@lotiai/composer 0.2.0 → 0.2.1
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 +16 -17
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer Build Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides build configuration utilities for the @lotiai/composer package.
|
|
5
|
+
* External teams can use this to configure their own composer setup.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // composer.build-config.ts
|
|
10
|
+
* import { defineBuildConfig } from "@lotiai/composer/build-config";
|
|
11
|
+
*
|
|
12
|
+
* export default defineBuildConfig({
|
|
13
|
+
* dev: {
|
|
14
|
+
* startAllWorkersJsScript: "dist/scripts/start-all-workers.js",
|
|
15
|
+
* watchPatterns: ["src/**\/*.ts"],
|
|
16
|
+
* },
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import type { ComposerBuildConfig, ComposerBuildConfigInput } from "./schema";
|
|
21
|
+
export { clearBuildConfigCache, getBuildConfigFilePath, hasBuildConfigFile, type LoadBuildConfigOptions, type LoadedBuildConfig, loadBuildConfig, } from "./loader";
|
|
22
|
+
export { type ComposerBuildConfig, type ComposerBuildConfigInput, ComposerBuildConfigSchema, type EnvExclusiveOptIn, type WorkerProfileOverrides, type WorkerProfileResources, WorkerProfileResourcesSchema, } from "./schema";
|
|
23
|
+
/**
|
|
24
|
+
* Helper function for creating a type-safe composer build configuration.
|
|
25
|
+
*
|
|
26
|
+
* This function provides TypeScript IntelliSense and validation hints
|
|
27
|
+
* when creating a composer.build-config.ts file.
|
|
28
|
+
*
|
|
29
|
+
* @param config - The composer build configuration
|
|
30
|
+
* @returns The same configuration (identity function for type inference)
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // composer.build-config.ts
|
|
35
|
+
* import { defineBuildConfig } from "@lotiai/composer/build-config";
|
|
36
|
+
*
|
|
37
|
+
* export default defineBuildConfig({
|
|
38
|
+
* workerProfiles: {
|
|
39
|
+
* standard: {
|
|
40
|
+
* cpu: 1024,
|
|
41
|
+
* memory: 4096,
|
|
42
|
+
* maxConcurrentActivities: 20,
|
|
43
|
+
* },
|
|
44
|
+
* },
|
|
45
|
+
* dev: {
|
|
46
|
+
* startAllWorkersJsScript: "dist/scripts/start-all-workers.js",
|
|
47
|
+
* },
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function defineBuildConfig(config: ComposerBuildConfigInput): ComposerBuildConfig;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/build-config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAI9E,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,4BAA4B,GAC7B,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,wBAAwB,GAAG,mBAAmB,CAEvF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Composer Build Configuration Module
|
|
4
|
+
*
|
|
5
|
+
* This module provides build configuration utilities for the @lotiai/composer package.
|
|
6
|
+
* External teams can use this to configure their own composer setup.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // composer.build-config.ts
|
|
11
|
+
* import { defineBuildConfig } from "@lotiai/composer/build-config";
|
|
12
|
+
*
|
|
13
|
+
* export default defineBuildConfig({
|
|
14
|
+
* dev: {
|
|
15
|
+
* startAllWorkersJsScript: "dist/scripts/start-all-workers.js",
|
|
16
|
+
* watchPatterns: ["src/**\/*.ts"],
|
|
17
|
+
* },
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.WorkerProfileResourcesSchema = exports.ComposerBuildConfigSchema = exports.loadBuildConfig = exports.hasBuildConfigFile = exports.getBuildConfigFilePath = exports.clearBuildConfigCache = void 0;
|
|
23
|
+
exports.defineBuildConfig = defineBuildConfig;
|
|
24
|
+
const schema_1 = require("./schema");
|
|
25
|
+
// Loader exports
|
|
26
|
+
var loader_1 = require("./loader");
|
|
27
|
+
Object.defineProperty(exports, "clearBuildConfigCache", { enumerable: true, get: function () { return loader_1.clearBuildConfigCache; } });
|
|
28
|
+
Object.defineProperty(exports, "getBuildConfigFilePath", { enumerable: true, get: function () { return loader_1.getBuildConfigFilePath; } });
|
|
29
|
+
Object.defineProperty(exports, "hasBuildConfigFile", { enumerable: true, get: function () { return loader_1.hasBuildConfigFile; } });
|
|
30
|
+
Object.defineProperty(exports, "loadBuildConfig", { enumerable: true, get: function () { return loader_1.loadBuildConfig; } });
|
|
31
|
+
// Schema exports
|
|
32
|
+
var schema_2 = require("./schema");
|
|
33
|
+
Object.defineProperty(exports, "ComposerBuildConfigSchema", { enumerable: true, get: function () { return schema_2.ComposerBuildConfigSchema; } });
|
|
34
|
+
Object.defineProperty(exports, "WorkerProfileResourcesSchema", { enumerable: true, get: function () { return schema_2.WorkerProfileResourcesSchema; } });
|
|
35
|
+
/**
|
|
36
|
+
* Helper function for creating a type-safe composer build configuration.
|
|
37
|
+
*
|
|
38
|
+
* This function provides TypeScript IntelliSense and validation hints
|
|
39
|
+
* when creating a composer.build-config.ts file.
|
|
40
|
+
*
|
|
41
|
+
* @param config - The composer build configuration
|
|
42
|
+
* @returns The same configuration (identity function for type inference)
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // composer.build-config.ts
|
|
47
|
+
* import { defineBuildConfig } from "@lotiai/composer/build-config";
|
|
48
|
+
*
|
|
49
|
+
* export default defineBuildConfig({
|
|
50
|
+
* workerProfiles: {
|
|
51
|
+
* standard: {
|
|
52
|
+
* cpu: 1024,
|
|
53
|
+
* memory: 4096,
|
|
54
|
+
* maxConcurrentActivities: 20,
|
|
55
|
+
* },
|
|
56
|
+
* },
|
|
57
|
+
* dev: {
|
|
58
|
+
* startAllWorkersJsScript: "dist/scripts/start-all-workers.js",
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function defineBuildConfig(config) {
|
|
64
|
+
return schema_1.ComposerBuildConfigSchema.parse(config);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build-config/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAqDH,8CAEC;AApDD,qCAAqD;AAErD,iBAAiB;AACjB,mCAOkB;AANhB,+GAAA,qBAAqB,OAAA;AACrB,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAGlB,yGAAA,eAAe,OAAA;AAEjB,iBAAiB;AACjB,mCAQkB;AALhB,mHAAA,yBAAyB,OAAA;AAIzB,sHAAA,4BAA4B,OAAA;AAG9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,iBAAiB,CAAC,MAAgC;IAChE,OAAO,kCAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer Build Configuration Loader
|
|
3
|
+
*
|
|
4
|
+
* Loads and validates composer build configuration from a config file.
|
|
5
|
+
* Supports TypeScript (.ts), JavaScript (.js), and JSON (.json) config files.
|
|
6
|
+
*
|
|
7
|
+
* TypeScript files are loaded using jiti, which provides transparent
|
|
8
|
+
* TypeScript support without requiring pre-compilation.
|
|
9
|
+
*/
|
|
10
|
+
import { type ComposerBuildConfig } from "./schema";
|
|
11
|
+
/**
|
|
12
|
+
* Result of loading a build config file.
|
|
13
|
+
*/
|
|
14
|
+
export interface LoadedBuildConfig {
|
|
15
|
+
/** The validated and resolved configuration */
|
|
16
|
+
config: ComposerBuildConfig;
|
|
17
|
+
/** Absolute path to the config file */
|
|
18
|
+
configPath: string;
|
|
19
|
+
/** Directory containing the config file (used for resolving relative paths) */
|
|
20
|
+
configDir: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for loading build configuration.
|
|
24
|
+
*/
|
|
25
|
+
export interface LoadBuildConfigOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Explicit path to config file.
|
|
28
|
+
* If not provided, searches for config files in searchDir.
|
|
29
|
+
*/
|
|
30
|
+
configPath?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Directory to search for config file.
|
|
33
|
+
* @default process.cwd()
|
|
34
|
+
*/
|
|
35
|
+
searchDir?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Clears the cached build config, forcing the next `loadBuildConfig()` call to reload from disk.
|
|
39
|
+
* Primarily useful for testing.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clearBuildConfigCache(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Loads, validates, and resolves a composer build configuration.
|
|
44
|
+
*
|
|
45
|
+
* Results are cached per-process: the first call reads from disk and validates,
|
|
46
|
+
* subsequent calls return the cached result immediately. This is safe because
|
|
47
|
+
* config files do not change during a single CLI or build invocation.
|
|
48
|
+
*
|
|
49
|
+
* @param options - Options for loading the config
|
|
50
|
+
* @returns The loaded and validated configuration
|
|
51
|
+
* @throws Error if config file is not found or validation fails
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // Load from current directory
|
|
56
|
+
* const { config, configDir } = await loadBuildConfig();
|
|
57
|
+
*
|
|
58
|
+
* // Load from specific path
|
|
59
|
+
* const { config } = await loadBuildConfig({ configPath: "./my-config.ts" });
|
|
60
|
+
*
|
|
61
|
+
* // Load from specific directory
|
|
62
|
+
* const { config } = await loadBuildConfig({ searchDir: "/path/to/project" });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function loadBuildConfig(options?: LoadBuildConfigOptions): Promise<LoadedBuildConfig>;
|
|
66
|
+
/**
|
|
67
|
+
* Synchronously checks if a build config file exists in the given directory.
|
|
68
|
+
*
|
|
69
|
+
* @param searchDir - Directory to search in
|
|
70
|
+
* @returns true if a build config file exists
|
|
71
|
+
*/
|
|
72
|
+
export declare function hasBuildConfigFile(searchDir?: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the path to the build config file without loading it.
|
|
75
|
+
*
|
|
76
|
+
* @param searchDir - Directory to search in
|
|
77
|
+
* @returns Absolute path to config file, or undefined if not found
|
|
78
|
+
*/
|
|
79
|
+
export declare function getBuildConfigFilePath(searchDir?: string): string | undefined;
|
|
80
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/build-config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,UAAU,CAAC;AAclB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyGD;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CACnC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAoD5B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,GAAE,MAAsB,GAAG,OAAO,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,GAAE,MAAsB,GAAG,MAAM,GAAG,SAAS,CAE5F"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Composer Build Configuration Loader
|
|
4
|
+
*
|
|
5
|
+
* Loads and validates composer build configuration from a config file.
|
|
6
|
+
* Supports TypeScript (.ts), JavaScript (.js), and JSON (.json) config files.
|
|
7
|
+
*
|
|
8
|
+
* TypeScript files are loaded using jiti, which provides transparent
|
|
9
|
+
* TypeScript support without requiring pre-compilation.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.clearBuildConfigCache = clearBuildConfigCache;
|
|
46
|
+
exports.loadBuildConfig = loadBuildConfig;
|
|
47
|
+
exports.hasBuildConfigFile = hasBuildConfigFile;
|
|
48
|
+
exports.getBuildConfigFilePath = getBuildConfigFilePath;
|
|
49
|
+
const fs = __importStar(require("node:fs"));
|
|
50
|
+
const path = __importStar(require("node:path"));
|
|
51
|
+
const jiti_1 = require("jiti");
|
|
52
|
+
const schema_1 = require("./schema");
|
|
53
|
+
/**
|
|
54
|
+
* Default config file names to search for, in order of preference.
|
|
55
|
+
*/
|
|
56
|
+
const BUILD_CONFIG_FILE_NAMES = [
|
|
57
|
+
"composer.build-config.ts",
|
|
58
|
+
"composer.build-config.js",
|
|
59
|
+
"composer.build-config.json",
|
|
60
|
+
// Compiled fallback: src/build-config.ts -> dist/build-config.js
|
|
61
|
+
// In Docker images, root-level config files are pruned but dist/ survives.
|
|
62
|
+
"dist/build-config.js",
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* Finds a build config file by searching for known config file names.
|
|
66
|
+
*
|
|
67
|
+
* @param searchDir - Directory to search in
|
|
68
|
+
* @returns Absolute path to config file, or undefined if not found
|
|
69
|
+
*/
|
|
70
|
+
function findBuildConfigFile(searchDir) {
|
|
71
|
+
for (const fileName of BUILD_CONFIG_FILE_NAMES) {
|
|
72
|
+
const filePath = path.join(searchDir, fileName);
|
|
73
|
+
if (fs.existsSync(filePath)) {
|
|
74
|
+
return filePath;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Extracts the config object from a loaded module, supporting default export,
|
|
81
|
+
* named 'config' export, and direct module.exports.
|
|
82
|
+
*
|
|
83
|
+
* Handles jiti's double-wrapping of CJS default exports where
|
|
84
|
+
* `module.default` may itself contain a nested `default` key.
|
|
85
|
+
*/
|
|
86
|
+
function extractConfigExport(configPath, module) {
|
|
87
|
+
let config = module.default ??
|
|
88
|
+
module.config ??
|
|
89
|
+
module;
|
|
90
|
+
// jiti may double-wrap CJS default exports: { default: { default: actualConfig } }
|
|
91
|
+
if (config && typeof config === "object" && "default" in config) {
|
|
92
|
+
config = config.default;
|
|
93
|
+
}
|
|
94
|
+
if (!config || typeof config !== "object") {
|
|
95
|
+
throw new Error(`Config file ${configPath} must export a config object (default export, named 'config', or module.exports)`);
|
|
96
|
+
}
|
|
97
|
+
return config;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Loads a build config file and returns its contents.
|
|
101
|
+
* Uses jiti for TypeScript/JavaScript files to support .ts configs without compilation.
|
|
102
|
+
*
|
|
103
|
+
* @param configPath - Absolute path to the config file
|
|
104
|
+
* @returns The config object (unvalidated)
|
|
105
|
+
*/
|
|
106
|
+
async function loadBuildConfigFile(configPath) {
|
|
107
|
+
const ext = path.extname(configPath).toLowerCase();
|
|
108
|
+
if (ext === ".json") {
|
|
109
|
+
const content = fs.readFileSync(configPath, "utf-8");
|
|
110
|
+
return JSON.parse(content);
|
|
111
|
+
}
|
|
112
|
+
if (ext === ".ts" || ext === ".js") {
|
|
113
|
+
// Use jiti to load TypeScript/JavaScript config files
|
|
114
|
+
// jiti provides transparent TypeScript support without pre-compilation
|
|
115
|
+
const jiti = (0, jiti_1.createJiti)(__filename, {
|
|
116
|
+
fsCache: false,
|
|
117
|
+
moduleCache: false,
|
|
118
|
+
});
|
|
119
|
+
const module = await jiti.import(configPath);
|
|
120
|
+
return extractConfigExport(configPath, module);
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`Unsupported config file extension: ${ext}`);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolves relative paths in the config to absolute paths.
|
|
126
|
+
*
|
|
127
|
+
* @param config - The parsed config
|
|
128
|
+
* @param configDir - Directory containing the config file
|
|
129
|
+
* @returns Config with resolved paths
|
|
130
|
+
*/
|
|
131
|
+
function resolveBuildConfigPaths(config, configDir) {
|
|
132
|
+
const watchPatterns = (config.dev.watchPatterns ?? ["src/**/*.ts"]).map((p) => path.isAbsolute(p) ? p : path.join(configDir, p));
|
|
133
|
+
return {
|
|
134
|
+
...config,
|
|
135
|
+
dev: {
|
|
136
|
+
...config.dev,
|
|
137
|
+
watchPatterns,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Cached config result. The config is loaded once per process and reused.
|
|
143
|
+
* Only a single config is supported per process; passing different options
|
|
144
|
+
* to subsequent calls is treated as a programming error and will throw.
|
|
145
|
+
*/
|
|
146
|
+
let cachedResult;
|
|
147
|
+
/**
|
|
148
|
+
* Clears the cached build config, forcing the next `loadBuildConfig()` call to reload from disk.
|
|
149
|
+
* Primarily useful for testing.
|
|
150
|
+
*/
|
|
151
|
+
function clearBuildConfigCache() {
|
|
152
|
+
cachedResult = undefined;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Loads, validates, and resolves a composer build configuration.
|
|
156
|
+
*
|
|
157
|
+
* Results are cached per-process: the first call reads from disk and validates,
|
|
158
|
+
* subsequent calls return the cached result immediately. This is safe because
|
|
159
|
+
* config files do not change during a single CLI or build invocation.
|
|
160
|
+
*
|
|
161
|
+
* @param options - Options for loading the config
|
|
162
|
+
* @returns The loaded and validated configuration
|
|
163
|
+
* @throws Error if config file is not found or validation fails
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* // Load from current directory
|
|
168
|
+
* const { config, configDir } = await loadBuildConfig();
|
|
169
|
+
*
|
|
170
|
+
* // Load from specific path
|
|
171
|
+
* const { config } = await loadBuildConfig({ configPath: "./my-config.ts" });
|
|
172
|
+
*
|
|
173
|
+
* // Load from specific directory
|
|
174
|
+
* const { config } = await loadBuildConfig({ searchDir: "/path/to/project" });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
async function loadBuildConfig(options = {}) {
|
|
178
|
+
if (cachedResult) {
|
|
179
|
+
return cachedResult;
|
|
180
|
+
}
|
|
181
|
+
const searchDir = options.searchDir ?? process.cwd();
|
|
182
|
+
// Find or use explicit config path
|
|
183
|
+
let configPath;
|
|
184
|
+
if (options.configPath) {
|
|
185
|
+
configPath = path.isAbsolute(options.configPath)
|
|
186
|
+
? options.configPath
|
|
187
|
+
: path.resolve(searchDir, options.configPath);
|
|
188
|
+
if (!fs.existsSync(configPath)) {
|
|
189
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const foundPath = findBuildConfigFile(searchDir);
|
|
194
|
+
if (!foundPath) {
|
|
195
|
+
throw new Error(`No config file found. Expected one of: ${BUILD_CONFIG_FILE_NAMES.join(", ")} in ${searchDir}`);
|
|
196
|
+
}
|
|
197
|
+
configPath = foundPath;
|
|
198
|
+
}
|
|
199
|
+
const configDir = path.dirname(configPath);
|
|
200
|
+
// Load and parse the config file
|
|
201
|
+
const rawConfig = await loadBuildConfigFile(configPath);
|
|
202
|
+
// Validate with Zod
|
|
203
|
+
const parseResult = schema_1.ComposerBuildConfigSchema.safeParse(rawConfig);
|
|
204
|
+
if (!parseResult.success) {
|
|
205
|
+
const issues = parseResult.error.issues
|
|
206
|
+
.map((issue) => ` - ${issue.path.join(".")}: ${issue.message}`)
|
|
207
|
+
.join("\n");
|
|
208
|
+
throw new Error(`Invalid composer build config at ${configPath}:\n${issues}`);
|
|
209
|
+
}
|
|
210
|
+
// Resolve relative paths
|
|
211
|
+
const resolvedConfig = resolveBuildConfigPaths(parseResult.data, configDir);
|
|
212
|
+
const result = {
|
|
213
|
+
config: resolvedConfig,
|
|
214
|
+
configPath,
|
|
215
|
+
configDir,
|
|
216
|
+
};
|
|
217
|
+
cachedResult = result;
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Synchronously checks if a build config file exists in the given directory.
|
|
222
|
+
*
|
|
223
|
+
* @param searchDir - Directory to search in
|
|
224
|
+
* @returns true if a build config file exists
|
|
225
|
+
*/
|
|
226
|
+
function hasBuildConfigFile(searchDir = process.cwd()) {
|
|
227
|
+
return findBuildConfigFile(searchDir) !== undefined;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Gets the path to the build config file without loading it.
|
|
231
|
+
*
|
|
232
|
+
* @param searchDir - Directory to search in
|
|
233
|
+
* @returns Absolute path to config file, or undefined if not found
|
|
234
|
+
*/
|
|
235
|
+
function getBuildConfigFilePath(searchDir = process.cwd()) {
|
|
236
|
+
return findBuildConfigFile(searchDir);
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/build-config/loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+JH,sDAEC;AAyBD,0CAsDC;AAQD,gDAEC;AAQD,wDAEC;AAlQD,4CAA8B;AAC9B,gDAAkC;AAClC,+BAAkC;AAClC,qCAIkB;AAElB;;GAEG;AACH,MAAM,uBAAuB,GAAG;IAC9B,0BAA0B;IAC1B,0BAA0B;IAC1B,4BAA4B;IAC5B,iEAAiE;IACjE,2EAA2E;IAC3E,sBAAsB;CACvB,CAAC;AA+BF;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,KAAK,MAAM,QAAQ,IAAI,uBAAuB,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,UAAkB,EAAE,MAAe;IAC9D,IAAI,MAAM,GACP,MAAiD,CAAC,OAAO;QACzD,MAAgD,CAAC,MAAM;QACxD,MAAM,CAAC;IAET,mFAAmF;IACnF,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QAChE,MAAM,GAAI,MAAgD,CAAC,OAAO,CAAC;IACrE,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EA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S,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAExD,oBAAoB;IACpB,MAAM,WAAW,GAAG,kCAAyB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACnE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM;aACpC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aAC/D,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,oCAAoC,UAAU,MAAM,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,yBAAyB;IACzB,MAAM,cAAc,GAAG,uBAAuB,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE5E,MAAM,MAAM,GAAsB;QAChC,MAAM,EAAE,cAAc;QACtB,UAAU;QACV,SAAS;KACV,CAAC;IAEF,YAAY,GAAG,MAAM,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,YAAoB,OAAO,CAAC,GAAG,EAAE;IAClE,OAAO,mBAAmB,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,YAAoB,OAAO,CAAC,GAAG,EAAE;IACtE,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer Build Configuration Schema
|
|
3
|
+
*
|
|
4
|
+
* Defines the build configuration schema for the @lotiai/composer package.
|
|
5
|
+
* This allows external teams to configure their own steps, workflows,
|
|
6
|
+
* and worker profiles.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
/**
|
|
10
|
+
* Worker profile resource configuration (required version for defaults).
|
|
11
|
+
* This is the single source of truth for worker profile fields.
|
|
12
|
+
*/
|
|
13
|
+
export declare const WorkerProfileResourcesSchema: z.ZodObject<{
|
|
14
|
+
cpu: z.ZodNumber;
|
|
15
|
+
memory: z.ZodNumber;
|
|
16
|
+
maxConcurrentActivities: z.ZodNumber;
|
|
17
|
+
minCount: z.ZodNumber;
|
|
18
|
+
maxConcurrentWorkflows: z.ZodNumber;
|
|
19
|
+
initialCount: z.ZodNumber;
|
|
20
|
+
maxCount: z.ZodNumber;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
/**
|
|
23
|
+
* Worker profile resource configuration (partial version for config overrides).
|
|
24
|
+
* All fields are optional - only specify what you want to override.
|
|
25
|
+
*/
|
|
26
|
+
declare const EnvExclusiveOptInSchema: z.ZodObject<{
|
|
27
|
+
environments: z.ZodArray<z.ZodString>;
|
|
28
|
+
fallbackProfile: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
/**
|
|
31
|
+
* Worker profile override configuration.
|
|
32
|
+
* Resource fields are optional and support environment-specific deployment via envExclusiveOptIn.
|
|
33
|
+
*/
|
|
34
|
+
declare const WorkerProfileOverridesSchema: z.ZodObject<{
|
|
35
|
+
envExclusiveOptIn: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
environments: z.ZodArray<z.ZodString>;
|
|
37
|
+
fallbackProfile: z.ZodString;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
cpu: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
memory: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
maxConcurrentActivities: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
maxConcurrentWorkflows: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
initialCount: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
maxCount: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
/**
|
|
48
|
+
* Development configuration for the `composer dev` CLI command.
|
|
49
|
+
*/
|
|
50
|
+
declare const DevConfigSchema: z.ZodObject<{
|
|
51
|
+
startAllWorkersJsScript: z.ZodOptional<z.ZodString>;
|
|
52
|
+
watchPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
/**
|
|
55
|
+
* Complete composer build configuration schema.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ComposerBuildConfigSchema: z.ZodObject<{
|
|
58
|
+
workerProfiles: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
59
|
+
envExclusiveOptIn: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
environments: z.ZodArray<z.ZodString>;
|
|
61
|
+
fallbackProfile: z.ZodString;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
cpu: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
memory: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
maxConcurrentActivities: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
maxConcurrentWorkflows: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
initialCount: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
maxCount: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strict>>>>;
|
|
71
|
+
dev: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
72
|
+
startAllWorkersJsScript: z.ZodOptional<z.ZodString>;
|
|
73
|
+
watchPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
}, z.core.$strict>>>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
/**
|
|
77
|
+
* Inferred TypeScript type from the Zod schema.
|
|
78
|
+
*/
|
|
79
|
+
export type ComposerBuildConfig = z.infer<typeof ComposerBuildConfigSchema>;
|
|
80
|
+
/**
|
|
81
|
+
* Input type for defineBuildConfig (allows partial output config).
|
|
82
|
+
*/
|
|
83
|
+
export type ComposerBuildConfigInput = z.input<typeof ComposerBuildConfigSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Development configuration type.
|
|
86
|
+
*/
|
|
87
|
+
export type DevConfig = z.infer<typeof DevConfigSchema>;
|
|
88
|
+
/**
|
|
89
|
+
* Worker profile resources type (all fields required - for defaults).
|
|
90
|
+
*/
|
|
91
|
+
export type WorkerProfileResources = z.infer<typeof WorkerProfileResourcesSchema>;
|
|
92
|
+
/**
|
|
93
|
+
* Worker profile env opt-in type.
|
|
94
|
+
*/
|
|
95
|
+
export type EnvExclusiveOptIn = z.infer<typeof EnvExclusiveOptInSchema>;
|
|
96
|
+
/**
|
|
97
|
+
* Worker profile overrides type (all fields optional - for config).
|
|
98
|
+
*/
|
|
99
|
+
export type WorkerProfileOverrides = z.infer<typeof WorkerProfileOverridesSchema>;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/build-config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;kBAevC,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,uBAAuB;;;kBAU3B,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,4BAA4B;;;;;;;;;;;;kBAGhC,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,eAAe;;;kBAoBnB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;kBAapC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Composer Build Configuration Schema
|
|
4
|
+
*
|
|
5
|
+
* Defines the build configuration schema for the @lotiai/composer package.
|
|
6
|
+
* This allows external teams to configure their own steps, workflows,
|
|
7
|
+
* and worker profiles.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ComposerBuildConfigSchema = exports.WorkerProfileResourcesSchema = void 0;
|
|
11
|
+
const zod_1 = require("zod");
|
|
12
|
+
/**
|
|
13
|
+
* Worker profile resource configuration (required version for defaults).
|
|
14
|
+
* This is the single source of truth for worker profile fields.
|
|
15
|
+
*/
|
|
16
|
+
exports.WorkerProfileResourcesSchema = zod_1.z.strictObject({
|
|
17
|
+
/** CPU units (1024 = 1 vCPU) */
|
|
18
|
+
cpu: zod_1.z.number().int().positive(),
|
|
19
|
+
/** Memory in MB */
|
|
20
|
+
memory: zod_1.z.number().int().positive(),
|
|
21
|
+
/** Maximum concurrent activities per worker */
|
|
22
|
+
maxConcurrentActivities: zod_1.z.number().int().positive(),
|
|
23
|
+
/** Minimum number of worker instances (auto-scaling floor) */
|
|
24
|
+
minCount: zod_1.z.number().int().nonnegative(),
|
|
25
|
+
/** Maximum concurrent workflow task executions per worker */
|
|
26
|
+
maxConcurrentWorkflows: zod_1.z.number().int().positive(),
|
|
27
|
+
/** Initial number of worker instances before autoscaling takes over */
|
|
28
|
+
initialCount: zod_1.z.number().int().nonnegative(),
|
|
29
|
+
/** Maximum number of worker instances for auto-scaling */
|
|
30
|
+
maxCount: zod_1.z.number().int().positive(),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Worker profile resource configuration (partial version for config overrides).
|
|
34
|
+
* All fields are optional - only specify what you want to override.
|
|
35
|
+
*/
|
|
36
|
+
const EnvExclusiveOptInSchema = zod_1.z.strictObject({
|
|
37
|
+
/**
|
|
38
|
+
* Environments where this profile should be deployed as a dedicated worker.
|
|
39
|
+
* If the current env is not listed, the profile's queue is absorbed by fallbackProfile.
|
|
40
|
+
*/
|
|
41
|
+
environments: zod_1.z.array(zod_1.z.string().min(1)).min(1),
|
|
42
|
+
/**
|
|
43
|
+
* Profile that should consume this profile's task queue when not deployed.
|
|
44
|
+
*/
|
|
45
|
+
fallbackProfile: zod_1.z.string().min(1),
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Worker profile override configuration.
|
|
49
|
+
* Resource fields are optional and support environment-specific deployment via envExclusiveOptIn.
|
|
50
|
+
*/
|
|
51
|
+
const WorkerProfileOverridesSchema = zod_1.z.strictObject({
|
|
52
|
+
...exports.WorkerProfileResourcesSchema.partial().shape,
|
|
53
|
+
envExclusiveOptIn: EnvExclusiveOptInSchema.optional(),
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Development configuration for the `composer dev` CLI command.
|
|
57
|
+
*/
|
|
58
|
+
const DevConfigSchema = zod_1.z.strictObject({
|
|
59
|
+
/**
|
|
60
|
+
* Path to the compiled start-all-workers script to spawn for local dev,
|
|
61
|
+
* relative to cwd (the package directory containing composer.build-config.ts).
|
|
62
|
+
*
|
|
63
|
+
* Can be overridden via the `--worker-script` CLI argument.
|
|
64
|
+
*
|
|
65
|
+
* @example "dist/scripts/start-all-workers.js"
|
|
66
|
+
*/
|
|
67
|
+
startAllWorkersJsScript: zod_1.z.string().min(1).optional(),
|
|
68
|
+
/**
|
|
69
|
+
* Glob patterns for files to watch in dev mode.
|
|
70
|
+
* Paths are relative to the config file location (or absolute).
|
|
71
|
+
*
|
|
72
|
+
* @default ["src\/**\/*.ts"]
|
|
73
|
+
* @example ["src\/**\/*.ts"]
|
|
74
|
+
* @example ["../../packages\/**\/src\/**\/*.ts"] (workspace: watch sibling packages)
|
|
75
|
+
*/
|
|
76
|
+
watchPatterns: zod_1.z.array(zod_1.z.string().min(1)).min(1).optional(),
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Complete composer build configuration schema.
|
|
80
|
+
*/
|
|
81
|
+
exports.ComposerBuildConfigSchema = zod_1.z.strictObject({
|
|
82
|
+
/**
|
|
83
|
+
* Optional worker profile overrides.
|
|
84
|
+
* Values are merged with defaults from worker-profiles.ts.
|
|
85
|
+
* Only specify fields you want to override.
|
|
86
|
+
* @example { standard: { cpu: 1024, memory: 4096 } }
|
|
87
|
+
*/
|
|
88
|
+
workerProfiles: zod_1.z.record(zod_1.z.string(), WorkerProfileOverridesSchema).optional().default({}),
|
|
89
|
+
/**
|
|
90
|
+
* Development configuration for the `composer dev` CLI command.
|
|
91
|
+
*/
|
|
92
|
+
dev: DevConfigSchema.optional().default({}),
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/build-config/schema.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6BAAwB;AAExB;;;GAGG;AACU,QAAA,4BAA4B,GAAG,OAAC,CAAC,YAAY,CAAC;IACzD,gCAAgC;IAChC,GAAG,EAAE,OAAC,CAAC,MAAM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