@adviser/cement 0.2.29 → 0.2.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/index.cjs +51 -13
  2. package/index.cjs.map +1 -1
  3. package/index.d.cts +19 -2
  4. package/index.d.ts +19 -2
  5. package/index.js +53 -16
  6. package/index.js.map +1 -1
  7. package/package.json +14 -14
  8. package/src/index.ts +1 -0
  9. package/src/jsr.json +4 -2
  10. package/src/refcounted.ts +23 -0
  11. package/src/uri.ts +43 -9
  12. package/src/utils/stripper.ts +59 -0
  13. package/ts/index.d.ts +1 -0
  14. package/ts/index.d.ts.map +1 -1
  15. package/ts/index.js +1 -0
  16. package/ts/index.js.map +1 -1
  17. package/ts/node/node-sys-abstraction.test.js +2 -6
  18. package/ts/node/node-sys-abstraction.test.js.map +1 -1
  19. package/ts/refcounted.d.ts +2 -0
  20. package/ts/refcounted.d.ts.map +1 -0
  21. package/ts/refcounted.js +19 -0
  22. package/ts/refcounted.js.map +1 -0
  23. package/ts/refcounted.test.d.ts +2 -0
  24. package/ts/refcounted.test.d.ts.map +1 -0
  25. package/ts/refcounted.test.js +39 -0
  26. package/ts/refcounted.test.js.map +1 -0
  27. package/ts/uri.d.ts +16 -1
  28. package/ts/uri.d.ts.map +1 -1
  29. package/ts/uri.js +21 -9
  30. package/ts/uri.js.map +1 -1
  31. package/ts/uri.test.js +28 -0
  32. package/ts/uri.test.js.map +1 -1
  33. package/ts/utils/stripper.d.ts +3 -0
  34. package/ts/utils/stripper.d.ts.map +1 -0
  35. package/ts/utils/stripper.js +56 -0
  36. package/ts/utils/stripper.js.map +1 -0
  37. package/ts/utils/stripper.test.d.ts +2 -0
  38. package/ts/utils/stripper.test.d.ts.map +1 -0
  39. package/ts/utils/stripper.test.js +97 -0
  40. package/ts/utils/stripper.test.js.map +1 -0
  41. package/src/base-sys-abstraction.test.ts +0 -95
  42. package/src/bin2text.test.ts +0 -59
  43. package/src/crypto.test.ts +0 -15
  44. package/src/future.test.ts +0 -32
  45. package/src/logger.test.ts +0 -1132
  46. package/src/resolve-once.test.ts +0 -321
  47. package/src/result.test.ts +0 -102
  48. package/src/sys-env.test.ts +0 -53
  49. package/src/tracer.test.ts +0 -314
  50. package/src/uri.test.ts +0 -155
package/src/uri.ts CHANGED
@@ -2,6 +2,23 @@ import { exception2Result, Result } from "./result.js";
2
2
 
3
3
  type NullOrUndef = null | undefined;
4
4
 
5
+ export interface URIObject {
6
+ readonly style: "host" | "path";
7
+ readonly protocol: string;
8
+ readonly pathname: string;
9
+ readonly searchParams: Record<string, string>;
10
+ }
11
+
12
+ export interface PathURIObject extends URIObject {
13
+ readonly style: "path";
14
+ }
15
+
16
+ export interface HostURIObject extends URIObject {
17
+ readonly style: "host";
18
+ readonly hostname: string;
19
+ readonly port: string;
20
+ }
21
+
5
22
  function falsy2undef<T>(value: T | NullOrUndef): T | undefined {
6
23
  return value === undefined || value === null ? undefined : value;
7
24
  }
