@saws/core 1.0.11 → 2.0.0-beta.11

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.
Files changed (61) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/Host.d.ts +62 -0
  3. package/dist/Host.js +202 -0
  4. package/dist/ServiceDefinition.d.ts +66 -0
  5. package/dist/ServiceDefinition.js +182 -0
  6. package/dist/find-service-definition.d.ts +2 -0
  7. package/dist/find-service-definition.js +25 -0
  8. package/dist/get-saws-config.d.ts +14 -0
  9. package/dist/get-saws-config.js +20 -0
  10. package/dist/global-hosts.d.ts +8 -0
  11. package/dist/global-hosts.js +119 -0
  12. package/dist/host-readiness.d.ts +12 -0
  13. package/dist/host-readiness.js +230 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.js +7 -0
  16. package/dist/secrets-manager.d.ts +66 -0
  17. package/dist/secrets-manager.js +325 -0
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/dist/utils/constants.d.ts +4 -0
  20. package/dist/utils/constants.js +5 -0
  21. package/dist/utils/create-directories.d.ts +2 -0
  22. package/dist/utils/create-directories.js +20 -0
  23. package/dist/utils/create-file-if-not-exists.d.ts +1 -0
  24. package/dist/utils/create-file-if-not-exists.js +12 -0
  25. package/dist/utils/create-file-if-note-exists.d.ts +1 -0
  26. package/dist/utils/create-file-if-note-exists.js +11 -0
  27. package/dist/utils/dependency-management.d.ts +16 -0
  28. package/dist/utils/dependency-management.js +132 -0
  29. package/dist/utils/file-exists.d.ts +1 -0
  30. package/dist/utils/file-exists.js +12 -0
  31. package/dist/utils/generate-token.d.ts +1 -0
  32. package/dist/utils/generate-token.js +13 -0
  33. package/dist/utils/get-project-name.d.ts +1 -0
  34. package/dist/utils/get-project-name.js +5 -0
  35. package/dist/utils/get-service-path.d.ts +1 -0
  36. package/dist/utils/get-service-path.js +1 -0
  37. package/dist/utils/list-files.d.ts +1 -0
  38. package/dist/utils/list-files.js +17 -0
  39. package/dist/utils/on-exit.d.ts +1 -0
  40. package/dist/utils/on-exit.js +14 -0
  41. package/dist/utils/parameterized-env-var-name.d.ts +1 -0
  42. package/dist/utils/parameterized-env-var-name.js +1 -0
  43. package/dist/utils/recursively-read-dir.d.ts +1 -0
  44. package/dist/utils/recursively-read-dir.js +15 -0
  45. package/dist/utils/retry-until.d.ts +1 -0
  46. package/dist/utils/retry-until.js +9 -0
  47. package/dist/utils/run-local.d.ts +9 -0
  48. package/dist/utils/run-local.js +87 -0
  49. package/dist/utils/shell-quote.d.ts +1 -0
  50. package/dist/utils/shell-quote.js +3 -0
  51. package/dist/utils/stage-outputs.d.ts +3 -0
  52. package/dist/utils/stage-outputs.js +24 -0
  53. package/dist/utils/uppercase.d.ts +1 -0
  54. package/dist/utils/uppercase.js +4 -0
  55. package/package.json +37 -6
  56. package/dist/src/ServiceDefinition.d.ts +0 -30
  57. package/dist/src/ServiceDefinition.js +0 -94
  58. package/dist/src/get-saws-config.d.ts +0 -2
  59. package/dist/src/get-saws-config.js +0 -11
  60. package/dist/src/index.d.ts +0 -2
  61. package/dist/src/index.js +0 -19
