@digitalocean/functions-deployer 5.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/main.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { Flags, Credentials } from './deploy-struct';
2
+ export interface Logger {
3
+ log: (msg: string, ...args: any[]) => void;
4
+ handleError: (msg: string, err?: Error) => never;
5
+ exit: (code: number) => void;
6
+ displayError: (msg: string, err?: Error) => void;
7
+ logJSON: (entity: any) => void;
8
+ logTable: (data: Record<string, unknown>[], columns: Record<string, unknown>, options: Record<string, unknown>) => void;
9
+ logOutput: (json: any, msgs: string[]) => void;
10
+ }
11
+ export declare class DefaultLogger implements Logger {
12
+ log(msg?: string, ...args: any[]): void;
13
+ handleError(msg: string, err?: Error): never;
14
+ displayError(msg: string, err?: Error): void;
15
+ exit(code: number): void;
16
+ logJSON(entity: Record<string, unknown>): void;
17
+ logTable(data: Record<string, unknown>[], _columns: Record<string, unknown>, _options?: Record<string, unknown>): void;
18
+ logOutput(json: Record<string, unknown>, msgs: string[]): void;
19
+ }
20
+ export declare class CaptureLogger implements Logger {
21
+ table: Record<string, unknown>[];
22
+ captured: string[];
23
+ errors: string[];
24
+ entity: Record<string, unknown>;
25
+ log(msg?: string, ...args: any[]): void;
26
+ handleError(msg: string, err?: Error): never;
27
+ displayError(msg: string, err?: Error): void;
28
+ exit(_code: number): void;
29
+ logJSON(entity: Record<string, unknown>): void;
30
+ logTable(data: Record<string, unknown>[], _columns: Record<string, unknown>, _options?: Record<string, unknown>): void;
31
+ logOutput(json: Record<string, unknown>, msgs: string[]): void;
32
+ }
33
+ export declare function flush(): Promise<void>;
34
+ export declare function handleError(err: any): void;
35
+ export declare function main(): Promise<void>;
36
+ export declare function runCommand(inputArgs: string[], logger: Logger): Promise<void>;
37
+ export declare function deployProject(project: string, cmdFlags: Flags, creds: Credentials | undefined, watching: boolean, logger: Logger): Promise<boolean>;
@@ -0,0 +1,18 @@
1
+ import { DeployStructure, Includer, ProjectReader, Feedback } from './deploy-struct';
2
+ interface TopLevel {
3
+ lib: string;
4
+ packages: string;
5
+ config?: string;
6
+ env?: string;
7
+ buildEnv?: string;
8
+ strays: string[];
9
+ filePath: string;
10
+ includer: Includer;
11
+ reader: ProjectReader;
12
+ feedback: Feedback;
13
+ noTriggers: boolean;
14
+ }
15
+ export declare function readTopLevel(filePath: string, env: string, buildEnv: string, includer: Includer, feedback: Feedback, noTriggers: boolean): Promise<TopLevel>;
16
+ export declare function buildStructureParts(topLevel: TopLevel): Promise<DeployStructure[]>;
17
+ export declare function assembleInitialStructure(parts: DeployStructure[]): DeployStructure;
18
+ export {};
@@ -0,0 +1,21 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export declare const API_ENDPOINT = "/api/v1";
3
+ type RuntimeLabel = string;
4
+ type RuntimeKind = string;
5
+ type RuntimeFileExtension = string;
6
+ export interface Runtime {
7
+ kind: RuntimeKind;
8
+ default?: boolean;
9
+ }
10
+ export type RuntimesConfig = Record<RuntimeLabel, Runtime[]>;
11
+ export declare function fromPlatform(httpClient: AxiosInstance, platformUrl: string): Promise<Record<string, unknown>>;
12
+ export declare function runtimeForFileExtension(fileExtension: RuntimeFileExtension): RuntimeKind | undefined;
13
+ export declare function isBinaryFileExtension(fileExtension: RuntimeFileExtension): boolean;
14
+ export declare function fileExtensionForRuntime(runtime: RuntimeKind, isBinaryExtension: boolean): RuntimeFileExtension;
15
+ export declare function isValidRuntime(kind: RuntimeKind): Promise<boolean>;
16
+ export declare function defaultRuntime(runtimes: RuntimesConfig, label: RuntimeLabel): RuntimeKind;
17
+ export declare function runtimeForZipMid(mid: string): Promise<RuntimeKind>;
18
+ export declare function canonicalRuntime(runtime: RuntimeKind): Promise<RuntimeKind>;
19
+ export declare function load(apihost: string): Promise<RuntimesConfig>;
20
+ export declare function getRuntimes(): Promise<RuntimesConfig>;
21
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DeployStructure } from './deploy-struct';
2
+ export declare const MAX_SLICE_UPLOAD_SIZE: number;
3
+ export declare function fetchSlice(sliceName: string): Promise<string>;
4
+ export declare function deleteSlice(project: DeployStructure): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { TriggerSpec, DeploySuccess, Credentials } from './deploy-struct';
2
+ export declare function deployTriggers(triggers: TriggerSpec[], functionName: string, credentials: Credentials): Promise<(DeploySuccess | Error)[]>;
3
+ export declare function undeployTriggers(triggers: string[], credentials: Credentials): Promise<Error[]>;
4
+ export declare function listTriggersForNamespace(namespace: string, credentials: Credentials, fcn?: string): Promise<string[]>;
package/lib/util.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ import { DeployStructure, DeployResponse, DeployKind, ActionSpec, PackageSpec, Feedback, DeployerAnnotation, VersionMap, VersionEntry, PathKind, ProjectReader, KeyVal, Credentials } from './deploy-struct';
2
+ import { Client, Dict, Activation, Action } from 'openwhisk';
3
+ export declare const SYSTEM_EXCLUDE_PATTERNS: (string | ((s: string) => boolean))[];
4
+ export declare function loadProjectConfig(configFile: string, envPath: string, buildEnvPath: string, filePath: string, reader: ProjectReader, feedback: Feedback, noTriggers: boolean): Promise<DeployStructure>;
5
+ export declare function encryptProjectConfig(config: string): {
6
+ config: string;
7
+ key: string;
8
+ };
9
+ export declare function decryptProjectConfig(config: string, key: string): string;
10
+ export declare function renameActionsToFunctions(config: Record<string, any>): void;
11
+ export declare function isRealBuild(buildField: string): boolean;
12
+ export declare function checkBuildingRequirements(todeploy: DeployStructure, requestRemote: boolean): Promise<boolean>;
13
+ export declare function getRuntimeForAction(action: ActionSpec, reader: ProjectReader): Promise<string>;
14
+ export declare function agreeOnRuntime(items: string[]): Promise<string>;
15
+ export declare function validateDeployConfig(arg: any, noTriggers: boolean): Promise<string>;
16
+ export declare function validateTriggers(arg: any): string;
17
+ export declare function keyVal(from: Dict): KeyVal[];
18
+ export declare function makeDict(keyVal: KeyVal[]): Dict;
19
+ export declare function emptyStructure(): DeployStructure;
20
+ export declare function errorStructure(err: Error): DeployStructure;
21
+ export declare function emptyResponse(): DeployResponse;
22
+ export declare function combineResponses(responses: DeployResponse[]): DeployResponse;
23
+ export declare function straysToResponse(strays: string[]): DeployResponse;
24
+ export declare function wrapSuccess(name: string, kind: DeployKind, skipped: boolean, actionVersions: VersionMap, namespace: string): DeployResponse;
25
+ export declare function wrapError(err: any, context: string): DeployResponse;
26
+ export declare function getActionName(action: ActionSpec): string;
27
+ export declare function isTargetNamespaceValid(client: Client, namespace: string): Promise<boolean>;
28
+ export declare function getTargetNamespace(client: Client): Promise<string>;
29
+ export declare function actionFileToParts(fileName: string): Promise<{
30
+ name: string;
31
+ binary: boolean;
32
+ zipped: boolean;
33
+ runtime: string;
34
+ }>;
35
+ export declare function filterFiles(entries: PathKind[]): PathKind[];
36
+ export declare function promiseFilesAndFilterFiles(root: string, reader: ProjectReader): Promise<string[]>;
37
+ export declare function substituteFromEnvAndFiles(input: string, envPath: string, projectPath: string, feedback: Feedback): {
38
+ content: string;
39
+ badVars: string[];
40
+ };
41
+ export interface PackageMap {
42
+ [key: string]: PackageSpec;
43
+ }
44
+ export interface ActionMap {
45
+ [key: string]: ActionSpec;
46
+ }
47
+ export declare function mapPackages(packages: PackageSpec[]): PackageMap;
48
+ export declare function mapActions(actions: ActionSpec[]): ActionMap;
49
+ export declare function getBestProjectName(project: DeployStructure): string;
50
+ export declare function getDeployerAnnotation(project: string): Promise<DeployerAnnotation>;
51
+ export declare function wipe(client: Client, credentials: Credentials): Promise<void>;
52
+ export declare function deleteAction(actionName: string, owClient: Client, credentials: Credentials): Promise<Action | Error[]>;
53
+ export declare function generateSecret(): string;
54
+ export declare function saveUsFromOurselves(namespace: string, apihost: string): boolean;
55
+ export declare function digestPackage(pkg: PackageSpec): string;
56
+ export declare function digestAction(action: ActionSpec, code: string): string;
57
+ export declare function writeSliceResult(project: string, result: string): void;
58
+ export declare function writeProjectStatus(project: string, results: DeployResponse, replace: boolean): string;
59
+ export declare function loadVersions(projectPath: string, namespace: string, apihost: string): VersionEntry;
60
+ export declare function delay(millis: number): Promise<void>;
61
+ export declare function waitForActivation(id: string, wsk: Client, waiting: () => void, total: number): Promise<Activation<Dict>>;
62
+ export declare function invokeWebSecure(actionAndQuery: string, auth: string, apihost: string): Promise<any>;
63
+ export declare function wskRequest(url: string, auth?: string): Promise<any>;
64
+ export declare function renamePackage(spec: DeployStructure, oldName: string, newName: string): DeployStructure;
65
+ export declare function isExcluded(match: string): boolean;
66
+ export declare function getExclusionList(): string[];
@@ -0,0 +1 @@
1
+ export declare const version = "5.0.18";
package/lib/watch.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { Flags, Credentials } from './deploy-struct';
2
+ import { Logger } from './main';
3
+ export declare function watch(project: string, cmdFlags: Flags, creds: Credentials | undefined, logger: Logger): void;
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@digitalocean/functions-deployer",
3
+ "version": "5.0.18",
4
+ "description": "The the functions deployer for DigitalOcean",
5
+ "main": "lib/index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/digitalocean/functions-deployer.git"
9
+ },
10
+ "bin": {
11
+ "dosls": "./bin/run"
12
+ },
13
+ "keywords": [],
14
+ "author": "DigitalOcean",
15
+ "license": "Apache-2.0",
16
+ "dependencies": {
17
+ "@aws-sdk/client-s3": "^3.27.0",
18
+ "adm-zip": "^0.4.16",
19
+ "anymatch": "^3.1.1",
20
+ "archiver": "^5.3.0",
21
+ "axios": "^0.21.4",
22
+ "chokidar": "^3.4.0",
23
+ "cron-validator": "^1.3.1",
24
+ "debug": "^4.1.1",
25
+ "dotenv": "^16.0.1",
26
+ "ignore": "5.0.6",
27
+ "js-yaml": "^3.13.1",
28
+ "memory-streams": "^0.1.3",
29
+ "openwhisk": "3.21.7",
30
+ "randomstring": "^1.1.5",
31
+ "rimraf": "^3.0.1",
32
+ "simple-git": "^3.6.0",
33
+ "touch": "^3.1.0",
34
+ "xmlhttprequest": "^1.8.0",
35
+ "yargs-parser": "^21.1.1"
36
+ },
37
+ "overrides": {
38
+ "engine.io": "^6.2.1",
39
+ "engine.io-client": "^6.2.3",
40
+ "needle": "3.1.0",
41
+ "node-uuid": "^1.4.4",
42
+ "sockjs": "^0.3.24",
43
+ "xmlhttprequest": "^1.8.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/adm-zip": "^0.4.33",
47
+ "@types/archiver": "^3.0.0",
48
+ "@types/jest": "^27.5.2",
49
+ "@types/js-yaml": "^3.12.1",
50
+ "@types/node": "11.13.4",
51
+ "@types/randomstring": "^1.1.6",
52
+ "@types/rimraf": "^3.0.0",
53
+ "@types/swagger-schema-official": "2.0.15",
54
+ "@types/touch": "^3.1.1",
55
+ "@types/yargs-parser": "^21.0.0",
56
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
57
+ "@typescript-eslint/parser": "^5.42.1",
58
+ "bats": "1.5.0",
59
+ "bats-assert": "https://github.com/bats-core/bats-assert.git",
60
+ "bats-support": "https://github.com/bats-core/bats-support.git",
61
+ "esbuild": "^0.14.36",
62
+ "esbuild-node-externals": "^1.4.1",
63
+ "eslint": "^8.27.0",
64
+ "eslint-config-prettier": "^8.5.0",
65
+ "husky": "^8.0.2",
66
+ "jest": "^29.2.2",
67
+ "prettier": "^2.7.1",
68
+ "ts-jest": "^29.0.3",
69
+ "typescript": "^4.8.4"
70
+ },
71
+ "engines": {
72
+ "node": ">=14.0.0"
73
+ },
74
+ "files": [
75
+ "/lib",
76
+ "/LICENSE",
77
+ "/package.json",
78
+ "/version.json",
79
+ "/sensitiveNamespaces.json",
80
+ "/productionProjects.json",
81
+ "/404.html"
82
+ ],
83
+ "scripts": {
84
+ "prepack": "npm run build",
85
+ "gen:version": "bash ./scripts/generateVersion.sh",
86
+ "test": "jest",
87
+ "test:coverage": "jest --coverage",
88
+ "test:e2e": "cd ./e2e && bats -rtT .",
89
+ "build": "npm run gen:version && tsc && node esbuild.config.js",
90
+ "lint": "eslint --ext js,ts src",
91
+ "format": "prettier --write \"./**/*.{js,ts,json}\"",
92
+ "format:check": "./scripts/prettier-check.sh",
93
+ "prepare": "husky install"
94
+ },
95
+ "types": "lib/index.d.ts"
96
+ }