@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.
- package/build/src/pathResolver.d.ts +8 -4
- package/build/src/pathResolver.js +26 -13
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
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.
|
|
9
|
+
exports.PathHelper = void 0;
|
|
4
10
|
const const_1 = require("./const");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 };
|