luigi12345 commited on
Commit
d5c1a65
1 Parent(s): abdb728

ab0fa6909bb69bf38143d8e1fc37198127dbd57e5bd53c9620b1407c3cd1610f

Browse files
Files changed (50) hide show
  1. workers1/auto3d/node_modules/capnp-ts/src/serialization/list-element-size.ts +25 -0
  2. workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.d.ts +16 -0
  3. workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.js +45 -0
  4. workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.js.map +1 -0
  5. workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.ts +48 -0
  6. workers1/auto3d/node_modules/capnp-ts/src/serialization/message.d.ts +158 -0
  7. workers1/auto3d/node_modules/capnp-ts/src/serialization/message.js +392 -0
  8. workers1/auto3d/node_modules/capnp-ts/src/serialization/message.js.map +1 -0
  9. workers1/auto3d/node_modules/capnp-ts/src/serialization/message.ts +507 -0
  10. workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.d.ts +21 -0
  11. workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.js +44 -0
  12. workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.js.map +1 -0
  13. workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.ts +56 -0
  14. workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.d.ts +78 -0
  15. workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.js +274 -0
  16. workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.js.map +1 -0
  17. workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.ts +372 -0
  18. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.d.ts +6 -0
  19. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js +10 -0
  20. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js.map +1 -0
  21. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.ts +9 -0
  22. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.d.ts +10 -0
  23. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.js +38 -0
  24. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.js.map +1 -0
  25. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts +41 -0
  26. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.d.ts +6 -0
  27. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.js +35 -0
  28. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.js.map +1 -0
  29. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.ts +35 -0
  30. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.d.ts +6 -0
  31. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.js +10 -0
  32. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.js.map +1 -0
  33. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.ts +9 -0
  34. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.d.ts +67 -0
  35. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.js +118 -0
  36. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.js.map +1 -0
  37. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.ts +158 -0
  38. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.d.ts +10 -0
  39. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.js +32 -0
  40. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.js.map +1 -0
  41. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.ts +35 -0
  42. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.d.ts +10 -0
  43. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.js +32 -0
  44. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.js.map +1 -0
  45. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.ts +35 -0
  46. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.d.ts +0 -0
  47. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.js +2 -0
  48. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.js.map +1 -0
  49. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.ts +0 -0
  50. workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/index.d.ts +30 -0
