@voltro/protocol 0.84.0 → 0.86.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/README.md +14 -0
  3. package/THIRD-PARTY-NOTICES.md +5 -89
  4. package/dist/apikey.d.ts +32 -34
  5. package/dist/approval.js +64 -0
  6. package/dist/approvalDescriptors.js +26 -0
  7. package/dist/auth.js +369 -0
  8. package/dist/boundedRing.js +27 -0
  9. package/dist/businessRule.js +11 -0
  10. package/dist/connection.js +73 -0
  11. package/dist/devActivity.js +4 -0
  12. package/dist/errorValue.js +21 -0
  13. package/dist/event.js +104 -0
  14. package/dist/idempotency.js +66 -0
  15. package/dist/identity.js +5 -9
  16. package/dist/index.d.ts +1494 -1366
  17. package/dist/index.js +42 -1411
  18. package/dist/inspect.d.ts +88 -88
  19. package/dist/inspect.js +14 -190
  20. package/dist/inspectBackfill.js +52 -0
  21. package/dist/inspectCommandRejection.js +21 -0
  22. package/dist/inspectProjection.js +133 -0
  23. package/dist/inspectStorageProjection.js +86 -0
  24. package/dist/inspectValueIdentity.js +4 -0
  25. package/dist/inspectWorkflowExecution.js +34 -0
  26. package/dist/inspectWorkflowQueuedStart.js +31 -0
  27. package/dist/jsonSchema.js +54 -0
  28. package/dist/jwt.d.ts +32 -34
  29. package/dist/outbox.js +10 -0
  30. package/dist/pairing.js +75 -0
  31. package/dist/plugin.js +61 -0
  32. package/dist/pluginNaming.js +32 -0
  33. package/dist/procedure.js +262 -0
  34. package/dist/publicApi.js +344 -0
  35. package/dist/reactivityChannel.js +34 -0
  36. package/dist/rest.d.ts +105 -57
  37. package/dist/rest.js +259 -437
  38. package/dist/restFormat.js +163 -0
  39. package/dist/rowEquality.js +31 -0
  40. package/dist/rowPatch.js +182 -0
  41. package/dist/schemaShape.js +67 -0
  42. package/dist/scopes.js +240 -0
  43. package/dist/serverErrorBus.js +15 -0
  44. package/dist/serviceCall.js +14 -0
  45. package/dist/session.d.ts +90 -96
  46. package/dist/session.js +13 -15
  47. package/dist/{sessionHeader-DriTZhmv.js → sessionHeader.js} +1 -1
  48. package/dist/storageAccess.js +14 -0
  49. package/dist/storeErrors.js +66 -0
  50. package/dist/storeScreenshots.js +90 -0
  51. package/dist/strictInput.js +27 -0
  52. package/dist/subscriptionEvent.js +37 -0
  53. package/dist/tenantSelection.js +40 -0
  54. package/dist/time.js +7 -0
  55. package/dist/undo.js +38 -0
  56. package/dist/validation.js +39 -0
  57. package/dist/webSocketGateway.js +10 -0
  58. package/dist/workflow.js +297 -0
  59. package/dist/workflowAccess.js +61 -0
  60. package/dist/workflowRestart.js +45 -0
  61. package/dist/workflowRetry.js +44 -0
  62. package/dist/workflowStartOutcome.js +30 -0
  63. package/package.json +4 -8
  64. package/dist/restFormat-EZ8k9ZcQ.js +0 -304
  65. package/dist/scopes-Di756ENh.js +0 -518
package/dist/inspect.d.ts CHANGED
@@ -1,74 +1,74 @@
1
1
  import { ParseOptions } from 'effect/SchemaAST';
2
2
  import { Schema } from 'effect';
3
3
 
