@tsed/core 7.29.1 → 7.31.0-rc.1

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,50 +0,0 @@
1
- import { uniq } from "./uniq.js";
2
- /**
3
- * Create a complete and iterable trap.
4
- * @param self
5
- * @param options
6
- * @ignore
7
- */
8
- export function proxyDelegation(self, options = {}) {
9
- const { handlers = {}, remove, ownKeys } = options;
10
- const get = options.getter || ((target, propertyKey) => target.get(propertyKey));
11
- const set = options.setter || ((target, propertyKey, value) => !!target.set(propertyKey, value));
12
- const itsOwnProp = (target, p) => Reflect.has(target, p) || typeof p === "symbol";
13
- return new Proxy(self, {
14
- getOwnPropertyDescriptor(target, p) {
15
- return Reflect.getOwnPropertyDescriptor(target, p);
16
- },
17
- has(target, p) {
18
- if (itsOwnProp(target, p)) {
19
- return Reflect.has(target, p);
20
- }
21
- return get(target, p) !== undefined;
22
- },
23
- get(target, p, receiver) {
24
- if (itsOwnProp(target, p)) {
25
- return Reflect.get(target, p, receiver);
26
- }
27
- return get(target, p);
28
- },
29
- set(target, p, value, receiver) {
30
- if (itsOwnProp(target, p)) {
31
- return Reflect.set(target, p, value, receiver);
32
- }
33
- return !!set(target, p, value, receiver);
34
- },
35
- deleteProperty(target, p) {
36
- if (itsOwnProp(target, p) || !remove) {
37
- return Reflect.deleteProperty(target, p);
38
- }
39
- return remove(target, p);
40
- },
41
- defineProperty(target, p, attributes) {
42
- return Reflect.defineProperty(target, p, attributes);
43
- },
44
- ownKeys(target) {
45
- return uniq(Reflect.ownKeys(target).concat((ownKeys && ownKeys(target)) || []));
46
- },
47
- ...handlers
48
- });
49
- }
50
- //# sourceMappingURL=proxyDelegation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxyDelegation.js","sourceRoot":"","sources":["../../../src/utils/proxyDelegation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AA4B5B;;;;;GAK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G,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACxB,CAAC;QAED,GAAG,CAAC,MAAW,EAAE,CAAc,EAAE,KAAU,EAAE,QAAa;YACxD,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;gBACzB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;aAChD;YAED,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC;QAED,cAAc,CAAC,MAAW,EAAE,CAAc;YACxC,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;gBACpC,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;aAC1C;YAED,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,cAAc,CAAC,MAAW,EAAE,CAAc,EAAE,UAA8B;YACxE,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,CAAC,MAAW;YACjB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;QACD,GAAG,QAAQ;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * @ignore
3
- */
4
- export type ProxyDelegationGetter<T = any> = (target: T, property: PropertyKey) => any | undefined;
5
- /**
6
- * @ignore
7
- */
8
- export type ProxyDelegationRemove<T = any> = (target: T, property: PropertyKey) => any;
9
- /**
10
- * @ignore
11
- */
12
- export type ProxyDelegationSetter<T = any> = (target: T, property: PropertyKey, value: any, receiver: any) => any;
13
- /**
14
- * @ignore
15
- */
16
- export type ProxyDelegationOwnKeys<T = any> = (target: T) => (string | symbol)[];
17
- /**
18
- * @ignore
19
- */
20
- export interface ProxyDelegation<T extends object> {
21
- handlers?: ProxyHandler<T>;
22
- getter?: ProxyDelegationGetter<T>;
23
- setter?: ProxyDelegationSetter<T>;
24
- remove?: ProxyDelegationRemove<T>;
25
- ownKeys?: ProxyDelegationOwnKeys<T>;
26
- }
27
- /**
28
- * Create a complete and iterable trap.
29
- * @param self
30
- * @param options
31
- * @ignore
32
- */
33
- export declare function proxyDelegation<T extends object = any>(self: any, options?: ProxyDelegation<T>): T;