workers1/auto3d/node_modules/capnp-ts/src/serialization/list-element-size.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ export enum ListElementSize {
6
+ VOID = 0,
7
+ BIT = 1,
8
+ BYTE = 2,
9
+ BYTE_2 = 3,
10
+ BYTE_4 = 4,
11
+ BYTE_8 = 5,
12
+ POINTER = 6,
13
+ COMPOSITE = 7
14
+ }
15
+
16
+ export const ListElementOffset = [
17
+ 0, // void
18
+ 0.125, // bit
19
+ 1, // byte
20
+ 2, // two byte
21
+ 4, // four byte
22
+ 8, // eight byte
23
+ 8, // pointer
24
+ NaN // composite
25
+ ];
workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.d.ts ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { Int64, Uint64 } from "../types/index";
5
+ export declare const getFloat32Mask: (x: number) => DataView;
6
+ export declare const getFloat64Mask: (x: number) => DataView;
7
+ export declare const getInt16Mask: (x: number) => DataView;
8
+ export declare const getInt32Mask: (x: number) => DataView;
9
+ export declare const getInt8Mask: (x: number) => DataView;
10
+ export declare const getUint16Mask: (x: number) => DataView;
11
+ export declare const getUint32Mask: (x: number) => DataView;
12
+ export declare const getUint8Mask: (x: number) => DataView;
13
+ export declare function getBitMask(value: boolean, bitOffset: number): DataView;
14
+ export declare function getInt64Mask(x: Int64): DataView;
15
+ export declare function getUint64Mask(x: Uint64): DataView;
16
+ export declare function getVoidMask(): void;
workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getVoidMask = exports.getUint64Mask = exports.getInt64Mask = exports.getBitMask = exports.getUint8Mask = exports.getUint32Mask = exports.getUint16Mask = exports.getInt8Mask = exports.getInt32Mask = exports.getInt16Mask = exports.getFloat64Mask = exports.getFloat32Mask = void 0;
7
+ const errors_1 = require("../errors");
8
+ function _makePrimitiveMaskFn(byteLength, setter) {
9
+ return (x) => {
10
+ const dv = new DataView(new ArrayBuffer(byteLength));
11
+ setter.call(dv, 0, x, true);
12
+ return dv;
13
+ };
14
+ }
15
+ /* eslint-disable @typescript-eslint/unbound-method */
16
+ exports.getFloat32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setFloat32);
17
+ exports.getFloat64Mask = _makePrimitiveMaskFn(8, DataView.prototype.setFloat64);
18
+ exports.getInt16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setInt16);
19
+ exports.getInt32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setInt32);
20
+ exports.getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8);
21
+ exports.getUint16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setUint16);
22
+ exports.getUint32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setUint32);
23
+ exports.getUint8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setUint8);
24
+ /* eslint-enable */
25
+ function getBitMask(value, bitOffset) {
26
+ const dv = new DataView(new ArrayBuffer(1));
27
+ if (!value)
28
+ return dv;
29
+ dv.setUint8(0, 1 << bitOffset % 8);
30
+ return dv;
31
+ }
32
+ exports.getBitMask = getBitMask;
33
+ function getInt64Mask(x) {
34
+ return x.toDataView();
35
+ }
36
+ exports.getInt64Mask = getInt64Mask;
37
+ function getUint64Mask(x) {
38
+ return x.toDataView();
39
+ }
40
+ exports.getUint64Mask = getUint64Mask;
41
+ function getVoidMask() {
42
+ throw new Error(errors_1.INVARIANT_UNREACHABLE_CODE);
43
+ }
44
+ exports.getVoidMask = getVoidMask;
45
+ //# sourceMappingURL=mask.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/mask.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"mask.js","sourceRoot":"","sources":["mask.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAuD;AAKvD,SAAS,oBAAoB,CAAC,UAAkB,EAAE,MAAsB;IACtE,OAAO,CAAC,CAAS,EAAY,EAAE;QAC7B,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC;AAED,sDAAsD;AACzC,QAAA,cAAc,GAAG,oBAAoB,CAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACxE,QAAA,cAAc,GAAG,oBAAoB,CAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACxE,QAAA,YAAY,GAAG,oBAAoB,CAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AACpE,QAAA,YAAY,GAAG,oBAAoB,CAAC,CAAC,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 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import { INVARIANT_UNREACHABLE_CODE } from "../errors";
6
+ import { Int64, Uint64 } from "../types/index";
7
+
8
+ type DataViewSetter = (byteOffset: number, value: number, littleEndian?: boolean) => void;
9
+
10
+ function _makePrimitiveMaskFn(byteLength: number, setter: DataViewSetter): (x: number) => DataView {
11
+ return (x: number): DataView => {
12
+ const dv = new DataView(new ArrayBuffer(byteLength));
13
+ setter.call(dv, 0, x, true);
14
+ return dv;
15
+ };
16
+ }
17
+
18
+ /* eslint-disable @typescript-eslint/unbound-method */
19
+ export const getFloat32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setFloat32);
20
+ export const getFloat64Mask = _makePrimitiveMaskFn(8, DataView.prototype.setFloat64);
21
+ export const getInt16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setInt16);
22
+ export const getInt32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setInt32);
23
+ export const getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8);
24
+ export const getUint16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setUint16);
25
+ export const getUint32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setUint32);
26
+ export const getUint8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setUint8);
27
+ /* eslint-enable */
28
+
29
+ export function getBitMask(value: boolean, bitOffset: number): DataView {
30
+ const dv = new DataView(new ArrayBuffer(1));
31
+
32
+ if (!value) return dv;
33
+
34
+ dv.setUint8(0, 1 << bitOffset % 8);
35
+ return dv;
36
+ }
37
+
38
+ export function getInt64Mask(x: Int64): DataView {
39
+ return x.toDataView();
40
+ }
41
+
42
+ export function getUint64Mask(x: Uint64): DataView {
43
+ return x.toDataView();
44
+ }
45
+
46
+ export function getVoidMask(): void {
47
+ throw new Error(INVARIANT_UNREACHABLE_CODE);
48
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/message.d.ts ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { AnyArena } from "./arena";
5
+ import { Pointer, StructCtor, Struct } from "./pointers";
6
+ import { Segment } from "./segment";
7
+ export interface _Message {
8
+ readonly arena: AnyArena;
9
+ segments: Segment[];
10
+ traversalLimit: number;
11
+ }
12
+ export declare class Message {
13
+ static readonly allocateSegment: typeof allocateSegment;
14
+ static readonly dump: typeof dump;
15
+ static readonly getRoot: typeof getRoot;
16
+ static readonly getSegment: typeof getSegment;
17
+ static readonly initRoot: typeof initRoot;
18
+ static readonly readRawPointer: typeof readRawPointer;
19
+ static readonly toArrayBuffer: typeof toArrayBuffer;
20
+ static readonly toPackedArrayBuffer: typeof toPackedArrayBuffer;
21
+ readonly _capnp: _Message;
22
+ /**
23
+ * A Cap'n Proto message.
24
+ *
25
+ * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer
26
+ * directly and everything will be fine. If not, your message will potentially be initialized with random memory
27
+ * contents!
28
+ *
29
+ * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer
30
+ * to read from.
31
+ *
32
+ * @constructor {Message}
33
+ *
34
+ * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message.
35
+ * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the
36
+ * root pointer; it will expand as you go. This is a reasonable choice for most messages.
37
+ *
38
+ * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted
39
+ * as-is.
40
+ *
41
+ * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source
42
+ * buffer; beware of the potential performance cost!
43
+ *
44
+ * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be
45
+ * unpacked.
46
+ *
47
+ * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without
48
+ * a framing header.
49
+ *
50
+ */
51
+ constructor(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed?: boolean, singleSegment?: boolean);
52
+ allocateSegment(byteLength: number): Segment;
53
+ /**
54
+ * Create a pretty-printed string dump of this message; incredibly useful for debugging.
55
+ *
56
+ * WARNING: Do not call this method on large messages!
57
+ *
58
+ * @returns {string} A big steaming pile of pretty hex digits.
59
+ */
60
+ dump(): string;
61
+ /**
62
+ * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not
63
+ * overwrite existing data.
64
+ *
65
+ * @template T
66
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
67
+ * @returns {T} A struct representing the root of the message.
68
+ */
69
+ getRoot<T extends Struct>(RootStruct: StructCtor<T>): T;
70
+ /**
71
+ * Get a segment by its id.
72
+ *
73
+ * This will lazily allocate the first segment if it doesn't already exist.
74
+ *
75
+ * @param {number} id The segment id.
76
+ * @returns {Segment} The requested segment.
77
+ */
78
+ getSegment(id: number): Segment;
79
+ /**
80
+ * Initialize a new message using the provided struct type as the root.
81
+ *
82
+ * @template T
83
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
84
+ * @returns {T} An initialized struct pointing to the root of the message.
85
+ */
86
+ initRoot<T extends Struct>(RootStruct: StructCtor<T>): T;
87
+ /**
88
+ * Set the root of the message to a copy of the given pointer. Used internally
89
+ * to make copies of pointers for default values.
90
+ *
91
+ * @param {Pointer} src The source pointer to copy.
92
+ * @returns {void}
93
+ */
94
+ setRoot(src: Pointer): void;
95
+ /**
96
+ * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header
97
+ * containing information about the following segment data.
98
+ *
99
+ * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message.
100
+ */
101
+ toArrayBuffer(): ArrayBuffer;
102
+ /**
103
+ * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to
104
+ * use if you're sending the message over a network link or other slow I/O interface where size matters.
105
+ *
106
+ * @returns {ArrayBuffer} A packed message.
107
+ */
108
+ toPackedArrayBuffer(): ArrayBuffer;
109
+ toString(): string;
110
+ }
111
+ export interface CreateMessageOptions {
112
+ packed?: boolean;
113
+ singleSegment?: boolean;
114
+ }
115
+ export declare function initMessage(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed?: boolean, singleSegment?: boolean): _Message;
116
+ /**
117
+ * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in
118
+ * the message.
119
+ *
120
+ * This method is not typically called directly, but can be useful in certain cases.
121
+ *
122
+ * @static
123
+ * @param {ArrayBuffer} message An unpacked message with a framing header.
124
+ * @returns {ArrayBuffer[]} An array of buffers containing the segment data.
125
+ */
126
+ export declare function getFramedSegments(message: ArrayBuffer): ArrayBuffer[];
127
+ /**
128
+ * This method is called on messages that were constructed with existing data to prepopulate the segments array with
129
+ * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer.
130
+ *
131
+ * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own
132
+ * may void your warranty.
133
+ *
134
+ * @param {Message} m The message to allocate.
135
+ * @returns {void}
136
+ */
137
+ export declare function preallocateSegments(m: Message): void;
138
+ export declare function allocateSegment(byteLength: number, m: Message): Segment;
139
+ export declare function dump(m: Message): string;
140
+ export declare function getRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T;
141
+ export declare function getSegment(id: number, m: Message): Segment;
142
+ export declare function initRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T;
143
+ /**
144
+ * Read a pointer in raw form (a packed message with framing headers). Does not
145
+ * care or attempt to validate the input beyond parsing the message
146
+ * segments.
147
+ *
148
+ * This is typically used by the compiler to load default values, but can be
149
+ * useful to work with messages with an unknown schema.
150
+ *
151
+ * @param {ArrayBuffer} data The raw data to read.
152
+ * @returns {Pointer} A root pointer.
153
+ */
154
+ export declare function readRawPointer(data: ArrayBuffer): Pointer;
155
+ export declare function setRoot(src: Pointer, m: Message): void;
156
+ export declare function toArrayBuffer(m: Message): ArrayBuffer;
157
+ export declare function toPackedArrayBuffer(m: Message): ArrayBuffer;
158
+ export declare function getStreamFrame(m: Message): ArrayBuffer;
workers1/auto3d/node_modules/capnp-ts/src/serialization/message.js ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getStreamFrame = exports.toPackedArrayBuffer = exports.toArrayBuffer = exports.setRoot = exports.readRawPointer = exports.initRoot = exports.getSegment = exports.getRoot = exports.dump = exports.allocateSegment = exports.preallocateSegments = exports.getFramedSegments = exports.initMessage = exports.Message = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const constants_1 = require("../constants");
10
+ const errors_1 = require("../errors");
11
+ const util_1 = require("../util");
12
+ const arena_1 = require("./arena");
13
+ const packing_1 = require("./packing");
14
+ const pointers_1 = require("./pointers");
15
+ const segment_1 = require("./segment");
16
+ const pointer_1 = require("./pointers/pointer");
17
+ const struct_1 = require("./pointers/struct");
18
+ const trace = debug_1.default("capnp:message");
19
+ trace("load");
20
+ class Message {
21
+ /**
22
+ * A Cap'n Proto message.
23
+ *
24
+ * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer
25
+ * directly and everything will be fine. If not, your message will potentially be initialized with random memory
26
+ * contents!
27
+ *
28
+ * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer
29
+ * to read from.
30
+ *
31
+ * @constructor {Message}
32
+ *
33
+ * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message.
34
+ * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the
35
+ * root pointer; it will expand as you go. This is a reasonable choice for most messages.
36
+ *
37
+ * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted
38
+ * as-is.
39
+ *
40
+ * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source
41
+ * buffer; beware of the potential performance cost!
42
+ *
43
+ * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be
44
+ * unpacked.
45
+ *
46
+ * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without
47
+ * a framing header.
48
+ *
49
+ */
50
+ constructor(src, packed = true, singleSegment = false) {
51
+ this._capnp = initMessage(src, packed, singleSegment);
52
+ if (src && !isAnyArena(src))
53
+ preallocateSegments(this);
54
+ trace("new %s", this);
55
+ }
56
+ allocateSegment(byteLength) {
57
+ return allocateSegment(byteLength, this);
58
+ }
59
+ /**
60
+ * Create a pretty-printed string dump of this message; incredibly useful for debugging.
61
+ *
62
+ * WARNING: Do not call this method on large messages!
63
+ *
64
+ * @returns {string} A big steaming pile of pretty hex digits.
65
+ */
66
+ dump() {
67
+ return dump(this);
68
+ }
69
+ /**
70
+ * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not
71
+ * overwrite existing data.
72
+ *
73
+ * @template T
74
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
75
+ * @returns {T} A struct representing the root of the message.
76
+ */
77
+ getRoot(RootStruct) {
78
+ return getRoot(RootStruct, this);
79
+ }
80
+ /**
81
+ * Get a segment by its id.
82
+ *
83
+ * This will lazily allocate the first segment if it doesn't already exist.
84
+ *
85
+ * @param {number} id The segment id.
86
+ * @returns {Segment} The requested segment.
87
+ */
88
+ getSegment(id) {
89
+ return getSegment(id, this);
90
+ }
91
+ /**
92
+ * Initialize a new message using the provided struct type as the root.
93
+ *
94
+ * @template T
95
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
96
+ * @returns {T} An initialized struct pointing to the root of the message.
97
+ */
98
+ initRoot(RootStruct) {
99
+ return initRoot(RootStruct, this);
100
+ }
101
+ /**
102
+ * Set the root of the message to a copy of the given pointer. Used internally
103
+ * to make copies of pointers for default values.
104
+ *
105
+ * @param {Pointer} src The source pointer to copy.
106
+ * @returns {void}
107
+ */
108
+ setRoot(src) {
109
+ setRoot(src, this);
110
+ }
111
+ /**
112
+ * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header
113
+ * containing information about the following segment data.
114
+ *
115
+ * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message.
116
+ */
117
+ toArrayBuffer() {
118
+ return toArrayBuffer(this);
119
+ }
120
+ /**
121
+ * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to
122
+ * use if you're sending the message over a network link or other slow I/O interface where size matters.
123
+ *
124
+ * @returns {ArrayBuffer} A packed message.
125
+ */
126
+ toPackedArrayBuffer() {
127
+ return toPackedArrayBuffer(this);
128
+ }
129
+ toString() {
130
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
131
+ return `Message_arena:${this._capnp.arena}`;
132
+ }
133
+ }
134
+ exports.Message = Message;
135
+ Message.allocateSegment = allocateSegment;
136
+ Message.dump = dump;
137
+ Message.getRoot = getRoot;
138
+ Message.getSegment = getSegment;
139
+ Message.initRoot = initRoot;
140
+ Message.readRawPointer = readRawPointer;
141
+ Message.toArrayBuffer = toArrayBuffer;
142
+ Message.toPackedArrayBuffer = toPackedArrayBuffer;
143
+ function initMessage(src, packed = true, singleSegment = false) {
144
+ if (src === undefined) {
145
+ return {
146
+ arena: new arena_1.SingleSegmentArena(),
147
+ segments: [],
148
+ traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT,
149
+ };
150
+ }
151
+ if (isAnyArena(src)) {
152
+ return { arena: src, segments: [], traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT };
153
+ }
154
+ let buf = src;
155
+ if (isArrayBufferView(buf)) {
156
+ buf = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
157
+ }
158
+ if (packed)
159
+ buf = packing_1.unpack(buf);
160
+ if (singleSegment) {
161
+ return {
162
+ arena: new arena_1.SingleSegmentArena(buf),
163
+ segments: [],
164
+ traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT,
165
+ };
166
+ }
167
+ return {
168
+ arena: new arena_1.MultiSegmentArena(getFramedSegments(buf)),
169
+ segments: [],
170
+ traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT,
171
+ };
172
+ }
173
+ exports.initMessage = initMessage;
174
+ /**
175
+ * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in
176
+ * the message.
177
+ *
178
+ * This method is not typically called directly, but can be useful in certain cases.
179
+ *
180
+ * @static
181
+ * @param {ArrayBuffer} message An unpacked message with a framing header.
182
+ * @returns {ArrayBuffer[]} An array of buffers containing the segment data.
183
+ */
184
+ function getFramedSegments(message) {
185
+ const dv = new DataView(message);
186
+ const segmentCount = dv.getUint32(0, true) + 1;
187
+ const segments = new Array(segmentCount);
188
+ trace("reading %d framed segments from stream", segmentCount);
189
+ let byteOffset = 4 + segmentCount * 4;
190
+ byteOffset += byteOffset % 8;
191
+ if (byteOffset + segmentCount * 4 > message.byteLength) {
192
+ throw new Error(errors_1.MSG_INVALID_FRAME_HEADER);
193
+ }
194
+ for (let i = 0; i < segmentCount; i++) {
195
+ const byteLength = dv.getUint32(4 + i * 4, true) * 8;
196
+ if (byteOffset + byteLength > message.byteLength) {
197
+ throw new Error(errors_1.MSG_INVALID_FRAME_HEADER);
198
+ }
199
+ segments[i] = message.slice(byteOffset, byteOffset + byteLength);
200
+ byteOffset += byteLength;
201
+ }
202
+ return segments;
203
+ }
204
+ exports.getFramedSegments = getFramedSegments;
205
+ /**
206
+ * This method is called on messages that were constructed with existing data to prepopulate the segments array with
207
+ * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer.
208
+ *
209
+ * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own
210
+ * may void your warranty.
211
+ *
212
+ * @param {Message} m The message to allocate.
213
+ * @returns {void}
214
+ */
215
+ function preallocateSegments(m) {
216
+ const numSegments = arena_1.Arena.getNumSegments(m._capnp.arena);
217
+ if (numSegments < 1)
218
+ throw new Error(errors_1.MSG_NO_SEGMENTS_IN_ARENA);
219
+ m._capnp.segments = new Array(numSegments);
220
+ for (let i = 0; i < numSegments; i++) {
221
+ // Set up each segment so that they're fully allocated to the extents of the existing buffers.
222
+ const buffer = arena_1.Arena.getBuffer(i, m._capnp.arena);
223
+ const segment = new segment_1.Segment(i, m, buffer, buffer.byteLength);
224
+ m._capnp.segments[i] = segment;
225
+ }
226
+ }
227
+ exports.preallocateSegments = preallocateSegments;
228
+ function isArrayBufferView(src) {
229
+ return src.byteOffset !== undefined;
230
+ }
231
+ function isAnyArena(o) {
232
+ return o.kind !== undefined;
233
+ }
234
+ function allocateSegment(byteLength, m) {
235
+ trace("allocating %x bytes for %s", byteLength, m);
236
+ const res = arena_1.Arena.allocate(byteLength, m._capnp.segments, m._capnp.arena);
237
+ let s;
238
+ if (res.id === m._capnp.segments.length) {
239
+ // Note how we're only allowing new segments in if they're exactly the next one in the array. There is no logical
240
+ // reason for segments to be created out of order.
241
+ s = new segment_1.Segment(res.id, m, res.buffer);
242
+ trace("adding new segment %s", s);
243
+ m._capnp.segments.push(s);
244
+ }
245
+ else if (res.id < 0 || res.id > m._capnp.segments.length) {
246
+ throw new Error(util_1.format(errors_1.MSG_SEGMENT_OUT_OF_BOUNDS, res.id, m));
247
+ }
248
+ else {
249
+ s = m._capnp.segments[res.id];
250
+ trace("replacing segment %s with buffer (len:%d)", s, res.buffer.byteLength);
251
+ s.replaceBuffer(res.buffer);
252
+ }
253
+ return s;
254
+ }
255
+ exports.allocateSegment = allocateSegment;
256
+ function dump(m) {
257
+ let r = "";
258
+ if (m._capnp.segments.length === 0) {
259
+ return "================\nNo Segments\n================\n";
260
+ }
261
+ for (let i = 0; i < m._capnp.segments.length; i++) {
262
+ r += `================\nSegment #${i}\n================\n`;
263
+ const { buffer, byteLength } = m._capnp.segments[i];
264
+ const b = new Uint8Array(buffer, 0, byteLength);
265
+ r += util_1.dumpBuffer(b);
266
+ }
267
+ return r;
268
+ }
269
+ exports.dump = dump;
270
+ function getRoot(RootStruct, m) {
271
+ const root = new RootStruct(m.getSegment(0), 0);
272
+ pointer_1.validate(pointers_1.PointerType.STRUCT, root);
273
+ const ts = pointer_1.getTargetStructSize(root);
274
+ // Make sure the underlying pointer is actually big enough to hold the data and pointers as specified in the schema.
275
+ // If not a shallow copy of the struct contents needs to be made before returning.
276
+ if (ts.dataByteLength < RootStruct._capnp.size.dataByteLength ||
277
+ ts.pointerLength < RootStruct._capnp.size.pointerLength) {
278
+ trace("need to resize root struct %s", root);
279
+ struct_1.resize(RootStruct._capnp.size, root);
280
+ }
281
+ return root;
282
+ }
283
+ exports.getRoot = getRoot;
284
+ function getSegment(id, m) {
285
+ const segmentLength = m._capnp.segments.length;
286
+ if (id === 0 && segmentLength === 0) {
287
+ // Segment zero is special. If we have no segments in the arena we'll want to allocate a new one and leave room
288
+ // for the root pointer.
289
+ const arenaSegments = arena_1.Arena.getNumSegments(m._capnp.arena);
290
+ if (arenaSegments === 0) {
291
+ allocateSegment(constants_1.DEFAULT_BUFFER_SIZE, m);
292
+ }
293
+ else {
294
+ // Okay, the arena already has a buffer we can use. This is totally fine.
295
+ m._capnp.segments[0] = new segment_1.Segment(0, m, arena_1.Arena.getBuffer(0, m._capnp.arena));
296
+ }
297
+ if (!m._capnp.segments[0].hasCapacity(8)) {
298
+ throw new Error(errors_1.MSG_SEGMENT_TOO_SMALL);
299
+ }
300
+ // This will leave room for the root pointer.
301
+ m._capnp.segments[0].allocate(8);
302
+ return m._capnp.segments[0];
303
+ }
304
+ if (id < 0 || id >= segmentLength) {
305
+ throw new Error(util_1.format(errors_1.MSG_SEGMENT_OUT_OF_BOUNDS, id, m));
306
+ }
307
+ return m._capnp.segments[id];
308
+ }
309
+ exports.getSegment = getSegment;
310
+ function initRoot(RootStruct, m) {
311
+ const root = new RootStruct(m.getSegment(0), 0);
312
+ struct_1.initStruct(RootStruct._capnp.size, root);
313
+ trace("Initialized root pointer %s for %s.", root, m);
314
+ return root;
315
+ }
316
+ exports.initRoot = initRoot;
317
+ /**
318
+ * Read a pointer in raw form (a packed message with framing headers). Does not
319
+ * care or attempt to validate the input beyond parsing the message
320
+ * segments.
321
+ *
322
+ * This is typically used by the compiler to load default values, but can be
323
+ * useful to work with messages with an unknown schema.
324
+ *
325
+ * @param {ArrayBuffer} data The raw data to read.
326
+ * @returns {Pointer} A root pointer.
327
+ */
328
+ function readRawPointer(data) {
329
+ return new pointers_1.Pointer(new Message(data).getSegment(0), 0);
330
+ }
331
+ exports.readRawPointer = readRawPointer;
332
+ function setRoot(src, m) {
333
+ pointers_1.Pointer.copyFrom(src, new pointers_1.Pointer(m.getSegment(0), 0));
334
+ }
335
+ exports.setRoot = setRoot;
336
+ function toArrayBuffer(m) {
337
+ const streamFrame = getStreamFrame(m);
338
+ // Make sure the first segment is allocated.
339
+ if (m._capnp.segments.length === 0)
340
+ getSegment(0, m);
341
+ const segments = m._capnp.segments;
342
+ // Add space for the stream framing.
343
+ const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + util_1.padToWord(s.byteLength), 0);
344
+ const out = new Uint8Array(new ArrayBuffer(totalLength));
345
+ let o = streamFrame.byteLength;
346
+ out.set(new Uint8Array(streamFrame));
347
+ segments.forEach((s) => {
348
+ const segmentLength = util_1.padToWord(s.byteLength);
349
+ out.set(new Uint8Array(s.buffer, 0, segmentLength), o);
350
+ o += segmentLength;
351
+ });
352
+ return out.buffer;
353
+ }
354
+ exports.toArrayBuffer = toArrayBuffer;
355
+ function toPackedArrayBuffer(m) {
356
+ const streamFrame = packing_1.pack(getStreamFrame(m));
357
+ // Make sure the first segment is allocated.
358
+ if (m._capnp.segments.length === 0)
359
+ m.getSegment(0);
360
+ // NOTE: A copy operation can be avoided here if we capture the intermediate array and use that directly in the copy
361
+ // loop below, rather than have `pack()` copy it to an ArrayBuffer just to have to copy it again later. If the
362
+ // intermediate array can be avoided altogether that's even better!
363
+ const segments = m._capnp.segments.map((s) => packing_1.pack(s.buffer, 0, util_1.padToWord(s.byteLength)));
364
+ const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + s.byteLength, 0);
365
+ const out = new Uint8Array(new ArrayBuffer(totalLength));
366
+ let o = streamFrame.byteLength;
367
+ out.set(new Uint8Array(streamFrame));
368
+ segments.forEach((s) => {
369
+ out.set(new Uint8Array(s), o);
370
+ o += s.byteLength;
371
+ });
372
+ return out.buffer;
373
+ }
374
+ exports.toPackedArrayBuffer = toPackedArrayBuffer;
375
+ function getStreamFrame(m) {
376
+ const length = m._capnp.segments.length;
377
+ if (length === 0) {
378
+ // Don't bother allocating the first segment, just return a single zero word for the frame header.
379
+ return new Float64Array(1).buffer;
380
+ }
381
+ const frameLength = 4 + length * 4 + (1 - (length % 2)) * 4;
382
+ const out = new DataView(new ArrayBuffer(frameLength));
383
+ trace("Writing message stream frame with segment count: %d.", length);
384
+ out.setUint32(0, length - 1, true);
385
+ m._capnp.segments.forEach((s, i) => {
386
+ trace("Message segment %d word count: %d.", s.id, s.byteLength / 8);
387
+ out.setUint32(i * 4 + 4, s.byteLength / 8, true);
388
+ });
389
+ return out.buffer;
390
+ }
391
+ exports.getStreamFrame = getStreamFrame;
392
+ //# sourceMappingURL=message.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/message.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["message.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAC9B,4CAA2E;AAC3E,sCAKmB;AACnB,kCAAwD;AACxD,mCAA4F;AAC5F,uCAAyC;AACzC,yCAAsE;AACtE,uCAAoC;AACpC,gDAAmE;AACnE,8CAAuD;AAEvD,MAAM,KAAK,GAAG,eAAS,CAAC,eAAe,CAAC,CAAC;AACzC,KAAK,CAAC,MAAM,CAAC,CAAC;AAQd,MAAa,OAAO;IAYlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,YAAY,GAA8C,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,GAAG,KAAK;QAC9F,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAEt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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+ import { DEFAULT_TRAVERSE_LIMIT, DEFAULT_BUFFER_SIZE } from "../constants";
7
+ import {
8
+ MSG_INVALID_FRAME_HEADER,
9
+ MSG_SEGMENT_OUT_OF_BOUNDS,
10
+ MSG_SEGMENT_TOO_SMALL,
11
+ MSG_NO_SEGMENTS_IN_ARENA,
12
+ } from "../errors";
13
+ import { dumpBuffer, format, padToWord } from "../util";
14
+ import { AnyArena, Arena, MultiSegmentArena, SingleSegmentArena, ArenaKind } from "./arena";
15
+ import { pack, unpack } from "./packing";
16
+ import { Pointer, StructCtor, PointerType, Struct } from "./pointers";
17
+ import { Segment } from "./segment";
18
+ import { getTargetStructSize, validate } from "./pointers/pointer";
19
+ import { resize, initStruct } from "./pointers/struct";
20
+
21
+ const trace = initTrace("capnp:message");
22
+ trace("load");
23
+
24
+ export interface _Message {
25
+ readonly arena: AnyArena;
26
+ segments: Segment[];
27
+ traversalLimit: number;
28
+ }
29
+
30
+ export class Message {
31
+ static readonly allocateSegment = allocateSegment;
32
+ static readonly dump = dump;
33
+ static readonly getRoot = getRoot;
34
+ static readonly getSegment = getSegment;
35
+ static readonly initRoot = initRoot;
36
+ static readonly readRawPointer = readRawPointer;
37
+ static readonly toArrayBuffer = toArrayBuffer;
38
+ static readonly toPackedArrayBuffer = toPackedArrayBuffer;
39
+
40
+ readonly _capnp: _Message;
41
+
42
+ /**
43
+ * A Cap'n Proto message.
44
+ *
45
+ * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer
46
+ * directly and everything will be fine. If not, your message will potentially be initialized with random memory
47
+ * contents!
48
+ *
49
+ * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer
50
+ * to read from.
51
+ *
52
+ * @constructor {Message}
53
+ *
54
+ * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message.
55
+ * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the
56
+ * root pointer; it will expand as you go. This is a reasonable choice for most messages.
57
+ *
58
+ * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted
59
+ * as-is.
60
+ *
61
+ * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source
62
+ * buffer; beware of the potential performance cost!
63
+ *
64
+ * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be
65
+ * unpacked.
66
+ *
67
+ * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without
68
+ * a framing header.
69
+ *
70
+ */
71
+ constructor(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed = true, singleSegment = false) {
72
+ this._capnp = initMessage(src, packed, singleSegment);
73
+
74
+ if (src && !isAnyArena(src)) preallocateSegments(this);
75
+
76
+ trace("new %s", this);
77
+ }
78
+
79
+ allocateSegment(byteLength: number): Segment {
80
+ return allocateSegment(byteLength, this);
81
+ }
82
+
83
+ /**
84
+ * Create a pretty-printed string dump of this message; incredibly useful for debugging.
85
+ *
86
+ * WARNING: Do not call this method on large messages!
87
+ *
88
+ * @returns {string} A big steaming pile of pretty hex digits.
89
+ */
90
+
91
+ dump(): string {
92
+ return dump(this);
93
+ }
94
+
95
+ /**
96
+ * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not
97
+ * overwrite existing data.
98
+ *
99
+ * @template T
100
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
101
+ * @returns {T} A struct representing the root of the message.
102
+ */
103
+
104
+ getRoot<T extends Struct>(RootStruct: StructCtor<T>): T {
105
+ return getRoot(RootStruct, this);
106
+ }
107
+
108
+ /**
109
+ * Get a segment by its id.
110
+ *
111
+ * This will lazily allocate the first segment if it doesn't already exist.
112
+ *
113
+ * @param {number} id The segment id.
114
+ * @returns {Segment} The requested segment.
115
+ */
116
+
117
+ getSegment(id: number): Segment {
118
+ return getSegment(id, this);
119
+ }
120
+
121
+ /**
122
+ * Initialize a new message using the provided struct type as the root.
123
+ *
124
+ * @template T
125
+ * @param {StructCtor<T>} RootStruct The struct type to use as the root.
126
+ * @returns {T} An initialized struct pointing to the root of the message.
127
+ */
128
+
129
+ initRoot<T extends Struct>(RootStruct: StructCtor<T>): T {
130
+ return initRoot(RootStruct, this);
131
+ }
132
+
133
+ /**
134
+ * Set the root of the message to a copy of the given pointer. Used internally
135
+ * to make copies of pointers for default values.
136
+ *
137
+ * @param {Pointer} src The source pointer to copy.
138
+ * @returns {void}
139
+ */
140
+
141
+ setRoot(src: Pointer): void {
142
+ setRoot(src, this);
143
+ }
144
+
145
+ /**
146
+ * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header
147
+ * containing information about the following segment data.
148
+ *
149
+ * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message.
150
+ */
151
+
152
+ toArrayBuffer(): ArrayBuffer {
153
+ return toArrayBuffer(this);
154
+ }
155
+
156
+ /**
157
+ * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to
158
+ * use if you're sending the message over a network link or other slow I/O interface where size matters.
159
+ *
160
+ * @returns {ArrayBuffer} A packed message.
161
+ */
162
+
163
+ toPackedArrayBuffer(): ArrayBuffer {
164
+ return toPackedArrayBuffer(this);
165
+ }
166
+
167
+ toString(): string {
168
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
169
+ return `Message_arena:${this._capnp.arena}`;
170
+ }
171
+ }
172
+
173
+ export interface CreateMessageOptions {
174
+ packed?: boolean;
175
+ singleSegment?: boolean;
176
+ }
177
+
178
+ export function initMessage(
179
+ src?: AnyArena | ArrayBufferView | ArrayBuffer,
180
+ packed = true,
181
+ singleSegment = false
182
+ ): _Message {
183
+ if (src === undefined) {
184
+ return {
185
+ arena: new SingleSegmentArena(),
186
+ segments: [],
187
+ traversalLimit: DEFAULT_TRAVERSE_LIMIT,
188
+ };
189
+ }
190
+
191
+ if (isAnyArena(src)) {
192
+ return { arena: src, segments: [], traversalLimit: DEFAULT_TRAVERSE_LIMIT };
193
+ }
194
+
195
+ let buf: ArrayBuffer = src as ArrayBuffer;
196
+
197
+ if (isArrayBufferView(buf)) {
198
+ buf = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
199
+ }
200
+
201
+ if (packed) buf = unpack(buf);
202
+
203
+ if (singleSegment) {
204
+ return {
205
+ arena: new SingleSegmentArena(buf),
206
+ segments: [],
207
+ traversalLimit: DEFAULT_TRAVERSE_LIMIT,
208
+ };
209
+ }
210
+
211
+ return {
212
+ arena: new MultiSegmentArena(getFramedSegments(buf)),
213
+ segments: [],
214
+ traversalLimit: DEFAULT_TRAVERSE_LIMIT,
215
+ };
216
+ }
217
+
218
+ /**
219
+ * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in
220
+ * the message.
221
+ *
222
+ * This method is not typically called directly, but can be useful in certain cases.
223
+ *
224
+ * @static
225
+ * @param {ArrayBuffer} message An unpacked message with a framing header.
226
+ * @returns {ArrayBuffer[]} An array of buffers containing the segment data.
227
+ */
228
+
229
+ export function getFramedSegments(message: ArrayBuffer): ArrayBuffer[] {
230
+ const dv = new DataView(message);
231
+
232
+ const segmentCount = dv.getUint32(0, true) + 1;
233
+
234
+ const segments = new Array(segmentCount) as ArrayBuffer[];
235
+
236
+ trace("reading %d framed segments from stream", segmentCount);
237
+
238
+ let byteOffset = 4 + segmentCount * 4;
239
+ byteOffset += byteOffset % 8;
240
+
241
+ if (byteOffset + segmentCount * 4 > message.byteLength) {
242
+ throw new Error(MSG_INVALID_FRAME_HEADER);
243
+ }
244
+
245
+ for (let i = 0; i < segmentCount; i++) {
246
+ const byteLength = dv.getUint32(4 + i * 4, true) * 8;
247
+
248
+ if (byteOffset + byteLength > message.byteLength) {
249
+ throw new Error(MSG_INVALID_FRAME_HEADER);
250
+ }
251
+
252
+ segments[i] = message.slice(byteOffset, byteOffset + byteLength);
253
+
254
+ byteOffset += byteLength;
255
+ }
256
+
257
+ return segments;
258
+ }
259
+
260
+ /**
261
+ * This method is called on messages that were constructed with existing data to prepopulate the segments array with
262
+ * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer.
263
+ *
264
+ * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own
265
+ * may void your warranty.
266
+ *
267
+ * @param {Message} m The message to allocate.
268
+ * @returns {void}
269
+ */
270
+
271
+ export function preallocateSegments(m: Message): void {
272
+ const numSegments = Arena.getNumSegments(m._capnp.arena);
273
+
274
+ if (numSegments < 1) throw new Error(MSG_NO_SEGMENTS_IN_ARENA);
275
+
276
+ m._capnp.segments = new Array(numSegments) as Segment[];
277
+
278
+ for (let i = 0; i < numSegments; i++) {
279
+ // Set up each segment so that they're fully allocated to the extents of the existing buffers.
280
+
281
+ const buffer = Arena.getBuffer(i, m._capnp.arena);
282
+ const segment = new Segment(i, m, buffer, buffer.byteLength);
283
+
284
+ m._capnp.segments[i] = segment;
285
+ }
286
+ }
287
+
288
+ function isArrayBufferView(src: ArrayBuffer | ArrayBufferView): src is ArrayBufferView {
289
+ return (src as { byteOffset?: number }).byteOffset !== undefined;
290
+ }
291
+
292
+ function isAnyArena(o: unknown): o is AnyArena {
293
+ return (o as { kind?: ArenaKind }).kind !== undefined;
294
+ }
295
+
296
+ export function allocateSegment(byteLength: number, m: Message): Segment {
297
+ trace("allocating %x bytes for %s", byteLength, m);
298
+
299
+ const res = Arena.allocate(byteLength, m._capnp.segments, m._capnp.arena);
300
+ let s: Segment;
301
+
302
+ if (res.id === m._capnp.segments.length) {
303
+ // Note how we're only allowing new segments in if they're exactly the next one in the array. There is no logical
304
+ // reason for segments to be created out of order.
305
+
306
+ s = new Segment(res.id, m, res.buffer);
307
+
308
+ trace("adding new segment %s", s);
309
+
310
+ m._capnp.segments.push(s);
311
+ } else if (res.id < 0 || res.id > m._capnp.segments.length) {
312
+ throw new Error(format(MSG_SEGMENT_OUT_OF_BOUNDS, res.id, m));
313
+ } else {
314
+ s = m._capnp.segments[res.id];
315
+
316
+ trace("replacing segment %s with buffer (len:%d)", s, res.buffer.byteLength);
317
+
318
+ s.replaceBuffer(res.buffer);
319
+ }
320
+
321
+ return s;
322
+ }
323
+
324
+ export function dump(m: Message): string {
325
+ let r = "";
326
+
327
+ if (m._capnp.segments.length === 0) {
328
+ return "================\nNo Segments\n================\n";
329
+ }
330
+
331
+ for (let i = 0; i < m._capnp.segments.length; i++) {
332
+ r += `================\nSegment #${i}\n================\n`;
333
+
334
+ const { buffer, byteLength } = m._capnp.segments[i];
335
+ const b = new Uint8Array(buffer, 0, byteLength);
336
+
337
+ r += dumpBuffer(b);
338
+ }
339
+
340
+ return r;
341
+ }
342
+
343
+ export function getRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T {
344
+ const root = new RootStruct(m.getSegment(0), 0);
345
+
346
+ validate(PointerType.STRUCT, root);
347
+
348
+ const ts = getTargetStructSize(root);
349
+
350
+ // Make sure the underlying pointer is actually big enough to hold the data and pointers as specified in the schema.
351
+ // If not a shallow copy of the struct contents needs to be made before returning.
352
+
353
+ if (
354
+ ts.dataByteLength < RootStruct._capnp.size.dataByteLength ||
355
+ ts.pointerLength < RootStruct._capnp.size.pointerLength
356
+ ) {
357
+ trace("need to resize root struct %s", root);
358
+
359
+ resize(RootStruct._capnp.size, root);
360
+ }
361
+
362
+ return root;
363
+ }
364
+
365
+ export function getSegment(id: number, m: Message): Segment {
366
+ const segmentLength = m._capnp.segments.length;
367
+
368
+ if (id === 0 && segmentLength === 0) {
369
+ // Segment zero is special. If we have no segments in the arena we'll want to allocate a new one and leave room
370
+ // for the root pointer.
371
+
372
+ const arenaSegments = Arena.getNumSegments(m._capnp.arena);
373
+
374
+ if (arenaSegments === 0) {
375
+ allocateSegment(DEFAULT_BUFFER_SIZE, m);
376
+ } else {
377
+ // Okay, the arena already has a buffer we can use. This is totally fine.
378
+
379
+ m._capnp.segments[0] = new Segment(0, m, Arena.getBuffer(0, m._capnp.arena));
380
+ }
381
+
382
+ if (!m._capnp.segments[0].hasCapacity(8)) {
383
+ throw new Error(MSG_SEGMENT_TOO_SMALL);
384
+ }
385
+
386
+ // This will leave room for the root pointer.
387
+
388
+ m._capnp.segments[0].allocate(8);
389
+
390
+ return m._capnp.segments[0];
391
+ }
392
+
393
+ if (id < 0 || id >= segmentLength) {
394
+ throw new Error(format(MSG_SEGMENT_OUT_OF_BOUNDS, id, m));
395
+ }
396
+
397
+ return m._capnp.segments[id];
398
+ }
399
+
400
+ export function initRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T {
401
+ const root = new RootStruct(m.getSegment(0), 0);
402
+
403
+ initStruct(RootStruct._capnp.size, root);
404
+
405
+ trace("Initialized root pointer %s for %s.", root, m);
406
+
407
+ return root;
408
+ }
409
+
410
+ /**
411
+ * Read a pointer in raw form (a packed message with framing headers). Does not
412
+ * care or attempt to validate the input beyond parsing the message
413
+ * segments.
414
+ *
415
+ * This is typically used by the compiler to load default values, but can be
416
+ * useful to work with messages with an unknown schema.
417
+ *
418
+ * @param {ArrayBuffer} data The raw data to read.
419
+ * @returns {Pointer} A root pointer.
420
+ */
421
+
422
+ export function readRawPointer(data: ArrayBuffer): Pointer {
423
+ return new Pointer(new Message(data).getSegment(0), 0);
424
+ }
425
+
426
+ export function setRoot(src: Pointer, m: Message): void {
427
+ Pointer.copyFrom(src, new Pointer(m.getSegment(0), 0));
428
+ }
429
+
430
+ export function toArrayBuffer(m: Message): ArrayBuffer {
431
+ const streamFrame = getStreamFrame(m);
432
+
433
+ // Make sure the first segment is allocated.
434
+
435
+ if (m._capnp.segments.length === 0) getSegment(0, m);
436
+
437
+ const segments = m._capnp.segments;
438
+
439
+ // Add space for the stream framing.
440
+
441
+ const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + padToWord(s.byteLength), 0);
442
+ const out = new Uint8Array(new ArrayBuffer(totalLength));
443
+ let o = streamFrame.byteLength;
444
+
445
+ out.set(new Uint8Array(streamFrame));
446
+
447
+ segments.forEach((s) => {
448
+ const segmentLength = padToWord(s.byteLength);
449
+ out.set(new Uint8Array(s.buffer, 0, segmentLength), o);
450
+
451
+ o += segmentLength;
452
+ });
453
+
454
+ return out.buffer;
455
+ }
456
+
457
+ export function toPackedArrayBuffer(m: Message): ArrayBuffer {
458
+ const streamFrame = pack(getStreamFrame(m));
459
+
460
+ // Make sure the first segment is allocated.
461
+
462
+ if (m._capnp.segments.length === 0) m.getSegment(0);
463
+
464
+ // NOTE: A copy operation can be avoided here if we capture the intermediate array and use that directly in the copy
465
+ // loop below, rather than have `pack()` copy it to an ArrayBuffer just to have to copy it again later. If the
466
+ // intermediate array can be avoided altogether that's even better!
467
+ const segments = m._capnp.segments.map((s) => pack(s.buffer, 0, padToWord(s.byteLength)));
468
+
469
+ const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + s.byteLength, 0);
470
+ const out = new Uint8Array(new ArrayBuffer(totalLength));
471
+ let o = streamFrame.byteLength;
472
+
473
+ out.set(new Uint8Array(streamFrame));
474
+
475
+ segments.forEach((s) => {
476
+ out.set(new Uint8Array(s), o);
477
+
478
+ o += s.byteLength;
479
+ });
480
+
481
+ return out.buffer;
482
+ }
483
+
484
+ export function getStreamFrame(m: Message): ArrayBuffer {
485
+ const length = m._capnp.segments.length;
486
+
487
+ if (length === 0) {
488
+ // Don't bother allocating the first segment, just return a single zero word for the frame header.
489
+
490
+ return new Float64Array(1).buffer;
491
+ }
492
+
493
+ const frameLength = 4 + length * 4 + (1 - (length % 2)) * 4;
494
+ const out = new DataView(new ArrayBuffer(frameLength));
495
+
496
+ trace("Writing message stream frame with segment count: %d.", length);
497
+
498
+ out.setUint32(0, length - 1, true);
499
+
500
+ m._capnp.segments.forEach((s, i) => {
501
+ trace("Message segment %d word count: %d.", s.id, s.byteLength / 8);
502
+
503
+ out.setUint32(i * 4 + 4, s.byteLength / 8, true);
504
+ });
505
+
506
+ return out.buffer;
507
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.d.ts ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ /**
5
+ * A simple object that describes the size of a struct.
6
+ *
7
+ * @export
8
+ * @class ObjectSize
9
+ */
10
+ export declare class ObjectSize {
11
+ /** The number of bytes required for the data section. */
12
+ readonly dataByteLength: number;
13
+ /** The number of pointers in the object. */
14
+ readonly pointerLength: number;
15
+ constructor(dataByteLength: number, pointerCount: number);
16
+ toString(): string;
17
+ }
18
+ export declare function getByteLength(o: ObjectSize): number;
19
+ export declare function getDataWordLength(o: ObjectSize): number;
20
+ export declare function getWordLength(o: ObjectSize): number;
21
+ export declare function padToWord(o: ObjectSize): ObjectSize;
workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.js ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.padToWord = exports.getWordLength = exports.getDataWordLength = exports.getByteLength = exports.ObjectSize = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const _ = tslib_1.__importStar(require("../util"));
10
+ const trace = debug_1.default("capnp:object-size");
11
+ trace("load");
12
+ /**
13
+ * A simple object that describes the size of a struct.
14
+ *
15
+ * @export
16
+ * @class ObjectSize
17
+ */
18
+ class ObjectSize {
19
+ constructor(dataByteLength, pointerCount) {
20
+ this.dataByteLength = dataByteLength;
21
+ this.pointerLength = pointerCount;
22
+ }
23
+ toString() {
24
+ return _.format("ObjectSize_dw:%d,pc:%d", getDataWordLength(this), this.pointerLength);
25
+ }
26
+ }
27
+ exports.ObjectSize = ObjectSize;
28
+ function getByteLength(o) {
29
+ return o.dataByteLength + o.pointerLength * 8;
30
+ }
31
+ exports.getByteLength = getByteLength;
32
+ function getDataWordLength(o) {
33
+ return o.dataByteLength / 8;
34
+ }
35
+ exports.getDataWordLength = getDataWordLength;
36
+ function getWordLength(o) {
37
+ return o.dataByteLength / 8 + o.pointerLength;
38
+ }
39
+ exports.getWordLength = getWordLength;
40
+ function padToWord(o) {
41
+ return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength);
42
+ }
43
+ exports.padToWord = padToWord;
44
+ //# sourceMappingURL=object-size.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"object-size.js","sourceRoot":"","sources":["object-size.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,mDAA6B;AAE7B,MAAM,KAAK,GAAG,eAAS,CAAC,mBAAmB,CAAC,CAAC;AAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd;;;;;GAKG;AAEH,MAAa,UAAU;IASrB,YAAY,cAAsB,EAAE,YAAoB;QACtD,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,CAAC,MAAM,CACb,wBAAwB,EACxB,iBAAiB,CAAC,IAAI,CAAC,EACvB,IAAI,CAAC,aAAa,CACnB,CAAC;IACJ,CAAC;CACF;AArBD,gCAqBC;AAED,SAAgB,aAAa,CAAC,CAAa;IACzC,OAAO,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC;AAChD,CAAC;AAFD,sCAEC;AAED,SAAgB,iBAAiB,CAAC,CAAa;IAC7C,OAAO,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC;AAC9B,CAAC;AAFD,8CAEC;AAED,SAAgB,aAAa,CAAC,CAAa;IACzC,OAAO,CAAC,CAAC,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC;AAChD,CAAC;AAFD,sCAEC;AAED,SAAgB,SAAS,CAAC,CAAa;IACrC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC;AACxE,CAAC;AAFD,8BAEC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/object-size.ts ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import * as _ from "../util";
8
+
9
+ const trace = initTrace("capnp:object-size");
10
+ trace("load");
11
+
12
+ /**
13
+ * A simple object that describes the size of a struct.
14
+ *
15
+ * @export
16
+ * @class ObjectSize
17
+ */
18
+
19
+ export class ObjectSize {
20
+ /** The number of bytes required for the data section. */
21
+
22
+ readonly dataByteLength: number;
23
+
24
+ /** The number of pointers in the object. */
25
+
26
+ readonly pointerLength: number;
27
+
28
+ constructor(dataByteLength: number, pointerCount: number) {
29
+ this.dataByteLength = dataByteLength;
30
+ this.pointerLength = pointerCount;
31
+ }
32
+
33
+ toString(): string {
34
+ return _.format(
35
+ "ObjectSize_dw:%d,pc:%d",
36
+ getDataWordLength(this),
37
+ this.pointerLength
38
+ );
39
+ }
40
+ }
41
+
42
+ export function getByteLength(o: ObjectSize): number {
43
+ return o.dataByteLength + o.pointerLength * 8;
44
+ }
45
+
46
+ export function getDataWordLength(o: ObjectSize): number {
47
+ return o.dataByteLength / 8;
48
+ }
49
+
50
+ export function getWordLength(o: ObjectSize): number {
51
+ return o.dataByteLength / 8 + o.pointerLength;
52
+ }
53
+
54
+ export function padToWord(o: ObjectSize): ObjectSize {
55
+ return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength);
56
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.d.ts ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ /**
5
+ * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte
6
+ * while computing the size of a packed message.
7
+ *
8
+ * WARNING: Using this with floating point numbers will void your warranty.
9
+ *
10
+ * @param {number} x A real integer.
11
+ * @returns {number} The hamming weight (integer).
12
+ */
13
+ export declare function getHammingWeight(x: number): number;
14
+ export declare type byte = number;
15
+ /**
16
+ * Compute the tag byte from the 8 bytes of a 64-bit word.
17
+ *
18
+ * @param {byte} a The first byte.
19
+ * @param {byte} b The second byte.
20
+ * @param {byte} c The third byte.
21
+ * @param {byte} d The fourth byte.
22
+ * @param {byte} e The fifth byte.
23
+ * @param {byte} f The sixth byte.
24
+ * @param {byte} g The seventh byte.
25
+ * @param {byte} h The eighth byte (phew!).
26
+ * @returns {number} The tag byte.
27
+ */
28
+ export declare function getTagByte(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number;
29
+ /**
30
+ * Efficiently calculate the length of a packed Cap'n Proto message.
31
+ *
32
+ * @export
33
+ * @param {ArrayBuffer} packed The packed message.
34
+ * @returns {number} The length of the unpacked message in bytes.
35
+ */
36
+ export declare function getUnpackedByteLength(packed: ArrayBuffer): number;
37
+ /**
38
+ * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes.
39
+ *
40
+ * @param {byte} a The first byte.
41
+ * @param {byte} b The second byte.
42
+ * @param {byte} c The third byte.
43
+ * @param {byte} d The fourth byte.
44
+ * @param {byte} e The fifth byte.
45
+ * @param {byte} f The sixth byte.
46
+ * @param {byte} g The seventh byte.
47
+ * @param {byte} h The eighth byte (phew!).
48
+ * @returns {number} The number of these bytes that are zero.
49
+ */
50
+ export declare function getZeroByteCount(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number;
51
+ /**
52
+ * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which
53
+ * are common in idiomatic Cap'n Proto messages) into a compact form.
54
+ *
55
+ * For stream-framed messages this is called once for the frame header and once again for each segment in the message.
56
+ *
57
+ * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end.
58
+ * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each
59
+ * packed byte until the packing is complete).
60
+ *
61
+ * @export
62
+ * @param {ArrayBuffer} unpacked The message to pack.
63
+ * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0.
64
+ * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents.
65
+ * @returns {ArrayBuffer} A packed version of the message.
66
+ */
67
+ export declare function pack(unpacked: ArrayBuffer, byteOffset?: number, byteLength?: number): ArrayBuffer;
68
+ /**
69
+ * Unpack a compressed Cap'n Proto message into a new ArrayBuffer.
70
+ *
71
+ * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and
72
+ * runs considerably more efficiently.
73
+ *
74
+ * @export
75
+ * @param {ArrayBuffer} packed An array buffer containing the packed message.
76
+ * @returns {ArrayBuffer} The unpacked message.
77
+ */
78
+ export declare function unpack(packed: ArrayBuffer): ArrayBuffer;
workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.js ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.unpack = exports.pack = exports.getZeroByteCount = exports.getUnpackedByteLength = exports.getTagByte = exports.getHammingWeight = void 0;
7
+ const constants_1 = require("../constants");
8
+ const errors_1 = require("../errors");
9
+ /**
10
+ * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte
11
+ * while computing the size of a packed message.
12
+ *
13
+ * WARNING: Using this with floating point numbers will void your warranty.
14
+ *
15
+ * @param {number} x A real integer.
16
+ * @returns {number} The hamming weight (integer).
17
+ */
18
+ function getHammingWeight(x) {
19
+ // Thanks, HACKMEM!
20
+ let w = x - ((x >> 1) & 0x55555555);
21
+ w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
22
+ return (((w + (w >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24;
23
+ }
24
+ exports.getHammingWeight = getHammingWeight;
25
+ /**
26
+ * Compute the tag byte from the 8 bytes of a 64-bit word.
27
+ *
28
+ * @param {byte} a The first byte.
29
+ * @param {byte} b The second byte.
30
+ * @param {byte} c The third byte.
31
+ * @param {byte} d The fourth byte.
32
+ * @param {byte} e The fifth byte.
33
+ * @param {byte} f The sixth byte.
34
+ * @param {byte} g The seventh byte.
35
+ * @param {byte} h The eighth byte (phew!).
36
+ * @returns {number} The tag byte.
37
+ */
38
+ function getTagByte(a, b, c, d, e, f, g, h) {
39
+ // Yes, it's pretty. Don't touch it.
40
+ return ((a === 0 ? 0 : 0b00000001) |
41
+ (b === 0 ? 0 : 0b00000010) |
42
+ (c === 0 ? 0 : 0b00000100) |
43
+ (d === 0 ? 0 : 0b00001000) |
44
+ (e === 0 ? 0 : 0b00010000) |
45
+ (f === 0 ? 0 : 0b00100000) |
46
+ (g === 0 ? 0 : 0b01000000) |
47
+ (h === 0 ? 0 : 0b10000000));
48
+ }
49
+ exports.getTagByte = getTagByte;
50
+ /**
51
+ * Efficiently calculate the length of a packed Cap'n Proto message.
52
+ *
53
+ * @export
54
+ * @param {ArrayBuffer} packed The packed message.
55
+ * @returns {number} The length of the unpacked message in bytes.
56
+ */
57
+ function getUnpackedByteLength(packed) {
58
+ const p = new Uint8Array(packed);
59
+ let wordLength = 0;
60
+ let lastTag = 0x77;
61
+ for (let i = 0; i < p.byteLength;) {
62
+ const tag = p[i];
63
+ if (lastTag === 0 /* ZERO */) {
64
+ wordLength += tag;
65
+ i++;
66
+ lastTag = 0x77;
67
+ }
68
+ else if (lastTag === 255 /* SPAN */) {
69
+ wordLength += tag;
70
+ i += tag * 8 + 1;
71
+ lastTag = 0x77;
72
+ }
73
+ else {
74
+ wordLength++;
75
+ i += getHammingWeight(tag) + 1;
76
+ lastTag = tag;
77
+ }
78
+ }
79
+ return wordLength * 8;
80
+ }
81
+ exports.getUnpackedByteLength = getUnpackedByteLength;
82
+ /**
83
+ * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes.
84
+ *
85
+ * @param {byte} a The first byte.
86
+ * @param {byte} b The second byte.
87
+ * @param {byte} c The third byte.
88
+ * @param {byte} d The fourth byte.
89
+ * @param {byte} e The fifth byte.
90
+ * @param {byte} f The sixth byte.
91
+ * @param {byte} g The seventh byte.
92
+ * @param {byte} h The eighth byte (phew!).
93
+ * @returns {number} The number of these bytes that are zero.
94
+ */
95
+ function getZeroByteCount(a, b, c, d, e, f, g, h) {
96
+ return ((a === 0 ? 1 : 0) +
97
+ (b === 0 ? 1 : 0) +
98
+ (c === 0 ? 1 : 0) +
99
+ (d === 0 ? 1 : 0) +
100
+ (e === 0 ? 1 : 0) +
101
+ (f === 0 ? 1 : 0) +
102
+ (g === 0 ? 1 : 0) +
103
+ (h === 0 ? 1 : 0));
104
+ }
105
+ exports.getZeroByteCount = getZeroByteCount;
106
+ /**
107
+ * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which
108
+ * are common in idiomatic Cap'n Proto messages) into a compact form.
109
+ *
110
+ * For stream-framed messages this is called once for the frame header and once again for each segment in the message.
111
+ *
112
+ * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end.
113
+ * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each
114
+ * packed byte until the packing is complete).
115
+ *
116
+ * @export
117
+ * @param {ArrayBuffer} unpacked The message to pack.
118
+ * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0.
119
+ * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents.
120
+ * @returns {ArrayBuffer} A packed version of the message.
121
+ */
122
+ function pack(unpacked, byteOffset = 0, byteLength) {
123
+ if (unpacked.byteLength % 8 !== 0)
124
+ throw new Error(errors_1.MSG_PACK_NOT_WORD_ALIGNED);
125
+ const src = new Uint8Array(unpacked, byteOffset, byteLength);
126
+ // TODO: Maybe we should do this with buffers? This costs more than 8x the final compressed size in temporary RAM.
127
+ const dst = [];
128
+ /* Just have to be sure it's neither ZERO nor SPAN. */
129
+ let lastTag = 0x77;
130
+ /** This is where we need to remember to write the SPAN tag (0xff). */
131
+ let spanTagOffset = NaN;
132
+ /** How many words have been copied during the current span. */
133
+ let spanWordLength = 0;
134
+ /**
135
+ * When this hits zero, we've had PACK_SPAN_THRESHOLD zero bytes pass by and it's time to bail from the span.
136
+ */
137
+ let spanThreshold = constants_1.PACK_SPAN_THRESHOLD;
138
+ for (let srcByteOffset = 0; srcByteOffset < src.byteLength; srcByteOffset += 8) {
139
+ /** Read in the entire word. Yes, this feels silly but it's fast! */
140
+ const a = src[srcByteOffset];
141
+ const b = src[srcByteOffset + 1];
142
+ const c = src[srcByteOffset + 2];
143
+ const d = src[srcByteOffset + 3];
144
+ const e = src[srcByteOffset + 4];
145
+ const f = src[srcByteOffset + 5];
146
+ const g = src[srcByteOffset + 6];
147
+ const h = src[srcByteOffset + 7];
148
+ const tag = getTagByte(a, b, c, d, e, f, g, h);
149
+ /** If this is true we'll skip the normal word write logic after the switch statement. */
150
+ let skipWriteWord = true;
151
+ switch (lastTag) {
152
+ case 0 /* ZERO */:
153
+ // We're writing a span of words with all zeroes in them. See if we need to bail out of the fast path.
154
+ if (tag !== 0 /* ZERO */ || spanWordLength >= 0xff) {
155
+ // There's a bit in there or we got too many zeroes. Damn, we need to bail.
156
+ dst.push(spanWordLength);
157
+ spanWordLength = 0;
158
+ skipWriteWord = false;
159
+ }
160
+ else {
161
+ // Kay, let's quickly inc this and go.
162
+ spanWordLength++;
163
+ }
164
+ break;
165
+ case 255 /* SPAN */: {
166
+ // We're writing a span of nonzero words.
167
+ const zeroCount = getZeroByteCount(a, b, c, d, e, f, g, h);
168
+ // See if we need to bail now.
169
+ spanThreshold -= zeroCount;
170
+ if (spanThreshold <= 0 || spanWordLength >= 0xff) {
171
+ // Alright, time to get packing again. Write the number of words we skipped to the beginning of the span.
172
+ dst[spanTagOffset] = spanWordLength;
173
+ spanWordLength = 0;
174
+ spanThreshold = constants_1.PACK_SPAN_THRESHOLD;
175
+ // We have to write this word normally.
176
+ skipWriteWord = false;
177
+ }
178
+ else {
179
+ // Just write this word verbatim.
180
+ dst.push(a, b, c, d, e, f, g, h);
181
+ spanWordLength++;
182
+ }
183
+ break;
184
+ }
185
+ default:
186
+ // Didn't get a special tag last time, let's write this as normal.
187
+ skipWriteWord = false;
188
+ break;
189
+ }
190
+ // A goto is fast, idk why people keep hatin'.
191
+ if (skipWriteWord)
192
+ continue;
193
+ dst.push(tag);
194
+ lastTag = tag;
195
+ if (a !== 0)
196
+ dst.push(a);
197
+ if (b !== 0)
198
+ dst.push(b);
199
+ if (c !== 0)
200
+ dst.push(c);
201
+ if (d !== 0)
202
+ dst.push(d);
203
+ if (e !== 0)
204
+ dst.push(e);
205
+ if (f !== 0)
206
+ dst.push(f);
207
+ if (g !== 0)
208
+ dst.push(g);
209
+ if (h !== 0)
210
+ dst.push(h);
211
+ // Record the span tag offset if needed, making sure to actually leave room for it.
212
+ if (tag === 255 /* SPAN */) {
213
+ spanTagOffset = dst.length;
214
+ dst.push(0);
215
+ }
216
+ }
217
+ // We're done. If we were writing a span let's finish it.
218
+ if (lastTag === 0 /* ZERO */) {
219
+ dst.push(spanWordLength);
220
+ }
221
+ else if (lastTag === 255 /* SPAN */) {
222
+ dst[spanTagOffset] = spanWordLength;
223
+ }
224
+ return new Uint8Array(dst).buffer;
225
+ }
226
+ exports.pack = pack;
227
+ /**
228
+ * Unpack a compressed Cap'n Proto message into a new ArrayBuffer.
229
+ *
230
+ * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and
231
+ * runs considerably more efficiently.
232
+ *
233
+ * @export
234
+ * @param {ArrayBuffer} packed An array buffer containing the packed message.
235
+ * @returns {ArrayBuffer} The unpacked message.
236
+ */
237
+ function unpack(packed) {
238
+ // We have no choice but to read the packed buffer one byte at a time.
239
+ const src = new Uint8Array(packed);
240
+ const dst = new Uint8Array(new ArrayBuffer(getUnpackedByteLength(packed)));
241
+ /** The last tag byte that we've seen - it starts at a "neutral" value. */
242
+ let lastTag = 0x77;
243
+ for (let srcByteOffset = 0, dstByteOffset = 0; srcByteOffset < src.byteLength;) {
244
+ const tag = src[srcByteOffset];
245
+ if (lastTag === 0 /* ZERO */) {
246
+ // We have a span of zeroes. New array buffers are guaranteed to be initialized to zero so we just seek ahead.
247
+ dstByteOffset += tag * 8;
248
+ srcByteOffset++;
249
+ lastTag = 0x77;
250
+ }
251
+ else if (lastTag === 255 /* SPAN */) {
252
+ // We have a span of unpacked bytes. Copy them verbatim from the source buffer.
253
+ const spanByteLength = tag * 8;
254
+ dst.set(src.subarray(srcByteOffset + 1, srcByteOffset + 1 + spanByteLength), dstByteOffset);
255
+ dstByteOffset += spanByteLength;
256
+ srcByteOffset += 1 + spanByteLength;
257
+ lastTag = 0x77;
258
+ }
259
+ else {
260
+ // Okay, a normal tag. Let's read past the tag and copy bytes that have a bit set in the tag.
261
+ srcByteOffset++;
262
+ for (let i = 1; i <= 0b10000000; i <<= 1) {
263
+ // We only need to actually touch `dst` if there's a nonzero byte (it's already initialized to zeroes).
264
+ if ((tag & i) !== 0)
265
+ dst[dstByteOffset] = src[srcByteOffset++];
266
+ dstByteOffset++;
267
+ }
268
+ lastTag = tag;
269
+ }
270
+ }
271
+ return dst.buffer;
272
+ }
273
+ exports.unpack = unpack;
274
+ //# sourceMappingURL=packing.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/packing.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"packing.js","sourceRoot":"","sources":["packing.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4CAAmD;AACnD,sCAAsD;AAmCtD;;;;;;;;GAQG;AAEH,SAAgB,gBAAgB,CAAC,CAAS;IACxC,mBAAmB;IAEnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IACpC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAND,4CAMC;AAID;;;;;;;;;;;;GAYG;AAEH,SAAgB,UAAU,CAAC,CAAO,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO;IAC/F,oCAAoC;IAEpC,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1B,C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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import { PACK_SPAN_THRESHOLD } from "../constants";
6
+ import { MSG_PACK_NOT_WORD_ALIGNED } from "../errors";
7
+
8
+ /**
9
+ * When packing a message there are two tags that are interpreted in a special way: `0x00` and `0xff`.
10
+ *
11
+ * @enum {number}
12
+ */
13
+
14
+ const enum PackedTag {
15
+ /**
16
+ * The tag is followed by a single byte which indicates a count of consecutive zero-valued words, minus 1. E.g. if the
17
+ * tag 0x00 is followed by 0x05, the sequence unpacks to 6 words of zero.
18
+ *
19
+ * Or, put another way: the tag is first decoded as if it were not special. Since none of the bits are set, it is
20
+ * followed by no bytes and expands to a word full of zeros. After that, the next byte is interpreted as a count of
21
+ * additional words that are also all-zero.
22
+ */
23
+
24
+ ZERO = 0x00,
25
+
26
+ /**
27
+ * The tag is followed by the bytes of the word (as if it weren’t special), but after those bytes is another byte with
28
+ * value N. Following that byte is N unpacked words that should be copied directly.
29
+ *
30
+ * These unpacked words may contain zeroes; in this implementation a minimum of PACK_SPAN_THRESHOLD zero bytes are
31
+ * written before ending the span.
32
+ *
33
+ * The purpose of this rule is to minimize the impact of packing on data that doesn’t contain any zeros – in
34
+ * particular, long text blobs. Because of this rule, the worst-case space overhead of packing is 2 bytes per 2 KiB of
35
+ * input (256 words = 2KiB).
36
+ */
37
+
38
+ SPAN = 0xff,
39
+ }
40
+
41
+ /**
42
+ * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte
43
+ * while computing the size of a packed message.
44
+ *
45
+ * WARNING: Using this with floating point numbers will void your warranty.
46
+ *
47
+ * @param {number} x A real integer.
48
+ * @returns {number} The hamming weight (integer).
49
+ */
50
+
51
+ export function getHammingWeight(x: number): number {
52
+ // Thanks, HACKMEM!
53
+
54
+ let w = x - ((x >> 1) & 0x55555555);
55
+ w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
56
+ return (((w + (w >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24;
57
+ }
58
+
59
+ export type byte = number;
60
+
61
+ /**
62
+ * Compute the tag byte from the 8 bytes of a 64-bit word.
63
+ *
64
+ * @param {byte} a The first byte.
65
+ * @param {byte} b The second byte.
66
+ * @param {byte} c The third byte.
67
+ * @param {byte} d The fourth byte.
68
+ * @param {byte} e The fifth byte.
69
+ * @param {byte} f The sixth byte.
70
+ * @param {byte} g The seventh byte.
71
+ * @param {byte} h The eighth byte (phew!).
72
+ * @returns {number} The tag byte.
73
+ */
74
+
75
+ export function getTagByte(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number {
76
+ // Yes, it's pretty. Don't touch it.
77
+
78
+ return (
79
+ (a === 0 ? 0 : 0b00000001) |
80
+ (b === 0 ? 0 : 0b00000010) |
81
+ (c === 0 ? 0 : 0b00000100) |
82
+ (d === 0 ? 0 : 0b00001000) |
83
+ (e === 0 ? 0 : 0b00010000) |
84
+ (f === 0 ? 0 : 0b00100000) |
85
+ (g === 0 ? 0 : 0b01000000) |
86
+ (h === 0 ? 0 : 0b10000000)
87
+ );
88
+ }
89
+
90
+ /**
91
+ * Efficiently calculate the length of a packed Cap'n Proto message.
92
+ *
93
+ * @export
94
+ * @param {ArrayBuffer} packed The packed message.
95
+ * @returns {number} The length of the unpacked message in bytes.
96
+ */
97
+
98
+ export function getUnpackedByteLength(packed: ArrayBuffer): number {
99
+ const p = new Uint8Array(packed);
100
+ let wordLength = 0;
101
+ let lastTag = 0x77;
102
+
103
+ for (let i = 0; i < p.byteLength; ) {
104
+ const tag = p[i];
105
+
106
+ if (lastTag === PackedTag.ZERO) {
107
+ wordLength += tag;
108
+
109
+ i++;
110
+
111
+ lastTag = 0x77;
112
+ } else if (lastTag === PackedTag.SPAN) {
113
+ wordLength += tag;
114
+
115
+ i += tag * 8 + 1;
116
+
117
+ lastTag = 0x77;
118
+ } else {
119
+ wordLength++;
120
+
121
+ i += getHammingWeight(tag) + 1;
122
+
123
+ lastTag = tag;
124
+ }
125
+ }
126
+
127
+ return wordLength * 8;
128
+ }
129
+
130
+ /**
131
+ * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes.
132
+ *
133
+ * @param {byte} a The first byte.
134
+ * @param {byte} b The second byte.
135
+ * @param {byte} c The third byte.
136
+ * @param {byte} d The fourth byte.
137
+ * @param {byte} e The fifth byte.
138
+ * @param {byte} f The sixth byte.
139
+ * @param {byte} g The seventh byte.
140
+ * @param {byte} h The eighth byte (phew!).
141
+ * @returns {number} The number of these bytes that are zero.
142
+ */
143
+
144
+ export function getZeroByteCount(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number {
145
+ return (
146
+ (a === 0 ? 1 : 0) +
147
+ (b === 0 ? 1 : 0) +
148
+ (c === 0 ? 1 : 0) +
149
+ (d === 0 ? 1 : 0) +
150
+ (e === 0 ? 1 : 0) +
151
+ (f === 0 ? 1 : 0) +
152
+ (g === 0 ? 1 : 0) +
153
+ (h === 0 ? 1 : 0)
154
+ );
155
+ }
156
+
157
+ /**
158
+ * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which
159
+ * are common in idiomatic Cap'n Proto messages) into a compact form.
160
+ *
161
+ * For stream-framed messages this is called once for the frame header and once again for each segment in the message.
162
+ *
163
+ * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end.
164
+ * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each
165
+ * packed byte until the packing is complete).
166
+ *
167
+ * @export
168
+ * @param {ArrayBuffer} unpacked The message to pack.
169
+ * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0.
170
+ * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents.
171
+ * @returns {ArrayBuffer} A packed version of the message.
172
+ */
173
+
174
+ export function pack(unpacked: ArrayBuffer, byteOffset = 0, byteLength?: number): ArrayBuffer {
175
+ if (unpacked.byteLength % 8 !== 0) throw new Error(MSG_PACK_NOT_WORD_ALIGNED);
176
+
177
+ const src = new Uint8Array(unpacked, byteOffset, byteLength);
178
+
179
+ // TODO: Maybe we should do this with buffers? This costs more than 8x the final compressed size in temporary RAM.
180
+
181
+ const dst: number[] = [];
182
+
183
+ /* Just have to be sure it's neither ZERO nor SPAN. */
184
+
185
+ let lastTag = 0x77;
186
+
187
+ /** This is where we need to remember to write the SPAN tag (0xff). */
188
+
189
+ let spanTagOffset = NaN;
190
+
191
+ /** How many words have been copied during the current span. */
192
+
193
+ let spanWordLength = 0;
194
+
195
+ /**
196
+ * When this hits zero, we've had PACK_SPAN_THRESHOLD zero bytes pass by and it's time to bail from the span.
197
+ */
198
+
199
+ let spanThreshold = PACK_SPAN_THRESHOLD;
200
+
201
+ for (let srcByteOffset = 0; srcByteOffset < src.byteLength; srcByteOffset += 8) {
202
+ /** Read in the entire word. Yes, this feels silly but it's fast! */
203
+
204
+ const a = src[srcByteOffset];
205
+ const b = src[srcByteOffset + 1];
206
+ const c = src[srcByteOffset + 2];
207
+ const d = src[srcByteOffset + 3];
208
+ const e = src[srcByteOffset + 4];
209
+ const f = src[srcByteOffset + 5];
210
+ const g = src[srcByteOffset + 6];
211
+ const h = src[srcByteOffset + 7];
212
+
213
+ const tag = getTagByte(a, b, c, d, e, f, g, h);
214
+
215
+ /** If this is true we'll skip the normal word write logic after the switch statement. */
216
+
217
+ let skipWriteWord = true;
218
+
219
+ switch (lastTag) {
220
+ case PackedTag.ZERO:
221
+ // We're writing a span of words with all zeroes in them. See if we need to bail out of the fast path.
222
+
223
+ if (tag !== PackedTag.ZERO || spanWordLength >= 0xff) {
224
+ // There's a bit in there or we got too many zeroes. Damn, we need to bail.
225
+
226
+ dst.push(spanWordLength);
227
+ spanWordLength = 0;
228
+
229
+ skipWriteWord = false;
230
+ } else {
231
+ // Kay, let's quickly inc this and go.
232
+
233
+ spanWordLength++;
234
+ }
235
+
236
+ break;
237
+
238
+ case PackedTag.SPAN: {
239
+ // We're writing a span of nonzero words.
240
+
241
+ const zeroCount = getZeroByteCount(a, b, c, d, e, f, g, h);
242
+
243
+ // See if we need to bail now.
244
+
245
+ spanThreshold -= zeroCount;
246
+
247
+ if (spanThreshold <= 0 || spanWordLength >= 0xff) {
248
+ // Alright, time to get packing again. Write the number of words we skipped to the beginning of the span.
249
+
250
+ dst[spanTagOffset] = spanWordLength;
251
+ spanWordLength = 0;
252
+
253
+ spanThreshold = PACK_SPAN_THRESHOLD;
254
+
255
+ // We have to write this word normally.
256
+
257
+ skipWriteWord = false;
258
+ } else {
259
+ // Just write this word verbatim.
260
+
261
+ dst.push(a, b, c, d, e, f, g, h);
262
+
263
+ spanWordLength++;
264
+ }
265
+
266
+ break;
267
+ }
268
+ default:
269
+ // Didn't get a special tag last time, let's write this as normal.
270
+
271
+ skipWriteWord = false;
272
+
273
+ break;
274
+ }
275
+
276
+ // A goto is fast, idk why people keep hatin'.
277
+ if (skipWriteWord) continue;
278
+
279
+ dst.push(tag);
280
+ lastTag = tag;
281
+
282
+ if (a !== 0) dst.push(a);
283
+ if (b !== 0) dst.push(b);
284
+ if (c !== 0) dst.push(c);
285
+ if (d !== 0) dst.push(d);
286
+ if (e !== 0) dst.push(e);
287
+ if (f !== 0) dst.push(f);
288
+ if (g !== 0) dst.push(g);
289
+ if (h !== 0) dst.push(h);
290
+
291
+ // Record the span tag offset if needed, making sure to actually leave room for it.
292
+
293
+ if (tag === PackedTag.SPAN) {
294
+ spanTagOffset = dst.length;
295
+
296
+ dst.push(0);
297
+ }
298
+ }
299
+
300
+ // We're done. If we were writing a span let's finish it.
301
+
302
+ if (lastTag === PackedTag.ZERO) {
303
+ dst.push(spanWordLength);
304
+ } else if (lastTag === PackedTag.SPAN) {
305
+ dst[spanTagOffset] = spanWordLength;
306
+ }
307
+
308
+ return new Uint8Array(dst).buffer;
309
+ }
310
+
311
+ /**
312
+ * Unpack a compressed Cap'n Proto message into a new ArrayBuffer.
313
+ *
314
+ * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and
315
+ * runs considerably more efficiently.
316
+ *
317
+ * @export
318
+ * @param {ArrayBuffer} packed An array buffer containing the packed message.
319
+ * @returns {ArrayBuffer} The unpacked message.
320
+ */
321
+
322
+ export function unpack(packed: ArrayBuffer): ArrayBuffer {
323
+ // We have no choice but to read the packed buffer one byte at a time.
324
+
325
+ const src = new Uint8Array(packed);
326
+ const dst = new Uint8Array(new ArrayBuffer(getUnpackedByteLength(packed)));
327
+
328
+ /** The last tag byte that we've seen - it starts at a "neutral" value. */
329
+
330
+ let lastTag = 0x77;
331
+
332
+ for (let srcByteOffset = 0, dstByteOffset = 0; srcByteOffset < src.byteLength; ) {
333
+ const tag = src[srcByteOffset];
334
+
335
+ if (lastTag === PackedTag.ZERO) {
336
+ // We have a span of zeroes. New array buffers are guaranteed to be initialized to zero so we just seek ahead.
337
+
338
+ dstByteOffset += tag * 8;
339
+
340
+ srcByteOffset++;
341
+
342
+ lastTag = 0x77;
343
+ } else if (lastTag === PackedTag.SPAN) {
344
+ // We have a span of unpacked bytes. Copy them verbatim from the source buffer.
345
+
346
+ const spanByteLength = tag * 8;
347
+
348
+ dst.set(src.subarray(srcByteOffset + 1, srcByteOffset + 1 + spanByteLength), dstByteOffset);
349
+
350
+ dstByteOffset += spanByteLength;
351
+ srcByteOffset += 1 + spanByteLength;
352
+
353
+ lastTag = 0x77;
354
+ } else {
355
+ // Okay, a normal tag. Let's read past the tag and copy bytes that have a bit set in the tag.
356
+
357
+ srcByteOffset++;
358
+
359
+ for (let i = 1; i <= 0b10000000; i <<= 1) {
360
+ // We only need to actually touch `dst` if there's a nonzero byte (it's already initialized to zeroes).
361
+
362
+ if ((tag & i) !== 0) dst[dstByteOffset] = src[srcByteOffset++];
363
+
364
+ dstByteOffset++;
365
+ }
366
+
367
+ lastTag = tag;
368
+ }
369
+ }
370
+
371
+ return dst.buffer;
372
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.d.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { ListCtor } from "./list";
5
+ import { Pointer } from "./pointer";
6
+ export declare const AnyPointerList: ListCtor<Pointer>;
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AnyPointerList = void 0;
7
+ const pointer_1 = require("./pointer");
8
+ const pointer_list_1 = require("./pointer-list");
9
+ exports.AnyPointerList = pointer_list_1.PointerList(pointer_1.Pointer);
10
+ //# sourceMappingURL=any-pointer-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"any-pointer-list.js","sourceRoot":"","sources":["any-pointer-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,uCAAoC;AACpC,iDAA6C;AAEhC,QAAA,cAAc,GAAsB,0BAAW,CAAC,iBAAO,CAAC,CAAC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import { ListCtor } from "./list";
6
+ import { Pointer } from "./pointer";
7
+ import { PointerList } from "./pointer-list";
8
+
9
+ export const AnyPointerList: ListCtor<Pointer> = PointerList(Pointer);
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.d.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { _ListCtor, List } from "./list";
5
+ export declare class BoolList extends List<boolean> {
6
+ static readonly _capnp: _ListCtor;
7
+ get(index: number): boolean;
8
+ set(index: number, value: boolean): void;
9
+ toString(): string;
10
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BoolList = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const list_element_size_1 = require("../list-element-size");
10
+ const list_1 = require("./list");
11
+ const pointer_1 = require("./pointer");
12
+ const trace = debug_1.default("capnp:list:composite");
13
+ trace("load");
14
+ class BoolList extends list_1.List {
15
+ get(index) {
16
+ const bitMask = 1 << index % 8;
17
+ const byteOffset = index >>> 3;
18
+ const c = pointer_1.getContent(this);
19
+ const v = c.segment.getUint8(c.byteOffset + byteOffset);
20
+ return (v & bitMask) !== 0;
21
+ }
22
+ set(index, value) {
23
+ const bitMask = 1 << index % 8;
24
+ const c = pointer_1.getContent(this);
25
+ const byteOffset = c.byteOffset + (index >>> 3);
26
+ const v = c.segment.getUint8(byteOffset);
27
+ c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask);
28
+ }
29
+ toString() {
30
+ return `Bool_${super.toString()}`;
31
+ }
32
+ }
33
+ exports.BoolList = BoolList;
34
+ BoolList._capnp = {
35
+ displayName: "List<boolean>",
36
+ size: list_element_size_1.ListElementSize.BIT
37
+ };
38
+ //# sourceMappingURL=bool-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"bool-list.js","sourceRoot":"","sources":["bool-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAyC;AACzC,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,QAAS,SAAQ,WAAa;IAMzC,GAAG,CAAC,KAAa;QACf,MAAM,OAAO,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;QAC/B,MAAM,UAAU,GAAG,KAAK,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;QAExD,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAc;QAC/B,MAAM,OAAO,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAEzC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpC,CAAC;;AA1BH,4BA2BC;AA1BiB,eAAM,GAAc;IAClC,WAAW,EAAE,eAAyB;IACtC,IAAI,EAAE,mCAAe,CAAC,GAAG;CAC1B,CAAC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import { ListElementSize } from "../list-element-size";
8
+ import { _ListCtor, List } from "./list";
9
+ import { getContent } from "./pointer";
10
+
11
+ const trace = initTrace("capnp:list:composite");
12
+ trace("load");
13
+
14
+ export class BoolList extends List<boolean> {
15
+ static readonly _capnp: _ListCtor = {
16
+ displayName: "List<boolean>" as string,
17
+ size: ListElementSize.BIT
18
+ };
19
+
20
+ get(index: number): boolean {
21
+ const bitMask = 1 << index % 8;
22
+ const byteOffset = index >>> 3;
23
+ const c = getContent(this);
24
+ const v = c.segment.getUint8(c.byteOffset + byteOffset);
25
+
26
+ return (v & bitMask) !== 0;
27
+ }
28
+
29
+ set(index: number, value: boolean): void {
30
+ const bitMask = 1 << index % 8;
31
+ const c = getContent(this);
32
+ const byteOffset = c.byteOffset + (index >>> 3);
33
+ const v = c.segment.getUint8(byteOffset);
34
+
35
+ c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask);
36
+ }
37
+
38
+ toString(): string {
39
+ return `Bool_${super.toString()}`;
40
+ }
41
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.d.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { ListCtor } from "./list";
5
+ import { Struct, StructCtor } from "./struct";
6
+ export declare function CompositeList<T extends Struct>(CompositeClass: StructCtor<T>): ListCtor<T>;
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CompositeList = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const list_element_size_1 = require("../list-element-size");
10
+ const list_1 = require("./list");
11
+ const pointer_1 = require("./pointer");
12
+ const trace = debug_1.default("capnp:list:composite");
13
+ trace("load");
14
+ function CompositeList(CompositeClass) {
15
+ var _a;
16
+ return _a = class extends list_1.List {
17
+ get(index) {
18
+ return new CompositeClass(this.segment, this.byteOffset, this._capnp.depthLimit - 1, index);
19
+ }
20
+ set(index, value) {
21
+ pointer_1.copyFrom(value, this.get(index));
22
+ }
23
+ toString() {
24
+ return `Composite_${super.toString()},cls:${CompositeClass.toString()}`;
25
+ }
26
+ },
27
+ _a._capnp = {
28
+ compositeSize: CompositeClass._capnp.size,
29
+ displayName: `List<${CompositeClass._capnp.displayName}>`,
30
+ size: list_element_size_1.ListElementSize.COMPOSITE,
31
+ },
32
+ _a;
33
+ }
34
+ exports.CompositeList = CompositeList;
35
+ //# sourceMappingURL=composite-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"composite-list.js","sourceRoot":"","sources":["composite-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAmD;AAEnD,uCAAqC;AAErC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,SAAgB,aAAa,CAAmB,cAA6B;;IAC3E,YAAO,KAAM,SAAQ,WAAO;YAO1B,GAAG,CAAC,KAAa;gBACf,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YAC9F,CAAC;YAED,GAAG,CAAC,KAAa,EAAE,KAAQ;gBACzB,kBAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;YACnC,CAAC;YAED,QAAQ;gBACN,OAAO,aAAa,KAAK,CAAC,QAAQ,EAAE,QAAQ,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC1E,CAAC;SACF;QAjBiB,SAAM,GAAc;YAClC,aAAa,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI;YACzC,WAAW,EAAE,QAAQ,cAAc,CAAC,MAAM,CAAC,WAAW,GAAG;YACzD,IAAI,EAAE,mCAAe,CAAC,SAAS;SAC/B;WAaF;AACJ,CAAC;AApBD,sCAoBC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/composite-list.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import { ListElementSize } from "../list-element-size";
8
+ import { _ListCtor, List, ListCtor } from "./list";
9
+ import { Struct, StructCtor } from "./struct";
10
+ import { copyFrom } from "./pointer";
11
+
12
+ const trace = initTrace("capnp:list:composite");
13
+ trace("load");
14
+
15
+ export function CompositeList<T extends Struct>(CompositeClass: StructCtor<T>): ListCtor<T> {
16
+ return class extends List<T> {
17
+ static readonly _capnp: _ListCtor = {
18
+ compositeSize: CompositeClass._capnp.size,
19
+ displayName: `List<${CompositeClass._capnp.displayName}>`,
20
+ size: ListElementSize.COMPOSITE,
21
+ };
22
+
23
+ get(index: number): T {
24
+ return new CompositeClass(this.segment, this.byteOffset, this._capnp.depthLimit - 1, index);
25
+ }
26
+
27
+ set(index: number, value: T): void {
28
+ copyFrom(value, this.get(index));
29
+ }
30
+
31
+ toString(): string {
32
+ return `Composite_${super.toString()},cls:${CompositeClass.toString()}`;
33
+ }
34
+ };
35
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.d.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { Data } from "./data";
5
+ import { ListCtor } from "./list";
6
+ export declare const DataList: ListCtor<Data>;
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DataList = void 0;
7
+ const data_1 = require("./data");
8
+ const pointer_list_1 = require("./pointer-list");
9
+ exports.DataList = pointer_list_1.PointerList(data_1.Data);
10
+ //# sourceMappingURL=data-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"data-list.js","sourceRoot":"","sources":["data-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iCAA8B;AAE9B,iDAA6C;AAEhC,QAAA,QAAQ,GAAmB,0BAAW,CAAC,WAAI,CAAC,CAAC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data-list.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import { Data } from "./data";
6
+ import { ListCtor } from "./list";
7
+ import { PointerList } from "./pointer-list";
8
+
9
+ export const DataList: ListCtor<Data> = PointerList(Data);
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.d.ts ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { List } from "./list";
5
+ import { Pointer } from "./pointer";
6
+ /**
7
+ * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and
8
+ * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once.
9
+ *
10
+ * @export
11
+ * @class Data
12
+ * @extends {List<number>}
13
+ */
14
+ export declare class Data extends List<number> {
15
+ static fromPointer(pointer: Pointer): Data;
16
+ protected static _fromPointerUnchecked(pointer: Pointer): Data;
17
+ /**
18
+ * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the
19
+ * remaining bytes will be zeroed out. Extra bytes in `src` are ignored.
20
+ *
21
+ * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer.
22
+ * @returns {void}
23
+ */
24
+ copyBuffer(src: ArrayBuffer | ArrayBufferView): void;
25
+ /**
26
+ * Read a byte from the specified offset.
27
+ *
28
+ * @param {number} byteOffset The byte offset to read.
29
+ * @returns {number} The byte value.
30
+ */
31
+ get(byteOffset: number): number;
32
+ /**
33
+ * Write a byte at the specified offset.
34
+ *
35
+ * @param {number} byteOffset The byte offset to set.
36
+ * @param {number} value The byte value to set.
37
+ * @returns {void}
38
+ */
39
+ set(byteOffset: number, value: number): void;
40
+ /**
41
+ * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer.
42
+ *
43
+ * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`.
44
+ *
45
+ * @returns {ArrayBuffer} A copy of this data buffer.
46
+ */
47
+ toArrayBuffer(): ArrayBuffer;
48
+ /**
49
+ * Convert this Data pointer to a DataView representing the pointer's contents.
50
+ *
51
+ * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the
52
+ * DataView or else BAD THINGS.
53
+ *
54
+ * @returns {DataView} A live reference to the underlying buffer.
55
+ */
56
+ toDataView(): DataView;
57
+ toString(): string;
58
+ /**
59
+ * Convert this Data pointer to a Uint8Array representing the pointer's contents.
60
+ *
61
+ * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the
62
+ * Uint8Array or else BAD THINGS.
63
+ *
64
+ * @returns {DataView} A live reference to the underlying buffer.
65
+ */
66
+ toUint8Array(): Uint8Array;
67
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.js ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Data = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const list_element_size_1 = require("../list-element-size");
10
+ const list_1 = require("./list");
11
+ const pointer_1 = require("./pointer");
12
+ const pointer_type_1 = require("./pointer-type");
13
+ const trace = debug_1.default("capnp:data");
14
+ trace("load");
15
+ /**
16
+ * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and
17
+ * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once.
18
+ *
19
+ * @export
20
+ * @class Data
21
+ * @extends {List<number>}
22
+ */
23
+ class Data extends list_1.List {
24
+ static fromPointer(pointer) {
25
+ pointer_1.validate(pointer_type_1.PointerType.LIST, pointer, list_element_size_1.ListElementSize.BYTE);
26
+ return this._fromPointerUnchecked(pointer);
27
+ }
28
+ static _fromPointerUnchecked(pointer) {
29
+ return new this(pointer.segment, pointer.byteOffset, pointer._capnp.depthLimit);
30
+ }
31
+ /**
32
+ * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the
33
+ * remaining bytes will be zeroed out. Extra bytes in `src` are ignored.
34
+ *
35
+ * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer.
36
+ * @returns {void}
37
+ */
38
+ // TODO: Would be nice to have a way to zero-copy a buffer by allocating a new segment into the message with that
39
+ // buffer data.
40
+ copyBuffer(src) {
41
+ const c = pointer_1.getContent(this);
42
+ const dstLength = this.getLength();
43
+ const srcLength = src.byteLength;
44
+ const i = src instanceof ArrayBuffer
45
+ ? new Uint8Array(src)
46
+ : new Uint8Array(src.buffer, src.byteOffset, Math.min(dstLength, srcLength));
47
+ const o = new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength());
48
+ o.set(i);
49
+ if (dstLength > srcLength) {
50
+ trace("Zeroing out remaining %d bytes after copy into %s.", dstLength - srcLength, this);
51
+ o.fill(0, srcLength, dstLength);
52
+ }
53
+ else if (dstLength < srcLength) {
54
+ trace("Truncated %d bytes from source buffer while copying to %s.", srcLength - dstLength, this);
55
+ }
56
+ }
57
+ /**
58
+ * Read a byte from the specified offset.
59
+ *
60
+ * @param {number} byteOffset The byte offset to read.
61
+ * @returns {number} The byte value.
62
+ */
63
+ get(byteOffset) {
64
+ const c = pointer_1.getContent(this);
65
+ return c.segment.getUint8(c.byteOffset + byteOffset);
66
+ }
67
+ /**
68
+ * Write a byte at the specified offset.
69
+ *
70
+ * @param {number} byteOffset The byte offset to set.
71
+ * @param {number} value The byte value to set.
72
+ * @returns {void}
73
+ */
74
+ set(byteOffset, value) {
75
+ const c = pointer_1.getContent(this);
76
+ c.segment.setUint8(c.byteOffset + byteOffset, value);
77
+ }
78
+ /**
79
+ * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer.
80
+ *
81
+ * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`.
82
+ *
83
+ * @returns {ArrayBuffer} A copy of this data buffer.
84
+ */
85
+ toArrayBuffer() {
86
+ const c = pointer_1.getContent(this);
87
+ return c.segment.buffer.slice(c.byteOffset, c.byteOffset + this.getLength());
88
+ }
89
+ /**
90
+ * Convert this Data pointer to a DataView representing the pointer's contents.
91
+ *
92
+ * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the
93
+ * DataView or else BAD THINGS.
94
+ *
95
+ * @returns {DataView} A live reference to the underlying buffer.
96
+ */
97
+ toDataView() {
98
+ const c = pointer_1.getContent(this);
99
+ return new DataView(c.segment.buffer, c.byteOffset, this.getLength());
100
+ }
101
+ toString() {
102
+ return `Data_${super.toString()}`;
103
+ }
104
+ /**
105
+ * Convert this Data pointer to a Uint8Array representing the pointer's contents.
106
+ *
107
+ * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the
108
+ * Uint8Array or else BAD THINGS.
109
+ *
110
+ * @returns {DataView} A live reference to the underlying buffer.
111
+ */
112
+ toUint8Array() {
113
+ const c = pointer_1.getContent(this);
114
+ return new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength());
115
+ }
116
+ }
117
+ exports.Data = Data;
118
+ //# sourceMappingURL=data.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.js.map ADDED
@@ -0,0 +1 @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,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;OAOG;IAEH,YAAY;QACV,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAtID,oBAsIC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/data.ts ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import { ListElementSize } from "../list-element-size";
8
+ import { List } from "./list";
9
+ import { Pointer, validate, getContent } from "./pointer";
10
+ import { PointerType } from "./pointer-type";
11
+
12
+ const trace = initTrace("capnp:data");
13
+ trace("load");
14
+
15
+ /**
16
+ * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and
17
+ * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once.
18
+ *
19
+ * @export
20
+ * @class Data
21
+ * @extends {List<number>}
22
+ */
23
+
24
+ export class Data extends List<number> {
25
+ static fromPointer(pointer: Pointer): Data {
26
+ validate(PointerType.LIST, pointer, ListElementSize.BYTE);
27
+
28
+ return this._fromPointerUnchecked(pointer);
29
+ }
30
+
31
+ protected static _fromPointerUnchecked(pointer: Pointer): Data {
32
+ return new this(
33
+ pointer.segment,
34
+ pointer.byteOffset,
35
+ pointer._capnp.depthLimit
36
+ );
37
+ }
38
+
39
+ /**
40
+ * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the
41
+ * remaining bytes will be zeroed out. Extra bytes in `src` are ignored.
42
+ *
43
+ * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer.
44
+ * @returns {void}
45
+ */
46
+
47
+ // TODO: Would be nice to have a way to zero-copy a buffer by allocating a new segment into the message with that
48
+ // buffer data.
49
+
50
+ copyBuffer(src: ArrayBuffer | ArrayBufferView): void {
51
+ const c = getContent(this);
52
+
53
+ const dstLength = this.getLength();
54
+ const srcLength = src.byteLength;
55
+
56
+ const i =
57
+ src instanceof ArrayBuffer
58
+ ? new Uint8Array(src)
59
+ : new Uint8Array(
60
+ src.buffer,
61
+ src.byteOffset,
62
+ Math.min(dstLength, srcLength)
63
+ );
64
+
65
+ const o = new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength());
66
+
67
+ o.set(i);
68
+
69
+ if (dstLength > srcLength) {
70
+ trace(
71
+ "Zeroing out remaining %d bytes after copy into %s.",
72
+ dstLength - srcLength,
73
+ this
74
+ );
75
+
76
+ o.fill(0, srcLength, dstLength);
77
+ } else if (dstLength < srcLength) {
78
+ trace(
79
+ "Truncated %d bytes from source buffer while copying to %s.",
80
+ srcLength - dstLength,
81
+ this
82
+ );
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Read a byte from the specified offset.
88
+ *
89
+ * @param {number} byteOffset The byte offset to read.
90
+ * @returns {number} The byte value.
91
+ */
92
+
93
+ get(byteOffset: number): number {
94
+ const c = getContent(this);
95
+ return c.segment.getUint8(c.byteOffset + byteOffset);
96
+ }
97
+
98
+ /**
99
+ * Write a byte at the specified offset.
100
+ *
101
+ * @param {number} byteOffset The byte offset to set.
102
+ * @param {number} value The byte value to set.
103
+ * @returns {void}
104
+ */
105
+
106
+ set(byteOffset: number, value: number): void {
107
+ const c = getContent(this);
108
+ c.segment.setUint8(c.byteOffset + byteOffset, value);
109
+ }
110
+
111
+ /**
112
+ * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer.
113
+ *
114
+ * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`.
115
+ *
116
+ * @returns {ArrayBuffer} A copy of this data buffer.
117
+ */
118
+
119
+ toArrayBuffer(): ArrayBuffer {
120
+ const c = getContent(this);
121
+ return c.segment.buffer.slice(
122
+ c.byteOffset,
123
+ c.byteOffset + this.getLength()
124
+ );
125
+ }
126
+
127
+ /**
128
+ * Convert this Data pointer to a DataView representing the pointer's contents.
129
+ *
130
+ * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the
131
+ * DataView or else BAD THINGS.
132
+ *
133
+ * @returns {DataView} A live reference to the underlying buffer.
134
+ */
135
+
136
+ toDataView(): DataView {
137
+ const c = getContent(this);
138
+ return new DataView(c.segment.buffer, c.byteOffset, this.getLength());
139
+ }
140
+
141
+ toString(): string {
142
+ return `Data_${super.toString()}`;
143
+ }
144
+
145
+ /**
146
+ * Convert this Data pointer to a Uint8Array representing the pointer's contents.
147
+ *
148
+ * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the
149
+ * Uint8Array or else BAD THINGS.
150
+ *
151
+ * @returns {DataView} A live reference to the underlying buffer.
152
+ */
153
+
154
+ toUint8Array(): Uint8Array {
155
+ const c = getContent(this);
156
+ return new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength());
157
+ }
158
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.d.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { _ListCtor, List } from "./list";
5
+ export declare class Float32List extends List<number> {
6
+ static readonly _capnp: _ListCtor;
7
+ get(index: number): number;
8
+ set(index: number, value: number): void;
9
+ toString(): string;
10
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Float32List = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const list_element_size_1 = require("../list-element-size");
10
+ const list_1 = require("./list");
11
+ const pointer_1 = require("./pointer");
12
+ const trace = debug_1.default("capnp:list:composite");
13
+ trace("load");
14
+ class Float32List extends list_1.List {
15
+ get(index) {
16
+ const c = pointer_1.getContent(this);
17
+ return c.segment.getFloat32(c.byteOffset + index * 4);
18
+ }
19
+ set(index, value) {
20
+ const c = pointer_1.getContent(this);
21
+ c.segment.setFloat32(c.byteOffset + index * 4, value);
22
+ }
23
+ toString() {
24
+ return `Float32_${super.toString()}`;
25
+ }
26
+ }
27
+ exports.Float32List = Float32List;
28
+ Float32List._capnp = {
29
+ displayName: "List<Float32>",
30
+ size: list_element_size_1.ListElementSize.BYTE_4
31
+ };
32
+ //# sourceMappingURL=float32-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"float32-list.js","sourceRoot":"","sources":["float32-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAyC;AACzC,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,WAAY,SAAQ,WAAY;IAM3C,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,WAAW,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACvC,CAAC;;AApBH,kCAqBC;AApBiB,kBAAM,GAAc;IAClC,WAAW,EAAE,eAAyB;IACtC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float32-list.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import { ListElementSize } from "../list-element-size";
8
+ import { _ListCtor, List } from "./list";
9
+ import { getContent } from "./pointer";
10
+
11
+ const trace = initTrace("capnp:list:composite");
12
+ trace("load");
13
+
14
+ export class Float32List extends List<number> {
15
+ static readonly _capnp: _ListCtor = {
16
+ displayName: "List<Float32>" as string,
17
+ size: ListElementSize.BYTE_4
18
+ };
19
+
20
+ get(index: number): number {
21
+ const c = getContent(this);
22
+
23
+ return c.segment.getFloat32(c.byteOffset + index * 4);
24
+ }
25
+
26
+ set(index: number, value: number): void {
27
+ const c = getContent(this);
28
+
29
+ c.segment.setFloat32(c.byteOffset + index * 4, value);
30
+ }
31
+
32
+ toString(): string {
33
+ return `Float32_${super.toString()}`;
34
+ }
35
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.d.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ import { _ListCtor, List } from "./list";
5
+ export declare class Float64List extends List<number> {
6
+ static readonly _capnp: _ListCtor;
7
+ get(index: number): number;
8
+ set(index: number, value: number): void;
9
+ toString(): string;
10
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /**
3
+ * @author jdiaz5513
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Float64List = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const debug_1 = tslib_1.__importDefault(require("debug"));
9
+ const list_element_size_1 = require("../list-element-size");
10
+ const list_1 = require("./list");
11
+ const pointer_1 = require("./pointer");
12
+ const trace = debug_1.default("capnp:list:composite");
13
+ trace("load");
14
+ class Float64List extends list_1.List {
15
+ get(index) {
16
+ const c = pointer_1.getContent(this);
17
+ return c.segment.getFloat64(c.byteOffset + index * 8);
18
+ }
19
+ set(index, value) {
20
+ const c = pointer_1.getContent(this);
21
+ c.segment.setFloat64(c.byteOffset + index * 8, value);
22
+ }
23
+ toString() {
24
+ return `Float64_${super.toString()}`;
25
+ }
26
+ }
27
+ exports.Float64List = Float64List;
28
+ Float64List._capnp = {
29
+ displayName: "List<Float64>",
30
+ size: list_element_size_1.ListElementSize.BYTE_8
31
+ };
32
+ //# sourceMappingURL=float64-list.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"float64-list.js","sourceRoot":"","sources":["float64-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAyC;AACzC,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,WAAY,SAAQ,WAAY;IAM3C,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,WAAW,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACvC,CAAC;;AApBH,kCAqBC;AApBiB,kBAAM,GAAc;IAClC,WAAW,EAAE,eAAyB;IACtC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/float64-list.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+
5
+ import initTrace from "debug";
6
+
7
+ import { ListElementSize } from "../list-element-size";
8
+ import { _ListCtor, List } from "./list";
9
+ import { getContent } from "./pointer";
10
+
11
+ const trace = initTrace("capnp:list:composite");
12
+ trace("load");
13
+
14
+ export class Float64List extends List<number> {
15
+ static readonly _capnp: _ListCtor = {
16
+ displayName: "List<Float64>" as string,
17
+ size: ListElementSize.BYTE_8
18
+ };
19
+
20
+ get(index: number): number {
21
+ const c = getContent(this);
22
+
23
+ return c.segment.getFloat64(c.byteOffset + index * 8);
24
+ }
25
+
26
+ set(index: number, value: number): void {
27
+ const c = getContent(this);
28
+
29
+ c.segment.setFloat64(c.byteOffset + index * 8, value);
30
+ }
31
+
32
+ toString(): string {
33
+ return `Float64_${super.toString()}`;
34
+ }
35
+ }
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.d.ts ADDED
File without changes
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ "use strict";
2
+ //# sourceMappingURL=group.js.map
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["group.ts"],"names":[],"mappings":""}
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/group.ts ADDED
File without changes
workers1/auto3d/node_modules/capnp-ts/src/serialization/pointers/index.d.ts ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author jdiaz5513
3
+ */
4
+ export { AnyPointerList } from "./any-pointer-list";
5
+ export { BoolList } from "./bool-list";
6
+ export { CompositeList } from "./composite-list";
7
+ export { Data } from "./data";
8
+ export { DataList } from "./data-list";
9
+ export { Float32List } from "./float32-list";
10
+ export { Float64List } from "./float64-list";
11
+ export { Int8List } from "./int8-list";
12
+ export { Int16List } from "./int16-list";
13
+ export { Int32List } from "./int32-list";
14
+ export { Int64List } from "./int64-list";
15
+ export { Interface } from "./interface";
16
+ export { InterfaceList } from "./interface-list";
17
+ export { List, ListCtor } from "./list";
18
+ export { Orphan } from "./orphan";
19
+ export { PointerList } from "./pointer-list";
20
+ export { PointerType } from "./pointer-type";
21
+ export { Pointer } from "./pointer";
22
+ export { _StructCtor, Struct, StructCtor } from "./struct";
23
+ export { Text } from "./text";
24
+ export { TextList } from "./text-list";
25
+ export { Uint8List } from "./uint8-list";
26
+ export { Uint16List } from "./uint16-list";
27
+ export { Uint32List } from "./uint32-list";
28
+ export { Uint64List } from "./uint64-list";
29
+ export { Void, VOID } from "./void";
30
+ export { VoidList } from "./void-list";