@@ -47,7 +64,7 @@ export class MutableURL extends URL {
47
64
  constructor(urlStr: string) {
48
65
  super("defect://does.not.exist");
49
66
  const partedURL = urlStr.split(":");
50
- this._hasHostpart = protocols.has(partedURL[0]);
67
+ this._hasHostpart = hasHostPartProtocols.has(partedURL[0]);
51
68
  let hostPartUrl = ["http", ...partedURL.slice(1)].join(":");
52
69
  if (!this._hasHostpart) {
53
70
  const pathname = hostPartUrl.replace(/http:\/\/[/]*/, "").replace(/[#?].*$/, "");
@@ -76,7 +93,7 @@ export class MutableURL extends URL {
76
93
  get host(): string {
77
94
  if (!this._hasHostpart) {
78
95
  throw new Error(
79
- `you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(protocols.keys()))}`,
96
+ `you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`,
80
97
  );
81
98
  }
82
99
  return this._sysURL.host;
@@ -84,28 +101,28 @@ export class MutableURL extends URL {
84
101
 
85
102
  get port(): string {
86
103
  if (!this._hasHostpart) {
87
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
104
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
88
105
  }
89
106
  return this._sysURL.port;
90
107
  }
91
108
 
92
109
  set port(p: string) {
93
110
  if (!this._hasHostpart) {
94
- throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
111
+ throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
95
112
  }
96
113
  this._sysURL.port = p;
97
114
  }
98
115
 
99
116
  get hostname(): string {
100
117
  if (!this._hasHostpart) {
101
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
118
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
102
119
  }
103
120
  return this._sysURL.hostname;
104
121
  }
105
122
 
106
123
  set hostname(h: string) {
107
124
  if (!this._hasHostpart) {
108
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
125
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
109
126
  }
110
127
  this._sysURL.hostname = h;
111
128
  }
@@ -290,15 +307,15 @@ export class BuildURI {
290
307
 
291
308
  export type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
292
309
 
293
- export const protocols: Set<string> = new Set<string>(["http", "https", "ws", "wss"]);
310
+ export const hasHostPartProtocols: Set<string> = new Set<string>(["http", "https", "ws", "wss"]);
294
311
 
295
312
  // non mutable URL Implementation
296
313
  export class URI {
297
314
  static protocolHasHostpart(protocol: string): () => void {
298
315
  protocol = protocol.replace(/:$/, "");
299
- protocols.add(protocol);
316
+ hasHostPartProtocols.add(protocol);
300
317
  return () => {
301
- protocols.delete(protocol);
318
+ hasHostPartProtocols.delete(protocol);
302
319
  };
303
320
  }
304
321
 
@@ -418,4 +435,21 @@ export class URI {
418
435
  toJSON(): string {
419
436
  return this.toString();
420
437
  }
438
+ asObj(): HostURIObject | PathURIObject {
439
+ const pathURI: PathURIObject = {
440
+ style: "path",
441
+ protocol: this.protocol,
442
+ pathname: this.pathname,
443
+ searchParams: Object.fromEntries(this.getParams),
444
+ };
445
+ if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
446
+ return {
447
+ ...pathURI,
448
+ style: "host",
449
+ hostname: this.hostname,
450
+ port: this.port,
451
+ } as HostURIObject;
452
+ }
453
+ return pathURI;
454
+ }
421
455
  }
@@ -0,0 +1,59 @@
1
+ export type StripCommand = string | RegExp;
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ export function stripper<T>(strip: StripCommand | StripCommand[], obj: T): Record<string, any> {
4
+ const strips = Array.isArray(strip) ? strip : [strip];
5
+ const restrips = strips.map((s) => {
6
+ if (typeof s === "string") {
7
+ const escaped = s.replace(/[-\\[\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g, "\\$&");
8
+ return new RegExp(`^${escaped}$`);
9
+ }
10
+ return s;
11
+ });
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ return localStripper(undefined, restrips, obj) as Record<string, any>;
14
+ }
15
+
16
+ function localStripper<T>(path: string | undefined, restrips: RegExp[], obj: T): unknown {
17
+ if (typeof obj !== "object" || obj === null) {
18
+ return obj;
19
+ }
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ const ret = { ...obj } as Record<string, any>;
22
+ const matcher = (key: string, nextPath: string): boolean => {
23
+ for (const re of restrips) {
24
+ if (re.test(key) || re.test(nextPath)) {
25
+ return true;
26
+ }
27
+ }
28
+ return false;
29
+ };
30
+ for (const key in ret) {
31
+ if (Object.prototype.hasOwnProperty.call(ret, key)) {
32
+ let nextPath: string;
33
+ if (path) {
34
+ nextPath = [path, key].join(".");
35
+ } else {
36
+ nextPath = key;
37
+ }
38
+ if (matcher(key, nextPath)) {
39
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
40
+ delete ret[key];
41
+ continue;
42
+ }
43
+ if (typeof ret[key] === "object") {
44
+ if (Array.isArray(ret[key])) {
45
+ ret[key] = ret[key].reduce((acc, v, i) => {
46
+ const toDelete = matcher(key, `${nextPath}[${i}]`);
47
+ if (!toDelete) {
48
+ acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
49
+ }
50
+ return acc;
51
+ }, []);
52
+ } else {
53
+ ret[key] = localStripper(nextPath, restrips, ret[key]);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ return ret;
59
+ }
package/ts/index.d.ts CHANGED
@@ -19,5 +19,6 @@ export * from "./crypto.js";
19
19
  export * from "./base-sys-abstraction.js";
20
20
  export * from "./bin2text.js";
21
21
  export * from "./version.js";
22
+ export * from "./refcounted.js";
22
23
  export * as utils from "./utils/index.js";
23
24
  //# sourceMappingURL=index.d.ts.map
package/ts/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
package/ts/index.js CHANGED
@@ -19,5 +19,6 @@ export * from "./crypto.js";
19
19
  export * from "./base-sys-abstraction.js";
20
20
  export * from "./bin2text.js";
21
21
  export * from "./version.js";
22
+ export * from "./refcounted.js";
22
23
  export * as utils from "./utils/index.js";
23
24
  //# sourceMappingURL=index.js.map
package/ts/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
@@ -42,15 +42,11 @@ describe("node_sys", () => {
42
42
  let fnExec;
43
43
  let execHandler = "tsx src/test/test-exit-handler.ts";
44
44
  beforeAll(async () => {
45
+ const { exec } = await import("node:child_process");
46
+ fnExec = exec;
45
47
  if (runtimeFn().isDeno) {
46
- const { exec } = await import("child_process");
47
- fnExec = exec;
48
48
  execHandler = "deno run --allow-net --allow-read --allow-run --unstable-sloppy-imports src/test/test-exit-handler.ts";
49
49
  }
50
- else {
51
- const { exec } = await import("child_process");
52
- fnExec = exec;
53
- }
54
50
  });
55
51
  it("just-exit", () => {
56
52
  return new Promise((done) => {
@@ -1 +1 @@
1
- {"version":3,"file":"node-sys-abstraction.test.js","sourceRoot":"","sources":["../../../src/node/node-sys-abstraction.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,SAAS,WAAW,CAAC,OAAe,EAAE,IAAY,EAAE,IAAgB;IAClE,OAAO,CAAC,GAAyB,EAAE,MAAuB,EAAE,MAAuB,EAAQ,EAAE;QAC3F,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,MAAM;iBACf,QAAQ,EAAE;iBACV,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,OAAO,GAAG,CAAC;YACb,CAAC,CAAC;iBACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACX,OAAO,GAAG,CAAC,GAAG,CAAC;gBACf,OAAO,GAAG,CAAC;YACb,CAAC,CAAC,CAAC;YACL,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;gBAClB;oBACE,IAAI,EAAE,IAAI;iBACX;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,iBAAiB;iBACvB;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,iBAAiB;iBACvB;aACF,C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O,CAAO,CAAC,IAAI,EAAE,EAAE;gBAChC,MAAM,CAAC,GAAG,WAAW,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function wrapRefcounted<T, M extends string>(t: T, method: M): T;
2
+ //# sourceMappingURL=refcounted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refcounted.d.ts","sourceRoot":"","sources":["../../src/refcounted.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAiBtE"}
@@ -0,0 +1,19 @@
1
+ export function wrapRefcounted(t, method) {
2
+ const my = t;
3
+ my.__refcounted = (my.__refcounted || 0) + 1;
4
+ if (my.__refcounted === 1) {
5
+ my.__unrefcounted = my[method];
6
+ const mRec = my;
7
+ mRec[method] = function () {
8
+ this.__refcounted--;
9
+ if (this.__refcounted === 0) {
10
+ this.__unrefcounted();
11
+ }
12
+ if (this.__refcounted < 0) {
13
+ throw new Error("already closed");
14
+ }
15
+ };
16
+ }
17
+ return t;
18
+ }
19
+ //# sourceMappingURL=refcounted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refcounted.js","sourceRoot":"","sources":["../../src/refcounted.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,cAAc,CAAsB,CAAI,EAAE,MAAS;IACjE,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,EAAE,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;QAC1B,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,EAAgC,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG;YACb,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=refcounted.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refcounted.test.d.ts","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { wrapRefcounted } from "./refcounted.js";
2
+ class RealInstance {
3
+ constructor(x) {
4
+ this.isOpen = true;
5
+ this.x = x;
6
+ }
7
+ wurst() {
8
+ return this.x++;
9
+ }
10
+ close() {
11
+ if (!this.isOpen) {
12
+ throw new Error("already closed");
13
+ }
14
+ this.isOpen = false;
15
+ }
16
+ }
17
+ it("simple", () => {
18
+ const obj = wrapRefcounted(new RealInstance(42), "close");
19
+ expect(obj.wurst()).toBe(42);
20
+ obj.close();
21
+ expect(() => obj.close()).toThrowError("already closed");
22
+ });
23
+ it("nested", () => {
24
+ const ri = new RealInstance(42);
25
+ const obj1 = wrapRefcounted(ri, "close");
26
+ const obj2 = wrapRefcounted(ri, "close");
27
+ expect(obj1).toBe(obj2);
28
+ expect(obj1.wurst()).toBe(42);
29
+ expect(obj2.wurst()).toBe(43);
30
+ obj2.close();
31
+ expect(obj2.isOpen).toBe(true);
32
+ expect(obj2.wurst()).toBe(44);
33
+ expect(obj1.wurst()).toBe(45);
34
+ obj1.close();
35
+ expect(obj1.wurst()).toBe(46);
36
+ expect(obj2.isOpen).toBe(false);
37
+ expect(() => obj2.close()).toThrowError("already closed");
38
+ });
39
+ //# sourceMappingURL=refcounted.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refcounted.test.js","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,YAAY;IAGhB,YAAY,CAAS;QADrB,WAAM,GAAG,IAAI,CAAC;QAEZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;IAClB,CAAC;IACD,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAED,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IAChB,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7B,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IAChB,MAAM,EAAE,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
package/ts/uri.d.ts CHANGED
@@ -1,5 +1,19 @@
1
1
  import { Result } from "./result.js";
2
2
  type NullOrUndef = null | undefined;
3
+ export interface URIObject {
4
+ readonly style: "host" | "path";
5
+ readonly protocol: string;
6
+ readonly pathname: string;
7
+ readonly searchParams: Record<string, string>;
8
+ }
9
+ export interface PathURIObject extends URIObject {
10
+ readonly style: "path";
11
+ }
12
+ export interface HostURIObject extends URIObject {
13
+ readonly style: "host";
14
+ readonly hostname: string;
15
+ readonly port: string;
16
+ }
3
17
  export declare function isURL(value: unknown): value is URL;
4
18
  export declare class MutableURL extends URL {
5
19
  private readonly _sysURL;
@@ -40,7 +54,7 @@ export declare class BuildURI {
40
54
  URI(): URI;
41
55
  }
42
56
  export type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
43
- export declare const protocols: Set<string>;
57
+ export declare const hasHostPartProtocols: Set<string>;
44
58
  export declare class URI {
45
59
  static protocolHasHostpart(protocol: string): () => void;
46
60
  static merge(into: CoerceURI, from: CoerceURI, defaultProtocol?: string): URI;
@@ -62,6 +76,7 @@ export declare class URI {
62
76
  asURL(): URL;
63
77
  toString(): string;
64
78
  toJSON(): string;
79
+ asObj(): HostURIObject | PathURIObject;
65
80
  }
66
81
  export {};
67
82
  //# sourceMappingURL=uri.d.ts.map
package/ts/uri.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../../src/uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;AAsBpC,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,GAAG,CAQlD;AAID,qBAAa,UAAW,SAAQ,GAAG;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAM;IAG9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAU;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,MAAM,EAAE,MAAM;IAyB1B,KAAK,IAAI,UAAU;IAInB,IAAI,IAAI,IAAI,MAAM,CAOjB;IAED,IAAI,IAAI,IAAI,MA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Q,EAAE,MAAM,GAAG,MAAM,IAAI;IASxD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,SAAU,GAAG,GAAG;IAe9E,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,GAAG;IAWvC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,SAAU,GAAG,GAAG;IAIlE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,SAAU,GAAG,MAAM,CAAC,GAAG,CAAC;IAIhF,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,OAAO;IAIP,KAAK,IAAI,QAAQ;IAIjB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAMD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAUD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAMrB;IAUD,IAAI,SAAS,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAE1C;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAG9B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC,KAAK,IAAI,GAAG;IAIZ,KAAK,IAAI,GAAG;IAMZ,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,MAAM;IAGhB,KAAK,IAAI,aAAa,GAAG,aAAa;CAiBvC"}
package/ts/uri.js CHANGED
@@ -29,7 +29,7 @@ export class MutableURL extends URL {
29
29
  constructor(urlStr) {
30
30
  super("defect://does.not.exist");
31
31
  const partedURL = urlStr.split(":");
32
- this._hasHostpart = protocols.has(partedURL[0]);
32
+ this._hasHostpart = hasHostPartProtocols.has(partedURL[0]);
33
33
  let hostPartUrl = ["http", ...partedURL.slice(1)].join(":");
34
34
  if (!this._hasHostpart) {
35
35
  const pathname = hostPartUrl.replace(/http:\/\/[/]*/, "").replace(/[#?].*$/, "");
@@ -57,31 +57,31 @@ export class MutableURL extends URL {
57
57
  }
58
58
  get host() {
59
59
  if (!this._hasHostpart) {
60
- throw new Error(`you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(protocols.keys()))}`);
60
+ throw new Error(`you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
61
61
  }
62
62
  return this._sysURL.host;
63
63
  }
64
64
  get port() {
65
65
  if (!this._hasHostpart) {
66
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
66
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
67
67
  }
68
68
  return this._sysURL.port;
69
69
  }
70
70
  set port(p) {
71
71
  if (!this._hasHostpart) {
72
- throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
72
+ throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
73
73
  }
74
74
  this._sysURL.port = p;
75
75
  }
76
76
  get hostname() {
77
77
  if (!this._hasHostpart) {
78
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
78
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
79
79
  }
80
80
  return this._sysURL.hostname;
81
81
  }
82
82
  set hostname(h) {
83
83
  if (!this._hasHostpart) {
84
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
84
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
85
85
  }
86
86
  this._sysURL.hostname = h;
87
87
  }
@@ -202,13 +202,13 @@ export class BuildURI {
202
202
  return URI.from(this._url);
203
203
  }
204
204
  }
205
- export const protocols = new Set(["http", "https", "ws", "wss"]);
205
+ export const hasHostPartProtocols = new Set(["http", "https", "ws", "wss"]);
206
206
  export class URI {
207
207
  static protocolHasHostpart(protocol) {
208
208
  protocol = protocol.replace(/:$/, "");
209
- protocols.add(protocol);
209
+ hasHostPartProtocols.add(protocol);
210
210
  return () => {
211
- protocols.delete(protocol);
211
+ hasHostPartProtocols.delete(protocol);
212
212
  };
213
213
  }
214
214
  static merge(into, from, defaultProtocol = "file:") {
@@ -279,5 +279,17 @@ export class URI {
279
279
  toJSON() {
280
280
  return this.toString();
281
281
  }
282
+ asObj() {
283
+ const pathURI = {
284
+ style: "path",
285
+ protocol: this.protocol,
286
+ pathname: this.pathname,
287
+ searchParams: Object.fromEntries(this.getParams),
288
+ };
289
+ if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
290
+ return Object.assign(Object.assign({}, pathURI), { style: "host", hostname: this.hostname, port: this.port });
291
+ }
292
+ return pathURI;
293
+ }
282
294
  }
283
295
  //# sourceMappingURL=uri.js.map
package/ts/uri.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uri.js","sourceRoot":"","sources":["../../src/uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAU,MAAM,aAAa,CAAC;AAIvD,SAAS,WAAW,CAAI,KAAsB;IAC5C,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAiB,EAAE,eAAuB;IAC3E,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,UAAU,CAAC,GAAG,eAAe,IAAI,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QAE7B,CAAC;QAA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@@ -115,5 +115,33 @@ describe("URI", () => {
115
115
  expect(withHostpartNoPath.pathname).toBe("/");
116
116
  unreg();
117
117
  });
118
+ it("host uri as json with omit", () => {
119
+ const uri = URI.from("http://example.com:8000/bla/blub?name=test&store=meta&key=%40bla");
120
+ expect(uri.asObj()).toEqual({
121
+ style: "host",
122
+ protocol: "http:",
123
+ hostname: "example.com",
124
+ port: "8000",
125
+ pathname: "/bla/blub",
126
+ searchParams: {
127
+ store: "meta",
128
+ name: "test",
129
+ key: "@bla",
130
+ },
131
+ });
132
+ });
133
+ it("path uri as json with omit", () => {
134
+ const uri = URI.from("blix://bla/blub?name=test&store=meta&key=%40bla");
135
+ expect(uri.asObj()).toEqual({
136
+ style: "path",
137
+ protocol: "blix:",
138
+ pathname: "bla/blub",
139
+ searchParams: {
140
+ store: "meta",
141
+ name: "test",
142
+ key: "@bla",
143
+ },
144
+ });
145
+ });
118
146
  });
119
147
  //# sourceMappingURL=uri.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uri.test.js","sourceRoot":"","sources":["../../src/uri.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE5D,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,GAAa,CAAC;IAClB,UAAU,CAAC,GAAG,EAAE;QACd,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC1D,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;QAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3D,CAAC,CAAC,CAA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KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YAC1B,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE;gBACZ,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,MAAM;aACZ;SACe,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YAC1B,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,UAAU;YACpB,YAAY,EAAE;gBACZ,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,MAAM;aACZ;SACe,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type StripCommand = string | RegExp;
2
+ export declare function stripper<T>(strip: StripCommand | StripCommand[], obj: T): Record<string, any>;
3
+ //# sourceMappingURL=stripper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripper.d.ts","sourceRoot":"","sources":["../../../src/utils/stripper.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAW7F"}
@@ -0,0 +1,56 @@
1
+ export function stripper(strip, obj) {
2
+ const strips = Array.isArray(strip) ? strip : [strip];
3
+ const restrips = strips.map((s) => {
4
+ if (typeof s === "string") {
5
+ const escaped = s.replace(/[-\\[\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g, "\\$&");
6
+ return new RegExp(`^${escaped}$`);
7
+ }
8
+ return s;
9
+ });
10
+ return localStripper(undefined, restrips, obj);
11
+ }
12
+ function localStripper(path, restrips, obj) {
13
+ if (typeof obj !== "object" || obj === null) {
14
+ return obj;
15
+ }
16
+ const ret = Object.assign({}, obj);
17
+ const matcher = (key, nextPath) => {
18
+ for (const re of restrips) {
19
+ if (re.test(key) || re.test(nextPath)) {
20
+ return true;
21
+ }
22
+ }
23
+ return false;
24
+ };
25
+ for (const key in ret) {
26
+ if (Object.prototype.hasOwnProperty.call(ret, key)) {
27
+ let nextPath;
28
+ if (path) {
29
+ nextPath = [path, key].join(".");
30
+ }
31
+ else {
32
+ nextPath = key;
33
+ }
34
+ if (matcher(key, nextPath)) {
35
+ delete ret[key];
36
+ continue;
37
+ }
38
+ if (typeof ret[key] === "object") {
39
+ if (Array.isArray(ret[key])) {
40
+ ret[key] = ret[key].reduce((acc, v, i) => {
41
+ const toDelete = matcher(key, `${nextPath}[${i}]`);
42
+ if (!toDelete) {
43
+ acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
44
+ }
45
+ return acc;
46
+ }, []);
47
+ }
48
+ else {
49
+ ret[key] = localStripper(nextPath, restrips, ret[key]);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ return ret;
55
+ }
56
+ //# sourceMappingURL=stripper.js.map