Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/aio-lib-runtime

Package Overview
Dependencies
Maintainers
21
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/aio-lib-runtime

Adobe I/O Runtime Lib

  • 3.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
decreased by-49.57%
Maintainers
21
Weekly downloads
 
Created
Source

Version Downloads/week Node.js CI License Codecov Coverage

Adobe I/O Runtime Lib

Installing

$ npm install @adobe/aio-lib-runtime

Usage

  1. Initialize the SDK
const sdk = require('@adobe/aio-lib-runtime')

async function sdkTest() {
  //initialize sdk
  const client = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
}
  1. Call methods using the initialized SDK
const sdk = require('@adobe/aio-lib-runtime')

async function sdkTest() {
  // initialize sdk
  const client = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')

  // call methods
  try {
    // get... something
    const result = await client.getSomething({})
    console.log(result)

  } catch (e) {
    console.error(e)
  }
}

Classes

LogForwarding

Log Forwarding management API

LogForwardingLocalDestinationsProvider

Log Forwarding destination provider

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Triggers

Functions

prepareToBuildAction(zipFileName, action, root, dist)Promise.<ActionBuild>

Will return data about an action ready to be built.

zipActions(buildsList, lastBuildsPath, skipCheck)Array.<string>

Will zip actions. By default only actions which were not built before will be zipped. Last built actions data will be used to validate which action needs zipping.

deployActions(config, [deployConfig], [logFunc])Promise.<object>

runs the command

deployWsk(scriptConfig, manifestContent, logFunc, filterEntities)Promise.<object>
init(options)Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

printActionLogs(config, logger, limit, filterActions, strip, tail, fetchLogsInterval, startTime)object

Prints action logs.

undeployActions(config, [logFunc])
undeployWsk(packageName, manifestContent, owOptions, logger)Promise.<void>
getIncludesForAction(action)Promise.<Array.<IncludeEntry>>

Gets the list of files matching the patterns defined by action.include

printLogs(activation, strip, logger)

Prints activation logs messages.

printFilteredActionLogs(runtime, logger, limit, filterActions, strip, startTime)object

Filters and prints action logs.

getActionEntryFile(pkgJsonPath)string

returns path to main function as defined in package.json OR default of index.js note: file MUST exist, caller's responsibility, this method will throw if it does not exist

zip(filePath, out, pathInZip)Promise

Zip a file/folder using archiver

createKeyValueObjectFromArray(inputsArray)object

returns key value pairs in an object from the key value array supplied. Used to create parameters object.

createKeyValueArrayFromObject(object)Array

returns key value array from the object supplied.

safeParse(val)object

returns JSON.parse of passed object, but handles exceptions, and numeric strings

createKeyValueArrayFromFlag(flag)Array

returns key value array from the parameters supplied. Used to create --param and --annotation key value pairs

createKeyValueArrayFromFile(file)Array

returns key value array from the json file supplied. Used to create --param-file and annotation-file key value pairs

createKeyValueObjectFromFlag(flag)object

returns key value pairs in an object from the parameters supplied. Used to create --param and --annotation key value pairs

parsePackageName(name)object

parses a package name string and returns the namespace and entity name for a package

getKeyValueArrayFromMergedParameters(params, paramFilePath)Array

returns key value array from the params and/or param-file supplied with more precendence to params.

getKeyValueObjectFromMergedParameters(params, paramFilePath)object

returns key value object from the params and/or param-file supplied with more precendence to params.

createKeyValueObjectFromFile(file)object

returns key value pairs from the parameters supplied. Used to create --param-file and --annotation-file key value pairs

createComponentsFromSequence(sequenceAction)object

Creates an object representation of a sequence.

createComponentsFromSequence(sequenceAction)object
returnUnion(firstObject, secondObject)object

Creates a union of two objects

parsePathPattern(path)Array

Parse a path pattern

processInputs(input, params)object

Process inputs

createKeyValueInput(input)object

Create a key-value object from the input

getDeploymentPath()string

Get the deployment yaml file path

getManifestPath()string

Get the manifest yaml file path

returnDeploymentTriggerInputs(deploymentPackages)object

Get the deployment trigger inputs.

returnAnnotations(action)object

Get the annotations for an action

createApiRoutes(pkg, pkgName, apiName, allowedActions, allowedSequences, pathOnly)Array.<OpenWhiskEntitiesRoute>

Creates an array of route definitions from the given manifest-based package. See https://github.com/apache/openwhisk-wskdeploy/blob/master/parsers/manifest_parser.go#L1187

createSequenceObject(fullName, manifestSequence, packageName)OpenWhiskEntitiesAction

Create a sequence object that is compatible with the OpenWhisk API from a parsed manifest object

checkWebFlags(flag)object

Check the web flags

createActionObject(fullName, manifestAction)OpenWhiskEntitiesAction

Create an action object compatible with the OpenWhisk API from an action object parsed from the manifest.

processPackage(packages, deploymentPackages, deploymentTriggers, params, [namesOnly], [owOptions])OpenWhiskEntities

