@stitchwire/client 0.0.0-stage → 0.31.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/LICENSE +21 -0
- package/README.md +296 -2
- package/dist/chunk-d3248e3w.js +728 -0
- package/dist/chunk-mva06nh4.js +709 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.js +84 -0
- package/dist/enrollment.d.ts +1 -0
- package/dist/enrollment.js +503 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1680 -0
- package/dist/types/client/src/contracts.d.ts +1 -0
- package/dist/types/client/src/enrollment.d.ts +11 -0
- package/dist/types/client/src/index.d.ts +1 -0
- package/dist/types/contracts/src/door/client-error.d.ts +20 -0
- package/dist/types/contracts/src/door/common.d.ts +3 -0
- package/dist/types/contracts/src/door/event-lifecycle.d.ts +22 -0
- package/dist/types/contracts/src/door/local-contract.d.ts +466 -0
- package/dist/types/contracts/src/door/paths.d.ts +17 -0
- package/dist/types/contracts/src/door/request-bounds.d.ts +4 -0
- package/dist/types/contracts/src/door/requests.d.ts +47 -0
- package/dist/types/contracts/src/door/results.d.ts +319 -0
- package/dist/types/contracts/src/door/status.d.ts +859 -0
- package/dist/types/contracts/src/door/streams.d.ts +226 -0
- package/dist/types/contracts/src/enrollment/fleet-admission.d.ts +413 -0
- package/dist/types/contracts/src/enrollment/outcome.d.ts +29 -0
- package/dist/types/contracts/src/enrollment/request.d.ts +281 -0
- package/dist/types/contracts/src/enrollment/result.d.ts +713 -0
- package/dist/types/contracts/src/fleet/bundle.d.ts +209 -0
- package/dist/types/contracts/src/fleet/identity.d.ts +4 -0
- package/dist/types/contracts/src/fleet/manifest.d.ts +71 -0
- package/dist/types/contracts/src/fleet/status.d.ts +56 -0
- package/dist/types/contracts/src/peer-contract.d.ts +78 -0
- package/dist/types/contracts/src/protocol/bounds.d.ts +37 -0
- package/dist/types/contracts/src/protocol/broker-health.d.ts +384 -0
- package/dist/types/contracts/src/protocol/event.d.ts +222 -0
- package/dist/types/contracts/src/protocol/failure.d.ts +146 -0
- package/dist/types/contracts/src/protocol/identity.d.ts +11 -0
- package/dist/types/contracts/src/protocol/json-bounds.d.ts +6 -0
- package/dist/types/contracts/src/protocol/lane-url.d.ts +16 -0
- package/dist/types/contracts/src/protocol/paths.d.ts +7 -0
- package/dist/types/contracts/src/protocol/payload.d.ts +25 -0
- package/dist/types/contracts/src/protocol/presence.d.ts +66 -0
- package/dist/types/contracts/src/protocol/release.d.ts +61 -0
- package/dist/types/contracts/src/protocol/result.d.ts +41 -0
- package/dist/types/contracts/src/protocol/rpc.d.ts +106 -0
- package/dist/types/contracts/src/protocol/schema-parse.d.ts +23 -0
- package/dist/types/contracts/src/protocol/stream.d.ts +290 -0
- package/dist/types/contracts/src/protocol/topic.d.ts +185 -0
- package/dist/types/contracts/src/service/budgets.d.ts +3 -0
- package/dist/types/contracts/src/service/contract-descriptor.d.ts +9 -0
- package/dist/types/contracts/src/service/contracts.d.ts +430 -0
- package/dist/types/contracts/src/service/declaration.d.ts +122 -0
- package/dist/types/contracts/src/service/diagnostics.d.ts +104 -0
- package/dist/types/contracts/src/service/owner-route-path.d.ts +11 -0
- package/dist/types/contracts/src/service/policy-schema.d.ts +154 -0
- package/dist/types/contracts/src/service/request-bounds.d.ts +5 -0
- package/dist/types/contracts/src/service/service-contract.d.ts +112 -0
- package/dist/types/local-client/src/broker-health.d.ts +18 -0
- package/dist/types/local-client/src/client.d.ts +377 -0
- package/dist/types/local-client/src/contracts.d.ts +112 -0
- package/dist/types/local-client/src/declarations.d.ts +57 -0
- package/dist/types/local-client/src/door-paths.d.ts +18 -0
- package/dist/types/local-client/src/errno.d.ts +6 -0
- package/dist/types/local-client/src/error-chain.d.ts +25 -0
- package/dist/types/local-client/src/errors.d.ts +39 -0
- package/dist/types/local-client/src/event-sequence.d.ts +4 -0
- package/dist/types/local-client/src/feed.d.ts +8 -0
- package/dist/types/local-client/src/http.d.ts +20 -0
- package/dist/types/local-client/src/index.d.ts +13 -0
- package/dist/types/local-client/src/ingress.d.ts +31 -0
- package/dist/types/local-client/src/operation.d.ts +37 -0
- package/dist/types/local-client/src/options.d.ts +18 -0
- package/dist/types/local-client/src/paths.d.ts +52 -0
- package/dist/types/local-client/src/readers.d.ts +143 -0
- package/dist/types/local-client/src/service.d.ts +33 -0
- package/dist/types/local-client/src/status-readers.d.ts +756 -0
- package/dist/types/local-client/src/unary.d.ts +10 -0
- package/package.json +58 -4
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const StreamIdSchema: z.ZodUUID;
|
|
3
|
+
export declare const StreamChannelSchema: z.ZodEnum<{
|
|
4
|
+
data: "data";
|
|
5
|
+
stderr: "stderr";
|
|
6
|
+
stdout: "stdout";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StreamTerminalReasonSchema: z.ZodEnum<{
|
|
9
|
+
cancelled: "cancelled";
|
|
10
|
+
completed: "completed";
|
|
11
|
+
disconnect: "disconnect";
|
|
12
|
+
error: "error";
|
|
13
|
+
limit: "limit";
|
|
14
|
+
"slow-consumer": "slow-consumer";
|
|
15
|
+
timeout: "timeout";
|
|
16
|
+
unsupported: "unsupported";
|
|
17
|
+
}>;
|
|
18
|
+
export type StreamTerminalReason = z.infer<typeof StreamTerminalReasonSchema>;
|
|
19
|
+
/** A stream profile a node declares and a caller names. */
|
|
20
|
+
export declare const StreamProfileNameSchema: z.ZodString;
|
|
21
|
+
export declare const StreamSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"profile">;
|
|
23
|
+
profile: z.ZodString;
|
|
24
|
+
args: z.ZodArray<z.ZodString>;
|
|
25
|
+
stdin: z.ZodNullable<z.ZodString>;
|
|
26
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
28
|
+
kind: z.ZodLiteral<"service">;
|
|
29
|
+
service: z.ZodString;
|
|
30
|
+
revision: z.ZodString;
|
|
31
|
+
operation: z.ZodString;
|
|
32
|
+
payload: z.ZodString;
|
|
33
|
+
}, z.core.$strict>], "kind">;
|
|
34
|
+
export declare const StreamOpenSchema: z.ZodObject<{
|
|
35
|
+
streamId: z.ZodUUID;
|
|
36
|
+
ts: z.ZodString;
|
|
37
|
+
from: z.ZodString;
|
|
38
|
+
to: z.ZodString;
|
|
39
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
|
+
kind: z.ZodLiteral<"profile">;
|
|
41
|
+
profile: z.ZodString;
|
|
42
|
+
args: z.ZodArray<z.ZodString>;
|
|
43
|
+
stdin: z.ZodNullable<z.ZodString>;
|
|
44
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"service">;
|
|
47
|
+
service: z.ZodString;
|
|
48
|
+
revision: z.ZodString;
|
|
49
|
+
operation: z.ZodString;
|
|
50
|
+
payload: z.ZodString;
|
|
51
|
+
}, z.core.$strict>], "kind">;
|
|
52
|
+
timeoutMs: z.ZodNumber;
|
|
53
|
+
requestedWindowBytes: z.ZodNumber;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export type StreamOpen = z.infer<typeof StreamOpenSchema>;
|
|
56
|
+
export declare const StreamLimitsSchema: z.ZodObject<{
|
|
57
|
+
maxChunkBytes: z.ZodNumber;
|
|
58
|
+
maxWindowBytes: z.ZodNumber;
|
|
59
|
+
maxStreamBytes: z.ZodNumber;
|
|
60
|
+
slowConsumerTimeoutMs: z.ZodNumber;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export type StreamLimits = z.infer<typeof StreamLimitsSchema>;
|
|
63
|
+
export declare const StreamInvokeSchema: z.ZodObject<{
|
|
64
|
+
open: z.ZodObject<{
|
|
65
|
+
streamId: z.ZodUUID;
|
|
66
|
+
ts: z.ZodString;
|
|
67
|
+
from: z.ZodString;
|
|
68
|
+
to: z.ZodString;
|
|
69
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
70
|
+
kind: z.ZodLiteral<"profile">;
|
|
71
|
+
profile: z.ZodString;
|
|
72
|
+
args: z.ZodArray<z.ZodString>;
|
|
73
|
+
stdin: z.ZodNullable<z.ZodString>;
|
|
74
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"service">;
|
|
77
|
+
service: z.ZodString;
|
|
78
|
+
revision: z.ZodString;
|
|
79
|
+
operation: z.ZodString;
|
|
80
|
+
payload: z.ZodString;
|
|
81
|
+
}, z.core.$strict>], "kind">;
|
|
82
|
+
timeoutMs: z.ZodNumber;
|
|
83
|
+
requestedWindowBytes: z.ZodNumber;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
limits: z.ZodObject<{
|
|
86
|
+
maxChunkBytes: z.ZodNumber;
|
|
87
|
+
maxWindowBytes: z.ZodNumber;
|
|
88
|
+
maxStreamBytes: z.ZodNumber;
|
|
89
|
+
slowConsumerTimeoutMs: z.ZodNumber;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export type StreamInvoke = z.infer<typeof StreamInvokeSchema>;
|
|
93
|
+
export declare const StreamAdmissionSchema: z.ZodObject<{
|
|
94
|
+
refusal: z.ZodEnum<{
|
|
95
|
+
capacity: "capacity";
|
|
96
|
+
none: "none";
|
|
97
|
+
policy: "policy";
|
|
98
|
+
request: "request";
|
|
99
|
+
}>;
|
|
100
|
+
retryAfterMs: z.ZodNullable<z.ZodNumber>;
|
|
101
|
+
transportCause: z.ZodNullable<z.ZodEnum<{
|
|
102
|
+
"acknowledgement-timeout": "acknowledgement-timeout";
|
|
103
|
+
"lane-lost-after-dispatch": "lane-lost-after-dispatch";
|
|
104
|
+
"no-connected-lane": "no-connected-lane";
|
|
105
|
+
"presence-pending-timeout": "presence-pending-timeout";
|
|
106
|
+
"target-offline": "target-offline";
|
|
107
|
+
}>>;
|
|
108
|
+
accepted: z.ZodBoolean;
|
|
109
|
+
failure: z.ZodEnum<{
|
|
110
|
+
cancelled: "cancelled";
|
|
111
|
+
denied: "denied";
|
|
112
|
+
exec: "exec";
|
|
113
|
+
none: "none";
|
|
114
|
+
offline: "offline";
|
|
115
|
+
rejected: "rejected";
|
|
116
|
+
timeout: "timeout";
|
|
117
|
+
transport: "transport";
|
|
118
|
+
}>;
|
|
119
|
+
detail: z.ZodString;
|
|
120
|
+
limits: z.ZodNullable<z.ZodObject<{
|
|
121
|
+
maxChunkBytes: z.ZodNumber;
|
|
122
|
+
maxWindowBytes: z.ZodNumber;
|
|
123
|
+
maxStreamBytes: z.ZodNumber;
|
|
124
|
+
slowConsumerTimeoutMs: z.ZodNumber;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
export type StreamAdmission = z.infer<typeof StreamAdmissionSchema>;
|
|
128
|
+
export declare const StreamChunkFields: {
|
|
129
|
+
streamId: z.ZodUUID;
|
|
130
|
+
from: z.ZodString;
|
|
131
|
+
seq: z.ZodNumber;
|
|
132
|
+
channel: z.ZodEnum<{
|
|
133
|
+
data: "data";
|
|
134
|
+
stderr: "stderr";
|
|
135
|
+
stdout: "stdout";
|
|
136
|
+
}>;
|
|
137
|
+
encoding: z.ZodLiteral<"base64">;
|
|
138
|
+
data: z.ZodString;
|
|
139
|
+
bytes: z.ZodNumber;
|
|
140
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
141
|
+
};
|
|
142
|
+
export declare const StreamChunkSchema: z.ZodObject<{
|
|
143
|
+
streamId: z.ZodUUID;
|
|
144
|
+
from: z.ZodString;
|
|
145
|
+
seq: z.ZodNumber;
|
|
146
|
+
channel: z.ZodEnum<{
|
|
147
|
+
data: "data";
|
|
148
|
+
stderr: "stderr";
|
|
149
|
+
stdout: "stdout";
|
|
150
|
+
}>;
|
|
151
|
+
encoding: z.ZodLiteral<"base64">;
|
|
152
|
+
data: z.ZodString;
|
|
153
|
+
bytes: z.ZodNumber;
|
|
154
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export type StreamChunk = z.infer<typeof StreamChunkSchema>;
|
|
157
|
+
export declare const StreamWindowSchema: z.ZodObject<{
|
|
158
|
+
streamId: z.ZodUUID;
|
|
159
|
+
from: z.ZodString;
|
|
160
|
+
creditBytes: z.ZodNumber;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
export type StreamWindow = z.infer<typeof StreamWindowSchema>;
|
|
163
|
+
export declare const StreamCancelSchema: z.ZodObject<{
|
|
164
|
+
streamId: z.ZodUUID;
|
|
165
|
+
from: z.ZodString;
|
|
166
|
+
reason: z.ZodString;
|
|
167
|
+
}, z.core.$strict>;
|
|
168
|
+
export type StreamCancel = z.infer<typeof StreamCancelSchema>;
|
|
169
|
+
export declare const StreamEndFields: {
|
|
170
|
+
streamId: z.ZodUUID;
|
|
171
|
+
from: z.ZodString;
|
|
172
|
+
lastSeq: z.ZodNumber;
|
|
173
|
+
code: z.ZodNumber;
|
|
174
|
+
reason: z.ZodEnum<{
|
|
175
|
+
cancelled: "cancelled";
|
|
176
|
+
completed: "completed";
|
|
177
|
+
disconnect: "disconnect";
|
|
178
|
+
error: "error";
|
|
179
|
+
limit: "limit";
|
|
180
|
+
"slow-consumer": "slow-consumer";
|
|
181
|
+
timeout: "timeout";
|
|
182
|
+
unsupported: "unsupported";
|
|
183
|
+
}>;
|
|
184
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
185
|
+
};
|
|
186
|
+
export declare const StreamEndSchema: z.ZodObject<{
|
|
187
|
+
streamId: z.ZodUUID;
|
|
188
|
+
from: z.ZodString;
|
|
189
|
+
lastSeq: z.ZodNumber;
|
|
190
|
+
code: z.ZodNumber;
|
|
191
|
+
reason: z.ZodEnum<{
|
|
192
|
+
cancelled: "cancelled";
|
|
193
|
+
completed: "completed";
|
|
194
|
+
disconnect: "disconnect";
|
|
195
|
+
error: "error";
|
|
196
|
+
limit: "limit";
|
|
197
|
+
"slow-consumer": "slow-consumer";
|
|
198
|
+
timeout: "timeout";
|
|
199
|
+
unsupported: "unsupported";
|
|
200
|
+
}>;
|
|
201
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
202
|
+
}, z.core.$strict>;
|
|
203
|
+
export type StreamEnd = z.infer<typeof StreamEndSchema>;
|
|
204
|
+
export declare const StreamErrorFields: {
|
|
205
|
+
refusal: z.ZodEnum<{
|
|
206
|
+
capacity: "capacity";
|
|
207
|
+
none: "none";
|
|
208
|
+
policy: "policy";
|
|
209
|
+
request: "request";
|
|
210
|
+
}>;
|
|
211
|
+
retryAfterMs: z.ZodNullable<z.ZodNumber>;
|
|
212
|
+
transportCause: z.ZodNullable<z.ZodEnum<{
|
|
213
|
+
"acknowledgement-timeout": "acknowledgement-timeout";
|
|
214
|
+
"lane-lost-after-dispatch": "lane-lost-after-dispatch";
|
|
215
|
+
"no-connected-lane": "no-connected-lane";
|
|
216
|
+
"presence-pending-timeout": "presence-pending-timeout";
|
|
217
|
+
"target-offline": "target-offline";
|
|
218
|
+
}>>;
|
|
219
|
+
streamId: z.ZodUUID;
|
|
220
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"broker">]>;
|
|
221
|
+
failure: z.ZodEnum<{
|
|
222
|
+
cancelled: "cancelled";
|
|
223
|
+
denied: "denied";
|
|
224
|
+
exec: "exec";
|
|
225
|
+
none: "none";
|
|
226
|
+
offline: "offline";
|
|
227
|
+
rejected: "rejected";
|
|
228
|
+
timeout: "timeout";
|
|
229
|
+
transport: "transport";
|
|
230
|
+
}>;
|
|
231
|
+
/** How the stream ENDED. Orthogonal to `refusal`, which says why it was refused: a stream can
|
|
232
|
+
* end at `limit` because the producer was over capacity or because the request itself was too
|
|
233
|
+
* large, and a consumer routes those two differently. */
|
|
234
|
+
reason: z.ZodEnum<{
|
|
235
|
+
cancelled: "cancelled";
|
|
236
|
+
completed: "completed";
|
|
237
|
+
disconnect: "disconnect";
|
|
238
|
+
error: "error";
|
|
239
|
+
limit: "limit";
|
|
240
|
+
"slow-consumer": "slow-consumer";
|
|
241
|
+
timeout: "timeout";
|
|
242
|
+
unsupported: "unsupported";
|
|
243
|
+
}>;
|
|
244
|
+
detail: z.ZodString;
|
|
245
|
+
};
|
|
246
|
+
export declare const StreamErrorSchema: z.ZodObject<{
|
|
247
|
+
refusal: z.ZodEnum<{
|
|
248
|
+
capacity: "capacity";
|
|
249
|
+
none: "none";
|
|
250
|
+
policy: "policy";
|
|
251
|
+
request: "request";
|
|
252
|
+
}>;
|
|
253
|
+
retryAfterMs: z.ZodNullable<z.ZodNumber>;
|
|
254
|
+
transportCause: z.ZodNullable<z.ZodEnum<{
|
|
255
|
+
"acknowledgement-timeout": "acknowledgement-timeout";
|
|
256
|
+
"lane-lost-after-dispatch": "lane-lost-after-dispatch";
|
|
257
|
+
"no-connected-lane": "no-connected-lane";
|
|
258
|
+
"presence-pending-timeout": "presence-pending-timeout";
|
|
259
|
+
"target-offline": "target-offline";
|
|
260
|
+
}>>;
|
|
261
|
+
streamId: z.ZodUUID;
|
|
262
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"broker">]>;
|
|
263
|
+
failure: z.ZodEnum<{
|
|
264
|
+
cancelled: "cancelled";
|
|
265
|
+
denied: "denied";
|
|
266
|
+
exec: "exec";
|
|
267
|
+
none: "none";
|
|
268
|
+
offline: "offline";
|
|
269
|
+
rejected: "rejected";
|
|
270
|
+
timeout: "timeout";
|
|
271
|
+
transport: "transport";
|
|
272
|
+
}>;
|
|
273
|
+
reason: z.ZodEnum<{
|
|
274
|
+
cancelled: "cancelled";
|
|
275
|
+
completed: "completed";
|
|
276
|
+
disconnect: "disconnect";
|
|
277
|
+
error: "error";
|
|
278
|
+
limit: "limit";
|
|
279
|
+
"slow-consumer": "slow-consumer";
|
|
280
|
+
timeout: "timeout";
|
|
281
|
+
unsupported: "unsupported";
|
|
282
|
+
}>;
|
|
283
|
+
detail: z.ZodString;
|
|
284
|
+
}, z.core.$strict>;
|
|
285
|
+
export type StreamError = z.infer<typeof StreamErrorSchema>;
|
|
286
|
+
export declare const StreamAckSchema: z.ZodObject<{
|
|
287
|
+
ok: z.ZodBoolean;
|
|
288
|
+
detail: z.ZodString;
|
|
289
|
+
}, z.core.$strict>;
|
|
290
|
+
export type StreamAck = z.infer<typeof StreamAckSchema>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Who decides what about a topic.
|
|
4
|
+
*
|
|
5
|
+
* The fleet decides who may send to whom, and what that may cost a broker: a namespace granted to
|
|
6
|
+
* one producer, with a ceiling on how many topics fit inside it. The owner of the producing
|
|
7
|
+
* application decides what it actually sends: the names inside that namespace and each topic's
|
|
8
|
+
* profile. It is the border services already have — the fleet grants a pair, the owner's descriptor
|
|
9
|
+
* declares the operations — and it exists for the same reason: an owner adding a topic should not
|
|
10
|
+
* have to ask whoever edits the fleet's configuration.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* How much of a topic's recent past the broker keeps so a subscriber that comes back can be handed
|
|
14
|
+
* it instead of a hole. Both zero — the default — keeps nothing.
|
|
15
|
+
*
|
|
16
|
+
* The ring belongs to the TOPIC, not to a subscriber. That is the whole reason this is affordable:
|
|
17
|
+
* a node that never returns costs nothing, because there is no mailbox with its name on it. Two
|
|
18
|
+
* bounds and not three — an event is already capped by `maxEventBytes`, so a count would be a third
|
|
19
|
+
* knob defending nothing, while age and bytes each answer a different failure: value decaying, and
|
|
20
|
+
* one loud topic evicting every other.
|
|
21
|
+
*/
|
|
22
|
+
export declare const TopicRetentionSchema: z.ZodObject<{
|
|
23
|
+
maxAgeMs: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
/** A topic the broker routes: its producer, its readers and its profile. */
|
|
27
|
+
export declare const TopicDeclarationSchema: z.ZodObject<{
|
|
28
|
+
delivery: z.ZodEnum<{
|
|
29
|
+
"latest-wins": "latest-wins";
|
|
30
|
+
ordered: "ordered";
|
|
31
|
+
}>;
|
|
32
|
+
publicationMode: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
"on-change": "on-change";
|
|
34
|
+
periodic: "periodic";
|
|
35
|
+
}>>;
|
|
36
|
+
maxEventBytes: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
maxEventsPerSecond: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
maxSubscribers: z.ZodDefault<z.ZodNumber>;
|
|
39
|
+
queueDepth: z.ZodDefault<z.ZodNumber>;
|
|
40
|
+
subscriberIdleMs: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
retain: z.ZodDefault<z.ZodObject<{
|
|
42
|
+
maxAgeMs: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
producer: z.ZodString;
|
|
46
|
+
subscribers: z.ZodArray<z.ZodString>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type TopicDeclaration = z.infer<typeof TopicDeclarationSchema>;
|
|
49
|
+
export declare const TopicNamespaceSchema: z.ZodString;
|
|
50
|
+
/**
|
|
51
|
+
* Whether `topic` lies inside `namespace`: the namespace is one `TopicNamespaceSchema` accepts — the
|
|
52
|
+
* same pattern, not a second reading of it — and the topic continues past it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isTopicInNamespace(namespace: string, topic: string): boolean;
|
|
55
|
+
export type TopicAccessMode = 'publish' | 'subscribe';
|
|
56
|
+
export interface TopicAuthorizationGrants {
|
|
57
|
+
readonly publish?: readonly string[];
|
|
58
|
+
readonly subscribe?: readonly string[];
|
|
59
|
+
readonly namespaces?: {
|
|
60
|
+
readonly publish?: readonly string[];
|
|
61
|
+
readonly subscribe?: readonly string[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Shared single-direction match used by both node enforcement and SDK authorization helpers. */
|
|
65
|
+
export declare function isTopicMatchedByGrants(topic: string, exact: readonly string[] | undefined, namespaces: readonly string[] | undefined): boolean;
|
|
66
|
+
/** Whether `topic` is granted in `mode` either by exact listing or by a granted namespace prefix. */
|
|
67
|
+
export declare function isTopicAuthorized(topic: string, events: TopicAuthorizationGrants, mode: TopicAccessMode): boolean;
|
|
68
|
+
/** Two namespaces overlap when one could hold a name of the other. */
|
|
69
|
+
export declare function namespacesOverlap(left: string, right: string): boolean;
|
|
70
|
+
export declare const MAX_DECLARED_TOPICS = 256;
|
|
71
|
+
/** Topic descriptor files one node configuration binds; each file may declare several topics. */
|
|
72
|
+
export declare const MAX_TOPIC_DESCRIPTOR_FILES = 16;
|
|
73
|
+
/** Maximum byte size of a single topic descriptor JSON file accepted by the node agent. */
|
|
74
|
+
export declare const TOPIC_MAX_DESCRIPTOR_BYTES: number;
|
|
75
|
+
/**
|
|
76
|
+
* A topic profile as its owner declares it. The producer is whoever sends the declaration, so it is
|
|
77
|
+
* not written here; the readers default to everyone the namespace admits, and may be narrowed.
|
|
78
|
+
*/
|
|
79
|
+
export declare const TopicProfileSchema: z.ZodObject<{
|
|
80
|
+
delivery: z.ZodEnum<{
|
|
81
|
+
"latest-wins": "latest-wins";
|
|
82
|
+
ordered: "ordered";
|
|
83
|
+
}>;
|
|
84
|
+
publicationMode: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
"on-change": "on-change";
|
|
86
|
+
periodic: "periodic";
|
|
87
|
+
}>>;
|
|
88
|
+
maxEventBytes: z.ZodDefault<z.ZodNumber>;
|
|
89
|
+
maxEventsPerSecond: z.ZodDefault<z.ZodNumber>;
|
|
90
|
+
maxSubscribers: z.ZodDefault<z.ZodNumber>;
|
|
91
|
+
queueDepth: z.ZodDefault<z.ZodNumber>;
|
|
92
|
+
subscriberIdleMs: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
retain: z.ZodDefault<z.ZodObject<{
|
|
94
|
+
maxAgeMs: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strict>>;
|
|
97
|
+
subscribers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
export type TopicProfile = z.infer<typeof TopicProfileSchema>;
|
|
100
|
+
export type TopicProfileInput = z.input<typeof TopicProfileSchema>;
|
|
101
|
+
/** The file an owner installs beside its application, and binds a node to. */
|
|
102
|
+
export declare const TopicDescriptorSchema: z.ZodObject<{
|
|
103
|
+
topics: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
104
|
+
delivery: z.ZodEnum<{
|
|
105
|
+
"latest-wins": "latest-wins";
|
|
106
|
+
ordered: "ordered";
|
|
107
|
+
}>;
|
|
108
|
+
publicationMode: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
"on-change": "on-change";
|
|
110
|
+
periodic: "periodic";
|
|
111
|
+
}>>;
|
|
112
|
+
maxEventBytes: z.ZodDefault<z.ZodNumber>;
|
|
113
|
+
maxEventsPerSecond: z.ZodDefault<z.ZodNumber>;
|
|
114
|
+
maxSubscribers: z.ZodDefault<z.ZodNumber>;
|
|
115
|
+
queueDepth: z.ZodDefault<z.ZodNumber>;
|
|
116
|
+
subscriberIdleMs: z.ZodDefault<z.ZodNumber>;
|
|
117
|
+
retain: z.ZodDefault<z.ZodObject<{
|
|
118
|
+
maxAgeMs: z.ZodDefault<z.ZodNumber>;
|
|
119
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
subscribers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
122
|
+
}, z.core.$strict>>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
export type TopicDescriptor = z.infer<typeof TopicDescriptorSchema>;
|
|
125
|
+
export type TopicDescriptorInput = z.input<typeof TopicDescriptorSchema>;
|
|
126
|
+
/** Validates a parsed topic descriptor the way the node agent does, with the same one-line reason. */
|
|
127
|
+
export declare const parseTopicDescriptor: import("./schema-parse.ts").SchemaParse<{
|
|
128
|
+
topics: Record<string, {
|
|
129
|
+
delivery: "latest-wins" | "ordered";
|
|
130
|
+
publicationMode?: "on-change" | "periodic" | undefined;
|
|
131
|
+
maxEventBytes: number;
|
|
132
|
+
maxEventsPerSecond: number;
|
|
133
|
+
maxSubscribers: number;
|
|
134
|
+
queueDepth: number;
|
|
135
|
+
subscriberIdleMs: number;
|
|
136
|
+
retain: {
|
|
137
|
+
maxAgeMs: number;
|
|
138
|
+
maxBytes: number;
|
|
139
|
+
};
|
|
140
|
+
subscribers?: string[] | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* Node → broker: the complete set of topics this producer declares. Complete, not incremental — a
|
|
145
|
+
* topic missing from a later declaration is withdrawn, so the broker never holds a name its owner
|
|
146
|
+
* has already removed.
|
|
147
|
+
*/
|
|
148
|
+
export declare const EventDeclareSchema: z.ZodObject<{
|
|
149
|
+
producer: z.ZodString;
|
|
150
|
+
topics: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
151
|
+
delivery: z.ZodEnum<{
|
|
152
|
+
"latest-wins": "latest-wins";
|
|
153
|
+
ordered: "ordered";
|
|
154
|
+
}>;
|
|
155
|
+
publicationMode: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
"on-change": "on-change";
|
|
157
|
+
periodic: "periodic";
|
|
158
|
+
}>>;
|
|
159
|
+
maxEventBytes: z.ZodDefault<z.ZodNumber>;
|
|
160
|
+
maxEventsPerSecond: z.ZodDefault<z.ZodNumber>;
|
|
161
|
+
maxSubscribers: z.ZodDefault<z.ZodNumber>;
|
|
162
|
+
queueDepth: z.ZodDefault<z.ZodNumber>;
|
|
163
|
+
subscriberIdleMs: z.ZodDefault<z.ZodNumber>;
|
|
164
|
+
retain: z.ZodDefault<z.ZodObject<{
|
|
165
|
+
maxAgeMs: z.ZodDefault<z.ZodNumber>;
|
|
166
|
+
maxBytes: z.ZodDefault<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
subscribers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
169
|
+
}, z.core.$strict>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
export type EventDeclare = z.infer<typeof EventDeclareSchema>;
|
|
172
|
+
export declare const EventDeclareRefusalSchema: z.ZodObject<{
|
|
173
|
+
topic: z.ZodString;
|
|
174
|
+
detail: z.ZodString;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
export type EventDeclareRefusal = z.infer<typeof EventDeclareRefusalSchema>;
|
|
177
|
+
/** Per name: accepted, or refused with the reason the owner needs to repair it. */
|
|
178
|
+
export declare const EventDeclareAckSchema: z.ZodObject<{
|
|
179
|
+
accepted: z.ZodArray<z.ZodString>;
|
|
180
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
181
|
+
topic: z.ZodString;
|
|
182
|
+
detail: z.ZodString;
|
|
183
|
+
}, z.core.$strict>>;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
export type EventDeclareAck = z.infer<typeof EventDeclareAckSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContractDef, EndpointDef } from 'stitchkit';
|
|
2
|
+
import { type ServiceDescriptor } from './policy-schema.ts';
|
|
3
|
+
/** Projects a Stitchkit owner contract into the policy facts Wire must route and bound. */
|
|
4
|
+
export declare function serviceDescriptorFromContract<T extends Record<string, EndpointDef>>(contract: ContractDef<T, string>, config: {
|
|
5
|
+
service: string;
|
|
6
|
+
revision: string;
|
|
7
|
+
maxInflight: number;
|
|
8
|
+
responseBytes?: Partial<Record<keyof T, number>>;
|
|
9
|
+
}): ServiceDescriptor;
|