@adviser/cement 0.2.30 → 0.2.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/index.cjs +142 -36
  2. package/index.cjs.map +1 -1
  3. package/index.d.cts +26 -4
  4. package/index.d.ts +26 -4
  5. package/index.js +140 -33
  6. package/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/index.ts +0 -1
  9. package/src/jsr.json +1 -1
  10. package/src/logger-impl.ts +3 -1
  11. package/src/logger.ts +1 -0
  12. package/src/uri.ts +117 -9
  13. package/src/utils/stripper.ts +59 -0
  14. package/ts/index.d.ts +0 -1
  15. package/ts/index.d.ts.map +1 -1
  16. package/ts/index.js +0 -1
  17. package/ts/index.js.map +1 -1
  18. package/ts/logger-impl.d.ts.map +1 -1
  19. package/ts/logger-impl.js +3 -1
  20. package/ts/logger-impl.js.map +1 -1
  21. package/ts/logger.d.ts +1 -0
  22. package/ts/logger.d.ts.map +1 -1
  23. package/ts/logger.test.js +14 -0
  24. package/ts/logger.test.js.map +1 -1
  25. package/ts/uri.d.ts +23 -1
  26. package/ts/uri.d.ts.map +1 -1
  27. package/ts/uri.js +81 -10
  28. package/ts/uri.js.map +1 -1
  29. package/ts/uri.test.js +85 -0
  30. package/ts/uri.test.js.map +1 -1
  31. package/ts/utils/stripper.d.ts +3 -0
  32. package/ts/utils/stripper.d.ts.map +1 -0
  33. package/ts/utils/stripper.js +56 -0
  34. package/ts/utils/stripper.js.map +1 -0
  35. package/ts/utils/stripper.test.d.ts +2 -0
  36. package/ts/utils/stripper.test.d.ts.map +1 -0
  37. package/ts/utils/stripper.test.js +97 -0
  38. package/ts/utils/stripper.test.js.map +1 -0
  39. package/src/refcounted.ts +0 -23
  40. package/ts/refcounted.d.ts +0 -2
  41. package/ts/refcounted.d.ts.map +0 -1
  42. package/ts/refcounted.js +0 -19
  43. package/ts/refcounted.js.map +0 -1
  44. package/ts/refcounted.test.d.ts +0 -2
  45. package/ts/refcounted.test.d.ts.map +0 -1
  46. package/ts/refcounted.test.js +0 -39
  47. package/ts/refcounted.test.js.map +0 -1
package/ts/uri.d.ts CHANGED
@@ -1,5 +1,20 @@
1
1
  import { Result } from "./result.js";
2
+ import { StripCommand } from "./utils/stripper.js";
2
3
  type NullOrUndef = null | undefined;
4
+ export interface URIObject {
5
+ readonly style: "host" | "path";
6
+ readonly protocol: string;
7
+ readonly pathname: string;
8
+ readonly searchParams: Record<string, string>;
9
+ }
10
+ export interface PathURIObject extends URIObject {
11
+ readonly style: "path";
12
+ }
13
+ export interface HostURIObject extends URIObject {
14
+ readonly style: "host";
15
+ readonly hostname: string;
16
+ readonly port: string;
17
+ }
3
18
  export declare function isURL(value: unknown): value is URL;
