@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.
Files changed (189) hide show
  1. package/dist/build-config/index.d.ts +52 -0
  2. package/dist/build-config/index.d.ts.map +1 -0
  3. package/dist/build-config/index.js +66 -0
  4. package/dist/build-config/index.js.map +1 -0
  5. package/dist/build-config/loader.d.ts +80 -0
  6. package/dist/build-config/loader.d.ts.map +1 -0
  7. package/dist/build-config/loader.js +238 -0
  8. package/dist/build-config/loader.js.map +1 -0
  9. package/dist/build-config/schema.d.ts +101 -0
  10. package/dist/build-config/schema.d.ts.map +1 -0
  11. package/dist/build-config/schema.js +94 -0
  12. package/dist/build-config/schema.js.map +1 -0
  13. package/dist/cli/commands/dev-temporal.d.ts +15 -0
  14. package/dist/cli/commands/dev-temporal.d.ts.map +1 -0
  15. package/dist/cli/commands/dev-temporal.js +68 -0
  16. package/dist/cli/commands/dev-temporal.js.map +1 -0
  17. package/dist/cli/commands/dev.d.ts +21 -0
  18. package/dist/cli/commands/dev.d.ts.map +1 -0
  19. package/dist/cli/commands/dev.js +421 -0
  20. package/dist/cli/commands/dev.js.map +1 -0
  21. package/dist/cli/commands/profiles.d.ts +15 -0
  22. package/dist/cli/commands/profiles.d.ts.map +1 -0
  23. package/dist/cli/commands/profiles.js +69 -0
  24. package/dist/cli/commands/profiles.js.map +1 -0
  25. package/dist/cli/index.d.ts +21 -0
  26. package/dist/cli/index.d.ts.map +1 -0
  27. package/dist/cli/index.js +44 -0
  28. package/dist/cli/index.js.map +1 -0
  29. package/dist/index.d.ts +15 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +57 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/internal/async/build/workflow-factory.d.ts +212 -0
  34. package/dist/internal/async/build/workflow-factory.d.ts.map +1 -0
  35. package/dist/internal/async/build/workflow-factory.js +533 -0
  36. package/dist/internal/async/build/workflow-factory.js.map +1 -0
  37. package/dist/internal/async/build-scripts/utils/common.d.ts +28 -0
  38. package/dist/internal/async/build-scripts/utils/common.d.ts.map +1 -0
  39. package/dist/internal/async/build-scripts/utils/common.js +50 -0
  40. package/dist/internal/async/build-scripts/utils/common.js.map +1 -0
  41. package/dist/internal/async/build-scripts/utils/import-module.d.ts +19 -0
  42. package/dist/internal/async/build-scripts/utils/import-module.d.ts.map +1 -0
  43. package/dist/internal/async/build-scripts/utils/import-module.js +80 -0
  44. package/dist/internal/async/build-scripts/utils/import-module.js.map +1 -0
  45. package/dist/internal/async/build-scripts/utils/type-guards.d.ts +123 -0
  46. package/dist/internal/async/build-scripts/utils/type-guards.d.ts.map +1 -0
  47. package/dist/internal/async/build-scripts/utils/type-guards.js +145 -0
  48. package/dist/internal/async/build-scripts/utils/type-guards.js.map +1 -0
  49. package/dist/internal/async/config/cleanup-policy.d.ts +50 -0
  50. package/dist/internal/async/config/cleanup-policy.d.ts.map +1 -0
  51. package/dist/internal/async/config/cleanup-policy.js +20 -0
  52. package/dist/internal/async/config/cleanup-policy.js.map +1 -0
  53. package/dist/internal/async/config/worker-profiles.d.ts +172 -0
  54. package/dist/internal/async/config/worker-profiles.d.ts.map +1 -0
  55. package/dist/internal/async/config/worker-profiles.js +275 -0
  56. package/dist/internal/async/config/worker-profiles.js.map +1 -0
  57. package/dist/internal/async/execute/temporal-client.d.ts +182 -0
  58. package/dist/internal/async/execute/temporal-client.d.ts.map +1 -0
  59. package/dist/internal/async/execute/temporal-client.js +190 -0
  60. package/dist/internal/async/execute/temporal-client.js.map +1 -0
  61. package/dist/internal/async/execute/workflow-execution.d.ts +98 -0
  62. package/dist/internal/async/execute/workflow-execution.d.ts.map +1 -0
  63. package/dist/internal/async/execute/workflow-execution.js +191 -0
  64. package/dist/internal/async/execute/workflow-execution.js.map +1 -0
  65. package/dist/internal/async/metrics/task-queue-metrics.d.ts +74 -0
  66. package/dist/internal/async/metrics/task-queue-metrics.d.ts.map +1 -0
  67. package/dist/internal/async/metrics/task-queue-metrics.js +155 -0
  68. package/dist/internal/async/metrics/task-queue-metrics.js.map +1 -0
  69. package/dist/internal/async/register/activity-worker.d.ts +123 -0
  70. package/dist/internal/async/register/activity-worker.d.ts.map +1 -0
  71. package/dist/internal/async/register/activity-worker.js +355 -0
  72. package/dist/internal/async/register/activity-worker.js.map +1 -0
  73. package/dist/internal/async/register/generate-workflow-source.d.ts +43 -0
  74. package/dist/internal/async/register/generate-workflow-source.d.ts.map +1 -0
  75. package/dist/internal/async/register/generate-workflow-source.js +193 -0
  76. package/dist/internal/async/register/generate-workflow-source.js.map +1 -0
  77. package/dist/internal/async/register/workflow-worker.d.ts +125 -0
  78. package/dist/internal/async/register/workflow-worker.d.ts.map +1 -0
  79. package/dist/internal/async/register/workflow-worker.js +215 -0
  80. package/dist/internal/async/register/workflow-worker.js.map +1 -0
  81. package/dist/internal/async/register-scripts/start-activity-worker.d.ts +70 -0
  82. package/dist/internal/async/register-scripts/start-activity-worker.d.ts.map +1 -0
  83. package/dist/internal/async/register-scripts/start-activity-worker.js +75 -0
  84. package/dist/internal/async/register-scripts/start-activity-worker.js.map +1 -0
  85. package/dist/internal/async/register-scripts/start-all-workers.d.ts +81 -0
  86. package/dist/internal/async/register-scripts/start-all-workers.d.ts.map +1 -0
  87. package/dist/internal/async/register-scripts/start-all-workers.js +84 -0
  88. package/dist/internal/async/register-scripts/start-all-workers.js.map +1 -0
  89. package/dist/internal/async/register-scripts/start-workflow-worker.d.ts +69 -0
  90. package/dist/internal/async/register-scripts/start-workflow-worker.d.ts.map +1 -0
  91. package/dist/internal/async/register-scripts/start-workflow-worker.js +74 -0
  92. package/dist/internal/async/register-scripts/start-workflow-worker.js.map +1 -0
  93. package/dist/internal/async/register-scripts/sync-schedules-cli.d.ts +28 -0
  94. package/dist/internal/async/register-scripts/sync-schedules-cli.d.ts.map +1 -0
  95. package/dist/internal/async/register-scripts/sync-schedules-cli.js +124 -0
  96. package/dist/internal/async/register-scripts/sync-schedules-cli.js.map +1 -0
  97. package/dist/internal/async/register-scripts/sync-schedules-via-lambda.d.ts +55 -0
  98. package/dist/internal/async/register-scripts/sync-schedules-via-lambda.d.ts.map +1 -0
  99. package/dist/internal/async/register-scripts/sync-schedules-via-lambda.js +146 -0
  100. package/dist/internal/async/register-scripts/sync-schedules-via-lambda.js.map +1 -0
  101. package/dist/internal/async/register-scripts/sync-schedules.d.ts +68 -0
  102. package/dist/internal/async/register-scripts/sync-schedules.d.ts.map +1 -0
  103. package/dist/internal/async/register-scripts/sync-schedules.js +83 -0
  104. package/dist/internal/async/register-scripts/sync-schedules.js.map +1 -0
  105. package/dist/internal/async/schedule/constants.d.ts +10 -0
  106. package/dist/internal/async/schedule/constants.d.ts.map +1 -0
  107. package/dist/internal/async/schedule/constants.js +13 -0
  108. package/dist/internal/async/schedule/constants.js.map +1 -0
  109. package/dist/internal/async/schedule/define-schedule.d.ts +192 -0
  110. package/dist/internal/async/schedule/define-schedule.d.ts.map +1 -0
  111. package/dist/internal/async/schedule/define-schedule.js +79 -0
  112. package/dist/internal/async/schedule/define-schedule.js.map +1 -0
  113. package/dist/internal/async/schedule/index.d.ts +3 -0
  114. package/dist/internal/async/schedule/index.d.ts.map +1 -0
  115. package/dist/internal/async/schedule/index.js +9 -0
  116. package/dist/internal/async/schedule/index.js.map +1 -0
  117. package/dist/internal/async/schedule/schedule-definition-schema.d.ts +64 -0
  118. package/dist/internal/async/schedule/schedule-definition-schema.d.ts.map +1 -0
  119. package/dist/internal/async/schedule/schedule-definition-schema.js +77 -0
  120. package/dist/internal/async/schedule/schedule-definition-schema.js.map +1 -0
  121. package/dist/internal/async/schedule/sync-schedules.d.ts +71 -0
  122. package/dist/internal/async/schedule/sync-schedules.d.ts.map +1 -0
  123. package/dist/internal/async/schedule/sync-schedules.js +231 -0
  124. package/dist/internal/async/schedule/sync-schedules.js.map +1 -0
  125. package/dist/internal/async/utils/ensure-namespace.d.ts +16 -0
  126. package/dist/internal/async/utils/ensure-namespace.d.ts.map +1 -0
  127. package/dist/internal/async/utils/ensure-namespace.js +64 -0
  128. package/dist/internal/async/utils/ensure-namespace.js.map +1 -0
  129. package/dist/internal/async/utils/find-package-root.d.ts +9 -0
  130. package/dist/internal/async/utils/find-package-root.d.ts.map +1 -0
  131. package/dist/internal/async/utils/find-package-root.js +28 -0
  132. package/dist/internal/async/utils/find-package-root.js.map +1 -0
  133. package/dist/internal/async/utils/is-composer-error.d.ts +14 -0
  134. package/dist/internal/async/utils/is-composer-error.d.ts.map +1 -0
  135. package/dist/internal/async/utils/is-composer-error.js +17 -0
  136. package/dist/internal/async/utils/is-composer-error.js.map +1 -0
  137. package/dist/internal/context-provider.d.ts +316 -0
  138. package/dist/internal/context-provider.d.ts.map +1 -0
  139. package/dist/internal/context-provider.js +12 -0
  140. package/dist/internal/context-provider.js.map +1 -0
  141. package/dist/internal/create-composer.d.ts +57 -0
  142. package/dist/internal/create-composer.d.ts.map +1 -0
  143. package/dist/internal/create-composer.js +125 -0
  144. package/dist/internal/create-composer.js.map +1 -0
  145. package/dist/internal/dag-sync-fanout.d.ts +79 -0
  146. package/dist/internal/dag-sync-fanout.d.ts.map +1 -0
  147. package/dist/internal/dag-sync-fanout.js +59 -0
  148. package/dist/internal/dag-sync-fanout.js.map +1 -0
  149. package/dist/internal/dag-sync-step.d.ts +230 -0
  150. package/dist/internal/dag-sync-step.d.ts.map +1 -0
  151. package/dist/internal/dag-sync-step.js +159 -0
  152. package/dist/internal/dag-sync-step.js.map +1 -0
  153. package/dist/internal/dag-sync-workflow.d.ts +535 -0
  154. package/dist/internal/dag-sync-workflow.d.ts.map +1 -0
  155. package/dist/internal/dag-sync-workflow.js +843 -0
  156. package/dist/internal/dag-sync-workflow.js.map +1 -0
  157. package/dist/internal/defaults.d.ts +24 -0
  158. package/dist/internal/defaults.d.ts.map +1 -0
  159. package/dist/internal/defaults.js +102 -0
  160. package/dist/internal/defaults.js.map +1 -0
  161. package/dist/internal/errors.d.ts +109 -0
  162. package/dist/internal/errors.d.ts.map +1 -0
  163. package/dist/internal/errors.js +212 -0
  164. package/dist/internal/errors.js.map +1 -0
  165. package/dist/internal/index.d.ts +9 -0
  166. package/dist/internal/index.d.ts.map +1 -0
  167. package/dist/internal/index.js +22 -0
  168. package/dist/internal/index.js.map +1 -0
  169. package/dist/internal/observability.d.ts +63 -0
  170. package/dist/internal/observability.d.ts.map +1 -0
  171. package/dist/internal/observability.js +323 -0
  172. package/dist/internal/observability.js.map +1 -0
  173. package/dist/internal/types.d.ts +80 -0
  174. package/dist/internal/types.d.ts.map +1 -0
  175. package/dist/internal/types.js +9 -0
  176. package/dist/internal/types.js.map +1 -0
  177. package/dist/internal/workflow-planning.d.ts +107 -0
  178. package/dist/internal/workflow-planning.d.ts.map +1 -0
  179. package/dist/internal/workflow-planning.js +216 -0
  180. package/dist/internal/workflow-planning.js.map +1 -0
  181. package/dist/schedule-sync.d.ts +17 -0
  182. package/dist/schedule-sync.d.ts.map +1 -0
  183. package/dist/schedule-sync.js +22 -0
  184. package/dist/schedule-sync.js.map +1 -0
  185. package/dist/temporal-naming.d.ts +27 -0
  186. package/dist/temporal-naming.d.ts.map +1 -0
  187. package/dist/temporal-naming.js +33 -0
  188. package/dist/temporal-naming.js.map +1 -0
  189. package/package.json +29 -17
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow Planning Logic for DAG Execution
4
+ *
5
+ * This module extracts the topological sort and batch planning logic from the
6
+ * synchronous workflow engine, making it reusable for both sync and async (Temporal)
7
+ * execution strategies.
8
+ *
9
+ * ## Execution Model
10
+ *
11
+ * The planner performs dependency analysis to determine which steps can run in parallel:
12
+ *
13
+ * 1. **Dependency Analysis**: Build a directed acyclic graph (DAG) of step dependencies
14
+ * 2. **Topological Sort**: Use Kahn's algorithm to find valid execution order
15
+ * 3. **Batch Formation**: Group steps with no dependencies into parallel "batches"
16
+ * 4. **Validation**: Detect cycles, missing dependencies, and conflicts
17
+ *
18
+ * ## Example
19
+ *
20
+ * Given workflow:
21
+ * - stepA: needs [] → provides ["x"]
22
+ * - stepB: needs ["x"] → provides ["y"]
23
+ * - stepC: needs ["x"] → provides ["z"]
24
+ * - stepD: needs ["y", "z"] → provides ["result"]
25
+ *
26
+ * Planning output:
27
+ * ```
28
+ * [
29
+ * [stepA], // Batch 0: No dependencies
30
+ * [stepB, stepC], // Batch 1: Both need "x" (parallel)
31
+ * [stepD] // Batch 2: Needs both "y" and "z"
32
+ * ]
33
+ * ```
34
+ *
35
+ * ## Usage
36
+ *
37
+ * For Temporal workflows:
38
+ * ```ts
39
+ * const plan = planWorkflowBatches(workflow.steps, initialFields);
40
+ * // Convert each batch to Temporal activities that can run in parallel
41
+ * ```
42
+ *
43
+ * For synchronous workflows:
44
+ * ```ts
45
+ * const plan = planWorkflowBatches(workflow.steps, initialFields);
46
+ * for (const batch of plan.batches) {
47
+ * await Promise.all(batch.map(step => step.run(ctx, bag)));
48
+ * }
49
+ * ```
50
+ */
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.planWorkflowBatches = planWorkflowBatches;
53
+ exports.validateWorkflowPlan = validateWorkflowPlan;
54
+ /**
55
+ * Plans the execution of a workflow by performing topological sort with batch grouping.
56
+ *
57
+ * This function:
58
+ * 1. Validates that all dependencies can be satisfied
59
+ * 2. Detects duplicate providers and cycles
60
+ * 3. Groups steps into parallel execution batches using Kahn's algorithm
61
+ * 4. Returns an execution plan optimized for maximum parallelism
62
+ *
63
+ * @param steps - Array of steps in the workflow
64
+ * @param initialFields - Fields provided as initial data (satisfy dependencies without producers)
65
+ * @returns Workflow execution plan with steps organized into parallel batches
66
+ * @throws Error if dependencies cannot be satisfied, cycles exist, or duplicate providers found
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const plan = planWorkflowBatches(
71
+ * [stepA, stepB, stepC, stepD],
72
+ * new Set(["userId"])
73
+ * );
74
+ *
75
+ * // Execute each batch in sequence, steps within a batch in parallel
76
+ * for (const batch of plan.batches) {
77
+ * await Promise.all(batch.map(step => executeStep(step)));
78
+ * }
79
+ * ```
80
+ */
81
+ function planWorkflowBatches(steps, initialFields = new Set()) {
82
+ // Build a map of which step produces each field (detect duplicates)
83
+ const producers = new Map();
84
+ for (const step of steps) {
85
+ for (const fieldKey of step.provides) {
86
+ if (producers.has(fieldKey)) {
87
+ throw new Error(`Duplicate producer for field "${String(fieldKey)}": ` +
88
+ `${producers.get(fieldKey)} and ${step.name}. ` +
89
+ `Each field can only be produced by one step.`);
90
+ }
91
+ producers.set(fieldKey, step.name);
92
+ }
93
+ }
94
+ // Validate that steps don't try to overwrite initial fields
95
+ for (const step of steps) {
96
+ for (const fieldKey of step.provides) {
97
+ if (initialFields.has(fieldKey)) {
98
+ throw new Error(`Step "${step.name}" cannot overwrite initial field "${String(fieldKey)}". ` +
99
+ `Initial data is protected from modification.`);
100
+ }
101
+ }
102
+ }
103
+ // Validate that all dependencies can be satisfied
104
+ const allProvidedFields = new Set(initialFields);
105
+ for (const step of steps) {
106
+ for (const fieldKey of step.provides) {
107
+ allProvidedFields.add(fieldKey);
108
+ }
109
+ }
110
+ for (const step of steps) {
111
+ for (const neededField of step.needs) {
112
+ if (!allProvidedFields.has(neededField)) {
113
+ throw new Error(`Step "${step.name}" requires field "${String(neededField)}" but no previous step provides it. ` +
114
+ `Available fields: [${Array.from(allProvidedFields).map(String).join(", ")}]. ` +
115
+ `Make sure a previous step provides "${String(neededField)}" or include it in initial data.`);
116
+ }
117
+ }
118
+ }
119
+ // Build dependency graph using adjacency lists
120
+ const stepsByName = new Map(steps.map((step) => [step.name, step]));
121
+ // children[stepName] = list of steps that depend on this step's outputs
122
+ const children = new Map();
123
+ // indegree[stepName] = number of unmet dependencies
124
+ const indegree = new Map(steps.map((step) => [step.name, 0]));
125
+ // Build the graph by connecting producers to consumers
126
+ for (const step of steps) {
127
+ let unmetDependencies = 0;
128
+ for (const neededField of step.needs) {
129
+ // Skip fields provided in initial data
130
+ if (initialFields.has(neededField))
131
+ continue;
132
+ const providerStep = producers.get(neededField);
133
+ if (!providerStep) {
134
+ throw new Error(`No producer for required field "${String(neededField)}" used by step "${step.name}"`);
135
+ }
136
+ // Add this step as a dependent of the provider
137
+ children.set(providerStep, [...(children.get(providerStep) ?? []), step.name]);
138
+ unmetDependencies++;
139
+ }
140
+ indegree.set(step.name, unmetDependencies);
141
+ }
142
+ // Perform topological sort with batch grouping (Kahn's algorithm)
143
+ // Each iteration processes one "batch" of steps that can run in parallel
144
+ const batches = [];
145
+ let readySteps = steps
146
+ .filter((step) => (indegree.get(step.name) ?? 0) === 0)
147
+ .map((step) => step.name);
148
+ while (readySteps.length > 0) {
149
+ // Validate that no two steps in the same batch produce the same field
150
+ // This prevents race conditions in parallel execution
151
+ const fieldsProducedInBatch = new Set();
152
+ for (const stepName of readySteps) {
153
+ const step = stepsByName.get(stepName);
154
+ for (const fieldKey of step.provides) {
155
+ const fieldName = String(fieldKey);
156
+ if (fieldsProducedInBatch.has(fieldName)) {
157
+ throw new Error(`Conflict: Multiple steps in the same execution batch produce field "${fieldName}". ` +
158
+ `This would cause non-deterministic behavior. ` +
159
+ `Steps in batch: [${readySteps.join(", ")}]`);
160
+ }
161
+ fieldsProducedInBatch.add(fieldName);
162
+ }
163
+ }
164
+ // Add this batch to the plan
165
+ const batchSteps = readySteps.map((stepName) => stepsByName.get(stepName));
166
+ batches.push(batchSteps);
167
+ // Update dependency graph: reduce indegree for dependent steps
168
+ const nextReadySteps = [];
169
+ for (const completedStepName of readySteps) {
170
+ for (const dependentStepName of children.get(completedStepName) ?? []) {
171
+ const newIndegree = (indegree.get(dependentStepName) ?? 0) - 1;
172
+ indegree.set(dependentStepName, newIndegree);
173
+ // If this step now has no unmet dependencies, it's ready for the next batch
174
+ if (newIndegree === 0) {
175
+ nextReadySteps.push(dependentStepName);
176
+ }
177
+ }
178
+ }
179
+ readySteps = nextReadySteps;
180
+ }
181
+ // Validate that all steps were processed (detect cycles)
182
+ const unfinishedSteps = [...indegree.entries()].filter(([, degree]) => (degree ?? 0) > 0);
183
+ if (unfinishedSteps.length > 0) {
184
+ const unfinishedNames = unfinishedSteps.map(([stepName]) => stepName);
185
+ throw new Error(`Unable to resolve dependencies for steps: [${unfinishedNames.join(", ")}]. ` +
186
+ `This indicates a circular dependency in the workflow.`);
187
+ }
188
+ return {
189
+ batches,
190
+ producers,
191
+ providedFields: allProvidedFields,
192
+ };
193
+ }
194
+ /**
195
+ * Validates a workflow plan for common issues.
196
+ *
197
+ * This is a convenience function that runs the planner and returns
198
+ * validation errors without throwing.
199
+ *
200
+ * @param steps - Array of steps in the workflow
201
+ * @param initialFields - Fields provided as initial data
202
+ * @returns Validation result with success flag and optional error message
203
+ */
204
+ function validateWorkflowPlan(steps, initialFields = new Set()) {
205
+ try {
206
+ const plan = planWorkflowBatches(steps, initialFields);
207
+ return { success: true, plan };
208
+ }
209
+ catch (error) {
210
+ return {
211
+ success: false,
212
+ error: error instanceof Error ? error.message : String(error),
213
+ };
214
+ }
215
+ }
216
+ //# sourceMappingURL=workflow-planning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-planning.js","sourceRoot":"","sources":["../../src/internal/workflow-planning.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;;AA6CH,kDA6IC;AAYD,oDAaC;AAjMD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,mBAAmB,CACjC,KAAsC,EACtC,gBAAgC,IAAI,GAAG,EAAE;IAEzC,oEAAoE;IACpE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CACb,iCAAiC,MAAM,CAAC,QAAQ,CAAC,KAAK;oBACpD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AAE,aAAa,CAAC,CAAC;QACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Schedule sync entry point.
3
+ *
4
+ * Exposed as a dedicated subpath export (@lotiai/composer/schedule-sync) so
5
+ * infrastructure Lambdas can import the reconciler and its payload schema
6
+ * without pulling in the full Composer framework surface (worker runtime,
7
+ * webpack, swc native bindings, chokidar, jiti, etc.) that the root barrel
8
+ * and ./internal both drag in via create-composer + register helpers.
9
+ *
10
+ * We import directly from leaf modules here -- NOT via ./internal -- so
11
+ * esbuild never traces through create-composer.ts and its worker imports.
12
+ * Keep this module narrowly focused on server-side reconciliation.
13
+ */
14
+ export type { ScheduleDefinition } from "./internal/async/schedule/define-schedule";
15
+ export { scheduleDefinitionSchema, scheduleOverlapPolicySchema, } from "./internal/async/schedule/schedule-definition-schema";
16
+ export { type SyncSchedulesResult, syncSchedules, } from "./internal/async/schedule/sync-schedules";
17
+ //# sourceMappingURL=schedule-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-sync.d.ts","sourceRoot":"","sources":["../src/schedule-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EACL,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,KAAK,mBAAmB,EACxB,aAAa,GACd,MAAM,0CAA0C,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Schedule sync entry point.
4
+ *
5
+ * Exposed as a dedicated subpath export (@lotiai/composer/schedule-sync) so
6
+ * infrastructure Lambdas can import the reconciler and its payload schema
7
+ * without pulling in the full Composer framework surface (worker runtime,
8
+ * webpack, swc native bindings, chokidar, jiti, etc.) that the root barrel
9
+ * and ./internal both drag in via create-composer + register helpers.
10
+ *
11
+ * We import directly from leaf modules here -- NOT via ./internal -- so
12
+ * esbuild never traces through create-composer.ts and its worker imports.
13
+ * Keep this module narrowly focused on server-side reconciliation.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.syncSchedules = exports.scheduleOverlapPolicySchema = exports.scheduleDefinitionSchema = void 0;
17
+ var schedule_definition_schema_1 = require("./internal/async/schedule/schedule-definition-schema");
18
+ Object.defineProperty(exports, "scheduleDefinitionSchema", { enumerable: true, get: function () { return schedule_definition_schema_1.scheduleDefinitionSchema; } });
19
+ Object.defineProperty(exports, "scheduleOverlapPolicySchema", { enumerable: true, get: function () { return schedule_definition_schema_1.scheduleOverlapPolicySchema; } });
20
+ var sync_schedules_1 = require("./internal/async/schedule/sync-schedules");
21
+ Object.defineProperty(exports, "syncSchedules", { enumerable: true, get: function () { return sync_schedules_1.syncSchedules; } });
22
+ //# sourceMappingURL=schedule-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-sync.js","sourceRoot":"","sources":["../src/schedule-sync.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAGH,mGAG8D;AAF5D,sIAAA,wBAAwB,OAAA;AACxB,yIAAA,2BAA2B,OAAA;AAE7B,2EAGkD;AADhD,+GAAA,aAAa,OAAA"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Temporal Worker Versioning deployment series naming conventions.
3
+ *
4
+ * Exposed as a dedicated subpath export (@lotiai/composer/temporal-naming) so
5
+ * infrastructure Lambdas can import these lightweight constants without pulling
6
+ * in the full Composer framework or Temporal SDK.
7
+ */
8
+ export declare const WORKER_DEPLOYMENT_SUFFIXES: {
9
+ readonly ACTIVITIES: "activities";
10
+ readonly WORKFLOWS: "workflows";
11
+ };
12
+ /**
13
+ * Derives the Temporal Worker Versioning deployment series names from a service name.
14
+ *
15
+ * Each service runs two worker types (activity and workflow), each with its own
16
+ * deployment series for independent versioning. CI uses these same names when
17
+ * calling setCurrentDeployment after a deploy.
18
+ *
19
+ * @example
20
+ * getDeploymentSeriesNames("orders-service")
21
+ * // => { activities: "orders-service-activities", workflows: "orders-service-workflows" }
22
+ */
23
+ export declare function getDeploymentSeriesNames(serviceName: string): {
24
+ activities: string;
25
+ workflows: string;
26
+ };
27
+ //# sourceMappingURL=temporal-naming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal-naming.d.ts","sourceRoot":"","sources":["../src/temporal-naming.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM;;;EAK3D"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * Temporal Worker Versioning deployment series naming conventions.
4
+ *
5
+ * Exposed as a dedicated subpath export (@lotiai/composer/temporal-naming) so
6
+ * infrastructure Lambdas can import these lightweight constants without pulling
7
+ * in the full Composer framework or Temporal SDK.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WORKER_DEPLOYMENT_SUFFIXES = void 0;
11
+ exports.getDeploymentSeriesNames = getDeploymentSeriesNames;
12
+ exports.WORKER_DEPLOYMENT_SUFFIXES = {
13
+ ACTIVITIES: "activities",
14
+ WORKFLOWS: "workflows",
15
+ };
16
+ /**
17
+ * Derives the Temporal Worker Versioning deployment series names from a service name.
18
+ *
19
+ * Each service runs two worker types (activity and workflow), each with its own
20
+ * deployment series for independent versioning. CI uses these same names when
21
+ * calling setCurrentDeployment after a deploy.
22
+ *
23
+ * @example
24
+ * getDeploymentSeriesNames("orders-service")
25
+ * // => { activities: "orders-service-activities", workflows: "orders-service-workflows" }
26
+ */
27
+ function getDeploymentSeriesNames(serviceName) {
28
+ return {
29
+ activities: `${serviceName}-${exports.WORKER_DEPLOYMENT_SUFFIXES.ACTIVITIES}`,
30
+ workflows: `${serviceName}-${exports.WORKER_DEPLOYMENT_SUFFIXES.WORKFLOWS}`,
31
+ };
32
+ }
33
+ //# sourceMappingURL=temporal-naming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal-naming.js","sourceRoot":"","sources":["../src/temporal-naming.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkBH,4DAKC;AArBY,QAAA,0BAA0B,GAAG;IACxC,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;CACd,CAAC;AAEX;;;;;;;;;;GAUG;AACH,SAAgB,wBAAwB,CAAC,WAAmB;IAC1D,OAAO;QACL,UAAU,EAAE,GAAG,WAAW,IAAI,kCAA0B,CAAC,UAAU,EAAE;QACrE,SAAS,EAAE,GAAG,WAAW,IAAI,kCAA0B,CAAC,SAAS,EAAE;KACpE,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotiai/composer",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A framework for building type-safe, DAG-based workflows with optional Temporal integration.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -21,6 +21,19 @@
21
21
  },
