@adviser/cement 0.3.7 → 0.3.9

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 (117) hide show
  1. package/{base-sys-abstraction-WS7lNbFm.d.cts → base-sys-abstraction-4Vw4QGaI.d.cts} +2 -2
  2. package/{base-sys-abstraction-Cqb4snul.d.ts → base-sys-abstraction-8v83VyEU.d.ts} +2 -2
  3. package/cf/index.cjs +16 -7
  4. package/cf/index.cjs.map +1 -1
  5. package/cf/index.d.cts +3 -3
  6. package/cf/index.d.ts +3 -3
  7. package/cf/index.js +5 -5
  8. package/cf/index.js.map +1 -1
  9. package/{chunk-BVZ6HD34.js → chunk-A57BAYWU.js} +7 -7
  10. package/{chunk-BVZ6HD34.js.map → chunk-A57BAYWU.js.map} +1 -1
  11. package/{chunk-SCFB6I2C.js → chunk-EQMNXZ4G.js} +12 -3
  12. package/chunk-EQMNXZ4G.js.map +1 -0
  13. package/{chunk-K5TIGJ6I.js → chunk-OMB3WMYS.js} +5 -5
  14. package/chunk-OMB3WMYS.js.map +1 -0
  15. package/{chunk-LNS2K5WL.js → chunk-PNTCDKAB.js} +7 -7
  16. package/chunk-PNTCDKAB.js.map +1 -0
  17. package/{chunk-H5JLIMWA.js → chunk-W53WEZWY.js} +4 -4
  18. package/{chunk-H5JLIMWA.js.map → chunk-W53WEZWY.js.map} +1 -1
  19. package/deno/index.cjs +18 -9
  20. package/deno/index.cjs.map +1 -1
  21. package/deno/index.d.cts +3 -3
  22. package/deno/index.d.ts +3 -3
  23. package/deno/index.js +6 -6
  24. package/deno/index.js.map +1 -1
  25. package/{get-params-result-CXYbMEcV.d.ts → get-params-result-C2cbgB78.d.cts} +2 -2
  26. package/{get-params-result-CXYbMEcV.d.cts → get-params-result-C2cbgB78.d.ts} +2 -2
  27. package/{index-BeXMFEyF.d.ts → index-CbOCsgzP.d.ts} +2 -2
  28. package/{index-C6hvxtE7.d.cts → index-Dpc3oVOD.d.cts} +1 -1
  29. package/{index-BH1SIYUK.d.cts → index-EnKo_jNv.d.cts} +2 -2
  30. package/{index-BQMIP01w.d.ts → index-MWn9Xel9.d.ts} +1 -1
  31. package/index.cjs +26 -17
  32. package/index.cjs.map +1 -1
  33. package/index.d.cts +12 -11
  34. package/index.d.ts +12 -11
  35. package/index.js +12 -12
  36. package/index.js.map +1 -1
  37. package/metafile-cjs.json +1 -1
  38. package/metafile-esm.json +1 -1
  39. package/node/index.cjs +17 -8
  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 +5 -5
  44. package/node/index.js.map +1 -1
  45. package/package.json +2 -2
  46. package/src/cf/cf-sys-abstraction.ts +2 -2
  47. package/src/deno/deno-file-service.ts +3 -3
  48. package/src/deno/deno-sys-abstraction.ts +2 -2
  49. package/src/json-en-decoder.ts +9 -9
  50. package/src/jsr.json +1 -1
  51. package/src/logger-impl.ts +2 -2
  52. package/src/node/node-file-service.ts +2 -2
  53. package/src/node/node-sys-abstraction.ts +2 -2
  54. package/src/resolve-once.ts +12 -1
  55. package/src/test/log-write-stream.ts +2 -2
  56. package/src/txt-en-decoder.ts +5 -5
  57. package/src/utils/string2stream.ts +2 -2
  58. package/src/web/web-sys-abstraction.ts +2 -2
  59. package/{sys-abstraction-B-0XMe9V.d.cts → sys-abstraction-3OXhCVsu.d.cts} +1 -1
  60. package/{sys-abstraction-CZa-VyNs.d.ts → sys-abstraction-DXeSUn9x.d.ts} +1 -1
  61. package/test/index.cjs +18 -9
  62. package/test/index.cjs.map +1 -1
  63. package/test/index.d.cts +3 -3
  64. package/test/index.d.ts +3 -3
  65. package/test/index.js +4 -4
  66. package/ts/src/cf/cf-sys-abstraction.js +2 -2
  67. package/ts/src/cf/cf-sys-abstraction.js.map +1 -1
  68. package/ts/src/deno/deno-file-service.d.ts.map +1 -1
  69. package/ts/src/deno/deno-file-service.js +3 -3
  70. package/ts/src/deno/deno-file-service.js.map +1 -1
  71. package/ts/src/deno/deno-sys-abstraction.js +2 -2
  72. package/ts/src/deno/deno-sys-abstraction.js.map +1 -1
  73. package/ts/src/json-en-decoder.d.ts +2 -2
  74. package/ts/src/json-en-decoder.d.ts.map +1 -1
  75. package/ts/src/json-en-decoder.js +6 -6
  76. package/ts/src/json-en-decoder.js.map +1 -1
  77. package/ts/src/logger-impl.d.ts.map +1 -1
  78. package/ts/src/logger-impl.js +2 -2
  79. package/ts/src/logger-impl.js.map +1 -1
  80. package/ts/src/node/node-file-service.d.ts.map +1 -1
  81. package/ts/src/node/node-file-service.js +2 -2
  82. package/ts/src/node/node-file-service.js.map +1 -1
  83. package/ts/src/node/node-sys-abstraction.js +2 -2
  84. package/ts/src/node/node-sys-abstraction.js.map +1 -1
  85. package/ts/src/resolve-once.d.ts +1 -0
  86. package/ts/src/resolve-once.d.ts.map +1 -1
  87. package/ts/src/resolve-once.js +11 -1
  88. package/ts/src/resolve-once.js.map +1 -1
  89. package/ts/src/resolve-once.test.js +26 -0
  90. package/ts/src/resolve-once.test.js.map +1 -1
  91. package/ts/src/test/log-write-stream.d.ts.map +1 -1
  92. package/ts/src/test/log-write-stream.js +2 -2
  93. package/ts/src/test/log-write-stream.js.map +1 -1
  94. package/ts/src/txt-en-decoder.d.ts +1 -1
  95. package/ts/src/txt-en-decoder.d.ts.map +1 -1
  96. package/ts/src/txt-en-decoder.js +5 -5
  97. package/ts/src/txt-en-decoder.js.map +1 -1
  98. package/ts/src/txt-en-decoder.test.js +3 -15
  99. package/ts/src/txt-en-decoder.test.js.map +1 -1
  100. package/ts/src/utils/string2stream.d.ts.map +1 -1
  101. package/ts/src/utils/string2stream.js +2 -2
  102. package/ts/src/utils/string2stream.js.map +1 -1
  103. package/ts/src/web/web-sys-abstraction.js +2 -2
  104. package/ts/src/web/web-sys-abstraction.js.map +1 -1
  105. package/utils/index.cjs +6 -6
  106. package/utils/index.cjs.map +1 -1
  107. package/utils/index.d.cts +2 -2
  108. package/utils/index.d.ts +2 -2
  109. package/utils/index.js +2 -2
  110. package/web/index.cjs +16 -7
  111. package/web/index.cjs.map +1 -1
  112. package/web/index.d.cts +3 -3
  113. package/web/index.d.ts +3 -3
  114. package/web/index.js +3 -3
  115. package/chunk-K5TIGJ6I.js.map +0 -1
  116. package/chunk-LNS2K5WL.js.map +0 -1
  117. package/chunk-SCFB6I2C.js.map +0 -1
