@stryke/capnp 0.12.95 → 0.12.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/bin/capnpc.cjs +418 -316
  2. package/bin/capnpc.d.cts +909 -4
  3. package/bin/capnpc.d.cts.map +1 -1
  4. package/bin/capnpc.d.mts +909 -4
  5. package/bin/capnpc.d.mts.map +1 -1
  6. package/bin/capnpc.mjs +381 -280
  7. package/bin/capnpc.mjs.map +1 -1
  8. package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts +2991 -0
  9. package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts.map +1 -0
  10. package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts +2991 -0
  11. package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts.map +1 -0
  12. package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs → capnp-es.GpvEvMIK-CH8kq1KS.mjs} +13 -6
  13. package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs.map → capnp-es.GpvEvMIK-CH8kq1KS.mjs.map} +1 -1
  14. package/dist/{capnp-es.GpvEvMIK-BcYm5JyH.cjs → capnp-es.GpvEvMIK-CZ5ZimCD.cjs} +12 -5
  15. package/dist/{compile-ySRLGi2G.mjs → compile-D_BOc0dD.mjs} +109 -15
  16. package/dist/compile-D_BOc0dD.mjs.map +1 -0
  17. package/dist/{compile-DgmKft8T.cjs → compile-Yq1zhccM.cjs} +113 -19
  18. package/dist/compile.cjs +2 -2
  19. package/dist/compile.d.cts +38 -3
  20. package/dist/compile.d.cts.map +1 -0
  21. package/dist/compile.d.mts +38 -3
  22. package/dist/compile.d.mts.map +1 -0
  23. package/dist/compile.mjs +1 -2
  24. package/dist/{dist-BlvFBzSi.mjs → dist-DQ7xmzRT.mjs} +385 -16
  25. package/dist/dist-DQ7xmzRT.mjs.map +1 -0
  26. package/dist/{dist-YywzZL3Q.cjs → dist-VMGxvENY.cjs} +381 -12
  27. package/dist/{helpers-B1zJTrkG.mjs → helpers-2TldkyGG.mjs} +149 -149
  28. package/dist/helpers-2TldkyGG.mjs.map +1 -0
  29. package/dist/{helpers-B7aznH9v.cjs → helpers-Dn4nWOb7.cjs} +177 -177
  30. package/dist/helpers.cjs +2 -1
  31. package/dist/helpers.d.cts +1 -2
  32. package/dist/helpers.d.cts.map +1 -1
  33. package/dist/helpers.d.mts +1 -2
  34. package/dist/helpers.d.mts.map +1 -1
  35. package/dist/helpers.mjs +1 -1
  36. package/dist/index-63Za7yNc.d.cts +736 -0
  37. package/dist/index-63Za7yNc.d.cts.map +1 -0
  38. package/dist/index-LYXu6eWz.d.mts +736 -0
  39. package/dist/index-LYXu6eWz.d.mts.map +1 -0
  40. package/dist/index.cjs +5 -5
  41. package/dist/index.d.cts +5 -4
  42. package/dist/index.d.mts +5 -4
  43. package/dist/index.mjs +4 -5
  44. package/dist/rpc-helpers.cjs +4 -3
  45. package/dist/rpc-helpers.d.cts +3 -4
  46. package/dist/rpc-helpers.d.cts.map +1 -1
  47. package/dist/rpc-helpers.d.mts +3 -4
  48. package/dist/rpc-helpers.d.mts.map +1 -1
  49. package/dist/rpc-helpers.mjs +2 -2
  50. package/dist/types-BjCOVfgj.d.cts +1506 -0
  51. package/dist/types-BjCOVfgj.d.cts.map +1 -0
  52. package/dist/types-CVzMn-TI.d.mts +1506 -0
  53. package/dist/types-CVzMn-TI.d.mts.map +1 -0
  54. package/dist/types.cjs +8 -2
  55. package/dist/types.d.cts +1 -1
  56. package/dist/types.d.mts +1 -1
  57. package/dist/types.mjs +7 -2
  58. package/dist/types.mjs.map +1 -0
  59. package/package.json +8 -8
  60. package/schemas/cpp.cjs +1 -0
  61. package/schemas/cpp.d.cts.map +1 -1
  62. package/schemas/cpp.d.mts.map +1 -1
  63. package/schemas/index-BB47pUzp.d.cts +742 -0
  64. package/schemas/index-BB47pUzp.d.cts.map +1 -0
  65. package/schemas/index-DprjZUdT.d.mts +742 -0
  66. package/schemas/index-DprjZUdT.d.mts.map +1 -0
  67. package/schemas/persistent.cjs +2 -1
  68. package/schemas/persistent.d.cts +48 -21
  69. package/schemas/persistent.d.cts.map +1 -1
  70. package/schemas/persistent.d.mts +48 -21
  71. package/schemas/persistent.d.mts.map +1 -1
  72. package/schemas/persistent.mjs +1 -1
  73. package/schemas/persistent.mjs.map +1 -1
  74. package/schemas/rpc-twoparty.cjs +20 -1
  75. package/schemas/rpc-twoparty.d.cts +17 -17
  76. package/schemas/rpc-twoparty.d.cts.map +1 -1
  77. package/schemas/rpc-twoparty.d.mts +17 -17
  78. package/schemas/rpc-twoparty.d.mts.map +1 -1
  79. package/schemas/rpc-twoparty.mjs +19 -1
  80. package/schemas/rpc-twoparty.mjs.map +1 -1
  81. package/schemas/rpc.cjs +371 -1
  82. package/schemas/rpc.d.cts +141 -141
  83. package/schemas/rpc.d.cts.map +1 -1
  84. package/schemas/rpc.d.mts +141 -141
  85. package/schemas/rpc.d.mts.map +1 -1
  86. package/schemas/rpc.mjs +370 -1
  87. package/schemas/rpc.mjs.map +1 -1
  88. package/schemas/schema.cjs +96 -1
  89. package/schemas/schema.d.cts +286 -228
  90. package/schemas/schema.d.cts.map +1 -1
  91. package/schemas/schema.d.mts +286 -228
  92. package/schemas/schema.d.mts.map +1 -1
  93. package/schemas/schema.mjs +95 -1
  94. package/schemas/schema.mjs.map +1 -1
  95. package/schemas/{src-2eLj6yCr.cjs → src-B6FhDNiV.cjs} +19 -12
  96. package/schemas/{src-s2pCu2mc.mjs → src-B97sIXSw.mjs} +19 -13
  97. package/schemas/src-B97sIXSw.mjs.map +1 -0
  98. package/schemas/ts.cjs +1 -0
  99. package/schemas/ts.d.cts.map +1 -1
  100. package/schemas/ts.d.mts.map +1 -1
  101. package/dist/compile-DccxA7WZ.d.cts +0 -40
  102. package/dist/compile-DccxA7WZ.d.cts.map +0 -1
  103. package/dist/compile-UkKIpqrK.d.mts +0 -40
  104. package/dist/compile-UkKIpqrK.d.mts.map +0 -1
  105. package/dist/compile-ySRLGi2G.mjs.map +0 -1
  106. package/dist/dist-BlvFBzSi.mjs.map +0 -1
  107. package/dist/helpers-B1zJTrkG.mjs.map +0 -1
  108. package/dist/types-Cuj2daUE.mjs +0 -8
  109. package/dist/types-Cuj2daUE.mjs.map +0 -1
  110. package/dist/types-D03SjfBL.d.mts +0 -55
  111. package/dist/types-D03SjfBL.d.mts.map +0 -1
  112. package/dist/types-D52qMMoK.d.cts +0 -55
  113. package/dist/types-D52qMMoK.d.cts.map +0 -1
  114. package/dist/types-DHrjS-69.cjs +0 -13
  115. package/schemas/index-BAJMwFip.d.mts +0 -96
  116. package/schemas/index-BAJMwFip.d.mts.map +0 -1
  117. package/schemas/index-b7dam4EA.d.cts +0 -96
  118. package/schemas/index-b7dam4EA.d.cts.map +0 -1
  119. package/schemas/src-s2pCu2mc.mjs.map +0 -1
