@adviser/cement 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/{base-sys-abstraction-CKI4xiRR.d.ts → base-sys-abstraction-Cqb4snul.d.ts} +2 -2
  2. package/{base-sys-abstraction-DLnSeH4s.d.cts → base-sys-abstraction-WS7lNbFm.d.cts} +2 -2
  3. package/cf/index.cjs +59 -8
  4. package/cf/index.cjs.map +1 -1
  5. package/cf/index.d.cts +19 -4
  6. package/cf/index.d.ts +19 -4
  7. package/cf/index.js +5 -3
  8. package/cf/index.js.map +1 -1
  9. package/{chunk-QDDO6NOK.js → chunk-BVZ6HD34.js} +66 -7
  10. package/chunk-BVZ6HD34.js.map +1 -0
  11. package/{chunk-LRJXXDF5.js → chunk-H5JLIMWA.js} +45 -4
  12. package/chunk-H5JLIMWA.js.map +1 -0
  13. package/{chunk-OIIUVSUX.js → chunk-K5TIGJ6I.js} +3 -3
  14. package/{chunk-6AG3MRNY.js → chunk-LNS2K5WL.js} +7 -64
  15. package/chunk-LNS2K5WL.js.map +1 -0
  16. package/{chunk-4U6TAOIU.js → chunk-PHS255C5.js} +60 -1
  17. package/chunk-PHS255C5.js.map +1 -0
  18. package/{chunk-4QRZPFED.js → chunk-SCFB6I2C.js} +58 -57
  19. package/{chunk-4QRZPFED.js.map → chunk-SCFB6I2C.js.map} +1 -1
  20. package/deno/index.cjs +57 -8
  21. package/deno/index.cjs.map +1 -1
  22. package/deno/index.d.cts +3 -3
  23. package/deno/index.d.ts +3 -3
  24. package/deno/index.js +2 -2
  25. package/{get-params-result-Bhy5997x.d.cts → get-params-result-CXYbMEcV.d.cts} +13 -7
  26. package/{get-params-result-Bhy5997x.d.ts → get-params-result-CXYbMEcV.d.ts} +13 -7
  27. package/{index-98HXQB3i.d.cts → index-BH1SIYUK.d.cts} +3 -4
  28. package/{index-BMCdndbY.d.cts → index-BQMIP01w.d.ts} +22 -3
  29. package/{index-1R-hTV11.d.ts → index-BeXMFEyF.d.ts} +3 -4
  30. package/{index-IrV5jK1W.d.ts → index-C6hvxtE7.d.cts} +22 -3
  31. package/index.cjs +184 -17
  32. package/index.cjs.map +1 -1
  33. package/index.d.cts +28 -10
  34. package/index.d.ts +28 -10
  35. package/index.js +84 -8
  36. package/index.js.map +1 -1
  37. package/metafile-cjs.json +1 -0
  38. package/metafile-esm.json +1 -0
  39. package/node/index.cjs +139 -90
  40. package/node/index.cjs.map +1 -1
  41. package/node/index.d.cts +3 -3
  42. package/node/index.d.ts +3 -3
  43. package/node/index.js +2 -2
  44. package/package.json +5 -5
  45. package/src/cf/index.ts +1 -0
  46. package/src/http_header.ts +1 -1
  47. package/src/index.ts +5 -1
  48. package/src/json-en-decoder.ts +83 -0
  49. package/src/jsr.json +1 -1
  50. package/src/path-ops.ts +30 -0
  51. package/src/txt-en-decoder.ts +38 -9
  52. package/src/utils/coerce-uint8.ts +53 -0
  53. package/src/utils/index.ts +4 -0
  54. package/src/utils/sorted-object.ts +18 -0
  55. package/src/utils/uint8array-equal.ts +11 -0
  56. package/stripper-BpBUUZ9p.d.cts +4 -0
  57. package/stripper-BpBUUZ9p.d.ts +4 -0
  58. package/{sys-abstraction-BRDT_TIU.d.cts → sys-abstraction-B-0XMe9V.d.cts} +2 -2
  59. package/{sys-abstraction-Bd0EzwO6.d.ts → sys-abstraction-CZa-VyNs.d.ts} +2 -2
  60. package/test/index.cjs +150 -101
  61. package/test/index.cjs.map +1 -1
  62. package/test/index.d.cts +4 -3
  63. package/test/index.d.ts +4 -3
  64. package/test/index.js +5 -5
  65. package/ts/src/cf/index.d.ts +1 -0
  66. package/ts/src/cf/index.d.ts.map +1 -1
  67. package/ts/src/cf/index.js +1 -0
  68. package/ts/src/cf/index.js.map +1 -1
  69. package/ts/src/crypto.test.js +1 -1
  70. package/ts/src/crypto.test.js.map +1 -1
  71. package/ts/src/http_header.d.ts +1 -1
  72. package/ts/src/http_header.d.ts.map +1 -1
  73. package/ts/src/http_header.js.map +1 -1
  74. package/ts/src/index.d.ts +2 -0
  75. package/ts/src/index.d.ts.map +1 -1
  76. package/ts/src/index.js +2 -0
  77. package/ts/src/index.js.map +1 -1
  78. package/ts/src/json-en-decoder.d.ts +12 -0
  79. package/ts/src/json-en-decoder.d.ts.map +1 -0
  80. package/ts/src/json-en-decoder.js +41 -0
  81. package/ts/src/json-en-decoder.js.map +1 -0
  82. package/ts/src/json-en-decoder.test.d.ts +2 -0
  83. package/ts/src/json-en-decoder.test.d.ts.map +1 -0
  84. package/ts/src/json-en-decoder.test.js +18 -0
  85. package/ts/src/json-en-decoder.test.js.map +1 -0
  86. package/ts/src/logger.test.js.map +1 -1
  87. package/ts/src/path-ops.d.ts +7 -0
  88. package/ts/src/path-ops.d.ts.map +1 -0
  89. package/ts/src/path-ops.js +33 -0
  90. package/ts/src/path-ops.js.map +1 -0
  91. package/ts/src/path-ops.test.d.ts +2 -0
  92. package/ts/src/path-ops.test.d.ts.map +1 -0
  93. package/ts/src/path-ops.test.js +23 -0
  94. package/ts/src/path-ops.test.js.map +1 -0
  95. package/ts/src/txt-en-decoder.d.ts +7 -6
  96. package/ts/src/txt-en-decoder.d.ts.map +1 -1
  97. package/ts/src/txt-en-decoder.js +30 -6
  98. package/ts/src/txt-en-decoder.js.map +1 -1
  99. package/ts/src/txt-en-decoder.test.d.ts +2 -0
  100. package/ts/src/txt-en-decoder.test.d.ts.map +1 -0
  101. package/ts/src/txt-en-decoder.test.js +60 -0
  102. package/ts/src/txt-en-decoder.test.js.map +1 -0
  103. package/ts/src/utils/coerce-uint8.d.ts +8 -0
  104. package/ts/src/utils/coerce-uint8.d.ts.map +1 -0
  105. package/ts/src/utils/coerce-uint8.js +34 -0
  106. package/ts/src/utils/coerce-uint8.js.map +1 -0
  107. package/ts/src/utils/index.d.ts +4 -0
  108. package/ts/src/utils/index.d.ts.map +1 -1
  109. package/ts/src/utils/index.js +4 -0
  110. package/ts/src/utils/index.js.map +1 -1
  111. package/ts/src/utils/sorted-objec.test.d.ts +2 -0
  112. package/ts/src/utils/sorted-objec.test.d.ts.map +1 -0
  113. package/ts/src/utils/sorted-objec.test.js +20 -0
  114. package/ts/src/utils/sorted-objec.test.js.map +1 -0
  115. package/ts/src/utils/sorted-object.d.ts +4 -0
  116. package/ts/src/utils/sorted-object.d.ts.map +1 -0
  117. package/ts/src/utils/sorted-object.js +16 -0
  118. package/ts/src/utils/sorted-object.js.map +1 -0
  119. package/ts/src/utils/uint8array-equal.d.ts +2 -0
  120. package/ts/src/utils/uint8array-equal.d.ts.map +1 -0
  121. package/ts/src/utils/uint8array-equal.js +12 -0
  122. package/ts/src/utils/uint8array-equal.js.map +1 -0
  123. package/utils/index.cjs +242 -87
  124. package/utils/index.cjs.map +1 -1
  125. package/utils/index.d.cts +3 -2
  126. package/utils/index.d.ts +3 -2
  127. package/utils/index.js +18 -4
  128. package/web/index.cjs +57 -8
  129. package/web/index.cjs.map +1 -1
  130. package/web/index.d.cts +3 -3
  131. package/web/index.d.ts +3 -3
  132. package/web/index.js +3 -3
  133. package/chunk-4U6TAOIU.js.map +0 -1
  134. package/chunk-6AG3MRNY.js.map +0 -1
  135. package/chunk-LRJXXDF5.js.map +0 -1
  136. package/chunk-QDDO6NOK.js.map +0 -1
  137. /package/{chunk-OIIUVSUX.js.map → chunk-K5TIGJ6I.js.map} +0 -0