4
19
  export declare class MutableURL extends URL {
5
20
  private readonly _sysURL;
@@ -21,6 +36,7 @@ export declare class MutableURL extends URL {
21
36
  get searchParams(): URLSearchParams;
22
37
  toString(): string;
23
38
  }
39
+ type keysParam = (string | ((...keys: string[]) => string))[];
24
40
  export declare class BuildURI {
25
41
  _url: MutableURL;
26
42
  private constructor();
@@ -30,17 +46,21 @@ export declare class BuildURI {
30
46
  hostname(h: string): BuildURI;
31
47
  protocol(p: string): BuildURI;
32
48
  pathname(p: string): BuildURI;
49
+ appendRelative(p: CoerceURI): BuildURI;
33
50
  delParam(key: string): BuildURI;
34
51
  defParam(key: string, str: string): BuildURI;
35
52
  setParam(key: string, str: string): BuildURI;
36
53
  hasParam(key: string): boolean;
37
54
  getParam(key: string): string | undefined;
55
+ getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
56
+ getParamsResult(...keys: keysParam): Result<Record<string, string>>;
38
57
  toString(): string;
39
58
  toJSON(): string;
59
+ asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
40
60
  URI(): URI;
41
61
  }
42
62
  export type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
43
- export declare const protocols: Set<string>;
63
+ export declare const hasHostPartProtocols: Set<string>;
44
64
  export declare class URI {
45
65
  static protocolHasHostpart(protocol: string): () => void;
46
66
  static merge(into: CoerceURI, from: CoerceURI, defaultProtocol?: string): URI;
@@ -58,10 +78,12 @@ export declare class URI {
58
78
  get getParams(): Iterable<[string, string]>;
59
79
  hasParam(key: string): boolean;
60
80
  getParam(key: string): string | undefined;
81
+ getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
61
82
  clone(): URI;
62
83
  asURL(): URL;
63
84
  toString(): string;
64
85
  toJSON(): string;
86
+ asObj(...strips: StripCommand[]): HostURIObject | PathURIObject;
65
87
  }
66
88
  export {};
67
89
  //# 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,MAAM,CAKjB;IAED,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,EAKjB;IAED,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,EAKrB;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,EAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,Q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C;IAI5E,KAAK,IAAI,GAAG;IAIZ,KAAK,IAAI,GAAG;IAMZ,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,MAAM;IAGhB,KAAK,CAAC,GAAG,MAAM,EAAE,YAAY,EAAE,GAAG,aAAa,GAAG,aAAa;CAiBhE"}
package/ts/uri.js CHANGED
@@ -1,4 +1,5 @@
1
- import { exception2Result } from "./result.js";
1
+ import { exception2Result, Result } from "./result.js";
2
+ import { stripper } from "./utils/stripper.js";
2
3
  function falsy2undef(value) {
3
4
  return value === undefined || value === null ? undefined : value;
4
5
  }
@@ -29,7 +30,7 @@ export class MutableURL extends URL {
29
30
  constructor(urlStr) {
30
31
  super("defect://does.not.exist");
31
32
  const partedURL = urlStr.split(":");
32
- this._hasHostpart = protocols.has(partedURL[0]);
33
+ this._hasHostpart = hasHostPartProtocols.has(partedURL[0]);
33
34
  let hostPartUrl = ["http", ...partedURL.slice(1)].join(":");
34
35
  if (!this._hasHostpart) {
35
36
  const pathname = hostPartUrl.replace(/http:\/\/[/]*/, "").replace(/[#?].*$/, "");
@@ -57,31 +58,31 @@ export class MutableURL extends URL {
57
58
  }
58
59
  get host() {
59
60
  if (!this._hasHostpart) {
60
- throw new Error(`you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(protocols.keys()))}`);
61
+ throw new Error(`you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
61
62
  }
62
63
  return this._sysURL.host;
63
64
  }
64
65
  get port() {
65
66
  if (!this._hasHostpart) {
66
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
67
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
67
68
  }
68
69
  return this._sysURL.port;
69
70
  }
70
71
  set port(p) {
71
72
  if (!this._hasHostpart) {
72
- throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
73
+ throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
73
74
  }
74
75
  this._sysURL.port = p;
75
76
  }
76
77
  get hostname() {
77
78
  if (!this._hasHostpart) {
78
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
79
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
79
80
  }
80
81
  return this._sysURL.hostname;
81
82
  }
82
83
  set hostname(h) {
83
84
  if (!this._hasHostpart) {
84
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(protocols.keys()))}`);
85
+ throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
85
86
  }
86
87
  this._sysURL.hostname = h;
87
88
  }
@@ -144,6 +145,37 @@ function from(fac, strURLUri, defaultProtocol) {
144
145
  throw new Error(`Invalid argument: ${typeof strURLUri}`);
145
146
  }
146
147
  }
148
+ function getParamResult(key, val, msgFn = (key) => {
149
+ return `missing parameter: ${key}`;
150
+ }) {
151
+ if (val === undefined) {
152
+ return Result.Err(msgFn(key));
153
+ }
154
+ return Result.Ok(val);
155
+ }
156
+ function getParamsResult(keys, getParam) {
157
+ const keyStrs = keys.flat().filter((k) => typeof k === "string");
158
+ const msgFn = keys.find((k) => typeof k === "function") ||
159
+ ((...keys) => {
160
+ const msg = keys.join(",");
161
+ return `missing parameters: ${msg}`;
162
+ });
163
+ const errors = [];
164
+ const result = {};
165
+ for (const key of keyStrs) {
166
+ const val = getParam.getParam(key);
167
+ if (val === undefined) {
168
+ errors.push(key);
169
+ }
170
+ else {
171
+ result[key] = val;
172
+ }
173
+ }
174
+ if (errors.length) {
175
+ return Result.Err(msgFn(...errors));
176
+ }
177
+ return Result.Ok(result);
178
+ }
147
179
  export class BuildURI {
148
180
  constructor(url) {
149
181
  this._url = url;
@@ -171,6 +203,21 @@ export class BuildURI {
171
203
  this._url.pathname = p;
172
204
  return this;
173
205
  }
206
+ appendRelative(p) {
207
+ const url = URI.from(p);
208
+ let pathname = url.pathname;
209
+ if (url.pathname === "/") {
210
+ pathname = "";
211
+ }
212
+ else if (!pathname.startsWith("/")) {
213
+ pathname = `/${pathname}`;
214
+ }
215
+ this.pathname(this._url.pathname + pathname);
216
+ for (const [key, value] of url.getParams) {
217
+ this.setParam(key, value);
218
+ }
219
+ return this;
220
+ }
174
221
  delParam(key) {
175
222
  this._url.searchParams.delete(key);
176
223
  return this;
@@ -191,6 +238,12 @@ export class BuildURI {
191
238
  getParam(key) {
192
239
  return falsy2undef(this._url.searchParams.get(key));
193
240
  }
241
+ getParamResult(key, msgFn) {
242
+ return getParamResult(key, this.getParam(key), msgFn);
243
+ }
244
+ getParamsResult(...keys) {
245
+ return getParamsResult(keys, this);
246
+ }
194
247
  toString() {
195
248
  this._url.searchParams.sort();
196
249
  return this._url.toString();
@@ -198,17 +251,20 @@ export class BuildURI {
198
251
  toJSON() {
199
252
  return this.toString();
200
253
  }
254
+ asObj(...strips) {
255
+ return this.URI().asObj(...strips);
256
+ }
201
257
  URI() {
202
258
  return URI.from(this._url);
203
259
  }
204
260
  }
205
- export const protocols = new Set(["http", "https", "ws", "wss"]);
261
+ export const hasHostPartProtocols = new Set(["http", "https", "ws", "wss"]);
206
262
  export class URI {
207
263
  static protocolHasHostpart(protocol) {
208
264
  protocol = protocol.replace(/:$/, "");
209
- protocols.add(protocol);
265
+ hasHostPartProtocols.add(protocol);
210
266
  return () => {
211
- protocols.delete(protocol);
267
+ hasHostPartProtocols.delete(protocol);
212
268
  };
213
269
  }
214
270
  static merge(into, from, defaultProtocol = "file:") {
@@ -267,6 +323,9 @@ export class URI {
267
323
  getParam(key) {
268
324
  return falsy2undef(this._url.searchParams.get(key));
269
325
  }
326
+ getParamResult(key, msgFn) {
327
+ return getParamResult(key, this.getParam(key), msgFn);
328
+ }
270
329
  clone() {
271
330
  return new URI(this._url);
272
331
  }
@@ -279,5 +338,17 @@ export class URI {
279
338
  toJSON() {
280
339
  return this.toString();
281
340
  }
341
+ asObj(...strips) {
342
+ const pathURI = {
343
+ style: "path",
344
+ protocol: this.protocol,
345
+ pathname: this.pathname,
346
+ searchParams: Object.fromEntries(this.getParams),
347
+ };
348
+ if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
349
+ return stripper(strips, Object.assign(Object.assign({}, pathURI), { style: "host", hostname: this.hostname, port: this.port }));
350
+ }
351
+ return stripper(strips, pathURI);
352
+ }
282
353
  }
283
354
  //# 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;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,IAAI,UAAU,CAAC,GAAG,eAAe,KAAK,GAAG,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,OAAO,CACL,KAAK,YAAY,GAAG;QACpB,CAAC,CAAC,CAAC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AC,CAAC,CAAC;IACtD,CAAC;IAED,cAAc,CAAC,GAAW,EAAE,KAA+B;QACzD,OAAO,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,KAAK;QACH,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK;QAGH,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAoB,CAAC;IAC7C,CAAC;IAED,QAAQ;QAEN,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,GAAG,MAAsB;QAC7B,MAAM,OAAO,GAAkB;YAC7B,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC;SACjD,CAAC;QACF,IAAI,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;YAC9D,OAAO,QAAQ,CAAC,MAAM,kCACjB,OAAO,KACV,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,IACE,CAAC;QACtB,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAkB,CAAC;IACpD,CAAC;CACF"}
package/ts/uri.test.js CHANGED
@@ -115,5 +115,90 @@ 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
+ });
146
+ it("URI getParamResult", () => {
147
+ const uri = URI.from("blix://bla/blub?name=test&store=meta&key=%40bla");
148
+ expect(uri.getParamResult("key").Ok()).toBe("@bla");
149
+ expect(uri.getParamResult("key2", (k) => `${k} not found`).Err().message).toBe("key2 not found");
150
+ expect(uri.getParamResult("key2").Err().message).toBe("missing parameter: key2");
151
+ });
152
+ it("BuildURI getParamResult", () => {
153
+ const uri = BuildURI.from("blix://bla/blub?name=test&store=meta&key=%40bla");
154
+ expect(uri.getParamResult("key").Ok()).toBe("@bla");
155
+ expect(uri.getParamResult("key2", (k) => `${k} not found`).Err().message).toBe("key2 not found");
156
+ expect(uri.getParamResult("key2").Err().message).toBe("missing parameter: key2");
157
+ });
158
+ it("URI append Params Path", () => {
159
+ const uri = BuildURI.from("blix://bla/blub?name=test&store=meta&key=%40bla").appendRelative("/murks/blub?name=append&work=hard");
160
+ expect(uri.asObj()).toEqual({
161
+ pathname: "bla/blub/murks/blub",
162
+ protocol: "blix:",
163
+ searchParams: {
164
+ key: "@bla",
165
+ name: "append",
166
+ store: "meta",
167
+ work: "hard",
168
+ },
169
+ style: "path",
170
+ });
171
+ });
172
+ it("URI append Params Host", () => {
173
+ const uri = BuildURI.from("http://host/bla/blub?name=test&store=meta&key=%40bla").appendRelative("/murks/blub?name=append&work=hard");
174
+ expect(uri.asObj()).toEqual({
175
+ pathname: "/bla/blub/murks/blub",
176
+ hostname: "host",
177
+ port: "",
178
+ protocol: "http:",
179
+ searchParams: {
180
+ key: "@bla",
181
+ name: "append",
182
+ store: "meta",
183
+ work: "hard",
184
+ },
185
+ style: "host",
186
+ });
187
+ });
188
+ it("URI getParamsResult ok", () => {
189
+ const rParams = BuildURI.from("http://host/bla/blub?name=test&store=meta&key=%40bla").getParamsResult("key", "name", "store");
190
+ expect(rParams.Ok()).toEqual({
191
+ key: "@bla",
192
+ name: "test",
193
+ store: "meta",
194
+ });
195
+ });
196
+ it("URI getParamsResult fail", () => {
197
+ const url = BuildURI.from("http://host/bla/blub?name=test&store=meta&key=%40bla");
198
+ const rParams = url.getParamsResult("key", "name", "store", "key2", "name2");
199
+ expect(rParams.Err().message).toEqual(`missing parameters: key2,name2`);
200
+ const rParams2 = url.getParamsResult("key", "name", "store", "key2", "name2", (...keys) => `keys not found: ${keys.join(",")}`);
201
+ expect(rParams2.Err().message).toEqual(`keys not found: key2,name2`);
202
+ });
118
203
  });
119
204
  //# 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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AAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3D,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACvE,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripper.js","sourceRoot":"","sources":["../../../src/utils/stripper.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,QAAQ,CAAI,KAAoC,EAAE,GAAM;IACtE,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,iDAAiD,EAAE,MAAM,CAAC,CAAC;YACrF,OAAO,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAwB,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAI,IAAwB,EAAE,QAAkB,EAAE,GAAM;IAC5E,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO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,IAAI,CAAC,QAAQ,EAAE,CAAC;4BACd,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,QAAQ,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;wBAC5D,CAAC;wBACD,OAAO,GAAG,CAAC;oBACb,CAAC,EAAE,EAAE,CAAC,CAAC;gBACT,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stripper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripper.test.d.ts","sourceRoot":"","sources":["../../../src/utils/stripper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,97 @@
1
+ import { stripper } from "./stripper.js";
2
+ const toStrip = {
3
+ main: "main",
4
+ Main: "main",
5
+ nested: {
6
+ main: "main",
7
+ Main: "main",
8
+ nested: {
9
+ main: "main",
10
+ Main: "main",
11
+ },
12
+ },
13
+ arrays: [
14
+ "main",
15
+ "Main",
16
+ {
17
+ main: "main",
18
+ Main: "main",
19
+ nested: {
20
+ main: "main",
21
+ Main: "main",
22
+ },
23
+ },
24
+ ],
25
+ };
26
+ it("empty stripper", () => {
27
+ expect(stripper("", toStrip)).toEqual(toStrip);
28
+ });
29
+ it("array concrete stripper", () => {
30
+ expect(stripper(["main", "Main", "blub"], toStrip)).toEqual({
31
+ nested: {
32
+ nested: {},
33
+ },
34
+ arrays: [
35
+ "main",
36
+ "Main",
37
+ {
38
+ nested: {},
39
+ },
40
+ ],
41
+ });
42
+ });
43
+ it("array simple regex concrete stripper", () => {
44
+ expect(stripper([/ain$/, "blub"], toStrip)).toEqual({
45
+ nested: {
46
+ nested: {},
47
+ },
48
+ arrays: [
49
+ "main",
50
+ "Main",
51
+ {
52
+ nested: {},
53
+ },
54
+ ],
55
+ });
56
+ });
57
+ it("array regex concrete stripper", () => {
58
+ expect(stripper([/Main/, "blub"], toStrip)).toEqual({
59
+ main: "main",
60
+ nested: {
61
+ main: "main",
62
+ nested: {
63
+ main: "main",
64
+ },
65
+ },
66
+ arrays: [
67
+ "main",
68
+ "Main",
69
+ {
70
+ main: "main",
71
+ nested: {
72
+ main: "main",
73
+ },
74
+ },
75
+ ],
76
+ });
77
+ });
78
+ it("array dotted concrete stripper", () => {
79
+ expect(stripper(["nested.main", "blub", "nested.nested.Main", "arrays[1]", "arrays[2].main", /arrays.2..nested..ain/], toStrip)).toEqual({
80
+ main: "main",
81
+ Main: "main",
82
+ nested: {
83
+ Main: "main",
84
+ nested: {
85
+ main: "main",
86
+ },
87
+ },
88
+ arrays: [
89
+ "main",
90
+ {
91
+ Main: "main",
92
+ nested: {},
93
+ },
94
+ ],
95
+ });
96
+ });
97
+ //# sourceMappingURL=stripper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripper.test.js","sourceRoot":"","sources":["../../../src/utils/stripper.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;SACb;KACF;IACD,MAAM,EAAE;QACN,MAAM;QACN,MAAM;QACN;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM;aACb;SACF;KACF;CACF,CAAC;AACF,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE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;IACxC,MAAM,CACJ,QAAQ,CAAC,CAAC,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,gBAAgB,EAAE,uBAAuB,CAAC,EAAE,OAAO,CAAC,CACzH,CAAC,OAAO,CAAC;QACR,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;SACF;QACD,MAAM,EAAE;YACN,MAAM;YACN;gBACE,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,EAEP;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/src/refcounted.ts DELETED
@@ -1,23 +0,0 @@
1
- type Refcounted<T, M extends string> = T & {
2
- __refcounted: number;
3
- __unrefcounted: () => void;
4
- } & Record<M, () => void>;
5
-
6
- export function wrapRefcounted<T, M extends string>(t: T, method: M): T {
7
- const my = t as Refcounted<T, M>;
8
- my.__refcounted = (my.__refcounted || 0) + 1;
9
- if (my.__refcounted === 1) {
10
- my.__unrefcounted = my[method];
11
- const mRec = my as Record<string, () => void>;
12
- mRec[method] = function (this: Refcounted<T, M>): void {
13
- this.__refcounted--;
14
- if (this.__refcounted === 0) {
15
- this.__unrefcounted();
16
- }
17
- if (this.__refcounted < 0) {
18
- throw new Error("already closed");
19
- }
20
- };
21
- }
22
- return t;
23
- }
@@ -1,2 +0,0 @@
1
- export declare function wrapRefcounted<T, M extends string>(t: T, method: M): T;
2
- //# sourceMappingURL=refcounted.d.ts.map
@@ -1 +0,0 @@
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"}