@net-mesh/browser 0.37.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 +517 -0
- package/LICENSE-APACHE +190 -0
- package/LICENSE-MIT +21 -0
- package/README.md +666 -0
- package/dist/async-queue.d.ts +26 -0
- package/dist/async-queue.js +62 -0
- package/dist/credential.d.ts +70 -0
- package/dist/credential.js +95 -0
- package/dist/errors.d.ts +400 -0
- package/dist/errors.js +726 -0
- package/dist/events.d.ts +232 -0
- package/dist/events.js +298 -0
- package/dist/identity.d.ts +40 -0
- package/dist/identity.js +78 -0
- package/dist/index.bundle.js +2 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +46 -0
- package/dist/leader/events.d.ts +111 -0
- package/dist/leader/events.js +116 -0
- package/dist/leader/index.d.ts +14 -0
- package/dist/leader/index.js +11 -0
- package/dist/leader/session.d.ts +539 -0
- package/dist/leader/session.js +770 -0
- package/dist/leader/wasm.d.ts +123 -0
- package/dist/leader/wasm.js +39 -0
- package/dist/lobby.d.ts +183 -0
- package/dist/lobby.js +504 -0
- package/dist/local.d.ts +80 -0
- package/dist/local.js +160 -0
- package/dist/net_leaf.d.ts +1494 -0
- package/dist/net_leaf.js +3753 -0
- package/dist/net_leaf_bg.wasm +0 -0
- package/dist/net_leaf_bg.wasm.d.ts +137 -0
- package/dist/netcode/client.d.ts +102 -0
- package/dist/netcode/client.js +296 -0
- package/dist/netcode/clock.d.ts +45 -0
- package/dist/netcode/clock.js +54 -0
- package/dist/netcode/host.d.ts +118 -0
- package/dist/netcode/host.js +276 -0
- package/dist/netcode/index.d.ts +19 -0
- package/dist/netcode/index.js +14 -0
- package/dist/netcode/interpolate.d.ts +50 -0
- package/dist/netcode/interpolate.js +100 -0
- package/dist/netcode/wire.d.ts +125 -0
- package/dist/netcode/wire.js +117 -0
- package/dist/node.d.ts +908 -0
- package/dist/node.js +1085 -0
- package/dist/org.d.ts +412 -0
- package/dist/org.js +567 -0
- package/dist/peer-driver.d.ts +117 -0
- package/dist/peer-driver.js +224 -0
- package/dist/store/assembly.d.ts +176 -0
- package/dist/store/assembly.js +325 -0
- package/dist/store/chunker.d.ts +83 -0
- package/dist/store/chunker.js +190 -0
- package/dist/store/core.d.ts +136 -0
- package/dist/store/core.js +477 -0
- package/dist/store/definition.d.ts +23 -0
- package/dist/store/definition.js +83 -0
- package/dist/store/errors.d.ts +77 -0
- package/dist/store/errors.js +94 -0
- package/dist/store/host.d.ts +247 -0
- package/dist/store/host.js +675 -0
- package/dist/store/index.d.ts +50 -0
- package/dist/store/index.js +40 -0
- package/dist/store/interest.d.ts +40 -0
- package/dist/store/interest.js +77 -0
- package/dist/store/inventory.d.ts +81 -0
- package/dist/store/inventory.js +140 -0
- package/dist/store/join.d.ts +118 -0
- package/dist/store/join.js +724 -0
- package/dist/store/json.d.ts +50 -0
- package/dist/store/json.js +283 -0
- package/dist/store/ledger.d.ts +187 -0
- package/dist/store/ledger.js +292 -0
- package/dist/store/owner.d.ts +616 -0
- package/dist/store/owner.js +1711 -0
- package/dist/store/patch.d.ts +70 -0
- package/dist/store/patch.js +166 -0
- package/dist/store/player.d.ts +65 -0
- package/dist/store/player.js +261 -0
- package/dist/store/replica.d.ts +187 -0
- package/dist/store/replica.js +740 -0
- package/dist/store/state.d.ts +42 -0
- package/dist/store/state.js +165 -0
- package/dist/store/types.d.ts +200 -0
- package/dist/store/types.js +25 -0
- package/dist/store/visibility.d.ts +118 -0
- package/dist/store/visibility.js +282 -0
- package/dist/store/wire.d.ts +309 -0
- package/dist/store/wire.js +834 -0
- package/dist/stream.d.ts +174 -0
- package/dist/stream.js +238 -0
- package/dist/three/index.d.ts +109 -0
- package/dist/three/index.js +130 -0
- package/dist/udp-probe.d.ts +159 -0
- package/dist/udp-probe.js +245 -0
- package/dist/wasm.d.ts +642 -0
- package/dist/wasm.js +98 -0
- package/dist/world/border.d.ts +84 -0
- package/dist/world/border.js +99 -0
- package/dist/world/handoff.d.ts +187 -0
- package/dist/world/handoff.js +222 -0
- package/dist/world/index.d.ts +13 -0
- package/dist/world/index.js +9 -0
- package/dist/world/link.d.ts +179 -0
- package/dist/world/link.js +476 -0
- package/dist/world/regions.d.ts +154 -0
- package/dist/world/regions.js +314 -0
- package/package.json +72 -0
package/dist/org.d.ts
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization-scoped streaming, as a page wants it (plan §4.5).
|
|
3
|
+
*
|
|
4
|
+
* The eight org verbs — {@link OrgUnaryHandler call}, streaming,
|
|
5
|
+
* client-streaming and duplex, each calling and serving — share one
|
|
6
|
+
* credential/option vocabulary and one terminal error taxonomy
|
|
7
|
+
* (`errors.ts`'s `OrgStreamError` family). The same eight names exist
|
|
8
|
+
* on {@link BrowserNode} and on {@link MeshSession}; the wrappers here
|
|
9
|
+
* serve both, so the two surfaces cannot drift into two spellings of
|
|
10
|
+
* one contract.
|
|
11
|
+
*
|
|
12
|
+
* **Suspension and closure (plan §4.5).** Deadlines are absolute: a
|
|
13
|
+
* frozen tab extends no lease and no window, so a call whose deadline
|
|
14
|
+
* passes while its tab is suspended retires with its deadline
|
|
15
|
+
* terminal on wake — {@link OrgTimeoutError}, or
|
|
16
|
+
* {@link OrgIndeterminateError} where the work may already be
|
|
17
|
+
* executing in another tab. Nothing resumes automatically: a retired
|
|
18
|
+
* call is never transparently re-opened, because re-opening is a
|
|
19
|
+
* fresh call with a fresh proof and MAY repeat effects. Node or tab
|
|
20
|
+
* close retires ownership — pending calls fail typed, and each
|
|
21
|
+
* dropped caller handle emits exactly one CANCEL.
|
|
22
|
+
*
|
|
23
|
+
* **Handler drop (F-S3.1-2), verbatim.** The retire supervisor may
|
|
24
|
+
* drop the handler future without a final poll — cancellation is
|
|
25
|
+
* observed through the retirement observables (the terminal item, the
|
|
26
|
+
* sink's typed closed refusal, and `retired`), never assumed as a
|
|
27
|
+
* handler-side event; a detached observer holding `retired` observes
|
|
28
|
+
* the signal. After retirement a handler sees typed refusals from
|
|
29
|
+
* `send`/`close`, and any return value it produces is discarded.
|
|
30
|
+
*/
|
|
31
|
+
import { type OrgRetireReason, type OrgStreamError } from './errors.js';
|
|
32
|
+
import type { LeafWasmOrgByteStreamHandle, LeafWasmOrgCallOptions, LeafWasmOrgClientStreamHandler, LeafWasmOrgDuplexCallHandle, LeafWasmOrgDuplexHandler, LeafWasmOrgRequestStreamHandle, LeafWasmOrgResponseSinkHandle, LeafWasmOrgServeHandle, LeafWasmOrgStreamingHandler, LeafWasmOrgUnaryHandler, LeafWasmOrgUploadCallHandle, LeafWasmOrgCaller, LeafWasmOrgServeOptions } from './wasm.js';
|
|
33
|
+
/**
|
|
34
|
+
* The credential set one org call presents.
|
|
35
|
+
*
|
|
36
|
+
* The proofs are the caller's own bytes — this package carries them
|
|
37
|
+
* and never mints, re-derives or interprets them. No TypeScript crypto
|
|
38
|
+
* or authority implementation exists here by design (plan §4.5).
|
|
39
|
+
*/
|
|
40
|
+
export interface OrgCallCredentials {
|
|
41
|
+
/** The caller's membership certificate, its 156-byte wire form. */
|
|
42
|
+
membership: Uint8Array;
|
|
43
|
+
/** The dispatcher grant, its wire form. */
|
|
44
|
+
dispatcher: Uint8Array;
|
|
45
|
+
/** The capability grant, its wire form, when the call carries one. */
|
|
46
|
+
capabilityGrant?: Uint8Array;
|
|
47
|
+
/** The org the caller acts as. */
|
|
48
|
+
actingOrg: string;
|
|
49
|
+
/** The org that owns the provider. */
|
|
50
|
+
providerOwnerOrg: string;
|
|
51
|
+
/** The provider, exactly as the call addresses it. */
|
|
52
|
+
provider: string;
|
|
53
|
+
/** Proof freshness bound, seconds. */
|
|
54
|
+
proofTtlSecs?: number;
|
|
55
|
+
}
|
|
56
|
+
/** Options for the four org call verbs. */
|
|
57
|
+
export interface OrgCallOptions {
|
|
58
|
+
credentials: OrgCallCredentials;
|
|
59
|
+
/**
|
|
60
|
+
* The call's deadline, milliseconds. **Absolute**, in the
|
|
61
|
+
* suspension contract's sense: a frozen tab extends it by nothing,
|
|
62
|
+
* and on wake an overdue call retires with its deadline terminal.
|
|
63
|
+
*/
|
|
64
|
+
deadlineMs?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Initial response-direction flow-control window, **chunk
|
|
67
|
+
* credits** — the wire header's unit: one credit permits one item
|
|
68
|
+
* frame, whatever the item's byte size. NOT bytes; a byte count
|
|
69
|
+
* here reads as a huge credit budget and nothing ever parks.
|
|
70
|
+
*/
|
|
71
|
+
streamWindowInitial?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Initial request-direction flow-control window, **chunk
|
|
74
|
+
* credits** (as {@link OrgCallOptions.streamWindowInitial}).
|
|
75
|
+
*/
|
|
76
|
+
requestWindowInitial?: number;
|
|
77
|
+
}
|
|
78
|
+
/** Options for the four org serve verbs. */
|
|
79
|
+
export interface OrgServeOptions {
|
|
80
|
+
/** The org that owns the provider side of every admitted call. */
|
|
81
|
+
ownerOrg: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Which authority admits a served call: `'same-org'` is owner-org
|
|
85
|
+
* traffic only, `'granted'` admits capability grants too. Anything
|
|
86
|
+
* else is refused loudly at registration.
|
|
87
|
+
*/
|
|
88
|
+
export type OrgAccess = 'same-org' | 'granted';
|
|
89
|
+
/**
|
|
90
|
+
* The verified caller attribution a handler receives. Every field is
|
|
91
|
+
* the leaf's own verified reading — `entity` is 64 hex digits — and
|
|
92
|
+
* none of it is caller-asserted at the handler.
|
|
93
|
+
*/
|
|
94
|
+
export interface OrgCaller {
|
|
95
|
+
/** The caller's entity id, 64 hex digits. */
|
|
96
|
+
entity: string;
|
|
97
|
+
/** The org the caller acted as. */
|
|
98
|
+
actingOrg: string;
|
|
99
|
+
/** The org that owns this provider. */
|
|
100
|
+
providerOrg: string;
|
|
101
|
+
/** The provider, exactly as the call addressed it. */
|
|
102
|
+
provider: string;
|
|
103
|
+
/** The capability the admission covered. */
|
|
104
|
+
capability: string;
|
|
105
|
+
/** Whether the caller acted inside `providerOrg`. */
|
|
106
|
+
isSameOrg: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The response half of an org call: pull items, or cancel.
|
|
110
|
+
*
|
|
111
|
+
* `next()`'s terminal error item carries the §4.3 typed error —
|
|
112
|
+
* `AdmissionDenied('denied')` ({@link OrgRevokedError} where the cause
|
|
113
|
+
* was revocation), {@link OrgTimeoutError}, {@link OrgCancelledError},
|
|
114
|
+
* and the rest of the `OrgStreamError` family. The async iterator
|
|
115
|
+
* **throws** that typed error at the terminal error item, which is
|
|
116
|
+
* idiomatic for `for await`; a clean end is a plain loop end.
|
|
117
|
+
*/
|
|
118
|
+
export interface OrgByteStream {
|
|
119
|
+
next(): Promise<{
|
|
120
|
+
done: boolean;
|
|
121
|
+
value?: Uint8Array;
|
|
122
|
+
error?: OrgStreamError;
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Drop this caller handle — exactly one CANCEL leaves, and the
|
|
126
|
+
* stream's terminal becomes {@link OrgCancelledError}.
|
|
127
|
+
*/
|
|
128
|
+
cancel(): void;
|
|
129
|
+
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A client-streaming upload: send bodies, then `finish()` for the
|
|
133
|
+
* reply. `finish()` rejects with the typed terminal error.
|
|
134
|
+
*/
|
|
135
|
+
export interface OrgUploadCall {
|
|
136
|
+
send(payload: Uint8Array): Promise<void>;
|
|
137
|
+
/** Half-close the upload and await the reply. */
|
|
138
|
+
finish(): Promise<Uint8Array>;
|
|
139
|
+
/** Drop this caller handle — exactly one CANCEL leaves. */
|
|
140
|
+
cancel(): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The upload half of a duplex call. The caller-side sink has
|
|
144
|
+
* `finishSending`/`cancel` and deliberately no `retired`: its
|
|
145
|
+
* retirement is the stream's terminal item, one observable per side.
|
|
146
|
+
*/
|
|
147
|
+
export interface OrgDuplexSink {
|
|
148
|
+
send(payload: Uint8Array): Promise<void>;
|
|
149
|
+
/** Half-close the request direction; the response direction runs on. */
|
|
150
|
+
finishSending(): Promise<void>;
|
|
151
|
+
/** Drop this caller handle — exactly one CANCEL leaves. */
|
|
152
|
+
cancel(): void;
|
|
153
|
+
}
|
|
154
|
+
/** The two halves of a duplex call. */
|
|
155
|
+
export interface OrgDuplexHandles {
|
|
156
|
+
sink: OrgDuplexSink;
|
|
157
|
+
stream: OrgByteStream;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The response sink a streaming or duplex **handler** receives.
|
|
161
|
+
*
|
|
162
|
+
* **Handler drop (F-S3.1-2), verbatim.** The retire supervisor may
|
|
163
|
+
* drop the handler future without a final poll — cancellation is
|
|
164
|
+
* observed through the retirement observables (the terminal item, the
|
|
165
|
+
* sink's typed closed refusal, and `retired`), never assumed as a
|
|
166
|
+
* handler-side event; a detached observer holding `retired` observes
|
|
167
|
+
* the signal. After retirement `send`/`close` refuse typed with THE
|
|
168
|
+
* closed refusal ({@link ORG_SINK_CLOSED_REFUSAL} — one text whatever
|
|
169
|
+
* the verdict, matching the leaf's own hardening byte for byte) and a
|
|
170
|
+
* handler return value is discarded.
|
|
171
|
+
*/
|
|
172
|
+
export interface OrgResponseSink {
|
|
173
|
+
send(payload: Uint8Array): Promise<void>;
|
|
174
|
+
/** Half-close the response direction: the call's normal ending. */
|
|
175
|
+
close(): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* THE retirement signal. Resolves with exactly
|
|
178
|
+
* one of {@link OrgRetireReason}'s verdicts when — and only when —
|
|
179
|
+
* this sink is retired before its call completed. On normal
|
|
180
|
+
* completion the call's own terminal settles every consumer and
|
|
181
|
+
* this promise stays pending: hold it as a signal, not a completion
|
|
182
|
+
* latch. Memoized at construction — one `retired()` crosses the
|
|
183
|
+
* boundary, and a detached observer holding this promise observes
|
|
184
|
+
* the signal.
|
|
185
|
+
*/
|
|
186
|
+
retired: Promise<OrgRetireReason>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The request stream a client-streaming or duplex **handler**
|
|
190
|
+
* receives.
|
|
191
|
+
*
|
|
192
|
+
* Its `next()` has **no** error arm: this stream's termination is
|
|
193
|
+
* observed ONLY through {@link OrgRequestStream.retired}, and
|
|
194
|
+
* iteration ends at the `done` item. The F-S3.1-2 level is the same
|
|
195
|
+
* as {@link OrgResponseSink}'s — the retire supervisor may drop the
|
|
196
|
+
* handler future without a final poll, and the retirement observables
|
|
197
|
+
* (the `done` terminal item, the sink's typed closed refusal, and
|
|
198
|
+
* `retired`) are the only reliable cancellation record; a detached
|
|
199
|
+
* observer holding `retired` observes the signal.
|
|
200
|
+
*/
|
|
201
|
+
export interface OrgRequestStream {
|
|
202
|
+
next(): Promise<{
|
|
203
|
+
done: boolean;
|
|
204
|
+
value?: Uint8Array;
|
|
205
|
+
}>;
|
|
206
|
+
/** As {@link OrgResponseSink.retired} — one verdict, memoized. */
|
|
207
|
+
retired: Promise<OrgRetireReason>;
|
|
208
|
+
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* One serve registration.
|
|
212
|
+
*
|
|
213
|
+
* **`close()` is a retirement, not a graceful unregister (C9's
|
|
214
|
+
* protected split).** Closing an org serve handle retires its live
|
|
215
|
+
* protected calls — each with its exact retirement terminal, the
|
|
216
|
+
* deadline/cancel/revocation vocabulary — and refuses new openings on
|
|
217
|
+
* that service. This is deliberately NOT the public path's
|
|
218
|
+
* let-existing-calls-finish behavior.
|
|
219
|
+
*/
|
|
220
|
+
export interface OrgServeHandle {
|
|
221
|
+
readonly service: string;
|
|
222
|
+
close(): void;
|
|
223
|
+
}
|
|
224
|
+
/** The unary org handler: one request in, one reply out. */
|
|
225
|
+
export type OrgUnaryHandler = (caller: OrgCaller, request: Uint8Array) => Promise<Uint8Array>;
|
|
226
|
+
/** The server-streaming org handler: one request in, items out. */
|
|
227
|
+
export type OrgStreamingHandler = (caller: OrgCaller, request: Uint8Array, sink: OrgResponseSink) => Promise<void>;
|
|
228
|
+
/** The client-streaming org handler: requests in, one reply out. */
|
|
229
|
+
export type OrgClientStreamHandler = (caller: OrgCaller, requests: OrgRequestStream) => Promise<Uint8Array>;
|
|
230
|
+
/** The duplex org handler: requests in, items out, independently. */
|
|
231
|
+
export type OrgDuplexHandler = (caller: OrgCaller, requests: OrgRequestStream, sink: OrgResponseSink) => Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* A live caller-side org handle its owner may have to retire — the
|
|
234
|
+
* registration {@link OrgHandleRegistry} keeps.
|
|
235
|
+
*/
|
|
236
|
+
export interface OrgCallHandle {
|
|
237
|
+
/**
|
|
238
|
+
* Retire it now: at most one CANCEL leaves, and every parked
|
|
239
|
+
* consumer settles with `error` as its typed terminal.
|
|
240
|
+
*/
|
|
241
|
+
retire(error: OrgStreamError): void;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The live org handles one node or session handed out, so its
|
|
245
|
+
* teardown can retire them: node close retires ownership — pending
|
|
246
|
+
* calls fail typed, one CANCEL per dropped caller handle.
|
|
247
|
+
*/
|
|
248
|
+
export declare class OrgHandleRegistry {
|
|
249
|
+
private readonly live;
|
|
250
|
+
add(handle: OrgCallHandle): void;
|
|
251
|
+
delete(handle: OrgCallHandle): void;
|
|
252
|
+
/**
|
|
253
|
+
* Retire every live handle with one typed terminal. Drains first,
|
|
254
|
+
* so a handle's own teardown cannot re-enter this loop. Every
|
|
255
|
+
* handle is attempted; the raw failures come back rather than being
|
|
256
|
+
* swallowed, for the owner's teardown ledger.
|
|
257
|
+
*/
|
|
258
|
+
retireAll(error: OrgStreamError): unknown[];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The response half of an org call, wrapped: terminal items become
|
|
262
|
+
* the §4.3 typed errors, and the async iterator throws them.
|
|
263
|
+
*/
|
|
264
|
+
export declare class OrgStream implements OrgByteStream, OrgCallHandle {
|
|
265
|
+
private readonly inner;
|
|
266
|
+
private readonly onCancel;
|
|
267
|
+
private readonly onDone?;
|
|
268
|
+
private terminal;
|
|
269
|
+
/** A boundary rejection, latched so a second pull sees the same typed failure. */
|
|
270
|
+
private failure;
|
|
271
|
+
private handleDropped;
|
|
272
|
+
private readonly waiters;
|
|
273
|
+
/**
|
|
274
|
+
* @param `onCancel` drops the underlying handle — at most once, so
|
|
275
|
+
* one CANCEL leaves however many halves initiate the drop.
|
|
276
|
+
*/
|
|
277
|
+
constructor(inner: LeafWasmOrgByteStreamHandle, onCancel: () => void, onDone?: (() => void) | undefined);
|
|
278
|
+
next(): Promise<ByteItemOut>;
|
|
279
|
+
cancel(): void;
|
|
280
|
+
/**
|
|
281
|
+
* Retire this stream: one CANCEL at most, every parked and future
|
|
282
|
+
* `next()` settled with `error` as the terminal item.
|
|
283
|
+
*/
|
|
284
|
+
retire(error: OrgStreamError): void;
|
|
285
|
+
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>;
|
|
286
|
+
private complete;
|
|
287
|
+
private fail;
|
|
288
|
+
private dropHandle;
|
|
289
|
+
}
|
|
290
|
+
/** A client-streaming upload, wrapped. */
|
|
291
|
+
export declare class OrgUpload implements OrgUploadCall, OrgCallHandle {
|
|
292
|
+
private readonly inner;
|
|
293
|
+
private readonly onDone?;
|
|
294
|
+
private failure;
|
|
295
|
+
private handleDropped;
|
|
296
|
+
private readonly waiters;
|
|
297
|
+
constructor(inner: LeafWasmOrgUploadCallHandle, onDone?: (() => void) | undefined);
|
|
298
|
+
send(payload: Uint8Array): Promise<void>;
|
|
299
|
+
finish(): Promise<Uint8Array>;
|
|
300
|
+
cancel(): void;
|
|
301
|
+
/** Retire this upload: one CANCEL at most; parked `finish()` rejects typed. */
|
|
302
|
+
retire(error: OrgStreamError): void;
|
|
303
|
+
}
|
|
304
|
+
/** A duplex call, wrapped: one call-level CANCEL however both halves end. */
|
|
305
|
+
export declare class OrgDuplex implements OrgDuplexHandles, OrgCallHandle {
|
|
306
|
+
private readonly inner;
|
|
307
|
+
private readonly onDone?;
|
|
308
|
+
/** The two halves share one drop, so one CANCEL leaves per call. */
|
|
309
|
+
private handleDropped;
|
|
310
|
+
private failure;
|
|
311
|
+
readonly sink: OrgDuplexSink;
|
|
312
|
+
readonly stream: OrgStream;
|
|
313
|
+
constructor(inner: LeafWasmOrgDuplexCallHandle, onDone?: (() => void) | undefined);
|
|
314
|
+
/** Retire the whole call: one CANCEL, both halves settled typed. */
|
|
315
|
+
retire(error: OrgStreamError): void;
|
|
316
|
+
private dropHandle;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The response sink a handler receives, wrapped. `retired` is
|
|
320
|
+
* memoized at construction — the boundary's `retired()` is called
|
|
321
|
+
* exactly once and the one signal is what a detached observer holds.
|
|
322
|
+
*/
|
|
323
|
+
export declare class OrgSink implements OrgResponseSink {
|
|
324
|
+
private readonly inner;
|
|
325
|
+
readonly retired: Promise<OrgRetireReason>;
|
|
326
|
+
private verdict;
|
|
327
|
+
constructor(inner: LeafWasmOrgResponseSinkHandle);
|
|
328
|
+
send(payload: Uint8Array): Promise<void>;
|
|
329
|
+
/** Half-close the response direction: the call's normal ending. */
|
|
330
|
+
close(): Promise<void>;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The request stream a handler receives, wrapped. Its terminal is the
|
|
334
|
+
* `done` item; the abnormal record is `retired`, memoized once as
|
|
335
|
+
* {@link OrgResponseSink.retired} is.
|
|
336
|
+
*/
|
|
337
|
+
export declare class OrgRequests implements OrgRequestStream {
|
|
338
|
+
private readonly inner;
|
|
339
|
+
readonly retired: Promise<OrgRetireReason>;
|
|
340
|
+
private verdict;
|
|
341
|
+
private readonly waiters;
|
|
342
|
+
constructor(inner: LeafWasmOrgRequestStreamHandle);
|
|
343
|
+
next(): Promise<{
|
|
344
|
+
done: boolean;
|
|
345
|
+
value?: Uint8Array;
|
|
346
|
+
}>;
|
|
347
|
+
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>;
|
|
348
|
+
private settle;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* One serve registration, wrapped. `close()` is C9's protected-split
|
|
352
|
+
* retirement: it retires the registration's live protected calls with
|
|
353
|
+
* their exact terminals and refuses new openings on the service.
|
|
354
|
+
*/
|
|
355
|
+
export declare class OrgServe implements OrgServeHandle, OrgCallHandle {
|
|
356
|
+
private readonly inner;
|
|
357
|
+
private readonly onDone?;
|
|
358
|
+
private closed;
|
|
359
|
+
constructor(inner: LeafWasmOrgServeHandle, onDone?: (() => void) | undefined);
|
|
360
|
+
get service(): string;
|
|
361
|
+
/**
|
|
362
|
+
* **A retirement, not a graceful unregister (C9's protected
|
|
363
|
+
* split).** Every live protected call this registration admitted is
|
|
364
|
+
* retired with its exact retirement terminal — the
|
|
365
|
+
* deadline/cancel/revocation vocabulary — and new openings on the
|
|
366
|
+
* service are refused. Deliberately NOT the public path's
|
|
367
|
+
* let-existing-calls-finish behavior.
|
|
368
|
+
*/
|
|
369
|
+
close(): void;
|
|
370
|
+
/** The registry's teardown verb: for a registration it is `close()`. */
|
|
371
|
+
retire(_error: OrgStreamError): void;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Build exactly the options object `call_org*` reads.
|
|
375
|
+
*
|
|
376
|
+
* A fresh object, so a caller mutating its own afterwards cannot
|
|
377
|
+
* change a call already in flight. The byte fields are forwarded as
|
|
378
|
+
* the `Uint8Array`s they must be — the leaf refuses anything else
|
|
379
|
+
* loudly, and a silent re-encode here would be a second codec.
|
|
380
|
+
*/
|
|
381
|
+
export declare function toWasmOrgCallOptions(options: OrgCallOptions): LeafWasmOrgCallOptions;
|
|
382
|
+
/** Build exactly the options object `serve_org*` reads. */
|
|
383
|
+
export declare function toWasmOrgServeOptions(options: OrgServeOptions): LeafWasmOrgServeOptions;
|
|
384
|
+
/**
|
|
385
|
+
* Read one handler invocation's caller attribution.
|
|
386
|
+
*
|
|
387
|
+
* The boundary hands the crate's `to_json` JSON **string** (the same
|
|
388
|
+
* convention `on_event` uses), camelCase keys verbatim
|
|
389
|
+
* {@link OrgCaller}'s; anything that does not parse to an object is
|
|
390
|
+
* refused rather than served with an attribution this build cannot
|
|
391
|
+
* vouch for.
|
|
392
|
+
*/
|
|
393
|
+
export declare function parseOrgCaller(raw: LeafWasmOrgCaller): OrgCaller;
|
|
394
|
+
/** Adapt a unary handler to the boundary's `(caller, request)` trampoline. */
|
|
395
|
+
export declare function unaryOrgTrampoline(handler: OrgUnaryHandler): LeafWasmOrgUnaryHandler;
|
|
396
|
+
/**
|
|
397
|
+
* Adapt a streaming handler to `(caller, request, sink)`. The sink is
|
|
398
|
+
* wrapped once per invocation; its `retired` is the one signal the
|
|
399
|
+
* F-S3.1-2 level names.
|
|
400
|
+
*/
|
|
401
|
+
export declare function streamingOrgTrampoline(handler: OrgStreamingHandler): LeafWasmOrgStreamingHandler;
|
|
402
|
+
/** Adapt a client-streaming handler to `(caller, requests)`. */
|
|
403
|
+
export declare function clientStreamOrgTrampoline(handler: OrgClientStreamHandler): LeafWasmOrgClientStreamHandler;
|
|
404
|
+
/** Adapt a duplex handler to `(caller, requests, sink)`. */
|
|
405
|
+
export declare function duplexOrgTrampoline(handler: OrgDuplexHandler): LeafWasmOrgDuplexHandler;
|
|
406
|
+
/** One `OrgByteStream.next()` outcome — the contract's inline shape. */
|
|
407
|
+
type ByteItemOut = {
|
|
408
|
+
done: boolean;
|
|
409
|
+
value?: Uint8Array;
|
|
410
|
+
error?: OrgStreamError;
|
|
411
|
+
};
|
|
412
|
+
export {};
|