4
- export declare const decodeInspectBackfillInput: (u: unknown, overrideOptions?: ParseOptions) => {
4
+ export declare const decodeInspectBackfillInput: (input: unknown, options?: ParseOptions) => {
5
+ readonly requestId: string;
5
6
  readonly name: string;
6
7
  readonly from: string;
7
- readonly limit: number;
8
8
  readonly to: string;
9
- readonly requestId: string;
10
9
  readonly confirm: boolean;
10
+ readonly limit: number;
11
11
  };
12
12
 
13
13
  export declare type InspectBackfillInput = typeof InspectBackfillInputSchema.Type;
14
14
 
15
15
  export declare const InspectBackfillInputSchema: Schema.Struct<{
16
- requestId: Schema.filter<Schema.filter<typeof Schema.String>>;
17
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
18
- from: Schema.filter<typeof Schema.String>;
19
- to: Schema.filter<typeof Schema.String>;
20
- confirm: typeof Schema.Boolean;
21
- limit: Schema.filter<Schema.filter<typeof Schema.Number>>;
16
+ readonly requestId: Schema.String;
17
+ readonly name: Schema.String;
18
+ readonly from: Schema.String;
19
+ readonly to: Schema.String;
20
+ readonly confirm: Schema.Boolean;
21
+ readonly limit: Schema.Number;
22
22
  }>;
23
23
 
24
24
  export declare type InspectBackfillReceipt = typeof InspectBackfillReceiptSchema.Type;
25
25
 
26
26
  export declare const InspectBackfillReceiptSchema: Schema.Struct<{
27
- id: Schema.filter<Schema.filter<typeof Schema.String>>;
28
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
29
- from: Schema.filter<typeof Schema.String>;
30
- to: Schema.filter<typeof Schema.String>;
31
- occurrences: Schema.Array$<typeof Schema.Number>;
32
- status: Schema.Literal<["queued", "running", "completed", "interrupted"]>;
33
- owner: Schema.NullOr<typeof Schema.String>;
34
- createdAt: Schema.filter<typeof Schema.String>;
35
- updatedAt: Schema.filter<typeof Schema.String>;
36
- cursor: typeof Schema.Number;
37
- activeIndex: Schema.NullOr<typeof Schema.Number>;
38
- results: Schema.Array$<Schema.Struct<{
39
- runId: Schema.filter<Schema.filter<typeof Schema.String>>;
40
- status: Schema.Literal<["succeeded", "failed", "skipped", "missed"]>;
27
+ readonly id: Schema.String;
28
+ readonly name: Schema.String;
29
+ readonly from: Schema.String;
30
+ readonly to: Schema.String;
31
+ readonly occurrences: Schema.$Array<Schema.Number>;
32
+ readonly status: Schema.Literals<readonly ["queued", "running", "completed", "interrupted"]>;
33
+ readonly owner: Schema.NullOr<Schema.String>;
34
+ readonly createdAt: Schema.String;
35
+ readonly updatedAt: Schema.String;
36
+ readonly cursor: Schema.Number;
37
+ readonly activeIndex: Schema.NullOr<Schema.Number>;
38
+ readonly results: Schema.$Array<Schema.Struct<{
39
+ readonly runId: Schema.String;
40
+ readonly status: Schema.Literals<readonly ["succeeded", "failed", "skipped", "missed"]>;
41
41
  }>>;
42
- error: Schema.NullOr<typeof Schema.String>;
42
+ readonly error: Schema.NullOr<Schema.String>;
43
43
  }>;
44
44
 
45
45
  export declare type InspectBackfillResult = typeof InspectBackfillResultSchema.Type;
46
46
 
47
- export declare const InspectBackfillResultSchema: Schema.Union<[Schema.Struct<{
48
- kind: Schema.Literal<["accepted"]>;
49
- request: Schema.Struct<{
50
- id: Schema.filter<Schema.filter<typeof Schema.String>>;
51
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
52
- from: Schema.filter<typeof Schema.String>;
53
- to: Schema.filter<typeof Schema.String>;
54
- occurrences: Schema.Array$<typeof Schema.Number>;
55
- status: Schema.Literal<["queued", "running", "completed", "interrupted"]>;
56
- owner: Schema.NullOr<typeof Schema.String>;
57
- createdAt: Schema.filter<typeof Schema.String>;
58
- updatedAt: Schema.filter<typeof Schema.String>;
59
- cursor: typeof Schema.Number;
60
- activeIndex: Schema.NullOr<typeof Schema.Number>;
61
- results: Schema.Array$<Schema.Struct<{
62
- runId: Schema.filter<Schema.filter<typeof Schema.String>>;
63
- status: Schema.Literal<["succeeded", "failed", "skipped", "missed"]>;
47
+ export declare const InspectBackfillResultSchema: Schema.Union<readonly [Schema.Struct<{
48
+ readonly kind: Schema.Literal<"accepted">;
49
+ readonly request: Schema.Struct<{
50
+ readonly id: Schema.String;
51
+ readonly name: Schema.String;
52
+ readonly from: Schema.String;
53
+ readonly to: Schema.String;
54
+ readonly occurrences: Schema.$Array<Schema.Number>;
55
+ readonly status: Schema.Literals<readonly ["queued", "running", "completed", "interrupted"]>;
56
+ readonly owner: Schema.NullOr<Schema.String>;
57
+ readonly createdAt: Schema.String;
58
+ readonly updatedAt: Schema.String;
59
+ readonly cursor: Schema.Number;
60
+ readonly activeIndex: Schema.NullOr<Schema.Number>;
61
+ readonly results: Schema.$Array<Schema.Struct<{
62
+ readonly runId: Schema.String;
63
+ readonly status: Schema.Literals<readonly ["succeeded", "failed", "skipped", "missed"]>;
64
64
  }>>;
65
- error: Schema.NullOr<typeof Schema.String>;
65
+ readonly error: Schema.NullOr<Schema.String>;
66
66
  }>;
67
67
  }>, Schema.Struct<{
68
- kind: Schema.Literal<["refused"]>;
69
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
70
- occurrences: typeof Schema.Number;
71
- reason: typeof Schema.String;
68
+ readonly kind: Schema.Literal<"refused">;
69
+ readonly name: Schema.String;
70
+ readonly occurrences: Schema.Number;
71
+ readonly reason: Schema.String;
72
72
  }>]>;
73
73
 
74
74
  export declare type InspectCommandRejection = typeof InspectCommandRejectionSchema.Type;
@@ -78,9 +78,9 @@ export declare const inspectCommandRejection: (status: number, message: string)
78
78
  /** Explicit non-acceptance from an Inspect command endpoint. Transport errors,
79
79
  * conflicts with an earlier request and server failures are not this outcome. */
80
80
  export declare const InspectCommandRejectionSchema: Schema.Struct<{
81
- kind: Schema.Literal<["rejected"]>;
82
- status: Schema.Literal<[400, 401, 403, 404]>;
83
- message: typeof Schema.String;
81
+ readonly kind: Schema.Literal<"rejected">;
82
+ readonly status: Schema.Literals<readonly [400, 401, 403, 404]>;
83
+ readonly message: Schema.String;
84
84
  }>;
85
85
 
86
86
  export declare type InspectReplicaSelection = {
@@ -94,75 +94,75 @@ export declare type InspectWorkflowExecutionObservation = typeof InspectWorkflow
94
94
 
95
95
  /** A projection of engine evidence, not a run-row or recorder-entry claim.
96
96
  * Deliberately excludes payloads, outputs, raw causes and journal identifiers. */
97
- export declare const InspectWorkflowExecutionObservationSchema: Schema.Union<[Schema.Struct<{
98
- kind: Schema.Literal<["not-observed"]>;
99
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
100
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
97
+ export declare const InspectWorkflowExecutionObservationSchema: Schema.Union<readonly [Schema.Struct<{
98
+ readonly kind: Schema.Literal<"not-observed">;
99
+ readonly workflowName: Schema.NonEmptyString;
100
+ readonly executionId: Schema.NonEmptyString;
101
101
  }>, Schema.Struct<{
102
- kind: Schema.Literal<["pending"]>;
103
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
104
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
102
+ readonly kind: Schema.Literal<"pending">;
103
+ readonly workflowName: Schema.NonEmptyString;
104
+ readonly executionId: Schema.NonEmptyString;
105
105
  }>, Schema.Struct<{
106
- kind: Schema.Literal<["delivery-failed"]>;
107
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
108
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
106
+ readonly kind: Schema.Literal<"delivery-failed">;
107
+ readonly workflowName: Schema.NonEmptyString;
108
+ readonly executionId: Schema.NonEmptyString;
109
109
  }>, Schema.Struct<{
110
- kind: Schema.Literal<["suspended"]>;
111
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
112
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
110
+ readonly kind: Schema.Literal<"suspended">;
111
+ readonly workflowName: Schema.NonEmptyString;
112
+ readonly executionId: Schema.NonEmptyString;
113
113
  }>, Schema.Struct<{
114
- kind: Schema.Literal<["completed"]>;
115
- outcome: Schema.Literal<["succeeded", "failed", "cancelled"]>;
116
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
117
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
114
+ readonly kind: Schema.Literal<"completed">;
115
+ readonly outcome: Schema.Literals<readonly ["succeeded", "failed", "cancelled"]>;
116
+ readonly workflowName: Schema.NonEmptyString;
117
+ readonly executionId: Schema.NonEmptyString;
118
118
  }>]>;
119
119
 
120
120
  export declare type InspectWorkflowExecutionTarget = typeof InspectWorkflowExecutionTargetSchema.Type;
121
121
 
122
122
  /** Read an existing execution identity; this is never a start command. */
123
123
  export declare const InspectWorkflowExecutionTargetSchema: Schema.Struct<{
124
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
125
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
124
+ readonly workflowName: Schema.NonEmptyString;
125
+ readonly executionId: Schema.NonEmptyString;
126
126
  }>;
127
127
 
128
128
  export declare type InspectWorkflowQueuedStartObservation = typeof InspectWorkflowQueuedStartObservationSchema.Type;
129
129
 
130
130
  /** Read-only admission evidence. Accepted means an execution exists, not that it succeeded. */
131
- export declare const InspectWorkflowQueuedStartObservationSchema: Schema.Union<[Schema.Struct<{
132
- kind: Schema.Literal<["pending"]>;
133
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
134
- receiptId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
135
- tenantId: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>>;
131
+ export declare const InspectWorkflowQueuedStartObservationSchema: Schema.Union<readonly [Schema.Struct<{
132
+ readonly kind: Schema.Literal<"pending">;
133
+ readonly workflowName: Schema.NonEmptyString;
134
+ readonly receiptId: Schema.NonEmptyString;
135
+ readonly tenantId: Schema.NullOr<Schema.NonEmptyString>;
136
136
  }>, Schema.Struct<{
137
- kind: Schema.Literal<["accepted"]>;
138
- executionId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
139
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
140
- receiptId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
141
- tenantId: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>>;
137
+ readonly kind: Schema.Literal<"accepted">;
138
+ readonly executionId: Schema.NonEmptyString;
139
+ readonly workflowName: Schema.NonEmptyString;
140
+ readonly receiptId: Schema.NonEmptyString;
141
+ readonly tenantId: Schema.NullOr<Schema.NonEmptyString>;
142
142
  }>, Schema.Struct<{
143
- kind: Schema.Literal<["not-executed"]>;
144
- reason: Schema.Literal<["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
145
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
146
- receiptId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
147
- tenantId: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>>;
143
+ readonly kind: Schema.Literal<"not-executed">;
144
+ readonly reason: Schema.Literals<readonly ["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
145
+ readonly workflowName: Schema.NonEmptyString;
146
+ readonly receiptId: Schema.NonEmptyString;
147
+ readonly tenantId: Schema.NullOr<Schema.NonEmptyString>;
148
148
  }>]>;
149
149
 
150
150
  export declare type InspectWorkflowQueuedStartTarget = typeof InspectWorkflowQueuedStartTargetSchema.Type;
151
151
 
152
152
  /** A caller receipt, never an execution or a reusable admission slot. */
153
153
  export declare const InspectWorkflowQueuedStartTargetSchema: Schema.Struct<{
154
- workflowName: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
155
- receiptId: Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>;
156
- tenantId: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.NonEmptyString>>>;
154
+ readonly workflowName: Schema.NonEmptyString;
155
+ readonly receiptId: Schema.NonEmptyString;
156
+ readonly tenantId: Schema.NullOr<Schema.NonEmptyString>;
157
157
  }>;
158
158
 
159
159
  export declare class InvalidReplicaSelection extends Error {
160
160
  readonly name = "InvalidReplicaSelection";
161
161
  }
162
162
 
163
- export declare const isInspectCommandRejection: (u: unknown, overrideOptions?: ParseOptions | number) => u is {
164
- readonly status: 400 | 401 | 403 | 404;
163
+ export declare const isInspectCommandRejection: <I>(input: I) => input is I & {
165
164
  readonly kind: "rejected";
165
+ readonly status: 400 | 401 | 403 | 404;
166
166
  readonly message: string;
167
167
  };
168
168
 
package/dist/inspect.js CHANGED
@@ -1,206 +1,30 @@
1
- import { Schema as e } from "effect";
2
- //#region src/inspectWorkflowQueuedStart.ts
3
- var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(e))), n = e.Struct({
4
- workflowName: t,
5
- receiptId: t,
6
- tenantId: e.NullOr(t)
7
- }), r = n.fields, i = e.Union(e.Struct({
8
- ...r,
9
- kind: e.Literal("pending")
10
- }), e.Struct({
11
- ...r,
12
- kind: e.Literal("accepted"),
13
- executionId: t
14
- }), e.Struct({
15
- ...r,
16
- kind: e.Literal("not-executed"),
17
- reason: e.Literal("dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected")
18
- })), a = e.Struct({
19
- kind: e.Literal("rejected"),
20
- status: e.Literal(400, 401, 403, 404),
21
- message: e.String
22
- }), o = e.is(a), s = (e, t) => {
23
- let n = {
24
- kind: "rejected",
25
- status: e,
26
- message: t
27
- };
28
- return o(n) ? n : void 0;
29
- }, c = e.String.pipe(e.filter((e) => Number.isFinite(Date.parse(e)))), l = e.String.pipe(e.minLength(1), e.maxLength(256)), u = e.Struct({
30
- id: l,
31
- name: l,
32
- from: c,
33
- to: c,
34
- occurrences: e.Array(e.Number),
35
- status: e.Literal("queued", "running", "completed", "interrupted"),
36
- owner: e.NullOr(e.String),
37
- createdAt: c,
38
- updatedAt: c,
39
- cursor: e.Number,
40
- activeIndex: e.NullOr(e.Number),
41
- results: e.Array(e.Struct({
42
- runId: l,
43
- status: e.Literal("succeeded", "failed", "skipped", "missed")
44
- })),
45
- error: e.NullOr(e.String)
46
- }), d = e.Struct({
47
- requestId: l,
48
- name: l,
49
- from: c,
50
- to: c,
51
- confirm: e.Boolean,
52
- limit: e.Number.pipe(e.int(), e.between(1, 1e4))
53
- }), f = e.decodeUnknownSync(d), p = e.Union(e.Struct({
54
- kind: e.Literal("accepted"),
55
- request: u
56
- }), e.Struct({
57
- kind: e.Literal("refused"),
58
- name: l,
59
- occurrences: e.Number,
60
- reason: e.String
61
- })), m = class extends Error {
62
- name = "ScheduleBackfillRequestConflict";
63
- }, h = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(e))), g = e.Struct({
64
- workflowName: h,
65
- executionId: h
66
- }), _ = g.fields, v = e.Union(e.Struct({
67
- ..._,
68
- kind: e.Literal("not-observed")
69
- }), e.Struct({
70
- ..._,
71
- kind: e.Literal("pending")
72
- }), e.Struct({
73
- ..._,
74
- kind: e.Literal("delivery-failed")
75
- }), e.Struct({
76
- ..._,
77
- kind: e.Literal("suspended")
78
- }), e.Struct({
79
- ..._,
80
- kind: e.Literal("completed"),
81
- outcome: e.Literal("succeeded", "failed", "cancelled")
82
- })), y = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : void 0, b = (e) => Array.isArray(e) && e.every((e) => y(e) !== void 0) ? e : void 0, x = (e) => typeof e == "number" && Number.isFinite(e) ? e : 0, S = /* @__PURE__ */ new Set([
83
- "counter",
84
- "gauge",
85
- "histogram",
86
- "summary",
87
- "frequency"
88
- ]), C = (e) => {
89
- let t = b(e);
90
- return t?.every((e) => typeof e.name == "string" && S.has(String(e.type))) ? t : void 0;
91
- }, w = (e) => {
92
- let t = y(e), n = y(t?.data), r = b(n?.results);
93
- if (!t || !n?.selection || !r) return e;
94
- let i = r.filter((e) => e.status === "answered").map((e) => ({
95
- replicaId: String(e.replicaId),
96
- observation: y(e.observation),
97
- data: y(e.observation)?.data
98
- }));
99
- if (i.length === 0) throw Error("None of the selected replicas answered. Check replica availability and retry.");
100
- let a = i.map((e) => ({
101
- ...e,
102
- object: y(e.data)
103
- })), o = (e) => a.reduce((t, n) => t + x(n.object?.[e]), 0), s = Math.max(...i.map((e) => x(e.observation?.capturedAt))), c = {
104
- capturedAt: s,
105
- bufferSize: o("bufferSize"),
106
- bufferCapacity: o("bufferCapacity")
107
- }, l;
108
- if (a.every((e) => b(e.object?.records))) {
109
- let e = a.flatMap((e) => b(e.object?.records).map((t) => ({
110
- ...t,
111
- fields: {
112
- ...y(t.fields),
113
- "voltro.replica": e.replicaId
114
- }
115
- }))).sort((e, t) => x(e.ts) - x(t.ts));
116
- l = {
117
- ...c,
118
- returned: e.length,
119
- records: e
120
- };
121
- } else if (a.every((e) => b(e.object?.traces))) {
122
- let e = /* @__PURE__ */ new Map();
123
- for (let t of a) for (let n of b(t.object?.traces)) {
124
- let r = String(n.traceId), i = (b(n.spans) ?? []).map((e) => ({
125
- ...e,
126
- attributes: {
127
- ...y(e.attributes),
128
- "voltro.replica": t.replicaId
129
- }
130
- })), a = e.get(r) ?? [];
131
- a.push({
132
- ...n,
133
- spans: i
134
- }), e.set(r, a);
135
- }
136
- let t = [...e.values()].map((e) => {
137
- let t = e.flatMap((e) => b(e.spans) ?? []).sort((e, t) => x(e.startMs) - x(t.startMs)), n = [...e].sort((e, t) => x(e.startMs) - x(t.startMs))[0], r = Math.min(...e.map((e) => x(e.startMs))), i = Math.max(...e.map((e) => x(e.startMs) + x(e.durationMs)));
138
- return {
139
- ...n,
140
- startMs: r,
141
- durationMs: Math.max(0, i - r),
142
- spanCount: t.length,
143
- hasError: e.some((e) => e.hasError === !0),
144
- spans: t,
145
- ...e.some((e) => e.deliveryCount !== void 0) ? { deliveryCount: e.reduce((e, t) => e + x(t.deliveryCount), 0) } : {},
146
- ...e.some((e) => e.lastDeliveryMs !== void 0) ? { lastDeliveryMs: Math.max(...e.map((e) => x(e.lastDeliveryMs))) } : {}
147
- };
148
- }).sort((e, t) => t.startMs - e.startMs);
149
- l = {
150
- ...c,
151
- returned: t.length,
152
- traces: t
153
- };
154
- } else if (a.every((e) => b(e.object?.buckets) && typeof e.object?.windowMs == "number")) l = {
155
- capturedAt: s,
156
- windowMs: Math.max(...a.map((e) => x(e.object?.windowMs))),
157
- totalSamples: o("totalSamples"),
158
- buckets: a.flatMap((e) => b(e.object?.buckets).map((t) => ({
159
- ...t,
160
- tag: `${String(t.tag)} [${e.replicaId}]`
161
- })))
162
- };
163
- else if (i.every((e) => C(e.data))) l = i.flatMap((e) => C(e.data).map((t) => ({
164
- ...t,
165
- labels: {
166
- ...y(t.labels),
167
- voltro_replica: e.replicaId
168
- }
169
- })));
170
- else if (a.every((e) => C(e.object?.samples))) l = { samples: a.flatMap((e) => C(e.object?.samples).map((t) => ({
171
- ...t,
172
- labels: {
173
- ...y(t.labels),
174
- voltro_replica: e.replicaId
175
- }
176
- }))) };
177
- else if (r.length === 1 && i.length === 1) l = i[0].data;
178
- else throw Error("This view must compare observations per replica; its values cannot be safely combined.");
179
- return {
180
- ...t,
181
- data: l
182
- };
183
- }, T = class extends Error {
1
+ import { InspectWorkflowQueuedStartObservationSchema as e, InspectWorkflowQueuedStartTargetSchema as t } from "./inspectWorkflowQueuedStart.js";
2
+ import { InspectCommandRejectionSchema as n, inspectCommandRejection as r, isInspectCommandRejection as i } from "./inspectCommandRejection.js";
3
+ import { InspectBackfillInputSchema as a, InspectBackfillReceiptSchema as o, InspectBackfillResultSchema as s, ScheduleBackfillRequestConflict as c, decodeInspectBackfillInput as l } from "./inspectBackfill.js";
4
+ import { InspectWorkflowExecutionObservationSchema as u, InspectWorkflowExecutionTargetSchema as d } from "./inspectWorkflowExecution.js";
5
+ import { projectReplicaObservation as f } from "./inspectProjection.js";
6
+ //#region src/inspectSelection.ts
7
+ var p = class extends Error {
184
8
  name = "InvalidReplicaSelection";
185
- }, E = (e) => {
9
+ }, m = (e) => {
186
10
  let t = e.getAll("replicas"), n = e.getAll("replica");
187
11
  if (t.length !== 0 || n.length !== 0) {
188
- if (t.length > 1 || t.length === 1 && t[0] !== "all" || t.length > 0 && n.length > 0) throw new T("Choose all replicas or explicit replica IDs, not both.");
12
+ if (t.length > 1 || t.length === 1 && t[0] !== "all" || t.length > 0 && n.length > 0) throw new p("Choose all replicas or explicit replica IDs, not both.");
189
13
  if (t[0] === "all") return { mode: "all" };
190
- if (n.some((e) => e.trim().length === 0 || e.length > 512 || /[\u0000-\u001f\u007f]/.test(e))) throw new T("Replica IDs must be nonempty and contain no control characters.");
14
+ if (n.some((e) => e.trim().length === 0 || e.length > 512 || /[\u0000-\u001f\u007f]/.test(e))) throw new p("Replica IDs must be nonempty and contain no control characters.");
191
15
  return {
192
16
  mode: "selected",
193
17
  replicaIds: [...new Set(n)].sort()
194
18
  };
195
19
  }
196
- }, D = (e, t) => {
20
+ }, h = (e, t) => {
197
21
  let n = e.indexOf("#"), r = n < 0 ? "" : e.slice(n), i = n < 0 ? e : e.slice(0, n), a = i.indexOf("?"), o = a < 0 ? i : i.slice(0, a), s = new URLSearchParams(a < 0 ? "" : i.slice(a + 1));
198
22
  if (s.delete("replica"), s.delete("replicas"), t.mode === "all") s.set("replicas", "all");
199
23
  else {
200
- if (t.replicaIds.length === 0) throw new T("Select at least one replica.");
24
+ if (t.replicaIds.length === 0) throw new p("Select at least one replica.");
201
25
  for (let e of [...new Set(t.replicaIds)].sort()) s.append("replica", e);
202
26
  }
203
- return E(s), `${o}?${s}${r}`;
27
+ return m(s), `${o}?${s}${r}`;
204
28
  };
205
29
  //#endregion
206
- export { d as InspectBackfillInputSchema, u as InspectBackfillReceiptSchema, p as InspectBackfillResultSchema, a as InspectCommandRejectionSchema, v as InspectWorkflowExecutionObservationSchema, g as InspectWorkflowExecutionTargetSchema, i as InspectWorkflowQueuedStartObservationSchema, n as InspectWorkflowQueuedStartTargetSchema, T as InvalidReplicaSelection, m as ScheduleBackfillRequestConflict, f as decodeInspectBackfillInput, s as inspectCommandRejection, o as isInspectCommandRejection, E as parseReplicaSelection, w as projectReplicaObservation, D as withReplicaSelection };
30
+ export { a as InspectBackfillInputSchema, o as InspectBackfillReceiptSchema, s as InspectBackfillResultSchema, n as InspectCommandRejectionSchema, u as InspectWorkflowExecutionObservationSchema, d as InspectWorkflowExecutionTargetSchema, e as InspectWorkflowQueuedStartObservationSchema, t as InspectWorkflowQueuedStartTargetSchema, p as InvalidReplicaSelection, c as ScheduleBackfillRequestConflict, l as decodeInspectBackfillInput, r as inspectCommandRejection, i as isInspectCommandRejection, m as parseReplicaSelection, f as projectReplicaObservation, h as withReplicaSelection };
@@ -0,0 +1,52 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/inspectBackfill.ts
3
+ var t = e.String.pipe(e.check(e.makeFilter((e) => Number.isFinite(Date.parse(e))))), n = e.String.pipe(e.check(e.isMinLength(1)), e.check(e.isMaxLength(256))), r = e.Struct({
4
+ id: n,
5
+ name: n,
6
+ from: t,
7
+ to: t,
8
+ occurrences: e.Array(e.Number),
9
+ status: e.Literals([
10
+ "queued",
11
+ "running",
12
+ "completed",
13
+ "interrupted"
14
+ ]),
15
+ owner: e.NullOr(e.String),
16
+ createdAt: t,
17
+ updatedAt: t,
18
+ cursor: e.Number,
19
+ activeIndex: e.NullOr(e.Number),
20
+ results: e.Array(e.Struct({
21
+ runId: n,
22
+ status: e.Literals([
23
+ "succeeded",
24
+ "failed",
25
+ "skipped",
26
+ "missed"
27
+ ])
28
+ })),
29
+ error: e.NullOr(e.String)
30
+ }), i = e.Struct({
31
+ requestId: n,
32
+ name: n,
33
+ from: t,
34
+ to: t,
35
+ confirm: e.Boolean,
36
+ limit: e.Number.pipe(e.check(e.isInt()), e.check(e.isBetween({
37
+ minimum: 1,
38
+ maximum: 1e4
39
+ })))
40
+ }), a = e.decodeUnknownSync(i), o = e.Union([e.Struct({
41
+ kind: e.Literal("accepted"),
42
+ request: r
43
+ }), e.Struct({
44
+ kind: e.Literal("refused"),
45
+ name: n,
46
+ occurrences: e.Number,
47
+ reason: e.String
48
+ })]), s = class extends Error {
49
+ name = "ScheduleBackfillRequestConflict";
50
+ };
51
+ //#endregion
52
+ export { i as InspectBackfillInputSchema, r as InspectBackfillReceiptSchema, o as InspectBackfillResultSchema, s as ScheduleBackfillRequestConflict, a as decodeInspectBackfillInput };
@@ -0,0 +1,21 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/inspectCommandRejection.ts
3
+ var t = e.Struct({
4
+ kind: e.Literal("rejected"),
5
+ status: e.Literals([
6
+ 400,
7
+ 401,
8
+ 403,
9
+ 404
10
+ ]),
11
+ message: e.String
12
+ }), n = e.is(t), r = (e, t) => {
13
+ let r = {
14
+ kind: "rejected",
15
+ status: e,
16
+ message: t
17
+ };
18
+ return n(r) ? r : void 0;
19
+ };
20
+ //#endregion
21
+ export { t as InspectCommandRejectionSchema, r as inspectCommandRejection, n as isInspectCommandRejection };