@nanobpm/urban 0.50.0 → 0.52.0
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/runtime/core/execContext.d.ts +5 -0
- package/dist/runtime/core/lineage.d.ts +116 -0
- package/dist/runtime/core/lineage.js +186 -0
- package/dist/runtime/core/modules/datasource.d.ts +6 -0
- package/dist/runtime/core/modules/datasource.js +8 -0
- package/dist/runtime/core/modules/lineage-store.d.ts +81 -0
- package/dist/runtime/core/modules/lineage-store.js +175 -0
- package/dist/runtime/core/modules/pages.js +165 -33
- package/dist/runtime/core/modules/workers.js +69 -2
- package/dist/runtime/engine/nanosdk.js +8 -2
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +5 -0
- package/package.json +1 -1
- package/src/runtime/core/execContext.ts +5 -0
- package/src/runtime/core/lineage.test.ts +215 -0
- package/src/runtime/core/lineage.ts +297 -0
- package/src/runtime/core/modules/datasource.ts +9 -0
- package/src/runtime/core/modules/lineage-store.test.ts +177 -0
- package/src/runtime/core/modules/lineage-store.ts +239 -0
- package/src/runtime/core/modules/pages.test.ts +85 -0
- package/src/runtime/core/modules/pages.ts +165 -33
- package/src/runtime/core/modules/workers.test.ts +136 -1
- package/src/runtime/core/modules/workers.ts +72 -6
- package/src/runtime/engine/nanosdk.test.ts +97 -3
- package/src/runtime/engine/nanosdk.ts +8 -2
- package/src/runtime/index.ts +35 -0
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from "../core/form-contract.ts";
|
|
32
32
|
import type { EngineSdkClient } from "./sdk.ts";
|
|
33
33
|
import { isRecord } from "../core/guards.ts";
|
|
34
|
+
import { applyAmbientLineage } from "../core/lineage.ts";
|
|
34
35
|
|
|
35
36
|
/** Coerce an engine response's process-instance key to a non-empty string, or
|
|
36
37
|
* throw — a missing key means a malformed/partial response, not a real instance. */
|
|
@@ -193,9 +194,12 @@ export class SdkEngineClient implements EngineClient {
|
|
|
193
194
|
variables?: Record<string, unknown>;
|
|
194
195
|
awaitCompletion?: boolean;
|
|
195
196
|
}): Promise<{ processInstanceKey: string; variables?: Record<string, unknown> }> {
|
|
197
|
+
// Auto-thread the `_urban.lineage` envelope (issue #254): a handler that spawns an
|
|
198
|
+
// instance propagates its `rootRequestKey` and stamps `causedByInstanceKey`; a genuine
|
|
199
|
+
// top-level request mints a fresh root. An explicit caller-supplied envelope wins.
|
|
196
200
|
const body = await this.client.createProcessInstance({
|
|
197
201
|
processDefinitionId: input.processDefinitionId,
|
|
198
|
-
variables: input.variables
|
|
202
|
+
variables: applyAmbientLineage(input.variables),
|
|
199
203
|
awaitCompletion: input.awaitCompletion ?? false,
|
|
200
204
|
});
|
|
201
205
|
const rawKey = body.processInstanceKey ?? body.key;
|
|
@@ -217,10 +221,12 @@ export class SdkEngineClient implements EngineClient {
|
|
|
217
221
|
correlationKey?: string;
|
|
218
222
|
variables?: Record<string, unknown>;
|
|
219
223
|
}): Promise<void> {
|
|
224
|
+
// Message-started instances inherit lineage too (issue #254): thread the envelope onto the
|
|
225
|
+
// message variables so the instance the message starts carries `_urban.lineage`.
|
|
220
226
|
await this.client.publishMessage({
|
|
221
227
|
name: input.name,
|
|
222
228
|
correlationKey: input.correlationKey ?? "",
|
|
223
|
-
variables: input.variables
|
|
229
|
+
variables: applyAmbientLineage(input.variables),
|
|
224
230
|
});
|
|
225
231
|
}
|
|
226
232
|
|
package/src/runtime/index.ts
CHANGED
|
@@ -143,6 +143,41 @@ export type {
|
|
|
143
143
|
} from "./core/modules/llm.ts";
|
|
144
144
|
export { evalCorrelation } from "./core/modules/triggers.ts";
|
|
145
145
|
|
|
146
|
+
// Lineage — the framework-level lineage primitive (issue #254): the `_urban.lineage`
|
|
147
|
+
// envelope + auto-threading, and the generic read projection that stitches user intent →
|
|
148
|
+
// progress (a root request → the instances/PRs/tasks it causes).
|
|
149
|
+
export {
|
|
150
|
+
applyAmbientLineage,
|
|
151
|
+
buildLineageTree,
|
|
152
|
+
deriveLineage,
|
|
153
|
+
LINEAGE_KEY,
|
|
154
|
+
LINEAGE_NAMESPACE,
|
|
155
|
+
mintRootRequestKey,
|
|
156
|
+
readLineage,
|
|
157
|
+
writeLineage,
|
|
158
|
+
} from "./core/lineage.ts";
|
|
159
|
+
export type {
|
|
160
|
+
ApplyLineageOptions,
|
|
161
|
+
LineageAttachment,
|
|
162
|
+
LineageEdge,
|
|
163
|
+
LineageEdgeType,
|
|
164
|
+
LineageEnvelope,
|
|
165
|
+
LineageNode,
|
|
166
|
+
LineageTree,
|
|
167
|
+
} from "./core/lineage.ts";
|
|
168
|
+
export {
|
|
169
|
+
LINEAGE_ATTACHMENTS_TABLE,
|
|
170
|
+
LINEAGE_EDGES_TABLE,
|
|
171
|
+
LINEAGE_SCHEMA_SQL,
|
|
172
|
+
LineageStore,
|
|
173
|
+
systemClock as lineageSystemClock,
|
|
174
|
+
} from "./core/modules/lineage-store.ts";
|
|
175
|
+
export type {
|
|
176
|
+
Clock as LineageClock,
|
|
177
|
+
LineageJobLike,
|
|
178
|
+
LineageStoreOptions,
|
|
179
|
+
} from "./core/modules/lineage-store.ts";
|
|
180
|
+
|
|
146
181
|
// Model deploy (deploy-by-convention under `resources/`, ADR 0062)
|
|
147
182
|
export { deployModels, RESOURCES_DIR } from "./core/modules/deploy.ts";
|
|
148
183
|
export { defaultScheduler, MAX_TIMER_DELAY_MS } from "./core/modules/scheduler.ts";
|