@@ -0,0 +1,742 @@
1
+ //#region ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@6.0.3/node_modules/capnp-es/dist/shared/capnp-es.Dd0AvjKJ.d.mts
2
+ declare enum ListElementSize {
3
+ VOID = 0,
4
+ BIT = 1,
5
+ BYTE = 2,
6
+ BYTE_2 = 3,
7
+ BYTE_4 = 4,
8
+ BYTE_8 = 5,
9
+ POINTER = 6,
10
+ COMPOSITE = 7
11
+ }
12
+ /**
13
+ * A simple object that describes the size of a struct.
14
+ */
15
+ declare class ObjectSize {
16
+ readonly dataByteLength: number;
17
+ readonly pointerLength: number;
18
+ /**
19
+ * Creates a new ObjectSize instance.
20
+ *
21
+ * @param dataByteLength - The number of bytes in the data section of the struct
22
+ * @param pointerLength - The number of pointers in the pointer section of the struct
23
+ */
24
+ constructor(dataByteLength: number, pointerLength: number);
25
+ toString(): string;
26
+ }
27
+ interface _PointerCtor {
28
+ readonly displayName: string;
29
+ }
30
+ declare enum PointerType {
31
+ STRUCT = 0,
32
+ LIST = 1,
33
+ FAR = 2,
34
+ OTHER = 3
35
+ }
36
+ interface _Pointer {
37
+ compositeIndex?: number;
38
+ compositeList: boolean;
39
+ /**
40
+ * A number that is decremented as nested pointers are traversed. When this hits zero errors will be thrown.
41
+ */
42
+ depthLimit: number;
43
+ }
44
+ /**
45
+ * A pointer referencing a single byte location in a segment. This is typically used for Cap'n Proto pointers, but is
46
+ * also sometimes used to reference an offset to a pointer's content or tag words.
47
+ */
48
+ declare class Pointer<T extends _Pointer = _Pointer> {
49
+ static readonly _capnp: _PointerCtor;
50
+ readonly _capnp: T;
51
+ /** Offset, in bytes, from the start of the segment to the beginning of this pointer. */
52
+ byteOffset: number;
53
+ /**
54
+ * The starting segment for this pointer's data. In the case of a far pointer, the actual content this pointer is
55
+ * referencing will be in another segment within the same message.
56
+ */
57
+ segment: Segment;
58
+ constructor(segment: Segment, byteOffset: number, depthLimit?: number);
59
+ [Symbol.toStringTag](): string;
60
+ toString(): string;
61
+ }
62
+ interface _ListCtor {
63
+ readonly compositeSize?: ObjectSize;
64
+ readonly displayName: string;
65
+ readonly size: ListElementSize;
66
+ }
67
+ interface ListCtor<T> {
68
+ readonly _capnp: _ListCtor;
69
+ new (segment: Segment, byteOffset: number, depthLimit?: number): List<T>;
70
+ }
71
+ type ArrayCb<T, RT = boolean> = (this: any, value: T, index: number, array: T[]) => RT;
72
+ /**
73
+ * A generic list class. Implements Filterable,
74
+ */
75
+ declare class List<T> extends Pointer implements Array<T> {
76
+ #private;
77
+ static readonly _capnp: _ListCtor;
78
+ [n: number]: T;
79
+ constructor(segment: Segment, byteOffset: number, depthLimit?: number);
80
+ get length(): number;
81
+ toArray(): T[];
82
+ get(_index: number): T;
83
+ set(_index: number, _value: T): void;
84
+ at(index: number): T;
85
+ concat(other: T[]): T[];
86
+ some(cb: ArrayCb<T>, _this?: any): boolean;
87
+ filter(cb: ArrayCb<T>, _this?: any): T[];
88
+ find(cb: ArrayCb<T>, _this?: any): T | undefined;
89
+ findIndex(cb: (v: T, i: number, arr: T[]) => boolean, _this?: any): number;
90
+ forEach(cb: ArrayCb<T, void>, _this?: any): void;
91
+ map<U>(cb: ArrayCb<T, U>, _this?: any): U[];
92
+ flatMap<U>(cb: ArrayCb<T, U | U[]>, _this?: any): U[];
93
+ every<S extends T>(cb: (v: T, i: number) => v is S, t?: any): this is S[];
94
+ reduce(cb: (p: T, c: T, i: number, a: T[]) => T, initialValue?: T): T;
95
+ reduceRight(cb: (p: T, c: T, i: number, a: T[]) => T, initialValue?: T): T;
96
+ slice(start?: number, end?: number): T[];
97
+ join(separator?: string): string;
98
+ toReversed(): T[];
99
+ toSorted(compareFn?: ((a: T, b: T) => number) | undefined): T[];
100
+ toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
101
+ fill(value: T, start?: number, end?: number): this;
102
+ copyWithin(target: number, start: number, end?: number): this;
103
+ keys(): ArrayIterator<number>;
104
+ values(): ArrayIterator<T>;
105
+ entries(): ArrayIterator<[number, T]>;
106
+ flat<A, D extends number = 1>(this: A, depth?: D): FlatArray<A, D>[];
107
+ with(index: number, value: T): T[];
108
+ includes(_searchElement: T, _fromIndex?: number): boolean;
109
+ findLast(_cb: unknown, _thisArg?: unknown): T | undefined;
110
+ findLastIndex(_cb: (v: T, i: number, a: T[]) => unknown, _t?: any): number;
111
+ indexOf(_searchElement: T, _fromIndex?: number): number;
112
+ lastIndexOf(_searchElement: T, _fromIndex?: number): number;
113
+ pop(): T | undefined;
114
+ push(..._items: T[]): number;
115
+ reverse(): T[];
116
+ shift(): T | undefined;
117
+ unshift(..._items: T[]): number;
118
+ splice(_start: unknown, _deleteCount?: unknown, ..._rest: unknown[]): T[];
119
+ sort(_fn?: ((a: T, b: T) => number) | undefined): this;
120
+ get [Symbol.unscopables](): {
121
+ [x: number]: boolean | undefined;
122
+ length?: boolean | undefined;
123
+ toString?: boolean | undefined;
124
+ toLocaleString?: boolean | undefined;
125
+ pop?: boolean | undefined;
126
+ push?: boolean | undefined;
127
+ concat?: boolean | undefined;
128
+ join?: boolean | undefined;
129
+ reverse?: boolean | undefined;
130
+ shift?: boolean | undefined;
131
+ slice?: boolean | undefined;
132
+ sort?: boolean | undefined;
133
+ splice?: boolean | undefined;
134
+ unshift?: boolean | undefined;
135
+ indexOf?: boolean | undefined;
136
+ lastIndexOf?: boolean | undefined;
137
+ every?: boolean | undefined;
138
+ some?: boolean | undefined;
139
+ forEach?: boolean | undefined;
140
+ map?: boolean | undefined;
141
+ filter?: boolean | undefined;
142
+ reduce?: boolean | undefined;
143
+ reduceRight?: boolean | undefined;
144
+ find?: boolean | undefined;
145
+ findIndex?: boolean | undefined;
146
+ fill?: boolean | undefined;
147
+ copyWithin?: boolean | undefined;
148
+ entries?: boolean | undefined;
149
+ keys?: boolean | undefined;
150
+ values?: boolean | undefined;
151
+ includes?: boolean | undefined;
152
+ flatMap?: boolean | undefined;
153
+ flat?: boolean | undefined;
154
+ at?: boolean | undefined;
155
+ findLast?: boolean | undefined;
156
+ findLastIndex?: boolean | undefined;
157
+ toReversed?: boolean | undefined;
158
+ toSorted?: boolean | undefined;
159
+ toSpliced?: boolean | undefined;
160
+ with?: boolean | undefined;
161
+ [Symbol.iterator]?: boolean | undefined;
162
+ readonly [Symbol.unscopables]?: boolean | undefined;
163
+ };
164
+ [Symbol.iterator](): ArrayIterator<T>;
165
+ toJSON(): unknown;
166
+ toString(): string;
167
+ toLocaleString(_locales?: unknown, _options?: unknown): string;
168
+ [Symbol.toStringTag](): string;
169
+ static [Symbol.toStringTag](): string;
170
+ }
171
+ type CapabilityID = number;
172
+ interface Method<P extends Struct, R extends Struct> {
173
+ interfaceId: bigint;
174
+ methodId: number;
175
+ interfaceName?: string;
176
+ methodName?: string;
177
+ ParamsClass: StructCtor<P>;
178
+ ResultsClass: StructCtor<R>;
179
+ }
180
+ type Call<P extends Struct, R extends Struct> = FuncCall<P, R> | DataCall<P, R>;
181
+ interface BaseCall<P extends Struct, R extends Struct> {
182
+ method: Method<P, R>;
183
+ }
184
+ type FuncCall<P extends Struct, R extends Struct> = BaseCall<P, R> & {
185
+ paramsFunc?(params: P): void;
186
+ };
187
+ type DataCall<P extends Struct, R extends Struct> = BaseCall<P, R> & {
188
+ params: P;
189
+ };
190
+ interface PipelineOp {
191
+ field: number;
192
+ defaultValue?: Pointer;
193
+ }
194
+ declare class Deferred<T> {
195
+ static fromPromise<T>(p: Promise<T>): Deferred<T>;
196
+ promise: Promise<T>;
197
+ reject: (reason?: unknown) => void;
198
+ resolve: (value: T | PromiseLike<T>) => void;
199
+ constructor();
200
+ }
201
+ interface ecall {
202
+ call: Call<any, any>;
203
+ f: Fulfiller<any>;
204
+ }
205
+ interface pcall extends ecall {
206
+ transform: PipelineOp[];
207
+ }
208
+ type ecallSlot = ecall | null;
209
+ declare class Ecalls {
210
+ data: ecallSlot[];
211
+ constructor(data: ecallSlot[]);
212
+ static copyOf(data: ecallSlot[]): Ecalls;
213
+ len(): number;
214
+ clear(i: number): void;
215
+ copy(): Ecalls;
216
+ }
217
+ declare class Fulfiller<R extends Struct> implements Answer<R> {
218
+ resolved: boolean;
219
+ answer?: Answer<R>;
220
+ queue: pcall[];
221
+ queueCap: number;
222
+ deferred: Deferred<R>;
223
+ fulfill(s: R): void;
224
+ reject(err: Error): void;
225
+ peek(): Answer<R> | undefined;
226
+ struct(): Promise<R>;
227
+ pipelineCall<CallParams extends Struct, CallResults extends Struct>(transform: PipelineOp[], call: Call<CallParams, CallResults>): Answer<CallResults>;
228
+ pipelineClose(transform: PipelineOp[]): void;
229
+ emptyQueue(s: Struct): Record<number, Ecalls>;
230
+ }
231
+ interface Answer<R extends Struct> {
232
+ struct(): Promise<R>;
233
+ pipelineCall<CallParams extends Struct, CallResults extends Struct>(transform: PipelineOp[], call: Call<CallParams, CallResults>): Answer<CallResults>;
234
+ pipelineClose(transform: PipelineOp[]): void;
235
+ }
236
+ interface ServerMethod<P extends Struct, R extends Struct> extends Method<P, R> {
237
+ impl(params: P, results: R): Promise<void>;
238
+ }
239
+ interface ServerCall<P extends Struct, R extends Struct> extends DataCall<P, R> {
240
+ serverMethod: ServerMethod<P, R>;
241
+ answer: Fulfiller<R>;
242
+ }
243
+ declare class Server implements Client {
244
+ target: any;
245
+ methods: Array<ServerMethod<any, any>>;
246
+ constructor(target: any, methods: Array<ServerMethod<any, any>>);
247
+ startCall<P extends Struct, R extends Struct>(call: ServerCall<P, R>): void;
248
+ call<P extends Struct, R extends Struct>(call: Call<P, R>): Answer<R>;
249
+ close(): void;
250
+ }
251
+ declare class Interface extends Pointer {
252
+ static readonly _capnp: {
253
+ displayName: string;
254
+ };
255
+ static readonly getCapID: typeof getCapID;
256
+ static readonly getAsInterface: typeof getAsInterface;
257
+ static readonly isInterface: typeof isInterface;
258
+ static readonly getClient: typeof getClient;
259
+ constructor(segment: Segment, byteOffset: number, depthLimit?: number);
260
+ static fromPointer(p: Pointer): Interface | null;
261
+ getCapId(): CapabilityID;
262
+ getClient(): Client | null;
263
+ }
264
+ declare function getAsInterface(p: Pointer): Interface | null;
265
+ declare function isInterface(p: Pointer): boolean;
266
+ declare function getCapID(i: Interface): CapabilityID;
267
+ declare function getClient(i: Interface): Client | null;
268
+ interface _Orphan {
269
+ capId: number;
270
+ elementSize: ListElementSize;
271
+ length: number;
272
+ size: ObjectSize;
273
+ type: PointerType;
274
+ }
275
+ /**
276
+ * An orphaned pointer. This object itself is technically a pointer to the original pointer's content, which was left
277
+ * untouched in its original message. The original pointer data is encoded as attributes on the Orphan object, ready to
278
+ * be reconstructed once another pointer is ready to adopt it.
279
+ */
280
+ declare class Orphan<T extends Pointer> {
281
+ /** If this member is not present then the orphan has already been adopted, or something went very wrong. */
282
+ _capnp?: _Orphan;
283
+ byteOffset: number;
284
+ segment: Segment;
285
+ constructor(src: T);
286
+ /**
287
+ * Adopt (move) this orphan into the target pointer location. This will allocate far pointers in `dst` as needed.
288
+ *
289
+ * @param dst The destination pointer.
290
+ */
291
+ _moveTo(dst: T): void;
292
+ dispose(): void;
293
+ }
294
+ declare class Segment implements DataView {
295
+ readonly id: number;
296
+ readonly message: Message;
297
+ buffer: ArrayBuffer;
298
+ /** The number of bytes currently allocated in the segment. */
299
+ byteLength: number;
300
+ /**
301
+ * This value should always be zero. It's only here to satisfy the DataView interface.
302
+ *
303
+ * In the future the Segment implementation (or a child class) may allow accessing the buffer from a nonzero offset,
304
+ * but that adds a lot of extra arithmetic.
305
+ */
306
+ byteOffset: number;
307
+ readonly [Symbol.toStringTag]: "DataView";
308
+ private _dv;
309
+ constructor(id: number, message: Message, buffer: ArrayBuffer, byteLength?: number);
310
+ /**
311
+ * Attempt to allocate the requested number of bytes in this segment. If this segment is full this method will return
312
+ * a pointer to freshly allocated space in another segment from the same message.
313
+ *
314
+ * @param byteLength The number of bytes to allocate, will be rounded up to the nearest word.
315
+ * @returns A pointer to the newly allocated space.
316
+ */
317
+ allocate(byteLength: number): Pointer;
318
+ /**
319
+ * Quickly copy a word (8 bytes) from `srcSegment` into this one at the given offset.
320
+ *
321
+ * @param byteOffset The offset to write the word to.
322
+ * @param srcSegment The segment to copy the word from.
323
+ * @param srcByteOffset The offset from the start of `srcSegment` to copy from.
324
+ */
325
+ copyWord(byteOffset: number, srcSegment: Segment, srcByteOffset: number): void;
326
+ /**
327
+ * Quickly copy words from `srcSegment` into this one.
328
+ *
329
+ * @param byteOffset The offset to start copying into.
330
+ * @param srcSegment The segment to copy from.
331
+ * @param srcByteOffset The start offset to copy from.
332
+ * @param wordLength The number of words to copy.
333
+ */
334
+ copyWords(byteOffset: number, srcSegment: Segment, srcByteOffset: number, wordLength: number): void;
335
+ /**
336
+ * Quickly fill a number of words in the buffer with zeroes.
337
+ *
338
+ * @param byteOffset The first byte to set to zero.
339
+ * @param wordLength The number of words (not bytes!) to zero out.
340
+ */
341
+ fillZeroWords(byteOffset: number, wordLength: number): void;
342
+ getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
343
+ getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
344
+ /**
345
+ * Get the total number of bytes available in this segment (the size of its underlying buffer).
346
+ *
347
+ * @returns The total number of bytes this segment can hold.
348
+ */
349
+ getCapacity(): number;
350
+ /**
351
+ * Read a float32 value out of this segment.
352
+ *
353
+ * @param byteOffset The offset in bytes to the value.
354
+ * @returns The value.
355
+ */
356
+ getFloat32(byteOffset: number): number;
357
+ /**
358
+ * Read a float64 value out of this segment.
359
+ *
360
+ * @param byteOffset The offset in bytes to the value.
361
+ * @returns The value.
362
+ */
363
+ getFloat64(byteOffset: number): number;
364
+ /**
365
+ * Read an int16 value out of this segment.
366
+ *
367
+ * @param byteOffset The offset in bytes to the value.
368
+ * @returns The value.
369
+ */
370
+ getInt16(byteOffset: number): number;
371
+ /**
372
+ * Read an int32 value out of this segment.
373
+ *
374
+ * @param byteOffset The offset in bytes to the value.
375
+ * @returns The value.
376
+ */
377
+ getInt32(byteOffset: number): number;
378
+ /**
379
+ * Read an int64 value out of this segment.
380
+ *
381
+ * @param byteOffset The offset in bytes to the value.
382
+ * @returns The value.
383
+ */
384
+ getInt64(byteOffset: number): bigint;
385
+ /**
386
+ * Read an int8 value out of this segment.
387
+ *
388
+ * @param byteOffset The offset in bytes to the value.
389
+ * @returns The value.
390
+ */
391
+ getInt8(byteOffset: number): number;
392
+ /**
393
+ * Read a uint16 value out of this segment.
394
+ *
395
+ * @param byteOffset The offset in bytes to the value.
396
+ * @returns The value.
397
+ */
398
+ getUint16(byteOffset: number): number;
399
+ /**
400
+ * Read a uint32 value out of this segment.
401
+ *
402
+ * @param byteOffset The offset in bytes to the value.
403
+ * @returns The value.
404
+ */
405
+ getUint32(byteOffset: number): number;
406
+ /**
407
+ * Read a uint64 value (as a bigint) out of this segment.
408
+ * NOTE: this does not copy the memory region, so updates to the underlying buffer will affect the returned value!
409
+ *
410
+ * @param byteOffset The offset in bytes to the value.
411
+ * @returns The value.
412
+ */
413
+ getUint64(byteOffset: number): bigint;
414
+ /**
415
+ * Read a uint8 value out of this segment.
416
+ *
417
+ * @param byteOffset The offset in bytes to the value.
418
+ * @returns The value.
419
+ */
420
+ getUint8(byteOffset: number): number;
421
+ hasCapacity(byteLength: number): boolean;
422
+ /**
423
+ * Quickly check the word at the given offset to see if it is equal to zero.
424
+ *
425
+ * PERF_V8: Fastest way to do this is by reading the whole word as a `number` (float64) in the _native_ endian format
426
+ * and see if it's zero.
427
+ *
428
+ * Benchmark: http://jsben.ch/#/Pjooc
429
+ *
430
+ * @param byteOffset The offset to the word.
431
+ * @returns `true` if the word is zero.
432
+ */
433
+ isWordZero(byteOffset: number): boolean;
434
+ /**
435
+ * Swap out this segment's underlying buffer with a new one. It's assumed that the new buffer has the same content but
436
+ * more free space, otherwise all existing pointers to this segment will be hilariously broken.
437
+ *
438
+ * @param buffer The new buffer to use.
439
+ */
440
+ replaceBuffer(buffer: ArrayBuffer): void;
441
+ /**
442
+ * Read a float16 value from the specified offset.
443
+ *
444
+ * @param byteOffset The offset from the beginning of the buffer.
445
+ * @param littleEndian If true, read the value as little-endian, otherwise read it as big-endian.
446
+ * @returns The value read from the buffer.
447
+ */
448
+ getFloat16(byteOffset: number, littleEndian?: boolean | undefined): number;
449
+ /**
450
+ * Write an float16 value to the specified offset.
451
+ *
452
+ * @param byteOffset The offset from the beginning of the buffer.
453
+ * @param val The value to store.
454
+ */
455
+ setFloat16(byteOffset: number, val: number): void;
456
+ setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
457
+ /** WARNING: This function is not yet implemented. */
458
+ setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
459
+ /**
460
+ * Write a float32 value to the specified offset.
461
+ *
462
+ * @param byteOffset The offset from the beginning of the buffer.
463
+ * @param val The value to store.
464
+ */
465
+ setFloat32(byteOffset: number, val: number): void;
466
+ /**
467
+ * Write an float64 value to the specified offset.
468
+ *
469
+ * @param byteOffset The offset from the beginning of the buffer.
470
+ * @param val The value to store.
471
+ */
472
+ setFloat64(byteOffset: number, val: number): void;
473
+ /**
474
+ * Write an int16 value to the specified offset.
475
+ *
476
+ * @param byteOffset The offset from the beginning of the buffer.
477
+ * @param val The value to store.
478
+ */
479
+ setInt16(byteOffset: number, val: number): void;
480
+ /**
481
+ * Write an int32 value to the specified offset.
482
+ *
483
+ * @param byteOffset The offset from the beginning of the buffer.
484
+ * @param val The value to store.
485
+ */
486
+ setInt32(byteOffset: number, val: number): void;
487
+ /**
488
+ * Write an int8 value to the specified offset.
489
+ *
490
+ * @param byteOffset The offset from the beginning of the buffer.
491
+ * @param val The value to store.
492
+ */
493
+ setInt8(byteOffset: number, val: number): void;
494
+ /**
495
+ * Write an int64 value to the specified offset.
496
+ *
497
+ * @param byteOffset The offset from the beginning of the buffer.
498
+ * @param val The value to store.
499
+ */
500
+ setInt64(byteOffset: number, val: bigint): void;
501
+ /**
502
+ * Write a uint16 value to the specified offset.
503
+ *
504
+ * @param byteOffset The offset from the beginning of the buffer.
505
+ * @param val The value to store.
506
+ */
507
+ setUint16(byteOffset: number, val: number): void;
508
+ /**
509
+ * Write a uint32 value to the specified offset.
510
+ *
511
+ * @param byteOffset The offset from the beginning of the buffer.
512
+ * @param val The value to store.
513
+ */
514
+ setUint32(byteOffset: number, val: number): void;
515
+ /**
516
+ * Write a uint64 value to the specified offset.
517
+ *
518
+ * @param byteOffset The offset from the beginning of the buffer.
519
+ * @param val The value to store.
520
+ */
521
+ setUint64(byteOffset: number, val: bigint): void;
522
+ /**
523
+ * Write a uint8 (byte) value to the specified offset.
524
+ *
525
+ * @param byteOffset The offset from the beginning of the buffer.
526
+ * @param val The value to store.
527
+ */
528
+ setUint8(byteOffset: number, val: number): void;
529
+ /**
530
+ * Write a zero word (8 bytes) to the specified offset. This is slightly faster than calling `setUint64` or
531
+ * `setFloat64` with a zero value.
532
+ *
533
+ * Benchmark: http://jsben.ch/#/dUdPI
534
+ *
535
+ * @param byteOffset The offset of the word to set to zero.
536
+ */
537
+ setWordZero(byteOffset: number): void;
538
+ toString(): string;
539
+ }
540
+ interface _StructCtor extends _PointerCtor {
541
+ readonly id: string;
542
+ readonly size: ObjectSize;
543
+ }
544
+ interface StructCtor<T extends Struct> {
545
+ readonly _capnp: _StructCtor;
546
+ new (segment: Segment, byteOffset: number, depthLimit?: number, compositeIndex?: number): T;
547
+ }
548
+ interface _Struct extends _Pointer {
549
+ compositeIndex?: number;
550
+ }
551
+ declare class Struct extends Pointer<_Struct> {
552
+ static readonly _capnp: {
553
+ displayName: string;
554
+ };
555
+ /**
556
+ * Create a new pointer to a struct.
557
+ *
558
+ * @param segment The segment the pointer resides in.
559
+ * @param byteOffset The offset from the beginning of the segment to the beginning of the pointer data.
560
+ * @param depthLimit The nesting depth limit for this object.
561
+ * @param compositeIndex If set, then this pointer is actually a reference to a composite list
562
+ * (`this._getPointerTargetType() === PointerType.LIST`), and this number is used as the index of the struct within
563
+ * the list. It is not valid to call `initStruct()` on a composite struct – the struct contents are initialized when
564
+ * the list pointer is initialized.
565
+ */
566
+ constructor(segment: Segment, byteOffset: number, depthLimit?: number, compositeIndex?: number);
567
+ static [Symbol.toStringTag](): string;
568
+ [Symbol.toStringTag](): string;
569
+ }
570
+ interface Client {
571
+ call<P extends Struct, R extends Struct>(call: Call<P, R>): Answer<R>;
572
+ close(): void;
573
+ }
574
+ declare class ArenaAllocationResult {
575
+ /**
576
+ * The newly allocated buffer. This buffer might be a copy of an existing segment's buffer with free space appended.
577
+ */
578
+ readonly buffer: ArrayBuffer;
579
+ /**
580
+ * The id of the newly-allocated segment.
581
+ */
582
+ readonly id: number;
583
+ constructor(id: number, buffer: ArrayBuffer);
584
+ }
585
+ declare enum ArenaKind {
586
+ SINGLE_SEGMENT = 0,
587
+ MULTI_SEGMENT = 1
588
+ }
589
+ declare class MultiSegmentArena {
590
+ readonly buffers: ArrayBuffer[];
591
+ static readonly allocate: typeof allocate$1;
592
+ static readonly getBuffer: typeof getBuffer$1;
593
+ static readonly getNumSegments: typeof getNumSegments$1;
594
+ readonly kind = ArenaKind.MULTI_SEGMENT;
595
+ constructor(buffers?: ArrayBuffer[]);
596
+ toString(): string;
597
+ }
598
+ declare function allocate$1(minSize: number, m: MultiSegmentArena): ArenaAllocationResult;
599
+ declare function getBuffer$1(id: number, m: MultiSegmentArena): ArrayBuffer;
600
+ declare function getNumSegments$1(m: MultiSegmentArena): number;
601
+ declare class SingleSegmentArena {
602
+ static readonly allocate: typeof allocate;
603
+ static readonly getBuffer: typeof getBuffer;
604
+ static readonly getNumSegments: typeof getNumSegments;
605
+ buffer: ArrayBuffer;
606
+ readonly kind = ArenaKind.SINGLE_SEGMENT;
607
+ constructor(buffer?: ArrayBuffer);
608
+ toString(): string;
609
+ }
610
+ declare function allocate(minSize: number, segments: Segment[], s: SingleSegmentArena): ArenaAllocationResult;
611
+ declare function getBuffer(id: number, s: SingleSegmentArena): ArrayBuffer;
612
+ declare function getNumSegments(): number;
613
+ type AnyArena = MultiSegmentArena | SingleSegmentArena;
614
+ interface _Message {
615
+ readonly arena: AnyArena;
616
+ segments: Segment[];
617
+ traversalLimit: number;
618
+ capTable?: Array<Client | null>;
619
+ }
620
+ declare class Message {
621
+ static readonly allocateSegment: typeof allocateSegment;
622
+ static readonly dump: typeof dump;
623
+ static readonly getRoot: typeof getRoot;
624
+ static readonly getSegment: typeof getSegment;
625
+ static readonly initRoot: typeof initRoot;
626
+ static readonly readRawPointer: typeof readRawPointer;
627
+ static readonly toArrayBuffer: typeof toArrayBuffer;
628
+ static readonly toPackedArrayBuffer: typeof toPackedArrayBuffer;
629
+ readonly _capnp: _Message;
630
+ /**
631
+ * A Cap'n Proto message.
632
+ *
633
+ * SECURITY WARNING: In Node.js do not pass a Buffer's internal array buffer into this constructor. Pass the buffer
634
+ * directly and everything will be fine. If not, your message will potentially be initialized with random memory
635
+ * contents!
636
+ *
637
+ * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer
638
+ * to read from.
639
+ *
640
+ * @param src The source for the message.
641
+ * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the
642
+ * root pointer; it will expand as you go. This is a reasonable choice for most messages.
643
+ *
644
+ * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted
645
+ * as-is.
646
+ *
647
+ * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source
648
+ * buffer; beware of the potential performance cost!
649
+ *
650
+ * @param packed Whether or not the message is packed. If `true` (the default), the message will be
651
+ * unpacked.
652
+ *
653
+ * @param singleSegment If true, `src` will be treated as a message consisting of a single segment without
654
+ * a framing header.
655
+ *
656
+ */
657
+ constructor(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed?: boolean, singleSegment?: boolean);
658
+ allocateSegment(byteLength: number): Segment;
659
+ /**
660
+ * Copies the contents of this message into an identical message with its own ArrayBuffers.
661
+ *
662
+ * @returns A copy of this message.
663
+ */
664
+ copy(): Message;
665
+ /**
666
+ * Create a pretty-printed string dump of this message; incredibly useful for debugging.
667
+ *
668
+ * WARNING: Do not call this method on large messages!
669
+ *
670
+ * @returns A big steaming pile of pretty hex digits.
671
+ */
672
+ dump(): string;
673
+ /**
674
+ * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not
675
+ * overwrite existing data.
676
+ *
677
+ * @param RootStruct The struct type to use as the root.
678
+ * @returns A struct representing the root of the message.
679
+ */
680
+ getRoot<T extends Struct>(RootStruct: StructCtor<T>): T;
681
+ /**
682
+ * Get a segment by its id.
683
+ *
684
+ * This will lazily allocate the first segment if it doesn't already exist.
685
+ *
686
+ * @param id The segment id.
687
+ * @returns The requested segment.
688
+ */
689
+ getSegment(id: number): Segment;
690
+ /**
691
+ * Initialize a new message using the provided struct type as the root.
692
+ *
693
+ * @param RootStruct The struct type to use as the root.
694
+ * @returns An initialized struct pointing to the root of the message.
695
+ */
696
+ initRoot<T extends Struct>(RootStruct: StructCtor<T>): T;
697
+ /**
698
+ * Set the root of the message to a copy of the given pointer. Used internally
699
+ * to make copies of pointers for default values.
700
+ *
701
+ * @param src The source pointer to copy.
702
+ */
703
+ setRoot(src: Pointer): void;
704
+ /**
705
+ * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header
706
+ * containing information about the following segment data.
707
+ *
708
+ * @returns An ArrayBuffer with the contents of this message.
709
+ */
710
+ toArrayBuffer(): ArrayBuffer;
711
+ /**
712
+ * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to
713
+ * use if you're sending the message over a network link or other slow I/O interface where size matters.
714
+ *
715
+ * @returns A packed message.
716
+ */
717
+ toPackedArrayBuffer(): ArrayBuffer;
718
+ addCap(client: Client | null): number;
719
+ toString(): string;
720
+ }
721
+ declare function allocateSegment(byteLength: number, m: Message): Segment;
722
+ declare function dump(m: Message): string;
723
+ declare function getRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T;
724
+ declare function getSegment(id: number, m: Message): Segment;
725
+ declare function initRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T;
726
+ /**
727
+ * Read a pointer in raw form (a packed message with framing headers). Does not
728
+ * care or attempt to validate the input beyond parsing the message
729
+ * segments.
730
+ *
731
+ * This is typically used by the compiler to load default values, but can be
732
+ * useful to work with messages with an unknown schema.
733
+ *
734
+ * @param data The raw data to read.
735
+ * @returns A root pointer.
736
+ */
737
+ declare function readRawPointer(data: ArrayBuffer): Pointer;
738
+ declare function toArrayBuffer(m: Message): ArrayBuffer;
739
+ declare function toPackedArrayBuffer(m: Message): ArrayBuffer;
740
+ //#endregion
741
+ export { List as a, ObjectSize as c, Pointer as d, type Server as f, type Interface as i, Orphan as l, type StructCtor as m, type Call as n, type ListCtor as o, Struct as p, Client as r, Method as s, Answer as t, PipelineOp as u };
742
+ //# sourceMappingURL=index-BB47pUzp.d.cts.map