UNPKG

faastjs

Version:

Serverless batch computing made simple.

1,119 lines 281 kB
{ "metadata": { "toolPackage": "@microsoft/api-extractor", "toolVersion": "7.19.2", "schemaVersion": 1004, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", "noStandardTags": true, "tagDefinitions": [ { "tagName": "@alpha", "syntaxKind": "modifier" }, { "tagName": "@beta", "syntaxKind": "modifier" }, { "tagName": "@defaultValue", "syntaxKind": "block" }, { "tagName": "@decorator", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@deprecated", "syntaxKind": "block" }, { "tagName": "@eventProperty", "syntaxKind": "modifier" }, { "tagName": "@example", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@experimental", "syntaxKind": "modifier" }, { "tagName": "@inheritDoc", "syntaxKind": "inline" }, { "tagName": "@internal", "syntaxKind": "modifier" }, { "tagName": "@label", "syntaxKind": "inline" }, { "tagName": "@link", "syntaxKind": "inline", "allowMultiple": true }, { "tagName": "@override", "syntaxKind": "modifier" }, { "tagName": "@packageDocumentation", "syntaxKind": "modifier" }, { "tagName": "@param", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@privateRemarks", "syntaxKind": "block" }, { "tagName": "@public", "syntaxKind": "modifier" }, { "tagName": "@readonly", "syntaxKind": "modifier" }, { "tagName": "@remarks", "syntaxKind": "block" }, { "tagName": "@returns", "syntaxKind": "block" }, { "tagName": "@sealed", "syntaxKind": "modifier" }, { "tagName": "@see", "syntaxKind": "block" }, { "tagName": "@throws", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@typeParam", "syntaxKind": "block", "allowMultiple": true }, { "tagName": "@virtual", "syntaxKind": "modifier" }, { "tagName": "@betaDocumentation", "syntaxKind": "modifier" }, { "tagName": "@internalRemarks", "syntaxKind": "block" }, { "tagName": "@preapproved", "syntaxKind": "modifier" } ], "supportForTags": { "@alpha": true, "@beta": true, "@defaultValue": true, "@decorator": true, "@deprecated": true, "@eventProperty": true, "@example": true, "@experimental": true, "@inheritDoc": true, "@internal": true, "@label": true, "@link": true, "@override": true, "@packageDocumentation": true, "@param": true, "@privateRemarks": true, "@public": true, "@readonly": true, "@remarks": true, "@returns": true, "@sealed": true, "@see": true, "@throws": true, "@typeParam": true, "@virtual": true, "@betaDocumentation": true, "@internalRemarks": true, "@preapproved": true } } }, "kind": "Package", "canonicalReference": "faastjs!", "docComment": "/**\n * Faast.js transforms ordinary JavaScript modules into serverless cloud functions that can run on AWS Lambda and Google Cloud Functions.\n *\n * The main entry point to faast.js is the {@link faast} function, which returns an object that implements the {@link FaastModule} interface. The most common options are {@link CommonOptions}. Using faast.js requires writing two modules, one containing the functions to upload to the cloud, and the other that invokes faast.js and calls the resulting cloud functions.\n *\n * @packageDocumentation\n */\n", "name": "faastjs", "members": [ { "kind": "EntryPoint", "canonicalReference": "faastjs!", "name": "", "members": [ { "kind": "TypeAlias", "canonicalReference": "faastjs!Async:type", "docComment": "/**\n * `Async<T>` maps regular values to Promises and Iterators to AsyncIterators, If `T` is already a Promise or an AsyncIterator, it remains the same. This type is used to infer the return value of cloud functions from the types of the functions in the user's input module.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export declare type Async<T> = " }, { "kind": "Content", "text": "T extends " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<R> : T extends " }, { "kind": "Reference", "text": "Generator", "canonicalReference": "!Generator:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<R> : T extends " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<R> : " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<T>" }, { "kind": "Content", "text": ";" } ], "releaseTag": "Public", "name": "Async", "typeParameters": [ { "typeParameterName": "T", "constraintTokenRange": { "startIndex": 0, "endIndex": 0 }, "defaultTypeTokenRange": { "startIndex": 0, "endIndex": 0 } } ], "typeTokenRange": { "startIndex": 1, "endIndex": 16 } }, { "kind": "TypeAlias", "canonicalReference": "faastjs!AsyncDetail:type", "docComment": "/**\n * `AsyncDetail<T>` is similar to {@link Async} except it maps retun values R to `Detail<R>`, which is the return value with additional information about each cloud function invocation.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export declare type AsyncDetail<T> = " }, { "kind": "Content", "text": "T extends " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<" }, { "kind": "Reference", "text": "Detail", "canonicalReference": "faastjs!Detail:interface" }, { "kind": "Content", "text": "<R>> : T extends " }, { "kind": "Reference", "text": "Generator", "canonicalReference": "!Generator:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "AsyncGenerator", "canonicalReference": "!AsyncGenerator:interface" }, { "kind": "Content", "text": "<" }, { "kind": "Reference", "text": "Detail", "canonicalReference": "faastjs!Detail:interface" }, { "kind": "Content", "text": "<R>> : T extends " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<infer R> ? " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<" }, { "kind": "Reference", "text": "Detail", "canonicalReference": "faastjs!Detail:interface" }, { "kind": "Content", "text": "<R>> : " }, { "kind": "Reference", "text": "Promise", "canonicalReference": "!Promise:interface" }, { "kind": "Content", "text": "<" }, { "kind": "Reference", "text": "Detail", "canonicalReference": "faastjs!Detail:interface" }, { "kind": "Content", "text": "<T>>" }, { "kind": "Content", "text": ";" } ], "releaseTag": "Public", "name": "AsyncDetail", "typeParameters": [ { "typeParameterName": "T", "constraintTokenRange": { "startIndex": 0, "endIndex": 0 }, "defaultTypeTokenRange": { "startIndex": 0, "endIndex": 0 } } ], "typeTokenRange": { "startIndex": 1, "endIndex": 24 } }, { "kind": "TypeAlias", "canonicalReference": "faastjs!AwsFaastModule:type", "docComment": "/**\n * The return type of {@link faastAws}. See {@link FaastModuleProxy}.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export declare type AwsFaastModule<M extends " }, { "kind": "Content", "text": "object " }, { "kind": "Content", "text": "= " }, { "kind": "Content", "text": "object" }, { "kind": "Content", "text": "> = " }, { "kind": "Reference", "text": "FaastModuleProxy", "canonicalReference": "faastjs!FaastModuleProxy:class" }, { "kind": "Content", "text": "<M, " }, { "kind": "Reference", "text": "AwsOptions", "canonicalReference": "faastjs!AwsOptions:interface" }, { "kind": "Content", "text": ", " }, { "kind": "Reference", "text": "AwsState", "canonicalReference": "faastjs!AwsState:interface" }, { "kind": "Content", "text": ">" }, { "kind": "Content", "text": ";" } ], "releaseTag": "Public", "name": "AwsFaastModule", "typeParameters": [ { "typeParameterName": "M", "constraintTokenRange": { "startIndex": 1, "endIndex": 2 }, "defaultTypeTokenRange": { "startIndex": 3, "endIndex": 4 } } ], "typeTokenRange": { "startIndex": 5, "endIndex": 11 } }, { "kind": "Interface", "canonicalReference": "faastjs!AwsOptions:interface", "docComment": "/**\n * AWS-specific options for {@link faastAws}.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export interface AwsOptions extends " }, { "kind": "Reference", "text": "CommonOptions", "canonicalReference": "faastjs!CommonOptions:interface" }, { "kind": "Content", "text": " " } ], "releaseTag": "Public", "name": "AwsOptions", "members": [ { "kind": "PropertySignature", "canonicalReference": "faastjs!AwsOptions#awsConfig:member", "docComment": "/**\n * Additional options to pass to all AWS services. See {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html | AWS.Config}.\n *\n * @remarks\n *\n * If you need to specify AWS options such as credentials, you can pass set these options here. Note that faast.js will override some options even if they are specified here, specifically the options used to create the `Lambda` service, to ensure they allow for faast to function correctly. Options set in {@link CommonOptions} override those set here.\n *\n * Example of passing in credentials:\n * ```typescript\n * const credentials = { accessKeyId, secretAccessKey };\n * const m = await faastAws(funcs, { credentials });\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", "text": "awsConfig?: " }, { "kind": "Reference", "text": "ConfigurationOptions", "canonicalReference": "aws-sdk!ConfigurationOptions:class" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "awsConfig", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!AwsOptions#awsLambdaOptions:member", "docComment": "/**\n * Additional options to pass to AWS Lambda creation. See {@link https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html | CreateFunction}.\n *\n * @remarks\n *\n * If you need specialized options, you can pass them to the AWS Lambda SDK directly. Note that if you override any settings set by faast.js, you may cause faast.js to not work:\n * ```typescript\n * const request: aws.Lambda.CreateFunctionRequest = {\n * FunctionName,\n * Role,\n * Runtime: \"nodejs14.x\",\n * Handler: \"index.trampoline\",\n * Code,\n * Description: \"faast trampoline function\",\n * Timeout,\n * MemorySize,\n * ...awsLambdaOptions\n * };\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", "text": "awsLambdaOptions?: " }, { "kind": "Reference", "text": "Partial", "canonicalReference": "!Partial:type" }, { "kind": "Content", "text": "<" }, { "kind": "Reference", "text": "Lambda.CreateFunctionRequest", "canonicalReference": "aws-sdk!~Lambda.CreateFunctionRequest:interface" }, { "kind": "Content", "text": ">" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "awsLambdaOptions", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 5 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!AwsOptions#region:member", "docComment": "/**\n * The region to create resources in. Garbage collection is also limited to this region. Default: `\"us-west-2\"`.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "region?: " }, { "kind": "Reference", "text": "AwsRegion", "canonicalReference": "faastjs!AwsRegion:type" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "region", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!AwsOptions#RoleName:member", "docComment": "/**\n * The role that the lambda function will assume when executing user code. Default: `\"faast-cached-lambda-role\"`. Rarely used.\n *\n * @remarks\n *\n * When a lambda executes, it first assumes an {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html | execution role} to grant access to resources.\n *\n * By default, faast.js creates this execution role for you and leaves it permanently in your account (the role is shared across all lambda functions created by faast.js). By default, faast.js grants administrator privileges to this role so your code can perform any AWS operation it requires.\n *\n * You can {@link https://console.aws.amazon.com/iam/home#/roles | create a custom role} that specifies more limited permissions if you prefer not to grant administrator privileges. Any role you assign for faast.js modules needs at least the following permissions:\n *\n * - Execution Role:\n * ```json\n * {\n * \"Version\": \"2012-10-17\",\n * \"Statement\": [\n * {\n * \"Effect\": \"Allow\",\n * \"Action\": [\"logs:*\"],\n * \"Resource\": \"arn:aws:logs:*:*:log-group:faast-*\"\n * },\n * {\n * \"Effect\": \"Allow\",\n * \"Action\": [\"sqs:*\"],\n * \"Resource\": \"arn:aws:sqs:*:*:faast-*\"\n * }\n * ]\n * }\n * ```\n *\n * - Trust relationship (also known as `AssumeRolePolicyDocument` in the AWS SDK):\n * ```json\n * {\n * \"Version\": \"2012-10-17\",\n * \"Statement\": [\n * {\n * \"Effect\": \"Allow\",\n * \"Principal\": {\n * \"Service\": \"lambda.amazonaws.com\"\n * },\n * \"Action\": \"sts:AssumeRole\"\n * }\n * ]\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", "text": "RoleName?: " }, { "kind": "Content", "text": "string" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "RoleName", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } } ], "extendsTokenRanges": [ { "startIndex": 1, "endIndex": 3 } ] }, { "kind": "TypeAlias", "canonicalReference": "faastjs!AwsRegion:type", "docComment": "/**\n * Valid AWS {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html | regions}. Not all of these regions have Lambda support.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export declare type AwsRegion = " }, { "kind": "Content", "text": "\"us-east-1\" | \"us-east-2\" | \"us-west-1\" | \"us-west-2\" | \"ca-central-1\" | \"eu-central-1\" | \"eu-west-1\" | \"eu-west-2\" | \"eu-west-3\" | \"ap-northeast-1\" | \"ap-northeast-2\" | \"ap-northeast-3\" | \"ap-southeast-1\" | \"ap-southeast-2\" | \"ap-south-1\" | \"sa-east-1\"" }, { "kind": "Content", "text": ";" } ], "releaseTag": "Public", "name": "AwsRegion", "typeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "Interface", "canonicalReference": "faastjs!CleanupOptions:interface", "docComment": "/**\n * Options that apply to the {@link FaastModule.cleanup} method.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export interface CleanupOptions " } ], "releaseTag": "Public", "name": "CleanupOptions", "members": [ { "kind": "PropertySignature", "canonicalReference": "faastjs!CleanupOptions#deleteCaches:member", "docComment": "/**\n * If true, delete cached resources. Default: false.\n *\n * @remarks\n *\n * Some resources are cached persistently between calls for performance reasons. If this option is set to true, these cached resources are deleted when cleanup occurs, instead of being left behind for future use. For example, on AWS this includes the Lambda Layers that are created for {@link CommonOptions.packageJson} dependencies. Note that only the cached resources created by this instance of FaastModule are deleted, not cached resources from other FaastModules. This is similar to setting `useCachedDependencies` to `false` during function construction, except `deleteCaches` can be set at function cleanup time, and any other FaastModules created before cleanup may use the cached Layers.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "deleteCaches?: " }, { "kind": "Content", "text": "boolean" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "deleteCaches", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CleanupOptions#deleteResources:member", "docComment": "/**\n * If true, delete provider cloud resources. Default: true.\n *\n * @remarks\n *\n * The cleanup operation has two functions: stopping the faast.js runtime and deleting cloud resources that were instantiated. If `deleteResources` is false, then only the runtime is stopped and no cloud resources are deleted. This can be useful for debugging and examining the state of resources created by faast.js.\n *\n * It is supported to call {@link FaastModule.cleanup} twice: once with `deleteResources` set to `false`, which only stops the runtime, and then again set to `true` to delete resources. This can be useful for testing.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "deleteResources?: " }, { "kind": "Content", "text": "boolean" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "deleteResources", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CleanupOptions#gcTimeout:member", "docComment": "/**\n * Number of seconds to wait for garbage collection. Default: 10.\n *\n * @remarks\n *\n * Garbage collection can still be operating when cleanup is called; this option limits the amount of time faast waits for the garbage collector. If set to 0, the wait is unlimited.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "gcTimeout?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "gcTimeout", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } } ], "extendsTokenRanges": [] }, { "kind": "Interface", "canonicalReference": "faastjs!CommonOptions:interface", "docComment": "/**\n * Options common across all faast.js providers. Used as argument to {@link faast}.\n *\n * @remarks\n *\n * There are also more specific options for each provider. See {@link AwsOptions}, {@link GoogleOptions}, and {@link LocalOptions}.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "export interface CommonOptions " } ], "releaseTag": "Public", "name": "CommonOptions", "members": [ { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#childProcess:member", "docComment": "/**\n * If true, create a child process to isolate user code from faast scaffolding. Default: true.\n *\n * @remarks\n *\n * If a child process is not created, faast runs in the same node instance as the user code and may not execute in a timely fashion because user code may {@link https://nodejs.org/en/docs/guides/dont-block-the-event-loop/ | block the event loop}. Creating a child process for user code allows faast.js to continue executing even if user code never yields. This provides better reliability and functionality:\n *\n * - Detect timeout errors more reliably, even if the function doesn't relinquish the CPU. Not applicable to AWS, which sends separate failure messages in case of timeout. See {@link CommonOptions.timeout}.\n *\n * - CPU metrics used for detecting invocations with high latency, which can be used for automatically retrying calls to reduce tail latency.\n *\n * The cost of creating a child process is mainly in the memory overhead of creating another node process.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "childProcess?: " }, { "kind": "Content", "text": "boolean" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "childProcess", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#childProcessMemoryMb:member", "docComment": "/**\n * When childProcess is true, the child process will be spawned with the value of this property as the setting for --max-old-space-size.\n *\n * @remarks\n *\n * This is useful if a function requires the node process to limit its memory so that another spawned process (e.g. a browser instance) can use the rest.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", "text": "childProcessMemoryMb?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "childProcessMemoryMb", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#concurrency:member", "docComment": "/**\n * The maximum number of concurrent invocations to allow. Default: 100, except for the `local` provider, where the default is 10.\n *\n * @remarks\n *\n * The concurrency limit applies to all invocations of all of the faast functions summed together. It is not a per-function limit. To apply a per-function limit, use {@link throttle}. A value of 0 is equivalent to Infinity. A value of 1 ensures mutually exclusive invocations.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "concurrency?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "concurrency", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#description:member", "docComment": "/**\n * A user-supplied description for this function, which may make it easier to track different functions when multiple functions are created.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "description?: " }, { "kind": "Content", "text": "string" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "description", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#env:member", "docComment": "/**\n * Environment variables available during serverless function execution. Default: \\{\\}.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "env?: " }, { "kind": "Content", "text": "{\n [key: string]: string;\n }" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "env", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#exclude:member", "docComment": "/**\n * Exclude a subset of files included by {@link CommonOptions.include}.\n *\n * @remarks\n *\n * The exclusion can be a directory or glob. Exclusions apply to all included entries.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "exclude?: " }, { "kind": "Content", "text": "string[]" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "exclude", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#gc:member", "docComment": "/**\n * Garbage collector mode. Default: `\"auto\"`.\n *\n * @remarks\n *\n * Garbage collection deletes resources that were created by previous instantiations of faast that were not cleaned up by {@link FaastModule.cleanup}, either because it was not called or because the process terminated and did not execute this cleanup step. In `\"auto\"` mode, garbage collection may be throttled to run up to once per hour no matter how many faast.js instances are created. In `\"force\"` mode, garbage collection is run without regard to whether another gc has already been performed recently. In `\"off\"` mode, garbage collection is skipped entirely. This can be useful for performance-sensitive tests, or for more control over when gc is performed.\n *\n * Garbage collection is cloud-specific, but in general garbage collection should not interfere with the behavior or performance of faast cloud functions. When {@link FaastModule.cleanup} runs, it waits for garbage collection to complete. Therefore the cleanup step can in some circumstances take a significant amount of time even after all invocations have returned.\n *\n * It is generally recommended to leave garbage collection in `\"auto\"` mode, otherwise garbage resources may accumulate over time and you will eventually hit resource limits on your account.\n *\n * Also see {@link CommonOptions.retentionInDays}.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "gc?: " }, { "kind": "Content", "text": "\"auto\" | \"force\" | \"off\"" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "gc", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#include:member", "docComment": "/**\n * Include files to make available in the remote function. See {@link IncludeOption}.\n *\n * @remarks\n *\n * Each include entry is a directory or glob pattern. Paths can be specified as relative or absolute paths. Relative paths are resolved relative to the current working directory, or relative to the `cwd` option.\n *\n * If the include entry is a directory `\"foo/bar\"`, the directory `\"./foo/bar\"` will be available in the cloud function. Directories are recursively added.\n *\n * Glob patterns use the syntax of {@link https://github.com/isaacs/node-glob | node glob}.\n *\n * Also see {@link CommonOptions.exclude} for file exclusions.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "include?: " }, { "kind": "Content", "text": "(string | " }, { "kind": "Reference", "text": "IncludeOption", "canonicalReference": "faastjs!IncludeOption:interface" }, { "kind": "Content", "text": ")[]" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "include", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 4 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#maxRetries:member", "docComment": "/**\n * Maximum number of times that faast will retry each invocation. Default: 2 (invocations can therefore be attemped 3 times in total).\n *\n * @remarks\n *\n * Retries are automatically attempted for transient infrastructure-level failures such as rate limits or netowrk failures. User-level exceptions are not retried automatically. In addition to retries performed by faast, some providers automatically attempt retries. These are not controllable by faast. But as a result, your function may be retried many more times than this setting suggests.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "maxRetries?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "maxRetries", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#memorySize:member", "docComment": "/**\n * Memory limit for each function in MB. This setting has an effect on pricing. Default varies by provider.\n *\n * @remarks\n *\n * Each provider has different settings for memory size, and performance varies depending on the setting. By default faast picks a likely optimal value for each provider.\n *\n * - aws: 1728MB\n *\n * - google: 1024MB\n *\n * - local: 512MB (however, memory size limits aren't reliable in local mode.)\n */\n", "excerptTokens": [ { "kind": "Content", "text": "memorySize?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "memorySize", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#mode:member", "docComment": "/**\n * Specify invocation mode. Default: `\"auto\"`.\n *\n * @remarks\n *\n * Modes specify how invocations are triggered. In https mode, the functions are invoked through an https request or the provider's API. In queue mode, a provider-specific queue is used to invoke functions. Queue mode adds additional latency and (usually negligible) cost, but may scale better for some providers. In auto mode the best default is chosen for each provider depending on its particular performance characteristics.\n *\n * The defaults are:\n *\n * - aws: `\"auto\"` is `\"https\"`. In https mode, the AWS SDK api is used to invoke functions. In queue mode, an AWS SNS topic is created and triggers invocations. The AWS API Gateway service is never used by faast, as it incurs a higher cost and is not needed to trigger invocations.\n *\n * - google: `\"auto\"` is `\"https\"`. In https mode, a PUT request is made to invoke the cloud function. In queue mode, a PubSub topic is created to invoke functions.\n *\n * - local: The local provider ignores the mode setting and always uses an internal asynchronous queue to schedule calls.\n *\n * Size limits are affected by the choice of mode. On AWS the limit is 256kb for arguments and return values in `\"queue\"` mode, and 6MB for `\"https\"` mode. For Google the limit is 10MB regardless of mode. In Local mode messages are sent via node's IPC and are subject to OS IPC limits.\n *\n * Note that no matter which mode is selected, faast.js always creates a queue for sending back intermediate results for bookeeping and performance monitoring.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "mode?: " }, { "kind": "Content", "text": "\"https\" | \"queue\" | \"auto\"" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "mode", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#packageJson:member", "docComment": "/**\n * Specify a package.json file to include with the code package.\n *\n * @remarks\n *\n * By default, faast.js will use webpack to bundle dependencies your remote module imports. In normal usage there is no need to specify a separate package.json, as webpack will statically analyze your imports and determine which files to bundle.\n *\n * However, there are some use cases where this is not enough. For example, some dependencies contain native code compiled during installation, and webpack cannot bundle these native modules. such as dependencies with native code. or are specifically not designed to work with webpack. In these cases, you can create a separate `package.json` for these dependencies and pass the filename as the `packageJson` option. If `packageJson` is an `object`, it is assumed to be a parsed JSON object with the same structure as a package.json file (useful for specifying a synthetic `package.json` directly in code).\n *\n * The way the `packageJson` is handled varies by provider:\n *\n * - local: Runs `npm install` in a temporary directory it prepares for the function.\n *\n * - google: uses Google Cloud Function's {@link https://cloud.google.com/functions/docs/writing/specifying-dependencies-nodejs | native support for package.json}.\n *\n * - aws: Recursively calls faast.js to run `npm install` inside a separate lambda function specifically created for this purpose. Faast.js uses lambda to install dependencies to ensure that native dependencies are compiled in an environment that can produce binaries linked against lambda's {@link https://aws.amazon.com/blogs/compute/running-executables-in-aws-lambda/ | execution environment}. Packages are saved in a Lambda Layer.\n *\n * For AWS, if {@link CommonOptions.useDependencyCaching} is `true` (which is the default), then the Lambda Layer created will be reused in future function creation requests if the contents of `packageJson` are the same.\n *\n * The `FAAST_PACKAGE_DIR` environment variable can be useful for debugging `packageJson` issues.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "packageJson?: " }, { "kind": "Content", "text": "string | object" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "packageJson", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#rate:member", "docComment": "/**\n * Rate limit invocations (invocations/sec). Default: no rate limit.\n *\n * @remarks\n *\n * Some services cannot handle more than a certain number of requests per second, and it is easy to overwhelm them with a large number of cloud functions. Specify a rate limit in invocation/second to restrict how faast.js issues requests.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "rate?: " }, { "kind": "Content", "text": "number" }, { "kind": "Content", "text": ";" } ], "isOptional": true, "releaseTag": "Public", "name": "rate", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "faastjs!CommonOptions#retentionInDays:member", "docComment": "/**\n * Specify how many days to wait before reclaiming cloud garbage. Default: 1.\n *\n * @remarks\n *\n * Garbage collection only deletes resources after they age beyond a certain number of days. This option specifies how many days old a resource needs to be before being considered garbage by the collector. Note that this setting is not recorded when the resources are created. For example, suppose this is the sequence of events:\n *\n * - Day 0: `faast()` is c