Process the manifest and deployment content and returns deployment entities.

setPaths(flags)DeploymentFileComponents

Get the deployment file components.

setupAdobeAuth(actions, owOptions, imsOrgId)

Handle Adobe auth action dependency

This is a temporary solution and needs to be removed when headless apps will be able to validate against app-registry

This function stores the IMS organization id in the Adobe I/O cloud state library which is required by the headless validator.

The IMS org id must be stored beforehand in @adobe/aio-lib-core-config under the 'project.org.ims_org_id' key. TODO: pass in imsOrgId

deployPackage(entities, ow, logger, imsOrgId)

Deploy all processed entities: can deploy packages, actions, triggers, rules and apis.

undeployPackage(entities, ow, logger)

Undeploy all processed entities: can undeploy packages, actions, triggers, rules and apis. Entity definitions do not need to be complete, only the names are needed for un-deployment.

syncProject(projectName, manifestPath, manifestContent, entities, ow, logger, imsOrgId, deleteEntities)

Sync a project. This is a higher level function that can be used to sync a local manifest with deployed entities.

syncProject doesn't only deploy entities it might also undeploy entities that are not defined in the manifest. This behavior can be disabled via the deleteEntities boolean parameter.

getProjectEntities(project, isProjectHash, ow)Promise.<OpenWhiskEntities>

