@lotiai/composer 0.2.0 → 0.2.2
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/dist/build-config/index.d.ts +52 -0
- package/dist/build-config/index.d.ts.map +1 -0
- package/dist/build-config/index.js +66 -0
- package/dist/build-config/index.js.map +1 -0
- package/dist/build-config/loader.d.ts +80 -0
- package/dist/build-config/loader.d.ts.map +1 -0
- package/dist/build-config/loader.js +238 -0
- package/dist/build-config/loader.js.map +1 -0
- package/dist/build-config/schema.d.ts +101 -0
- package/dist/build-config/schema.d.ts.map +1 -0
- package/dist/build-config/schema.js +94 -0
- package/dist/build-config/schema.js.map +1 -0
- package/dist/cli/commands/dev-temporal.d.ts +15 -0
- package/dist/cli/commands/dev-temporal.d.ts.map +1 -0
- package/dist/cli/commands/dev-temporal.js +68 -0
- package/dist/cli/commands/dev-temporal.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +21 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +421 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/profiles.d.ts +15 -0
- package/dist/cli/commands/profiles.d.ts.map +1 -0
- package/dist/cli/commands/profiles.js +69 -0
- package/dist/cli/commands/profiles.js.map +1 -0
- package/dist/cli/index.d.ts +21 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +44 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/async/build/workflow-factory.d.ts +212 -0
- package/dist/internal/async/build/workflow-factory.d.ts.map +1 -0
- package/dist/internal/async/build/workflow-factory.js +533 -0
- package/dist/internal/async/build/workflow-factory.js.map +1 -0
- package/dist/internal/async/build-scripts/utils/common.d.ts +28 -0
- package/dist/internal/async/build-scripts/utils/common.d.ts.map +1 -0
- package/dist/internal/async/build-scripts/utils/common.js +50 -0
- package/dist/internal/async/build-scripts/utils/common.js.map +1 -0
- package/dist/internal/async/build-scripts/utils/import-module.d.ts +19 -0
- package/dist/internal/async/build-scripts/utils/import-module.d.ts.map +1 -0
- package/dist/internal/async/build-scripts/utils/import-module.js +80 -0
- package/dist/internal/async/build-scripts/utils/import-module.js.map +1 -0
- package/dist/internal/async/build-scripts/utils/type-guards.d.ts +123 -0
- package/dist/internal/async/build-scripts/utils/type-guards.d.ts.map +1 -0
- package/dist/internal/async/build-scripts/utils/type-guards.js +145 -0
- package/dist/internal/async/build-scripts/utils/type-guards.js.map +1 -0
- package/dist/internal/async/config/cleanup-policy.d.ts +50 -0
- package/dist/internal/async/config/cleanup-policy.d.ts.map +1 -0
- package/dist/internal/async/config/cleanup-policy.js +20 -0
- package/dist/internal/async/config/cleanup-policy.js.map +1 -0
- package/dist/internal/async/config/worker-profiles.d.ts +172 -0
- package/dist/internal/async/config/worker-profiles.d.ts.map +1 -0
- package/dist/internal/async/config/worker-profiles.js +275 -0
- package/dist/internal/async/config/worker-profiles.js.map +1 -0
- package/dist/internal/async/execute/temporal-client.d.ts +182 -0
- package/dist/internal/async/execute/temporal-client.d.ts.map +1 -0
- package/dist/internal/async/execute/temporal-client.js +190 -0
- package/dist/internal/async/execute/temporal-client.js.map +1 -0
- package/dist/internal/async/execute/workflow-execution.d.ts +98 -0
- package/dist/internal/async/execute/workflow-execution.d.ts.map +1 -0
- package/dist/internal/async/execute/workflow-execution.js +191 -0
- package/dist/internal/async/execute/workflow-execution.js.map +1 -0
- package/dist/internal/async/metrics/task-queue-metrics.d.ts +74 -0
- package/dist/internal/async/metrics/task-queue-metrics.d.ts.map +1 -0
- package/dist/internal/async/metrics/task-queue-metrics.js +155 -0
- package/dist/internal/async/metrics/task-queue-metrics.js.map +1 -0
- package/dist/internal/async/register/activity-worker.d.ts +123 -0
- package/dist/internal/async/register/activity-worker.d.ts.map +1 -0
- package/dist/internal/async/register/activity-worker.js +355 -0
- package/dist/internal/async/register/activity-worker.js.map +1 -0
- package/dist/internal/async/register/generate-workflow-source.d.ts +43 -0
- package/dist/internal/async/register/generate-workflow-source.d.ts.map +1 -0
- package/dist/internal/async/register/generate-workflow-source.js +193 -0
- package/dist/internal/async/register/generate-workflow-source.js.map +1 -0
- package/dist/internal/async/register/workflow-worker.d.ts +125 -0
- package/dist/internal/async/register/workflow-worker.d.ts.map +1 -0
- package/dist/internal/async/register/workflow-worker.js +215 -0
- package/dist/internal/async/register/workflow-worker.js.map +1 -0
- package/dist/internal/async/register-scripts/start-activity-worker.d.ts +70 -0
- package/dist/internal/async/register-scripts/start-activity-worker.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/start-activity-worker.js +75 -0
- package/dist/internal/async/register-scripts/start-activity-worker.js.map +1 -0
- package/dist/internal/async/register-scripts/start-all-workers.d.ts +81 -0
- package/dist/internal/async/register-scripts/start-all-workers.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/start-all-workers.js +84 -0
- package/dist/internal/async/register-scripts/start-all-workers.js.map +1 -0
- package/dist/internal/async/register-scripts/start-workflow-worker.d.ts +69 -0
- package/dist/internal/async/register-scripts/start-workflow-worker.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/start-workflow-worker.js +74 -0
- package/dist/internal/async/register-scripts/start-workflow-worker.js.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules-cli.d.ts +28 -0
- package/dist/internal/async/register-scripts/sync-schedules-cli.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules-cli.js +124 -0
- package/dist/internal/async/register-scripts/sync-schedules-cli.js.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules-via-lambda.d.ts +55 -0
- package/dist/internal/async/register-scripts/sync-schedules-via-lambda.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules-via-lambda.js +146 -0
- package/dist/internal/async/register-scripts/sync-schedules-via-lambda.js.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules.d.ts +68 -0
- package/dist/internal/async/register-scripts/sync-schedules.d.ts.map +1 -0
- package/dist/internal/async/register-scripts/sync-schedules.js +83 -0
- package/dist/internal/async/register-scripts/sync-schedules.js.map +1 -0
- package/dist/internal/async/schedule/constants.d.ts +10 -0
- package/dist/internal/async/schedule/constants.d.ts.map +1 -0
- package/dist/internal/async/schedule/constants.js +13 -0
- package/dist/internal/async/schedule/constants.js.map +1 -0
- package/dist/internal/async/schedule/define-schedule.d.ts +192 -0
- package/dist/internal/async/schedule/define-schedule.d.ts.map +1 -0
- package/dist/internal/async/schedule/define-schedule.js +79 -0
- package/dist/internal/async/schedule/define-schedule.js.map +1 -0
- package/dist/internal/async/schedule/index.d.ts +3 -0
- package/dist/internal/async/schedule/index.d.ts.map +1 -0
- package/dist/internal/async/schedule/index.js +9 -0
- package/dist/internal/async/schedule/index.js.map +1 -0
- package/dist/internal/async/schedule/schedule-definition-schema.d.ts +64 -0
- package/dist/internal/async/schedule/schedule-definition-schema.d.ts.map +1 -0
- package/dist/internal/async/schedule/schedule-definition-schema.js +77 -0
- package/dist/internal/async/schedule/schedule-definition-schema.js.map +1 -0
- package/dist/internal/async/schedule/sync-schedules.d.ts +71 -0
- package/dist/internal/async/schedule/sync-schedules.d.ts.map +1 -0
- package/dist/internal/async/schedule/sync-schedules.js +231 -0
- package/dist/internal/async/schedule/sync-schedules.js.map +1 -0
- package/dist/internal/async/utils/ensure-namespace.d.ts +16 -0
- package/dist/internal/async/utils/ensure-namespace.d.ts.map +1 -0
- package/dist/internal/async/utils/ensure-namespace.js +64 -0
- package/dist/internal/async/utils/ensure-namespace.js.map +1 -0
- package/dist/internal/async/utils/find-package-root.d.ts +9 -0
- package/dist/internal/async/utils/find-package-root.d.ts.map +1 -0
- package/dist/internal/async/utils/find-package-root.js +28 -0
- package/dist/internal/async/utils/find-package-root.js.map +1 -0
- package/dist/internal/async/utils/is-composer-error.d.ts +14 -0
- package/dist/internal/async/utils/is-composer-error.d.ts.map +1 -0
- package/dist/internal/async/utils/is-composer-error.js +17 -0
- package/dist/internal/async/utils/is-composer-error.js.map +1 -0
- package/dist/internal/context-provider.d.ts +316 -0
- package/dist/internal/context-provider.d.ts.map +1 -0
- package/dist/internal/context-provider.js +12 -0
- package/dist/internal/context-provider.js.map +1 -0
- package/dist/internal/create-composer.d.ts +57 -0
- package/dist/internal/create-composer.d.ts.map +1 -0
- package/dist/internal/create-composer.js +125 -0
- package/dist/internal/create-composer.js.map +1 -0
- package/dist/internal/dag-sync-fanout.d.ts +79 -0
- package/dist/internal/dag-sync-fanout.d.ts.map +1 -0
- package/dist/internal/dag-sync-fanout.js +59 -0
- package/dist/internal/dag-sync-fanout.js.map +1 -0
- package/dist/internal/dag-sync-step.d.ts +230 -0
- package/dist/internal/dag-sync-step.d.ts.map +1 -0
- package/dist/internal/dag-sync-step.js +159 -0
- package/dist/internal/dag-sync-step.js.map +1 -0
- package/dist/internal/dag-sync-workflow.d.ts +535 -0
- package/dist/internal/dag-sync-workflow.d.ts.map +1 -0
- package/dist/internal/dag-sync-workflow.js +843 -0
- package/dist/internal/dag-sync-workflow.js.map +1 -0
- package/dist/internal/defaults.d.ts +24 -0
- package/dist/internal/defaults.d.ts.map +1 -0
- package/dist/internal/defaults.js +102 -0
- package/dist/internal/defaults.js.map +1 -0
- package/dist/internal/errors.d.ts +109 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +212 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/index.d.ts +9 -0
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +22 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/observability.d.ts +63 -0
- package/dist/internal/observability.d.ts.map +1 -0
- package/dist/internal/observability.js +323 -0
- package/dist/internal/observability.js.map +1 -0
- package/dist/internal/types.d.ts +80 -0
- package/dist/internal/types.d.ts.map +1 -0
- package/dist/internal/types.js +9 -0
- package/dist/internal/types.js.map +1 -0
- package/dist/internal/workflow-planning.d.ts +107 -0
- package/dist/internal/workflow-planning.d.ts.map +1 -0
- package/dist/internal/workflow-planning.js +216 -0
- package/dist/internal/workflow-planning.js.map +1 -0
- package/dist/schedule-sync.d.ts +17 -0
- package/dist/schedule-sync.d.ts.map +1 -0
- package/dist/schedule-sync.js +22 -0
- package/dist/schedule-sync.js.map +1 -0
- package/dist/temporal-naming.d.ts +27 -0
- package/dist/temporal-naming.d.ts.map +1 -0
- package/dist/temporal-naming.js +33 -0
- package/dist/temporal-naming.js.map +1 -0
- package/package.json +29 -17
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared dynamic module import utility.
|
|
3
|
+
*
|
|
4
|
+
* Handles the fragile import logic needed for both compiled JS (dist/) and
|
|
5
|
+
* TypeScript (src/) environments, including require.cache invalidation and
|
|
6
|
+
* ESM cache-busting. Extracted so that all definition collectors share a
|
|
7
|
+
* single implementation and don't drift.
|
|
8
|
+
*
|
|
9
|
+
* @module import-module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Dynamically imports a TypeScript/JavaScript module with proper cache handling.
|
|
13
|
+
*
|
|
14
|
+
* - In compiled JS environments: rewrites `src/` to `dist/` and `.ts` to `.js`,
|
|
15
|
+
* then clears `require.cache` before importing.
|
|
16
|
+
* - In ESM/tsx environments: appends a cache-busting query parameter.
|
|
17
|
+
*/
|
|
18
|
+
export declare function importModuleFromFile(filePath: string): Promise<Record<string, unknown>>;
|
|
19
|
+
//# sourceMappingURL=import-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-module.d.ts","sourceRoot":"","sources":["../../../../../src/internal/async/build-scripts/utils/import-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA4B7F"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared dynamic module import utility.
|
|
4
|
+
*
|
|
5
|
+
* Handles the fragile import logic needed for both compiled JS (dist/) and
|
|
6
|
+
* TypeScript (src/) environments, including require.cache invalidation and
|
|
7
|
+
* ESM cache-busting. Extracted so that all definition collectors share a
|
|
8
|
+
* single implementation and don't drift.
|
|
9
|
+
*
|
|
10
|
+
* @module import-module
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.importModuleFromFile = importModuleFromFile;
|
|
47
|
+
const node_path_1 = require("node:path");
|
|
48
|
+
/**
|
|
49
|
+
* Dynamically imports a TypeScript/JavaScript module with proper cache handling.
|
|
50
|
+
*
|
|
51
|
+
* - In compiled JS environments: rewrites `src/` to `dist/` and `.ts` to `.js`,
|
|
52
|
+
* then clears `require.cache` before importing.
|
|
53
|
+
* - In ESM/tsx environments: appends a cache-busting query parameter.
|
|
54
|
+
*/
|
|
55
|
+
async function importModuleFromFile(filePath) {
|
|
56
|
+
let absolutePath = (0, node_path_1.resolve)(filePath);
|
|
57
|
+
const isCompiledJs = __filename.endsWith(".js");
|
|
58
|
+
const isNodeEnv = typeof require !== "undefined" && typeof require.cache !== "undefined";
|
|
59
|
+
const shouldUseRequireCache = isCompiledJs || isNodeEnv;
|
|
60
|
+
if (isCompiledJs) {
|
|
61
|
+
const lastSrcIdx = absolutePath.lastIndexOf("/src/");
|
|
62
|
+
if (lastSrcIdx !== -1) {
|
|
63
|
+
absolutePath = `${absolutePath.substring(0, lastSrcIdx)}/dist/${absolutePath.substring(lastSrcIdx + 5)}`;
|
|
64
|
+
}
|
|
65
|
+
absolutePath = absolutePath.replace(/\.ts$/, ".js");
|
|
66
|
+
}
|
|
67
|
+
if (shouldUseRequireCache) {
|
|
68
|
+
const resolvedPath = require.resolve(absolutePath);
|
|
69
|
+
delete require.cache[resolvedPath];
|
|
70
|
+
for (const key of Object.keys(require.cache)) {
|
|
71
|
+
if (key === absolutePath || key === resolvedPath) {
|
|
72
|
+
delete require.cache[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return await Promise.resolve(`${absolutePath}`).then(s => __importStar(require(s)));
|
|
76
|
+
}
|
|
77
|
+
const cacheBuster = `?t=${Date.now()}`;
|
|
78
|
+
return await Promise.resolve(`${`${absolutePath}${cacheBuster}`}`).then(s => __importStar(require(s)));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=import-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-module.js","sourceRoot":"","sources":["../../../../../src/internal/async/build-scripts/utils/import-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWH,oDA4BC;AArCD,yCAAoC;AAEpC;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB;IACzD,IAAI,YAAY,GAAG,IAAA,mBAAO,EAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,CAAC;IACzF,MAAM,qBAAqB,GAAG,YAAY,IAAI,SAAS,CAAC;IAExD,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,YAAY,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,SAAS,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3G,CAAC;QACD,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,qBAAqB,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACnC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,IAAI,GAAG,KAAK,YAAY,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;gBACjD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QACD,OAAO,yBAAa,YAAY,uCAAC,CAAC;IACpC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IACvC,OAAO,yBAAa,GAAG,YAAY,GAAG,WAAW,EAAE,uCAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Guards for Step and Workflow Definitions
|
|
3
|
+
*
|
|
4
|
+
* Provides runtime type guards for validating step and workflow definitions
|
|
5
|
+
* during build-time file scanning and dynamic module loading.
|
|
6
|
+
*
|
|
7
|
+
* ## Purpose
|
|
8
|
+
*
|
|
9
|
+
* These type guards are used by the build system to:
|
|
10
|
+
* 1. Distinguish valid step/workflow exports from other exported values
|
|
11
|
+
* 2. Filter out helper functions, constants, and types during collection
|
|
12
|
+
* 3. Validate that dynamically imported modules contain properly structured definitions
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { isStep, isWorkflow } from './type-guards';
|
|
18
|
+
*
|
|
19
|
+
* // During file scanning
|
|
20
|
+
* const module = await import('./some-file.ts');
|
|
21
|
+
* for (const value of Object.values(module)) {
|
|
22
|
+
* if (isStep(value)) {
|
|
23
|
+
* console.log('Found step:', value.name);
|
|
24
|
+
* } else if (isWorkflow(value)) {
|
|
25
|
+
* console.log('Found workflow:', value.name);
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* ## Type Guard Criteria
|
|
31
|
+
*
|
|
32
|
+
* ### Step Definition
|
|
33
|
+
* A valid step must have:
|
|
34
|
+
* - `name` (string): Unique identifier
|
|
35
|
+
* - `needs` (array): Input dependencies
|
|
36
|
+
* - `provides` (array): Output fields
|
|
37
|
+
* - `run` (function): Execution logic
|
|
38
|
+
*
|
|
39
|
+
* ### Workflow Definition
|
|
40
|
+
* A valid workflow must have:
|
|
41
|
+
* - `name` (string): Unique identifier
|
|
42
|
+
* - `steps` (array): Step sequence
|
|
43
|
+
* - `requiredInitial` (array or undefined): Optional initial data requirements
|
|
44
|
+
*
|
|
45
|
+
* ## Implementation Notes
|
|
46
|
+
*
|
|
47
|
+
* These type guards intentionally use `any` types because they operate on
|
|
48
|
+
* dynamically loaded module exports where the actual types are not known
|
|
49
|
+
* until runtime. The guards perform structural validation to ensure the
|
|
50
|
+
* objects match the expected Step/Workflow interface shape.
|
|
51
|
+
*/
|
|
52
|
+
import type { FanOutMetadata } from "../../../dag-sync-fanout";
|
|
53
|
+
import type { Step } from "../../../dag-sync-step";
|
|
54
|
+
import type { Workflow } from "../../../dag-sync-workflow";
|
|
55
|
+
import type { ScheduleDefinition } from "../../schedule/define-schedule";
|
|
56
|
+
/**
|
|
57
|
+
* Type guard to check if a value is a step definition.
|
|
58
|
+
*
|
|
59
|
+
* Validates that the value has all required step properties:
|
|
60
|
+
* - name (string)
|
|
61
|
+
* - needs (array)
|
|
62
|
+
* - provides (array)
|
|
63
|
+
* - run (function)
|
|
64
|
+
*
|
|
65
|
+
* @param value - Value to check
|
|
66
|
+
* @returns True if the value is a valid Step definition
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const exported = { name: 'myStep', needs: [], provides: ['result'], run: async () => {} };
|
|
71
|
+
* if (isStep(exported)) {
|
|
72
|
+
* console.log('Valid step:', exported.name);
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function isStep(value: any): value is Step<any, any, any>;
|
|
77
|
+
/**
|
|
78
|
+
* Type guard to check if a value is a workflow definition.
|
|
79
|
+
*
|
|
80
|
+
* Validates that the value has all required workflow properties:
|
|
81
|
+
* - name (string)
|
|
82
|
+
* - steps (array)
|
|
83
|
+
* - requiredInitial (array OR undefined - this field is optional)
|
|
84
|
+
*
|
|
85
|
+
* Note: `requiredInitial` is optional in the Workflow type definition.
|
|
86
|
+
* Workflows that consist only of independent steps or steps that depend
|
|
87
|
+
* on each other's outputs don't require initial data.
|
|
88
|
+
*
|
|
89
|
+
* @param value - Value to check
|
|
90
|
+
* @returns True if the value is a valid Workflow definition
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Workflow with required initial data
|
|
95
|
+
* const wf1 = { name: 'myWorkflow', steps: [], requiredInitial: ['input'] };
|
|
96
|
+
* console.log(isWorkflow(wf1)); // true
|
|
97
|
+
*
|
|
98
|
+
* // Workflow without required initial data
|
|
99
|
+
* const wf2 = { name: 'independentWorkflow', steps: [] };
|
|
100
|
+
* console.log(isWorkflow(wf2)); // true (requiredInitial is optional)
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Type guard to check if a value is a FanOut step definition.
|
|
105
|
+
*
|
|
106
|
+
* A FanOut is a Step that also has a `__fanOut` metadata object containing
|
|
107
|
+
* childWorkflow, mapInput, aggregateResults, and concurrency.
|
|
108
|
+
*/
|
|
109
|
+
export declare function isFanOut(value: any): value is Step<any, any, any> & {
|
|
110
|
+
__fanOut: FanOutMetadata;
|
|
111
|
+
};
|
|
112
|
+
export declare function isWorkflow(value: any): value is Workflow<any, any, any>;
|
|
113
|
+
/**
|
|
114
|
+
* Type guard to check if a value is a schedule definition.
|
|
115
|
+
*
|
|
116
|
+
* Validates that the value has the `__scheduleDefinition` marker
|
|
117
|
+
* and required schedule properties.
|
|
118
|
+
*
|
|
119
|
+
* @param value - Value to check
|
|
120
|
+
* @returns True if the value is a valid ScheduleDefinition
|
|
121
|
+
*/
|
|
122
|
+
export declare function isScheduleDefinition(value: unknown): value is ScheduleDefinition;
|
|
123
|
+
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../../../../../src/internal/async/build-scripts/utils/type-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAS/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAAE,CAEhG;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAQvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAShF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type Guards for Step and Workflow Definitions
|
|
4
|
+
*
|
|
5
|
+
* Provides runtime type guards for validating step and workflow definitions
|
|
6
|
+
* during build-time file scanning and dynamic module loading.
|
|
7
|
+
*
|
|
8
|
+
* ## Purpose
|
|
9
|
+
*
|
|
10
|
+
* These type guards are used by the build system to:
|
|
11
|
+
* 1. Distinguish valid step/workflow exports from other exported values
|
|
12
|
+
* 2. Filter out helper functions, constants, and types during collection
|
|
13
|
+
* 3. Validate that dynamically imported modules contain properly structured definitions
|
|
14
|
+
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { isStep, isWorkflow } from './type-guards';
|
|
19
|
+
*
|
|
20
|
+
* // During file scanning
|
|
21
|
+
* const module = await import('./some-file.ts');
|
|
22
|
+
* for (const value of Object.values(module)) {
|
|
23
|
+
* if (isStep(value)) {
|
|
24
|
+
* console.log('Found step:', value.name);
|
|
25
|
+
* } else if (isWorkflow(value)) {
|
|
26
|
+
* console.log('Found workflow:', value.name);
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* ## Type Guard Criteria
|
|
32
|
+
*
|
|
33
|
+
* ### Step Definition
|
|
34
|
+
* A valid step must have:
|
|
35
|
+
* - `name` (string): Unique identifier
|
|
36
|
+
* - `needs` (array): Input dependencies
|
|
37
|
+
* - `provides` (array): Output fields
|
|
38
|
+
* - `run` (function): Execution logic
|
|
39
|
+
*
|
|
40
|
+
* ### Workflow Definition
|
|
41
|
+
* A valid workflow must have:
|
|
42
|
+
* - `name` (string): Unique identifier
|
|
43
|
+
* - `steps` (array): Step sequence
|
|
44
|
+
* - `requiredInitial` (array or undefined): Optional initial data requirements
|
|
45
|
+
*
|
|
46
|
+
* ## Implementation Notes
|
|
47
|
+
*
|
|
48
|
+
* These type guards intentionally use `any` types because they operate on
|
|
49
|
+
* dynamically loaded module exports where the actual types are not known
|
|
50
|
+
* until runtime. The guards perform structural validation to ensure the
|
|
51
|
+
* objects match the expected Step/Workflow interface shape.
|
|
52
|
+
*/
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.isStep = isStep;
|
|
55
|
+
exports.isFanOut = isFanOut;
|
|
56
|
+
exports.isWorkflow = isWorkflow;
|
|
57
|
+
exports.isScheduleDefinition = isScheduleDefinition;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard to check if a value is a step definition.
|
|
60
|
+
*
|
|
61
|
+
* Validates that the value has all required step properties:
|
|
62
|
+
* - name (string)
|
|
63
|
+
* - needs (array)
|
|
64
|
+
* - provides (array)
|
|
65
|
+
* - run (function)
|
|
66
|
+
*
|
|
67
|
+
* @param value - Value to check
|
|
68
|
+
* @returns True if the value is a valid Step definition
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const exported = { name: 'myStep', needs: [], provides: ['result'], run: async () => {} };
|
|
73
|
+
* if (isStep(exported)) {
|
|
74
|
+
* console.log('Valid step:', exported.name);
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
function isStep(value) {
|
|
79
|
+
return (value &&
|
|
80
|
+
typeof value === "object" &&
|
|
81
|
+
typeof value.name === "string" &&
|
|
82
|
+
Array.isArray(value.needs) &&
|
|
83
|
+
Array.isArray(value.provides) &&
|
|
84
|
+
typeof value.run === "function");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Type guard to check if a value is a workflow definition.
|
|
88
|
+
*
|
|
89
|
+
* Validates that the value has all required workflow properties:
|
|
90
|
+
* - name (string)
|
|
91
|
+
* - steps (array)
|
|
92
|
+
* - requiredInitial (array OR undefined - this field is optional)
|
|
93
|
+
*
|
|
94
|
+
* Note: `requiredInitial` is optional in the Workflow type definition.
|
|
95
|
+
* Workflows that consist only of independent steps or steps that depend
|
|
96
|
+
* on each other's outputs don't require initial data.
|
|
97
|
+
*
|
|
98
|
+
* @param value - Value to check
|
|
99
|
+
* @returns True if the value is a valid Workflow definition
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* // Workflow with required initial data
|
|
104
|
+
* const wf1 = { name: 'myWorkflow', steps: [], requiredInitial: ['input'] };
|
|
105
|
+
* console.log(isWorkflow(wf1)); // true
|
|
106
|
+
*
|
|
107
|
+
* // Workflow without required initial data
|
|
108
|
+
* const wf2 = { name: 'independentWorkflow', steps: [] };
|
|
109
|
+
* console.log(isWorkflow(wf2)); // true (requiredInitial is optional)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* Type guard to check if a value is a FanOut step definition.
|
|
114
|
+
*
|
|
115
|
+
* A FanOut is a Step that also has a `__fanOut` metadata object containing
|
|
116
|
+
* childWorkflow, mapInput, aggregateResults, and concurrency.
|
|
117
|
+
*/
|
|
118
|
+
function isFanOut(value) {
|
|
119
|
+
return isStep(value) && "__fanOut" in value && value.__fanOut != null;
|
|
120
|
+
}
|
|
121
|
+
function isWorkflow(value) {
|
|
122
|
+
return (value &&
|
|
123
|
+
typeof value === "object" &&
|
|
124
|
+
typeof value.name === "string" &&
|
|
125
|
+
Array.isArray(value.steps) &&
|
|
126
|
+
(Array.isArray(value.requiredInitial) || value.requiredInitial === undefined));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Type guard to check if a value is a schedule definition.
|
|
130
|
+
*
|
|
131
|
+
* Validates that the value has the `__scheduleDefinition` marker
|
|
132
|
+
* and required schedule properties.
|
|
133
|
+
*
|
|
134
|
+
* @param value - Value to check
|
|
135
|
+
* @returns True if the value is a valid ScheduleDefinition
|
|
136
|
+
*/
|
|
137
|
+
function isScheduleDefinition(value) {
|
|
138
|
+
return (value != null &&
|
|
139
|
+
typeof value === "object" &&
|
|
140
|
+
value.__scheduleDefinition === true &&
|
|
141
|
+
typeof value.scheduleId === "string" &&
|
|
142
|
+
typeof value.workflowName === "string" &&
|
|
143
|
+
value.spec != null);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=type-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../../../../../src/internal/async/build-scripts/utils/type-guards.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;;AA2BH,wBASC;AAkCD,4BAEC;AAED,gCAQC;AAWD,oDASC;AA/FD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,MAAM,CAAC,KAAU;IAC/B,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,OAAO,KAAK,CAAC,GAAG,KAAK,UAAU,CAChC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,KAAU;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;AACxE,CAAC;AAED,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,eAAe,KAAK,SAAS,CAAC,CAC9E,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,KAAc;IACjD,OAAO,CACL,KAAK,IAAI,IAAI;QACb,OAAO,KAAK,KAAK,QAAQ;QACxB,KAAiC,CAAC,oBAAoB,KAAK,IAAI;QAChE,OAAQ,KAAiC,CAAC,UAAU,KAAK,QAAQ;QACjE,OAAQ,KAAiC,CAAC,YAAY,KAAK,QAAQ;QAClE,KAAiC,CAAC,IAAI,IAAI,IAAI,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup Policy Configuration
|
|
3
|
+
*
|
|
4
|
+
* Defines rules for cleaning up old composer bundles from S3.
|
|
5
|
+
* This policy helps manage storage costs while preserving bundles
|
|
6
|
+
* needed for in-flight workflows.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Cleanup policy for managing composer bundle retention in S3.
|
|
10
|
+
*
|
|
11
|
+
* There are two types of bundles:
|
|
12
|
+
* - **Version bundles**: Individual builds by git hash (e.g., workflow-bundle-abc1234.js)
|
|
13
|
+
* Governed by: minimumRetentionDays, gracePeriodHours, forceKeepHashes
|
|
14
|
+
* - **Merged bundles**: Combined bundles containing multiple versions (e.g., merged-workflow-bundle.js)
|
|
15
|
+
* Governed by: maxMergedBundlesToKeep
|
|
16
|
+
*/
|
|
17
|
+
export interface CleanupPolicy {
|
|
18
|
+
/**
|
|
19
|
+
* Minimum number of days to retain a version bundle before considering deletion.
|
|
20
|
+
* Version bundles newer than this are always kept regardless of other factors.
|
|
21
|
+
* Only applies to version bundles (per git hash), not merged bundles.
|
|
22
|
+
*/
|
|
23
|
+
minimumRetentionDays: number;
|
|
24
|
+
/**
|
|
25
|
+
* Git hashes that should never be deleted, regardless of age or activity.
|
|
26
|
+
* Useful for pinning specific production versions or important releases.
|
|
27
|
+
* Only applies to version bundles.
|
|
28
|
+
*/
|
|
29
|
+
forceKeepHashes: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Number of hours after a workflow becomes inactive before its version bundle
|
|
32
|
+
* can be deleted (assuming minimumRetentionDays has passed).
|
|
33
|
+
* This grace period prevents premature deletion of recently-completed workflows.
|
|
34
|
+
* Only applies to version bundles.
|
|
35
|
+
*/
|
|
36
|
+
gracePeriodHours: number;
|
|
37
|
+
/**
|
|
38
|
+
* Maximum number of merged bundles to keep in S3.
|
|
39
|
+
* Older merged bundles are deleted first (FIFO).
|
|
40
|
+
* This enables fast rollback to recent versions.
|
|
41
|
+
* Only applies to merged bundles, not version bundles.
|
|
42
|
+
* Note: Does not respect minimumRetentionDays - purely count-based.
|
|
43
|
+
*/
|
|
44
|
+
maxMergedBundlesToKeep: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cleanup policy for composer bundles
|
|
48
|
+
*/
|
|
49
|
+
export declare const CLEANUP_POLICY: CleanupPolicy;
|
|
50
|
+
//# sourceMappingURL=cleanup-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-policy.d.ts","sourceRoot":"","sources":["../../../../src/internal/async/config/cleanup-policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAK5B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cleanup Policy Configuration
|
|
4
|
+
*
|
|
5
|
+
* Defines rules for cleaning up old composer bundles from S3.
|
|
6
|
+
* This policy helps manage storage costs while preserving bundles
|
|
7
|
+
* needed for in-flight workflows.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CLEANUP_POLICY = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Cleanup policy for composer bundles
|
|
13
|
+
*/
|
|
14
|
+
exports.CLEANUP_POLICY = {
|
|
15
|
+
minimumRetentionDays: 1,
|
|
16
|
+
forceKeepHashes: [],
|
|
17
|
+
gracePeriodHours: 48,
|
|
18
|
+
maxMergedBundlesToKeep: 5,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=cleanup-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-policy.js","sourceRoot":"","sources":["../../../../src/internal/async/config/cleanup-policy.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA4CH;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,oBAAoB,EAAE,CAAC;IACvB,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,sBAAsB,EAAE,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Profile Definitions for Temporal Activity Workers
|
|
3
|
+
*
|
|
4
|
+
* This module defines worker profiles that map step performance characteristics
|
|
5
|
+
* to appropriate infrastructure resources.
|
|
6
|
+
*
|
|
7
|
+
* ## Profiles
|
|
8
|
+
*
|
|
9
|
+
* - **standard**: General business logic (API calls, DB queries, content acquisition).
|
|
10
|
+
* 0.5 vCPU / 2GB per container, 15 concurrent activities, scales 2-10.
|
|
11
|
+
* - **heavy**: CPU-intensive or long-running work (zone ingestion, large data processing).
|
|
12
|
+
* 2 vCPU / 4GB per container, 5 concurrent activities, starts at 3 containers and scales 1-3 by default.
|
|
13
|
+
*
|
|
14
|
+
* Each profile maps to a dedicated Temporal task queue and ECS service.
|
|
15
|
+
*
|
|
16
|
+
* ## Configuration
|
|
17
|
+
*
|
|
18
|
+
* Defaults are defined here. Users can override via `composer.build-config.ts`:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* workerProfiles: {
|
|
21
|
+
* standard: { cpu: 1024, memory: 4096 } // Override just what you need
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import type { ComposerBuildConfig, WorkerProfileOverrides, WorkerProfileResources } from "../../../build-config/index";
|
|
26
|
+
/**
|
|
27
|
+
* Worker profile type.
|
|
28
|
+
*
|
|
29
|
+
* Steps declare their profile via the `workerProfile` field. Steps without an
|
|
30
|
+
* explicit profile default to "standard".
|
|
31
|
+
*/
|
|
32
|
+
export type WorkerProfile = "standard" | "heavy";
|
|
33
|
+
/**
|
|
34
|
+
* Configuration for a worker profile, defining its resource characteristics
|
|
35
|
+
* and operational parameters.
|
|
36
|
+
*/
|
|
37
|
+
export interface WorkerProfileConfig {
|
|
38
|
+
/** Human-readable name */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Temporal task queue name for this profile */
|
|
41
|
+
taskQueue: string;
|
|
42
|
+
/** Description of when to use this profile */
|
|
43
|
+
description: string;
|
|
44
|
+
/** Resource configuration (CPU, memory, scaling) */
|
|
45
|
+
resources: WorkerProfileResources;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Default worker profile configuration defining resource characteristics and task queues.
|
|
49
|
+
*
|
|
50
|
+
* These defaults are referenced by:
|
|
51
|
+
* - Step definitions (via `workerProfile` field - currently all use "standard")
|
|
52
|
+
* - Activity workers (to register on the "standard-tasks" queue)
|
|
53
|
+
* - Infrastructure as Code (to create appropriately sized ECS tasks)
|
|
54
|
+
*
|
|
55
|
+
* Users can override these defaults via `composer.build-config.ts`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const WORKER_PROFILES: Record<WorkerProfile, WorkerProfileConfig>;
|
|
58
|
+
/**
|
|
59
|
+
* Default worker profile for steps that don't explicitly declare one.
|
|
60
|
+
*
|
|
61
|
+
* Using "standard" as the default provides reasonable performance for
|
|
62
|
+
* typical business logic without over-provisioning resources.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEFAULT_WORKER_PROFILE: WorkerProfile;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the task queue name for a given worker profile.
|
|
67
|
+
*
|
|
68
|
+
* @param profile - The worker profile
|
|
69
|
+
* @returns Temporal task queue name
|
|
70
|
+
*/
|
|
71
|
+
export declare function getTaskQueueForProfile(profile: WorkerProfile): string;
|
|
72
|
+
/**
|
|
73
|
+
* Validates that a profile string is a valid WorkerProfile.
|
|
74
|
+
*
|
|
75
|
+
* @param profile - The profile string to validate
|
|
76
|
+
* @returns true if valid, false otherwise
|
|
77
|
+
*/
|
|
78
|
+
export declare function isValidWorkerProfile(profile: string): profile is WorkerProfile;
|
|
79
|
+
/**
|
|
80
|
+
* Gets all task queue names (useful for workers that listen to multiple queues).
|
|
81
|
+
*
|
|
82
|
+
* @returns Array of all task queue names
|
|
83
|
+
*/
|
|
84
|
+
export declare function getAllTaskQueues(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Gets the effective resources for a worker profile, merging config overrides with defaults.
|
|
87
|
+
*
|
|
88
|
+
* @param profile - The worker profile name
|
|
89
|
+
* @param configOverrides - Optional overrides from composer.build-config.ts
|
|
90
|
+
* @returns The merged resource configuration
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // With no overrides, returns defaults
|
|
95
|
+
* getEffectiveResources("standard");
|
|
96
|
+
* // { cpu: 512, memory: 2048, maxConcurrentActivities: 15, minCount: 2, initialCount: 2, maxCount: 10 }
|
|
97
|
+
*
|
|
98
|
+
* // With overrides, merges them
|
|
99
|
+
* getEffectiveResources("standard", { cpu: 1024 });
|
|
100
|
+
* // { cpu: 1024, memory: 2048, maxConcurrentActivities: 15, minCount: 2, initialCount: 2, maxCount: 10 }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function getEffectiveResources(profile: WorkerProfile, configOverrides?: WorkerProfileOverrides): WorkerProfileResources;
|
|
104
|
+
/**
|
|
105
|
+
* Gets the effective worker profile config, merging config overrides with defaults.
|
|
106
|
+
*
|
|
107
|
+
* @param profile - The worker profile name
|
|
108
|
+
* @param config - Optional composer config containing workerProfiles overrides
|
|
109
|
+
* @returns The full profile config with merged resources
|
|
110
|
+
*/
|
|
111
|
+
export declare function getEffectiveProfileConfig(profile: WorkerProfile, config?: ComposerBuildConfig): WorkerProfileConfig;
|
|
112
|
+
export interface ResolvedProfilesForEnvironment {
|
|
113
|
+
dedicatedProfiles: Partial<Record<WorkerProfile, WorkerProfileConfig>>;
|
|
114
|
+
fallbackQueues: Partial<Record<WorkerProfile, string[]>>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Resolves which worker profiles are deployed for an environment and which task
|
|
118
|
+
* queues should be absorbed by fallback profiles.
|
|
119
|
+
*
|
|
120
|
+
* Profiles with no envExclusiveOptIn are always dedicated.
|
|
121
|
+
* Profiles with envExclusiveOptIn deploy only when environment is listed.
|
|
122
|
+
*/
|
|
123
|
+
export declare function resolveProfilesForEnvironment(environment: string, config?: ComposerBuildConfig): ResolvedProfilesForEnvironment;
|
|
124
|
+
export interface ResolveActivityWorkerRuntimeConfigOptions {
|
|
125
|
+
environment: string;
|
|
126
|
+
workerProfile: string;
|
|
127
|
+
config: ComposerBuildConfig;
|
|
128
|
+
}
|
|
129
|
+
export interface ActivityWorkerRuntimeConfig {
|
|
130
|
+
workerProfile: WorkerProfile;
|
|
131
|
+
taskQueues: string[];
|
|
132
|
+
maxConcurrentActivityTaskExecutions: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Resolves runtime configuration for a single activity worker process.
|
|
136
|
+
*
|
|
137
|
+
* Validates the given profile, resolves the environment topology, and returns
|
|
138
|
+
* the task queues this worker should listen on plus the profile-derived
|
|
139
|
+
* max concurrent activities.
|
|
140
|
+
*/
|
|
141
|
+
export declare function resolveActivityWorkerRuntimeConfig(options: ResolveActivityWorkerRuntimeConfigOptions): ActivityWorkerRuntimeConfig;
|
|
142
|
+
export interface LoadAndResolveActivityWorkerRuntimeConfigOptions extends Omit<ResolveActivityWorkerRuntimeConfigOptions, "config"> {
|
|
143
|
+
/** Directory containing the composer.build-config.ts file. Defaults to process.cwd(). */
|
|
144
|
+
buildConfigDir?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Convenience wrapper that loads build config from disk and then resolves
|
|
148
|
+
* activity worker runtime configuration.
|
|
149
|
+
*/
|
|
150
|
+
export declare function loadAndResolveActivityWorkerRuntimeConfig(options: LoadAndResolveActivityWorkerRuntimeConfigOptions): Promise<ActivityWorkerRuntimeConfig>;
|
|
151
|
+
export interface CombinedWorkerConfigOptions {
|
|
152
|
+
environment: string;
|
|
153
|
+
/** Directory containing the composer.build-config.ts file. Defaults to process.cwd(). */
|
|
154
|
+
buildConfigDir?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface CombinedWorkerConfig {
|
|
157
|
+
taskQueues: string[];
|
|
158
|
+
maxConcurrentActivityTaskExecutions: number;
|
|
159
|
+
maxConcurrentWorkflowTaskExecutions: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Loads build config and resolves combined worker configuration
|
|
163
|
+
* across all dedicated profiles for the given environment.
|
|
164
|
+
*
|
|
165
|
+
* Designed for local development where a single process handles all
|
|
166
|
+
* task queues. Collects every dedicated profile's primary queue
|
|
167
|
+
* plus any absorbed fallback queues, sums maxConcurrentActivities,
|
|
168
|
+
* and takes the max of maxConcurrentWorkflows across profiles
|
|
169
|
+
* (since there is only one workflow worker regardless of activity profiles).
|
|
170
|
+
*/
|
|
171
|
+
export declare function loadAndResolveCombinedWorkerConfigForLocalDev(options: CombinedWorkerConfigOptions): Promise<CombinedWorkerConfig>;
|
|
172
|
+
//# sourceMappingURL=worker-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-profiles.d.ts","sourceRoot":"","sources":["../../../../src/internal/async/config/worker-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IAEb,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IAEpB,oDAAoD;IACpD,SAAS,EAAE,sBAAsB,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,aAAa,EAAE,mBAAmB,CA+BtE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAA0B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,aAAa,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,EACtB,eAAe,CAAC,EAAE,sBAAsB,GACvC,sBAAsB,CAmBxB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAOrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACvE,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;CAC1D;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,8BAA8B,CA+ChC;AAED,MAAM,WAAW,yCAAyC;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mCAAmC,EAAE,MAAM,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,yCAAyC,GACjD,2BAA2B,CA8B7B;AAED,MAAM,WAAW,gDACf,SAAQ,IAAI,CAAC,yCAAyC,EAAE,QAAQ,CAAC;IACjE,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,2BAA2B,CAAC,CAUtC;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mCAAmC,EAAE,MAAM,CAAC;IAC5C,mCAAmC,EAAE,MAAM,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAsB,6CAA6C,CACjE,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAsB/B"}
|