@stryke/capnp 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,7 @@ var RPC_CALL_QUEUE_FULL = "CAPNP-TS101 Promised answer call queue full.";
66
66
  var RPC_QUEUE_CALL_CANCEL = "CAPNP-TS102 Queue call canceled.";
67
67
  var RPC_ZERO_REF = "CAPNP-TS105 Ref() called on zeroed refcount.";
68
68
  var RPC_IMPORT_CLOSED = "CAPNP-TS106 Call on closed import.";
69
+ var RPC_METHOD_NOT_IMPLEMENTED = "CAPNP-TS107 Method not implemented.";
69
70
  var RPC_BAD_TARGET = "CAPNP-TS109 Target not found.";
70
71
  var RPC_RETURN_FOR_UNKNOWN_QUESTION = "CAPNP-TS111 Received return for unknown question (id=%s).";
71
72
  var RPC_QUESTION_ID_REUSED = "CAPNP-TS112 Attempted to re-use question id (%s).";
@@ -702,6 +703,24 @@ function isNull(p) {
702
703
  return p.segment.isWordZero(p.byteOffset);
703
704
  }
704
705
  __name(isNull, "isNull");
706
+ function relocateTo(dst, src) {
707
+ const t = followFars(src);
708
+ const lo = t.segment.getUint8(t.byteOffset) & 3;
709
+ const hi = t.segment.getUint32(t.byteOffset + 4);
710
+ erase(dst);
711
+ const res = initPointer(
712
+ t.segment,
713
+ t.byteOffset + 8 + getOffsetWords(t) * 8,
714
+ dst
715
+ );
716
+ res.pointer.segment.setUint32(
717
+ res.pointer.byteOffset,
718
+ lo | res.offsetWords << 2
719
+ );
720
+ res.pointer.segment.setUint32(res.pointer.byteOffset + 4, hi);
721
+ erasePointer(src);
722
+ }
723
+ __name(relocateTo, "relocateTo");
705
724
  function setFarPointer(doubleFar, offsetWords, segmentId, p) {
706
725
  const A = PointerType.FAR;
707
726
  const B = doubleFar ? 1 : 0;
@@ -1550,6 +1569,10 @@ function checkPointerBounds(index, s) {
1550
1569
  }
1551
1570
  }
1552
1571
  __name(checkPointerBounds, "checkPointerBounds");
