@adviser/cement 0.3.6 → 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.
- package/{base-sys-abstraction-CKI4xiRR.d.ts → base-sys-abstraction-Cqb4snul.d.ts} +2 -2
- package/{base-sys-abstraction-DLnSeH4s.d.cts → base-sys-abstraction-WS7lNbFm.d.cts} +2 -2
- package/cf/index.cjs +59 -8
- package/cf/index.cjs.map +1 -1
- package/cf/index.d.cts +19 -4
- package/cf/index.d.ts +19 -4
- package/cf/index.js +5 -3
- package/cf/index.js.map +1 -1
- package/{chunk-QDDO6NOK.js → chunk-BVZ6HD34.js} +66 -7
- package/chunk-BVZ6HD34.js.map +1 -0
- package/{chunk-N5ISHPJ6.js → chunk-H5JLIMWA.js} +41 -2
- package/{chunk-N5ISHPJ6.js.map → chunk-H5JLIMWA.js.map} +1 -1
- package/{chunk-OIIUVSUX.js → chunk-K5TIGJ6I.js} +3 -3
- package/{chunk-Z7F6652G.js → chunk-LNS2K5WL.js} +4 -4
- package/{chunk-4QRZPFED.js → chunk-SCFB6I2C.js} +58 -57
- package/{chunk-4QRZPFED.js.map → chunk-SCFB6I2C.js.map} +1 -1
- package/deno/index.cjs +57 -8
- package/deno/index.cjs.map +1 -1
- package/deno/index.d.cts +3 -3
- package/deno/index.d.ts +3 -3
- package/deno/index.js +2 -2
- package/{get-params-result-Bhy5997x.d.ts → get-params-result-CXYbMEcV.d.cts} +13 -7
- package/{get-params-result-Bhy5997x.d.cts → get-params-result-CXYbMEcV.d.ts} +13 -7
- package/{index-CcNS7k5i.d.cts → index-BH1SIYUK.d.cts} +2 -2
- package/{index-DjN6Y4N2.d.ts → index-BQMIP01w.d.ts} +19 -3
- package/{index-6ofzOS0J.d.ts → index-BeXMFEyF.d.ts} +2 -2
- package/{index-TZQHtEZo.d.cts → index-C6hvxtE7.d.cts} +19 -3
- package/index.cjs +180 -14
- package/index.cjs.map +1 -1
- package/index.d.cts +27 -10
- package/index.d.ts +27 -10
- package/index.js +83 -7
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -0
- package/metafile-esm.json +1 -0
- package/node/index.cjs +139 -90
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +3 -3
- package/node/index.d.ts +3 -3
- package/node/index.js +2 -2
- package/package.json +2 -2
- package/src/cf/index.ts +1 -0
- package/src/http_header.ts +1 -1
- package/src/index.ts +5 -1
- package/src/json-en-decoder.ts +83 -0
- package/src/jsr.json +1 -1
- package/src/path-ops.ts +30 -0
- package/src/txt-en-decoder.ts +38 -9
- package/src/utils/coerce-uint8.ts +53 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/sorted-object.ts +18 -0
- package/src/utils/uint8array-equal.ts +11 -0
- package/{sys-abstraction-BRDT_TIU.d.cts → sys-abstraction-B-0XMe9V.d.cts} +2 -2
- package/{sys-abstraction-Bd0EzwO6.d.ts → sys-abstraction-CZa-VyNs.d.ts} +2 -2
- package/test/index.cjs +150 -101
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +3 -3
- package/test/index.d.ts +3 -3
- package/test/index.js +4 -4
- package/ts/src/cf/index.d.ts +1 -0
- package/ts/src/cf/index.d.ts.map +1 -1
- package/ts/src/cf/index.js +1 -0
- package/ts/src/cf/index.js.map +1 -1
- package/ts/src/http_header.d.ts +1 -1
- package/ts/src/http_header.d.ts.map +1 -1
- package/ts/src/http_header.js.map +1 -1
- package/ts/src/index.d.ts +2 -0
- package/ts/src/index.d.ts.map +1 -1
- package/ts/src/index.js +2 -0
- package/ts/src/index.js.map +1 -1
- package/ts/src/json-en-decoder.d.ts +12 -0
- package/ts/src/json-en-decoder.d.ts.map +1 -0
- package/ts/src/json-en-decoder.js +41 -0
- package/ts/src/json-en-decoder.js.map +1 -0
- package/ts/src/json-en-decoder.test.d.ts +2 -0
- package/ts/src/json-en-decoder.test.d.ts.map +1 -0
- package/ts/src/json-en-decoder.test.js +18 -0
- package/ts/src/json-en-decoder.test.js.map +1 -0
- package/ts/src/path-ops.d.ts +7 -0
- package/ts/src/path-ops.d.ts.map +1 -0
- package/ts/src/path-ops.js +33 -0
- package/ts/src/path-ops.js.map +1 -0
- package/ts/src/path-ops.test.d.ts +2 -0
- package/ts/src/path-ops.test.d.ts.map +1 -0
- package/ts/src/path-ops.test.js +23 -0
- package/ts/src/path-ops.test.js.map +1 -0
- package/ts/src/txt-en-decoder.d.ts +7 -6
- package/ts/src/txt-en-decoder.d.ts.map +1 -1
- package/ts/src/txt-en-decoder.js +30 -6
- package/ts/src/txt-en-decoder.js.map +1 -1
- package/ts/src/txt-en-decoder.test.d.ts +2 -0
- package/ts/src/txt-en-decoder.test.d.ts.map +1 -0
- package/ts/src/txt-en-decoder.test.js +60 -0
- package/ts/src/txt-en-decoder.test.js.map +1 -0
- package/ts/src/utils/coerce-uint8.d.ts +8 -0
- package/ts/src/utils/coerce-uint8.d.ts.map +1 -0
- package/ts/src/utils/coerce-uint8.js +34 -0
- package/ts/src/utils/coerce-uint8.js.map +1 -0
- package/ts/src/utils/index.d.ts +3 -0
- package/ts/src/utils/index.d.ts.map +1 -1
- package/ts/src/utils/index.js +3 -0
- package/ts/src/utils/index.js.map +1 -1
- package/ts/src/utils/sorted-objec.test.d.ts +2 -0
- package/ts/src/utils/sorted-objec.test.d.ts.map +1 -0
- package/ts/src/utils/sorted-objec.test.js +20 -0
- package/ts/src/utils/sorted-objec.test.js.map +1 -0
- package/ts/src/utils/sorted-object.d.ts +4 -0
- package/ts/src/utils/sorted-object.d.ts.map +1 -0
- package/ts/src/utils/sorted-object.js +16 -0
- package/ts/src/utils/sorted-object.js.map +1 -0
- package/ts/src/utils/uint8array-equal.d.ts +2 -0
- package/ts/src/utils/uint8array-equal.d.ts.map +1 -0
- package/ts/src/utils/uint8array-equal.js +12 -0
- package/ts/src/utils/uint8array-equal.js.map +1 -0
- package/utils/index.cjs +182 -87
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +2 -2
- package/utils/index.d.ts +2 -2
- package/utils/index.js +14 -2
- package/web/index.cjs +57 -8
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +3 -3
- package/web/index.d.ts +3 -3
- package/web/index.js +3 -3
- package/chunk-QDDO6NOK.js.map +0 -1
- /package/{chunk-OIIUVSUX.js.map → chunk-K5TIGJ6I.js.map} +0 -0
- /package/{chunk-Z7F6652G.js.map → chunk-LNS2K5WL.js.map} +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { T as TxtEnDecoder, K as KeysParam, M as MsgFn, P as Param, g as getParamsResult, p as param } from './get-params-result-
|
1
|
+
import { T as TxtEnDecoder, A as AsyncToUInt8, K as KeysParam, M as MsgFn, P as Param, a as ToUInt8, b as ToUInt8Async, c as ToUInt8Plain, d as asyncCoerceIntoUint8, e as coerceIntoUint8, g as getParamsResult, p as param } from './get-params-result-CXYbMEcV.cjs';
|
2
2
|
import { S as StripCommand, s as stripper } from './stripper-BpBUUZ9p.cjs';
|
3
3
|
|
4
4
|
declare function rebufferArray(a: Uint8Array[], chunkSize: number): Promise<Uint8Array[]>;
|
@@ -52,6 +52,13 @@ declare class FanoutWriteStream implements WritableStreamDefaultWriter<Uint8Arra
|
|
52
52
|
write(chunk?: Uint8Array): Promise<void>;
|
53
53
|
}
|
54
54
|
|
55
|
+
declare function toSortedObjectArray<T>(set?: T): Record<string, unknown>[];
|
56
|
+
declare function toSortedArray<T>(set?: T): [string, unknown][];
|
57
|
+
declare function toSortedObject<S, T extends NonNullable<S>>(set?: T): T;
|
58
|
+
|
59
|
+
declare function UInt8ArrayEqual(a: Uint8Array, b: Uint8Array): boolean;
|
60
|
+
|
61
|
+
declare const utils_AsyncToUInt8: typeof AsyncToUInt8;
|
55
62
|
type utils_ConsoleWriterStream = ConsoleWriterStream;
|
56
63
|
declare const utils_ConsoleWriterStream: typeof ConsoleWriterStream;
|
57
64
|
type utils_ConsoleWriterStreamDefaultWriter = ConsoleWriterStreamDefaultWriter;
|
@@ -63,7 +70,13 @@ declare const utils_MsgFn: typeof MsgFn;
|
|
63
70
|
declare const utils_Param: typeof Param;
|
64
71
|
type utils_StreamMap<T, U> = StreamMap<T, U>;
|
65
72
|
declare const utils_StripCommand: typeof StripCommand;
|
73
|
+
declare const utils_ToUInt8: typeof ToUInt8;
|
74
|
+
declare const utils_ToUInt8Async: typeof ToUInt8Async;
|
75
|
+
declare const utils_ToUInt8Plain: typeof ToUInt8Plain;
|
76
|
+
declare const utils_UInt8ArrayEqual: typeof UInt8ArrayEqual;
|
66
77
|
declare const utils_array2stream: typeof array2stream;
|
78
|
+
declare const utils_asyncCoerceIntoUint8: typeof asyncCoerceIntoUint8;
|
79
|
+
declare const utils_coerceIntoUint8: typeof coerceIntoUint8;
|
67
80
|
declare const utils_devnull: typeof devnull;
|
68
81
|
declare const utils_getParamsResult: typeof getParamsResult;
|
69
82
|
declare const utils_param: typeof param;
|
@@ -75,9 +88,12 @@ declare const utils_stream2uint8array: typeof stream2uint8array;
|
|
75
88
|
declare const utils_streamMap: typeof streamMap;
|
76
89
|
declare const utils_string2stream: typeof string2stream;
|
77
90
|
declare const utils_stripper: typeof stripper;
|
91
|
+
declare const utils_toSortedArray: typeof toSortedArray;
|
92
|
+
declare const utils_toSortedObject: typeof toSortedObject;
|
93
|
+
declare const utils_toSortedObjectArray: typeof toSortedObjectArray;
|
78
94
|
declare const utils_uint8array2stream: typeof uint8array2stream;
|
79
95
|
declare namespace utils {
|
80
|
-
export { utils_ConsoleWriterStream as ConsoleWriterStream, utils_ConsoleWriterStreamDefaultWriter as ConsoleWriterStreamDefaultWriter, utils_FanoutWriteStream as FanoutWriteStream, utils_KeysParam as KeysParam, utils_MsgFn as MsgFn, utils_Param as Param, type utils_StreamMap as StreamMap, utils_StripCommand as StripCommand, utils_array2stream as array2stream, utils_devnull as devnull, utils_getParamsResult as getParamsResult, utils_param as param, utils_rebuffer as rebuffer, utils_rebufferArray as rebufferArray, utils_stream2array as stream2array, utils_stream2string as stream2string, utils_stream2uint8array as stream2uint8array, utils_streamMap as streamMap, utils_string2stream as string2stream, utils_stripper as stripper, utils_uint8array2stream as uint8array2stream };
|
96
|
+
export { utils_AsyncToUInt8 as AsyncToUInt8, utils_ConsoleWriterStream as ConsoleWriterStream, utils_ConsoleWriterStreamDefaultWriter as ConsoleWriterStreamDefaultWriter, utils_FanoutWriteStream as FanoutWriteStream, utils_KeysParam as KeysParam, utils_MsgFn as MsgFn, utils_Param as Param, type utils_StreamMap as StreamMap, utils_StripCommand as StripCommand, utils_ToUInt8 as ToUInt8, utils_ToUInt8Async as ToUInt8Async, utils_ToUInt8Plain as ToUInt8Plain, utils_UInt8ArrayEqual as UInt8ArrayEqual, utils_array2stream as array2stream, utils_asyncCoerceIntoUint8 as asyncCoerceIntoUint8, utils_coerceIntoUint8 as coerceIntoUint8, utils_devnull as devnull, utils_getParamsResult as getParamsResult, utils_param as param, utils_rebuffer as rebuffer, utils_rebufferArray as rebufferArray, utils_stream2array as stream2array, utils_stream2string as stream2string, utils_stream2uint8array as stream2uint8array, utils_streamMap as streamMap, utils_string2stream as string2stream, utils_stripper as stripper, utils_toSortedArray as toSortedArray, utils_toSortedObject as toSortedObject, utils_toSortedObjectArray as toSortedObjectArray, utils_uint8array2stream as uint8array2stream };
|
81
97
|
}
|
82
98
|
|
83
|
-
export { ConsoleWriterStreamDefaultWriter as C, FanoutWriteStream as F, type StreamMap as S, rebuffer as a, array2stream as b, stream2array as c, devnull as d, stream2string as e, stream2uint8array as f, string2stream as g, uint8array2stream as h, ConsoleWriterStream as i, rebufferArray as r, streamMap as s, utils as u };
|
99
|
+
export { ConsoleWriterStreamDefaultWriter as C, FanoutWriteStream as F, type StreamMap as S, UInt8ArrayEqual as U, rebuffer as a, array2stream as b, stream2array as c, devnull as d, stream2string as e, stream2uint8array as f, string2stream as g, uint8array2stream as h, ConsoleWriterStream as i, toSortedArray as j, toSortedObject as k, rebufferArray as r, streamMap as s, toSortedObjectArray as t, utils as u };
|
package/index.cjs
CHANGED
@@ -33,6 +33,7 @@ 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
39
|
var index_exports = {};
|
@@ -47,6 +48,7 @@ __export(index_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(index_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,6 +97,7 @@ __export(index_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,
|
@@ -222,8 +224,8 @@ function logValueInternal(val, ctx) {
|
|
222
224
|
}
|
223
225
|
if (ArrayBuffer.isView(val)) {
|
224
226
|
try {
|
225
|
-
const
|
226
|
-
const asStr =
|
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
|
468
|
+
const decoder = this._txtEnDe;
|
467
469
|
this._stdout = CFWriteableStream((chunk) => {
|
468
|
-
const decoded =
|
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 =
|
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
|
-
|
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
|
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,
|
@@ -3107,6 +3242,9 @@ __export(utils_exports, {
|
|
3107
3242
|
streamMap: () => streamMap,
|
3108
3243
|
string2stream: () => string2stream,
|
3109
3244
|
stripper: () => stripper,
|
3245
|
+
toSortedArray: () => toSortedArray,
|
3246
|
+
toSortedObject: () => toSortedObject,
|
3247
|
+
toSortedObjectArray: () => toSortedObjectArray,
|
3110
3248
|
uint8array2stream: () => uint8array2stream
|
3111
3249
|
});
|
3112
3250
|
|
@@ -3241,7 +3379,7 @@ async function stream2string(stream, maxSize) {
|
|
3241
3379
|
}
|
3242
3380
|
const reader = stream.getReader();
|
3243
3381
|
let res = "";
|
3244
|
-
const
|
3382
|
+
const decoder = new TextDecoder();
|
3245
3383
|
let rSize = 0;
|
3246
3384
|
while (typeof maxSize === "undefined" || rSize < maxSize) {
|
3247
3385
|
try {
|
@@ -3252,7 +3390,7 @@ async function stream2string(stream, maxSize) {
|
|
3252
3390
|
if (maxSize && rSize + read.value.length > maxSize) {
|
3253
3391
|
read.value = read.value.slice(0, maxSize - rSize);
|
3254
3392
|
}
|
3255
|
-
const block =
|
3393
|
+
const block = decoder.decode(read.value, { stream: true });
|
3256
3394
|
rSize += read.value.length;
|
3257
3395
|
res += block;
|
3258
3396
|
} catch (err) {
|
@@ -3294,6 +3432,33 @@ function uint8array2stream(str) {
|
|
3294
3432
|
});
|
3295
3433
|
}
|
3296
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
|
+
|
3297
3462
|
// src/index.ts
|
3298
3463
|
var param2 = param;
|
3299
3464
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -3308,6 +3473,7 @@ var param2 = param;
|
|
3308
3473
|
IDMode,
|
3309
3474
|
IdService,
|
3310
3475
|
IsLogger,
|
3476
|
+
JSONEnDecoderSingleton,
|
3311
3477
|
JSONFormatter,
|
3312
3478
|
Keyed,
|
3313
3479
|
KeyedResolvOnce,
|
@@ -3342,7 +3508,6 @@ var param2 = param;
|
|
3342
3508
|
TimeUnits,
|
3343
3509
|
TraceNode,
|
3344
3510
|
URI,
|
3345
|
-
Utf8EnDecoder,
|
3346
3511
|
Utf8EnDecoderSingleton,
|
3347
3512
|
VERSION,
|
3348
3513
|
WrapperSysAbstraction,
|
@@ -3357,6 +3522,7 @@ var param2 = param;
|
|
3357
3522
|
key,
|
3358
3523
|
logValue,
|
3359
3524
|
param,
|
3525
|
+
pathOps,
|
3360
3526
|
registerEnvAction,
|
3361
3527
|
runtimeFn,
|
3362
3528
|
toCryptoRuntime,
|