@adviser/cement 0.4.0 → 0.4.1

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.
package/index.cjs CHANGED
@@ -106,6 +106,10 @@ __export(index_exports, {
106
106
  registerEnvAction: () => registerEnvAction,
107
107
  runtimeFn: () => runtimeFn,
108
108
  toCryptoRuntime: () => toCryptoRuntime,
109
+ to_arraybuf: () => to_arraybuf,
110
+ to_blob: () => to_blob,
111
+ to_uint8: () => to_uint8,
112
+ top_uint8: () => top_uint8,
109
113
  utils: () => utils_exports
110
114
  });
111
115
  module.exports = __toCommonJS(index_exports);
@@ -1118,53 +1122,6 @@ var URI = class _URI {
1118
1122
  }
1119
1123
  };
1120
1124
 
1121
- // src/log-writer-impl.ts
1122
- var LogWriterStream = class {
1123
- constructor(out) {
1124
- this._toFlush = [];
1125
- this._flushIsRunning = false;
1126
- this._flushDoneFns = [];
1127
- this._out = out;
1128
- this._id = Math.random();
1129
- }
1130
- write(encoded) {
1131
- const my = async () => {
1132
- try {
1133
- const writer = this._out.getWriter();
1134
- await writer.ready;
1135
- await writer.write(encoded);
1136
- writer.releaseLock();
1137
- } catch (err) {
1138
- console.error("Chunk error:", err);
1139
- }
1140
- };
1141
- this._toFlush.push(my);
1142
- this._flush();
1143
- }
1144
- _flush(toFlush = void 0, done) {
1145
- if (done) {
1146
- this._flushDoneFns.push(done);
1147
- }
1148
- if (this._toFlush.length == 0) {
1149
- this._flushIsRunning = false;
1150
- this._flushDoneFns.forEach((fn) => fn());
1151
- this._flushDoneFns = [];
1152
- return;
1153
- }
1154
- if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
1155
- this._flushIsRunning = true;
1156
- } else if (!toFlush) {
1157
- return;
1158
- }
1159
- const my = this._toFlush.shift();
1160
- my == null ? void 0 : my().catch((e) => {
1161
- console.error("Flush error:", e);
1162
- }).finally(() => {
1163
- this._flush(this._toFlush);
1164
- });
1165
- }
1166
- };
1167
-
1168
1125
  // src/future.ts
1169
1126
  var _promise, _resolveFn, _rejectFn;
1170
1127
  var Future = class {
@@ -2541,6 +2498,53 @@ var WrapperRuntimeSysAbstraction = class extends WrapperBasicSysAbstraction {
2541
2498
  }
2542
2499
  };
2543
2500
 
2501
+ // src/log-writer-impl.ts
2502
+ var LogWriterStream = class {
2503
+ constructor(out) {
2504
+ this._toFlush = [];
2505
+ this._flushIsRunning = false;
2506
+ this._flushDoneFns = [];
2507
+ this._out = out;
2508
+ this._id = Math.random();
2509
+ }
2510
+ write(encoded) {
2511
+ const my = async () => {
2512
+ try {
2513
+ const writer = this._out.getWriter();
2514
+ await writer.ready;
2515
+ await writer.write(encoded);
2516
+ writer.releaseLock();
2517
+ } catch (err) {
2518
+ console.error("Chunk error:", err);
2519
+ }
2520
+ };
2521
+ this._toFlush.push(my);
2522
+ this._flush();
2523
+ }
2524
+ _flush(toFlush = void 0, done) {
2525
+ if (done) {
2526
+ this._flushDoneFns.push(done);
2527
+ }
2528
+ if (this._toFlush.length == 0) {
2529
+ this._flushIsRunning = false;
2530
+ this._flushDoneFns.forEach((fn) => fn());
2531
+ this._flushDoneFns = [];
2532
+ return;
2533
+ }
2534
+ if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
2535
+ this._flushIsRunning = true;
2536
+ } else if (!toFlush) {
2537
+ return;
2538
+ }
2539
+ const my = this._toFlush.shift();
2540
+ my == null ? void 0 : my().catch((e) => {
2541
+ console.error("Flush error:", e);
2542
+ }).finally(() => {
2543
+ this._flush(this._toFlush);
2544
+ });
2545
+ }
2546
+ };
2547
+
2544
2548
  // src/logger-impl.ts
2545
2549
  function getLen(value, lvs) {
2546
2550
  if (Array.isArray(value)) {
@@ -3560,6 +3564,39 @@ function JSONEnDecoderSingleton(txtEnde) {
3560
3564
  return jsonEnDecoder;
3561
3565
  }
3562
3566
 
3567
+ // src/coerce-binary.ts
3568
+ async function top_uint8(input) {
3569
+ if (input instanceof Blob) {
3570
+ return new Uint8Array(await input.arrayBuffer());
3571
+ }
3572
+ return to_uint8(input);
3573
+ }
3574
+ function to_uint8(input, encoder) {
3575
+ if (typeof input === "string") {
3576
+ return (encoder != null ? encoder : new TextEncoder()).encode(input);
3577
+ }
3578
+ if (input instanceof ArrayBuffer) {
3579
+ return new Uint8Array(input);
3580
+ }
3581
+ if (input instanceof Uint8Array) {
3582
+ return input;
3583
+ }
3584
+ return new Uint8Array(input);
3585
+ }
3586
+ function to_blob(input, encoder) {
3587
+ if (input instanceof Blob) {
3588
+ return input;
3589
+ }
3590
+ return new Blob([to_uint8(input, encoder)]);
3591
+ }
3592
+ function to_arraybuf(input, encoder) {
3593
+ if (input instanceof ArrayBuffer) {
3594
+ return input;
3595
+ }
3596
+ const u8 = to_uint8(input, encoder);
3597
+ return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
3598
+ }
3599
+
3563
3600
  // src/utils/index.ts
3564
3601
  var utils_exports = {};
3565
3602
  __export(utils_exports, {
@@ -3866,6 +3903,10 @@ function UInt8ArrayEqual(a, b) {
3866
3903
  registerEnvAction,
3867
3904
  runtimeFn,
3868
3905
  toCryptoRuntime,
3906
+ to_arraybuf,
3907
+ to_blob,
3908
+ to_uint8,
3909
+ top_uint8,
3869
3910
  utils
3870
3911
  });
3871
3912
  //# sourceMappingURL=index.cjs.map