Get deployed entities for a managed project. This methods retrieves all the deployed entities for a given project name or project hash. This only works if the project was deployed using the whisk-managed annotation. This annotation can be set pre-deployement using [addManagedProjectAnnotations](#addmanagedprojectannotations).

Note that returned apis will always be empty as they don't support annotations and hence are not managed as part of a project.

addManagedProjectAnnotations(entities, manifestPath, projectName, projectHash)

Add the whisk-managed annotation to processed entities. This is needed for syncing managed projects.

getProjectHash(manifestContent)string

Compute the project hash based on the manifest content string. This is used for syncing managed projects.

findProjectHashOnServer(ow, projectName)Promise.<string>

Retrieve the project hash from a deployed managed project.

findProjectHashOnServer(ow, projectName)Promise.<string>

Retrieve the project hash from a deployed managed project.

_relApp(root, p)string

Path relative to the root

_absApp(root, p)string

Absolute path

checkOpenWhiskCredentials(config)

Checks the existence of required openwhisk credentials

getActionUrls(appConfig, isRemoteDev, isLocalDev)object

Returns action URLs based on the manifest config

urlJoin(...args)string

Joins url path parts

removeProtocolFromURL(url)string
replacePackagePlaceHolder(config)object
validateActionRuntime(action)

Checks the validity of nodejs version in action definition and throws an error if invalid.

getActionZipFileName(pkgName, actionName, defaultPkg)string

Returns the action's build file name without the .zip extension

getActionNameFromZipFile(zipFile)string

Returns the action name based on the zipFile name.

activationLogBanner(logFunc, activation, activationLogs)

Creates an info banner for an activation.

actionBuiltBefore(lastBuildsData, actionBuildData)boolean

Will tell if the action was built before based on it's contentHash.

dumpActionsBuiltInfo(lastBuiltActionsPath, actionBuildData, prevBuildData)Promise.<boolean>

Will dump the previously actions built data information.

Typedefs

ActionBuild : object
OpenwhiskOptions : object
OpenwhiskRetryOptions : object
OpenwhiskClient : object
ManifestPackages : Array.<ManifestPackage>

The entry point to the information read from the manifest, this can be extracted using setPaths.

ManifestPackage : object

The manifest package definition

ManifestAction : object

The manifest action definition

IncludeEntry : object
ManifestSequence : object

The manifest sequence definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_sequences.md

ManifestTrigger : object

The manifest trigger definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_triggers.md

ManifestRule : object

The manifest rule definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_rules.md

ManifestDependency : object

The manifest dependency definition TODO

OpenWhiskEntities : object

The OpenWhisk entities definitions, which are compatible with the openwhisk node client module. Can be obtained using (processpackage)[#processpackage] (with onlyNames=true for un-deployment)

OpenWhiskEntitiesRoute : object

The api entity definition

OpenWhiskEntitiesAction : object

The action entity definition TODO

OpenWhiskEntitiesRule : object

The rule entity definition TODO

OpenWhiskEntitiesTrigger : object

The trigger entity definition TODO

OpenWhiskEntitiesPackage : object

The package entity definition TODO

DeploymentPackages : Array.<object>

The entry point to the information read from the deployment file, this can be extracted using setPaths. TODO

DeploymentFileComponents : object

LogForwarding

Log Forwarding management API

Kind: global class

logForwarding.get() ⇒ Promise.<*>

Get current Log Forwarding settings

Kind: instance method of LogForwarding
Returns: Promise.<*> - response from get API

logForwarding.setAdobeIoRuntime() ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Adobe I/O Runtime (default behavior)

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

logForwarding.setAzureLogAnalytics(customerId, sharedKey, logType) ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Azure Log Analytics

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

ParamTypeDescription
customerIdstringcustomer ID
sharedKeystringshared key
logTypestringlog type

logForwarding.setSplunkHec(host, port, index, hecToken) ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Splunk HEC

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

ParamTypeDescription
hoststringhost
portstringport
indexstringindex
hecTokenstringhec token

logForwarding.getSupportedDestinations() ⇒ Array.<object>

Get supported destinations

Kind: instance method of LogForwarding
Returns: Array.<object> - in format: { value: , name: }

logForwarding.getDestinationSettings(destination) ⇒ Array.<object>

Get destination settings

Kind: instance method of LogForwarding
Returns: Array.<object> - in format: { name: , message: [, type: ] }

ParamTypeDescription
destinationstringDestination name

logForwarding.setDestination(destination, config) ⇒ Promise.<*>

Configure destination

Kind: instance method of LogForwarding
Returns: Promise.<*> - response from set API

ParamTypeDescription
destinationstringDestination name
configobjectvalue-pairs of settings, specific to the destination

logForwarding.getErrors() ⇒ object

Get log forwarding errors

Kind: instance method of LogForwarding
Returns: object - Errors in format { destination: '', errors: [] }

LogForwardingLocalDestinationsProvider

Log Forwarding destination provider

Kind: global class

logForwardingLocalDestinationsProvider.getSupportedDestinations() ⇒ Array.<object>

Get supported destinations

Kind: instance method of LogForwardingLocalDestinationsProvider
Returns: Array.<object> - in format: { value: , name: }

logForwardingLocalDestinationsProvider.getDestinationSettings(destination) ⇒ Array.<object>

Get destination settings

Kind: instance method of LogForwardingLocalDestinationsProvider
Returns: Array.<object> - in format: { name: , message: [, type: ] }

ParamTypeDescription
destinationstringDestination name

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Kind: global class

runtimeAPI.init(options) ⇒ Promise.<OpenwhiskClient>

Initializes a RuntimeAPI object and returns it.

Kind: instance method of RuntimeAPI
Returns: Promise.<OpenwhiskClient> - a RuntimeAPI object

ParamTypeDescription
optionsOpenwhiskOptionsoptions for initialization

Triggers

Kind: global class

new Triggers()

A class to manage triggers

triggers.create(options) ⇒ Promise.<object>

Creates a trigger and associated feeds

Kind: instance method of Triggers
Returns: Promise.<object> - the result of the create operation

ParamTypeDescription
optionsobjectinput options to create the trigger from manifest

triggers.delete(options) ⇒ Promise.<object>

Deletes a trigger and associated feeds

Kind: instance method of Triggers
Returns: Promise.<object> - the result of the delete operation

ParamTypeDescription
optionsobjectoptions with the name of the trigger

prepareToBuildAction(zipFileName, action, root, dist) ⇒ Promise.<ActionBuild>

Will return data about an action ready to be built.

Kind: global function
Returns: Promise.<ActionBuild> - Relevant data for the zip process..

ParamTypeDescription
zipFileNamestringthe action's build file name without the .zip extension.
actionobjectData about the Action.
rootstringroot of the project.
diststringPath to the minimized version of the action code

zipActions(buildsList, lastBuildsPath, skipCheck) ⇒ Array.<string>

Will zip actions. By default only actions which were not built before will be zipped. Last built actions data will be used to validate which action needs zipping.

Kind: global function
Returns: Array.<string> - Array of zipped actions.

ParamTypeDescription
buildsListArray.<ActionBuild>Array with data about actions available to be zipped.
lastBuildsPathstringPath to the last built actions data.
skipCheckbooleanwhen true will zip all the actions from the buildsList

deployActions(config, [deployConfig], [logFunc]) ⇒ Promise.<object>

runs the command

Kind: global function
Returns: Promise.<object> - deployedEntities

ParamTypeDefaultDescription
configobjectapp config
[deployConfig]object{}deployment config
[deployConfig.isLocalDev]booleanlocal dev flag
[deployConfig.filterEntities]objectadd filters to deploy only specified OpenWhisk entities
[deployConfig.filterEntities.actions]Arrayfilter list of actions to deploy by provided array, e.g. ['name1', ..]
[deployConfig.filterEntities.byBuiltActions]booleanif true, trim actions from the manifest based on the already built actions
[deployConfig.filterEntities.sequences]Arrayfilter list of sequences to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.triggers]Arrayfilter list of triggers to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.rules]Arrayfilter list of rules to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.apis]Arrayfilter list of apis to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.dependencies]Arrayfilter list of package dependencies to deploy, e.g. ['name1', ..]
[logFunc]objectcustom logger function

deployWsk(scriptConfig, manifestContent, logFunc, filterEntities) ⇒ Promise.<object>

Kind: global function
Returns: Promise.<object> - deployedEntities

ParamTypeDescription
scriptConfigobjectconfig
manifestContentobjectmanifest
logFuncobjectcustom logger function
filterEntitiesobjectentities (actions, sequences, triggers, rules etc) to be filtered

