@adviser/cement 0.2.31 → 0.2.32

Sign up to get free protection for your applications and to get access to all the features.
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
  }
@@ -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,6 +251,9 @@ 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
  }
@@ -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,7 +338,7 @@ export class URI {
279
338
  toJSON() {
280
339
  return this.toString();
281
340
  }
282
- asObj() {
341
+ asObj(...strips) {
283
342
  const pathURI = {
284
343
  style: "path",
285
344
  protocol: this.protocol,
@@ -287,9 +346,9 @@ export class URI {
287
346
  searchParams: Object.fromEntries(this.getParams),
288
347
  };
289
348
  if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
290
- return Object.assign(Object.assign({}, pathURI), { style: "host", hostname: this.hostname, port: this.port });
349
+ return stripper(strips, Object.assign(Object.assign({}, pathURI), { style: "host", hostname: this.hostname, port: this.port }));
291
350
  }
292
- return pathURI;
351
+ return stripper(strips, pathURI);
293
352
  }
294
353
  }
295
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;AAqBvD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I,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,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
@@ -143,5 +143,62 @@ describe("URI", () => {
143
143
  },
144
144
  });
145
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
+ });
146
203
  });
147
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,EAAiB,UAAU,EAAiB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE1F,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,CAAC;IAEH,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACf,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;QAClB,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC/B,MAAM,CAAC,GAAG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,CAAC;QAClF,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7E,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,CAClC,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,CAAC,GAAG,IAAc,EAAE,EAAE,CAAC,mBAAmB,IAAI,CAAC,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"}
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"}
package/ts/refcounted.js DELETED
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=refcounted.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refcounted.test.d.ts","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
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
@@ -1 +0,0 @@
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,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