1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.registerAs = void 0;
|
4 | const __1 = require("..");
|
5 | const config_constants_1 = require("../config.constants");
|
6 | const get_config_token_util_1 = require("./get-config-token.util");
|
7 |
|
8 |
|
9 |
|
10 | function registerAs(token, configFactory) {
|
11 | const defineProperty = (key, value) => {
|
12 | Object.defineProperty(configFactory, key, {
|
13 | configurable: false,
|
14 | enumerable: false,
|
15 | value,
|
16 | writable: false,
|
17 | });
|
18 | };
|
19 | defineProperty(config_constants_1.PARTIAL_CONFIGURATION_KEY, token);
|
20 | defineProperty(config_constants_1.PARTIAL_CONFIGURATION_PROPNAME, (0, get_config_token_util_1.getConfigToken)(token));
|
21 | defineProperty(config_constants_1.AS_PROVIDER_METHOD_KEY, () => ({
|
22 | imports: [__1.ConfigModule.forFeature(configFactory)],
|
23 | useFactory: (config) => config,
|
24 | inject: [(0, get_config_token_util_1.getConfigToken)(token)],
|
25 | }));
|
26 | return configFactory;
|
27 | }
|
28 | exports.registerAs = registerAs;
|