1572
+ function getInterfaceClientOrNullAt(index, s) {
1573
+ return getInterfaceClientOrNull(getPointer(index, s));
1574
+ }
1575
+ __name(getInterfaceClientOrNullAt, "getInterfaceClientOrNullAt");
1553
1576
  function getInterfaceClientOrNull(p) {
1554
1577
  let client = null;
1555
1578
  const capId = getInterfacePointer(p);
@@ -2065,6 +2088,86 @@ function checkDataBounds(byteOffset, byteLength, s) {
2065
2088
  }
2066
2089
  __name(checkDataBounds, "checkDataBounds");
2067
2090
 
2091
+ // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=53996ae63a1465953815fff49405f2224c85d26eeeff469d2b1f87e1c2af451d_typescript@5.8.3/node_modules/capnp-es/dist/shared/capnp-es.BvfUH5E6.mjs
2092
+ function CompositeList(CompositeClass) {
2093
+ return class extends List {
2094
+ static _capnp = {
2095
+ compositeSize: CompositeClass._capnp.size,
2096
+ displayName: `List<${CompositeClass._capnp.displayName}>`,
2097
+ size: ListElementSize.COMPOSITE
2098
+ };
2099
+ get(index) {
2100
+ return new CompositeClass(
2101
+ this.segment,
2102
+ this.byteOffset,
2103
+ this._capnp.depthLimit - 1,
2104
+ index
2105
+ );
2106
+ }
2107
+ set(index, value) {
2108
+ copyFrom(value, this.get(index));
2109
+ }
2110
+ [Symbol.toStringTag]() {
2111
+ return `Composite_${super.toString()},cls:${CompositeClass.toString()}`;
2112
+ }
2113
+ };
2114
+ }
2115
+ __name(CompositeList, "CompositeList");
2116
+ function _makePrimitiveMaskFn(byteLength, setter) {
2117
+ return (x) => {
2118
+ const dv = new DataView(new ArrayBuffer(byteLength));
2119
+ setter.call(dv, 0, x, true);
2120
+ return dv;
2121
+ };
2122
+ }
2123
+ __name(_makePrimitiveMaskFn, "_makePrimitiveMaskFn");
2124
+ var getFloat32Mask = _makePrimitiveMaskFn(
2125
+ 4,
2126
+ DataView.prototype.setFloat32
2127
+ );
2128
+ var getFloat64Mask = _makePrimitiveMaskFn(
2129
+ 8,
2130
+ DataView.prototype.setFloat64
2131
+ );
2132
+ var getInt16Mask = _makePrimitiveMaskFn(
2133
+ 2,
2134
+ DataView.prototype.setInt16
2135
+ );
2136
+ var getInt32Mask = _makePrimitiveMaskFn(
2137
+ 4,
2138
+ DataView.prototype.setInt32
2139
+ );
2140
+ var getInt64Mask = _makePrimitiveMaskFn(
2141
+ 8,
2142
+ DataView.prototype.setBigInt64
2143
+ );
2144
+ var getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8);
2145
+ var getUint16Mask = _makePrimitiveMaskFn(
2146
+ 2,
2147
+ DataView.prototype.setUint16
2148
+ );
2149
+ var getUint32Mask = _makePrimitiveMaskFn(
2150
+ 4,
2151
+ DataView.prototype.setUint32
2152
+ );
2153
+ var getUint64Mask = _makePrimitiveMaskFn(
2154
+ 8,
2155
+ DataView.prototype.setBigUint64
2156
+ );
2157
+ var getUint8Mask = _makePrimitiveMaskFn(
2158
+ 1,
2159
+ DataView.prototype.setUint8
2160
+ );
2161
+ function getBitMask(value, bitOffset) {
2162
+ const dv = new DataView(new ArrayBuffer(1));
2163
+ if (!value) {
2164
+ return dv;
2165
+ }
2166
+ dv.setUint8(0, 1 << bitOffset % 8);
2167
+ return dv;
2168
+ }
2169
+ __name(getBitMask, "getBitMask");
2170
+
2068
2171
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=53996ae63a1465953815fff49405f2224c85d26eeeff469d2b1f87e1c2af451d_typescript@5.8.3/node_modules/capnp-es/dist/shared/capnp-es.GpvEvMIK.mjs
2069
2172
  var ArenaKind = /* @__PURE__ */ ((ArenaKind2) => {
2070
2173
  ArenaKind2[ArenaKind2["SINGLE_SEGMENT"] = 0] = "SINGLE_SEGMENT";
@@ -3062,86 +3165,6 @@ function copy(m) {
3062
3165
  }
3063
3166
  __name(copy, "copy");
3064
3167
 
3065
- // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=53996ae63a1465953815fff49405f2224c85d26eeeff469d2b1f87e1c2af451d_typescript@5.8.3/node_modules/capnp-es/dist/shared/capnp-es.BvfUH5E6.mjs
3066
- function CompositeList(CompositeClass) {
3067
- return class extends List {
3068
- static _capnp = {
3069
- compositeSize: CompositeClass._capnp.size,
3070
- displayName: `List<${CompositeClass._capnp.displayName}>`,
3071
- size: ListElementSize.COMPOSITE
3072
- };
3073
- get(index) {
3074
- return new CompositeClass(
3075
- this.segment,
3076
- this.byteOffset,
3077
- this._capnp.depthLimit - 1,
3078
- index
3079
- );
3080
- }
3081
- set(index, value) {
3082
- copyFrom(value, this.get(index));
3083
- }
3084
- [Symbol.toStringTag]() {
3085
- return `Composite_${super.toString()},cls:${CompositeClass.toString()}`;
3086
- }
3087
- };
3088
- }
3089
- __name(CompositeList, "CompositeList");
3090
- function _makePrimitiveMaskFn(byteLength, setter) {
3091
- return (x) => {
3092
- const dv = new DataView(new ArrayBuffer(byteLength));
3093
- setter.call(dv, 0, x, true);
3094
- return dv;
3095
- };
3096
- }
3097
- __name(_makePrimitiveMaskFn, "_makePrimitiveMaskFn");
3098
- var getFloat32Mask = _makePrimitiveMaskFn(
3099
- 4,
3100
- DataView.prototype.setFloat32
3101
- );
3102
- var getFloat64Mask = _makePrimitiveMaskFn(
3103
- 8,
3104
- DataView.prototype.setFloat64
3105
- );
3106
- var getInt16Mask = _makePrimitiveMaskFn(
3107
- 2,
3108
- DataView.prototype.setInt16
3109
- );
3110
- var getInt32Mask = _makePrimitiveMaskFn(
3111
- 4,
3112
- DataView.prototype.setInt32
3113
- );
3114
- var getInt64Mask = _makePrimitiveMaskFn(
3115
- 8,
3116
- DataView.prototype.setBigInt64
3117
- );
3118
- var getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8);
3119
- var getUint16Mask = _makePrimitiveMaskFn(
3120
- 2,
3121
- DataView.prototype.setUint16
3122
- );
3123
- var getUint32Mask = _makePrimitiveMaskFn(
3124
- 4,
3125
- DataView.prototype.setUint32
3126
- );
3127
- var getUint64Mask = _makePrimitiveMaskFn(
3128
- 8,
3129
- DataView.prototype.setBigUint64
3130
- );
3131
- var getUint8Mask = _makePrimitiveMaskFn(
3132
- 1,
3133
- DataView.prototype.setUint8
3134
- );
3135
- function getBitMask(value, bitOffset) {
3136
- const dv = new DataView(new ArrayBuffer(1));
3137
- if (!value) {
3138
- return dv;
3139
- }
3140
- dv.setUint8(0, 1 << bitOffset % 8);
3141
- return dv;
3142
- }
3143
- __name(getBitMask, "getBitMask");
3144
-
3145
3168
  export {
3146
3169
  __name,
3147
3170
  ListElementSize,
@@ -3153,6 +3176,7 @@ export {
3153
3176
  RPC_QUEUE_CALL_CANCEL,
3154
3177
  RPC_ZERO_REF,
3155
3178
  RPC_IMPORT_CLOSED,
3179
+ RPC_METHOD_NOT_IMPLEMENTED,
3156
3180
  RPC_BAD_TARGET,
3157
3181
  RPC_RETURN_FOR_UNKNOWN_QUESTION,
3158
3182
  RPC_QUESTION_ID_REUSED,
@@ -3167,12 +3191,49 @@ export {
3167
3191
  format,
3168
3192
  pad,
3169
3193
  ObjectSize,
3194
+ Orphan,
3170
3195
  adopt,
3171
3196
  disown,
3197
+ dump,
3198
+ getListByteLength,
3199
+ getListElementByteLength,
3200
+ add,
3172
3201
  copyFrom,
3202
+ erase,
3203
+ erasePointer,
3204
+ followFar,
3205
+ followFars,
3206
+ getCapabilityId,
3173
3207
  getContent,
3208
+ getFarSegmentId,
3209
+ getListElementSize,
3210
+ getListLength,
3211
+ getOffsetWords,
3212
+ getPointerType,
3213
+ getStructDataWords,
3214
+ getStructPointerLength,
3215
+ getStructSize,
3216
+ getTargetCompositeListTag,
3217
+ getTargetCompositeListSize,
3218
+ getTargetListElementSize,
3219
+ getTargetListLength,
3174
3220
  getTargetPointerType,
3221
+ getTargetStructSize,
3222
+ initPointer,
3223
+ isDoubleFar,
3175
3224
  isNull,
3225
+ relocateTo,
3226
+ setFarPointer,
3227
+ setInterfacePointer,
3228
+ getInterfacePointer,
3229
+ setListPointer,
3230
+ setStructPointer,
3231
+ validate,
3232
+ copyFromInterface,
3233
+ copyFromList,
3234
+ copyFromStruct,
3235
+ trackPointerAllocation,
3236
+ PointerAllocationResult,
3176
3237
  PointerType,
3177
3238
  Pointer,
3178
3239
  List,
@@ -3183,12 +3244,17 @@ export {
3183
3244
  FixedAnswer,
3184
3245
  ErrorAnswer,
3185
3246
  ErrorClient,
3247
+ clientOrNull,
3186
3248
  initStruct,
3187
3249
  initStructAt,
3250
+ checkPointerBounds,
3251
+ getInterfaceClientOrNullAt,
3188
3252
  getInterfaceClientOrNull,
3253
+ resize,
3189
3254
  getAs,
3190
3255
  getBit,
3191
3256
  getData,
3257
+ getDataSection,
3192
3258
  getFloat32,
3193
3259
  getFloat64,
3194
3260
  getInt16,
@@ -3197,6 +3263,9 @@ export {
3197
3263
  getInt8,
3198
3264
  getList,
3199
3265
  getPointer,
3266
+ getPointerAs,
3267
+ getPointerSection,
3268
+ getSize,
3200
3269
  getStruct,
3201
3270
  getText,
3202
3271
  getUint16,
@@ -3218,9 +3287,19 @@ export {
3218
3287
  setUint64,
3219
3288
  setUint8,
3220
3289
  testWhich,
3290
+ checkDataBounds,
3221
3291
  CompositeList,
3292
+ getFloat32Mask,
3293
+ getFloat64Mask,
3294
+ getInt16Mask,
3295
+ getInt32Mask,
3296
+ getInt64Mask,
3297
+ getInt8Mask,
3222
3298
  getUint16Mask,
3299
+ getUint32Mask,
3300
+ getUint64Mask,
3223
3301
  getUint8Mask,
3224
3302
  getBitMask,
3225
- Message
3303
+ Message,
3304
+ readRawPointer
3226
3305
  };
@@ -44,7 +44,7 @@ import {
44
44
  setUint64,
45
45
  setUint8,
46
46
  testWhich
47
- } from "./chunk-U3UL3P5H.js";
47
+ } from "./chunk-I2A4KWAA.js";
48
48
 
49
49
  // ../path/src/exists.ts
50
50
  import { existsSync as existsSyncFs } from "node:fs";