deployWsk~_filterOutPackageEntity(pkgName, pkgEntity, filterItems, fullNameCheck) ⇒ object

Kind: inner method of deployWsk
Returns: object - package object containing only the filterItems

ParamTypeDescription
pkgNameobjectname of the package
pkgEntityobjectpackage object from the manifest
filterItemsobjectitems (actions, sequences, triggers, rules etc) to be filtered
fullNameCheckbooleantrue if the items are part of packages (actions and sequences)

init(options) ⇒ Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

Kind: global function
Returns: Promise.<OpenwhiskClient> - a Promise with a RuntimeAPI object

ParamTypeDescription
optionsOpenwhiskOptionsoptions for initialization

printActionLogs(config, logger, limit, filterActions, strip, tail, fetchLogsInterval, startTime) ⇒ object

Prints action logs.

Kind: global function
Returns: object - activation timestamp of the last retrieved activation or null

ParamTypeDefaultDescription
configobjectopenwhisk config
loggerobjectan instance of a logger to emit messages to
limitnumbermaximum number of activations to fetch logs from
filterActionsArrayarray of actions to fetch logs from examples:- ['pkg1/'] = logs of all deployed actions under package pkg1 ['pkg1/action'] = logs of action 'action' under package 'pkg1' [] = logs of all actions in the namespace
stripbooleanif true, strips the timestamp which prefixes every log line
tailbooleanfalseif true, logs are fetched continuously
fetchLogsIntervalnumber10000number of seconds to wait before fetching logs again when tail is set to true
startTimenumbertime in milliseconds. Only logs after this time will be fetched

undeployActions(config, [logFunc])

Kind: global function

ParamTypeDescription
configobjectapp config
[logFunc]objectcustom logger function

undeployWsk(packageName, manifestContent, owOptions, logger) ⇒ Promise.<void>

Kind: global function
Returns: Promise.<void> - void

ParamTypeDescription
packageNamestringname of the package to be undeployed
manifestContentobjectmanifest
owOptionsobjectopenwhisk options
loggerobjectcustom logger function

getIncludesForAction(action) ⇒ Promise.<Array.<IncludeEntry>>

Gets the list of files matching the patterns defined by action.include

Kind: global function
Returns: Promise.<Array.<IncludeEntry>> - list of files matching the patterns defined by action.include

ParamTypeDescription
actionManifestActionaction object from manifest which defines includes

printLogs(activation, strip, logger)

Prints activation logs messages.

Kind: global function

ParamTypeDescription
activationobjectthe activation
stripbooleanif true, strips the timestamp which prefixes every log line
loggerobjectan instance of a logger to emit messages to

printFilteredActionLogs(runtime, logger, limit, filterActions, strip, startTime) ⇒ object

Filters and prints action logs.

Kind: global function
Returns: object - activation timestamp of the last retrieved activation or null

ParamTypeDefaultDescription
runtimeobjectruntime (openwhisk) object
loggerobjectan instance of a logger to emit messages to (may optionally provide logFunc and bannerFunc to customize logging)
limitnumbermaximum number of activations to fetch logs from
filterActionsArrayarray of actions to fetch logs from ['pkg1/'] = logs of all deployed actions under package pkg1 ['pkg1/action'] = logs of action 'action' under package 'pkg1' [] = logs of all actions in the namespace
stripbooleanfalseif true, strips the timestamp which prefixes every log line
startTimenumber0time in milliseconds. Only logs after this time will be fetched

printFilteredActionLogs~isSequenceActivation(activation) ⇒ boolean

Check if an activation entry is for a sequence.

Kind: inner method of printFilteredActionLogs
Returns: boolean - isSequenceActivation

ParamTypeDescription
activation*activation log entry

printFilteredActionLogs~printActivationLogs(activation, runtime)

Print activation logs

Kind: inner method of printFilteredActionLogs

ParamTypeDescription
activationobjectactivation object
runtimeobjectruntime object

printFilteredActionLogs~printSequenceLogs(activation, runtime)

Print sequence logs

Kind: inner method of printFilteredActionLogs

ParamTypeDescription
activationobjectsequence activation
runtimeobjectruntime object

printFilteredActionLogs~printLogs(activation, runtime)

Print logs

Kind: inner method of printFilteredActionLogs

ParamTypeDescription
activationobjectactivation
runtimeobjectruntime

getActionEntryFile(pkgJsonPath) ⇒ string

returns path to main function as defined in package.json OR default of index.js note: file MUST exist, caller's responsibility, this method will throw if it does not exist

Kind: global function
Returns: string - path to the entry file

ParamTypeDescription
pkgJsonPathstring: path to a package.json file

zip(filePath, out, pathInZip) ⇒ Promise

Zip a file/folder using archiver

Kind: global function
Returns: Promise - returns with a blank promise when done

ParamTypeDefaultDescription
filePathstringpath of file.folder to zip
outstringoutput path
pathInZipbooleanfalseinternal path in zip

createKeyValueObjectFromArray(inputsArray) ⇒ object

returns key value pairs in an object from the key value array supplied. Used to create parameters object.

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

