@voltro/protocol 0.83.1 → 0.85.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/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
- readonly limit: number;
7
7
  readonly from: string;
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,23 +1,39 @@
1
1
  import { Schema as e } from "effect";
2
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({
3
+ var t = e.NonEmptyString.pipe(e.check(e.isMaxLength(1024)), e.check(e.makeFilter((e) => e.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(e)))), n = e.Struct({
4
4
  workflowName: t,
5
5
  receiptId: t,
6
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({
7
+ }), r = n.fields, i = e.Union([
8
+ e.Struct({
9
+ ...r,
10
+ kind: e.Literal("pending")
11
+ }),
12
+ e.Struct({
13
+ ...r,
14
+ kind: e.Literal("accepted"),
15
+ executionId: t
16
+ }),
17
+ e.Struct({
18
+ ...r,
19
+ kind: e.Literal("not-executed"),
20
+ reason: e.Literals([
21
+ "dropped",
22
+ "skipped",
23
+ "superseded",
24
+ "cancelled",
25
+ "abandoned",
26
+ "rejected"
27
+ ])
28
+ })
29
+ ]), a = e.Struct({
19
30
  kind: e.Literal("rejected"),
20
- status: e.Literal(400, 401, 403, 404),
31
+ status: e.Literals([
32
+ 400,
33
+ 401,
34
+ 403,
35
+ 404
36
+ ]),
21
37
  message: e.String
22
38
  }), o = e.is(a), s = (e, t) => {
23
39
  let n = {
@@ -26,13 +42,18 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
26
42
  message: t
27
43
  };
28
44
  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({
45
+ }, c = e.String.pipe(e.check(e.makeFilter((e) => Number.isFinite(Date.parse(e))))), l = e.String.pipe(e.check(e.isMinLength(1)), e.check(e.isMaxLength(256))), u = e.Struct({
30
46
  id: l,
31
47
  name: l,
32
48
  from: c,
33
49
  to: c,
34
50
  occurrences: e.Array(e.Number),
35
- status: e.Literal("queued", "running", "completed", "interrupted"),
51
+ status: e.Literals([
52
+ "queued",
53
+ "running",
54
+ "completed",
55
+ "interrupted"
56
+ ]),
36
57
  owner: e.NullOr(e.String),
37
58
  createdAt: c,
38
59
  updatedAt: c,
@@ -40,7 +61,12 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
40
61
  activeIndex: e.NullOr(e.Number),
41
62
  results: e.Array(e.Struct({
42
63
  runId: l,
43
- status: e.Literal("succeeded", "failed", "skipped", "missed")
64
+ status: e.Literals([
65
+ "succeeded",
66
+ "failed",
67
+ "skipped",
68
+ "missed"
69
+ ])
44
70
  })),
45
71
  error: e.NullOr(e.String)
46
72
  }), d = e.Struct({
@@ -49,8 +75,11 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
49
75
  from: c,
50
76
  to: c,
51
77
  confirm: e.Boolean,
52
- limit: e.Number.pipe(e.int(), e.between(1, 1e4))
53
- }), f = e.decodeUnknownSync(d), p = e.Union(e.Struct({
78
+ limit: e.Number.pipe(e.check(e.isInt()), e.check(e.isBetween({
79
+ minimum: 1,
80
+ maximum: 1e4
81
+ })))
82
+ }), f = e.decodeUnknownSync(d), p = e.Union([e.Struct({
54
83
  kind: e.Literal("accepted"),
55
84
  request: u
56
85
  }), e.Struct({
@@ -58,28 +87,38 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
58
87
  name: l,
59
88
  occurrences: e.Number,
60
89
  reason: e.String
61
- })), m = class extends Error {
90
+ })]), m = class extends Error {
62
91
  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({
92
+ }, h = e.NonEmptyString.pipe(e.check(e.isMaxLength(1024)), e.check(e.makeFilter((e) => e.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(e)))), g = e.Struct({
64
93
  workflowName: h,
65
94
  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([
95
+ }), _ = g.fields, v = e.Union([
96
+ e.Struct({
97
+ ..._,
98
+ kind: e.Literal("not-observed")
99
+ }),
100
+ e.Struct({
101
+ ..._,
102
+ kind: e.Literal("pending")
103
+ }),
104
+ e.Struct({
105
+ ..._,
106
+ kind: e.Literal("delivery-failed")
107
+ }),
108
+ e.Struct({
109
+ ..._,
110
+ kind: e.Literal("suspended")
111
+ }),
112
+ e.Struct({
113
+ ..._,
114
+ kind: e.Literal("completed"),
115
+ outcome: e.Literals([
116
+ "succeeded",
117
+ "failed",
118
+ "cancelled"
119
+ ])
120
+ })
121
+ ]), 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
122
  "counter",
84
123
  "gauge",
85
124
  "histogram",
@@ -100,7 +139,9 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
100
139
  let a = i.map((e) => ({
101
140
  ...e,
102
141
  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 = {
142
+ })), o = (e) => a.reduce((t, n) => t + x(n.object?.[e]), 0), s = -Infinity;
143
+ for (let e of i) s = Math.max(s, x(e.observation?.capturedAt));
144
+ let c = {
104
145
  capturedAt: s,
105
146
  bufferSize: o("bufferSize"),
106
147
  bufferCapacity: o("bufferCapacity")
@@ -134,16 +175,22 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
134
175
  }), e.set(r, a);
135
176
  }
136
177
  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)));
178
+ let t = e.flatMap((e) => b(e.spans) ?? []).sort((e, t) => x(e.startMs) - x(t.startMs)), n = e[0], r = x(n.startMs);
179
+ for (let t = 1; t < e.length; t += 1) {
180
+ let i = e[t], a = x(i.startMs);
181
+ a < r && (n = i, r = a);
182
+ }
183
+ let i = -Infinity, a = -Infinity, o = 0, s = !1, c = !1, l = !1;
184
+ for (let t of e) i = Math.max(i, x(t.startMs) + x(t.durationMs)), s ||= t.hasError === !0, c ||= t.deliveryCount !== void 0, l ||= t.lastDeliveryMs !== void 0, o += x(t.deliveryCount), a = Math.max(a, x(t.lastDeliveryMs));
138
185
  return {
139
186
  ...n,
140
187
  startMs: r,
141
188
  durationMs: Math.max(0, i - r),
142
189
  spanCount: t.length,
143
- hasError: e.some((e) => e.hasError === !0),
190
+ hasError: s,
144
191
  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))) } : {}
192
+ ...c ? { deliveryCount: o } : {},
193
+ ...l ? { lastDeliveryMs: a } : {}
147
194
  };
148
195
  }).sort((e, t) => t.startMs - e.startMs);
