@serverless/client

The Serverless Platform Client makes it easy to access all Serverless Platform Services, wherever they are hosted.

Usage no npm install needed!

<script type="module">
  import serverlessClient from 'https://cdn.skypack.dev/@serverless/client';
</script>

README

Serverless Platform Client

The Serverless Platform Client makes it easy to access all Serverless Platform Services, wherever they are hosted.

Registry

const { Registry } = require('@serverless/client')

const config = {
  accessKey: 'xxx', // required only if you need to make authenticated calls.
  endpoint: 'xxx' // required only if you're using a self hosted version of the platform.
  stage: 'dev' // optional and overwritten by the SERVERLESS_PLATFORM_STAGE. Default is prod
}
const registry = new Registry(config)

prePublish()

const { Registry } = require('@serverless/client')

const config = {
  accessKey: 'xxx', // required only if you need to make authenticated calls.
  endpoint: 'xxx' // required only if you're using a self hosted version of the platform.
  stage: 'dev' // optional and overwritten by the SERVERLESS_PLATFORM_STAGE. Default is prod
}
const registry = new Registry(config)

const component = {
  name: 'myComponent', // required
  version: '1.0.0', // if not provided, default is dev
  org: 'serverlessinc' // required
}

const res = await registry.prePublish(prePublishInputs)

// res.url - s3 url to upload the component package to
// res.method - method to use when uploading the component package

prePublish()

const { Registry } = require('@serverless/client')

const config = {
  accessKey: 'xxx', // required only if you need to make authenticated calls.
  endpoint: 'xxx' // required only if you're using a self hosted version of the platform.
  stage: 'dev' // optional and overwritten by the SERVERLESS_PLATFORM_STAGE. Default is prod
}
const registry = new Registry()

const component = {
  name: 'myComponent', // required
  version: '1.0.0', // if not provided, default is dev
  org: 'serverlessinc' // required
}

const res = await registry.prePublish(prePublishInputs)

// res.url - s3 url to upload the component package to
// res.method - method to use when uploading the component package