ParamTypeDescription
inputsArrayArrayArray in the form of [{'key':'key1', 'value': 'value1'}]

createKeyValueArrayFromObject(object) ⇒ Array

returns key value array from the object supplied.

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

ParamTypeDescription
objectobjectJSON object

safeParse(val) ⇒ object

returns JSON.parse of passed object, but handles exceptions, and numeric strings

Kind: global function
Returns: object - the parsed object

ParamTypeDescription
valstringvalue to parse

createKeyValueArrayFromFlag(flag) ⇒ Array

returns key value array from the parameters supplied. Used to create --param and --annotation key value pairs

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

ParamTypeDescription
flagArrayvalue from flags.param or flags.annotation

createKeyValueArrayFromFile(file) ⇒ Array

returns key value array from the json file supplied. Used to create --param-file and annotation-file key value pairs

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

ParamTypeDescription
filestringfrom flags['param-file'] or flags['annotation-file]

createKeyValueObjectFromFlag(flag) ⇒ object

returns key value pairs in an object from the parameters supplied. Used to create --param and --annotation key value pairs

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

ParamTypeDescription
flagArrayfrom flags.param or flags.annotation

parsePackageName(name) ⇒ object

parses a package name string and returns the namespace and entity name for a package

Kind: global function
Returns: object - An object { namespace: string, name: string }

ParamTypeDescription
namestringpackage name

getKeyValueArrayFromMergedParameters(params, paramFilePath) ⇒ Array

returns key value array from the params and/or param-file supplied with more precendence to params.

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

ParamTypeDescription
paramsArrayfrom flags.param or flags.annotation
paramFilePathstringfrom flags['param-file'] or flags['annotation-file']

getKeyValueObjectFromMergedParameters(params, paramFilePath) ⇒ object

returns key value object from the params and/or param-file supplied with more precendence to params.

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

ParamTypeDescription
paramsArrayfrom flags.param or flags.annotation
paramFilePathstringfrom flags['param-file'] or flags['annotation-file']

createKeyValueObjectFromFile(file) ⇒ object

returns key value pairs from the parameters supplied. Used to create --param-file and --annotation-file key value pairs

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

ParamTypeDescription
filestringfrom flags['param-file'] or flags['annotation-file']

createComponentsFromSequence(sequenceAction) ⇒ object

Creates an object representation of a sequence.

Kind: global function
Returns: object - the object representation of the sequence

ParamTypeDescription
sequenceActionArraythe sequence action array

createComponentsFromSequence(sequenceAction) ⇒ object

Deprecated

Kind: global function
Returns: object - the object representation of the sequence

ParamTypeDescription
sequenceActionArraythe sequence action array

returnUnion(firstObject, secondObject) ⇒ object

Creates a union of two objects

Kind: global function
Returns: object - the union of both objects

ParamTypeDescription
firstObjectobjectthe object to merge into
secondObjectobjectthe object to merge from

parsePathPattern(path) ⇒ Array

Parse a path pattern

Kind: global function
Returns: Array - array of matches

ParamTypeDescription
pathstringthe path to parse

processInputs(input, params) ⇒ object

Process inputs

Kind: global function
Returns: object - the processed inputs

ParamTypeDescription
inputobjectthe input object to process
paramsobjectthe parameters for the input to process

createKeyValueInput(input) ⇒ object

Create a key-value object from the input

Kind: global function
Returns: object - the processed input as a key-value object

ParamTypeDescription
inputobjectthe input to process

getDeploymentPath() ⇒ string

Get the deployment yaml file path

Kind: global function
Returns: string - the deployment yaml path

getManifestPath() ⇒ string

Get the manifest yaml file path

Kind: global function
Returns: string - the manifest yaml path

returnDeploymentTriggerInputs(deploymentPackages) ⇒ object

Get the deployment trigger inputs.

Kind: global function
Returns: object - the deployment trigger inputs

ParamTypeDescription
deploymentPackagesDeploymentPackagesthe deployment packages

returnAnnotations(action) ⇒ object

Get the annotations for an action

Kind: global function
Returns: object - the action annotation entities

ParamTypeDescription
actionManifestActionthe action manifest object

createApiRoutes(pkg, pkgName, apiName, allowedActions, allowedSequences, pathOnly) ⇒ Array.<OpenWhiskEntitiesRoute>

Creates an array of route definitions from the given manifest-based package. See https://github.com/apache/openwhisk-wskdeploy/blob/master/parsers/manifest_parser.go#L1187

Kind: global function
Returns: Array.<OpenWhiskEntitiesRoute> - the array of route entities

ParamTypeDescription
pkgManifestPackageThe package definition from the manifest.
pkgNamestringThe name of the package.
apiNamestringThe name of the HTTP API definition from the manifest.
allowedActionsArrayList of action names allowed to be used in routes.
allowedSequencesArrayList of sequence names allowed to be used in routes.
pathOnlybooleanSkip action, method and response type in route definitions.

createSequenceObject(fullName, manifestSequence, packageName) ⇒ OpenWhiskEntitiesAction

Create a sequence object that is compatible with the OpenWhisk API from a parsed manifest object

Kind: global function
Returns: OpenWhiskEntitiesAction - a sequence object describing the action entity

ParamTypeDescription
fullNamestringthe full sequence name prefixed with the package, e.g. pkg/sequence
manifestSequenceManifestSequencea sequence object as defined in a valid manifest file
packageNamestringthe package name of the sequence, which will be set to for actions in the sequence

checkWebFlags(flag) ⇒ object

Check the web flags

Kind: global function
Returns: object - object with the appropriate web flags for an action

ParamTypeDescription
flagstring | booleanthe flag to check

createActionObject(fullName, manifestAction) ⇒ OpenWhiskEntitiesAction

Create an action object compatible with the OpenWhisk API from an action object parsed from the manifest.

Kind: global function
Returns: OpenWhiskEntitiesAction - the action entity object

ParamTypeDescription
fullNamestringthe full action name prefixed with the package, e.g. pkg/action
manifestActionManifestActionthe action object as parsed from the manifest

processPackage(packages, deploymentPackages, deploymentTriggers, params, [namesOnly], [owOptions]) ⇒ OpenWhiskEntities

Process the manifest and deployment content and returns deployment entities.

Kind: global function
Returns: OpenWhiskEntities - deployment entities

ParamTypeDefaultDescription
packagesManifestPackagesthe manifest packages
deploymentPackagesDeploymentPackagesthe deployment packages
deploymentTriggersobjectthe deployment triggers
paramsobjectthe package params
[namesOnly]booleanfalseif false, set the namespaces as well
[owOptions]object{}additional OpenWhisk options

setPaths(flags) ⇒ DeploymentFileComponents

Get the deployment file components.

Kind: global function
Returns: DeploymentFileComponents - fileComponents

ParamTypeDescription
flagsobject(manifest + deployment)

setupAdobeAuth(actions, owOptions, imsOrgId)

Handle Adobe auth action dependency

This is a temporary solution and needs to be removed when headless apps will be able to validate against app-registry

This function stores the IMS organization id in the Adobe I/O cloud state library which is required by the headless validator.

The IMS org id must be stored beforehand in @adobe/aio-lib-core-config under the 'project.org.ims_org_id' key. TODO: pass in imsOrgId

Kind: global function

ParamTypeDescription
actionsArray.<OpenWhiskEntitiesAction>the array of action deployment entities
owOptionsobjectOpenWhisk options
imsOrgIdstringthe IMS Org Id

deployPackage(entities, ow, logger, imsOrgId)

Deploy all processed entities: can deploy packages, actions, triggers, rules and apis.

Kind: global function

ParamTypeDescription
entitiesOpenWhiskEntitiesActionthe processed entities
owobjectthe OpenWhisk client
loggerobjectthe logger
imsOrgIdstringthe IMS Org ID

undeployPackage(entities, ow, logger)

Undeploy all processed entities: can undeploy packages, actions, triggers, rules and apis. Entity definitions do not need to be complete, only the names are needed for un-deployment.

Kind: global function

ParamTypeDescription
entitiesobjectthe processed entities, only names are enough for undeploy
owobjectthe OpenWhisk object
loggerobjectthe logger

syncProject(projectName, manifestPath, manifestContent, entities, ow, logger, imsOrgId, deleteEntities)

Sync a project. This is a higher level function that can be used to sync a local manifest with deployed entities.

syncProject doesn't only deploy entities it might also undeploy entities that are not defined in the manifest. This behavior can be disabled via the deleteEntities boolean parameter.

Kind: global function

ParamTypeDefaultDescription
projectNamestringthe project name
manifestPathstringthe manifest path
manifestContentstringthe manifest content, needed to compute hash
entitiesOpenWhiskEntitiesthe entities, extracted via processPackage
owobjectthe OpenWhisk object
loggerobjectthe logger
imsOrgIdstringthe IMS Org ID
deleteEntitiesbooleantrueset to true to delete entities

getProjectEntities(project, isProjectHash, ow) ⇒ Promise.<OpenWhiskEntities>

Get deployed entities for a managed project. This methods retrieves all the deployed entities for a given project name or project hash. This only works if the project was deployed using the whisk-managed annotation. This annotation can be set pre-deployement using [addManagedProjectAnnotations](#addmanagedprojectannotations).

Note that returned apis will always be empty as they don't support annotations and hence are not managed as part of a project.

Kind: global function
Returns: Promise.<OpenWhiskEntities> - the deployed project entities

ParamTypeDescription
projectstringthe project name or hash
isProjectHashbooleanset to true if the project is a hash, and not the name
owobjectthe OpenWhisk client object

addManagedProjectAnnotations(entities, manifestPath, projectName, projectHash)

Add the whisk-managed annotation to processed entities. This is needed for syncing managed projects.

Kind: global function

ParamTypeDescription
entitiesOpenWhiskEntitiesthe processed entities
manifestPathstringthe manifest path
projectNamestringthe project name
projectHashstringthe project hash

getProjectHash(manifestContent) ⇒ string

Compute the project hash based on the manifest content string. This is used for syncing managed projects.

Kind: global function
Returns: string - the project hash

ParamTypeDescription
manifestContentstringthe manifest content

findProjectHashOnServer(ow, projectName) ⇒ Promise.<string>

Retrieve the project hash from a deployed managed project.

Kind: global function
Returns: Promise.<string> - the project hash, or '' if not found

ParamTypeDescription
owobjectthe OpenWhisk client object
projectNamestringthe project name

findProjectHashOnServer(ow, projectName) ⇒ Promise.<string>

Deprecated

Retrieve the project hash from a deployed managed project.

Kind: global function
Returns: Promise.<string> - the project hash, or '' if not found

ParamTypeDescription
owobjectthe OpenWhisk client object
projectNamestringthe project name

_relApp(root, p) ⇒ string

Path relative to the root

Kind: global function
Returns: string - relative path

ParamTypeDescription
rootstringroot path
pstringpath

_absApp(root, p) ⇒ string

Absolute path

Kind: global function
Returns: string - absolute path

ParamTypeDescription
rootstringroot path
pstringpath

checkOpenWhiskCredentials(config)

Checks the existence of required openwhisk credentials

Kind: global function

ParamTypeDescription
configobjectopenwhisk config

getActionUrls(appConfig, isRemoteDev, isLocalDev) ⇒ object

Returns action URLs based on the manifest config

Kind: global function
Returns: object - urls of actions

ParamTypeDefaultDescription
appConfigobjectapp config
isRemoteDevbooleanfalseremote dev
isLocalDevbooleanfalselocal dev

urlJoin(...args) ⇒ string

Joins url path parts

Kind: global function
Returns: string - joined url

ParamTypeDescription
...argsstringurl parts

removeProtocolFromURL(url) ⇒ string

Kind: global function
Returns: string - url

ParamTypeDescription
urlstringurl

replacePackagePlaceHolder(config) ⇒ object

Kind: global function
Returns: object - sanitized config

ParamTypeDescription
configobjectconfig

validateActionRuntime(action)

Checks the validity of nodejs version in action definition and throws an error if invalid.

Kind: global function

ParamTypeDescription
actionobjectaction object

getActionZipFileName(pkgName, actionName, defaultPkg) ⇒ string

Returns the action's build file name without the .zip extension

Kind: global function
Returns: string - name of zip file for the action contents

ParamTypeDescription
pkgNamestringname of the package
actionNamestringname of the action
defaultPkgbooleantrue if pkgName is the default/first package

getActionNameFromZipFile(zipFile) ⇒ string

Returns the action name based on the zipFile name.

Kind: global function
Returns: string - name of the action

ParamTypeDescription
zipFilestringname of the zip file

activationLogBanner(logFunc, activation, activationLogs)

Creates an info banner for an activation.

Kind: global function

ParamTypeDescription
logFuncobjectcustom logger function
activationobjectactivation metadata
activationLogsArray.<string>the logs of the activation (may selectively suppress banner if there are no log lines)

actionBuiltBefore(lastBuildsData, actionBuildData) ⇒ boolean

Will tell if the action was built before based on it's contentHash.

Kind: global function
Returns: boolean - true if the action was built before

ParamTypeDescription
lastBuildsDatastringData with the last builds
actionBuildDataobjectObject which contains action name and contentHash.

dumpActionsBuiltInfo(lastBuiltActionsPath, actionBuildData, prevBuildData) ⇒ Promise.<boolean>

Will dump the previously actions built data information.

Kind: global function
Returns: Promise.<boolean> - If the contentHash already belongs to the deploymentLogs file

ParamTypeDescription
lastBuiltActionsPathstringPath to the deployments logs
actionBuildDataobjectObject which contains action name and contentHash.
prevBuildDataobjectObject which contains info about all the previously built actions

ActionBuild : object

Kind: global typedef
Properties

NameTypeDescription
outPathstringzip output path
actionBuildDataobjectObject where key is the name of the action and value is its contentHash
tempBuildDirstringpath of temp build
tempActionNamestringname of the action file.

OpenwhiskOptions : object

Kind: global typedef
Properties

NameTypeDescription
apihoststringHostname and optional port for openwhisk platform
api_keystringAuthorisation key
[api]stringFull API URL
[apiversion]stringApi version
[namespace]stringNamespace for resource requests
[ignore_certs]booleanTurns off server SSL/TLS certificate verification
[key]stringClient key to use when connecting to the apihost
[retry]OpenwhiskRetryOptionsthe retry options. Defaults to 2 retries, with a 200ms minTimeout.

OpenwhiskRetryOptions : object

Kind: global typedef
Properties

NameTypeDescription
retriesnumberthe number of retries for an OpenWhisk call
minTimeoutnumberthe minimum number of milliseconds to wait before a retry

OpenwhiskClient : object

Kind: global typedef
Properties

NameTypeDescription
actionsow.Actionsactions
activationsow.Activationsactivations
namespacesow.Namespacesnamespaces
packagesow.Packagespackages
rulesow.Rulesrules
triggersow.Triggerstriggers
routesow.Routesroutes
logForwardingLogForwardingLog Forwarding management API

ManifestPackages : Array.<ManifestPackage>

The entry point to the information read from the manifest, this can be extracted using setPaths.

Kind: global typedef

ManifestPackage : object

The manifest package definition

Kind: global typedef
Properties

NameTypeDescription
versionstringthe manifest package version
[license]stringthe manifest package license, e.g. Apache-2.0
[actions]Array.<ManifestAction>Actions in the manifest package
[sequences]Array.<ManifestSequence>Sequences in the manifest package
[triggers]Array.<ManifestTrigger>Triggers in the manifest package
[rules]Array.<ManifestRule>Rules in the manifest package
[dependencies]Array.<ManifestDependency>Dependencies in the manifest package
[apis]Array.<object>Apis in the manifest package

ManifestAction : object

The manifest action definition

Kind: global typedef
Properties

NameTypeDescription
[version]stringthe manifest action version
functionstringthe path to the action code
runtimestringthe runtime environment or kind in which the action executes, e.g. 'nodejs:12'
[main]stringthe entry point to the function
[inputs]objectthe list of action default parameters
[limits]Array.<object>limits for the action
[web]stringindicate if an action should be exported as web, can take the value of: true
[web-export]stringsame as web
[raw-http]booleanindicate if an action should be exported as raw web action, this option is only valid if web or web-export is set to true
[docker]stringthe docker container to run the action into
[annotations]Array.<object>the manifest action annotations

IncludeEntry : object

Kind: global typedef
Properties

NameTypeDescription
deststringdestination for included files
sourcesArraylist of files that matched pattern

ManifestSequence : object

The manifest sequence definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_sequences.md

Kind: global typedef
Properties

NameTypeDescription
actionsstringComma separated list of actions in the sequence

ManifestTrigger : object

The manifest trigger definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_triggers.md

Kind: global typedef
Properties

NameTypeDescription
[inputs]objectinputs like cron and trigger_payload
[feed]stringfeed associated with the trigger.
[annotations]objectannotations

ManifestRule : object

The manifest rule definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_rules.md

Kind: global typedef
Properties

NameTypeDescription
triggerstringtrigger name
actionstringaction name

ManifestDependency : object

The manifest dependency definition TODO

Kind: global typedef
Properties

NameTypeDescription
locationstringpackage to bind to
[inputs]objectpackage parameters

OpenWhiskEntities : object

The OpenWhisk entities definitions, which are compatible with the openwhisk node client module. Can be obtained using (processpackage)[#processpackage] (with onlyNames=true for un-deployment)

Kind: global typedef
Properties

NameTypeDescription
apisArray.<OpenWhiskEntitiesRoute>the array of route entities
actionsArray.<OpenWhiskEntitiesAction>the array of action entities
triggersArray.<OpenWhiskEntitiesTrigger>the array of trigger entities
rulesArray.<OpenWhiskEntitiesRule>the array of rule entities
pkgAndDepsArray.<OpenWhiskEntitiesPackage>the array of package entities

OpenWhiskEntitiesRoute : object

The api entity definition

Kind: global typedef
Properties

NameTypeDescription
namestringthe api name
basepathstringthe api basepath
relpathstringthe api relpath
actionstringthe action name behind the api
responsettypestringthe response type, e.g. 'json'
operationstringthe http method, e.g 'get'

OpenWhiskEntitiesAction : object

The action entity definition TODO

Kind: global typedef
Properties

NameTypeDescription
actionstringblank
namestringname
execobjectexec object

OpenWhiskEntitiesRule : object

The rule entity definition TODO

Kind: global typedef
Properties

NameTypeDescription
triggerstringtrigger name
actionstringaction name

OpenWhiskEntitiesTrigger : object

The trigger entity definition TODO

Kind: global typedef
Properties

NameTypeDescription
[feed]stringfeed associated with the trigger
[annotations]objectannotations
[parameters]objectparameters

OpenWhiskEntitiesPackage : object

The package entity definition TODO

Kind: global typedef
Properties

NameTypeDescription
[publish]booleantrue for shared package
[parameters]objectparameters

DeploymentPackages : Array.<object>

The entry point to the information read from the deployment file, this can be extracted using setPaths. TODO

Kind: global typedef

DeploymentFileComponents : object

Kind: global typedef
Properties

NameTypeDescription
packagesManifestPackagesPackages in the manifest
deploymentTriggersobjectTrigger names and their inputs in the deployment manifest
deploymentPackagesDeploymentPackagesPackages in the deployment manifest
manifestPathstringPath to manifest
manifestContentobjectParsed manifest object
projectNamestringName of the project

Debug Logs

LOG_LEVEL=debug <your_call_here>

Prepend the LOG_LEVEL environment variable and debug value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.

Contributing

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

Licensing

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

FAQs

Package last updated on 25 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc