@voltro/protocol 0.85.0 → 0.87.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 +5987 -0
- package/README.md +14 -0
- package/THIRD-PARTY-NOTICES.md +1122 -31
- package/dist/apiRoleEndpoints.js +108 -0
- package/dist/apiRoleObservation.js +68 -0
- package/dist/apikey.d.ts +10 -0
- package/dist/approval.js +64 -0
- package/dist/approvalDescriptors.js +26 -0
- package/dist/auth.js +389 -0
- package/dist/boundedRing.js +27 -0
- package/dist/businessRule.js +11 -0
- package/dist/canonicalJson.js +14 -0
- package/dist/connection.js +73 -0
- package/dist/devActivity.js +4 -0
- package/dist/errorSchema.js +24 -0
- package/dist/errorValue.js +21 -0
- package/dist/event.js +110 -0
- package/dist/formCapture.js +12 -0
- package/dist/httpStreamMaxDuration.js +9 -0
- package/dist/idempotency.js +121 -0
- package/dist/idempotencyInput.js +123 -0
- package/dist/identity.js +5 -9
- package/dist/index.d.ts +1095 -139
- package/dist/index.js +54 -1700
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +14 -240
- package/dist/inspectBackfill.js +52 -0
- package/dist/inspectCommandRejection.js +21 -0
- package/dist/inspectProjection.js +133 -0
- package/dist/inspectStorageProjection.js +86 -0
- package/dist/inspectValueIdentity.js +4 -0
- package/dist/inspectWorkflowExecution.js +34 -0
- package/dist/inspectWorkflowQueuedStart.js +31 -0
- package/dist/jsonSchema.js +54 -0
- package/dist/jwt.d.ts +10 -0
- package/dist/jwt.js +1 -1
- package/dist/outbox.js +10 -0
- package/dist/pairing.js +75 -0
- package/dist/plugin.js +87 -0
- package/dist/pluginAccountMerge.js +88 -0
- package/dist/pluginNaming.js +32 -0
- package/dist/pluginPrivacy.js +166 -0
- package/dist/procedure.js +280 -0
- package/dist/publicApi.js +325 -0
- package/dist/queryOptionalSources.js +14 -0
- package/dist/reactivityChannel.js +34 -0
- package/dist/rest.d.ts +260 -64
- package/dist/rest.js +345 -499
- package/dist/restFormat.js +163 -0
- package/dist/restReceipt.js +43 -0
- package/dist/revalidate.js +13 -0
- package/dist/rowEquality.js +31 -0
- package/dist/rowPatch.js +182 -0
- package/dist/schemaShape.js +67 -0
- package/dist/scopes.js +273 -0
- package/dist/secretWindows.js +71 -0
- package/dist/serverErrorBus.js +15 -0
- package/dist/serviceCall.js +14 -0
- package/dist/session.d.ts +89 -6
- package/dist/session.js +62 -63
- package/dist/{sessionHeader-DriTZhmv.js → sessionHeader.js} +1 -1
- package/dist/ssrfPolicy.js +30 -0
- package/dist/storageAccess.js +14 -0
- package/dist/storeErrors.js +66 -0
- package/dist/storeScreenshots.js +90 -0
- package/dist/strictInput.js +27 -0
- package/dist/subscriptionEvent.js +37 -0
- package/dist/tenantSelection.js +40 -0
- package/dist/time.js +7 -0
- package/dist/undo.js +38 -0
- package/dist/validation.js +39 -0
- package/dist/webSocketGateway.js +16 -0
- package/dist/workflow.js +297 -0
- package/dist/workflowAccess.js +61 -0
- package/dist/workflowRestart.js +45 -0
- package/dist/workflowRetry.js +44 -0
- package/dist/workflowStartOutcome.js +30 -0
- package/package.json +5 -3
- package/dist/restFormat-BlgTLxm1.js +0 -298
- package/dist/scopes-ClywBij8.js +0 -548
package/dist/inspect.d.ts
CHANGED
|
@@ -162,7 +162,7 @@ export declare class InvalidReplicaSelection extends Error {
|
|
|
162
162
|
|
|
163
163
|
export declare const isInspectCommandRejection: <I>(input: I) => input is I & {
|
|
164
164
|
readonly kind: "rejected";
|
|
165
|
-
readonly status: 400 |
|
|
165
|
+
readonly status: 400 | 404 | 401 | 403;
|
|
166
166
|
readonly message: string;
|
|
167
167
|
};
|
|
168
168
|
|
package/dist/inspect.js
CHANGED
|
@@ -1,256 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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({
|
|
30
|
-
kind: e.Literal("rejected"),
|
|
31
|
-
status: e.Literals([
|
|
32
|
-
400,
|
|
33
|
-
401,
|
|
34
|
-
403,
|
|
35
|
-
404
|
|
36
|
-
]),
|
|
37
|
-
message: e.String
|
|
38
|
-
}), o = e.is(a), s = (e, t) => {
|
|
39
|
-
let n = {
|
|
40
|
-
kind: "rejected",
|
|
41
|
-
status: e,
|
|
42
|
-
message: t
|
|
43
|
-
};
|
|
44
|
-
return o(n) ? n : void 0;
|
|
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({
|
|
46
|
-
id: l,
|
|
47
|
-
name: l,
|
|
48
|
-
from: c,
|
|
49
|
-
to: c,
|
|
50
|
-
occurrences: e.Array(e.Number),
|
|
51
|
-
status: e.Literals([
|
|
52
|
-
"queued",
|
|
53
|
-
"running",
|
|
54
|
-
"completed",
|
|
55
|
-
"interrupted"
|
|
56
|
-
]),
|
|
57
|
-
owner: e.NullOr(e.String),
|
|
58
|
-
createdAt: c,
|
|
59
|
-
updatedAt: c,
|
|
60
|
-
cursor: e.Number,
|
|
61
|
-
activeIndex: e.NullOr(e.Number),
|
|
62
|
-
results: e.Array(e.Struct({
|
|
63
|
-
runId: l,
|
|
64
|
-
status: e.Literals([
|
|
65
|
-
"succeeded",
|
|
66
|
-
"failed",
|
|
67
|
-
"skipped",
|
|
68
|
-
"missed"
|
|
69
|
-
])
|
|
70
|
-
})),
|
|
71
|
-
error: e.NullOr(e.String)
|
|
72
|
-
}), d = e.Struct({
|
|
73
|
-
requestId: l,
|
|
74
|
-
name: l,
|
|
75
|
-
from: c,
|
|
76
|
-
to: c,
|
|
77
|
-
confirm: e.Boolean,
|
|
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({
|
|
83
|
-
kind: e.Literal("accepted"),
|
|
84
|
-
request: u
|
|
85
|
-
}), e.Struct({
|
|
86
|
-
kind: e.Literal("refused"),
|
|
87
|
-
name: l,
|
|
88
|
-
occurrences: e.Number,
|
|
89
|
-
reason: e.String
|
|
90
|
-
})]), m = class extends Error {
|
|
91
|
-
name = "ScheduleBackfillRequestConflict";
|
|
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({
|
|
93
|
-
workflowName: h,
|
|
94
|
-
executionId: h
|
|
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([
|
|
122
|
-
"counter",
|
|
123
|
-
"gauge",
|
|
124
|
-
"histogram",
|
|
125
|
-
"summary",
|
|
126
|
-
"frequency"
|
|
127
|
-
]), C = (e) => {
|
|
128
|
-
let t = b(e);
|
|
129
|
-
return t?.every((e) => typeof e.name == "string" && S.has(String(e.type))) ? t : void 0;
|
|
130
|
-
}, w = (e) => {
|
|
131
|
-
let t = y(e), n = y(t?.data), r = b(n?.results);
|
|
132
|
-
if (!t || !n?.selection || !r) return e;
|
|
133
|
-
let i = r.filter((e) => e.status === "answered").map((e) => ({
|
|
134
|
-
replicaId: String(e.replicaId),
|
|
135
|
-
observation: y(e.observation),
|
|
136
|
-
data: y(e.observation)?.data
|
|
137
|
-
}));
|
|
138
|
-
if (i.length === 0) throw Error("None of the selected replicas answered. Check replica availability and retry.");
|
|
139
|
-
let a = i.map((e) => ({
|
|
140
|
-
...e,
|
|
141
|
-
object: y(e.data)
|
|
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 = {
|
|
145
|
-
capturedAt: s,
|
|
146
|
-
bufferSize: o("bufferSize"),
|
|
147
|
-
bufferCapacity: o("bufferCapacity")
|
|
148
|
-
}, l;
|
|
149
|
-
if (a.every((e) => b(e.object?.records))) {
|
|
150
|
-
let e = a.flatMap((e) => b(e.object?.records).map((t) => ({
|
|
151
|
-
...t,
|
|
152
|
-
fields: {
|
|
153
|
-
...y(t.fields),
|
|
154
|
-
"voltro.replica": e.replicaId
|
|
155
|
-
}
|
|
156
|
-
}))).sort((e, t) => x(e.ts) - x(t.ts));
|
|
157
|
-
l = {
|
|
158
|
-
...c,
|
|
159
|
-
returned: e.length,
|
|
160
|
-
records: e
|
|
161
|
-
};
|
|
162
|
-
} else if (a.every((e) => b(e.object?.traces))) {
|
|
163
|
-
let e = /* @__PURE__ */ new Map();
|
|
164
|
-
for (let t of a) for (let n of b(t.object?.traces)) {
|
|
165
|
-
let r = String(n.traceId), i = (b(n.spans) ?? []).map((e) => ({
|
|
166
|
-
...e,
|
|
167
|
-
attributes: {
|
|
168
|
-
...y(e.attributes),
|
|
169
|
-
"voltro.replica": t.replicaId
|
|
170
|
-
}
|
|
171
|
-
})), a = e.get(r) ?? [];
|
|
172
|
-
a.push({
|
|
173
|
-
...n,
|
|
174
|
-
spans: i
|
|
175
|
-
}), e.set(r, a);
|
|
176
|
-
}
|
|
177
|
-
let t = [...e.values()].map((e) => {
|
|
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));
|
|
185
|
-
return {
|
|
186
|
-
...n,
|
|
187
|
-
startMs: r,
|
|
188
|
-
durationMs: Math.max(0, i - r),
|
|
189
|
-
spanCount: t.length,
|
|
190
|
-
hasError: s,
|
|
191
|
-
spans: t,
|
|
192
|
-
...c ? { deliveryCount: o } : {},
|
|
193
|
-
...l ? { lastDeliveryMs: a } : {}
|
|
194
|
-
};
|
|
195
|
-
}).sort((e, t) => t.startMs - e.startMs);
|
|
196
|
-
l = {
|
|
197
|
-
...c,
|
|
198
|
-
returned: t.length,
|
|
199
|
-
traces: t
|
|
200
|
-
};
|
|
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) => ({
|
|
214
|
-
...t,
|
|
215
|
-
labels: {
|
|
216
|
-
...y(t.labels),
|
|
217
|
-
voltro_replica: e.replicaId
|
|
218
|
-
}
|
|
219
|
-
})));
|
|
220
|
-
else if (a.every((e) => C(e.object?.samples))) l = { samples: a.flatMap((e) => C(e.object?.samples).map((t) => ({
|
|
221
|
-
...t,
|
|
222
|
-
labels: {
|
|
223
|
-
...y(t.labels),
|
|
224
|
-
voltro_replica: e.replicaId
|
|
225
|
-
}
|
|
226
|
-
}))) };
|
|
227
|
-
else if (r.length === 1 && i.length === 1) l = i[0].data;
|
|
228
|
-
else throw Error("This view must compare observations per replica; its values cannot be safely combined.");
|
|
229
|
-
return {
|
|
230
|
-
...t,
|
|
231
|
-
data: l
|
|
232
|
-
};
|
|
233
|
-
}, 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 {
|
|
234
8
|
name = "InvalidReplicaSelection";
|
|
235
|
-
},
|
|
9
|
+
}, m = (e) => {
|
|
236
10
|
let t = e.getAll("replicas"), n = e.getAll("replica");
|
|
237
11
|
if (t.length !== 0 || n.length !== 0) {
|
|
238
|
-
if (t.length > 1 || t.length === 1 && t[0] !== "all" || t.length > 0 && n.length > 0) throw new
|
|
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.");
|
|
239
13
|
if (t[0] === "all") return { mode: "all" };
|
|
240
|
-
if (n.some((e) => e.trim().length === 0 || e.length > 512 || /[\u0000-\u001f\u007f]/.test(e))) throw new
|
|
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.");
|
|
241
15
|
return {
|
|
242
16
|
mode: "selected",
|
|
243
17
|
replicaIds: [...new Set(n)].sort()
|
|
244
18
|
};
|
|
245
19
|
}
|
|
246
|
-
},
|
|
20
|
+
}, h = (e, t) => {
|
|
247
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));
|
|
248
22
|
if (s.delete("replica"), s.delete("replicas"), t.mode === "all") s.set("replicas", "all");
|
|
249
23
|
else {
|
|
250
|
-
if (t.replicaIds.length === 0) throw new
|
|
24
|
+
if (t.replicaIds.length === 0) throw new p("Select at least one replica.");
|
|
251
25
|
for (let e of [...new Set(t.replicaIds)].sort()) s.append("replica", e);
|
|
252
26
|
}
|
|
253
|
-
return
|
|
27
|
+
return m(s), `${o}?${s}${r}`;
|
|
254
28
|
};
|
|
255
29
|
//#endregion
|
|
256
|
-
export {
|
|
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 };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { canonicalInspectValue as e } from "./inspectValueIdentity.js";
|
|
2
|
+
import { projectStorageReplicaAnswers as t } from "./inspectStorageProjection.js";
|
|
3
|
+
//#region src/inspectProjection.ts
|
|
4
|
+
var n = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : void 0, r = (e) => Array.isArray(e) && e.every((e) => n(e) !== void 0) ? e : void 0, i = (e) => typeof e == "number" && Number.isFinite(e) ? e : 0, a = /* @__PURE__ */ new Set([
|
|
5
|
+
"counter",
|
|
6
|
+
"gauge",
|
|
7
|
+
"histogram",
|
|
8
|
+
"summary",
|
|
9
|
+
"frequency"
|
|
10
|
+
]), o = (e) => {
|
|
11
|
+
let t = r(e);
|
|
12
|
+
return t?.every((e) => typeof e.name == "string" && a.has(String(e.type))) ? t : void 0;
|
|
13
|
+
}, s = (a) => {
|
|
14
|
+
let s = n(a), c = n(s?.data), l = r(c?.results);
|
|
15
|
+
if (!s || !c?.selection || !l) return a;
|
|
16
|
+
let u = l.filter((e) => e.status === "answered").map((e) => ({
|
|
17
|
+
replicaId: String(e.replicaId),
|
|
18
|
+
observation: n(e.observation),
|
|
19
|
+
data: n(e.observation)?.data
|
|
20
|
+
}));
|
|
21
|
+
if (u.length === 0) throw Error("None of the selected replicas answered. Check replica availability and retry.");
|
|
22
|
+
let d = u.map((e) => ({
|
|
23
|
+
...e,
|
|
24
|
+
object: n(e.data)
|
|
25
|
+
})), f = (e) => d.reduce((t, n) => t + i(n.object?.[e]), 0), p = -Infinity;
|
|
26
|
+
for (let e of u) p = Math.max(p, i(e.observation?.capturedAt));
|
|
27
|
+
let m = {
|
|
28
|
+
capturedAt: p,
|
|
29
|
+
bufferSize: f("bufferSize"),
|
|
30
|
+
bufferCapacity: f("bufferCapacity")
|
|
31
|
+
}, h, g = u.every((e) => n(e.data)) ? t(u.map((e) => ({
|
|
32
|
+
replicaId: e.replicaId,
|
|
33
|
+
capturedAt: i(e.observation?.capturedAt),
|
|
34
|
+
data: n(e.data)
|
|
35
|
+
}))) : void 0;
|
|
36
|
+
if (g !== void 0) return {
|
|
37
|
+
...s,
|
|
38
|
+
data: g
|
|
39
|
+
};
|
|
40
|
+
if (d.every((e) => r(e.object?.plugins))) {
|
|
41
|
+
let t = d.map((e) => r(e.object.plugins)), n = t[0].filter((n) => t.every((t) => t.some((t) => e(t) === e(n)))), i = new Set(n.map(e)), a = [...new Set(t.flatMap((t) => t.filter((t) => !i.has(e(t))).map((e) => String(e.name))))].sort();
|
|
42
|
+
h = {
|
|
43
|
+
capturedAt: p,
|
|
44
|
+
plugins: n,
|
|
45
|
+
inventoryConflicts: a
|
|
46
|
+
};
|
|
47
|
+
} else if (d.every((e) => r(e.object?.records))) {
|
|
48
|
+
let e = d.flatMap((e) => r(e.object?.records).map((t) => ({
|
|
49
|
+
...t,
|
|
50
|
+
fields: {
|
|
51
|
+
...n(t.fields),
|
|
52
|
+
"voltro.replica": e.replicaId
|
|
53
|
+
}
|
|
54
|
+
}))).sort((e, t) => i(e.ts) - i(t.ts));
|
|
55
|
+
h = {
|
|
56
|
+
...m,
|
|
57
|
+
returned: e.length,
|
|
58
|
+
records: e
|
|
59
|
+
};
|
|
60
|
+
} else if (d.every((e) => r(e.object?.traces))) {
|
|
61
|
+
let e = /* @__PURE__ */ new Map();
|
|
62
|
+
for (let t of d) for (let i of r(t.object?.traces)) {
|
|
63
|
+
let a = String(i.traceId), o = (r(i.spans) ?? []).map((e) => ({
|
|
64
|
+
...e,
|
|
65
|
+
attributes: {
|
|
66
|
+
...n(e.attributes),
|
|
67
|
+
"voltro.replica": t.replicaId
|
|
68
|
+
}
|
|
69
|
+
})), s = e.get(a) ?? [];
|
|
70
|
+
s.push({
|
|
71
|
+
...i,
|
|
72
|
+
spans: o
|
|
73
|
+
}), e.set(a, s);
|
|
74
|
+
}
|
|
75
|
+
let t = [...e.values()].map((e) => {
|
|
76
|
+
let t = e.flatMap((e) => r(e.spans) ?? []).sort((e, t) => i(e.startMs) - i(t.startMs)), n = e[0], a = i(n.startMs);
|
|
77
|
+
for (let t = 1; t < e.length; t += 1) {
|
|
78
|
+
let r = e[t], o = i(r.startMs);
|
|
79
|
+
o < a && (n = r, a = o);
|
|
80
|
+
}
|
|
81
|
+
let o = -Infinity, s = -Infinity, c = 0, l = !1, u = !1, d = !1;
|
|
82
|
+
for (let t of e) o = Math.max(o, i(t.startMs) + i(t.durationMs)), l ||= t.hasError === !0, u ||= t.deliveryCount !== void 0, d ||= t.lastDeliveryMs !== void 0, c += i(t.deliveryCount), s = Math.max(s, i(t.lastDeliveryMs));
|
|
83
|
+
return {
|
|
84
|
+
...n,
|
|
85
|
+
startMs: a,
|
|
86
|
+
durationMs: Math.max(0, o - a),
|
|
87
|
+
spanCount: t.length,
|
|
88
|
+
hasError: l,
|
|
89
|
+
spans: t,
|
|
90
|
+
...u ? { deliveryCount: c } : {},
|
|
91
|
+
...d ? { lastDeliveryMs: s } : {}
|
|
92
|
+
};
|
|
93
|
+
}).sort((e, t) => t.startMs - e.startMs);
|
|
94
|
+
h = {
|
|
95
|
+
...m,
|
|
96
|
+
returned: t.length,
|
|
97
|
+
traces: t
|
|
98
|
+
};
|
|
99
|
+
} else if (d.every((e) => r(e.object?.buckets) && typeof e.object?.windowMs == "number")) {
|
|
100
|
+
let e = -Infinity;
|
|
101
|
+
for (let t of d) e = Math.max(e, i(t.object?.windowMs));
|
|
102
|
+
h = {
|
|
103
|
+
capturedAt: p,
|
|
104
|
+
windowMs: e,
|
|
105
|
+
totalSamples: f("totalSamples"),
|
|
106
|
+
buckets: d.flatMap((e) => r(e.object?.buckets).map((t) => ({
|
|
107
|
+
...t,
|
|
108
|
+
tag: `${String(t.tag)} [${e.replicaId}]`
|
|
109
|
+
})))
|
|
110
|
+
};
|
|
111
|
+
} else if (u.every((e) => o(e.data))) h = u.flatMap((e) => o(e.data).map((t) => ({
|
|
112
|
+
...t,
|
|
113
|
+
labels: {
|
|
114
|
+
...n(t.labels),
|
|
115
|
+
voltro_replica: e.replicaId
|
|
116
|
+
}
|
|
117
|
+
})));
|
|
118
|
+
else if (d.every((e) => o(e.object?.samples))) h = { samples: d.flatMap((e) => o(e.object?.samples).map((t) => ({
|
|
119
|
+
...t,
|
|
120
|
+
labels: {
|
|
121
|
+
...n(t.labels),
|
|
122
|
+
voltro_replica: e.replicaId
|
|
123
|
+
}
|
|
124
|
+
}))) };
|
|
125
|
+
else if (l.length === 1 && u.length === 1) h = u[0].data;
|
|
126
|
+
else throw Error("This view must compare observations per replica; its values cannot be safely combined.");
|
|
127
|
+
return {
|
|
128
|
+
...s,
|
|
129
|
+
data: h
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
export { s as projectReplicaObservation };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { canonicalInspectValue as e } from "./inspectValueIdentity.js";
|
|
2
|
+
//#region src/inspectStorageProjection.ts
|
|
3
|
+
var t = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : void 0, n = (e) => Array.isArray(e) && e.every((e) => t(e)) ? e : void 0, r = (e) => {
|
|
4
|
+
let n = t(e);
|
|
5
|
+
if (n && ["catalogueId", "objectNamespace"].every((e) => typeof n[e] == "string" && /^[a-f0-9]{64}$/.test(n[e])) && typeof n.storageInstance == "string" && n.storageInstance.trim()) return {
|
|
6
|
+
catalogueId: n.catalogueId,
|
|
7
|
+
objectNamespace: n.objectNamespace,
|
|
8
|
+
storageInstance: n.storageInstance
|
|
9
|
+
};
|
|
10
|
+
}, i = (e) => {
|
|
11
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e < 0) throw Error("Storage observation contains an invalid counter.");
|
|
12
|
+
return e;
|
|
13
|
+
}, a = (e, t) => i(e + t), o = (o) => {
|
|
14
|
+
if (!o.length || !o.every((e) => r(e.data.source))) return;
|
|
15
|
+
let s = /* @__PURE__ */ new Map();
|
|
16
|
+
for (let t of o) {
|
|
17
|
+
let n = r(t.data.source), i = s.get(n.catalogueId);
|
|
18
|
+
if (i) {
|
|
19
|
+
if (e(i.source) !== e(n) || e(i.data) !== e(t.data)) throw Error("Replicas returned different snapshots for the same storage catalogue. Compare the replicas or retry the read; counters have not been combined.");
|
|
20
|
+
i.replicaIds.push(t.replicaId), i.capturedAt = Math.max(i.capturedAt, t.capturedAt);
|
|
21
|
+
} else s.set(n.catalogueId, {
|
|
22
|
+
source: n,
|
|
23
|
+
data: t.data,
|
|
24
|
+
replicaIds: [t.replicaId],
|
|
25
|
+
capturedAt: t.capturedAt
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
let c = [...s.values()].sort((e, t) => e.source.catalogueId.localeCompare(t.source.catalogueId)), l = c.map((e) => ({
|
|
29
|
+
...e.source,
|
|
30
|
+
replicaIds: [...new Set(e.replicaIds)].sort(),
|
|
31
|
+
capturedAt: e.capturedAt
|
|
32
|
+
}));
|
|
33
|
+
if (c.every((e) => n(e.data.refs) && t(e.data.page))) {
|
|
34
|
+
let e = c.map((e) => t(e.data.page));
|
|
35
|
+
if (e.some((t) => t.search !== e[0].search || t.offset !== e[0].offset)) throw Error("Storage replica pages do not describe the same query.");
|
|
36
|
+
let r = i(e[0].offset), o = e.some((e) => e.nextOffset !== null) ? a(r, 50) : null;
|
|
37
|
+
if (e.some((e) => e.nextOffset !== null && e.nextOffset !== o)) throw Error("Storage replica pages contain an invalid continuation.");
|
|
38
|
+
return {
|
|
39
|
+
sources: l,
|
|
40
|
+
refs: c.flatMap((e) => n(e.data.refs).map((t) => ({
|
|
41
|
+
...t,
|
|
42
|
+
source: {
|
|
43
|
+
...e.source,
|
|
44
|
+
replicaIds: [...new Set(e.replicaIds)].sort()
|
|
45
|
+
}
|
|
46
|
+
}))).sort((e, t) => String(t.createdAt).localeCompare(String(e.createdAt)) || String(t.id).localeCompare(String(e.id)) || e.source.catalogueId.localeCompare(t.source.catalogueId)),
|
|
47
|
+
page: {
|
|
48
|
+
search: e[0].search,
|
|
49
|
+
offset: r,
|
|
50
|
+
nextOffset: o
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (c.every((e) => typeof e.data.provider == "string" && typeof e.data.bucket == "string" && t(e.data.byTenant) && t(e.data.visibility))) {
|
|
55
|
+
let e = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
56
|
+
for (let o of c) {
|
|
57
|
+
for (let [n, r] of Object.entries(t(o.data.byTenant))) {
|
|
58
|
+
let o = t(r);
|
|
59
|
+
if (!o) throw Error("Storage tenant observation is unreadable.");
|
|
60
|
+
let s = e.get(n) ?? {
|
|
61
|
+
count: 0,
|
|
62
|
+
bytes: 0
|
|
63
|
+
};
|
|
64
|
+
e.set(n, {
|
|
65
|
+
count: a(s.count, i(o.count)),
|
|
66
|
+
bytes: a(s.bytes, i(o.bytes))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
let s = t(o.data.visibility);
|
|
70
|
+
n = a(n, i(s.public)), r = a(r, i(s.private));
|
|
71
|
+
}
|
|
72
|
+
let o = [...new Set(c.map((e) => String(e.data.provider)))].sort(), s = [...new Set(c.map((e) => String(e.data.bucket)))].sort();
|
|
73
|
+
return {
|
|
74
|
+
sources: l,
|
|
75
|
+
provider: o.length === 1 ? o[0] : o.join(", "),
|
|
76
|
+
bucket: s.length === 1 ? s[0] : s.join(", "),
|
|
77
|
+
byTenant: Object.fromEntries(e),
|
|
78
|
+
visibility: {
|
|
79
|
+
public: n,
|
|
80
|
+
private: r
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { o as projectStorageReplicaAnswers };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/inspectValueIdentity.ts
|
|
2
|
+
var e = (e) => JSON.stringify(t(e)), t = (e) => Array.isArray(e) ? e.map(t) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => [e, t(n)])) : e;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as canonicalInspectValue };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
//#region src/inspectWorkflowExecution.ts
|
|
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
|
+
workflowName: t,
|
|
5
|
+
executionId: t
|
|
6
|
+
}), r = n.fields, i = e.Union([
|
|
7
|
+
e.Struct({
|
|
8
|
+
...r,
|
|
9
|
+
kind: e.Literal("not-observed")
|
|
10
|
+
}),
|
|
11
|
+
e.Struct({
|
|
12
|
+
...r,
|
|
13
|
+
kind: e.Literal("pending")
|
|
14
|
+
}),
|
|
15
|
+
e.Struct({
|
|
16
|
+
...r,
|
|
17
|
+
kind: e.Literal("delivery-failed")
|
|
18
|
+
}),
|
|
19
|
+
e.Struct({
|
|
20
|
+
...r,
|
|
21
|
+
kind: e.Literal("suspended")
|
|
22
|
+
}),
|
|
23
|
+
e.Struct({
|
|
24
|
+
...r,
|
|
25
|
+
kind: e.Literal("completed"),
|
|
26
|
+
outcome: e.Literals([
|
|
27
|
+
"succeeded",
|
|
28
|
+
"failed",
|
|
29
|
+
"cancelled"
|
|
30
|
+
])
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as InspectWorkflowExecutionObservationSchema, n as InspectWorkflowExecutionTargetSchema };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
//#region src/inspectWorkflowQueuedStart.ts
|
|
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
|
+
workflowName: t,
|
|
5
|
+
receiptId: t,
|
|
6
|
+
tenantId: e.NullOr(t)
|
|
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
|
+
]);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { i as InspectWorkflowQueuedStartObservationSchema, n as InspectWorkflowQueuedStartTargetSchema };
|