@adobe/aio-lib-core-tvm

4.0.2 • Public • Published

Version Downloads/week Node.js CI License Codecov Coverage

Adobe I/O Lib Core Token Vending Machine

A JS client to access the token vending machine.

For more details on the server side, goto adobe/aio-tvm

Install

npm install @adobe/aio-lib-core-tvm

Use

const TvmClient = require('@adobe/aio-lib-core-tvm')
// init
const tvm = await TvmClient.init({ ow: { auth: '<myauth>', namespace: '<mynamespace>' } })
// init with retryOptions
const tvm = await TvmClient.init({ ow: { auth: '<myauth>', namespace: '<mynamespace>' }, retryOptions: { maxRetries: 5, initialDelayInMillis: 100} })

// aws s3
const awsS3Credentials = await tvm.getAwsS3Credentials()
const aws = require('aws-sdk')
const s3 = new aws.S3(awsS3Credentials)
// ...operations on s3 object

// azure blob
const azureBlobCredentials = await tvm.getAzureBlobCredentials()
const azure = require('@azure/storage-blob')
const azureCreds = new azure.AnonymousCredential()
const pipeline = azure.newPipeline(azureCreds)
const containerClientPrivate = new azure.ContainerClient(azureBlobCredentials.sasURLPrivate, pipeline)
const containerClientPublic = new azure.ContainerClient(azureBlobCredentials.sasURLPublic, pipeline)
// ...operations on containerClientPrivate and containerClientPublic

// azure cosmos
const azureCosmosCredentials = await tvm.getAzureCosmosCredentials()
const cosmos = require('@azure/cosmos')
const container = new cosmos.CosmosClient({ endpoint: azureCosmosCredentials.endpoint, tokenProvider: async () => azureCosmosCredentials.resourceToken })
                            .database(azureCosmosCredentials.databaseId)
                            .container(azureCosmosCredentials.containerId)
const data = await container.item('<itemKey>', azureCosmosCredentials.partitionKey).read()
// ...operations on items within azureCosmosCredentials.partitionKey

Explore

goto API

Debug

set DEBUG=@adobe/aio-lib-core-tvm* to see debug logs.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Package Sidebar

Install

npm i @adobe/aio-lib-core-tvm

Weekly Downloads

8,279

Version

4.0.2

License

Apache-2.0

Unpacked Size

34 kB

Total Files

5

Last publish

Collaborators

  • dylandepass
  • djaeggi
  • adobehalls
  • fullcolorcoder
  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • korra
  • rofe
  • kptdobe