@@ -2,7 +2,7 @@ import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import process from "node:process";
4
4
  import { FileService, NamedWritableStream } from "../file-service.js";
5
- import { TxtEnDecoder, Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
5
+ import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
6
6
 
7
7
  export class NodeFileService implements FileService {
8
8
  readonly baseDir: string;
@@ -57,7 +57,7 @@ export class NodeFileService implements FileService {
57
57
  return path.isAbsolute(fname);
58
58
  }
59
59
 
60
- async writeFileString(fname: string, content: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): Promise<void> {
60
+ async writeFileString(fname: string, content: string, ende: TxtEnDecoder = TxtEnDecoderSingleton()): Promise<void> {
61
61
  const o = await this.create(fname);
62
62
  const wr = o.stream.getWriter();
63
63
  await wr.write(ende.encode(content));
@@ -8,7 +8,7 @@ import {
8
8
  } from "../base-sys-abstraction.js";
9
9
  import { NodeFileService } from "./node-file-service.js";
10
10
  import { Env, envFactory } from "../sys-env.js";
11
- import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
11
+ import { TxtEnDecoderSingleton } from "../txt-en-decoder.js";
12
12
  import process from "node:process";
13
13
 
14
14
  export class NodeExitServiceImpl implements ExitService {
@@ -112,7 +112,7 @@ let my: BaseSysAbstraction | undefined = undefined;
112
112
  export function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {
113
113
  if (!my) {
114
114
  my = new BaseSysAbstraction({
115
- TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),
115
+ TxtEnDecoder: param?.TxtEnDecoder || TxtEnDecoderSingleton(),
116
116
  FileSystem: new NodeFileService(),
117
117
  SystemService: new NodeSystemService(),
118
118
  });
@@ -47,6 +47,7 @@ export class ResolveOnce<T, CTX = void> {
47
47
  _onceValue?: T;
48
48
  _onceError?: Error;
49
49
  _isPromise = false;
50
+ _inProgress?: Future<T>;
50
51
 
51
52
  readonly ctx: CTX;
52
53
 
@@ -63,7 +64,15 @@ export class ResolveOnce<T, CTX = void> {
63
64
  this._onceOk = false;
64
65
  this._onceValue = undefined;
65
66
  this._onceError = undefined;
66
- this._onceFutures.length = 0;
67
+ if (this._inProgress) {
68
+ const idx = this._onceFutures.findIndex((f) => f === this._inProgress);
69
+ if (idx >= 0) {
70
+ // leave the current in progress future
71
+ this._onceFutures.push(...this._onceFutures.splice(2).slice(1));
72
+ }
73
+ } else {
74
+ this._onceFutures.length = 0;
75
+ }
67
76
  }
68
77
 
69
78
  // T extends Option<infer U> ? U : T
@@ -110,6 +119,7 @@ export class ResolveOnce<T, CTX = void> {
110
119
  }
111
120
  this._onceFutures.length = 0;
112
121
  };
122
+ this._inProgress = future;
113
123
  try {
114
124
  const ret = fn(this.ctx);
115
125
  if (typeof (ret as Promise<T>).then === "function") {
@@ -121,6 +131,7 @@ export class ResolveOnce<T, CTX = void> {
121
131
  } catch (e) {
122
132
  catchFn(e as Error);
123
133
  }
134
+ this._inProgress = undefined;
124
135
  }
125
136
  if (this._isPromise) {
126
137
  return future.asPromise() as unknown as R;
@@ -1,6 +1,6 @@
1
1
  import { FanoutWriteStream } from "../utils/fanout-write-stream.js";
2
2
  import { Future } from "../future.js";
3
- import { TxtEnDecoder, Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
3
+ import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
4
4
 
5
5
  export class LogWriteStream implements WritableStreamDefaultWriter<Uint8Array> {
6
6
  private readonly _bufferArr: Uint8Array[];
@@ -42,7 +42,7 @@ export class LogCollector implements WritableStream<Uint8Array> {
42
42
 
43
43
  constructor(pass?: WritableStreamDefaultWriter<Uint8Array>, txtEnDe?: TxtEnDecoder) {
44
44
  this._pass = pass;
45
- this._txtEnDe = txtEnDe || Utf8EnDecoderSingleton();
45
+ this._txtEnDe = txtEnDe || TxtEnDecoderSingleton();
46
46
  }
47
47
 
48
48
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -10,7 +10,7 @@ export interface TxtEnDecoder {
10
10
  asyncDecode(input: AsyncToEnDecoder): Promise<string>;
11
11
  }
12
12
 
13
- class Utf8EnDecoder implements TxtEnDecoder {
13
+ class TxtOps implements TxtEnDecoder {
14
14
  readonly encoder = new TextEncoder();
15
15
  readonly decoder = new TextDecoder();
16
16
 
@@ -43,8 +43,8 @@ class Utf8EnDecoder implements TxtEnDecoder {
43
43
  }
44
44
  }
45
45
 
46
- let utf8EnDecoder: TxtEnDecoder;
47
- export function Utf8EnDecoderSingleton(): TxtEnDecoder {
48
- utf8EnDecoder = utf8EnDecoder ?? new Utf8EnDecoder();
49
- return utf8EnDecoder;
46
+ let txtEnDecoder: TxtEnDecoder;
47
+ export function TxtEnDecoderSingleton(): TxtEnDecoder {
48
+ txtEnDecoder = txtEnDecoder ?? new TxtOps();
49
+ return txtEnDecoder;
50
50
  }
@@ -1,6 +1,6 @@
1
- import { TxtEnDecoder, Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
1
+ import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
2
2
 
3
- export function string2stream(str: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): ReadableStream<Uint8Array> {
3
+ export function string2stream(str: string, ende: TxtEnDecoder = TxtEnDecoderSingleton()): ReadableStream<Uint8Array> {
4
4
  return uint8array2stream(ende.encode(str));
5
5
  }
6
6
 
@@ -2,7 +2,7 @@ import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams
2
2
  import { FileService, NamedWritableStream } from "../file-service.js";
3
3
  import { SysAbstraction, SystemService, VoidFunc } from "../sys-abstraction.js";
4
4
  import { Env, envFactory } from "../sys-env.js";
5
- import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
5
+ import { TxtEnDecoderSingleton } from "../txt-en-decoder.js";
6
6
 
7
7
  export class WebFileService implements FileService {
8
8
  get baseDir(): string {
@@ -71,7 +71,7 @@ let my: BaseSysAbstraction | undefined = undefined;
71
71
  export function WebSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {
72
72
  if (!my) {
73
73
  my = new BaseSysAbstraction({
74
- TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),
74
+ TxtEnDecoder: param?.TxtEnDecoder || TxtEnDecoderSingleton(),
75
75
  FileSystem: new WebFileService(),
76
76
  SystemService: new WebSystemService(),
77
77
  });
@@ -1,4 +1,4 @@
1
- import { K as KeysParam, R as Result } from './get-params-result-CXYbMEcV.cjs';
1
+ import { K as KeysParam, R as Result } from './get-params-result-C2cbgB78.cjs';
2
2
 
3
3
  interface NamedWritableStream {
4
4
  readonly name: string;
@@ -1,4 +1,4 @@
1
- import { K as KeysParam, R as Result } from './get-params-result-CXYbMEcV.js';
1
+ import { K as KeysParam, R as Result } from './get-params-result-C2cbgB78.js';
2
2
 
3
3
  interface NamedWritableStream {
4
4
  readonly name: string;
package/test/index.cjs CHANGED
@@ -218,7 +218,7 @@ function coerceIntoUint8(raw) {
218
218
  }
219
219
 
220
220
  // src/txt-en-decoder.ts
221
- var Utf8EnDecoder = class {
221
+ var TxtOps = class {
222
222
  constructor() {
223
223
  this.encoder = new TextEncoder();
224
224
  this.decoder = new TextDecoder();
@@ -249,10 +249,10 @@ var Utf8EnDecoder = class {
249
249
  return this.decode(resolved);
250
250
  }
251
251
  };
252
- var utf8EnDecoder;
253
- function Utf8EnDecoderSingleton() {
254
- utf8EnDecoder = utf8EnDecoder != null ? utf8EnDecoder : new Utf8EnDecoder();
255
- return utf8EnDecoder;
252
+ var txtEnDecoder;
253
+ function TxtEnDecoderSingleton() {
254
+ txtEnDecoder = txtEnDecoder != null ? txtEnDecoder : new TxtOps();
255
+ return txtEnDecoder;
256
256
  }
257
257
 
258
258
  // src/test/log-write-stream.ts
@@ -286,7 +286,7 @@ var LogCollector = class {
286
286
  this.locked = false;
287
287
  this._bufferArr = [];
288
288
  this._pass = pass;
289
- this._txtEnDe = txtEnDe || Utf8EnDecoderSingleton();
289
+ this._txtEnDe = txtEnDe || TxtEnDecoderSingleton();
290
290
  }
291
291
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
292
292
  abort(reason) {
@@ -850,7 +850,14 @@ var ResolveOnce = class {
850
850
  this._onceOk = false;
851
851
  this._onceValue = void 0;
852
852
  this._onceError = void 0;
853
- this._onceFutures.length = 0;
853
+ if (this._inProgress) {
854
+ const idx = this._onceFutures.findIndex((f) => f === this._inProgress);
855
+ if (idx >= 0) {
856
+ this._onceFutures.push(...this._onceFutures.splice(2).slice(1));
857
+ }
858
+ } else {
859
+ this._onceFutures.length = 0;
860
+ }
854
861
  }
855
862
  // T extends Option<infer U> ? U : T
856
863
  once(fn) {
@@ -893,6 +900,7 @@ var ResolveOnce = class {
893
900
  }
894
901
  this._onceFutures.length = 0;
895
902
  };
903
+ this._inProgress = future;
896
904
  try {
897
905
  const ret = fn(this.ctx);
898
906
  if (typeof ret.then === "function") {
@@ -904,6 +912,7 @@ var ResolveOnce = class {
904
912
  } catch (e) {
905
913
  catchFn(e);
906
914
  }
915
+ this._inProgress = void 0;
907
916
  }
908
917
  if (this._isPromise) {
909
918
  return future.asPromise();
@@ -1411,7 +1420,7 @@ var my = void 0;
1411
1420
  function WebSysAbstraction(param2) {
1412
1421
  if (!my) {
1413
1422
  my = new BaseSysAbstraction({
1414
- TxtEnDecoder: (param2 == null ? void 0 : param2.TxtEnDecoder) || Utf8EnDecoderSingleton(),
1423
+ TxtEnDecoder: (param2 == null ? void 0 : param2.TxtEnDecoder) || TxtEnDecoderSingleton(),
1415
1424
  FileSystem: new WebFileService(),
1416
1425
  SystemService: new WebSystemService()
1417
1426
  });
@@ -2170,7 +2179,7 @@ var LoggerImpl = class _LoggerImpl {
2170
2179
  this._sys = params.sys;
2171
2180
  }
2172
2181
  if (!params.txtEnDe) {
2173
- this._txtEnDe = Utf8EnDecoderSingleton();
2182
+ this._txtEnDe = TxtEnDecoderSingleton();
2174
2183
  } else {
2175
2184
  this._txtEnDe = params.txtEnDe;
2176
2185
  }