@@ -0,0 +1,132 @@
1
+ import { spawn } from "node:child_process";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { fileExists } from "./file-exists.js";
5
+ export async function installDependencies(dependencies, options = {}) {
6
+ if (dependencies.length === 0)
7
+ return;
8
+ const rootDirectory = path.resolve(options.cwd ?? process.cwd());
9
+ const packageManager = await detectPackageManager(rootDirectory);
10
+ const args = installArguments(packageManager, dependencies, options.development ?? false, options.workspace);
11
+ await new Promise((resolve, reject) => {
12
+ const captureOutput = options.logSink != null;
13
+ const serviceName = options.serviceName ?? "system";
14
+ const child = spawn(packageManager, args, {
15
+ // Workspace-aware package managers must be run from the workspace root.
16
+ // Running npm from within a workspace can install into the root package
17
+ // instead of updating the generated service's package.json.
18
+ cwd: rootDirectory,
19
+ env: process.env,
20
+ stdio: captureOutput ? ["ignore", "pipe", "pipe"] : "inherit",
21
+ });
22
+ child.stdout?.on("data", (chunk) => {
23
+ options.logSink?.({
24
+ serviceName,
25
+ stream: "stdout",
26
+ chunk: chunk.toString("utf8"),
27
+ timestamp: new Date(),
28
+ });
29
+ });
30
+ child.stderr?.on("data", (chunk) => {
31
+ options.logSink?.({
32
+ serviceName,
33
+ stream: "stderr",
34
+ chunk: chunk.toString("utf8"),
35
+ timestamp: new Date(),
36
+ });
37
+ });
38
+ child.once("error", (error) => {
39
+ reject(new Error(`Unable to run ${packageManager}: ${error.message}`, { cause: error }));
40
+ });
41
+ child.once("close", (code, signal) => {
42
+ if (code === 0) {
43
+ resolve();
44
+ return;
45
+ }
46
+ const reason = signal == null ? `exit code ${code ?? "unknown"}` : `signal ${signal}`;
47
+ reject(new Error(`${packageManager} failed to install dependencies with ${reason}`));
48
+ });
49
+ });
50
+ }
51
+ export async function hasDependency(dependency, cwd = process.cwd()) {
52
+ try {
53
+ const contents = await readFile(path.resolve(cwd, "package.json"), "utf8");
54
+ const packageJson = JSON.parse(contents);
55
+ return (packageJson.dependencies?.[dependency] != null ||
56
+ packageJson.devDependencies?.[dependency] != null);
57
+ }
58
+ catch (error) {
59
+ if (error.code === "ENOENT")
60
+ return false;
61
+ throw error;
62
+ }
63
+ }
64
+ async function detectPackageManager(cwd) {
65
+ for (let directory = cwd;; directory = path.dirname(directory)) {
66
+ const packageManager = await readPackageManagerField(directory);
67
+ if (packageManager != null)
68
+ return packageManager;
69
+ for (const [lockfile, manager] of LOCKFILES) {
70
+ if (await fileExists(path.join(directory, lockfile)))
71
+ return manager;
72
+ }
73
+ const parent = path.dirname(directory);
74
+ if (parent === directory)
75
+ return "npm";
76
+ }
77
+ }
78
+ async function readPackageManagerField(directory) {
79
+ try {
80
+ const contents = await readFile(path.join(directory, "package.json"), "utf8");
81
+ const packageJson = JSON.parse(contents);
82
+ if (typeof packageJson.packageManager !== "string")
83
+ return undefined;
84
+ const name = packageJson.packageManager.split("@", 1)[0];
85
+ return isPackageManager(name) ? name : undefined;
86
+ }
87
+ catch (error) {
88
+ if (error.code === "ENOENT")
89
+ return undefined;
90
+ throw error;
91
+ }
92
+ }
93
+ function installArguments(packageManager, dependencies, development, workspace) {
94
+ switch (packageManager) {
95
+ case "npm":
96
+ return [
97
+ "install",
98
+ ...(workspace == null ? [] : ["--workspace", workspace]),
99
+ development ? "--save-dev" : "--save-prod",
100
+ ...dependencies,
101
+ ];
102
+ case "pnpm":
103
+ return [
104
+ ...(workspace == null ? [] : ["--filter", workspace]),
105
+ "add",
106
+ ...(development ? ["--dev"] : []),
107
+ ...dependencies,
108
+ ];
109
+ case "yarn":
110
+ return workspace == null
111
+ ? ["add", ...(development ? ["--dev"] : []), ...dependencies]
112
+ : ["workspace", workspace, "add", ...(development ? ["--dev"] : []), ...dependencies];
113
+ case "bun":
114
+ return [
115
+ "add",
116
+ ...(workspace == null ? [] : ["--filter", workspace]),
117
+ ...(development ? ["--dev"] : []),
118
+ ...dependencies,
119
+ ];
120
+ }
121
+ }
122
+ function isPackageManager(value) {
123
+ return value === "npm" || value === "pnpm" || value === "yarn" || value === "bun";
124
+ }
125
+ const LOCKFILES = [
126
+ ["pnpm-lock.yaml", "pnpm"],
127
+ ["yarn.lock", "yarn"],
128
+ ["bun.lock", "bun"],
129
+ ["bun.lockb", "bun"],
130
+ ["package-lock.json", "npm"],
131
+ ["npm-shrinkwrap.json", "npm"],
132
+ ];
@@ -0,0 +1 @@
1
+ export declare function fileExists(filePath: string): Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ import { access } from "node:fs/promises";
2
+ export async function fileExists(filePath) {
3
+ try {
4
+ await access(filePath);
5
+ return true;
6
+ }
7
+ catch (error) {
8
+ if (error.code === "ENOENT")
9
+ return false;
10
+ throw error;
11
+ }
12
+ }
@@ -0,0 +1 @@
1
+ export declare const generateToken: () => Promise<string>;
@@ -0,0 +1,13 @@
1
+ import * as crypto from "crypto";
2
+ export const generateToken = async () => {
3
+ return new Promise((resolve, reject) => {
4
+ crypto.randomBytes(20, (err, buffer) => {
5
+ if (err) {
6
+ reject(err);
7
+ return;
8
+ }
9
+ resolve(buffer.toString("hex"));
10
+ return;
11
+ });
12
+ });
13
+ };
@@ -0,0 +1 @@
1
+ export declare const getProjectName: () => string;
@@ -0,0 +1,5 @@
1
+ import { default as finder } from "find-package-json";
2
+ export const getProjectName = () => {
3
+ const pkg = finder(import.meta.dirname).next().value;
4
+ return pkg.name;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function listFiles(directory: string): Promise<string[]>;
@@ -0,0 +1,17 @@
1
+ import { readdir } from "node:fs/promises";
2
+ import path from "node:path";
3
+ export async function listFiles(directory) {
4
+ const entries = await readdir(directory, { withFileTypes: true });
5
+ const files = [];
6
+ for (const entry of entries) {
7
+ const fullPath = path.join(directory, entry.name);
8
+ if (entry.isDirectory()) {
9
+ files.push(...(await listFiles(fullPath)));
10
+ continue;
11
+ }
12
+ if (entry.isFile()) {
13
+ files.push(fullPath);
14
+ }
15
+ }
16
+ return files;
17
+ }
@@ -0,0 +1 @@
1
+ export declare const onProcessExit: (callback: () => void) => void;
@@ -0,0 +1,14 @@
1
+ let registeredFunctions = [];
2
+ export const onProcessExit = (callback) => {
3
+ registeredFunctions.push(callback);
4
+ };
5
+ process.on("exit", () => {
6
+ registeredFunctions.forEach((f) => f());
7
+ registeredFunctions = [];
8
+ process.exit();
9
+ });
10
+ process.on("SIGINT", () => {
11
+ registeredFunctions.forEach((f) => f());
12
+ registeredFunctions = [];
13
+ process.exit();
14
+ });
@@ -0,0 +1 @@
1
+ export declare const parameterizedEnvVarName: (name: string, variable: string) => string;
@@ -0,0 +1 @@
1
+ export const parameterizedEnvVarName = (name, variable) => `${name.replace(/[^a-zA-Z\d]/g, "_").toUpperCase()}_${variable}`;
@@ -0,0 +1 @@
1
+ export declare const recursivelyReadDir: (dir: string) => Promise<string[]>;
@@ -0,0 +1,15 @@
1
+ import { promises as fs } from "fs";
2
+ import { resolve } from "path";
3
+ export const recursivelyReadDir = async (dir) => {
4
+ const files = [];
5
+ const dirContents = await fs.readdir(dir, { withFileTypes: true });
6
+ for (const item of dirContents) {
7
+ if (item.isDirectory()) {
8
+ const nestedFiles = await recursivelyReadDir(resolve(dir, item.name));
9
+ files.push(...nestedFiles);
10
+ continue;
11
+ }
12
+ files.push(resolve(dir, item.name));
13
+ }
14
+ return files;
15
+ };
@@ -0,0 +1 @@
1
+ export declare const retryUntil: (callback: () => Promise<boolean>, timeout: number) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ export const retryUntil = async (callback, timeout) => {
2
+ while (true) {
3
+ const done = await callback();
4
+ if (done)
5
+ break;
6
+ await new Promise((r) => setTimeout(r, timeout));
7
+ }
8
+ return;
9
+ };
@@ -0,0 +1,9 @@
1
+ import type { RuntimeLogSink } from "../ServiceDefinition.js";
2
+ export declare function runLocal(command: string, options?: {
3
+ dryRun?: boolean;
4
+ input?: string;
5
+ cwd?: string;
6
+ logSink?: RuntimeLogSink;
7
+ serviceName?: string;
8
+ signal?: AbortSignal;
9
+ }): Promise<void>;
@@ -0,0 +1,87 @@
1
+ import { spawn } from "node:child_process";
2
+ export async function runLocal(command, options = {}) {
3
+ if (options.dryRun) {
4
+ if (options.logSink == null) {
5
+ console.log(`[dry-run:local] ${command}`);
6
+ }
7
+ else {
8
+ options.logSink({
9
+ serviceName: options.serviceName ?? "system",
10
+ stream: "stdout",
11
+ chunk: `[dry-run:local] ${command}\n`,
12
+ timestamp: new Date(),
13
+ });
14
+ }
15
+ return;
16
+ }
17
+ await new Promise((resolve, reject) => {
18
+ if (options.signal?.aborted) {
19
+ reject(new Error(`local command aborted: ${command}`));
20
+ return;
21
+ }
22
+ const captureOutput = options.logSink != null;
23
+ const serviceName = options.serviceName ?? "system";
24
+ const child = spawn(command, {
25
+ cwd: options.cwd,
26
+ shell: true,
27
+ detached: true,
28
+ stdio: [
29
+ options.input == null ? "ignore" : "pipe",
30
+ captureOutput ? "pipe" : "inherit",
31
+ captureOutput ? "pipe" : "inherit",
32
+ ],
33
+ });
34
+ let aborted = false;
35
+ const abort = () => {
36
+ aborted = true;
37
+ if (child.pid == null)
38
+ return;
39
+ try {
40
+ process.kill(-child.pid, "SIGTERM");
41
+ }
42
+ catch (error) {
43
+ if (error.code !== "ESRCH") {
44
+ options.logSink?.({
45
+ serviceName: options.serviceName ?? "system",
46
+ stream: "stderr",
47
+ chunk: `Failed to stop local command: ${error.message}\n`,
48
+ timestamp: new Date(),
49
+ });
50
+ }
51
+ }
52
+ };
53
+ options.signal?.addEventListener("abort", abort, { once: true });
54
+ if (options.input != null) {
55
+ child.stdin?.end(options.input);
56
+ }
57
+ child.stdout?.on("data", (chunk) => {
58
+ options.logSink?.({
59
+ serviceName,
60
+ stream: "stdout",
61
+ chunk: chunk.toString("utf8"),
62
+ timestamp: new Date(),
63
+ });
64
+ });
65
+ child.stderr?.on("data", (chunk) => {
66
+ options.logSink?.({
67
+ serviceName,
68
+ stream: "stderr",
69
+ chunk: chunk.toString("utf8"),
70
+ timestamp: new Date(),
71
+ });
72
+ });
73
+ child.on("error", reject);
74
+ child.on("exit", (code) => {
75
+ options.signal?.removeEventListener("abort", abort);
76
+ if (aborted) {
77
+ reject(new Error(`local command aborted: ${command}`));
78
+ return;
79
+ }
80
+ if (code === 0) {
81
+ resolve();
82
+ return;
83
+ }
84
+ reject(new Error(`local command exited with code ${code}: ${command}`));
85
+ });
86
+ });
87
+ }
@@ -0,0 +1 @@
1
+ export declare function shellQuote(value: string): string;
@@ -0,0 +1,3 @@
1
+ export function shellQuote(value) {
2
+ return `'${value.replaceAll("'", "'\\''")}'`;
3
+ }
@@ -0,0 +1,3 @@
1
+ export type Outputs = Record<string, string | number | boolean | null | undefined>;
2
+ export declare const getStageOutputs: (stage: string) => Promise<Record<string, Outputs>>;
3
+ export declare const writeStageOutputs: (newOutputs: Record<string, Outputs>, stage: string) => Promise<Record<string, Outputs>>;
@@ -0,0 +1,24 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { SAWS_DIR } from "./constants.js";
4
+ export const getStageOutputs = async (stage) => {
5
+ const outputPath = path.resolve(SAWS_DIR, `saws-${stage}-output.json`);
6
+ try {
7
+ await fs.stat(outputPath);
8
+ const outputsText = await fs.readFile(outputPath, { encoding: "utf-8" });
9
+ return JSON.parse(outputsText);
10
+ }
11
+ catch (err) {
12
+ return {};
13
+ }
14
+ };
15
+ export const writeStageOutputs = async (newOutputs, stage) => {
16
+ const currentOutputs = await getStageOutputs(stage);
17
+ // write outputs
18
+ const outputs = {
19
+ ...currentOutputs,
20
+ ...newOutputs,
21
+ };
22
+ await fs.writeFile(path.resolve(SAWS_DIR, `saws-${stage}-output.json`), JSON.stringify(outputs, null, 2));
23
+ return outputs;
24
+ };
@@ -0,0 +1 @@
1
+ export declare const uppercase: (text: string) => string;
@@ -0,0 +1,4 @@
1
+ export const uppercase = (text) => {
2
+ const [first, ...rest] = text;
3
+ return first.toUpperCase() + rest.join("");
4
+ };
package/package.json CHANGED
@@ -1,16 +1,47 @@
1
1
  {
2
2
  "name": "@saws/core",
3
- "version": "1.0.11",
3
+ "version": "2.0.0-beta.11",
4
4
  "description": "",
5
- "main": "./dist/src/index.js",
6
- "types": "./dist/src/index.d.ts",
7
5
  "keywords": [],
8
- "author": "",
9
6
  "license": "MIT",
7
+ "author": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/shichongrui/saws.git"
11
+ },
10
12
  "files": [
11
13
  "./dist"
12
14
  ],
15
+ "type": "module",
16
+ "exports": {
17
+ ".": "./dist/index.js",
18
+ "./ServiceDefinition": "./dist/ServiceDefinition.js",
19
+ "./get-saws-config": "./dist/get-saws-config.js",
20
+ "./Host": "./dist/Host.js",
21
+ "./global-hosts": "./dist/global-hosts.js",
22
+ "./host-readiness": "./dist/host-readiness.js",
23
+ "./secrets-manager": "./dist/secrets-manager.js",
24
+ "./utils/constants": "./dist/utils/constants.js",
25
+ "./utils/create-directories": "./dist/utils/create-directories.js",
26
+ "./utils/file-exists": "./dist/utils/file-exists.js",
27
+ "./utils/generate-token": "./dist/utils/generate-token.js",
28
+ "./utils/get-project-name": "./dist/utils/get-project-name.js",
29
+ "./utils/list-files": "./dist/utils/list-files.js",
30
+ "./utils/on-exit": "./dist/utils/on-exit.js",
31
+ "./utils/parameterized-env-var-name": "./dist/utils/parameterized-env-var-name.js",
32
+ "./utils/recursively-read-dir": "./dist/utils/recursively-read-dir.js",
33
+ "./utils/retry-until": "./dist/utils/retry-until.js",
34
+ "./utils/shell-quote": "./dist/utils/shell-quote.js",
35
+ "./utils/stage-outputs": "./dist/utils/stage-outputs.js",
36
+ "./utils/uppercase": "./dist/utils/uppercase.js",
37
+ "./utils/create-file-if-not-exists": "./dist/utils/create-file-if-not-exists.js",
38
+ "./utils/dependency-management": "./dist/utils/dependency-management.js",
39
+ "./utils/run-local": "./dist/utils/run-local.js"
40
+ },
13
41
  "dependencies": {
14
- "@saws/utils": "^1.0.11"
42
+ "find-package-json": "^1.2.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/find-package-json": "^1.2.7"
15
46
  }
16
- }
47
+ }
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from "stream";
3
- import { type Outputs } from "@saws/utils/stage-outputs";
4
- import type { AWSPermission } from "@saws/utils/aws-permission";
5
- export interface ServiceDefinitionConfig {
6
- name: string;
7
- dependencies?: ServiceDefinition[];
8
- }
9
- export declare class ServiceDefinition {
10
- name: string;
11
- dependencies: ServiceDefinition[];
12
- outputs: Outputs;
13
- deved: boolean;
14
- deployed: boolean;
15
- constructor(config: ServiceDefinitionConfig);
16
- init(): Promise<void>;
17
- dev(): Promise<void>;
18
- deploy(stage: string): Promise<void>;
19
- getOutputs(): Outputs;
20
- setOutputs(outputs: Outputs, stage: string): Promise<void>;
21
- forEachDependency(callback: (serviceDefinition: ServiceDefinition) => void): void;
22
- forEachDependencyAsync(callback: (serviceDefinition: ServiceDefinition) => Promise<void>): Promise<void>;
23
- getAllDependencies(): ServiceDefinition[];
24
- exit(): void;
25
- parameterizedEnvVarName(envVarName: string): string;
26
- getEnvironmentVariables(stage: string): Promise<Record<string, string>>;
27
- getDependenciesEnvironmentVariables(stage: string): Promise<Record<string, string>>;
28
- getStdOut(): Readable | null | undefined;
29
- getPermissions(stage: string): AWSPermission[];
30
- }
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServiceDefinition = void 0;
4
- const stage_outputs_1 = require("@saws/utils/stage-outputs");
5
- const parameterized_env_var_name_1 = require("@saws/utils/parameterized-env-var-name");
6
- class ServiceDefinition {
7
- name;
8
- dependencies;
9
- outputs = {};
10
- deved = false;
11
- deployed = false;
12
- constructor(config) {
13
- this.name = config.name;
14
- this.dependencies = config.dependencies ?? [];
15
- }
16
- async init() {
17
- return;
18
- }
19
- async dev() {
20
- console.log("Start dev", this.name);
21
- await this.init();
22
- await this.forEachDependencyAsync(async (dependency) => {
23
- if (dependency.deved)
24
- return;
25
- await dependency.dev();
26
- dependency.deved = true;
27
- });
28
- }
29
- async deploy(stage) {
30
- console.log("Start deploy", this.name);
31
- await this.forEachDependencyAsync(async (dependency) => {
32
- if (dependency.deployed)
33
- return;
34
- await dependency.deploy(stage);
35
- dependency.deployed = true;
36
- });
37
- }
38
- getOutputs() {
39
- return this.outputs;
40
- }
41
- async setOutputs(outputs, stage) {
42
- this.outputs = {
43
- ...this.outputs,
44
- ...outputs,
45
- };
46
- await (0, stage_outputs_1.writeStageOutputs)({
47
- [this.name]: this.outputs,
48
- }, stage);
49
- }
50
- forEachDependency(callback) {
51
- for (const dependency of this.dependencies) {
52
- callback(dependency);
53
- }
54
- }
55
- async forEachDependencyAsync(callback) {
56
- for (const dependency of this.dependencies) {
57
- await callback(dependency);
58
- }
59
- }
60
- getAllDependencies() {
61
- const all = [this];
62
- for (const dependency of this.dependencies) {
63
- all.push(dependency);
64
- all.push(...dependency.getAllDependencies());
65
- }
66
- return all;
67
- }
68
- // this needs to be recursive down dependencies
69
- exit() {
70
- this.forEachDependency((dependency) => dependency.exit());
71
- }
72
- parameterizedEnvVarName(envVarName) {
73
- return (0, parameterized_env_var_name_1.parameterizedEnvVarName)(this.name, envVarName);
74
- }
75
- // this needs to be recursive down dependencies
76
- async getEnvironmentVariables(stage) {
77
- return {};
78
- }
79
- async getDependenciesEnvironmentVariables(stage) {
80
- const environmentVariables = {};
81
- await this.forEachDependencyAsync(async (definition) => {
82
- Object.assign(environmentVariables, await definition.getEnvironmentVariables(stage));
83
- });
84
- return environmentVariables;
85
- }
86
- getStdOut() {
87
- return null;
88
- }
89
- getPermissions(stage) {
90
- return [];
91
- }
92
- }
93
- exports.ServiceDefinition = ServiceDefinition;
94
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2VydmljZURlZmluaXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvU2VydmljZURlZmluaXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsNkRBQTRFO0FBRTVFLHVGQUFnRjtBQU9oRixNQUFhLGlCQUFpQjtJQUM1QixJQUFJLENBQVM7SUFDYixZQUFZLENBQXNCO0lBQ2xDLE9BQU8sR0FBWSxFQUFFLENBQUM7SUFDdEIsS0FBSyxHQUFZLEtBQUssQ0FBQTtJQUN0QixRQUFRLEdBQVksS0FBSyxDQUFBO0lBRXpCLFlBQVksTUFBK0I7UUFDekMsSUFBSSxDQUFDLElBQUksR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDO1FBQ3hCLElBQUksQ0FBQyxZQUFZLEdBQUcsTUFBTSxDQUFDLFlBQVksSUFBSSxFQUFFLENBQUM7SUFDaEQsQ0FBQztJQUVELEtBQUssQ0FBQyxJQUFJO1FBQ1IsT0FBTTtJQUNSLENBQUM7SUFFRCxLQUFLLENBQUMsR0FBR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xJQUFJLENBQUMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxDQUFDO0lBQ3hELENBQUM7SUFFRCwrQ0FBK0M7SUFDL0MsS0FBSyxDQUFDLHVCQUF1QixDQUFDLEtBQWE7UUFDekMsT0FBTyxFQUFFLENBQUE7SUFDWCxDQUFDO0lBRUQsS0FBSyxDQUFDLG1DQUFtQyxDQUFDLEtBQWE7UUFDckQsTUFBTSxvQkFBb0IsR0FBMkIsRUFBRSxDQUFDO1FBQ3hELE1BQU0sSUFBSSxDQUFDLHNCQUFzQixDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUUsRUFBRTtZQUNyRCxNQUFNLENBQUMsTUFBTSxDQUNYLG9CQUFvQixFQUNwQixNQUFNLFVBQVUsQ0FBQyx1QkFBdUIsQ0FBQyxLQUFLLENBQUMsQ0FDaEQsQ0FBQztRQUNKLENBQUMsQ0FBQyxDQUFDO1FBQ0gsT0FBTyxvQkFBb0IsQ0FBQztJQUM5QixDQUFDO0lBR0QsU0FBUztRQUNQLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELGNBQWMsQ0FBQyxLQUFhO1FBQzFCLE9BQU8sRUFBRSxDQUFDO0lBQ1osQ0FBQztDQUNGO0FBN0dELDhDQTZHQyJ9
@@ -1,2 +0,0 @@
1
- import { type ServiceDefinition } from "./ServiceDefinition";
2
- export declare function getSawsConfig(path?: string): Promise<ServiceDefinition>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSawsConfig = void 0;
4
- const path_1 = require("path");
5
- async function getSawsConfig(path = './saws.js') {
6
- const pathToConfig = (0, path_1.resolve)(path);
7
- const serviceDefinition = await import(pathToConfig);
8
- return serviceDefinition.default;
9
- }
10
- exports.getSawsConfig = getSawsConfig;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXNhd3MtY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2dldC1zYXdzLWNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwrQkFBK0I7QUFFeEIsS0FBSyxVQUFVLGFBQWEsQ0FBQyxPQUFlLFdBQVc7SUFDNUQsTUFBTSxZQUFZLEdBQUcsSUFBQSxjQUFPLEVBQUMsSUFBSSxDQUFDLENBQUM7SUFDbkMsTUFBTSxpQkFBaUIsR0FBRyxNQUFNLE1BQU0sQ0FBQyxZQUFZLENBQUMsQ0FBQztJQUNyRCxPQUFPLGlCQUFpQixDQUFDLE9BQTRCLENBQUE7QUFDdkQsQ0FBQztBQUpELHNDQUlDIn0=
@@ -1,2 +0,0 @@
1
- export * from './ServiceDefinition';
2
- export * from './get-saws-config';
package/dist/src/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ServiceDefinition"), exports);
18
- __exportStar(require("./get-saws-config"), exports);
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHNEQUFtQztBQUNuQyxvREFBaUMifQ==