1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const constants_1 = require("../../constants");
|
4 | const shared_utils_1 = require("../../utils/shared.utils");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | function Optional() {
|
19 | return (target, key, index) => {
|
20 | if (!shared_utils_1.isUndefined(index)) {
|
21 | const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
|
22 | Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
|
23 | return;
|
24 | }
|
25 | const properties = Reflect.getMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, target.constructor) || [];
|
26 | Reflect.defineMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, [...properties, key], target.constructor);
|
27 | };
|
28 | }
|
29 | exports.Optional = Optional;
|