package/index.cjs CHANGED
@@ -33,10 +33,11 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
33
33
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
34
34
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
35
35
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
36
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
36
37
 
37
38
  // src/index.ts
38
- var src_exports = {};
39
- __export(src_exports, {
39
+ var index_exports = {};
40
+ __export(index_exports, {
40
41
  BaseSysAbstraction: () => BaseSysAbstraction,
41
42
  BuildURI: () => BuildURI,
42
43
  ConstTime: () => ConstTime,
@@ -47,6 +48,7 @@ __export(src_exports, {
47
48
  IDMode: () => IDMode,
48
49
  IdService: () => IdService,
49
50
  IsLogger: () => IsLogger,
51
+ JSONEnDecoderSingleton: () => JSONEnDecoderSingleton,
50
52
  JSONFormatter: () => JSONFormatter,
51
53
  Keyed: () => Keyed,
52
54
  KeyedResolvOnce: () => KeyedResolvOnce,
@@ -81,7 +83,6 @@ __export(src_exports, {
81
83
  TimeUnits: () => TimeUnits,
82
84
  TraceNode: () => TraceNode,
83
85
  URI: () => URI,
84
- Utf8EnDecoder: () => Utf8EnDecoder,
85
86
  Utf8EnDecoderSingleton: () => Utf8EnDecoderSingleton,
86
87
  VERSION: () => VERSION,
87
88
  WrapperSysAbstraction: () => WrapperSysAbstraction,
@@ -96,12 +97,13 @@ __export(src_exports, {
96
97
  key: () => key,
97
98
  logValue: () => logValue,
98
99
  param: () => param2,
100
+ pathOps: () => pathOps,
99
101
  registerEnvAction: () => registerEnvAction,
100
102
  runtimeFn: () => runtimeFn,
101
103
  toCryptoRuntime: () => toCryptoRuntime,
102
104
  utils: () => utils_exports
103
105
  });
104
- module.exports = __toCommonJS(src_exports);
106
+ module.exports = __toCommonJS(index_exports);
105
107
 
106
108
  // src/logger-impl.ts
107
109
  var import_yaml = __toESM(require("yaml"), 1);
@@ -222,8 +224,8 @@ function logValueInternal(val, ctx) {
222
224
  }
223
225
  if (ArrayBuffer.isView(val)) {
224
226
  try {
225
- const decoder2 = new TextDecoder();
226
- const asStr = decoder2.decode(val);
227
+ const decoder = new TextDecoder();
228
+ const asStr = decoder.decode(val);
227
229
  const obj = JSON.parse(asStr);
228
230
  return logValueInternal(obj, ctx);
229
231
  } catch (e) {
@@ -463,14 +465,14 @@ var BaseSysAbstraction = class {
463
465
  this._fileSystem = params.FileSystem;
464
466
  this._systemService = params.SystemService;
465
467
  this._txtEnDe = params.TxtEnDecoder;
466
- const decoder2 = this._txtEnDe;
468
+ const decoder = this._txtEnDe;
467
469
  this._stdout = CFWriteableStream((chunk) => {
468
- const decoded = decoder2.decode(chunk);
470
+ const decoded = decoder.decode(chunk);
469
471
  console.log(decoded.trimEnd());
470
472
  return Promise.resolve();
471
473
  });
472
474
  this._stderr = CFWriteableStream((chunk) => {
473
- const decoded = decoder2.decode(chunk);
475
+ const decoded = decoder.decode(chunk);
474
476
  console.error(decoded.trimEnd());
475
477
  return Promise.resolve();
476
478
  });
@@ -1207,19 +1209,75 @@ var EnvImpl = class {
1207
1209
  }
1208
1210
  };
1209
1211
 
1212
+ // src/utils/coerce-uint8.ts
1213
+ var globalBuffer = globalThis;
1214
+ function coerceIntoUint8(raw) {
1215
+ if (raw instanceof ArrayBuffer) {
1216
+ return Result.Ok(new Uint8Array(raw));
1217
+ }
1218
+ if (ArrayBuffer.isView(raw)) {
1219
+ return Result.Ok(new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength));
1220
+ }
1221
+ if (raw instanceof Blob) {
1222
+ return Result.Err("Blob not supported");
1223
+ }
1224
+ if (globalBuffer.Buffer && globalBuffer.Buffer.isBuffer(raw)) {
1225
+ return Result.Ok(new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength));
1226
+ }
1227
+ if (raw instanceof Uint8Array) {
1228
+ return Result.Ok(raw);
1229
+ }
1230
+ if (Result.Is(raw)) {
1231
+ if (raw.isErr()) {
1232
+ return Result.Err(raw);
1233
+ }
1234
+ return coerceIntoUint8(raw.unwrap());
1235
+ }
1236
+ return Result.Err("Not a Uint8Array");
1237
+ }
1238
+ async function asyncCoerceIntoUint8(raw) {
1239
+ let resolved = await raw;
1240
+ if (resolved instanceof Blob) {
1241
+ resolved = await resolved.arrayBuffer();
1242
+ }
1243
+ return coerceIntoUint8(resolved);
1244
+ }
1245
+
1210
1246
  // src/txt-en-decoder.ts
1211
- var encoder = new TextEncoder();
1212
- var decoder = new TextDecoder();
1213
1247
  var Utf8EnDecoder = class {
1248
+ constructor() {
1249
+ this.encoder = new TextEncoder();
1250
+ this.decoder = new TextDecoder();
1251
+ }
1214
1252
  encode(str) {
1215
- return encoder.encode(str);
1253
+ return this.encoder.encode(str);
1216
1254
  }
1217
1255
  decode(data) {
1218
- return decoder.decode(data);
1256
+ if (Result.Is(data)) {
1257
+ if (data.isErr()) {
1258
+ throw data.Err();
1259
+ }
1260
+ const unwrapped = data.unwrap();
1261
+ if (typeof unwrapped === "string") {
1262
+ return this.decode(unwrapped);
1263
+ }
1264
+ }
1265
+ if (typeof data === "string") {
1266
+ return data;
1267
+ }
1268
+ return this.decoder.decode(coerceIntoUint8(data).Ok());
1269
+ }
1270
+ async asyncDecode(data) {
1271
+ let resolved = await data;
1272
+ if (resolved instanceof Blob) {
1273
+ resolved = await resolved.arrayBuffer();
1274
+ }
1275
+ return this.decode(resolved);
1219
1276
  }
1220
1277
  };
1221
- var utf8EnDecoder = new Utf8EnDecoder();
1278
+ var utf8EnDecoder;
1222
1279
  function Utf8EnDecoderSingleton() {
1280
+ utf8EnDecoder = utf8EnDecoder != null ? utf8EnDecoder : new Utf8EnDecoder();
1223
1281
  return utf8EnDecoder;
1224
1282
  }
1225
1283
 
@@ -3089,13 +3147,90 @@ var HttpHeader = class _HttpHeader {
3089
3147
  }
3090
3148
  };
3091
3149
 
3150
+ // src/path-ops.ts
3151
+ var _pathOpsImpl_instances, parts_fn;
3152
+ var pathOpsImpl = class {
3153
+ constructor() {
3154
+ __privateAdd(this, _pathOpsImpl_instances);
3155
+ }
3156
+ join(...paths) {
3157
+ return paths.map((i) => i.replace(/\/+$/, "")).join("/");
3158
+ }
3159
+ dirname(path) {
3160
+ return __privateMethod(this, _pathOpsImpl_instances, parts_fn).call(this, path).dirname;
3161
+ }
3162
+ basename(path) {
3163
+ return __privateMethod(this, _pathOpsImpl_instances, parts_fn).call(this, path).basename;
3164
+ }
3165
+ };
3166
+ _pathOpsImpl_instances = new WeakSet();
3167
+ parts_fn = function(path) {
3168
+ const splitted = path.split("/");
3169
+ const last = splitted.pop();
3170
+ if (splitted.length && last === "") {
3171
+ return __privateMethod(this, _pathOpsImpl_instances, parts_fn).call(this, this.join(...splitted));
3172
+ }
3173
+ return {
3174
+ dirname: this.join(...splitted),
3175
+ basename: last != null ? last : ""
3176
+ };
3177
+ };
3178
+ var pathOps = new pathOpsImpl();
3179
+
3180
+ // src/json-en-decoder.ts
3181
+ var JSONOps = class {
3182
+ constructor(txtOps) {
3183
+ this.txtOps = txtOps;
3184
+ }
3185
+ async asyncStringify(input, replacer, space) {
3186
+ const resolved = await input;
3187
+ return this.stringify(resolved, replacer, space);
3188
+ }
3189
+ async asyncUint8ify(input, replacer, space) {
3190
+ const resolved = await input;
3191
+ return this.uint8ify(resolved, replacer, space);
3192
+ }
3193
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3194
+ async asyncParse(input, reviver) {
3195
+ return this.parse(await this.txtOps.asyncDecode(input), reviver);
3196
+ }
3197
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3198
+ stringify(input, replacer, space) {
3199
+ return JSON.stringify(Result.Is(input) ? input.unwrap() : input, replacer, space);
3200
+ }
3201
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3202
+ uint8ify(input, replacer, space) {
3203
+ return this.txtOps.encode(this.stringify(input, replacer, space));
3204
+ }
3205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3206
+ parse(input, reviver) {
3207
+ return exception2Result(() => JSON.parse(this.txtOps.decode(input), reviver));
3208
+ }
3209
+ };
3210
+ var jsonEnCoder;
3211
+ function JSONEnDecoderSingleton(txtEnde) {
3212
+ let needNew = false;
3213
+ if (txtEnde && txtEnde !== Utf8EnDecoderSingleton()) {
3214
+ needNew = !!txtEnde;
3215
+ txtEnde = txtEnde != null ? txtEnde : Utf8EnDecoderSingleton();
3216
+ }
3217
+ if (needNew && txtEnde) {
3218
+ return new JSONOps(txtEnde);
3219
+ }
3220
+ jsonEnCoder = jsonEnCoder != null ? jsonEnCoder : new JSONOps(Utf8EnDecoderSingleton());
3221
+ return jsonEnCoder;
3222
+ }
3223
+
3092
3224
  // src/utils/index.ts
3093
3225
  var utils_exports = {};
3094
3226
  __export(utils_exports, {
3095
3227
  ConsoleWriterStream: () => ConsoleWriterStream,
3096
3228
  ConsoleWriterStreamDefaultWriter: () => ConsoleWriterStreamDefaultWriter,
3097
3229
  FanoutWriteStream: () => FanoutWriteStream,
3230
+ UInt8ArrayEqual: () => UInt8ArrayEqual,
3098
3231
  array2stream: () => array2stream,
3232
+ asyncCoerceIntoUint8: () => asyncCoerceIntoUint8,
3233
+ coerceIntoUint8: () => coerceIntoUint8,
3099
3234
  devnull: () => devnull,
3100
3235
  getParamsResult: () => getParamsResult,
3101
3236
  param: () => param,
@@ -3106,6 +3241,10 @@ __export(utils_exports, {
3106
3241
  stream2uint8array: () => stream2uint8array,
3107
3242
  streamMap: () => streamMap,
3108
3243
  string2stream: () => string2stream,
3244
+ stripper: () => stripper,
3245
+ toSortedArray: () => toSortedArray,
3246
+ toSortedObject: () => toSortedObject,
3247
+ toSortedObjectArray: () => toSortedObjectArray,
3109
3248
  uint8array2stream: () => uint8array2stream
3110
3249
  });
3111
3250
 
@@ -3240,7 +3379,7 @@ async function stream2string(stream, maxSize) {
3240
3379
  }
3241
3380
  const reader = stream.getReader();
3242
3381
  let res = "";
3243
- const decoder2 = new TextDecoder();
3382
+ const decoder = new TextDecoder();
3244
3383
  let rSize = 0;
3245
3384
  while (typeof maxSize === "undefined" || rSize < maxSize) {
3246
3385
  try {
@@ -3251,7 +3390,7 @@ async function stream2string(stream, maxSize) {
3251
3390
  if (maxSize && rSize + read.value.length > maxSize) {
3252
3391
  read.value = read.value.slice(0, maxSize - rSize);
3253
3392
  }
3254
- const block = decoder2.decode(read.value, { stream: true });
3393
+ const block = decoder.decode(read.value, { stream: true });
3255
3394
  rSize += read.value.length;
3256
3395
  res += block;
3257
3396
  } catch (err) {
@@ -3293,6 +3432,33 @@ function uint8array2stream(str) {
3293
3432
  });
3294
3433
  }
3295
3434
 
3435
+ // src/utils/sorted-object.ts
3436
+ function toSortedObjectArray(set) {
3437
+ if (!set) return [];
3438
+ return toSortedArray(set).map(([k, v]) => ({ [k]: v }));
3439
+ }
3440
+ function toSortedArray(set) {
3441
+ if (!set) return [];
3442
+ return Object.entries(set).sort(([a], [b]) => a.localeCompare(b));
3443
+ }
3444
+ function toSortedObject(set) {
3445
+ if (!set) return set;
3446
+ return Object.fromEntries(toSortedArray(set));
3447
+ }
3448
+
3449
+ // src/utils/uint8array-equal.ts
3450
+ function UInt8ArrayEqual(a, b) {
3451
+ if (a.length !== b.length) {
3452
+ return false;
3453
+ }
3454
+ for (let i = 0; i < a.length; i++) {
3455
+ if (a[i] !== b[i]) {
3456
+ return false;
3457
+ }
3458
+ }
3459
+ return true;
3460
+ }
3461
+
3296
3462
  // src/index.ts
3297
3463
  var param2 = param;
3298
3464
  // Annotate the CommonJS export names for ESM import in node:
@@ -3307,6 +3473,7 @@ var param2 = param;
3307
3473
  IDMode,
3308
3474
  IdService,
3309
3475
  IsLogger,
3476
+ JSONEnDecoderSingleton,
3310
3477
  JSONFormatter,
3311
3478
  Keyed,
3312
3479
  KeyedResolvOnce,
@@ -3341,7 +3508,6 @@ var param2 = param;
3341
3508
  TimeUnits,
3342
3509
  TraceNode,
3343
3510
  URI,
3344
- Utf8EnDecoder,
3345
3511
  Utf8EnDecoderSingleton,
3346
3512
  VERSION,
3347
3513
  WrapperSysAbstraction,
@@ -3356,6 +3522,7 @@ var param2 = param;
3356
3522
  key,
3357
3523
  logValue,
3358
3524
  param,
3525
+ pathOps,
3359
3526
  registerEnvAction,
3360
3527
  runtimeFn,
3361
3528
  toCryptoRuntime,