diff options
| author | akiyamn | 2023-09-24 23:22:21 +1000 |
|---|---|---|
| committer | akiyamn | 2023-09-24 23:22:21 +1000 |
| commit | 4e87195739f2a5d9a05451b48773c8afdc680765 (patch) | |
| tree | 9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/capnp-ts | |
| download | price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip | |
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/capnp-ts')
233 files changed, 19645 insertions, 0 deletions
diff --git a/node_modules/capnp-ts/CHANGELOG.md b/node_modules/capnp-ts/CHANGELOG.md new file mode 100644 index 0000000..8bccb0a --- /dev/null +++ b/node_modules/capnp-ts/CHANGELOG.md @@ -0,0 +1,59 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +<a name="0.4.0"></a> +# [0.4.0](https://github.com/jdiaz5513/capnp-ts/compare/v0.3.1...v0.4.0) (2018-09-26) + + +### Bug Fixes + +* revert botched import paths ([#111](https://github.com/jdiaz5513/capnp-ts/issues/111)) ([e280020](https://github.com/jdiaz5513/capnp-ts/commit/e280020)) + + +### Features + +* **compiler:** add support for capnpc v0.7.0 ([#110](https://github.com/jdiaz5513/capnp-ts/issues/110)) ([22bd14d](https://github.com/jdiaz5513/capnp-ts/commit/22bd14d)) + + + + + +<a name="0.3.1"></a> +## [0.3.1](https://github.com/jdiaz5513/capnp-ts/compare/v0.3.0...v0.3.1) (2018-09-25) + + +### Bug Fixes + +* **serialization:** fix parse crash on null pointer dereference in resize ([#107](https://github.com/jdiaz5513/capnp-ts/issues/107)) ([3f8b307](https://github.com/jdiaz5513/capnp-ts/commit/3f8b307)), closes [#78](https://github.com/jdiaz5513/capnp-ts/issues/78) + + + + + +<a name="0.3.0"></a> +# [0.3.0](https://github.com/jdiaz5513/capnp-ts/compare/v0.2.4...v0.3.0) (2018-08-29) + + +### Bug Fixes + +* **build:** avoid use of debug script for capnpc build step ([#101](https://github.com/jdiaz5513/capnp-ts/issues/101)) ([f1d606a](https://github.com/jdiaz5513/capnp-ts/commit/f1d606a)) +* **serialization:** set instance variables before they may be referenced ([#106](https://github.com/jdiaz5513/capnp-ts/issues/106)) ([21deff5](https://github.com/jdiaz5513/capnp-ts/commit/21deff5)) + + +### Features + +* **compiler:** implement remaining serialization features ([#98](https://github.com/jdiaz5513/capnp-ts/issues/98)) ([524b6bd](https://github.com/jdiaz5513/capnp-ts/commit/524b6bd)) + + + + + +<a name="0.2.4"></a> +## [0.2.4](https://github.com/jdiaz5513/capnp-ts/compare/v0.2.3...v0.2.4) (2017-11-24) + + + + +**Note:** Version bump only for package capnp-ts diff --git a/node_modules/capnp-ts/README.md b/node_modules/capnp-ts/README.md new file mode 100644 index 0000000..a5c6723 --- /dev/null +++ b/node_modules/capnp-ts/README.md @@ -0,0 +1,21 @@ +# capnp-ts + +A strongly typed [Cap'n Proto](https://capnproto.org/) implementation for the browser and Node.js using TypeScript. + +Here's a quick usage example: + +```typescript +import * as capnp from 'capnp-ts'; + +import {MyStruct} from './myschema.capnp'; + +export function loadMessage(buffer: ArrayBuffer): MyStruct { + + const message = capnp.Message.fromArrayBuffer(buffer); + + return message.getRoot(MyStruct); + +} +``` + +An extended readme is available on the project site: [https://github.com/jdiaz5513/capnp-ts](https://github.com/jdiaz5513/capnp-ts). diff --git a/node_modules/capnp-ts/package.json b/node_modules/capnp-ts/package.json new file mode 100644 index 0000000..73fac9a --- /dev/null +++ b/node_modules/capnp-ts/package.json @@ -0,0 +1,26 @@ +{ + "author": "jdiaz5513", + "bugs": { + "url": "https://github.com/jdiaz5513/capnp-ts/issues" + }, + "dependencies": { + "debug": "^4.3.1", + "tslib": "^2.2.0" + }, + "description": "Strongly typed Cap'n Proto implementation for the browser and Node.js using TypeScript", + "homepage": "https://github.com/jdiaz5513/capnp-ts#readme", + "keywords": [ + "capnp", + "rpc", + "typescript" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "capnp-ts", + "repository": { + "type": "git", + "url": "git+https://github.com/jdiaz5513/capnp-ts.git" + }, + "types": "./src/index.d.ts", + "version": "0.7.0" +} diff --git a/node_modules/capnp-ts/src/constants.d.ts b/node_modules/capnp-ts/src/constants.d.ts new file mode 100644 index 0000000..b70cbbf --- /dev/null +++ b/node_modules/capnp-ts/src/constants.d.ts @@ -0,0 +1,75 @@ +/** + * @author jdiaz5513 + */ +/** Default size (in bytes) for newly allocated segments. */ +export declare const DEFAULT_BUFFER_SIZE = 4096; +export declare const DEFAULT_DECODE_LIMIT: number; +/** + * Limit to how deeply nested pointers are allowed to be. The root struct of a message will start at this value, and it + * is decremented as pointers are dereferenced. + */ +export declare const DEFAULT_DEPTH_LIMIT = 64; +/** + * Limit to the number of **bytes** that can be traversed in a single message. This is necessary to prevent certain + * classes of DoS attacks where maliciously crafted data can be self-referencing in a way that wouldn't trigger the + * depth limit. + * + * For this reason, it is advised to cache pointers into variables and not constantly dereference them since the + * message's traversal limit gets decremented each time. + */ +export declare const DEFAULT_TRAVERSE_LIMIT: number; +/** + * When allocating array buffers dynamically (while packing or in certain Arena implementations) the previous buffer's + * size is multiplied by this number to determine the next buffer's size. This is chosen to keep both time spent + * reallocating and wasted memory to a minimum. + * + * Smaller numbers would save memory at the expense of CPU time. + */ +export declare const GROWTH_FACTOR = 1.5; +/** A bitmask applied to obtain the size of a list pointer. */ +export declare const LIST_SIZE_MASK = 7; +/** Maximum number of bytes to dump at once when dumping array buffers to string. */ +export declare const MAX_BUFFER_DUMP_BYTES = 8192; +/** The maximum value for a 32-bit integer. */ +export declare const MAX_INT32 = 2147483647; +/** The maximum value for a 32-bit unsigned integer. */ +export declare const MAX_UINT32 = 4294967295; +/** The largest integer that can be precisely represented in JavaScript. */ +export declare const MAX_SAFE_INTEGER = 9007199254740991; +/** Maximum limit on the number of segments in a message stream. */ +export declare const MAX_STREAM_SEGMENTS = 512; +/** The smallest integer that can be precisely represented in JavaScript. */ +export declare const MIN_SAFE_INTEGER = -9007199254740991; +/** Minimum growth increment for a SingleSegmentArena. */ +export declare const MIN_SINGLE_SEGMENT_GROWTH = 4096; +/** + * This will be `true` if the machine running this code stores numbers natively in little-endian format. This is useful + * for some numeric type conversions when the endianness does not affect the output. Using the native endianness for + * these operations is _slightly_ faster. + */ +export declare const NATIVE_LITTLE_ENDIAN: boolean; +/** + * When packing a message, this is the number of zero bytes required after a SPAN (0xff) tag is written to the packed + * message before the span is terminated. + * + * This little detail is left up to the implementation because it can be tuned for performance. Setting this to a higher + * value may help with messages that contain a ton of text/data. + * + * It is imperative to never set this below 1 or else BAD THINGS. You have been warned. + */ +export declare const PACK_SPAN_THRESHOLD = 2; +/** + * How far to travel into a nested pointer structure during a deep copy; when this limit is exhausted the copy + * operation will throw an error. + */ +export declare const POINTER_COPY_LIMIT = 32; +/** A bitmask for looking up the double-far flag on a far pointer. */ +export declare const POINTER_DOUBLE_FAR_MASK = 4; +/** A bitmask for looking up the pointer type. */ +export declare const POINTER_TYPE_MASK = 3; +/** Used for some 64-bit conversions, equal to Math.pow(2, 32). */ +export declare const VAL32 = 4294967296; +/** The maximum value allowed for depth traversal limits. */ +export declare const MAX_DEPTH = 2147483647; +/** The maximum byte length for a single segment. */ +export declare const MAX_SEGMENT_LENGTH = 4294967295; diff --git a/node_modules/capnp-ts/src/constants.js b/node_modules/capnp-ts/src/constants.js new file mode 100644 index 0000000..90e168b --- /dev/null +++ b/node_modules/capnp-ts/src/constants.js @@ -0,0 +1,82 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MAX_SEGMENT_LENGTH = exports.MAX_DEPTH = exports.VAL32 = exports.POINTER_TYPE_MASK = exports.POINTER_DOUBLE_FAR_MASK = exports.POINTER_COPY_LIMIT = exports.PACK_SPAN_THRESHOLD = exports.NATIVE_LITTLE_ENDIAN = exports.MIN_SINGLE_SEGMENT_GROWTH = exports.MIN_SAFE_INTEGER = exports.MAX_STREAM_SEGMENTS = exports.MAX_SAFE_INTEGER = exports.MAX_UINT32 = exports.MAX_INT32 = exports.MAX_BUFFER_DUMP_BYTES = exports.LIST_SIZE_MASK = exports.GROWTH_FACTOR = exports.DEFAULT_TRAVERSE_LIMIT = exports.DEFAULT_DEPTH_LIMIT = exports.DEFAULT_DECODE_LIMIT = exports.DEFAULT_BUFFER_SIZE = void 0; +// Perform some bit gymnastics to determine the native endian format. +const tmpWord = new DataView(new ArrayBuffer(8)); +new Uint16Array(tmpWord.buffer)[0] = 0x0102; +/** Default size (in bytes) for newly allocated segments. */ +exports.DEFAULT_BUFFER_SIZE = 4096; +exports.DEFAULT_DECODE_LIMIT = 64 << 20; // 64 MiB +/** + * Limit to how deeply nested pointers are allowed to be. The root struct of a message will start at this value, and it + * is decremented as pointers are dereferenced. + */ +exports.DEFAULT_DEPTH_LIMIT = 64; +/** + * Limit to the number of **bytes** that can be traversed in a single message. This is necessary to prevent certain + * classes of DoS attacks where maliciously crafted data can be self-referencing in a way that wouldn't trigger the + * depth limit. + * + * For this reason, it is advised to cache pointers into variables and not constantly dereference them since the + * message's traversal limit gets decremented each time. + */ +exports.DEFAULT_TRAVERSE_LIMIT = 64 << 20; // 64 MiB +/** + * When allocating array buffers dynamically (while packing or in certain Arena implementations) the previous buffer's + * size is multiplied by this number to determine the next buffer's size. This is chosen to keep both time spent + * reallocating and wasted memory to a minimum. + * + * Smaller numbers would save memory at the expense of CPU time. + */ +exports.GROWTH_FACTOR = 1.5; +/** A bitmask applied to obtain the size of a list pointer. */ +exports.LIST_SIZE_MASK = 0x00000007; +/** Maximum number of bytes to dump at once when dumping array buffers to string. */ +exports.MAX_BUFFER_DUMP_BYTES = 8192; +/** The maximum value for a 32-bit integer. */ +exports.MAX_INT32 = 0x7fffffff; +/** The maximum value for a 32-bit unsigned integer. */ +exports.MAX_UINT32 = 0xffffffff; +/** The largest integer that can be precisely represented in JavaScript. */ +exports.MAX_SAFE_INTEGER = 9007199254740991; +/** Maximum limit on the number of segments in a message stream. */ +exports.MAX_STREAM_SEGMENTS = 512; +/** The smallest integer that can be precisely represented in JavaScript. */ +exports.MIN_SAFE_INTEGER = -9007199254740991; +/** Minimum growth increment for a SingleSegmentArena. */ +exports.MIN_SINGLE_SEGMENT_GROWTH = 4096; +/** + * This will be `true` if the machine running this code stores numbers natively in little-endian format. This is useful + * for some numeric type conversions when the endianness does not affect the output. Using the native endianness for + * these operations is _slightly_ faster. + */ +exports.NATIVE_LITTLE_ENDIAN = tmpWord.getUint8(0) === 0x02; +/** + * When packing a message, this is the number of zero bytes required after a SPAN (0xff) tag is written to the packed + * message before the span is terminated. + * + * This little detail is left up to the implementation because it can be tuned for performance. Setting this to a higher + * value may help with messages that contain a ton of text/data. + * + * It is imperative to never set this below 1 or else BAD THINGS. You have been warned. + */ +exports.PACK_SPAN_THRESHOLD = 2; +/** + * How far to travel into a nested pointer structure during a deep copy; when this limit is exhausted the copy + * operation will throw an error. + */ +exports.POINTER_COPY_LIMIT = 32; +/** A bitmask for looking up the double-far flag on a far pointer. */ +exports.POINTER_DOUBLE_FAR_MASK = 0x00000004; +/** A bitmask for looking up the pointer type. */ +exports.POINTER_TYPE_MASK = 0x00000003; +/** Used for some 64-bit conversions, equal to Math.pow(2, 32). */ +exports.VAL32 = 0x100000000; +/** The maximum value allowed for depth traversal limits. */ +exports.MAX_DEPTH = exports.MAX_INT32; +/** The maximum byte length for a single segment. */ +exports.MAX_SEGMENT_LENGTH = exports.MAX_UINT32; +//# sourceMappingURL=constants.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/constants.js.map b/node_modules/capnp-ts/src/constants.js.map new file mode 100644 index 0000000..6d0eb63 --- /dev/null +++ b/node_modules/capnp-ts/src/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,qEAAqE;AAErE,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC,IAAI,WA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WAAW,CAAC;AAEjC,4DAA4D;AAE/C,QAAA,SAAS,GAAG,iBAAS,CAAC;AAEnC,oDAAoD;AAEvC,QAAA,kBAAkB,GAAG,kBAAU,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/constants.ts b/node_modules/capnp-ts/src/constants.ts new file mode 100644 index 0000000..24315de --- /dev/null +++ b/node_modules/capnp-ts/src/constants.ts @@ -0,0 +1,121 @@ +/** + * @author jdiaz5513 + */ + +// Perform some bit gymnastics to determine the native endian format. + +const tmpWord = new DataView(new ArrayBuffer(8)); +new Uint16Array(tmpWord.buffer)[0] = 0x0102; + +/** Default size (in bytes) for newly allocated segments. */ + +export const DEFAULT_BUFFER_SIZE = 4096; + +export const DEFAULT_DECODE_LIMIT = 64 << 20; // 64 MiB + +/** + * Limit to how deeply nested pointers are allowed to be. The root struct of a message will start at this value, and it + * is decremented as pointers are dereferenced. + */ + +export const DEFAULT_DEPTH_LIMIT = 64; + +/** + * Limit to the number of **bytes** that can be traversed in a single message. This is necessary to prevent certain + * classes of DoS attacks where maliciously crafted data can be self-referencing in a way that wouldn't trigger the + * depth limit. + * + * For this reason, it is advised to cache pointers into variables and not constantly dereference them since the + * message's traversal limit gets decremented each time. + */ + +export const DEFAULT_TRAVERSE_LIMIT = 64 << 20; // 64 MiB + +/** + * When allocating array buffers dynamically (while packing or in certain Arena implementations) the previous buffer's + * size is multiplied by this number to determine the next buffer's size. This is chosen to keep both time spent + * reallocating and wasted memory to a minimum. + * + * Smaller numbers would save memory at the expense of CPU time. + */ + +export const GROWTH_FACTOR = 1.5; + +/** A bitmask applied to obtain the size of a list pointer. */ + +export const LIST_SIZE_MASK = 0x00000007; + +/** Maximum number of bytes to dump at once when dumping array buffers to string. */ + +export const MAX_BUFFER_DUMP_BYTES = 8192; + +/** The maximum value for a 32-bit integer. */ + +export const MAX_INT32 = 0x7fffffff; + +/** The maximum value for a 32-bit unsigned integer. */ + +export const MAX_UINT32 = 0xffffffff; + +/** The largest integer that can be precisely represented in JavaScript. */ + +export const MAX_SAFE_INTEGER = 9007199254740991; + +/** Maximum limit on the number of segments in a message stream. */ + +export const MAX_STREAM_SEGMENTS = 512; + +/** The smallest integer that can be precisely represented in JavaScript. */ + +export const MIN_SAFE_INTEGER = -9007199254740991; + +/** Minimum growth increment for a SingleSegmentArena. */ + +export const MIN_SINGLE_SEGMENT_GROWTH = 4096; + +/** + * This will be `true` if the machine running this code stores numbers natively in little-endian format. This is useful + * for some numeric type conversions when the endianness does not affect the output. Using the native endianness for + * these operations is _slightly_ faster. + */ + +export const NATIVE_LITTLE_ENDIAN = tmpWord.getUint8(0) === 0x02; + +/** + * When packing a message, this is the number of zero bytes required after a SPAN (0xff) tag is written to the packed + * message before the span is terminated. + * + * This little detail is left up to the implementation because it can be tuned for performance. Setting this to a higher + * value may help with messages that contain a ton of text/data. + * + * It is imperative to never set this below 1 or else BAD THINGS. You have been warned. + */ + +export const PACK_SPAN_THRESHOLD = 2; + +/** + * How far to travel into a nested pointer structure during a deep copy; when this limit is exhausted the copy + * operation will throw an error. + */ + +export const POINTER_COPY_LIMIT = 32; + +/** A bitmask for looking up the double-far flag on a far pointer. */ + +export const POINTER_DOUBLE_FAR_MASK = 0x00000004; + +/** A bitmask for looking up the pointer type. */ + +export const POINTER_TYPE_MASK = 0x00000003; + +/** Used for some 64-bit conversions, equal to Math.pow(2, 32). */ + +export const VAL32 = 0x100000000; + +/** The maximum value allowed for depth traversal limits. */ + +export const MAX_DEPTH = MAX_INT32; + +/** The maximum byte length for a single segment. */ + +export const MAX_SEGMENT_LENGTH = MAX_UINT32; diff --git a/node_modules/capnp-ts/src/errors.d.ts b/node_modules/capnp-ts/src/errors.d.ts new file mode 100644 index 0000000..d8dcefc --- /dev/null +++ b/node_modules/capnp-ts/src/errors.d.ts @@ -0,0 +1,51 @@ +/** + * This file contains all the error strings used in the library. Also contains silliness. + * + * @author jdiaz5513 + */ +export declare const INVARIANT_UNREACHABLE_CODE = "CAPNP-TS000 Unreachable code detected."; +export declare function assertNever(n: never): never; +export declare const MSG_INVALID_FRAME_HEADER = "CAPNP-TS001 Attempted to parse an invalid message frame header; are you sure this is a Cap'n Proto message?"; +export declare const MSG_NO_SEGMENTS_IN_ARENA = "CAPNP-TS002 Attempted to preallocate a message with no segments in the arena."; +export declare const MSG_PACK_NOT_WORD_ALIGNED = "CAPNP-TS003 Attempted to pack a message that was not word-aligned."; +export declare const MSG_SEGMENT_OUT_OF_BOUNDS = "CAPNP-TS004 Segment ID %X is out of bounds for message %s."; +export declare const MSG_SEGMENT_TOO_SMALL = "CAPNP-TS005 First segment must have at least enough room to hold the root pointer (8 bytes)."; +export declare const NOT_IMPLEMENTED = "CAPNP-TS006 %s is not implemented."; +export declare const PTR_ADOPT_COMPOSITE_STRUCT = "CAPNP-TS007 Attempted to adopt a struct into a composite list (%s)."; +export declare const PTR_ADOPT_WRONG_MESSAGE = "CAPNP-TS008 Attempted to adopt %s into a pointer in a different message %s."; +export declare const PTR_ALREADY_ADOPTED = "CAPNP-TS009 Attempted to adopt %s more than once."; +export declare const PTR_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS010 Attempted to set a composite list without providing a composite element size."; +export declare const PTR_DEPTH_LIMIT_EXCEEDED = "CAPNP-TS011 Nesting depth limit exceeded for %s."; +export declare const PTR_DISOWN_COMPOSITE_STRUCT = "CAPNP-TS012 Attempted to disown a struct member from a composite list (%s)."; +export declare const PTR_INIT_COMPOSITE_STRUCT = "CAPNP-TS013 Attempted to initialize a struct member from a composite list (%s)."; +export declare const PTR_INIT_NON_GROUP = "CAPNP-TS014 Attempted to initialize a group field with a non-group struct class."; +export declare const PTR_INVALID_FAR_TARGET = "CAPNP-TS015 Target of a far pointer (%s) is another far pointer."; +export declare const PTR_INVALID_LIST_SIZE = "CAPNP-TS016 Invalid list element size: %x."; +export declare const PTR_INVALID_POINTER_TYPE = "CAPNP-TS017 Invalid pointer type: %x."; +export declare const PTR_INVALID_UNION_ACCESS = "CAPNP-TS018 Attempted to access getter on %s for union field %s that is not currently set (wanted: %d, found: %d)."; +export declare const PTR_OFFSET_OUT_OF_BOUNDS = "CAPNP-TS019 Pointer offset %a is out of bounds for underlying buffer."; +export declare const PTR_STRUCT_DATA_OUT_OF_BOUNDS = "CAPNP-TS020 Attempted to access out-of-bounds struct data (struct: %s, %d bytes at %a, data words: %d)."; +export declare const PTR_STRUCT_POINTER_OUT_OF_BOUNDS = "CAPNP-TS021 Attempted to access out-of-bounds struct pointer (%s, index: %d, length: %d)."; +export declare const PTR_TRAVERSAL_LIMIT_EXCEEDED = "CAPNP-TS022 Traversal limit exceeded! Slow down! %s"; +export declare const PTR_WRONG_LIST_TYPE = "CAPNP-TS023 Cannot convert %s to a %s list."; +export declare const PTR_WRONG_POINTER_TYPE = "CAPNP-TS024 Attempted to convert pointer %s to a %s type."; +export declare const PTR_WRONG_COMPOSITE_DATA_SIZE = "CAPNP-TS025 Attempted to convert %s to a composite list with the wrong data size (found: %d)."; +export declare const PTR_WRONG_COMPOSITE_PTR_SIZE = "CAPNP-TS026 Attempted to convert %s to a composite list with the wrong pointer size (found: %d)."; +export declare const PTR_WRONG_STRUCT_DATA_SIZE = "CAPNP-TS027 Attempted to convert %s to a struct with the wrong data size (found: %d)."; +export declare const PTR_WRONG_STRUCT_PTR_SIZE = "CAPNP-TS028 Attempted to convert %s to a struct with the wrong pointer size (found: %d)."; +export declare const RANGE_INT32_OVERFLOW = "CAPNP-TS029 32-bit signed integer overflow detected."; +export declare const RANGE_INT64_UNDERFLOW = "CAPNP-TS030 Buffer is not large enough to hold a word."; +export declare const RANGE_INVALID_UTF8 = "CAPNP-TS031 Invalid UTF-8 code sequence detected."; +export declare const RANGE_SIZE_OVERFLOW: string; +export declare const RANGE_UINT32_OVERFLOW = "CAPNP-TS033 32-bit unsigned integer overflow detected."; +export declare const SEG_BUFFER_NOT_ALLOCATED = "CAPNP-TS034 allocate() needs to be called at least once before getting a buffer."; +export declare const SEG_GET_NON_ZERO_SINGLE = "CAPNP-TS035 Attempted to get a segment other than 0 (%d) from a single segment arena."; +export declare const SEG_ID_OUT_OF_BOUNDS = "CAPNP-TS036 Attempted to get an out-of-bounds segment (%d)."; +export declare const SEG_NOT_WORD_ALIGNED = "CAPNP-TS037 Segment buffer length %d is not a multiple of 8."; +export declare const SEG_REPLACEMENT_BUFFER_TOO_SMALL = "CAPNP-TS038 Attempted to replace a segment buffer with one that is smaller than the allocated space."; +export declare const SEG_SIZE_OVERFLOW: string; +export declare const TYPE_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS040 Must provide a composite element size for composite list pointers."; +export declare const TYPE_GET_GENERIC_LIST = "CAPNP-TS041 Attempted to call get() on a generic list."; +export declare const TYPE_SET_GENERIC_LIST = "CAPNP-TS042 Attempted to call set() on a generic list."; +export declare const PTR_WRITE_CONST_LIST = "CAPNP-TS043 Attempted to write to a const list."; +export declare const PTR_WRITE_CONST_STRUCT = "CAPNP-TS044 Attempted to write to a const struct."; diff --git a/node_modules/capnp-ts/src/errors.js b/node_modules/capnp-ts/src/errors.js new file mode 100644 index 0000000..348d3ad --- /dev/null +++ b/node_modules/capnp-ts/src/errors.js @@ -0,0 +1,86 @@ +"use strict"; +/** + * This file contains all the error strings used in the library. Also contains silliness. + * + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PTR_WRITE_CONST_STRUCT = exports.PTR_WRITE_CONST_LIST = exports.TYPE_SET_GENERIC_LIST = exports.TYPE_GET_GENERIC_LIST = exports.TYPE_COMPOSITE_SIZE_UNDEFINED = exports.SEG_SIZE_OVERFLOW = exports.SEG_REPLACEMENT_BUFFER_TOO_SMALL = exports.SEG_NOT_WORD_ALIGNED = exports.SEG_ID_OUT_OF_BOUNDS = exports.SEG_GET_NON_ZERO_SINGLE = exports.SEG_BUFFER_NOT_ALLOCATED = exports.RANGE_UINT32_OVERFLOW = exports.RANGE_SIZE_OVERFLOW = exports.RANGE_INVALID_UTF8 = exports.RANGE_INT64_UNDERFLOW = exports.RANGE_INT32_OVERFLOW = exports.PTR_WRONG_STRUCT_PTR_SIZE = exports.PTR_WRONG_STRUCT_DATA_SIZE = exports.PTR_WRONG_COMPOSITE_PTR_SIZE = exports.PTR_WRONG_COMPOSITE_DATA_SIZE = exports.PTR_WRONG_POINTER_TYPE = exports.PTR_WRONG_LIST_TYPE = exports.PTR_TRAVERSAL_LIMIT_EXCEEDED = exports.PTR_STRUCT_POINTER_OUT_OF_BOUNDS = exports.PTR_STRUCT_DATA_OUT_OF_BOUNDS = exports.PTR_OFFSET_OUT_OF_BOUNDS = exports.PTR_INVALID_UNION_ACCESS = exports.PTR_INVALID_POINTER_TYPE = exports.PTR_INVALID_LIST_SIZE = exports.PTR_INVALID_FAR_TARGET = exports.PTR_INIT_NON_GROUP = exports.PTR_INIT_COMPOSITE_STRUCT = exports.PTR_DISOWN_COMPOSITE_STRUCT = exports.PTR_DEPTH_LIMIT_EXCEEDED = exports.PTR_COMPOSITE_SIZE_UNDEFINED = exports.PTR_ALREADY_ADOPTED = exports.PTR_ADOPT_WRONG_MESSAGE = exports.PTR_ADOPT_COMPOSITE_STRUCT = exports.NOT_IMPLEMENTED = exports.MSG_SEGMENT_TOO_SMALL = exports.MSG_SEGMENT_OUT_OF_BOUNDS = exports.MSG_PACK_NOT_WORD_ALIGNED = exports.MSG_NO_SEGMENTS_IN_ARENA = exports.MSG_INVALID_FRAME_HEADER = exports.assertNever = exports.INVARIANT_UNREACHABLE_CODE = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("./constants"); +const trace = debug_1.default("capnp:errors"); +trace("load"); +// Invariant violations (sometimes known as "precondition failed"). +// +// All right, hold up the brakes. This is a serious 1 === 0 WHAT THE FAILURE moment here. Tell the SO's you won't be +// home for dinner. +exports.INVARIANT_UNREACHABLE_CODE = "CAPNP-TS000 Unreachable code detected."; +function assertNever(n) { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + throw new Error(exports.INVARIANT_UNREACHABLE_CODE + ` (never block hit with: ${n})`); +} +exports.assertNever = assertNever; +// Message errors. +// +// Now who told you it would be a good idea to fuzz the inputs? You just made the program sad. +exports.MSG_INVALID_FRAME_HEADER = "CAPNP-TS001 Attempted to parse an invalid message frame header; are you sure this is a Cap'n Proto message?"; +exports.MSG_NO_SEGMENTS_IN_ARENA = "CAPNP-TS002 Attempted to preallocate a message with no segments in the arena."; +exports.MSG_PACK_NOT_WORD_ALIGNED = "CAPNP-TS003 Attempted to pack a message that was not word-aligned."; +exports.MSG_SEGMENT_OUT_OF_BOUNDS = "CAPNP-TS004 Segment ID %X is out of bounds for message %s."; +exports.MSG_SEGMENT_TOO_SMALL = "CAPNP-TS005 First segment must have at least enough room to hold the root pointer (8 bytes)."; +// Used for methods that are not yet implemented. +// +// My bad. I'll get to it. Eventually. +exports.NOT_IMPLEMENTED = "CAPNP-TS006 %s is not implemented."; +// Pointer-related errors. +// +// Look, this is probably the hardest part of the code. Cut some slack here! You probably found a bug. +exports.PTR_ADOPT_COMPOSITE_STRUCT = "CAPNP-TS007 Attempted to adopt a struct into a composite list (%s)."; +exports.PTR_ADOPT_WRONG_MESSAGE = "CAPNP-TS008 Attempted to adopt %s into a pointer in a different message %s."; +exports.PTR_ALREADY_ADOPTED = "CAPNP-TS009 Attempted to adopt %s more than once."; +exports.PTR_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS010 Attempted to set a composite list without providing a composite element size."; +exports.PTR_DEPTH_LIMIT_EXCEEDED = "CAPNP-TS011 Nesting depth limit exceeded for %s."; +exports.PTR_DISOWN_COMPOSITE_STRUCT = "CAPNP-TS012 Attempted to disown a struct member from a composite list (%s)."; +exports.PTR_INIT_COMPOSITE_STRUCT = "CAPNP-TS013 Attempted to initialize a struct member from a composite list (%s)."; +exports.PTR_INIT_NON_GROUP = "CAPNP-TS014 Attempted to initialize a group field with a non-group struct class."; +exports.PTR_INVALID_FAR_TARGET = "CAPNP-TS015 Target of a far pointer (%s) is another far pointer."; +exports.PTR_INVALID_LIST_SIZE = "CAPNP-TS016 Invalid list element size: %x."; +exports.PTR_INVALID_POINTER_TYPE = "CAPNP-TS017 Invalid pointer type: %x."; +exports.PTR_INVALID_UNION_ACCESS = "CAPNP-TS018 Attempted to access getter on %s for union field %s that is not currently set (wanted: %d, found: %d)."; +exports.PTR_OFFSET_OUT_OF_BOUNDS = "CAPNP-TS019 Pointer offset %a is out of bounds for underlying buffer."; +exports.PTR_STRUCT_DATA_OUT_OF_BOUNDS = "CAPNP-TS020 Attempted to access out-of-bounds struct data (struct: %s, %d bytes at %a, data words: %d)."; +exports.PTR_STRUCT_POINTER_OUT_OF_BOUNDS = "CAPNP-TS021 Attempted to access out-of-bounds struct pointer (%s, index: %d, length: %d)."; +exports.PTR_TRAVERSAL_LIMIT_EXCEEDED = "CAPNP-TS022 Traversal limit exceeded! Slow down! %s"; +exports.PTR_WRONG_LIST_TYPE = "CAPNP-TS023 Cannot convert %s to a %s list."; +exports.PTR_WRONG_POINTER_TYPE = "CAPNP-TS024 Attempted to convert pointer %s to a %s type."; +exports.PTR_WRONG_COMPOSITE_DATA_SIZE = "CAPNP-TS025 Attempted to convert %s to a composite list with the wrong data size (found: %d)."; +exports.PTR_WRONG_COMPOSITE_PTR_SIZE = "CAPNP-TS026 Attempted to convert %s to a composite list with the wrong pointer size (found: %d)."; +exports.PTR_WRONG_STRUCT_DATA_SIZE = "CAPNP-TS027 Attempted to convert %s to a struct with the wrong data size (found: %d)."; +exports.PTR_WRONG_STRUCT_PTR_SIZE = "CAPNP-TS028 Attempted to convert %s to a struct with the wrong pointer size (found: %d)."; +// Custom error messages for the built-in `RangeError` class. +// +// You don't get a witty comment with these. +exports.RANGE_INT32_OVERFLOW = "CAPNP-TS029 32-bit signed integer overflow detected."; +exports.RANGE_INT64_UNDERFLOW = "CAPNP-TS030 Buffer is not large enough to hold a word."; +exports.RANGE_INVALID_UTF8 = "CAPNP-TS031 Invalid UTF-8 code sequence detected."; +exports.RANGE_SIZE_OVERFLOW = `CAPNP-TS032 Size %x exceeds maximum ${constants_1.MAX_SEGMENT_LENGTH.toString(16)}.`; +exports.RANGE_UINT32_OVERFLOW = "CAPNP-TS033 32-bit unsigned integer overflow detected."; +// Segment-related errors. +// +// These suck. Deal with it. +exports.SEG_BUFFER_NOT_ALLOCATED = "CAPNP-TS034 allocate() needs to be called at least once before getting a buffer."; +exports.SEG_GET_NON_ZERO_SINGLE = "CAPNP-TS035 Attempted to get a segment other than 0 (%d) from a single segment arena."; +exports.SEG_ID_OUT_OF_BOUNDS = "CAPNP-TS036 Attempted to get an out-of-bounds segment (%d)."; +exports.SEG_NOT_WORD_ALIGNED = "CAPNP-TS037 Segment buffer length %d is not a multiple of 8."; +exports.SEG_REPLACEMENT_BUFFER_TOO_SMALL = "CAPNP-TS038 Attempted to replace a segment buffer with one that is smaller than the allocated space."; +exports.SEG_SIZE_OVERFLOW = `CAPNP-TS039 Requested size %x exceeds maximum value (${constants_1.MAX_SEGMENT_LENGTH}).`; +// Custom error messages for the built-in `TypeError` class. +// +// If it looks like a duck, quacks like an elephant, and has hooves for feet, it's probably JavaScript. +exports.TYPE_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS040 Must provide a composite element size for composite list pointers."; +exports.TYPE_GET_GENERIC_LIST = "CAPNP-TS041 Attempted to call get() on a generic list."; +exports.TYPE_SET_GENERIC_LIST = "CAPNP-TS042 Attempted to call set() on a generic list."; +exports.PTR_WRITE_CONST_LIST = "CAPNP-TS043 Attempted to write to a const list."; +exports.PTR_WRITE_CONST_STRUCT = "CAPNP-TS044 Attempted to write to a const struct."; +//# sourceMappingURL=errors.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/errors.js.map b/node_modules/capnp-ts/src/errors.js.map new file mode 100644 index 0000000..74a463d --- /dev/null +++ b/node_modules/capnp-ts/src/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["errors.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,0DAA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GAAG,mDAAmD,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/errors.ts b/node_modules/capnp-ts/src/errors.ts new file mode 100644 index 0000000..3fce404 --- /dev/null +++ b/node_modules/capnp-ts/src/errors.ts @@ -0,0 +1,115 @@ +/** + * This file contains all the error strings used in the library. Also contains silliness. + * + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { MAX_SEGMENT_LENGTH } from "./constants"; + +const trace = initTrace("capnp:errors"); +trace("load"); + +// Invariant violations (sometimes known as "precondition failed"). +// +// All right, hold up the brakes. This is a serious 1 === 0 WHAT THE FAILURE moment here. Tell the SO's you won't be +// home for dinner. + +export const INVARIANT_UNREACHABLE_CODE = "CAPNP-TS000 Unreachable code detected."; + +export function assertNever(n: never): never { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + throw new Error(INVARIANT_UNREACHABLE_CODE + ` (never block hit with: ${n})`); +} + +// Message errors. +// +// Now who told you it would be a good idea to fuzz the inputs? You just made the program sad. + +export const MSG_INVALID_FRAME_HEADER = + "CAPNP-TS001 Attempted to parse an invalid message frame header; are you sure this is a Cap'n Proto message?"; +export const MSG_NO_SEGMENTS_IN_ARENA = "CAPNP-TS002 Attempted to preallocate a message with no segments in the arena."; +export const MSG_PACK_NOT_WORD_ALIGNED = "CAPNP-TS003 Attempted to pack a message that was not word-aligned."; +export const MSG_SEGMENT_OUT_OF_BOUNDS = "CAPNP-TS004 Segment ID %X is out of bounds for message %s."; +export const MSG_SEGMENT_TOO_SMALL = + "CAPNP-TS005 First segment must have at least enough room to hold the root pointer (8 bytes)."; + +// Used for methods that are not yet implemented. +// +// My bad. I'll get to it. Eventually. + +export const NOT_IMPLEMENTED = "CAPNP-TS006 %s is not implemented."; + +// Pointer-related errors. +// +// Look, this is probably the hardest part of the code. Cut some slack here! You probably found a bug. + +export const PTR_ADOPT_COMPOSITE_STRUCT = "CAPNP-TS007 Attempted to adopt a struct into a composite list (%s)."; +export const PTR_ADOPT_WRONG_MESSAGE = "CAPNP-TS008 Attempted to adopt %s into a pointer in a different message %s."; +export const PTR_ALREADY_ADOPTED = "CAPNP-TS009 Attempted to adopt %s more than once."; +export const PTR_COMPOSITE_SIZE_UNDEFINED = + "CAPNP-TS010 Attempted to set a composite list without providing a composite element size."; +export const PTR_DEPTH_LIMIT_EXCEEDED = "CAPNP-TS011 Nesting depth limit exceeded for %s."; +export const PTR_DISOWN_COMPOSITE_STRUCT = + "CAPNP-TS012 Attempted to disown a struct member from a composite list (%s)."; +export const PTR_INIT_COMPOSITE_STRUCT = + "CAPNP-TS013 Attempted to initialize a struct member from a composite list (%s)."; +export const PTR_INIT_NON_GROUP = "CAPNP-TS014 Attempted to initialize a group field with a non-group struct class."; +export const PTR_INVALID_FAR_TARGET = "CAPNP-TS015 Target of a far pointer (%s) is another far pointer."; +export const PTR_INVALID_LIST_SIZE = "CAPNP-TS016 Invalid list element size: %x."; +export const PTR_INVALID_POINTER_TYPE = "CAPNP-TS017 Invalid pointer type: %x."; +export const PTR_INVALID_UNION_ACCESS = + "CAPNP-TS018 Attempted to access getter on %s for union field %s that is not currently set (wanted: %d, found: %d)."; +export const PTR_OFFSET_OUT_OF_BOUNDS = "CAPNP-TS019 Pointer offset %a is out of bounds for underlying buffer."; +export const PTR_STRUCT_DATA_OUT_OF_BOUNDS = + "CAPNP-TS020 Attempted to access out-of-bounds struct data (struct: %s, %d bytes at %a, data words: %d)."; +export const PTR_STRUCT_POINTER_OUT_OF_BOUNDS = + "CAPNP-TS021 Attempted to access out-of-bounds struct pointer (%s, index: %d, length: %d)."; +export const PTR_TRAVERSAL_LIMIT_EXCEEDED = "CAPNP-TS022 Traversal limit exceeded! Slow down! %s"; +export const PTR_WRONG_LIST_TYPE = "CAPNP-TS023 Cannot convert %s to a %s list."; +export const PTR_WRONG_POINTER_TYPE = "CAPNP-TS024 Attempted to convert pointer %s to a %s type."; +export const PTR_WRONG_COMPOSITE_DATA_SIZE = + "CAPNP-TS025 Attempted to convert %s to a composite list with the wrong data size (found: %d)."; +export const PTR_WRONG_COMPOSITE_PTR_SIZE = + "CAPNP-TS026 Attempted to convert %s to a composite list with the wrong pointer size (found: %d)."; +export const PTR_WRONG_STRUCT_DATA_SIZE = + "CAPNP-TS027 Attempted to convert %s to a struct with the wrong data size (found: %d)."; +export const PTR_WRONG_STRUCT_PTR_SIZE = + "CAPNP-TS028 Attempted to convert %s to a struct with the wrong pointer size (found: %d)."; + +// Custom error messages for the built-in `RangeError` class. +// +// You don't get a witty comment with these. + +export const RANGE_INT32_OVERFLOW = "CAPNP-TS029 32-bit signed integer overflow detected."; +export const RANGE_INT64_UNDERFLOW = "CAPNP-TS030 Buffer is not large enough to hold a word."; +export const RANGE_INVALID_UTF8 = "CAPNP-TS031 Invalid UTF-8 code sequence detected."; +export const RANGE_SIZE_OVERFLOW = `CAPNP-TS032 Size %x exceeds maximum ${MAX_SEGMENT_LENGTH.toString(16)}.`; +export const RANGE_UINT32_OVERFLOW = "CAPNP-TS033 32-bit unsigned integer overflow detected."; + +// Segment-related errors. +// +// These suck. Deal with it. + +export const SEG_BUFFER_NOT_ALLOCATED = + "CAPNP-TS034 allocate() needs to be called at least once before getting a buffer."; +export const SEG_GET_NON_ZERO_SINGLE = + "CAPNP-TS035 Attempted to get a segment other than 0 (%d) from a single segment arena."; +export const SEG_ID_OUT_OF_BOUNDS = "CAPNP-TS036 Attempted to get an out-of-bounds segment (%d)."; +export const SEG_NOT_WORD_ALIGNED = "CAPNP-TS037 Segment buffer length %d is not a multiple of 8."; +export const SEG_REPLACEMENT_BUFFER_TOO_SMALL = + "CAPNP-TS038 Attempted to replace a segment buffer with one that is smaller than the allocated space."; +export const SEG_SIZE_OVERFLOW = `CAPNP-TS039 Requested size %x exceeds maximum value (${MAX_SEGMENT_LENGTH}).`; + +// Custom error messages for the built-in `TypeError` class. +// +// If it looks like a duck, quacks like an elephant, and has hooves for feet, it's probably JavaScript. + +export const TYPE_COMPOSITE_SIZE_UNDEFINED = + "CAPNP-TS040 Must provide a composite element size for composite list pointers."; +export const TYPE_GET_GENERIC_LIST = "CAPNP-TS041 Attempted to call get() on a generic list."; +export const TYPE_SET_GENERIC_LIST = "CAPNP-TS042 Attempted to call set() on a generic list."; + +export const PTR_WRITE_CONST_LIST = "CAPNP-TS043 Attempted to write to a const list."; +export const PTR_WRITE_CONST_STRUCT = "CAPNP-TS044 Attempted to write to a const struct."; diff --git a/node_modules/capnp-ts/src/index.d.ts b/node_modules/capnp-ts/src/index.d.ts new file mode 100644 index 0000000..5795ab4 --- /dev/null +++ b/node_modules/capnp-ts/src/index.d.ts @@ -0,0 +1,5 @@ +/** + * @author jdiaz5513 + */ +export { ListElementSize, Message, ObjectSize, readRawPointer, AnyPointerList, BoolList, CompositeList, Data, DataList, Float32List, Float64List, Int16List, Int32List, Int64List, Int8List, Interface, InterfaceList, List, ListCtor, Orphan, PointerList, PointerType, Pointer, Struct, StructCtor, Text, TextList, Uint16List, Uint32List, Uint64List, Uint8List, VoidList, Void, getBitMask, getFloat32Mask, getFloat64Mask, getInt16Mask, getInt32Mask, getInt64Mask, getInt8Mask, getUint16Mask, getUint32Mask, getUint64Mask, getUint8Mask, } from "./serialization"; +export { Int64, Uint64 } from "./types"; diff --git a/node_modules/capnp-ts/src/index.js b/node_modules/capnp-ts/src/index.js new file mode 100644 index 0000000..6cedf60 --- /dev/null +++ b/node_modules/capnp-ts/src/index.js @@ -0,0 +1,53 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint64 = exports.Int64 = exports.getUint8Mask = exports.getUint64Mask = exports.getUint32Mask = exports.getUint16Mask = exports.getInt8Mask = exports.getInt64Mask = exports.getInt32Mask = exports.getInt16Mask = exports.getFloat64Mask = exports.getFloat32Mask = exports.getBitMask = exports.Void = exports.VoidList = exports.Uint8List = exports.Uint64List = exports.Uint32List = exports.Uint16List = exports.TextList = exports.Text = exports.Struct = exports.Pointer = exports.PointerType = exports.PointerList = exports.Orphan = exports.List = exports.InterfaceList = exports.Interface = exports.Int8List = exports.Int64List = exports.Int32List = exports.Int16List = exports.Float64List = exports.Float32List = exports.DataList = exports.Data = exports.CompositeList = exports.BoolList = exports.AnyPointerList = exports.readRawPointer = exports.ObjectSize = exports.Message = exports.ListElementSize = void 0; +var serialization_1 = require("./serialization"); +Object.defineProperty(exports, "ListElementSize", { enumerable: true, get: function () { return serialization_1.ListElementSize; } }); +Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return serialization_1.Message; } }); +Object.defineProperty(exports, "ObjectSize", { enumerable: true, get: function () { return serialization_1.ObjectSize; } }); +Object.defineProperty(exports, "readRawPointer", { enumerable: true, get: function () { return serialization_1.readRawPointer; } }); +Object.defineProperty(exports, "AnyPointerList", { enumerable: true, get: function () { return serialization_1.AnyPointerList; } }); +Object.defineProperty(exports, "BoolList", { enumerable: true, get: function () { return serialization_1.BoolList; } }); +Object.defineProperty(exports, "CompositeList", { enumerable: true, get: function () { return serialization_1.CompositeList; } }); +Object.defineProperty(exports, "Data", { enumerable: true, get: function () { return serialization_1.Data; } }); +Object.defineProperty(exports, "DataList", { enumerable: true, get: function () { return serialization_1.DataList; } }); +Object.defineProperty(exports, "Float32List", { enumerable: true, get: function () { return serialization_1.Float32List; } }); +Object.defineProperty(exports, "Float64List", { enumerable: true, get: function () { return serialization_1.Float64List; } }); +Object.defineProperty(exports, "Int16List", { enumerable: true, get: function () { return serialization_1.Int16List; } }); +Object.defineProperty(exports, "Int32List", { enumerable: true, get: function () { return serialization_1.Int32List; } }); +Object.defineProperty(exports, "Int64List", { enumerable: true, get: function () { return serialization_1.Int64List; } }); +Object.defineProperty(exports, "Int8List", { enumerable: true, get: function () { return serialization_1.Int8List; } }); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return serialization_1.Interface; } }); +Object.defineProperty(exports, "InterfaceList", { enumerable: true, get: function () { return serialization_1.InterfaceList; } }); +Object.defineProperty(exports, "List", { enumerable: true, get: function () { return serialization_1.List; } }); +Object.defineProperty(exports, "Orphan", { enumerable: true, get: function () { return serialization_1.Orphan; } }); +Object.defineProperty(exports, "PointerList", { enumerable: true, get: function () { return serialization_1.PointerList; } }); +Object.defineProperty(exports, "PointerType", { enumerable: true, get: function () { return serialization_1.PointerType; } }); +Object.defineProperty(exports, "Pointer", { enumerable: true, get: function () { return serialization_1.Pointer; } }); +Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return serialization_1.Struct; } }); +Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return serialization_1.Text; } }); +Object.defineProperty(exports, "TextList", { enumerable: true, get: function () { return serialization_1.TextList; } }); +Object.defineProperty(exports, "Uint16List", { enumerable: true, get: function () { return serialization_1.Uint16List; } }); +Object.defineProperty(exports, "Uint32List", { enumerable: true, get: function () { return serialization_1.Uint32List; } }); +Object.defineProperty(exports, "Uint64List", { enumerable: true, get: function () { return serialization_1.Uint64List; } }); +Object.defineProperty(exports, "Uint8List", { enumerable: true, get: function () { return serialization_1.Uint8List; } }); +Object.defineProperty(exports, "VoidList", { enumerable: true, get: function () { return serialization_1.VoidList; } }); +Object.defineProperty(exports, "Void", { enumerable: true, get: function () { return serialization_1.Void; } }); +Object.defineProperty(exports, "getBitMask", { enumerable: true, get: function () { return serialization_1.getBitMask; } }); +Object.defineProperty(exports, "getFloat32Mask", { enumerable: true, get: function () { return serialization_1.getFloat32Mask; } }); +Object.defineProperty(exports, "getFloat64Mask", { enumerable: true, get: function () { return serialization_1.getFloat64Mask; } }); +Object.defineProperty(exports, "getInt16Mask", { enumerable: true, get: function () { return serialization_1.getInt16Mask; } }); +Object.defineProperty(exports, "getInt32Mask", { enumerable: true, get: function () { return serialization_1.getInt32Mask; } }); +Object.defineProperty(exports, "getInt64Mask", { enumerable: true, get: function () { return serialization_1.getInt64Mask; } }); +Object.defineProperty(exports, "getInt8Mask", { enumerable: true, get: function () { return serialization_1.getInt8Mask; } }); +Object.defineProperty(exports, "getUint16Mask", { enumerable: true, get: function () { return serialization_1.getUint16Mask; } }); +Object.defineProperty(exports, "getUint32Mask", { enumerable: true, get: function () { return serialization_1.getUint32Mask; } }); +Object.defineProperty(exports, "getUint64Mask", { enumerable: true, get: function () { return serialization_1.getUint64Mask; } }); +Object.defineProperty(exports, "getUint8Mask", { enumerable: true, get: function () { return serialization_1.getUint8Mask; } }); +var types_1 = require("./types"); +Object.defineProperty(exports, "Int64", { enumerable: true, get: function () { return types_1.Int64; } }); +Object.defineProperty(exports, "Uint64", { enumerable: true, get: function () { return types_1.Uint64; } }); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/index.js.map b/node_modules/capnp-ts/src/index.js.map new file mode 100644 index 0000000..c24915b --- /dev/null +++ b/node_modules/capnp-ts/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDA6CyB;AA5CvB,gHAAA,eAAe,OAAA;AACf,wGAAA,OAAO,OAAA;AACP,2GAAA,UAAU,OAAA;AACV,+GAAA,cAAc,OAAA;AACd,+GAAA,cAAc,OAAA;AACd,yGAAA,QAAQ,OAAA;AACR,8GAAA,aAAa,OAAA;AACb,qGAAA,IAAI,OAAA;AACJ,yGAAA,QAAQ,OAAA;AACR,4GAAA,WAAW,OAAA;AACX,4GAAA,WAAW,OAAA;AACX,0GAAA,SAAS,OAAA;AACT,0GAAA,SAAS,OAAA;AACT,0GAAA,SAAS,OAAA;AACT,yGAAA,QAAQ,OAAA;AACR,0GAAA,SAAS,OAAA;AACT,8GAAA,aAAa,OAAA;AACb,qGAAA,IAAI,OAAA;AAEJ,uGAAA,MAAM,OAAA;AACN,4GAAA,WAAW,OAAA;AACX,4GAAA,WAAW,OAAA;AACX,wGAAA,OAAO,OAAA;AACP,uGAAA,MAAM,OAAA;AAEN,qGAAA,IAAI,OAAA;AACJ,yGAAA,QAAQ,OAAA;AACR,2GAAA,UAAU,OAAA;AACV,2GAAA,UAAU,OAAA;AACV,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AACT,yGAAA,QAAQ,OAAA;AACR,qGAAA,IAAI,OAAA;AACJ,2GAAA,UAAU,OAAA;AACV,+GAAA,cAAc,OAAA;AACd,+GAAA,cAAc,OAAA;AACd,6GAAA,YAAY,OAAA;AACZ,6GAAA,YAAY,OAAA;AACZ,6GAAA,YAAY,OAAA;AACZ,4GAAA,WAAW,OAAA;AACX,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,6GAAA,YAAY,OAAA;AAGd,iCAAwC;AAA/B,8FAAA,KAAK,OAAA;AAAE,+FAAA,MAAM,OAAA"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/index.ts b/node_modules/capnp-ts/src/index.ts new file mode 100644 index 0000000..714d3ee --- /dev/null +++ b/node_modules/capnp-ts/src/index.ts @@ -0,0 +1,52 @@ +/** + * @author jdiaz5513 + */ + +export { + ListElementSize, + Message, + ObjectSize, + readRawPointer, + AnyPointerList, + BoolList, + CompositeList, + Data, + DataList, + Float32List, + Float64List, + Int16List, + Int32List, + Int64List, + Int8List, + Interface, + InterfaceList, + List, + ListCtor, + Orphan, + PointerList, + PointerType, + Pointer, + Struct, + StructCtor, + Text, + TextList, + Uint16List, + Uint32List, + Uint64List, + Uint8List, + VoidList, + Void, + getBitMask, + getFloat32Mask, + getFloat64Mask, + getInt16Mask, + getInt32Mask, + getInt64Mask, + getInt8Mask, + getUint16Mask, + getUint32Mask, + getUint64Mask, + getUint8Mask, +} from "./serialization"; + +export { Int64, Uint64 } from "./types"; diff --git a/node_modules/capnp-ts/src/serialization/arena/any-arena.d.ts b/node_modules/capnp-ts/src/serialization/arena/any-arena.d.ts new file mode 100644 index 0000000..dc7e62a --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/any-arena.d.ts @@ -0,0 +1,3 @@ +import { MultiSegmentArena } from "./multi-segment-arena"; +import { SingleSegmentArena } from "./single-segment-arena"; +export declare type AnyArena = MultiSegmentArena | SingleSegmentArena; diff --git a/node_modules/capnp-ts/src/serialization/arena/any-arena.js b/node_modules/capnp-ts/src/serialization/arena/any-arena.js new file mode 100644 index 0000000..ce181cb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/any-arena.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=any-arena.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/any-arena.js.map b/node_modules/capnp-ts/src/serialization/arena/any-arena.js.map new file mode 100644 index 0000000..151e5db --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/any-arena.js.map @@ -0,0 +1 @@ +{"version":3,"file":"any-arena.js","sourceRoot":"","sources":["any-arena.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/any-arena.ts b/node_modules/capnp-ts/src/serialization/arena/any-arena.ts new file mode 100644 index 0000000..3f96922 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/any-arena.ts @@ -0,0 +1,4 @@ +import { MultiSegmentArena } from "./multi-segment-arena"; +import { SingleSegmentArena } from "./single-segment-arena"; + +export type AnyArena = MultiSegmentArena | SingleSegmentArena; diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.d.ts b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.d.ts new file mode 100644 index 0000000..3099d3d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.d.ts @@ -0,0 +1,18 @@ +/** + * @author jdiaz5513 + */ +export declare class ArenaAllocationResult { + /** + * The newly allocated buffer. This buffer might be a copy of an existing segment's buffer with free space appended. + * + * @type {ArrayBuffer} + */ + readonly buffer: ArrayBuffer; + /** + * The id of the newly-allocated segment. + * + * @type {number} + */ + readonly id: number; + constructor(id: number, buffer: ArrayBuffer); +} diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js new file mode 100644 index 0000000..6984a19 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js @@ -0,0 +1,19 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ArenaAllocationResult = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const trace = debug_1.default("capnp:serialization:arena:arena-allocation-result"); +trace("load"); +class ArenaAllocationResult { + constructor(id, buffer) { + this.id = id; + this.buffer = buffer; + trace("new", this); + } +} +exports.ArenaAllocationResult = ArenaAllocationResult; +//# sourceMappingURL=arena-allocation-result.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js.map b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js.map new file mode 100644 index 0000000..062fcbb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arena-allocation-result.js","sourceRoot":"","sources":["arena-allocation-result.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,MAAM,KAAK,GAAG,eAAS,CAAC,mDAAmD,CAAC,CAAC;AAC7E,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,qBAAqB;IAiBhC,YAAY,EAAU,EAAE,MAAmB;QACzC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrB,CAAC;CACF;AAvBD,sDAuBC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.ts b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.ts new file mode 100644 index 0000000..a2c746c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-allocation-result.ts @@ -0,0 +1,33 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +const trace = initTrace("capnp:serialization:arena:arena-allocation-result"); +trace("load"); + +export class ArenaAllocationResult { + /** + * The newly allocated buffer. This buffer might be a copy of an existing segment's buffer with free space appended. + * + * @type {ArrayBuffer} + */ + + readonly buffer: ArrayBuffer; + + /** + * The id of the newly-allocated segment. + * + * @type {number} + */ + + readonly id: number; + + constructor(id: number, buffer: ArrayBuffer) { + this.id = id; + this.buffer = buffer; + + trace("new", this); + } +} diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-kind.d.ts b/node_modules/capnp-ts/src/serialization/arena/arena-kind.d.ts new file mode 100644 index 0000000..6437de1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-kind.d.ts @@ -0,0 +1,4 @@ +export declare enum ArenaKind { + SINGLE_SEGMENT = 0, + MULTI_SEGMENT = 1 +} diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-kind.js b/node_modules/capnp-ts/src/serialization/arena/arena-kind.js new file mode 100644 index 0000000..a01cb84 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-kind.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ArenaKind = void 0; +var ArenaKind; +(function (ArenaKind) { + ArenaKind[ArenaKind["SINGLE_SEGMENT"] = 0] = "SINGLE_SEGMENT"; + ArenaKind[ArenaKind["MULTI_SEGMENT"] = 1] = "MULTI_SEGMENT"; +})(ArenaKind = exports.ArenaKind || (exports.ArenaKind = {})); +//# sourceMappingURL=arena-kind.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-kind.js.map b/node_modules/capnp-ts/src/serialization/arena/arena-kind.js.map new file mode 100644 index 0000000..aec7139 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-kind.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arena-kind.js","sourceRoot":"","sources":["arena-kind.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,6DAAc,CAAA;IACd,2DAAa,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/arena-kind.ts b/node_modules/capnp-ts/src/serialization/arena/arena-kind.ts new file mode 100644 index 0000000..66357be --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena-kind.ts @@ -0,0 +1,4 @@ +export enum ArenaKind { + SINGLE_SEGMENT, + MULTI_SEGMENT +} diff --git a/node_modules/capnp-ts/src/serialization/arena/arena.d.ts b/node_modules/capnp-ts/src/serialization/arena/arena.d.ts new file mode 100644 index 0000000..e14ec81 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena.d.ts @@ -0,0 +1,14 @@ +/** + * @author jdiaz5513 + */ +import { Segment } from "../segment"; +import { AnyArena } from "./any-arena"; +import { ArenaAllocationResult } from "./arena-allocation-result"; +export declare abstract class Arena { + static readonly allocate: typeof allocate; + static readonly getBuffer: typeof getBuffer; + static readonly getNumSegments: typeof getNumSegments; +} +export declare function allocate(minSize: number, segments: Segment[], a: AnyArena): ArenaAllocationResult; +export declare function getBuffer(id: number, a: AnyArena): ArrayBuffer; +export declare function getNumSegments(a: AnyArena): number; diff --git a/node_modules/capnp-ts/src/serialization/arena/arena.js b/node_modules/capnp-ts/src/serialization/arena/arena.js new file mode 100644 index 0000000..bf2642e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena.js @@ -0,0 +1,54 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getNumSegments = exports.getBuffer = exports.allocate = exports.Arena = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const errors_1 = require("../../errors"); +const arena_kind_1 = require("./arena-kind"); +const multi_segment_arena_1 = require("./multi-segment-arena"); +const single_segment_arena_1 = require("./single-segment-arena"); +const trace = debug_1.default("capnp:arena"); +trace("load"); +class Arena { +} +exports.Arena = Arena; +Arena.allocate = allocate; +Arena.getBuffer = getBuffer; +Arena.getNumSegments = getNumSegments; +function allocate(minSize, segments, a) { + switch (a.kind) { + case arena_kind_1.ArenaKind.MULTI_SEGMENT: + return multi_segment_arena_1.MultiSegmentArena.allocate(minSize, a); + case arena_kind_1.ArenaKind.SINGLE_SEGMENT: + return single_segment_arena_1.SingleSegmentArena.allocate(minSize, segments, a); + default: + return errors_1.assertNever(a); + } +} +exports.allocate = allocate; +function getBuffer(id, a) { + switch (a.kind) { + case arena_kind_1.ArenaKind.MULTI_SEGMENT: + return multi_segment_arena_1.MultiSegmentArena.getBuffer(id, a); + case arena_kind_1.ArenaKind.SINGLE_SEGMENT: + return single_segment_arena_1.SingleSegmentArena.getBuffer(id, a); + default: + return errors_1.assertNever(a); + } +} +exports.getBuffer = getBuffer; +function getNumSegments(a) { + switch (a.kind) { + case arena_kind_1.ArenaKind.MULTI_SEGMENT: + return multi_segment_arena_1.MultiSegmentArena.getNumSegments(a); + case arena_kind_1.ArenaKind.SINGLE_SEGMENT: + return single_segment_arena_1.SingleSegmentArena.getNumSegments(); + default: + return errors_1.assertNever(a); + } +} +exports.getNumSegments = getNumSegments; +//# sourceMappingURL=arena.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/arena.js.map b/node_modules/capnp-ts/src/serialization/arena/arena.js.map new file mode 100644 index 0000000..2089f01 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arena.js","sourceRoot":"","sources":["arena.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAC9B,yCAA2C;AAI3C,6CAAyC;AACzC,+DAA0D;AAC1D,iEAA4D;AAE5D,MAAM,KAAK,GAAG,eAAS,CAAC,aAAa,CAAC,CAAC;AACvC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAsB,K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.ts b/node_modules/capnp-ts/src/serialization/arena/arena.ts new file mode 100644 index 0000000..1c88859 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/arena.ts @@ -0,0 +1,60 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; +import { assertNever } from "../../errors"; +import { Segment } from "../segment"; +import { AnyArena } from "./any-arena"; +import { ArenaAllocationResult } from "./arena-allocation-result"; +import { ArenaKind } from "./arena-kind"; +import { MultiSegmentArena } from "./multi-segment-arena"; +import { SingleSegmentArena } from "./single-segment-arena"; + +const trace = initTrace("capnp:arena"); +trace("load"); + +export abstract class Arena { + static readonly allocate = allocate; + static readonly getBuffer = getBuffer; + static readonly getNumSegments = getNumSegments; +} + +export function allocate(minSize: number, segments: Segment[], a: AnyArena): ArenaAllocationResult { + switch (a.kind) { + case ArenaKind.MULTI_SEGMENT: + return MultiSegmentArena.allocate(minSize, a); + + case ArenaKind.SINGLE_SEGMENT: + return SingleSegmentArena.allocate(minSize, segments, a); + + default: + return assertNever(a); + } +} + +export function getBuffer(id: number, a: AnyArena): ArrayBuffer { + switch (a.kind) { + case ArenaKind.MULTI_SEGMENT: + return MultiSegmentArena.getBuffer(id, a); + + case ArenaKind.SINGLE_SEGMENT: + return SingleSegmentArena.getBuffer(id, a); + + default: + return assertNever(a); + } +} + +export function getNumSegments(a: AnyArena): number { + switch (a.kind) { + case ArenaKind.MULTI_SEGMENT: + return MultiSegmentArena.getNumSegments(a); + + case ArenaKind.SINGLE_SEGMENT: + return SingleSegmentArena.getNumSegments(); + + default: + return assertNever(a); + } +} diff --git a/node_modules/capnp-ts/src/serialization/arena/index.d.ts b/node_modules/capnp-ts/src/serialization/arena/index.d.ts new file mode 100644 index 0000000..86f6210 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/index.d.ts @@ -0,0 +1,8 @@ +/** + * @author jdiaz5513 + */ +export { AnyArena } from "./any-arena"; +export { Arena } from "./arena"; +export { ArenaKind } from "./arena-kind"; +export { MultiSegmentArena } from "./multi-segment-arena"; +export { SingleSegmentArena } from "./single-segment-arena"; diff --git a/node_modules/capnp-ts/src/serialization/arena/index.js b/node_modules/capnp-ts/src/serialization/arena/index.js new file mode 100644 index 0000000..e2ee4e5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/index.js @@ -0,0 +1,15 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SingleSegmentArena = exports.MultiSegmentArena = exports.ArenaKind = exports.Arena = void 0; +var arena_1 = require("./arena"); +Object.defineProperty(exports, "Arena", { enumerable: true, get: function () { return arena_1.Arena; } }); +var arena_kind_1 = require("./arena-kind"); +Object.defineProperty(exports, "ArenaKind", { enumerable: true, get: function () { return arena_kind_1.ArenaKind; } }); +var multi_segment_arena_1 = require("./multi-segment-arena"); +Object.defineProperty(exports, "MultiSegmentArena", { enumerable: true, get: function () { return multi_segment_arena_1.MultiSegmentArena; } }); +var single_segment_arena_1 = require("./single-segment-arena"); +Object.defineProperty(exports, "SingleSegmentArena", { enumerable: true, get: function () { return single_segment_arena_1.SingleSegmentArena; } }); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/index.js.map b/node_modules/capnp-ts/src/serialization/arena/index.js.map new file mode 100644 index 0000000..aef7b57 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/index.ts b/node_modules/capnp-ts/src/serialization/arena/index.ts new file mode 100644 index 0000000..5128c6e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/index.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ + +export { AnyArena } from "./any-arena"; +export { Arena } from "./arena"; +export { ArenaKind } from "./arena-kind"; +export { MultiSegmentArena } from "./multi-segment-arena"; +export { SingleSegmentArena } from "./single-segment-arena"; diff --git a/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.d.ts b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.d.ts new file mode 100644 index 0000000..84b5412 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.d.ts @@ -0,0 +1,17 @@ +/** + * @author jdiaz5513 + */ +import { ArenaAllocationResult } from "./arena-allocation-result"; +import { ArenaKind } from "./arena-kind"; +export declare class MultiSegmentArena { + static readonly allocate: typeof allocate; + static readonly getBuffer: typeof getBuffer; + static readonly getNumSegments: typeof getNumSegments; + readonly buffers: ArrayBuffer[]; + readonly kind = ArenaKind.MULTI_SEGMENT; + constructor(buffers?: ArrayBuffer[]); + toString(): string; +} +export declare function allocate(minSize: number, m: MultiSegmentArena): ArenaAllocationResult; +export declare function getBuffer(id: number, m: MultiSegmentArena): ArrayBuffer; +export declare function getNumSegments(m: MultiSegmentArena): number; diff --git a/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js new file mode 100644 index 0000000..8e5d064 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js @@ -0,0 +1,47 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getNumSegments = exports.getBuffer = exports.allocate = exports.MultiSegmentArena = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../../constants"); +const errors_1 = require("../../errors"); +const util_1 = require("../../util"); +const arena_allocation_result_1 = require("./arena-allocation-result"); +const arena_kind_1 = require("./arena-kind"); +const trace = debug_1.default("capnp:arena:multi"); +trace("load"); +class MultiSegmentArena { + constructor(buffers = []) { + this.kind = arena_kind_1.ArenaKind.MULTI_SEGMENT; + this.buffers = buffers; + trace("new %s", this); + } + toString() { + return util_1.format("MultiSegmentArena_segments:%d", getNumSegments(this)); + } +} +exports.MultiSegmentArena = MultiSegmentArena; +MultiSegmentArena.allocate = allocate; +MultiSegmentArena.getBuffer = getBuffer; +MultiSegmentArena.getNumSegments = getNumSegments; +function allocate(minSize, m) { + const b = new ArrayBuffer(util_1.padToWord(Math.max(minSize, constants_1.DEFAULT_BUFFER_SIZE))); + m.buffers.push(b); + return new arena_allocation_result_1.ArenaAllocationResult(m.buffers.length - 1, b); +} +exports.allocate = allocate; +function getBuffer(id, m) { + if (id < 0 || id >= m.buffers.length) { + throw new Error(util_1.format(errors_1.SEG_ID_OUT_OF_BOUNDS, id)); + } + return m.buffers[id]; +} +exports.getBuffer = getBuffer; +function getNumSegments(m) { + return m.buffers.length; +} +exports.getNumSegments = getNumSegments; +//# sourceMappingURL=multi-segment-arena.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js.map b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js.map new file mode 100644 index 0000000..b86b981 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multi-segment-arena.js","sourceRoot":"","sources":["multi-segment-arena.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAC9B,+CAAsD;AACtD,yCAAoD;AACpD,qCAA+C;AAC/C,uEAAkE;AAClE,6CAAyC;AAEzC,MAAM,KAAK,GAAG,eAAS,CAAC,mBAAmB,CAAC,CAAC;AAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,iBAAiB;IAQ5B,YAAY,UAAyB,EAAE;QAF9B,SAAI,GAAG,sBAAS,CAAC,aAAa,CAAC;QAGtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,aAAM,CAAC,+BAA+B,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,CAAC;;AAhBH,8CAiBC;AAhBiB,0BAAQ,GAAG,QAAQ,CAAC;AACpB,2BAAS,GAAG,SAAS,CAAC;AACtB,gCAAc,GAAG,cAAc,CAAC;AAgBlD,SAAgB,QAAQ,CAAC,OAAe,EAAE,CAAoB;IAC5D,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,gBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,+BAAmB,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAElB,OAAO,IAAI,+CAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC;AALD,4BAKC;AAED,SAAgB,SAAS,CAAC,EAAU,EAAE,CAAoB;IACxD,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,6BAAoB,EAAE,EAAE,CAAC,CAAC,CAAC;KACnD;IAED,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC;AAND,8BAMC;AAED,SAAgB,cAAc,CAAC,CAAoB;IACjD,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC;AAFD,wCAEC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.ts b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.ts new file mode 100644 index 0000000..7a53e1b --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/multi-segment-arena.ts @@ -0,0 +1,51 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; +import { DEFAULT_BUFFER_SIZE } from "../../constants"; +import { SEG_ID_OUT_OF_BOUNDS } from "../../errors"; +import { padToWord, format } from "../../util"; +import { ArenaAllocationResult } from "./arena-allocation-result"; +import { ArenaKind } from "./arena-kind"; + +const trace = initTrace("capnp:arena:multi"); +trace("load"); + +export class MultiSegmentArena { + static readonly allocate = allocate; + static readonly getBuffer = getBuffer; + static readonly getNumSegments = getNumSegments; + + readonly buffers: ArrayBuffer[]; + readonly kind = ArenaKind.MULTI_SEGMENT; + + constructor(buffers: ArrayBuffer[] = []) { + this.buffers = buffers; + + trace("new %s", this); + } + + toString(): string { + return format("MultiSegmentArena_segments:%d", getNumSegments(this)); + } +} + +export function allocate(minSize: number, m: MultiSegmentArena): ArenaAllocationResult { + const b = new ArrayBuffer(padToWord(Math.max(minSize, DEFAULT_BUFFER_SIZE))); + m.buffers.push(b); + + return new ArenaAllocationResult(m.buffers.length - 1, b); +} + +export function getBuffer(id: number, m: MultiSegmentArena): ArrayBuffer { + if (id < 0 || id >= m.buffers.length) { + throw new Error(format(SEG_ID_OUT_OF_BOUNDS, id)); + } + + return m.buffers[id]; +} + +export function getNumSegments(m: MultiSegmentArena): number { + return m.buffers.length; +} diff --git a/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.d.ts b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.d.ts new file mode 100644 index 0000000..07b2950 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.d.ts @@ -0,0 +1,18 @@ +/** + * @author jdiaz5513 + */ +import { Segment } from "../segment"; +import { ArenaAllocationResult } from "./arena-allocation-result"; +import { ArenaKind } from "./arena-kind"; +export declare class SingleSegmentArena { + static readonly allocate: typeof allocate; + static readonly getBuffer: typeof getBuffer; + static readonly getNumSegments: typeof getNumSegments; + buffer: ArrayBuffer; + readonly kind = ArenaKind.SINGLE_SEGMENT; + constructor(buffer?: ArrayBuffer); + toString(): string; +} +export declare function allocate(minSize: number, segments: Segment[], s: SingleSegmentArena): ArenaAllocationResult; +export declare function getBuffer(id: number, s: SingleSegmentArena): ArrayBuffer; +export declare function getNumSegments(): number; diff --git a/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js new file mode 100644 index 0000000..3edc8b5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js @@ -0,0 +1,59 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getNumSegments = exports.getBuffer = exports.allocate = exports.SingleSegmentArena = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../../constants"); +const errors_1 = require("../../errors"); +const util_1 = require("../../util"); +const arena_allocation_result_1 = require("./arena-allocation-result"); +const arena_kind_1 = require("./arena-kind"); +const trace = debug_1.default("capnp:arena:single"); +trace("load"); +class SingleSegmentArena { + constructor(buffer = new ArrayBuffer(constants_1.DEFAULT_BUFFER_SIZE)) { + this.kind = arena_kind_1.ArenaKind.SINGLE_SEGMENT; + if ((buffer.byteLength & 7) !== 0) { + throw new Error(util_1.format(errors_1.SEG_NOT_WORD_ALIGNED, buffer.byteLength)); + } + this.buffer = buffer; + trace("new %s", this); + } + toString() { + return util_1.format("SingleSegmentArena_len:%x", this.buffer.byteLength); + } +} +exports.SingleSegmentArena = SingleSegmentArena; +SingleSegmentArena.allocate = allocate; +SingleSegmentArena.getBuffer = getBuffer; +SingleSegmentArena.getNumSegments = getNumSegments; +function allocate(minSize, segments, s) { + trace("Allocating %x bytes for segment 0 in %s.", minSize, s); + const srcBuffer = segments.length > 0 ? segments[0].buffer : s.buffer; + if (minSize < constants_1.MIN_SINGLE_SEGMENT_GROWTH) { + minSize = constants_1.MIN_SINGLE_SEGMENT_GROWTH; + } + else { + minSize = util_1.padToWord(minSize); + } + s.buffer = new ArrayBuffer(srcBuffer.byteLength + minSize); + // PERF: Assume that the source and destination buffers are word-aligned and use Float64Array to copy them one word + // at a time. + new Float64Array(s.buffer).set(new Float64Array(srcBuffer)); + return new arena_allocation_result_1.ArenaAllocationResult(0, s.buffer); +} +exports.allocate = allocate; +function getBuffer(id, s) { + if (id !== 0) + throw new Error(util_1.format(errors_1.SEG_GET_NON_ZERO_SINGLE, id)); + return s.buffer; +} +exports.getBuffer = getBuffer; +function getNumSegments() { + return 1; +} +exports.getNumSegments = getNumSegments; +//# sourceMappingURL=single-segment-arena.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js.map b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js.map new file mode 100644 index 0000000..d150e0b --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.js.map @@ -0,0 +1 @@ +{"version":3,"file":"single-segment-arena.js","sourceRoot":"","sources":["single-segment-arena.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAC9B,+CAAiF;AACjF,yCAA6E;AAC7E,qCAA+C;AAE/C,uEAAkE;AAClE,6CAAyC;AAEzC,MAAM,KAAK,GAAG,eAAS,CAAC,oBAAoB,CAAC,CAAC;AAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,kBAAkB;IAQ7B,YAAY,MAAM,GAAG,IAAI,WAAW,CAAC,+BAAmB,CAAC;QAFhD,SAAI,GAAG,sBAAS,CAAC,cAAc,CAAC;QAGvC,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,6BAAoB,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;SAClE;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,O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No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.ts b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.ts new file mode 100644 index 0000000..250568c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/arena/single-segment-arena.ts @@ -0,0 +1,67 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; +import { DEFAULT_BUFFER_SIZE, MIN_SINGLE_SEGMENT_GROWTH } from "../../constants"; +import { SEG_GET_NON_ZERO_SINGLE, SEG_NOT_WORD_ALIGNED } from "../../errors"; +import { format, padToWord } from "../../util"; +import { Segment } from "../segment"; +import { ArenaAllocationResult } from "./arena-allocation-result"; +import { ArenaKind } from "./arena-kind"; + +const trace = initTrace("capnp:arena:single"); +trace("load"); + +export class SingleSegmentArena { + static readonly allocate = allocate; + static readonly getBuffer = getBuffer; + static readonly getNumSegments = getNumSegments; + + buffer: ArrayBuffer; + readonly kind = ArenaKind.SINGLE_SEGMENT; + + constructor(buffer = new ArrayBuffer(DEFAULT_BUFFER_SIZE)) { + if ((buffer.byteLength & 7) !== 0) { + throw new Error(format(SEG_NOT_WORD_ALIGNED, buffer.byteLength)); + } + + this.buffer = buffer; + + trace("new %s", this); + } + + toString(): string { + return format("SingleSegmentArena_len:%x", this.buffer.byteLength); + } +} + +export function allocate(minSize: number, segments: Segment[], s: SingleSegmentArena): ArenaAllocationResult { + trace("Allocating %x bytes for segment 0 in %s.", minSize, s); + + const srcBuffer = segments.length > 0 ? segments[0].buffer : s.buffer; + + if (minSize < MIN_SINGLE_SEGMENT_GROWTH) { + minSize = MIN_SINGLE_SEGMENT_GROWTH; + } else { + minSize = padToWord(minSize); + } + + s.buffer = new ArrayBuffer(srcBuffer.byteLength + minSize); + + // PERF: Assume that the source and destination buffers are word-aligned and use Float64Array to copy them one word + // at a time. + new Float64Array(s.buffer).set(new Float64Array(srcBuffer)); + + return new ArenaAllocationResult(0, s.buffer); +} + +export function getBuffer(id: number, s: SingleSegmentArena): ArrayBuffer { + if (id !== 0) throw new Error(format(SEG_GET_NON_ZERO_SINGLE, id)); + + return s.buffer; +} + +export function getNumSegments(): number { + return 1; +} diff --git a/node_modules/capnp-ts/src/serialization/index.d.ts b/node_modules/capnp-ts/src/serialization/index.d.ts new file mode 100644 index 0000000..ef08a70 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/index.d.ts @@ -0,0 +1,8 @@ +/** + * @author jdiaz5513 + */ +export * from "./mask"; +export { ListElementSize } from "./list-element-size"; +export { Message, readRawPointer } from "./message"; +export { ObjectSize } from "./object-size"; +export * from "./pointers/index"; diff --git a/node_modules/capnp-ts/src/serialization/index.js b/node_modules/capnp-ts/src/serialization/index.js new file mode 100644 index 0000000..16f2cea --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/index.js @@ -0,0 +1,17 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ObjectSize = exports.readRawPointer = exports.Message = exports.ListElementSize = void 0; +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./mask"), exports); +var list_element_size_1 = require("./list-element-size"); +Object.defineProperty(exports, "ListElementSize", { enumerable: true, get: function () { return list_element_size_1.ListElementSize; } }); +var message_1 = require("./message"); +Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_1.Message; } }); +Object.defineProperty(exports, "readRawPointer", { enumerable: true, get: function () { return message_1.readRawPointer; } }); +var object_size_1 = require("./object-size"); +Object.defineProperty(exports, "ObjectSize", { enumerable: true, get: function () { return object_size_1.ObjectSize; } }); +tslib_1.__exportStar(require("./pointers/index"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/index.js.map b/node_modules/capnp-ts/src/serialization/index.js.map new file mode 100644 index 0000000..c68025b --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,iDAAuB;AACvB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,qCAAoD;AAA3C,kGAAA,OAAO,OAAA;AAAE,yGAAA,cAAc,OAAA;AAChC,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,2DAAiC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/index.ts b/node_modules/capnp-ts/src/serialization/index.ts new file mode 100644 index 0000000..805c2da --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/index.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ + +export * from "./mask"; +export { ListElementSize } from "./list-element-size"; +export { Message, readRawPointer } from "./message"; +export { ObjectSize } from "./object-size"; +export * from "./pointers/index"; diff --git a/node_modules/capnp-ts/src/serialization/list-element-size.d.ts b/node_modules/capnp-ts/src/serialization/list-element-size.d.ts new file mode 100644 index 0000000..96f9a21 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/list-element-size.d.ts @@ -0,0 +1,14 @@ +/** + * @author jdiaz5513 + */ +export declare enum ListElementSize { + VOID = 0, + BIT = 1, + BYTE = 2, + BYTE_2 = 3, + BYTE_4 = 4, + BYTE_8 = 5, + POINTER = 6, + COMPOSITE = 7 +} +export declare const ListElementOffset: number[]; diff --git a/node_modules/capnp-ts/src/serialization/list-element-size.js b/node_modules/capnp-ts/src/serialization/list-element-size.js new file mode 100644 index 0000000..35816c4 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/list-element-size.js @@ -0,0 +1,28 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ListElementOffset = exports.ListElementSize = void 0; +var ListElementSize; +(function (ListElementSize) { + ListElementSize[ListElementSize["VOID"] = 0] = "VOID"; + ListElementSize[ListElementSize["BIT"] = 1] = "BIT"; + ListElementSize[ListElementSize["BYTE"] = 2] = "BYTE"; + ListElementSize[ListElementSize["BYTE_2"] = 3] = "BYTE_2"; + ListElementSize[ListElementSize["BYTE_4"] = 4] = "BYTE_4"; + ListElementSize[ListElementSize["BYTE_8"] = 5] = "BYTE_8"; + ListElementSize[ListElementSize["POINTER"] = 6] = "POINTER"; + ListElementSize[ListElementSize["COMPOSITE"] = 7] = "COMPOSITE"; +})(ListElementSize = exports.ListElementSize || (exports.ListElementSize = {})); +exports.ListElementOffset = [ + 0, + 0.125, + 1, + 2, + 4, + 8, + 8, + NaN // composite +]; +//# sourceMappingURL=list-element-size.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/list-element-size.js.map b/node_modules/capnp-ts/src/serialization/list-element-size.js.map new file mode 100644 index 0000000..ca2a42e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/list-element-size.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list-element-size.js","sourceRoot":"","sources":["list-element-size.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,eASX;AATD,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,mDAAO,CAAA;IACP,qDAAQ,CAAA;IACR,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,+DAAa,CAAA;AACf,CAAC,EATW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAS1B;AAEY,QAAA,iBAAiB,GAAG;IAC/B,CAAC;IACD,KAAK;IACL,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,GAAG,CAAC,YAAY;CACjB,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/list-element-size.ts b/node_modules/capnp-ts/src/serialization/list-element-size.ts new file mode 100644 index 0000000..0aaac25 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/list-element-size.ts @@ -0,0 +1,25 @@ +/** + * @author jdiaz5513 + */ + +export enum ListElementSize { + VOID = 0, + BIT = 1, + BYTE = 2, + BYTE_2 = 3, + BYTE_4 = 4, + BYTE_8 = 5, + POINTER = 6, + COMPOSITE = 7 +} + +export const ListElementOffset = [ + 0, // void + 0.125, // bit + 1, // byte + 2, // two byte + 4, // four byte + 8, // eight byte + 8, // pointer + NaN // composite +]; diff --git a/node_modules/capnp-ts/src/serialization/mask.d.ts b/node_modules/capnp-ts/src/serialization/mask.d.ts new file mode 100644 index 0000000..c0c71fe --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/mask.d.ts @@ -0,0 +1,16 @@ +/** + * @author jdiaz5513 + */ +import { Int64, Uint64 } from "../types/index"; +export declare const getFloat32Mask: (x: number) => DataView; +export declare const getFloat64Mask: (x: number) => DataView; +export declare const getInt16Mask: (x: number) => DataView; +export declare const getInt32Mask: (x: number) => DataView; +export declare const getInt8Mask: (x: number) => DataView; +export declare const getUint16Mask: (x: number) => DataView; +export declare const getUint32Mask: (x: number) => DataView; +export declare const getUint8Mask: (x: number) => DataView; +export declare function getBitMask(value: boolean, bitOffset: number): DataView; +export declare function getInt64Mask(x: Int64): DataView; +export declare function getUint64Mask(x: Uint64): DataView; +export declare function getVoidMask(): void; diff --git a/node_modules/capnp-ts/src/serialization/mask.js b/node_modules/capnp-ts/src/serialization/mask.js new file mode 100644 index 0000000..784d678 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/mask.js @@ -0,0 +1,45 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +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; +const errors_1 = require("../errors"); +function _makePrimitiveMaskFn(byteLength, setter) { + return (x) => { + const dv = new DataView(new ArrayBuffer(byteLength)); + setter.call(dv, 0, x, true); + return dv; + }; +} +/* eslint-disable @typescript-eslint/unbound-method */ +exports.getFloat32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setFloat32); +exports.getFloat64Mask = _makePrimitiveMaskFn(8, DataView.prototype.setFloat64); +exports.getInt16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setInt16); +exports.getInt32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setInt32); +exports.getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8); +exports.getUint16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setUint16); +exports.getUint32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setUint32); +exports.getUint8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setUint8); +/* eslint-enable */ +function getBitMask(value, bitOffset) { + const dv = new DataView(new ArrayBuffer(1)); + if (!value) + return dv; + dv.setUint8(0, 1 << bitOffset % 8); + return dv; +} +exports.getBitMask = getBitMask; +function getInt64Mask(x) { + return x.toDataView(); +} +exports.getInt64Mask = getInt64Mask; +function getUint64Mask(x) { + return x.toDataView(); +} +exports.getUint64Mask = getUint64Mask; +function getVoidMask() { + throw new Error(errors_1.INVARIANT_UNREACHABLE_CODE); +} +exports.getVoidMask = getVoidMask; +//# sourceMappingURL=mask.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/mask.js.map b/node_modules/capnp-ts/src/serialization/mask.js.map new file mode 100644 index 0000000..104b99a --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/mask.js.map @@ -0,0 +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,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,UAAU,EAAE,CAAC;AACxB,CAAC;AAFD,sCAEC;AAED,SAAgB,WAAW;IACzB,MAAM,IAAI,KAAK,CAAC,mCAA0B,CAAC,CAAC;AAC9C,CAAC;AAFD,kCAEC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/mask.ts b/node_modules/capnp-ts/src/serialization/mask.ts new file mode 100644 index 0000000..dcaa9e9 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/mask.ts @@ -0,0 +1,48 @@ +/** + * @author jdiaz5513 + */ + +import { INVARIANT_UNREACHABLE_CODE } from "../errors"; +import { Int64, Uint64 } from "../types/index"; + +type DataViewSetter = (byteOffset: number, value: number, littleEndian?: boolean) => void; + +function _makePrimitiveMaskFn(byteLength: number, setter: DataViewSetter): (x: number) => DataView { + return (x: number): DataView => { + const dv = new DataView(new ArrayBuffer(byteLength)); + setter.call(dv, 0, x, true); + return dv; + }; +} + +/* eslint-disable @typescript-eslint/unbound-method */ +export const getFloat32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setFloat32); +export const getFloat64Mask = _makePrimitiveMaskFn(8, DataView.prototype.setFloat64); +export const getInt16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setInt16); +export const getInt32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setInt32); +export const getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8); +export const getUint16Mask = _makePrimitiveMaskFn(2, DataView.prototype.setUint16); +export const getUint32Mask = _makePrimitiveMaskFn(4, DataView.prototype.setUint32); +export const getUint8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setUint8); +/* eslint-enable */ + +export function getBitMask(value: boolean, bitOffset: number): DataView { + const dv = new DataView(new ArrayBuffer(1)); + + if (!value) return dv; + + dv.setUint8(0, 1 << bitOffset % 8); + return dv; +} + +export function getInt64Mask(x: Int64): DataView { + return x.toDataView(); +} + +export function getUint64Mask(x: Uint64): DataView { + return x.toDataView(); +} + +export function getVoidMask(): void { + throw new Error(INVARIANT_UNREACHABLE_CODE); +} diff --git a/node_modules/capnp-ts/src/serialization/message.d.ts b/node_modules/capnp-ts/src/serialization/message.d.ts new file mode 100644 index 0000000..4eafff5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/message.d.ts @@ -0,0 +1,158 @@ +/** + * @author jdiaz5513 + */ +import { AnyArena } from "./arena"; +import { Pointer, StructCtor, Struct } from "./pointers"; +import { Segment } from "./segment"; +export interface _Message { + readonly arena: AnyArena; + segments: Segment[]; + traversalLimit: number; +} +export declare class Message { + static readonly allocateSegment: typeof allocateSegment; + static readonly dump: typeof dump; + static readonly getRoot: typeof getRoot; + static readonly getSegment: typeof getSegment; + static readonly initRoot: typeof initRoot; + static readonly readRawPointer: typeof readRawPointer; + static readonly toArrayBuffer: typeof toArrayBuffer; + static readonly toPackedArrayBuffer: typeof toPackedArrayBuffer; + readonly _capnp: _Message; + /** + * A Cap'n Proto message. + * + * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer + * directly and everything will be fine. If not, your message will potentially be initialized with random memory + * contents! + * + * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer + * to read from. + * + * @constructor {Message} + * + * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message. + * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the + * root pointer; it will expand as you go. This is a reasonable choice for most messages. + * + * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted + * as-is. + * + * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source + * buffer; beware of the potential performance cost! + * + * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be + * unpacked. + * + * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without + * a framing header. + * + */ + constructor(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed?: boolean, singleSegment?: boolean); + allocateSegment(byteLength: number): Segment; + /** + * Create a pretty-printed string dump of this message; incredibly useful for debugging. + * + * WARNING: Do not call this method on large messages! + * + * @returns {string} A big steaming pile of pretty hex digits. + */ + dump(): string; + /** + * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not + * overwrite existing data. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} A struct representing the root of the message. + */ + getRoot<T extends Struct>(RootStruct: StructCtor<T>): T; + /** + * Get a segment by its id. + * + * This will lazily allocate the first segment if it doesn't already exist. + * + * @param {number} id The segment id. + * @returns {Segment} The requested segment. + */ + getSegment(id: number): Segment; + /** + * Initialize a new message using the provided struct type as the root. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} An initialized struct pointing to the root of the message. + */ + initRoot<T extends Struct>(RootStruct: StructCtor<T>): T; + /** + * Set the root of the message to a copy of the given pointer. Used internally + * to make copies of pointers for default values. + * + * @param {Pointer} src The source pointer to copy. + * @returns {void} + */ + setRoot(src: Pointer): void; + /** + * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header + * containing information about the following segment data. + * + * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message. + */ + toArrayBuffer(): ArrayBuffer; + /** + * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to + * use if you're sending the message over a network link or other slow I/O interface where size matters. + * + * @returns {ArrayBuffer} A packed message. + */ + toPackedArrayBuffer(): ArrayBuffer; + toString(): string; +} +export interface CreateMessageOptions { + packed?: boolean; + singleSegment?: boolean; +} +export declare function initMessage(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed?: boolean, singleSegment?: boolean): _Message; +/** + * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in + * the message. + * + * This method is not typically called directly, but can be useful in certain cases. + * + * @static + * @param {ArrayBuffer} message An unpacked message with a framing header. + * @returns {ArrayBuffer[]} An array of buffers containing the segment data. + */ +export declare function getFramedSegments(message: ArrayBuffer): ArrayBuffer[]; +/** + * This method is called on messages that were constructed with existing data to prepopulate the segments array with + * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer. + * + * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own + * may void your warranty. + * + * @param {Message} m The message to allocate. + * @returns {void} + */ +export declare function preallocateSegments(m: Message): void; +export declare function allocateSegment(byteLength: number, m: Message): Segment; +export declare function dump(m: Message): string; +export declare function getRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T; +export declare function getSegment(id: number, m: Message): Segment; +export declare function initRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T; +/** + * Read a pointer in raw form (a packed message with framing headers). Does not + * care or attempt to validate the input beyond parsing the message + * segments. + * + * This is typically used by the compiler to load default values, but can be + * useful to work with messages with an unknown schema. + * + * @param {ArrayBuffer} data The raw data to read. + * @returns {Pointer} A root pointer. + */ +export declare function readRawPointer(data: ArrayBuffer): Pointer; +export declare function setRoot(src: Pointer, m: Message): void; +export declare function toArrayBuffer(m: Message): ArrayBuffer; +export declare function toPackedArrayBuffer(m: Message): ArrayBuffer; +export declare function getStreamFrame(m: Message): ArrayBuffer; diff --git a/node_modules/capnp-ts/src/serialization/message.js b/node_modules/capnp-ts/src/serialization/message.js new file mode 100644 index 0000000..818c912 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/message.js @@ -0,0 +1,392 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +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; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../constants"); +const errors_1 = require("../errors"); +const util_1 = require("../util"); +const arena_1 = require("./arena"); +const packing_1 = require("./packing"); +const pointers_1 = require("./pointers"); +const segment_1 = require("./segment"); +const pointer_1 = require("./pointers/pointer"); +const struct_1 = require("./pointers/struct"); +const trace = debug_1.default("capnp:message"); +trace("load"); +class Message { + /** + * A Cap'n Proto message. + * + * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer + * directly and everything will be fine. If not, your message will potentially be initialized with random memory + * contents! + * + * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer + * to read from. + * + * @constructor {Message} + * + * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message. + * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the + * root pointer; it will expand as you go. This is a reasonable choice for most messages. + * + * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted + * as-is. + * + * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source + * buffer; beware of the potential performance cost! + * + * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be + * unpacked. + * + * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without + * a framing header. + * + */ + constructor(src, packed = true, singleSegment = false) { + this._capnp = initMessage(src, packed, singleSegment); + if (src && !isAnyArena(src)) + preallocateSegments(this); + trace("new %s", this); + } + allocateSegment(byteLength) { + return allocateSegment(byteLength, this); + } + /** + * Create a pretty-printed string dump of this message; incredibly useful for debugging. + * + * WARNING: Do not call this method on large messages! + * + * @returns {string} A big steaming pile of pretty hex digits. + */ + dump() { + return dump(this); + } + /** + * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not + * overwrite existing data. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} A struct representing the root of the message. + */ + getRoot(RootStruct) { + return getRoot(RootStruct, this); + } + /** + * Get a segment by its id. + * + * This will lazily allocate the first segment if it doesn't already exist. + * + * @param {number} id The segment id. + * @returns {Segment} The requested segment. + */ + getSegment(id) { + return getSegment(id, this); + } + /** + * Initialize a new message using the provided struct type as the root. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} An initialized struct pointing to the root of the message. + */ + initRoot(RootStruct) { + return initRoot(RootStruct, this); + } + /** + * Set the root of the message to a copy of the given pointer. Used internally + * to make copies of pointers for default values. + * + * @param {Pointer} src The source pointer to copy. + * @returns {void} + */ + setRoot(src) { + setRoot(src, this); + } + /** + * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header + * containing information about the following segment data. + * + * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message. + */ + toArrayBuffer() { + return toArrayBuffer(this); + } + /** + * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to + * use if you're sending the message over a network link or other slow I/O interface where size matters. + * + * @returns {ArrayBuffer} A packed message. + */ + toPackedArrayBuffer() { + return toPackedArrayBuffer(this); + } + toString() { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + return `Message_arena:${this._capnp.arena}`; + } +} +exports.Message = Message; +Message.allocateSegment = allocateSegment; +Message.dump = dump; +Message.getRoot = getRoot; +Message.getSegment = getSegment; +Message.initRoot = initRoot; +Message.readRawPointer = readRawPointer; +Message.toArrayBuffer = toArrayBuffer; +Message.toPackedArrayBuffer = toPackedArrayBuffer; +function initMessage(src, packed = true, singleSegment = false) { + if (src === undefined) { + return { + arena: new arena_1.SingleSegmentArena(), + segments: [], + traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT, + }; + } + if (isAnyArena(src)) { + return { arena: src, segments: [], traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT }; + } + let buf = src; + if (isArrayBufferView(buf)) { + buf = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + } + if (packed) + buf = packing_1.unpack(buf); + if (singleSegment) { + return { + arena: new arena_1.SingleSegmentArena(buf), + segments: [], + traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT, + }; + } + return { + arena: new arena_1.MultiSegmentArena(getFramedSegments(buf)), + segments: [], + traversalLimit: constants_1.DEFAULT_TRAVERSE_LIMIT, + }; +} +exports.initMessage = initMessage; +/** + * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in + * the message. + * + * This method is not typically called directly, but can be useful in certain cases. + * + * @static + * @param {ArrayBuffer} message An unpacked message with a framing header. + * @returns {ArrayBuffer[]} An array of buffers containing the segment data. + */ +function getFramedSegments(message) { + const dv = new DataView(message); + const segmentCount = dv.getUint32(0, true) + 1; + const segments = new Array(segmentCount); + trace("reading %d framed segments from stream", segmentCount); + let byteOffset = 4 + segmentCount * 4; + byteOffset += byteOffset % 8; + if (byteOffset + segmentCount * 4 > message.byteLength) { + throw new Error(errors_1.MSG_INVALID_FRAME_HEADER); + } + for (let i = 0; i < segmentCount; i++) { + const byteLength = dv.getUint32(4 + i * 4, true) * 8; + if (byteOffset + byteLength > message.byteLength) { + throw new Error(errors_1.MSG_INVALID_FRAME_HEADER); + } + segments[i] = message.slice(byteOffset, byteOffset + byteLength); + byteOffset += byteLength; + } + return segments; +} +exports.getFramedSegments = getFramedSegments; +/** + * This method is called on messages that were constructed with existing data to prepopulate the segments array with + * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer. + * + * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own + * may void your warranty. + * + * @param {Message} m The message to allocate. + * @returns {void} + */ +function preallocateSegments(m) { + const numSegments = arena_1.Arena.getNumSegments(m._capnp.arena); + if (numSegments < 1) + throw new Error(errors_1.MSG_NO_SEGMENTS_IN_ARENA); + m._capnp.segments = new Array(numSegments); + for (let i = 0; i < numSegments; i++) { + // Set up each segment so that they're fully allocated to the extents of the existing buffers. + const buffer = arena_1.Arena.getBuffer(i, m._capnp.arena); + const segment = new segment_1.Segment(i, m, buffer, buffer.byteLength); + m._capnp.segments[i] = segment; + } +} +exports.preallocateSegments = preallocateSegments; +function isArrayBufferView(src) { + return src.byteOffset !== undefined; +} +function isAnyArena(o) { + return o.kind !== undefined; +} +function allocateSegment(byteLength, m) { + trace("allocating %x bytes for %s", byteLength, m); + const res = arena_1.Arena.allocate(byteLength, m._capnp.segments, m._capnp.arena); + let s; + if (res.id === m._capnp.segments.length) { + // Note how we're only allowing new segments in if they're exactly the next one in the array. There is no logical + // reason for segments to be created out of order. + s = new segment_1.Segment(res.id, m, res.buffer); + trace("adding new segment %s", s); + m._capnp.segments.push(s); + } + else if (res.id < 0 || res.id > m._capnp.segments.length) { + throw new Error(util_1.format(errors_1.MSG_SEGMENT_OUT_OF_BOUNDS, res.id, m)); + } + else { + s = m._capnp.segments[res.id]; + trace("replacing segment %s with buffer (len:%d)", s, res.buffer.byteLength); + s.replaceBuffer(res.buffer); + } + return s; +} +exports.allocateSegment = allocateSegment; +function dump(m) { + let r = ""; + if (m._capnp.segments.length === 0) { + return "================\nNo Segments\n================\n"; + } + for (let i = 0; i < m._capnp.segments.length; i++) { + r += `================\nSegment #${i}\n================\n`; + const { buffer, byteLength } = m._capnp.segments[i]; + const b = new Uint8Array(buffer, 0, byteLength); + r += util_1.dumpBuffer(b); + } + return r; +} +exports.dump = dump; +function getRoot(RootStruct, m) { + const root = new RootStruct(m.getSegment(0), 0); + pointer_1.validate(pointers_1.PointerType.STRUCT, root); + const ts = pointer_1.getTargetStructSize(root); + // Make sure the underlying pointer is actually big enough to hold the data and pointers as specified in the schema. + // If not a shallow copy of the struct contents needs to be made before returning. + if (ts.dataByteLength < RootStruct._capnp.size.dataByteLength || + ts.pointerLength < RootStruct._capnp.size.pointerLength) { + trace("need to resize root struct %s", root); + struct_1.resize(RootStruct._capnp.size, root); + } + return root; +} +exports.getRoot = getRoot; +function getSegment(id, m) { + const segmentLength = m._capnp.segments.length; + if (id === 0 && segmentLength === 0) { + // Segment zero is special. If we have no segments in the arena we'll want to allocate a new one and leave room + // for the root pointer. + const arenaSegments = arena_1.Arena.getNumSegments(m._capnp.arena); + if (arenaSegments === 0) { + allocateSegment(constants_1.DEFAULT_BUFFER_SIZE, m); + } + else { + // Okay, the arena already has a buffer we can use. This is totally fine. + m._capnp.segments[0] = new segment_1.Segment(0, m, arena_1.Arena.getBuffer(0, m._capnp.arena)); + } + if (!m._capnp.segments[0].hasCapacity(8)) { + throw new Error(errors_1.MSG_SEGMENT_TOO_SMALL); + } + // This will leave room for the root pointer. + m._capnp.segments[0].allocate(8); + return m._capnp.segments[0]; + } + if (id < 0 || id >= segmentLength) { + throw new Error(util_1.format(errors_1.MSG_SEGMENT_OUT_OF_BOUNDS, id, m)); + } + return m._capnp.segments[id]; +} +exports.getSegment = getSegment; +function initRoot(RootStruct, m) { + const root = new RootStruct(m.getSegment(0), 0); + struct_1.initStruct(RootStruct._capnp.size, root); + trace("Initialized root pointer %s for %s.", root, m); + return root; +} +exports.initRoot = initRoot; +/** + * Read a pointer in raw form (a packed message with framing headers). Does not + * care or attempt to validate the input beyond parsing the message + * segments. + * + * This is typically used by the compiler to load default values, but can be + * useful to work with messages with an unknown schema. + * + * @param {ArrayBuffer} data The raw data to read. + * @returns {Pointer} A root pointer. + */ +function readRawPointer(data) { + return new pointers_1.Pointer(new Message(data).getSegment(0), 0); +} +exports.readRawPointer = readRawPointer; +function setRoot(src, m) { + pointers_1.Pointer.copyFrom(src, new pointers_1.Pointer(m.getSegment(0), 0)); +} +exports.setRoot = setRoot; +function toArrayBuffer(m) { + const streamFrame = getStreamFrame(m); + // Make sure the first segment is allocated. + if (m._capnp.segments.length === 0) + getSegment(0, m); + const segments = m._capnp.segments; + // Add space for the stream framing. + const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + util_1.padToWord(s.byteLength), 0); + const out = new Uint8Array(new ArrayBuffer(totalLength)); + let o = streamFrame.byteLength; + out.set(new Uint8Array(streamFrame)); + segments.forEach((s) => { + const segmentLength = util_1.padToWord(s.byteLength); + out.set(new Uint8Array(s.buffer, 0, segmentLength), o); + o += segmentLength; + }); + return out.buffer; +} +exports.toArrayBuffer = toArrayBuffer; +function toPackedArrayBuffer(m) { + const streamFrame = packing_1.pack(getStreamFrame(m)); + // Make sure the first segment is allocated. + if (m._capnp.segments.length === 0) + m.getSegment(0); + // NOTE: A copy operation can be avoided here if we capture the intermediate array and use that directly in the copy + // loop below, rather than have `pack()` copy it to an ArrayBuffer just to have to copy it again later. If the + // intermediate array can be avoided altogether that's even better! + const segments = m._capnp.segments.map((s) => packing_1.pack(s.buffer, 0, util_1.padToWord(s.byteLength))); + const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + s.byteLength, 0); + const out = new Uint8Array(new ArrayBuffer(totalLength)); + let o = streamFrame.byteLength; + out.set(new Uint8Array(streamFrame)); + segments.forEach((s) => { + out.set(new Uint8Array(s), o); + o += s.byteLength; + }); + return out.buffer; +} +exports.toPackedArrayBuffer = toPackedArrayBuffer; +function getStreamFrame(m) { + const length = m._capnp.segments.length; + if (length === 0) { + // Don't bother allocating the first segment, just return a single zero word for the frame header. + return new Float64Array(1).buffer; + } + const frameLength = 4 + length * 4 + (1 - (length % 2)) * 4; + const out = new DataView(new ArrayBuffer(frameLength)); + trace("Writing message stream frame with segment count: %d.", length); + out.setUint32(0, length - 1, true); + m._capnp.segments.forEach((s, i) => { + trace("Message segment %d word count: %d.", s.id, s.byteLength / 8); + out.setUint32(i * 4 + 4, s.byteLength / 8, true); + }); + return out.buffer; +} +exports.getStreamFrame = getStreamFrame; +//# sourceMappingURL=message.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/message.js.map b/node_modules/capnp-ts/src/serialization/message.js.map new file mode 100644 index 0000000..9d42066 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/message.js.map @@ -0,0 +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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,CAAC;IAExC,IAAI,MAAM,KAAK,CAAC,EAAE;QAChB,kGAAkG;QAElG,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KACnC;IAED,MAAM,WAAW,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAEvD,KAAK,CAAC,sDAAsD,EAAE,MAAM,CAAC,CAAC;IAEtE,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IAEnC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACjC,KAAK,CAAC,oCAAoC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAEpE,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAvBD,wCAuBC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/message.ts b/node_modules/capnp-ts/src/serialization/message.ts new file mode 100644 index 0000000..20e56a2 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/message.ts @@ -0,0 +1,507 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; +import { DEFAULT_TRAVERSE_LIMIT, DEFAULT_BUFFER_SIZE } from "../constants"; +import { + MSG_INVALID_FRAME_HEADER, + MSG_SEGMENT_OUT_OF_BOUNDS, + MSG_SEGMENT_TOO_SMALL, + MSG_NO_SEGMENTS_IN_ARENA, +} from "../errors"; +import { dumpBuffer, format, padToWord } from "../util"; +import { AnyArena, Arena, MultiSegmentArena, SingleSegmentArena, ArenaKind } from "./arena"; +import { pack, unpack } from "./packing"; +import { Pointer, StructCtor, PointerType, Struct } from "./pointers"; +import { Segment } from "./segment"; +import { getTargetStructSize, validate } from "./pointers/pointer"; +import { resize, initStruct } from "./pointers/struct"; + +const trace = initTrace("capnp:message"); +trace("load"); + +export interface _Message { + readonly arena: AnyArena; + segments: Segment[]; + traversalLimit: number; +} + +export class Message { + static readonly allocateSegment = allocateSegment; + static readonly dump = dump; + static readonly getRoot = getRoot; + static readonly getSegment = getSegment; + static readonly initRoot = initRoot; + static readonly readRawPointer = readRawPointer; + static readonly toArrayBuffer = toArrayBuffer; + static readonly toPackedArrayBuffer = toPackedArrayBuffer; + + readonly _capnp: _Message; + + /** + * A Cap'n Proto message. + * + * SECURITY WARNING: In nodejs do not pass a Buffer's internal array buffer into this constructor. Pass the buffer + * directly and everything will be fine. If not, your message will potentially be initialized with random memory + * contents! + * + * The constructor method creates a new Message, optionally using a provided arena for segment allocation, or a buffer + * to read from. + * + * @constructor {Message} + * + * @param {AnyArena|ArrayBufferView|ArrayBuffer} [src] The source for the message. + * A value of `undefined` will cause the message to initialize with a single segment arena only big enough for the + * root pointer; it will expand as you go. This is a reasonable choice for most messages. + * + * Passing an arena will cause the message to use that arena for its segment allocation. Contents will be accepted + * as-is. + * + * Passing an array buffer view (like `DataView`, `Uint8Array` or `Buffer`) will create a **copy** of the source + * buffer; beware of the potential performance cost! + * + * @param {boolean} [packed] Whether or not the message is packed. If `true` (the default), the message will be + * unpacked. + * + * @param {boolean} [singleSegment] If true, `src` will be treated as a message consisting of a single segment without + * a framing header. + * + */ + constructor(src?: AnyArena | ArrayBufferView | ArrayBuffer, packed = true, singleSegment = false) { + this._capnp = initMessage(src, packed, singleSegment); + + if (src && !isAnyArena(src)) preallocateSegments(this); + + trace("new %s", this); + } + + allocateSegment(byteLength: number): Segment { + return allocateSegment(byteLength, this); + } + + /** + * Create a pretty-printed string dump of this message; incredibly useful for debugging. + * + * WARNING: Do not call this method on large messages! + * + * @returns {string} A big steaming pile of pretty hex digits. + */ + + dump(): string { + return dump(this); + } + + /** + * Get a struct pointer for the root of this message. This is primarily used when reading a message; it will not + * overwrite existing data. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} A struct representing the root of the message. + */ + + getRoot<T extends Struct>(RootStruct: StructCtor<T>): T { + return getRoot(RootStruct, this); + } + + /** + * Get a segment by its id. + * + * This will lazily allocate the first segment if it doesn't already exist. + * + * @param {number} id The segment id. + * @returns {Segment} The requested segment. + */ + + getSegment(id: number): Segment { + return getSegment(id, this); + } + + /** + * Initialize a new message using the provided struct type as the root. + * + * @template T + * @param {StructCtor<T>} RootStruct The struct type to use as the root. + * @returns {T} An initialized struct pointing to the root of the message. + */ + + initRoot<T extends Struct>(RootStruct: StructCtor<T>): T { + return initRoot(RootStruct, this); + } + + /** + * Set the root of the message to a copy of the given pointer. Used internally + * to make copies of pointers for default values. + * + * @param {Pointer} src The source pointer to copy. + * @returns {void} + */ + + setRoot(src: Pointer): void { + setRoot(src, this); + } + + /** + * Combine the contents of this message's segments into a single array buffer and prepend a stream framing header + * containing information about the following segment data. + * + * @returns {ArrayBuffer} An ArrayBuffer with the contents of this message. + */ + + toArrayBuffer(): ArrayBuffer { + return toArrayBuffer(this); + } + + /** + * Like `toArrayBuffer()`, but also applies the packing algorithm to the output. This is typically what you want to + * use if you're sending the message over a network link or other slow I/O interface where size matters. + * + * @returns {ArrayBuffer} A packed message. + */ + + toPackedArrayBuffer(): ArrayBuffer { + return toPackedArrayBuffer(this); + } + + toString(): string { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + return `Message_arena:${this._capnp.arena}`; + } +} + +export interface CreateMessageOptions { + packed?: boolean; + singleSegment?: boolean; +} + +export function initMessage( + src?: AnyArena | ArrayBufferView | ArrayBuffer, + packed = true, + singleSegment = false +): _Message { + if (src === undefined) { + return { + arena: new SingleSegmentArena(), + segments: [], + traversalLimit: DEFAULT_TRAVERSE_LIMIT, + }; + } + + if (isAnyArena(src)) { + return { arena: src, segments: [], traversalLimit: DEFAULT_TRAVERSE_LIMIT }; + } + + let buf: ArrayBuffer = src as ArrayBuffer; + + if (isArrayBufferView(buf)) { + buf = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + } + + if (packed) buf = unpack(buf); + + if (singleSegment) { + return { + arena: new SingleSegmentArena(buf), + segments: [], + traversalLimit: DEFAULT_TRAVERSE_LIMIT, + }; + } + + return { + arena: new MultiSegmentArena(getFramedSegments(buf)), + segments: [], + traversalLimit: DEFAULT_TRAVERSE_LIMIT, + }; +} + +/** + * Given an _unpacked_ message with a segment framing header, this will generate an ArrayBuffer for each segment in + * the message. + * + * This method is not typically called directly, but can be useful in certain cases. + * + * @static + * @param {ArrayBuffer} message An unpacked message with a framing header. + * @returns {ArrayBuffer[]} An array of buffers containing the segment data. + */ + +export function getFramedSegments(message: ArrayBuffer): ArrayBuffer[] { + const dv = new DataView(message); + + const segmentCount = dv.getUint32(0, true) + 1; + + const segments = new Array(segmentCount) as ArrayBuffer[]; + + trace("reading %d framed segments from stream", segmentCount); + + let byteOffset = 4 + segmentCount * 4; + byteOffset += byteOffset % 8; + + if (byteOffset + segmentCount * 4 > message.byteLength) { + throw new Error(MSG_INVALID_FRAME_HEADER); + } + + for (let i = 0; i < segmentCount; i++) { + const byteLength = dv.getUint32(4 + i * 4, true) * 8; + + if (byteOffset + byteLength > message.byteLength) { + throw new Error(MSG_INVALID_FRAME_HEADER); + } + + segments[i] = message.slice(byteOffset, byteOffset + byteLength); + + byteOffset += byteLength; + } + + return segments; +} + +/** + * This method is called on messages that were constructed with existing data to prepopulate the segments array with + * everything we can find in the arena. Each segment will have it's `byteLength` set to the size of its buffer. + * + * Technically speaking, the message's segments will be "full" after calling this function. Calling this on your own + * may void your warranty. + * + * @param {Message} m The message to allocate. + * @returns {void} + */ + +export function preallocateSegments(m: Message): void { + const numSegments = Arena.getNumSegments(m._capnp.arena); + + if (numSegments < 1) throw new Error(MSG_NO_SEGMENTS_IN_ARENA); + + m._capnp.segments = new Array(numSegments) as Segment[]; + + for (let i = 0; i < numSegments; i++) { + // Set up each segment so that they're fully allocated to the extents of the existing buffers. + + const buffer = Arena.getBuffer(i, m._capnp.arena); + const segment = new Segment(i, m, buffer, buffer.byteLength); + + m._capnp.segments[i] = segment; + } +} + +function isArrayBufferView(src: ArrayBuffer | ArrayBufferView): src is ArrayBufferView { + return (src as { byteOffset?: number }).byteOffset !== undefined; +} + +function isAnyArena(o: unknown): o is AnyArena { + return (o as { kind?: ArenaKind }).kind !== undefined; +} + +export function allocateSegment(byteLength: number, m: Message): Segment { + trace("allocating %x bytes for %s", byteLength, m); + + const res = Arena.allocate(byteLength, m._capnp.segments, m._capnp.arena); + let s: Segment; + + if (res.id === m._capnp.segments.length) { + // Note how we're only allowing new segments in if they're exactly the next one in the array. There is no logical + // reason for segments to be created out of order. + + s = new Segment(res.id, m, res.buffer); + + trace("adding new segment %s", s); + + m._capnp.segments.push(s); + } else if (res.id < 0 || res.id > m._capnp.segments.length) { + throw new Error(format(MSG_SEGMENT_OUT_OF_BOUNDS, res.id, m)); + } else { + s = m._capnp.segments[res.id]; + + trace("replacing segment %s with buffer (len:%d)", s, res.buffer.byteLength); + + s.replaceBuffer(res.buffer); + } + + return s; +} + +export function dump(m: Message): string { + let r = ""; + + if (m._capnp.segments.length === 0) { + return "================\nNo Segments\n================\n"; + } + + for (let i = 0; i < m._capnp.segments.length; i++) { + r += `================\nSegment #${i}\n================\n`; + + const { buffer, byteLength } = m._capnp.segments[i]; + const b = new Uint8Array(buffer, 0, byteLength); + + r += dumpBuffer(b); + } + + return r; +} + +export function getRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T { + const root = new RootStruct(m.getSegment(0), 0); + + validate(PointerType.STRUCT, root); + + const ts = getTargetStructSize(root); + + // Make sure the underlying pointer is actually big enough to hold the data and pointers as specified in the schema. + // If not a shallow copy of the struct contents needs to be made before returning. + + if ( + ts.dataByteLength < RootStruct._capnp.size.dataByteLength || + ts.pointerLength < RootStruct._capnp.size.pointerLength + ) { + trace("need to resize root struct %s", root); + + resize(RootStruct._capnp.size, root); + } + + return root; +} + +export function getSegment(id: number, m: Message): Segment { + const segmentLength = m._capnp.segments.length; + + if (id === 0 && segmentLength === 0) { + // Segment zero is special. If we have no segments in the arena we'll want to allocate a new one and leave room + // for the root pointer. + + const arenaSegments = Arena.getNumSegments(m._capnp.arena); + + if (arenaSegments === 0) { + allocateSegment(DEFAULT_BUFFER_SIZE, m); + } else { + // Okay, the arena already has a buffer we can use. This is totally fine. + + m._capnp.segments[0] = new Segment(0, m, Arena.getBuffer(0, m._capnp.arena)); + } + + if (!m._capnp.segments[0].hasCapacity(8)) { + throw new Error(MSG_SEGMENT_TOO_SMALL); + } + + // This will leave room for the root pointer. + + m._capnp.segments[0].allocate(8); + + return m._capnp.segments[0]; + } + + if (id < 0 || id >= segmentLength) { + throw new Error(format(MSG_SEGMENT_OUT_OF_BOUNDS, id, m)); + } + + return m._capnp.segments[id]; +} + +export function initRoot<T extends Struct>(RootStruct: StructCtor<T>, m: Message): T { + const root = new RootStruct(m.getSegment(0), 0); + + initStruct(RootStruct._capnp.size, root); + + trace("Initialized root pointer %s for %s.", root, m); + + return root; +} + +/** + * Read a pointer in raw form (a packed message with framing headers). Does not + * care or attempt to validate the input beyond parsing the message + * segments. + * + * This is typically used by the compiler to load default values, but can be + * useful to work with messages with an unknown schema. + * + * @param {ArrayBuffer} data The raw data to read. + * @returns {Pointer} A root pointer. + */ + +export function readRawPointer(data: ArrayBuffer): Pointer { + return new Pointer(new Message(data).getSegment(0), 0); +} + +export function setRoot(src: Pointer, m: Message): void { + Pointer.copyFrom(src, new Pointer(m.getSegment(0), 0)); +} + +export function toArrayBuffer(m: Message): ArrayBuffer { + const streamFrame = getStreamFrame(m); + + // Make sure the first segment is allocated. + + if (m._capnp.segments.length === 0) getSegment(0, m); + + const segments = m._capnp.segments; + + // Add space for the stream framing. + + const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + padToWord(s.byteLength), 0); + const out = new Uint8Array(new ArrayBuffer(totalLength)); + let o = streamFrame.byteLength; + + out.set(new Uint8Array(streamFrame)); + + segments.forEach((s) => { + const segmentLength = padToWord(s.byteLength); + out.set(new Uint8Array(s.buffer, 0, segmentLength), o); + + o += segmentLength; + }); + + return out.buffer; +} + +export function toPackedArrayBuffer(m: Message): ArrayBuffer { + const streamFrame = pack(getStreamFrame(m)); + + // Make sure the first segment is allocated. + + if (m._capnp.segments.length === 0) m.getSegment(0); + + // NOTE: A copy operation can be avoided here if we capture the intermediate array and use that directly in the copy + // loop below, rather than have `pack()` copy it to an ArrayBuffer just to have to copy it again later. If the + // intermediate array can be avoided altogether that's even better! + const segments = m._capnp.segments.map((s) => pack(s.buffer, 0, padToWord(s.byteLength))); + + const totalLength = streamFrame.byteLength + segments.reduce((l, s) => l + s.byteLength, 0); + const out = new Uint8Array(new ArrayBuffer(totalLength)); + let o = streamFrame.byteLength; + + out.set(new Uint8Array(streamFrame)); + + segments.forEach((s) => { + out.set(new Uint8Array(s), o); + + o += s.byteLength; + }); + + return out.buffer; +} + +export function getStreamFrame(m: Message): ArrayBuffer { + const length = m._capnp.segments.length; + + if (length === 0) { + // Don't bother allocating the first segment, just return a single zero word for the frame header. + + return new Float64Array(1).buffer; + } + + const frameLength = 4 + length * 4 + (1 - (length % 2)) * 4; + const out = new DataView(new ArrayBuffer(frameLength)); + + trace("Writing message stream frame with segment count: %d.", length); + + out.setUint32(0, length - 1, true); + + m._capnp.segments.forEach((s, i) => { + trace("Message segment %d word count: %d.", s.id, s.byteLength / 8); + + out.setUint32(i * 4 + 4, s.byteLength / 8, true); + }); + + return out.buffer; +} diff --git a/node_modules/capnp-ts/src/serialization/object-size.d.ts b/node_modules/capnp-ts/src/serialization/object-size.d.ts new file mode 100644 index 0000000..bd56f04 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/object-size.d.ts @@ -0,0 +1,21 @@ +/** + * @author jdiaz5513 + */ +/** + * A simple object that describes the size of a struct. + * + * @export + * @class ObjectSize + */ +export declare class ObjectSize { + /** The number of bytes required for the data section. */ + readonly dataByteLength: number; + /** The number of pointers in the object. */ + readonly pointerLength: number; + constructor(dataByteLength: number, pointerCount: number); + toString(): string; +} +export declare function getByteLength(o: ObjectSize): number; +export declare function getDataWordLength(o: ObjectSize): number; +export declare function getWordLength(o: ObjectSize): number; +export declare function padToWord(o: ObjectSize): ObjectSize; diff --git a/node_modules/capnp-ts/src/serialization/object-size.js b/node_modules/capnp-ts/src/serialization/object-size.js new file mode 100644 index 0000000..2a41040 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/object-size.js @@ -0,0 +1,44 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.padToWord = exports.getWordLength = exports.getDataWordLength = exports.getByteLength = exports.ObjectSize = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const _ = tslib_1.__importStar(require("../util")); +const trace = debug_1.default("capnp:object-size"); +trace("load"); +/** + * A simple object that describes the size of a struct. + * + * @export + * @class ObjectSize + */ +class ObjectSize { + constructor(dataByteLength, pointerCount) { + this.dataByteLength = dataByteLength; + this.pointerLength = pointerCount; + } + toString() { + return _.format("ObjectSize_dw:%d,pc:%d", getDataWordLength(this), this.pointerLength); + } +} +exports.ObjectSize = ObjectSize; +function getByteLength(o) { + return o.dataByteLength + o.pointerLength * 8; +} +exports.getByteLength = getByteLength; +function getDataWordLength(o) { + return o.dataByteLength / 8; +} +exports.getDataWordLength = getDataWordLength; +function getWordLength(o) { + return o.dataByteLength / 8 + o.pointerLength; +} +exports.getWordLength = getWordLength; +function padToWord(o) { + return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength); +} +exports.padToWord = padToWord; +//# sourceMappingURL=object-size.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/object-size.js.map b/node_modules/capnp-ts/src/serialization/object-size.js.map new file mode 100644 index 0000000..f0960e6 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/object-size.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/object-size.ts b/node_modules/capnp-ts/src/serialization/object-size.ts new file mode 100644 index 0000000..1051a07 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/object-size.ts @@ -0,0 +1,56 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import * as _ from "../util"; + +const trace = initTrace("capnp:object-size"); +trace("load"); + +/** + * A simple object that describes the size of a struct. + * + * @export + * @class ObjectSize + */ + +export class ObjectSize { + /** The number of bytes required for the data section. */ + + readonly dataByteLength: number; + + /** The number of pointers in the object. */ + + readonly pointerLength: number; + + constructor(dataByteLength: number, pointerCount: number) { + this.dataByteLength = dataByteLength; + this.pointerLength = pointerCount; + } + + toString(): string { + return _.format( + "ObjectSize_dw:%d,pc:%d", + getDataWordLength(this), + this.pointerLength + ); + } +} + +export function getByteLength(o: ObjectSize): number { + return o.dataByteLength + o.pointerLength * 8; +} + +export function getDataWordLength(o: ObjectSize): number { + return o.dataByteLength / 8; +} + +export function getWordLength(o: ObjectSize): number { + return o.dataByteLength / 8 + o.pointerLength; +} + +export function padToWord(o: ObjectSize): ObjectSize { + return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength); +} diff --git a/node_modules/capnp-ts/src/serialization/packing.d.ts b/node_modules/capnp-ts/src/serialization/packing.d.ts new file mode 100644 index 0000000..7127bda --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/packing.d.ts @@ -0,0 +1,78 @@ +/** + * @author jdiaz5513 + */ +/** + * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte + * while computing the size of a packed message. + * + * WARNING: Using this with floating point numbers will void your warranty. + * + * @param {number} x A real integer. + * @returns {number} The hamming weight (integer). + */ +export declare function getHammingWeight(x: number): number; +export declare type byte = number; +/** + * Compute the tag byte from the 8 bytes of a 64-bit word. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The tag byte. + */ +export declare function getTagByte(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number; +/** + * Efficiently calculate the length of a packed Cap'n Proto message. + * + * @export + * @param {ArrayBuffer} packed The packed message. + * @returns {number} The length of the unpacked message in bytes. + */ +export declare function getUnpackedByteLength(packed: ArrayBuffer): number; +/** + * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The number of these bytes that are zero. + */ +export declare function getZeroByteCount(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number; +/** + * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which + * are common in idiomatic Cap'n Proto messages) into a compact form. + * + * For stream-framed messages this is called once for the frame header and once again for each segment in the message. + * + * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end. + * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each + * packed byte until the packing is complete). + * + * @export + * @param {ArrayBuffer} unpacked The message to pack. + * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0. + * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents. + * @returns {ArrayBuffer} A packed version of the message. + */ +export declare function pack(unpacked: ArrayBuffer, byteOffset?: number, byteLength?: number): ArrayBuffer; +/** + * Unpack a compressed Cap'n Proto message into a new ArrayBuffer. + * + * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and + * runs considerably more efficiently. + * + * @export + * @param {ArrayBuffer} packed An array buffer containing the packed message. + * @returns {ArrayBuffer} The unpacked message. + */ +export declare function unpack(packed: ArrayBuffer): ArrayBuffer; diff --git a/node_modules/capnp-ts/src/serialization/packing.js b/node_modules/capnp-ts/src/serialization/packing.js new file mode 100644 index 0000000..ac359d3 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/packing.js @@ -0,0 +1,274 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unpack = exports.pack = exports.getZeroByteCount = exports.getUnpackedByteLength = exports.getTagByte = exports.getHammingWeight = void 0; +const constants_1 = require("../constants"); +const errors_1 = require("../errors"); +/** + * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte + * while computing the size of a packed message. + * + * WARNING: Using this with floating point numbers will void your warranty. + * + * @param {number} x A real integer. + * @returns {number} The hamming weight (integer). + */ +function getHammingWeight(x) { + // Thanks, HACKMEM! + let w = x - ((x >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + return (((w + (w >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24; +} +exports.getHammingWeight = getHammingWeight; +/** + * Compute the tag byte from the 8 bytes of a 64-bit word. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The tag byte. + */ +function getTagByte(a, b, c, d, e, f, g, h) { + // Yes, it's pretty. Don't touch it. + return ((a === 0 ? 0 : 0b00000001) | + (b === 0 ? 0 : 0b00000010) | + (c === 0 ? 0 : 0b00000100) | + (d === 0 ? 0 : 0b00001000) | + (e === 0 ? 0 : 0b00010000) | + (f === 0 ? 0 : 0b00100000) | + (g === 0 ? 0 : 0b01000000) | + (h === 0 ? 0 : 0b10000000)); +} +exports.getTagByte = getTagByte; +/** + * Efficiently calculate the length of a packed Cap'n Proto message. + * + * @export + * @param {ArrayBuffer} packed The packed message. + * @returns {number} The length of the unpacked message in bytes. + */ +function getUnpackedByteLength(packed) { + const p = new Uint8Array(packed); + let wordLength = 0; + let lastTag = 0x77; + for (let i = 0; i < p.byteLength;) { + const tag = p[i]; + if (lastTag === 0 /* ZERO */) { + wordLength += tag; + i++; + lastTag = 0x77; + } + else if (lastTag === 255 /* SPAN */) { + wordLength += tag; + i += tag * 8 + 1; + lastTag = 0x77; + } + else { + wordLength++; + i += getHammingWeight(tag) + 1; + lastTag = tag; + } + } + return wordLength * 8; +} +exports.getUnpackedByteLength = getUnpackedByteLength; +/** + * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The number of these bytes that are zero. + */ +function getZeroByteCount(a, b, c, d, e, f, g, h) { + return ((a === 0 ? 1 : 0) + + (b === 0 ? 1 : 0) + + (c === 0 ? 1 : 0) + + (d === 0 ? 1 : 0) + + (e === 0 ? 1 : 0) + + (f === 0 ? 1 : 0) + + (g === 0 ? 1 : 0) + + (h === 0 ? 1 : 0)); +} +exports.getZeroByteCount = getZeroByteCount; +/** + * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which + * are common in idiomatic Cap'n Proto messages) into a compact form. + * + * For stream-framed messages this is called once for the frame header and once again for each segment in the message. + * + * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end. + * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each + * packed byte until the packing is complete). + * + * @export + * @param {ArrayBuffer} unpacked The message to pack. + * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0. + * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents. + * @returns {ArrayBuffer} A packed version of the message. + */ +function pack(unpacked, byteOffset = 0, byteLength) { + if (unpacked.byteLength % 8 !== 0) + throw new Error(errors_1.MSG_PACK_NOT_WORD_ALIGNED); + const src = new Uint8Array(unpacked, byteOffset, byteLength); + // TODO: Maybe we should do this with buffers? This costs more than 8x the final compressed size in temporary RAM. + const dst = []; + /* Just have to be sure it's neither ZERO nor SPAN. */ + let lastTag = 0x77; + /** This is where we need to remember to write the SPAN tag (0xff). */ + let spanTagOffset = NaN; + /** How many words have been copied during the current span. */ + let spanWordLength = 0; + /** + * When this hits zero, we've had PACK_SPAN_THRESHOLD zero bytes pass by and it's time to bail from the span. + */ + let spanThreshold = constants_1.PACK_SPAN_THRESHOLD; + for (let srcByteOffset = 0; srcByteOffset < src.byteLength; srcByteOffset += 8) { + /** Read in the entire word. Yes, this feels silly but it's fast! */ + const a = src[srcByteOffset]; + const b = src[srcByteOffset + 1]; + const c = src[srcByteOffset + 2]; + const d = src[srcByteOffset + 3]; + const e = src[srcByteOffset + 4]; + const f = src[srcByteOffset + 5]; + const g = src[srcByteOffset + 6]; + const h = src[srcByteOffset + 7]; + const tag = getTagByte(a, b, c, d, e, f, g, h); + /** If this is true we'll skip the normal word write logic after the switch statement. */ + let skipWriteWord = true; + switch (lastTag) { + case 0 /* ZERO */: + // We're writing a span of words with all zeroes in them. See if we need to bail out of the fast path. + if (tag !== 0 /* ZERO */ || spanWordLength >= 0xff) { + // There's a bit in there or we got too many zeroes. Damn, we need to bail. + dst.push(spanWordLength); + spanWordLength = 0; + skipWriteWord = false; + } + else { + // Kay, let's quickly inc this and go. + spanWordLength++; + } + break; + case 255 /* SPAN */: { + // We're writing a span of nonzero words. + const zeroCount = getZeroByteCount(a, b, c, d, e, f, g, h); + // See if we need to bail now. + spanThreshold -= zeroCount; + if (spanThreshold <= 0 || spanWordLength >= 0xff) { + // Alright, time to get packing again. Write the number of words we skipped to the beginning of the span. + dst[spanTagOffset] = spanWordLength; + spanWordLength = 0; + spanThreshold = constants_1.PACK_SPAN_THRESHOLD; + // We have to write this word normally. + skipWriteWord = false; + } + else { + // Just write this word verbatim. + dst.push(a, b, c, d, e, f, g, h); + spanWordLength++; + } + break; + } + default: + // Didn't get a special tag last time, let's write this as normal. + skipWriteWord = false; + break; + } + // A goto is fast, idk why people keep hatin'. + if (skipWriteWord) + continue; + dst.push(tag); + lastTag = tag; + if (a !== 0) + dst.push(a); + if (b !== 0) + dst.push(b); + if (c !== 0) + dst.push(c); + if (d !== 0) + dst.push(d); + if (e !== 0) + dst.push(e); + if (f !== 0) + dst.push(f); + if (g !== 0) + dst.push(g); + if (h !== 0) + dst.push(h); + // Record the span tag offset if needed, making sure to actually leave room for it. + if (tag === 255 /* SPAN */) { + spanTagOffset = dst.length; + dst.push(0); + } + } + // We're done. If we were writing a span let's finish it. + if (lastTag === 0 /* ZERO */) { + dst.push(spanWordLength); + } + else if (lastTag === 255 /* SPAN */) { + dst[spanTagOffset] = spanWordLength; + } + return new Uint8Array(dst).buffer; +} +exports.pack = pack; +/** + * Unpack a compressed Cap'n Proto message into a new ArrayBuffer. + * + * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and + * runs considerably more efficiently. + * + * @export + * @param {ArrayBuffer} packed An array buffer containing the packed message. + * @returns {ArrayBuffer} The unpacked message. + */ +function unpack(packed) { + // We have no choice but to read the packed buffer one byte at a time. + const src = new Uint8Array(packed); + const dst = new Uint8Array(new ArrayBuffer(getUnpackedByteLength(packed))); + /** The last tag byte that we've seen - it starts at a "neutral" value. */ + let lastTag = 0x77; + for (let srcByteOffset = 0, dstByteOffset = 0; srcByteOffset < src.byteLength;) { + const tag = src[srcByteOffset]; + if (lastTag === 0 /* ZERO */) { + // We have a span of zeroes. New array buffers are guaranteed to be initialized to zero so we just seek ahead. + dstByteOffset += tag * 8; + srcByteOffset++; + lastTag = 0x77; + } + else if (lastTag === 255 /* SPAN */) { + // We have a span of unpacked bytes. Copy them verbatim from the source buffer. + const spanByteLength = tag * 8; + dst.set(src.subarray(srcByteOffset + 1, srcByteOffset + 1 + spanByteLength), dstByteOffset); + dstByteOffset += spanByteLength; + srcByteOffset += 1 + spanByteLength; + lastTag = 0x77; + } + else { + // Okay, a normal tag. Let's read past the tag and copy bytes that have a bit set in the tag. + srcByteOffset++; + for (let i = 1; i <= 0b10000000; i <<= 1) { + // We only need to actually touch `dst` if there's a nonzero byte (it's already initialized to zeroes). + if ((tag & i) !== 0) + dst[dstByteOffset] = src[srcByteOffset++]; + dstByteOffset++; + } + lastTag = tag; + } + } + return dst.buffer; +} +exports.unpack = unpack; +//# sourceMappingURL=packing.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/packing.js.map b/node_modules/capnp-ts/src/serialization/packing.js.map new file mode 100644 index 0000000..ce5c80d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/packing.js.map @@ -0,0 +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;QAC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EAA0E;IAE1E,IAAI,OAAO,GAAG,IAAI,CAAC;IAEnB,KAAK,IAAI,aAAa,GAAG,CAAC,EAAE,aAAa,GAAG,CAAC,EAAE,aAAa,GAAG,GAAG,CAAC,UAAU,GAAI;QAC/E,MAAM,GAAG,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;QAE/B,IAAI,OAAO,iBAAmB,EAAE;YAC9B,8GAA8G;YAE9G,aAAa,IAAI,GAAG,GAAG,CAAC,CAAC;YAEzB,aAAa,EAAE,CAAC;YAEhB,OAAO,GAAG,IAAI,CAAC;SAChB;aAAM,IAAI,OAAO,mBAAmB,EAAE;YACrC,+EAA+E;YAE/E,MAAM,cAAc,GAAG,GAAG,GAAG,CAAC,CAAC;YAE/B,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC,EAAE,aAAa,GAAG,CAAC,GAAG,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC;YAE5F,aAAa,IAAI,cAAc,CAAC;YAChC,aAAa,IAAI,CAAC,GAAG,cAAc,CAAC;YAEpC,OAAO,GAAG,IAAI,CAAC;SAChB;aAAM;YACL,6FAA6F;YAE7F,aAAa,EAAE,CAAC;YAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE;gBACxC,uGAAuG;gBAEvG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC;oBAAE,GAAG,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;gBAE/D,aAAa,EAAE,CAAC;aACjB;YAED,OAAO,GAAG,GAAG,CAAC;SACf;KACF;IAED,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAlDD,wBAkDC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/packing.ts b/node_modules/capnp-ts/src/serialization/packing.ts new file mode 100644 index 0000000..31e9b6d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/packing.ts @@ -0,0 +1,372 @@ +/** + * @author jdiaz5513 + */ + +import { PACK_SPAN_THRESHOLD } from "../constants"; +import { MSG_PACK_NOT_WORD_ALIGNED } from "../errors"; + +/** + * When packing a message there are two tags that are interpreted in a special way: `0x00` and `0xff`. + * + * @enum {number} + */ + +const enum PackedTag { + /** + * The tag is followed by a single byte which indicates a count of consecutive zero-valued words, minus 1. E.g. if the + * tag 0x00 is followed by 0x05, the sequence unpacks to 6 words of zero. + * + * Or, put another way: the tag is first decoded as if it were not special. Since none of the bits are set, it is + * followed by no bytes and expands to a word full of zeros. After that, the next byte is interpreted as a count of + * additional words that are also all-zero. + */ + + ZERO = 0x00, + + /** + * The tag is followed by the bytes of the word (as if it weren’t special), but after those bytes is another byte with + * value N. Following that byte is N unpacked words that should be copied directly. + * + * These unpacked words may contain zeroes; in this implementation a minimum of PACK_SPAN_THRESHOLD zero bytes are + * written before ending the span. + * + * The purpose of this rule is to minimize the impact of packing on data that doesn’t contain any zeros – in + * particular, long text blobs. Because of this rule, the worst-case space overhead of packing is 2 bytes per 2 KiB of + * input (256 words = 2KiB). + */ + + SPAN = 0xff, +} + +/** + * Compute the Hamming weight (number of bits set to 1) of a number. Used to figure out how many bytes follow a tag byte + * while computing the size of a packed message. + * + * WARNING: Using this with floating point numbers will void your warranty. + * + * @param {number} x A real integer. + * @returns {number} The hamming weight (integer). + */ + +export function getHammingWeight(x: number): number { + // Thanks, HACKMEM! + + let w = x - ((x >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + return (((w + (w >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24; +} + +export type byte = number; + +/** + * Compute the tag byte from the 8 bytes of a 64-bit word. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The tag byte. + */ + +export function getTagByte(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number { + // Yes, it's pretty. Don't touch it. + + return ( + (a === 0 ? 0 : 0b00000001) | + (b === 0 ? 0 : 0b00000010) | + (c === 0 ? 0 : 0b00000100) | + (d === 0 ? 0 : 0b00001000) | + (e === 0 ? 0 : 0b00010000) | + (f === 0 ? 0 : 0b00100000) | + (g === 0 ? 0 : 0b01000000) | + (h === 0 ? 0 : 0b10000000) + ); +} + +/** + * Efficiently calculate the length of a packed Cap'n Proto message. + * + * @export + * @param {ArrayBuffer} packed The packed message. + * @returns {number} The length of the unpacked message in bytes. + */ + +export function getUnpackedByteLength(packed: ArrayBuffer): number { + const p = new Uint8Array(packed); + let wordLength = 0; + let lastTag = 0x77; + + for (let i = 0; i < p.byteLength; ) { + const tag = p[i]; + + if (lastTag === PackedTag.ZERO) { + wordLength += tag; + + i++; + + lastTag = 0x77; + } else if (lastTag === PackedTag.SPAN) { + wordLength += tag; + + i += tag * 8 + 1; + + lastTag = 0x77; + } else { + wordLength++; + + i += getHammingWeight(tag) + 1; + + lastTag = tag; + } + } + + return wordLength * 8; +} + +/** + * Compute the number of zero bytes that occur in a given 64-bit word, provided as eight separate bytes. + * + * @param {byte} a The first byte. + * @param {byte} b The second byte. + * @param {byte} c The third byte. + * @param {byte} d The fourth byte. + * @param {byte} e The fifth byte. + * @param {byte} f The sixth byte. + * @param {byte} g The seventh byte. + * @param {byte} h The eighth byte (phew!). + * @returns {number} The number of these bytes that are zero. + */ + +export function getZeroByteCount(a: byte, b: byte, c: byte, d: byte, e: byte, f: byte, g: byte, h: byte): number { + return ( + (a === 0 ? 1 : 0) + + (b === 0 ? 1 : 0) + + (c === 0 ? 1 : 0) + + (d === 0 ? 1 : 0) + + (e === 0 ? 1 : 0) + + (f === 0 ? 1 : 0) + + (g === 0 ? 1 : 0) + + (h === 0 ? 1 : 0) + ); +} + +/** + * Pack a section of a Cap'n Proto message into a compressed format. This will efficiently compress zero bytes (which + * are common in idiomatic Cap'n Proto messages) into a compact form. + * + * For stream-framed messages this is called once for the frame header and once again for each segment in the message. + * + * The returned array buffer is trimmed to the exact size of the packed message with a single copy operation at the end. + * This should be decent on CPU time but does require quite a lot of memory (a normal array is filled up with each + * packed byte until the packing is complete). + * + * @export + * @param {ArrayBuffer} unpacked The message to pack. + * @param {number} [byteOffset] Starting byte offset to read bytes from, defaults to 0. + * @param {number} [byteLength] Total number of bytes to read, defaults to the remainder of the buffer contents. + * @returns {ArrayBuffer} A packed version of the message. + */ + +export function pack(unpacked: ArrayBuffer, byteOffset = 0, byteLength?: number): ArrayBuffer { + if (unpacked.byteLength % 8 !== 0) throw new Error(MSG_PACK_NOT_WORD_ALIGNED); + + const src = new Uint8Array(unpacked, byteOffset, byteLength); + + // TODO: Maybe we should do this with buffers? This costs more than 8x the final compressed size in temporary RAM. + + const dst: number[] = []; + + /* Just have to be sure it's neither ZERO nor SPAN. */ + + let lastTag = 0x77; + + /** This is where we need to remember to write the SPAN tag (0xff). */ + + let spanTagOffset = NaN; + + /** How many words have been copied during the current span. */ + + let spanWordLength = 0; + + /** + * When this hits zero, we've had PACK_SPAN_THRESHOLD zero bytes pass by and it's time to bail from the span. + */ + + let spanThreshold = PACK_SPAN_THRESHOLD; + + for (let srcByteOffset = 0; srcByteOffset < src.byteLength; srcByteOffset += 8) { + /** Read in the entire word. Yes, this feels silly but it's fast! */ + + const a = src[srcByteOffset]; + const b = src[srcByteOffset + 1]; + const c = src[srcByteOffset + 2]; + const d = src[srcByteOffset + 3]; + const e = src[srcByteOffset + 4]; + const f = src[srcByteOffset + 5]; + const g = src[srcByteOffset + 6]; + const h = src[srcByteOffset + 7]; + + const tag = getTagByte(a, b, c, d, e, f, g, h); + + /** If this is true we'll skip the normal word write logic after the switch statement. */ + + let skipWriteWord = true; + + switch (lastTag) { + case PackedTag.ZERO: + // We're writing a span of words with all zeroes in them. See if we need to bail out of the fast path. + + if (tag !== PackedTag.ZERO || spanWordLength >= 0xff) { + // There's a bit in there or we got too many zeroes. Damn, we need to bail. + + dst.push(spanWordLength); + spanWordLength = 0; + + skipWriteWord = false; + } else { + // Kay, let's quickly inc this and go. + + spanWordLength++; + } + + break; + + case PackedTag.SPAN: { + // We're writing a span of nonzero words. + + const zeroCount = getZeroByteCount(a, b, c, d, e, f, g, h); + + // See if we need to bail now. + + spanThreshold -= zeroCount; + + if (spanThreshold <= 0 || spanWordLength >= 0xff) { + // Alright, time to get packing again. Write the number of words we skipped to the beginning of the span. + + dst[spanTagOffset] = spanWordLength; + spanWordLength = 0; + + spanThreshold = PACK_SPAN_THRESHOLD; + + // We have to write this word normally. + + skipWriteWord = false; + } else { + // Just write this word verbatim. + + dst.push(a, b, c, d, e, f, g, h); + + spanWordLength++; + } + + break; + } + default: + // Didn't get a special tag last time, let's write this as normal. + + skipWriteWord = false; + + break; + } + + // A goto is fast, idk why people keep hatin'. + if (skipWriteWord) continue; + + dst.push(tag); + lastTag = tag; + + if (a !== 0) dst.push(a); + if (b !== 0) dst.push(b); + if (c !== 0) dst.push(c); + if (d !== 0) dst.push(d); + if (e !== 0) dst.push(e); + if (f !== 0) dst.push(f); + if (g !== 0) dst.push(g); + if (h !== 0) dst.push(h); + + // Record the span tag offset if needed, making sure to actually leave room for it. + + if (tag === PackedTag.SPAN) { + spanTagOffset = dst.length; + + dst.push(0); + } + } + + // We're done. If we were writing a span let's finish it. + + if (lastTag === PackedTag.ZERO) { + dst.push(spanWordLength); + } else if (lastTag === PackedTag.SPAN) { + dst[spanTagOffset] = spanWordLength; + } + + return new Uint8Array(dst).buffer; +} + +/** + * Unpack a compressed Cap'n Proto message into a new ArrayBuffer. + * + * Unlike the `pack` function, this is able to efficiently determine the exact size needed for the output buffer and + * runs considerably more efficiently. + * + * @export + * @param {ArrayBuffer} packed An array buffer containing the packed message. + * @returns {ArrayBuffer} The unpacked message. + */ + +export function unpack(packed: ArrayBuffer): ArrayBuffer { + // We have no choice but to read the packed buffer one byte at a time. + + const src = new Uint8Array(packed); + const dst = new Uint8Array(new ArrayBuffer(getUnpackedByteLength(packed))); + + /** The last tag byte that we've seen - it starts at a "neutral" value. */ + + let lastTag = 0x77; + + for (let srcByteOffset = 0, dstByteOffset = 0; srcByteOffset < src.byteLength; ) { + const tag = src[srcByteOffset]; + + if (lastTag === PackedTag.ZERO) { + // We have a span of zeroes. New array buffers are guaranteed to be initialized to zero so we just seek ahead. + + dstByteOffset += tag * 8; + + srcByteOffset++; + + lastTag = 0x77; + } else if (lastTag === PackedTag.SPAN) { + // We have a span of unpacked bytes. Copy them verbatim from the source buffer. + + const spanByteLength = tag * 8; + + dst.set(src.subarray(srcByteOffset + 1, srcByteOffset + 1 + spanByteLength), dstByteOffset); + + dstByteOffset += spanByteLength; + srcByteOffset += 1 + spanByteLength; + + lastTag = 0x77; + } else { + // Okay, a normal tag. Let's read past the tag and copy bytes that have a bit set in the tag. + + srcByteOffset++; + + for (let i = 1; i <= 0b10000000; i <<= 1) { + // We only need to actually touch `dst` if there's a nonzero byte (it's already initialized to zeroes). + + if ((tag & i) !== 0) dst[dstByteOffset] = src[srcByteOffset++]; + + dstByteOffset++; + } + + lastTag = tag; + } + } + + return dst.buffer; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.d.ts new file mode 100644 index 0000000..742faf1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.d.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ +import { ListCtor } from "./list"; +import { Pointer } from "./pointer"; +export declare const AnyPointerList: ListCtor<Pointer>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js new file mode 100644 index 0000000..cfc67c2 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js @@ -0,0 +1,10 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnyPointerList = void 0; +const pointer_1 = require("./pointer"); +const pointer_list_1 = require("./pointer-list"); +exports.AnyPointerList = pointer_list_1.PointerList(pointer_1.Pointer); +//# sourceMappingURL=any-pointer-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js.map new file mode 100644 index 0000000..3338c88 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.ts b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.ts new file mode 100644 index 0000000..f9dc979 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/any-pointer-list.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ + +import { ListCtor } from "./list"; +import { Pointer } from "./pointer"; +import { PointerList } from "./pointer-list"; + +export const AnyPointerList: ListCtor<Pointer> = PointerList(Pointer); diff --git a/node_modules/capnp-ts/src/serialization/pointers/bool-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/bool-list.d.ts new file mode 100644 index 0000000..0a6548f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/bool-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class BoolList extends List<boolean> { + static readonly _capnp: _ListCtor; + get(index: number): boolean; + set(index: number, value: boolean): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/bool-list.js b/node_modules/capnp-ts/src/serialization/pointers/bool-list.js new file mode 100644 index 0000000..e9ff3ca --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/bool-list.js @@ -0,0 +1,38 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BoolList = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class BoolList extends list_1.List { + get(index) { + const bitMask = 1 << index % 8; + const byteOffset = index >>> 3; + const c = pointer_1.getContent(this); + const v = c.segment.getUint8(c.byteOffset + byteOffset); + return (v & bitMask) !== 0; + } + set(index, value) { + const bitMask = 1 << index % 8; + const c = pointer_1.getContent(this); + const byteOffset = c.byteOffset + (index >>> 3); + const v = c.segment.getUint8(byteOffset); + c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask); + } + toString() { + return `Bool_${super.toString()}`; + } +} +exports.BoolList = BoolList; +BoolList._capnp = { + displayName: "List<boolean>", + size: list_element_size_1.ListElementSize.BIT +}; +//# sourceMappingURL=bool-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/bool-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/bool-list.js.map new file mode 100644 index 0000000..c280878 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/bool-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts b/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts new file mode 100644 index 0000000..26836bc --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts @@ -0,0 +1,41 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class BoolList extends List<boolean> { + static readonly _capnp: _ListCtor = { + displayName: "List<boolean>" as string, + size: ListElementSize.BIT + }; + + get(index: number): boolean { + const bitMask = 1 << index % 8; + const byteOffset = index >>> 3; + const c = getContent(this); + const v = c.segment.getUint8(c.byteOffset + byteOffset); + + return (v & bitMask) !== 0; + } + + set(index: number, value: boolean): void { + const bitMask = 1 << index % 8; + const c = getContent(this); + const byteOffset = c.byteOffset + (index >>> 3); + const v = c.segment.getUint8(byteOffset); + + c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask); + } + + toString(): string { + return `Bool_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/composite-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/composite-list.d.ts new file mode 100644 index 0000000..1031067 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/composite-list.d.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ +import { ListCtor } from "./list"; +import { Struct, StructCtor } from "./struct"; +export declare function CompositeList<T extends Struct>(CompositeClass: StructCtor<T>): ListCtor<T>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/composite-list.js b/node_modules/capnp-ts/src/serialization/pointers/composite-list.js new file mode 100644 index 0000000..5e83117 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/composite-list.js @@ -0,0 +1,35 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CompositeList = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +function CompositeList(CompositeClass) { + var _a; + return _a = class extends list_1.List { + get(index) { + return new CompositeClass(this.segment, this.byteOffset, this._capnp.depthLimit - 1, index); + } + set(index, value) { + pointer_1.copyFrom(value, this.get(index)); + } + toString() { + return `Composite_${super.toString()},cls:${CompositeClass.toString()}`; + } + }, + _a._capnp = { + compositeSize: CompositeClass._capnp.size, + displayName: `List<${CompositeClass._capnp.displayName}>`, + size: list_element_size_1.ListElementSize.COMPOSITE, + }, + _a; +} +exports.CompositeList = CompositeList; +//# sourceMappingURL=composite-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/composite-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/composite-list.js.map new file mode 100644 index 0000000..359c5e6 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/composite-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/composite-list.ts b/node_modules/capnp-ts/src/serialization/pointers/composite-list.ts new file mode 100644 index 0000000..6338244 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/composite-list.ts @@ -0,0 +1,35 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List, ListCtor } from "./list"; +import { Struct, StructCtor } from "./struct"; +import { copyFrom } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export function CompositeList<T extends Struct>(CompositeClass: StructCtor<T>): ListCtor<T> { + return class extends List<T> { + static readonly _capnp: _ListCtor = { + compositeSize: CompositeClass._capnp.size, + displayName: `List<${CompositeClass._capnp.displayName}>`, + size: ListElementSize.COMPOSITE, + }; + + get(index: number): T { + return new CompositeClass(this.segment, this.byteOffset, this._capnp.depthLimit - 1, index); + } + + set(index: number, value: T): void { + copyFrom(value, this.get(index)); + } + + toString(): string { + return `Composite_${super.toString()},cls:${CompositeClass.toString()}`; + } + }; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/data-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/data-list.d.ts new file mode 100644 index 0000000..f1381fa --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data-list.d.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ +import { Data } from "./data"; +import { ListCtor } from "./list"; +export declare const DataList: ListCtor<Data>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/data-list.js b/node_modules/capnp-ts/src/serialization/pointers/data-list.js new file mode 100644 index 0000000..62a66cb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data-list.js @@ -0,0 +1,10 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DataList = void 0; +const data_1 = require("./data"); +const pointer_list_1 = require("./pointer-list"); +exports.DataList = pointer_list_1.PointerList(data_1.Data); +//# sourceMappingURL=data-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/data-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/data-list.js.map new file mode 100644 index 0000000..aac5762 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/data-list.ts b/node_modules/capnp-ts/src/serialization/pointers/data-list.ts new file mode 100644 index 0000000..5115de7 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data-list.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ + +import { Data } from "./data"; +import { ListCtor } from "./list"; +import { PointerList } from "./pointer-list"; + +export const DataList: ListCtor<Data> = PointerList(Data); diff --git a/node_modules/capnp-ts/src/serialization/pointers/data.d.ts b/node_modules/capnp-ts/src/serialization/pointers/data.d.ts new file mode 100644 index 0000000..0055412 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data.d.ts @@ -0,0 +1,67 @@ +/** + * @author jdiaz5513 + */ +import { List } from "./list"; +import { Pointer } from "./pointer"; +/** + * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and + * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once. + * + * @export + * @class Data + * @extends {List<number>} + */ +export declare class Data extends List<number> { + static fromPointer(pointer: Pointer): Data; + protected static _fromPointerUnchecked(pointer: Pointer): Data; + /** + * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the + * remaining bytes will be zeroed out. Extra bytes in `src` are ignored. + * + * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer. + * @returns {void} + */ + copyBuffer(src: ArrayBuffer | ArrayBufferView): void; + /** + * Read a byte from the specified offset. + * + * @param {number} byteOffset The byte offset to read. + * @returns {number} The byte value. + */ + get(byteOffset: number): number; + /** + * Write a byte at the specified offset. + * + * @param {number} byteOffset The byte offset to set. + * @param {number} value The byte value to set. + * @returns {void} + */ + set(byteOffset: number, value: number): void; + /** + * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer. + * + * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`. + * + * @returns {ArrayBuffer} A copy of this data buffer. + */ + toArrayBuffer(): ArrayBuffer; + /** + * Convert this Data pointer to a DataView representing the pointer's contents. + * + * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the + * DataView or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toDataView(): DataView; + toString(): string; + /** + * Convert this Data pointer to a Uint8Array representing the pointer's contents. + * + * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the + * Uint8Array or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toUint8Array(): Uint8Array; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/data.js b/node_modules/capnp-ts/src/serialization/pointers/data.js new file mode 100644 index 0000000..6ea484d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data.js @@ -0,0 +1,118 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Data = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const pointer_type_1 = require("./pointer-type"); +const trace = debug_1.default("capnp:data"); +trace("load"); +/** + * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and + * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once. + * + * @export + * @class Data + * @extends {List<number>} + */ +class Data extends list_1.List { + static fromPointer(pointer) { + pointer_1.validate(pointer_type_1.PointerType.LIST, pointer, list_element_size_1.ListElementSize.BYTE); + return this._fromPointerUnchecked(pointer); + } + static _fromPointerUnchecked(pointer) { + return new this(pointer.segment, pointer.byteOffset, pointer._capnp.depthLimit); + } + /** + * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the + * remaining bytes will be zeroed out. Extra bytes in `src` are ignored. + * + * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer. + * @returns {void} + */ + // TODO: Would be nice to have a way to zero-copy a buffer by allocating a new segment into the message with that + // buffer data. + copyBuffer(src) { + const c = pointer_1.getContent(this); + const dstLength = this.getLength(); + const srcLength = src.byteLength; + const i = src instanceof ArrayBuffer + ? new Uint8Array(src) + : new Uint8Array(src.buffer, src.byteOffset, Math.min(dstLength, srcLength)); + const o = new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength()); + o.set(i); + if (dstLength > srcLength) { + trace("Zeroing out remaining %d bytes after copy into %s.", dstLength - srcLength, this); + o.fill(0, srcLength, dstLength); + } + else if (dstLength < srcLength) { + trace("Truncated %d bytes from source buffer while copying to %s.", srcLength - dstLength, this); + } + } + /** + * Read a byte from the specified offset. + * + * @param {number} byteOffset The byte offset to read. + * @returns {number} The byte value. + */ + get(byteOffset) { + const c = pointer_1.getContent(this); + return c.segment.getUint8(c.byteOffset + byteOffset); + } + /** + * Write a byte at the specified offset. + * + * @param {number} byteOffset The byte offset to set. + * @param {number} value The byte value to set. + * @returns {void} + */ + set(byteOffset, value) { + const c = pointer_1.getContent(this); + c.segment.setUint8(c.byteOffset + byteOffset, value); + } + /** + * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer. + * + * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`. + * + * @returns {ArrayBuffer} A copy of this data buffer. + */ + toArrayBuffer() { + const c = pointer_1.getContent(this); + return c.segment.buffer.slice(c.byteOffset, c.byteOffset + this.getLength()); + } + /** + * Convert this Data pointer to a DataView representing the pointer's contents. + * + * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the + * DataView or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toDataView() { + const c = pointer_1.getContent(this); + return new DataView(c.segment.buffer, c.byteOffset, this.getLength()); + } + toString() { + return `Data_${super.toString()}`; + } + /** + * Convert this Data pointer to a Uint8Array representing the pointer's contents. + * + * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the + * Uint8Array or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toUint8Array() { + const c = pointer_1.getContent(this); + return new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength()); + } +} +exports.Data = Data; +//# sourceMappingURL=data.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/data.js.map b/node_modules/capnp-ts/src/serialization/pointers/data.js.map new file mode 100644 index 0000000..d7d2a80 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.js","sourceRoot":"","sources":["data.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAA8B;AAC9B,uCAA0D;AAC1D,iDAA6C;AAE7C,MAAM,KAAK,GAAG,eAAS,CAAC,YAAY,CAAC,CAAC;AACtC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd;;;;;;;GAOG;AAEH,MAAa,IAAK,SAAQ,WAAY;IACpC,MAAM,CAAC,WAAW,CAAC,OAAgB;QACjC,kBAAQ,CAAC,0BAAW,CAAC,IAAI,EAAE,OAAO,EAAE,mCAAe,CAAC,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;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CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IAEH,GAAG,CAAC,UAAkB,EAAE,KAAa;QACnC,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IAEH,aAAa;QACX,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAC3B,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAChC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IAEH,UAAU;QACR,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/data.ts b/node_modules/capnp-ts/src/serialization/pointers/data.ts new file mode 100644 index 0000000..bec7df1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/data.ts @@ -0,0 +1,158 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { List } from "./list"; +import { Pointer, validate, getContent } from "./pointer"; +import { PointerType } from "./pointer-type"; + +const trace = initTrace("capnp:data"); +trace("load"); + +/** + * A generic blob of bytes. Can be converted to a DataView or Uint8Array to access its contents using `toDataView()` and + * `toUint8Array()`. Use `copyBuffer()` to copy an entire buffer at once. + * + * @export + * @class Data + * @extends {List<number>} + */ + +export class Data extends List<number> { + static fromPointer(pointer: Pointer): Data { + validate(PointerType.LIST, pointer, ListElementSize.BYTE); + + return this._fromPointerUnchecked(pointer); + } + + protected static _fromPointerUnchecked(pointer: Pointer): Data { + return new this( + pointer.segment, + pointer.byteOffset, + pointer._capnp.depthLimit + ); + } + + /** + * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the + * remaining bytes will be zeroed out. Extra bytes in `src` are ignored. + * + * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer. + * @returns {void} + */ + + // TODO: Would be nice to have a way to zero-copy a buffer by allocating a new segment into the message with that + // buffer data. + + copyBuffer(src: ArrayBuffer | ArrayBufferView): void { + const c = getContent(this); + + const dstLength = this.getLength(); + const srcLength = src.byteLength; + + const i = + src instanceof ArrayBuffer + ? new Uint8Array(src) + : new Uint8Array( + src.buffer, + src.byteOffset, + Math.min(dstLength, srcLength) + ); + + const o = new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength()); + + o.set(i); + + if (dstLength > srcLength) { + trace( + "Zeroing out remaining %d bytes after copy into %s.", + dstLength - srcLength, + this + ); + + o.fill(0, srcLength, dstLength); + } else if (dstLength < srcLength) { + trace( + "Truncated %d bytes from source buffer while copying to %s.", + srcLength - dstLength, + this + ); + } + } + + /** + * Read a byte from the specified offset. + * + * @param {number} byteOffset The byte offset to read. + * @returns {number} The byte value. + */ + + get(byteOffset: number): number { + const c = getContent(this); + return c.segment.getUint8(c.byteOffset + byteOffset); + } + + /** + * Write a byte at the specified offset. + * + * @param {number} byteOffset The byte offset to set. + * @param {number} value The byte value to set. + * @returns {void} + */ + + set(byteOffset: number, value: number): void { + const c = getContent(this); + c.segment.setUint8(c.byteOffset + byteOffset, value); + } + + /** + * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer. + * + * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`. + * + * @returns {ArrayBuffer} A copy of this data buffer. + */ + + toArrayBuffer(): ArrayBuffer { + const c = getContent(this); + return c.segment.buffer.slice( + c.byteOffset, + c.byteOffset + this.getLength() + ); + } + + /** + * Convert this Data pointer to a DataView representing the pointer's contents. + * + * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the + * DataView or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + + toDataView(): DataView { + const c = getContent(this); + return new DataView(c.segment.buffer, c.byteOffset, this.getLength()); + } + + toString(): string { + return `Data_${super.toString()}`; + } + + /** + * Convert this Data pointer to a Uint8Array representing the pointer's contents. + * + * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the + * Uint8Array or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + + toUint8Array(): Uint8Array { + const c = getContent(this); + return new Uint8Array(c.segment.buffer, c.byteOffset, this.getLength()); + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/float32-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/float32-list.d.ts new file mode 100644 index 0000000..b109a22 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float32-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Float32List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/float32-list.js b/node_modules/capnp-ts/src/serialization/pointers/float32-list.js new file mode 100644 index 0000000..8c33da1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float32-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Float32List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Float32List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getFloat32(c.byteOffset + index * 4); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setFloat32(c.byteOffset + index * 4, value); + } + toString() { + return `Float32_${super.toString()}`; + } +} +exports.Float32List = Float32List; +Float32List._capnp = { + displayName: "List<Float32>", + size: list_element_size_1.ListElementSize.BYTE_4 +}; +//# sourceMappingURL=float32-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/float32-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/float32-list.js.map new file mode 100644 index 0000000..dd79ac8 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float32-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/float32-list.ts b/node_modules/capnp-ts/src/serialization/pointers/float32-list.ts new file mode 100644 index 0000000..7de7f99 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float32-list.ts @@ -0,0 +1,35 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Float32List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Float32>" as string, + size: ListElementSize.BYTE_4 + }; + + get(index: number): number { + const c = getContent(this); + + return c.segment.getFloat32(c.byteOffset + index * 4); + } + + set(index: number, value: number): void { + const c = getContent(this); + + c.segment.setFloat32(c.byteOffset + index * 4, value); + } + + toString(): string { + return `Float32_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/float64-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/float64-list.d.ts new file mode 100644 index 0000000..877c0f5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float64-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Float64List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/float64-list.js b/node_modules/capnp-ts/src/serialization/pointers/float64-list.js new file mode 100644 index 0000000..7f681e0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float64-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Float64List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Float64List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getFloat64(c.byteOffset + index * 8); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setFloat64(c.byteOffset + index * 8, value); + } + toString() { + return `Float64_${super.toString()}`; + } +} +exports.Float64List = Float64List; +Float64List._capnp = { + displayName: "List<Float64>", + size: list_element_size_1.ListElementSize.BYTE_8 +}; +//# sourceMappingURL=float64-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/float64-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/float64-list.js.map new file mode 100644 index 0000000..f382c12 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float64-list.js.map @@ -0,0 +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"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/float64-list.ts b/node_modules/capnp-ts/src/serialization/pointers/float64-list.ts new file mode 100644 index 0000000..3dfd4b2 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/float64-list.ts @@ -0,0 +1,35 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Float64List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Float64>" as string, + size: ListElementSize.BYTE_8 + }; + + get(index: number): number { + const c = getContent(this); + + return c.segment.getFloat64(c.byteOffset + index * 8); + } + + set(index: number, value: number): void { + const c = getContent(this); + + c.segment.setFloat64(c.byteOffset + index * 8, value); + } + + toString(): string { + return `Float64_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/group.d.ts b/node_modules/capnp-ts/src/serialization/pointers/group.d.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/group.d.ts diff --git a/node_modules/capnp-ts/src/serialization/pointers/group.js b/node_modules/capnp-ts/src/serialization/pointers/group.js new file mode 100644 index 0000000..4e1f4b0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/group.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=group.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/group.js.map b/node_modules/capnp-ts/src/serialization/pointers/group.js.map new file mode 100644 index 0000000..60a2003 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/group.js.map @@ -0,0 +1 @@ +{"version":3,"file":"group.js","sourceRoot":"","sources":["group.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/group.ts b/node_modules/capnp-ts/src/serialization/pointers/group.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/group.ts diff --git a/node_modules/capnp-ts/src/serialization/pointers/index.d.ts b/node_modules/capnp-ts/src/serialization/pointers/index.d.ts new file mode 100644 index 0000000..dc013aa --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/index.d.ts @@ -0,0 +1,30 @@ +/** + * @author jdiaz5513 + */ +export { AnyPointerList } from "./any-pointer-list"; +export { BoolList } from "./bool-list"; +export { CompositeList } from "./composite-list"; +export { Data } from "./data"; +export { DataList } from "./data-list"; +export { Float32List } from "./float32-list"; +export { Float64List } from "./float64-list"; +export { Int8List } from "./int8-list"; +export { Int16List } from "./int16-list"; +export { Int32List } from "./int32-list"; +export { Int64List } from "./int64-list"; +export { Interface } from "./interface"; +export { InterfaceList } from "./interface-list"; +export { List, ListCtor } from "./list"; +export { Orphan } from "./orphan"; +export { PointerList } from "./pointer-list"; +export { PointerType } from "./pointer-type"; +export { Pointer } from "./pointer"; +export { _StructCtor, Struct, StructCtor } from "./struct"; +export { Text } from "./text"; +export { TextList } from "./text-list"; +export { Uint8List } from "./uint8-list"; +export { Uint16List } from "./uint16-list"; +export { Uint32List } from "./uint32-list"; +export { Uint64List } from "./uint64-list"; +export { Void, VOID } from "./void"; +export { VoidList } from "./void-list"; diff --git a/node_modules/capnp-ts/src/serialization/pointers/index.js b/node_modules/capnp-ts/src/serialization/pointers/index.js new file mode 100644 index 0000000..b5902c9 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/index.js @@ -0,0 +1,62 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VoidList = exports.VOID = exports.Void = exports.Uint64List = exports.Uint32List = exports.Uint16List = exports.Uint8List = exports.TextList = exports.Text = exports.Struct = exports.Pointer = exports.PointerType = exports.PointerList = exports.Orphan = exports.List = exports.InterfaceList = exports.Interface = exports.Int64List = exports.Int32List = exports.Int16List = exports.Int8List = exports.Float64List = exports.Float32List = exports.DataList = exports.Data = exports.CompositeList = exports.BoolList = exports.AnyPointerList = void 0; +var any_pointer_list_1 = require("./any-pointer-list"); +Object.defineProperty(exports, "AnyPointerList", { enumerable: true, get: function () { return any_pointer_list_1.AnyPointerList; } }); +var bool_list_1 = require("./bool-list"); +Object.defineProperty(exports, "BoolList", { enumerable: true, get: function () { return bool_list_1.BoolList; } }); +var composite_list_1 = require("./composite-list"); +Object.defineProperty(exports, "CompositeList", { enumerable: true, get: function () { return composite_list_1.CompositeList; } }); +var data_1 = require("./data"); +Object.defineProperty(exports, "Data", { enumerable: true, get: function () { return data_1.Data; } }); +var data_list_1 = require("./data-list"); +Object.defineProperty(exports, "DataList", { enumerable: true, get: function () { return data_list_1.DataList; } }); +var float32_list_1 = require("./float32-list"); +Object.defineProperty(exports, "Float32List", { enumerable: true, get: function () { return float32_list_1.Float32List; } }); +var float64_list_1 = require("./float64-list"); +Object.defineProperty(exports, "Float64List", { enumerable: true, get: function () { return float64_list_1.Float64List; } }); +var int8_list_1 = require("./int8-list"); +Object.defineProperty(exports, "Int8List", { enumerable: true, get: function () { return int8_list_1.Int8List; } }); +var int16_list_1 = require("./int16-list"); +Object.defineProperty(exports, "Int16List", { enumerable: true, get: function () { return int16_list_1.Int16List; } }); +var int32_list_1 = require("./int32-list"); +Object.defineProperty(exports, "Int32List", { enumerable: true, get: function () { return int32_list_1.Int32List; } }); +var int64_list_1 = require("./int64-list"); +Object.defineProperty(exports, "Int64List", { enumerable: true, get: function () { return int64_list_1.Int64List; } }); +var interface_1 = require("./interface"); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return interface_1.Interface; } }); +var interface_list_1 = require("./interface-list"); +Object.defineProperty(exports, "InterfaceList", { enumerable: true, get: function () { return interface_list_1.InterfaceList; } }); +var list_1 = require("./list"); +Object.defineProperty(exports, "List", { enumerable: true, get: function () { return list_1.List; } }); +var orphan_1 = require("./orphan"); +Object.defineProperty(exports, "Orphan", { enumerable: true, get: function () { return orphan_1.Orphan; } }); +var pointer_list_1 = require("./pointer-list"); +Object.defineProperty(exports, "PointerList", { enumerable: true, get: function () { return pointer_list_1.PointerList; } }); +var pointer_type_1 = require("./pointer-type"); +Object.defineProperty(exports, "PointerType", { enumerable: true, get: function () { return pointer_type_1.PointerType; } }); +var pointer_1 = require("./pointer"); +Object.defineProperty(exports, "Pointer", { enumerable: true, get: function () { return pointer_1.Pointer; } }); +var struct_1 = require("./struct"); +Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return struct_1.Struct; } }); +var text_1 = require("./text"); +Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.Text; } }); +var text_list_1 = require("./text-list"); +Object.defineProperty(exports, "TextList", { enumerable: true, get: function () { return text_list_1.TextList; } }); +var uint8_list_1 = require("./uint8-list"); +Object.defineProperty(exports, "Uint8List", { enumerable: true, get: function () { return uint8_list_1.Uint8List; } }); +var uint16_list_1 = require("./uint16-list"); +Object.defineProperty(exports, "Uint16List", { enumerable: true, get: function () { return uint16_list_1.Uint16List; } }); +var uint32_list_1 = require("./uint32-list"); +Object.defineProperty(exports, "Uint32List", { enumerable: true, get: function () { return uint32_list_1.Uint32List; } }); +var uint64_list_1 = require("./uint64-list"); +Object.defineProperty(exports, "Uint64List", { enumerable: true, get: function () { return uint64_list_1.Uint64List; } }); +var void_1 = require("./void"); +Object.defineProperty(exports, "Void", { enumerable: true, get: function () { return void_1.Void; } }); +Object.defineProperty(exports, "VOID", { enumerable: true, get: function () { return void_1.VOID; } }); +var void_list_1 = require("./void-list"); +Object.defineProperty(exports, "VoidList", { enumerable: true, get: function () { return void_list_1.VoidList; } }); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/index.js.map b/node_modules/capnp-ts/src/serialization/pointers/index.js.map new file mode 100644 index 0000000..959c7d6 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,+BAAwC;AAA/B,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,mCAA2D;AAArC,gGAAA,MAAM,OAAA;AAC5B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+BAAoC;AAA3B,4FAAA,IAAI,OAAA;AAAE,4FAAA,IAAI,OAAA;AACnB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/index.ts b/node_modules/capnp-ts/src/serialization/pointers/index.ts new file mode 100644 index 0000000..5a94ada --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/index.ts @@ -0,0 +1,31 @@ +/** + * @author jdiaz5513 + */ + +export { AnyPointerList } from "./any-pointer-list"; +export { BoolList } from "./bool-list"; +export { CompositeList } from "./composite-list"; +export { Data } from "./data"; +export { DataList } from "./data-list"; +export { Float32List } from "./float32-list"; +export { Float64List } from "./float64-list"; +export { Int8List } from "./int8-list"; +export { Int16List } from "./int16-list"; +export { Int32List } from "./int32-list"; +export { Int64List } from "./int64-list"; +export { Interface } from "./interface"; +export { InterfaceList } from "./interface-list"; +export { List, ListCtor } from "./list"; +export { Orphan } from "./orphan"; +export { PointerList } from "./pointer-list"; +export { PointerType } from "./pointer-type"; +export { Pointer } from "./pointer"; +export { _StructCtor, Struct, StructCtor } from "./struct"; +export { Text } from "./text"; +export { TextList } from "./text-list"; +export { Uint8List } from "./uint8-list"; +export { Uint16List } from "./uint16-list"; +export { Uint32List } from "./uint32-list"; +export { Uint64List } from "./uint64-list"; +export { Void, VOID } from "./void"; +export { VoidList } from "./void-list"; diff --git a/node_modules/capnp-ts/src/serialization/pointers/int16-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/int16-list.d.ts new file mode 100644 index 0000000..62d4ae8 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int16-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Int16List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int16-list.js b/node_modules/capnp-ts/src/serialization/pointers/int16-list.js new file mode 100644 index 0000000..0922302 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int16-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Int16List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Int16List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getInt16(c.byteOffset + index * 2); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setInt16(c.byteOffset + index * 2, value); + } + toString() { + return `Int16_${super.toString()}`; + } +} +exports.Int16List = Int16List; +Int16List._capnp = { + displayName: "List<Int16>", + size: list_element_size_1.ListElementSize.BYTE_2 +}; +//# sourceMappingURL=int16-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int16-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/int16-list.js.map new file mode 100644 index 0000000..e39e88f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int16-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"int16-list.js","sourceRoot":"","sources":["int16-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,SAAU,SAAQ,WAAY;IAMzC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ;QACN,OAAO,SAAS,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACrC,CAAC;;AApBH,8BAqBC;AApBiB,gBAAM,GAAc;IAClC,WAAW,EAAE,aAAuB;IACpC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int16-list.ts b/node_modules/capnp-ts/src/serialization/pointers/int16-list.ts new file mode 100644 index 0000000..45ec4a5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int16-list.ts @@ -0,0 +1,35 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Int16List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Int16>" as string, + size: ListElementSize.BYTE_2 + }; + + get(index: number): number { + const c = getContent(this); + + return c.segment.getInt16(c.byteOffset + index * 2); + } + + set(index: number, value: number): void { + const c = getContent(this); + + c.segment.setInt16(c.byteOffset + index * 2, value); + } + + toString(): string { + return `Int16_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int32-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/int32-list.d.ts new file mode 100644 index 0000000..5602410 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int32-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Int32List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int32-list.js b/node_modules/capnp-ts/src/serialization/pointers/int32-list.js new file mode 100644 index 0000000..c41cdf0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int32-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Int32List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Int32List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getInt32(c.byteOffset + index * 4); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setInt32(c.byteOffset + index * 4, value); + } + toString() { + return `Int32_${super.toString()}`; + } +} +exports.Int32List = Int32List; +Int32List._capnp = { + displayName: "List<Int32>", + size: list_element_size_1.ListElementSize.BYTE_4 +}; +//# sourceMappingURL=int32-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int32-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/int32-list.js.map new file mode 100644 index 0000000..ce50721 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int32-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"int32-list.js","sourceRoot":"","sources":["int32-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,SAAU,SAAQ,WAAY;IAMzC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ;QACN,OAAO,SAAS,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACrC,CAAC;;AAlBH,8BAmBC;AAlBiB,gBAAM,GAAc;IAClC,WAAW,EAAE,aAAuB;IACpC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int32-list.ts b/node_modules/capnp-ts/src/serialization/pointers/int32-list.ts new file mode 100644 index 0000000..8e65ad2 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int32-list.ts @@ -0,0 +1,33 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Int32List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Int32>" as string, + size: ListElementSize.BYTE_4 + }; + + get(index: number): number { + const c = getContent(this); + return c.segment.getInt32(c.byteOffset + index * 4); + } + + set(index: number, value: number): void { + const c = getContent(this); + c.segment.setInt32(c.byteOffset + index * 4, value); + } + + toString(): string { + return `Int32_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int64-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/int64-list.d.ts new file mode 100644 index 0000000..e25d900 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int64-list.d.ts @@ -0,0 +1,11 @@ +/** + * @author jdiaz5513 + */ +import { Int64 } from "../../types"; +import { _ListCtor, List } from "./list"; +export declare class Int64List extends List<Int64> { + static readonly _capnp: _ListCtor; + get(index: number): Int64; + set(index: number, value: Int64): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int64-list.js b/node_modules/capnp-ts/src/serialization/pointers/int64-list.js new file mode 100644 index 0000000..5578b27 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int64-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Int64List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Int64List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getInt64(c.byteOffset + index * 8); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setInt64(c.byteOffset + index * 8, value); + } + toString() { + return `Int64_${super.toString()}`; + } +} +exports.Int64List = Int64List; +Int64List._capnp = { + displayName: "List<Int64>", + size: list_element_size_1.ListElementSize.BYTE_8, +}; +//# sourceMappingURL=int64-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int64-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/int64-list.js.map new file mode 100644 index 0000000..9b04f2f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int64-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"int64-list.js","sourceRoot":"","sources":["int64-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAG9B,4DAAuD;AACvD,iCAAyC;AACzC,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,SAAU,SAAQ,WAAW;IAMxC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAY;QAC7B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ;QACN,OAAO,SAAS,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACrC,CAAC;;AAlBH,8BAmBC;AAlBiB,gBAAM,GAAc;IAClC,WAAW,EAAE,aAAuB;IACpC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int64-list.ts b/node_modules/capnp-ts/src/serialization/pointers/int64-list.ts new file mode 100644 index 0000000..6ad1236 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int64-list.ts @@ -0,0 +1,34 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { Int64 } from "../../types"; +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Int64List extends List<Int64> { + static readonly _capnp: _ListCtor = { + displayName: "List<Int64>" as string, + size: ListElementSize.BYTE_8, + }; + + get(index: number): Int64 { + const c = getContent(this); + return c.segment.getInt64(c.byteOffset + index * 8); + } + + set(index: number, value: Int64): void { + const c = getContent(this); + c.segment.setInt64(c.byteOffset + index * 8, value); + } + + toString(): string { + return `Int64_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int8-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/int8-list.d.ts new file mode 100644 index 0000000..f35140c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int8-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Int8List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/int8-list.js b/node_modules/capnp-ts/src/serialization/pointers/int8-list.js new file mode 100644 index 0000000..0da8ec5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int8-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Int8List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Int8List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getInt8(c.byteOffset + index); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setInt8(c.byteOffset + index, value); + } + toString() { + return `Int8_${super.toString()}`; + } +} +exports.Int8List = Int8List; +Int8List._capnp = { + displayName: "List<Int8>", + size: list_element_size_1.ListElementSize.BYTE +}; +//# sourceMappingURL=int8-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int8-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/int8-list.js.map new file mode 100644 index 0000000..42b05a5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int8-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"int8-list.js","sourceRoot":"","sources":["int8-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,WAAY;IAMxC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpC,CAAC;;AAlBH,4BAmBC;AAlBiB,eAAM,GAAc;IAClC,WAAW,EAAE,YAAsB;IACnC,IAAI,EAAE,mCAAe,CAAC,IAAI;CAC3B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/int8-list.ts b/node_modules/capnp-ts/src/serialization/pointers/int8-list.ts new file mode 100644 index 0000000..ccf99eb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/int8-list.ts @@ -0,0 +1,33 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Int8List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Int8>" as string, + size: ListElementSize.BYTE + }; + + get(index: number): number { + const c = getContent(this); + return c.segment.getInt8(c.byteOffset + index); + } + + set(index: number, value: number): void { + const c = getContent(this); + c.segment.setInt8(c.byteOffset + index, value); + } + + toString(): string { + return `Int8_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/interface-list.d.ts new file mode 100644 index 0000000..982bef3 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface-list.d.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ +import { Interface } from "./interface"; +import { ListCtor } from "./list"; +export declare const InterfaceList: ListCtor<Interface>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface-list.js b/node_modules/capnp-ts/src/serialization/pointers/interface-list.js new file mode 100644 index 0000000..d607915 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface-list.js @@ -0,0 +1,10 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InterfaceList = void 0; +const interface_1 = require("./interface"); +const pointer_list_1 = require("./pointer-list"); +exports.InterfaceList = pointer_list_1.PointerList(interface_1.Interface); +//# sourceMappingURL=interface-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/interface-list.js.map new file mode 100644 index 0000000..b439f57 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface-list.js","sourceRoot":"","sources":["interface-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2CAAwC;AAExC,iDAA6C;AAEhC,QAAA,aAAa,GAAwB,0BAAW,CAAC,qBAAS,CAAC,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface-list.ts b/node_modules/capnp-ts/src/serialization/pointers/interface-list.ts new file mode 100644 index 0000000..6dc35c1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface-list.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ + +import { Interface } from "./interface"; +import { ListCtor } from "./list"; +import { PointerList } from "./pointer-list"; + +export const InterfaceList: ListCtor<Interface> = PointerList(Interface); diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface.d.ts b/node_modules/capnp-ts/src/serialization/pointers/interface.d.ts new file mode 100644 index 0000000..89a3b72 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface.d.ts @@ -0,0 +1,8 @@ +/** + * @author jdiaz5513 + */ +import { Segment } from "../segment"; +import { Pointer } from "./pointer"; +export declare class Interface extends Pointer { + constructor(segment: Segment, byteOffset: number, depthLimit?: number); +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface.js b/node_modules/capnp-ts/src/serialization/pointers/interface.js new file mode 100644 index 0000000..d4607e9 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface.js @@ -0,0 +1,18 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Interface = void 0; +const constants_1 = require("../../constants"); +const errors_1 = require("../../errors"); +const util_1 = require("../../util"); +const pointer_1 = require("./pointer"); +class Interface extends pointer_1.Pointer { + constructor(segment, byteOffset, depthLimit = constants_1.MAX_DEPTH) { + super(segment, byteOffset, depthLimit); + throw new Error(util_1.format(errors_1.NOT_IMPLEMENTED, "new Interface")); + } +} +exports.Interface = Interface; +//# sourceMappingURL=interface.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface.js.map b/node_modules/capnp-ts/src/serialization/pointers/interface.js.map new file mode 100644 index 0000000..8d8c1d5 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["interface.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,+CAA4C;AAC5C,yCAA+C;AAC/C,qCAAoC;AAEpC,uCAAoC;AAEpC,MAAa,SAAU,SAAQ,iBAAO;IACpC,YAAY,OAAgB,EAAE,UAAkB,EAAE,UAAU,GAAG,qBAAS;QACtE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAEvC,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,wBAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF;AAND,8BAMC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/interface.ts b/node_modules/capnp-ts/src/serialization/pointers/interface.ts new file mode 100644 index 0000000..b283869 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/interface.ts @@ -0,0 +1,17 @@ +/** + * @author jdiaz5513 + */ + +import { MAX_DEPTH } from "../../constants"; +import { NOT_IMPLEMENTED } from "../../errors"; +import { format } from "../../util"; +import { Segment } from "../segment"; +import { Pointer } from "./pointer"; + +export class Interface extends Pointer { + constructor(segment: Segment, byteOffset: number, depthLimit = MAX_DEPTH) { + super(segment, byteOffset, depthLimit); + + throw new Error(format(NOT_IMPLEMENTED, "new Interface")); + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/list.d.ts new file mode 100644 index 0000000..8bd69fc --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/list.d.ts @@ -0,0 +1,76 @@ +/** + * @author jdiaz5513 + */ +import { ListElementSize } from "../list-element-size"; +import { ObjectSize } from "../object-size"; +import { Segment } from "../segment"; +import { Pointer } from "./pointer"; +export interface _ListCtor { + readonly compositeSize?: ObjectSize; + readonly displayName: string; + readonly size: ListElementSize; +} +export interface ListCtor<T> { + readonly _capnp: _ListCtor; + new (segment: Segment, byteOffset: number, depthLimit?: number): List<T>; +} +export declare type FilterCallback<T> = (this: void, value: T, index: number) => boolean; +export declare type IndexedCallback<T, U> = (this: void, value: T, index: number) => U; +export interface Group<T> { + [k: string]: T; +} +/** + * A generic list class. Implements Filterable, + */ +export declare class List<T> extends Pointer { + static readonly _capnp: _ListCtor; + static readonly get: typeof get; + static readonly initList: typeof initList; + static readonly set: typeof set; + static toString(): string; + all(callbackfn: FilterCallback<T>): boolean; + any(callbackfn: FilterCallback<T>): boolean; + ap<U>(callbackfns: Array<IndexedCallback<T, U>>): U[]; + concat(other: List<T>): T[]; + drop(n: number): T[]; + dropWhile(callbackfn: FilterCallback<T>): T[]; + empty(): T[]; + every(callbackfn: FilterCallback<T>): boolean; + filter(callbackfn: FilterCallback<T>): T[]; + find(callbackfn: FilterCallback<T>): T | undefined; + findIndex(callbackfn: FilterCallback<T>): number; + forEach(callbackfn: (this: void, value: T, index: number) => void): void; + get(_index: number): T; + /** + * Get the length of this list. + * + * @returns {number} The number of elements in this list. + */ + getLength(): number; + groupBy(callbackfn: IndexedCallback<T, string>): Group<T>; + intersperse(sep: T): T[]; + map<U>(callbackfn: IndexedCallback<T, U>): U[]; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T; + reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U; + set(_index: number, _value: T): void; + slice(start?: number, end?: number): T[]; + some(callbackfn: FilterCallback<T>): boolean; + take(n: number): T[]; + takeWhile(callbackfn: FilterCallback<T>): T[]; + toArray(): T[]; + toString(): string; +} +/** + * Initialize the list with the given element size and length. This will allocate new space for the list, ideally in + * the same segment as this pointer. + * + * @param {ListElementSize} elementSize The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {List<T>} l The list to initialize. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list. This value is required for + * composite lists. + * @returns {void} + */ +export declare function initList<T>(elementSize: ListElementSize, length: number, l: List<T>, compositeSize?: ObjectSize): void; +export declare function get<T>(_index: number, _l: List<T>): T; +export declare function set<T>(_index: number, _value: T, _l: List<T>): void; diff --git a/node_modules/capnp-ts/src/serialization/pointers/list.js b/node_modules/capnp-ts/src/serialization/pointers/list.js new file mode 100644 index 0000000..0e002cd --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/list.js @@ -0,0 +1,274 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.set = exports.get = exports.initList = exports.List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const errors_1 = require("../../errors"); +const util_1 = require("../../util"); +const list_element_size_1 = require("../list-element-size"); +const object_size_1 = require("../object-size"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list"); +trace("load"); +/** + * A generic list class. Implements Filterable, + */ +class List extends pointer_1.Pointer { + static toString() { + return this._capnp.displayName; + } + all(callbackfn) { + const length = this.getLength(); + for (let i = 0; i < length; i++) { + if (!callbackfn(this.get(i), i)) + return false; + } + return true; + } + any(callbackfn) { + const length = this.getLength(); + for (let i = 0; i < length; i++) { + if (callbackfn(this.get(i), i)) + return true; + } + return false; + } + ap(callbackfns) { + const length = this.getLength(); + const res = []; + for (let i = 0; i < length; i++) { + res.push(...callbackfns.map((f) => f(this.get(i), i))); + } + return res; + } + concat(other) { + const length = this.getLength(); + const otherLength = other.getLength(); + const res = new Array(length + otherLength); + for (let i = 0; i < length; i++) + res[i] = this.get(i); + for (let i = 0; i < otherLength; i++) + res[i + length] = other.get(i); + return res; + } + drop(n) { + const length = this.getLength(); + const res = new Array(length); + for (let i = n; i < length; i++) + res[i] = this.get(i); + return res; + } + dropWhile(callbackfn) { + const length = this.getLength(); + const res = []; + let drop = true; + for (let i = 0; i < length; i++) { + const v = this.get(i); + if (drop) + drop = callbackfn(v, i); + if (!drop) + res.push(v); + } + return res; + } + empty() { + return []; + } + every(callbackfn) { + return this.all(callbackfn); + } + filter(callbackfn) { + const length = this.getLength(); + const res = []; + for (let i = 0; i < length; i++) { + const value = this.get(i); + if (callbackfn(value, i)) + res.push(value); + } + return res; + } + find(callbackfn) { + const length = this.getLength(); + for (let i = 0; i < length; i++) { + const value = this.get(i); + if (callbackfn(value, i)) + return value; + } + return undefined; + } + findIndex(callbackfn) { + const length = this.getLength(); + for (let i = 0; i < length; i++) { + const value = this.get(i); + if (callbackfn(value, i)) + return i; + } + return -1; + } + forEach(callbackfn) { + const length = this.getLength(); + for (let i = 0; i < length; i++) + callbackfn(this.get(i), i); + } + get(_index) { + return get(_index, this); + } + /** + * Get the length of this list. + * + * @returns {number} The number of elements in this list. + */ + getLength() { + return pointer_1.getTargetListLength(this); + } + groupBy(callbackfn) { + const length = this.getLength(); + const res = {}; + for (let i = 0; i < length; i++) { + const v = this.get(i); + res[callbackfn(v, i)] = v; + } + return res; + } + intersperse(sep) { + const length = this.getLength(); + const res = new Array(length); + for (let i = 0; i < length; i++) { + if (i > 0) + res.push(sep); + res.push(this.get(i)); + } + return res; + } + map(callbackfn) { + const length = this.getLength(); + const res = new Array(length); + for (let i = 0; i < length; i++) + res[i] = callbackfn(this.get(i), i); + return res; + } + reduce(callbackfn, initialValue) { + let i = 0; + let res; + if (initialValue === undefined) { + res = this.get(0); + i++; + } + else { + res = initialValue; + } + for (; i < this.getLength(); i++) + res = callbackfn(res, this.get(i), i); + return res; + } + set(_index, _value) { + set(_index, _value, this); + } + slice(start = 0, end) { + const length = end ? Math.min(this.getLength(), end) : this.getLength(); + const res = new Array(length - start); + for (let i = start; i < length; i++) + res[i] = this.get(i); + return res; + } + some(callbackfn) { + return this.any(callbackfn); + } + take(n) { + const length = Math.min(this.getLength(), n); + const res = new Array(length); + for (let i = 0; i < length; i++) + res[i] = this.get(i); + return res; + } + takeWhile(callbackfn) { + const length = this.getLength(); + const res = []; + let take; + for (let i = 0; i < length; i++) { + const v = this.get(i); + take = callbackfn(v, i); + if (!take) + return res; + res.push(v); + } + return res; + } + toArray() { + return this.map(util_1.identity); + } + toString() { + return `List_${super.toString()}`; + } +} +exports.List = List; +List._capnp = { + displayName: "List<Generic>", + size: list_element_size_1.ListElementSize.VOID, +}; +List.get = get; +List.initList = initList; +List.set = set; +/** + * Initialize the list with the given element size and length. This will allocate new space for the list, ideally in + * the same segment as this pointer. + * + * @param {ListElementSize} elementSize The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {List<T>} l The list to initialize. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list. This value is required for + * composite lists. + * @returns {void} + */ +function initList(elementSize, length, l, compositeSize) { + let c; + switch (elementSize) { + case list_element_size_1.ListElementSize.BIT: + c = l.segment.allocate(Math.ceil(length / 8)); + break; + case list_element_size_1.ListElementSize.BYTE: + case list_element_size_1.ListElementSize.BYTE_2: + case list_element_size_1.ListElementSize.BYTE_4: + case list_element_size_1.ListElementSize.BYTE_8: + case list_element_size_1.ListElementSize.POINTER: + c = l.segment.allocate(length * pointer_1.getListElementByteLength(elementSize)); + break; + case list_element_size_1.ListElementSize.COMPOSITE: { + if (compositeSize === undefined) { + throw new Error(util_1.format(errors_1.PTR_COMPOSITE_SIZE_UNDEFINED)); + } + compositeSize = object_size_1.padToWord(compositeSize); + const byteLength = object_size_1.getByteLength(compositeSize) * length; + // We need to allocate an extra 8 bytes for the tag word, then make sure we write the length to it. We advance + // the content pointer by 8 bytes so that it then points to the first list element as intended. Everything + // starts off zeroed out so these nested structs don't need to be initialized in any way. + c = l.segment.allocate(byteLength + 8); + pointer_1.setStructPointer(length, compositeSize, c); + trace("Wrote composite tag word %s for %s.", c, l); + break; + } + case list_element_size_1.ListElementSize.VOID: + // No need to allocate anything, we can write the list pointer right here. + pointer_1.setListPointer(0, elementSize, length, l); + return; + default: + throw new Error(util_1.format(errors_1.PTR_INVALID_LIST_SIZE, elementSize)); + } + const res = pointer_1.initPointer(c.segment, c.byteOffset, l); + pointer_1.setListPointer(res.offsetWords, elementSize, length, res.pointer, compositeSize); +} +exports.initList = initList; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function get(_index, _l) { + throw new TypeError(); +} +exports.get = get; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function set(_index, _value, _l) { + throw new TypeError(); +} +exports.set = set; +//# sourceMappingURL=list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/list.js.map b/node_modules/capnp-ts/src/serialization/pointers/list.js.map new file mode 100644 index 0000000..89bc461 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,yCAAmF;AACnF,qCAA8C;AAC9C,4DAAuD;AACvD,gDAAsE;AAEtE,uCAOmB;AAEnB,MAAM,KAAK,GAAG,eAAS,CAAC,YAAY,CAAC,CAAC;AACtC,KAAK,CAAC,MAAM,CAAC,CAAC;AAqBd;;GAEG;AAEH,MAAa,IAAQ,SAAQ,iBAAO;IASlC,MAAM,CAAC,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,GAAG,CAAC,UAA6B;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;SAC/C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,UAA6B;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,KAAK,IAAI,CAAC,GA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GAAG,qBAAW,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAEpD,wBAAc,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACnF,CAAC;AA1DD,4BA0DC;AAED,6DAA6D;AAC7D,SAAgB,GAAG,CAAI,MAAc,EAAE,EAAW;IAChD,MAAM,IAAI,SAAS,EAAE,CAAC;AACxB,CAAC;AAFD,kBAEC;AAED,6DAA6D;AAC7D,SAAgB,GAAG,CAAI,MAAc,EAAE,MAAS,EAAE,EAAW;IAC3D,MAAM,IAAI,SAAS,EAAE,CAAC;AACxB,CAAC;AAFD,kBAEC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/list.ts b/node_modules/capnp-ts/src/serialization/pointers/list.ts new file mode 100644 index 0000000..1e4744b --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/list.ts @@ -0,0 +1,381 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { PTR_COMPOSITE_SIZE_UNDEFINED, PTR_INVALID_LIST_SIZE } from "../../errors"; +import { format, identity } from "../../util"; +import { ListElementSize } from "../list-element-size"; +import { ObjectSize, padToWord, getByteLength } from "../object-size"; +import { Segment } from "../segment"; +import { + Pointer, + getTargetListLength, + getListElementByteLength, + setStructPointer, + setListPointer, + initPointer, +} from "./pointer"; + +const trace = initTrace("capnp:list"); +trace("load"); + +export interface _ListCtor { + readonly compositeSize?: ObjectSize; + readonly displayName: string; + readonly size: ListElementSize; +} + +export interface ListCtor<T> { + readonly _capnp: _ListCtor; + + new (segment: Segment, byteOffset: number, depthLimit?: number): List<T>; +} + +export type FilterCallback<T> = (this: void, value: T, index: number) => boolean; +export type IndexedCallback<T, U> = (this: void, value: T, index: number) => U; + +export interface Group<T> { + [k: string]: T; +} + +/** + * A generic list class. Implements Filterable, + */ + +export class List<T> extends Pointer { + static readonly _capnp: _ListCtor = { + displayName: "List<Generic>" as string, + size: ListElementSize.VOID, + }; + static readonly get = get; + static readonly initList = initList; + static readonly set = set; + + static toString(): string { + return this._capnp.displayName; + } + + all(callbackfn: FilterCallback<T>): boolean { + const length = this.getLength(); + + for (let i = 0; i < length; i++) { + if (!callbackfn(this.get(i), i)) return false; + } + + return true; + } + + any(callbackfn: FilterCallback<T>): boolean { + const length = this.getLength(); + + for (let i = 0; i < length; i++) { + if (callbackfn(this.get(i), i)) return true; + } + + return false; + } + + ap<U>(callbackfns: Array<IndexedCallback<T, U>>): U[] { + const length = this.getLength(); + const res: U[] = []; + + for (let i = 0; i < length; i++) { + res.push(...callbackfns.map((f) => f(this.get(i), i))); + } + + return res; + } + + concat(other: List<T>): T[] { + const length = this.getLength(); + const otherLength = other.getLength(); + const res = new Array<T>(length + otherLength); + + for (let i = 0; i < length; i++) res[i] = this.get(i); + + for (let i = 0; i < otherLength; i++) res[i + length] = other.get(i); + + return res; + } + + drop(n: number): T[] { + const length = this.getLength(); + const res = new Array(length) as T[]; + + for (let i = n; i < length; i++) res[i] = this.get(i); + + return res; + } + + dropWhile(callbackfn: FilterCallback<T>): T[] { + const length = this.getLength(); + const res: T[] = []; + let drop = true; + + for (let i = 0; i < length; i++) { + const v = this.get(i); + + if (drop) drop = callbackfn(v, i); + + if (!drop) res.push(v); + } + + return res; + } + + empty(): T[] { + return [] as T[]; + } + + every(callbackfn: FilterCallback<T>): boolean { + return this.all(callbackfn); + } + + filter(callbackfn: FilterCallback<T>): T[] { + const length = this.getLength(); + const res: T[] = []; + + for (let i = 0; i < length; i++) { + const value = this.get(i); + + if (callbackfn(value, i)) res.push(value); + } + + return res; + } + + find(callbackfn: FilterCallback<T>): T | undefined { + const length = this.getLength(); + + for (let i = 0; i < length; i++) { + const value = this.get(i); + + if (callbackfn(value, i)) return value; + } + + return undefined; + } + + findIndex(callbackfn: FilterCallback<T>): number { + const length = this.getLength(); + + for (let i = 0; i < length; i++) { + const value = this.get(i); + + if (callbackfn(value, i)) return i; + } + + return -1; + } + + forEach(callbackfn: (this: void, value: T, index: number) => void): void { + const length = this.getLength(); + + for (let i = 0; i < length; i++) callbackfn(this.get(i), i); + } + + get(_index: number): T { + return get(_index, this); + } + + /** + * Get the length of this list. + * + * @returns {number} The number of elements in this list. + */ + + getLength(): number { + return getTargetListLength(this); + } + + groupBy(callbackfn: IndexedCallback<T, string>): Group<T> { + const length = this.getLength(); + const res: Group<T> = {}; + + for (let i = 0; i < length; i++) { + const v = this.get(i); + res[callbackfn(v, i)] = v; + } + + return res; + } + + intersperse(sep: T): T[] { + const length = this.getLength(); + const res = new Array(length) as T[]; + + for (let i = 0; i < length; i++) { + if (i > 0) res.push(sep); + + res.push(this.get(i)); + } + + return res; + } + + map<U>(callbackfn: IndexedCallback<T, U>): U[] { + const length = this.getLength(); + const res = new Array(length) as U[]; + + for (let i = 0; i < length; i++) res[i] = callbackfn(this.get(i), i); + + return res; + } + + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T; + reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U; + reduce<U>( + callbackfn: (previousValue: T | U, currentValue: T, currentIndex: number) => T | U, + initialValue?: U + ): T | U { + let i = 0; + let res: T | U; + + if (initialValue === undefined) { + res = this.get(0); + i++; + } else { + res = initialValue; + } + + for (; i < this.getLength(); i++) res = callbackfn(res, this.get(i), i); + + return res; + } + + set(_index: number, _value: T): void { + set(_index, _value, this); + } + + slice(start = 0, end?: number): T[] { + const length = end ? Math.min(this.getLength(), end) : this.getLength(); + const res = new Array(length - start) as T[]; + + for (let i = start; i < length; i++) res[i] = this.get(i); + + return res; + } + + some(callbackfn: FilterCallback<T>): boolean { + return this.any(callbackfn); + } + + take(n: number): T[] { + const length = Math.min(this.getLength(), n); + const res = new Array(length) as T[]; + + for (let i = 0; i < length; i++) res[i] = this.get(i); + + return res; + } + + takeWhile(callbackfn: FilterCallback<T>): T[] { + const length = this.getLength(); + const res: T[] = []; + let take; + + for (let i = 0; i < length; i++) { + const v = this.get(i); + + take = callbackfn(v, i); + + if (!take) return res; + + res.push(v); + } + + return res; + } + + toArray(): T[] { + return this.map(identity); + } + + toString(): string { + return `List_${super.toString()}`; + } +} + +/** + * Initialize the list with the given element size and length. This will allocate new space for the list, ideally in + * the same segment as this pointer. + * + * @param {ListElementSize} elementSize The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {List<T>} l The list to initialize. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list. This value is required for + * composite lists. + * @returns {void} + */ + +export function initList<T>( + elementSize: ListElementSize, + length: number, + l: List<T>, + compositeSize?: ObjectSize +): void { + let c: Pointer; + + switch (elementSize) { + case ListElementSize.BIT: + c = l.segment.allocate(Math.ceil(length / 8)); + + break; + + case ListElementSize.BYTE: + case ListElementSize.BYTE_2: + case ListElementSize.BYTE_4: + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: + c = l.segment.allocate(length * getListElementByteLength(elementSize)); + + break; + + case ListElementSize.COMPOSITE: { + if (compositeSize === undefined) { + throw new Error(format(PTR_COMPOSITE_SIZE_UNDEFINED)); + } + + compositeSize = padToWord(compositeSize); + + const byteLength = getByteLength(compositeSize) * length; + + // We need to allocate an extra 8 bytes for the tag word, then make sure we write the length to it. We advance + // the content pointer by 8 bytes so that it then points to the first list element as intended. Everything + // starts off zeroed out so these nested structs don't need to be initialized in any way. + + c = l.segment.allocate(byteLength + 8); + + setStructPointer(length, compositeSize, c); + + trace("Wrote composite tag word %s for %s.", c, l); + + break; + } + case ListElementSize.VOID: + // No need to allocate anything, we can write the list pointer right here. + + setListPointer(0, elementSize, length, l); + + return; + + default: + throw new Error(format(PTR_INVALID_LIST_SIZE, elementSize)); + } + + const res = initPointer(c.segment, c.byteOffset, l); + + setListPointer(res.offsetWords, elementSize, length, res.pointer, compositeSize); +} + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export function get<T>(_index: number, _l: List<T>): T { + throw new TypeError(); +} + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export function set<T>(_index: number, _value: T, _l: List<T>): void { + throw new TypeError(); +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/orphan.d.ts b/node_modules/capnp-ts/src/serialization/pointers/orphan.d.ts new file mode 100644 index 0000000..236305f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/orphan.d.ts @@ -0,0 +1,38 @@ +import { ListElementSize } from "../list-element-size"; +import { ObjectSize } from "../object-size"; +import { Segment } from "../segment"; +import { Pointer } from "./pointer"; +import { PointerType } from "./pointer-type"; +export interface _Orphan { + capId: number; + elementSize: ListElementSize; + length: number; + size: ObjectSize; + type: PointerType; +} +/** + * An orphaned pointer. This object itself is technically a pointer to the original pointer's content, which was left + * untouched in its original message. The original pointer data is encoded as attributes on the Orphan object, ready to + * be reconstructed once another pointer is ready to adopt it. + * + * @export + * @class Orphan + * @extends {Pointer} + * @template T + */ +export declare class Orphan<T extends Pointer> { + /** If this member is not present then the orphan has already been adopted, or something went very wrong. */ + _capnp?: _Orphan; + byteOffset: number; + segment: Segment; + constructor(src: T); + /** + * Adopt (move) this orphan into the target pointer location. This will allocate far pointers in `dst` as needed. + * + * @param {T} dst The destination pointer. + * @returns {void} + */ + _moveTo(dst: T): void; + dispose(): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/orphan.js b/node_modules/capnp-ts/src/serialization/pointers/orphan.js new file mode 100644 index 0000000..6641afa --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/orphan.js @@ -0,0 +1,120 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Orphan = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const errors_1 = require("../../errors"); +const util_1 = require("../../util"); +const list_element_size_1 = require("../list-element-size"); +const object_size_1 = require("../object-size"); +const pointer_1 = require("./pointer"); +const pointer_type_1 = require("./pointer-type"); +const trace = debug_1.default("capnp:orphan"); +trace("load"); +// Technically speaking this class doesn't need to be generic, but the extra type checking enforced by this helps to +// make sure you don't accidentally adopt a pointer of the wrong type. +/** + * An orphaned pointer. This object itself is technically a pointer to the original pointer's content, which was left + * untouched in its original message. The original pointer data is encoded as attributes on the Orphan object, ready to + * be reconstructed once another pointer is ready to adopt it. + * + * @export + * @class Orphan + * @extends {Pointer} + * @template T + */ +class Orphan { + constructor(src) { + const c = pointer_1.getContent(src); + this.segment = c.segment; + this.byteOffset = c.byteOffset; + this._capnp = {}; + // Read vital info from the src pointer so we can reconstruct it during adoption. + this._capnp.type = pointer_1.getTargetPointerType(src); + switch (this._capnp.type) { + case pointer_type_1.PointerType.STRUCT: + this._capnp.size = pointer_1.getTargetStructSize(src); + break; + case pointer_type_1.PointerType.LIST: + this._capnp.length = pointer_1.getTargetListLength(src); + this._capnp.elementSize = pointer_1.getTargetListElementSize(src); + if (this._capnp.elementSize === list_element_size_1.ListElementSize.COMPOSITE) { + this._capnp.size = pointer_1.getTargetCompositeListSize(src); + } + break; + case pointer_type_1.PointerType.OTHER: + this._capnp.capId = pointer_1.getCapabilityId(src); + break; + default: + // COVERAGE: Unreachable code. + /* istanbul ignore next */ + throw new Error(errors_1.PTR_INVALID_POINTER_TYPE); + } + // Zero out the source pointer (but not the contents!). + pointer_1.erasePointer(src); + } + /** + * Adopt (move) this orphan into the target pointer location. This will allocate far pointers in `dst` as needed. + * + * @param {T} dst The destination pointer. + * @returns {void} + */ + _moveTo(dst) { + if (this._capnp === undefined) { + throw new Error(util_1.format(errors_1.PTR_ALREADY_ADOPTED, this)); + } + // TODO: Implement copy semantics when this happens. + if (this.segment.message !== dst.segment.message) { + throw new Error(util_1.format(errors_1.PTR_ADOPT_WRONG_MESSAGE, this, dst)); + } + // Recursively wipe out the destination pointer first. + pointer_1.erase(dst); + const res = pointer_1.initPointer(this.segment, this.byteOffset, dst); + switch (this._capnp.type) { + case pointer_type_1.PointerType.STRUCT: + pointer_1.setStructPointer(res.offsetWords, this._capnp.size, res.pointer); + break; + case pointer_type_1.PointerType.LIST: { + let offsetWords = res.offsetWords; + if (this._capnp.elementSize === list_element_size_1.ListElementSize.COMPOSITE) { + offsetWords--; // The tag word gets skipped. + } + pointer_1.setListPointer(offsetWords, this._capnp.elementSize, this._capnp.length, res.pointer, this._capnp.size); + break; + } + case pointer_type_1.PointerType.OTHER: + pointer_1.setInterfacePointer(this._capnp.capId, res.pointer); + break; + /* istanbul ignore next */ + default: + throw new Error(errors_1.PTR_INVALID_POINTER_TYPE); + } + this._capnp = undefined; + } + dispose() { + // FIXME: Should this throw? + if (this._capnp === undefined) { + trace("not disposing an already disposed orphan", this); + return; + } + switch (this._capnp.type) { + case pointer_type_1.PointerType.STRUCT: + this.segment.fillZeroWords(this.byteOffset, object_size_1.getWordLength(this._capnp.size)); + break; + case pointer_type_1.PointerType.LIST: { + const byteLength = pointer_1.getListByteLength(this._capnp.elementSize, this._capnp.length, this._capnp.size); + this.segment.fillZeroWords(this.byteOffset, byteLength); + break; + } + default: + // Other pointer types don't actually have any content. + break; + } + this._capnp = undefined; + } + toString() { + return util_1.format("Orphan_%d@%a,type:%s", this.segment.id, this.byteOffset, this._capnp && this._capnp.type); + } +} +exports.Orphan = Orphan; +//# sourceMappingURL=orphan.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/orphan.js.map b/node_modules/capnp-ts/src/serialization/pointers/orphan.js.map new file mode 100644 index 0000000..668cece --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/orphan.js.map @@ -0,0 +1 @@ +{"version":3,"file":"orphan.js","sourceRoot":"","sources":["orphan.ts"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAE9B,yCAAsG;AACtG,qCAAoC;AACpC,4DAAuD;AACvD,gDAA2D;AAE3D,uCAgBmB;AACnB,iDAA6C;AAE7C,MAAM,KAAK,GAAG,eAAS,CAAC,cAAc,CAAC,CAAC;AACxC,KAAK,CAAC,MAAM,CAAC,CAAC;AAUd,oHAAoH;A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;gBACE,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;SAC7C;QAED,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,4BAA4B;QAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,KAAK,CAAC,0CAA0C,EAAE,IAAI,CAAC,CAAC;YAExD,OAAO;SACR;QAED,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YACxB,KAAK,0BAAW,CAAC,MAAM;gBACrB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,2BAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;gBAE7E,MAAM;YAER,KAAK,0BAAW,CAAC,IAAI,CAAC,CAAC;gBACrB,MAAM,UAAU,GAAG,2BAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACpG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;gBAExD,MAAM;aACP;YACD;gBACE,uDAAuD;gBAEvD,MAAM;SACT;QAED,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED,QAAQ;QACN,OAAO,aAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3G,CAAC;CACF;AAxID,wBAwIC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/orphan.ts b/node_modules/capnp-ts/src/serialization/pointers/orphan.ts new file mode 100644 index 0000000..76c480c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/orphan.ts @@ -0,0 +1,188 @@ +import initTrace from "debug"; + +import { PTR_ADOPT_WRONG_MESSAGE, PTR_ALREADY_ADOPTED, PTR_INVALID_POINTER_TYPE } from "../../errors"; +import { format } from "../../util"; +import { ListElementSize } from "../list-element-size"; +import { ObjectSize, getWordLength } from "../object-size"; +import { Segment } from "../segment"; +import { + Pointer, + getTargetListLength, + getTargetStructSize, + getTargetPointerType, + getTargetListElementSize, + getTargetCompositeListSize, + getCapabilityId, + getContent, + erasePointer, + initPointer, + erase, + setStructPointer, + setListPointer, + setInterfacePointer, + getListByteLength, +} from "./pointer"; +import { PointerType } from "./pointer-type"; + +const trace = initTrace("capnp:orphan"); +trace("load"); + +export interface _Orphan { + capId: number; + elementSize: ListElementSize; + length: number; + size: ObjectSize; + type: PointerType; +} + +// Technically speaking this class doesn't need to be generic, but the extra type checking enforced by this helps to +// make sure you don't accidentally adopt a pointer of the wrong type. + +/** + * An orphaned pointer. This object itself is technically a pointer to the original pointer's content, which was left + * untouched in its original message. The original pointer data is encoded as attributes on the Orphan object, ready to + * be reconstructed once another pointer is ready to adopt it. + * + * @export + * @class Orphan + * @extends {Pointer} + * @template T + */ + +export class Orphan<T extends Pointer> { + /** If this member is not present then the orphan has already been adopted, or something went very wrong. */ + _capnp?: _Orphan; + + byteOffset: number; + segment: Segment; + + constructor(src: T) { + const c = getContent(src); + + this.segment = c.segment; + this.byteOffset = c.byteOffset; + + this._capnp = {} as _Orphan; + + // Read vital info from the src pointer so we can reconstruct it during adoption. + + this._capnp.type = getTargetPointerType(src); + + switch (this._capnp.type) { + case PointerType.STRUCT: + this._capnp.size = getTargetStructSize(src); + + break; + + case PointerType.LIST: + this._capnp.length = getTargetListLength(src); + this._capnp.elementSize = getTargetListElementSize(src); + + if (this._capnp.elementSize === ListElementSize.COMPOSITE) { + this._capnp.size = getTargetCompositeListSize(src); + } + + break; + + case PointerType.OTHER: + this._capnp.capId = getCapabilityId(src); + + break; + + default: + // COVERAGE: Unreachable code. + /* istanbul ignore next */ + throw new Error(PTR_INVALID_POINTER_TYPE); + } + + // Zero out the source pointer (but not the contents!). + + erasePointer(src); + } + + /** + * Adopt (move) this orphan into the target pointer location. This will allocate far pointers in `dst` as needed. + * + * @param {T} dst The destination pointer. + * @returns {void} + */ + + _moveTo(dst: T): void { + if (this._capnp === undefined) { + throw new Error(format(PTR_ALREADY_ADOPTED, this)); + } + + // TODO: Implement copy semantics when this happens. + if (this.segment.message !== dst.segment.message) { + throw new Error(format(PTR_ADOPT_WRONG_MESSAGE, this, dst)); + } + + // Recursively wipe out the destination pointer first. + + erase(dst); + + const res = initPointer(this.segment, this.byteOffset, dst); + + switch (this._capnp.type) { + case PointerType.STRUCT: + setStructPointer(res.offsetWords, this._capnp.size, res.pointer); + + break; + + case PointerType.LIST: { + let offsetWords = res.offsetWords; + + if (this._capnp.elementSize === ListElementSize.COMPOSITE) { + offsetWords--; // The tag word gets skipped. + } + + setListPointer(offsetWords, this._capnp.elementSize, this._capnp.length, res.pointer, this._capnp.size); + + break; + } + case PointerType.OTHER: + setInterfacePointer(this._capnp.capId, res.pointer); + + break; + + /* istanbul ignore next */ + default: + throw new Error(PTR_INVALID_POINTER_TYPE); + } + + this._capnp = undefined; + } + + dispose(): void { + // FIXME: Should this throw? + if (this._capnp === undefined) { + trace("not disposing an already disposed orphan", this); + + return; + } + + switch (this._capnp.type) { + case PointerType.STRUCT: + this.segment.fillZeroWords(this.byteOffset, getWordLength(this._capnp.size)); + + break; + + case PointerType.LIST: { + const byteLength = getListByteLength(this._capnp.elementSize, this._capnp.length, this._capnp.size); + this.segment.fillZeroWords(this.byteOffset, byteLength); + + break; + } + default: + // Other pointer types don't actually have any content. + + break; + } + + this._capnp = undefined; + } + + toString(): string { + return format("Orphan_%d@%a,type:%s", this.segment.id, this.byteOffset, this._capnp && this._capnp.type); + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.d.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.d.ts new file mode 100644 index 0000000..d004868 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.d.ts @@ -0,0 +1,18 @@ +/** + * @author jdiaz5513 + */ +import { Pointer } from "./pointer"; +/** + * This is used as the return value for `Pointer.prototype.initPointer`. Turns out using a class in V8 for multiple + * return values is faster than using an array or anonymous object. + * + * http://jsben.ch/#/zTdbD + * + * @export + * @class PointerAllocationResult + */ +export declare class PointerAllocationResult { + readonly offsetWords: number; + readonly pointer: Pointer; + constructor(pointer: Pointer, offsetWords: number); +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js new file mode 100644 index 0000000..7d5e928 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js @@ -0,0 +1,27 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PointerAllocationResult = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const trace = debug_1.default("capnp:pointer-allocation-result"); +trace("load"); +/** + * This is used as the return value for `Pointer.prototype.initPointer`. Turns out using a class in V8 for multiple + * return values is faster than using an array or anonymous object. + * + * http://jsben.ch/#/zTdbD + * + * @export + * @class PointerAllocationResult + */ +class PointerAllocationResult { + constructor(pointer, offsetWords) { + this.pointer = pointer; + this.offsetWords = offsetWords; + } +} +exports.PointerAllocationResult = PointerAllocationResult; +//# sourceMappingURL=pointer-allocation-result.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js.map b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js.map new file mode 100644 index 0000000..fe7418f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pointer-allocation-result.js","sourceRoot":"","sources":["pointer-allocation-result.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAI9B,MAAM,KAAK,GAAG,eAAS,CAAC,iCAAiC,CAAC,CAAC;AAC3D,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd;;;;;;;;GAQG;AAEH,MAAa,uBAAuB;IAKlC,YAAY,OAAgB,EAAE,WAAmB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AATD,0DASC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.ts new file mode 100644 index 0000000..ffa436e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-allocation-result.ts @@ -0,0 +1,31 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { Pointer } from "./pointer"; + +const trace = initTrace("capnp:pointer-allocation-result"); +trace("load"); + +/** + * This is used as the return value for `Pointer.prototype.initPointer`. Turns out using a class in V8 for multiple + * return values is faster than using an array or anonymous object. + * + * http://jsben.ch/#/zTdbD + * + * @export + * @class PointerAllocationResult + */ + +export class PointerAllocationResult { + readonly offsetWords: number; + + readonly pointer: Pointer; + + constructor(pointer: Pointer, offsetWords: number) { + this.pointer = pointer; + this.offsetWords = offsetWords; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.d.ts new file mode 100644 index 0000000..5c1303b --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.d.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ +import { ListCtor } from "./list"; +import { Pointer, PointerCtor } from "./pointer"; +export declare function PointerList<T extends Pointer>(PointerClass: PointerCtor<T>): ListCtor<T>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js new file mode 100644 index 0000000..39a10f7 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js @@ -0,0 +1,35 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PointerList = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +function PointerList(PointerClass) { + var _a; + return _a = class extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return new PointerClass(c.segment, c.byteOffset + index * 8, this._capnp.depthLimit - 1); + } + set(index, value) { + pointer_1.copyFrom(value, this.get(index)); + } + toString() { + return `Pointer_${super.toString()},cls:${PointerClass.toString()}`; + } + }, + _a._capnp = { + displayName: `List<${PointerClass._capnp.displayName}>`, + size: list_element_size_1.ListElementSize.POINTER, + }, + _a; +} +exports.PointerList = PointerList; +//# sourceMappingURL=pointer-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js.map new file mode 100644 index 0000000..165aaba --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pointer-list.js","sourceRoot":"","sources":["pointer-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAmD;AACnD,uCAAuE;AAEvE,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,SAAgB,WAAW,CAAoB,YAA4B;;IACzE,YAAO,KAAM,SAAQ,WAAO;YAM1B,GAAG,CAAC,KAAa;gBACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;gBAC3B,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3F,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,WAAW,KAAK,CAAC,QAAQ,EAAE,QAAQ,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;YACtE,CAAC;SACF;QAjBiB,SAAM,GAAc;YAClC,WAAW,EAAE,QAAQ,YAAY,CAAC,MAAM,CAAC,WAAW,GAAG;YACvD,IAAI,EAAE,mCAAe,CAAC,OAAO;SAC7B;WAcF;AACJ,CAAC;AApBD,kCAoBC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-list.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.ts new file mode 100644 index 0000000..d71f8b1 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-list.ts @@ -0,0 +1,34 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List, ListCtor } from "./list"; +import { Pointer, PointerCtor, getContent, copyFrom } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export function PointerList<T extends Pointer>(PointerClass: PointerCtor<T>): ListCtor<T> { + return class extends List<T> { + static readonly _capnp: _ListCtor = { + displayName: `List<${PointerClass._capnp.displayName}>`, + size: ListElementSize.POINTER, + }; + + get(index: number): T { + const c = getContent(this); + return new PointerClass(c.segment, c.byteOffset + index * 8, this._capnp.depthLimit - 1); + } + + set(index: number, value: T): void { + copyFrom(value, this.get(index)); + } + + toString(): string { + return `Pointer_${super.toString()},cls:${PointerClass.toString()}`; + } + }; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-type.d.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.d.ts new file mode 100644 index 0000000..f8b3c4c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.d.ts @@ -0,0 +1,9 @@ +/** + * @author jdiaz5513 + */ +export declare enum PointerType { + STRUCT = 0, + LIST = 1, + FAR = 2, + OTHER = 3 +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js new file mode 100644 index 0000000..c81c2fc --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js @@ -0,0 +1,14 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PointerType = void 0; +var PointerType; +(function (PointerType) { + PointerType[PointerType["STRUCT"] = 0] = "STRUCT"; + PointerType[PointerType["LIST"] = 1] = "LIST"; + PointerType[PointerType["FAR"] = 2] = "FAR"; + PointerType[PointerType["OTHER"] = 3] = "OTHER"; +})(PointerType = exports.PointerType || (exports.PointerType = {})); +//# sourceMappingURL=pointer-type.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js.map b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js.map new file mode 100644 index 0000000..02591b4 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pointer-type.js","sourceRoot":"","sources":["pointer-type.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,iDAAU,CAAA;IACV,6CAAQ,CAAA;IACR,2CAAO,CAAA;IACP,+CAAS,CAAA;AACX,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer-type.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.ts new file mode 100644 index 0000000..ad8f91d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer-type.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ + +export enum PointerType { + STRUCT = 0, + LIST = 1, + FAR = 2, + OTHER = 3 +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer.d.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer.d.ts new file mode 100644 index 0000000..9199148 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer.d.ts @@ -0,0 +1,362 @@ +/** + * @author jdiaz5513 + */ +import { ListElementSize } from "../list-element-size"; +import { ObjectSize } from "../object-size"; +import { Segment } from "../segment"; +import { Orphan } from "./orphan"; +import { PointerAllocationResult } from "./pointer-allocation-result"; +import { PointerType } from "./pointer-type"; +import { Message } from "../message"; +export interface _PointerCtor { + readonly displayName: string; +} +export interface PointerCtor<T extends Pointer> { + readonly _capnp: _PointerCtor; + new (segment: Segment, byteOffset: number, depthLimit?: number): T; +} +export interface _Pointer { + compositeIndex?: number; + compositeList: boolean; + /** + * A number that is decremented as nested pointers are traversed. When this hits zero errors will be thrown. + */ + depthLimit: number; +} +/** + * A pointer referencing a single byte location in a segment. This is typically used for Cap'n Proto pointers, but is + * also sometimes used to reference an offset to a pointer's content or tag words. + * + * @export + * @class Pointer + */ +export declare class Pointer { + static readonly adopt: typeof adopt; + static readonly copyFrom: typeof copyFrom; + static readonly disown: typeof disown; + static readonly dump: typeof dump; + static readonly isNull: typeof isNull; + static readonly _capnp: _PointerCtor; + readonly _capnp: _Pointer; + /** Offset, in bytes, from the start of the segment to the beginning of this pointer. */ + byteOffset: number; + /** + * The starting segment for this pointer's data. In the case of a far pointer, the actual content this pointer is + * referencing will be in another segment within the same message. + */ + segment: Segment; + constructor(segment: Segment, byteOffset: number, depthLimit?: number); + toString(): string; +} +/** + * Adopt an orphaned pointer, making the pointer point to the orphaned content without copying it. + * + * @param {Orphan<Pointer>} src The orphan to adopt. + * @param {Pointer} p The the pointer to adopt into. + * @returns {void} + */ +export declare function adopt<T extends Pointer>(src: Orphan<T>, p: T): void; +/** + * Convert a pointer to an Orphan, zeroing out the pointer and leaving its content untouched. If the content is no + * longer needed, call `disown()` on the orphaned pointer to erase the contents as well. + * + * Call `adopt()` on the orphan with the new target pointer location to move it back into the message; the orphan + * object is then invalidated after adoption (can only adopt once!). + * + * @param {T} p The pointer to turn into an Orphan. + * @returns {Orphan<T>} An orphaned pointer. + */ +export declare function disown<T extends Pointer>(p: T): Orphan<T>; +export declare function dump(p: Pointer): string; +/** + * Get the total number of bytes required to hold a list of the provided size with the given length, rounded up to the + * nearest word. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @param {number} length The length of the list. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list; required if + * `elementSize === ListElementSize.COMPOSITE`. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ +export declare function getListByteLength(elementSize: ListElementSize, length: number, compositeSize?: ObjectSize): number; +/** + * Get the number of bytes required to hold a list element of the provided size. `COMPOSITE` elements do not have a + * fixed size, and `BIT` elements are packed into exactly a single bit, so these both return `NaN`. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ +export declare function getListElementByteLength(elementSize: ListElementSize): number; +/** + * Add an offset to the pointer's offset and return a new Pointer for that address. + * + * @param {number} offset The number of bytes to add to the offset. + * @param {Pointer} p The pointer to add from. + * @returns {Pointer} A new pointer to the address. + */ +export declare function add(offset: number, p: Pointer): Pointer; +/** + * Replace a pointer with a deep copy of the pointer at `src` and all of its contents. + * + * @param {Pointer} src The pointer to copy. + * @param {Pointer} p The pointer to copy into. + * @returns {void} + */ +export declare function copyFrom(src: Pointer, p: Pointer): void; +/** + * Recursively erase a pointer, any far pointers/landing pads/tag words, and the content it points to. + * + * Note that this will leave "holes" of zeroes in the message, since the space cannot be reclaimed. With packing this + * will have a negligible effect on the final message size. + * + * FIXME: This may need protection against infinite recursion... + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ +export declare function erase(p: Pointer): void; +/** + * Set the pointer (and far pointer landing pads, if applicable) to zero. Does not touch the pointer's content. + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ +export declare function erasePointer(p: Pointer): void; +/** + * Interpret the pointer as a far pointer, returning its target segment and offset. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the far target. + */ +export declare function followFar(p: Pointer): Pointer; +/** + * If the pointer address references a far pointer, follow it to the location where the actual pointer data is written. + * Otherwise, returns the pointer unmodified. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A new pointer representing the target location, or `p` if it is not a far pointer. + */ +export declare function followFars(p: Pointer): Pointer; +export declare function getCapabilityId(p: Pointer): number; +/** + * Obtain the location of the pointer's content, following far pointers as needed. + * If the pointer is a struct pointer and `compositeIndex` is set, it will be offset by a multiple of the struct's size. + * + * @param {Pointer} p The pointer to read from. + * @param {boolean} [ignoreCompositeIndex] If true, will not follow the composite struct pointer's composite index and + * instead return a pointer to the parent list's contents (also the beginning of the first struct). + * @returns {Pointer} A pointer to the beginning of the pointer's content. + */ +export declare function getContent(p: Pointer, ignoreCompositeIndex?: boolean): Pointer; +/** + * Read the target segment ID from a far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The target segment ID. + */ +export declare function getFarSegmentId(p: Pointer): number; +/** + * Get a number indicating the size of the list's elements. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the list's elements. + */ +export declare function getListElementSize(p: Pointer): ListElementSize; +/** + * Get the number of elements in a list pointer. For composite lists, it instead represents the total number of words in + * the list (not counting the tag word). + * + * This method does **not** attempt to distinguish between composite and non-composite lists. To get the correct + * length for composite lists use `getTargetListLength()` instead. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The length of the list, or total number of words for composite lists. + */ +export declare function getListLength(p: Pointer): number; +/** + * Get the offset (in words) from the end of a pointer to the start of its content. For struct pointers, this is the + * beginning of the data section, and for list pointers it is the location of the first element. The value should + * always be zero for interface pointers. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The offset, in words, from the end of the pointer to the start of the data section. + */ +export declare function getOffsetWords(p: Pointer): number; +/** + * Look up the pointer's type. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer. + */ +export declare function getPointerType(p: Pointer): PointerType; +/** + * Read the number of data words from this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of data words in the struct. + */ +export declare function getStructDataWords(p: Pointer): number; +/** + * Read the number of pointers contained in this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of pointers in this struct. + */ +export declare function getStructPointerLength(p: Pointer): number; +/** + * Get an object describing this struct pointer's size. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} The size of the struct. + */ +export declare function getStructSize(p: Pointer): ObjectSize; +/** + * Get a pointer to this pointer's composite list tag word, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the list's composite tag word. + */ +export declare function getTargetCompositeListTag(p: Pointer): Pointer; +/** + * Get the object size for the target composite list, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} An object describing the size of each struct in the list. + */ +export declare function getTargetCompositeListSize(p: Pointer): ObjectSize; +/** + * Get the size of the list elements referenced by this pointer, following far pointers if necessary. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the elements in the list. + */ +export declare function getTargetListElementSize(p: Pointer): ListElementSize; +/** + * Get the length of the list referenced by this pointer, following far pointers if necessary. If the list is a + * composite list, it will look up the tag word and read the length from there. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of elements in the list. + */ +export declare function getTargetListLength(p: Pointer): number; +/** + * Get the type of a pointer, following far pointers if necessary. For non-far pointers this is equivalent to calling + * `getPointerType()`. + * + * The target of a far pointer can never be another far pointer, and this method will throw if such a situation is + * encountered. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer referenced by this pointer. + */ +export declare function getTargetPointerType(p: Pointer): PointerType; +/** + * Get the size of the struct referenced by a pointer, following far pointers if necessary. + * + * @param {Pointer} p The poiner to read from. + * @returns {ObjectSize} The size of the struct referenced by this pointer. + */ +export declare function getTargetStructSize(p: Pointer): ObjectSize; +/** + * Initialize a pointer to point at the data in the content segment. If the content segment is not the same as the + * pointer's segment, this will allocate and write far pointers as needed. Nothing is written otherwise. + * + * The return value includes a pointer to write the pointer's actual data to (the eventual far target), and the offset + * value (in words) to use for that pointer. In the case of double-far pointers this offset will always be zero. + * + * @param {Segment} contentSegment The segment containing this pointer's content. + * @param {number} contentOffset The offset within the content segment for the beginning of this pointer's content. + * @param {Pointer} p The pointer to initialize. + * @returns {PointerAllocationResult} An object containing a pointer (where the pointer data should be written), and + * the value to use as the offset for that pointer. + */ +export declare function initPointer(contentSegment: Segment, contentOffset: number, p: Pointer): PointerAllocationResult; +/** + * Check if the pointer is a double-far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if it is a double-far pointer, `false` otherwise. + */ +export declare function isDoubleFar(p: Pointer): boolean; +/** + * Quickly check to see if the pointer is "null". A "null" pointer is a zero word, equivalent to an empty struct + * pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if the pointer is "null". + */ +export declare function isNull(p: Pointer): boolean; +/** + * Relocate a pointer to the given destination, ensuring that it points to the same content. This will create far + * pointers as needed if the content is in a different segment than the destination. After the relocation the source + * pointer will be erased and is no longer valid. + * + * @param {Pointer} dst The desired location for the `src` pointer. Any existing contents will be erased before + * relocating! + * @param {Pointer} src The pointer to relocate. + * @returns {void} + */ +export declare function relocateTo(dst: Pointer, src: Pointer): void; +/** + * Write a far pointer. + * + * @param {boolean} doubleFar Set to `true` if this is a double far pointer. + * @param {number} offsetWords The offset, in words, to the target pointer. + * @param {number} segmentId The segment the target pointer is located in. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +export declare function setFarPointer(doubleFar: boolean, offsetWords: number, segmentId: number, p: Pointer): void; +/** + * Write a raw interface pointer. + * + * @param {number} capId The capability ID. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +export declare function setInterfacePointer(capId: number, p: Pointer): void; +/** + * Write a raw list pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the list content. + * @param {ListElementSize} size The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {Pointer} p The pointer to write to. + * @param {ObjectSize} [compositeSize] For composite lists this describes the size of each element in this list. This + * is required for composite lists. + * @returns {void} + */ +export declare function setListPointer(offsetWords: number, size: ListElementSize, length: number, p: Pointer, compositeSize?: ObjectSize): void; +/** + * Write a raw struct pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the struct's data + * section. + * @param {ObjectSize} size An object describing the size of the struct. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +export declare function setStructPointer(offsetWords: number, size: ObjectSize, p: Pointer): void; +/** + * Read some bits off a pointer to make sure it has the right pointer data. + * + * @param {PointerType} pointerType The expected pointer type. + * @param {Pointer} p The pointer to validate. + * @param {ListElementSize} [elementSize] For list pointers, the expected element size. Leave this + * undefined for struct pointers. + * @returns {void} + */ +export declare function validate(pointerType: PointerType, p: Pointer, elementSize?: ListElementSize): void; +export declare function copyFromList(src: Pointer, dst: Pointer): void; +export declare function copyFromStruct(src: Pointer, dst: Pointer): void; +/** + * Track the allocation of a new Pointer object. + * + * This will decrement an internal counter tracking how many bytes have been traversed in the message so far. After + * a certain limit, this method will throw an error in order to prevent a certain class of DoS attacks. + * + * @param {Message} message The message the pointer belongs to. + * @param {Pointer} p The pointer being allocated. + * @returns {void} + */ +export declare function trackPointerAllocation(message: Message, p: Pointer): void; diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer.js b/node_modules/capnp-ts/src/serialization/pointers/pointer.js new file mode 100644 index 0000000..711bfbc --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer.js @@ -0,0 +1,795 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.trackPointerAllocation = exports.copyFromStruct = exports.copyFromList = exports.validate = exports.setStructPointer = exports.setListPointer = exports.setInterfacePointer = exports.setFarPointer = exports.relocateTo = exports.isNull = exports.isDoubleFar = exports.initPointer = exports.getTargetStructSize = exports.getTargetPointerType = exports.getTargetListLength = exports.getTargetListElementSize = exports.getTargetCompositeListSize = exports.getTargetCompositeListTag = exports.getStructSize = exports.getStructPointerLength = exports.getStructDataWords = exports.getPointerType = exports.getOffsetWords = exports.getListLength = exports.getListElementSize = exports.getFarSegmentId = exports.getContent = exports.getCapabilityId = exports.followFars = exports.followFar = exports.erasePointer = exports.erase = exports.copyFrom = exports.add = exports.getListElementByteLength = exports.getListByteLength = exports.dump = exports.disown = exports.adopt = exports.Pointer = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../../constants"); +const util_1 = require("../../util"); +const list_element_size_1 = require("../list-element-size"); +const object_size_1 = require("../object-size"); +const orphan_1 = require("./orphan"); +const pointer_allocation_result_1 = require("./pointer-allocation-result"); +const pointer_type_1 = require("./pointer-type"); +const errors_1 = require("../../errors"); +const trace = debug_1.default("capnp:pointer"); +trace("load"); +/** + * A pointer referencing a single byte location in a segment. This is typically used for Cap'n Proto pointers, but is + * also sometimes used to reference an offset to a pointer's content or tag words. + * + * @export + * @class Pointer + */ +class Pointer { + constructor(segment, byteOffset, depthLimit = constants_1.MAX_DEPTH) { + this._capnp = { compositeList: false, depthLimit }; + this.segment = segment; + this.byteOffset = byteOffset; + if (depthLimit === 0) { + throw new Error(util_1.format(errors_1.PTR_DEPTH_LIMIT_EXCEEDED, this)); + } + // Make sure we keep track of all pointer allocations; there's a limit per message (prevent DoS). + trackPointerAllocation(segment.message, this); + // NOTE: It's okay to have a pointer to the end of the segment; you'll see this when creating pointers to the + // beginning of the content of a newly-allocated composite list with zero elements. Unlike other language + // implementations buffer over/underflows are not a big issue since all buffer access is bounds checked in native + // code anyway. + if (byteOffset < 0 || byteOffset > segment.byteLength) { + throw new Error(util_1.format(errors_1.PTR_OFFSET_OUT_OF_BOUNDS, byteOffset)); + } + trace("new %s", this); + } + toString() { + return util_1.format("Pointer_%d@%a,%s,limit:%x", this.segment.id, this.byteOffset, dump(this), this._capnp.depthLimit); + } +} +exports.Pointer = Pointer; +Pointer.adopt = adopt; +Pointer.copyFrom = copyFrom; +Pointer.disown = disown; +Pointer.dump = dump; +Pointer.isNull = isNull; +Pointer._capnp = { + displayName: "Pointer", +}; +/** + * Adopt an orphaned pointer, making the pointer point to the orphaned content without copying it. + * + * @param {Orphan<Pointer>} src The orphan to adopt. + * @param {Pointer} p The the pointer to adopt into. + * @returns {void} + */ +function adopt(src, p) { + src._moveTo(p); +} +exports.adopt = adopt; +/** + * Convert a pointer to an Orphan, zeroing out the pointer and leaving its content untouched. If the content is no + * longer needed, call `disown()` on the orphaned pointer to erase the contents as well. + * + * Call `adopt()` on the orphan with the new target pointer location to move it back into the message; the orphan + * object is then invalidated after adoption (can only adopt once!). + * + * @param {T} p The pointer to turn into an Orphan. + * @returns {Orphan<T>} An orphaned pointer. + */ +function disown(p) { + return new orphan_1.Orphan(p); +} +exports.disown = disown; +function dump(p) { + return util_1.bufferToHex(p.segment.buffer.slice(p.byteOffset, p.byteOffset + 8)); +} +exports.dump = dump; +/** + * Get the total number of bytes required to hold a list of the provided size with the given length, rounded up to the + * nearest word. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @param {number} length The length of the list. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list; required if + * `elementSize === ListElementSize.COMPOSITE`. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ +function getListByteLength(elementSize, length, compositeSize) { + switch (elementSize) { + case list_element_size_1.ListElementSize.BIT: + return util_1.padToWord((length + 7) >>> 3); + case list_element_size_1.ListElementSize.BYTE: + case list_element_size_1.ListElementSize.BYTE_2: + case list_element_size_1.ListElementSize.BYTE_4: + case list_element_size_1.ListElementSize.BYTE_8: + case list_element_size_1.ListElementSize.POINTER: + case list_element_size_1.ListElementSize.VOID: + return util_1.padToWord(getListElementByteLength(elementSize) * length); + /* istanbul ignore next */ + case list_element_size_1.ListElementSize.COMPOSITE: + if (compositeSize === undefined) { + throw new Error(util_1.format(errors_1.PTR_INVALID_LIST_SIZE, NaN)); + } + return length * util_1.padToWord(object_size_1.getByteLength(compositeSize)); + /* istanbul ignore next */ + default: + throw new Error(errors_1.PTR_INVALID_LIST_SIZE); + } +} +exports.getListByteLength = getListByteLength; +/** + * Get the number of bytes required to hold a list element of the provided size. `COMPOSITE` elements do not have a + * fixed size, and `BIT` elements are packed into exactly a single bit, so these both return `NaN`. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ +function getListElementByteLength(elementSize) { + switch (elementSize) { + /* istanbul ignore next */ + case list_element_size_1.ListElementSize.BIT: + return NaN; + case list_element_size_1.ListElementSize.BYTE: + return 1; + case list_element_size_1.ListElementSize.BYTE_2: + return 2; + case list_element_size_1.ListElementSize.BYTE_4: + return 4; + case list_element_size_1.ListElementSize.BYTE_8: + case list_element_size_1.ListElementSize.POINTER: + return 8; + /* istanbul ignore next */ + case list_element_size_1.ListElementSize.COMPOSITE: + // Caller has to figure it out based on the tag word. + return NaN; + /* istanbul ignore next */ + case list_element_size_1.ListElementSize.VOID: + return 0; + /* istanbul ignore next */ + default: + throw new Error(util_1.format(errors_1.PTR_INVALID_LIST_SIZE, elementSize)); + } +} +exports.getListElementByteLength = getListElementByteLength; +/** + * Add an offset to the pointer's offset and return a new Pointer for that address. + * + * @param {number} offset The number of bytes to add to the offset. + * @param {Pointer} p The pointer to add from. + * @returns {Pointer} A new pointer to the address. + */ +function add(offset, p) { + return new Pointer(p.segment, p.byteOffset + offset, p._capnp.depthLimit); +} +exports.add = add; +/** + * Replace a pointer with a deep copy of the pointer at `src` and all of its contents. + * + * @param {Pointer} src The pointer to copy. + * @param {Pointer} p The pointer to copy into. + * @returns {void} + */ +function copyFrom(src, p) { + // If the pointer is the same then this is a noop. + if (p.segment === src.segment && p.byteOffset === src.byteOffset) { + trace("ignoring copy operation from identical pointer %s", src); + return; + } + // Make sure we erase this pointer's contents before moving on. If src is null, that's all we do. + erase(p); // noop if null + if (isNull(src)) + return; + switch (getTargetPointerType(src)) { + case pointer_type_1.PointerType.STRUCT: + copyFromStruct(src, p); + break; + case pointer_type_1.PointerType.LIST: + copyFromList(src, p); + break; + /* istanbul ignore next */ + default: + throw new Error(util_1.format(errors_1.PTR_INVALID_POINTER_TYPE, getTargetPointerType(p))); + } +} +exports.copyFrom = copyFrom; +/** + * Recursively erase a pointer, any far pointers/landing pads/tag words, and the content it points to. + * + * Note that this will leave "holes" of zeroes in the message, since the space cannot be reclaimed. With packing this + * will have a negligible effect on the final message size. + * + * FIXME: This may need protection against infinite recursion... + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ +function erase(p) { + if (isNull(p)) + return; + // First deal with the contents. + let c; + switch (getTargetPointerType(p)) { + case pointer_type_1.PointerType.STRUCT: { + const size = getTargetStructSize(p); + c = getContent(p); + // Wipe the data section. + c.segment.fillZeroWords(c.byteOffset, size.dataByteLength / 8); + // Iterate over all the pointers and nuke them. + for (let i = 0; i < size.pointerLength; i++) { + erase(add(i * 8, c)); + } + break; + } + case pointer_type_1.PointerType.LIST: { + const elementSize = getTargetListElementSize(p); + const length = getTargetListLength(p); + let contentWords = util_1.padToWord(length * getListElementByteLength(elementSize)); + c = getContent(p); + if (elementSize === list_element_size_1.ListElementSize.POINTER) { + for (let i = 0; i < length; i++) { + erase(new Pointer(c.segment, c.byteOffset + i * 8, p._capnp.depthLimit - 1)); + } + // Calling erase on each pointer takes care of the content, nothing left to do here. + break; + } + else if (elementSize === list_element_size_1.ListElementSize.COMPOSITE) { + // Read some stuff from the tag word. + const tag = add(-8, c); + const compositeSize = getStructSize(tag); + const compositeByteLength = object_size_1.getByteLength(compositeSize); + contentWords = getOffsetWords(tag); + // Kill the tag word. + c.segment.setWordZero(c.byteOffset - 8); + // Recursively erase each pointer. + for (let i = 0; i < length; i++) { + for (let j = 0; j < compositeSize.pointerLength; j++) { + erase(new Pointer(c.segment, c.byteOffset + i * compositeByteLength + j * 8, p._capnp.depthLimit - 1)); + } + } + } + c.segment.fillZeroWords(c.byteOffset, contentWords); + break; + } + case pointer_type_1.PointerType.OTHER: + // No content. + break; + default: + throw new Error(util_1.format(errors_1.PTR_INVALID_POINTER_TYPE, getTargetPointerType(p))); + } + erasePointer(p); +} +exports.erase = erase; +/** + * Set the pointer (and far pointer landing pads, if applicable) to zero. Does not touch the pointer's content. + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ +function erasePointer(p) { + if (getPointerType(p) === pointer_type_1.PointerType.FAR) { + const landingPad = followFar(p); + if (isDoubleFar(p)) { + // Kill the double-far tag word. + landingPad.segment.setWordZero(landingPad.byteOffset + 8); + } + // Kill the landing pad. + landingPad.segment.setWordZero(landingPad.byteOffset); + } + // Finally! Kill the pointer itself... + p.segment.setWordZero(p.byteOffset); +} +exports.erasePointer = erasePointer; +/** + * Interpret the pointer as a far pointer, returning its target segment and offset. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the far target. + */ +function followFar(p) { + const targetSegment = p.segment.message.getSegment(p.segment.getUint32(p.byteOffset + 4)); + const targetWordOffset = p.segment.getUint32(p.byteOffset) >>> 3; + return new Pointer(targetSegment, targetWordOffset * 8, p._capnp.depthLimit - 1); +} +exports.followFar = followFar; +/** + * If the pointer address references a far pointer, follow it to the location where the actual pointer data is written. + * Otherwise, returns the pointer unmodified. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A new pointer representing the target location, or `p` if it is not a far pointer. + */ +function followFars(p) { + if (getPointerType(p) === pointer_type_1.PointerType.FAR) { + const landingPad = followFar(p); + if (isDoubleFar(p)) + landingPad.byteOffset += 8; + return landingPad; + } + return p; +} +exports.followFars = followFars; +function getCapabilityId(p) { + return p.segment.getUint32(p.byteOffset + 4); +} +exports.getCapabilityId = getCapabilityId; +function isCompositeList(p) { + return getTargetPointerType(p) === pointer_type_1.PointerType.LIST && getTargetListElementSize(p) === list_element_size_1.ListElementSize.COMPOSITE; +} +/** + * Obtain the location of the pointer's content, following far pointers as needed. + * If the pointer is a struct pointer and `compositeIndex` is set, it will be offset by a multiple of the struct's size. + * + * @param {Pointer} p The pointer to read from. + * @param {boolean} [ignoreCompositeIndex] If true, will not follow the composite struct pointer's composite index and + * instead return a pointer to the parent list's contents (also the beginning of the first struct). + * @returns {Pointer} A pointer to the beginning of the pointer's content. + */ +function getContent(p, ignoreCompositeIndex) { + let c; + if (isDoubleFar(p)) { + const landingPad = followFar(p); + c = new Pointer(p.segment.message.getSegment(getFarSegmentId(landingPad)), getOffsetWords(landingPad) * 8); + } + else { + const target = followFars(p); + c = new Pointer(target.segment, target.byteOffset + 8 + getOffsetWords(target) * 8); + } + if (isCompositeList(p)) + c.byteOffset += 8; + if (!ignoreCompositeIndex && p._capnp.compositeIndex !== undefined) { + // Seek backwards by one word so we can read the struct size off the tag word. + c.byteOffset -= 8; + // Seek ahead by `compositeIndex` multiples of the struct's total size. + c.byteOffset += 8 + p._capnp.compositeIndex * object_size_1.getByteLength(object_size_1.padToWord(getStructSize(c))); + } + return c; +} +exports.getContent = getContent; +/** + * Read the target segment ID from a far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The target segment ID. + */ +function getFarSegmentId(p) { + return p.segment.getUint32(p.byteOffset + 4); +} +exports.getFarSegmentId = getFarSegmentId; +/** + * Get a number indicating the size of the list's elements. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the list's elements. + */ +function getListElementSize(p) { + return p.segment.getUint32(p.byteOffset + 4) & constants_1.LIST_SIZE_MASK; +} +exports.getListElementSize = getListElementSize; +/** + * Get the number of elements in a list pointer. For composite lists, it instead represents the total number of words in + * the list (not counting the tag word). + * + * This method does **not** attempt to distinguish between composite and non-composite lists. To get the correct + * length for composite lists use `getTargetListLength()` instead. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The length of the list, or total number of words for composite lists. + */ +function getListLength(p) { + return p.segment.getUint32(p.byteOffset + 4) >>> 3; +} +exports.getListLength = getListLength; +/** + * Get the offset (in words) from the end of a pointer to the start of its content. For struct pointers, this is the + * beginning of the data section, and for list pointers it is the location of the first element. The value should + * always be zero for interface pointers. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The offset, in words, from the end of the pointer to the start of the data section. + */ +function getOffsetWords(p) { + const o = p.segment.getInt32(p.byteOffset); + // Far pointers only have 29 offset bits. + return o & 2 ? o >> 3 : o >> 2; +} +exports.getOffsetWords = getOffsetWords; +/** + * Look up the pointer's type. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer. + */ +function getPointerType(p) { + return p.segment.getUint32(p.byteOffset) & constants_1.POINTER_TYPE_MASK; +} +exports.getPointerType = getPointerType; +/** + * Read the number of data words from this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of data words in the struct. + */ +function getStructDataWords(p) { + return p.segment.getUint16(p.byteOffset + 4); +} +exports.getStructDataWords = getStructDataWords; +/** + * Read the number of pointers contained in this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of pointers in this struct. + */ +function getStructPointerLength(p) { + return p.segment.getUint16(p.byteOffset + 6); +} +exports.getStructPointerLength = getStructPointerLength; +/** + * Get an object describing this struct pointer's size. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} The size of the struct. + */ +function getStructSize(p) { + return new object_size_1.ObjectSize(getStructDataWords(p) * 8, getStructPointerLength(p)); +} +exports.getStructSize = getStructSize; +/** + * Get a pointer to this pointer's composite list tag word, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the list's composite tag word. + */ +function getTargetCompositeListTag(p) { + const c = getContent(p); + // The composite list tag is always one word before the content. + c.byteOffset -= 8; + return c; +} +exports.getTargetCompositeListTag = getTargetCompositeListTag; +/** + * Get the object size for the target composite list, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} An object describing the size of each struct in the list. + */ +function getTargetCompositeListSize(p) { + return getStructSize(getTargetCompositeListTag(p)); +} +exports.getTargetCompositeListSize = getTargetCompositeListSize; +/** + * Get the size of the list elements referenced by this pointer, following far pointers if necessary. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the elements in the list. + */ +function getTargetListElementSize(p) { + return getListElementSize(followFars(p)); +} +exports.getTargetListElementSize = getTargetListElementSize; +/** + * Get the length of the list referenced by this pointer, following far pointers if necessary. If the list is a + * composite list, it will look up the tag word and read the length from there. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of elements in the list. + */ +function getTargetListLength(p) { + const t = followFars(p); + if (getListElementSize(t) === list_element_size_1.ListElementSize.COMPOSITE) { + // The content is prefixed by a tag word; it's a struct pointer whose offset contains the list's length. + return getOffsetWords(getTargetCompositeListTag(p)); + } + return getListLength(t); +} +exports.getTargetListLength = getTargetListLength; +/** + * Get the type of a pointer, following far pointers if necessary. For non-far pointers this is equivalent to calling + * `getPointerType()`. + * + * The target of a far pointer can never be another far pointer, and this method will throw if such a situation is + * encountered. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer referenced by this pointer. + */ +function getTargetPointerType(p) { + const t = getPointerType(followFars(p)); + if (t === pointer_type_1.PointerType.FAR) + throw new Error(util_1.format(errors_1.PTR_INVALID_FAR_TARGET, p)); + return t; +} +exports.getTargetPointerType = getTargetPointerType; +/** + * Get the size of the struct referenced by a pointer, following far pointers if necessary. + * + * @param {Pointer} p The poiner to read from. + * @returns {ObjectSize} The size of the struct referenced by this pointer. + */ +function getTargetStructSize(p) { + return getStructSize(followFars(p)); +} +exports.getTargetStructSize = getTargetStructSize; +/** + * Initialize a pointer to point at the data in the content segment. If the content segment is not the same as the + * pointer's segment, this will allocate and write far pointers as needed. Nothing is written otherwise. + * + * The return value includes a pointer to write the pointer's actual data to (the eventual far target), and the offset + * value (in words) to use for that pointer. In the case of double-far pointers this offset will always be zero. + * + * @param {Segment} contentSegment The segment containing this pointer's content. + * @param {number} contentOffset The offset within the content segment for the beginning of this pointer's content. + * @param {Pointer} p The pointer to initialize. + * @returns {PointerAllocationResult} An object containing a pointer (where the pointer data should be written), and + * the value to use as the offset for that pointer. + */ +function initPointer(contentSegment, contentOffset, p) { + if (p.segment !== contentSegment) { + // Need a far pointer. + trace("Initializing far pointer %s -> %s.", p, contentSegment); + if (!contentSegment.hasCapacity(8)) { + // GAH! Not enough space in the content segment for a landing pad so we need a double far pointer. + const landingPad = p.segment.allocate(16); + trace("GAH! Initializing double-far pointer in %s from %s -> %s.", p, contentSegment, landingPad); + setFarPointer(true, landingPad.byteOffset / 8, landingPad.segment.id, p); + setFarPointer(false, contentOffset / 8, contentSegment.id, landingPad); + landingPad.byteOffset += 8; + return new pointer_allocation_result_1.PointerAllocationResult(landingPad, 0); + } + // Allocate a far pointer landing pad in the target segment. + const landingPad = contentSegment.allocate(8); + if (landingPad.segment.id !== contentSegment.id) { + throw new Error(errors_1.INVARIANT_UNREACHABLE_CODE); + } + setFarPointer(false, landingPad.byteOffset / 8, landingPad.segment.id, p); + return new pointer_allocation_result_1.PointerAllocationResult(landingPad, (contentOffset - landingPad.byteOffset - 8) / 8); + } + trace("Initializing intra-segment pointer %s -> %a.", p, contentOffset); + return new pointer_allocation_result_1.PointerAllocationResult(p, (contentOffset - p.byteOffset - 8) / 8); +} +exports.initPointer = initPointer; +/** + * Check if the pointer is a double-far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if it is a double-far pointer, `false` otherwise. + */ +function isDoubleFar(p) { + return getPointerType(p) === pointer_type_1.PointerType.FAR && (p.segment.getUint32(p.byteOffset) & constants_1.POINTER_DOUBLE_FAR_MASK) !== 0; +} +exports.isDoubleFar = isDoubleFar; +/** + * Quickly check to see if the pointer is "null". A "null" pointer is a zero word, equivalent to an empty struct + * pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if the pointer is "null". + */ +function isNull(p) { + return p.segment.isWordZero(p.byteOffset); +} +exports.isNull = isNull; +/** + * Relocate a pointer to the given destination, ensuring that it points to the same content. This will create far + * pointers as needed if the content is in a different segment than the destination. After the relocation the source + * pointer will be erased and is no longer valid. + * + * @param {Pointer} dst The desired location for the `src` pointer. Any existing contents will be erased before + * relocating! + * @param {Pointer} src The pointer to relocate. + * @returns {void} + */ +function relocateTo(dst, src) { + const t = followFars(src); + const lo = t.segment.getUint8(t.byteOffset) & 0x03; // discard the offset + const hi = t.segment.getUint32(t.byteOffset + 4); + // Make sure anything dst was pointing to is wiped out. + erase(dst); + const res = initPointer(t.segment, t.byteOffset + 8 + getOffsetWords(t) * 8, dst); + // Keep the low 2 bits and write the new offset. + res.pointer.segment.setUint32(res.pointer.byteOffset, lo | (res.offsetWords << 2)); + // Keep the high 32 bits intact. + res.pointer.segment.setUint32(res.pointer.byteOffset + 4, hi); + erasePointer(src); +} +exports.relocateTo = relocateTo; +/** + * Write a far pointer. + * + * @param {boolean} doubleFar Set to `true` if this is a double far pointer. + * @param {number} offsetWords The offset, in words, to the target pointer. + * @param {number} segmentId The segment the target pointer is located in. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +function setFarPointer(doubleFar, offsetWords, segmentId, p) { + const A = pointer_type_1.PointerType.FAR; + const B = doubleFar ? 1 : 0; + const C = offsetWords; + const D = segmentId; + p.segment.setUint32(p.byteOffset, A | (B << 2) | (C << 3)); + p.segment.setUint32(p.byteOffset + 4, D); +} +exports.setFarPointer = setFarPointer; +/** + * Write a raw interface pointer. + * + * @param {number} capId The capability ID. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +function setInterfacePointer(capId, p) { + p.segment.setUint32(p.byteOffset, pointer_type_1.PointerType.OTHER); + p.segment.setUint32(p.byteOffset + 4, capId); +} +exports.setInterfacePointer = setInterfacePointer; +/** + * Write a raw list pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the list content. + * @param {ListElementSize} size The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {Pointer} p The pointer to write to. + * @param {ObjectSize} [compositeSize] For composite lists this describes the size of each element in this list. This + * is required for composite lists. + * @returns {void} + */ +function setListPointer(offsetWords, size, length, p, compositeSize) { + const A = pointer_type_1.PointerType.LIST; + const B = offsetWords; + const C = size; + let D = length; + if (size === list_element_size_1.ListElementSize.COMPOSITE) { + if (compositeSize === undefined) { + throw new TypeError(errors_1.TYPE_COMPOSITE_SIZE_UNDEFINED); + } + D *= object_size_1.getWordLength(compositeSize); + } + p.segment.setUint32(p.byteOffset, A | (B << 2)); + p.segment.setUint32(p.byteOffset + 4, C | (D << 3)); +} +exports.setListPointer = setListPointer; +/** + * Write a raw struct pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the struct's data + * section. + * @param {ObjectSize} size An object describing the size of the struct. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ +function setStructPointer(offsetWords, size, p) { + const A = pointer_type_1.PointerType.STRUCT; + const B = offsetWords; + const C = object_size_1.getDataWordLength(size); + const D = size.pointerLength; + p.segment.setUint32(p.byteOffset, A | (B << 2)); + p.segment.setUint16(p.byteOffset + 4, C); + p.segment.setUint16(p.byteOffset + 6, D); +} +exports.setStructPointer = setStructPointer; +/** + * Read some bits off a pointer to make sure it has the right pointer data. + * + * @param {PointerType} pointerType The expected pointer type. + * @param {Pointer} p The pointer to validate. + * @param {ListElementSize} [elementSize] For list pointers, the expected element size. Leave this + * undefined for struct pointers. + * @returns {void} + */ +function validate(pointerType, p, elementSize) { + if (isNull(p)) + return; + const t = followFars(p); + // Check the pointer type. + const A = t.segment.getUint32(t.byteOffset) & constants_1.POINTER_TYPE_MASK; + if (A !== pointerType) { + throw new Error(util_1.format(errors_1.PTR_WRONG_POINTER_TYPE, p, pointerType)); + } + // Check the list element size, if provided. + if (elementSize !== undefined) { + const C = t.segment.getUint32(t.byteOffset + 4) & constants_1.LIST_SIZE_MASK; + if (C !== elementSize) { + throw new Error(util_1.format(errors_1.PTR_WRONG_LIST_TYPE, p, list_element_size_1.ListElementSize[elementSize])); + } + } +} +exports.validate = validate; +function copyFromList(src, dst) { + if (dst._capnp.depthLimit <= 0) + throw new Error(errors_1.PTR_DEPTH_LIMIT_EXCEEDED); + const srcContent = getContent(src); + const srcElementSize = getTargetListElementSize(src); + const srcLength = getTargetListLength(src); + let srcCompositeSize; + let srcStructByteLength; + let dstContent; + if (srcElementSize === list_element_size_1.ListElementSize.POINTER) { + dstContent = dst.segment.allocate(srcLength << 3); + // Recursively copy each pointer in the list. + for (let i = 0; i < srcLength; i++) { + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + (i << 3), src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + (i << 3), dst._capnp.depthLimit - 1); + copyFrom(srcPtr, dstPtr); + } + } + else if (srcElementSize === list_element_size_1.ListElementSize.COMPOSITE) { + srcCompositeSize = object_size_1.padToWord(getTargetCompositeListSize(src)); + srcStructByteLength = object_size_1.getByteLength(srcCompositeSize); + dstContent = dst.segment.allocate(object_size_1.getByteLength(srcCompositeSize) * srcLength + 8); + // Copy the tag word. + dstContent.segment.copyWord(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset - 8); + // Copy the entire contents, including all pointers. This should be more efficient than making `srcLength` + // copies to skip the pointer sections, and we're about to rewrite all those pointers anyway. + // PERF: Skip this step if the composite struct only contains pointers. + if (srcCompositeSize.dataByteLength > 0) { + const wordLength = object_size_1.getWordLength(srcCompositeSize) * srcLength; + dstContent.segment.copyWords(dstContent.byteOffset + 8, srcContent.segment, srcContent.byteOffset, wordLength); + } + // Recursively copy all the pointers in each struct. + for (let i = 0; i < srcLength; i++) { + for (let j = 0; j < srcCompositeSize.pointerLength; j++) { + const offset = i * srcStructByteLength + srcCompositeSize.dataByteLength + (j << 3); + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + offset, src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + offset + 8, dst._capnp.depthLimit - 1); + copyFrom(srcPtr, dstPtr); + } + } + } + else { + const byteLength = util_1.padToWord(srcElementSize === list_element_size_1.ListElementSize.BIT + ? (srcLength + 7) >>> 3 + : getListElementByteLength(srcElementSize) * srcLength); + const wordLength = byteLength >>> 3; + dstContent = dst.segment.allocate(byteLength); + // Copy all of the list contents word-by-word. + dstContent.segment.copyWords(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset, wordLength); + } + // Initialize the list pointer. + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setListPointer(res.offsetWords, srcElementSize, srcLength, res.pointer, srcCompositeSize); +} +exports.copyFromList = copyFromList; +function copyFromStruct(src, dst) { + if (dst._capnp.depthLimit <= 0) + throw new Error(errors_1.PTR_DEPTH_LIMIT_EXCEEDED); + const srcContent = getContent(src); + const srcSize = getTargetStructSize(src); + const srcDataWordLength = object_size_1.getDataWordLength(srcSize); + // Allocate space for the destination content. + const dstContent = dst.segment.allocate(object_size_1.getByteLength(srcSize)); + // Copy the data section. + dstContent.segment.copyWords(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset, srcDataWordLength); + // Copy the pointer section. + for (let i = 0; i < srcSize.pointerLength; i++) { + const offset = srcSize.dataByteLength + i * 8; + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + offset, src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + offset, dst._capnp.depthLimit - 1); + copyFrom(srcPtr, dstPtr); + } + // Don't touch dst if it's already initialized as a composite list pointer. With composite struct pointers there's + // no pointer to copy here and we've already copied the contents. + if (dst._capnp.compositeList) + return; + // Initialize the struct pointer. + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setStructPointer(res.offsetWords, srcSize, res.pointer); +} +exports.copyFromStruct = copyFromStruct; +/** + * Track the allocation of a new Pointer object. + * + * This will decrement an internal counter tracking how many bytes have been traversed in the message so far. After + * a certain limit, this method will throw an error in order to prevent a certain class of DoS attacks. + * + * @param {Message} message The message the pointer belongs to. + * @param {Pointer} p The pointer being allocated. + * @returns {void} + */ +function trackPointerAllocation(message, p) { + message._capnp.traversalLimit -= 8; + if (message._capnp.traversalLimit <= 0) { + throw new Error(util_1.format(errors_1.PTR_TRAVERSAL_LIMIT_EXCEEDED, p)); + } +} +exports.trackPointerAllocation = trackPointerAllocation; +//# sourceMappingURL=pointer.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer.js.map b/node_modules/capnp-ts/src/serialization/pointers/pointer.js.map new file mode 100644 index 0000000..5a0bd3e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pointer.js","sourceRoot":"","sources":["pointer.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,+CAAwG;AACxG,qCAA4D;AAC5D,4DAAuD;AACvD,gDAMwB;AAExB,qCAAkC;AAClC,2EAAsE;AACtE,iDAA6C;AAE7C,yCAWsB;AAEtB,MAAM,KAAK,GAAG,eAAS,CAAC,eAAe,CAAC,CAAC;AACzC,KAAK,CAAC,MAAM,CAAC,CAAC;AAwBd;;;;;;GAMG;AAEH,MAAa,OAAO;IAwBlB,YAAY,OAAgB,EAAE,UAAkB,EAAE,UAAU,GAAG,qBAAS;QACtE,IAAI,CAAC,MAAM,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,UAAU,KAAK,CAAC,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,iCAAwB,EAAE,IAAI,CAAC,CA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B,EAAE,CAAU;IACjE,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,CAAC;IAEnC,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,qCAA4B,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1D;AACH,CAAC;AAND,wDAMC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/pointer.ts b/node_modules/capnp-ts/src/serialization/pointers/pointer.ts new file mode 100644 index 0000000..891382e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/pointer.ts @@ -0,0 +1,1018 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { LIST_SIZE_MASK, MAX_DEPTH, POINTER_DOUBLE_FAR_MASK, POINTER_TYPE_MASK } from "../../constants"; +import { bufferToHex, format, padToWord } from "../../util"; +import { ListElementSize } from "../list-element-size"; +import { + ObjectSize, + getByteLength, + padToWord as padObjectToWord, + getWordLength, + getDataWordLength, +} from "../object-size"; +import { Segment } from "../segment"; +import { Orphan } from "./orphan"; +import { PointerAllocationResult } from "./pointer-allocation-result"; +import { PointerType } from "./pointer-type"; +import { Message } from "../message"; +import { + PTR_TRAVERSAL_LIMIT_EXCEEDED, + PTR_DEPTH_LIMIT_EXCEEDED, + PTR_OFFSET_OUT_OF_BOUNDS, + PTR_INVALID_LIST_SIZE, + PTR_INVALID_POINTER_TYPE, + PTR_INVALID_FAR_TARGET, + TYPE_COMPOSITE_SIZE_UNDEFINED, + PTR_WRONG_POINTER_TYPE, + PTR_WRONG_LIST_TYPE, + INVARIANT_UNREACHABLE_CODE, +} from "../../errors"; + +const trace = initTrace("capnp:pointer"); +trace("load"); + +export interface _PointerCtor { + readonly displayName: string; +} + +export interface PointerCtor<T extends Pointer> { + readonly _capnp: _PointerCtor; + + new (segment: Segment, byteOffset: number, depthLimit?: number): T; +} + +export interface _Pointer { + compositeIndex?: number; + + compositeList: boolean; + + /** + * A number that is decremented as nested pointers are traversed. When this hits zero errors will be thrown. + */ + + depthLimit: number; +} + +/** + * A pointer referencing a single byte location in a segment. This is typically used for Cap'n Proto pointers, but is + * also sometimes used to reference an offset to a pointer's content or tag words. + * + * @export + * @class Pointer + */ + +export class Pointer { + static readonly adopt = adopt; + static readonly copyFrom = copyFrom; + static readonly disown = disown; + static readonly dump = dump; + static readonly isNull = isNull; + + static readonly _capnp: _PointerCtor = { + displayName: "Pointer" as string, + }; + + readonly _capnp: _Pointer; + + /** Offset, in bytes, from the start of the segment to the beginning of this pointer. */ + + byteOffset: number; + + /** + * The starting segment for this pointer's data. In the case of a far pointer, the actual content this pointer is + * referencing will be in another segment within the same message. + */ + + segment: Segment; + + constructor(segment: Segment, byteOffset: number, depthLimit = MAX_DEPTH) { + this._capnp = { compositeList: false, depthLimit }; + this.segment = segment; + this.byteOffset = byteOffset; + + if (depthLimit === 0) { + throw new Error(format(PTR_DEPTH_LIMIT_EXCEEDED, this)); + } + + // Make sure we keep track of all pointer allocations; there's a limit per message (prevent DoS). + + trackPointerAllocation(segment.message, this); + + // NOTE: It's okay to have a pointer to the end of the segment; you'll see this when creating pointers to the + // beginning of the content of a newly-allocated composite list with zero elements. Unlike other language + // implementations buffer over/underflows are not a big issue since all buffer access is bounds checked in native + // code anyway. + + if (byteOffset < 0 || byteOffset > segment.byteLength) { + throw new Error(format(PTR_OFFSET_OUT_OF_BOUNDS, byteOffset)); + } + + trace("new %s", this); + } + + toString(): string { + return format("Pointer_%d@%a,%s,limit:%x", this.segment.id, this.byteOffset, dump(this), this._capnp.depthLimit); + } +} + +/** + * Adopt an orphaned pointer, making the pointer point to the orphaned content without copying it. + * + * @param {Orphan<Pointer>} src The orphan to adopt. + * @param {Pointer} p The the pointer to adopt into. + * @returns {void} + */ + +export function adopt<T extends Pointer>(src: Orphan<T>, p: T): void { + src._moveTo(p); +} + +/** + * Convert a pointer to an Orphan, zeroing out the pointer and leaving its content untouched. If the content is no + * longer needed, call `disown()` on the orphaned pointer to erase the contents as well. + * + * Call `adopt()` on the orphan with the new target pointer location to move it back into the message; the orphan + * object is then invalidated after adoption (can only adopt once!). + * + * @param {T} p The pointer to turn into an Orphan. + * @returns {Orphan<T>} An orphaned pointer. + */ + +export function disown<T extends Pointer>(p: T): Orphan<T> { + return new Orphan(p); +} + +export function dump(p: Pointer): string { + return bufferToHex(p.segment.buffer.slice(p.byteOffset, p.byteOffset + 8)); +} + +/** + * Get the total number of bytes required to hold a list of the provided size with the given length, rounded up to the + * nearest word. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @param {number} length The length of the list. + * @param {ObjectSize} [compositeSize] The size of each element in a composite list; required if + * `elementSize === ListElementSize.COMPOSITE`. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ + +export function getListByteLength(elementSize: ListElementSize, length: number, compositeSize?: ObjectSize): number { + switch (elementSize) { + case ListElementSize.BIT: + return padToWord((length + 7) >>> 3); + + case ListElementSize.BYTE: + case ListElementSize.BYTE_2: + case ListElementSize.BYTE_4: + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: + case ListElementSize.VOID: + return padToWord(getListElementByteLength(elementSize) * length); + + /* istanbul ignore next */ + case ListElementSize.COMPOSITE: + if (compositeSize === undefined) { + throw new Error(format(PTR_INVALID_LIST_SIZE, NaN)); + } + + return length * padToWord(getByteLength(compositeSize)); + + /* istanbul ignore next */ + default: + throw new Error(PTR_INVALID_LIST_SIZE); + } +} + +/** + * Get the number of bytes required to hold a list element of the provided size. `COMPOSITE` elements do not have a + * fixed size, and `BIT` elements are packed into exactly a single bit, so these both return `NaN`. + * + * @param {ListElementSize} elementSize A number describing the size of the list elements. + * @returns {number} The number of bytes required to hold an element of that size, or `NaN` if that is undefined. + */ + +export function getListElementByteLength(elementSize: ListElementSize): number { + switch (elementSize) { + /* istanbul ignore next */ + case ListElementSize.BIT: + return NaN; + + case ListElementSize.BYTE: + return 1; + + case ListElementSize.BYTE_2: + return 2; + + case ListElementSize.BYTE_4: + return 4; + + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: + return 8; + + /* istanbul ignore next */ + case ListElementSize.COMPOSITE: + // Caller has to figure it out based on the tag word. + + return NaN; + + /* istanbul ignore next */ + case ListElementSize.VOID: + return 0; + + /* istanbul ignore next */ + default: + throw new Error(format(PTR_INVALID_LIST_SIZE, elementSize)); + } +} + +/** + * Add an offset to the pointer's offset and return a new Pointer for that address. + * + * @param {number} offset The number of bytes to add to the offset. + * @param {Pointer} p The pointer to add from. + * @returns {Pointer} A new pointer to the address. + */ + +export function add(offset: number, p: Pointer): Pointer { + return new Pointer(p.segment, p.byteOffset + offset, p._capnp.depthLimit); +} + +/** + * Replace a pointer with a deep copy of the pointer at `src` and all of its contents. + * + * @param {Pointer} src The pointer to copy. + * @param {Pointer} p The pointer to copy into. + * @returns {void} + */ + +export function copyFrom(src: Pointer, p: Pointer): void { + // If the pointer is the same then this is a noop. + + if (p.segment === src.segment && p.byteOffset === src.byteOffset) { + trace("ignoring copy operation from identical pointer %s", src); + + return; + } + + // Make sure we erase this pointer's contents before moving on. If src is null, that's all we do. + + erase(p); // noop if null + + if (isNull(src)) return; + + switch (getTargetPointerType(src)) { + case PointerType.STRUCT: + copyFromStruct(src, p); + + break; + + case PointerType.LIST: + copyFromList(src, p); + + break; + + /* istanbul ignore next */ + default: + throw new Error(format(PTR_INVALID_POINTER_TYPE, getTargetPointerType(p))); + } +} + +/** + * Recursively erase a pointer, any far pointers/landing pads/tag words, and the content it points to. + * + * Note that this will leave "holes" of zeroes in the message, since the space cannot be reclaimed. With packing this + * will have a negligible effect on the final message size. + * + * FIXME: This may need protection against infinite recursion... + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ + +export function erase(p: Pointer): void { + if (isNull(p)) return; + + // First deal with the contents. + + let c: Pointer; + + switch (getTargetPointerType(p)) { + case PointerType.STRUCT: { + const size = getTargetStructSize(p); + c = getContent(p); + + // Wipe the data section. + + c.segment.fillZeroWords(c.byteOffset, size.dataByteLength / 8); + + // Iterate over all the pointers and nuke them. + + for (let i = 0; i < size.pointerLength; i++) { + erase(add(i * 8, c)); + } + + break; + } + case PointerType.LIST: { + const elementSize = getTargetListElementSize(p); + const length = getTargetListLength(p); + let contentWords = padToWord(length * getListElementByteLength(elementSize)); + c = getContent(p); + + if (elementSize === ListElementSize.POINTER) { + for (let i = 0; i < length; i++) { + erase(new Pointer(c.segment, c.byteOffset + i * 8, p._capnp.depthLimit - 1)); + } + + // Calling erase on each pointer takes care of the content, nothing left to do here. + + break; + } else if (elementSize === ListElementSize.COMPOSITE) { + // Read some stuff from the tag word. + const tag = add(-8, c); + const compositeSize = getStructSize(tag); + const compositeByteLength = getByteLength(compositeSize); + contentWords = getOffsetWords(tag); + + // Kill the tag word. + c.segment.setWordZero(c.byteOffset - 8); + + // Recursively erase each pointer. + for (let i = 0; i < length; i++) { + for (let j = 0; j < compositeSize.pointerLength; j++) { + erase(new Pointer(c.segment, c.byteOffset + i * compositeByteLength + j * 8, p._capnp.depthLimit - 1)); + } + } + } + + c.segment.fillZeroWords(c.byteOffset, contentWords); + + break; + } + case PointerType.OTHER: + // No content. + + break; + + default: + throw new Error(format(PTR_INVALID_POINTER_TYPE, getTargetPointerType(p))); + } + + erasePointer(p); +} + +/** + * Set the pointer (and far pointer landing pads, if applicable) to zero. Does not touch the pointer's content. + * + * @param {Pointer} p The pointer to erase. + * @returns {void} + */ + +export function erasePointer(p: Pointer): void { + if (getPointerType(p) === PointerType.FAR) { + const landingPad = followFar(p); + + if (isDoubleFar(p)) { + // Kill the double-far tag word. + + landingPad.segment.setWordZero(landingPad.byteOffset + 8); + } + + // Kill the landing pad. + + landingPad.segment.setWordZero(landingPad.byteOffset); + } + + // Finally! Kill the pointer itself... + + p.segment.setWordZero(p.byteOffset); +} + +/** + * Interpret the pointer as a far pointer, returning its target segment and offset. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the far target. + */ + +export function followFar(p: Pointer): Pointer { + const targetSegment = p.segment.message.getSegment(p.segment.getUint32(p.byteOffset + 4)); + const targetWordOffset = p.segment.getUint32(p.byteOffset) >>> 3; + + return new Pointer(targetSegment, targetWordOffset * 8, p._capnp.depthLimit - 1); +} + +/** + * If the pointer address references a far pointer, follow it to the location where the actual pointer data is written. + * Otherwise, returns the pointer unmodified. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A new pointer representing the target location, or `p` if it is not a far pointer. + */ + +export function followFars(p: Pointer): Pointer { + if (getPointerType(p) === PointerType.FAR) { + const landingPad = followFar(p); + + if (isDoubleFar(p)) landingPad.byteOffset += 8; + + return landingPad; + } + + return p; +} + +export function getCapabilityId(p: Pointer): number { + return p.segment.getUint32(p.byteOffset + 4); +} + +function isCompositeList(p: Pointer): boolean { + return getTargetPointerType(p) === PointerType.LIST && getTargetListElementSize(p) === ListElementSize.COMPOSITE; +} + +/** + * Obtain the location of the pointer's content, following far pointers as needed. + * If the pointer is a struct pointer and `compositeIndex` is set, it will be offset by a multiple of the struct's size. + * + * @param {Pointer} p The pointer to read from. + * @param {boolean} [ignoreCompositeIndex] If true, will not follow the composite struct pointer's composite index and + * instead return a pointer to the parent list's contents (also the beginning of the first struct). + * @returns {Pointer} A pointer to the beginning of the pointer's content. + */ + +export function getContent(p: Pointer, ignoreCompositeIndex?: boolean): Pointer { + let c: Pointer; + + if (isDoubleFar(p)) { + const landingPad = followFar(p); + c = new Pointer(p.segment.message.getSegment(getFarSegmentId(landingPad)), getOffsetWords(landingPad) * 8); + } else { + const target = followFars(p); + c = new Pointer(target.segment, target.byteOffset + 8 + getOffsetWords(target) * 8); + } + + if (isCompositeList(p)) c.byteOffset += 8; + + if (!ignoreCompositeIndex && p._capnp.compositeIndex !== undefined) { + // Seek backwards by one word so we can read the struct size off the tag word. + + c.byteOffset -= 8; + + // Seek ahead by `compositeIndex` multiples of the struct's total size. + + c.byteOffset += 8 + p._capnp.compositeIndex * getByteLength(padObjectToWord(getStructSize(c))); + } + + return c; +} + +/** + * Read the target segment ID from a far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The target segment ID. + */ + +export function getFarSegmentId(p: Pointer): number { + return p.segment.getUint32(p.byteOffset + 4); +} + +/** + * Get a number indicating the size of the list's elements. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the list's elements. + */ + +export function getListElementSize(p: Pointer): ListElementSize { + return p.segment.getUint32(p.byteOffset + 4) & LIST_SIZE_MASK; +} + +/** + * Get the number of elements in a list pointer. For composite lists, it instead represents the total number of words in + * the list (not counting the tag word). + * + * This method does **not** attempt to distinguish between composite and non-composite lists. To get the correct + * length for composite lists use `getTargetListLength()` instead. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The length of the list, or total number of words for composite lists. + */ + +export function getListLength(p: Pointer): number { + return p.segment.getUint32(p.byteOffset + 4) >>> 3; +} + +/** + * Get the offset (in words) from the end of a pointer to the start of its content. For struct pointers, this is the + * beginning of the data section, and for list pointers it is the location of the first element. The value should + * always be zero for interface pointers. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The offset, in words, from the end of the pointer to the start of the data section. + */ + +export function getOffsetWords(p: Pointer): number { + const o = p.segment.getInt32(p.byteOffset); + + // Far pointers only have 29 offset bits. + return o & 2 ? o >> 3 : o >> 2; +} + +/** + * Look up the pointer's type. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer. + */ + +export function getPointerType(p: Pointer): PointerType { + return p.segment.getUint32(p.byteOffset) & POINTER_TYPE_MASK; +} + +/** + * Read the number of data words from this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of data words in the struct. + */ + +export function getStructDataWords(p: Pointer): number { + return p.segment.getUint16(p.byteOffset + 4); +} + +/** + * Read the number of pointers contained in this struct pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of pointers in this struct. + */ + +export function getStructPointerLength(p: Pointer): number { + return p.segment.getUint16(p.byteOffset + 6); +} + +/** + * Get an object describing this struct pointer's size. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} The size of the struct. + */ + +export function getStructSize(p: Pointer): ObjectSize { + return new ObjectSize(getStructDataWords(p) * 8, getStructPointerLength(p)); +} + +/** + * Get a pointer to this pointer's composite list tag word, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {Pointer} A pointer to the list's composite tag word. + */ + +export function getTargetCompositeListTag(p: Pointer): Pointer { + const c = getContent(p); + + // The composite list tag is always one word before the content. + + c.byteOffset -= 8; + + return c; +} + +/** + * Get the object size for the target composite list, following far pointers as needed. + * + * @param {Pointer} p The pointer to read from. + * @returns {ObjectSize} An object describing the size of each struct in the list. + */ + +export function getTargetCompositeListSize(p: Pointer): ObjectSize { + return getStructSize(getTargetCompositeListTag(p)); +} + +/** + * Get the size of the list elements referenced by this pointer, following far pointers if necessary. + * + * @param {Pointer} p The pointer to read from. + * @returns {ListElementSize} The size of the elements in the list. + */ + +export function getTargetListElementSize(p: Pointer): ListElementSize { + return getListElementSize(followFars(p)); +} + +/** + * Get the length of the list referenced by this pointer, following far pointers if necessary. If the list is a + * composite list, it will look up the tag word and read the length from there. + * + * @param {Pointer} p The pointer to read from. + * @returns {number} The number of elements in the list. + */ + +export function getTargetListLength(p: Pointer): number { + const t = followFars(p); + + if (getListElementSize(t) === ListElementSize.COMPOSITE) { + // The content is prefixed by a tag word; it's a struct pointer whose offset contains the list's length. + + return getOffsetWords(getTargetCompositeListTag(p)); + } + + return getListLength(t); +} + +/** + * Get the type of a pointer, following far pointers if necessary. For non-far pointers this is equivalent to calling + * `getPointerType()`. + * + * The target of a far pointer can never be another far pointer, and this method will throw if such a situation is + * encountered. + * + * @param {Pointer} p The pointer to read from. + * @returns {PointerType} The type of pointer referenced by this pointer. + */ + +export function getTargetPointerType(p: Pointer): PointerType { + const t = getPointerType(followFars(p)); + + if (t === PointerType.FAR) throw new Error(format(PTR_INVALID_FAR_TARGET, p)); + + return t; +} + +/** + * Get the size of the struct referenced by a pointer, following far pointers if necessary. + * + * @param {Pointer} p The poiner to read from. + * @returns {ObjectSize} The size of the struct referenced by this pointer. + */ + +export function getTargetStructSize(p: Pointer): ObjectSize { + return getStructSize(followFars(p)); +} + +/** + * Initialize a pointer to point at the data in the content segment. If the content segment is not the same as the + * pointer's segment, this will allocate and write far pointers as needed. Nothing is written otherwise. + * + * The return value includes a pointer to write the pointer's actual data to (the eventual far target), and the offset + * value (in words) to use for that pointer. In the case of double-far pointers this offset will always be zero. + * + * @param {Segment} contentSegment The segment containing this pointer's content. + * @param {number} contentOffset The offset within the content segment for the beginning of this pointer's content. + * @param {Pointer} p The pointer to initialize. + * @returns {PointerAllocationResult} An object containing a pointer (where the pointer data should be written), and + * the value to use as the offset for that pointer. + */ + +export function initPointer(contentSegment: Segment, contentOffset: number, p: Pointer): PointerAllocationResult { + if (p.segment !== contentSegment) { + // Need a far pointer. + + trace("Initializing far pointer %s -> %s.", p, contentSegment); + + if (!contentSegment.hasCapacity(8)) { + // GAH! Not enough space in the content segment for a landing pad so we need a double far pointer. + + const landingPad = p.segment.allocate(16); + + trace("GAH! Initializing double-far pointer in %s from %s -> %s.", p, contentSegment, landingPad); + + setFarPointer(true, landingPad.byteOffset / 8, landingPad.segment.id, p); + setFarPointer(false, contentOffset / 8, contentSegment.id, landingPad); + + landingPad.byteOffset += 8; + + return new PointerAllocationResult(landingPad, 0); + } + + // Allocate a far pointer landing pad in the target segment. + + const landingPad = contentSegment.allocate(8); + + if (landingPad.segment.id !== contentSegment.id) { + throw new Error(INVARIANT_UNREACHABLE_CODE); + } + + setFarPointer(false, landingPad.byteOffset / 8, landingPad.segment.id, p); + + return new PointerAllocationResult(landingPad, (contentOffset - landingPad.byteOffset - 8) / 8); + } + + trace("Initializing intra-segment pointer %s -> %a.", p, contentOffset); + + return new PointerAllocationResult(p, (contentOffset - p.byteOffset - 8) / 8); +} + +/** + * Check if the pointer is a double-far pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if it is a double-far pointer, `false` otherwise. + */ + +export function isDoubleFar(p: Pointer): boolean { + return getPointerType(p) === PointerType.FAR && (p.segment.getUint32(p.byteOffset) & POINTER_DOUBLE_FAR_MASK) !== 0; +} + +/** + * Quickly check to see if the pointer is "null". A "null" pointer is a zero word, equivalent to an empty struct + * pointer. + * + * @param {Pointer} p The pointer to read from. + * @returns {boolean} `true` if the pointer is "null". + */ + +export function isNull(p: Pointer): boolean { + return p.segment.isWordZero(p.byteOffset); +} + +/** + * Relocate a pointer to the given destination, ensuring that it points to the same content. This will create far + * pointers as needed if the content is in a different segment than the destination. After the relocation the source + * pointer will be erased and is no longer valid. + * + * @param {Pointer} dst The desired location for the `src` pointer. Any existing contents will be erased before + * relocating! + * @param {Pointer} src The pointer to relocate. + * @returns {void} + */ + +export function relocateTo(dst: Pointer, src: Pointer): void { + const t = followFars(src); + const lo = t.segment.getUint8(t.byteOffset) & 0x03; // discard the offset + const hi = t.segment.getUint32(t.byteOffset + 4); + + // Make sure anything dst was pointing to is wiped out. + erase(dst); + + const res = initPointer(t.segment, t.byteOffset + 8 + getOffsetWords(t) * 8, dst); + + // Keep the low 2 bits and write the new offset. + res.pointer.segment.setUint32(res.pointer.byteOffset, lo | (res.offsetWords << 2)); + // Keep the high 32 bits intact. + res.pointer.segment.setUint32(res.pointer.byteOffset + 4, hi); + + erasePointer(src); +} + +/** + * Write a far pointer. + * + * @param {boolean} doubleFar Set to `true` if this is a double far pointer. + * @param {number} offsetWords The offset, in words, to the target pointer. + * @param {number} segmentId The segment the target pointer is located in. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ + +export function setFarPointer(doubleFar: boolean, offsetWords: number, segmentId: number, p: Pointer): void { + const A = PointerType.FAR; + const B = doubleFar ? 1 : 0; + const C = offsetWords; + const D = segmentId; + + p.segment.setUint32(p.byteOffset, A | (B << 2) | (C << 3)); + p.segment.setUint32(p.byteOffset + 4, D); +} + +/** + * Write a raw interface pointer. + * + * @param {number} capId The capability ID. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ + +export function setInterfacePointer(capId: number, p: Pointer): void { + p.segment.setUint32(p.byteOffset, PointerType.OTHER); + p.segment.setUint32(p.byteOffset + 4, capId); +} + +/** + * Write a raw list pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the list content. + * @param {ListElementSize} size The size of each element in the list. + * @param {number} length The number of elements in the list. + * @param {Pointer} p The pointer to write to. + * @param {ObjectSize} [compositeSize] For composite lists this describes the size of each element in this list. This + * is required for composite lists. + * @returns {void} + */ + +export function setListPointer( + offsetWords: number, + size: ListElementSize, + length: number, + p: Pointer, + compositeSize?: ObjectSize +): void { + const A = PointerType.LIST; + const B = offsetWords; + const C = size; + let D = length; + + if (size === ListElementSize.COMPOSITE) { + if (compositeSize === undefined) { + throw new TypeError(TYPE_COMPOSITE_SIZE_UNDEFINED); + } + + D *= getWordLength(compositeSize); + } + + p.segment.setUint32(p.byteOffset, A | (B << 2)); + p.segment.setUint32(p.byteOffset + 4, C | (D << 3)); +} + +/** + * Write a raw struct pointer. + * + * @param {number} offsetWords The number of words from the end of this pointer to the beginning of the struct's data + * section. + * @param {ObjectSize} size An object describing the size of the struct. + * @param {Pointer} p The pointer to write to. + * @returns {void} + */ + +export function setStructPointer(offsetWords: number, size: ObjectSize, p: Pointer): void { + const A = PointerType.STRUCT; + const B = offsetWords; + const C = getDataWordLength(size); + const D = size.pointerLength; + + p.segment.setUint32(p.byteOffset, A | (B << 2)); + p.segment.setUint16(p.byteOffset + 4, C); + p.segment.setUint16(p.byteOffset + 6, D); +} + +/** + * Read some bits off a pointer to make sure it has the right pointer data. + * + * @param {PointerType} pointerType The expected pointer type. + * @param {Pointer} p The pointer to validate. + * @param {ListElementSize} [elementSize] For list pointers, the expected element size. Leave this + * undefined for struct pointers. + * @returns {void} + */ + +export function validate(pointerType: PointerType, p: Pointer, elementSize?: ListElementSize): void { + if (isNull(p)) return; + + const t = followFars(p); + + // Check the pointer type. + + const A = t.segment.getUint32(t.byteOffset) & POINTER_TYPE_MASK; + + if (A !== pointerType) { + throw new Error(format(PTR_WRONG_POINTER_TYPE, p, pointerType)); + } + + // Check the list element size, if provided. + + if (elementSize !== undefined) { + const C = t.segment.getUint32(t.byteOffset + 4) & LIST_SIZE_MASK; + + if (C !== elementSize) { + throw new Error(format(PTR_WRONG_LIST_TYPE, p, ListElementSize[elementSize])); + } + } +} + +export function copyFromList(src: Pointer, dst: Pointer): void { + if (dst._capnp.depthLimit <= 0) throw new Error(PTR_DEPTH_LIMIT_EXCEEDED); + + const srcContent = getContent(src); + const srcElementSize = getTargetListElementSize(src); + const srcLength = getTargetListLength(src); + let srcCompositeSize; + let srcStructByteLength; + let dstContent; + + if (srcElementSize === ListElementSize.POINTER) { + dstContent = dst.segment.allocate(srcLength << 3); + + // Recursively copy each pointer in the list. + + for (let i = 0; i < srcLength; i++) { + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + (i << 3), src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + (i << 3), dst._capnp.depthLimit - 1); + + copyFrom(srcPtr, dstPtr); + } + } else if (srcElementSize === ListElementSize.COMPOSITE) { + srcCompositeSize = padObjectToWord(getTargetCompositeListSize(src)); + srcStructByteLength = getByteLength(srcCompositeSize); + + dstContent = dst.segment.allocate(getByteLength(srcCompositeSize) * srcLength + 8); + + // Copy the tag word. + + dstContent.segment.copyWord(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset - 8); + + // Copy the entire contents, including all pointers. This should be more efficient than making `srcLength` + // copies to skip the pointer sections, and we're about to rewrite all those pointers anyway. + + // PERF: Skip this step if the composite struct only contains pointers. + if (srcCompositeSize.dataByteLength > 0) { + const wordLength = getWordLength(srcCompositeSize) * srcLength; + + dstContent.segment.copyWords(dstContent.byteOffset + 8, srcContent.segment, srcContent.byteOffset, wordLength); + } + + // Recursively copy all the pointers in each struct. + + for (let i = 0; i < srcLength; i++) { + for (let j = 0; j < srcCompositeSize.pointerLength; j++) { + const offset = i * srcStructByteLength + srcCompositeSize.dataByteLength + (j << 3); + + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + offset, src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + offset + 8, dst._capnp.depthLimit - 1); + + copyFrom(srcPtr, dstPtr); + } + } + } else { + const byteLength = padToWord( + srcElementSize === ListElementSize.BIT + ? (srcLength + 7) >>> 3 + : getListElementByteLength(srcElementSize) * srcLength + ); + const wordLength = byteLength >>> 3; + + dstContent = dst.segment.allocate(byteLength); + + // Copy all of the list contents word-by-word. + + dstContent.segment.copyWords(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset, wordLength); + } + + // Initialize the list pointer. + + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setListPointer(res.offsetWords, srcElementSize, srcLength, res.pointer, srcCompositeSize); +} + +export function copyFromStruct(src: Pointer, dst: Pointer): void { + if (dst._capnp.depthLimit <= 0) throw new Error(PTR_DEPTH_LIMIT_EXCEEDED); + + const srcContent = getContent(src); + const srcSize = getTargetStructSize(src); + const srcDataWordLength = getDataWordLength(srcSize); + + // Allocate space for the destination content. + + const dstContent = dst.segment.allocate(getByteLength(srcSize)); + + // Copy the data section. + + dstContent.segment.copyWords(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset, srcDataWordLength); + + // Copy the pointer section. + + for (let i = 0; i < srcSize.pointerLength; i++) { + const offset = srcSize.dataByteLength + i * 8; + + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + offset, src._capnp.depthLimit - 1); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + offset, dst._capnp.depthLimit - 1); + + copyFrom(srcPtr, dstPtr); + } + + // Don't touch dst if it's already initialized as a composite list pointer. With composite struct pointers there's + // no pointer to copy here and we've already copied the contents. + + if (dst._capnp.compositeList) return; + + // Initialize the struct pointer. + + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setStructPointer(res.offsetWords, srcSize, res.pointer); +} + +/** + * Track the allocation of a new Pointer object. + * + * This will decrement an internal counter tracking how many bytes have been traversed in the message so far. After + * a certain limit, this method will throw an error in order to prevent a certain class of DoS attacks. + * + * @param {Message} message The message the pointer belongs to. + * @param {Pointer} p The pointer being allocated. + * @returns {void} + */ + +export function trackPointerAllocation(message: Message, p: Pointer): void { + message._capnp.traversalLimit -= 8; + + if (message._capnp.traversalLimit <= 0) { + throw new Error(format(PTR_TRAVERSAL_LIMIT_EXCEEDED, p)); + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/struct.d.ts b/node_modules/capnp-ts/src/serialization/pointers/struct.d.ts new file mode 100644 index 0000000..5e6ef92 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/struct.d.ts @@ -0,0 +1,349 @@ +/** + * @author jdiaz5513 + */ +import { Int64, Uint64 } from "../../types/index"; +import { ObjectSize } from "../object-size"; +import { Segment } from "../segment"; +import { Data } from "./data"; +import { List, ListCtor } from "./list"; +import { Orphan } from "./orphan"; +import { _Pointer, _PointerCtor, Pointer, PointerCtor } from "./pointer"; +export interface _StructCtor extends _PointerCtor { + readonly id: string; + readonly size: ObjectSize; +} +export interface StructCtor<T extends Struct> { + readonly _capnp: _StructCtor; + new (segment: Segment, byteOffset: number, depthLimit?: number, compositeIndex?: number): T; +} +export interface _Struct extends _Pointer { + compositeIndex?: number; +} +export declare class Struct extends Pointer { + static readonly _capnp: { + displayName: string; + }; + static readonly getAs: typeof getAs; + static readonly getBit: typeof getBit; + static readonly getData: typeof getData; + static readonly getFloat32: typeof getFloat32; + static readonly getFloat64: typeof getFloat64; + static readonly getUint8: typeof getUint8; + static readonly getUint16: typeof getUint16; + static readonly getUint32: typeof getUint32; + static readonly getUint64: typeof getUint64; + static readonly getInt8: typeof getInt8; + static readonly getInt16: typeof getInt16; + static readonly getInt32: typeof getInt32; + static readonly getInt64: typeof getInt64; + static readonly getList: typeof getList; + static readonly getPointer: typeof getPointer; + static readonly getPointerAs: typeof getPointerAs; + static readonly getStruct: typeof getStruct; + static readonly getText: typeof getText; + static readonly initData: typeof initData; + static readonly initList: typeof initList; + static readonly initStruct: typeof initStruct; + static readonly initStructAt: typeof initStructAt; + static readonly setBit: typeof setBit; + static readonly setFloat32: typeof setFloat32; + static readonly setFloat64: typeof setFloat64; + static readonly setUint8: typeof setUint8; + static readonly setUint16: typeof setUint16; + static readonly setUint32: typeof setUint32; + static readonly setUint64: typeof setUint64; + static readonly setInt8: typeof setInt8; + static readonly setInt16: typeof setInt16; + static readonly setInt32: typeof setInt32; + static readonly setInt64: typeof setInt64; + static readonly setText: typeof setText; + static readonly testWhich: typeof testWhich; + readonly _capnp: _Struct; + /** + * Create a new pointer to a struct. + * + * @constructor {Struct} + * @param {Segment} segment The segment the pointer resides in. + * @param {number} byteOffset The offset from the beginning of the segment to the beginning of the pointer data. + * @param {any} [depthLimit=MAX_DEPTH] The nesting depth limit for this object. + * @param {number} [compositeIndex] If set, then this pointer is actually a reference to a composite list + * (`this._getPointerTargetType() === PointerType.LIST`), and this number is used as the index of the struct within + * the list. It is not valid to call `initStruct()` on a composite struct – the struct contents are initialized when + * the list pointer is initialized. + */ + constructor(segment: Segment, byteOffset: number, depthLimit?: number, compositeIndex?: number); + static toString(): string; + toString(): string; +} +/** + * Initialize a struct with the provided object size. This will allocate new space for the struct contents, ideally in + * the same segment as this pointer. + * + * @param {ObjectSize} size An object describing the size of the struct's data and pointer sections. + * @param {Struct} s The struct to initialize. + * @returns {void} + */ +export declare function initStruct(size: ObjectSize, s: Struct): void; +export declare function initStructAt<T extends Struct>(index: number, StructClass: StructCtor<T>, p: Pointer): T; +/** + * Make a shallow copy of a struct's contents and update the pointer to point to the new content. The data and pointer + * sections will be resized to the provided size. + * + * WARNING: This method can cause data loss if `dstSize` is smaller than the original size! + * + * @param {ObjectSize} dstSize The desired size for the struct contents. + * @param {Struct} s The struct to resize. + * @returns {void} + */ +export declare function resize(dstSize: ObjectSize, s: Struct): void; +export declare function adopt<T extends Struct>(src: Orphan<T>, s: Struct): void; +export declare function disown<T extends Struct>(s: Struct): Orphan<T>; +/** + * Convert a struct to a struct of the provided class. Particularly useful when casting to nested group types. + * + * @protected + * @template T + * @param {StructCtor<T>} StructClass The struct class to convert to. Not particularly useful if `Struct`. + * @param {Struct} s The struct to convert. + * @returns {T} A new instance of the desired struct class pointing to the same location. + */ +export declare function getAs<T extends Struct>(StructClass: StructCtor<T>, s: Struct): T; +/** + * Read a boolean (bit) value out of a struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {boolean} The value. + */ +export declare function getBit(bitOffset: number, s: Struct, defaultMask?: DataView): boolean; +export declare function getData(index: number, s: Struct, defaultValue?: Pointer): Data; +export declare function getDataSection(s: Struct): Pointer; +/** + * Read a float32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getFloat32(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getFloat64(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getInt16(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getInt32(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getInt64(byteOffset: number, s: Struct, defaultMask?: DataView): Int64; +/** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getInt8(byteOffset: number, s: Struct, defaultMask?: DataView): number; +export declare function getList<T>(index: number, ListClass: ListCtor<T>, s: Struct, defaultValue?: Pointer): List<T>; +export declare function getPointer(index: number, s: Struct): Pointer; +export declare function getPointerAs<T extends Pointer>(index: number, PointerClass: PointerCtor<T>, s: Struct): T; +export declare function getPointerSection(s: Struct): Pointer; +export declare function getSize(s: Struct): ObjectSize; +export declare function getStruct<T extends Struct>(index: number, StructClass: StructCtor<T>, s: Struct, defaultValue?: Pointer): T; +export declare function getText(index: number, s: Struct, defaultValue?: string): string; +/** + * Read an uint16 value out of a struct.. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getUint16(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read an uint32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getUint32(byteOffset: number, s: Struct, defaultMask?: DataView): number; +/** + * Read an uint64 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getUint64(byteOffset: number, s: Struct, defaultMask?: DataView): Uint64; +/** + * Read an uint8 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +export declare function getUint8(byteOffset: number, s: Struct, defaultMask?: DataView): number; +export declare function getVoid(): void; +export declare function initData(index: number, length: number, s: Struct): Data; +export declare function initList<T>(index: number, ListClass: ListCtor<T>, length: number, s: Struct): List<T>; +/** + * Write a boolean (bit) value to the struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {boolean} value The value to write (writes a 0 for `false`, 1 for `true`). + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setBit(bitOffset: number, value: boolean, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive float32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setFloat32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive float64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setFloat64(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive int16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setInt16(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive int32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setInt32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive int64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setInt64(byteOffset: number, value: Int64, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive int8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setInt8(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +export declare function setPointer(index: number, value: Pointer, s: Struct): void; +export declare function setText(index: number, value: string, s: Struct): void; +/** + * Write a primitive uint16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setUint16(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive uint32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setUint32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive uint64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setUint64(byteOffset: number, value: Uint64, s: Struct, defaultMask?: DataView): void; +/** + * Write a primitive uint8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +export declare function setUint8(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void; +export declare function setVoid(): void; +export declare function testWhich(name: string, found: number, wanted: number, s: Struct): void; +export declare function checkDataBounds(byteOffset: number, byteLength: number, s: Struct): void; +export declare function checkPointerBounds(index: number, s: Struct): void; diff --git a/node_modules/capnp-ts/src/serialization/pointers/struct.js b/node_modules/capnp-ts/src/serialization/pointers/struct.js new file mode 100644 index 0000000..bc14e52 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/struct.js @@ -0,0 +1,839 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkPointerBounds = exports.checkDataBounds = exports.testWhich = exports.setVoid = exports.setUint8 = exports.setUint64 = exports.setUint32 = exports.setUint16 = exports.setText = exports.setPointer = exports.setInt8 = exports.setInt64 = exports.setInt32 = exports.setInt16 = exports.setFloat64 = exports.setFloat32 = exports.setBit = exports.initList = exports.initData = exports.getVoid = exports.getUint8 = exports.getUint64 = exports.getUint32 = exports.getUint16 = exports.getText = exports.getStruct = exports.getSize = exports.getPointerSection = exports.getPointerAs = exports.getPointer = exports.getList = exports.getInt8 = exports.getInt64 = exports.getInt32 = exports.getInt16 = exports.getFloat64 = exports.getFloat32 = exports.getDataSection = exports.getData = exports.getBit = exports.getAs = exports.disown = exports.adopt = exports.resize = exports.initStructAt = exports.initStruct = exports.Struct = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../../constants"); +const index_1 = require("../../types/index"); +const util_1 = require("../../util"); +const list_element_size_1 = require("../list-element-size"); +const object_size_1 = require("../object-size"); +const data_1 = require("./data"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const pointer_type_1 = require("./pointer-type"); +const text_1 = require("./text"); +const errors_1 = require("../../errors"); +const trace = debug_1.default("capnp:struct"); +trace("load"); +// Used to apply bit masks (default values). +const TMP_WORD = new DataView(new ArrayBuffer(8)); +class Struct extends pointer_1.Pointer { + /** + * Create a new pointer to a struct. + * + * @constructor {Struct} + * @param {Segment} segment The segment the pointer resides in. + * @param {number} byteOffset The offset from the beginning of the segment to the beginning of the pointer data. + * @param {any} [depthLimit=MAX_DEPTH] The nesting depth limit for this object. + * @param {number} [compositeIndex] If set, then this pointer is actually a reference to a composite list + * (`this._getPointerTargetType() === PointerType.LIST`), and this number is used as the index of the struct within + * the list. It is not valid to call `initStruct()` on a composite struct – the struct contents are initialized when + * the list pointer is initialized. + */ + constructor(segment, byteOffset, depthLimit = constants_1.MAX_DEPTH, compositeIndex) { + super(segment, byteOffset, depthLimit); + this._capnp.compositeIndex = compositeIndex; + this._capnp.compositeList = compositeIndex !== undefined; + } + static toString() { + return this._capnp.displayName; + } + toString() { + return (`Struct_${super.toString()}` + + `${this._capnp.compositeIndex === undefined ? "" : `,ci:${this._capnp.compositeIndex}`}`); + } +} +exports.Struct = Struct; +Struct._capnp = { + displayName: "Struct", +}; +Struct.getAs = getAs; +Struct.getBit = getBit; +Struct.getData = getData; +Struct.getFloat32 = getFloat32; +Struct.getFloat64 = getFloat64; +Struct.getUint8 = getUint8; +Struct.getUint16 = getUint16; +Struct.getUint32 = getUint32; +Struct.getUint64 = getUint64; +Struct.getInt8 = getInt8; +Struct.getInt16 = getInt16; +Struct.getInt32 = getInt32; +Struct.getInt64 = getInt64; +Struct.getList = getList; +Struct.getPointer = getPointer; +Struct.getPointerAs = getPointerAs; +Struct.getStruct = getStruct; +Struct.getText = getText; +Struct.initData = initData; +Struct.initList = initList; +Struct.initStruct = initStruct; +Struct.initStructAt = initStructAt; +Struct.setBit = setBit; +Struct.setFloat32 = setFloat32; +Struct.setFloat64 = setFloat64; +Struct.setUint8 = setUint8; +Struct.setUint16 = setUint16; +Struct.setUint32 = setUint32; +Struct.setUint64 = setUint64; +Struct.setInt8 = setInt8; +Struct.setInt16 = setInt16; +Struct.setInt32 = setInt32; +Struct.setInt64 = setInt64; +Struct.setText = setText; +Struct.testWhich = testWhich; +/** + * Initialize a struct with the provided object size. This will allocate new space for the struct contents, ideally in + * the same segment as this pointer. + * + * @param {ObjectSize} size An object describing the size of the struct's data and pointer sections. + * @param {Struct} s The struct to initialize. + * @returns {void} + */ +function initStruct(size, s) { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(util_1.format(errors_1.PTR_INIT_COMPOSITE_STRUCT, s)); + } + // Make sure to clear existing contents before overwriting the pointer data (erase is a noop if already empty). + pointer_1.erase(s); + const c = s.segment.allocate(object_size_1.getByteLength(size)); + const res = pointer_1.initPointer(c.segment, c.byteOffset, s); + pointer_1.setStructPointer(res.offsetWords, size, res.pointer); +} +exports.initStruct = initStruct; +function initStructAt(index, StructClass, p) { + const s = getPointerAs(index, StructClass, p); + initStruct(StructClass._capnp.size, s); + return s; +} +exports.initStructAt = initStructAt; +/** + * Make a shallow copy of a struct's contents and update the pointer to point to the new content. The data and pointer + * sections will be resized to the provided size. + * + * WARNING: This method can cause data loss if `dstSize` is smaller than the original size! + * + * @param {ObjectSize} dstSize The desired size for the struct contents. + * @param {Struct} s The struct to resize. + * @returns {void} + */ +function resize(dstSize, s) { + const srcSize = getSize(s); + const srcContent = pointer_1.getContent(s); + const dstContent = s.segment.allocate(object_size_1.getByteLength(dstSize)); + // Only copy the data section for now. The pointer section will need to be rewritten. + dstContent.segment.copyWords(dstContent.byteOffset, srcContent.segment, srcContent.byteOffset, Math.min(object_size_1.getDataWordLength(srcSize), object_size_1.getDataWordLength(dstSize))); + const res = pointer_1.initPointer(dstContent.segment, dstContent.byteOffset, s); + pointer_1.setStructPointer(res.offsetWords, dstSize, res.pointer); + // Iterate through the new pointer section and update the offsets so they point to the right place. This is a bit + // more complicated than it appears due to the fact that the original pointers could have been far pointers, and + // the new pointers might need to be allocated as far pointers if the segment is full. + for (let i = 0; i < Math.min(srcSize.pointerLength, dstSize.pointerLength); i++) { + const srcPtr = new pointer_1.Pointer(srcContent.segment, srcContent.byteOffset + srcSize.dataByteLength + i * 8); + if (pointer_1.isNull(srcPtr)) { + // If source pointer is null, leave the destination pointer as default null. + continue; + } + const srcPtrTarget = pointer_1.followFars(srcPtr); + const srcPtrContent = pointer_1.getContent(srcPtr); + const dstPtr = new pointer_1.Pointer(dstContent.segment, dstContent.byteOffset + dstSize.dataByteLength + i * 8); + // For composite lists the offset needs to point to the tag word, not the first element which is what getContent + // returns. + if (pointer_1.getTargetPointerType(srcPtr) === pointer_type_1.PointerType.LIST && + pointer_1.getTargetListElementSize(srcPtr) === list_element_size_1.ListElementSize.COMPOSITE) { + srcPtrContent.byteOffset -= 8; + } + const r = pointer_1.initPointer(srcPtrContent.segment, srcPtrContent.byteOffset, dstPtr); + // Read the old pointer data, but discard the original offset. + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 0x03; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + r.pointer.segment.setUint32(r.pointer.byteOffset, a | (r.offsetWords << 2)); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + // Zero out the old data and pointer sections. + srcContent.segment.fillZeroWords(srcContent.byteOffset, object_size_1.getWordLength(srcSize)); +} +exports.resize = resize; +function adopt(src, s) { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(util_1.format(errors_1.PTR_ADOPT_COMPOSITE_STRUCT, s)); + } + pointer_1.Pointer.adopt(src, s); +} +exports.adopt = adopt; +function disown(s) { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(util_1.format(errors_1.PTR_DISOWN_COMPOSITE_STRUCT, s)); + } + return pointer_1.Pointer.disown(s); +} +exports.disown = disown; +/** + * Convert a struct to a struct of the provided class. Particularly useful when casting to nested group types. + * + * @protected + * @template T + * @param {StructCtor<T>} StructClass The struct class to convert to. Not particularly useful if `Struct`. + * @param {Struct} s The struct to convert. + * @returns {T} A new instance of the desired struct class pointing to the same location. + */ +function getAs(StructClass, s) { + return new StructClass(s.segment, s.byteOffset, s._capnp.depthLimit, s._capnp.compositeIndex); +} +exports.getAs = getAs; +/** + * Read a boolean (bit) value out of a struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {boolean} The value. + */ +function getBit(bitOffset, s, defaultMask) { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + const v = ds.segment.getUint8(ds.byteOffset + byteOffset); + if (defaultMask === undefined) + return (v & bitMask) !== 0; + const defaultValue = defaultMask.getUint8(0); + return ((v ^ defaultValue) & bitMask) !== 0; +} +exports.getBit = getBit; +function getData(index, s, defaultValue) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new data_1.Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + if (pointer_1.isNull(l)) { + if (defaultValue) { + pointer_1.Pointer.copyFrom(defaultValue, l); + } + else { + list_1.List.initList(list_element_size_1.ListElementSize.BYTE, 0, l); + } + } + return l; +} +exports.getData = getData; +function getDataSection(s) { + return pointer_1.getContent(s); +} +exports.getDataSection = getDataSection; +/** + * Read a float32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getFloat32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getFloat32(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + TMP_WORD.setUint32(0, v, constants_1.NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat32(0, constants_1.NATIVE_LITTLE_ENDIAN); +} +exports.getFloat32 = getFloat32; +/** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getFloat64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, constants_1.NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, constants_1.NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat64(0, constants_1.NATIVE_LITTLE_ENDIAN); + } + return ds.segment.getFloat64(ds.byteOffset + byteOffset); +} +exports.getFloat64 = getFloat64; +/** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getInt16(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getInt16(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint16(0, v, constants_1.NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt16(0, constants_1.NATIVE_LITTLE_ENDIAN); +} +exports.getInt16 = getInt16; +/** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getInt32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getInt32(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint32(0, v, constants_1.NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt32(0, constants_1.NATIVE_LITTLE_ENDIAN); +} +exports.getInt32 = getInt32; +/** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getInt64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getInt64(ds.byteOffset + byteOffset); + } + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, constants_1.NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, constants_1.NATIVE_LITTLE_ENDIAN); + return new index_1.Int64(new Uint8Array(TMP_WORD.buffer.slice(0))); +} +exports.getInt64 = getInt64; +/** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getInt8(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getInt8(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); + TMP_WORD.setUint8(0, v); + return TMP_WORD.getInt8(0); +} +exports.getInt8 = getInt8; +function getList(index, ListClass, s, defaultValue) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + if (pointer_1.isNull(l)) { + if (defaultValue) { + pointer_1.Pointer.copyFrom(defaultValue, l); + } + else { + list_1.List.initList(ListClass._capnp.size, 0, l, ListClass._capnp.compositeSize); + } + } + else if (ListClass._capnp.compositeSize !== undefined) { + // If this is a composite list we need to be sure the composite elements are big enough to hold everything as + // specified in the schema. If the new schema has added fields we'll need to "resize" (shallow-copy) the list so + // it has room for the new fields. + const srcSize = pointer_1.getTargetCompositeListSize(l); + const dstSize = ListClass._capnp.compositeSize; + if (dstSize.dataByteLength > srcSize.dataByteLength || dstSize.pointerLength > srcSize.pointerLength) { + const srcContent = pointer_1.getContent(l); + const srcLength = pointer_1.getTargetListLength(l); + trace("resizing composite list %s due to protocol upgrade, new size: %d", l, object_size_1.getByteLength(dstSize) * srcLength); + // Allocate an extra 8 bytes for the tag. + const dstContent = l.segment.allocate(object_size_1.getByteLength(dstSize) * srcLength + 8); + const res = pointer_1.initPointer(dstContent.segment, dstContent.byteOffset, l); + pointer_1.setListPointer(res.offsetWords, ListClass._capnp.size, srcLength, res.pointer, dstSize); + // Write the new tag word. + pointer_1.setStructPointer(srcLength, dstSize, dstContent); + // Seek ahead past the tag word before copying the content. + dstContent.byteOffset += 8; + for (let i = 0; i < srcLength; i++) { + const srcElementOffset = srcContent.byteOffset + i * object_size_1.getByteLength(srcSize); + const dstElementOffset = dstContent.byteOffset + i * object_size_1.getByteLength(dstSize); + // Copy the data section. + dstContent.segment.copyWords(dstElementOffset, srcContent.segment, srcElementOffset, object_size_1.getWordLength(srcSize)); + // Iterate through the pointers and update the offsets so they point to the right place. + for (let j = 0; j < srcSize.pointerLength; j++) { + const srcPtr = new pointer_1.Pointer(srcContent.segment, srcElementOffset + srcSize.dataByteLength + j * 8); + const dstPtr = new pointer_1.Pointer(dstContent.segment, dstElementOffset + dstSize.dataByteLength + j * 8); + const srcPtrTarget = pointer_1.followFars(srcPtr); + const srcPtrContent = pointer_1.getContent(srcPtr); + if (pointer_1.getTargetPointerType(srcPtr) === pointer_type_1.PointerType.LIST && + pointer_1.getTargetListElementSize(srcPtr) === list_element_size_1.ListElementSize.COMPOSITE) { + srcPtrContent.byteOffset -= 8; + } + const r = pointer_1.initPointer(srcPtrContent.segment, srcPtrContent.byteOffset, dstPtr); + // Read the old pointer data, but discard the original offset. + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 0x03; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + r.pointer.segment.setUint32(r.pointer.byteOffset, a | (r.offsetWords << 2)); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + } + // Zero out the old content. + srcContent.segment.fillZeroWords(srcContent.byteOffset, object_size_1.getWordLength(srcSize) * srcLength); + } + } + return l; +} +exports.getList = getList; +function getPointer(index, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + return new pointer_1.Pointer(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} +exports.getPointer = getPointer; +function getPointerAs(index, PointerClass, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + return new PointerClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} +exports.getPointerAs = getPointerAs; +function getPointerSection(s) { + const ps = pointer_1.getContent(s); + ps.byteOffset += util_1.padToWord(getSize(s).dataByteLength); + return ps; +} +exports.getPointerSection = getPointerSection; +function getSize(s) { + if (s._capnp.compositeIndex !== undefined) { + // For composite lists the object size is stored in a tag word right before the content. + const c = pointer_1.getContent(s, true); + c.byteOffset -= 8; + return pointer_1.getStructSize(c); + } + return pointer_1.getTargetStructSize(s); +} +exports.getSize = getSize; +function getStruct(index, StructClass, s, defaultValue) { + const t = getPointerAs(index, StructClass, s); + if (pointer_1.isNull(t)) { + if (defaultValue) { + pointer_1.Pointer.copyFrom(defaultValue, t); + } + else { + initStruct(StructClass._capnp.size, t); + } + } + else { + pointer_1.validate(pointer_type_1.PointerType.STRUCT, t); + const ts = pointer_1.getTargetStructSize(t); + // This can happen when reading a struct that was constructed with an older version of the same schema, and new + // fields were added to the struct. A shallow copy of the struct will be made so that there's enough room for the + // data and pointer sections. This will unfortunately leave a "hole" of zeroes in the message, but that hole will + // at least compress well. + if (ts.dataByteLength < StructClass._capnp.size.dataByteLength || + ts.pointerLength < StructClass._capnp.size.pointerLength) { + trace("need to resize child struct %s", t); + resize(StructClass._capnp.size, t); + } + } + return t; +} +exports.getStruct = getStruct; +function getText(index, s, defaultValue) { + const t = text_1.Text.fromPointer(getPointer(index, s)); + // FIXME: This will perform an unnecessary string<>ArrayBuffer roundtrip. + if (pointer_1.isNull(t) && defaultValue) + t.set(0, defaultValue); + return t.get(0); +} +exports.getText = getText; +/** + * Read an uint16 value out of a struct.. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getUint16(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getUint16(ds.byteOffset + byteOffset); + } + return ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); +} +exports.getUint16 = getUint16; +/** + * Read an uint32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getUint32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getUint32(ds.byteOffset + byteOffset); + } + return ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); +} +exports.getUint32 = getUint32; +/** + * Read an uint64 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getUint64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getUint64(ds.byteOffset + byteOffset); + } + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, constants_1.NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, constants_1.NATIVE_LITTLE_ENDIAN); + return new index_1.Uint64(new Uint8Array(TMP_WORD.buffer.slice(0))); +} +exports.getUint64 = getUint64; +/** + * Read an uint8 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ +function getUint8(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask === undefined) { + return ds.segment.getUint8(ds.byteOffset + byteOffset); + } + return ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); +} +exports.getUint8 = getUint8; +function getVoid() { + throw new Error(errors_1.INVARIANT_UNREACHABLE_CODE); +} +exports.getVoid = getVoid; +function initData(index, length, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new data_1.Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + pointer_1.erase(l); + list_1.List.initList(list_element_size_1.ListElementSize.BYTE, length, l); + return l; +} +exports.initData = initData; +function initList(index, ListClass, length, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + pointer_1.erase(l); + list_1.List.initList(ListClass._capnp.size, length, l, ListClass._capnp.compositeSize); + return l; +} +exports.initList = initList; +/** + * Write a boolean (bit) value to the struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {boolean} value The value to write (writes a 0 for `false`, 1 for `true`). + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setBit(bitOffset, value, s, defaultMask) { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + const b = ds.segment.getUint8(ds.byteOffset + byteOffset); + // If the default mask bit is set, that means `true` values are actually written as `0`. + if (defaultMask !== undefined) { + value = (defaultMask.getUint8(0) & bitMask) !== 0 ? !value : value; + } + ds.segment.setUint8(ds.byteOffset + byteOffset, value ? b | bitMask : b & ~bitMask); +} +exports.setBit = setBit; +/** + * Write a primitive float32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setFloat32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + TMP_WORD.setFloat32(0, value, constants_1.NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, constants_1.NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setFloat32(ds.byteOffset + byteOffset, value); +} +exports.setFloat32 = setFloat32; +/** + * Write a primitive float64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setFloat64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + TMP_WORD.setFloat64(0, value, constants_1.NATIVE_LITTLE_ENDIAN); + const lo = TMP_WORD.getUint32(0, constants_1.NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + const hi = TMP_WORD.getUint32(4, constants_1.NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(4, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, lo); + ds.segment.setUint32(ds.byteOffset + byteOffset + 4, hi); + return; + } + ds.segment.setFloat64(ds.byteOffset + byteOffset, value); +} +exports.setFloat64 = setFloat64; +/** + * Write a primitive int16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setInt16(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + TMP_WORD.setInt16(0, value, constants_1.NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint16(0, constants_1.NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint16(0, true); + ds.segment.setUint16(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt16(ds.byteOffset + byteOffset, value); +} +exports.setInt16 = setInt16; +/** + * Write a primitive int32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setInt32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + TMP_WORD.setInt32(0, value, constants_1.NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, constants_1.NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt32(ds.byteOffset + byteOffset, value); +} +exports.setInt32 = setInt32; +/** + * Write a primitive int64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setInt64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + // PERF: We could cast the Int64 to a DataView to apply the mask using four 32-bit reads, but we already have a + // typed array so avoiding the object allocation turns out to be slightly faster. Int64 is guaranteed to be in + // little-endian format by design. + for (let i = 0; i < 8; i++) { + ds.segment.setUint8(ds.byteOffset + byteOffset + i, value.buffer[i] ^ defaultMask.getUint8(i)); + } + return; + } + ds.segment.setInt64(ds.byteOffset + byteOffset, value); +} +exports.setInt64 = setInt64; +/** + * Write a primitive int8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setInt8(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + TMP_WORD.setInt8(0, value); + const v = TMP_WORD.getUint8(0) ^ defaultMask.getUint8(0); + ds.segment.setUint8(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt8(ds.byteOffset + byteOffset, value); +} +exports.setInt8 = setInt8; +function setPointer(index, value, s) { + pointer_1.copyFrom(value, getPointer(index, s)); +} +exports.setPointer = setPointer; +function setText(index, value, s) { + text_1.Text.fromPointer(getPointer(index, s)).set(0, value); +} +exports.setText = setText; +/** + * Write a primitive uint16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setUint16(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) + value ^= defaultMask.getUint16(0, true); + ds.segment.setUint16(ds.byteOffset + byteOffset, value); +} +exports.setUint16 = setUint16; +/** + * Write a primitive uint32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setUint32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) + value ^= defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, value); +} +exports.setUint32 = setUint32; +/** + * Write a primitive uint64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setUint64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) { + // PERF: We could cast the Uint64 to a DataView to apply the mask using four 32-bit reads, but we already have a + // typed array so avoiding the object allocation turns out to be slightly faster. Uint64 is guaranteed to be in + // little-endian format by design. + for (let i = 0; i < 8; i++) { + ds.segment.setUint8(ds.byteOffset + byteOffset + i, value.buffer[i] ^ defaultMask.getUint8(i)); + } + return; + } + ds.segment.setUint64(ds.byteOffset + byteOffset, value); +} +exports.setUint64 = setUint64; +/** + * Write a primitive uint8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ +function setUint8(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask !== undefined) + value ^= defaultMask.getUint8(0); + ds.segment.setUint8(ds.byteOffset + byteOffset, value); +} +exports.setUint8 = setUint8; +function setVoid() { + throw new Error(errors_1.INVARIANT_UNREACHABLE_CODE); +} +exports.setVoid = setVoid; +function testWhich(name, found, wanted, s) { + if (found !== wanted) { + throw new Error(util_1.format(errors_1.PTR_INVALID_UNION_ACCESS, s, name, found, wanted)); + } +} +exports.testWhich = testWhich; +function checkDataBounds(byteOffset, byteLength, s) { + const dataByteLength = getSize(s).dataByteLength; + if (byteOffset < 0 || byteLength < 0 || byteOffset + byteLength > dataByteLength) { + throw new Error(util_1.format(errors_1.PTR_STRUCT_DATA_OUT_OF_BOUNDS, s, byteLength, byteOffset, dataByteLength)); + } +} +exports.checkDataBounds = checkDataBounds; +function checkPointerBounds(index, s) { + const pointerLength = getSize(s).pointerLength; + if (index < 0 || index >= pointerLength) { + throw new Error(util_1.format(errors_1.PTR_STRUCT_POINTER_OUT_OF_BOUNDS, s, index, pointerLength)); + } +} +exports.checkPointerBounds = checkPointerBounds; +//# sourceMappingURL=struct.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/struct.js.map b/node_modules/capnp-ts/src/serialization/pointers/struct.js.map new file mode 100644 index 0000000..a6233ff --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/struct.js.map @@ -0,0 +1 @@ +{"version":3,"file":"struct.js","sourceRoot":"","sources":["struct.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,+CAAkE;AAClE,6CAAkD;AAClD,qCAA+C;AAC/C,4DAAuD;AACvD,gDAA6F;AAE7F,iCAA8B;AAC9B,iCAAwC;AAExC,uCAoBmB;AACnB,iDAA6C;AAC7C,iCAA8B;AAC9B,yCAQsB;AAEtB,MAAM,KAAK,GAAG,eAAS,CAAC,cAAc,CAAC,CAAC;AACxC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,4CAA4C;AAC5C,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAiBlD,MAAa,MAAO,SAAQ,iBAAO;IA0CjC;;;;;;;;;;;OAWG;IAEH,YAAY,OAAgB,EAAE,UAAkB,EAAE,UAAU,GAAG,qBAAS,EAAE,cAAuB;QAC/F,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAEvC,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,cAAc,KAAK,SAAS,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,OAAO,CACL,UAAU,KAAK,CAAC,QAAQ,EAAE,EAA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EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;KACpF;AACH,CAAC;AAND,gDAMC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/struct.ts b/node_modules/capnp-ts/src/serialization/pointers/struct.ts new file mode 100644 index 0000000..30b3fc0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/struct.ts @@ -0,0 +1,1090 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { MAX_DEPTH, NATIVE_LITTLE_ENDIAN } from "../../constants"; +import { Int64, Uint64 } from "../../types/index"; +import { format, padToWord } from "../../util"; +import { ListElementSize } from "../list-element-size"; +import { ObjectSize, getByteLength, getDataWordLength, getWordLength } from "../object-size"; +import { Segment } from "../segment"; +import { Data } from "./data"; +import { List, ListCtor } from "./list"; +import { Orphan } from "./orphan"; +import { + _Pointer, + _PointerCtor, + Pointer, + PointerCtor, + getContent, + getStructSize, + initPointer, + erase, + setStructPointer, + followFars, + getTargetListElementSize, + getTargetPointerType, + isNull, + getTargetCompositeListSize, + getTargetListLength, + setListPointer, + getTargetStructSize, + validate, + copyFrom, +} from "./pointer"; +import { PointerType } from "./pointer-type"; +import { Text } from "./text"; +import { + PTR_INIT_COMPOSITE_STRUCT, + PTR_ADOPT_COMPOSITE_STRUCT, + PTR_DISOWN_COMPOSITE_STRUCT, + PTR_INVALID_UNION_ACCESS, + PTR_STRUCT_DATA_OUT_OF_BOUNDS, + PTR_STRUCT_POINTER_OUT_OF_BOUNDS, + INVARIANT_UNREACHABLE_CODE, +} from "../../errors"; + +const trace = initTrace("capnp:struct"); +trace("load"); + +// Used to apply bit masks (default values). +const TMP_WORD = new DataView(new ArrayBuffer(8)); + +export interface _StructCtor extends _PointerCtor { + readonly id: string; + readonly size: ObjectSize; +} + +export interface StructCtor<T extends Struct> { + readonly _capnp: _StructCtor; + + new (segment: Segment, byteOffset: number, depthLimit?: number, compositeIndex?: number): T; +} + +export interface _Struct extends _Pointer { + compositeIndex?: number; +} + +export class Struct extends Pointer { + static readonly _capnp = { + displayName: "Struct" as string, + }; + static readonly getAs = getAs; + static readonly getBit = getBit; + static readonly getData = getData; + static readonly getFloat32 = getFloat32; + static readonly getFloat64 = getFloat64; + static readonly getUint8 = getUint8; + static readonly getUint16 = getUint16; + static readonly getUint32 = getUint32; + static readonly getUint64 = getUint64; + static readonly getInt8 = getInt8; + static readonly getInt16 = getInt16; + static readonly getInt32 = getInt32; + static readonly getInt64 = getInt64; + static readonly getList = getList; + static readonly getPointer = getPointer; + static readonly getPointerAs = getPointerAs; + static readonly getStruct = getStruct; + static readonly getText = getText; + static readonly initData = initData; + static readonly initList = initList; + static readonly initStruct = initStruct; + static readonly initStructAt = initStructAt; + static readonly setBit = setBit; + static readonly setFloat32 = setFloat32; + static readonly setFloat64 = setFloat64; + static readonly setUint8 = setUint8; + static readonly setUint16 = setUint16; + static readonly setUint32 = setUint32; + static readonly setUint64 = setUint64; + static readonly setInt8 = setInt8; + static readonly setInt16 = setInt16; + static readonly setInt32 = setInt32; + static readonly setInt64 = setInt64; + static readonly setText = setText; + static readonly testWhich = testWhich; + + readonly _capnp!: _Struct; + + /** + * Create a new pointer to a struct. + * + * @constructor {Struct} + * @param {Segment} segment The segment the pointer resides in. + * @param {number} byteOffset The offset from the beginning of the segment to the beginning of the pointer data. + * @param {any} [depthLimit=MAX_DEPTH] The nesting depth limit for this object. + * @param {number} [compositeIndex] If set, then this pointer is actually a reference to a composite list + * (`this._getPointerTargetType() === PointerType.LIST`), and this number is used as the index of the struct within + * the list. It is not valid to call `initStruct()` on a composite struct – the struct contents are initialized when + * the list pointer is initialized. + */ + + constructor(segment: Segment, byteOffset: number, depthLimit = MAX_DEPTH, compositeIndex?: number) { + super(segment, byteOffset, depthLimit); + + this._capnp.compositeIndex = compositeIndex; + this._capnp.compositeList = compositeIndex !== undefined; + } + + static toString(): string { + return this._capnp.displayName; + } + + toString(): string { + return ( + `Struct_${super.toString()}` + + `${this._capnp.compositeIndex === undefined ? "" : `,ci:${this._capnp.compositeIndex}`}` + ); + } +} + +/** + * Initialize a struct with the provided object size. This will allocate new space for the struct contents, ideally in + * the same segment as this pointer. + * + * @param {ObjectSize} size An object describing the size of the struct's data and pointer sections. + * @param {Struct} s The struct to initialize. + * @returns {void} + */ + +export function initStruct(size: ObjectSize, s: Struct): void { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(format(PTR_INIT_COMPOSITE_STRUCT, s)); + } + + // Make sure to clear existing contents before overwriting the pointer data (erase is a noop if already empty). + + erase(s); + + const c = s.segment.allocate(getByteLength(size)); + + const res = initPointer(c.segment, c.byteOffset, s); + + setStructPointer(res.offsetWords, size, res.pointer); +} + +export function initStructAt<T extends Struct>(index: number, StructClass: StructCtor<T>, p: Pointer): T { + const s = getPointerAs(index, StructClass, p); + + initStruct(StructClass._capnp.size, s); + + return s; +} + +/** + * Make a shallow copy of a struct's contents and update the pointer to point to the new content. The data and pointer + * sections will be resized to the provided size. + * + * WARNING: This method can cause data loss if `dstSize` is smaller than the original size! + * + * @param {ObjectSize} dstSize The desired size for the struct contents. + * @param {Struct} s The struct to resize. + * @returns {void} + */ + +export function resize(dstSize: ObjectSize, s: Struct): void { + const srcSize = getSize(s); + const srcContent = getContent(s); + const dstContent = s.segment.allocate(getByteLength(dstSize)); + + // Only copy the data section for now. The pointer section will need to be rewritten. + dstContent.segment.copyWords( + dstContent.byteOffset, + srcContent.segment, + srcContent.byteOffset, + Math.min(getDataWordLength(srcSize), getDataWordLength(dstSize)) + ); + + const res = initPointer(dstContent.segment, dstContent.byteOffset, s); + + setStructPointer(res.offsetWords, dstSize, res.pointer); + + // Iterate through the new pointer section and update the offsets so they point to the right place. This is a bit + // more complicated than it appears due to the fact that the original pointers could have been far pointers, and + // the new pointers might need to be allocated as far pointers if the segment is full. + + for (let i = 0; i < Math.min(srcSize.pointerLength, dstSize.pointerLength); i++) { + const srcPtr = new Pointer(srcContent.segment, srcContent.byteOffset + srcSize.dataByteLength + i * 8); + if (isNull(srcPtr)) { + // If source pointer is null, leave the destination pointer as default null. + continue; + } + const srcPtrTarget = followFars(srcPtr); + const srcPtrContent = getContent(srcPtr); + const dstPtr = new Pointer(dstContent.segment, dstContent.byteOffset + dstSize.dataByteLength + i * 8); + + // For composite lists the offset needs to point to the tag word, not the first element which is what getContent + // returns. + + if ( + getTargetPointerType(srcPtr) === PointerType.LIST && + getTargetListElementSize(srcPtr) === ListElementSize.COMPOSITE + ) { + srcPtrContent.byteOffset -= 8; + } + + const r = initPointer(srcPtrContent.segment, srcPtrContent.byteOffset, dstPtr); + + // Read the old pointer data, but discard the original offset. + + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 0x03; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + + r.pointer.segment.setUint32(r.pointer.byteOffset, a | (r.offsetWords << 2)); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + + // Zero out the old data and pointer sections. + + srcContent.segment.fillZeroWords(srcContent.byteOffset, getWordLength(srcSize)); +} + +export function adopt<T extends Struct>(src: Orphan<T>, s: Struct): void { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(format(PTR_ADOPT_COMPOSITE_STRUCT, s)); + } + + Pointer.adopt(src, s); +} + +export function disown<T extends Struct>(s: Struct): Orphan<T> { + if (s._capnp.compositeIndex !== undefined) { + throw new Error(format(PTR_DISOWN_COMPOSITE_STRUCT, s)); + } + + return Pointer.disown(s); +} + +/** + * Convert a struct to a struct of the provided class. Particularly useful when casting to nested group types. + * + * @protected + * @template T + * @param {StructCtor<T>} StructClass The struct class to convert to. Not particularly useful if `Struct`. + * @param {Struct} s The struct to convert. + * @returns {T} A new instance of the desired struct class pointing to the same location. + */ + +export function getAs<T extends Struct>(StructClass: StructCtor<T>, s: Struct): T { + return new StructClass(s.segment, s.byteOffset, s._capnp.depthLimit, s._capnp.compositeIndex); +} + +/** + * Read a boolean (bit) value out of a struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {boolean} The value. + */ + +export function getBit(bitOffset: number, s: Struct, defaultMask?: DataView): boolean { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + const v = ds.segment.getUint8(ds.byteOffset + byteOffset); + + if (defaultMask === undefined) return (v & bitMask) !== 0; + + const defaultValue = defaultMask.getUint8(0); + return ((v ^ defaultValue) & bitMask) !== 0; +} + +export function getData(index: number, s: Struct, defaultValue?: Pointer): Data { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + const l = new Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + + if (isNull(l)) { + if (defaultValue) { + Pointer.copyFrom(defaultValue, l); + } else { + List.initList(ListElementSize.BYTE, 0, l); + } + } + + return l; +} + +export function getDataSection(s: Struct): Pointer { + return getContent(s); +} + +/** + * Read a float32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getFloat32(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getFloat32(ds.byteOffset + byteOffset); + } + + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + TMP_WORD.setUint32(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat32(0, NATIVE_LITTLE_ENDIAN); +} + +/** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getFloat64(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat64(0, NATIVE_LITTLE_ENDIAN); + } + + return ds.segment.getFloat64(ds.byteOffset + byteOffset); +} + +/** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getInt16(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 2, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getInt16(ds.byteOffset + byteOffset); + } + + const v = ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint16(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt16(0, NATIVE_LITTLE_ENDIAN); +} + +/** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getInt32(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getInt32(ds.byteOffset + byteOffset); + } + + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint32(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt32(0, NATIVE_LITTLE_ENDIAN); +} + +/** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getInt64(byteOffset: number, s: Struct, defaultMask?: DataView): Int64 { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getInt64(ds.byteOffset + byteOffset); + } + + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, NATIVE_LITTLE_ENDIAN); + return new Int64(new Uint8Array(TMP_WORD.buffer.slice(0))); +} + +/** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getInt8(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getInt8(ds.byteOffset + byteOffset); + } + + const v = ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); + TMP_WORD.setUint8(0, v); + return TMP_WORD.getInt8(0); +} + +export function getList<T>(index: number, ListClass: ListCtor<T>, s: Struct, defaultValue?: Pointer): List<T> { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + + if (isNull(l)) { + if (defaultValue) { + Pointer.copyFrom(defaultValue, l); + } else { + List.initList(ListClass._capnp.size, 0, l, ListClass._capnp.compositeSize); + } + } else if (ListClass._capnp.compositeSize !== undefined) { + // If this is a composite list we need to be sure the composite elements are big enough to hold everything as + // specified in the schema. If the new schema has added fields we'll need to "resize" (shallow-copy) the list so + // it has room for the new fields. + + const srcSize = getTargetCompositeListSize(l); + const dstSize = ListClass._capnp.compositeSize; + + if (dstSize.dataByteLength > srcSize.dataByteLength || dstSize.pointerLength > srcSize.pointerLength) { + const srcContent = getContent(l); + const srcLength = getTargetListLength(l); + + trace("resizing composite list %s due to protocol upgrade, new size: %d", l, getByteLength(dstSize) * srcLength); + + // Allocate an extra 8 bytes for the tag. + const dstContent = l.segment.allocate(getByteLength(dstSize) * srcLength + 8); + + const res = initPointer(dstContent.segment, dstContent.byteOffset, l); + + setListPointer(res.offsetWords, ListClass._capnp.size, srcLength, res.pointer, dstSize); + + // Write the new tag word. + + setStructPointer(srcLength, dstSize, dstContent); + + // Seek ahead past the tag word before copying the content. + dstContent.byteOffset += 8; + + for (let i = 0; i < srcLength; i++) { + const srcElementOffset = srcContent.byteOffset + i * getByteLength(srcSize); + const dstElementOffset = dstContent.byteOffset + i * getByteLength(dstSize); + + // Copy the data section. + + dstContent.segment.copyWords(dstElementOffset, srcContent.segment, srcElementOffset, getWordLength(srcSize)); + + // Iterate through the pointers and update the offsets so they point to the right place. + + for (let j = 0; j < srcSize.pointerLength; j++) { + const srcPtr = new Pointer(srcContent.segment, srcElementOffset + srcSize.dataByteLength + j * 8); + const dstPtr = new Pointer(dstContent.segment, dstElementOffset + dstSize.dataByteLength + j * 8); + + const srcPtrTarget = followFars(srcPtr); + const srcPtrContent = getContent(srcPtr); + + if ( + getTargetPointerType(srcPtr) === PointerType.LIST && + getTargetListElementSize(srcPtr) === ListElementSize.COMPOSITE + ) { + srcPtrContent.byteOffset -= 8; + } + + const r = initPointer(srcPtrContent.segment, srcPtrContent.byteOffset, dstPtr); + + // Read the old pointer data, but discard the original offset. + + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 0x03; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + + r.pointer.segment.setUint32(r.pointer.byteOffset, a | (r.offsetWords << 2)); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + } + + // Zero out the old content. + + srcContent.segment.fillZeroWords(srcContent.byteOffset, getWordLength(srcSize) * srcLength); + } + } + + return l; +} + +export function getPointer(index: number, s: Struct): Pointer { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + return new Pointer(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} + +export function getPointerAs<T extends Pointer>(index: number, PointerClass: PointerCtor<T>, s: Struct): T { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + return new PointerClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} + +export function getPointerSection(s: Struct): Pointer { + const ps = getContent(s); + + ps.byteOffset += padToWord(getSize(s).dataByteLength); + + return ps; +} + +export function getSize(s: Struct): ObjectSize { + if (s._capnp.compositeIndex !== undefined) { + // For composite lists the object size is stored in a tag word right before the content. + + const c = getContent(s, true); + + c.byteOffset -= 8; + + return getStructSize(c); + } + + return getTargetStructSize(s); +} + +export function getStruct<T extends Struct>( + index: number, + StructClass: StructCtor<T>, + s: Struct, + defaultValue?: Pointer +): T { + const t = getPointerAs(index, StructClass, s); + + if (isNull(t)) { + if (defaultValue) { + Pointer.copyFrom(defaultValue, t); + } else { + initStruct(StructClass._capnp.size, t); + } + } else { + validate(PointerType.STRUCT, t); + + const ts = getTargetStructSize(t); + + // This can happen when reading a struct that was constructed with an older version of the same schema, and new + // fields were added to the struct. A shallow copy of the struct will be made so that there's enough room for the + // data and pointer sections. This will unfortunately leave a "hole" of zeroes in the message, but that hole will + // at least compress well. + if ( + ts.dataByteLength < StructClass._capnp.size.dataByteLength || + ts.pointerLength < StructClass._capnp.size.pointerLength + ) { + trace("need to resize child struct %s", t); + + resize(StructClass._capnp.size, t); + } + } + + return t; +} + +export function getText(index: number, s: Struct, defaultValue?: string): string { + const t = Text.fromPointer(getPointer(index, s)); + + // FIXME: This will perform an unnecessary string<>ArrayBuffer roundtrip. + if (isNull(t) && defaultValue) t.set(0, defaultValue); + + return t.get(0); +} + +/** + * Read an uint16 value out of a struct.. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getUint16(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 2, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getUint16(ds.byteOffset + byteOffset); + } + + return ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); +} + +/** + * Read an uint32 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getUint32(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getUint32(ds.byteOffset + byteOffset); + } + + return ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); +} + +/** + * Read an uint64 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getUint64(byteOffset: number, s: Struct, defaultMask?: DataView): Uint64 { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getUint64(ds.byteOffset + byteOffset); + } + + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, NATIVE_LITTLE_ENDIAN); + return new Uint64(new Uint8Array(TMP_WORD.buffer.slice(0))); +} + +/** + * Read an uint8 value out of a struct. + * + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {Struct} s The struct to read from. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {number} The value. + */ + +export function getUint8(byteOffset: number, s: Struct, defaultMask?: DataView): number { + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + if (defaultMask === undefined) { + return ds.segment.getUint8(ds.byteOffset + byteOffset); + } + + return ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); +} + +export function getVoid(): void { + throw new Error(INVARIANT_UNREACHABLE_CODE); +} + +export function initData(index: number, length: number, s: Struct): Data { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + const l = new Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + + erase(l); + + List.initList(ListElementSize.BYTE, length, l); + + return l; +} + +export function initList<T>(index: number, ListClass: ListCtor<T>, length: number, s: Struct): List<T> { + checkPointerBounds(index, s); + + const ps = getPointerSection(s); + + ps.byteOffset += index * 8; + + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + + erase(l); + + List.initList(ListClass._capnp.size, length, l, ListClass._capnp.compositeSize); + + return l; +} + +/** + * Write a boolean (bit) value to the struct. + * + * @protected + * @param {number} bitOffset The offset in **bits** from the start of the data section. + * @param {boolean} value The value to write (writes a 0 for `false`, 1 for `true`). + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setBit(bitOffset: number, value: boolean, s: Struct, defaultMask?: DataView): void { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + const b = ds.segment.getUint8(ds.byteOffset + byteOffset); + + // If the default mask bit is set, that means `true` values are actually written as `0`. + + if (defaultMask !== undefined) { + value = (defaultMask.getUint8(0) & bitMask) !== 0 ? !value : value; + } + + ds.segment.setUint8(ds.byteOffset + byteOffset, value ? b | bitMask : b & ~bitMask); +} + +/** + * Write a primitive float32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setFloat32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + TMP_WORD.setFloat32(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + + return; + } + + ds.segment.setFloat32(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive float64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setFloat64(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + TMP_WORD.setFloat64(0, value, NATIVE_LITTLE_ENDIAN); + const lo = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + const hi = TMP_WORD.getUint32(4, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(4, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, lo); + ds.segment.setUint32(ds.byteOffset + byteOffset + 4, hi); + + return; + } + + ds.segment.setFloat64(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive int16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setInt16(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 2, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + TMP_WORD.setInt16(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint16(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint16(0, true); + ds.segment.setUint16(ds.byteOffset + byteOffset, v); + + return; + } + + ds.segment.setInt16(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive int32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setInt32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + TMP_WORD.setInt32(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + + return; + } + + ds.segment.setInt32(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive int64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setInt64(byteOffset: number, value: Int64, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + // PERF: We could cast the Int64 to a DataView to apply the mask using four 32-bit reads, but we already have a + // typed array so avoiding the object allocation turns out to be slightly faster. Int64 is guaranteed to be in + // little-endian format by design. + + for (let i = 0; i < 8; i++) { + ds.segment.setUint8(ds.byteOffset + byteOffset + i, value.buffer[i] ^ defaultMask.getUint8(i)); + } + + return; + } + + ds.segment.setInt64(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive int8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setInt8(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + TMP_WORD.setInt8(0, value); + const v = TMP_WORD.getUint8(0) ^ defaultMask.getUint8(0); + ds.segment.setUint8(ds.byteOffset + byteOffset, v); + + return; + } + + ds.segment.setInt8(ds.byteOffset + byteOffset, value); +} + +export function setPointer(index: number, value: Pointer, s: Struct): void { + copyFrom(value, getPointer(index, s)); +} + +export function setText(index: number, value: string, s: Struct): void { + Text.fromPointer(getPointer(index, s)).set(0, value); +} + +/** + * Write a primitive uint16 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setUint16(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 2, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) value ^= defaultMask.getUint16(0, true); + + ds.segment.setUint16(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive uint32 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setUint32(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 4, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) value ^= defaultMask.getUint32(0, true); + + ds.segment.setUint32(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive uint64 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setUint64(byteOffset: number, value: Uint64, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 8, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) { + // PERF: We could cast the Uint64 to a DataView to apply the mask using four 32-bit reads, but we already have a + // typed array so avoiding the object allocation turns out to be slightly faster. Uint64 is guaranteed to be in + // little-endian format by design. + + for (let i = 0; i < 8; i++) { + ds.segment.setUint8(ds.byteOffset + byteOffset + i, value.buffer[i] ^ defaultMask.getUint8(i)); + } + + return; + } + + ds.segment.setUint64(ds.byteOffset + byteOffset, value); +} + +/** + * Write a primitive uint8 value to the struct. + * + * @protected + * @param {number} byteOffset The offset in bytes from the start of the data section. + * @param {number} value The value to write. + * @param {Struct} s The struct to write to. + * @param {DataView} [defaultMask] The default value as a DataView. + * @returns {void} + */ + +export function setUint8(byteOffset: number, value: number, s: Struct, defaultMask?: DataView): void { + checkDataBounds(byteOffset, 1, s); + + const ds = getDataSection(s); + + if (defaultMask !== undefined) value ^= defaultMask.getUint8(0); + + ds.segment.setUint8(ds.byteOffset + byteOffset, value); +} + +export function setVoid(): void { + throw new Error(INVARIANT_UNREACHABLE_CODE); +} + +export function testWhich(name: string, found: number, wanted: number, s: Struct): void { + if (found !== wanted) { + throw new Error(format(PTR_INVALID_UNION_ACCESS, s, name, found, wanted)); + } +} + +export function checkDataBounds(byteOffset: number, byteLength: number, s: Struct): void { + const dataByteLength = getSize(s).dataByteLength; + + if (byteOffset < 0 || byteLength < 0 || byteOffset + byteLength > dataByteLength) { + throw new Error(format(PTR_STRUCT_DATA_OUT_OF_BOUNDS, s, byteLength, byteOffset, dataByteLength)); + } +} + +export function checkPointerBounds(index: number, s: Struct): void { + const pointerLength = getSize(s).pointerLength; + + if (index < 0 || index >= pointerLength) { + throw new Error(format(PTR_STRUCT_POINTER_OUT_OF_BOUNDS, s, index, pointerLength)); + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/text-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/text-list.d.ts new file mode 100644 index 0000000..bd4c8bb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class TextList extends List<string> { + static readonly _capnp: _ListCtor; + get(index: number): string; + set(index: number, value: string): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/text-list.js b/node_modules/capnp-ts/src/serialization/pointers/text-list.js new file mode 100644 index 0000000..0005b0c --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text-list.js @@ -0,0 +1,35 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TextList = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const text_1 = require("./text"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class TextList extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + c.byteOffset += index * 8; + return text_1.Text.fromPointer(c).get(0); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.byteOffset += index * 8; + text_1.Text.fromPointer(c).set(0, value); + } + toString() { + return `Text_${super.toString()}`; + } +} +exports.TextList = TextList; +TextList._capnp = { + displayName: "List<Text>", + size: list_element_size_1.ListElementSize.POINTER +}; +//# sourceMappingURL=text-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/text-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/text-list.js.map new file mode 100644 index 0000000..7c9c627 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text-list.js","sourceRoot":"","sources":["text-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4DAAuD;AACvD,iCAAyC;AACzC,iCAA8B;AAC9B,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,QAAS,SAAQ,WAAY;IAMxC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,UAAU,IAAI,KAAK,GAAG,CAAC,CAAC;QAE1B,OAAO,WAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,UAAU,IAAI,KAAK,GAAG,CAAC,CAAC;QAE1B,WAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpC,CAAC;;AAxBH,4BAyBC;AAxBiB,eAAM,GAAc;IAClC,WAAW,EAAE,YAAsB;IACnC,IAAI,EAAE,mCAAe,CAAC,OAAO;CAC9B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/text-list.ts b/node_modules/capnp-ts/src/serialization/pointers/text-list.ts new file mode 100644 index 0000000..0c2c8fd --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text-list.ts @@ -0,0 +1,40 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { Text } from "./text"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class TextList extends List<string> { + static readonly _capnp: _ListCtor = { + displayName: "List<Text>" as string, + size: ListElementSize.POINTER + }; + + get(index: number): string { + const c = getContent(this); + + c.byteOffset += index * 8; + + return Text.fromPointer(c).get(0); + } + + set(index: number, value: string): void { + const c = getContent(this); + + c.byteOffset += index * 8; + + Text.fromPointer(c).set(0, value); + } + + toString(): string { + return `Text_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/text.d.ts b/node_modules/capnp-ts/src/serialization/pointers/text.d.ts new file mode 100644 index 0000000..bbbaa7d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text.d.ts @@ -0,0 +1,31 @@ +/** + * @author jdiaz5513 + */ +import { List } from "./list"; +import { Pointer } from "./pointer"; +export declare class Text extends List<string> { + static fromPointer(pointer: Pointer): Text; + /** + * Read a utf-8 encoded string value from this pointer. + * + * @param {number} [index] The index at which to start reading; defaults to zero. + * @returns {string} The string value. + */ + get(index?: number): string; + /** + * Get the number of utf-8 encoded bytes in this text. This does **not** include the NUL byte. + * + * @returns {number} The number of bytes allocated for the text. + */ + getLength(): number; + /** + * Write a utf-8 encoded string value starting at the specified index. + * + * @param {number} index The index at which to start copying the string. Note that if this is not zero the bytes + * before `index` will be left as-is. All bytes after `index` will be overwritten. + * @param {string} value The string value to set. + * @returns {void} + */ + set(index: number, value: string): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/text.js b/node_modules/capnp-ts/src/serialization/pointers/text.js new file mode 100644 index 0000000..e4de308 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text.js @@ -0,0 +1,91 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Text = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const util_1 = require("../../util"); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const pointer_type_1 = require("./pointer-type"); +const trace = debug_1.default("capnp:text"); +trace("load"); +class Text extends list_1.List { + static fromPointer(pointer) { + pointer_1.validate(pointer_type_1.PointerType.LIST, pointer, list_element_size_1.ListElementSize.BYTE); + return textFromPointerUnchecked(pointer); + } + /** + * Read a utf-8 encoded string value from this pointer. + * + * @param {number} [index] The index at which to start reading; defaults to zero. + * @returns {string} The string value. + */ + get(index = 0) { + if (index !== 0) { + trace("Called get() on %s with a strange index (%d).", this, index); + } + if (pointer_1.isNull(this)) + return ""; + const c = pointer_1.getContent(this); + // Remember to exclude the NUL byte. + return util_1.decodeUtf8(new Uint8Array(c.segment.buffer, c.byteOffset + index, this.getLength() - index)); + } + /** + * Get the number of utf-8 encoded bytes in this text. This does **not** include the NUL byte. + * + * @returns {number} The number of bytes allocated for the text. + */ + getLength() { + return super.getLength() - 1; + } + /** + * Write a utf-8 encoded string value starting at the specified index. + * + * @param {number} index The index at which to start copying the string. Note that if this is not zero the bytes + * before `index` will be left as-is. All bytes after `index` will be overwritten. + * @param {string} value The string value to set. + * @returns {void} + */ + set(index, value) { + if (index !== 0) { + trace("Called set() on %s with a strange index (%d).", this, index); + } + const src = util_1.encodeUtf8(value); + const dstLength = src.byteLength + index; + let c; + let original; + // TODO: Consider reusing existing space if list is already initialized and there's enough room for the value. + if (!pointer_1.isNull(this)) { + c = pointer_1.getContent(this); + // Only copy bytes that will remain after copying. Everything after `index` should end up truncated. + let originalLength = this.getLength(); + if (originalLength >= index) { + originalLength = index; + } + else { + trace("%d byte gap exists between original text and new text in %s.", index - originalLength, this); + } + original = new Uint8Array(c.segment.buffer.slice(c.byteOffset, c.byteOffset + Math.min(originalLength, index))); + pointer_1.erase(this); + } + // Always allocate an extra byte for the NUL byte. + list_1.initList(list_element_size_1.ListElementSize.BYTE, dstLength + 1, this); + c = pointer_1.getContent(this); + const dst = new Uint8Array(c.segment.buffer, c.byteOffset, dstLength); + if (original) + dst.set(original); + dst.set(src, index); + } + toString() { + return `Text_${super.toString()}`; + } +} +exports.Text = Text; +function textFromPointerUnchecked(pointer) { + return new Text(pointer.segment, pointer.byteOffset, pointer._capnp.depthLimit); +} +//# sourceMappingURL=text.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/text.js.map b/node_modules/capnp-ts/src/serialization/pointers/text.js.map new file mode 100644 index 0000000..4cd6d29 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text.js","sourceRoot":"","sources":["text.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,qCAAoD;AACpD,4DAAuD;AACvD,iCAAwC;AACxC,uCAAyE;AACzE,iDAA6C;AAE7C,MAAM,KAAK,GAAG,eAAS,CAAC,YAAY,CAAC,CAAC;AACtC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,IAAK,SAAQ,WAAY;IACpC,MAAM,CAAC,WAAW,CAAC,OAAgB;QACjC,kBAAQ,CAAC,0BAAW,CAAC,IAAI,EAAE,OAAO,EAAE,mCAAe,CAAC,IAAI,CAAC,CAAC;QAE1D,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IAEH,GAAG,CAAC,KAAK,GAAG,CAAC;QACX,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,KAAK,CAAC,+CAA+C,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACrE;QAED,IAAI,gBAAM,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QAE5B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,oCAAoC;QAEpC,OAAO,iBAAU,CACf,IAAI,UAAU,CACZ,CAAC,CAAC,OAAO,CAAC,MAAM,EAChB,CAAC,CAAC,UAAU,GAAG,KAAK,EACpB,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,CACzB,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IAEH,SAAS;QACP,OAAO,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;OAOG;IAEH,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9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KAAK,CAAC,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpC,CAAC;CACF;AA3GD,oBA2GC;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAChD,OAAO,IAAI,IAAI,CACb,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,MAAM,CAAC,UAAU,CAC1B,CAAC;AACJ,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/text.ts b/node_modules/capnp-ts/src/serialization/pointers/text.ts new file mode 100644 index 0000000..2804097 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/text.ts @@ -0,0 +1,131 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { decodeUtf8, encodeUtf8 } from "../../util"; +import { ListElementSize } from "../list-element-size"; +import { List, initList } from "./list"; +import { Pointer, validate, isNull, getContent, erase } from "./pointer"; +import { PointerType } from "./pointer-type"; + +const trace = initTrace("capnp:text"); +trace("load"); + +export class Text extends List<string> { + static fromPointer(pointer: Pointer): Text { + validate(PointerType.LIST, pointer, ListElementSize.BYTE); + + return textFromPointerUnchecked(pointer); + } + + /** + * Read a utf-8 encoded string value from this pointer. + * + * @param {number} [index] The index at which to start reading; defaults to zero. + * @returns {string} The string value. + */ + + get(index = 0): string { + if (index !== 0) { + trace("Called get() on %s with a strange index (%d).", this, index); + } + + if (isNull(this)) return ""; + + const c = getContent(this); + + // Remember to exclude the NUL byte. + + return decodeUtf8( + new Uint8Array( + c.segment.buffer, + c.byteOffset + index, + this.getLength() - index + ) + ); + } + + /** + * Get the number of utf-8 encoded bytes in this text. This does **not** include the NUL byte. + * + * @returns {number} The number of bytes allocated for the text. + */ + + getLength(): number { + return super.getLength() - 1; + } + + /** + * Write a utf-8 encoded string value starting at the specified index. + * + * @param {number} index The index at which to start copying the string. Note that if this is not zero the bytes + * before `index` will be left as-is. All bytes after `index` will be overwritten. + * @param {string} value The string value to set. + * @returns {void} + */ + + set(index: number, value: string): void { + if (index !== 0) { + trace("Called set() on %s with a strange index (%d).", this, index); + } + + const src = encodeUtf8(value); + const dstLength = src.byteLength + index; + let c: Pointer; + let original: Uint8Array | undefined; + + // TODO: Consider reusing existing space if list is already initialized and there's enough room for the value. + + if (!isNull(this)) { + c = getContent(this); + + // Only copy bytes that will remain after copying. Everything after `index` should end up truncated. + + let originalLength = this.getLength(); + + if (originalLength >= index) { + originalLength = index; + } else { + trace( + "%d byte gap exists between original text and new text in %s.", + index - originalLength, + this + ); + } + + original = new Uint8Array( + c.segment.buffer.slice( + c.byteOffset, + c.byteOffset + Math.min(originalLength, index) + ) + ); + + erase(this); + } + + // Always allocate an extra byte for the NUL byte. + + initList(ListElementSize.BYTE, dstLength + 1, this); + + c = getContent(this); + const dst = new Uint8Array(c.segment.buffer, c.byteOffset, dstLength); + + if (original) dst.set(original); + + dst.set(src, index); + } + + toString(): string { + return `Text_${super.toString()}`; + } +} + +function textFromPointerUnchecked(pointer: Pointer): Text { + return new Text( + pointer.segment, + pointer.byteOffset, + pointer._capnp.depthLimit + ); +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint16-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.d.ts new file mode 100644 index 0000000..02df3da --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Uint16List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js new file mode 100644 index 0000000..e6ca94e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint16List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Uint16List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getUint16(c.byteOffset + index * 2); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setUint16(c.byteOffset + index * 2, value); + } + toString() { + return `Uint16_${super.toString()}`; + } +} +exports.Uint16List = Uint16List; +Uint16List._capnp = { + displayName: "List<Uint16>", + size: list_element_size_1.ListElementSize.BYTE_2 +}; +//# sourceMappingURL=uint16-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js.map new file mode 100644 index 0000000..e9c8dce --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uint16-list.js","sourceRoot":"","sources":["uint16-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,UAAW,SAAQ,WAAY;IAM1C,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAE3B,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ;QACN,OAAO,UAAU,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtC,CAAC;;AAnBH,gCAoBC;AAnBiB,iBAAM,GAAc;IAClC,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint16-list.ts b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.ts new file mode 100644 index 0000000..64741f0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint16-list.ts @@ -0,0 +1,34 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Uint16List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Uint16>", + size: ListElementSize.BYTE_2 + }; + + get(index: number): number { + const c = getContent(this); + return c.segment.getUint16(c.byteOffset + index * 2); + } + + set(index: number, value: number): void { + const c = getContent(this); + + c.segment.setUint16(c.byteOffset + index * 2, value); + } + + toString(): string { + return `Uint16_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint32-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.d.ts new file mode 100644 index 0000000..245b4aa --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Uint32List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js new file mode 100644 index 0000000..7ef3a02 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint32List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Uint32List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getUint32(c.byteOffset + index * 4); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setUint32(c.byteOffset + index * 4, value); + } + toString() { + return `Uint32_${super.toString()}`; + } +} +exports.Uint32List = Uint32List; +Uint32List._capnp = { + displayName: "List<Uint32>", + size: list_element_size_1.ListElementSize.BYTE_4 +}; +//# sourceMappingURL=uint32-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js.map new file mode 100644 index 0000000..241593f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uint32-list.js","sourceRoot":"","sources":["uint32-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,UAAW,SAAQ,WAAY;IAM1C,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ;QACN,OAAO,UAAU,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtC,CAAC;;AAlBH,gCAmBC;AAlBiB,iBAAM,GAAc;IAClC,WAAW,EAAE,cAAwB;IACrC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint32-list.ts b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.ts new file mode 100644 index 0000000..2a6eafc --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint32-list.ts @@ -0,0 +1,33 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Uint32List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Uint32>" as string, + size: ListElementSize.BYTE_4 + }; + + get(index: number): number { + const c = getContent(this); + return c.segment.getUint32(c.byteOffset + index * 4); + } + + set(index: number, value: number): void { + const c = getContent(this); + c.segment.setUint32(c.byteOffset + index * 4, value); + } + + toString(): string { + return `Uint32_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint64-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.d.ts new file mode 100644 index 0000000..467e08d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.d.ts @@ -0,0 +1,11 @@ +/** + * @author jdiaz5513 + */ +import { Uint64 } from "../../types/index"; +import { _ListCtor, List } from "./list"; +export declare class Uint64List extends List<Uint64> { + static readonly _capnp: _ListCtor; + get(index: number): Uint64; + set(index: number, value: Uint64): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js new file mode 100644 index 0000000..0e49e01 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint64List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Uint64List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getUint64(c.byteOffset + index * 8); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setUint64(c.byteOffset + index * 8, value); + } + toString() { + return `Uint64_${super.toString()}`; + } +} +exports.Uint64List = Uint64List; +Uint64List._capnp = { + displayName: "List<Uint64>", + size: list_element_size_1.ListElementSize.BYTE_8, +}; +//# sourceMappingURL=uint64-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js.map new file mode 100644 index 0000000..b5b0102 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uint64-list.js","sourceRoot":"","sources":["uint64-list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAG9B,4DAAuD;AACvD,iCAAyC;AACzC,uCAAuC;AAEvC,MAAM,KAAK,GAAG,eAAS,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,UAAW,SAAQ,WAAY;IAM1C,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ;QACN,OAAO,UAAU,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtC,CAAC;;AAlBH,gCAmBC;AAlBiB,iBAAM,GAAc;IAClC,WAAW,EAAE,cAAwB;IACrC,IAAI,EAAE,mCAAe,CAAC,MAAM;CAC7B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint64-list.ts b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.ts new file mode 100644 index 0000000..d46a6cb --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint64-list.ts @@ -0,0 +1,34 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { Uint64 } from "../../types/index"; +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Uint64List extends List<Uint64> { + static readonly _capnp: _ListCtor = { + displayName: "List<Uint64>" as string, + size: ListElementSize.BYTE_8, + }; + + get(index: number): Uint64 { + const c = getContent(this); + return c.segment.getUint64(c.byteOffset + index * 8); + } + + set(index: number, value: Uint64): void { + const c = getContent(this); + c.segment.setUint64(c.byteOffset + index * 8, value); + } + + toString(): string { + return `Uint64_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint8-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.d.ts new file mode 100644 index 0000000..3383f88 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.d.ts @@ -0,0 +1,10 @@ +/** + * @author jdiaz5513 + */ +import { _ListCtor, List } from "./list"; +export declare class Uint8List extends List<number> { + static readonly _capnp: _ListCtor; + get(index: number): number; + set(index: number, value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js new file mode 100644 index 0000000..2387ad6 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js @@ -0,0 +1,32 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint8List = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const list_element_size_1 = require("../list-element-size"); +const list_1 = require("./list"); +const pointer_1 = require("./pointer"); +const trace = debug_1.default("capnp:list:composite"); +trace("load"); +class Uint8List extends list_1.List { + get(index) { + const c = pointer_1.getContent(this); + return c.segment.getUint8(c.byteOffset + index); + } + set(index, value) { + const c = pointer_1.getContent(this); + c.segment.setUint8(c.byteOffset + index, value); + } + toString() { + return `Uint8_${super.toString()}`; + } +} +exports.Uint8List = Uint8List; +Uint8List._capnp = { + displayName: "List<Uint8>", + size: list_element_size_1.ListElementSize.BYTE +}; +//# sourceMappingURL=uint8-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js.map new file mode 100644 index 0000000..aced68e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uint8-list.js","sourceRoot":"","sources":["uint8-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,SAAU,SAAQ,WAAY;IAMzC,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,KAAa;QAC9B,MAAM,CAAC,GAAG,oBAAU,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ;QACN,OAAO,SAAS,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACrC,CAAC;;AAlBH,8BAmBC;AAlBiB,gBAAM,GAAc;IAClC,WAAW,EAAE,aAAuB;IACpC,IAAI,EAAE,mCAAe,CAAC,IAAI;CAC3B,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/uint8-list.ts b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.ts new file mode 100644 index 0000000..524fd9d --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/uint8-list.ts @@ -0,0 +1,33 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { ListElementSize } from "../list-element-size"; +import { _ListCtor, List } from "./list"; +import { getContent } from "./pointer"; + +const trace = initTrace("capnp:list:composite"); +trace("load"); + +export class Uint8List extends List<number> { + static readonly _capnp: _ListCtor = { + displayName: "List<Uint8>" as string, + size: ListElementSize.BYTE + }; + + get(index: number): number { + const c = getContent(this); + return c.segment.getUint8(c.byteOffset + index); + } + + set(index: number, value: number): void { + const c = getContent(this); + c.segment.setUint8(c.byteOffset + index, value); + } + + toString(): string { + return `Uint8_${super.toString()}`; + } +} diff --git a/node_modules/capnp-ts/src/serialization/pointers/void-list.d.ts b/node_modules/capnp-ts/src/serialization/pointers/void-list.d.ts new file mode 100644 index 0000000..50392a0 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void-list.d.ts @@ -0,0 +1,8 @@ +/** + * Why would anyone **SANE** ever use this!? + * + * @author jdiaz5513 + */ +import { ListCtor } from "./list"; +import { Void } from "./void"; +export declare const VoidList: ListCtor<Void>; diff --git a/node_modules/capnp-ts/src/serialization/pointers/void-list.js b/node_modules/capnp-ts/src/serialization/pointers/void-list.js new file mode 100644 index 0000000..68a75d3 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void-list.js @@ -0,0 +1,12 @@ +"use strict"; +/** + * Why would anyone **SANE** ever use this!? + * + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VoidList = void 0; +const pointer_list_1 = require("./pointer-list"); +const void_1 = require("./void"); +exports.VoidList = pointer_list_1.PointerList(void_1.Void); +//# sourceMappingURL=void-list.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/void-list.js.map b/node_modules/capnp-ts/src/serialization/pointers/void-list.js.map new file mode 100644 index 0000000..5706639 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"void-list.js","sourceRoot":"","sources":["void-list.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,iDAA6C;AAC7C,iCAA8B;AAEjB,QAAA,QAAQ,GAAmB,0BAAW,CAAC,WAAI,CAAC,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/void-list.ts b/node_modules/capnp-ts/src/serialization/pointers/void-list.ts new file mode 100644 index 0000000..07b4b6e --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void-list.ts @@ -0,0 +1,11 @@ +/** + * Why would anyone **SANE** ever use this!? + * + * @author jdiaz5513 + */ + +import { ListCtor } from "./list"; +import { PointerList } from "./pointer-list"; +import { Void } from "./void"; + +export const VoidList: ListCtor<Void> = PointerList(Void); diff --git a/node_modules/capnp-ts/src/serialization/pointers/void.d.ts b/node_modules/capnp-ts/src/serialization/pointers/void.d.ts new file mode 100644 index 0000000..798baa2 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void.d.ts @@ -0,0 +1,8 @@ +/** + * @author jdiaz5513 + */ +import { _StructCtor, Struct } from "./struct"; +export declare class Void extends Struct { + static readonly _capnp: _StructCtor; +} +export declare const VOID: undefined; diff --git a/node_modules/capnp-ts/src/serialization/pointers/void.js b/node_modules/capnp-ts/src/serialization/pointers/void.js new file mode 100644 index 0000000..15b9d2f --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void.js @@ -0,0 +1,19 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VOID = exports.Void = void 0; +const object_size_1 = require("../object-size"); +const struct_1 = require("./struct"); +class Void extends struct_1.Struct { +} +exports.Void = Void; +Void._capnp = { + displayName: "Void", + id: "0", + size: new object_size_1.ObjectSize(0, 0) +}; +// This following line makes a mysterious "whooshing" sound when it runs. +exports.VOID = undefined; +//# sourceMappingURL=void.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/void.js.map b/node_modules/capnp-ts/src/serialization/pointers/void.js.map new file mode 100644 index 0000000..3cd848a --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void.js.map @@ -0,0 +1 @@ +{"version":3,"file":"void.js","sourceRoot":"","sources":["void.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gDAA4C;AAC5C,qCAA+C;AAE/C,MAAa,IAAK,SAAQ,eAAM;;AAAhC,oBAMC;AALiB,WAAM,GAAgB;IACpC,WAAW,EAAE,MAAgB;IAC7B,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,IAAI,wBAAU,CAAC,CAAC,EAAE,CAAC,CAAC;CAC3B,CAAC;AAGJ,yEAAyE;AAE5D,QAAA,IAAI,GAAG,SAAS,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/pointers/void.ts b/node_modules/capnp-ts/src/serialization/pointers/void.ts new file mode 100644 index 0000000..a03c1ad --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/pointers/void.ts @@ -0,0 +1,18 @@ +/** + * @author jdiaz5513 + */ + +import { ObjectSize } from "../object-size"; +import { _StructCtor, Struct } from "./struct"; + +export class Void extends Struct { + static readonly _capnp: _StructCtor = { + displayName: "Void" as string, + id: "0", + size: new ObjectSize(0, 0) + }; +} + +// This following line makes a mysterious "whooshing" sound when it runs. + +export const VOID = undefined; diff --git a/node_modules/capnp-ts/src/serialization/segment.d.ts b/node_modules/capnp-ts/src/serialization/segment.d.ts new file mode 100644 index 0000000..bdc6737 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/segment.d.ts @@ -0,0 +1,256 @@ +/** + * @author jdiaz5513 + */ +import { Int64, Uint64 } from "../types"; +import { Message } from "./message"; +import { Pointer } from "./pointers"; +export declare class Segment implements DataView { + buffer: ArrayBuffer; + /** The number of bytes currently allocated in the segment. */ + byteLength: number; + /** + * This value should always be zero. It's only here to satisfy the DataView interface. + * + * In the future the Segment implementation (or a child class) may allow accessing the buffer from a nonzero offset, + * but that adds a lot of extra arithmetic. + */ + byteOffset: number; + readonly [Symbol.toStringTag]: "DataView"; + readonly id: number; + readonly message: Message; + private _dv; + constructor(id: number, message: Message, buffer: ArrayBuffer, byteLength?: number); + /** + * Attempt to allocate the requested number of bytes in this segment. If this segment is full this method will return + * a pointer to freshly allocated space in another segment from the same message. + * + * @param {number} byteLength The number of bytes to allocate, will be rounded up to the nearest word. + * @returns {Pointer} A pointer to the newly allocated space. + */ + allocate(byteLength: number): Pointer; + /** + * Quickly copy a word (8 bytes) from `srcSegment` into this one at the given offset. + * + * @param {number} byteOffset The offset to write the word to. + * @param {Segment} srcSegment The segment to copy the word from. + * @param {number} srcByteOffset The offset from the start of `srcSegment` to copy from. + * @returns {void} + */ + copyWord(byteOffset: number, srcSegment: Segment, srcByteOffset: number): void; + /** + * Quickly copy words from `srcSegment` into this one. + * + * @param {number} byteOffset The offset to start copying into. + * @param {Segment} srcSegment The segment to copy from. + * @param {number} srcByteOffset The start offset to copy from. + * @param {number} wordLength The number of words to copy. + * @returns {void} + */ + copyWords(byteOffset: number, srcSegment: Segment, srcByteOffset: number, wordLength: number): void; + /** + * Quickly fill a number of words in the buffer with zeroes. + * + * @param {number} byteOffset The first byte to set to zero. + * @param {number} wordLength The number of words (not bytes!) to zero out. + * @returns {void} + */ + fillZeroWords(byteOffset: number, wordLength: number): void; + /** WARNING: This function is not yet implemented. */ + getBigInt64(byteOffset: number, littleEndian?: boolean): bigint; + /** WARNING: This function is not yet implemented. */ + getBigUint64(byteOffset: number, littleEndian?: boolean): bigint; + /** + * Get the total number of bytes available in this segment (the size of its underlying buffer). + * + * @returns {number} The total number of bytes this segment can hold. + */ + getCapacity(): number; + /** + * Read a float32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getFloat32(byteOffset: number): number; + /** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getFloat64(byteOffset: number): number; + /** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt16(byteOffset: number): number; + /** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt32(byteOffset: number): number; + /** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt64(byteOffset: number): Int64; + /** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt8(byteOffset: number): number; + /** + * Read a uint16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint16(byteOffset: number): number; + /** + * Read a uint32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint32(byteOffset: number): number; + /** + * Read a uint8 value out of this segment. + * NOTE: this does not copy the memory region, so updates to the underlying buffer will affect the Uint64 value! + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint64(byteOffset: number): Uint64; + /** + * Read a uint8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint8(byteOffset: number): number; + hasCapacity(byteLength: number): boolean; + /** + * Quickly check the word at the given offset to see if it is equal to zero. + * + * PERF_V8: Fastest way to do this is by reading the whole word as a `number` (float64) in the _native_ endian format + * and see if it's zero. + * + * Benchmark: http://jsben.ch/#/Pjooc + * + * @param {number} byteOffset The offset to the word. + * @returns {boolean} `true` if the word is zero. + */ + isWordZero(byteOffset: number): boolean; + /** + * Swap out this segment's underlying buffer with a new one. It's assumed that the new buffer has the same content but + * more free space, otherwise all existing pointers to this segment will be hilariously broken. + * + * @param {ArrayBuffer} buffer The new buffer to use. + * @returns {void} + */ + replaceBuffer(buffer: ArrayBuffer): void; + /** WARNING: This function is not yet implemented. */ + setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void; + /** WARNING: This function is not yet implemented. */ + setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void; + /** + * Write a float32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setFloat32(byteOffset: number, val: number): void; + /** + * Write an float64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setFloat64(byteOffset: number, val: number): void; + /** + * Write an int16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt16(byteOffset: number, val: number): void; + /** + * Write an int32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt32(byteOffset: number, val: number): void; + /** + * Write an int8 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt8(byteOffset: number, val: number): void; + /** + * Write an int64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Int64} val The value to store. + * @returns {void} + */ + setInt64(byteOffset: number, val: Int64): void; + /** + * Write a uint16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint16(byteOffset: number, val: number): void; + /** + * Write a uint32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint32(byteOffset: number, val: number): void; + /** + * Write a uint64 value to the specified offset. + * TODO: benchmark other ways to perform this write operation. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Uint64} val The value to store. + * @returns {void} + */ + setUint64(byteOffset: number, val: Uint64): void; + /** + * Write a uint8 (byte) value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint8(byteOffset: number, val: number): void; + /** + * Write a zero word (8 bytes) to the specified offset. This is slightly faster than calling `setUint64` or + * `setFloat64` with a zero value. + * + * Benchmark: http://jsben.ch/#/dUdPI + * + * @param {number} byteOffset The offset of the word to set to zero. + * @returns {void} + */ + setWordZero(byteOffset: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/serialization/segment.js b/node_modules/capnp-ts/src/serialization/segment.js new file mode 100644 index 0000000..984a065 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/segment.js @@ -0,0 +1,370 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Segment = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../constants"); +const errors_1 = require("../errors"); +const types_1 = require("../types"); +const util_1 = require("../util"); +const pointers_1 = require("./pointers"); +const trace = debug_1.default("capnp:segment"); +trace("load"); +class Segment { + constructor(id, message, buffer, byteLength = 0) { + this[_a] = "Segment"; + this.id = id; + this.message = message; + this.buffer = buffer; + this._dv = new DataView(buffer); + this.byteOffset = 0; + this.byteLength = byteLength; + } + /** + * Attempt to allocate the requested number of bytes in this segment. If this segment is full this method will return + * a pointer to freshly allocated space in another segment from the same message. + * + * @param {number} byteLength The number of bytes to allocate, will be rounded up to the nearest word. + * @returns {Pointer} A pointer to the newly allocated space. + */ + allocate(byteLength) { + trace("allocate(%d)", byteLength); + // eslint-disable-next-line @typescript-eslint/no-this-alias + let segment = this; + byteLength = util_1.padToWord(byteLength); + if (byteLength > constants_1.MAX_SEGMENT_LENGTH - 8) { + throw new Error(util_1.format(errors_1.SEG_SIZE_OVERFLOW, byteLength)); + } + if (!segment.hasCapacity(byteLength)) { + segment = segment.message.allocateSegment(byteLength); + } + const byteOffset = segment.byteLength; + segment.byteLength = segment.byteLength + byteLength; + trace("Allocated %x bytes in %s (requested segment: %s).", byteLength, this, segment); + return new pointers_1.Pointer(segment, byteOffset); + } + /** + * Quickly copy a word (8 bytes) from `srcSegment` into this one at the given offset. + * + * @param {number} byteOffset The offset to write the word to. + * @param {Segment} srcSegment The segment to copy the word from. + * @param {number} srcByteOffset The offset from the start of `srcSegment` to copy from. + * @returns {void} + */ + copyWord(byteOffset, srcSegment, srcByteOffset) { + const value = srcSegment._dv.getFloat64(srcByteOffset, constants_1.NATIVE_LITTLE_ENDIAN); + this._dv.setFloat64(byteOffset, value, constants_1.NATIVE_LITTLE_ENDIAN); + } + /** + * Quickly copy words from `srcSegment` into this one. + * + * @param {number} byteOffset The offset to start copying into. + * @param {Segment} srcSegment The segment to copy from. + * @param {number} srcByteOffset The start offset to copy from. + * @param {number} wordLength The number of words to copy. + * @returns {void} + */ + copyWords(byteOffset, srcSegment, srcByteOffset, wordLength) { + const dst = new Float64Array(this.buffer, byteOffset, wordLength); + const src = new Float64Array(srcSegment.buffer, srcByteOffset, wordLength); + dst.set(src); + } + /** + * Quickly fill a number of words in the buffer with zeroes. + * + * @param {number} byteOffset The first byte to set to zero. + * @param {number} wordLength The number of words (not bytes!) to zero out. + * @returns {void} + */ + fillZeroWords(byteOffset, wordLength) { + new Float64Array(this.buffer, byteOffset, wordLength).fill(0); + } + /** WARNING: This function is not yet implemented. */ + getBigInt64(byteOffset, littleEndian) { + throw new Error(util_1.format(errors_1.NOT_IMPLEMENTED, byteOffset, littleEndian)); + } + /** WARNING: This function is not yet implemented. */ + getBigUint64(byteOffset, littleEndian) { + throw new Error(util_1.format(errors_1.NOT_IMPLEMENTED, byteOffset, littleEndian)); + } + /** + * Get the total number of bytes available in this segment (the size of its underlying buffer). + * + * @returns {number} The total number of bytes this segment can hold. + */ + getCapacity() { + return this.buffer.byteLength; + } + /** + * Read a float32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getFloat32(byteOffset) { + return this._dv.getFloat32(byteOffset, true); + } + /** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getFloat64(byteOffset) { + return this._dv.getFloat64(byteOffset, true); + } + /** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt16(byteOffset) { + return this._dv.getInt16(byteOffset, true); + } + /** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt32(byteOffset) { + return this._dv.getInt32(byteOffset, true); + } + /** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt64(byteOffset) { + return new types_1.Int64(new Uint8Array(this.buffer.slice(byteOffset, byteOffset + 8))); + } + /** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getInt8(byteOffset) { + return this._dv.getInt8(byteOffset); + } + /** + * Read a uint16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint16(byteOffset) { + return this._dv.getUint16(byteOffset, true); + } + /** + * Read a uint32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint32(byteOffset) { + return this._dv.getUint32(byteOffset, true); + } + /** + * Read a uint8 value out of this segment. + * NOTE: this does not copy the memory region, so updates to the underlying buffer will affect the Uint64 value! + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint64(byteOffset) { + return new types_1.Uint64(new Uint8Array(this.buffer.slice(byteOffset, byteOffset + 8))); + } + /** + * Read a uint8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + getUint8(byteOffset) { + return this._dv.getUint8(byteOffset); + } + hasCapacity(byteLength) { + trace("hasCapacity(%d)", byteLength); + // capacity - allocated >= requested + return this.buffer.byteLength - this.byteLength >= byteLength; + } + /** + * Quickly check the word at the given offset to see if it is equal to zero. + * + * PERF_V8: Fastest way to do this is by reading the whole word as a `number` (float64) in the _native_ endian format + * and see if it's zero. + * + * Benchmark: http://jsben.ch/#/Pjooc + * + * @param {number} byteOffset The offset to the word. + * @returns {boolean} `true` if the word is zero. + */ + isWordZero(byteOffset) { + return this._dv.getFloat64(byteOffset, constants_1.NATIVE_LITTLE_ENDIAN) === 0; + } + /** + * Swap out this segment's underlying buffer with a new one. It's assumed that the new buffer has the same content but + * more free space, otherwise all existing pointers to this segment will be hilariously broken. + * + * @param {ArrayBuffer} buffer The new buffer to use. + * @returns {void} + */ + replaceBuffer(buffer) { + trace("replaceBuffer(%p)", buffer); + if (this.buffer === buffer) + return; + if (buffer.byteLength < this.byteLength) { + throw new Error(errors_1.SEG_REPLACEMENT_BUFFER_TOO_SMALL); + } + this._dv = new DataView(buffer); + this.buffer = buffer; + } + /** WARNING: This function is not yet implemented. */ + setBigInt64(byteOffset, value, littleEndian) { + throw new Error(util_1.format(errors_1.NOT_IMPLEMENTED, byteOffset, value, littleEndian)); + } + /** WARNING: This function is not yet implemented. */ + setBigUint64(byteOffset, value, littleEndian) { + throw new Error(util_1.format(errors_1.NOT_IMPLEMENTED, byteOffset, value, littleEndian)); + } + /** + * Write a float32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setFloat32(byteOffset, val) { + this._dv.setFloat32(byteOffset, val, true); + } + /** + * Write an float64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setFloat64(byteOffset, val) { + this._dv.setFloat64(byteOffset, val, true); + } + /** + * Write an int16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt16(byteOffset, val) { + this._dv.setInt16(byteOffset, val, true); + } + /** + * Write an int32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt32(byteOffset, val) { + this._dv.setInt32(byteOffset, val, true); + } + /** + * Write an int8 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setInt8(byteOffset, val) { + this._dv.setInt8(byteOffset, val); + } + /** + * Write an int64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Int64} val The value to store. + * @returns {void} + */ + setInt64(byteOffset, val) { + this._dv.setUint8(byteOffset, val.buffer[0]); + this._dv.setUint8(byteOffset + 1, val.buffer[1]); + this._dv.setUint8(byteOffset + 2, val.buffer[2]); + this._dv.setUint8(byteOffset + 3, val.buffer[3]); + this._dv.setUint8(byteOffset + 4, val.buffer[4]); + this._dv.setUint8(byteOffset + 5, val.buffer[5]); + this._dv.setUint8(byteOffset + 6, val.buffer[6]); + this._dv.setUint8(byteOffset + 7, val.buffer[7]); + } + /** + * Write a uint16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint16(byteOffset, val) { + this._dv.setUint16(byteOffset, val, true); + } + /** + * Write a uint32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint32(byteOffset, val) { + this._dv.setUint32(byteOffset, val, true); + } + /** + * Write a uint64 value to the specified offset. + * TODO: benchmark other ways to perform this write operation. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Uint64} val The value to store. + * @returns {void} + */ + setUint64(byteOffset, val) { + this._dv.setUint8(byteOffset + 0, val.buffer[0]); + this._dv.setUint8(byteOffset + 1, val.buffer[1]); + this._dv.setUint8(byteOffset + 2, val.buffer[2]); + this._dv.setUint8(byteOffset + 3, val.buffer[3]); + this._dv.setUint8(byteOffset + 4, val.buffer[4]); + this._dv.setUint8(byteOffset + 5, val.buffer[5]); + this._dv.setUint8(byteOffset + 6, val.buffer[6]); + this._dv.setUint8(byteOffset + 7, val.buffer[7]); + } + /** + * Write a uint8 (byte) value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + setUint8(byteOffset, val) { + this._dv.setUint8(byteOffset, val); + } + /** + * Write a zero word (8 bytes) to the specified offset. This is slightly faster than calling `setUint64` or + * `setFloat64` with a zero value. + * + * Benchmark: http://jsben.ch/#/dUdPI + * + * @param {number} byteOffset The offset of the word to set to zero. + * @returns {void} + */ + setWordZero(byteOffset) { + this._dv.setFloat64(byteOffset, 0, constants_1.NATIVE_LITTLE_ENDIAN); + } + toString() { + return util_1.format("Segment_id:%d,off:%a,len:%a,cap:%a", this.id, this.byteLength, this.byteOffset, this.buffer.byteLength); + } +} +exports.Segment = Segment; +_a = Symbol.toStringTag; +//# sourceMappingURL=segment.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/segment.js.map b/node_modules/capnp-ts/src/serialization/segment.js.map new file mode 100644 index 0000000..f973518 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/segment.js.map @@ -0,0 +1 @@ +{"version":3,"file":"segment.js","sourceRoot":"","sources":["segment.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,0DAA8B;AAE9B,4CAAwE;AACxE,sCAAiG;AACjG,oCAAyC;AACzC,kCAA4C;AAE5C,yCAAqC;AAErC,MAAM,KAAK,GAAG,eAAS,CAAC,eAAe,CAAC,CAAC;AACzC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd,MAAa,OAAO;IAwBlB,YAAY,EAAU,EAAE,OAAgB,EAAE,MAAmB,EAAE,UAAU,GAAG,CAAC;QARpE,QAAoB,GAAG,SAAuB,CAAC;QAStD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEhC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IAEH,QAAQ,CAAC,UAAkB;QACzB,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAElC,4DAA4D;QAC5D,IAAI,OAAO,GAAY,IAAI,CAAC;QAE5B,UAAU,GAAG,gBAAS,CAAC,UAAU,CAAC,CAAC;QAEnC,IAAI,UAAU,GAAG,8BAAkB,GAAG,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,aAAM,CAAC,0BAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;SACxD;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;YACpC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe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EACf,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,MAAM,CAAC,UAAU,CACvB,CAAC;IACJ,CAAC;CACF;AA3cD,0BA2cC;KA3bW,MAAM,CAAC,WAAW"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/serialization/segment.ts b/node_modules/capnp-ts/src/serialization/segment.ts new file mode 100644 index 0000000..b488451 --- /dev/null +++ b/node_modules/capnp-ts/src/serialization/segment.ts @@ -0,0 +1,476 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { MAX_SEGMENT_LENGTH, NATIVE_LITTLE_ENDIAN } from "../constants"; +import { NOT_IMPLEMENTED, SEG_REPLACEMENT_BUFFER_TOO_SMALL, SEG_SIZE_OVERFLOW } from "../errors"; +import { Int64, Uint64 } from "../types"; +import { format, padToWord } from "../util"; +import { Message } from "./message"; +import { Pointer } from "./pointers"; + +const trace = initTrace("capnp:segment"); +trace("load"); + +export class Segment implements DataView { + buffer: ArrayBuffer; + + /** The number of bytes currently allocated in the segment. */ + + byteLength: number; + + /** + * This value should always be zero. It's only here to satisfy the DataView interface. + * + * In the future the Segment implementation (or a child class) may allow accessing the buffer from a nonzero offset, + * but that adds a lot of extra arithmetic. + */ + + byteOffset: number; + + readonly [Symbol.toStringTag] = "Segment" as "DataView"; + + readonly id: number; + + readonly message: Message; + + private _dv: DataView; + + constructor(id: number, message: Message, buffer: ArrayBuffer, byteLength = 0) { + this.id = id; + this.message = message; + this.buffer = buffer; + this._dv = new DataView(buffer); + + this.byteOffset = 0; + this.byteLength = byteLength; + } + + /** + * Attempt to allocate the requested number of bytes in this segment. If this segment is full this method will return + * a pointer to freshly allocated space in another segment from the same message. + * + * @param {number} byteLength The number of bytes to allocate, will be rounded up to the nearest word. + * @returns {Pointer} A pointer to the newly allocated space. + */ + + allocate(byteLength: number): Pointer { + trace("allocate(%d)", byteLength); + + // eslint-disable-next-line @typescript-eslint/no-this-alias + let segment: Segment = this; + + byteLength = padToWord(byteLength); + + if (byteLength > MAX_SEGMENT_LENGTH - 8) { + throw new Error(format(SEG_SIZE_OVERFLOW, byteLength)); + } + + if (!segment.hasCapacity(byteLength)) { + segment = segment.message.allocateSegment(byteLength); + } + + const byteOffset = segment.byteLength; + + segment.byteLength = segment.byteLength + byteLength; + + trace("Allocated %x bytes in %s (requested segment: %s).", byteLength, this, segment); + + return new Pointer(segment, byteOffset); + } + + /** + * Quickly copy a word (8 bytes) from `srcSegment` into this one at the given offset. + * + * @param {number} byteOffset The offset to write the word to. + * @param {Segment} srcSegment The segment to copy the word from. + * @param {number} srcByteOffset The offset from the start of `srcSegment` to copy from. + * @returns {void} + */ + + copyWord(byteOffset: number, srcSegment: Segment, srcByteOffset: number): void { + const value = srcSegment._dv.getFloat64(srcByteOffset, NATIVE_LITTLE_ENDIAN); + + this._dv.setFloat64(byteOffset, value, NATIVE_LITTLE_ENDIAN); + } + + /** + * Quickly copy words from `srcSegment` into this one. + * + * @param {number} byteOffset The offset to start copying into. + * @param {Segment} srcSegment The segment to copy from. + * @param {number} srcByteOffset The start offset to copy from. + * @param {number} wordLength The number of words to copy. + * @returns {void} + */ + + copyWords(byteOffset: number, srcSegment: Segment, srcByteOffset: number, wordLength: number): void { + const dst = new Float64Array(this.buffer, byteOffset, wordLength); + const src = new Float64Array(srcSegment.buffer, srcByteOffset, wordLength); + + dst.set(src); + } + + /** + * Quickly fill a number of words in the buffer with zeroes. + * + * @param {number} byteOffset The first byte to set to zero. + * @param {number} wordLength The number of words (not bytes!) to zero out. + * @returns {void} + */ + + fillZeroWords(byteOffset: number, wordLength: number): void { + new Float64Array(this.buffer, byteOffset, wordLength).fill(0); + } + + /** WARNING: This function is not yet implemented. */ + + getBigInt64(byteOffset: number, littleEndian?: boolean): bigint { + throw new Error(format(NOT_IMPLEMENTED, byteOffset, littleEndian)); + } + + /** WARNING: This function is not yet implemented. */ + + getBigUint64(byteOffset: number, littleEndian?: boolean): bigint { + throw new Error(format(NOT_IMPLEMENTED, byteOffset, littleEndian)); + } + + /** + * Get the total number of bytes available in this segment (the size of its underlying buffer). + * + * @returns {number} The total number of bytes this segment can hold. + */ + + getCapacity(): number { + return this.buffer.byteLength; + } + + /** + * Read a float32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getFloat32(byteOffset: number): number { + return this._dv.getFloat32(byteOffset, true); + } + + /** + * Read a float64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getFloat64(byteOffset: number): number { + return this._dv.getFloat64(byteOffset, true); + } + + /** + * Read an int16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getInt16(byteOffset: number): number { + return this._dv.getInt16(byteOffset, true); + } + + /** + * Read an int32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getInt32(byteOffset: number): number { + return this._dv.getInt32(byteOffset, true); + } + + /** + * Read an int64 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getInt64(byteOffset: number): Int64 { + return new Int64(new Uint8Array(this.buffer.slice(byteOffset, byteOffset + 8))); + } + + /** + * Read an int8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getInt8(byteOffset: number): number { + return this._dv.getInt8(byteOffset); + } + + /** + * Read a uint16 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getUint16(byteOffset: number): number { + return this._dv.getUint16(byteOffset, true); + } + + /** + * Read a uint32 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getUint32(byteOffset: number): number { + return this._dv.getUint32(byteOffset, true); + } + + /** + * Read a uint8 value out of this segment. + * NOTE: this does not copy the memory region, so updates to the underlying buffer will affect the Uint64 value! + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getUint64(byteOffset: number): Uint64 { + return new Uint64(new Uint8Array(this.buffer.slice(byteOffset, byteOffset + 8))); + } + + /** + * Read a uint8 value out of this segment. + * + * @param {number} byteOffset The offset in bytes to the value. + * @returns {number} The value. + */ + + getUint8(byteOffset: number): number { + return this._dv.getUint8(byteOffset); + } + + hasCapacity(byteLength: number): boolean { + trace("hasCapacity(%d)", byteLength); + + // capacity - allocated >= requested + + return this.buffer.byteLength - this.byteLength >= byteLength; + } + + /** + * Quickly check the word at the given offset to see if it is equal to zero. + * + * PERF_V8: Fastest way to do this is by reading the whole word as a `number` (float64) in the _native_ endian format + * and see if it's zero. + * + * Benchmark: http://jsben.ch/#/Pjooc + * + * @param {number} byteOffset The offset to the word. + * @returns {boolean} `true` if the word is zero. + */ + + isWordZero(byteOffset: number): boolean { + return this._dv.getFloat64(byteOffset, NATIVE_LITTLE_ENDIAN) === 0; + } + + /** + * Swap out this segment's underlying buffer with a new one. It's assumed that the new buffer has the same content but + * more free space, otherwise all existing pointers to this segment will be hilariously broken. + * + * @param {ArrayBuffer} buffer The new buffer to use. + * @returns {void} + */ + + replaceBuffer(buffer: ArrayBuffer): void { + trace("replaceBuffer(%p)", buffer); + + if (this.buffer === buffer) return; + + if (buffer.byteLength < this.byteLength) { + throw new Error(SEG_REPLACEMENT_BUFFER_TOO_SMALL); + } + + this._dv = new DataView(buffer); + this.buffer = buffer; + } + + /** WARNING: This function is not yet implemented. */ + + setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void { + throw new Error(format(NOT_IMPLEMENTED, byteOffset, value, littleEndian)); + } + + /** WARNING: This function is not yet implemented. */ + + setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void { + throw new Error(format(NOT_IMPLEMENTED, byteOffset, value, littleEndian)); + } + + /** + * Write a float32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setFloat32(byteOffset: number, val: number): void { + this._dv.setFloat32(byteOffset, val, true); + } + + /** + * Write an float64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setFloat64(byteOffset: number, val: number): void { + this._dv.setFloat64(byteOffset, val, true); + } + + /** + * Write an int16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setInt16(byteOffset: number, val: number): void { + this._dv.setInt16(byteOffset, val, true); + } + + /** + * Write an int32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setInt32(byteOffset: number, val: number): void { + this._dv.setInt32(byteOffset, val, true); + } + + /** + * Write an int8 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setInt8(byteOffset: number, val: number): void { + this._dv.setInt8(byteOffset, val); + } + + /** + * Write an int64 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Int64} val The value to store. + * @returns {void} + */ + + setInt64(byteOffset: number, val: Int64): void { + this._dv.setUint8(byteOffset, val.buffer[0]); + this._dv.setUint8(byteOffset + 1, val.buffer[1]); + this._dv.setUint8(byteOffset + 2, val.buffer[2]); + this._dv.setUint8(byteOffset + 3, val.buffer[3]); + this._dv.setUint8(byteOffset + 4, val.buffer[4]); + this._dv.setUint8(byteOffset + 5, val.buffer[5]); + this._dv.setUint8(byteOffset + 6, val.buffer[6]); + this._dv.setUint8(byteOffset + 7, val.buffer[7]); + } + + /** + * Write a uint16 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setUint16(byteOffset: number, val: number): void { + this._dv.setUint16(byteOffset, val, true); + } + + /** + * Write a uint32 value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setUint32(byteOffset: number, val: number): void { + this._dv.setUint32(byteOffset, val, true); + } + + /** + * Write a uint64 value to the specified offset. + * TODO: benchmark other ways to perform this write operation. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {Uint64} val The value to store. + * @returns {void} + */ + + setUint64(byteOffset: number, val: Uint64): void { + this._dv.setUint8(byteOffset + 0, val.buffer[0]); + this._dv.setUint8(byteOffset + 1, val.buffer[1]); + this._dv.setUint8(byteOffset + 2, val.buffer[2]); + this._dv.setUint8(byteOffset + 3, val.buffer[3]); + this._dv.setUint8(byteOffset + 4, val.buffer[4]); + this._dv.setUint8(byteOffset + 5, val.buffer[5]); + this._dv.setUint8(byteOffset + 6, val.buffer[6]); + this._dv.setUint8(byteOffset + 7, val.buffer[7]); + } + + /** + * Write a uint8 (byte) value to the specified offset. + * + * @param {number} byteOffset The offset from the beginning of the buffer. + * @param {number} val The value to store. + * @returns {void} + */ + + setUint8(byteOffset: number, val: number): void { + this._dv.setUint8(byteOffset, val); + } + + /** + * Write a zero word (8 bytes) to the specified offset. This is slightly faster than calling `setUint64` or + * `setFloat64` with a zero value. + * + * Benchmark: http://jsben.ch/#/dUdPI + * + * @param {number} byteOffset The offset of the word to set to zero. + * @returns {void} + */ + + setWordZero(byteOffset: number): void { + this._dv.setFloat64(byteOffset, 0, NATIVE_LITTLE_ENDIAN); + } + + toString(): string { + return format( + "Segment_id:%d,off:%a,len:%a,cap:%a", + this.id, + this.byteLength, + this.byteOffset, + this.buffer.byteLength + ); + } +} diff --git a/node_modules/capnp-ts/src/std/README.md b/node_modules/capnp-ts/src/std/README.md new file mode 100644 index 0000000..8ed1ccc --- /dev/null +++ b/node_modules/capnp-ts/src/std/README.md @@ -0,0 +1,5 @@ +# Cap'n Proto Standard Libary Files + +These files are the underpinning of much of the RPC and code generation portions of the library. + +They were copied directly from https://github.com/sandstorm-io/capnproto/tree/41264ae6deb85ee9d9756e88293c856f7e9fe9d9/c%2B%2B/src/capnp. diff --git a/node_modules/capnp-ts/src/std/c++.capnp.d.ts b/node_modules/capnp-ts/src/std/c++.capnp.d.ts new file mode 100644 index 0000000..2b16d4d --- /dev/null +++ b/node_modules/capnp-ts/src/std/c++.capnp.d.ts @@ -0,0 +1,5 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +export declare const _capnpFileId = "bdf87d7bb8304e81"; diff --git a/node_modules/capnp-ts/src/std/c++.capnp.js b/node_modules/capnp-ts/src/std/c++.capnp.js new file mode 100644 index 0000000..838d597 --- /dev/null +++ b/node_modules/capnp-ts/src/std/c++.capnp.js @@ -0,0 +1,9 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports._capnpFileId = void 0; +exports._capnpFileId = "bdf87d7bb8304e81"; +//# sourceMappingURL=c++.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/c++.capnp.js.map b/node_modules/capnp-ts/src/std/c++.capnp.js.map new file mode 100644 index 0000000..5cf44a8 --- /dev/null +++ b/node_modules/capnp-ts/src/std/c++.capnp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"c++.capnp.js","sourceRoot":"","sources":["c++.capnp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,YAAY,GAAG,kBAAkB,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/c++.capnp.ts b/node_modules/capnp-ts/src/std/c++.capnp.ts new file mode 100644 index 0000000..334a089 --- /dev/null +++ b/node_modules/capnp-ts/src/std/c++.capnp.ts @@ -0,0 +1,8 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "bdf87d7bb8304e81"; diff --git a/node_modules/capnp-ts/src/std/persistent.capnp.d.ts b/node_modules/capnp-ts/src/std/persistent.capnp.d.ts new file mode 100644 index 0000000..6b9e49a --- /dev/null +++ b/node_modules/capnp-ts/src/std/persistent.capnp.d.ts @@ -0,0 +1,51 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +import * as capnp from "../index"; +import { Struct as __S } from "../index"; +export declare const _capnpFileId = "b8630836983feed7"; +export declare class Persistent_SaveParams extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptSealFor(value: capnp.Orphan<capnp.Pointer>): void; + disownSealFor(): capnp.Orphan<capnp.Pointer>; + getSealFor(): capnp.Pointer; + hasSealFor(): boolean; + setSealFor(value: capnp.Pointer): void; + toString(): string; +} +export declare class Persistent_SaveResults extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptSturdyRef(value: capnp.Orphan<capnp.Pointer>): void; + disownSturdyRef(): capnp.Orphan<capnp.Pointer>; + getSturdyRef(): capnp.Pointer; + hasSturdyRef(): boolean; + setSturdyRef(value: capnp.Pointer): void; + toString(): string; +} +export declare class Persistent extends __S { + static readonly SaveParams: typeof Persistent_SaveParams; + static readonly SaveResults: typeof Persistent_SaveResults; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + toString(): string; +} +export declare class RealmGateway extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/std/persistent.capnp.js b/node_modules/capnp-ts/src/std/persistent.capnp.js new file mode 100644 index 0000000..51a72bc --- /dev/null +++ b/node_modules/capnp-ts/src/std/persistent.capnp.js @@ -0,0 +1,42 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RealmGateway = exports.Persistent = exports.Persistent_SaveResults = exports.Persistent_SaveParams = exports._capnpFileId = void 0; +const index_1 = require("../index"); +exports._capnpFileId = "b8630836983feed7"; +class Persistent_SaveParams extends index_1.Struct { + adoptSealFor(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownSealFor() { return index_1.Struct.disown(this.getSealFor()); } + getSealFor() { return index_1.Struct.getPointer(0, this); } + hasSealFor() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setSealFor(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Persistent_SaveParams_" + super.toString(); } +} +exports.Persistent_SaveParams = Persistent_SaveParams; +Persistent_SaveParams._capnp = { displayName: "SaveParams", id: "f76fba59183073a5", size: new index_1.ObjectSize(0, 1) }; +class Persistent_SaveResults extends index_1.Struct { + adoptSturdyRef(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownSturdyRef() { return index_1.Struct.disown(this.getSturdyRef()); } + getSturdyRef() { return index_1.Struct.getPointer(0, this); } + hasSturdyRef() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setSturdyRef(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Persistent_SaveResults_" + super.toString(); } +} +exports.Persistent_SaveResults = Persistent_SaveResults; +Persistent_SaveResults._capnp = { displayName: "SaveResults", id: "b76848c18c40efbf", size: new index_1.ObjectSize(0, 1) }; +class Persistent extends index_1.Struct { + toString() { return "Persistent_" + super.toString(); } +} +exports.Persistent = Persistent; +Persistent.SaveParams = Persistent_SaveParams; +Persistent.SaveResults = Persistent_SaveResults; +Persistent._capnp = { displayName: "Persistent", id: "c8cb212fcd9f5691", size: new index_1.ObjectSize(0, 0) }; +class RealmGateway extends index_1.Struct { + toString() { return "RealmGateway_" + super.toString(); } +} +exports.RealmGateway = RealmGateway; +RealmGateway._capnp = { displayName: "RealmGateway", id: "84ff286cd00a3ed4", size: new index_1.ObjectSize(0, 0) }; +//# sourceMappingURL=persistent.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/persistent.capnp.js.map b/node_modules/capnp-ts/src/std/persistent.capnp.js.map new file mode 100644 index 0000000..da62ae5 --- /dev/null +++ b/node_modules/capnp-ts/src/std/pers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EAAE,IAAI,EAAE,IAAI,kBAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/persistent.capnp.ts b/node_modules/capnp-ts/src/std/persistent.capnp.ts new file mode 100644 index 0000000..e0920a5 --- /dev/null +++ b/node_modules/capnp-ts/src/std/persistent.capnp.ts @@ -0,0 +1,36 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "b8630836983feed7"; +export class Persistent_SaveParams extends __S { + static readonly _capnp = { displayName: "SaveParams", id: "f76fba59183073a5", size: new __O(0, 1) }; + adoptSealFor(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownSealFor(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getSealFor()); } + getSealFor(): capnp.Pointer { return __S.getPointer(0, this); } + hasSealFor(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setSealFor(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Persistent_SaveParams_" + super.toString(); } +} +export class Persistent_SaveResults extends __S { + static readonly _capnp = { displayName: "SaveResults", id: "b76848c18c40efbf", size: new __O(0, 1) }; + adoptSturdyRef(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownSturdyRef(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getSturdyRef()); } + getSturdyRef(): capnp.Pointer { return __S.getPointer(0, this); } + hasSturdyRef(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setSturdyRef(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Persistent_SaveResults_" + super.toString(); } +} +export class Persistent extends __S { + static readonly SaveParams = Persistent_SaveParams; + static readonly SaveResults = Persistent_SaveResults; + static readonly _capnp = { displayName: "Persistent", id: "c8cb212fcd9f5691", size: new __O(0, 0) }; + toString(): string { return "Persistent_" + super.toString(); } +} +export class RealmGateway extends __S { + static readonly _capnp = { displayName: "RealmGateway", id: "84ff286cd00a3ed4", size: new __O(0, 0) }; + toString(): string { return "RealmGateway_" + super.toString(); } +} diff --git a/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.d.ts b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.d.ts new file mode 100644 index 0000000..a6ff167 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.d.ts @@ -0,0 +1,78 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +import * as capnp from "../index"; +import { Struct as __S } from "../index"; +export declare const _capnpFileId = "a184c7885cdaf2a1"; +export declare enum Side { + SERVER = 0, + CLIENT = 1 +} +export declare class VatId extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getSide(): Side; + setSide(value: Side): void; + toString(): string; +} +export declare class ProvisionId extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getJoinId(): number; + setJoinId(value: number): void; + toString(): string; +} +export declare class RecipientId extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + toString(): string; +} +export declare class ThirdPartyCapId extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + toString(): string; +} +export declare class JoinKeyPart extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getJoinId(): number; + setJoinId(value: number): void; + getPartCount(): number; + setPartCount(value: number): void; + getPartNum(): number; + setPartNum(value: number): void; + toString(): string; +} +export declare class JoinResult extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getJoinId(): number; + setJoinId(value: number): void; + getSucceeded(): boolean; + setSucceeded(value: boolean): void; + adoptCap(value: capnp.Orphan<capnp.Pointer>): void; + disownCap(): capnp.Orphan<capnp.Pointer>; + getCap(): capnp.Pointer; + hasCap(): boolean; + setCap(value: capnp.Pointer): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js new file mode 100644 index 0000000..4ed0b3a --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js @@ -0,0 +1,64 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JoinResult = exports.JoinKeyPart = exports.ThirdPartyCapId = exports.RecipientId = exports.ProvisionId = exports.VatId = exports.Side = exports._capnpFileId = void 0; +const index_1 = require("../index"); +exports._capnpFileId = "a184c7885cdaf2a1"; +var Side; +(function (Side) { + Side[Side["SERVER"] = 0] = "SERVER"; + Side[Side["CLIENT"] = 1] = "CLIENT"; +})(Side = exports.Side || (exports.Side = {})); +class VatId extends index_1.Struct { + getSide() { return index_1.Struct.getUint16(0, this); } + setSide(value) { index_1.Struct.setUint16(0, value, this); } + toString() { return "VatId_" + super.toString(); } +} +exports.VatId = VatId; +VatId._capnp = { displayName: "VatId", id: "d20b909fee733a8e", size: new index_1.ObjectSize(8, 0) }; +class ProvisionId extends index_1.Struct { + getJoinId() { return index_1.Struct.getUint32(0, this); } + setJoinId(value) { index_1.Struct.setUint32(0, value, this); } + toString() { return "ProvisionId_" + super.toString(); } +} +exports.ProvisionId = ProvisionId; +ProvisionId._capnp = { displayName: "ProvisionId", id: "b88d09a9c5f39817", size: new index_1.ObjectSize(8, 0) }; +class RecipientId extends index_1.Struct { + toString() { return "RecipientId_" + super.toString(); } +} +exports.RecipientId = RecipientId; +RecipientId._capnp = { displayName: "RecipientId", id: "89f389b6fd4082c1", size: new index_1.ObjectSize(0, 0) }; +class ThirdPartyCapId extends index_1.Struct { + toString() { return "ThirdPartyCapId_" + super.toString(); } +} +exports.ThirdPartyCapId = ThirdPartyCapId; +ThirdPartyCapId._capnp = { displayName: "ThirdPartyCapId", id: "b47f4979672cb59d", size: new index_1.ObjectSize(0, 0) }; +class JoinKeyPart extends index_1.Struct { + getJoinId() { return index_1.Struct.getUint32(0, this); } + setJoinId(value) { index_1.Struct.setUint32(0, value, this); } + getPartCount() { return index_1.Struct.getUint16(4, this); } + setPartCount(value) { index_1.Struct.setUint16(4, value, this); } + getPartNum() { return index_1.Struct.getUint16(6, this); } + setPartNum(value) { index_1.Struct.setUint16(6, value, this); } + toString() { return "JoinKeyPart_" + super.toString(); } +} +exports.JoinKeyPart = JoinKeyPart; +JoinKeyPart._capnp = { displayName: "JoinKeyPart", id: "95b29059097fca83", size: new index_1.ObjectSize(8, 0) }; +class JoinResult extends index_1.Struct { + getJoinId() { return index_1.Struct.getUint32(0, this); } + setJoinId(value) { index_1.Struct.setUint32(0, value, this); } + getSucceeded() { return index_1.Struct.getBit(32, this); } + setSucceeded(value) { index_1.Struct.setBit(32, value, this); } + adoptCap(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownCap() { return index_1.Struct.disown(this.getCap()); } + getCap() { return index_1.Struct.getPointer(0, this); } + hasCap() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setCap(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "JoinResult_" + super.toString(); } +} +exports.JoinResult = JoinResult; +JoinResult._capnp = { displayName: "JoinResult", id: "9d263a3630b7ebee", size: new index_1.ObjectSize(8, 1) }; +//# sourceMappingURL=rpc-twoparty.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js.map b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js.map new file mode 100644 index 0000000..afde6d3 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rpc-twoparty.capnp.js","sourceRoot":"","sources":["rpc-twoparty.capnp.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AXnE,gCAYC;AAXmB,iBAAM,GAAG,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,kBAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.ts b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.ts new file mode 100644 index 0000000..e56cf78 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc-twoparty.capnp.ts @@ -0,0 +1,55 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "a184c7885cdaf2a1"; +export enum Side { + SERVER, + CLIENT +} +export class VatId extends __S { + static readonly _capnp = { displayName: "VatId", id: "d20b909fee733a8e", size: new __O(8, 0) }; + getSide(): Side { return __S.getUint16(0, this); } + setSide(value: Side): void { __S.setUint16(0, value, this); } + toString(): string { return "VatId_" + super.toString(); } +} +export class ProvisionId extends __S { + static readonly _capnp = { displayName: "ProvisionId", id: "b88d09a9c5f39817", size: new __O(8, 0) }; + getJoinId(): number { return __S.getUint32(0, this); } + setJoinId(value: number): void { __S.setUint32(0, value, this); } + toString(): string { return "ProvisionId_" + super.toString(); } +} +export class RecipientId extends __S { + static readonly _capnp = { displayName: "RecipientId", id: "89f389b6fd4082c1", size: new __O(0, 0) }; + toString(): string { return "RecipientId_" + super.toString(); } +} +export class ThirdPartyCapId extends __S { + static readonly _capnp = { displayName: "ThirdPartyCapId", id: "b47f4979672cb59d", size: new __O(0, 0) }; + toString(): string { return "ThirdPartyCapId_" + super.toString(); } +} +export class JoinKeyPart extends __S { + static readonly _capnp = { displayName: "JoinKeyPart", id: "95b29059097fca83", size: new __O(8, 0) }; + getJoinId(): number { return __S.getUint32(0, this); } + setJoinId(value: number): void { __S.setUint32(0, value, this); } + getPartCount(): number { return __S.getUint16(4, this); } + setPartCount(value: number): void { __S.setUint16(4, value, this); } + getPartNum(): number { return __S.getUint16(6, this); } + setPartNum(value: number): void { __S.setUint16(6, value, this); } + toString(): string { return "JoinKeyPart_" + super.toString(); } +} +export class JoinResult extends __S { + static readonly _capnp = { displayName: "JoinResult", id: "9d263a3630b7ebee", size: new __O(8, 1) }; + getJoinId(): number { return __S.getUint32(0, this); } + setJoinId(value: number): void { __S.setUint32(0, value, this); } + getSucceeded(): boolean { return __S.getBit(32, this); } + setSucceeded(value: boolean): void { __S.setBit(32, value, this); } + adoptCap(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownCap(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getCap()); } + getCap(): capnp.Pointer { return __S.getPointer(0, this); } + hasCap(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setCap(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "JoinResult_" + super.toString(); } +} diff --git a/node_modules/capnp-ts/src/std/rpc.capnp.d.ts b/node_modules/capnp-ts/src/std/rpc.capnp.d.ts new file mode 100644 index 0000000..9ce22ea --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc.capnp.d.ts @@ -0,0 +1,600 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +import * as capnp from "../index"; +import { Struct as __S } from "../index"; +export declare const _capnpFileId = "b312981b2552a250"; +export declare enum Message_Which { + UNIMPLEMENTED = 0, + ABORT = 1, + BOOTSTRAP = 8, + CALL = 2, + RETURN = 3, + FINISH = 4, + RESOLVE = 5, + RELEASE = 6, + DISEMBARGO = 13, + OBSOLETE_SAVE = 7, + OBSOLETE_DELETE = 9, + PROVIDE = 10, + ACCEPT = 11, + JOIN = 12 +} +export declare class Message extends __S { + static readonly UNIMPLEMENTED = Message_Which.UNIMPLEMENTED; + static readonly ABORT = Message_Which.ABORT; + static readonly BOOTSTRAP = Message_Which.BOOTSTRAP; + static readonly CALL = Message_Which.CALL; + static readonly RETURN = Message_Which.RETURN; + static readonly FINISH = Message_Which.FINISH; + static readonly RESOLVE = Message_Which.RESOLVE; + static readonly RELEASE = Message_Which.RELEASE; + static readonly DISEMBARGO = Message_Which.DISEMBARGO; + static readonly OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE; + static readonly OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE; + static readonly PROVIDE = Message_Which.PROVIDE; + static readonly ACCEPT = Message_Which.ACCEPT; + static readonly JOIN = Message_Which.JOIN; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptUnimplemented(value: capnp.Orphan<Message>): void; + disownUnimplemented(): capnp.Orphan<Message>; + getUnimplemented(): Message; + hasUnimplemented(): boolean; + initUnimplemented(): Message; + isUnimplemented(): boolean; + setUnimplemented(value: Message): void; + adoptAbort(value: capnp.Orphan<Exception>): void; + disownAbort(): capnp.Orphan<Exception>; + getAbort(): Exception; + hasAbort(): boolean; + initAbort(): Exception; + isAbort(): boolean; + setAbort(value: Exception): void; + adoptBootstrap(value: capnp.Orphan<Bootstrap>): void; + disownBootstrap(): capnp.Orphan<Bootstrap>; + getBootstrap(): Bootstrap; + hasBootstrap(): boolean; + initBootstrap(): Bootstrap; + isBootstrap(): boolean; + setBootstrap(value: Bootstrap): void; + adoptCall(value: capnp.Orphan<Call>): void; + disownCall(): capnp.Orphan<Call>; + getCall(): Call; + hasCall(): boolean; + initCall(): Call; + isCall(): boolean; + setCall(value: Call): void; + adoptReturn(value: capnp.Orphan<Return>): void; + disownReturn(): capnp.Orphan<Return>; + getReturn(): Return; + hasReturn(): boolean; + initReturn(): Return; + isReturn(): boolean; + setReturn(value: Return): void; + adoptFinish(value: capnp.Orphan<Finish>): void; + disownFinish(): capnp.Orphan<Finish>; + getFinish(): Finish; + hasFinish(): boolean; + initFinish(): Finish; + isFinish(): boolean; + setFinish(value: Finish): void; + adoptResolve(value: capnp.Orphan<Resolve>): void; + disownResolve(): capnp.Orphan<Resolve>; + getResolve(): Resolve; + hasResolve(): boolean; + initResolve(): Resolve; + isResolve(): boolean; + setResolve(value: Resolve): void; + adoptRelease(value: capnp.Orphan<Release>): void; + disownRelease(): capnp.Orphan<Release>; + getRelease(): Release; + hasRelease(): boolean; + initRelease(): Release; + isRelease(): boolean; + setRelease(value: Release): void; + adoptDisembargo(value: capnp.Orphan<Disembargo>): void; + disownDisembargo(): capnp.Orphan<Disembargo>; + getDisembargo(): Disembargo; + hasDisembargo(): boolean; + initDisembargo(): Disembargo; + isDisembargo(): boolean; + setDisembargo(value: Disembargo): void; + adoptObsoleteSave(value: capnp.Orphan<capnp.Pointer>): void; + disownObsoleteSave(): capnp.Orphan<capnp.Pointer>; + getObsoleteSave(): capnp.Pointer; + hasObsoleteSave(): boolean; + isObsoleteSave(): boolean; + setObsoleteSave(value: capnp.Pointer): void; + adoptObsoleteDelete(value: capnp.Orphan<capnp.Pointer>): void; + disownObsoleteDelete(): capnp.Orphan<capnp.Pointer>; + getObsoleteDelete(): capnp.Pointer; + hasObsoleteDelete(): boolean; + isObsoleteDelete(): boolean; + setObsoleteDelete(value: capnp.Pointer): void; + adoptProvide(value: capnp.Orphan<Provide>): void; + disownProvide(): capnp.Orphan<Provide>; + getProvide(): Provide; + hasProvide(): boolean; + initProvide(): Provide; + isProvide(): boolean; + setProvide(value: Provide): void; + adoptAccept(value: capnp.Orphan<Accept>): void; + disownAccept(): capnp.Orphan<Accept>; + getAccept(): Accept; + hasAccept(): boolean; + initAccept(): Accept; + isAccept(): boolean; + setAccept(value: Accept): void; + adoptJoin(value: capnp.Orphan<Join>): void; + disownJoin(): capnp.Orphan<Join>; + getJoin(): Join; + hasJoin(): boolean; + initJoin(): Join; + isJoin(): boolean; + setJoin(value: Join): void; + toString(): string; + which(): Message_Which; +} +export declare class Bootstrap extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptDeprecatedObjectId(value: capnp.Orphan<capnp.Pointer>): void; + disownDeprecatedObjectId(): capnp.Orphan<capnp.Pointer>; + getDeprecatedObjectId(): capnp.Pointer; + hasDeprecatedObjectId(): boolean; + setDeprecatedObjectId(value: capnp.Pointer): void; + toString(): string; +} +export declare enum Call_SendResultsTo_Which { + CALLER = 0, + YOURSELF = 1, + THIRD_PARTY = 2 +} +export declare class Call_SendResultsTo extends __S { + static readonly CALLER = Call_SendResultsTo_Which.CALLER; + static readonly YOURSELF = Call_SendResultsTo_Which.YOURSELF; + static readonly THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isCaller(): boolean; + setCaller(): void; + isYourself(): boolean; + setYourself(): void; + adoptThirdParty(value: capnp.Orphan<capnp.Pointer>): void; + disownThirdParty(): capnp.Orphan<capnp.Pointer>; + getThirdParty(): capnp.Pointer; + hasThirdParty(): boolean; + isThirdParty(): boolean; + setThirdParty(value: capnp.Pointer): void; + toString(): string; + which(): Call_SendResultsTo_Which; +} +export declare class Call extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + defaultAllowThirdPartyTailCall: DataView; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptTarget(value: capnp.Orphan<MessageTarget>): void; + disownTarget(): capnp.Orphan<MessageTarget>; + getTarget(): MessageTarget; + hasTarget(): boolean; + initTarget(): MessageTarget; + setTarget(value: MessageTarget): void; + getInterfaceId(): capnp.Uint64; + setInterfaceId(value: capnp.Uint64): void; + getMethodId(): number; + setMethodId(value: number): void; + getAllowThirdPartyTailCall(): boolean; + setAllowThirdPartyTailCall(value: boolean): void; + adoptParams(value: capnp.Orphan<Payload>): void; + disownParams(): capnp.Orphan<Payload>; + getParams(): Payload; + hasParams(): boolean; + initParams(): Payload; + setParams(value: Payload): void; + getSendResultsTo(): Call_SendResultsTo; + initSendResultsTo(): Call_SendResultsTo; + toString(): string; +} +export declare enum Return_Which { + RESULTS = 0, + EXCEPTION = 1, + CANCELED = 2, + RESULTS_SENT_ELSEWHERE = 3, + TAKE_FROM_OTHER_QUESTION = 4, + ACCEPT_FROM_THIRD_PARTY = 5 +} +export declare class Return extends __S { + static readonly RESULTS = Return_Which.RESULTS; + static readonly EXCEPTION = Return_Which.EXCEPTION; + static readonly CANCELED = Return_Which.CANCELED; + static readonly RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE; + static readonly TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION; + static readonly ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + defaultReleaseParamCaps: DataView; + }; + getAnswerId(): number; + setAnswerId(value: number): void; + getReleaseParamCaps(): boolean; + setReleaseParamCaps(value: boolean): void; + adoptResults(value: capnp.Orphan<Payload>): void; + disownResults(): capnp.Orphan<Payload>; + getResults(): Payload; + hasResults(): boolean; + initResults(): Payload; + isResults(): boolean; + setResults(value: Payload): void; + adoptException(value: capnp.Orphan<Exception>): void; + disownException(): capnp.Orphan<Exception>; + getException(): Exception; + hasException(): boolean; + initException(): Exception; + isException(): boolean; + setException(value: Exception): void; + isCanceled(): boolean; + setCanceled(): void; + isResultsSentElsewhere(): boolean; + setResultsSentElsewhere(): void; + getTakeFromOtherQuestion(): number; + isTakeFromOtherQuestion(): boolean; + setTakeFromOtherQuestion(value: number): void; + adoptAcceptFromThirdParty(value: capnp.Orphan<capnp.Pointer>): void; + disownAcceptFromThirdParty(): capnp.Orphan<capnp.Pointer>; + getAcceptFromThirdParty(): capnp.Pointer; + hasAcceptFromThirdParty(): boolean; + isAcceptFromThirdParty(): boolean; + setAcceptFromThirdParty(value: capnp.Pointer): void; + toString(): string; + which(): Return_Which; +} +export declare class Finish extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + defaultReleaseResultCaps: DataView; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + getReleaseResultCaps(): boolean; + setReleaseResultCaps(value: boolean): void; + toString(): string; +} +export declare enum Resolve_Which { + CAP = 0, + EXCEPTION = 1 +} +export declare class Resolve extends __S { + static readonly CAP = Resolve_Which.CAP; + static readonly EXCEPTION = Resolve_Which.EXCEPTION; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getPromiseId(): number; + setPromiseId(value: number): void; + adoptCap(value: capnp.Orphan<CapDescriptor>): void; + disownCap(): capnp.Orphan<CapDescriptor>; + getCap(): CapDescriptor; + hasCap(): boolean; + initCap(): CapDescriptor; + isCap(): boolean; + setCap(value: CapDescriptor): void; + adoptException(value: capnp.Orphan<Exception>): void; + disownException(): capnp.Orphan<Exception>; + getException(): Exception; + hasException(): boolean; + initException(): Exception; + isException(): boolean; + setException(value: Exception): void; + toString(): string; + which(): Resolve_Which; +} +export declare class Release extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getId(): number; + setId(value: number): void; + getReferenceCount(): number; + setReferenceCount(value: number): void; + toString(): string; +} +export declare enum Disembargo_Context_Which { + SENDER_LOOPBACK = 0, + RECEIVER_LOOPBACK = 1, + ACCEPT = 2, + PROVIDE = 3 +} +export declare class Disembargo_Context extends __S { + static readonly SENDER_LOOPBACK = Disembargo_Context_Which.SENDER_LOOPBACK; + static readonly RECEIVER_LOOPBACK = Disembargo_Context_Which.RECEIVER_LOOPBACK; + static readonly ACCEPT = Disembargo_Context_Which.ACCEPT; + static readonly PROVIDE = Disembargo_Context_Which.PROVIDE; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getSenderLoopback(): number; + isSenderLoopback(): boolean; + setSenderLoopback(value: number): void; + getReceiverLoopback(): number; + isReceiverLoopback(): boolean; + setReceiverLoopback(value: number): void; + isAccept(): boolean; + setAccept(): void; + getProvide(): number; + isProvide(): boolean; + setProvide(value: number): void; + toString(): string; + which(): Disembargo_Context_Which; +} +export declare class Disembargo extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptTarget(value: capnp.Orphan<MessageTarget>): void; + disownTarget(): capnp.Orphan<MessageTarget>; + getTarget(): MessageTarget; + hasTarget(): boolean; + initTarget(): MessageTarget; + setTarget(value: MessageTarget): void; + getContext(): Disembargo_Context; + initContext(): Disembargo_Context; + toString(): string; +} +export declare class Provide extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptTarget(value: capnp.Orphan<MessageTarget>): void; + disownTarget(): capnp.Orphan<MessageTarget>; + getTarget(): MessageTarget; + hasTarget(): boolean; + initTarget(): MessageTarget; + setTarget(value: MessageTarget): void; + adoptRecipient(value: capnp.Orphan<capnp.Pointer>): void; + disownRecipient(): capnp.Orphan<capnp.Pointer>; + getRecipient(): capnp.Pointer; + hasRecipient(): boolean; + setRecipient(value: capnp.Pointer): void; + toString(): string; +} +export declare class Accept extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptProvision(value: capnp.Orphan<capnp.Pointer>): void; + disownProvision(): capnp.Orphan<capnp.Pointer>; + getProvision(): capnp.Pointer; + hasProvision(): boolean; + setProvision(value: capnp.Pointer): void; + getEmbargo(): boolean; + setEmbargo(value: boolean): void; + toString(): string; +} +export declare class Join extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptTarget(value: capnp.Orphan<MessageTarget>): void; + disownTarget(): capnp.Orphan<MessageTarget>; + getTarget(): MessageTarget; + hasTarget(): boolean; + initTarget(): MessageTarget; + setTarget(value: MessageTarget): void; + adoptKeyPart(value: capnp.Orphan<capnp.Pointer>): void; + disownKeyPart(): capnp.Orphan<capnp.Pointer>; + getKeyPart(): capnp.Pointer; + hasKeyPart(): boolean; + setKeyPart(value: capnp.Pointer): void; + toString(): string; +} +export declare enum MessageTarget_Which { + IMPORTED_CAP = 0, + PROMISED_ANSWER = 1 +} +export declare class MessageTarget extends __S { + static readonly IMPORTED_CAP = MessageTarget_Which.IMPORTED_CAP; + static readonly PROMISED_ANSWER = MessageTarget_Which.PROMISED_ANSWER; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getImportedCap(): number; + isImportedCap(): boolean; + setImportedCap(value: number): void; + adoptPromisedAnswer(value: capnp.Orphan<PromisedAnswer>): void; + disownPromisedAnswer(): capnp.Orphan<PromisedAnswer>; + getPromisedAnswer(): PromisedAnswer; + hasPromisedAnswer(): boolean; + initPromisedAnswer(): PromisedAnswer; + isPromisedAnswer(): boolean; + setPromisedAnswer(value: PromisedAnswer): void; + toString(): string; + which(): MessageTarget_Which; +} +export declare class Payload extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _CapTable: capnp.ListCtor<CapDescriptor>; + adoptContent(value: capnp.Orphan<capnp.Pointer>): void; + disownContent(): capnp.Orphan<capnp.Pointer>; + getContent(): capnp.Pointer; + hasContent(): boolean; + setContent(value: capnp.Pointer): void; + adoptCapTable(value: capnp.Orphan<capnp.List<CapDescriptor>>): void; + disownCapTable(): capnp.Orphan<capnp.List<CapDescriptor>>; + getCapTable(): capnp.List<CapDescriptor>; + hasCapTable(): boolean; + initCapTable(length: number): capnp.List<CapDescriptor>; + setCapTable(value: capnp.List<CapDescriptor>): void; + toString(): string; +} +export declare enum CapDescriptor_Which { + NONE = 0, + SENDER_HOSTED = 1, + SENDER_PROMISE = 2, + RECEIVER_HOSTED = 3, + RECEIVER_ANSWER = 4, + THIRD_PARTY_HOSTED = 5 +} +export declare class CapDescriptor extends __S { + static readonly NONE = CapDescriptor_Which.NONE; + static readonly SENDER_HOSTED = CapDescriptor_Which.SENDER_HOSTED; + static readonly SENDER_PROMISE = CapDescriptor_Which.SENDER_PROMISE; + static readonly RECEIVER_HOSTED = CapDescriptor_Which.RECEIVER_HOSTED; + static readonly RECEIVER_ANSWER = CapDescriptor_Which.RECEIVER_ANSWER; + static readonly THIRD_PARTY_HOSTED = CapDescriptor_Which.THIRD_PARTY_HOSTED; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isNone(): boolean; + setNone(): void; + getSenderHosted(): number; + isSenderHosted(): boolean; + setSenderHosted(value: number): void; + getSenderPromise(): number; + isSenderPromise(): boolean; + setSenderPromise(value: number): void; + getReceiverHosted(): number; + isReceiverHosted(): boolean; + setReceiverHosted(value: number): void; + adoptReceiverAnswer(value: capnp.Orphan<PromisedAnswer>): void; + disownReceiverAnswer(): capnp.Orphan<PromisedAnswer>; + getReceiverAnswer(): PromisedAnswer; + hasReceiverAnswer(): boolean; + initReceiverAnswer(): PromisedAnswer; + isReceiverAnswer(): boolean; + setReceiverAnswer(value: PromisedAnswer): void; + adoptThirdPartyHosted(value: capnp.Orphan<ThirdPartyCapDescriptor>): void; + disownThirdPartyHosted(): capnp.Orphan<ThirdPartyCapDescriptor>; + getThirdPartyHosted(): ThirdPartyCapDescriptor; + hasThirdPartyHosted(): boolean; + initThirdPartyHosted(): ThirdPartyCapDescriptor; + isThirdPartyHosted(): boolean; + setThirdPartyHosted(value: ThirdPartyCapDescriptor): void; + toString(): string; + which(): CapDescriptor_Which; +} +export declare enum PromisedAnswer_Op_Which { + NOOP = 0, + GET_POINTER_FIELD = 1 +} +export declare class PromisedAnswer_Op extends __S { + static readonly NOOP = PromisedAnswer_Op_Which.NOOP; + static readonly GET_POINTER_FIELD = PromisedAnswer_Op_Which.GET_POINTER_FIELD; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isNoop(): boolean; + setNoop(): void; + getGetPointerField(): number; + isGetPointerField(): boolean; + setGetPointerField(value: number): void; + toString(): string; + which(): PromisedAnswer_Op_Which; +} +export declare class PromisedAnswer extends __S { + static readonly Op: typeof PromisedAnswer_Op; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Transform: capnp.ListCtor<PromisedAnswer_Op>; + getQuestionId(): number; + setQuestionId(value: number): void; + adoptTransform(value: capnp.Orphan<capnp.List<PromisedAnswer_Op>>): void; + disownTransform(): capnp.Orphan<capnp.List<PromisedAnswer_Op>>; + getTransform(): capnp.List<PromisedAnswer_Op>; + hasTransform(): boolean; + initTransform(length: number): capnp.List<PromisedAnswer_Op>; + setTransform(value: capnp.List<PromisedAnswer_Op>): void; + toString(): string; +} +export declare class ThirdPartyCapDescriptor extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptId(value: capnp.Orphan<capnp.Pointer>): void; + disownId(): capnp.Orphan<capnp.Pointer>; + getId(): capnp.Pointer; + hasId(): boolean; + setId(value: capnp.Pointer): void; + getVineId(): number; + setVineId(value: number): void; + toString(): string; +} +export declare enum Exception_Type { + FAILED = 0, + OVERLOADED = 1, + DISCONNECTED = 2, + UNIMPLEMENTED = 3 +} +export declare class Exception extends __S { + static readonly Type: typeof Exception_Type; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getReason(): string; + setReason(value: string): void; + getType(): Exception_Type; + setType(value: Exception_Type): void; + getObsoleteIsCallersFault(): boolean; + setObsoleteIsCallersFault(value: boolean): void; + getObsoleteDurability(): number; + setObsoleteDurability(value: number): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/std/rpc.capnp.js b/node_modules/capnp-ts/src/std/rpc.capnp.js new file mode 100644 index 0000000..4947725 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc.capnp.js @@ -0,0 +1,869 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Exception = exports.Exception_Type = exports.ThirdPartyCapDescriptor = exports.PromisedAnswer = exports.PromisedAnswer_Op = exports.PromisedAnswer_Op_Which = exports.CapDescriptor = exports.CapDescriptor_Which = exports.Payload = exports.MessageTarget = exports.MessageTarget_Which = exports.Join = exports.Accept = exports.Provide = exports.Disembargo = exports.Disembargo_Context = exports.Disembargo_Context_Which = exports.Release = exports.Resolve = exports.Resolve_Which = exports.Finish = exports.Return = exports.Return_Which = exports.Call = exports.Call_SendResultsTo = exports.Call_SendResultsTo_Which = exports.Bootstrap = exports.Message = exports.Message_Which = exports._capnpFileId = void 0; +const tslib_1 = require("tslib"); +const capnp = tslib_1.__importStar(require("../index")); +const index_1 = require("../index"); +exports._capnpFileId = "b312981b2552a250"; +var Message_Which; +(function (Message_Which) { + Message_Which[Message_Which["UNIMPLEMENTED"] = 0] = "UNIMPLEMENTED"; + Message_Which[Message_Which["ABORT"] = 1] = "ABORT"; + Message_Which[Message_Which["BOOTSTRAP"] = 8] = "BOOTSTRAP"; + Message_Which[Message_Which["CALL"] = 2] = "CALL"; + Message_Which[Message_Which["RETURN"] = 3] = "RETURN"; + Message_Which[Message_Which["FINISH"] = 4] = "FINISH"; + Message_Which[Message_Which["RESOLVE"] = 5] = "RESOLVE"; + Message_Which[Message_Which["RELEASE"] = 6] = "RELEASE"; + Message_Which[Message_Which["DISEMBARGO"] = 13] = "DISEMBARGO"; + Message_Which[Message_Which["OBSOLETE_SAVE"] = 7] = "OBSOLETE_SAVE"; + Message_Which[Message_Which["OBSOLETE_DELETE"] = 9] = "OBSOLETE_DELETE"; + Message_Which[Message_Which["PROVIDE"] = 10] = "PROVIDE"; + Message_Which[Message_Which["ACCEPT"] = 11] = "ACCEPT"; + Message_Which[Message_Which["JOIN"] = 12] = "JOIN"; +})(Message_Which = exports.Message_Which || (exports.Message_Which = {})); +class Message extends index_1.Struct { + adoptUnimplemented(value) { + index_1.Struct.setUint16(0, 0, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownUnimplemented() { return index_1.Struct.disown(this.getUnimplemented()); } + getUnimplemented() { + index_1.Struct.testWhich("unimplemented", index_1.Struct.getUint16(0, this), 0, this); + return index_1.Struct.getStruct(0, Message, this); + } + hasUnimplemented() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initUnimplemented() { + index_1.Struct.setUint16(0, 0, this); + return index_1.Struct.initStructAt(0, Message, this); + } + isUnimplemented() { return index_1.Struct.getUint16(0, this) === 0; } + setUnimplemented(value) { + index_1.Struct.setUint16(0, 0, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptAbort(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownAbort() { return index_1.Struct.disown(this.getAbort()); } + getAbort() { + index_1.Struct.testWhich("abort", index_1.Struct.getUint16(0, this), 1, this); + return index_1.Struct.getStruct(0, Exception, this); + } + hasAbort() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initAbort() { + index_1.Struct.setUint16(0, 1, this); + return index_1.Struct.initStructAt(0, Exception, this); + } + isAbort() { return index_1.Struct.getUint16(0, this) === 1; } + setAbort(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptBootstrap(value) { + index_1.Struct.setUint16(0, 8, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownBootstrap() { return index_1.Struct.disown(this.getBootstrap()); } + getBootstrap() { + index_1.Struct.testWhich("bootstrap", index_1.Struct.getUint16(0, this), 8, this); + return index_1.Struct.getStruct(0, Bootstrap, this); + } + hasBootstrap() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBootstrap() { + index_1.Struct.setUint16(0, 8, this); + return index_1.Struct.initStructAt(0, Bootstrap, this); + } + isBootstrap() { return index_1.Struct.getUint16(0, this) === 8; } + setBootstrap(value) { + index_1.Struct.setUint16(0, 8, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptCall(value) { + index_1.Struct.setUint16(0, 2, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownCall() { return index_1.Struct.disown(this.getCall()); } + getCall() { + index_1.Struct.testWhich("call", index_1.Struct.getUint16(0, this), 2, this); + return index_1.Struct.getStruct(0, Call, this); + } + hasCall() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initCall() { + index_1.Struct.setUint16(0, 2, this); + return index_1.Struct.initStructAt(0, Call, this); + } + isCall() { return index_1.Struct.getUint16(0, this) === 2; } + setCall(value) { + index_1.Struct.setUint16(0, 2, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptReturn(value) { + index_1.Struct.setUint16(0, 3, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownReturn() { return index_1.Struct.disown(this.getReturn()); } + getReturn() { + index_1.Struct.testWhich("return", index_1.Struct.getUint16(0, this), 3, this); + return index_1.Struct.getStruct(0, Return, this); + } + hasReturn() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initReturn() { + index_1.Struct.setUint16(0, 3, this); + return index_1.Struct.initStructAt(0, Return, this); + } + isReturn() { return index_1.Struct.getUint16(0, this) === 3; } + setReturn(value) { + index_1.Struct.setUint16(0, 3, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptFinish(value) { + index_1.Struct.setUint16(0, 4, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownFinish() { return index_1.Struct.disown(this.getFinish()); } + getFinish() { + index_1.Struct.testWhich("finish", index_1.Struct.getUint16(0, this), 4, this); + return index_1.Struct.getStruct(0, Finish, this); + } + hasFinish() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initFinish() { + index_1.Struct.setUint16(0, 4, this); + return index_1.Struct.initStructAt(0, Finish, this); + } + isFinish() { return index_1.Struct.getUint16(0, this) === 4; } + setFinish(value) { + index_1.Struct.setUint16(0, 4, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptResolve(value) { + index_1.Struct.setUint16(0, 5, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownResolve() { return index_1.Struct.disown(this.getResolve()); } + getResolve() { + index_1.Struct.testWhich("resolve", index_1.Struct.getUint16(0, this), 5, this); + return index_1.Struct.getStruct(0, Resolve, this); + } + hasResolve() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initResolve() { + index_1.Struct.setUint16(0, 5, this); + return index_1.Struct.initStructAt(0, Resolve, this); + } + isResolve() { return index_1.Struct.getUint16(0, this) === 5; } + setResolve(value) { + index_1.Struct.setUint16(0, 5, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptRelease(value) { + index_1.Struct.setUint16(0, 6, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownRelease() { return index_1.Struct.disown(this.getRelease()); } + getRelease() { + index_1.Struct.testWhich("release", index_1.Struct.getUint16(0, this), 6, this); + return index_1.Struct.getStruct(0, Release, this); + } + hasRelease() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initRelease() { + index_1.Struct.setUint16(0, 6, this); + return index_1.Struct.initStructAt(0, Release, this); + } + isRelease() { return index_1.Struct.getUint16(0, this) === 6; } + setRelease(value) { + index_1.Struct.setUint16(0, 6, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptDisembargo(value) { + index_1.Struct.setUint16(0, 13, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownDisembargo() { return index_1.Struct.disown(this.getDisembargo()); } + getDisembargo() { + index_1.Struct.testWhich("disembargo", index_1.Struct.getUint16(0, this), 13, this); + return index_1.Struct.getStruct(0, Disembargo, this); + } + hasDisembargo() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initDisembargo() { + index_1.Struct.setUint16(0, 13, this); + return index_1.Struct.initStructAt(0, Disembargo, this); + } + isDisembargo() { return index_1.Struct.getUint16(0, this) === 13; } + setDisembargo(value) { + index_1.Struct.setUint16(0, 13, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptObsoleteSave(value) { + index_1.Struct.setUint16(0, 7, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownObsoleteSave() { return index_1.Struct.disown(this.getObsoleteSave()); } + getObsoleteSave() { + index_1.Struct.testWhich("obsoleteSave", index_1.Struct.getUint16(0, this), 7, this); + return index_1.Struct.getPointer(0, this); + } + hasObsoleteSave() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isObsoleteSave() { return index_1.Struct.getUint16(0, this) === 7; } + setObsoleteSave(value) { + index_1.Struct.setUint16(0, 7, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptObsoleteDelete(value) { + index_1.Struct.setUint16(0, 9, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownObsoleteDelete() { return index_1.Struct.disown(this.getObsoleteDelete()); } + getObsoleteDelete() { + index_1.Struct.testWhich("obsoleteDelete", index_1.Struct.getUint16(0, this), 9, this); + return index_1.Struct.getPointer(0, this); + } + hasObsoleteDelete() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isObsoleteDelete() { return index_1.Struct.getUint16(0, this) === 9; } + setObsoleteDelete(value) { + index_1.Struct.setUint16(0, 9, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptProvide(value) { + index_1.Struct.setUint16(0, 10, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownProvide() { return index_1.Struct.disown(this.getProvide()); } + getProvide() { + index_1.Struct.testWhich("provide", index_1.Struct.getUint16(0, this), 10, this); + return index_1.Struct.getStruct(0, Provide, this); + } + hasProvide() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initProvide() { + index_1.Struct.setUint16(0, 10, this); + return index_1.Struct.initStructAt(0, Provide, this); + } + isProvide() { return index_1.Struct.getUint16(0, this) === 10; } + setProvide(value) { + index_1.Struct.setUint16(0, 10, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptAccept(value) { + index_1.Struct.setUint16(0, 11, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownAccept() { return index_1.Struct.disown(this.getAccept()); } + getAccept() { + index_1.Struct.testWhich("accept", index_1.Struct.getUint16(0, this), 11, this); + return index_1.Struct.getStruct(0, Accept, this); + } + hasAccept() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initAccept() { + index_1.Struct.setUint16(0, 11, this); + return index_1.Struct.initStructAt(0, Accept, this); + } + isAccept() { return index_1.Struct.getUint16(0, this) === 11; } + setAccept(value) { + index_1.Struct.setUint16(0, 11, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptJoin(value) { + index_1.Struct.setUint16(0, 12, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownJoin() { return index_1.Struct.disown(this.getJoin()); } + getJoin() { + index_1.Struct.testWhich("join", index_1.Struct.getUint16(0, this), 12, this); + return index_1.Struct.getStruct(0, Join, this); + } + hasJoin() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initJoin() { + index_1.Struct.setUint16(0, 12, this); + return index_1.Struct.initStructAt(0, Join, this); + } + isJoin() { return index_1.Struct.getUint16(0, this) === 12; } + setJoin(value) { + index_1.Struct.setUint16(0, 12, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "Message_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.Message = Message; +Message.UNIMPLEMENTED = Message_Which.UNIMPLEMENTED; +Message.ABORT = Message_Which.ABORT; +Message.BOOTSTRAP = Message_Which.BOOTSTRAP; +Message.CALL = Message_Which.CALL; +Message.RETURN = Message_Which.RETURN; +Message.FINISH = Message_Which.FINISH; +Message.RESOLVE = Message_Which.RESOLVE; +Message.RELEASE = Message_Which.RELEASE; +Message.DISEMBARGO = Message_Which.DISEMBARGO; +Message.OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE; +Message.OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE; +Message.PROVIDE = Message_Which.PROVIDE; +Message.ACCEPT = Message_Which.ACCEPT; +Message.JOIN = Message_Which.JOIN; +Message._capnp = { displayName: "Message", id: "91b79f1f808db032", size: new index_1.ObjectSize(8, 1) }; +class Bootstrap extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptDeprecatedObjectId(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownDeprecatedObjectId() { return index_1.Struct.disown(this.getDeprecatedObjectId()); } + getDeprecatedObjectId() { return index_1.Struct.getPointer(0, this); } + hasDeprecatedObjectId() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setDeprecatedObjectId(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Bootstrap_" + super.toString(); } +} +exports.Bootstrap = Bootstrap; +Bootstrap._capnp = { displayName: "Bootstrap", id: "e94ccf8031176ec4", size: new index_1.ObjectSize(8, 1) }; +var Call_SendResultsTo_Which; +(function (Call_SendResultsTo_Which) { + Call_SendResultsTo_Which[Call_SendResultsTo_Which["CALLER"] = 0] = "CALLER"; + Call_SendResultsTo_Which[Call_SendResultsTo_Which["YOURSELF"] = 1] = "YOURSELF"; + Call_SendResultsTo_Which[Call_SendResultsTo_Which["THIRD_PARTY"] = 2] = "THIRD_PARTY"; +})(Call_SendResultsTo_Which = exports.Call_SendResultsTo_Which || (exports.Call_SendResultsTo_Which = {})); +class Call_SendResultsTo extends index_1.Struct { + isCaller() { return index_1.Struct.getUint16(6, this) === 0; } + setCaller() { index_1.Struct.setUint16(6, 0, this); } + isYourself() { return index_1.Struct.getUint16(6, this) === 1; } + setYourself() { index_1.Struct.setUint16(6, 1, this); } + adoptThirdParty(value) { + index_1.Struct.setUint16(6, 2, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(2, this)); + } + disownThirdParty() { return index_1.Struct.disown(this.getThirdParty()); } + getThirdParty() { + index_1.Struct.testWhich("thirdParty", index_1.Struct.getUint16(6, this), 2, this); + return index_1.Struct.getPointer(2, this); + } + hasThirdParty() { return !index_1.Struct.isNull(index_1.Struct.getPointer(2, this)); } + isThirdParty() { return index_1.Struct.getUint16(6, this) === 2; } + setThirdParty(value) { + index_1.Struct.setUint16(6, 2, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(2, this)); + } + toString() { return "Call_SendResultsTo_" + super.toString(); } + which() { return index_1.Struct.getUint16(6, this); } +} +exports.Call_SendResultsTo = Call_SendResultsTo; +Call_SendResultsTo.CALLER = Call_SendResultsTo_Which.CALLER; +Call_SendResultsTo.YOURSELF = Call_SendResultsTo_Which.YOURSELF; +Call_SendResultsTo.THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY; +Call_SendResultsTo._capnp = { displayName: "sendResultsTo", id: "dae8b0f61aab5f99", size: new index_1.ObjectSize(24, 3) }; +class Call extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptTarget(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownTarget() { return index_1.Struct.disown(this.getTarget()); } + getTarget() { return index_1.Struct.getStruct(0, MessageTarget, this); } + hasTarget() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initTarget() { return index_1.Struct.initStructAt(0, MessageTarget, this); } + setTarget(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + getInterfaceId() { return index_1.Struct.getUint64(8, this); } + setInterfaceId(value) { index_1.Struct.setUint64(8, value, this); } + getMethodId() { return index_1.Struct.getUint16(4, this); } + setMethodId(value) { index_1.Struct.setUint16(4, value, this); } + getAllowThirdPartyTailCall() { return index_1.Struct.getBit(128, this, Call._capnp.defaultAllowThirdPartyTailCall); } + setAllowThirdPartyTailCall(value) { index_1.Struct.setBit(128, value, this); } + adoptParams(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownParams() { return index_1.Struct.disown(this.getParams()); } + getParams() { return index_1.Struct.getStruct(1, Payload, this); } + hasParams() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initParams() { return index_1.Struct.initStructAt(1, Payload, this); } + setParams(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + getSendResultsTo() { return index_1.Struct.getAs(Call_SendResultsTo, this); } + initSendResultsTo() { return index_1.Struct.getAs(Call_SendResultsTo, this); } + toString() { return "Call_" + super.toString(); } +} +exports.Call = Call; +Call._capnp = { displayName: "Call", id: "836a53ce789d4cd4", size: new index_1.ObjectSize(24, 3), defaultAllowThirdPartyTailCall: capnp.getBitMask(false, 0) }; +var Return_Which; +(function (Return_Which) { + Return_Which[Return_Which["RESULTS"] = 0] = "RESULTS"; + Return_Which[Return_Which["EXCEPTION"] = 1] = "EXCEPTION"; + Return_Which[Return_Which["CANCELED"] = 2] = "CANCELED"; + Return_Which[Return_Which["RESULTS_SENT_ELSEWHERE"] = 3] = "RESULTS_SENT_ELSEWHERE"; + Return_Which[Return_Which["TAKE_FROM_OTHER_QUESTION"] = 4] = "TAKE_FROM_OTHER_QUESTION"; + Return_Which[Return_Which["ACCEPT_FROM_THIRD_PARTY"] = 5] = "ACCEPT_FROM_THIRD_PARTY"; +})(Return_Which = exports.Return_Which || (exports.Return_Which = {})); +class Return extends index_1.Struct { + getAnswerId() { return index_1.Struct.getUint32(0, this); } + setAnswerId(value) { index_1.Struct.setUint32(0, value, this); } + getReleaseParamCaps() { return index_1.Struct.getBit(32, this, Return._capnp.defaultReleaseParamCaps); } + setReleaseParamCaps(value) { index_1.Struct.setBit(32, value, this); } + adoptResults(value) { + index_1.Struct.setUint16(6, 0, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownResults() { return index_1.Struct.disown(this.getResults()); } + getResults() { + index_1.Struct.testWhich("results", index_1.Struct.getUint16(6, this), 0, this); + return index_1.Struct.getStruct(0, Payload, this); + } + hasResults() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initResults() { + index_1.Struct.setUint16(6, 0, this); + return index_1.Struct.initStructAt(0, Payload, this); + } + isResults() { return index_1.Struct.getUint16(6, this) === 0; } + setResults(value) { + index_1.Struct.setUint16(6, 0, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptException(value) { + index_1.Struct.setUint16(6, 1, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownException() { return index_1.Struct.disown(this.getException()); } + getException() { + index_1.Struct.testWhich("exception", index_1.Struct.getUint16(6, this), 1, this); + return index_1.Struct.getStruct(0, Exception, this); + } + hasException() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initException() { + index_1.Struct.setUint16(6, 1, this); + return index_1.Struct.initStructAt(0, Exception, this); + } + isException() { return index_1.Struct.getUint16(6, this) === 1; } + setException(value) { + index_1.Struct.setUint16(6, 1, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + isCanceled() { return index_1.Struct.getUint16(6, this) === 2; } + setCanceled() { index_1.Struct.setUint16(6, 2, this); } + isResultsSentElsewhere() { return index_1.Struct.getUint16(6, this) === 3; } + setResultsSentElsewhere() { index_1.Struct.setUint16(6, 3, this); } + getTakeFromOtherQuestion() { + index_1.Struct.testWhich("takeFromOtherQuestion", index_1.Struct.getUint16(6, this), 4, this); + return index_1.Struct.getUint32(8, this); + } + isTakeFromOtherQuestion() { return index_1.Struct.getUint16(6, this) === 4; } + setTakeFromOtherQuestion(value) { + index_1.Struct.setUint16(6, 4, this); + index_1.Struct.setUint32(8, value, this); + } + adoptAcceptFromThirdParty(value) { + index_1.Struct.setUint16(6, 5, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownAcceptFromThirdParty() { return index_1.Struct.disown(this.getAcceptFromThirdParty()); } + getAcceptFromThirdParty() { + index_1.Struct.testWhich("acceptFromThirdParty", index_1.Struct.getUint16(6, this), 5, this); + return index_1.Struct.getPointer(0, this); + } + hasAcceptFromThirdParty() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isAcceptFromThirdParty() { return index_1.Struct.getUint16(6, this) === 5; } + setAcceptFromThirdParty(value) { + index_1.Struct.setUint16(6, 5, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "Return_" + super.toString(); } + which() { return index_1.Struct.getUint16(6, this); } +} +exports.Return = Return; +Return.RESULTS = Return_Which.RESULTS; +Return.EXCEPTION = Return_Which.EXCEPTION; +Return.CANCELED = Return_Which.CANCELED; +Return.RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE; +Return.TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION; +Return.ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY; +Return._capnp = { displayName: "Return", id: "9e19b28d3db3573a", size: new index_1.ObjectSize(16, 1), defaultReleaseParamCaps: capnp.getBitMask(true, 0) }; +class Finish extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + getReleaseResultCaps() { return index_1.Struct.getBit(32, this, Finish._capnp.defaultReleaseResultCaps); } + setReleaseResultCaps(value) { index_1.Struct.setBit(32, value, this); } + toString() { return "Finish_" + super.toString(); } +} +exports.Finish = Finish; +Finish._capnp = { displayName: "Finish", id: "d37d2eb2c2f80e63", size: new index_1.ObjectSize(8, 0), defaultReleaseResultCaps: capnp.getBitMask(true, 0) }; +var Resolve_Which; +(function (Resolve_Which) { + Resolve_Which[Resolve_Which["CAP"] = 0] = "CAP"; + Resolve_Which[Resolve_Which["EXCEPTION"] = 1] = "EXCEPTION"; +})(Resolve_Which = exports.Resolve_Which || (exports.Resolve_Which = {})); +class Resolve extends index_1.Struct { + getPromiseId() { return index_1.Struct.getUint32(0, this); } + setPromiseId(value) { index_1.Struct.setUint32(0, value, this); } + adoptCap(value) { + index_1.Struct.setUint16(4, 0, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownCap() { return index_1.Struct.disown(this.getCap()); } + getCap() { + index_1.Struct.testWhich("cap", index_1.Struct.getUint16(4, this), 0, this); + return index_1.Struct.getStruct(0, CapDescriptor, this); + } + hasCap() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initCap() { + index_1.Struct.setUint16(4, 0, this); + return index_1.Struct.initStructAt(0, CapDescriptor, this); + } + isCap() { return index_1.Struct.getUint16(4, this) === 0; } + setCap(value) { + index_1.Struct.setUint16(4, 0, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptException(value) { + index_1.Struct.setUint16(4, 1, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownException() { return index_1.Struct.disown(this.getException()); } + getException() { + index_1.Struct.testWhich("exception", index_1.Struct.getUint16(4, this), 1, this); + return index_1.Struct.getStruct(0, Exception, this); + } + hasException() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initException() { + index_1.Struct.setUint16(4, 1, this); + return index_1.Struct.initStructAt(0, Exception, this); + } + isException() { return index_1.Struct.getUint16(4, this) === 1; } + setException(value) { + index_1.Struct.setUint16(4, 1, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "Resolve_" + super.toString(); } + which() { return index_1.Struct.getUint16(4, this); } +} +exports.Resolve = Resolve; +Resolve.CAP = Resolve_Which.CAP; +Resolve.EXCEPTION = Resolve_Which.EXCEPTION; +Resolve._capnp = { displayName: "Resolve", id: "bbc29655fa89086e", size: new index_1.ObjectSize(8, 1) }; +class Release extends index_1.Struct { + getId() { return index_1.Struct.getUint32(0, this); } + setId(value) { index_1.Struct.setUint32(0, value, this); } + getReferenceCount() { return index_1.Struct.getUint32(4, this); } + setReferenceCount(value) { index_1.Struct.setUint32(4, value, this); } + toString() { return "Release_" + super.toString(); } +} +exports.Release = Release; +Release._capnp = { displayName: "Release", id: "ad1a6c0d7dd07497", size: new index_1.ObjectSize(8, 0) }; +var Disembargo_Context_Which; +(function (Disembargo_Context_Which) { + Disembargo_Context_Which[Disembargo_Context_Which["SENDER_LOOPBACK"] = 0] = "SENDER_LOOPBACK"; + Disembargo_Context_Which[Disembargo_Context_Which["RECEIVER_LOOPBACK"] = 1] = "RECEIVER_LOOPBACK"; + Disembargo_Context_Which[Disembargo_Context_Which["ACCEPT"] = 2] = "ACCEPT"; + Disembargo_Context_Which[Disembargo_Context_Which["PROVIDE"] = 3] = "PROVIDE"; +})(Disembargo_Context_Which = exports.Disembargo_Context_Which || (exports.Disembargo_Context_Which = {})); +class Disembargo_Context extends index_1.Struct { + getSenderLoopback() { + index_1.Struct.testWhich("senderLoopback", index_1.Struct.getUint16(4, this), 0, this); + return index_1.Struct.getUint32(0, this); + } + isSenderLoopback() { return index_1.Struct.getUint16(4, this) === 0; } + setSenderLoopback(value) { + index_1.Struct.setUint16(4, 0, this); + index_1.Struct.setUint32(0, value, this); + } + getReceiverLoopback() { + index_1.Struct.testWhich("receiverLoopback", index_1.Struct.getUint16(4, this), 1, this); + return index_1.Struct.getUint32(0, this); + } + isReceiverLoopback() { return index_1.Struct.getUint16(4, this) === 1; } + setReceiverLoopback(value) { + index_1.Struct.setUint16(4, 1, this); + index_1.Struct.setUint32(0, value, this); + } + isAccept() { return index_1.Struct.getUint16(4, this) === 2; } + setAccept() { index_1.Struct.setUint16(4, 2, this); } + getProvide() { + index_1.Struct.testWhich("provide", index_1.Struct.getUint16(4, this), 3, this); + return index_1.Struct.getUint32(0, this); + } + isProvide() { return index_1.Struct.getUint16(4, this) === 3; } + setProvide(value) { + index_1.Struct.setUint16(4, 3, this); + index_1.Struct.setUint32(0, value, this); + } + toString() { return "Disembargo_Context_" + super.toString(); } + which() { return index_1.Struct.getUint16(4, this); } +} +exports.Disembargo_Context = Disembargo_Context; +Disembargo_Context.SENDER_LOOPBACK = Disembargo_Context_Which.SENDER_LOOPBACK; +Disembargo_Context.RECEIVER_LOOPBACK = Disembargo_Context_Which.RECEIVER_LOOPBACK; +Disembargo_Context.ACCEPT = Disembargo_Context_Which.ACCEPT; +Disembargo_Context.PROVIDE = Disembargo_Context_Which.PROVIDE; +Disembargo_Context._capnp = { displayName: "context", id: "d562b4df655bdd4d", size: new index_1.ObjectSize(8, 1) }; +class Disembargo extends index_1.Struct { + adoptTarget(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownTarget() { return index_1.Struct.disown(this.getTarget()); } + getTarget() { return index_1.Struct.getStruct(0, MessageTarget, this); } + hasTarget() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initTarget() { return index_1.Struct.initStructAt(0, MessageTarget, this); } + setTarget(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + getContext() { return index_1.Struct.getAs(Disembargo_Context, this); } + initContext() { return index_1.Struct.getAs(Disembargo_Context, this); } + toString() { return "Disembargo_" + super.toString(); } +} +exports.Disembargo = Disembargo; +Disembargo._capnp = { displayName: "Disembargo", id: "f964368b0fbd3711", size: new index_1.ObjectSize(8, 1) }; +class Provide extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptTarget(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownTarget() { return index_1.Struct.disown(this.getTarget()); } + getTarget() { return index_1.Struct.getStruct(0, MessageTarget, this); } + hasTarget() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initTarget() { return index_1.Struct.initStructAt(0, MessageTarget, this); } + setTarget(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + adoptRecipient(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownRecipient() { return index_1.Struct.disown(this.getRecipient()); } + getRecipient() { return index_1.Struct.getPointer(1, this); } + hasRecipient() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + setRecipient(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "Provide_" + super.toString(); } +} +exports.Provide = Provide; +Provide._capnp = { displayName: "Provide", id: "9c6a046bfbc1ac5a", size: new index_1.ObjectSize(8, 2) }; +class Accept extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptProvision(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownProvision() { return index_1.Struct.disown(this.getProvision()); } + getProvision() { return index_1.Struct.getPointer(0, this); } + hasProvision() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setProvision(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + getEmbargo() { return index_1.Struct.getBit(32, this); } + setEmbargo(value) { index_1.Struct.setBit(32, value, this); } + toString() { return "Accept_" + super.toString(); } +} +exports.Accept = Accept; +Accept._capnp = { displayName: "Accept", id: "d4c9b56290554016", size: new index_1.ObjectSize(8, 1) }; +class Join extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptTarget(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownTarget() { return index_1.Struct.disown(this.getTarget()); } + getTarget() { return index_1.Struct.getStruct(0, MessageTarget, this); } + hasTarget() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initTarget() { return index_1.Struct.initStructAt(0, MessageTarget, this); } + setTarget(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + adoptKeyPart(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownKeyPart() { return index_1.Struct.disown(this.getKeyPart()); } + getKeyPart() { return index_1.Struct.getPointer(1, this); } + hasKeyPart() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + setKeyPart(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "Join_" + super.toString(); } +} +exports.Join = Join; +Join._capnp = { displayName: "Join", id: "fbe1980490e001af", size: new index_1.ObjectSize(8, 2) }; +var MessageTarget_Which; +(function (MessageTarget_Which) { + MessageTarget_Which[MessageTarget_Which["IMPORTED_CAP"] = 0] = "IMPORTED_CAP"; + MessageTarget_Which[MessageTarget_Which["PROMISED_ANSWER"] = 1] = "PROMISED_ANSWER"; +})(MessageTarget_Which = exports.MessageTarget_Which || (exports.MessageTarget_Which = {})); +class MessageTarget extends index_1.Struct { + getImportedCap() { + index_1.Struct.testWhich("importedCap", index_1.Struct.getUint16(4, this), 0, this); + return index_1.Struct.getUint32(0, this); + } + isImportedCap() { return index_1.Struct.getUint16(4, this) === 0; } + setImportedCap(value) { + index_1.Struct.setUint16(4, 0, this); + index_1.Struct.setUint32(0, value, this); + } + adoptPromisedAnswer(value) { + index_1.Struct.setUint16(4, 1, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownPromisedAnswer() { return index_1.Struct.disown(this.getPromisedAnswer()); } + getPromisedAnswer() { + index_1.Struct.testWhich("promisedAnswer", index_1.Struct.getUint16(4, this), 1, this); + return index_1.Struct.getStruct(0, PromisedAnswer, this); + } + hasPromisedAnswer() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initPromisedAnswer() { + index_1.Struct.setUint16(4, 1, this); + return index_1.Struct.initStructAt(0, PromisedAnswer, this); + } + isPromisedAnswer() { return index_1.Struct.getUint16(4, this) === 1; } + setPromisedAnswer(value) { + index_1.Struct.setUint16(4, 1, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "MessageTarget_" + super.toString(); } + which() { return index_1.Struct.getUint16(4, this); } +} +exports.MessageTarget = MessageTarget; +MessageTarget.IMPORTED_CAP = MessageTarget_Which.IMPORTED_CAP; +MessageTarget.PROMISED_ANSWER = MessageTarget_Which.PROMISED_ANSWER; +MessageTarget._capnp = { displayName: "MessageTarget", id: "95bc14545813fbc1", size: new index_1.ObjectSize(8, 1) }; +class Payload extends index_1.Struct { + adoptContent(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownContent() { return index_1.Struct.disown(this.getContent()); } + getContent() { return index_1.Struct.getPointer(0, this); } + hasContent() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setContent(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + adoptCapTable(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownCapTable() { return index_1.Struct.disown(this.getCapTable()); } + getCapTable() { return index_1.Struct.getList(1, Payload._CapTable, this); } + hasCapTable() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initCapTable(length) { return index_1.Struct.initList(1, Payload._CapTable, length, this); } + setCapTable(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "Payload_" + super.toString(); } +} +exports.Payload = Payload; +Payload._capnp = { displayName: "Payload", id: "9a0e61223d96743b", size: new index_1.ObjectSize(0, 2) }; +var CapDescriptor_Which; +(function (CapDescriptor_Which) { + CapDescriptor_Which[CapDescriptor_Which["NONE"] = 0] = "NONE"; + CapDescriptor_Which[CapDescriptor_Which["SENDER_HOSTED"] = 1] = "SENDER_HOSTED"; + CapDescriptor_Which[CapDescriptor_Which["SENDER_PROMISE"] = 2] = "SENDER_PROMISE"; + CapDescriptor_Which[CapDescriptor_Which["RECEIVER_HOSTED"] = 3] = "RECEIVER_HOSTED"; + CapDescriptor_Which[CapDescriptor_Which["RECEIVER_ANSWER"] = 4] = "RECEIVER_ANSWER"; + CapDescriptor_Which[CapDescriptor_Which["THIRD_PARTY_HOSTED"] = 5] = "THIRD_PARTY_HOSTED"; +})(CapDescriptor_Which = exports.CapDescriptor_Which || (exports.CapDescriptor_Which = {})); +class CapDescriptor extends index_1.Struct { + isNone() { return index_1.Struct.getUint16(0, this) === 0; } + setNone() { index_1.Struct.setUint16(0, 0, this); } + getSenderHosted() { + index_1.Struct.testWhich("senderHosted", index_1.Struct.getUint16(0, this), 1, this); + return index_1.Struct.getUint32(4, this); + } + isSenderHosted() { return index_1.Struct.getUint16(0, this) === 1; } + setSenderHosted(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.setUint32(4, value, this); + } + getSenderPromise() { + index_1.Struct.testWhich("senderPromise", index_1.Struct.getUint16(0, this), 2, this); + return index_1.Struct.getUint32(4, this); + } + isSenderPromise() { return index_1.Struct.getUint16(0, this) === 2; } + setSenderPromise(value) { + index_1.Struct.setUint16(0, 2, this); + index_1.Struct.setUint32(4, value, this); + } + getReceiverHosted() { + index_1.Struct.testWhich("receiverHosted", index_1.Struct.getUint16(0, this), 3, this); + return index_1.Struct.getUint32(4, this); + } + isReceiverHosted() { return index_1.Struct.getUint16(0, this) === 3; } + setReceiverHosted(value) { + index_1.Struct.setUint16(0, 3, this); + index_1.Struct.setUint32(4, value, this); + } + adoptReceiverAnswer(value) { + index_1.Struct.setUint16(0, 4, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownReceiverAnswer() { return index_1.Struct.disown(this.getReceiverAnswer()); } + getReceiverAnswer() { + index_1.Struct.testWhich("receiverAnswer", index_1.Struct.getUint16(0, this), 4, this); + return index_1.Struct.getStruct(0, PromisedAnswer, this); + } + hasReceiverAnswer() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initReceiverAnswer() { + index_1.Struct.setUint16(0, 4, this); + return index_1.Struct.initStructAt(0, PromisedAnswer, this); + } + isReceiverAnswer() { return index_1.Struct.getUint16(0, this) === 4; } + setReceiverAnswer(value) { + index_1.Struct.setUint16(0, 4, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptThirdPartyHosted(value) { + index_1.Struct.setUint16(0, 5, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownThirdPartyHosted() { return index_1.Struct.disown(this.getThirdPartyHosted()); } + getThirdPartyHosted() { + index_1.Struct.testWhich("thirdPartyHosted", index_1.Struct.getUint16(0, this), 5, this); + return index_1.Struct.getStruct(0, ThirdPartyCapDescriptor, this); + } + hasThirdPartyHosted() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initThirdPartyHosted() { + index_1.Struct.setUint16(0, 5, this); + return index_1.Struct.initStructAt(0, ThirdPartyCapDescriptor, this); + } + isThirdPartyHosted() { return index_1.Struct.getUint16(0, this) === 5; } + setThirdPartyHosted(value) { + index_1.Struct.setUint16(0, 5, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "CapDescriptor_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.CapDescriptor = CapDescriptor; +CapDescriptor.NONE = CapDescriptor_Which.NONE; +CapDescriptor.SENDER_HOSTED = CapDescriptor_Which.SENDER_HOSTED; +CapDescriptor.SENDER_PROMISE = CapDescriptor_Which.SENDER_PROMISE; +CapDescriptor.RECEIVER_HOSTED = CapDescriptor_Which.RECEIVER_HOSTED; +CapDescriptor.RECEIVER_ANSWER = CapDescriptor_Which.RECEIVER_ANSWER; +CapDescriptor.THIRD_PARTY_HOSTED = CapDescriptor_Which.THIRD_PARTY_HOSTED; +CapDescriptor._capnp = { displayName: "CapDescriptor", id: "8523ddc40b86b8b0", size: new index_1.ObjectSize(8, 1) }; +var PromisedAnswer_Op_Which; +(function (PromisedAnswer_Op_Which) { + PromisedAnswer_Op_Which[PromisedAnswer_Op_Which["NOOP"] = 0] = "NOOP"; + PromisedAnswer_Op_Which[PromisedAnswer_Op_Which["GET_POINTER_FIELD"] = 1] = "GET_POINTER_FIELD"; +})(PromisedAnswer_Op_Which = exports.PromisedAnswer_Op_Which || (exports.PromisedAnswer_Op_Which = {})); +class PromisedAnswer_Op extends index_1.Struct { + isNoop() { return index_1.Struct.getUint16(0, this) === 0; } + setNoop() { index_1.Struct.setUint16(0, 0, this); } + getGetPointerField() { + index_1.Struct.testWhich("getPointerField", index_1.Struct.getUint16(0, this), 1, this); + return index_1.Struct.getUint16(2, this); + } + isGetPointerField() { return index_1.Struct.getUint16(0, this) === 1; } + setGetPointerField(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.setUint16(2, value, this); + } + toString() { return "PromisedAnswer_Op_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.PromisedAnswer_Op = PromisedAnswer_Op; +PromisedAnswer_Op.NOOP = PromisedAnswer_Op_Which.NOOP; +PromisedAnswer_Op.GET_POINTER_FIELD = PromisedAnswer_Op_Which.GET_POINTER_FIELD; +PromisedAnswer_Op._capnp = { displayName: "Op", id: "f316944415569081", size: new index_1.ObjectSize(8, 0) }; +class PromisedAnswer extends index_1.Struct { + getQuestionId() { return index_1.Struct.getUint32(0, this); } + setQuestionId(value) { index_1.Struct.setUint32(0, value, this); } + adoptTransform(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownTransform() { return index_1.Struct.disown(this.getTransform()); } + getTransform() { return index_1.Struct.getList(0, PromisedAnswer._Transform, this); } + hasTransform() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initTransform(length) { return index_1.Struct.initList(0, PromisedAnswer._Transform, length, this); } + setTransform(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "PromisedAnswer_" + super.toString(); } +} +exports.PromisedAnswer = PromisedAnswer; +PromisedAnswer.Op = PromisedAnswer_Op; +PromisedAnswer._capnp = { displayName: "PromisedAnswer", id: "d800b1d6cd6f1ca0", size: new index_1.ObjectSize(8, 1) }; +class ThirdPartyCapDescriptor extends index_1.Struct { + adoptId(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownId() { return index_1.Struct.disown(this.getId()); } + getId() { return index_1.Struct.getPointer(0, this); } + hasId() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + setId(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + getVineId() { return index_1.Struct.getUint32(0, this); } + setVineId(value) { index_1.Struct.setUint32(0, value, this); } + toString() { return "ThirdPartyCapDescriptor_" + super.toString(); } +} +exports.ThirdPartyCapDescriptor = ThirdPartyCapDescriptor; +ThirdPartyCapDescriptor._capnp = { displayName: "ThirdPartyCapDescriptor", id: "d37007fde1f0027d", size: new index_1.ObjectSize(8, 1) }; +var Exception_Type; +(function (Exception_Type) { + Exception_Type[Exception_Type["FAILED"] = 0] = "FAILED"; + Exception_Type[Exception_Type["OVERLOADED"] = 1] = "OVERLOADED"; + Exception_Type[Exception_Type["DISCONNECTED"] = 2] = "DISCONNECTED"; + Exception_Type[Exception_Type["UNIMPLEMENTED"] = 3] = "UNIMPLEMENTED"; +})(Exception_Type = exports.Exception_Type || (exports.Exception_Type = {})); +class Exception extends index_1.Struct { + getReason() { return index_1.Struct.getText(0, this); } + setReason(value) { index_1.Struct.setText(0, value, this); } + getType() { return index_1.Struct.getUint16(4, this); } + setType(value) { index_1.Struct.setUint16(4, value, this); } + getObsoleteIsCallersFault() { return index_1.Struct.getBit(0, this); } + setObsoleteIsCallersFault(value) { index_1.Struct.setBit(0, value, this); } + getObsoleteDurability() { return index_1.Struct.getUint16(2, this); } + setObsoleteDurability(value) { index_1.Struct.setUint16(2, value, this); } + toString() { return "Exception_" + super.toString(); } +} +exports.Exception = Exception; +Exception.Type = Exception_Type; +Exception._capnp = { displayName: "Exception", id: "d625b7063acf691a", size: new index_1.ObjectSize(8, 1) }; +Payload._CapTable = capnp.CompositeList(CapDescriptor); +PromisedAnswer._Transform = capnp.CompositeList(PromisedAnswer_Op); +//# sourceMappingURL=rpc.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/rpc.capnp.js.map b/node_modules/capnp-ts/src/std/rpc.capnp.js.map new file mode 100644 index 0000000..63df001 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc.capnp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rpc.capnp.js","sourceRoot":"","sources":["rpc.capnp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,wDAAkC;AAClC,oCAA4D;AAC/C,QAAA,YAAY,GAAG,kBAAkB,CAAC;AAC/C,IAAY,aAeX;AAfD,WAAY,aAAa;IACrB,mEAAiB,CAAA;IACjB,mDAAS,CAAA;IACT,2DAAa,CAAA;IACb,iDAAQ,CAAA;IACR,qDAAU,CAAA;IACV,qDAAU,CAAA;IACV,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,8DAAe,CAAA;IACf,mEAAiB,CAAA;IACjB,uEAAmB,CAAA;IACnB,wDAAY,CAAA;IACZ,sDAAW,CAAA;IACX,kDAAS,CAAA;AACb,CAAC,EAfW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAexB;AACD,MAAa,OAAQ,SAAQ,cAAG;IAgB5B,kBAAkB,CAAC,KAA4B;QAC3C,cAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC1B,cAAG,CAAC,KAAK,CAAC,KAAK,EAAE,cAAG,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,mBAAmB,KAA4B,OAAO,cAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,gBAAgB;QACZ,cAAG,CAAC,SAAS,CAAC,eAAe,EAAE,cAAG,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAChE,OAAO,cAAG,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,g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CAAC,CAAC,CAAC;IAClE,qBAAqB,CAAC,KAAa,IAAU,cAAG,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7E,QAAQ,KAAa,OAAO,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;;AAXlE,8BAYC;AAXmB,cAAI,GAAG,cAAc,CAAC;AACtB,gBAAM,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,kBAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAWvG,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;AACvD,cAAc,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/rpc.capnp.ts b/node_modules/capnp-ts/src/std/rpc.capnp.ts new file mode 100644 index 0000000..e0b9ca1 --- /dev/null +++ b/node_modules/capnp-ts/src/std/rpc.capnp.ts @@ -0,0 +1,838 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "b312981b2552a250"; +export enum Message_Which { + UNIMPLEMENTED = 0, + ABORT = 1, + BOOTSTRAP = 8, + CALL = 2, + RETURN = 3, + FINISH = 4, + RESOLVE = 5, + RELEASE = 6, + DISEMBARGO = 13, + OBSOLETE_SAVE = 7, + OBSOLETE_DELETE = 9, + PROVIDE = 10, + ACCEPT = 11, + JOIN = 12 +} +export class Message extends __S { + static readonly UNIMPLEMENTED = Message_Which.UNIMPLEMENTED; + static readonly ABORT = Message_Which.ABORT; + static readonly BOOTSTRAP = Message_Which.BOOTSTRAP; + static readonly CALL = Message_Which.CALL; + static readonly RETURN = Message_Which.RETURN; + static readonly FINISH = Message_Which.FINISH; + static readonly RESOLVE = Message_Which.RESOLVE; + static readonly RELEASE = Message_Which.RELEASE; + static readonly DISEMBARGO = Message_Which.DISEMBARGO; + static readonly OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE; + static readonly OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE; + static readonly PROVIDE = Message_Which.PROVIDE; + static readonly ACCEPT = Message_Which.ACCEPT; + static readonly JOIN = Message_Which.JOIN; + static readonly _capnp = { displayName: "Message", id: "91b79f1f808db032", size: new __O(8, 1) }; + adoptUnimplemented(value: capnp.Orphan<Message>): void { + __S.setUint16(0, 0, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownUnimplemented(): capnp.Orphan<Message> { return __S.disown(this.getUnimplemented()); } + getUnimplemented(): Message { + __S.testWhich("unimplemented", __S.getUint16(0, this), 0, this); + return __S.getStruct(0, Message, this); + } + hasUnimplemented(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initUnimplemented(): Message { + __S.setUint16(0, 0, this); + return __S.initStructAt(0, Message, this); + } + isUnimplemented(): boolean { return __S.getUint16(0, this) === 0; } + setUnimplemented(value: Message): void { + __S.setUint16(0, 0, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptAbort(value: capnp.Orphan<Exception>): void { + __S.setUint16(0, 1, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownAbort(): capnp.Orphan<Exception> { return __S.disown(this.getAbort()); } + getAbort(): Exception { + __S.testWhich("abort", __S.getUint16(0, this), 1, this); + return __S.getStruct(0, Exception, this); + } + hasAbort(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initAbort(): Exception { + __S.setUint16(0, 1, this); + return __S.initStructAt(0, Exception, this); + } + isAbort(): boolean { return __S.getUint16(0, this) === 1; } + setAbort(value: Exception): void { + __S.setUint16(0, 1, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptBootstrap(value: capnp.Orphan<Bootstrap>): void { + __S.setUint16(0, 8, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownBootstrap(): capnp.Orphan<Bootstrap> { return __S.disown(this.getBootstrap()); } + getBootstrap(): Bootstrap { + __S.testWhich("bootstrap", __S.getUint16(0, this), 8, this); + return __S.getStruct(0, Bootstrap, this); + } + hasBootstrap(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBootstrap(): Bootstrap { + __S.setUint16(0, 8, this); + return __S.initStructAt(0, Bootstrap, this); + } + isBootstrap(): boolean { return __S.getUint16(0, this) === 8; } + setBootstrap(value: Bootstrap): void { + __S.setUint16(0, 8, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptCall(value: capnp.Orphan<Call>): void { + __S.setUint16(0, 2, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownCall(): capnp.Orphan<Call> { return __S.disown(this.getCall()); } + getCall(): Call { + __S.testWhich("call", __S.getUint16(0, this), 2, this); + return __S.getStruct(0, Call, this); + } + hasCall(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initCall(): Call { + __S.setUint16(0, 2, this); + return __S.initStructAt(0, Call, this); + } + isCall(): boolean { return __S.getUint16(0, this) === 2; } + setCall(value: Call): void { + __S.setUint16(0, 2, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptReturn(value: capnp.Orphan<Return>): void { + __S.setUint16(0, 3, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownReturn(): capnp.Orphan<Return> { return __S.disown(this.getReturn()); } + getReturn(): Return { + __S.testWhich("return", __S.getUint16(0, this), 3, this); + return __S.getStruct(0, Return, this); + } + hasReturn(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initReturn(): Return { + __S.setUint16(0, 3, this); + return __S.initStructAt(0, Return, this); + } + isReturn(): boolean { return __S.getUint16(0, this) === 3; } + setReturn(value: Return): void { + __S.setUint16(0, 3, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptFinish(value: capnp.Orphan<Finish>): void { + __S.setUint16(0, 4, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownFinish(): capnp.Orphan<Finish> { return __S.disown(this.getFinish()); } + getFinish(): Finish { + __S.testWhich("finish", __S.getUint16(0, this), 4, this); + return __S.getStruct(0, Finish, this); + } + hasFinish(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initFinish(): Finish { + __S.setUint16(0, 4, this); + return __S.initStructAt(0, Finish, this); + } + isFinish(): boolean { return __S.getUint16(0, this) === 4; } + setFinish(value: Finish): void { + __S.setUint16(0, 4, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptResolve(value: capnp.Orphan<Resolve>): void { + __S.setUint16(0, 5, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownResolve(): capnp.Orphan<Resolve> { return __S.disown(this.getResolve()); } + getResolve(): Resolve { + __S.testWhich("resolve", __S.getUint16(0, this), 5, this); + return __S.getStruct(0, Resolve, this); + } + hasResolve(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initResolve(): Resolve { + __S.setUint16(0, 5, this); + return __S.initStructAt(0, Resolve, this); + } + isResolve(): boolean { return __S.getUint16(0, this) === 5; } + setResolve(value: Resolve): void { + __S.setUint16(0, 5, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptRelease(value: capnp.Orphan<Release>): void { + __S.setUint16(0, 6, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownRelease(): capnp.Orphan<Release> { return __S.disown(this.getRelease()); } + getRelease(): Release { + __S.testWhich("release", __S.getUint16(0, this), 6, this); + return __S.getStruct(0, Release, this); + } + hasRelease(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initRelease(): Release { + __S.setUint16(0, 6, this); + return __S.initStructAt(0, Release, this); + } + isRelease(): boolean { return __S.getUint16(0, this) === 6; } + setRelease(value: Release): void { + __S.setUint16(0, 6, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptDisembargo(value: capnp.Orphan<Disembargo>): void { + __S.setUint16(0, 13, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownDisembargo(): capnp.Orphan<Disembargo> { return __S.disown(this.getDisembargo()); } + getDisembargo(): Disembargo { + __S.testWhich("disembargo", __S.getUint16(0, this), 13, this); + return __S.getStruct(0, Disembargo, this); + } + hasDisembargo(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initDisembargo(): Disembargo { + __S.setUint16(0, 13, this); + return __S.initStructAt(0, Disembargo, this); + } + isDisembargo(): boolean { return __S.getUint16(0, this) === 13; } + setDisembargo(value: Disembargo): void { + __S.setUint16(0, 13, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptObsoleteSave(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(0, 7, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownObsoleteSave(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getObsoleteSave()); } + getObsoleteSave(): capnp.Pointer { + __S.testWhich("obsoleteSave", __S.getUint16(0, this), 7, this); + return __S.getPointer(0, this); + } + hasObsoleteSave(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isObsoleteSave(): boolean { return __S.getUint16(0, this) === 7; } + setObsoleteSave(value: capnp.Pointer): void { + __S.setUint16(0, 7, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptObsoleteDelete(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(0, 9, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownObsoleteDelete(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getObsoleteDelete()); } + getObsoleteDelete(): capnp.Pointer { + __S.testWhich("obsoleteDelete", __S.getUint16(0, this), 9, this); + return __S.getPointer(0, this); + } + hasObsoleteDelete(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isObsoleteDelete(): boolean { return __S.getUint16(0, this) === 9; } + setObsoleteDelete(value: capnp.Pointer): void { + __S.setUint16(0, 9, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptProvide(value: capnp.Orphan<Provide>): void { + __S.setUint16(0, 10, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownProvide(): capnp.Orphan<Provide> { return __S.disown(this.getProvide()); } + getProvide(): Provide { + __S.testWhich("provide", __S.getUint16(0, this), 10, this); + return __S.getStruct(0, Provide, this); + } + hasProvide(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initProvide(): Provide { + __S.setUint16(0, 10, this); + return __S.initStructAt(0, Provide, this); + } + isProvide(): boolean { return __S.getUint16(0, this) === 10; } + setProvide(value: Provide): void { + __S.setUint16(0, 10, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptAccept(value: capnp.Orphan<Accept>): void { + __S.setUint16(0, 11, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownAccept(): capnp.Orphan<Accept> { return __S.disown(this.getAccept()); } + getAccept(): Accept { + __S.testWhich("accept", __S.getUint16(0, this), 11, this); + return __S.getStruct(0, Accept, this); + } + hasAccept(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initAccept(): Accept { + __S.setUint16(0, 11, this); + return __S.initStructAt(0, Accept, this); + } + isAccept(): boolean { return __S.getUint16(0, this) === 11; } + setAccept(value: Accept): void { + __S.setUint16(0, 11, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptJoin(value: capnp.Orphan<Join>): void { + __S.setUint16(0, 12, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownJoin(): capnp.Orphan<Join> { return __S.disown(this.getJoin()); } + getJoin(): Join { + __S.testWhich("join", __S.getUint16(0, this), 12, this); + return __S.getStruct(0, Join, this); + } + hasJoin(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initJoin(): Join { + __S.setUint16(0, 12, this); + return __S.initStructAt(0, Join, this); + } + isJoin(): boolean { return __S.getUint16(0, this) === 12; } + setJoin(value: Join): void { + __S.setUint16(0, 12, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "Message_" + super.toString(); } + which(): Message_Which { return __S.getUint16(0, this); } +} +export class Bootstrap extends __S { + static readonly _capnp = { displayName: "Bootstrap", id: "e94ccf8031176ec4", size: new __O(8, 1) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptDeprecatedObjectId(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownDeprecatedObjectId(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getDeprecatedObjectId()); } + getDeprecatedObjectId(): capnp.Pointer { return __S.getPointer(0, this); } + hasDeprecatedObjectId(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setDeprecatedObjectId(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Bootstrap_" + super.toString(); } +} +export enum Call_SendResultsTo_Which { + CALLER = 0, + YOURSELF = 1, + THIRD_PARTY = 2 +} +export class Call_SendResultsTo extends __S { + static readonly CALLER = Call_SendResultsTo_Which.CALLER; + static readonly YOURSELF = Call_SendResultsTo_Which.YOURSELF; + static readonly THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY; + static readonly _capnp = { displayName: "sendResultsTo", id: "dae8b0f61aab5f99", size: new __O(24, 3) }; + isCaller(): boolean { return __S.getUint16(6, this) === 0; } + setCaller(): void { __S.setUint16(6, 0, this); } + isYourself(): boolean { return __S.getUint16(6, this) === 1; } + setYourself(): void { __S.setUint16(6, 1, this); } + adoptThirdParty(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(6, 2, this); + __S.adopt(value, __S.getPointer(2, this)); + } + disownThirdParty(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getThirdParty()); } + getThirdParty(): capnp.Pointer { + __S.testWhich("thirdParty", __S.getUint16(6, this), 2, this); + return __S.getPointer(2, this); + } + hasThirdParty(): boolean { return !__S.isNull(__S.getPointer(2, this)); } + isThirdParty(): boolean { return __S.getUint16(6, this) === 2; } + setThirdParty(value: capnp.Pointer): void { + __S.setUint16(6, 2, this); + __S.copyFrom(value, __S.getPointer(2, this)); + } + toString(): string { return "Call_SendResultsTo_" + super.toString(); } + which(): Call_SendResultsTo_Which { return __S.getUint16(6, this); } +} +export class Call extends __S { + static readonly _capnp = { displayName: "Call", id: "836a53ce789d4cd4", size: new __O(24, 3), defaultAllowThirdPartyTailCall: capnp.getBitMask(false, 0) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptTarget(value: capnp.Orphan<MessageTarget>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownTarget(): capnp.Orphan<MessageTarget> { return __S.disown(this.getTarget()); } + getTarget(): MessageTarget { return __S.getStruct(0, MessageTarget, this); } + hasTarget(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initTarget(): MessageTarget { return __S.initStructAt(0, MessageTarget, this); } + setTarget(value: MessageTarget): void { __S.copyFrom(value, __S.getPointer(0, this)); } + getInterfaceId(): capnp.Uint64 { return __S.getUint64(8, this); } + setInterfaceId(value: capnp.Uint64): void { __S.setUint64(8, value, this); } + getMethodId(): number { return __S.getUint16(4, this); } + setMethodId(value: number): void { __S.setUint16(4, value, this); } + getAllowThirdPartyTailCall(): boolean { return __S.getBit(128, this, Call._capnp.defaultAllowThirdPartyTailCall); } + setAllowThirdPartyTailCall(value: boolean): void { __S.setBit(128, value, this); } + adoptParams(value: capnp.Orphan<Payload>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownParams(): capnp.Orphan<Payload> { return __S.disown(this.getParams()); } + getParams(): Payload { return __S.getStruct(1, Payload, this); } + hasParams(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initParams(): Payload { return __S.initStructAt(1, Payload, this); } + setParams(value: Payload): void { __S.copyFrom(value, __S.getPointer(1, this)); } + getSendResultsTo(): Call_SendResultsTo { return __S.getAs(Call_SendResultsTo, this); } + initSendResultsTo(): Call_SendResultsTo { return __S.getAs(Call_SendResultsTo, this); } + toString(): string { return "Call_" + super.toString(); } +} +export enum Return_Which { + RESULTS = 0, + EXCEPTION = 1, + CANCELED = 2, + RESULTS_SENT_ELSEWHERE = 3, + TAKE_FROM_OTHER_QUESTION = 4, + ACCEPT_FROM_THIRD_PARTY = 5 +} +export class Return extends __S { + static readonly RESULTS = Return_Which.RESULTS; + static readonly EXCEPTION = Return_Which.EXCEPTION; + static readonly CANCELED = Return_Which.CANCELED; + static readonly RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE; + static readonly TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION; + static readonly ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY; + static readonly _capnp = { displayName: "Return", id: "9e19b28d3db3573a", size: new __O(16, 1), defaultReleaseParamCaps: capnp.getBitMask(true, 0) }; + getAnswerId(): number { return __S.getUint32(0, this); } + setAnswerId(value: number): void { __S.setUint32(0, value, this); } + getReleaseParamCaps(): boolean { return __S.getBit(32, this, Return._capnp.defaultReleaseParamCaps); } + setReleaseParamCaps(value: boolean): void { __S.setBit(32, value, this); } + adoptResults(value: capnp.Orphan<Payload>): void { + __S.setUint16(6, 0, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownResults(): capnp.Orphan<Payload> { return __S.disown(this.getResults()); } + getResults(): Payload { + __S.testWhich("results", __S.getUint16(6, this), 0, this); + return __S.getStruct(0, Payload, this); + } + hasResults(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initResults(): Payload { + __S.setUint16(6, 0, this); + return __S.initStructAt(0, Payload, this); + } + isResults(): boolean { return __S.getUint16(6, this) === 0; } + setResults(value: Payload): void { + __S.setUint16(6, 0, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptException(value: capnp.Orphan<Exception>): void { + __S.setUint16(6, 1, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownException(): capnp.Orphan<Exception> { return __S.disown(this.getException()); } + getException(): Exception { + __S.testWhich("exception", __S.getUint16(6, this), 1, this); + return __S.getStruct(0, Exception, this); + } + hasException(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initException(): Exception { + __S.setUint16(6, 1, this); + return __S.initStructAt(0, Exception, this); + } + isException(): boolean { return __S.getUint16(6, this) === 1; } + setException(value: Exception): void { + __S.setUint16(6, 1, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + isCanceled(): boolean { return __S.getUint16(6, this) === 2; } + setCanceled(): void { __S.setUint16(6, 2, this); } + isResultsSentElsewhere(): boolean { return __S.getUint16(6, this) === 3; } + setResultsSentElsewhere(): void { __S.setUint16(6, 3, this); } + getTakeFromOtherQuestion(): number { + __S.testWhich("takeFromOtherQuestion", __S.getUint16(6, this), 4, this); + return __S.getUint32(8, this); + } + isTakeFromOtherQuestion(): boolean { return __S.getUint16(6, this) === 4; } + setTakeFromOtherQuestion(value: number): void { + __S.setUint16(6, 4, this); + __S.setUint32(8, value, this); + } + adoptAcceptFromThirdParty(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(6, 5, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownAcceptFromThirdParty(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getAcceptFromThirdParty()); } + getAcceptFromThirdParty(): capnp.Pointer { + __S.testWhich("acceptFromThirdParty", __S.getUint16(6, this), 5, this); + return __S.getPointer(0, this); + } + hasAcceptFromThirdParty(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isAcceptFromThirdParty(): boolean { return __S.getUint16(6, this) === 5; } + setAcceptFromThirdParty(value: capnp.Pointer): void { + __S.setUint16(6, 5, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "Return_" + super.toString(); } + which(): Return_Which { return __S.getUint16(6, this); } +} +export class Finish extends __S { + static readonly _capnp = { displayName: "Finish", id: "d37d2eb2c2f80e63", size: new __O(8, 0), defaultReleaseResultCaps: capnp.getBitMask(true, 0) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + getReleaseResultCaps(): boolean { return __S.getBit(32, this, Finish._capnp.defaultReleaseResultCaps); } + setReleaseResultCaps(value: boolean): void { __S.setBit(32, value, this); } + toString(): string { return "Finish_" + super.toString(); } +} +export enum Resolve_Which { + CAP = 0, + EXCEPTION = 1 +} +export class Resolve extends __S { + static readonly CAP = Resolve_Which.CAP; + static readonly EXCEPTION = Resolve_Which.EXCEPTION; + static readonly _capnp = { displayName: "Resolve", id: "bbc29655fa89086e", size: new __O(8, 1) }; + getPromiseId(): number { return __S.getUint32(0, this); } + setPromiseId(value: number): void { __S.setUint32(0, value, this); } + adoptCap(value: capnp.Orphan<CapDescriptor>): void { + __S.setUint16(4, 0, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownCap(): capnp.Orphan<CapDescriptor> { return __S.disown(this.getCap()); } + getCap(): CapDescriptor { + __S.testWhich("cap", __S.getUint16(4, this), 0, this); + return __S.getStruct(0, CapDescriptor, this); + } + hasCap(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initCap(): CapDescriptor { + __S.setUint16(4, 0, this); + return __S.initStructAt(0, CapDescriptor, this); + } + isCap(): boolean { return __S.getUint16(4, this) === 0; } + setCap(value: CapDescriptor): void { + __S.setUint16(4, 0, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptException(value: capnp.Orphan<Exception>): void { + __S.setUint16(4, 1, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownException(): capnp.Orphan<Exception> { return __S.disown(this.getException()); } + getException(): Exception { + __S.testWhich("exception", __S.getUint16(4, this), 1, this); + return __S.getStruct(0, Exception, this); + } + hasException(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initException(): Exception { + __S.setUint16(4, 1, this); + return __S.initStructAt(0, Exception, this); + } + isException(): boolean { return __S.getUint16(4, this) === 1; } + setException(value: Exception): void { + __S.setUint16(4, 1, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "Resolve_" + super.toString(); } + which(): Resolve_Which { return __S.getUint16(4, this); } +} +export class Release extends __S { + static readonly _capnp = { displayName: "Release", id: "ad1a6c0d7dd07497", size: new __O(8, 0) }; + getId(): number { return __S.getUint32(0, this); } + setId(value: number): void { __S.setUint32(0, value, this); } + getReferenceCount(): number { return __S.getUint32(4, this); } + setReferenceCount(value: number): void { __S.setUint32(4, value, this); } + toString(): string { return "Release_" + super.toString(); } +} +export enum Disembargo_Context_Which { + SENDER_LOOPBACK = 0, + RECEIVER_LOOPBACK = 1, + ACCEPT = 2, + PROVIDE = 3 +} +export class Disembargo_Context extends __S { + static readonly SENDER_LOOPBACK = Disembargo_Context_Which.SENDER_LOOPBACK; + static readonly RECEIVER_LOOPBACK = Disembargo_Context_Which.RECEIVER_LOOPBACK; + static readonly ACCEPT = Disembargo_Context_Which.ACCEPT; + static readonly PROVIDE = Disembargo_Context_Which.PROVIDE; + static readonly _capnp = { displayName: "context", id: "d562b4df655bdd4d", size: new __O(8, 1) }; + getSenderLoopback(): number { + __S.testWhich("senderLoopback", __S.getUint16(4, this), 0, this); + return __S.getUint32(0, this); + } + isSenderLoopback(): boolean { return __S.getUint16(4, this) === 0; } + setSenderLoopback(value: number): void { + __S.setUint16(4, 0, this); + __S.setUint32(0, value, this); + } + getReceiverLoopback(): number { + __S.testWhich("receiverLoopback", __S.getUint16(4, this), 1, this); + return __S.getUint32(0, this); + } + isReceiverLoopback(): boolean { return __S.getUint16(4, this) === 1; } + setReceiverLoopback(value: number): void { + __S.setUint16(4, 1, this); + __S.setUint32(0, value, this); + } + isAccept(): boolean { return __S.getUint16(4, this) === 2; } + setAccept(): void { __S.setUint16(4, 2, this); } + getProvide(): number { + __S.testWhich("provide", __S.getUint16(4, this), 3, this); + return __S.getUint32(0, this); + } + isProvide(): boolean { return __S.getUint16(4, this) === 3; } + setProvide(value: number): void { + __S.setUint16(4, 3, this); + __S.setUint32(0, value, this); + } + toString(): string { return "Disembargo_Context_" + super.toString(); } + which(): Disembargo_Context_Which { return __S.getUint16(4, this); } +} +export class Disembargo extends __S { + static readonly _capnp = { displayName: "Disembargo", id: "f964368b0fbd3711", size: new __O(8, 1) }; + adoptTarget(value: capnp.Orphan<MessageTarget>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownTarget(): capnp.Orphan<MessageTarget> { return __S.disown(this.getTarget()); } + getTarget(): MessageTarget { return __S.getStruct(0, MessageTarget, this); } + hasTarget(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initTarget(): MessageTarget { return __S.initStructAt(0, MessageTarget, this); } + setTarget(value: MessageTarget): void { __S.copyFrom(value, __S.getPointer(0, this)); } + getContext(): Disembargo_Context { return __S.getAs(Disembargo_Context, this); } + initContext(): Disembargo_Context { return __S.getAs(Disembargo_Context, this); } + toString(): string { return "Disembargo_" + super.toString(); } +} +export class Provide extends __S { + static readonly _capnp = { displayName: "Provide", id: "9c6a046bfbc1ac5a", size: new __O(8, 2) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptTarget(value: capnp.Orphan<MessageTarget>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownTarget(): capnp.Orphan<MessageTarget> { return __S.disown(this.getTarget()); } + getTarget(): MessageTarget { return __S.getStruct(0, MessageTarget, this); } + hasTarget(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initTarget(): MessageTarget { return __S.initStructAt(0, MessageTarget, this); } + setTarget(value: MessageTarget): void { __S.copyFrom(value, __S.getPointer(0, this)); } + adoptRecipient(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownRecipient(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getRecipient()); } + getRecipient(): capnp.Pointer { return __S.getPointer(1, this); } + hasRecipient(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + setRecipient(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "Provide_" + super.toString(); } +} +export class Accept extends __S { + static readonly _capnp = { displayName: "Accept", id: "d4c9b56290554016", size: new __O(8, 1) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptProvision(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownProvision(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getProvision()); } + getProvision(): capnp.Pointer { return __S.getPointer(0, this); } + hasProvision(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setProvision(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + getEmbargo(): boolean { return __S.getBit(32, this); } + setEmbargo(value: boolean): void { __S.setBit(32, value, this); } + toString(): string { return "Accept_" + super.toString(); } +} +export class Join extends __S { + static readonly _capnp = { displayName: "Join", id: "fbe1980490e001af", size: new __O(8, 2) }; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptTarget(value: capnp.Orphan<MessageTarget>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownTarget(): capnp.Orphan<MessageTarget> { return __S.disown(this.getTarget()); } + getTarget(): MessageTarget { return __S.getStruct(0, MessageTarget, this); } + hasTarget(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initTarget(): MessageTarget { return __S.initStructAt(0, MessageTarget, this); } + setTarget(value: MessageTarget): void { __S.copyFrom(value, __S.getPointer(0, this)); } + adoptKeyPart(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownKeyPart(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getKeyPart()); } + getKeyPart(): capnp.Pointer { return __S.getPointer(1, this); } + hasKeyPart(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + setKeyPart(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "Join_" + super.toString(); } +} +export enum MessageTarget_Which { + IMPORTED_CAP = 0, + PROMISED_ANSWER = 1 +} +export class MessageTarget extends __S { + static readonly IMPORTED_CAP = MessageTarget_Which.IMPORTED_CAP; + static readonly PROMISED_ANSWER = MessageTarget_Which.PROMISED_ANSWER; + static readonly _capnp = { displayName: "MessageTarget", id: "95bc14545813fbc1", size: new __O(8, 1) }; + getImportedCap(): number { + __S.testWhich("importedCap", __S.getUint16(4, this), 0, this); + return __S.getUint32(0, this); + } + isImportedCap(): boolean { return __S.getUint16(4, this) === 0; } + setImportedCap(value: number): void { + __S.setUint16(4, 0, this); + __S.setUint32(0, value, this); + } + adoptPromisedAnswer(value: capnp.Orphan<PromisedAnswer>): void { + __S.setUint16(4, 1, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownPromisedAnswer(): capnp.Orphan<PromisedAnswer> { return __S.disown(this.getPromisedAnswer()); } + getPromisedAnswer(): PromisedAnswer { + __S.testWhich("promisedAnswer", __S.getUint16(4, this), 1, this); + return __S.getStruct(0, PromisedAnswer, this); + } + hasPromisedAnswer(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initPromisedAnswer(): PromisedAnswer { + __S.setUint16(4, 1, this); + return __S.initStructAt(0, PromisedAnswer, this); + } + isPromisedAnswer(): boolean { return __S.getUint16(4, this) === 1; } + setPromisedAnswer(value: PromisedAnswer): void { + __S.setUint16(4, 1, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "MessageTarget_" + super.toString(); } + which(): MessageTarget_Which { return __S.getUint16(4, this); } +} +export class Payload extends __S { + static readonly _capnp = { displayName: "Payload", id: "9a0e61223d96743b", size: new __O(0, 2) }; + static _CapTable: capnp.ListCtor<CapDescriptor>; + adoptContent(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownContent(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getContent()); } + getContent(): capnp.Pointer { return __S.getPointer(0, this); } + hasContent(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setContent(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + adoptCapTable(value: capnp.Orphan<capnp.List<CapDescriptor>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownCapTable(): capnp.Orphan<capnp.List<CapDescriptor>> { return __S.disown(this.getCapTable()); } + getCapTable(): capnp.List<CapDescriptor> { return __S.getList(1, Payload._CapTable, this); } + hasCapTable(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initCapTable(length: number): capnp.List<CapDescriptor> { return __S.initList(1, Payload._CapTable, length, this); } + setCapTable(value: capnp.List<CapDescriptor>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "Payload_" + super.toString(); } +} +export enum CapDescriptor_Which { + NONE = 0, + SENDER_HOSTED = 1, + SENDER_PROMISE = 2, + RECEIVER_HOSTED = 3, + RECEIVER_ANSWER = 4, + THIRD_PARTY_HOSTED = 5 +} +export class CapDescriptor extends __S { + static readonly NONE = CapDescriptor_Which.NONE; + static readonly SENDER_HOSTED = CapDescriptor_Which.SENDER_HOSTED; + static readonly SENDER_PROMISE = CapDescriptor_Which.SENDER_PROMISE; + static readonly RECEIVER_HOSTED = CapDescriptor_Which.RECEIVER_HOSTED; + static readonly RECEIVER_ANSWER = CapDescriptor_Which.RECEIVER_ANSWER; + static readonly THIRD_PARTY_HOSTED = CapDescriptor_Which.THIRD_PARTY_HOSTED; + static readonly _capnp = { displayName: "CapDescriptor", id: "8523ddc40b86b8b0", size: new __O(8, 1) }; + isNone(): boolean { return __S.getUint16(0, this) === 0; } + setNone(): void { __S.setUint16(0, 0, this); } + getSenderHosted(): number { + __S.testWhich("senderHosted", __S.getUint16(0, this), 1, this); + return __S.getUint32(4, this); + } + isSenderHosted(): boolean { return __S.getUint16(0, this) === 1; } + setSenderHosted(value: number): void { + __S.setUint16(0, 1, this); + __S.setUint32(4, value, this); + } + getSenderPromise(): number { + __S.testWhich("senderPromise", __S.getUint16(0, this), 2, this); + return __S.getUint32(4, this); + } + isSenderPromise(): boolean { return __S.getUint16(0, this) === 2; } + setSenderPromise(value: number): void { + __S.setUint16(0, 2, this); + __S.setUint32(4, value, this); + } + getReceiverHosted(): number { + __S.testWhich("receiverHosted", __S.getUint16(0, this), 3, this); + return __S.getUint32(4, this); + } + isReceiverHosted(): boolean { return __S.getUint16(0, this) === 3; } + setReceiverHosted(value: number): void { + __S.setUint16(0, 3, this); + __S.setUint32(4, value, this); + } + adoptReceiverAnswer(value: capnp.Orphan<PromisedAnswer>): void { + __S.setUint16(0, 4, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownReceiverAnswer(): capnp.Orphan<PromisedAnswer> { return __S.disown(this.getReceiverAnswer()); } + getReceiverAnswer(): PromisedAnswer { + __S.testWhich("receiverAnswer", __S.getUint16(0, this), 4, this); + return __S.getStruct(0, PromisedAnswer, this); + } + hasReceiverAnswer(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initReceiverAnswer(): PromisedAnswer { + __S.setUint16(0, 4, this); + return __S.initStructAt(0, PromisedAnswer, this); + } + isReceiverAnswer(): boolean { return __S.getUint16(0, this) === 4; } + setReceiverAnswer(value: PromisedAnswer): void { + __S.setUint16(0, 4, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptThirdPartyHosted(value: capnp.Orphan<ThirdPartyCapDescriptor>): void { + __S.setUint16(0, 5, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownThirdPartyHosted(): capnp.Orphan<ThirdPartyCapDescriptor> { return __S.disown(this.getThirdPartyHosted()); } + getThirdPartyHosted(): ThirdPartyCapDescriptor { + __S.testWhich("thirdPartyHosted", __S.getUint16(0, this), 5, this); + return __S.getStruct(0, ThirdPartyCapDescriptor, this); + } + hasThirdPartyHosted(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initThirdPartyHosted(): ThirdPartyCapDescriptor { + __S.setUint16(0, 5, this); + return __S.initStructAt(0, ThirdPartyCapDescriptor, this); + } + isThirdPartyHosted(): boolean { return __S.getUint16(0, this) === 5; } + setThirdPartyHosted(value: ThirdPartyCapDescriptor): void { + __S.setUint16(0, 5, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "CapDescriptor_" + super.toString(); } + which(): CapDescriptor_Which { return __S.getUint16(0, this); } +} +export enum PromisedAnswer_Op_Which { + NOOP = 0, + GET_POINTER_FIELD = 1 +} +export class PromisedAnswer_Op extends __S { + static readonly NOOP = PromisedAnswer_Op_Which.NOOP; + static readonly GET_POINTER_FIELD = PromisedAnswer_Op_Which.GET_POINTER_FIELD; + static readonly _capnp = { displayName: "Op", id: "f316944415569081", size: new __O(8, 0) }; + isNoop(): boolean { return __S.getUint16(0, this) === 0; } + setNoop(): void { __S.setUint16(0, 0, this); } + getGetPointerField(): number { + __S.testWhich("getPointerField", __S.getUint16(0, this), 1, this); + return __S.getUint16(2, this); + } + isGetPointerField(): boolean { return __S.getUint16(0, this) === 1; } + setGetPointerField(value: number): void { + __S.setUint16(0, 1, this); + __S.setUint16(2, value, this); + } + toString(): string { return "PromisedAnswer_Op_" + super.toString(); } + which(): PromisedAnswer_Op_Which { return __S.getUint16(0, this); } +} +export class PromisedAnswer extends __S { + static readonly Op = PromisedAnswer_Op; + static readonly _capnp = { displayName: "PromisedAnswer", id: "d800b1d6cd6f1ca0", size: new __O(8, 1) }; + static _Transform: capnp.ListCtor<PromisedAnswer_Op>; + getQuestionId(): number { return __S.getUint32(0, this); } + setQuestionId(value: number): void { __S.setUint32(0, value, this); } + adoptTransform(value: capnp.Orphan<capnp.List<PromisedAnswer_Op>>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownTransform(): capnp.Orphan<capnp.List<PromisedAnswer_Op>> { return __S.disown(this.getTransform()); } + getTransform(): capnp.List<PromisedAnswer_Op> { return __S.getList(0, PromisedAnswer._Transform, this); } + hasTransform(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initTransform(length: number): capnp.List<PromisedAnswer_Op> { return __S.initList(0, PromisedAnswer._Transform, length, this); } + setTransform(value: capnp.List<PromisedAnswer_Op>): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "PromisedAnswer_" + super.toString(); } +} +export class ThirdPartyCapDescriptor extends __S { + static readonly _capnp = { displayName: "ThirdPartyCapDescriptor", id: "d37007fde1f0027d", size: new __O(8, 1) }; + adoptId(value: capnp.Orphan<capnp.Pointer>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownId(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getId()); } + getId(): capnp.Pointer { return __S.getPointer(0, this); } + hasId(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + setId(value: capnp.Pointer): void { __S.copyFrom(value, __S.getPointer(0, this)); } + getVineId(): number { return __S.getUint32(0, this); } + setVineId(value: number): void { __S.setUint32(0, value, this); } + toString(): string { return "ThirdPartyCapDescriptor_" + super.toString(); } +} +export enum Exception_Type { + FAILED, + OVERLOADED, + DISCONNECTED, + UNIMPLEMENTED +} +export class Exception extends __S { + static readonly Type = Exception_Type; + static readonly _capnp = { displayName: "Exception", id: "d625b7063acf691a", size: new __O(8, 1) }; + getReason(): string { return __S.getText(0, this); } + setReason(value: string): void { __S.setText(0, value, this); } + getType(): Exception_Type { return __S.getUint16(4, this); } + setType(value: Exception_Type): void { __S.setUint16(4, value, this); } + getObsoleteIsCallersFault(): boolean { return __S.getBit(0, this); } + setObsoleteIsCallersFault(value: boolean): void { __S.setBit(0, value, this); } + getObsoleteDurability(): number { return __S.getUint16(2, this); } + setObsoleteDurability(value: number): void { __S.setUint16(2, value, this); } + toString(): string { return "Exception_" + super.toString(); } +} +Payload._CapTable = capnp.CompositeList(CapDescriptor); +PromisedAnswer._Transform = capnp.CompositeList(PromisedAnswer_Op); diff --git a/node_modules/capnp-ts/src/std/schema.capnp.d.ts b/node_modules/capnp-ts/src/std/schema.capnp.d.ts new file mode 100644 index 0000000..6b3477f --- /dev/null +++ b/node_modules/capnp-ts/src/std/schema.capnp.d.ts @@ -0,0 +1,929 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +import * as capnp from "../index"; +import { Struct as __S } from "../index"; +export declare const _capnpFileId = "a93fc509624c72d9"; +export declare class Node_Parameter extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getName(): string; + setName(value: string): void; + toString(): string; +} +export declare class Node_NestedNode extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getName(): string; + setName(value: string): void; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + toString(): string; +} +export declare class Node_Struct extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Fields: capnp.ListCtor<Field>; + getDataWordCount(): number; + setDataWordCount(value: number): void; + getPointerCount(): number; + setPointerCount(value: number): void; + getPreferredListEncoding(): ElementSize; + setPreferredListEncoding(value: ElementSize): void; + getIsGroup(): boolean; + setIsGroup(value: boolean): void; + getDiscriminantCount(): number; + setDiscriminantCount(value: number): void; + getDiscriminantOffset(): number; + setDiscriminantOffset(value: number): void; + adoptFields(value: capnp.Orphan<capnp.List<Field>>): void; + disownFields(): capnp.Orphan<capnp.List<Field>>; + getFields(): capnp.List<Field>; + hasFields(): boolean; + initFields(length: number): capnp.List<Field>; + setFields(value: capnp.List<Field>): void; + toString(): string; +} +export declare class Node_Enum extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Enumerants: capnp.ListCtor<Enumerant>; + adoptEnumerants(value: capnp.Orphan<capnp.List<Enumerant>>): void; + disownEnumerants(): capnp.Orphan<capnp.List<Enumerant>>; + getEnumerants(): capnp.List<Enumerant>; + hasEnumerants(): boolean; + initEnumerants(length: number): capnp.List<Enumerant>; + setEnumerants(value: capnp.List<Enumerant>): void; + toString(): string; +} +export declare class Node_Interface extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Methods: capnp.ListCtor<Method>; + static _Superclasses: capnp.ListCtor<Superclass>; + adoptMethods(value: capnp.Orphan<capnp.List<Method>>): void; + disownMethods(): capnp.Orphan<capnp.List<Method>>; + getMethods(): capnp.List<Method>; + hasMethods(): boolean; + initMethods(length: number): capnp.List<Method>; + setMethods(value: capnp.List<Method>): void; + adoptSuperclasses(value: capnp.Orphan<capnp.List<Superclass>>): void; + disownSuperclasses(): capnp.Orphan<capnp.List<Superclass>>; + getSuperclasses(): capnp.List<Superclass>; + hasSuperclasses(): boolean; + initSuperclasses(length: number): capnp.List<Superclass>; + setSuperclasses(value: capnp.List<Superclass>): void; + toString(): string; +} +export declare class Node_Const extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptType(value: capnp.Orphan<Type>): void; + disownType(): capnp.Orphan<Type>; + getType(): Type; + hasType(): boolean; + initType(): Type; + setType(value: Type): void; + adoptValue(value: capnp.Orphan<Value>): void; + disownValue(): capnp.Orphan<Value>; + getValue(): Value; + hasValue(): boolean; + initValue(): Value; + setValue(value: Value): void; + toString(): string; +} +export declare class Node_Annotation extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptType(value: capnp.Orphan<Type>): void; + disownType(): capnp.Orphan<Type>; + getType(): Type; + hasType(): boolean; + initType(): Type; + setType(value: Type): void; + getTargetsFile(): boolean; + setTargetsFile(value: boolean): void; + getTargetsConst(): boolean; + setTargetsConst(value: boolean): void; + getTargetsEnum(): boolean; + setTargetsEnum(value: boolean): void; + getTargetsEnumerant(): boolean; + setTargetsEnumerant(value: boolean): void; + getTargetsStruct(): boolean; + setTargetsStruct(value: boolean): void; + getTargetsField(): boolean; + setTargetsField(value: boolean): void; + getTargetsUnion(): boolean; + setTargetsUnion(value: boolean): void; + getTargetsGroup(): boolean; + setTargetsGroup(value: boolean): void; + getTargetsInterface(): boolean; + setTargetsInterface(value: boolean): void; + getTargetsMethod(): boolean; + setTargetsMethod(value: boolean): void; + getTargetsParam(): boolean; + setTargetsParam(value: boolean): void; + getTargetsAnnotation(): boolean; + setTargetsAnnotation(value: boolean): void; + toString(): string; +} +export declare enum Node_Which { + FILE = 0, + STRUCT = 1, + ENUM = 2, + INTERFACE = 3, + CONST = 4, + ANNOTATION = 5 +} +export declare class Node extends __S { + static readonly FILE = Node_Which.FILE; + static readonly STRUCT = Node_Which.STRUCT; + static readonly ENUM = Node_Which.ENUM; + static readonly INTERFACE = Node_Which.INTERFACE; + static readonly CONST = Node_Which.CONST; + static readonly ANNOTATION = Node_Which.ANNOTATION; + static readonly Parameter: typeof Node_Parameter; + static readonly NestedNode: typeof Node_NestedNode; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Parameters: capnp.ListCtor<Node_Parameter>; + static _NestedNodes: capnp.ListCtor<Node_NestedNode>; + static _Annotations: capnp.ListCtor<Annotation>; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + getDisplayName(): string; + setDisplayName(value: string): void; + getDisplayNamePrefixLength(): number; + setDisplayNamePrefixLength(value: number): void; + getScopeId(): capnp.Uint64; + setScopeId(value: capnp.Uint64): void; + adoptParameters(value: capnp.Orphan<capnp.List<Node_Parameter>>): void; + disownParameters(): capnp.Orphan<capnp.List<Node_Parameter>>; + getParameters(): capnp.List<Node_Parameter>; + hasParameters(): boolean; + initParameters(length: number): capnp.List<Node_Parameter>; + setParameters(value: capnp.List<Node_Parameter>): void; + getIsGeneric(): boolean; + setIsGeneric(value: boolean): void; + adoptNestedNodes(value: capnp.Orphan<capnp.List<Node_NestedNode>>): void; + disownNestedNodes(): capnp.Orphan<capnp.List<Node_NestedNode>>; + getNestedNodes(): capnp.List<Node_NestedNode>; + hasNestedNodes(): boolean; + initNestedNodes(length: number): capnp.List<Node_NestedNode>; + setNestedNodes(value: capnp.List<Node_NestedNode>): void; + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void; + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>>; + getAnnotations(): capnp.List<Annotation>; + hasAnnotations(): boolean; + initAnnotations(length: number): capnp.List<Annotation>; + setAnnotations(value: capnp.List<Annotation>): void; + isFile(): boolean; + setFile(): void; + getStruct(): Node_Struct; + initStruct(): Node_Struct; + isStruct(): boolean; + setStruct(): void; + getEnum(): Node_Enum; + initEnum(): Node_Enum; + isEnum(): boolean; + setEnum(): void; + getInterface(): Node_Interface; + initInterface(): Node_Interface; + isInterface(): boolean; + setInterface(): void; + getConst(): Node_Const; + initConst(): Node_Const; + isConst(): boolean; + setConst(): void; + getAnnotation(): Node_Annotation; + initAnnotation(): Node_Annotation; + isAnnotation(): boolean; + setAnnotation(): void; + toString(): string; + which(): Node_Which; +} +export declare class Field_Slot extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getOffset(): number; + setOffset(value: number): void; + adoptType(value: capnp.Orphan<Type>): void; + disownType(): capnp.Orphan<Type>; + getType(): Type; + hasType(): boolean; + initType(): Type; + setType(value: Type): void; + adoptDefaultValue(value: capnp.Orphan<Value>): void; + disownDefaultValue(): capnp.Orphan<Value>; + getDefaultValue(): Value; + hasDefaultValue(): boolean; + initDefaultValue(): Value; + setDefaultValue(value: Value): void; + getHadExplicitDefault(): boolean; + setHadExplicitDefault(value: boolean): void; + toString(): string; +} +export declare class Field_Group extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getTypeId(): capnp.Uint64; + setTypeId(value: capnp.Uint64): void; + toString(): string; +} +export declare enum Field_Ordinal_Which { + IMPLICIT = 0, + EXPLICIT = 1 +} +export declare class Field_Ordinal extends __S { + static readonly IMPLICIT = Field_Ordinal_Which.IMPLICIT; + static readonly EXPLICIT = Field_Ordinal_Which.EXPLICIT; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isImplicit(): boolean; + setImplicit(): void; + getExplicit(): number; + isExplicit(): boolean; + setExplicit(value: number): void; + toString(): string; + which(): Field_Ordinal_Which; +} +export declare enum Field_Which { + SLOT = 0, + GROUP = 1 +} +export declare class Field extends __S { + static readonly NO_DISCRIMINANT = 65535; + static readonly SLOT = Field_Which.SLOT; + static readonly GROUP = Field_Which.GROUP; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + defaultDiscriminantValue: DataView; + }; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string; + setName(value: string): void; + getCodeOrder(): number; + setCodeOrder(value: number): void; + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void; + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>>; + getAnnotations(): capnp.List<Annotation>; + hasAnnotations(): boolean; + initAnnotations(length: number): capnp.List<Annotation>; + setAnnotations(value: capnp.List<Annotation>): void; + getDiscriminantValue(): number; + setDiscriminantValue(value: number): void; + getSlot(): Field_Slot; + initSlot(): Field_Slot; + isSlot(): boolean; + setSlot(): void; + getGroup(): Field_Group; + initGroup(): Field_Group; + isGroup(): boolean; + setGroup(): void; + getOrdinal(): Field_Ordinal; + initOrdinal(): Field_Ordinal; + toString(): string; + which(): Field_Which; +} +export declare class Enumerant extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string; + setName(value: string): void; + getCodeOrder(): number; + setCodeOrder(value: number): void; + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void; + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>>; + getAnnotations(): capnp.List<Annotation>; + hasAnnotations(): boolean; + initAnnotations(length: number): capnp.List<Annotation>; + setAnnotations(value: capnp.List<Annotation>): void; + toString(): string; +} +export declare class Superclass extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + adoptBrand(value: capnp.Orphan<Brand>): void; + disownBrand(): capnp.Orphan<Brand>; + getBrand(): Brand; + hasBrand(): boolean; + initBrand(): Brand; + setBrand(value: Brand): void; + toString(): string; +} +export declare class Method extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _ImplicitParameters: capnp.ListCtor<Node_Parameter>; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string; + setName(value: string): void; + getCodeOrder(): number; + setCodeOrder(value: number): void; + adoptImplicitParameters(value: capnp.Orphan<capnp.List<Node_Parameter>>): void; + disownImplicitParameters(): capnp.Orphan<capnp.List<Node_Parameter>>; + getImplicitParameters(): capnp.List<Node_Parameter>; + hasImplicitParameters(): boolean; + initImplicitParameters(length: number): capnp.List<Node_Parameter>; + setImplicitParameters(value: capnp.List<Node_Parameter>): void; + getParamStructType(): capnp.Uint64; + setParamStructType(value: capnp.Uint64): void; + adoptParamBrand(value: capnp.Orphan<Brand>): void; + disownParamBrand(): capnp.Orphan<Brand>; + getParamBrand(): Brand; + hasParamBrand(): boolean; + initParamBrand(): Brand; + setParamBrand(value: Brand): void; + getResultStructType(): capnp.Uint64; + setResultStructType(value: capnp.Uint64): void; + adoptResultBrand(value: capnp.Orphan<Brand>): void; + disownResultBrand(): capnp.Orphan<Brand>; + getResultBrand(): Brand; + hasResultBrand(): boolean; + initResultBrand(): Brand; + setResultBrand(value: Brand): void; + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void; + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>>; + getAnnotations(): capnp.List<Annotation>; + hasAnnotations(): boolean; + initAnnotations(length: number): capnp.List<Annotation>; + setAnnotations(value: capnp.List<Annotation>): void; + toString(): string; +} +export declare class Type_List extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + adoptElementType(value: capnp.Orphan<Type>): void; + disownElementType(): capnp.Orphan<Type>; + getElementType(): Type; + hasElementType(): boolean; + initElementType(): Type; + setElementType(value: Type): void; + toString(): string; +} +export declare class Type_Enum extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getTypeId(): capnp.Uint64; + setTypeId(value: capnp.Uint64): void; + adoptBrand(value: capnp.Orphan<Brand>): void; + disownBrand(): capnp.Orphan<Brand>; + getBrand(): Brand; + hasBrand(): boolean; + initBrand(): Brand; + setBrand(value: Brand): void; + toString(): string; +} +export declare class Type_Struct extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getTypeId(): capnp.Uint64; + setTypeId(value: capnp.Uint64): void; + adoptBrand(value: capnp.Orphan<Brand>): void; + disownBrand(): capnp.Orphan<Brand>; + getBrand(): Brand; + hasBrand(): boolean; + initBrand(): Brand; + setBrand(value: Brand): void; + toString(): string; +} +export declare class Type_Interface extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getTypeId(): capnp.Uint64; + setTypeId(value: capnp.Uint64): void; + adoptBrand(value: capnp.Orphan<Brand>): void; + disownBrand(): capnp.Orphan<Brand>; + getBrand(): Brand; + hasBrand(): boolean; + initBrand(): Brand; + setBrand(value: Brand): void; + toString(): string; +} +export declare enum Type_AnyPointer_Unconstrained_Which { + ANY_KIND = 0, + STRUCT = 1, + LIST = 2, + CAPABILITY = 3 +} +export declare class Type_AnyPointer_Unconstrained extends __S { + static readonly ANY_KIND = Type_AnyPointer_Unconstrained_Which.ANY_KIND; + static readonly STRUCT = Type_AnyPointer_Unconstrained_Which.STRUCT; + static readonly LIST = Type_AnyPointer_Unconstrained_Which.LIST; + static readonly CAPABILITY = Type_AnyPointer_Unconstrained_Which.CAPABILITY; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isAnyKind(): boolean; + setAnyKind(): void; + isStruct(): boolean; + setStruct(): void; + isList(): boolean; + setList(): void; + isCapability(): boolean; + setCapability(): void; + toString(): string; + which(): Type_AnyPointer_Unconstrained_Which; +} +export declare class Type_AnyPointer_Parameter extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getScopeId(): capnp.Uint64; + setScopeId(value: capnp.Uint64): void; + getParameterIndex(): number; + setParameterIndex(value: number): void; + toString(): string; +} +export declare class Type_AnyPointer_ImplicitMethodParameter extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getParameterIndex(): number; + setParameterIndex(value: number): void; + toString(): string; +} +export declare enum Type_AnyPointer_Which { + UNCONSTRAINED = 0, + PARAMETER = 1, + IMPLICIT_METHOD_PARAMETER = 2 +} +export declare class Type_AnyPointer extends __S { + static readonly UNCONSTRAINED = Type_AnyPointer_Which.UNCONSTRAINED; + static readonly PARAMETER = Type_AnyPointer_Which.PARAMETER; + static readonly IMPLICIT_METHOD_PARAMETER = Type_AnyPointer_Which.IMPLICIT_METHOD_PARAMETER; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getUnconstrained(): Type_AnyPointer_Unconstrained; + initUnconstrained(): Type_AnyPointer_Unconstrained; + isUnconstrained(): boolean; + setUnconstrained(): void; + getParameter(): Type_AnyPointer_Parameter; + initParameter(): Type_AnyPointer_Parameter; + isParameter(): boolean; + setParameter(): void; + getImplicitMethodParameter(): Type_AnyPointer_ImplicitMethodParameter; + initImplicitMethodParameter(): Type_AnyPointer_ImplicitMethodParameter; + isImplicitMethodParameter(): boolean; + setImplicitMethodParameter(): void; + toString(): string; + which(): Type_AnyPointer_Which; +} +export declare enum Type_Which { + VOID = 0, + BOOL = 1, + INT8 = 2, + INT16 = 3, + INT32 = 4, + INT64 = 5, + UINT8 = 6, + UINT16 = 7, + UINT32 = 8, + UINT64 = 9, + FLOAT32 = 10, + FLOAT64 = 11, + TEXT = 12, + DATA = 13, + LIST = 14, + ENUM = 15, + STRUCT = 16, + INTERFACE = 17, + ANY_POINTER = 18 +} +export declare class Type extends __S { + static readonly VOID = Type_Which.VOID; + static readonly BOOL = Type_Which.BOOL; + static readonly INT8 = Type_Which.INT8; + static readonly INT16 = Type_Which.INT16; + static readonly INT32 = Type_Which.INT32; + static readonly INT64 = Type_Which.INT64; + static readonly UINT8 = Type_Which.UINT8; + static readonly UINT16 = Type_Which.UINT16; + static readonly UINT32 = Type_Which.UINT32; + static readonly UINT64 = Type_Which.UINT64; + static readonly FLOAT32 = Type_Which.FLOAT32; + static readonly FLOAT64 = Type_Which.FLOAT64; + static readonly TEXT = Type_Which.TEXT; + static readonly DATA = Type_Which.DATA; + static readonly LIST = Type_Which.LIST; + static readonly ENUM = Type_Which.ENUM; + static readonly STRUCT = Type_Which.STRUCT; + static readonly INTERFACE = Type_Which.INTERFACE; + static readonly ANY_POINTER = Type_Which.ANY_POINTER; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isVoid(): boolean; + setVoid(): void; + isBool(): boolean; + setBool(): void; + isInt8(): boolean; + setInt8(): void; + isInt16(): boolean; + setInt16(): void; + isInt32(): boolean; + setInt32(): void; + isInt64(): boolean; + setInt64(): void; + isUint8(): boolean; + setUint8(): void; + isUint16(): boolean; + setUint16(): void; + isUint32(): boolean; + setUint32(): void; + isUint64(): boolean; + setUint64(): void; + isFloat32(): boolean; + setFloat32(): void; + isFloat64(): boolean; + setFloat64(): void; + isText(): boolean; + setText(): void; + isData(): boolean; + setData(): void; + getList(): Type_List; + initList(): Type_List; + isList(): boolean; + setList(): void; + getEnum(): Type_Enum; + initEnum(): Type_Enum; + isEnum(): boolean; + setEnum(): void; + getStruct(): Type_Struct; + initStruct(): Type_Struct; + isStruct(): boolean; + setStruct(): void; + getInterface(): Type_Interface; + initInterface(): Type_Interface; + isInterface(): boolean; + setInterface(): void; + getAnyPointer(): Type_AnyPointer; + initAnyPointer(): Type_AnyPointer; + isAnyPointer(): boolean; + setAnyPointer(): void; + toString(): string; + which(): Type_Which; +} +export declare enum Brand_Scope_Which { + BIND = 0, + INHERIT = 1 +} +export declare class Brand_Scope extends __S { + static readonly BIND = Brand_Scope_Which.BIND; + static readonly INHERIT = Brand_Scope_Which.INHERIT; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Bind: capnp.ListCtor<Brand_Binding>; + getScopeId(): capnp.Uint64; + setScopeId(value: capnp.Uint64): void; + adoptBind(value: capnp.Orphan<capnp.List<Brand_Binding>>): void; + disownBind(): capnp.Orphan<capnp.List<Brand_Binding>>; + getBind(): capnp.List<Brand_Binding>; + hasBind(): boolean; + initBind(length: number): capnp.List<Brand_Binding>; + isBind(): boolean; + setBind(value: capnp.List<Brand_Binding>): void; + isInherit(): boolean; + setInherit(): void; + toString(): string; + which(): Brand_Scope_Which; +} +export declare enum Brand_Binding_Which { + UNBOUND = 0, + TYPE = 1 +} +export declare class Brand_Binding extends __S { + static readonly UNBOUND = Brand_Binding_Which.UNBOUND; + static readonly TYPE = Brand_Binding_Which.TYPE; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isUnbound(): boolean; + setUnbound(): void; + adoptType(value: capnp.Orphan<Type>): void; + disownType(): capnp.Orphan<Type>; + getType(): Type; + hasType(): boolean; + initType(): Type; + isType(): boolean; + setType(value: Type): void; + toString(): string; + which(): Brand_Binding_Which; +} +export declare class Brand extends __S { + static readonly Scope: typeof Brand_Scope; + static readonly Binding: typeof Brand_Binding; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Scopes: capnp.ListCtor<Brand_Scope>; + adoptScopes(value: capnp.Orphan<capnp.List<Brand_Scope>>): void; + disownScopes(): capnp.Orphan<capnp.List<Brand_Scope>>; + getScopes(): capnp.List<Brand_Scope>; + hasScopes(): boolean; + initScopes(length: number): capnp.List<Brand_Scope>; + setScopes(value: capnp.List<Brand_Scope>): void; + toString(): string; +} +export declare enum Value_Which { + VOID = 0, + BOOL = 1, + INT8 = 2, + INT16 = 3, + INT32 = 4, + INT64 = 5, + UINT8 = 6, + UINT16 = 7, + UINT32 = 8, + UINT64 = 9, + FLOAT32 = 10, + FLOAT64 = 11, + TEXT = 12, + DATA = 13, + LIST = 14, + ENUM = 15, + STRUCT = 16, + INTERFACE = 17, + ANY_POINTER = 18 +} +export declare class Value extends __S { + static readonly VOID = Value_Which.VOID; + static readonly BOOL = Value_Which.BOOL; + static readonly INT8 = Value_Which.INT8; + static readonly INT16 = Value_Which.INT16; + static readonly INT32 = Value_Which.INT32; + static readonly INT64 = Value_Which.INT64; + static readonly UINT8 = Value_Which.UINT8; + static readonly UINT16 = Value_Which.UINT16; + static readonly UINT32 = Value_Which.UINT32; + static readonly UINT64 = Value_Which.UINT64; + static readonly FLOAT32 = Value_Which.FLOAT32; + static readonly FLOAT64 = Value_Which.FLOAT64; + static readonly TEXT = Value_Which.TEXT; + static readonly DATA = Value_Which.DATA; + static readonly LIST = Value_Which.LIST; + static readonly ENUM = Value_Which.ENUM; + static readonly STRUCT = Value_Which.STRUCT; + static readonly INTERFACE = Value_Which.INTERFACE; + static readonly ANY_POINTER = Value_Which.ANY_POINTER; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + isVoid(): boolean; + setVoid(): void; + getBool(): boolean; + isBool(): boolean; + setBool(value: boolean): void; + getInt8(): number; + isInt8(): boolean; + setInt8(value: number): void; + getInt16(): number; + isInt16(): boolean; + setInt16(value: number): void; + getInt32(): number; + isInt32(): boolean; + setInt32(value: number): void; + getInt64(): capnp.Int64; + isInt64(): boolean; + setInt64(value: capnp.Int64): void; + getUint8(): number; + isUint8(): boolean; + setUint8(value: number): void; + getUint16(): number; + isUint16(): boolean; + setUint16(value: number): void; + getUint32(): number; + isUint32(): boolean; + setUint32(value: number): void; + getUint64(): capnp.Uint64; + isUint64(): boolean; + setUint64(value: capnp.Uint64): void; + getFloat32(): number; + isFloat32(): boolean; + setFloat32(value: number): void; + getFloat64(): number; + isFloat64(): boolean; + setFloat64(value: number): void; + getText(): string; + isText(): boolean; + setText(value: string): void; + adoptData(value: capnp.Orphan<capnp.Data>): void; + disownData(): capnp.Orphan<capnp.Data>; + getData(): capnp.Data; + hasData(): boolean; + initData(length: number): capnp.Data; + isData(): boolean; + setData(value: capnp.Data): void; + adoptList(value: capnp.Orphan<capnp.Pointer>): void; + disownList(): capnp.Orphan<capnp.Pointer>; + getList(): capnp.Pointer; + hasList(): boolean; + isList(): boolean; + setList(value: capnp.Pointer): void; + getEnum(): number; + isEnum(): boolean; + setEnum(value: number): void; + adoptStruct(value: capnp.Orphan<capnp.Pointer>): void; + disownStruct(): capnp.Orphan<capnp.Pointer>; + getStruct(): capnp.Pointer; + hasStruct(): boolean; + isStruct(): boolean; + setStruct(value: capnp.Pointer): void; + isInterface(): boolean; + setInterface(): void; + adoptAnyPointer(value: capnp.Orphan<capnp.Pointer>): void; + disownAnyPointer(): capnp.Orphan<capnp.Pointer>; + getAnyPointer(): capnp.Pointer; + hasAnyPointer(): boolean; + isAnyPointer(): boolean; + setAnyPointer(value: capnp.Pointer): void; + toString(): string; + which(): Value_Which; +} +export declare class Annotation extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + adoptBrand(value: capnp.Orphan<Brand>): void; + disownBrand(): capnp.Orphan<Brand>; + getBrand(): Brand; + hasBrand(): boolean; + initBrand(): Brand; + setBrand(value: Brand): void; + adoptValue(value: capnp.Orphan<Value>): void; + disownValue(): capnp.Orphan<Value>; + getValue(): Value; + hasValue(): boolean; + initValue(): Value; + setValue(value: Value): void; + toString(): string; +} +export declare enum ElementSize { + EMPTY = 0, + BIT = 1, + BYTE = 2, + TWO_BYTES = 3, + FOUR_BYTES = 4, + EIGHT_BYTES = 5, + POINTER = 6, + INLINE_COMPOSITE = 7 +} +export declare class CapnpVersion extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getMajor(): number; + setMajor(value: number): void; + getMinor(): number; + setMinor(value: number): void; + getMicro(): number; + setMicro(value: number): void; + toString(): string; +} +export declare class CodeGeneratorRequest_RequestedFile_Import extends __S { + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + getName(): string; + setName(value: string): void; + toString(): string; +} +export declare class CodeGeneratorRequest_RequestedFile extends __S { + static readonly Import: typeof CodeGeneratorRequest_RequestedFile_Import; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Imports: capnp.ListCtor<CodeGeneratorRequest_RequestedFile_Import>; + getId(): capnp.Uint64; + setId(value: capnp.Uint64): void; + getFilename(): string; + setFilename(value: string): void; + adoptImports(value: capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile_Import>>): void; + disownImports(): capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile_Import>>; + getImports(): capnp.List<CodeGeneratorRequest_RequestedFile_Import>; + hasImports(): boolean; + initImports(length: number): capnp.List<CodeGeneratorRequest_RequestedFile_Import>; + setImports(value: capnp.List<CodeGeneratorRequest_RequestedFile_Import>): void; + toString(): string; +} +export declare class CodeGeneratorRequest extends __S { + static readonly RequestedFile: typeof CodeGeneratorRequest_RequestedFile; + static readonly _capnp: { + displayName: string; + id: string; + size: capnp.ObjectSize; + }; + static _Nodes: capnp.ListCtor<Node>; + static _RequestedFiles: capnp.ListCtor<CodeGeneratorRequest_RequestedFile>; + adoptCapnpVersion(value: capnp.Orphan<CapnpVersion>): void; + disownCapnpVersion(): capnp.Orphan<CapnpVersion>; + getCapnpVersion(): CapnpVersion; + hasCapnpVersion(): boolean; + initCapnpVersion(): CapnpVersion; + setCapnpVersion(value: CapnpVersion): void; + adoptNodes(value: capnp.Orphan<capnp.List<Node>>): void; + disownNodes(): capnp.Orphan<capnp.List<Node>>; + getNodes(): capnp.List<Node>; + hasNodes(): boolean; + initNodes(length: number): capnp.List<Node>; + setNodes(value: capnp.List<Node>): void; + adoptRequestedFiles(value: capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile>>): void; + disownRequestedFiles(): capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile>>; + getRequestedFiles(): capnp.List<CodeGeneratorRequest_RequestedFile>; + hasRequestedFiles(): boolean; + initRequestedFiles(length: number): capnp.List<CodeGeneratorRequest_RequestedFile>; + setRequestedFiles(value: capnp.List<CodeGeneratorRequest_RequestedFile>): void; + toString(): string; +} diff --git a/node_modules/capnp-ts/src/std/schema.capnp.js b/node_modules/capnp-ts/src/std/schema.capnp.js new file mode 100644 index 0000000..c9861cf --- /dev/null +++ b/node_modules/capnp-ts/src/std/schema.capnp.js @@ -0,0 +1,1081 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGeneratorRequest = exports.CodeGeneratorRequest_RequestedFile = exports.CodeGeneratorRequest_RequestedFile_Import = exports.CapnpVersion = exports.ElementSize = exports.Annotation = exports.Value = exports.Value_Which = exports.Brand = exports.Brand_Binding = exports.Brand_Binding_Which = exports.Brand_Scope = exports.Brand_Scope_Which = exports.Type = exports.Type_Which = exports.Type_AnyPointer = exports.Type_AnyPointer_Which = exports.Type_AnyPointer_ImplicitMethodParameter = exports.Type_AnyPointer_Parameter = exports.Type_AnyPointer_Unconstrained = exports.Type_AnyPointer_Unconstrained_Which = exports.Type_Interface = exports.Type_Struct = exports.Type_Enum = exports.Type_List = exports.Method = exports.Superclass = exports.Enumerant = exports.Field = exports.Field_Which = exports.Field_Ordinal = exports.Field_Ordinal_Which = exports.Field_Group = exports.Field_Slot = exports.Node = exports.Node_Which = exports.Node_Annotation = exports.Node_Const = exports.Node_Interface = exports.Node_Enum = exports.Node_Struct = exports.Node_NestedNode = exports.Node_Parameter = exports._capnpFileId = void 0; +const tslib_1 = require("tslib"); +const capnp = tslib_1.__importStar(require("../index")); +const index_1 = require("../index"); +exports._capnpFileId = "a93fc509624c72d9"; +class Node_Parameter extends index_1.Struct { + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + toString() { return "Node_Parameter_" + super.toString(); } +} +exports.Node_Parameter = Node_Parameter; +Node_Parameter._capnp = { displayName: "Parameter", id: "b9521bccf10fa3b1", size: new index_1.ObjectSize(0, 1) }; +class Node_NestedNode extends index_1.Struct { + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + toString() { return "Node_NestedNode_" + super.toString(); } +} +exports.Node_NestedNode = Node_NestedNode; +Node_NestedNode._capnp = { displayName: "NestedNode", id: "debf55bbfa0fc242", size: new index_1.ObjectSize(8, 1) }; +class Node_Struct extends index_1.Struct { + getDataWordCount() { return index_1.Struct.getUint16(14, this); } + setDataWordCount(value) { index_1.Struct.setUint16(14, value, this); } + getPointerCount() { return index_1.Struct.getUint16(24, this); } + setPointerCount(value) { index_1.Struct.setUint16(24, value, this); } + getPreferredListEncoding() { return index_1.Struct.getUint16(26, this); } + setPreferredListEncoding(value) { index_1.Struct.setUint16(26, value, this); } + getIsGroup() { return index_1.Struct.getBit(224, this); } + setIsGroup(value) { index_1.Struct.setBit(224, value, this); } + getDiscriminantCount() { return index_1.Struct.getUint16(30, this); } + setDiscriminantCount(value) { index_1.Struct.setUint16(30, value, this); } + getDiscriminantOffset() { return index_1.Struct.getUint32(32, this); } + setDiscriminantOffset(value) { index_1.Struct.setUint32(32, value, this); } + adoptFields(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownFields() { return index_1.Struct.disown(this.getFields()); } + getFields() { return index_1.Struct.getList(3, Node_Struct._Fields, this); } + hasFields() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initFields(length) { return index_1.Struct.initList(3, Node_Struct._Fields, length, this); } + setFields(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + toString() { return "Node_Struct_" + super.toString(); } +} +exports.Node_Struct = Node_Struct; +Node_Struct._capnp = { displayName: "struct", id: "9ea0b19b37fb4435", size: new index_1.ObjectSize(40, 6) }; +class Node_Enum extends index_1.Struct { + adoptEnumerants(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownEnumerants() { return index_1.Struct.disown(this.getEnumerants()); } + getEnumerants() { return index_1.Struct.getList(3, Node_Enum._Enumerants, this); } + hasEnumerants() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initEnumerants(length) { return index_1.Struct.initList(3, Node_Enum._Enumerants, length, this); } + setEnumerants(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + toString() { return "Node_Enum_" + super.toString(); } +} +exports.Node_Enum = Node_Enum; +Node_Enum._capnp = { displayName: "enum", id: "b54ab3364333f598", size: new index_1.ObjectSize(40, 6) }; +class Node_Interface extends index_1.Struct { + adoptMethods(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownMethods() { return index_1.Struct.disown(this.getMethods()); } + getMethods() { return index_1.Struct.getList(3, Node_Interface._Methods, this); } + hasMethods() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initMethods(length) { return index_1.Struct.initList(3, Node_Interface._Methods, length, this); } + setMethods(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + adoptSuperclasses(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(4, this)); } + disownSuperclasses() { return index_1.Struct.disown(this.getSuperclasses()); } + getSuperclasses() { return index_1.Struct.getList(4, Node_Interface._Superclasses, this); } + hasSuperclasses() { return !index_1.Struct.isNull(index_1.Struct.getPointer(4, this)); } + initSuperclasses(length) { return index_1.Struct.initList(4, Node_Interface._Superclasses, length, this); } + setSuperclasses(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(4, this)); } + toString() { return "Node_Interface_" + super.toString(); } +} +exports.Node_Interface = Node_Interface; +Node_Interface._capnp = { displayName: "interface", id: "e82753cff0c2218f", size: new index_1.ObjectSize(40, 6) }; +class Node_Const extends index_1.Struct { + adoptType(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownType() { return index_1.Struct.disown(this.getType()); } + getType() { return index_1.Struct.getStruct(3, Type, this); } + hasType() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initType() { return index_1.Struct.initStructAt(3, Type, this); } + setType(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + adoptValue(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(4, this)); } + disownValue() { return index_1.Struct.disown(this.getValue()); } + getValue() { return index_1.Struct.getStruct(4, Value, this); } + hasValue() { return !index_1.Struct.isNull(index_1.Struct.getPointer(4, this)); } + initValue() { return index_1.Struct.initStructAt(4, Value, this); } + setValue(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(4, this)); } + toString() { return "Node_Const_" + super.toString(); } +} +exports.Node_Const = Node_Const; +Node_Const._capnp = { displayName: "const", id: "b18aa5ac7a0d9420", size: new index_1.ObjectSize(40, 6) }; +class Node_Annotation extends index_1.Struct { + adoptType(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownType() { return index_1.Struct.disown(this.getType()); } + getType() { return index_1.Struct.getStruct(3, Type, this); } + hasType() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initType() { return index_1.Struct.initStructAt(3, Type, this); } + setType(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + getTargetsFile() { return index_1.Struct.getBit(112, this); } + setTargetsFile(value) { index_1.Struct.setBit(112, value, this); } + getTargetsConst() { return index_1.Struct.getBit(113, this); } + setTargetsConst(value) { index_1.Struct.setBit(113, value, this); } + getTargetsEnum() { return index_1.Struct.getBit(114, this); } + setTargetsEnum(value) { index_1.Struct.setBit(114, value, this); } + getTargetsEnumerant() { return index_1.Struct.getBit(115, this); } + setTargetsEnumerant(value) { index_1.Struct.setBit(115, value, this); } + getTargetsStruct() { return index_1.Struct.getBit(116, this); } + setTargetsStruct(value) { index_1.Struct.setBit(116, value, this); } + getTargetsField() { return index_1.Struct.getBit(117, this); } + setTargetsField(value) { index_1.Struct.setBit(117, value, this); } + getTargetsUnion() { return index_1.Struct.getBit(118, this); } + setTargetsUnion(value) { index_1.Struct.setBit(118, value, this); } + getTargetsGroup() { return index_1.Struct.getBit(119, this); } + setTargetsGroup(value) { index_1.Struct.setBit(119, value, this); } + getTargetsInterface() { return index_1.Struct.getBit(120, this); } + setTargetsInterface(value) { index_1.Struct.setBit(120, value, this); } + getTargetsMethod() { return index_1.Struct.getBit(121, this); } + setTargetsMethod(value) { index_1.Struct.setBit(121, value, this); } + getTargetsParam() { return index_1.Struct.getBit(122, this); } + setTargetsParam(value) { index_1.Struct.setBit(122, value, this); } + getTargetsAnnotation() { return index_1.Struct.getBit(123, this); } + setTargetsAnnotation(value) { index_1.Struct.setBit(123, value, this); } + toString() { return "Node_Annotation_" + super.toString(); } +} +exports.Node_Annotation = Node_Annotation; +Node_Annotation._capnp = { displayName: "annotation", id: "ec1619d4400a0290", size: new index_1.ObjectSize(40, 6) }; +var Node_Which; +(function (Node_Which) { + Node_Which[Node_Which["FILE"] = 0] = "FILE"; + Node_Which[Node_Which["STRUCT"] = 1] = "STRUCT"; + Node_Which[Node_Which["ENUM"] = 2] = "ENUM"; + Node_Which[Node_Which["INTERFACE"] = 3] = "INTERFACE"; + Node_Which[Node_Which["CONST"] = 4] = "CONST"; + Node_Which[Node_Which["ANNOTATION"] = 5] = "ANNOTATION"; +})(Node_Which = exports.Node_Which || (exports.Node_Which = {})); +class Node extends index_1.Struct { + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + getDisplayName() { return index_1.Struct.getText(0, this); } + setDisplayName(value) { index_1.Struct.setText(0, value, this); } + getDisplayNamePrefixLength() { return index_1.Struct.getUint32(8, this); } + setDisplayNamePrefixLength(value) { index_1.Struct.setUint32(8, value, this); } + getScopeId() { return index_1.Struct.getUint64(16, this); } + setScopeId(value) { index_1.Struct.setUint64(16, value, this); } + adoptParameters(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(5, this)); } + disownParameters() { return index_1.Struct.disown(this.getParameters()); } + getParameters() { return index_1.Struct.getList(5, Node._Parameters, this); } + hasParameters() { return !index_1.Struct.isNull(index_1.Struct.getPointer(5, this)); } + initParameters(length) { return index_1.Struct.initList(5, Node._Parameters, length, this); } + setParameters(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(5, this)); } + getIsGeneric() { return index_1.Struct.getBit(288, this); } + setIsGeneric(value) { index_1.Struct.setBit(288, value, this); } + adoptNestedNodes(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownNestedNodes() { return index_1.Struct.disown(this.getNestedNodes()); } + getNestedNodes() { return index_1.Struct.getList(1, Node._NestedNodes, this); } + hasNestedNodes() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initNestedNodes(length) { return index_1.Struct.initList(1, Node._NestedNodes, length, this); } + setNestedNodes(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + adoptAnnotations(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(2, this)); } + disownAnnotations() { return index_1.Struct.disown(this.getAnnotations()); } + getAnnotations() { return index_1.Struct.getList(2, Node._Annotations, this); } + hasAnnotations() { return !index_1.Struct.isNull(index_1.Struct.getPointer(2, this)); } + initAnnotations(length) { return index_1.Struct.initList(2, Node._Annotations, length, this); } + setAnnotations(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(2, this)); } + isFile() { return index_1.Struct.getUint16(12, this) === 0; } + setFile() { index_1.Struct.setUint16(12, 0, this); } + getStruct() { + index_1.Struct.testWhich("struct", index_1.Struct.getUint16(12, this), 1, this); + return index_1.Struct.getAs(Node_Struct, this); + } + initStruct() { + index_1.Struct.setUint16(12, 1, this); + return index_1.Struct.getAs(Node_Struct, this); + } + isStruct() { return index_1.Struct.getUint16(12, this) === 1; } + setStruct() { index_1.Struct.setUint16(12, 1, this); } + getEnum() { + index_1.Struct.testWhich("enum", index_1.Struct.getUint16(12, this), 2, this); + return index_1.Struct.getAs(Node_Enum, this); + } + initEnum() { + index_1.Struct.setUint16(12, 2, this); + return index_1.Struct.getAs(Node_Enum, this); + } + isEnum() { return index_1.Struct.getUint16(12, this) === 2; } + setEnum() { index_1.Struct.setUint16(12, 2, this); } + getInterface() { + index_1.Struct.testWhich("interface", index_1.Struct.getUint16(12, this), 3, this); + return index_1.Struct.getAs(Node_Interface, this); + } + initInterface() { + index_1.Struct.setUint16(12, 3, this); + return index_1.Struct.getAs(Node_Interface, this); + } + isInterface() { return index_1.Struct.getUint16(12, this) === 3; } + setInterface() { index_1.Struct.setUint16(12, 3, this); } + getConst() { + index_1.Struct.testWhich("const", index_1.Struct.getUint16(12, this), 4, this); + return index_1.Struct.getAs(Node_Const, this); + } + initConst() { + index_1.Struct.setUint16(12, 4, this); + return index_1.Struct.getAs(Node_Const, this); + } + isConst() { return index_1.Struct.getUint16(12, this) === 4; } + setConst() { index_1.Struct.setUint16(12, 4, this); } + getAnnotation() { + index_1.Struct.testWhich("annotation", index_1.Struct.getUint16(12, this), 5, this); + return index_1.Struct.getAs(Node_Annotation, this); + } + initAnnotation() { + index_1.Struct.setUint16(12, 5, this); + return index_1.Struct.getAs(Node_Annotation, this); + } + isAnnotation() { return index_1.Struct.getUint16(12, this) === 5; } + setAnnotation() { index_1.Struct.setUint16(12, 5, this); } + toString() { return "Node_" + super.toString(); } + which() { return index_1.Struct.getUint16(12, this); } +} +exports.Node = Node; +Node.FILE = Node_Which.FILE; +Node.STRUCT = Node_Which.STRUCT; +Node.ENUM = Node_Which.ENUM; +Node.INTERFACE = Node_Which.INTERFACE; +Node.CONST = Node_Which.CONST; +Node.ANNOTATION = Node_Which.ANNOTATION; +Node.Parameter = Node_Parameter; +Node.NestedNode = Node_NestedNode; +Node._capnp = { displayName: "Node", id: "e682ab4cf923a417", size: new index_1.ObjectSize(40, 6) }; +class Field_Slot extends index_1.Struct { + getOffset() { return index_1.Struct.getUint32(4, this); } + setOffset(value) { index_1.Struct.setUint32(4, value, this); } + adoptType(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(2, this)); } + disownType() { return index_1.Struct.disown(this.getType()); } + getType() { return index_1.Struct.getStruct(2, Type, this); } + hasType() { return !index_1.Struct.isNull(index_1.Struct.getPointer(2, this)); } + initType() { return index_1.Struct.initStructAt(2, Type, this); } + setType(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(2, this)); } + adoptDefaultValue(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownDefaultValue() { return index_1.Struct.disown(this.getDefaultValue()); } + getDefaultValue() { return index_1.Struct.getStruct(3, Value, this); } + hasDefaultValue() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initDefaultValue() { return index_1.Struct.initStructAt(3, Value, this); } + setDefaultValue(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + getHadExplicitDefault() { return index_1.Struct.getBit(128, this); } + setHadExplicitDefault(value) { index_1.Struct.setBit(128, value, this); } + toString() { return "Field_Slot_" + super.toString(); } +} +exports.Field_Slot = Field_Slot; +Field_Slot._capnp = { displayName: "slot", id: "c42305476bb4746f", size: new index_1.ObjectSize(24, 4) }; +class Field_Group extends index_1.Struct { + getTypeId() { return index_1.Struct.getUint64(16, this); } + setTypeId(value) { index_1.Struct.setUint64(16, value, this); } + toString() { return "Field_Group_" + super.toString(); } +} +exports.Field_Group = Field_Group; +Field_Group._capnp = { displayName: "group", id: "cafccddb68db1d11", size: new index_1.ObjectSize(24, 4) }; +var Field_Ordinal_Which; +(function (Field_Ordinal_Which) { + Field_Ordinal_Which[Field_Ordinal_Which["IMPLICIT"] = 0] = "IMPLICIT"; + Field_Ordinal_Which[Field_Ordinal_Which["EXPLICIT"] = 1] = "EXPLICIT"; +})(Field_Ordinal_Which = exports.Field_Ordinal_Which || (exports.Field_Ordinal_Which = {})); +class Field_Ordinal extends index_1.Struct { + isImplicit() { return index_1.Struct.getUint16(10, this) === 0; } + setImplicit() { index_1.Struct.setUint16(10, 0, this); } + getExplicit() { + index_1.Struct.testWhich("explicit", index_1.Struct.getUint16(10, this), 1, this); + return index_1.Struct.getUint16(12, this); + } + isExplicit() { return index_1.Struct.getUint16(10, this) === 1; } + setExplicit(value) { + index_1.Struct.setUint16(10, 1, this); + index_1.Struct.setUint16(12, value, this); + } + toString() { return "Field_Ordinal_" + super.toString(); } + which() { return index_1.Struct.getUint16(10, this); } +} +exports.Field_Ordinal = Field_Ordinal; +Field_Ordinal.IMPLICIT = Field_Ordinal_Which.IMPLICIT; +Field_Ordinal.EXPLICIT = Field_Ordinal_Which.EXPLICIT; +Field_Ordinal._capnp = { displayName: "ordinal", id: "bb90d5c287870be6", size: new index_1.ObjectSize(24, 4) }; +var Field_Which; +(function (Field_Which) { + Field_Which[Field_Which["SLOT"] = 0] = "SLOT"; + Field_Which[Field_Which["GROUP"] = 1] = "GROUP"; +})(Field_Which = exports.Field_Which || (exports.Field_Which = {})); +class Field extends index_1.Struct { + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + getCodeOrder() { return index_1.Struct.getUint16(0, this); } + setCodeOrder(value) { index_1.Struct.setUint16(0, value, this); } + adoptAnnotations(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownAnnotations() { return index_1.Struct.disown(this.getAnnotations()); } + getAnnotations() { return index_1.Struct.getList(1, Field._Annotations, this); } + hasAnnotations() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initAnnotations(length) { return index_1.Struct.initList(1, Field._Annotations, length, this); } + setAnnotations(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + getDiscriminantValue() { return index_1.Struct.getUint16(2, this, Field._capnp.defaultDiscriminantValue); } + setDiscriminantValue(value) { index_1.Struct.setUint16(2, value, this); } + getSlot() { + index_1.Struct.testWhich("slot", index_1.Struct.getUint16(8, this), 0, this); + return index_1.Struct.getAs(Field_Slot, this); + } + initSlot() { + index_1.Struct.setUint16(8, 0, this); + return index_1.Struct.getAs(Field_Slot, this); + } + isSlot() { return index_1.Struct.getUint16(8, this) === 0; } + setSlot() { index_1.Struct.setUint16(8, 0, this); } + getGroup() { + index_1.Struct.testWhich("group", index_1.Struct.getUint16(8, this), 1, this); + return index_1.Struct.getAs(Field_Group, this); + } + initGroup() { + index_1.Struct.setUint16(8, 1, this); + return index_1.Struct.getAs(Field_Group, this); + } + isGroup() { return index_1.Struct.getUint16(8, this) === 1; } + setGroup() { index_1.Struct.setUint16(8, 1, this); } + getOrdinal() { return index_1.Struct.getAs(Field_Ordinal, this); } + initOrdinal() { return index_1.Struct.getAs(Field_Ordinal, this); } + toString() { return "Field_" + super.toString(); } + which() { return index_1.Struct.getUint16(8, this); } +} +exports.Field = Field; +Field.NO_DISCRIMINANT = 65535; +Field.SLOT = Field_Which.SLOT; +Field.GROUP = Field_Which.GROUP; +Field._capnp = { displayName: "Field", id: "9aad50a41f4af45f", size: new index_1.ObjectSize(24, 4), defaultDiscriminantValue: capnp.getUint16Mask(65535) }; +class Enumerant extends index_1.Struct { + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + getCodeOrder() { return index_1.Struct.getUint16(0, this); } + setCodeOrder(value) { index_1.Struct.setUint16(0, value, this); } + adoptAnnotations(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownAnnotations() { return index_1.Struct.disown(this.getAnnotations()); } + getAnnotations() { return index_1.Struct.getList(1, Enumerant._Annotations, this); } + hasAnnotations() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initAnnotations(length) { return index_1.Struct.initList(1, Enumerant._Annotations, length, this); } + setAnnotations(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "Enumerant_" + super.toString(); } +} +exports.Enumerant = Enumerant; +Enumerant._capnp = { displayName: "Enumerant", id: "978a7cebdc549a4d", size: new index_1.ObjectSize(8, 2) }; +class Superclass extends index_1.Struct { + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + adoptBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownBrand() { return index_1.Struct.disown(this.getBrand()); } + getBrand() { return index_1.Struct.getStruct(0, Brand, this); } + hasBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBrand() { return index_1.Struct.initStructAt(0, Brand, this); } + setBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Superclass_" + super.toString(); } +} +exports.Superclass = Superclass; +Superclass._capnp = { displayName: "Superclass", id: "a9962a9ed0a4d7f8", size: new index_1.ObjectSize(8, 1) }; +class Method extends index_1.Struct { + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + getCodeOrder() { return index_1.Struct.getUint16(0, this); } + setCodeOrder(value) { index_1.Struct.setUint16(0, value, this); } + adoptImplicitParameters(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(4, this)); } + disownImplicitParameters() { return index_1.Struct.disown(this.getImplicitParameters()); } + getImplicitParameters() { return index_1.Struct.getList(4, Method._ImplicitParameters, this); } + hasImplicitParameters() { return !index_1.Struct.isNull(index_1.Struct.getPointer(4, this)); } + initImplicitParameters(length) { return index_1.Struct.initList(4, Method._ImplicitParameters, length, this); } + setImplicitParameters(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(4, this)); } + getParamStructType() { return index_1.Struct.getUint64(8, this); } + setParamStructType(value) { index_1.Struct.setUint64(8, value, this); } + adoptParamBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(2, this)); } + disownParamBrand() { return index_1.Struct.disown(this.getParamBrand()); } + getParamBrand() { return index_1.Struct.getStruct(2, Brand, this); } + hasParamBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(2, this)); } + initParamBrand() { return index_1.Struct.initStructAt(2, Brand, this); } + setParamBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(2, this)); } + getResultStructType() { return index_1.Struct.getUint64(16, this); } + setResultStructType(value) { index_1.Struct.setUint64(16, value, this); } + adoptResultBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(3, this)); } + disownResultBrand() { return index_1.Struct.disown(this.getResultBrand()); } + getResultBrand() { return index_1.Struct.getStruct(3, Brand, this); } + hasResultBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(3, this)); } + initResultBrand() { return index_1.Struct.initStructAt(3, Brand, this); } + setResultBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(3, this)); } + adoptAnnotations(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownAnnotations() { return index_1.Struct.disown(this.getAnnotations()); } + getAnnotations() { return index_1.Struct.getList(1, Method._Annotations, this); } + hasAnnotations() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initAnnotations(length) { return index_1.Struct.initList(1, Method._Annotations, length, this); } + setAnnotations(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "Method_" + super.toString(); } +} +exports.Method = Method; +Method._capnp = { displayName: "Method", id: "9500cce23b334d80", size: new index_1.ObjectSize(24, 5) }; +class Type_List extends index_1.Struct { + adoptElementType(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownElementType() { return index_1.Struct.disown(this.getElementType()); } + getElementType() { return index_1.Struct.getStruct(0, Type, this); } + hasElementType() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initElementType() { return index_1.Struct.initStructAt(0, Type, this); } + setElementType(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Type_List_" + super.toString(); } +} +exports.Type_List = Type_List; +Type_List._capnp = { displayName: "list", id: "87e739250a60ea97", size: new index_1.ObjectSize(24, 1) }; +class Type_Enum extends index_1.Struct { + getTypeId() { return index_1.Struct.getUint64(8, this); } + setTypeId(value) { index_1.Struct.setUint64(8, value, this); } + adoptBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownBrand() { return index_1.Struct.disown(this.getBrand()); } + getBrand() { return index_1.Struct.getStruct(0, Brand, this); } + hasBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBrand() { return index_1.Struct.initStructAt(0, Brand, this); } + setBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Type_Enum_" + super.toString(); } +} +exports.Type_Enum = Type_Enum; +Type_Enum._capnp = { displayName: "enum", id: "9e0e78711a7f87a9", size: new index_1.ObjectSize(24, 1) }; +class Type_Struct extends index_1.Struct { + getTypeId() { return index_1.Struct.getUint64(8, this); } + setTypeId(value) { index_1.Struct.setUint64(8, value, this); } + adoptBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownBrand() { return index_1.Struct.disown(this.getBrand()); } + getBrand() { return index_1.Struct.getStruct(0, Brand, this); } + hasBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBrand() { return index_1.Struct.initStructAt(0, Brand, this); } + setBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Type_Struct_" + super.toString(); } +} +exports.Type_Struct = Type_Struct; +Type_Struct._capnp = { displayName: "struct", id: "ac3a6f60ef4cc6d3", size: new index_1.ObjectSize(24, 1) }; +class Type_Interface extends index_1.Struct { + getTypeId() { return index_1.Struct.getUint64(8, this); } + setTypeId(value) { index_1.Struct.setUint64(8, value, this); } + adoptBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownBrand() { return index_1.Struct.disown(this.getBrand()); } + getBrand() { return index_1.Struct.getStruct(0, Brand, this); } + hasBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBrand() { return index_1.Struct.initStructAt(0, Brand, this); } + setBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Type_Interface_" + super.toString(); } +} +exports.Type_Interface = Type_Interface; +Type_Interface._capnp = { displayName: "interface", id: "ed8bca69f7fb0cbf", size: new index_1.ObjectSize(24, 1) }; +var Type_AnyPointer_Unconstrained_Which; +(function (Type_AnyPointer_Unconstrained_Which) { + Type_AnyPointer_Unconstrained_Which[Type_AnyPointer_Unconstrained_Which["ANY_KIND"] = 0] = "ANY_KIND"; + Type_AnyPointer_Unconstrained_Which[Type_AnyPointer_Unconstrained_Which["STRUCT"] = 1] = "STRUCT"; + Type_AnyPointer_Unconstrained_Which[Type_AnyPointer_Unconstrained_Which["LIST"] = 2] = "LIST"; + Type_AnyPointer_Unconstrained_Which[Type_AnyPointer_Unconstrained_Which["CAPABILITY"] = 3] = "CAPABILITY"; +})(Type_AnyPointer_Unconstrained_Which = exports.Type_AnyPointer_Unconstrained_Which || (exports.Type_AnyPointer_Unconstrained_Which = {})); +class Type_AnyPointer_Unconstrained extends index_1.Struct { + isAnyKind() { return index_1.Struct.getUint16(10, this) === 0; } + setAnyKind() { index_1.Struct.setUint16(10, 0, this); } + isStruct() { return index_1.Struct.getUint16(10, this) === 1; } + setStruct() { index_1.Struct.setUint16(10, 1, this); } + isList() { return index_1.Struct.getUint16(10, this) === 2; } + setList() { index_1.Struct.setUint16(10, 2, this); } + isCapability() { return index_1.Struct.getUint16(10, this) === 3; } + setCapability() { index_1.Struct.setUint16(10, 3, this); } + toString() { return "Type_AnyPointer_Unconstrained_" + super.toString(); } + which() { return index_1.Struct.getUint16(10, this); } +} +exports.Type_AnyPointer_Unconstrained = Type_AnyPointer_Unconstrained; +Type_AnyPointer_Unconstrained.ANY_KIND = Type_AnyPointer_Unconstrained_Which.ANY_KIND; +Type_AnyPointer_Unconstrained.STRUCT = Type_AnyPointer_Unconstrained_Which.STRUCT; +Type_AnyPointer_Unconstrained.LIST = Type_AnyPointer_Unconstrained_Which.LIST; +Type_AnyPointer_Unconstrained.CAPABILITY = Type_AnyPointer_Unconstrained_Which.CAPABILITY; +Type_AnyPointer_Unconstrained._capnp = { displayName: "unconstrained", id: "8e3b5f79fe593656", size: new index_1.ObjectSize(24, 1) }; +class Type_AnyPointer_Parameter extends index_1.Struct { + getScopeId() { return index_1.Struct.getUint64(16, this); } + setScopeId(value) { index_1.Struct.setUint64(16, value, this); } + getParameterIndex() { return index_1.Struct.getUint16(10, this); } + setParameterIndex(value) { index_1.Struct.setUint16(10, value, this); } + toString() { return "Type_AnyPointer_Parameter_" + super.toString(); } +} +exports.Type_AnyPointer_Parameter = Type_AnyPointer_Parameter; +Type_AnyPointer_Parameter._capnp = { displayName: "parameter", id: "9dd1f724f4614a85", size: new index_1.ObjectSize(24, 1) }; +class Type_AnyPointer_ImplicitMethodParameter extends index_1.Struct { + getParameterIndex() { return index_1.Struct.getUint16(10, this); } + setParameterIndex(value) { index_1.Struct.setUint16(10, value, this); } + toString() { return "Type_AnyPointer_ImplicitMethodParameter_" + super.toString(); } +} +exports.Type_AnyPointer_ImplicitMethodParameter = Type_AnyPointer_ImplicitMethodParameter; +Type_AnyPointer_ImplicitMethodParameter._capnp = { displayName: "implicitMethodParameter", id: "baefc9120c56e274", size: new index_1.ObjectSize(24, 1) }; +var Type_AnyPointer_Which; +(function (Type_AnyPointer_Which) { + Type_AnyPointer_Which[Type_AnyPointer_Which["UNCONSTRAINED"] = 0] = "UNCONSTRAINED"; + Type_AnyPointer_Which[Type_AnyPointer_Which["PARAMETER"] = 1] = "PARAMETER"; + Type_AnyPointer_Which[Type_AnyPointer_Which["IMPLICIT_METHOD_PARAMETER"] = 2] = "IMPLICIT_METHOD_PARAMETER"; +})(Type_AnyPointer_Which = exports.Type_AnyPointer_Which || (exports.Type_AnyPointer_Which = {})); +class Type_AnyPointer extends index_1.Struct { + getUnconstrained() { + index_1.Struct.testWhich("unconstrained", index_1.Struct.getUint16(8, this), 0, this); + return index_1.Struct.getAs(Type_AnyPointer_Unconstrained, this); + } + initUnconstrained() { + index_1.Struct.setUint16(8, 0, this); + return index_1.Struct.getAs(Type_AnyPointer_Unconstrained, this); + } + isUnconstrained() { return index_1.Struct.getUint16(8, this) === 0; } + setUnconstrained() { index_1.Struct.setUint16(8, 0, this); } + getParameter() { + index_1.Struct.testWhich("parameter", index_1.Struct.getUint16(8, this), 1, this); + return index_1.Struct.getAs(Type_AnyPointer_Parameter, this); + } + initParameter() { + index_1.Struct.setUint16(8, 1, this); + return index_1.Struct.getAs(Type_AnyPointer_Parameter, this); + } + isParameter() { return index_1.Struct.getUint16(8, this) === 1; } + setParameter() { index_1.Struct.setUint16(8, 1, this); } + getImplicitMethodParameter() { + index_1.Struct.testWhich("implicitMethodParameter", index_1.Struct.getUint16(8, this), 2, this); + return index_1.Struct.getAs(Type_AnyPointer_ImplicitMethodParameter, this); + } + initImplicitMethodParameter() { + index_1.Struct.setUint16(8, 2, this); + return index_1.Struct.getAs(Type_AnyPointer_ImplicitMethodParameter, this); + } + isImplicitMethodParameter() { return index_1.Struct.getUint16(8, this) === 2; } + setImplicitMethodParameter() { index_1.Struct.setUint16(8, 2, this); } + toString() { return "Type_AnyPointer_" + super.toString(); } + which() { return index_1.Struct.getUint16(8, this); } +} +exports.Type_AnyPointer = Type_AnyPointer; +Type_AnyPointer.UNCONSTRAINED = Type_AnyPointer_Which.UNCONSTRAINED; +Type_AnyPointer.PARAMETER = Type_AnyPointer_Which.PARAMETER; +Type_AnyPointer.IMPLICIT_METHOD_PARAMETER = Type_AnyPointer_Which.IMPLICIT_METHOD_PARAMETER; +Type_AnyPointer._capnp = { displayName: "anyPointer", id: "c2573fe8a23e49f1", size: new index_1.ObjectSize(24, 1) }; +var Type_Which; +(function (Type_Which) { + Type_Which[Type_Which["VOID"] = 0] = "VOID"; + Type_Which[Type_Which["BOOL"] = 1] = "BOOL"; + Type_Which[Type_Which["INT8"] = 2] = "INT8"; + Type_Which[Type_Which["INT16"] = 3] = "INT16"; + Type_Which[Type_Which["INT32"] = 4] = "INT32"; + Type_Which[Type_Which["INT64"] = 5] = "INT64"; + Type_Which[Type_Which["UINT8"] = 6] = "UINT8"; + Type_Which[Type_Which["UINT16"] = 7] = "UINT16"; + Type_Which[Type_Which["UINT32"] = 8] = "UINT32"; + Type_Which[Type_Which["UINT64"] = 9] = "UINT64"; + Type_Which[Type_Which["FLOAT32"] = 10] = "FLOAT32"; + Type_Which[Type_Which["FLOAT64"] = 11] = "FLOAT64"; + Type_Which[Type_Which["TEXT"] = 12] = "TEXT"; + Type_Which[Type_Which["DATA"] = 13] = "DATA"; + Type_Which[Type_Which["LIST"] = 14] = "LIST"; + Type_Which[Type_Which["ENUM"] = 15] = "ENUM"; + Type_Which[Type_Which["STRUCT"] = 16] = "STRUCT"; + Type_Which[Type_Which["INTERFACE"] = 17] = "INTERFACE"; + Type_Which[Type_Which["ANY_POINTER"] = 18] = "ANY_POINTER"; +})(Type_Which = exports.Type_Which || (exports.Type_Which = {})); +class Type extends index_1.Struct { + isVoid() { return index_1.Struct.getUint16(0, this) === 0; } + setVoid() { index_1.Struct.setUint16(0, 0, this); } + isBool() { return index_1.Struct.getUint16(0, this) === 1; } + setBool() { index_1.Struct.setUint16(0, 1, this); } + isInt8() { return index_1.Struct.getUint16(0, this) === 2; } + setInt8() { index_1.Struct.setUint16(0, 2, this); } + isInt16() { return index_1.Struct.getUint16(0, this) === 3; } + setInt16() { index_1.Struct.setUint16(0, 3, this); } + isInt32() { return index_1.Struct.getUint16(0, this) === 4; } + setInt32() { index_1.Struct.setUint16(0, 4, this); } + isInt64() { return index_1.Struct.getUint16(0, this) === 5; } + setInt64() { index_1.Struct.setUint16(0, 5, this); } + isUint8() { return index_1.Struct.getUint16(0, this) === 6; } + setUint8() { index_1.Struct.setUint16(0, 6, this); } + isUint16() { return index_1.Struct.getUint16(0, this) === 7; } + setUint16() { index_1.Struct.setUint16(0, 7, this); } + isUint32() { return index_1.Struct.getUint16(0, this) === 8; } + setUint32() { index_1.Struct.setUint16(0, 8, this); } + isUint64() { return index_1.Struct.getUint16(0, this) === 9; } + setUint64() { index_1.Struct.setUint16(0, 9, this); } + isFloat32() { return index_1.Struct.getUint16(0, this) === 10; } + setFloat32() { index_1.Struct.setUint16(0, 10, this); } + isFloat64() { return index_1.Struct.getUint16(0, this) === 11; } + setFloat64() { index_1.Struct.setUint16(0, 11, this); } + isText() { return index_1.Struct.getUint16(0, this) === 12; } + setText() { index_1.Struct.setUint16(0, 12, this); } + isData() { return index_1.Struct.getUint16(0, this) === 13; } + setData() { index_1.Struct.setUint16(0, 13, this); } + getList() { + index_1.Struct.testWhich("list", index_1.Struct.getUint16(0, this), 14, this); + return index_1.Struct.getAs(Type_List, this); + } + initList() { + index_1.Struct.setUint16(0, 14, this); + return index_1.Struct.getAs(Type_List, this); + } + isList() { return index_1.Struct.getUint16(0, this) === 14; } + setList() { index_1.Struct.setUint16(0, 14, this); } + getEnum() { + index_1.Struct.testWhich("enum", index_1.Struct.getUint16(0, this), 15, this); + return index_1.Struct.getAs(Type_Enum, this); + } + initEnum() { + index_1.Struct.setUint16(0, 15, this); + return index_1.Struct.getAs(Type_Enum, this); + } + isEnum() { return index_1.Struct.getUint16(0, this) === 15; } + setEnum() { index_1.Struct.setUint16(0, 15, this); } + getStruct() { + index_1.Struct.testWhich("struct", index_1.Struct.getUint16(0, this), 16, this); + return index_1.Struct.getAs(Type_Struct, this); + } + initStruct() { + index_1.Struct.setUint16(0, 16, this); + return index_1.Struct.getAs(Type_Struct, this); + } + isStruct() { return index_1.Struct.getUint16(0, this) === 16; } + setStruct() { index_1.Struct.setUint16(0, 16, this); } + getInterface() { + index_1.Struct.testWhich("interface", index_1.Struct.getUint16(0, this), 17, this); + return index_1.Struct.getAs(Type_Interface, this); + } + initInterface() { + index_1.Struct.setUint16(0, 17, this); + return index_1.Struct.getAs(Type_Interface, this); + } + isInterface() { return index_1.Struct.getUint16(0, this) === 17; } + setInterface() { index_1.Struct.setUint16(0, 17, this); } + getAnyPointer() { + index_1.Struct.testWhich("anyPointer", index_1.Struct.getUint16(0, this), 18, this); + return index_1.Struct.getAs(Type_AnyPointer, this); + } + initAnyPointer() { + index_1.Struct.setUint16(0, 18, this); + return index_1.Struct.getAs(Type_AnyPointer, this); + } + isAnyPointer() { return index_1.Struct.getUint16(0, this) === 18; } + setAnyPointer() { index_1.Struct.setUint16(0, 18, this); } + toString() { return "Type_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.Type = Type; +Type.VOID = Type_Which.VOID; +Type.BOOL = Type_Which.BOOL; +Type.INT8 = Type_Which.INT8; +Type.INT16 = Type_Which.INT16; +Type.INT32 = Type_Which.INT32; +Type.INT64 = Type_Which.INT64; +Type.UINT8 = Type_Which.UINT8; +Type.UINT16 = Type_Which.UINT16; +Type.UINT32 = Type_Which.UINT32; +Type.UINT64 = Type_Which.UINT64; +Type.FLOAT32 = Type_Which.FLOAT32; +Type.FLOAT64 = Type_Which.FLOAT64; +Type.TEXT = Type_Which.TEXT; +Type.DATA = Type_Which.DATA; +Type.LIST = Type_Which.LIST; +Type.ENUM = Type_Which.ENUM; +Type.STRUCT = Type_Which.STRUCT; +Type.INTERFACE = Type_Which.INTERFACE; +Type.ANY_POINTER = Type_Which.ANY_POINTER; +Type._capnp = { displayName: "Type", id: "d07378ede1f9cc60", size: new index_1.ObjectSize(24, 1) }; +var Brand_Scope_Which; +(function (Brand_Scope_Which) { + Brand_Scope_Which[Brand_Scope_Which["BIND"] = 0] = "BIND"; + Brand_Scope_Which[Brand_Scope_Which["INHERIT"] = 1] = "INHERIT"; +})(Brand_Scope_Which = exports.Brand_Scope_Which || (exports.Brand_Scope_Which = {})); +class Brand_Scope extends index_1.Struct { + getScopeId() { return index_1.Struct.getUint64(0, this); } + setScopeId(value) { index_1.Struct.setUint64(0, value, this); } + adoptBind(value) { + index_1.Struct.setUint16(8, 0, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownBind() { return index_1.Struct.disown(this.getBind()); } + getBind() { + index_1.Struct.testWhich("bind", index_1.Struct.getUint16(8, this), 0, this); + return index_1.Struct.getList(0, Brand_Scope._Bind, this); + } + hasBind() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initBind(length) { + index_1.Struct.setUint16(8, 0, this); + return index_1.Struct.initList(0, Brand_Scope._Bind, length, this); + } + isBind() { return index_1.Struct.getUint16(8, this) === 0; } + setBind(value) { + index_1.Struct.setUint16(8, 0, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + isInherit() { return index_1.Struct.getUint16(8, this) === 1; } + setInherit() { index_1.Struct.setUint16(8, 1, this); } + toString() { return "Brand_Scope_" + super.toString(); } + which() { return index_1.Struct.getUint16(8, this); } +} +exports.Brand_Scope = Brand_Scope; +Brand_Scope.BIND = Brand_Scope_Which.BIND; +Brand_Scope.INHERIT = Brand_Scope_Which.INHERIT; +Brand_Scope._capnp = { displayName: "Scope", id: "abd73485a9636bc9", size: new index_1.ObjectSize(16, 1) }; +var Brand_Binding_Which; +(function (Brand_Binding_Which) { + Brand_Binding_Which[Brand_Binding_Which["UNBOUND"] = 0] = "UNBOUND"; + Brand_Binding_Which[Brand_Binding_Which["TYPE"] = 1] = "TYPE"; +})(Brand_Binding_Which = exports.Brand_Binding_Which || (exports.Brand_Binding_Which = {})); +class Brand_Binding extends index_1.Struct { + isUnbound() { return index_1.Struct.getUint16(0, this) === 0; } + setUnbound() { index_1.Struct.setUint16(0, 0, this); } + adoptType(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownType() { return index_1.Struct.disown(this.getType()); } + getType() { + index_1.Struct.testWhich("type", index_1.Struct.getUint16(0, this), 1, this); + return index_1.Struct.getStruct(0, Type, this); + } + hasType() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initType() { + index_1.Struct.setUint16(0, 1, this); + return index_1.Struct.initStructAt(0, Type, this); + } + isType() { return index_1.Struct.getUint16(0, this) === 1; } + setType(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "Brand_Binding_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.Brand_Binding = Brand_Binding; +Brand_Binding.UNBOUND = Brand_Binding_Which.UNBOUND; +Brand_Binding.TYPE = Brand_Binding_Which.TYPE; +Brand_Binding._capnp = { displayName: "Binding", id: "c863cd16969ee7fc", size: new index_1.ObjectSize(8, 1) }; +class Brand extends index_1.Struct { + adoptScopes(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownScopes() { return index_1.Struct.disown(this.getScopes()); } + getScopes() { return index_1.Struct.getList(0, Brand._Scopes, this); } + hasScopes() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initScopes(length) { return index_1.Struct.initList(0, Brand._Scopes, length, this); } + setScopes(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Brand_" + super.toString(); } +} +exports.Brand = Brand; +Brand.Scope = Brand_Scope; +Brand.Binding = Brand_Binding; +Brand._capnp = { displayName: "Brand", id: "903455f06065422b", size: new index_1.ObjectSize(0, 1) }; +var Value_Which; +(function (Value_Which) { + Value_Which[Value_Which["VOID"] = 0] = "VOID"; + Value_Which[Value_Which["BOOL"] = 1] = "BOOL"; + Value_Which[Value_Which["INT8"] = 2] = "INT8"; + Value_Which[Value_Which["INT16"] = 3] = "INT16"; + Value_Which[Value_Which["INT32"] = 4] = "INT32"; + Value_Which[Value_Which["INT64"] = 5] = "INT64"; + Value_Which[Value_Which["UINT8"] = 6] = "UINT8"; + Value_Which[Value_Which["UINT16"] = 7] = "UINT16"; + Value_Which[Value_Which["UINT32"] = 8] = "UINT32"; + Value_Which[Value_Which["UINT64"] = 9] = "UINT64"; + Value_Which[Value_Which["FLOAT32"] = 10] = "FLOAT32"; + Value_Which[Value_Which["FLOAT64"] = 11] = "FLOAT64"; + Value_Which[Value_Which["TEXT"] = 12] = "TEXT"; + Value_Which[Value_Which["DATA"] = 13] = "DATA"; + Value_Which[Value_Which["LIST"] = 14] = "LIST"; + Value_Which[Value_Which["ENUM"] = 15] = "ENUM"; + Value_Which[Value_Which["STRUCT"] = 16] = "STRUCT"; + Value_Which[Value_Which["INTERFACE"] = 17] = "INTERFACE"; + Value_Which[Value_Which["ANY_POINTER"] = 18] = "ANY_POINTER"; +})(Value_Which = exports.Value_Which || (exports.Value_Which = {})); +class Value extends index_1.Struct { + isVoid() { return index_1.Struct.getUint16(0, this) === 0; } + setVoid() { index_1.Struct.setUint16(0, 0, this); } + getBool() { + index_1.Struct.testWhich("bool", index_1.Struct.getUint16(0, this), 1, this); + return index_1.Struct.getBit(16, this); + } + isBool() { return index_1.Struct.getUint16(0, this) === 1; } + setBool(value) { + index_1.Struct.setUint16(0, 1, this); + index_1.Struct.setBit(16, value, this); + } + getInt8() { + index_1.Struct.testWhich("int8", index_1.Struct.getUint16(0, this), 2, this); + return index_1.Struct.getInt8(2, this); + } + isInt8() { return index_1.Struct.getUint16(0, this) === 2; } + setInt8(value) { + index_1.Struct.setUint16(0, 2, this); + index_1.Struct.setInt8(2, value, this); + } + getInt16() { + index_1.Struct.testWhich("int16", index_1.Struct.getUint16(0, this), 3, this); + return index_1.Struct.getInt16(2, this); + } + isInt16() { return index_1.Struct.getUint16(0, this) === 3; } + setInt16(value) { + index_1.Struct.setUint16(0, 3, this); + index_1.Struct.setInt16(2, value, this); + } + getInt32() { + index_1.Struct.testWhich("int32", index_1.Struct.getUint16(0, this), 4, this); + return index_1.Struct.getInt32(4, this); + } + isInt32() { return index_1.Struct.getUint16(0, this) === 4; } + setInt32(value) { + index_1.Struct.setUint16(0, 4, this); + index_1.Struct.setInt32(4, value, this); + } + getInt64() { + index_1.Struct.testWhich("int64", index_1.Struct.getUint16(0, this), 5, this); + return index_1.Struct.getInt64(8, this); + } + isInt64() { return index_1.Struct.getUint16(0, this) === 5; } + setInt64(value) { + index_1.Struct.setUint16(0, 5, this); + index_1.Struct.setInt64(8, value, this); + } + getUint8() { + index_1.Struct.testWhich("uint8", index_1.Struct.getUint16(0, this), 6, this); + return index_1.Struct.getUint8(2, this); + } + isUint8() { return index_1.Struct.getUint16(0, this) === 6; } + setUint8(value) { + index_1.Struct.setUint16(0, 6, this); + index_1.Struct.setUint8(2, value, this); + } + getUint16() { + index_1.Struct.testWhich("uint16", index_1.Struct.getUint16(0, this), 7, this); + return index_1.Struct.getUint16(2, this); + } + isUint16() { return index_1.Struct.getUint16(0, this) === 7; } + setUint16(value) { + index_1.Struct.setUint16(0, 7, this); + index_1.Struct.setUint16(2, value, this); + } + getUint32() { + index_1.Struct.testWhich("uint32", index_1.Struct.getUint16(0, this), 8, this); + return index_1.Struct.getUint32(4, this); + } + isUint32() { return index_1.Struct.getUint16(0, this) === 8; } + setUint32(value) { + index_1.Struct.setUint16(0, 8, this); + index_1.Struct.setUint32(4, value, this); + } + getUint64() { + index_1.Struct.testWhich("uint64", index_1.Struct.getUint16(0, this), 9, this); + return index_1.Struct.getUint64(8, this); + } + isUint64() { return index_1.Struct.getUint16(0, this) === 9; } + setUint64(value) { + index_1.Struct.setUint16(0, 9, this); + index_1.Struct.setUint64(8, value, this); + } + getFloat32() { + index_1.Struct.testWhich("float32", index_1.Struct.getUint16(0, this), 10, this); + return index_1.Struct.getFloat32(4, this); + } + isFloat32() { return index_1.Struct.getUint16(0, this) === 10; } + setFloat32(value) { + index_1.Struct.setUint16(0, 10, this); + index_1.Struct.setFloat32(4, value, this); + } + getFloat64() { + index_1.Struct.testWhich("float64", index_1.Struct.getUint16(0, this), 11, this); + return index_1.Struct.getFloat64(8, this); + } + isFloat64() { return index_1.Struct.getUint16(0, this) === 11; } + setFloat64(value) { + index_1.Struct.setUint16(0, 11, this); + index_1.Struct.setFloat64(8, value, this); + } + getText() { + index_1.Struct.testWhich("text", index_1.Struct.getUint16(0, this), 12, this); + return index_1.Struct.getText(0, this); + } + isText() { return index_1.Struct.getUint16(0, this) === 12; } + setText(value) { + index_1.Struct.setUint16(0, 12, this); + index_1.Struct.setText(0, value, this); + } + adoptData(value) { + index_1.Struct.setUint16(0, 13, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownData() { return index_1.Struct.disown(this.getData()); } + getData() { + index_1.Struct.testWhich("data", index_1.Struct.getUint16(0, this), 13, this); + return index_1.Struct.getData(0, this); + } + hasData() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initData(length) { + index_1.Struct.setUint16(0, 13, this); + return index_1.Struct.initData(0, length, this); + } + isData() { return index_1.Struct.getUint16(0, this) === 13; } + setData(value) { + index_1.Struct.setUint16(0, 13, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + adoptList(value) { + index_1.Struct.setUint16(0, 14, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownList() { return index_1.Struct.disown(this.getList()); } + getList() { + index_1.Struct.testWhich("list", index_1.Struct.getUint16(0, this), 14, this); + return index_1.Struct.getPointer(0, this); + } + hasList() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isList() { return index_1.Struct.getUint16(0, this) === 14; } + setList(value) { + index_1.Struct.setUint16(0, 14, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + getEnum() { + index_1.Struct.testWhich("enum", index_1.Struct.getUint16(0, this), 15, this); + return index_1.Struct.getUint16(2, this); + } + isEnum() { return index_1.Struct.getUint16(0, this) === 15; } + setEnum(value) { + index_1.Struct.setUint16(0, 15, this); + index_1.Struct.setUint16(2, value, this); + } + adoptStruct(value) { + index_1.Struct.setUint16(0, 16, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownStruct() { return index_1.Struct.disown(this.getStruct()); } + getStruct() { + index_1.Struct.testWhich("struct", index_1.Struct.getUint16(0, this), 16, this); + return index_1.Struct.getPointer(0, this); + } + hasStruct() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isStruct() { return index_1.Struct.getUint16(0, this) === 16; } + setStruct(value) { + index_1.Struct.setUint16(0, 16, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + isInterface() { return index_1.Struct.getUint16(0, this) === 17; } + setInterface() { index_1.Struct.setUint16(0, 17, this); } + adoptAnyPointer(value) { + index_1.Struct.setUint16(0, 18, this); + index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); + } + disownAnyPointer() { return index_1.Struct.disown(this.getAnyPointer()); } + getAnyPointer() { + index_1.Struct.testWhich("anyPointer", index_1.Struct.getUint16(0, this), 18, this); + return index_1.Struct.getPointer(0, this); + } + hasAnyPointer() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + isAnyPointer() { return index_1.Struct.getUint16(0, this) === 18; } + setAnyPointer(value) { + index_1.Struct.setUint16(0, 18, this); + index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); + } + toString() { return "Value_" + super.toString(); } + which() { return index_1.Struct.getUint16(0, this); } +} +exports.Value = Value; +Value.VOID = Value_Which.VOID; +Value.BOOL = Value_Which.BOOL; +Value.INT8 = Value_Which.INT8; +Value.INT16 = Value_Which.INT16; +Value.INT32 = Value_Which.INT32; +Value.INT64 = Value_Which.INT64; +Value.UINT8 = Value_Which.UINT8; +Value.UINT16 = Value_Which.UINT16; +Value.UINT32 = Value_Which.UINT32; +Value.UINT64 = Value_Which.UINT64; +Value.FLOAT32 = Value_Which.FLOAT32; +Value.FLOAT64 = Value_Which.FLOAT64; +Value.TEXT = Value_Which.TEXT; +Value.DATA = Value_Which.DATA; +Value.LIST = Value_Which.LIST; +Value.ENUM = Value_Which.ENUM; +Value.STRUCT = Value_Which.STRUCT; +Value.INTERFACE = Value_Which.INTERFACE; +Value.ANY_POINTER = Value_Which.ANY_POINTER; +Value._capnp = { displayName: "Value", id: "ce23dcd2d7b00c9b", size: new index_1.ObjectSize(16, 1) }; +class Annotation extends index_1.Struct { + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + adoptBrand(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownBrand() { return index_1.Struct.disown(this.getBrand()); } + getBrand() { return index_1.Struct.getStruct(1, Brand, this); } + hasBrand() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initBrand() { return index_1.Struct.initStructAt(1, Brand, this); } + setBrand(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + adoptValue(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownValue() { return index_1.Struct.disown(this.getValue()); } + getValue() { return index_1.Struct.getStruct(0, Value, this); } + hasValue() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initValue() { return index_1.Struct.initStructAt(0, Value, this); } + setValue(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + toString() { return "Annotation_" + super.toString(); } +} +exports.Annotation = Annotation; +Annotation._capnp = { displayName: "Annotation", id: "f1c8950dab257542", size: new index_1.ObjectSize(8, 2) }; +var ElementSize; +(function (ElementSize) { + ElementSize[ElementSize["EMPTY"] = 0] = "EMPTY"; + ElementSize[ElementSize["BIT"] = 1] = "BIT"; + ElementSize[ElementSize["BYTE"] = 2] = "BYTE"; + ElementSize[ElementSize["TWO_BYTES"] = 3] = "TWO_BYTES"; + ElementSize[ElementSize["FOUR_BYTES"] = 4] = "FOUR_BYTES"; + ElementSize[ElementSize["EIGHT_BYTES"] = 5] = "EIGHT_BYTES"; + ElementSize[ElementSize["POINTER"] = 6] = "POINTER"; + ElementSize[ElementSize["INLINE_COMPOSITE"] = 7] = "INLINE_COMPOSITE"; +})(ElementSize = exports.ElementSize || (exports.ElementSize = {})); +class CapnpVersion extends index_1.Struct { + getMajor() { return index_1.Struct.getUint16(0, this); } + setMajor(value) { index_1.Struct.setUint16(0, value, this); } + getMinor() { return index_1.Struct.getUint8(2, this); } + setMinor(value) { index_1.Struct.setUint8(2, value, this); } + getMicro() { return index_1.Struct.getUint8(3, this); } + setMicro(value) { index_1.Struct.setUint8(3, value, this); } + toString() { return "CapnpVersion_" + super.toString(); } +} +exports.CapnpVersion = CapnpVersion; +CapnpVersion._capnp = { displayName: "CapnpVersion", id: "d85d305b7d839963", size: new index_1.ObjectSize(8, 0) }; +class CodeGeneratorRequest_RequestedFile_Import extends index_1.Struct { + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + getName() { return index_1.Struct.getText(0, this); } + setName(value) { index_1.Struct.setText(0, value, this); } + toString() { return "CodeGeneratorRequest_RequestedFile_Import_" + super.toString(); } +} +exports.CodeGeneratorRequest_RequestedFile_Import = CodeGeneratorRequest_RequestedFile_Import; +CodeGeneratorRequest_RequestedFile_Import._capnp = { displayName: "Import", id: "ae504193122357e5", size: new index_1.ObjectSize(8, 1) }; +class CodeGeneratorRequest_RequestedFile extends index_1.Struct { + getId() { return index_1.Struct.getUint64(0, this); } + setId(value) { index_1.Struct.setUint64(0, value, this); } + getFilename() { return index_1.Struct.getText(0, this); } + setFilename(value) { index_1.Struct.setText(0, value, this); } + adoptImports(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownImports() { return index_1.Struct.disown(this.getImports()); } + getImports() { return index_1.Struct.getList(1, CodeGeneratorRequest_RequestedFile._Imports, this); } + hasImports() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initImports(length) { return index_1.Struct.initList(1, CodeGeneratorRequest_RequestedFile._Imports, length, this); } + setImports(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "CodeGeneratorRequest_RequestedFile_" + super.toString(); } +} +exports.CodeGeneratorRequest_RequestedFile = CodeGeneratorRequest_RequestedFile; +CodeGeneratorRequest_RequestedFile.Import = CodeGeneratorRequest_RequestedFile_Import; +CodeGeneratorRequest_RequestedFile._capnp = { displayName: "RequestedFile", id: "cfea0eb02e810062", size: new index_1.ObjectSize(8, 2) }; +class CodeGeneratorRequest extends index_1.Struct { + adoptCapnpVersion(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(2, this)); } + disownCapnpVersion() { return index_1.Struct.disown(this.getCapnpVersion()); } + getCapnpVersion() { return index_1.Struct.getStruct(2, CapnpVersion, this); } + hasCapnpVersion() { return !index_1.Struct.isNull(index_1.Struct.getPointer(2, this)); } + initCapnpVersion() { return index_1.Struct.initStructAt(2, CapnpVersion, this); } + setCapnpVersion(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(2, this)); } + adoptNodes(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(0, this)); } + disownNodes() { return index_1.Struct.disown(this.getNodes()); } + getNodes() { return index_1.Struct.getList(0, CodeGeneratorRequest._Nodes, this); } + hasNodes() { return !index_1.Struct.isNull(index_1.Struct.getPointer(0, this)); } + initNodes(length) { return index_1.Struct.initList(0, CodeGeneratorRequest._Nodes, length, this); } + setNodes(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(0, this)); } + adoptRequestedFiles(value) { index_1.Struct.adopt(value, index_1.Struct.getPointer(1, this)); } + disownRequestedFiles() { return index_1.Struct.disown(this.getRequestedFiles()); } + getRequestedFiles() { return index_1.Struct.getList(1, CodeGeneratorRequest._RequestedFiles, this); } + hasRequestedFiles() { return !index_1.Struct.isNull(index_1.Struct.getPointer(1, this)); } + initRequestedFiles(length) { return index_1.Struct.initList(1, CodeGeneratorRequest._RequestedFiles, length, this); } + setRequestedFiles(value) { index_1.Struct.copyFrom(value, index_1.Struct.getPointer(1, this)); } + toString() { return "CodeGeneratorRequest_" + super.toString(); } +} +exports.CodeGeneratorRequest = CodeGeneratorRequest; +CodeGeneratorRequest.RequestedFile = CodeGeneratorRequest_RequestedFile; +CodeGeneratorRequest._capnp = { displayName: "CodeGeneratorRequest", id: "bfc546f6210ad7ce", size: new index_1.ObjectSize(0, 3) }; +Node_Struct._Fields = capnp.CompositeList(Field); +Node_Enum._Enumerants = capnp.CompositeList(Enumerant); +Node_Interface._Methods = capnp.CompositeList(Method); +Node_Interface._Superclasses = capnp.CompositeList(Superclass); +Node._Parameters = capnp.CompositeList(Node_Parameter); +Node._NestedNodes = capnp.CompositeList(Node_NestedNode); +Node._Annotations = capnp.CompositeList(Annotation); +Field._Annotations = capnp.CompositeList(Annotation); +Enumerant._Annotations = capnp.CompositeList(Annotation); +Method._ImplicitParameters = capnp.CompositeList(Node_Parameter); +Method._Annotations = capnp.CompositeList(Annotation); +Brand_Scope._Bind = capnp.CompositeList(Brand_Binding); +Brand._Scopes = capnp.CompositeList(Brand_Scope); +CodeGeneratorRequest_RequestedFile._Imports = capnp.CompositeList(CodeGeneratorRequest_RequestedFile_Import); +CodeGeneratorRequest._Nodes = capnp.CompositeList(Node); +CodeGeneratorRequest._RequestedFiles = capnp.CompositeList(CodeGeneratorRequest_RequestedFile); +//# sourceMappingURL=schema.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/schema.capnp.js.map b/node_modules/capnp-ts/src/std/schema.capnp.js.map new file mode 100644 index 0000000..6fa4e1f --- /dev/null +++ b/node_modules/capnp-ts/src/std/schema.capnp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"schema.capnp.js","sourceRoot":"","sources":["schema.capnp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,wDAAkC;AAClC,oCAA4D;AAC/C,QAAA,YAAY,GAAG,kBAAkB,CAAC;AAC/C,MAAa,cAAe,SAAQ,cAAG;IAEnC,OAAO,KAAa,OAAO,cAAG,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,KAAa,IAAU,cAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7D,QAAQ,KAAa,OAAO,iBAAiB,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;;AAJvE,wCAKC;AAJmB,qBAAM,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,kBAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAKvG,MAAa,eAAgB,SAAQ,cAAG;IAEpC,OAAO,KAAa,OAAO,cAAG,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,KAAa,IAAU,cAAG,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AAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AACzD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACpD,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACrD,SAAS,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACzD,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACtD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;AACvD,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AACjD,kCAAkC,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,yCAAyC,CAAC,CAAC;AAC7G,oBAAoB,CAAC,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACxD,oBAAoB,CAAC,eAAe,GAAG,KAAK,CAAC,aAAa,CAAC,kCAAkC,CAAC,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/schema.capnp.ts b/node_modules/capnp-ts/src/std/schema.capnp.ts new file mode 100644 index 0000000..5b713f1 --- /dev/null +++ b/node_modules/capnp-ts/src/std/schema.capnp.ts @@ -0,0 +1,1050 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "a93fc509624c72d9"; +export class Node_Parameter extends __S { + static readonly _capnp = { displayName: "Parameter", id: "b9521bccf10fa3b1", size: new __O(0, 1) }; + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + toString(): string { return "Node_Parameter_" + super.toString(); } +} +export class Node_NestedNode extends __S { + static readonly _capnp = { displayName: "NestedNode", id: "debf55bbfa0fc242", size: new __O(8, 1) }; + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + toString(): string { return "Node_NestedNode_" + super.toString(); } +} +export class Node_Struct extends __S { + static readonly _capnp = { displayName: "struct", id: "9ea0b19b37fb4435", size: new __O(40, 6) }; + static _Fields: capnp.ListCtor<Field>; + getDataWordCount(): number { return __S.getUint16(14, this); } + setDataWordCount(value: number): void { __S.setUint16(14, value, this); } + getPointerCount(): number { return __S.getUint16(24, this); } + setPointerCount(value: number): void { __S.setUint16(24, value, this); } + getPreferredListEncoding(): ElementSize { return __S.getUint16(26, this); } + setPreferredListEncoding(value: ElementSize): void { __S.setUint16(26, value, this); } + getIsGroup(): boolean { return __S.getBit(224, this); } + setIsGroup(value: boolean): void { __S.setBit(224, value, this); } + getDiscriminantCount(): number { return __S.getUint16(30, this); } + setDiscriminantCount(value: number): void { __S.setUint16(30, value, this); } + getDiscriminantOffset(): number { return __S.getUint32(32, this); } + setDiscriminantOffset(value: number): void { __S.setUint32(32, value, this); } + adoptFields(value: capnp.Orphan<capnp.List<Field>>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownFields(): capnp.Orphan<capnp.List<Field>> { return __S.disown(this.getFields()); } + getFields(): capnp.List<Field> { return __S.getList(3, Node_Struct._Fields, this); } + hasFields(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initFields(length: number): capnp.List<Field> { return __S.initList(3, Node_Struct._Fields, length, this); } + setFields(value: capnp.List<Field>): void { __S.copyFrom(value, __S.getPointer(3, this)); } + toString(): string { return "Node_Struct_" + super.toString(); } +} +export class Node_Enum extends __S { + static readonly _capnp = { displayName: "enum", id: "b54ab3364333f598", size: new __O(40, 6) }; + static _Enumerants: capnp.ListCtor<Enumerant>; + adoptEnumerants(value: capnp.Orphan<capnp.List<Enumerant>>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownEnumerants(): capnp.Orphan<capnp.List<Enumerant>> { return __S.disown(this.getEnumerants()); } + getEnumerants(): capnp.List<Enumerant> { return __S.getList(3, Node_Enum._Enumerants, this); } + hasEnumerants(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initEnumerants(length: number): capnp.List<Enumerant> { return __S.initList(3, Node_Enum._Enumerants, length, this); } + setEnumerants(value: capnp.List<Enumerant>): void { __S.copyFrom(value, __S.getPointer(3, this)); } + toString(): string { return "Node_Enum_" + super.toString(); } +} +export class Node_Interface extends __S { + static readonly _capnp = { displayName: "interface", id: "e82753cff0c2218f", size: new __O(40, 6) }; + static _Methods: capnp.ListCtor<Method>; + static _Superclasses: capnp.ListCtor<Superclass>; + adoptMethods(value: capnp.Orphan<capnp.List<Method>>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownMethods(): capnp.Orphan<capnp.List<Method>> { return __S.disown(this.getMethods()); } + getMethods(): capnp.List<Method> { return __S.getList(3, Node_Interface._Methods, this); } + hasMethods(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initMethods(length: number): capnp.List<Method> { return __S.initList(3, Node_Interface._Methods, length, this); } + setMethods(value: capnp.List<Method>): void { __S.copyFrom(value, __S.getPointer(3, this)); } + adoptSuperclasses(value: capnp.Orphan<capnp.List<Superclass>>): void { __S.adopt(value, __S.getPointer(4, this)); } + disownSuperclasses(): capnp.Orphan<capnp.List<Superclass>> { return __S.disown(this.getSuperclasses()); } + getSuperclasses(): capnp.List<Superclass> { return __S.getList(4, Node_Interface._Superclasses, this); } + hasSuperclasses(): boolean { return !__S.isNull(__S.getPointer(4, this)); } + initSuperclasses(length: number): capnp.List<Superclass> { return __S.initList(4, Node_Interface._Superclasses, length, this); } + setSuperclasses(value: capnp.List<Superclass>): void { __S.copyFrom(value, __S.getPointer(4, this)); } + toString(): string { return "Node_Interface_" + super.toString(); } +} +export class Node_Const extends __S { + static readonly _capnp = { displayName: "const", id: "b18aa5ac7a0d9420", size: new __O(40, 6) }; + adoptType(value: capnp.Orphan<Type>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownType(): capnp.Orphan<Type> { return __S.disown(this.getType()); } + getType(): Type { return __S.getStruct(3, Type, this); } + hasType(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initType(): Type { return __S.initStructAt(3, Type, this); } + setType(value: Type): void { __S.copyFrom(value, __S.getPointer(3, this)); } + adoptValue(value: capnp.Orphan<Value>): void { __S.adopt(value, __S.getPointer(4, this)); } + disownValue(): capnp.Orphan<Value> { return __S.disown(this.getValue()); } + getValue(): Value { return __S.getStruct(4, Value, this); } + hasValue(): boolean { return !__S.isNull(__S.getPointer(4, this)); } + initValue(): Value { return __S.initStructAt(4, Value, this); } + setValue(value: Value): void { __S.copyFrom(value, __S.getPointer(4, this)); } + toString(): string { return "Node_Const_" + super.toString(); } +} +export class Node_Annotation extends __S { + static readonly _capnp = { displayName: "annotation", id: "ec1619d4400a0290", size: new __O(40, 6) }; + adoptType(value: capnp.Orphan<Type>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownType(): capnp.Orphan<Type> { return __S.disown(this.getType()); } + getType(): Type { return __S.getStruct(3, Type, this); } + hasType(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initType(): Type { return __S.initStructAt(3, Type, this); } + setType(value: Type): void { __S.copyFrom(value, __S.getPointer(3, this)); } + getTargetsFile(): boolean { return __S.getBit(112, this); } + setTargetsFile(value: boolean): void { __S.setBit(112, value, this); } + getTargetsConst(): boolean { return __S.getBit(113, this); } + setTargetsConst(value: boolean): void { __S.setBit(113, value, this); } + getTargetsEnum(): boolean { return __S.getBit(114, this); } + setTargetsEnum(value: boolean): void { __S.setBit(114, value, this); } + getTargetsEnumerant(): boolean { return __S.getBit(115, this); } + setTargetsEnumerant(value: boolean): void { __S.setBit(115, value, this); } + getTargetsStruct(): boolean { return __S.getBit(116, this); } + setTargetsStruct(value: boolean): void { __S.setBit(116, value, this); } + getTargetsField(): boolean { return __S.getBit(117, this); } + setTargetsField(value: boolean): void { __S.setBit(117, value, this); } + getTargetsUnion(): boolean { return __S.getBit(118, this); } + setTargetsUnion(value: boolean): void { __S.setBit(118, value, this); } + getTargetsGroup(): boolean { return __S.getBit(119, this); } + setTargetsGroup(value: boolean): void { __S.setBit(119, value, this); } + getTargetsInterface(): boolean { return __S.getBit(120, this); } + setTargetsInterface(value: boolean): void { __S.setBit(120, value, this); } + getTargetsMethod(): boolean { return __S.getBit(121, this); } + setTargetsMethod(value: boolean): void { __S.setBit(121, value, this); } + getTargetsParam(): boolean { return __S.getBit(122, this); } + setTargetsParam(value: boolean): void { __S.setBit(122, value, this); } + getTargetsAnnotation(): boolean { return __S.getBit(123, this); } + setTargetsAnnotation(value: boolean): void { __S.setBit(123, value, this); } + toString(): string { return "Node_Annotation_" + super.toString(); } +} +export enum Node_Which { + FILE = 0, + STRUCT = 1, + ENUM = 2, + INTERFACE = 3, + CONST = 4, + ANNOTATION = 5 +} +export class Node extends __S { + static readonly FILE = Node_Which.FILE; + static readonly STRUCT = Node_Which.STRUCT; + static readonly ENUM = Node_Which.ENUM; + static readonly INTERFACE = Node_Which.INTERFACE; + static readonly CONST = Node_Which.CONST; + static readonly ANNOTATION = Node_Which.ANNOTATION; + static readonly Parameter = Node_Parameter; + static readonly NestedNode = Node_NestedNode; + static readonly _capnp = { displayName: "Node", id: "e682ab4cf923a417", size: new __O(40, 6) }; + static _Parameters: capnp.ListCtor<Node_Parameter>; + static _NestedNodes: capnp.ListCtor<Node_NestedNode>; + static _Annotations: capnp.ListCtor<Annotation>; + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + getDisplayName(): string { return __S.getText(0, this); } + setDisplayName(value: string): void { __S.setText(0, value, this); } + getDisplayNamePrefixLength(): number { return __S.getUint32(8, this); } + setDisplayNamePrefixLength(value: number): void { __S.setUint32(8, value, this); } + getScopeId(): capnp.Uint64 { return __S.getUint64(16, this); } + setScopeId(value: capnp.Uint64): void { __S.setUint64(16, value, this); } + adoptParameters(value: capnp.Orphan<capnp.List<Node_Parameter>>): void { __S.adopt(value, __S.getPointer(5, this)); } + disownParameters(): capnp.Orphan<capnp.List<Node_Parameter>> { return __S.disown(this.getParameters()); } + getParameters(): capnp.List<Node_Parameter> { return __S.getList(5, Node._Parameters, this); } + hasParameters(): boolean { return !__S.isNull(__S.getPointer(5, this)); } + initParameters(length: number): capnp.List<Node_Parameter> { return __S.initList(5, Node._Parameters, length, this); } + setParameters(value: capnp.List<Node_Parameter>): void { __S.copyFrom(value, __S.getPointer(5, this)); } + getIsGeneric(): boolean { return __S.getBit(288, this); } + setIsGeneric(value: boolean): void { __S.setBit(288, value, this); } + adoptNestedNodes(value: capnp.Orphan<capnp.List<Node_NestedNode>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownNestedNodes(): capnp.Orphan<capnp.List<Node_NestedNode>> { return __S.disown(this.getNestedNodes()); } + getNestedNodes(): capnp.List<Node_NestedNode> { return __S.getList(1, Node._NestedNodes, this); } + hasNestedNodes(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initNestedNodes(length: number): capnp.List<Node_NestedNode> { return __S.initList(1, Node._NestedNodes, length, this); } + setNestedNodes(value: capnp.List<Node_NestedNode>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void { __S.adopt(value, __S.getPointer(2, this)); } + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>> { return __S.disown(this.getAnnotations()); } + getAnnotations(): capnp.List<Annotation> { return __S.getList(2, Node._Annotations, this); } + hasAnnotations(): boolean { return !__S.isNull(__S.getPointer(2, this)); } + initAnnotations(length: number): capnp.List<Annotation> { return __S.initList(2, Node._Annotations, length, this); } + setAnnotations(value: capnp.List<Annotation>): void { __S.copyFrom(value, __S.getPointer(2, this)); } + isFile(): boolean { return __S.getUint16(12, this) === 0; } + setFile(): void { __S.setUint16(12, 0, this); } + getStruct(): Node_Struct { + __S.testWhich("struct", __S.getUint16(12, this), 1, this); + return __S.getAs(Node_Struct, this); + } + initStruct(): Node_Struct { + __S.setUint16(12, 1, this); + return __S.getAs(Node_Struct, this); + } + isStruct(): boolean { return __S.getUint16(12, this) === 1; } + setStruct(): void { __S.setUint16(12, 1, this); } + getEnum(): Node_Enum { + __S.testWhich("enum", __S.getUint16(12, this), 2, this); + return __S.getAs(Node_Enum, this); + } + initEnum(): Node_Enum { + __S.setUint16(12, 2, this); + return __S.getAs(Node_Enum, this); + } + isEnum(): boolean { return __S.getUint16(12, this) === 2; } + setEnum(): void { __S.setUint16(12, 2, this); } + getInterface(): Node_Interface { + __S.testWhich("interface", __S.getUint16(12, this), 3, this); + return __S.getAs(Node_Interface, this); + } + initInterface(): Node_Interface { + __S.setUint16(12, 3, this); + return __S.getAs(Node_Interface, this); + } + isInterface(): boolean { return __S.getUint16(12, this) === 3; } + setInterface(): void { __S.setUint16(12, 3, this); } + getConst(): Node_Const { + __S.testWhich("const", __S.getUint16(12, this), 4, this); + return __S.getAs(Node_Const, this); + } + initConst(): Node_Const { + __S.setUint16(12, 4, this); + return __S.getAs(Node_Const, this); + } + isConst(): boolean { return __S.getUint16(12, this) === 4; } + setConst(): void { __S.setUint16(12, 4, this); } + getAnnotation(): Node_Annotation { + __S.testWhich("annotation", __S.getUint16(12, this), 5, this); + return __S.getAs(Node_Annotation, this); + } + initAnnotation(): Node_Annotation { + __S.setUint16(12, 5, this); + return __S.getAs(Node_Annotation, this); + } + isAnnotation(): boolean { return __S.getUint16(12, this) === 5; } + setAnnotation(): void { __S.setUint16(12, 5, this); } + toString(): string { return "Node_" + super.toString(); } + which(): Node_Which { return __S.getUint16(12, this); } +} +export class Field_Slot extends __S { + static readonly _capnp = { displayName: "slot", id: "c42305476bb4746f", size: new __O(24, 4) }; + getOffset(): number { return __S.getUint32(4, this); } + setOffset(value: number): void { __S.setUint32(4, value, this); } + adoptType(value: capnp.Orphan<Type>): void { __S.adopt(value, __S.getPointer(2, this)); } + disownType(): capnp.Orphan<Type> { return __S.disown(this.getType()); } + getType(): Type { return __S.getStruct(2, Type, this); } + hasType(): boolean { return !__S.isNull(__S.getPointer(2, this)); } + initType(): Type { return __S.initStructAt(2, Type, this); } + setType(value: Type): void { __S.copyFrom(value, __S.getPointer(2, this)); } + adoptDefaultValue(value: capnp.Orphan<Value>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownDefaultValue(): capnp.Orphan<Value> { return __S.disown(this.getDefaultValue()); } + getDefaultValue(): Value { return __S.getStruct(3, Value, this); } + hasDefaultValue(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initDefaultValue(): Value { return __S.initStructAt(3, Value, this); } + setDefaultValue(value: Value): void { __S.copyFrom(value, __S.getPointer(3, this)); } + getHadExplicitDefault(): boolean { return __S.getBit(128, this); } + setHadExplicitDefault(value: boolean): void { __S.setBit(128, value, this); } + toString(): string { return "Field_Slot_" + super.toString(); } +} +export class Field_Group extends __S { + static readonly _capnp = { displayName: "group", id: "cafccddb68db1d11", size: new __O(24, 4) }; + getTypeId(): capnp.Uint64 { return __S.getUint64(16, this); } + setTypeId(value: capnp.Uint64): void { __S.setUint64(16, value, this); } + toString(): string { return "Field_Group_" + super.toString(); } +} +export enum Field_Ordinal_Which { + IMPLICIT = 0, + EXPLICIT = 1 +} +export class Field_Ordinal extends __S { + static readonly IMPLICIT = Field_Ordinal_Which.IMPLICIT; + static readonly EXPLICIT = Field_Ordinal_Which.EXPLICIT; + static readonly _capnp = { displayName: "ordinal", id: "bb90d5c287870be6", size: new __O(24, 4) }; + isImplicit(): boolean { return __S.getUint16(10, this) === 0; } + setImplicit(): void { __S.setUint16(10, 0, this); } + getExplicit(): number { + __S.testWhich("explicit", __S.getUint16(10, this), 1, this); + return __S.getUint16(12, this); + } + isExplicit(): boolean { return __S.getUint16(10, this) === 1; } + setExplicit(value: number): void { + __S.setUint16(10, 1, this); + __S.setUint16(12, value, this); + } + toString(): string { return "Field_Ordinal_" + super.toString(); } + which(): Field_Ordinal_Which { return __S.getUint16(10, this); } +} +export enum Field_Which { + SLOT = 0, + GROUP = 1 +} +export class Field extends __S { + static readonly NO_DISCRIMINANT = 65535; + static readonly SLOT = Field_Which.SLOT; + static readonly GROUP = Field_Which.GROUP; + static readonly _capnp = { displayName: "Field", id: "9aad50a41f4af45f", size: new __O(24, 4), defaultDiscriminantValue: capnp.getUint16Mask(65535) }; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + getCodeOrder(): number { return __S.getUint16(0, this); } + setCodeOrder(value: number): void { __S.setUint16(0, value, this); } + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>> { return __S.disown(this.getAnnotations()); } + getAnnotations(): capnp.List<Annotation> { return __S.getList(1, Field._Annotations, this); } + hasAnnotations(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initAnnotations(length: number): capnp.List<Annotation> { return __S.initList(1, Field._Annotations, length, this); } + setAnnotations(value: capnp.List<Annotation>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + getDiscriminantValue(): number { return __S.getUint16(2, this, Field._capnp.defaultDiscriminantValue); } + setDiscriminantValue(value: number): void { __S.setUint16(2, value, this); } + getSlot(): Field_Slot { + __S.testWhich("slot", __S.getUint16(8, this), 0, this); + return __S.getAs(Field_Slot, this); + } + initSlot(): Field_Slot { + __S.setUint16(8, 0, this); + return __S.getAs(Field_Slot, this); + } + isSlot(): boolean { return __S.getUint16(8, this) === 0; } + setSlot(): void { __S.setUint16(8, 0, this); } + getGroup(): Field_Group { + __S.testWhich("group", __S.getUint16(8, this), 1, this); + return __S.getAs(Field_Group, this); + } + initGroup(): Field_Group { + __S.setUint16(8, 1, this); + return __S.getAs(Field_Group, this); + } + isGroup(): boolean { return __S.getUint16(8, this) === 1; } + setGroup(): void { __S.setUint16(8, 1, this); } + getOrdinal(): Field_Ordinal { return __S.getAs(Field_Ordinal, this); } + initOrdinal(): Field_Ordinal { return __S.getAs(Field_Ordinal, this); } + toString(): string { return "Field_" + super.toString(); } + which(): Field_Which { return __S.getUint16(8, this); } +} +export class Enumerant extends __S { + static readonly _capnp = { displayName: "Enumerant", id: "978a7cebdc549a4d", size: new __O(8, 2) }; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + getCodeOrder(): number { return __S.getUint16(0, this); } + setCodeOrder(value: number): void { __S.setUint16(0, value, this); } + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>> { return __S.disown(this.getAnnotations()); } + getAnnotations(): capnp.List<Annotation> { return __S.getList(1, Enumerant._Annotations, this); } + hasAnnotations(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initAnnotations(length: number): capnp.List<Annotation> { return __S.initList(1, Enumerant._Annotations, length, this); } + setAnnotations(value: capnp.List<Annotation>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "Enumerant_" + super.toString(); } +} +export class Superclass extends __S { + static readonly _capnp = { displayName: "Superclass", id: "a9962a9ed0a4d7f8", size: new __O(8, 1) }; + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + adoptBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownBrand(): capnp.Orphan<Brand> { return __S.disown(this.getBrand()); } + getBrand(): Brand { return __S.getStruct(0, Brand, this); } + hasBrand(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBrand(): Brand { return __S.initStructAt(0, Brand, this); } + setBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Superclass_" + super.toString(); } +} +export class Method extends __S { + static readonly _capnp = { displayName: "Method", id: "9500cce23b334d80", size: new __O(24, 5) }; + static _ImplicitParameters: capnp.ListCtor<Node_Parameter>; + static _Annotations: capnp.ListCtor<Annotation>; + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + getCodeOrder(): number { return __S.getUint16(0, this); } + setCodeOrder(value: number): void { __S.setUint16(0, value, this); } + adoptImplicitParameters(value: capnp.Orphan<capnp.List<Node_Parameter>>): void { __S.adopt(value, __S.getPointer(4, this)); } + disownImplicitParameters(): capnp.Orphan<capnp.List<Node_Parameter>> { return __S.disown(this.getImplicitParameters()); } + getImplicitParameters(): capnp.List<Node_Parameter> { return __S.getList(4, Method._ImplicitParameters, this); } + hasImplicitParameters(): boolean { return !__S.isNull(__S.getPointer(4, this)); } + initImplicitParameters(length: number): capnp.List<Node_Parameter> { return __S.initList(4, Method._ImplicitParameters, length, this); } + setImplicitParameters(value: capnp.List<Node_Parameter>): void { __S.copyFrom(value, __S.getPointer(4, this)); } + getParamStructType(): capnp.Uint64 { return __S.getUint64(8, this); } + setParamStructType(value: capnp.Uint64): void { __S.setUint64(8, value, this); } + adoptParamBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(2, this)); } + disownParamBrand(): capnp.Orphan<Brand> { return __S.disown(this.getParamBrand()); } + getParamBrand(): Brand { return __S.getStruct(2, Brand, this); } + hasParamBrand(): boolean { return !__S.isNull(__S.getPointer(2, this)); } + initParamBrand(): Brand { return __S.initStructAt(2, Brand, this); } + setParamBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(2, this)); } + getResultStructType(): capnp.Uint64 { return __S.getUint64(16, this); } + setResultStructType(value: capnp.Uint64): void { __S.setUint64(16, value, this); } + adoptResultBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(3, this)); } + disownResultBrand(): capnp.Orphan<Brand> { return __S.disown(this.getResultBrand()); } + getResultBrand(): Brand { return __S.getStruct(3, Brand, this); } + hasResultBrand(): boolean { return !__S.isNull(__S.getPointer(3, this)); } + initResultBrand(): Brand { return __S.initStructAt(3, Brand, this); } + setResultBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(3, this)); } + adoptAnnotations(value: capnp.Orphan<capnp.List<Annotation>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownAnnotations(): capnp.Orphan<capnp.List<Annotation>> { return __S.disown(this.getAnnotations()); } + getAnnotations(): capnp.List<Annotation> { return __S.getList(1, Method._Annotations, this); } + hasAnnotations(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initAnnotations(length: number): capnp.List<Annotation> { return __S.initList(1, Method._Annotations, length, this); } + setAnnotations(value: capnp.List<Annotation>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "Method_" + super.toString(); } +} +export class Type_List extends __S { + static readonly _capnp = { displayName: "list", id: "87e739250a60ea97", size: new __O(24, 1) }; + adoptElementType(value: capnp.Orphan<Type>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownElementType(): capnp.Orphan<Type> { return __S.disown(this.getElementType()); } + getElementType(): Type { return __S.getStruct(0, Type, this); } + hasElementType(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initElementType(): Type { return __S.initStructAt(0, Type, this); } + setElementType(value: Type): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Type_List_" + super.toString(); } +} +export class Type_Enum extends __S { + static readonly _capnp = { displayName: "enum", id: "9e0e78711a7f87a9", size: new __O(24, 1) }; + getTypeId(): capnp.Uint64 { return __S.getUint64(8, this); } + setTypeId(value: capnp.Uint64): void { __S.setUint64(8, value, this); } + adoptBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownBrand(): capnp.Orphan<Brand> { return __S.disown(this.getBrand()); } + getBrand(): Brand { return __S.getStruct(0, Brand, this); } + hasBrand(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBrand(): Brand { return __S.initStructAt(0, Brand, this); } + setBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Type_Enum_" + super.toString(); } +} +export class Type_Struct extends __S { + static readonly _capnp = { displayName: "struct", id: "ac3a6f60ef4cc6d3", size: new __O(24, 1) }; + getTypeId(): capnp.Uint64 { return __S.getUint64(8, this); } + setTypeId(value: capnp.Uint64): void { __S.setUint64(8, value, this); } + adoptBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownBrand(): capnp.Orphan<Brand> { return __S.disown(this.getBrand()); } + getBrand(): Brand { return __S.getStruct(0, Brand, this); } + hasBrand(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBrand(): Brand { return __S.initStructAt(0, Brand, this); } + setBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Type_Struct_" + super.toString(); } +} +export class Type_Interface extends __S { + static readonly _capnp = { displayName: "interface", id: "ed8bca69f7fb0cbf", size: new __O(24, 1) }; + getTypeId(): capnp.Uint64 { return __S.getUint64(8, this); } + setTypeId(value: capnp.Uint64): void { __S.setUint64(8, value, this); } + adoptBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownBrand(): capnp.Orphan<Brand> { return __S.disown(this.getBrand()); } + getBrand(): Brand { return __S.getStruct(0, Brand, this); } + hasBrand(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBrand(): Brand { return __S.initStructAt(0, Brand, this); } + setBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Type_Interface_" + super.toString(); } +} +export enum Type_AnyPointer_Unconstrained_Which { + ANY_KIND = 0, + STRUCT = 1, + LIST = 2, + CAPABILITY = 3 +} +export class Type_AnyPointer_Unconstrained extends __S { + static readonly ANY_KIND = Type_AnyPointer_Unconstrained_Which.ANY_KIND; + static readonly STRUCT = Type_AnyPointer_Unconstrained_Which.STRUCT; + static readonly LIST = Type_AnyPointer_Unconstrained_Which.LIST; + static readonly CAPABILITY = Type_AnyPointer_Unconstrained_Which.CAPABILITY; + static readonly _capnp = { displayName: "unconstrained", id: "8e3b5f79fe593656", size: new __O(24, 1) }; + isAnyKind(): boolean { return __S.getUint16(10, this) === 0; } + setAnyKind(): void { __S.setUint16(10, 0, this); } + isStruct(): boolean { return __S.getUint16(10, this) === 1; } + setStruct(): void { __S.setUint16(10, 1, this); } + isList(): boolean { return __S.getUint16(10, this) === 2; } + setList(): void { __S.setUint16(10, 2, this); } + isCapability(): boolean { return __S.getUint16(10, this) === 3; } + setCapability(): void { __S.setUint16(10, 3, this); } + toString(): string { return "Type_AnyPointer_Unconstrained_" + super.toString(); } + which(): Type_AnyPointer_Unconstrained_Which { return __S.getUint16(10, this); } +} +export class Type_AnyPointer_Parameter extends __S { + static readonly _capnp = { displayName: "parameter", id: "9dd1f724f4614a85", size: new __O(24, 1) }; + getScopeId(): capnp.Uint64 { return __S.getUint64(16, this); } + setScopeId(value: capnp.Uint64): void { __S.setUint64(16, value, this); } + getParameterIndex(): number { return __S.getUint16(10, this); } + setParameterIndex(value: number): void { __S.setUint16(10, value, this); } + toString(): string { return "Type_AnyPointer_Parameter_" + super.toString(); } +} +export class Type_AnyPointer_ImplicitMethodParameter extends __S { + static readonly _capnp = { displayName: "implicitMethodParameter", id: "baefc9120c56e274", size: new __O(24, 1) }; + getParameterIndex(): number { return __S.getUint16(10, this); } + setParameterIndex(value: number): void { __S.setUint16(10, value, this); } + toString(): string { return "Type_AnyPointer_ImplicitMethodParameter_" + super.toString(); } +} +export enum Type_AnyPointer_Which { + UNCONSTRAINED = 0, + PARAMETER = 1, + IMPLICIT_METHOD_PARAMETER = 2 +} +export class Type_AnyPointer extends __S { + static readonly UNCONSTRAINED = Type_AnyPointer_Which.UNCONSTRAINED; + static readonly PARAMETER = Type_AnyPointer_Which.PARAMETER; + static readonly IMPLICIT_METHOD_PARAMETER = Type_AnyPointer_Which.IMPLICIT_METHOD_PARAMETER; + static readonly _capnp = { displayName: "anyPointer", id: "c2573fe8a23e49f1", size: new __O(24, 1) }; + getUnconstrained(): Type_AnyPointer_Unconstrained { + __S.testWhich("unconstrained", __S.getUint16(8, this), 0, this); + return __S.getAs(Type_AnyPointer_Unconstrained, this); + } + initUnconstrained(): Type_AnyPointer_Unconstrained { + __S.setUint16(8, 0, this); + return __S.getAs(Type_AnyPointer_Unconstrained, this); + } + isUnconstrained(): boolean { return __S.getUint16(8, this) === 0; } + setUnconstrained(): void { __S.setUint16(8, 0, this); } + getParameter(): Type_AnyPointer_Parameter { + __S.testWhich("parameter", __S.getUint16(8, this), 1, this); + return __S.getAs(Type_AnyPointer_Parameter, this); + } + initParameter(): Type_AnyPointer_Parameter { + __S.setUint16(8, 1, this); + return __S.getAs(Type_AnyPointer_Parameter, this); + } + isParameter(): boolean { return __S.getUint16(8, this) === 1; } + setParameter(): void { __S.setUint16(8, 1, this); } + getImplicitMethodParameter(): Type_AnyPointer_ImplicitMethodParameter { + __S.testWhich("implicitMethodParameter", __S.getUint16(8, this), 2, this); + return __S.getAs(Type_AnyPointer_ImplicitMethodParameter, this); + } + initImplicitMethodParameter(): Type_AnyPointer_ImplicitMethodParameter { + __S.setUint16(8, 2, this); + return __S.getAs(Type_AnyPointer_ImplicitMethodParameter, this); + } + isImplicitMethodParameter(): boolean { return __S.getUint16(8, this) === 2; } + setImplicitMethodParameter(): void { __S.setUint16(8, 2, this); } + toString(): string { return "Type_AnyPointer_" + super.toString(); } + which(): Type_AnyPointer_Which { return __S.getUint16(8, this); } +} +export enum Type_Which { + VOID = 0, + BOOL = 1, + INT8 = 2, + INT16 = 3, + INT32 = 4, + INT64 = 5, + UINT8 = 6, + UINT16 = 7, + UINT32 = 8, + UINT64 = 9, + FLOAT32 = 10, + FLOAT64 = 11, + TEXT = 12, + DATA = 13, + LIST = 14, + ENUM = 15, + STRUCT = 16, + INTERFACE = 17, + ANY_POINTER = 18 +} +export class Type extends __S { + static readonly VOID = Type_Which.VOID; + static readonly BOOL = Type_Which.BOOL; + static readonly INT8 = Type_Which.INT8; + static readonly INT16 = Type_Which.INT16; + static readonly INT32 = Type_Which.INT32; + static readonly INT64 = Type_Which.INT64; + static readonly UINT8 = Type_Which.UINT8; + static readonly UINT16 = Type_Which.UINT16; + static readonly UINT32 = Type_Which.UINT32; + static readonly UINT64 = Type_Which.UINT64; + static readonly FLOAT32 = Type_Which.FLOAT32; + static readonly FLOAT64 = Type_Which.FLOAT64; + static readonly TEXT = Type_Which.TEXT; + static readonly DATA = Type_Which.DATA; + static readonly LIST = Type_Which.LIST; + static readonly ENUM = Type_Which.ENUM; + static readonly STRUCT = Type_Which.STRUCT; + static readonly INTERFACE = Type_Which.INTERFACE; + static readonly ANY_POINTER = Type_Which.ANY_POINTER; + static readonly _capnp = { displayName: "Type", id: "d07378ede1f9cc60", size: new __O(24, 1) }; + isVoid(): boolean { return __S.getUint16(0, this) === 0; } + setVoid(): void { __S.setUint16(0, 0, this); } + isBool(): boolean { return __S.getUint16(0, this) === 1; } + setBool(): void { __S.setUint16(0, 1, this); } + isInt8(): boolean { return __S.getUint16(0, this) === 2; } + setInt8(): void { __S.setUint16(0, 2, this); } + isInt16(): boolean { return __S.getUint16(0, this) === 3; } + setInt16(): void { __S.setUint16(0, 3, this); } + isInt32(): boolean { return __S.getUint16(0, this) === 4; } + setInt32(): void { __S.setUint16(0, 4, this); } + isInt64(): boolean { return __S.getUint16(0, this) === 5; } + setInt64(): void { __S.setUint16(0, 5, this); } + isUint8(): boolean { return __S.getUint16(0, this) === 6; } + setUint8(): void { __S.setUint16(0, 6, this); } + isUint16(): boolean { return __S.getUint16(0, this) === 7; } + setUint16(): void { __S.setUint16(0, 7, this); } + isUint32(): boolean { return __S.getUint16(0, this) === 8; } + setUint32(): void { __S.setUint16(0, 8, this); } + isUint64(): boolean { return __S.getUint16(0, this) === 9; } + setUint64(): void { __S.setUint16(0, 9, this); } + isFloat32(): boolean { return __S.getUint16(0, this) === 10; } + setFloat32(): void { __S.setUint16(0, 10, this); } + isFloat64(): boolean { return __S.getUint16(0, this) === 11; } + setFloat64(): void { __S.setUint16(0, 11, this); } + isText(): boolean { return __S.getUint16(0, this) === 12; } + setText(): void { __S.setUint16(0, 12, this); } + isData(): boolean { return __S.getUint16(0, this) === 13; } + setData(): void { __S.setUint16(0, 13, this); } + getList(): Type_List { + __S.testWhich("list", __S.getUint16(0, this), 14, this); + return __S.getAs(Type_List, this); + } + initList(): Type_List { + __S.setUint16(0, 14, this); + return __S.getAs(Type_List, this); + } + isList(): boolean { return __S.getUint16(0, this) === 14; } + setList(): void { __S.setUint16(0, 14, this); } + getEnum(): Type_Enum { + __S.testWhich("enum", __S.getUint16(0, this), 15, this); + return __S.getAs(Type_Enum, this); + } + initEnum(): Type_Enum { + __S.setUint16(0, 15, this); + return __S.getAs(Type_Enum, this); + } + isEnum(): boolean { return __S.getUint16(0, this) === 15; } + setEnum(): void { __S.setUint16(0, 15, this); } + getStruct(): Type_Struct { + __S.testWhich("struct", __S.getUint16(0, this), 16, this); + return __S.getAs(Type_Struct, this); + } + initStruct(): Type_Struct { + __S.setUint16(0, 16, this); + return __S.getAs(Type_Struct, this); + } + isStruct(): boolean { return __S.getUint16(0, this) === 16; } + setStruct(): void { __S.setUint16(0, 16, this); } + getInterface(): Type_Interface { + __S.testWhich("interface", __S.getUint16(0, this), 17, this); + return __S.getAs(Type_Interface, this); + } + initInterface(): Type_Interface { + __S.setUint16(0, 17, this); + return __S.getAs(Type_Interface, this); + } + isInterface(): boolean { return __S.getUint16(0, this) === 17; } + setInterface(): void { __S.setUint16(0, 17, this); } + getAnyPointer(): Type_AnyPointer { + __S.testWhich("anyPointer", __S.getUint16(0, this), 18, this); + return __S.getAs(Type_AnyPointer, this); + } + initAnyPointer(): Type_AnyPointer { + __S.setUint16(0, 18, this); + return __S.getAs(Type_AnyPointer, this); + } + isAnyPointer(): boolean { return __S.getUint16(0, this) === 18; } + setAnyPointer(): void { __S.setUint16(0, 18, this); } + toString(): string { return "Type_" + super.toString(); } + which(): Type_Which { return __S.getUint16(0, this); } +} +export enum Brand_Scope_Which { + BIND = 0, + INHERIT = 1 +} +export class Brand_Scope extends __S { + static readonly BIND = Brand_Scope_Which.BIND; + static readonly INHERIT = Brand_Scope_Which.INHERIT; + static readonly _capnp = { displayName: "Scope", id: "abd73485a9636bc9", size: new __O(16, 1) }; + static _Bind: capnp.ListCtor<Brand_Binding>; + getScopeId(): capnp.Uint64 { return __S.getUint64(0, this); } + setScopeId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + adoptBind(value: capnp.Orphan<capnp.List<Brand_Binding>>): void { + __S.setUint16(8, 0, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownBind(): capnp.Orphan<capnp.List<Brand_Binding>> { return __S.disown(this.getBind()); } + getBind(): capnp.List<Brand_Binding> { + __S.testWhich("bind", __S.getUint16(8, this), 0, this); + return __S.getList(0, Brand_Scope._Bind, this); + } + hasBind(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initBind(length: number): capnp.List<Brand_Binding> { + __S.setUint16(8, 0, this); + return __S.initList(0, Brand_Scope._Bind, length, this); + } + isBind(): boolean { return __S.getUint16(8, this) === 0; } + setBind(value: capnp.List<Brand_Binding>): void { + __S.setUint16(8, 0, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + isInherit(): boolean { return __S.getUint16(8, this) === 1; } + setInherit(): void { __S.setUint16(8, 1, this); } + toString(): string { return "Brand_Scope_" + super.toString(); } + which(): Brand_Scope_Which { return __S.getUint16(8, this); } +} +export enum Brand_Binding_Which { + UNBOUND = 0, + TYPE = 1 +} +export class Brand_Binding extends __S { + static readonly UNBOUND = Brand_Binding_Which.UNBOUND; + static readonly TYPE = Brand_Binding_Which.TYPE; + static readonly _capnp = { displayName: "Binding", id: "c863cd16969ee7fc", size: new __O(8, 1) }; + isUnbound(): boolean { return __S.getUint16(0, this) === 0; } + setUnbound(): void { __S.setUint16(0, 0, this); } + adoptType(value: capnp.Orphan<Type>): void { + __S.setUint16(0, 1, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownType(): capnp.Orphan<Type> { return __S.disown(this.getType()); } + getType(): Type { + __S.testWhich("type", __S.getUint16(0, this), 1, this); + return __S.getStruct(0, Type, this); + } + hasType(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initType(): Type { + __S.setUint16(0, 1, this); + return __S.initStructAt(0, Type, this); + } + isType(): boolean { return __S.getUint16(0, this) === 1; } + setType(value: Type): void { + __S.setUint16(0, 1, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "Brand_Binding_" + super.toString(); } + which(): Brand_Binding_Which { return __S.getUint16(0, this); } +} +export class Brand extends __S { + static readonly Scope = Brand_Scope; + static readonly Binding = Brand_Binding; + static readonly _capnp = { displayName: "Brand", id: "903455f06065422b", size: new __O(0, 1) }; + static _Scopes: capnp.ListCtor<Brand_Scope>; + adoptScopes(value: capnp.Orphan<capnp.List<Brand_Scope>>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownScopes(): capnp.Orphan<capnp.List<Brand_Scope>> { return __S.disown(this.getScopes()); } + getScopes(): capnp.List<Brand_Scope> { return __S.getList(0, Brand._Scopes, this); } + hasScopes(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initScopes(length: number): capnp.List<Brand_Scope> { return __S.initList(0, Brand._Scopes, length, this); } + setScopes(value: capnp.List<Brand_Scope>): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Brand_" + super.toString(); } +} +export enum Value_Which { + VOID = 0, + BOOL = 1, + INT8 = 2, + INT16 = 3, + INT32 = 4, + INT64 = 5, + UINT8 = 6, + UINT16 = 7, + UINT32 = 8, + UINT64 = 9, + FLOAT32 = 10, + FLOAT64 = 11, + TEXT = 12, + DATA = 13, + LIST = 14, + ENUM = 15, + STRUCT = 16, + INTERFACE = 17, + ANY_POINTER = 18 +} +export class Value extends __S { + static readonly VOID = Value_Which.VOID; + static readonly BOOL = Value_Which.BOOL; + static readonly INT8 = Value_Which.INT8; + static readonly INT16 = Value_Which.INT16; + static readonly INT32 = Value_Which.INT32; + static readonly INT64 = Value_Which.INT64; + static readonly UINT8 = Value_Which.UINT8; + static readonly UINT16 = Value_Which.UINT16; + static readonly UINT32 = Value_Which.UINT32; + static readonly UINT64 = Value_Which.UINT64; + static readonly FLOAT32 = Value_Which.FLOAT32; + static readonly FLOAT64 = Value_Which.FLOAT64; + static readonly TEXT = Value_Which.TEXT; + static readonly DATA = Value_Which.DATA; + static readonly LIST = Value_Which.LIST; + static readonly ENUM = Value_Which.ENUM; + static readonly STRUCT = Value_Which.STRUCT; + static readonly INTERFACE = Value_Which.INTERFACE; + static readonly ANY_POINTER = Value_Which.ANY_POINTER; + static readonly _capnp = { displayName: "Value", id: "ce23dcd2d7b00c9b", size: new __O(16, 1) }; + isVoid(): boolean { return __S.getUint16(0, this) === 0; } + setVoid(): void { __S.setUint16(0, 0, this); } + getBool(): boolean { + __S.testWhich("bool", __S.getUint16(0, this), 1, this); + return __S.getBit(16, this); + } + isBool(): boolean { return __S.getUint16(0, this) === 1; } + setBool(value: boolean): void { + __S.setUint16(0, 1, this); + __S.setBit(16, value, this); + } + getInt8(): number { + __S.testWhich("int8", __S.getUint16(0, this), 2, this); + return __S.getInt8(2, this); + } + isInt8(): boolean { return __S.getUint16(0, this) === 2; } + setInt8(value: number): void { + __S.setUint16(0, 2, this); + __S.setInt8(2, value, this); + } + getInt16(): number { + __S.testWhich("int16", __S.getUint16(0, this), 3, this); + return __S.getInt16(2, this); + } + isInt16(): boolean { return __S.getUint16(0, this) === 3; } + setInt16(value: number): void { + __S.setUint16(0, 3, this); + __S.setInt16(2, value, this); + } + getInt32(): number { + __S.testWhich("int32", __S.getUint16(0, this), 4, this); + return __S.getInt32(4, this); + } + isInt32(): boolean { return __S.getUint16(0, this) === 4; } + setInt32(value: number): void { + __S.setUint16(0, 4, this); + __S.setInt32(4, value, this); + } + getInt64(): capnp.Int64 { + __S.testWhich("int64", __S.getUint16(0, this), 5, this); + return __S.getInt64(8, this); + } + isInt64(): boolean { return __S.getUint16(0, this) === 5; } + setInt64(value: capnp.Int64): void { + __S.setUint16(0, 5, this); + __S.setInt64(8, value, this); + } + getUint8(): number { + __S.testWhich("uint8", __S.getUint16(0, this), 6, this); + return __S.getUint8(2, this); + } + isUint8(): boolean { return __S.getUint16(0, this) === 6; } + setUint8(value: number): void { + __S.setUint16(0, 6, this); + __S.setUint8(2, value, this); + } + getUint16(): number { + __S.testWhich("uint16", __S.getUint16(0, this), 7, this); + return __S.getUint16(2, this); + } + isUint16(): boolean { return __S.getUint16(0, this) === 7; } + setUint16(value: number): void { + __S.setUint16(0, 7, this); + __S.setUint16(2, value, this); + } + getUint32(): number { + __S.testWhich("uint32", __S.getUint16(0, this), 8, this); + return __S.getUint32(4, this); + } + isUint32(): boolean { return __S.getUint16(0, this) === 8; } + setUint32(value: number): void { + __S.setUint16(0, 8, this); + __S.setUint32(4, value, this); + } + getUint64(): capnp.Uint64 { + __S.testWhich("uint64", __S.getUint16(0, this), 9, this); + return __S.getUint64(8, this); + } + isUint64(): boolean { return __S.getUint16(0, this) === 9; } + setUint64(value: capnp.Uint64): void { + __S.setUint16(0, 9, this); + __S.setUint64(8, value, this); + } + getFloat32(): number { + __S.testWhich("float32", __S.getUint16(0, this), 10, this); + return __S.getFloat32(4, this); + } + isFloat32(): boolean { return __S.getUint16(0, this) === 10; } + setFloat32(value: number): void { + __S.setUint16(0, 10, this); + __S.setFloat32(4, value, this); + } + getFloat64(): number { + __S.testWhich("float64", __S.getUint16(0, this), 11, this); + return __S.getFloat64(8, this); + } + isFloat64(): boolean { return __S.getUint16(0, this) === 11; } + setFloat64(value: number): void { + __S.setUint16(0, 11, this); + __S.setFloat64(8, value, this); + } + getText(): string { + __S.testWhich("text", __S.getUint16(0, this), 12, this); + return __S.getText(0, this); + } + isText(): boolean { return __S.getUint16(0, this) === 12; } + setText(value: string): void { + __S.setUint16(0, 12, this); + __S.setText(0, value, this); + } + adoptData(value: capnp.Orphan<capnp.Data>): void { + __S.setUint16(0, 13, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownData(): capnp.Orphan<capnp.Data> { return __S.disown(this.getData()); } + getData(): capnp.Data { + __S.testWhich("data", __S.getUint16(0, this), 13, this); + return __S.getData(0, this); + } + hasData(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initData(length: number): capnp.Data { + __S.setUint16(0, 13, this); + return __S.initData(0, length, this); + } + isData(): boolean { return __S.getUint16(0, this) === 13; } + setData(value: capnp.Data): void { + __S.setUint16(0, 13, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + adoptList(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(0, 14, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownList(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getList()); } + getList(): capnp.Pointer { + __S.testWhich("list", __S.getUint16(0, this), 14, this); + return __S.getPointer(0, this); + } + hasList(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isList(): boolean { return __S.getUint16(0, this) === 14; } + setList(value: capnp.Pointer): void { + __S.setUint16(0, 14, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + getEnum(): number { + __S.testWhich("enum", __S.getUint16(0, this), 15, this); + return __S.getUint16(2, this); + } + isEnum(): boolean { return __S.getUint16(0, this) === 15; } + setEnum(value: number): void { + __S.setUint16(0, 15, this); + __S.setUint16(2, value, this); + } + adoptStruct(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(0, 16, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownStruct(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getStruct()); } + getStruct(): capnp.Pointer { + __S.testWhich("struct", __S.getUint16(0, this), 16, this); + return __S.getPointer(0, this); + } + hasStruct(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isStruct(): boolean { return __S.getUint16(0, this) === 16; } + setStruct(value: capnp.Pointer): void { + __S.setUint16(0, 16, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + isInterface(): boolean { return __S.getUint16(0, this) === 17; } + setInterface(): void { __S.setUint16(0, 17, this); } + adoptAnyPointer(value: capnp.Orphan<capnp.Pointer>): void { + __S.setUint16(0, 18, this); + __S.adopt(value, __S.getPointer(0, this)); + } + disownAnyPointer(): capnp.Orphan<capnp.Pointer> { return __S.disown(this.getAnyPointer()); } + getAnyPointer(): capnp.Pointer { + __S.testWhich("anyPointer", __S.getUint16(0, this), 18, this); + return __S.getPointer(0, this); + } + hasAnyPointer(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + isAnyPointer(): boolean { return __S.getUint16(0, this) === 18; } + setAnyPointer(value: capnp.Pointer): void { + __S.setUint16(0, 18, this); + __S.copyFrom(value, __S.getPointer(0, this)); + } + toString(): string { return "Value_" + super.toString(); } + which(): Value_Which { return __S.getUint16(0, this); } +} +export class Annotation extends __S { + static readonly _capnp = { displayName: "Annotation", id: "f1c8950dab257542", size: new __O(8, 2) }; + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + adoptBrand(value: capnp.Orphan<Brand>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownBrand(): capnp.Orphan<Brand> { return __S.disown(this.getBrand()); } + getBrand(): Brand { return __S.getStruct(1, Brand, this); } + hasBrand(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initBrand(): Brand { return __S.initStructAt(1, Brand, this); } + setBrand(value: Brand): void { __S.copyFrom(value, __S.getPointer(1, this)); } + adoptValue(value: capnp.Orphan<Value>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownValue(): capnp.Orphan<Value> { return __S.disown(this.getValue()); } + getValue(): Value { return __S.getStruct(0, Value, this); } + hasValue(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initValue(): Value { return __S.initStructAt(0, Value, this); } + setValue(value: Value): void { __S.copyFrom(value, __S.getPointer(0, this)); } + toString(): string { return "Annotation_" + super.toString(); } +} +export enum ElementSize { + EMPTY, + BIT, + BYTE, + TWO_BYTES, + FOUR_BYTES, + EIGHT_BYTES, + POINTER, + INLINE_COMPOSITE +} +export class CapnpVersion extends __S { + static readonly _capnp = { displayName: "CapnpVersion", id: "d85d305b7d839963", size: new __O(8, 0) }; + getMajor(): number { return __S.getUint16(0, this); } + setMajor(value: number): void { __S.setUint16(0, value, this); } + getMinor(): number { return __S.getUint8(2, this); } + setMinor(value: number): void { __S.setUint8(2, value, this); } + getMicro(): number { return __S.getUint8(3, this); } + setMicro(value: number): void { __S.setUint8(3, value, this); } + toString(): string { return "CapnpVersion_" + super.toString(); } +} +export class CodeGeneratorRequest_RequestedFile_Import extends __S { + static readonly _capnp = { displayName: "Import", id: "ae504193122357e5", size: new __O(8, 1) }; + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + getName(): string { return __S.getText(0, this); } + setName(value: string): void { __S.setText(0, value, this); } + toString(): string { return "CodeGeneratorRequest_RequestedFile_Import_" + super.toString(); } +} +export class CodeGeneratorRequest_RequestedFile extends __S { + static readonly Import = CodeGeneratorRequest_RequestedFile_Import; + static readonly _capnp = { displayName: "RequestedFile", id: "cfea0eb02e810062", size: new __O(8, 2) }; + static _Imports: capnp.ListCtor<CodeGeneratorRequest_RequestedFile_Import>; + getId(): capnp.Uint64 { return __S.getUint64(0, this); } + setId(value: capnp.Uint64): void { __S.setUint64(0, value, this); } + getFilename(): string { return __S.getText(0, this); } + setFilename(value: string): void { __S.setText(0, value, this); } + adoptImports(value: capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile_Import>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownImports(): capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile_Import>> { return __S.disown(this.getImports()); } + getImports(): capnp.List<CodeGeneratorRequest_RequestedFile_Import> { return __S.getList(1, CodeGeneratorRequest_RequestedFile._Imports, this); } + hasImports(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initImports(length: number): capnp.List<CodeGeneratorRequest_RequestedFile_Import> { return __S.initList(1, CodeGeneratorRequest_RequestedFile._Imports, length, this); } + setImports(value: capnp.List<CodeGeneratorRequest_RequestedFile_Import>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "CodeGeneratorRequest_RequestedFile_" + super.toString(); } +} +export class CodeGeneratorRequest extends __S { + static readonly RequestedFile = CodeGeneratorRequest_RequestedFile; + static readonly _capnp = { displayName: "CodeGeneratorRequest", id: "bfc546f6210ad7ce", size: new __O(0, 3) }; + static _Nodes: capnp.ListCtor<Node>; + static _RequestedFiles: capnp.ListCtor<CodeGeneratorRequest_RequestedFile>; + adoptCapnpVersion(value: capnp.Orphan<CapnpVersion>): void { __S.adopt(value, __S.getPointer(2, this)); } + disownCapnpVersion(): capnp.Orphan<CapnpVersion> { return __S.disown(this.getCapnpVersion()); } + getCapnpVersion(): CapnpVersion { return __S.getStruct(2, CapnpVersion, this); } + hasCapnpVersion(): boolean { return !__S.isNull(__S.getPointer(2, this)); } + initCapnpVersion(): CapnpVersion { return __S.initStructAt(2, CapnpVersion, this); } + setCapnpVersion(value: CapnpVersion): void { __S.copyFrom(value, __S.getPointer(2, this)); } + adoptNodes(value: capnp.Orphan<capnp.List<Node>>): void { __S.adopt(value, __S.getPointer(0, this)); } + disownNodes(): capnp.Orphan<capnp.List<Node>> { return __S.disown(this.getNodes()); } + getNodes(): capnp.List<Node> { return __S.getList(0, CodeGeneratorRequest._Nodes, this); } + hasNodes(): boolean { return !__S.isNull(__S.getPointer(0, this)); } + initNodes(length: number): capnp.List<Node> { return __S.initList(0, CodeGeneratorRequest._Nodes, length, this); } + setNodes(value: capnp.List<Node>): void { __S.copyFrom(value, __S.getPointer(0, this)); } + adoptRequestedFiles(value: capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile>>): void { __S.adopt(value, __S.getPointer(1, this)); } + disownRequestedFiles(): capnp.Orphan<capnp.List<CodeGeneratorRequest_RequestedFile>> { return __S.disown(this.getRequestedFiles()); } + getRequestedFiles(): capnp.List<CodeGeneratorRequest_RequestedFile> { return __S.getList(1, CodeGeneratorRequest._RequestedFiles, this); } + hasRequestedFiles(): boolean { return !__S.isNull(__S.getPointer(1, this)); } + initRequestedFiles(length: number): capnp.List<CodeGeneratorRequest_RequestedFile> { return __S.initList(1, CodeGeneratorRequest._RequestedFiles, length, this); } + setRequestedFiles(value: capnp.List<CodeGeneratorRequest_RequestedFile>): void { __S.copyFrom(value, __S.getPointer(1, this)); } + toString(): string { return "CodeGeneratorRequest_" + super.toString(); } +} +Node_Struct._Fields = capnp.CompositeList(Field); +Node_Enum._Enumerants = capnp.CompositeList(Enumerant); +Node_Interface._Methods = capnp.CompositeList(Method); +Node_Interface._Superclasses = capnp.CompositeList(Superclass); +Node._Parameters = capnp.CompositeList(Node_Parameter); +Node._NestedNodes = capnp.CompositeList(Node_NestedNode); +Node._Annotations = capnp.CompositeList(Annotation); +Field._Annotations = capnp.CompositeList(Annotation); +Enumerant._Annotations = capnp.CompositeList(Annotation); +Method._ImplicitParameters = capnp.CompositeList(Node_Parameter); +Method._Annotations = capnp.CompositeList(Annotation); +Brand_Scope._Bind = capnp.CompositeList(Brand_Binding); +Brand._Scopes = capnp.CompositeList(Brand_Scope); +CodeGeneratorRequest_RequestedFile._Imports = capnp.CompositeList(CodeGeneratorRequest_RequestedFile_Import); +CodeGeneratorRequest._Nodes = capnp.CompositeList(Node); +CodeGeneratorRequest._RequestedFiles = capnp.CompositeList(CodeGeneratorRequest_RequestedFile); diff --git a/node_modules/capnp-ts/src/std/ts.capnp.d.ts b/node_modules/capnp-ts/src/std/ts.capnp.d.ts new file mode 100644 index 0000000..c97581c --- /dev/null +++ b/node_modules/capnp-ts/src/std/ts.capnp.d.ts @@ -0,0 +1,5 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +export declare const _capnpFileId = "e37ded525a68a7c9"; diff --git a/node_modules/capnp-ts/src/std/ts.capnp.js b/node_modules/capnp-ts/src/std/ts.capnp.js new file mode 100644 index 0000000..b842969 --- /dev/null +++ b/node_modules/capnp-ts/src/std/ts.capnp.js @@ -0,0 +1,9 @@ +"use strict"; +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports._capnpFileId = void 0; +exports._capnpFileId = "e37ded525a68a7c9"; +//# sourceMappingURL=ts.capnp.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/ts.capnp.js.map b/node_modules/capnp-ts/src/std/ts.capnp.js.map new file mode 100644 index 0000000..228bccb --- /dev/null +++ b/node_modules/capnp-ts/src/std/ts.capnp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ts.capnp.js","sourceRoot":"","sources":["ts.capnp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,YAAY,GAAG,kBAAkB,CAAC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/std/ts.capnp.ts b/node_modules/capnp-ts/src/std/ts.capnp.ts new file mode 100644 index 0000000..c8713de --- /dev/null +++ b/node_modules/capnp-ts/src/std/ts.capnp.ts @@ -0,0 +1,8 @@ +/** + * This file is generated by hand in order to bootstrap compiler development. It is intended to be an exact match to + * compiled output. + */ + +import * as capnp from "../index"; +import { ObjectSize as __O, Struct as __S } from "../index"; +export const _capnpFileId = "e37ded525a68a7c9"; diff --git a/node_modules/capnp-ts/src/types/index.d.ts b/node_modules/capnp-ts/src/types/index.d.ts new file mode 100644 index 0000000..2bc6e94 --- /dev/null +++ b/node_modules/capnp-ts/src/types/index.d.ts @@ -0,0 +1,5 @@ +/** + * @author jdiaz5513 + */ +export { Int64 } from "./int64"; +export { Uint64 } from "./uint64"; diff --git a/node_modules/capnp-ts/src/types/index.js b/node_modules/capnp-ts/src/types/index.js new file mode 100644 index 0000000..7bb7268 --- /dev/null +++ b/node_modules/capnp-ts/src/types/index.js @@ -0,0 +1,11 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint64 = exports.Int64 = void 0; +var int64_1 = require("./int64"); +Object.defineProperty(exports, "Int64", { enumerable: true, get: function () { return int64_1.Int64; } }); +var uint64_1 = require("./uint64"); +Object.defineProperty(exports, "Uint64", { enumerable: true, get: function () { return uint64_1.Uint64; } }); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/index.js.map b/node_modules/capnp-ts/src/types/index.js.map new file mode 100644 index 0000000..66d9975 --- /dev/null +++ b/node_modules/capnp-ts/src/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/index.ts b/node_modules/capnp-ts/src/types/index.ts new file mode 100644 index 0000000..5abe946 --- /dev/null +++ b/node_modules/capnp-ts/src/types/index.ts @@ -0,0 +1,6 @@ +/** + * @author jdiaz5513 + */ + +export { Int64 } from "./int64"; +export { Uint64 } from "./uint64"; diff --git a/node_modules/capnp-ts/src/types/int64.d.ts b/node_modules/capnp-ts/src/types/int64.d.ts new file mode 100644 index 0000000..a66e633 --- /dev/null +++ b/node_modules/capnp-ts/src/types/int64.d.ts @@ -0,0 +1,43 @@ +/** + * @author jdiaz5513 + */ +import { Uint64 } from "./uint64"; +/** + * Represents a signed 64-bit integer stored using a Uint8Array in little-endian format. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ +export declare class Int64 extends Uint64 { + static fromArrayBuffer(source: ArrayBuffer, offset?: number, noCopy?: boolean): Int64; + static fromDataView(source: DataView, offset?: number, noCopy?: boolean): Int64; + static fromNumber(source: number): Int64; + /** + * Parse a hexadecimal string in **big endian format** as an Int64 value. + * + * The value will be negative if the string is either preceded with a `-` sign, or already in the negative 2's + * complement form. + * + * @static + * @param {string} source The source string. + * @returns {Int64} The string parsed as a 64-bit signed integer. + */ + static fromHexString(source: string): Int64; + static fromUint8Array(source: Uint8Array, offset?: number, noCopy?: boolean): Int64; + equals(other: Int64): boolean; + inspect(): string; + negate(): void; + setValue(loWord: number, hiWord?: number): void; + toHexString(): string; + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +/-Infinity. + * @returns {number} A numeric representation of this integer. + */ + toNumber(allowImprecise?: boolean): number; +} diff --git a/node_modules/capnp-ts/src/types/int64.js b/node_modules/capnp-ts/src/types/int64.js new file mode 100644 index 0000000..80d00b3 --- /dev/null +++ b/node_modules/capnp-ts/src/types/int64.js @@ -0,0 +1,162 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Int64 = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../constants"); +const util_1 = require("../util"); +const uint64_1 = require("./uint64"); +const trace = debug_1.default("capnp:int64"); +trace("load"); +/** + * Represents a signed 64-bit integer stored using a Uint8Array in little-endian format. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ +class Int64 extends uint64_1.Uint64 { + static fromArrayBuffer(source, offset = 0, noCopy = false) { + if (noCopy) + return new this(new Uint8Array(source, offset, 8)); + return new this(new Uint8Array(source.slice(offset, offset + 8))); + } + static fromDataView(source, offset = 0, noCopy = false) { + if (noCopy) { + return new this(new Uint8Array(source.buffer, source.byteOffset + offset, 8)); + } + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteLength + offset + 8))); + } + static fromNumber(source) { + const ret = new this(new Uint8Array(8)); + ret.setValue(source); + return ret; + } + /** + * Parse a hexadecimal string in **big endian format** as an Int64 value. + * + * The value will be negative if the string is either preceded with a `-` sign, or already in the negative 2's + * complement form. + * + * @static + * @param {string} source The source string. + * @returns {Int64} The string parsed as a 64-bit signed integer. + */ + static fromHexString(source) { + if (source.substr(0, 2) === "0x") + source = source.substr(2); + if (source.length < 1) + return Int64.fromNumber(0); + const neg = source[0] === "-"; + if (neg) + source = source.substr(1); + source = util_1.pad(source, 16); + if (source.length !== 16) { + throw new RangeError("Source string must contain at most 16 hexadecimal digits."); + } + const bytes = source.toLowerCase().replace(/[^\da-f]/g, ""); + const buf = new Uint8Array(new ArrayBuffer(8)); + for (let i = 0; i < 8; i++) { + buf[7 - i] = parseInt(bytes.substr(i * 2, 2), 16); + } + const val = new Int64(buf); + if (neg) + val.negate(); + return val; + } + static fromUint8Array(source, offset = 0, noCopy = false) { + if (noCopy) + return new this(source.subarray(offset, offset + 8)); + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteOffset + offset + 8))); + } + equals(other) { + return super.equals(other); + } + inspect() { + return `[Int64 ${this.toString(10)} 0x${this.toHexString()}]`; + } + negate() { + for (let b = this.buffer, carry = 1, i = 0; i < 8; i++) { + const v = (b[i] ^ 0xff) + carry; + b[i] = v & 0xff; + carry = v >> 8; + } + } + setValue(loWord, hiWord) { + let negate = false; + let lo = loWord; + let hi = hiWord; + if (hi === undefined) { + hi = lo; + negate = hi < 0; + hi = Math.abs(hi); + lo = hi % constants_1.VAL32; + hi = hi / constants_1.VAL32; + if (hi > constants_1.VAL32) + throw new RangeError(`${loWord} is outside Int64 range`); + hi = hi >>> 0; + } + for (let i = 0; i < 8; i++) { + this.buffer[i] = lo & 0xff; + lo = i === 3 ? hi : lo >>> 8; + } + if (negate) + this.negate(); + } + toHexString() { + const b = this.buffer; + const negate = b[7] & 0x80; + if (negate) + this.negate(); + let hex = ""; + for (let i = 7; i >= 0; i--) { + let v = b[i].toString(16); + if (v.length === 1) + v = "0" + v; + hex += v; + } + if (negate) { + this.negate(); + hex = "-" + hex; + } + return hex; + } + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +/-Infinity. + * @returns {number} A numeric representation of this integer. + */ + toNumber(allowImprecise) { + const b = this.buffer; + const negate = b[7] & 0x80; + let x = 0; + let carry = 1; + let i = 0; + let m = 1; + while (i < 8) { + let v = b[i]; + if (negate) { + v = (v ^ 0xff) + carry; + carry = v >> 8; + v = v & 0xff; + } + x += v * m; + m *= 256; + i++; + } + if (!allowImprecise && x >= constants_1.MAX_SAFE_INTEGER) { + trace("Coercing out of range value %d to Infinity.", x); + return negate ? -Infinity : Infinity; + } + return negate ? -x : x; + } +} +exports.Int64 = Int64; +//# sourceMappingURL=int64.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/int64.js.map b/node_modules/capnp-ts/src/types/int64.js.map new file mode 100644 index 0000000..e04aee3 --- /dev/null +++ b/node_modules/capnp-ts/src/types/int64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"int64.js","sourceRoot":"","sources":["int64.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,0DAA8B;AAE9B,4CAAuD;AACvD,kCAA8B;AAC9B,qCAAkC;AAElC,MAAM,KAAK,GAAG,eAAS,CAAC,aAAa,CAAC,CAAC;AACvC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd;;;;;;GAMG;AAEH,MAAa,KAAM,SAAQ,eAAM;IAC/B,MAAM,CAAC,eAAe,CAAC,MAAmB,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;QACpE,IAAI,MAAM;YAAE,OAAO,IAAI,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QAE/D,OAAO,IAAI,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM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C,CAAC;gBACf,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;aACd;YAED,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACX,CAAC,IAAI,GAAG,CAAC;YACT,CAAC,EAAE,CAAC;SACL;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,4BAAgB,EAAE;YAC5C,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;YAExD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;SACtC;QAED,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;CACF;AAlLD,sBAkLC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/int64.ts b/node_modules/capnp-ts/src/types/int64.ts new file mode 100644 index 0000000..c6b2410 --- /dev/null +++ b/node_modules/capnp-ts/src/types/int64.ts @@ -0,0 +1,200 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { MAX_SAFE_INTEGER, VAL32 } from "../constants"; +import { pad } from "../util"; +import { Uint64 } from "./uint64"; + +const trace = initTrace("capnp:int64"); +trace("load"); + +/** + * Represents a signed 64-bit integer stored using a Uint8Array in little-endian format. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ + +export class Int64 extends Uint64 { + static fromArrayBuffer(source: ArrayBuffer, offset = 0, noCopy = false): Int64 { + if (noCopy) return new this(new Uint8Array(source, offset, 8)); + + return new this(new Uint8Array(source.slice(offset, offset + 8))); + } + + static fromDataView(source: DataView, offset = 0, noCopy = false): Int64 { + if (noCopy) { + return new this(new Uint8Array(source.buffer, source.byteOffset + offset, 8)); + } + + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteLength + offset + 8))); + } + + static fromNumber(source: number): Int64 { + const ret = new this(new Uint8Array(8)); + + ret.setValue(source); + + return ret; + } + + /** + * Parse a hexadecimal string in **big endian format** as an Int64 value. + * + * The value will be negative if the string is either preceded with a `-` sign, or already in the negative 2's + * complement form. + * + * @static + * @param {string} source The source string. + * @returns {Int64} The string parsed as a 64-bit signed integer. + */ + + static fromHexString(source: string): Int64 { + if (source.substr(0, 2) === "0x") source = source.substr(2); + + if (source.length < 1) return Int64.fromNumber(0); + + const neg = source[0] === "-"; + + if (neg) source = source.substr(1); + + source = pad(source, 16); + + if (source.length !== 16) { + throw new RangeError("Source string must contain at most 16 hexadecimal digits."); + } + + const bytes = source.toLowerCase().replace(/[^\da-f]/g, ""); + const buf = new Uint8Array(new ArrayBuffer(8)); + + for (let i = 0; i < 8; i++) { + buf[7 - i] = parseInt(bytes.substr(i * 2, 2), 16); + } + + const val = new Int64(buf); + + if (neg) val.negate(); + + return val; + } + + static fromUint8Array(source: Uint8Array, offset = 0, noCopy = false): Int64 { + if (noCopy) return new this(source.subarray(offset, offset + 8)); + + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteOffset + offset + 8))); + } + + equals(other: Int64): boolean { + return super.equals(other); + } + + inspect(): string { + return `[Int64 ${this.toString(10)} 0x${this.toHexString()}]`; + } + + negate(): void { + for (let b = this.buffer, carry = 1, i = 0; i < 8; i++) { + const v = (b[i] ^ 0xff) + carry; + + b[i] = v & 0xff; + carry = v >> 8; + } + } + + setValue(loWord: number, hiWord?: number): void { + let negate = false; + let lo = loWord; + let hi = hiWord; + + if (hi === undefined) { + hi = lo; + negate = hi < 0; + hi = Math.abs(hi); + lo = hi % VAL32; + hi = hi / VAL32; + + if (hi > VAL32) throw new RangeError(`${loWord} is outside Int64 range`); + + hi = hi >>> 0; + } + + for (let i = 0; i < 8; i++) { + this.buffer[i] = lo & 0xff; + + lo = i === 3 ? hi : lo >>> 8; + } + + if (negate) this.negate(); + } + + toHexString(): string { + const b = this.buffer; + const negate = b[7] & 0x80; + + if (negate) this.negate(); + + let hex = ""; + + for (let i = 7; i >= 0; i--) { + let v = b[i].toString(16); + + if (v.length === 1) v = "0" + v; + + hex += v; + } + + if (negate) { + this.negate(); + + hex = "-" + hex; + } + + return hex; + } + + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +/-Infinity. + * @returns {number} A numeric representation of this integer. + */ + + toNumber(allowImprecise?: boolean): number { + const b = this.buffer; + const negate = b[7] & 0x80; + + let x = 0; + let carry = 1; + let i = 0; + let m = 1; + + while (i < 8) { + let v = b[i]; + + if (negate) { + v = (v ^ 0xff) + carry; + carry = v >> 8; + v = v & 0xff; + } + + x += v * m; + m *= 256; + i++; + } + + if (!allowImprecise && x >= MAX_SAFE_INTEGER) { + trace("Coercing out of range value %d to Infinity.", x); + + return negate ? -Infinity : Infinity; + } + + return negate ? -x : x; + } +} diff --git a/node_modules/capnp-ts/src/types/uint64.d.ts b/node_modules/capnp-ts/src/types/uint64.d.ts new file mode 100644 index 0000000..f274f30 --- /dev/null +++ b/node_modules/capnp-ts/src/types/uint64.d.ts @@ -0,0 +1,64 @@ +/** + * @author jdiaz5513 + */ +/** + * Represents an unsigned 64-bit integer stored using a Uint8Array in little-endian format. It's a little bit faster + * than int64 because we don't need to keep track of the sign bit or perform two's compliment operations on set. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * Note that overflow is not implemented, so negative numbers passed into `setValue()` will be negated first. + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ +export declare class Uint64 { + readonly buffer: Uint8Array; + /** + * Creates a new instance; this is a no-frills constructor for speed. Use the factory methods if you need to convert + * from other types or use a different offset into the buffer. + * + * Will throw if the buffer is not at least 8 bytes long. + * + * @constructor + * @param {Uint8Array} buffer The buffer to use for this 64-bit word; the bytes must be in little-endian order. + */ + constructor(buffer: Uint8Array); + static fromArrayBuffer(source: ArrayBuffer, offset?: number, noCopy?: boolean): Uint64; + static fromDataView(source: DataView, offset?: number, noCopy?: boolean): Uint64; + /** + * Parse a hexadecimal string in **big endian format** as a Uint64 value. + * + * @static + * @param {string} source The source string. + * @returns {Uint64} The string parsed as a 64-bit unsigned integer. + */ + static fromHexString(source: string): Uint64; + static fromNumber(source: number): Uint64; + static fromUint8Array(source: Uint8Array, offset?: number, noCopy?: boolean): Uint64; + equals(other: Uint64): boolean; + inspect(): string; + /** + * Faster way to check for zero values without converting to a number first. + * + * @returns {boolean} `true` if the contained value is zero. + * @memberOf Uint64 + */ + isZero(): boolean; + setValue(loWord: number, hiWord?: number): void; + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +Infinity. + * @returns {number} A numeric representation of this integer. + */ + toNumber(allowImprecise?: boolean): number; + valueOf(): number; + toArrayBuffer(): ArrayBuffer; + toDataView(): DataView; + toHexString(): string; + toString(radix?: number): string; + toUint8Array(): Uint8Array; +} diff --git a/node_modules/capnp-ts/src/types/uint64.js b/node_modules/capnp-ts/src/types/uint64.js new file mode 100644 index 0000000..70e264f --- /dev/null +++ b/node_modules/capnp-ts/src/types/uint64.js @@ -0,0 +1,178 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint64 = void 0; +const tslib_1 = require("tslib"); +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("../constants"); +const errors_1 = require("../errors"); +const util_1 = require("../util"); +const trace = debug_1.default("capnp:uint64"); +trace("load"); +/** + * Represents an unsigned 64-bit integer stored using a Uint8Array in little-endian format. It's a little bit faster + * than int64 because we don't need to keep track of the sign bit or perform two's compliment operations on set. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * Note that overflow is not implemented, so negative numbers passed into `setValue()` will be negated first. + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ +class Uint64 { + /** + * Creates a new instance; this is a no-frills constructor for speed. Use the factory methods if you need to convert + * from other types or use a different offset into the buffer. + * + * Will throw if the buffer is not at least 8 bytes long. + * + * @constructor + * @param {Uint8Array} buffer The buffer to use for this 64-bit word; the bytes must be in little-endian order. + */ + constructor(buffer) { + if (buffer.byteLength < 8) + throw new RangeError(errors_1.RANGE_INT64_UNDERFLOW); + this.buffer = buffer; + } + static fromArrayBuffer(source, offset = 0, noCopy = false) { + if (noCopy) + return new this(new Uint8Array(source, offset, 8)); + return new this(new Uint8Array(source.slice(offset, offset + 8))); + } + static fromDataView(source, offset = 0, noCopy = false) { + if (noCopy) { + return new this(new Uint8Array(source.buffer, source.byteOffset + offset, 8)); + } + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteLength + offset + 8))); + } + /** + * Parse a hexadecimal string in **big endian format** as a Uint64 value. + * + * @static + * @param {string} source The source string. + * @returns {Uint64} The string parsed as a 64-bit unsigned integer. + */ + static fromHexString(source) { + if (source.substr(0, 2) === "0x") + source = source.substr(2); + if (source.length < 1) + return Uint64.fromNumber(0); + if (source[0] === "-") + throw new RangeError("Source must not be negative."); + source = util_1.pad(source, 16); + if (source.length !== 16) { + throw new RangeError("Source string must contain at most 16 hexadecimal digits."); + } + const bytes = source.toLowerCase().replace(/[^\da-f]/g, ""); + const buf = new Uint8Array(new ArrayBuffer(8)); + for (let i = 0; i < 8; i++) { + buf[7 - i] = parseInt(bytes.substr(i * 2, 2), 16); + } + return new Uint64(buf); + } + static fromNumber(source) { + const ret = new this(new Uint8Array(8)); + ret.setValue(source); + return ret; + } + static fromUint8Array(source, offset = 0, noCopy = false) { + if (noCopy) + return new this(source.subarray(offset, offset + 8)); + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteOffset + offset + 8))); + } + equals(other) { + for (let i = 0; i < 8; i++) { + if (this.buffer[i] !== other.buffer[i]) + return false; + } + return true; + } + inspect() { + return `[Uint64 ${this.toString(10)} 0x${this.toHexString()}]`; + } + /** + * Faster way to check for zero values without converting to a number first. + * + * @returns {boolean} `true` if the contained value is zero. + * @memberOf Uint64 + */ + isZero() { + for (let i = 0; i < 8; i++) { + if (this.buffer[i] !== 0) + return false; + } + return true; + } + setValue(loWord, hiWord) { + let lo = loWord; + let hi = hiWord; + if (hi === undefined) { + hi = lo; + hi = Math.abs(hi); + lo = hi % constants_1.VAL32; + hi = hi / constants_1.VAL32; + if (hi > constants_1.VAL32) + throw new RangeError(`${loWord} is outside Uint64 range`); + hi = hi >>> 0; + } + for (let i = 0; i < 8; i++) { + this.buffer[i] = lo & 0xff; + lo = i === 3 ? hi : lo >>> 8; + } + } + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +Infinity. + * @returns {number} A numeric representation of this integer. + */ + toNumber(allowImprecise) { + const b = this.buffer; + let x = 0; + let i = 0; + let m = 1; + while (i < 8) { + const v = b[i]; + x += v * m; + m *= 256; + i++; + } + if (!allowImprecise && x >= constants_1.MAX_SAFE_INTEGER) { + trace("Coercing out of range value %d to Infinity.", x); + return Infinity; + } + return x; + } + valueOf() { + return this.toNumber(false); + } + toArrayBuffer() { + return this.buffer.buffer; + } + toDataView() { + return new DataView(this.buffer.buffer); + } + toHexString() { + let hex = ""; + for (let i = 7; i >= 0; i--) { + let v = this.buffer[i].toString(16); + if (v.length === 1) + v = "0" + v; + hex += v; + } + return hex; + } + toString(radix) { + return this.toNumber(true).toString(radix); + } + toUint8Array() { + return this.buffer; + } +} +exports.Uint64 = Uint64; +//# sourceMappingURL=uint64.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/uint64.js.map b/node_modules/capnp-ts/src/types/uint64.js.map new file mode 100644 index 0000000..3bb25f2 --- /dev/null +++ b/node_modules/capnp-ts/src/types/uint64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uint64.js","sourceRoot":"","s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;QACR,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,WAAW;QACT,IAAI,GAAG,GAAG,EAAE,CAAC;QAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAEpC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YAEhC,GAAG,IAAI,CAAC,CAAC;SACV;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED,QAAQ,CAAC,KAAc;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAhMD,wBAgMC"}
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/types/uint64.ts b/node_modules/capnp-ts/src/types/uint64.ts new file mode 100644 index 0000000..a1ccc3a --- /dev/null +++ b/node_modules/capnp-ts/src/types/uint64.ts @@ -0,0 +1,217 @@ +/** + * @author jdiaz5513 + */ + +import initTrace from "debug"; + +import { MAX_SAFE_INTEGER, VAL32 } from "../constants"; +import { RANGE_INT64_UNDERFLOW } from "../errors"; +import { pad } from "../util"; + +const trace = initTrace("capnp:uint64"); +trace("load"); + +/** + * Represents an unsigned 64-bit integer stored using a Uint8Array in little-endian format. It's a little bit faster + * than int64 because we don't need to keep track of the sign bit or perform two's compliment operations on set. + * + * You may convert this to a primitive number by calling `toNumber()` but be wary of precision loss! + * + * Note that overflow is not implemented, so negative numbers passed into `setValue()` will be negated first. + * + * The value passed in as the source buffer is expected to be in little-endian format. + */ + +export class Uint64 { + readonly buffer: Uint8Array; + + /** + * Creates a new instance; this is a no-frills constructor for speed. Use the factory methods if you need to convert + * from other types or use a different offset into the buffer. + * + * Will throw if the buffer is not at least 8 bytes long. + * + * @constructor + * @param {Uint8Array} buffer The buffer to use for this 64-bit word; the bytes must be in little-endian order. + */ + + constructor(buffer: Uint8Array) { + if (buffer.byteLength < 8) throw new RangeError(RANGE_INT64_UNDERFLOW); + + this.buffer = buffer; + } + + static fromArrayBuffer(source: ArrayBuffer, offset = 0, noCopy = false): Uint64 { + if (noCopy) return new this(new Uint8Array(source, offset, 8)); + + return new this(new Uint8Array(source.slice(offset, offset + 8))); + } + + static fromDataView(source: DataView, offset = 0, noCopy = false): Uint64 { + if (noCopy) { + return new this(new Uint8Array(source.buffer, source.byteOffset + offset, 8)); + } + + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteLength + offset + 8))); + } + + /** + * Parse a hexadecimal string in **big endian format** as a Uint64 value. + * + * @static + * @param {string} source The source string. + * @returns {Uint64} The string parsed as a 64-bit unsigned integer. + */ + + static fromHexString(source: string): Uint64 { + if (source.substr(0, 2) === "0x") source = source.substr(2); + + if (source.length < 1) return Uint64.fromNumber(0); + + if (source[0] === "-") throw new RangeError("Source must not be negative."); + + source = pad(source, 16); + + if (source.length !== 16) { + throw new RangeError("Source string must contain at most 16 hexadecimal digits."); + } + + const bytes = source.toLowerCase().replace(/[^\da-f]/g, ""); + const buf = new Uint8Array(new ArrayBuffer(8)); + + for (let i = 0; i < 8; i++) { + buf[7 - i] = parseInt(bytes.substr(i * 2, 2), 16); + } + + return new Uint64(buf); + } + + static fromNumber(source: number): Uint64 { + const ret = new this(new Uint8Array(8)); + + ret.setValue(source); + + return ret; + } + + static fromUint8Array(source: Uint8Array, offset = 0, noCopy = false): Uint64 { + if (noCopy) return new this(source.subarray(offset, offset + 8)); + + return new this(new Uint8Array(source.buffer.slice(source.byteOffset + offset, source.byteOffset + offset + 8))); + } + + equals(other: Uint64): boolean { + for (let i = 0; i < 8; i++) { + if (this.buffer[i] !== other.buffer[i]) return false; + } + + return true; + } + + inspect(): string { + return `[Uint64 ${this.toString(10)} 0x${this.toHexString()}]`; + } + + /** + * Faster way to check for zero values without converting to a number first. + * + * @returns {boolean} `true` if the contained value is zero. + * @memberOf Uint64 + */ + + isZero(): boolean { + for (let i = 0; i < 8; i++) { + if (this.buffer[i] !== 0) return false; + } + + return true; + } + + setValue(loWord: number, hiWord?: number): void { + let lo = loWord; + let hi = hiWord; + + if (hi === undefined) { + hi = lo; + hi = Math.abs(hi); + lo = hi % VAL32; + hi = hi / VAL32; + + if (hi > VAL32) throw new RangeError(`${loWord} is outside Uint64 range`); + + hi = hi >>> 0; + } + + for (let i = 0; i < 8; i++) { + this.buffer[i] = lo & 0xff; + lo = i === 3 ? hi : lo >>> 8; + } + } + + /** + * Convert to a native javascript number. + * + * WARNING: do not expect this number to be accurate to integer precision for large (positive or negative) numbers! + * + * @param {boolean} allowImprecise If `true`, no check is performed to verify the returned value is accurate; + * otherwise out-of-range values are clamped to +Infinity. + * @returns {number} A numeric representation of this integer. + */ + + toNumber(allowImprecise?: boolean): number { + const b = this.buffer; + let x = 0; + let i = 0; + let m = 1; + + while (i < 8) { + const v = b[i]; + + x += v * m; + m *= 256; + i++; + } + + if (!allowImprecise && x >= MAX_SAFE_INTEGER) { + trace("Coercing out of range value %d to Infinity.", x); + + return Infinity; + } + + return x; + } + + valueOf(): number { + return this.toNumber(false); + } + + toArrayBuffer(): ArrayBuffer { + return this.buffer.buffer; + } + + toDataView(): DataView { + return new DataView(this.buffer.buffer); + } + + toHexString(): string { + let hex = ""; + + for (let i = 7; i >= 0; i--) { + let v = this.buffer[i].toString(16); + + if (v.length === 1) v = "0" + v; + + hex += v; + } + + return hex; + } + + toString(radix?: number): string { + return this.toNumber(true).toString(radix); + } + + toUint8Array(): Uint8Array { + return this.buffer; + } +} diff --git a/node_modules/capnp-ts/src/util.d.ts b/node_modules/capnp-ts/src/util.d.ts new file mode 100644 index 0000000..00c805e --- /dev/null +++ b/node_modules/capnp-ts/src/util.d.ts @@ -0,0 +1,75 @@ +/** + * @author jdiaz5513 + */ +/** + * Dump a hex string from the given buffer. + * + * @export + * @param {ArrayBuffer} buffer The buffer to convert. + * @returns {string} A hexadecimal string representing the buffer. + */ +export declare function bufferToHex(buffer: ArrayBuffer): string; +/** + * Throw an error if the provided value cannot be represented as a 32-bit integer. + * + * @export + * @param {number} value The number to check. + * @returns {number} The same number if it is valid. + */ +export declare function checkInt32(value: number): number; +export declare function checkUint32(value: number): number; +/** + * Decode a UTF-8 encoded byte array into a JavaScript string (UCS-2). + * + * @export + * @param {Uint8Array} src A utf-8 encoded byte array. + * @returns {string} A string representation of the byte array. + */ +export declare function decodeUtf8(src: Uint8Array): string; +export declare function dumpBuffer(buffer: ArrayBuffer | ArrayBufferView): string; +/** + * Encode a JavaScript string (UCS-2) to a UTF-8 encoded string inside a Uint8Array. + * + * Note that the underlying buffer for the array will likely be larger than the actual contents; ignore the extra bytes. + * + * @export + * @param {string} src The input string. + * @returns {Uint8Array} A UTF-8 encoded buffer with the string's contents. + */ +export declare function encodeUtf8(src: string): Uint8Array; +/** + * Produce a `printf`-style string. Nice for providing arguments to `assert` without paying the cost for string + * concatenation up front. Precision is supported for floating point numbers. + * + * @param {string} s The format string. Supported format specifiers: b, c, d, f, j, o, s, x, and X. + * @param {...any} args Values to be formatted in the string. Arguments beyond what are consumed by the format string + * are ignored. + * @returns {string} The formatted string. + */ +export declare function format(s: string, ...args: unknown[]): string; +/** + * Return the thing that was passed in. Yaaaaawn. + * + * @export + * @template T + * @param {T} x A thing. + * @returns {T} The same thing. + */ +export declare function identity<T>(x: T): T; +export declare function pad(v: string, width: number, pad?: string): string; +/** + * Add padding to a number to make it divisible by 8. Typically used to pad byte sizes so they align to a word boundary. + * + * @export + * @param {number} size The number to pad. + * @returns {number} The padded number. + */ +export declare function padToWord(size: number): number; +/** + * Repeat a string n times. Shamelessly copied from lodash.repeat. + * + * @param {number} times Number of times to repeat. + * @param {string} str The string to repeat. + * @returns {string} The repeated string. + */ +export declare function repeat(times: number, str: string): string; diff --git a/node_modules/capnp-ts/src/util.js b/node_modules/capnp-ts/src/util.js new file mode 100644 index 0000000..e29e69e --- /dev/null +++ b/node_modules/capnp-ts/src/util.js @@ -0,0 +1,349 @@ +"use strict"; +/** + * @author jdiaz5513 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.repeat = exports.padToWord = exports.pad = exports.identity = exports.format = exports.encodeUtf8 = exports.dumpBuffer = exports.decodeUtf8 = exports.checkUint32 = exports.checkInt32 = exports.bufferToHex = void 0; +const tslib_1 = require("tslib"); +// LINT: a lot of the util functions need the any type. +/* tslint:disable:no-any no-unsafe-any */ +const debug_1 = tslib_1.__importDefault(require("debug")); +const constants_1 = require("./constants"); +const errors_1 = require("./errors"); +const trace = debug_1.default("capnp:util"); +trace("load"); +/** + * Dump a hex string from the given buffer. + * + * @export + * @param {ArrayBuffer} buffer The buffer to convert. + * @returns {string} A hexadecimal string representing the buffer. + */ +function bufferToHex(buffer) { + const a = new Uint8Array(buffer); + const h = []; + for (let i = 0; i < a.byteLength; i++) + h.push(pad(a[i].toString(16), 2)); + return `[${h.join(" ")}]`; +} +exports.bufferToHex = bufferToHex; +/** + * Throw an error if the provided value cannot be represented as a 32-bit integer. + * + * @export + * @param {number} value The number to check. + * @returns {number} The same number if it is valid. + */ +function checkInt32(value) { + if (value > constants_1.MAX_INT32 || value < -constants_1.MAX_INT32) { + throw new RangeError(errors_1.RANGE_INT32_OVERFLOW); + } + return value; +} +exports.checkInt32 = checkInt32; +function checkUint32(value) { + if (value < 0 || value > constants_1.MAX_UINT32) { + throw new RangeError(errors_1.RANGE_UINT32_OVERFLOW); + } + return value; +} +exports.checkUint32 = checkUint32; +/** + * Decode a UTF-8 encoded byte array into a JavaScript string (UCS-2). + * + * @export + * @param {Uint8Array} src A utf-8 encoded byte array. + * @returns {string} A string representation of the byte array. + */ +function decodeUtf8(src) { + // This ain't for the faint of heart, kids. If you suffer from seizures, heart palpitations, or have had a history of + // stroke you may want to look away now. + const l = src.byteLength; + let dst = ""; + let i = 0; + let cp = 0; + let a = 0; + let b = 0; + let c = 0; + let d = 0; + while (i < l) { + a = src[i++]; + if ((a & 0b10000000) === 0) { + cp = a; + } + else if ((a & 0b11100000) === 0b11000000) { + if (i >= l) + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + b = src[i++]; + cp = ((a & 0b00011111) << 6) | (b & 0b00111111); + } + else if ((a & 0b11110000) === 0b11100000) { + if (i + 1 >= l) + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + b = src[i++]; + c = src[i++]; + cp = ((a & 0b00001111) << 12) | ((b & 0b00111111) << 6) | (c & 0b00111111); + } + else if ((a & 0b11111000) === 0b11110000) { + if (i + 2 >= l) + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + b = src[i++]; + c = src[i++]; + d = src[i++]; + cp = ((a & 0b00000111) << 18) | ((b & 0b00111111) << 12) | ((c & 0b00111111) << 6) | (d & 0b00111111); + } + else { + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + } + if (cp <= 0xd7ff || (cp >= 0xe000 && cp <= 0xffff)) { + dst += String.fromCharCode(cp); + } + else { + // We must reach into the astral plane and construct the surrogate pair! + cp -= 0x00010000; + const hi = (cp >>> 10) + 0xd800; + const lo = (cp & 0x03ff) + 0xdc00; + if (hi < 0xd800 || hi > 0xdbff) + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + dst += String.fromCharCode(hi, lo); + } + } + return dst; +} +exports.decodeUtf8 = decodeUtf8; +function dumpBuffer(buffer) { + const b = buffer instanceof ArrayBuffer + ? new Uint8Array(buffer) + : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); + const byteLength = Math.min(b.byteLength, constants_1.MAX_BUFFER_DUMP_BYTES); + let r = format("\n=== buffer[%d] ===", byteLength); + for (let j = 0; j < byteLength; j += 16) { + r += `\n${pad(j.toString(16), 8)}: `; + let s = ""; + let k; + for (k = 0; k < 16 && j + k < b.byteLength; k++) { + const v = b[j + k]; + r += `${pad(v.toString(16), 2)} `; + // Printable ASCII range. + s += v > 31 && v < 255 ? String.fromCharCode(v) : "·"; + if (k === 7) + r += " "; + } + r += `${repeat((17 - k) * 3, " ")}${s}`; + } + r += "\n"; + if (byteLength !== b.byteLength) { + r += format("=== (truncated %d bytes) ===\n", b.byteLength - byteLength); + } + return r; +} +exports.dumpBuffer = dumpBuffer; +/** + * Encode a JavaScript string (UCS-2) to a UTF-8 encoded string inside a Uint8Array. + * + * Note that the underlying buffer for the array will likely be larger than the actual contents; ignore the extra bytes. + * + * @export + * @param {string} src The input string. + * @returns {Uint8Array} A UTF-8 encoded buffer with the string's contents. + */ +function encodeUtf8(src) { + const l = src.length; + const dst = new Uint8Array(new ArrayBuffer(l * 4)); + let j = 0; + for (let i = 0; i < l; i++) { + const c = src.charCodeAt(i); + if (c <= 0x7f) { + dst[j++] = c; + } + else if (c <= 0x07ff) { + dst[j++] = 0b11000000 | (c >>> 6); + dst[j++] = 0b10000000 | ((c >>> 0) & 0b00111111); + } + else if (c <= 0xd7ff || c >= 0xe000) { + dst[j++] = 0b11100000 | (c >>> 12); + dst[j++] = 0b10000000 | ((c >>> 6) & 0b00111111); + dst[j++] = 0b10000000 | ((c >>> 0) & 0b00111111); + } + else { + // Make sure the surrogate pair is complete. + /* istanbul ignore next */ + if (i + 1 >= l) + throw new RangeError(errors_1.RANGE_INVALID_UTF8); + // I cast thee back into the astral plane. + const hi = c - 0xd800; + const lo = src.charCodeAt(++i) - 0xdc00; + const cp = ((hi << 10) | lo) + 0x00010000; + dst[j++] = 0b11110000 | (cp >>> 18); + dst[j++] = 0b10000000 | ((cp >>> 12) & 0b00111111); + dst[j++] = 0b10000000 | ((cp >>> 6) & 0b00111111); + dst[j++] = 0b10000000 | ((cp >>> 0) & 0b00111111); + } + } + return dst.subarray(0, j); +} +exports.encodeUtf8 = encodeUtf8; +/** + * Produce a `printf`-style string. Nice for providing arguments to `assert` without paying the cost for string + * concatenation up front. Precision is supported for floating point numbers. + * + * @param {string} s The format string. Supported format specifiers: b, c, d, f, j, o, s, x, and X. + * @param {...any} args Values to be formatted in the string. Arguments beyond what are consumed by the format string + * are ignored. + * @returns {string} The formatted string. + */ +function format(s, ...args) { + const n = s.length; + let arg; + let argIndex = 0; + let c; + let escaped = false; + let i = 0; + let leadingZero = false; + let precision; + let result = ""; + function nextArg() { + return args[argIndex++]; + } + function slurpNumber() { + let digits = ""; + while (/\d/.test(s[i])) { + digits += s[i++]; + c = s[i]; + } + return digits.length > 0 ? parseInt(digits, 10) : null; + } + for (; i < n; ++i) { + c = s[i]; + if (escaped) { + escaped = false; + if (c === ".") { + leadingZero = false; + c = s[++i]; + } + else if (c === "0" && s[i + 1] === ".") { + leadingZero = true; + i += 2; + c = s[i]; + } + else { + leadingZero = true; + } + precision = slurpNumber(); + switch (c) { + case "a": // number in hex with padding + result += "0x" + pad(parseInt(String(nextArg()), 10).toString(16), 8); + break; + case "b": // number in binary + result += parseInt(String(nextArg()), 10).toString(2); + break; + case "c": // character + arg = nextArg(); + if (typeof arg === "string" || arg instanceof String) { + result += arg; + } + else { + result += String.fromCharCode(parseInt(String(arg), 10)); + } + break; + case "d": // number in decimal + result += parseInt(String(nextArg()), 10); + break; + case "f": { + // floating point number + const tmp = parseFloat(String(nextArg())).toFixed(precision || 6); + result += leadingZero ? tmp : tmp.replace(/^0/, ""); + break; + } + case "j": // JSON + result += JSON.stringify(nextArg()); + break; + case "o": // number in octal + result += "0" + parseInt(String(nextArg()), 10).toString(8); + break; + case "s": // string + result += nextArg(); + break; + case "x": // lowercase hexadecimal + result += "0x" + parseInt(String(nextArg()), 10).toString(16); + break; + case "X": // uppercase hexadecimal + result += "0x" + parseInt(String(nextArg()), 10).toString(16).toUpperCase(); + break; + default: + result += c; + break; + } + } + else if (c === "%") { + escaped = true; + } + else { + result += c; + } + } + return result; +} +exports.format = format; +/** + * Return the thing that was passed in. Yaaaaawn. + * + * @export + * @template T + * @param {T} x A thing. + * @returns {T} The same thing. + */ +function identity(x) { + return x; +} +exports.identity = identity; +function pad(v, width, pad = "0") { + return v.length >= width ? v : new Array(width - v.length + 1).join(pad) + v; +} +exports.pad = pad; +/** + * Add padding to a number to make it divisible by 8. Typically used to pad byte sizes so they align to a word boundary. + * + * @export + * @param {number} size The number to pad. + * @returns {number} The padded number. + */ +function padToWord(size) { + return (size + 7) & ~7; +} +exports.padToWord = padToWord; +/** + * Repeat a string n times. Shamelessly copied from lodash.repeat. + * + * @param {number} times Number of times to repeat. + * @param {string} str The string to repeat. + * @returns {string} The repeated string. + */ +function repeat(times, str) { + let out = ""; + let n = times; + let s = str; + if (n < 1 || n > Number.MAX_VALUE) + return out; + // https://en.wikipedia.org/wiki/Exponentiation_by_squaring + do { + if (n % 2) + out += s; + n = Math.floor(n / 2); + if (n) + s += s; + } while (n); + return out; +} +exports.repeat = repeat; +const hex = (v) => parseInt(String(v)).toString(16); +// Set up custom debug formatters. +/* istanbul ignore next */ +debug_1.default.formatters["h"] = hex; +/* istanbul ignore next */ +debug_1.default.formatters["x"] = (v) => `0x${hex(v)}`; +/* istanbul ignore next */ +debug_1.default.formatters["a"] = (v) => `0x${pad(hex(v), 8)}`; +/* istanbul ignore next */ +debug_1.default.formatters["X"] = (v) => `0x${hex(v).toUpperCase()}`; +//# sourceMappingURL=util.js.map
\ No newline at end of file diff --git a/node_modules/capnp-ts/src/util.js.map b/node_modules/capnp-ts/src/util.js.map new file mode 100644 index 0000000..de4780e --- /dev/null +++ b/node_modules/capnp-ts/src/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,uDAAuD;AACvD,yCAAyC;AACzC,0DAA8B;AAE9B,2CAA2E;AAC3E,qCAA2F;AAE3F,MAAM,KAAK,GAAG,eAAS,CAAC,YAAY,CAAC,CAAC;AACtC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEd;;;;;;GAMG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/node_modules/capnp-ts/src/util.ts @@ -0,0 +1,413 @@ +/** + * @author jdiaz5513 + */ + +// LINT: a lot of the util functions need the any type. +/* tslint:disable:no-any no-unsafe-any */ +import initTrace from "debug"; + +import { MAX_BUFFER_DUMP_BYTES, MAX_INT32, MAX_UINT32 } from "./constants"; +import { RANGE_INT32_OVERFLOW, RANGE_INVALID_UTF8, RANGE_UINT32_OVERFLOW } from "./errors"; + +const trace = initTrace("capnp:util"); +trace("load"); + +/** + * Dump a hex string from the given buffer. + * + * @export + * @param {ArrayBuffer} buffer The buffer to convert. + * @returns {string} A hexadecimal string representing the buffer. + */ + +export function bufferToHex(buffer: ArrayBuffer): string { + const a = new Uint8Array(buffer); + const h = []; + + for (let i = 0; i < a.byteLength; i++) h.push(pad(a[i].toString(16), 2)); + + return `[${h.join(" ")}]`; +} + +/** + * Throw an error if the provided value cannot be represented as a 32-bit integer. + * + * @export + * @param {number} value The number to check. + * @returns {number} The same number if it is valid. + */ + +export function checkInt32(value: number): number { + if (value > MAX_INT32 || value < -MAX_INT32) { + throw new RangeError(RANGE_INT32_OVERFLOW); + } + + return value; +} + +export function checkUint32(value: number): number { + if (value < 0 || value > MAX_UINT32) { + throw new RangeError(RANGE_UINT32_OVERFLOW); + } + + return value; +} + +/** + * Decode a UTF-8 encoded byte array into a JavaScript string (UCS-2). + * + * @export + * @param {Uint8Array} src A utf-8 encoded byte array. + * @returns {string} A string representation of the byte array. + */ + +export function decodeUtf8(src: Uint8Array): string { + // This ain't for the faint of heart, kids. If you suffer from seizures, heart palpitations, or have had a history of + // stroke you may want to look away now. + + const l = src.byteLength; + let dst = ""; + let i = 0; + let cp = 0; + let a = 0; + let b = 0; + let c = 0; + let d = 0; + + while (i < l) { + a = src[i++]; + + if ((a & 0b10000000) === 0) { + cp = a; + } else if ((a & 0b11100000) === 0b11000000) { + if (i >= l) throw new RangeError(RANGE_INVALID_UTF8); + + b = src[i++]; + + cp = ((a & 0b00011111) << 6) | (b & 0b00111111); + } else if ((a & 0b11110000) === 0b11100000) { + if (i + 1 >= l) throw new RangeError(RANGE_INVALID_UTF8); + + b = src[i++]; + c = src[i++]; + + cp = ((a & 0b00001111) << 12) | ((b & 0b00111111) << 6) | (c & 0b00111111); + } else if ((a & 0b11111000) === 0b11110000) { + if (i + 2 >= l) throw new RangeError(RANGE_INVALID_UTF8); + + b = src[i++]; + c = src[i++]; + d = src[i++]; + + cp = ((a & 0b00000111) << 18) | ((b & 0b00111111) << 12) | ((c & 0b00111111) << 6) | (d & 0b00111111); + } else { + throw new RangeError(RANGE_INVALID_UTF8); + } + + if (cp <= 0xd7ff || (cp >= 0xe000 && cp <= 0xffff)) { + dst += String.fromCharCode(cp); + } else { + // We must reach into the astral plane and construct the surrogate pair! + + cp -= 0x00010000; + + const hi = (cp >>> 10) + 0xd800; + const lo = (cp & 0x03ff) + 0xdc00; + + if (hi < 0xd800 || hi > 0xdbff) throw new RangeError(RANGE_INVALID_UTF8); + + dst += String.fromCharCode(hi, lo); + } + } + + return dst; +} + +export function dumpBuffer(buffer: ArrayBuffer | ArrayBufferView): string { + const b = + buffer instanceof ArrayBuffer + ? new Uint8Array(buffer) + : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); + + const byteLength = Math.min(b.byteLength, MAX_BUFFER_DUMP_BYTES); + + let r = format("\n=== buffer[%d] ===", byteLength); + + for (let j = 0; j < byteLength; j += 16) { + r += `\n${pad(j.toString(16), 8)}: `; + let s = ""; + let k; + + for (k = 0; k < 16 && j + k < b.byteLength; k++) { + const v = b[j + k]; + + r += `${pad(v.toString(16), 2)} `; + + // Printable ASCII range. + + s += v > 31 && v < 255 ? String.fromCharCode(v) : "·"; + + if (k === 7) r += " "; + } + + r += `${repeat((17 - k) * 3, " ")}${s}`; + } + + r += "\n"; + + if (byteLength !== b.byteLength) { + r += format("=== (truncated %d bytes) ===\n", b.byteLength - byteLength); + } + + return r; +} + +/** + * Encode a JavaScript string (UCS-2) to a UTF-8 encoded string inside a Uint8Array. + * + * Note that the underlying buffer for the array will likely be larger than the actual contents; ignore the extra bytes. + * + * @export + * @param {string} src The input string. + * @returns {Uint8Array} A UTF-8 encoded buffer with the string's contents. + */ + +export function encodeUtf8(src: string): Uint8Array { + const l = src.length; + const dst = new Uint8Array(new ArrayBuffer(l * 4)); + let j = 0; + + for (let i = 0; i < l; i++) { + const c = src.charCodeAt(i); + + if (c <= 0x7f) { + dst[j++] = c; + } else if (c <= 0x07ff) { + dst[j++] = 0b11000000 | (c >>> 6); + dst[j++] = 0b10000000 | ((c >>> 0) & 0b00111111); + } else if (c <= 0xd7ff || c >= 0xe000) { + dst[j++] = 0b11100000 | (c >>> 12); + dst[j++] = 0b10000000 | ((c >>> 6) & 0b00111111); + dst[j++] = 0b10000000 | ((c >>> 0) & 0b00111111); + } else { + // Make sure the surrogate pair is complete. + /* istanbul ignore next */ + if (i + 1 >= l) throw new RangeError(RANGE_INVALID_UTF8); + + // I cast thee back into the astral plane. + + const hi = c - 0xd800; + const lo = src.charCodeAt(++i) - 0xdc00; + const cp = ((hi << 10) | lo) + 0x00010000; + + dst[j++] = 0b11110000 | (cp >>> 18); + dst[j++] = 0b10000000 | ((cp >>> 12) & 0b00111111); + dst[j++] = 0b10000000 | ((cp >>> 6) & 0b00111111); + dst[j++] = 0b10000000 | ((cp >>> 0) & 0b00111111); + } + } + + return dst.subarray(0, j); +} + +/** + * Produce a `printf`-style string. Nice for providing arguments to `assert` without paying the cost for string + * concatenation up front. Precision is supported for floating point numbers. + * + * @param {string} s The format string. Supported format specifiers: b, c, d, f, j, o, s, x, and X. + * @param {...any} args Values to be formatted in the string. Arguments beyond what are consumed by the format string + * are ignored. + * @returns {string} The formatted string. + */ + +export function format(s: string, ...args: unknown[]): string { + const n = s.length; + let arg: unknown; + let argIndex = 0; + let c: string; + let escaped = false; + let i = 0; + let leadingZero = false; + let precision: number | null; + let result = ""; + + function nextArg() { + return args[argIndex++]; + } + + function slurpNumber() { + let digits = ""; + + while (/\d/.test(s[i])) { + digits += s[i++]; + c = s[i]; + } + + return digits.length > 0 ? parseInt(digits, 10) : null; + } + + for (; i < n; ++i) { + c = s[i]; + + if (escaped) { + escaped = false; + + if (c === ".") { + leadingZero = false; + + c = s[++i]; + } else if (c === "0" && s[i + 1] === ".") { + leadingZero = true; + + i += 2; + c = s[i]; + } else { + leadingZero = true; + } + + precision = slurpNumber(); + + switch (c) { + case "a": // number in hex with padding + result += "0x" + pad(parseInt(String(nextArg()), 10).toString(16), 8); + + break; + + case "b": // number in binary + result += parseInt(String(nextArg()), 10).toString(2); + + break; + + case "c": // character + arg = nextArg(); + + if (typeof arg === "string" || arg instanceof String) { + result += arg; + } else { + result += String.fromCharCode(parseInt(String(arg), 10)); + } + + break; + + case "d": // number in decimal + result += parseInt(String(nextArg()), 10); + + break; + + case "f": { + // floating point number + const tmp = parseFloat(String(nextArg())).toFixed(precision || 6); + + result += leadingZero ? tmp : tmp.replace(/^0/, ""); + + break; + } + case "j": // JSON + result += JSON.stringify(nextArg()); + + break; + + case "o": // number in octal + result += "0" + parseInt(String(nextArg()), 10).toString(8); + + break; + + case "s": // string + result += nextArg(); + + break; + + case "x": // lowercase hexadecimal + result += "0x" + parseInt(String(nextArg()), 10).toString(16); + + break; + + case "X": // uppercase hexadecimal + result += "0x" + parseInt(String(nextArg()), 10).toString(16).toUpperCase(); + + break; + + default: + result += c; + + break; + } + } else if (c === "%") { + escaped = true; + } else { + result += c; + } + } + + return result; +} + +/** + * Return the thing that was passed in. Yaaaaawn. + * + * @export + * @template T + * @param {T} x A thing. + * @returns {T} The same thing. + */ + +export function identity<T>(x: T): T { + return x; +} + +export function pad(v: string, width: number, pad = "0"): string { + return v.length >= width ? v : new Array(width - v.length + 1).join(pad) + v; +} + +/** + * Add padding to a number to make it divisible by 8. Typically used to pad byte sizes so they align to a word boundary. + * + * @export + * @param {number} size The number to pad. + * @returns {number} The padded number. + */ + +export function padToWord(size: number): number { + return (size + 7) & ~7; +} + +/** + * Repeat a string n times. Shamelessly copied from lodash.repeat. + * + * @param {number} times Number of times to repeat. + * @param {string} str The string to repeat. + * @returns {string} The repeated string. + */ + +export function repeat(times: number, str: string): string { + let out = ""; + let n = times; + let s = str; + + if (n < 1 || n > Number.MAX_VALUE) return out; + + // https://en.wikipedia.org/wiki/Exponentiation_by_squaring + + do { + if (n % 2) out += s; + + n = Math.floor(n / 2); + + if (n) s += s; + } while (n); + + return out; +} + +const hex = (v: unknown) => parseInt(String(v)).toString(16); + +// Set up custom debug formatters. + +/* istanbul ignore next */ +initTrace.formatters["h"] = hex; +/* istanbul ignore next */ +initTrace.formatters["x"] = (v: unknown) => `0x${hex(v)}`; +/* istanbul ignore next */ +initTrace.formatters["a"] = (v: unknown) => `0x${pad(hex(v), 8)}`; +/* istanbul ignore next */ +initTrace.formatters["X"] = (v: unknown) => `0x${hex(v).toUpperCase()}`; diff --git a/node_modules/capnp-ts/tsconfig.json b/node_modules/capnp-ts/tsconfig.json new file mode 100644 index 0000000..3eec3f6 --- /dev/null +++ b/node_modules/capnp-ts/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "noEmit": false + }, + "extends": "../../tsconfig.json", + "include": ["src/**/*", "test/**/*"] +} |
