@swirls/looms 0.22.1 → 0.23.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/CHANGELOG.md +6 -0
- package/dist/approval/effects.d.ts +26 -26
- package/dist/approval/module.d.ts +52 -52
- package/dist/evaluator/effects.d.ts +33 -33
- package/dist/evaluator/module.d.ts +66 -66
- package/dist/nats/index.d.ts +3 -2
- package/dist/nats/index.js +3 -2
- package/dist/nats/projector.d.ts +26 -44
- package/dist/nats/projector.js +63 -175
- package/dist/nats/subjects.d.ts +24 -3
- package/dist/nats/subjects.js +36 -5
- package/dist/nats/transport.d.ts +101 -0
- package/dist/nats/transport.js +185 -0
- package/dist/schedule/module.d.ts +36 -36
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e8e38fd: Let the NATS projector reach a stream without a NATS connection, and file a run's subjects under its attributes. `natsProjector` takes a `transport` with two operations, the last message on a subject filter and an atomic commit that expects a stream sequence, so a host behind an HTTP bridge supplies its own; `natsConnectionTransport` is the one over a connection and is still what `connection` or `connect` gives you. `subjectAttributes` puts the named run attributes before the run id, `<prefix>.run.<attributes>.<runId>.<type>`, so a consumer filters one tenant's events on the server. `NatsProjectorSettings` no longer holds `stream`, `createStream` and `timeoutMs`: they are `NatsStreamSettings`.
|
|
8
|
+
|
|
3
9
|
## 0.22.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -9,32 +9,6 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
9
9
|
}[];
|
|
10
10
|
readonly schema?: import("effect/Schema").Json | undefined;
|
|
11
11
|
}, never, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
12
|
-
readonly type: "approval.decided";
|
|
13
|
-
readonly payload: {
|
|
14
|
-
readonly approvalId: string;
|
|
15
|
-
readonly actionId: string;
|
|
16
|
-
readonly outcome: "approve" | "reject";
|
|
17
|
-
readonly payload?: import("effect/Schema").Json | undefined;
|
|
18
|
-
};
|
|
19
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
20
|
-
readonly type: "approval.requested";
|
|
21
|
-
readonly payload: {
|
|
22
|
-
readonly approvalId: string;
|
|
23
|
-
readonly title: string;
|
|
24
|
-
readonly description?: string | undefined;
|
|
25
|
-
readonly actions: readonly {
|
|
26
|
-
readonly id: string;
|
|
27
|
-
readonly label: string;
|
|
28
|
-
readonly outcome: "approve" | "reject";
|
|
29
|
-
}[];
|
|
30
|
-
readonly schema?: import("effect/Schema").Json | undefined;
|
|
31
|
-
};
|
|
32
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
33
|
-
readonly type: "approval.timed_out";
|
|
34
|
-
readonly payload: {
|
|
35
|
-
readonly approvalId: string;
|
|
36
|
-
};
|
|
37
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
38
12
|
readonly type: "runtime.child.close.requested";
|
|
39
13
|
readonly payload: {
|
|
40
14
|
readonly policy: "terminate" | "wait";
|
|
@@ -280,4 +254,30 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
280
254
|
readonly payload: import("effect/Schema").Json;
|
|
281
255
|
};
|
|
282
256
|
};
|
|
257
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
258
|
+
readonly type: "approval.decided";
|
|
259
|
+
readonly payload: {
|
|
260
|
+
readonly approvalId: string;
|
|
261
|
+
readonly actionId: string;
|
|
262
|
+
readonly outcome: "approve" | "reject";
|
|
263
|
+
readonly payload?: import("effect/Schema").Json | undefined;
|
|
264
|
+
};
|
|
265
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
266
|
+
readonly type: "approval.requested";
|
|
267
|
+
readonly payload: {
|
|
268
|
+
readonly approvalId: string;
|
|
269
|
+
readonly title: string;
|
|
270
|
+
readonly description?: string | undefined;
|
|
271
|
+
readonly actions: readonly {
|
|
272
|
+
readonly id: string;
|
|
273
|
+
readonly label: string;
|
|
274
|
+
readonly outcome: "approve" | "reject";
|
|
275
|
+
}[];
|
|
276
|
+
readonly schema?: import("effect/Schema").Json | undefined;
|
|
277
|
+
};
|
|
278
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
279
|
+
readonly type: "approval.timed_out";
|
|
280
|
+
readonly payload: {
|
|
281
|
+
readonly approvalId: string;
|
|
282
|
+
};
|
|
283
283
|
})>>;
|
|
@@ -32,32 +32,6 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
32
32
|
}[];
|
|
33
33
|
readonly schema?: import("effect/Schema").Json | undefined;
|
|
34
34
|
}, never, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
35
|
-
readonly type: "approval.decided";
|
|
36
|
-
readonly payload: {
|
|
37
|
-
readonly approvalId: string;
|
|
38
|
-
readonly actionId: string;
|
|
39
|
-
readonly outcome: "approve" | "reject";
|
|
40
|
-
readonly payload?: import("effect/Schema").Json | undefined;
|
|
41
|
-
};
|
|
42
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
43
|
-
readonly type: "approval.requested";
|
|
44
|
-
readonly payload: {
|
|
45
|
-
readonly approvalId: string;
|
|
46
|
-
readonly title: string;
|
|
47
|
-
readonly description?: string | undefined;
|
|
48
|
-
readonly actions: readonly {
|
|
49
|
-
readonly id: string;
|
|
50
|
-
readonly label: string;
|
|
51
|
-
readonly outcome: "approve" | "reject";
|
|
52
|
-
}[];
|
|
53
|
-
readonly schema?: import("effect/Schema").Json | undefined;
|
|
54
|
-
};
|
|
55
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
56
|
-
readonly type: "approval.timed_out";
|
|
57
|
-
readonly payload: {
|
|
58
|
-
readonly approvalId: string;
|
|
59
|
-
};
|
|
60
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
61
35
|
readonly type: "runtime.child.close.requested";
|
|
62
36
|
readonly payload: {
|
|
63
37
|
readonly policy: "terminate" | "wait";
|
|
@@ -303,6 +277,32 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
303
277
|
readonly payload: import("effect/Schema").Json;
|
|
304
278
|
};
|
|
305
279
|
};
|
|
280
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
281
|
+
readonly type: "approval.decided";
|
|
282
|
+
readonly payload: {
|
|
283
|
+
readonly approvalId: string;
|
|
284
|
+
readonly actionId: string;
|
|
285
|
+
readonly outcome: "approve" | "reject";
|
|
286
|
+
readonly payload?: import("effect/Schema").Json | undefined;
|
|
287
|
+
};
|
|
288
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
289
|
+
readonly type: "approval.requested";
|
|
290
|
+
readonly payload: {
|
|
291
|
+
readonly approvalId: string;
|
|
292
|
+
readonly title: string;
|
|
293
|
+
readonly description?: string | undefined;
|
|
294
|
+
readonly actions: readonly {
|
|
295
|
+
readonly id: string;
|
|
296
|
+
readonly label: string;
|
|
297
|
+
readonly outcome: "approve" | "reject";
|
|
298
|
+
}[];
|
|
299
|
+
readonly schema?: import("effect/Schema").Json | undefined;
|
|
300
|
+
};
|
|
301
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
302
|
+
readonly type: "approval.timed_out";
|
|
303
|
+
readonly payload: {
|
|
304
|
+
readonly approvalId: string;
|
|
305
|
+
};
|
|
306
306
|
})>;
|
|
307
307
|
}, {}, {
|
|
308
308
|
pendingApprovals: import("@swirls/looms/core").ProjectionDefinition<{
|
|
@@ -346,32 +346,6 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
346
346
|
}[];
|
|
347
347
|
readonly schema?: import("effect/Schema").Json | undefined;
|
|
348
348
|
}, never, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
349
|
-
readonly type: "approval.decided";
|
|
350
|
-
readonly payload: {
|
|
351
|
-
readonly approvalId: string;
|
|
352
|
-
readonly actionId: string;
|
|
353
|
-
readonly outcome: "approve" | "reject";
|
|
354
|
-
readonly payload?: import("effect/Schema").Json | undefined;
|
|
355
|
-
};
|
|
356
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
357
|
-
readonly type: "approval.requested";
|
|
358
|
-
readonly payload: {
|
|
359
|
-
readonly approvalId: string;
|
|
360
|
-
readonly title: string;
|
|
361
|
-
readonly description?: string | undefined;
|
|
362
|
-
readonly actions: readonly {
|
|
363
|
-
readonly id: string;
|
|
364
|
-
readonly label: string;
|
|
365
|
-
readonly outcome: "approve" | "reject";
|
|
366
|
-
}[];
|
|
367
|
-
readonly schema?: import("effect/Schema").Json | undefined;
|
|
368
|
-
};
|
|
369
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
370
|
-
readonly type: "approval.timed_out";
|
|
371
|
-
readonly payload: {
|
|
372
|
-
readonly approvalId: string;
|
|
373
|
-
};
|
|
374
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
375
349
|
readonly type: "runtime.child.close.requested";
|
|
376
350
|
readonly payload: {
|
|
377
351
|
readonly policy: "terminate" | "wait";
|
|
@@ -617,6 +591,32 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
617
591
|
readonly payload: import("effect/Schema").Json;
|
|
618
592
|
};
|
|
619
593
|
};
|
|
594
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
595
|
+
readonly type: "approval.decided";
|
|
596
|
+
readonly payload: {
|
|
597
|
+
readonly approvalId: string;
|
|
598
|
+
readonly actionId: string;
|
|
599
|
+
readonly outcome: "approve" | "reject";
|
|
600
|
+
readonly payload?: import("effect/Schema").Json | undefined;
|
|
601
|
+
};
|
|
602
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
603
|
+
readonly type: "approval.requested";
|
|
604
|
+
readonly payload: {
|
|
605
|
+
readonly approvalId: string;
|
|
606
|
+
readonly title: string;
|
|
607
|
+
readonly description?: string | undefined;
|
|
608
|
+
readonly actions: readonly {
|
|
609
|
+
readonly id: string;
|
|
610
|
+
readonly label: string;
|
|
611
|
+
readonly outcome: "approve" | "reject";
|
|
612
|
+
}[];
|
|
613
|
+
readonly schema?: import("effect/Schema").Json | undefined;
|
|
614
|
+
};
|
|
615
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
616
|
+
readonly type: "approval.timed_out";
|
|
617
|
+
readonly payload: {
|
|
618
|
+
readonly approvalId: string;
|
|
619
|
+
};
|
|
620
620
|
})>;
|
|
621
621
|
};
|
|
622
622
|
readonly threads: {};
|
|
@@ -7,39 +7,6 @@ export declare const evaluateEffect: NoInfer<import("@swirls/looms/core").LocalE
|
|
|
7
7
|
readonly definitionVersion?: string | undefined;
|
|
8
8
|
readonly input?: Schema.Json | undefined;
|
|
9
9
|
}, EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
10
|
-
readonly type: "evaluator.evaluated";
|
|
11
|
-
readonly payload: {
|
|
12
|
-
readonly evaluationId: string;
|
|
13
|
-
readonly definitionName?: string | undefined;
|
|
14
|
-
readonly answers: {
|
|
15
|
-
readonly [x: string]: {
|
|
16
|
-
readonly type: "boolean";
|
|
17
|
-
readonly value: boolean;
|
|
18
|
-
readonly probability: number;
|
|
19
|
-
} | {
|
|
20
|
-
readonly type: "choice";
|
|
21
|
-
readonly value: string;
|
|
22
|
-
} | {
|
|
23
|
-
readonly type: "score";
|
|
24
|
-
readonly value: number;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
readonly route: string;
|
|
28
|
-
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
29
|
-
readonly usage?: {
|
|
30
|
-
readonly input: number;
|
|
31
|
-
readonly output: number;
|
|
32
|
-
} | undefined;
|
|
33
|
-
};
|
|
34
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
35
|
-
readonly type: "evaluator.requested";
|
|
36
|
-
readonly payload: {
|
|
37
|
-
readonly evaluationId: string;
|
|
38
|
-
readonly definitionName?: string | undefined;
|
|
39
|
-
readonly state: string;
|
|
40
|
-
readonly model?: string | undefined;
|
|
41
|
-
};
|
|
42
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
43
10
|
readonly type: "runtime.child.close.requested";
|
|
44
11
|
readonly payload: {
|
|
45
12
|
readonly policy: "terminate" | "wait";
|
|
@@ -285,4 +252,37 @@ export declare const evaluateEffect: NoInfer<import("@swirls/looms/core").LocalE
|
|
|
285
252
|
readonly payload: Schema.Json;
|
|
286
253
|
};
|
|
287
254
|
};
|
|
255
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
256
|
+
readonly type: "evaluator.evaluated";
|
|
257
|
+
readonly payload: {
|
|
258
|
+
readonly evaluationId: string;
|
|
259
|
+
readonly definitionName?: string | undefined;
|
|
260
|
+
readonly answers: {
|
|
261
|
+
readonly [x: string]: {
|
|
262
|
+
readonly type: "boolean";
|
|
263
|
+
readonly value: boolean;
|
|
264
|
+
readonly probability: number;
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "choice";
|
|
267
|
+
readonly value: string;
|
|
268
|
+
} | {
|
|
269
|
+
readonly type: "score";
|
|
270
|
+
readonly value: number;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
readonly route: string;
|
|
274
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
275
|
+
readonly usage?: {
|
|
276
|
+
readonly input: number;
|
|
277
|
+
readonly output: number;
|
|
278
|
+
} | undefined;
|
|
279
|
+
};
|
|
280
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
281
|
+
readonly type: "evaluator.requested";
|
|
282
|
+
readonly payload: {
|
|
283
|
+
readonly evaluationId: string;
|
|
284
|
+
readonly definitionName?: string | undefined;
|
|
285
|
+
readonly state: string;
|
|
286
|
+
readonly model?: string | undefined;
|
|
287
|
+
};
|
|
288
288
|
})>>;
|
|
@@ -43,39 +43,6 @@ export declare function evaluator(options?: EvaluatorModuleOptions): import("@sw
|
|
|
43
43
|
readonly definitionVersion?: string | undefined;
|
|
44
44
|
readonly input?: import("effect/Schema").Json | undefined;
|
|
45
45
|
}, import("./definitions-store").EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
46
|
-
readonly type: "evaluator.evaluated";
|
|
47
|
-
readonly payload: {
|
|
48
|
-
readonly evaluationId: string;
|
|
49
|
-
readonly definitionName?: string | undefined;
|
|
50
|
-
readonly answers: {
|
|
51
|
-
readonly [x: string]: {
|
|
52
|
-
readonly type: "boolean";
|
|
53
|
-
readonly value: boolean;
|
|
54
|
-
readonly probability: number;
|
|
55
|
-
} | {
|
|
56
|
-
readonly type: "choice";
|
|
57
|
-
readonly value: string;
|
|
58
|
-
} | {
|
|
59
|
-
readonly type: "score";
|
|
60
|
-
readonly value: number;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
readonly route: string;
|
|
64
|
-
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
65
|
-
readonly usage?: {
|
|
66
|
-
readonly input: number;
|
|
67
|
-
readonly output: number;
|
|
68
|
-
} | undefined;
|
|
69
|
-
};
|
|
70
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
71
|
-
readonly type: "evaluator.requested";
|
|
72
|
-
readonly payload: {
|
|
73
|
-
readonly evaluationId: string;
|
|
74
|
-
readonly definitionName?: string | undefined;
|
|
75
|
-
readonly state: string;
|
|
76
|
-
readonly model?: string | undefined;
|
|
77
|
-
};
|
|
78
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
79
46
|
readonly type: "runtime.child.close.requested";
|
|
80
47
|
readonly payload: {
|
|
81
48
|
readonly policy: "terminate" | "wait";
|
|
@@ -321,6 +288,39 @@ export declare function evaluator(options?: EvaluatorModuleOptions): import("@sw
|
|
|
321
288
|
readonly payload: import("effect/Schema").Json;
|
|
322
289
|
};
|
|
323
290
|
};
|
|
291
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
292
|
+
readonly type: "evaluator.evaluated";
|
|
293
|
+
readonly payload: {
|
|
294
|
+
readonly evaluationId: string;
|
|
295
|
+
readonly definitionName?: string | undefined;
|
|
296
|
+
readonly answers: {
|
|
297
|
+
readonly [x: string]: {
|
|
298
|
+
readonly type: "boolean";
|
|
299
|
+
readonly value: boolean;
|
|
300
|
+
readonly probability: number;
|
|
301
|
+
} | {
|
|
302
|
+
readonly type: "choice";
|
|
303
|
+
readonly value: string;
|
|
304
|
+
} | {
|
|
305
|
+
readonly type: "score";
|
|
306
|
+
readonly value: number;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
readonly route: string;
|
|
310
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
311
|
+
readonly usage?: {
|
|
312
|
+
readonly input: number;
|
|
313
|
+
readonly output: number;
|
|
314
|
+
} | undefined;
|
|
315
|
+
};
|
|
316
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
317
|
+
readonly type: "evaluator.requested";
|
|
318
|
+
readonly payload: {
|
|
319
|
+
readonly evaluationId: string;
|
|
320
|
+
readonly definitionName?: string | undefined;
|
|
321
|
+
readonly state: string;
|
|
322
|
+
readonly model?: string | undefined;
|
|
323
|
+
};
|
|
324
324
|
})>;
|
|
325
325
|
}, {
|
|
326
326
|
evaluator: import("@swirls/looms/core").ThreadDefinition<{
|
|
@@ -391,39 +391,6 @@ export declare function evaluator(options?: EvaluatorModuleOptions): import("@sw
|
|
|
391
391
|
readonly definitionVersion?: string | undefined;
|
|
392
392
|
readonly input?: import("effect/Schema").Json | undefined;
|
|
393
393
|
}, import("./definitions-store").EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
394
|
-
readonly type: "evaluator.evaluated";
|
|
395
|
-
readonly payload: {
|
|
396
|
-
readonly evaluationId: string;
|
|
397
|
-
readonly definitionName?: string | undefined;
|
|
398
|
-
readonly answers: {
|
|
399
|
-
readonly [x: string]: {
|
|
400
|
-
readonly type: "boolean";
|
|
401
|
-
readonly value: boolean;
|
|
402
|
-
readonly probability: number;
|
|
403
|
-
} | {
|
|
404
|
-
readonly type: "choice";
|
|
405
|
-
readonly value: string;
|
|
406
|
-
} | {
|
|
407
|
-
readonly type: "score";
|
|
408
|
-
readonly value: number;
|
|
409
|
-
};
|
|
410
|
-
};
|
|
411
|
-
readonly route: string;
|
|
412
|
-
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
413
|
-
readonly usage?: {
|
|
414
|
-
readonly input: number;
|
|
415
|
-
readonly output: number;
|
|
416
|
-
} | undefined;
|
|
417
|
-
};
|
|
418
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
419
|
-
readonly type: "evaluator.requested";
|
|
420
|
-
readonly payload: {
|
|
421
|
-
readonly evaluationId: string;
|
|
422
|
-
readonly definitionName?: string | undefined;
|
|
423
|
-
readonly state: string;
|
|
424
|
-
readonly model?: string | undefined;
|
|
425
|
-
};
|
|
426
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
427
394
|
readonly type: "runtime.child.close.requested";
|
|
428
395
|
readonly payload: {
|
|
429
396
|
readonly policy: "terminate" | "wait";
|
|
@@ -669,6 +636,39 @@ export declare function evaluator(options?: EvaluatorModuleOptions): import("@sw
|
|
|
669
636
|
readonly payload: import("effect/Schema").Json;
|
|
670
637
|
};
|
|
671
638
|
};
|
|
639
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
640
|
+
readonly type: "evaluator.evaluated";
|
|
641
|
+
readonly payload: {
|
|
642
|
+
readonly evaluationId: string;
|
|
643
|
+
readonly definitionName?: string | undefined;
|
|
644
|
+
readonly answers: {
|
|
645
|
+
readonly [x: string]: {
|
|
646
|
+
readonly type: "boolean";
|
|
647
|
+
readonly value: boolean;
|
|
648
|
+
readonly probability: number;
|
|
649
|
+
} | {
|
|
650
|
+
readonly type: "choice";
|
|
651
|
+
readonly value: string;
|
|
652
|
+
} | {
|
|
653
|
+
readonly type: "score";
|
|
654
|
+
readonly value: number;
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
readonly route: string;
|
|
658
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
659
|
+
readonly usage?: {
|
|
660
|
+
readonly input: number;
|
|
661
|
+
readonly output: number;
|
|
662
|
+
} | undefined;
|
|
663
|
+
};
|
|
664
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
665
|
+
readonly type: "evaluator.requested";
|
|
666
|
+
readonly payload: {
|
|
667
|
+
readonly evaluationId: string;
|
|
668
|
+
readonly definitionName?: string | undefined;
|
|
669
|
+
readonly state: string;
|
|
670
|
+
readonly model?: string | undefined;
|
|
671
|
+
};
|
|
672
672
|
})>;
|
|
673
673
|
};
|
|
674
674
|
readonly threads: {
|
package/dist/nats/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { LoomsHeaders,
|
|
2
|
-
export { encodeEventType, encodeSubjectToken, eventSubject, runSubjectFilter, streamSubject, } from './subjects';
|
|
1
|
+
export { LoomsHeaders, natsProjector, type NatsProjectorOptions, type NatsProjectorSettings, } from './projector';
|
|
2
|
+
export { anyAttributeTokens, attributeTokens, attributeTokensOf, encodeEventType, encodeSubjectToken, eventSubject, runSubjectFilter, streamSubject, } from './subjects';
|
|
3
|
+
export { NatsProjectorError, SERVER_BATCH_LIMIT, WRONG_LAST_SEQUENCE, natsConnectionTransport, type NatsCommit, type NatsConnectionSource, type NatsConnectionTransportOptions, type NatsOutgoingMessage, type NatsProjectorTransport, type NatsStoredMessage, type NatsStreamSettings, } from './transport';
|
package/dist/nats/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { LoomsHeaders,
|
|
2
|
-
export { encodeEventType, encodeSubjectToken, eventSubject, runSubjectFilter, streamSubject, } from './subjects.js';
|
|
1
|
+
export { LoomsHeaders, natsProjector, } from './projector.js';
|
|
2
|
+
export { anyAttributeTokens, attributeTokens, attributeTokensOf, encodeEventType, encodeSubjectToken, eventSubject, runSubjectFilter, streamSubject, } from './subjects.js';
|
|
3
|
+
export { NatsProjectorError, SERVER_BATCH_LIMIT, WRONG_LAST_SEQUENCE, natsConnectionTransport, } from './transport.js';
|
package/dist/nats/projector.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { StreamConfig } from '@nats-io/jetstream';
|
|
2
|
-
import type { NatsConnection } from '@nats-io/nats-core';
|
|
3
1
|
import { type Projector } from '@swirls/looms/projectors';
|
|
2
|
+
import { type NatsConnectionSource, type NatsProjectorTransport, type NatsStreamSettings } from './transport';
|
|
4
3
|
/** Headers on every message, so consumers can route without decoding the body. */
|
|
5
4
|
export declare const LoomsHeaders: {
|
|
6
5
|
readonly runId: 'Looms-Run-Id';
|
|
@@ -10,60 +9,43 @@ export declare const LoomsHeaders: {
|
|
|
10
9
|
readonly threadId: 'Looms-Thread-Id';
|
|
11
10
|
readonly ephemeral: 'Looms-Ephemeral';
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
readonly _tag: "NatsProjectorError";
|
|
15
|
-
} & Readonly<A>;
|
|
16
|
-
export declare class NatsProjectorError extends NatsProjectorError_base<{
|
|
17
|
-
readonly message: string;
|
|
18
|
-
readonly cause?: unknown;
|
|
19
|
-
/** JetStream `err_code` when the server rejected the request. */
|
|
20
|
-
readonly errCode?: number;
|
|
21
|
-
}> {
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Where the projector gets its connection. Use whichever transport fits the runtime:
|
|
25
|
-
* `@nats-io/transport-node`, `wsconnect`, and so on.
|
|
26
|
-
*/
|
|
27
|
-
export type NatsConnectionSource = {
|
|
28
|
-
/** A connection the caller owns. The projector never closes it. */
|
|
29
|
-
readonly connection: NatsConnection;
|
|
30
|
-
readonly connect?: never;
|
|
31
|
-
} | {
|
|
12
|
+
export interface NatsProjectorSettings {
|
|
32
13
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
14
|
+
* Subject prefix; events go to `<prefix>.run.<runId>.<type>`, or with `subjectAttributes` to
|
|
15
|
+
* `<prefix>.run.<attributes>.<runId>.<type>`. Defaults to `looms`.
|
|
35
16
|
*/
|
|
36
|
-
readonly connect: () => PromiseLike<NatsConnection>;
|
|
37
|
-
readonly connection?: never;
|
|
38
|
-
};
|
|
39
|
-
export type NatsProjectorOptions = NatsConnectionSource & NatsProjectorSettings;
|
|
40
|
-
export interface NatsProjectorSettings {
|
|
41
|
-
/** JetStream stream name. Defaults to `LOOMS`. */
|
|
42
|
-
readonly stream?: string;
|
|
43
|
-
/** Subject prefix; events go to `<prefix>.run.<runId>.<type>`. Defaults to `looms`. */
|
|
44
17
|
readonly subjectPrefix?: string;
|
|
45
18
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
19
|
+
* Run attributes to put in every subject of a run, in this order, before the run id. With
|
|
20
|
+
* `['orgId', 'projectId']`, `<prefix>.run.<orgId>.<projectId>.>` is one project's events and
|
|
21
|
+
* the server does the filtering. A run without one of them has the empty token, `~`, there.
|
|
22
|
+
*
|
|
23
|
+
* The names and their order are the stream's layout: changing them later strands the runs
|
|
24
|
+
* already in the stream under the old subjects.
|
|
48
25
|
*/
|
|
49
|
-
readonly
|
|
50
|
-
/** Events per atomic batch
|
|
26
|
+
readonly subjectAttributes?: readonly string[];
|
|
27
|
+
/** Events per atomic batch. At most what the transport takes, which is also the default. */
|
|
51
28
|
readonly maxBatch?: number;
|
|
52
|
-
/** Milliseconds to wait for a batch commit. Defaults to 5000. */
|
|
53
|
-
readonly timeoutMs?: number;
|
|
54
29
|
/** Projector name for delivery cursors and diagnostics. Defaults to `nats`. */
|
|
55
30
|
readonly name?: string;
|
|
56
31
|
}
|
|
32
|
+
export type NatsProjectorOptions = NatsProjectorSettings & ((NatsConnectionSource & NatsStreamSettings & {
|
|
33
|
+
readonly transport?: never;
|
|
34
|
+
}) | {
|
|
35
|
+
/** How to reach the stream when the host can't hold a NATS connection. */
|
|
36
|
+
readonly transport: NatsProjectorTransport;
|
|
37
|
+
});
|
|
57
38
|
/**
|
|
58
39
|
* Replicates committed events to a NATS JetStream stream, one subject per event:
|
|
59
|
-
* `<prefix>.run.<runId>.<type tokens
|
|
40
|
+
* `<prefix>.run.<runId>.<type tokens>`, with the run's `subjectAttributes` before the run id
|
|
41
|
+
* when they are set. The body is the JSON envelope.
|
|
60
42
|
*
|
|
61
|
-
* Each batch
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
43
|
+
* Each batch lands whole or not at all, and expects the run's last stream sequence, so a
|
|
44
|
+
* concurrent writer or a hole in the run is refused instead of reordering the copy. `position`
|
|
45
|
+
* reads the run's last message, so durable delivery rewinds and catches up when the stream is
|
|
46
|
+
* behind its cursor.
|
|
65
47
|
*
|
|
66
|
-
*
|
|
48
|
+
* Pass a NATS connection, or a `transport` when the host reaches the stream some other way.
|
|
49
|
+
* Over a connection it requires nats-server 2.12 or newer (atomic batch publish).
|
|
67
50
|
*/
|
|
68
51
|
export declare function natsProjector(options: NatsProjectorOptions): Projector;
|
|
69
|
-
export {};
|