@adviser/cement 0.2.31 → 0.2.33
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +122 -29
- package/index.cjs.map +1 -1
- package/index.d.cts +12 -4
- package/index.d.ts +12 -4
- package/index.js +121 -27
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/jsr.json +1 -1
- package/src/logger-impl.ts +3 -1
- package/src/logger.ts +1 -0
- package/src/uri.ts +82 -4
- package/ts/index.d.ts +0 -1
- package/ts/index.d.ts.map +1 -1
- package/ts/index.js +0 -1
- package/ts/index.js.map +1 -1
- package/ts/logger-impl.d.ts.map +1 -1
- package/ts/logger-impl.js +3 -1
- package/ts/logger-impl.js.map +1 -1
- package/ts/logger.d.ts +1 -0
- package/ts/logger.d.ts.map +1 -1
- package/ts/logger.test.js +14 -0
- package/ts/logger.test.js.map +1 -1
- package/ts/uri.d.ts +9 -1
- package/ts/uri.d.ts.map +1 -1
- package/ts/uri.js +66 -4
- package/ts/uri.js.map +1 -1
- package/ts/uri.test.js +64 -0
- package/ts/uri.test.js.map +1 -1
- package/src/refcounted.ts +0 -23
- package/ts/refcounted.d.ts +0 -2
- package/ts/refcounted.d.ts.map +0 -1
- package/ts/refcounted.js +0 -19
- package/ts/refcounted.js.map +0 -1
- package/ts/refcounted.test.d.ts +0 -2
- package/ts/refcounted.test.d.ts.map +0 -1
- package/ts/refcounted.test.js +0 -39
- package/ts/refcounted.test.js.map +0 -1
package/index.d.cts
CHANGED
@@ -37,6 +37,8 @@ type WithoutResult<T> = T extends Result<infer U> ? U : T;
|
|
37
37
|
type WithResult<T> = T extends Promise<infer U> ? Promise<Result<U>> : Result<T>;
|
38
38
|
declare function exception2Result<FN extends () => Promise<T> | T, T>(fn: FN): WithResult<ReturnType<FN>>;
|
39
39
|
|
40
|
+
type StripCommand = string | RegExp;
|
41
|
+
|
40
42
|
type NullOrUndef = null | undefined;
|
41
43
|
interface URIObject {
|
42
44
|
readonly style: "host" | "path";
|
@@ -73,6 +75,7 @@ declare class MutableURL extends URL {
|
|
73
75
|
get searchParams(): URLSearchParams;
|
74
76
|
toString(): string;
|
75
77
|
}
|
78
|
+
type keysParam = (string | ((...keys: string[]) => string))[];
|
76
79
|
declare class BuildURI {
|
77
80
|
_url: MutableURL;
|
78
81
|
private constructor();
|
@@ -82,13 +85,17 @@ declare class BuildURI {
|
|
82
85
|
hostname(h: string): BuildURI;
|
83
86
|
protocol(p: string): BuildURI;
|
84
87
|
pathname(p: string): BuildURI;
|
88
|
+
appendRelative(p: CoerceURI): BuildURI;
|
85
89
|
delParam(key: string): BuildURI;
|
86
90
|
defParam(key: string, str: string): BuildURI;
|
87
91
|
setParam(key: string, str: string): BuildURI;
|
88
92
|
hasParam(key: string): boolean;
|
89
93
|
getParam(key: string): string | undefined;
|
94
|
+
getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
|
95
|
+
getParamsResult(...keys: keysParam): Result<Record<string, string>>;
|
90
96
|
toString(): string;
|
91
97
|
toJSON(): string;
|
98
|
+
asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
|
92
99
|
URI(): URI;
|
93
100
|
}
|
94
101
|
type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
|
@@ -110,11 +117,13 @@ declare class URI {
|
|
110
117
|
get getParams(): Iterable<[string, string]>;
|
111
118
|
hasParam(key: string): boolean;
|
112
119
|
getParam(key: string): string | undefined;
|
120
|
+
getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
|
121
|
+
getParamsResult(...keys: keysParam): Result<Record<string, string>>;
|
113
122
|
clone(): URI;
|
114
123
|
asURL(): URL;
|
115
124
|
toString(): string;
|
116
125
|
toJSON(): string;
|
117
|
-
asObj(): HostURIObject | PathURIObject;
|
126
|
+
asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
|
118
127
|
}
|
119
128
|
|
120
129
|
declare enum Level {
|
@@ -191,6 +200,7 @@ interface WithLogger extends LoggerInterface<WithLogger> {
|
|
191
200
|
}
|
192
201
|
interface AsError {
|
193
202
|
AsError(): Error;
|
203
|
+
ResultError<T>(): Result<T>;
|
194
204
|
}
|
195
205
|
interface Logger extends LoggerInterface<Logger> {
|
196
206
|
With(): WithLogger;
|
@@ -544,6 +554,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
|
|
544
554
|
|
545
555
|
declare const VERSION: string;
|
546
556
|
|
547
|
-
|
548
|
-
|
549
|
-
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime, wrapRefcounted };
|
557
|
+
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
|
package/index.d.ts
CHANGED
@@ -37,6 +37,8 @@ type WithoutResult<T> = T extends Result<infer U> ? U : T;
|
|
37
37
|
type WithResult<T> = T extends Promise<infer U> ? Promise<Result<U>> : Result<T>;
|
38
38
|
declare function exception2Result<FN extends () => Promise<T> | T, T>(fn: FN): WithResult<ReturnType<FN>>;
|
39
39
|
|
40
|
+
type StripCommand = string | RegExp;
|
41
|
+
|
40
42
|
type NullOrUndef = null | undefined;
|
41
43
|
interface URIObject {
|
42
44
|
readonly style: "host" | "path";
|
@@ -73,6 +75,7 @@ declare class MutableURL extends URL {
|
|
73
75
|
get searchParams(): URLSearchParams;
|
74
76
|
toString(): string;
|
75
77
|
}
|
78
|
+
type keysParam = (string | ((...keys: string[]) => string))[];
|
76
79
|
declare class BuildURI {
|
77
80
|
_url: MutableURL;
|
78
81
|
private constructor();
|
@@ -82,13 +85,17 @@ declare class BuildURI {
|
|
82
85
|
hostname(h: string): BuildURI;
|
83
86
|
protocol(p: string): BuildURI;
|
84
87
|
pathname(p: string): BuildURI;
|
88
|
+
appendRelative(p: CoerceURI): BuildURI;
|
85
89
|
delParam(key: string): BuildURI;
|
86
90
|
defParam(key: string, str: string): BuildURI;
|
87
91
|
setParam(key: string, str: string): BuildURI;
|
88
92
|
hasParam(key: string): boolean;
|
89
93
|
getParam(key: string): string | undefined;
|
94
|
+
getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
|
95
|
+
getParamsResult(...keys: keysParam): Result<Record<string, string>>;
|
90
96
|
toString(): string;
|
91
97
|
toJSON(): string;
|
98
|
+
asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
|
92
99
|
URI(): URI;
|
93
100
|
}
|
94
101
|
type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
|
@@ -110,11 +117,13 @@ declare class URI {
|
|
110
117
|
get getParams(): Iterable<[string, string]>;
|
111
118
|
hasParam(key: string): boolean;
|
112
119
|
getParam(key: string): string | undefined;
|
120
|
+
getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
|
121
|
+
getParamsResult(...keys: keysParam): Result<Record<string, string>>;
|
113
122
|
clone(): URI;
|
114
123
|
asURL(): URL;
|
115
124
|
toString(): string;
|
116
125
|
toJSON(): string;
|
117
|
-
asObj(): HostURIObject | PathURIObject;
|
126
|
+
asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
|
118
127
|
}
|
119
128
|
|
120
129
|
declare enum Level {
|
@@ -191,6 +200,7 @@ interface WithLogger extends LoggerInterface<WithLogger> {
|
|
191
200
|
}
|
192
201
|
interface AsError {
|
193
202
|
AsError(): Error;
|
203
|
+
ResultError<T>(): Result<T>;
|
194
204
|
}
|
195
205
|
interface Logger extends LoggerInterface<Logger> {
|
196
206
|
With(): WithLogger;
|
@@ -544,6 +554,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
|
|
544
554
|
|
545
555
|
declare const VERSION: string;
|
546
556
|
|
547
|
-
|
548
|
-
|
549
|
-
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime, wrapRefcounted };
|
557
|
+
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
|
package/index.js
CHANGED
@@ -281,6 +281,61 @@ function exception2Result(fn) {
|
|
281
281
|
}
|
282
282
|
}
|
283
283
|
|
284
|
+
// src/utils/stripper.ts
|
285
|
+
function stripper(strip, obj) {
|
286
|
+
const strips = Array.isArray(strip) ? strip : [strip];
|
287
|
+
const restrips = strips.map((s) => {
|
288
|
+
if (typeof s === "string") {
|
289
|
+
const escaped = s.replace(/[-\\[\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g, "\\$&");
|
290
|
+
return new RegExp(`^${escaped}$`);
|
291
|
+
}
|
292
|
+
return s;
|
293
|
+
});
|
294
|
+
return localStripper(void 0, restrips, obj);
|
295
|
+
}
|
296
|
+
function localStripper(path, restrips, obj) {
|
297
|
+
if (typeof obj !== "object" || obj === null) {
|
298
|
+
return obj;
|
299
|
+
}
|
300
|
+
const ret = __spreadValues({}, obj);
|
301
|
+
const matcher = (key, nextPath) => {
|
302
|
+
for (const re of restrips) {
|
303
|
+
if (re.test(key) || re.test(nextPath)) {
|
304
|
+
return true;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
return false;
|
308
|
+
};
|
309
|
+
for (const key in ret) {
|
310
|
+
if (Object.prototype.hasOwnProperty.call(ret, key)) {
|
311
|
+
let nextPath;
|
312
|
+
if (path) {
|
313
|
+
nextPath = [path, key].join(".");
|
314
|
+
} else {
|
315
|
+
nextPath = key;
|
316
|
+
}
|
317
|
+
if (matcher(key, nextPath)) {
|
318
|
+
delete ret[key];
|
319
|
+
continue;
|
320
|
+
}
|
321
|
+
if (typeof ret[key] === "object") {
|
322
|
+
if (Array.isArray(ret[key])) {
|
323
|
+
ret[key] = ret[key].reduce((acc, v, i) => {
|
324
|
+
const toDelete = matcher(key, `${nextPath}[${i}]`);
|
325
|
+
if (!toDelete) {
|
326
|
+
acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
|
327
|
+
}
|
328
|
+
return acc;
|
329
|
+
}, []);
|
330
|
+
} else {
|
331
|
+
ret[key] = localStripper(nextPath, restrips, ret[key]);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
return ret;
|
337
|
+
}
|
338
|
+
|
284
339
|
// src/uri.ts
|
285
340
|
function falsy2undef(value) {
|
286
341
|
return value === void 0 || value === null ? void 0 : value;
|
@@ -419,6 +474,35 @@ function from(fac, strURLUri, defaultProtocol) {
|
|
419
474
|
throw new Error(`Invalid argument: ${typeof strURLUri}`);
|
420
475
|
}
|
421
476
|
}
|
477
|
+
function getParamResult(key, val, msgFn = (key2) => {
|
478
|
+
return `missing parameter: ${key2}`;
|
479
|
+
}) {
|
480
|
+
if (val === void 0) {
|
481
|
+
return Result.Err(msgFn(key));
|
482
|
+
}
|
483
|
+
return Result.Ok(val);
|
484
|
+
}
|
485
|
+
function getParamsResult(keys, getParam) {
|
486
|
+
const keyStrs = keys.flat().filter((k) => typeof k === "string");
|
487
|
+
const msgFn = keys.find((k) => typeof k === "function") || ((...keys2) => {
|
488
|
+
const msg = keys2.join(",");
|
489
|
+
return `missing parameters: ${msg}`;
|
490
|
+
});
|
491
|
+
const errors = [];
|
492
|
+
const result = {};
|
493
|
+
for (const key of keyStrs) {
|
494
|
+
const val = getParam.getParam(key);
|
495
|
+
if (val === void 0) {
|
496
|
+
errors.push(key);
|
497
|
+
} else {
|
498
|
+
result[key] = val;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
if (errors.length) {
|
502
|
+
return Result.Err(msgFn(...errors));
|
503
|
+
}
|
504
|
+
return Result.Ok(result);
|
505
|
+
}
|
422
506
|
var BuildURI = class _BuildURI {
|
423
507
|
// pathname needs this
|
424
508
|
constructor(url) {
|
@@ -470,6 +554,20 @@ var BuildURI = class _BuildURI {
|
|
470
554
|
// this._url.host = h;
|
471
555
|
// return this;
|
472
556
|
// }
|
557
|
+
appendRelative(p) {
|
558
|
+
const url = URI.from(p);
|
559
|
+
let pathname = url.pathname;
|
560
|
+
if (url.pathname === "/") {
|
561
|
+
pathname = "";
|
562
|
+
} else if (!pathname.startsWith("/")) {
|
563
|
+
pathname = `/${pathname}`;
|
564
|
+
}
|
565
|
+
this.pathname(this._url.pathname + pathname);
|
566
|
+
for (const [key, value] of url.getParams) {
|
567
|
+
this.setParam(key, value);
|
568
|
+
}
|
569
|
+
return this;
|
570
|
+
}
|
473
571
|
delParam(key) {
|
474
572
|
this._url.searchParams.delete(key);
|
475
573
|
return this;
|
@@ -490,6 +588,12 @@ var BuildURI = class _BuildURI {
|
|
490
588
|
getParam(key) {
|
491
589
|
return falsy2undef(this._url.searchParams.get(key));
|
492
590
|
}
|
591
|
+
getParamResult(key, msgFn) {
|
592
|
+
return getParamResult(key, this.getParam(key), msgFn);
|
593
|
+
}
|
594
|
+
getParamsResult(...keys) {
|
595
|
+
return getParamsResult(keys, this);
|
596
|
+
}
|
493
597
|
toString() {
|
494
598
|
this._url.searchParams.sort();
|
495
599
|
return this._url.toString();
|
@@ -497,6 +601,9 @@ var BuildURI = class _BuildURI {
|
|
497
601
|
toJSON() {
|
498
602
|
return this.toString();
|
499
603
|
}
|
604
|
+
asObj(...strips) {
|
605
|
+
return this.URI().asObj(...strips);
|
606
|
+
}
|
500
607
|
URI() {
|
501
608
|
return URI.from(this._url);
|
502
609
|
}
|
@@ -579,6 +686,12 @@ var URI = class _URI {
|
|
579
686
|
getParam(key) {
|
580
687
|
return falsy2undef(this._url.searchParams.get(key));
|
581
688
|
}
|
689
|
+
getParamResult(key, msgFn) {
|
690
|
+
return getParamResult(key, this.getParam(key), msgFn);
|
691
|
+
}
|
692
|
+
getParamsResult(...keys) {
|
693
|
+
return getParamsResult(keys, this);
|
694
|
+
}
|
582
695
|
clone() {
|
583
696
|
return new _URI(this._url);
|
584
697
|
}
|
@@ -591,7 +704,7 @@ var URI = class _URI {
|
|
591
704
|
toJSON() {
|
592
705
|
return this.toString();
|
593
706
|
}
|
594
|
-
asObj() {
|
707
|
+
asObj(...strips) {
|
595
708
|
const pathURI = {
|
596
709
|
style: "path",
|
597
710
|
protocol: this.protocol,
|
@@ -599,13 +712,13 @@ var URI = class _URI {
|
|
599
712
|
searchParams: Object.fromEntries(this.getParams)
|
600
713
|
};
|
601
714
|
if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
|
602
|
-
return __spreadProps(__spreadValues({}, pathURI), {
|
715
|
+
return stripper(strips, __spreadProps(__spreadValues({}, pathURI), {
|
603
716
|
style: "host",
|
604
717
|
hostname: this.hostname,
|
605
718
|
port: this.port
|
606
|
-
});
|
719
|
+
}));
|
607
720
|
}
|
608
|
-
return pathURI;
|
721
|
+
return stripper(strips, pathURI);
|
609
722
|
}
|
610
723
|
};
|
611
724
|
|
@@ -1034,8 +1147,10 @@ var LoggerImpl = class _LoggerImpl {
|
|
1034
1147
|
}
|
1035
1148
|
return fnRet;
|
1036
1149
|
});
|
1150
|
+
const asError = () => new Error(this._txtEnDe.decode(fnError()));
|
1037
1151
|
return {
|
1038
|
-
|
1152
|
+
ResultError: () => Result.Err(asError()),
|
1153
|
+
AsError: asError
|
1039
1154
|
};
|
1040
1155
|
}
|
1041
1156
|
};
|
@@ -1484,26 +1599,6 @@ function toCryptoRuntime(cryptoOpts = {}) {
|
|
1484
1599
|
var VERSION = Object.keys({
|
1485
1600
|
__packageVersion__: "xxxx"
|
1486
1601
|
})[0];
|
1487
|
-
|
1488
|
-
// src/refcounted.ts
|
1489
|
-
function wrapRefcounted(t, method) {
|
1490
|
-
const my = t;
|
1491
|
-
my.__refcounted = (my.__refcounted || 0) + 1;
|
1492
|
-
if (my.__refcounted === 1) {
|
1493
|
-
my.__unrefcounted = my[method];
|
1494
|
-
const mRec = my;
|
1495
|
-
mRec[method] = function() {
|
1496
|
-
this.__refcounted--;
|
1497
|
-
if (this.__refcounted === 0) {
|
1498
|
-
this.__unrefcounted();
|
1499
|
-
}
|
1500
|
-
if (this.__refcounted < 0) {
|
1501
|
-
throw new Error("already closed");
|
1502
|
-
}
|
1503
|
-
};
|
1504
|
-
}
|
1505
|
-
return t;
|
1506
|
-
}
|
1507
1602
|
export {
|
1508
1603
|
BaseSysAbstraction,
|
1509
1604
|
BrowserEnvActions,
|
@@ -1564,7 +1659,6 @@ export {
|
|
1564
1659
|
removeSelfRef,
|
1565
1660
|
runtimeFn,
|
1566
1661
|
toCryptoRuntime,
|
1567
|
-
utils_exports as utils
|
1568
|
-
wrapRefcounted
|
1662
|
+
utils_exports as utils
|
1569
1663
|
};
|
1570
1664
|
//# sourceMappingURL=index.js.map
|