149
196
  l = {
@@ -151,16 +198,19 @@ var t = e.NonEmptyString.pipe(e.maxLength(1024), e.filter((e) => e.trim().length
151
198
  returned: t.length,
152
199
  traces: t
153
200
  };
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) => ({
201
+ } else if (a.every((e) => b(e.object?.buckets) && typeof e.object?.windowMs == "number")) {
202
+ let e = -Infinity;
203
+ for (let t of a) e = Math.max(e, x(t.object?.windowMs));
204
+ l = {
205
+ capturedAt: s,
206
+ windowMs: e,
207
+ totalSamples: o("totalSamples"),
208
+ buckets: a.flatMap((e) => b(e.object?.buckets).map((t) => ({
209
+ ...t,
210
+ tag: `${String(t.tag)} [${e.replicaId}]`
211
+ })))
212
+ };
213
+ } else if (i.every((e) => C(e.data))) l = i.flatMap((e) => C(e.data).map((t) => ({
164
214
  ...t,
165
215
  labels: {
166
216
  ...y(t.labels),
package/dist/jwt.d.ts CHANGED
@@ -289,33 +289,31 @@ declare type StrategyResolution = {
289
289
  readonly reason: string;
290
290
  };
291
291
 
292
- declare const Subject: Schema.Union<[Schema.Struct<{
293
- type: Schema.Literal<["user"]>;
294
- id: typeof Schema.String;
295
- tenantId: typeof Schema.String;
296
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
297
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
292
+ declare const Subject: Schema.Union<readonly [Schema.Struct<{
293
+ readonly type: Schema.Literal<"user">;
294
+ readonly id: Schema.String;
295
+ readonly tenantId: Schema.String;
296
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
297
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
298
298
  }>, Schema.Struct<{
299
- type: Schema.Literal<["apiKey"]>;
300
- id: typeof Schema.String;
301
- tenantId: typeof Schema.String;
302
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
303
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
299
+ readonly type: Schema.Literal<"apiKey">;
300
+ readonly id: Schema.String;
301
+ readonly tenantId: Schema.String;
302
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
303
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
304
304
  }>, Schema.Struct<{
305
- type: Schema.Literal<["serviceAccount"]>;
306
- id: typeof Schema.String;
307
- tenantId: typeof Schema.String;
305
+ readonly type: Schema.Literal<"serviceAccount">;
306
+ readonly id: Schema.String;
307
+ readonly tenantId: Schema.String;
308
308
  /** Application actor used for audit columns; null means machine work with
309
309
  * no application actor. Identity only, never a permission grant. */
310
- auditActorId: Schema.optionalWith<Schema.NullOr<typeof Schema.String>, {
311
- exact: true;
312
- }>;
313
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
314
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
310
+ readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
311
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
312
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
315
313
  }>, Schema.Struct<{
316
- type: Schema.Literal<["anonymous"]>;
317
- id: typeof Schema.Null;
318
- tenantId: Schema.NullOr<typeof Schema.String>;
314
+ readonly type: Schema.Literal<"anonymous">;
315
+ readonly id: Schema.Null;
316
+ readonly tenantId: Schema.NullOr<Schema.String>;
319
317
  /**
320
318
  * Set when this caller PRESENTED a credential and it was rejected — an
321
319
  * expired token above all. Absent when they presented none.
@@ -332,21 +330,21 @@ declare const Subject: Schema.Union<[Schema.Struct<{
332
330
  * must not break an `openAccess` procedure that needs no session at all. The
333
331
  * fact travels, and only a guard that actually refuses spends it.
334
332
  */
335
- credentialRejected: Schema.optional<typeof Schema.String>;
333
+ readonly credentialRejected: Schema.optional<Schema.String>;
336
334
  }>, Schema.Struct<{
337
- type: Schema.Literal<["system"]>;
338
- id: typeof Schema.String;
339
- tenantId: typeof Schema.Null;
340
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
341
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
335
+ readonly type: Schema.Literal<"system">;
336
+ readonly id: Schema.String;
337
+ readonly tenantId: Schema.Null;
338
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
339
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
342
340
  }>, Schema.Struct<{
343
- type: Schema.Literal<["service"]>;
344
- id: typeof Schema.String;
341
+ readonly type: Schema.Literal<"service">;
342
+ readonly id: Schema.String;
345
343
  /** The calling app's name, as the callee lists it in `serviceCallers`. */
346
- service: typeof Schema.String;
347
- tenantId: typeof Schema.Null;
348
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
349
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
344
+ readonly service: Schema.String;
345
+ readonly tenantId: Schema.Null;
346
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
347
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
350
348
  }>]>;
351
349
 
352
350
  declare type Subject = typeof Subject.Type;