@livequery/nestjs 1.0.27 → 1.0.28

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.
@@ -1,4 +1,8 @@
1
- export declare const pathResolver: (target: Function, method: string) => {
2
- ref: string;
3
- schema_ref: string;
4
- };
1
+ export declare class PathHelper {
2
+ #private;
3
+ static livequeryPathExtractor(path: string): {
4
+ ref: string;
5
+ schema_ref: string;
6
+ };
7
+ static nestjsPathResolver(target: Function, method: string): string[];
8
+ }
@@ -1,16 +1,29 @@
1
1
  "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _a, _PathHelper_toArray;
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathResolver = void 0;
9
+ exports.PathHelper = void 0;
4
10
  const const_1 = require("./const");
5
- const pathResolver = (target, method) => {
6
- var _a;
7
- const collection_path = Reflect.getMetadata('path', target) || '';
8
- const method_path = Reflect.getMetadata('path', target.prototype[method]) || '';
9
- const refs = (_a = `${collection_path}/${method_path}`
10
- .replaceAll(':', '')
11
- .split(const_1.LIVEQUERY_MAGIC_KEY)) === null || _a === void 0 ? void 0 : _a[1].split('/').filter(s => s.length > 0);
12
- const ref = refs.join('/');
13
- const schema_ref = refs.filter((_, i) => i % 2 == 0).join('/');
14
- return { ref, schema_ref };
15
- };
16
- exports.pathResolver = pathResolver;
11
+ class PathHelper {
12
+ static livequeryPathExtractor(path) {
13
+ var _b, _c, _d, _e;
14
+ const refs = (_e = (_d = (_c = (_b = path === null || path === void 0 ? void 0 : path.replaceAll(':', '')) === null || _b === void 0 ? void 0 : _b.split(const_1.LIVEQUERY_MAGIC_KEY)) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.split('/')) === null || _e === void 0 ? void 0 : _e.filter(s => s.length > 0);
15
+ if (!refs)
16
+ return null;
17
+ const ref = refs.join('/');
18
+ const schema_ref = refs.filter((_, i) => i % 2 == 0).join('/');
19
+ return { ref, schema_ref };
20
+ }
21
+ static nestjsPathResolver(target, method) {
22
+ const collection_paths = __classPrivateFieldGet(this, _a, "f", _PathHelper_toArray).call(this, Reflect.getMetadata('path', target) || '');
23
+ const method_paths = __classPrivateFieldGet(this, _a, "f", _PathHelper_toArray).call(this, Reflect.getMetadata('path', target.prototype[method]) || '');
24
+ return collection_paths.map(collection_path => method_paths.map(method_path => `${collection_path}/${method_path}`)).flat(2);
25
+ }
26
+ }
27
+ exports.PathHelper = PathHelper;
28
+ _a = PathHelper;
29
+ _PathHelper_toArray = { value: (a) => typeof a == 'string' ? [a] : a };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "url": "git@github.com:livequery/nestjs.git"
5
5
  },
6
- "version": "1.0.27",
6
+ "version": "1.0.28",
7
7
  "description": "",
8
8
  "main": "build/index.js",
9
9
  "types": "build/index.d.ts",