Installations
npm install @serverless/platform-sdk
Developer
serverless
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
14.10.1
NPM Version
6.14.8
Statistics
17 Stars
314 Commits
7 Forks
24 Watching
17 Branches
15 Contributors
Updated on 08 Sept 2023
Bundle Size
186.12 kB
Minified
50.57 kB
Minified + Gzipped
Languages
JavaScript (99%)
Shell (0.59%)
Dockerfile (0.41%)
Total Downloads
Cumulative downloads
Total Downloads
57,624,617
Last day
-13.1%
6,224
Compared to previous day
Last week
-0.2%
46,689
Compared to previous week
Last month
40.4%
161,975
Compared to previous month
Last year
-55.2%
1,781,214
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
14
Platform SDK (deprecated)
Note: This package is deprecated in favor of @serverless/platform-client. It accepts only bug fixes
Functional SDK for the Serverless Platfrom.
Project Status
Contents
installation
npm i -s @serverless/platform-sdk
Functions
login
Opens a browser for the user to login, along with a running server awaiting auth data once the user logs in.
Parameters
None
Returns
Promise resolving to the following object:
username
-string
- dashboard usernameaccessToken
-string
- Auth0 access tokenidToken
-string
- Auth0 idTokenrefreshToken
-string
- Auth0 refreshTokenexpiresAt
-string
- epoch time at which the idToken expires
Example
1const { login } = require('@serverless/platform-sdk') 2 3const { username, accessToken, idToken, expiresAt } = await login()
refreshToken
Refreshes Auth0 idToken
Parameters
refresh token string
Returns
Promise resolving to the following object:
id_token
-string
- new Auth0 id tokenaccess_token
-string
- new Auth0 access tokenexpires_in
-string
- number of seconds until token expiration
Example
1const { refreshToken } = require('@serverless/platform-sdk') 2 3const { id_token, access_token, expires_in } = await refreshToken('some-refresh-token')
createAccessKey
Creates a platform access key for the authenticated user.
Parameters
Object
username
-string
- dashboard usernametenant
-string
- dashboard tenantidToken
-string
- Auth0 idTokentitle
-string
- title of the access key
Returns
Promise resolving to an accessKey
string, that is the access key.
Example
1const { createAccessKey } = require('@serverless/platform-sdk') 2 3const data = { 4 username: 'eahefnawy', 5 tenant: 'eahefnawy', 6 idToken: 'abc', 7 title: 'Framework' 8} 9 10const accessKey = await createAccessKey(data)
archiveService
Archives a service in the platform.
Parameters
Object
tenant
-string
- dashboard tenantaccessKey
-string
- dashboard access keyapp
-string
- service appname
-string
- service nameprovider
-string
- provider nameregion
-string
- region name
Returns
None
Example
1const { archiveService } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 accessKey: 'abc', 6 app: 'my-app', 7 name: 'my-service', 8 provider: 'aws', 9 region: 'us-east-1' 10} 11 12await archiveService(data)
getServiceUrl
Constructs a service url based on passed-in data.
Parameters
Object
tenant
-string
- dashboard tenantapp
-string
- service appname
-string
- service name
Returns
The service url string.
Example
1const { getServiceUrl } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 app: 'my-app', 6 name: 'my-service' 7} 8 9const serviceUrl = getServiceUrl(data)
listTenants
Lists the tenants for a given username
Parameters
Object
username
-string
- dashboard usernameidToken
-string
- auth0 user id token
Returns
Array of objects, each represents a single tenant data model.
Example
1const { listTenants } = require('@serverless/platform-sdk') 2 3const data = { 4 username: 'eahefnawy', 5 idToken: 'abc' 6} 7 8const tenants = await listTenants(data)
createDeploymnet
Creates a platform deployment
Parameters
Object
tenant
-string
- dashboard tenant nameapp
-string
- app nameserviceName
-string
- service nameaccessKey
-string
- dashboard access keyfiles
-object
- files which should be stored in the Platforms deployment record
Returns
Object - Deployment model
Example
1const { createDeployment } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 app: 'my-app', 6 serviceName: 'my-service', 7 accessKey: 'abc', 8 files: { 9 'serverless-state.json': { 10 //...snip... 11 } 12 } 13} 14 15const { id } = await createDeployment(data)
updateDeployment
Updates a platform deployment
Parameters
Object
tenant
-string
- dashboard tenant nameapp
-string
- app nameserviceName
-string
- service namedeploymentId
-string
- id of the previously created deploymentstatus
-string
- status of the deployment to updateaccessKey
-string
- dashboard access keycomputedData
-object
- computed data the Platform needs to generate the state items
Returns
Object - Deployment model
Example
1const { updateDeployment } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 app: 'my-app', 6 serviceName: 'my-service', 7 deploymentId: 'abc', 8 status: 'failed', 9 accessKey: 'abc', 10 computedData: { 11 // ...snip... 12 } 13} 14 15const { id } = await updateDeployment(data)
getApp
Gets a platform app
Parameters
Object
tenant
-string
- dashboard tenant nameapp
-string
- app nametoken
-string
- Auth0 id token
Returns
Object - App model
Example
1const { getApp } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 app: 'my-app', 6 token: 'abc' 7} 8 9const app = await getApp(data)
createApp
Creates a platform app
Parameters
Object
tenant
-string
- dashboard tenant nameapp
-string
- app nametoken
-string
- Auth0 id token
Returns
Object - App model
Example
1const { createApp } = require('@serverless/platform-sdk') 2 3const data = { 4 tenant: 'eahefnawy', 5 app: 'my-app', 6 token: 'abc' 7} 8 9const app = await createApp(data)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
Found 9/13 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating ubuntu:latest to ubuntu:latest@sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295
- Warn: downloadThenRun not pinned by hash: Dockerfile:8
- Warn: npmCommand not pinned by hash: Dockerfile:9-12
- Warn: npmCommand not pinned by hash: scripts/setup-ci.sh:2
- Warn: npmCommand not pinned by hash: scripts/setup.sh:2
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 1 downloadThenRun dependencies pinned
- Info: 0 out of 3 npmCommand dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 26 are checked with a SAST tool
Score
4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More