22
22
  "main": "dist/index.js",
23
23
  "types": "dist/index.d.ts",
24
+ "typesVersions": {
25
+ "*": {
26
+ "build-config": [
27
+ "dist/build-config/index.d.ts"
28
+ ],
29
+ "temporal-naming": [
30
+ "dist/temporal-naming.d.ts"
31
+ ],
32
+ "schedule-sync": [
33
+ "dist/schedule-sync.d.ts"
34
+ ]
35
+ }
36
+ },
24
37
  "bin": {
25
38
  "composer": "bin/composer.js"
26
39
  },
@@ -53,20 +66,6 @@
53
66
  "access": "public",
54
67
  "registry": "https://registry.npmjs.org"
55
68
  },
56
- "scripts": {
57
- "compile": "tsc --build",
58
- "clean": "rm -rf dist *.tsbuildinfo",
59
- "test": "pnpm test:vitest",
60
- "test:vitest": "vitest run --config vitest.config.mts --typecheck",
61
- "test:vitest:watch": "vitest --config vitest.config.mts",
62
- "test:watch": "pnpm test:vitest:watch",
63
- "test:coverage": "vitest run --config vitest.config.mts --coverage",
64
- "dev:temporal:up": "docker-compose -f docker-compose.temporal.yml up -d",
65
- "dev:temporal:down": "docker-compose -f docker-compose.temporal.yml down",
66
- "dev:temporal:logs": "docker-compose -f docker-compose.temporal.yml logs -f",
67
- "cli": "node dist/cli/index.js",
68
- "cli:dev": "node dist/cli/index.js dev"
69
- },
70
69
  "dependencies": {
71
70
  "@aws-sdk/client-cloudwatch": "^3.946.0",
72
71
  "@aws-sdk/client-lambda": "^3.658.1",
@@ -95,5 +94,18 @@
95
94
  "engines": {
96
95
  "node": ">=22"
97
96
  },
98
- "packageManager": "pnpm@10.28.2"
99
- }
97
+ "scripts": {
98
+ "compile": "tsc --build",
99
+ "clean": "rm -rf dist *.tsbuildinfo",
100
+ "test": "pnpm test:vitest",
101
+ "test:vitest": "vitest run --config vitest.config.mts --typecheck",
102
+ "test:vitest:watch": "vitest --config vitest.config.mts",
103
+ "test:watch": "pnpm test:vitest:watch",
104
+ "test:coverage": "vitest run --config vitest.config.mts --coverage",
105
+ "dev:temporal:up": "docker-compose -f docker-compose.temporal.yml up -d",
106
+ "dev:temporal:down": "docker-compose -f docker-compose.temporal.yml down",
107
+ "dev:temporal:logs": "docker-compose -f docker-compose.temporal.yml logs -f",
108
+ "cli": "node dist/cli/index.js",
109
+ "cli:dev": "node dist/cli/index.js dev"
110
+ }
111
+ }