@decaf-ts/decoration 0.7.0 → 0.8.0
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/README.md +1 -1
- package/dist/decoration.cjs +1 -1
- package/dist/decoration.cjs.map +1 -1
- package/dist/decoration.js +1 -1
- package/dist/decoration.js.map +1 -1
- package/lib/constants.cjs +10 -1
- package/lib/constants.d.ts +8 -0
- package/lib/constants.js.map +1 -1
- package/lib/decoration/Decoration.cjs +259 -42
- package/lib/decoration/Decoration.d.ts +19 -12
- package/lib/decoration/Decoration.js.map +1 -1
- package/lib/decorators.cjs +56 -17
- package/lib/decorators.d.ts +3 -2
- package/lib/decorators.js.map +1 -1
- package/lib/esm/constants.d.ts +8 -0
- package/lib/esm/constants.js +9 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/decoration/Decoration.d.ts +19 -12
- package/lib/esm/decoration/Decoration.js +260 -43
- package/lib/esm/decoration/Decoration.js.map +1 -1
- package/lib/esm/decorators.d.ts +3 -2
- package/lib/esm/decorators.js +55 -17
- package/lib/esm/decorators.js.map +1 -1
- package/lib/esm/index.d.ts +1 -8
- package/lib/esm/index.js +1 -10
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/metadata/Metadata.d.ts +4 -0
- package/lib/esm/metadata/Metadata.js +42 -1
- package/lib/esm/metadata/Metadata.js.map +1 -1
- package/lib/esm/metadata/types.d.ts +1 -0
- package/lib/esm/version.d.ts +9 -0
- package/lib/esm/version.js +10 -0
- package/lib/esm/version.js.map +1 -0
- package/lib/index.cjs +1 -11
- package/lib/index.d.ts +1 -8
- package/lib/index.js.map +1 -1
- package/lib/metadata/Metadata.cjs +41 -0
- package/lib/metadata/Metadata.d.ts +4 -0
- package/lib/metadata/Metadata.js.map +1 -1
- package/lib/metadata/types.d.ts +1 -0
- package/lib/version.cjs +13 -0
- package/lib/version.d.ts +9 -0
- package/lib/version.js.map +1 -0
- package/package.json +1 -1
|
@@ -2,17 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Decoration = void 0;
|
|
4
4
|
const constants_1 = require("./../constants.cjs");
|
|
5
|
+
const Metadata_1 = require("./../metadata/Metadata.cjs");
|
|
6
|
+
const decorators_1 = require("./../decorators.cjs");
|
|
5
7
|
/**
|
|
6
8
|
* @description Default resolver that returns the current default flavour.
|
|
7
9
|
* @summary Resolves the flavour for a given target by always returning the library's `DefaultFlavour` value.
|
|
8
10
|
* @param {object} target Target object being decorated.
|
|
9
11
|
* @return {string} Resolved flavour identifier.
|
|
10
|
-
* @function
|
|
12
|
+
* @function flavourResolver
|
|
11
13
|
* @memberOf module:decoration
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
function flavourResolver(target) {
|
|
16
|
+
const owner = Metadata_1.Metadata.constr(typeof target === "function" ? target : target?.constructor);
|
|
17
|
+
const meta = Metadata_1.Metadata["innerGet"](Metadata_1.Metadata.Symbol(owner), constants_1.DecorationKeys.FLAVOUR);
|
|
18
|
+
if (meta && meta !== Decoration.defaultFlavour)
|
|
19
|
+
return meta;
|
|
20
|
+
const registered = typeof Metadata_1.Metadata["registeredFlavour"] === "function"
|
|
21
|
+
? Metadata_1.Metadata.registeredFlavour(owner)
|
|
22
|
+
: undefined;
|
|
23
|
+
if (registered && registered !== Decoration.defaultFlavour)
|
|
24
|
+
return registered;
|
|
25
|
+
return meta ?? Decoration.defaultFlavour;
|
|
16
26
|
}
|
|
17
27
|
/**
|
|
18
28
|
* @description A decorator management class that handles flavoured decorators.
|
|
@@ -54,6 +64,8 @@ function defaultFlavourResolver(target) {
|
|
|
54
64
|
* F-->>C: decorated target
|
|
55
65
|
*/
|
|
56
66
|
class Decoration {
|
|
67
|
+
static { this.defaultFlavour = constants_1.DefaultFlavour; }
|
|
68
|
+
static { this.targetStates = new WeakMap(); }
|
|
57
69
|
/**
|
|
58
70
|
* @description Static map of registered decorators.
|
|
59
71
|
* @summary Stores all registered decorators organised by key and flavour.
|
|
@@ -63,10 +75,163 @@ class Decoration {
|
|
|
63
75
|
* @description Function to resolve flavour from a target.
|
|
64
76
|
* @summary Resolver function that determines the appropriate flavour for a given target.
|
|
65
77
|
*/
|
|
66
|
-
static { this.flavourResolver =
|
|
67
|
-
constructor(flavour =
|
|
78
|
+
static { this.flavourResolver = flavourResolver; }
|
|
79
|
+
constructor(flavour = Decoration.defaultFlavour) {
|
|
68
80
|
this.flavour = flavour;
|
|
69
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Register a decorator operation to be executed after class decorator runs.
|
|
84
|
+
* This solves the execution order issue: property decorators run before class decorators.
|
|
85
|
+
*
|
|
86
|
+
* @param target - The class being decorated
|
|
87
|
+
* @param callback - Function to execute once flavour is resolved
|
|
88
|
+
* @param propertyKey - Optional property key for property decorators
|
|
89
|
+
* @returns Unique key for this registration
|
|
90
|
+
*/
|
|
91
|
+
static getTargetState(owner) {
|
|
92
|
+
if (!owner) {
|
|
93
|
+
throw new Error("Invalid target provided to Decoration state tracker");
|
|
94
|
+
}
|
|
95
|
+
let state = this.targetStates.get(owner);
|
|
96
|
+
if (!state) {
|
|
97
|
+
state = { pending: [], flavour: undefined, directApply: false };
|
|
98
|
+
this.targetStates.set(owner, state);
|
|
99
|
+
}
|
|
100
|
+
return state;
|
|
101
|
+
}
|
|
102
|
+
static applyPendingEntry(entry, flavour) {
|
|
103
|
+
try {
|
|
104
|
+
const descriptorResult = entry.callback(flavour, entry.argsOverride)(entry.target, entry.propertyKey, entry.descriptor);
|
|
105
|
+
if (typeof entry.propertyKey !== "undefined" &&
|
|
106
|
+
descriptorResult &&
|
|
107
|
+
entry.target) {
|
|
108
|
+
Object.defineProperty(entry.target, entry.propertyKey, descriptorResult);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.error(`Error resolving pending decorator for ${entry.owner?.name || "anonymous"}.${String(entry.propertyKey)}`, error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
static markPending(owner) {
|
|
116
|
+
if (!owner)
|
|
117
|
+
return;
|
|
118
|
+
const state = this.getTargetState(owner);
|
|
119
|
+
state.resolved = false;
|
|
120
|
+
if (!state.flavour)
|
|
121
|
+
state.flavour = Decoration.defaultFlavour;
|
|
122
|
+
Metadata_1.Metadata.set(owner, constants_1.DecorationKeys.DECORATION, constants_1.DecorationState.PENDING);
|
|
123
|
+
}
|
|
124
|
+
static registerPendingDecorator(owner, target, callback, propertyKey, descriptor, argsOverride) {
|
|
125
|
+
const key = `${owner?.name || "anonymous"}:${String(propertyKey || "class")}:${Date.now()}:${Math.random()}`;
|
|
126
|
+
const state = this.getTargetState(owner);
|
|
127
|
+
const entry = {
|
|
128
|
+
owner,
|
|
129
|
+
target,
|
|
130
|
+
propertyKey,
|
|
131
|
+
descriptor,
|
|
132
|
+
callback,
|
|
133
|
+
argsOverride,
|
|
134
|
+
key,
|
|
135
|
+
};
|
|
136
|
+
const applyImmediately = () => {
|
|
137
|
+
const flavourToUse = state.flavour ||
|
|
138
|
+
Metadata_1.Metadata.get(owner, constants_1.DecorationKeys.FLAVOUR) ||
|
|
139
|
+
Decoration.defaultFlavour;
|
|
140
|
+
this.applyPendingEntry(entry, flavourToUse);
|
|
141
|
+
entry.lastAppliedPass = state.passId;
|
|
142
|
+
return flavourToUse;
|
|
143
|
+
};
|
|
144
|
+
if (state.directApply) {
|
|
145
|
+
const flavourToUse = applyImmediately();
|
|
146
|
+
state.flavour = flavourToUse;
|
|
147
|
+
Metadata_1.Metadata.set(owner, constants_1.DecorationKeys.DECORATION, true);
|
|
148
|
+
return key;
|
|
149
|
+
}
|
|
150
|
+
state.pending.push(entry);
|
|
151
|
+
if (state.applying) {
|
|
152
|
+
applyImmediately();
|
|
153
|
+
}
|
|
154
|
+
if (Decoration.flavourResolver !== flavourResolver) {
|
|
155
|
+
try {
|
|
156
|
+
const eagerFlavour = Decoration.flavourResolver(owner);
|
|
157
|
+
if (eagerFlavour && eagerFlavour !== Decoration.defaultFlavour) {
|
|
158
|
+
this.resolvePendingDecorators(owner, eagerFlavour);
|
|
159
|
+
return key;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// Ignore resolver errors during eager resolution attempts.
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return key;
|
|
167
|
+
}
|
|
168
|
+
static resolvePendingDecorators(target, flavour) {
|
|
169
|
+
const owner = typeof target === "function" ? target : target?.constructor || target;
|
|
170
|
+
if (!owner)
|
|
171
|
+
return;
|
|
172
|
+
const state = this.getTargetState(owner);
|
|
173
|
+
if (!state.pending.length && !flavour)
|
|
174
|
+
return;
|
|
175
|
+
const resolvedFlavour = flavour ||
|
|
176
|
+
state.flavour ||
|
|
177
|
+
Metadata_1.Metadata.get(owner, constants_1.DecorationKeys.FLAVOUR) ||
|
|
178
|
+
Decoration.defaultFlavour;
|
|
179
|
+
if (state.applying)
|
|
180
|
+
return;
|
|
181
|
+
const cursor = state.appliedCount || 0;
|
|
182
|
+
if (!flavour &&
|
|
183
|
+
state.lastAppliedFlavour === resolvedFlavour &&
|
|
184
|
+
cursor >= state.pending.length) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const shouldFinalize = Boolean(flavour && flavour !== Decoration.defaultFlavour) ||
|
|
188
|
+
state.directApply;
|
|
189
|
+
if (!state.pending.length)
|
|
190
|
+
return;
|
|
191
|
+
const currentPass = (state.passId || 0) + 1;
|
|
192
|
+
state.passId = currentPass;
|
|
193
|
+
state.applying = true;
|
|
194
|
+
try {
|
|
195
|
+
if (shouldFinalize) {
|
|
196
|
+
while (state.pending.length) {
|
|
197
|
+
const entry = state.pending.shift();
|
|
198
|
+
if (!entry)
|
|
199
|
+
continue;
|
|
200
|
+
if (entry.lastAppliedPass === currentPass)
|
|
201
|
+
continue;
|
|
202
|
+
this.applyPendingEntry(entry, resolvedFlavour);
|
|
203
|
+
entry.lastAppliedPass = currentPass;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
let index = cursor;
|
|
208
|
+
while (index < state.pending.length) {
|
|
209
|
+
const entry = state.pending[index++];
|
|
210
|
+
if (!entry)
|
|
211
|
+
continue;
|
|
212
|
+
if (entry.lastAppliedPass === currentPass)
|
|
213
|
+
continue;
|
|
214
|
+
this.applyPendingEntry(entry, resolvedFlavour);
|
|
215
|
+
entry.lastAppliedPass = currentPass;
|
|
216
|
+
}
|
|
217
|
+
state.appliedCount = state.pending.length;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
state.applying = false;
|
|
222
|
+
}
|
|
223
|
+
state.flavour = resolvedFlavour;
|
|
224
|
+
state.resolved = true;
|
|
225
|
+
state.lastAppliedFlavour = resolvedFlavour;
|
|
226
|
+
if (shouldFinalize) {
|
|
227
|
+
state.pending.length = 0;
|
|
228
|
+
state.appliedCount = 0;
|
|
229
|
+
if (resolvedFlavour !== Decoration.defaultFlavour) {
|
|
230
|
+
state.directApply = true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
Metadata_1.Metadata.set(owner, constants_1.DecorationKeys.DECORATION, true);
|
|
234
|
+
}
|
|
70
235
|
/**
|
|
71
236
|
* @description Sets the key for the decoration builder.
|
|
72
237
|
* @summary Initialises a new decoration chain with the specified key.
|
|
@@ -89,7 +254,7 @@ class Decoration {
|
|
|
89
254
|
throw new Error("key must be provided before decorators can be added");
|
|
90
255
|
if ((!decorators || !decorators.length) &&
|
|
91
256
|
!addon &&
|
|
92
|
-
this.flavour !==
|
|
257
|
+
this.flavour !== Decoration.defaultFlavour)
|
|
93
258
|
throw new Error("Must provide overrides or addons to override or extend decaf's decorators");
|
|
94
259
|
// For addon (extend) we merge with existing extras; for base (define) we replace
|
|
95
260
|
if (addon) {
|
|
@@ -104,6 +269,19 @@ class Decoration {
|
|
|
104
269
|
}
|
|
105
270
|
return this;
|
|
106
271
|
}
|
|
272
|
+
snapshotDecoratorArgs() {
|
|
273
|
+
if (!this.decorators || !this.decorators.size)
|
|
274
|
+
return undefined;
|
|
275
|
+
const overrides = {};
|
|
276
|
+
Array.from(this.decorators.values()).forEach((entry, index) => {
|
|
277
|
+
if (typeof entry === "object" &&
|
|
278
|
+
"args" in entry &&
|
|
279
|
+
Array.isArray(entry.args)) {
|
|
280
|
+
overrides[index] = [...entry.args];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return Object.keys(overrides).length ? overrides : undefined;
|
|
284
|
+
}
|
|
107
285
|
/**
|
|
108
286
|
* @description Defines the base decorators.
|
|
109
287
|
* @summary Sets the primary decorators for the current context.
|
|
@@ -150,14 +328,14 @@ class Decoration {
|
|
|
150
328
|
* A->>U: invoke decorator(target, key?, desc?)
|
|
151
329
|
* end
|
|
152
330
|
*/
|
|
153
|
-
decoratorFactory(key, f
|
|
331
|
+
decoratorFactory(key, f, overrides) {
|
|
154
332
|
function contextDecorator(target, propertyKey, descriptor) {
|
|
155
|
-
const flavour = Decoration.flavourResolver(target);
|
|
333
|
+
const flavour = f ?? Decoration.flavourResolver(target);
|
|
156
334
|
const cache = Decoration.decorators[key];
|
|
157
335
|
let decorators;
|
|
158
336
|
const extras = cache[flavour]
|
|
159
337
|
? cache[flavour].extras
|
|
160
|
-
: cache[
|
|
338
|
+
: cache[Decoration.defaultFlavour].extras;
|
|
161
339
|
if (cache &&
|
|
162
340
|
cache[flavour] &&
|
|
163
341
|
cache[flavour].decorators &&
|
|
@@ -165,11 +343,11 @@ class Decoration {
|
|
|
165
343
|
decorators = cache[flavour].decorators;
|
|
166
344
|
}
|
|
167
345
|
else {
|
|
168
|
-
decorators = cache[
|
|
346
|
+
decorators = cache[Decoration.defaultFlavour].decorators;
|
|
169
347
|
}
|
|
170
348
|
const baseDecoratorsList = [...(decorators ? decorators.values() : [])];
|
|
171
349
|
const defaultDecoratorsList = [
|
|
172
|
-
...(cache[
|
|
350
|
+
...(cache[Decoration.defaultFlavour]?.decorators || new Set()).values(),
|
|
173
351
|
];
|
|
174
352
|
const baseArgsByIndex = baseDecoratorsList.reduce((accum, entry, index) => {
|
|
175
353
|
if (typeof entry === "object" &&
|
|
@@ -192,28 +370,46 @@ class Decoration {
|
|
|
192
370
|
...(extras ? extras.values() : []),
|
|
193
371
|
];
|
|
194
372
|
const baseLength = baseDecoratorsList.length;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
373
|
+
const argsOverrides = overrides || {};
|
|
374
|
+
let currentTarget = target;
|
|
375
|
+
let currentDescriptor = descriptor;
|
|
376
|
+
toApply.forEach((d, index) => {
|
|
377
|
+
let decoratorFn;
|
|
378
|
+
if (typeof d === "object") {
|
|
379
|
+
const entry = d;
|
|
380
|
+
const candidateIndex = index < baseLength ? index : 0;
|
|
381
|
+
const overrideArgs = index < baseLength ? argsOverrides[candidateIndex] : undefined;
|
|
382
|
+
const args = overrideArgs ||
|
|
383
|
+
("args" in entry && Array.isArray(entry.args)
|
|
201
384
|
? entry.args
|
|
202
385
|
: (baseArgsByIndex[candidateIndex] ??
|
|
203
386
|
defaultArgsByIndex[candidateIndex] ??
|
|
204
387
|
defaultArgsByIndex[0] ??
|
|
205
|
-
[]);
|
|
206
|
-
|
|
388
|
+
[]));
|
|
389
|
+
decoratorFn = entry.decorator(...args);
|
|
390
|
+
}
|
|
391
|
+
else if (typeof d === "function") {
|
|
392
|
+
decoratorFn = d;
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
throw new Error(`Unexpected decorator type: ${typeof d}`);
|
|
396
|
+
}
|
|
397
|
+
const result = decoratorFn(typeof propertyKey === "undefined" ? currentTarget : target, propertyKey, currentDescriptor);
|
|
398
|
+
if (typeof propertyKey === "undefined") {
|
|
399
|
+
if (typeof result === "function") {
|
|
400
|
+
currentTarget = result;
|
|
207
401
|
}
|
|
208
|
-
case "function":
|
|
209
|
-
return d(target, propertyKey, descriptor);
|
|
210
|
-
default:
|
|
211
|
-
throw new Error(`Unexpected decorator type: ${typeof d}`);
|
|
212
402
|
}
|
|
213
|
-
|
|
403
|
+
else if (typeof result !== "undefined") {
|
|
404
|
+
currentDescriptor = result;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
return typeof propertyKey === "undefined"
|
|
408
|
+
? currentTarget
|
|
409
|
+
: currentDescriptor;
|
|
214
410
|
}
|
|
215
411
|
Object.defineProperty(contextDecorator, "name", {
|
|
216
|
-
value: [f, key].join("_decorator_for_"),
|
|
412
|
+
value: [f || "dynamic", key].join("_decorator_for_"),
|
|
217
413
|
writable: false,
|
|
218
414
|
});
|
|
219
415
|
return contextDecorator;
|
|
@@ -226,16 +422,46 @@ class Decoration {
|
|
|
226
422
|
apply() {
|
|
227
423
|
if (!this.key)
|
|
228
424
|
throw new Error("No key provided for the decoration builder");
|
|
425
|
+
const key = this.key;
|
|
229
426
|
const existingDecorators = Decoration.decorators[this.key]?.[this.flavour]?.decorators;
|
|
230
427
|
const decoratorsToRegister = this.decorators || existingDecorators || new Set();
|
|
231
|
-
// If this builder explicitly configured decorators (via define), we want
|
|
232
|
-
// to replace previously registered base decorators. Previously we cleared
|
|
233
|
-
// extras when define() was called — restore the behaviour where define()
|
|
234
|
-
// does not remove previously registered extras unless extras were
|
|
235
|
-
// explicitly supplied.
|
|
236
428
|
const extrasToRegister = typeof this.extras !== "undefined" ? this.extras : undefined;
|
|
237
429
|
Decoration.register(this.key, this.flavour, decoratorsToRegister, extrasToRegister);
|
|
238
|
-
|
|
430
|
+
const wrapper = (target, propertyKey, descriptor) => {
|
|
431
|
+
const isMember = typeof propertyKey !== "undefined";
|
|
432
|
+
const owner = typeof target === "function" ? target : target?.constructor || target;
|
|
433
|
+
if (owner && isMember) {
|
|
434
|
+
const currentFlavour = Metadata_1.Metadata["innerGet"](Metadata_1.Metadata.Symbol(owner), constants_1.DecorationKeys.FLAVOUR);
|
|
435
|
+
if (!currentFlavour)
|
|
436
|
+
(0, decorators_1.uses)(Decoration.defaultFlavour)(owner);
|
|
437
|
+
const argsOverride = this.snapshotDecoratorArgs();
|
|
438
|
+
Decoration.registerPendingDecorator(owner, target, (resolvedFlavour) => {
|
|
439
|
+
return this.decoratorFactory(key, resolvedFlavour, argsOverride);
|
|
440
|
+
}, propertyKey, descriptor, argsOverride);
|
|
441
|
+
Decoration.resolvePendingDecorators(owner);
|
|
442
|
+
if (propertyKey && !descriptor) {
|
|
443
|
+
(0, decorators_1.prop)()(owner, propertyKey); // auto tag as a property
|
|
444
|
+
}
|
|
445
|
+
if (propertyKey && descriptor) {
|
|
446
|
+
// TODO this probably needs refining. under some compilation processes, the descriptor can exit on a prop
|
|
447
|
+
(0, decorators_1.method)()(owner, propertyKey, descriptor); // auto tag as a method
|
|
448
|
+
}
|
|
449
|
+
return descriptor;
|
|
450
|
+
}
|
|
451
|
+
const flavourHint = this.flavour === Decoration.defaultFlavour ? undefined : this.flavour;
|
|
452
|
+
return this.decoratorFactory(key, flavourHint)(target, propertyKey, descriptor);
|
|
453
|
+
};
|
|
454
|
+
try {
|
|
455
|
+
Object.defineProperty(wrapper, "name", {
|
|
456
|
+
value: [this.flavour, key].join("_decorator_for_"),
|
|
457
|
+
writable: false,
|
|
458
|
+
});
|
|
459
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
460
|
+
}
|
|
461
|
+
catch (e) {
|
|
462
|
+
// Ignore environments that forbid redefining function name
|
|
463
|
+
}
|
|
464
|
+
return wrapper;
|
|
239
465
|
}
|
|
240
466
|
/**
|
|
241
467
|
* @description Registers decorators for a specific key and flavour.
|
|
@@ -258,21 +484,12 @@ class Decoration {
|
|
|
258
484
|
Decoration.decorators[key] = {};
|
|
259
485
|
if (!Decoration.decorators[key][flavour])
|
|
260
486
|
Decoration.decorators[key][flavour] = {};
|
|
261
|
-
// Always set decorators. Only overwrite extras when an explicit value is
|
|
262
|
-
// provided so that calling define() without extras does not accidentally
|
|
263
|
-
// clear previously registered extras.
|
|
264
487
|
Decoration.decorators[key][flavour].decorators = decorators;
|
|
265
488
|
if (typeof extras !== "undefined") {
|
|
266
489
|
Decoration.decorators[key][flavour].extras = extras;
|
|
267
490
|
}
|
|
268
491
|
}
|
|
269
|
-
|
|
270
|
-
* @description Sets the global flavour resolver.
|
|
271
|
-
* @summary Configures the function used to determine decorator flavours.
|
|
272
|
-
* @param {FlavourResolver} resolver Function to resolve flavours.
|
|
273
|
-
* @return {void}
|
|
274
|
-
*/
|
|
275
|
-
static setFlavourResolver(resolver) {
|
|
492
|
+
static setResolver(resolver) {
|
|
276
493
|
Decoration.flavourResolver = resolver;
|
|
277
494
|
}
|
|
278
495
|
/**
|
|
@@ -76,6 +76,8 @@ export type ExtendDecoratorData = DecoratorTypes | Omit<DecoratorFactoryArgs, "a
|
|
|
76
76
|
*/
|
|
77
77
|
export declare class Decoration implements IDecorationBuilder {
|
|
78
78
|
private flavour;
|
|
79
|
+
static defaultFlavour: string;
|
|
80
|
+
private static targetStates;
|
|
79
81
|
/**
|
|
80
82
|
* @description Static map of registered decorators.
|
|
81
83
|
* @summary Stores all registered decorators organised by key and flavour.
|
|
@@ -99,6 +101,20 @@ export declare class Decoration implements IDecorationBuilder {
|
|
|
99
101
|
*/
|
|
100
102
|
private key?;
|
|
101
103
|
constructor(flavour?: string);
|
|
104
|
+
/**
|
|
105
|
+
* Register a decorator operation to be executed after class decorator runs.
|
|
106
|
+
* This solves the execution order issue: property decorators run before class decorators.
|
|
107
|
+
*
|
|
108
|
+
* @param target - The class being decorated
|
|
109
|
+
* @param callback - Function to execute once flavour is resolved
|
|
110
|
+
* @param propertyKey - Optional property key for property decorators
|
|
111
|
+
* @returns Unique key for this registration
|
|
112
|
+
*/
|
|
113
|
+
private static getTargetState;
|
|
114
|
+
private static applyPendingEntry;
|
|
115
|
+
protected static markPending(owner: any): void;
|
|
116
|
+
protected static registerPendingDecorator(owner: any, target: any, callback: (flavour: string, overrides?: Record<number, any[]>) => PropertyDecorator | MethodDecorator, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<any> | number, argsOverride?: Record<number, any[]>): string;
|
|
117
|
+
protected static resolvePendingDecorators(target: any, flavour?: string): void;
|
|
102
118
|
/**
|
|
103
119
|
* @description Sets the key for the decoration builder.
|
|
104
120
|
* @summary Initialises a new decoration chain with the specified key.
|
|
@@ -114,6 +130,7 @@ export declare class Decoration implements IDecorationBuilder {
|
|
|
114
130
|
* @return {this} Current instance for chaining.
|
|
115
131
|
*/
|
|
116
132
|
private decorate;
|
|
133
|
+
private snapshotDecoratorArgs;
|
|
117
134
|
/**
|
|
118
135
|
* @description Defines the base decorators.
|
|
119
136
|
* @summary Sets the primary decorators for the current context.
|
|
@@ -150,11 +167,7 @@ export declare class Decoration implements IDecorationBuilder {
|
|
|
150
167
|
* A->>U: invoke decorator(target, key?, desc?)
|
|
151
168
|
* end
|
|
152
169
|
*/
|
|
153
|
-
protected decoratorFactory(key: string, f?: string): (target: object, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) =>
|
|
154
|
-
target: object;
|
|
155
|
-
propertyKey: any;
|
|
156
|
-
descriptor: TypedPropertyDescriptor<any> | undefined;
|
|
157
|
-
};
|
|
170
|
+
protected decoratorFactory(key: string, f?: string, overrides?: Record<number, any[]>): (target: object, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => object | undefined;
|
|
158
171
|
/**
|
|
159
172
|
* @description Creates the final decorator function.
|
|
160
173
|
* @summary Builds and returns the decorator factory function.
|
|
@@ -171,13 +184,7 @@ export declare class Decoration implements IDecorationBuilder {
|
|
|
171
184
|
* @return {void}
|
|
172
185
|
*/
|
|
173
186
|
private static register;
|
|
174
|
-
|
|
175
|
-
* @description Sets the global flavour resolver.
|
|
176
|
-
* @summary Configures the function used to determine decorator flavours.
|
|
177
|
-
* @param {FlavourResolver} resolver Function to resolve flavours.
|
|
178
|
-
* @return {void}
|
|
179
|
-
*/
|
|
180
|
-
static setFlavourResolver(resolver: FlavourResolver): void;
|
|
187
|
+
static setResolver(resolver: FlavourResolver): void;
|
|
181
188
|
/**
|
|
182
189
|
* @description Convenience static entry to start a decoration builder.
|
|
183
190
|
* @summary Creates a new Decoration instance and initiates the builder chain with the provided key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decoration.js","sourceRoot":"","sources":["../../src/decoration/Decoration.ts"],"names":[],"mappings":";;;AAQA,kDAA8C;AAE9C;;;;;;;GAOG;AACH,6DAA6D;AAC7D,SAAS,sBAAsB,CAAC,MAAc;IAC5C,OAAO,0BAAc,CAAC;AACxB,CAAC;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,UAAU;IACrB;;;OAGG;aACY,eAAU,GASrB,EAAE,CAAC;IAEP;;;OAGG;aACY,oBAAe,GAAoB,sBAAsB,CAAC;IAiBzE,YAAoB,UAAkB,0BAAc;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAExD;;;;;OAKG;IACH,GAAG,CAAC,GAAW;QACb,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACK,QAAQ,CACd,QAAiB,KAAK,EACtB,GAAG,UAAiC;QAEpC,IAAI,CAAC,IAAI,CAAC,GAAG;YACX,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,IACE,CAAC,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACnC,CAAC,KAAK;YACN,IAAI,CAAC,OAAO,KAAK,0BAAc;YAE/B,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;QACJ,iFAAiF;QACjF,IAAI,KAAK,EAAE,CAAC;YACT,IAAY,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC;gBAC7B,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;gBACtC,GAAG,UAAU;aACd,CAAC,CA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,QAAQ,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,GAAW;QACpB,OAAO,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,OAAe;QAChC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;;AA5mBH,gCA6mBC"}
|
package/lib/decorators.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.metadata = metadata;
|
|
4
4
|
exports.metadataArray = metadataArray;
|
|
5
|
+
exports.uses = uses;
|
|
5
6
|
exports.prop = prop;
|
|
6
7
|
exports.param = param;
|
|
7
8
|
exports.paramMetadata = paramMetadata;
|
|
@@ -26,7 +27,14 @@ function metadata(key, value) {
|
|
|
26
27
|
return function metadata(model, prop,
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
29
|
descriptor) {
|
|
29
|
-
|
|
30
|
+
let targetModel = model;
|
|
31
|
+
if (prop) {
|
|
32
|
+
targetModel =
|
|
33
|
+
typeof model === "function"
|
|
34
|
+
? model
|
|
35
|
+
: model.constructor || model;
|
|
36
|
+
}
|
|
37
|
+
Metadata_1.Metadata.set(targetModel, key, value);
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
40
|
function metadataArray(key, ...data) {
|
|
@@ -37,6 +45,46 @@ function metadataArray(key, ...data) {
|
|
|
37
45
|
return apply(...arr)(target, propertyKey, descriptor);
|
|
38
46
|
};
|
|
39
47
|
}
|
|
48
|
+
function manageFlavourRMetadata(object, flavour) {
|
|
49
|
+
const canonical = Metadata_1.Metadata.constr(object);
|
|
50
|
+
const flav = Metadata_1.Metadata["innerGet"](Metadata_1.Metadata.Symbol(object), constants_1.DecorationKeys.FLAVOUR) || Decoration_1.Decoration.defaultFlavour;
|
|
51
|
+
const old = Metadata_1.Metadata["innerGet"](Symbol.for(constants_1.DecorationKeys.FLAVOUR), flav) || [];
|
|
52
|
+
const filtered = old.filter((o) => {
|
|
53
|
+
return Metadata_1.Metadata.constr(o) !== canonical;
|
|
54
|
+
});
|
|
55
|
+
Metadata_1.Metadata.set(constants_1.DecorationKeys.FLAVOUR, flav, filtered);
|
|
56
|
+
const current = new Set(Metadata_1.Metadata["innerGet"](Symbol.for(constants_1.DecorationKeys.FLAVOUR), flavour) || []);
|
|
57
|
+
current.add(object);
|
|
58
|
+
Metadata_1.Metadata.set(constants_1.DecorationKeys.FLAVOUR, flavour, [...current]);
|
|
59
|
+
}
|
|
60
|
+
function uses(flavour) {
|
|
61
|
+
return (object) => {
|
|
62
|
+
const constr = Metadata_1.Metadata.constr(object);
|
|
63
|
+
manageFlavourRMetadata(object, flavour);
|
|
64
|
+
Metadata_1.Metadata.set(constr, constants_1.DecorationKeys.FLAVOUR, flavour);
|
|
65
|
+
if (flavour !== Decoration_1.Decoration.defaultFlavour) {
|
|
66
|
+
Decoration_1.Decoration["resolvePendingDecorators"](constr, flavour);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
let resolved;
|
|
70
|
+
try {
|
|
71
|
+
resolved = Decoration_1.Decoration["flavourResolver"]
|
|
72
|
+
? Decoration_1.Decoration["flavourResolver"](constr)
|
|
73
|
+
: undefined;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
resolved = undefined;
|
|
77
|
+
}
|
|
78
|
+
if (resolved && resolved !== Decoration_1.Decoration.defaultFlavour) {
|
|
79
|
+
Decoration_1.Decoration["resolvePendingDecorators"](constr, resolved);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
Decoration_1.Decoration["markPending"](constr);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return object;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
40
88
|
/**
|
|
41
89
|
* @description Captures and stores a property's design type.
|
|
42
90
|
* @summary Decorator factory that reads the reflected `design:type` for a property and registers it in the metadata store under the properties map.
|
|
@@ -45,18 +93,12 @@ function metadataArray(key, ...data) {
|
|
|
45
93
|
* @category Property Decorators
|
|
46
94
|
*/
|
|
47
95
|
function prop() {
|
|
48
|
-
function innerProp() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return Decoration_1.Decoration.for(constants_1.DecorationKeys.PROPERTIES)
|
|
55
|
-
.define({
|
|
56
|
-
decorator: innerProp,
|
|
57
|
-
args: [],
|
|
58
|
-
})
|
|
59
|
-
.apply();
|
|
96
|
+
// function innerProp() {
|
|
97
|
+
return function innerProp(model, prop) {
|
|
98
|
+
const metadataTarget = typeof model === "function" ? model.prototype : model;
|
|
99
|
+
const designType = Reflect.getOwnMetadata(constants_1.DecorationKeys.DESIGN_TYPE, metadataTarget, prop);
|
|
100
|
+
return metadata(Metadata_1.Metadata.key(constants_1.DecorationKeys.PROPERTIES, prop), designType)(model, prop);
|
|
101
|
+
};
|
|
60
102
|
}
|
|
61
103
|
/**
|
|
62
104
|
* @description Captures a single parameter type for the decorated method.
|
|
@@ -193,10 +235,7 @@ function methodMetadata(key, value) {
|
|
|
193
235
|
function description(desc) {
|
|
194
236
|
function innerDescription(desc) {
|
|
195
237
|
return function innerDescription(original, prop, descriptor) {
|
|
196
|
-
return metadata(
|
|
197
|
-
constants_1.DecorationKeys.DESCRIPTION,
|
|
198
|
-
prop ? prop.toString() : constants_1.DecorationKeys.CLASS,
|
|
199
|
-
].join(Metadata_1.Metadata.splitter), desc)(original, prop, descriptor);
|
|
238
|
+
return metadata(Metadata_1.Metadata.key(constants_1.DecorationKeys.DESCRIPTION, prop ? prop.toString() : constants_1.DecorationKeys.CLASS), desc)(original, prop, descriptor);
|
|
200
239
|
};
|
|
201
240
|
}
|
|
202
241
|
return Decoration_1.Decoration.for(constants_1.DecorationKeys.DESCRIPTION)
|
package/lib/decorators.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function metadata(key: string, value: any): (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
|
|
11
11
|
export declare function metadataArray(key: string, ...data: any[]): (target: any, propertyKey?: any, descriptor?: any) => void;
|
|
12
|
+
export declare function uses(flavour: string): (object: any) => any;
|
|
12
13
|
/**
|
|
13
14
|
* @description Captures and stores a property's design type.
|
|
14
15
|
* @summary Decorator factory that reads the reflected `design:type` for a property and registers it in the metadata store under the properties map.
|
|
@@ -16,7 +17,7 @@ export declare function metadataArray(key: string, ...data: any[]): (target: any
|
|
|
16
17
|
* @function prop
|
|
17
18
|
* @category Property Decorators
|
|
18
19
|
*/
|
|
19
|
-
export declare function prop(): (
|
|
20
|
+
export declare function prop(): (model: object, prop?: any) => void;
|
|
20
21
|
/**
|
|
21
22
|
* @description Captures a single parameter type for the decorated method.
|
|
22
23
|
* @summary Decorator factory that ensures the method metadata is initialised and stores the reflected parameter constructor at the provided index.
|
|
@@ -35,7 +36,7 @@ export declare function prop(): (target: any, propertyKey?: any, descriptor?: Ty
|
|
|
35
36
|
* P->>M: set(methods.key.index, constructor)
|
|
36
37
|
* P-->>U: parameter recorded
|
|
37
38
|
*/
|
|
38
|
-
export declare function param(): (model: object, prop
|
|
39
|
+
export declare function param(): (model: object, prop?: any, index?: number) => void;
|
|
39
40
|
/**
|
|
40
41
|
* @description Extends a parameter decorator with additional metadata.
|
|
41
42
|
* @summary Applies the default `param()` decorator and augments the stored metadata with an arbitrary key/value pair.
|