@digital-alchemy/core 0.1.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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/automation/automation.module.d.ts +61 -0
- package/dist/automation/automation.module.js +70 -0
- package/dist/automation/automation.module.js.map +1 -0
- package/dist/automation/extensions/aggressive-scenes.extension.d.ts +22 -0
- package/dist/automation/extensions/aggressive-scenes.extension.js +125 -0
- package/dist/automation/extensions/aggressive-scenes.extension.js.map +1 -0
- package/dist/automation/extensions/circadian.extension.d.ts +11 -0
- package/dist/automation/extensions/circadian.extension.js +87 -0
- package/dist/automation/extensions/circadian.extension.js.map +1 -0
- package/dist/automation/extensions/index.d.ts +7 -0
- package/dist/automation/extensions/index.js +11 -0
- package/dist/automation/extensions/index.js.map +1 -0
- package/dist/automation/extensions/light-manager.extension.d.ts +26 -0
- package/dist/automation/extensions/light-manager.extension.js +260 -0
- package/dist/automation/extensions/light-manager.extension.js.map +1 -0
- package/dist/automation/extensions/managed-switch.extension.d.ts +3 -0
- package/dist/automation/extensions/managed-switch.extension.js +73 -0
- package/dist/automation/extensions/managed-switch.extension.js.map +1 -0
- package/dist/automation/extensions/room.extension.d.ts +11 -0
- package/dist/automation/extensions/room.extension.js +179 -0
- package/dist/automation/extensions/room.extension.js.map +1 -0
- package/dist/automation/extensions/sequence-matcher.extension.d.ts +3 -0
- package/dist/automation/extensions/sequence-matcher.extension.js +126 -0
- package/dist/automation/extensions/sequence-matcher.extension.js.map +1 -0
- package/dist/automation/extensions/solar-calc.extension.d.ts +20 -0
- package/dist/automation/extensions/solar-calc.extension.js +105 -0
- package/dist/automation/extensions/solar-calc.extension.js.map +1 -0
- package/dist/automation/helpers/events.helper.d.ts +33 -0
- package/dist/automation/helpers/events.helper.js +14 -0
- package/dist/automation/helpers/events.helper.js.map +1 -0
- package/dist/automation/helpers/index.d.ts +7 -0
- package/dist/automation/helpers/index.js +11 -0
- package/dist/automation/helpers/index.js.map +1 -0
- package/dist/automation/helpers/managed-switch.helper.d.ts +41 -0
- package/dist/automation/helpers/managed-switch.helper.js +3 -0
- package/dist/automation/helpers/managed-switch.helper.js.map +1 -0
- package/dist/automation/helpers/metrics.helper.d.ts +13 -0
- package/dist/automation/helpers/metrics.helper.js +30 -0
- package/dist/automation/helpers/metrics.helper.js.map +1 -0
- package/dist/automation/helpers/reftimes.helper.d.ts +54 -0
- package/dist/automation/helpers/reftimes.helper.js +33 -0
- package/dist/automation/helpers/reftimes.helper.js.map +1 -0
- package/dist/automation/helpers/scene.helper.d.ts +97 -0
- package/dist/automation/helpers/scene.helper.js +5 -0
- package/dist/automation/helpers/scene.helper.js.map +1 -0
- package/dist/automation/helpers/sequence.helper.d.ts +55 -0
- package/dist/automation/helpers/sequence.helper.js +3 -0
- package/dist/automation/helpers/sequence.helper.js.map +1 -0
- package/dist/automation/helpers/solar.helper.d.ts +3 -0
- package/dist/automation/helpers/solar.helper.js +262 -0
- package/dist/automation/helpers/solar.helper.js.map +1 -0
- package/dist/automation/index.d.ts +3 -0
- package/dist/automation/index.js +10 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/boilerplate/extensions/cache.extension.d.ts +24 -0
- package/dist/boilerplate/extensions/cache.extension.js +96 -0
- package/dist/boilerplate/extensions/cache.extension.js.map +1 -0
- package/dist/boilerplate/extensions/configuration.extension.d.ts +23 -0
- package/dist/boilerplate/extensions/configuration.extension.js +98 -0
- package/dist/boilerplate/extensions/configuration.extension.js.map +1 -0
- package/dist/boilerplate/extensions/fetch.extension.d.ts +20 -0
- package/dist/boilerplate/extensions/fetch.extension.js +154 -0
- package/dist/boilerplate/extensions/fetch.extension.js.map +1 -0
- package/dist/boilerplate/extensions/index.d.ts +6 -0
- package/dist/boilerplate/extensions/index.js +10 -0
- package/dist/boilerplate/extensions/index.js.map +1 -0
- package/dist/boilerplate/extensions/logger.extension.d.ts +39 -0
- package/dist/boilerplate/extensions/logger.extension.js +159 -0
- package/dist/boilerplate/extensions/logger.extension.js.map +1 -0
- package/dist/boilerplate/extensions/scheduler.extension.d.ts +21 -0
- package/dist/boilerplate/extensions/scheduler.extension.js +117 -0
- package/dist/boilerplate/extensions/scheduler.extension.js.map +1 -0
- package/dist/boilerplate/extensions/wiring.extension.d.ts +101 -0
- package/dist/boilerplate/extensions/wiring.extension.js +452 -0
- package/dist/boilerplate/extensions/wiring.extension.js.map +1 -0
- package/dist/boilerplate/helpers/cache-memory.helper.d.ts +7 -0
- package/dist/boilerplate/helpers/cache-memory.helper.js +65 -0
- package/dist/boilerplate/helpers/cache-memory.helper.js.map +1 -0
- package/dist/boilerplate/helpers/cache-redis.helper.d.ts +7 -0
- package/dist/boilerplate/helpers/cache-redis.helper.js +69 -0
- package/dist/boilerplate/helpers/cache-redis.helper.js.map +1 -0
- package/dist/boilerplate/helpers/config-environment-loader.helper.d.ts +2 -0
- package/dist/boilerplate/helpers/config-environment-loader.helper.js +56 -0
- package/dist/boilerplate/helpers/config-environment-loader.helper.js.map +1 -0
- package/dist/boilerplate/helpers/config-file-loader.helper.d.ts +4 -0
- package/dist/boilerplate/helpers/config-file-loader.helper.js +87 -0
- package/dist/boilerplate/helpers/config-file-loader.helper.js.map +1 -0
- package/dist/boilerplate/helpers/config.helper.d.ts +102 -0
- package/dist/boilerplate/helpers/config.helper.js +32 -0
- package/dist/boilerplate/helpers/config.helper.js.map +1 -0
- package/dist/boilerplate/helpers/errors.helper.d.ts +39 -0
- package/dist/boilerplate/helpers/errors.helper.js +76 -0
- package/dist/boilerplate/helpers/errors.helper.js.map +1 -0
- package/dist/boilerplate/helpers/events.helper.d.ts +3 -0
- package/dist/boilerplate/helpers/events.helper.js +11 -0
- package/dist/boilerplate/helpers/events.helper.js.map +1 -0
- package/dist/boilerplate/helpers/fetch.helper.d.ts +170 -0
- package/dist/boilerplate/helpers/fetch.helper.js +173 -0
- package/dist/boilerplate/helpers/fetch.helper.js.map +1 -0
- package/dist/boilerplate/helpers/index.d.ts +12 -0
- package/dist/boilerplate/helpers/index.js +16 -0
- package/dist/boilerplate/helpers/index.js.map +1 -0
- package/dist/boilerplate/helpers/lifecycle.helper.d.ts +43 -0
- package/dist/boilerplate/helpers/lifecycle.helper.js +13 -0
- package/dist/boilerplate/helpers/lifecycle.helper.js.map +1 -0
- package/dist/boilerplate/helpers/metrics.helper.d.ts +73 -0
- package/dist/boilerplate/helpers/metrics.helper.js +141 -0
- package/dist/boilerplate/helpers/metrics.helper.js.map +1 -0
- package/dist/boilerplate/helpers/testing.helper.d.ts +13 -0
- package/dist/boilerplate/helpers/testing.helper.js +91 -0
- package/dist/boilerplate/helpers/testing.helper.js.map +1 -0
- package/dist/boilerplate/helpers/wiring.helper.d.ts +155 -0
- package/dist/boilerplate/helpers/wiring.helper.js +5 -0
- package/dist/boilerplate/helpers/wiring.helper.js.map +1 -0
- package/dist/boilerplate/index.d.ts +2 -0
- package/dist/boilerplate/index.js +6 -0
- package/dist/boilerplate/index.js.map +1 -0
- package/dist/gotify/extensions/application.extension.d.ts +13 -0
- package/dist/gotify/extensions/application.extension.js +52 -0
- package/dist/gotify/extensions/application.extension.js.map +1 -0
- package/dist/gotify/extensions/client.extension.d.ts +8 -0
- package/dist/gotify/extensions/client.extension.js +38 -0
- package/dist/gotify/extensions/client.extension.js.map +1 -0
- package/dist/gotify/extensions/fetch.extension.d.ts +2 -0
- package/dist/gotify/extensions/fetch.extension.js +14 -0
- package/dist/gotify/extensions/fetch.extension.js.map +1 -0
- package/dist/gotify/extensions/index.d.ts +4 -0
- package/dist/gotify/extensions/index.js +8 -0
- package/dist/gotify/extensions/index.js.map +1 -0
- package/dist/gotify/extensions/message.extension.d.ts +8 -0
- package/dist/gotify/extensions/message.extension.js +37 -0
- package/dist/gotify/extensions/message.extension.js.map +1 -0
- package/dist/gotify/gotify.module.d.ts +29 -0
- package/dist/gotify/gotify.module.js +33 -0
- package/dist/gotify/gotify.module.js.map +1 -0
- package/dist/gotify/helpers/api.d.ts +346 -0
- package/dist/gotify/helpers/api.js +14 -0
- package/dist/gotify/helpers/api.js.map +1 -0
- package/dist/gotify/helpers/events.helper.d.ts +6 -0
- package/dist/gotify/helpers/events.helper.js +5 -0
- package/dist/gotify/helpers/events.helper.js.map +1 -0
- package/dist/gotify/helpers/index.d.ts +2 -0
- package/dist/gotify/helpers/index.js +6 -0
- package/dist/gotify/helpers/index.js.map +1 -0
- package/dist/gotify/index.d.ts +3 -0
- package/dist/gotify/index.js +7 -0
- package/dist/gotify/index.js.map +1 -0
- package/dist/hass/dynamic.d.ts +1126 -0
- package/dist/hass/dynamic.js +153 -0
- package/dist/hass/dynamic.js.map +1 -0
- package/dist/hass/extensions/call-proxy.extension.d.ts +4 -0
- package/dist/hass/extensions/call-proxy.extension.js +88 -0
- package/dist/hass/extensions/call-proxy.extension.js.map +1 -0
- package/dist/hass/extensions/entity-manager.extension.d.ts +61 -0
- package/dist/hass/extensions/entity-manager.extension.js +214 -0
- package/dist/hass/extensions/entity-manager.extension.js.map +1 -0
- package/dist/hass/extensions/fetch-api.extension.d.ts +26 -0
- package/dist/hass/extensions/fetch-api.extension.js +166 -0
- package/dist/hass/extensions/fetch-api.extension.js.map +1 -0
- package/dist/hass/extensions/index.d.ts +5 -0
- package/dist/hass/extensions/index.js +9 -0
- package/dist/hass/extensions/index.js.map +1 -0
- package/dist/hass/extensions/utilities.extension.d.ts +9 -0
- package/dist/hass/extensions/utilities.extension.js +43 -0
- package/dist/hass/extensions/utilities.extension.js.map +1 -0
- package/dist/hass/extensions/websocket-api.extension.d.ts +39 -0
- package/dist/hass/extensions/websocket-api.extension.js +363 -0
- package/dist/hass/extensions/websocket-api.extension.js.map +1 -0
- package/dist/hass/hass.module.d.ts +53 -0
- package/dist/hass/hass.module.js +59 -0
- package/dist/hass/hass.module.js.map +1 -0
- package/dist/hass/helpers/backup.helper.d.ts +11 -0
- package/dist/hass/helpers/backup.helper.js +3 -0
- package/dist/hass/helpers/backup.helper.js.map +1 -0
- package/dist/hass/helpers/constants.helper.d.ts +54 -0
- package/dist/hass/helpers/constants.helper.js +63 -0
- package/dist/hass/helpers/constants.helper.js.map +1 -0
- package/dist/hass/helpers/entity-state.helper.d.ts +45 -0
- package/dist/hass/helpers/entity-state.helper.js +9 -0
- package/dist/hass/helpers/entity-state.helper.js.map +1 -0
- package/dist/hass/helpers/fetch/calendar.d.ts +54 -0
- package/dist/hass/helpers/fetch/calendar.js +3 -0
- package/dist/hass/helpers/fetch/calendar.js.map +1 -0
- package/dist/hass/helpers/fetch/configuration.d.ts +34 -0
- package/dist/hass/helpers/fetch/configuration.js +3 -0
- package/dist/hass/helpers/fetch/configuration.js.map +1 -0
- package/dist/hass/helpers/fetch/index.d.ts +4 -0
- package/dist/hass/helpers/fetch/index.js +8 -0
- package/dist/hass/helpers/fetch/index.js.map +1 -0
- package/dist/hass/helpers/fetch/server-log.d.ts +10 -0
- package/dist/hass/helpers/fetch/server-log.js +20 -0
- package/dist/hass/helpers/fetch/server-log.js.map +1 -0
- package/dist/hass/helpers/fetch/service-list.d.ts +51 -0
- package/dist/hass/helpers/fetch/service-list.js +3 -0
- package/dist/hass/helpers/fetch/service-list.js.map +1 -0
- package/dist/hass/helpers/index.d.ts +7 -0
- package/dist/hass/helpers/index.js +11 -0
- package/dist/hass/helpers/index.js.map +1 -0
- package/dist/hass/helpers/metrics.helper.d.ts +13 -0
- package/dist/hass/helpers/metrics.helper.js +30 -0
- package/dist/hass/helpers/metrics.helper.js.map +1 -0
- package/dist/hass/helpers/utility.helper.d.ts +57 -0
- package/dist/hass/helpers/utility.helper.js +34 -0
- package/dist/hass/helpers/utility.helper.js.map +1 -0
- package/dist/hass/helpers/websocket.helper.d.ts +129 -0
- package/dist/hass/helpers/websocket.helper.js +3 -0
- package/dist/hass/helpers/websocket.helper.js.map +1 -0
- package/dist/hass/index.d.ts +4 -0
- package/dist/hass/index.js +8 -0
- package/dist/hass/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nexus/entities.extension.d.ts +2 -0
- package/dist/nexus/entities.extension.js +51 -0
- package/dist/nexus/entities.extension.js.map +1 -0
- package/dist/nexus/main.d.ts +9 -0
- package/dist/nexus/main.js +28 -0
- package/dist/nexus/main.js.map +1 -0
- package/dist/synapse/extensions/binary-sensor.extension.d.ts +19 -0
- package/dist/synapse/extensions/binary-sensor.extension.js +84 -0
- package/dist/synapse/extensions/binary-sensor.extension.js.map +1 -0
- package/dist/synapse/extensions/button.extension.d.ts +10 -0
- package/dist/synapse/extensions/button.extension.js +46 -0
- package/dist/synapse/extensions/button.extension.js.map +1 -0
- package/dist/synapse/extensions/index.d.ts +6 -0
- package/dist/synapse/extensions/index.js +10 -0
- package/dist/synapse/extensions/index.js.map +1 -0
- package/dist/synapse/extensions/registry.extension.d.ts +21 -0
- package/dist/synapse/extensions/registry.extension.js +207 -0
- package/dist/synapse/extensions/registry.extension.js.map +1 -0
- package/dist/synapse/extensions/scene.extension.d.ts +9 -0
- package/dist/synapse/extensions/scene.extension.js +37 -0
- package/dist/synapse/extensions/scene.extension.js.map +1 -0
- package/dist/synapse/extensions/sensor.extension.d.ts +25 -0
- package/dist/synapse/extensions/sensor.extension.js +154 -0
- package/dist/synapse/extensions/sensor.extension.js.map +1 -0
- package/dist/synapse/extensions/switch.extension.d.ts +19 -0
- package/dist/synapse/extensions/switch.extension.js +95 -0
- package/dist/synapse/extensions/switch.extension.js.map +1 -0
- package/dist/synapse/helpers/device-class.helper.d.ts +323 -0
- package/dist/synapse/helpers/device-class.helper.js +241 -0
- package/dist/synapse/helpers/device-class.helper.js.map +1 -0
- package/dist/synapse/helpers/index.d.ts +3 -0
- package/dist/synapse/helpers/index.js +7 -0
- package/dist/synapse/helpers/index.js.map +1 -0
- package/dist/synapse/helpers/metrics.helper.d.ts +13 -0
- package/dist/synapse/helpers/metrics.helper.js +30 -0
- package/dist/synapse/helpers/metrics.helper.js.map +1 -0
- package/dist/synapse/helpers/utility.helper.d.ts +1 -0
- package/dist/synapse/helpers/utility.helper.js +3 -0
- package/dist/synapse/helpers/utility.helper.js.map +1 -0
- package/dist/synapse/index.d.ts +3 -0
- package/dist/synapse/index.js +7 -0
- package/dist/synapse/index.js.map +1 -0
- package/dist/synapse/synapse.module.d.ts +29 -0
- package/dist/synapse/synapse.module.js +41 -0
- package/dist/synapse/synapse.module.js.map +1 -0
- package/dist/type-writer/build.extension.d.ts +2 -0
- package/dist/type-writer/build.extension.js +53 -0
- package/dist/type-writer/build.extension.js.map +1 -0
- package/dist/type-writer/main.d.ts +17 -0
- package/dist/type-writer/main.js +36 -0
- package/dist/type-writer/main.js.map +1 -0
- package/dist/type-writer/type-writer.extension.d.ts +2 -0
- package/dist/type-writer/type-writer.extension.js +212 -0
- package/dist/type-writer/type-writer.extension.js.map +1 -0
- package/dist/utilities/extensions/index.d.ts +3 -0
- package/dist/utilities/extensions/index.js +7 -0
- package/dist/utilities/extensions/index.js.map +1 -0
- package/dist/utilities/extensions/is.extension.d.ts +38 -0
- package/dist/utilities/extensions/is.extension.js +104 -0
- package/dist/utilities/extensions/is.extension.js.map +1 -0
- package/dist/utilities/extensions/zcc-testing.extension.d.ts +4 -0
- package/dist/utilities/extensions/zcc-testing.extension.js +9 -0
- package/dist/utilities/extensions/zcc-testing.extension.js.map +1 -0
- package/dist/utilities/extensions/zcc.extension.d.ts +20 -0
- package/dist/utilities/extensions/zcc.extension.js +66 -0
- package/dist/utilities/extensions/zcc.extension.js.map +1 -0
- package/dist/utilities/helpers/async.helper.d.ts +2 -0
- package/dist/utilities/helpers/async.helper.js +26 -0
- package/dist/utilities/helpers/async.helper.js.map +1 -0
- package/dist/utilities/helpers/context.helper.d.ts +7 -0
- package/dist/utilities/helpers/context.helper.js +3 -0
- package/dist/utilities/helpers/context.helper.js.map +1 -0
- package/dist/utilities/helpers/cron.helper.d.ts +87 -0
- package/dist/utilities/helpers/cron.helper.js +92 -0
- package/dist/utilities/helpers/cron.helper.js.map +1 -0
- package/dist/utilities/helpers/extend.helper.d.ts +2 -0
- package/dist/utilities/helpers/extend.helper.js +68 -0
- package/dist/utilities/helpers/extend.helper.js.map +1 -0
- package/dist/utilities/helpers/index.d.ts +5 -0
- package/dist/utilities/helpers/index.js +9 -0
- package/dist/utilities/helpers/index.js.map +1 -0
- package/dist/utilities/helpers/utilities.helper.d.ts +63 -0
- package/dist/utilities/helpers/utilities.helper.js +93 -0
- package/dist/utilities/helpers/utilities.helper.js.map +1 -0
- package/dist/utilities/index.d.ts +2 -0
- package/dist/utilities/index.js +6 -0
- package/dist/utilities/index.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoaderEnvironment = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const minimist_1 = tslib_1.__importDefault(require("minimist"));
|
|
6
|
+
const object_path_1 = require("object-path");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
async function ConfigLoaderEnvironment({ configs, }) {
|
|
9
|
+
const environmentKeys = Object.keys(process.env);
|
|
10
|
+
const CLI_SWITCHES = (0, minimist_1.default)(process.argv);
|
|
11
|
+
const switchKeys = Object.keys(CLI_SWITCHES);
|
|
12
|
+
const out = {};
|
|
13
|
+
configs.forEach((configuration, project) => {
|
|
14
|
+
const cleanedProject = project.replaceAll("-", "_");
|
|
15
|
+
Object.keys(configuration).forEach(key => {
|
|
16
|
+
const noAppPath = `${cleanedProject}_${key}`;
|
|
17
|
+
const search = [noAppPath, key];
|
|
18
|
+
const configPath = `${project}.${key}`;
|
|
19
|
+
// Find an applicable switch
|
|
20
|
+
const flag =
|
|
21
|
+
// Find an exact match (if available) first
|
|
22
|
+
search.find(line => switchKeys.includes(line)) ||
|
|
23
|
+
// Do case insensitive searches
|
|
24
|
+
search.find(line => {
|
|
25
|
+
const match = new RegExp(`^${line.replaceAll(new RegExp("[-_]", "gi"), "[-_]?")}$`, "gi");
|
|
26
|
+
return switchKeys.some(item => item.match(match));
|
|
27
|
+
});
|
|
28
|
+
if (flag) {
|
|
29
|
+
const formattedFlag = switchKeys.find(key => search.some(line => key.match(new RegExp(`^${line.replaceAll(new RegExp("[-_]", "gi"), "[-_]?")}$`, "gi"))));
|
|
30
|
+
if (__1.is.string(formattedFlag)) {
|
|
31
|
+
(0, object_path_1.set)(out, configPath, CLI_SWITCHES[formattedFlag]);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Find an environment variable
|
|
36
|
+
const environment =
|
|
37
|
+
// Find an exact match (if available) first
|
|
38
|
+
search.find(line => environmentKeys.includes(line)) ||
|
|
39
|
+
// Do case insensitive searches
|
|
40
|
+
search.find(line => {
|
|
41
|
+
const match = new RegExp(`^${line.replaceAll(new RegExp("[-_]", "gi"), "[-_]?")}$`, "gi");
|
|
42
|
+
return environmentKeys.some(item => item.match(match));
|
|
43
|
+
});
|
|
44
|
+
if (__1.is.empty(environment)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const environmentName = environmentKeys.find(key => search.some(line => key.match(new RegExp(`^${line.replaceAll(new RegExp("[-_]", "gi"), "[-_]?")}$`, "gi"))));
|
|
48
|
+
if (__1.is.string(environmentName)) {
|
|
49
|
+
(0, object_path_1.set)(out, configPath, process.env[environmentName]);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
exports.ConfigLoaderEnvironment = ConfigLoaderEnvironment;
|
|
56
|
+
//# sourceMappingURL=config-environment-loader.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-environment-loader.helper.js","sourceRoot":"","sources":["../../../src/boilerplate/helpers/config-environment-loader.helper.ts"],"names":[],"mappings":";;;;AAAA,gEAAgC;AAChC,6CAAkC;AAElC,6BAA2B;AAOpB,KAAK,UAAU,uBAAuB,CAAC,EAC5C,OAAO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AC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,EACzD,IAAI,CACL,CACF,CACF,CACF,CAAC;YACF,IAAI,MAAE,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC/B,IAAA,iBAAG,EAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AA3ED,0DA2EC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ConfigLoaderParams, ConfigLoaderReturn } from "./config.helper";
|
|
2
|
+
export declare const SUPPORTED_CONFIG_EXTENSIONS: string[];
|
|
3
|
+
export declare function configFilePaths(name?: string): string[];
|
|
4
|
+
export declare function ConfigLoaderFile({ application, }: ConfigLoaderParams): ConfigLoaderReturn;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoaderFile = exports.configFilePaths = exports.SUPPORTED_CONFIG_EXTENSIONS = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const ini_1 = require("ini");
|
|
6
|
+
const js_yaml_1 = require("js-yaml");
|
|
7
|
+
const os_1 = require("os");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const process_1 = require("process");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const isWindows = process_1.platform === "win32";
|
|
12
|
+
exports.SUPPORTED_CONFIG_EXTENSIONS = ["json", "ini", "yaml", "yml"];
|
|
13
|
+
function withExtensions(path) {
|
|
14
|
+
return [path, ...exports.SUPPORTED_CONFIG_EXTENSIONS.map(i => `${path}.${i}`)];
|
|
15
|
+
}
|
|
16
|
+
function configFilePaths(name = "digital-alchemy") {
|
|
17
|
+
const out = [];
|
|
18
|
+
if (!isWindows) {
|
|
19
|
+
out.push(...withExtensions((0, path_1.join)(`/etc`, name, "config")), ...withExtensions((0, path_1.join)(`/etc`, `${name}`)));
|
|
20
|
+
}
|
|
21
|
+
let current = (0, process_1.cwd)();
|
|
22
|
+
let next;
|
|
23
|
+
while (!__1.is.empty(current)) {
|
|
24
|
+
out.push((0, path_1.join)(current, `.${name}`), ...withExtensions(current));
|
|
25
|
+
next = (0, path_1.join)(current, "..");
|
|
26
|
+
if (next === current) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
current = next;
|
|
30
|
+
}
|
|
31
|
+
out.push(...withExtensions((0, path_1.join)((0, os_1.homedir)(), ".config", name)), ...withExtensions((0, path_1.join)((0, os_1.homedir)(), ".config", name, "config")));
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
exports.configFilePaths = configFilePaths;
|
|
35
|
+
async function ConfigLoaderFile({ application, }) {
|
|
36
|
+
const files = configFilePaths(application.name);
|
|
37
|
+
const out = {};
|
|
38
|
+
files.forEach(file => loadConfigFromFile(out, file));
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
exports.ConfigLoaderFile = ConfigLoaderFile;
|
|
42
|
+
function loadConfigFromFile(out, filePath) {
|
|
43
|
+
if (!(0, fs_1.existsSync)(filePath) || !(0, fs_1.statSync)(filePath).isFile()) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const fileContent = (0, fs_1.readFileSync)(filePath, "utf8").trim();
|
|
47
|
+
const hasExtension = exports.SUPPORTED_CONFIG_EXTENSIONS.some(extension => {
|
|
48
|
+
if (filePath.slice(extension.length * __1.INVERT_VALUE).toLowerCase() ===
|
|
49
|
+
extension) {
|
|
50
|
+
switch (extension) {
|
|
51
|
+
case "ini":
|
|
52
|
+
(0, __1.deepExtend)(out, (0, ini_1.decode)(fileContent));
|
|
53
|
+
return true;
|
|
54
|
+
case "yaml":
|
|
55
|
+
case "yml":
|
|
56
|
+
(0, __1.deepExtend)(out, (0, js_yaml_1.load)(fileContent));
|
|
57
|
+
return true;
|
|
58
|
+
case "json":
|
|
59
|
+
(0, __1.deepExtend)(out, JSON.parse(fileContent));
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
});
|
|
65
|
+
if (hasExtension) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Guessing JSON
|
|
69
|
+
if (fileContent[__1.START] === "{") {
|
|
70
|
+
(0, __1.deepExtend)(out, JSON.parse(fileContent));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// Guessing yaml
|
|
74
|
+
try {
|
|
75
|
+
const content = (0, js_yaml_1.load)(fileContent);
|
|
76
|
+
if (__1.is.object(content)) {
|
|
77
|
+
(0, __1.deepExtend)(out, content);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Is not a yaml file
|
|
83
|
+
}
|
|
84
|
+
// Final fallback: INI
|
|
85
|
+
(0, __1.deepExtend)(out, (0, ini_1.decode)(fileContent));
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=config-file-loader.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-file-loader.helper.js","sourceRoot":"","sources":["../../../src/boilerplate/helpers/config-file-loader.helper.ts"],"names":[],"mappings":";;;AAAA,2BAAwD;AACxD,6BAA6B;AAC7B,qCAA+B;AAC/B,2BAA6B;AAC7B,+BAA4B;AAC5B,qCAAwC;AAExC,6BAA4D;AAO5D,MAAM,SAAS,GAAG,kBAAQ,KAAK,OAAO,CAAC;AAE1B,QAAA,2BAA2B,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1E,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,CAAC,IAAI,EAAE,GAAG,mCAA2B,CAAC,GAAG,CAAC,CAAC,CAAC,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AAC;IACD,gBAAgB;IAChB,IAAI,WAAW,CAAC,SAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QAC/B,IAAA,cAAU,EAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAA8B,CAAC,CAAC;QACtE,OAAO;IACT,CAAC;IACD,gBAAgB;IAChB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,cAAI,EAAC,WAAW,CAAC,CAAC;QAClC,IAAI,MAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,IAAA,cAAU,EAAC,GAAG,EAAE,OAAoC,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,qBAAqB;IACvB,CAAC;IACD,sBAAsB;IACtB,IAAA,cAAU,EAAC,GAAG,EAAE,IAAA,YAAM,EAAC,WAAW,CAA8B,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ApplicationDefinition, ServiceMap } from "./wiring.helper";
|
|
2
|
+
export type CodeConfigDefinition = Record<string, AnyConfig>;
|
|
3
|
+
export type ZccConfigTypes = "string" | "boolean" | "internal" | "number" | "record" | "string[]";
|
|
4
|
+
export type AnyConfig = StringConfig<string> | BooleanConfig | InternalConfig<unknown> | NumberConfig | RecordConfig | StringArrayConfig;
|
|
5
|
+
export interface BaseConfig {
|
|
6
|
+
/**
|
|
7
|
+
* If no other values are provided, what value should be injected?
|
|
8
|
+
* This ensures a value is always provided, and checks for undefined don't need to happen
|
|
9
|
+
*/
|
|
10
|
+
default?: unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Short descriptive text so humans can understand why this exists.
|
|
13
|
+
*/
|
|
14
|
+
description?: string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* Refuse to boot if user provided value is still undefined by `onPostConfig` lifecycle event
|
|
17
|
+
*/
|
|
18
|
+
required?: boolean;
|
|
19
|
+
type: ZccConfigTypes;
|
|
20
|
+
}
|
|
21
|
+
export type KnownConfigs = Map<string, CodeConfigDefinition>;
|
|
22
|
+
export interface StringConfig<STRING extends string> extends BaseConfig {
|
|
23
|
+
default?: STRING;
|
|
24
|
+
/**
|
|
25
|
+
* If provided, the value **MUST** appear in this list or the application will refuse to boot.
|
|
26
|
+
*/
|
|
27
|
+
enum?: STRING[];
|
|
28
|
+
type: "string";
|
|
29
|
+
}
|
|
30
|
+
export interface BooleanConfig extends BaseConfig {
|
|
31
|
+
default?: boolean;
|
|
32
|
+
type: "boolean";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* For configurations that just can't be expressed any other way.
|
|
36
|
+
* Make sure to add a helpful description on how to format the value,
|
|
37
|
+
* because `config-builder` won't be able to help.
|
|
38
|
+
*
|
|
39
|
+
* This can be used to take in a complex json object, and forward the information to another library.
|
|
40
|
+
*
|
|
41
|
+
* TODO: JSON schema magic for validation / maybe config builder help
|
|
42
|
+
*/
|
|
43
|
+
export type InternalConfig<VALUE extends unknown> = BaseConfig & {
|
|
44
|
+
default: VALUE;
|
|
45
|
+
type: "internal";
|
|
46
|
+
};
|
|
47
|
+
export interface NumberConfig extends BaseConfig {
|
|
48
|
+
default?: number;
|
|
49
|
+
type: "number";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* key/value pairs
|
|
53
|
+
*/
|
|
54
|
+
export interface RecordConfig extends BaseConfig {
|
|
55
|
+
type: "record";
|
|
56
|
+
}
|
|
57
|
+
export interface StringArrayConfig extends BaseConfig {
|
|
58
|
+
default?: string[];
|
|
59
|
+
type: "string[]";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Used with config scanner
|
|
63
|
+
*/
|
|
64
|
+
export interface ConfigDefinitionDTO {
|
|
65
|
+
application: string;
|
|
66
|
+
bootstrapOverrides?: AbstractConfig;
|
|
67
|
+
config: ConfigTypeDTO[];
|
|
68
|
+
}
|
|
69
|
+
export interface ConfigTypeDTO<METADATA extends AnyConfig = AnyConfig> {
|
|
70
|
+
/**
|
|
71
|
+
* Name of project
|
|
72
|
+
*/
|
|
73
|
+
library: string;
|
|
74
|
+
/**
|
|
75
|
+
* Description of a single config item as passed into the module
|
|
76
|
+
*/
|
|
77
|
+
metadata: METADATA;
|
|
78
|
+
/**
|
|
79
|
+
* Property name
|
|
80
|
+
*/
|
|
81
|
+
property: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Top level configuration object
|
|
85
|
+
*
|
|
86
|
+
* Extends the global common config, adding a section for the top level application to chuck in data without affecting things
|
|
87
|
+
* Also provides dedicated sections for libraries to store their own configuration options
|
|
88
|
+
*/
|
|
89
|
+
export interface AbstractConfig {
|
|
90
|
+
}
|
|
91
|
+
export type ConfigLoaderReturn = Promise<Partial<AbstractConfig>>;
|
|
92
|
+
export type ConfigLoaderParams<S extends ServiceMap = ServiceMap, C extends OptionalModuleConfiguration = OptionalModuleConfiguration> = {
|
|
93
|
+
application: ApplicationDefinition<S, C>;
|
|
94
|
+
configs: KnownConfigs;
|
|
95
|
+
};
|
|
96
|
+
export type ConfigLoaderMethod = <S extends ServiceMap, C extends OptionalModuleConfiguration>(params: ConfigLoaderParams<S, C>) => ConfigLoaderReturn;
|
|
97
|
+
export type ConfigLoader = [loader: ConfigLoaderMethod, priority: number];
|
|
98
|
+
export declare function cast<T = unknown>(data: string | string[], type: string): T;
|
|
99
|
+
export type ModuleConfiguration = {
|
|
100
|
+
[key: string]: AnyConfig;
|
|
101
|
+
};
|
|
102
|
+
export type OptionalModuleConfiguration = ModuleConfiguration | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cast = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
function cast(data, type) {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "boolean": {
|
|
8
|
+
data ??= "";
|
|
9
|
+
return (__1.is.boolean(data)
|
|
10
|
+
? data
|
|
11
|
+
: ["true", "y", "1"].includes(data.toLowerCase()));
|
|
12
|
+
}
|
|
13
|
+
case "number":
|
|
14
|
+
return Number(data);
|
|
15
|
+
case "string[]":
|
|
16
|
+
if (__1.is.undefined(data)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
if (__1.is.array(data)) {
|
|
20
|
+
return data.map(String);
|
|
21
|
+
}
|
|
22
|
+
// This occurs with cli switches
|
|
23
|
+
// If only 1 is passed, it'll get the value
|
|
24
|
+
// ex: --foo=bar ==== {foo:'bar'}
|
|
25
|
+
// If duplicates are passed, will receive array
|
|
26
|
+
// ex: --foo=bar --foo=baz === {foo:['bar','baz']}
|
|
27
|
+
return [String(data)];
|
|
28
|
+
}
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
exports.cast = cast;
|
|
32
|
+
//# sourceMappingURL=config.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.helper.js","sourceRoot":"","sources":["../../../src/boilerplate/helpers/config.helper.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AAmI3B,SAAgB,IAAI,CAAc,IAAuB,EAAE,IAAY;IACrE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,IAAI,KAAK,EAAE,CAAC;YACZ,OAAO,CACL,MAAE,CAAC,OAAO,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAE,IAAe,CAAC,WAAW,EAAE,CAAC,CAC3D,CAAC;QACT,CAAC;QACD,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,IAAI,CAAM,CAAC;QAC3B,KAAK,UAAU;YACb,IAAI,MAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,OAAO,EAAO,CAAC;YACjB,CAAC;YACD,IAAI,MAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAM,CAAC;YAC/B,CAAC;YACD,gCAAgC;YAChC,2CAA2C;YAC3C,kCAAkC;YAClC,+CAA+C;YAC/C,kDAAkD;YAClD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAM,CAAC;IAC/B,CAAC;IACD,OAAO,IAAS,CAAC;AACnB,CAAC;AA3BD,oBA2BC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TContext } from "../..";
|
|
2
|
+
export type MaybeHttpError = {
|
|
3
|
+
error: string;
|
|
4
|
+
message: string;
|
|
5
|
+
statusCode: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class BootstrapException extends Error {
|
|
8
|
+
context: TContext;
|
|
9
|
+
cause: string;
|
|
10
|
+
timestamp: Date;
|
|
11
|
+
constructor(context: TContext, cause: string, message: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class InternalError extends Error {
|
|
14
|
+
context: TContext;
|
|
15
|
+
cause: string;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
constructor(context: TContext, cause: string, message: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class FetchRequestError extends Error {
|
|
20
|
+
statusCode: number;
|
|
21
|
+
error: string;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
constructor(statusCode: number, error: string, message: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class CacheError extends Error {
|
|
26
|
+
context: TContext;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
constructor(context: TContext, message: string);
|
|
29
|
+
}
|
|
30
|
+
export declare class ConfigError extends Error {
|
|
31
|
+
context: TContext;
|
|
32
|
+
timestamp: Date;
|
|
33
|
+
constructor(context: TContext, message: string);
|
|
34
|
+
}
|
|
35
|
+
export declare class CronError extends Error {
|
|
36
|
+
context: TContext;
|
|
37
|
+
timestamp: Date;
|
|
38
|
+
constructor(context: TContext, message: string);
|
|
39
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronError = exports.ConfigError = exports.CacheError = exports.FetchRequestError = exports.InternalError = exports.BootstrapException = void 0;
|
|
4
|
+
class BootstrapException extends Error {
|
|
5
|
+
context;
|
|
6
|
+
cause;
|
|
7
|
+
timestamp;
|
|
8
|
+
constructor(context, cause, message) {
|
|
9
|
+
super(`[BootstrapException] Context: ${context}, Cause: ${cause}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
10
|
+
this.name = "BootstrapException";
|
|
11
|
+
this.context = context;
|
|
12
|
+
this.cause = cause;
|
|
13
|
+
this.timestamp = new Date();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.BootstrapException = BootstrapException;
|
|
17
|
+
class InternalError extends Error {
|
|
18
|
+
context;
|
|
19
|
+
cause;
|
|
20
|
+
timestamp;
|
|
21
|
+
constructor(context, cause, message) {
|
|
22
|
+
super(`[InternalError] Context: ${context}, Cause: ${cause}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
23
|
+
this.name = "InternalError";
|
|
24
|
+
this.context = context;
|
|
25
|
+
this.cause = cause;
|
|
26
|
+
this.timestamp = new Date();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.InternalError = InternalError;
|
|
30
|
+
class FetchRequestError extends Error {
|
|
31
|
+
statusCode;
|
|
32
|
+
error;
|
|
33
|
+
timestamp;
|
|
34
|
+
constructor(statusCode, error, message) {
|
|
35
|
+
super(`[FetchRequestError - ${statusCode}] Error: ${error}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
36
|
+
this.name = "FetchRequestError";
|
|
37
|
+
this.statusCode = statusCode;
|
|
38
|
+
this.error = error;
|
|
39
|
+
this.timestamp = new Date();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.FetchRequestError = FetchRequestError;
|
|
43
|
+
class CacheError extends Error {
|
|
44
|
+
context;
|
|
45
|
+
timestamp;
|
|
46
|
+
constructor(context, message) {
|
|
47
|
+
super(`[CacheError] Context: ${context}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
48
|
+
this.name = "CacheError";
|
|
49
|
+
this.context = context;
|
|
50
|
+
this.timestamp = new Date();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.CacheError = CacheError;
|
|
54
|
+
class ConfigError extends Error {
|
|
55
|
+
context;
|
|
56
|
+
timestamp;
|
|
57
|
+
constructor(context, message) {
|
|
58
|
+
super(`[ConfigError] Context: ${context}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
59
|
+
this.name = "ConfigError";
|
|
60
|
+
this.context = context;
|
|
61
|
+
this.timestamp = new Date();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.ConfigError = ConfigError;
|
|
65
|
+
class CronError extends Error {
|
|
66
|
+
context;
|
|
67
|
+
timestamp;
|
|
68
|
+
constructor(context, message) {
|
|
69
|
+
super(`[CronError] Context: ${context}, Message: ${message} | Timestamp: ${new Date().toISOString()}`);
|
|
70
|
+
this.name = "CronError";
|
|
71
|
+
this.context = context;
|
|
72
|
+
this.timestamp = new Date();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.CronError = CronError;
|
|
76
|
+
//# sourceMappingURL=errors.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.helper.js","sourceRoot":"","sources":["../../../src/boilerplate/helpers/errors.helper.ts"],"names":[],"mappings":";;;AAQA,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,OAAO,CAAW;IACT,KAAK,CAAS;IACvB,SAAS,CAAO;IAEhB,YAAY,OAAiB,EAAE,KAAa,EAAE,OAAe;QAC3D,KAAK,CACH,iCAAiC,OAAO,YAAY,KAAK,cAAc,OAAO,iBAAiB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAC1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ODE_GLOBAL_ERROR = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
exports.DIGITAL_ALCHEMY_NODE_GLOBAL_ERROR = "DIGITAL_ALCHEMY_NODE_GLOBAL_ERROR";
|
|
6
|
+
exports.DIGITAL_ALCHEMY_APPLICATION_ERROR = "DIGITAL_ALCHEMY_APPLICATION_ERROR";
|
|
7
|
+
const DIGITAL_ALCHEMY_LIBRARY_ERROR = (library) => __1.is.empty(library)
|
|
8
|
+
? "DIGITAL_ALCHEMY_LIBRARY_ERROR"
|
|
9
|
+
: `DIGITAL_ALCHEMY_LIBRARY_ERROR:${library}`;
|
|
10
|
+
exports.DIGITAL_ALCHEMY_LIBRARY_ERROR = DIGITAL_ALCHEMY_LIBRARY_ERROR;
|
|
11
|
+
//# sourceMappingURL=events.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.helper.js","sourceRoot":"","sources":["../../../src/boilerplate/helpers/events.helper.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AAEd,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AACzB,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAC/B,MAAM,6BAA6B,GAAG,CAAC,OAAgB,EAAE,EAAE,CAChE,MAAE,CAAC,KAAK,CAAC,OAAO,CAAC;IACf,CAAC,CAAC,+BAA+B;IACjC,CAAC,CAAC,iCAAiC,OAAO,EAAE,CAAC;AAHpC,QAAA,6BAA6B,iCAGO"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import Bottleneck from "bottleneck";
|
|
2
|
+
import { MergeExclusive } from "type-fest";
|
|
3
|
+
import { TContext } from "../..";
|
|
4
|
+
/**
|
|
5
|
+
* Defines the types of parameters that can be used in fetch requests.
|
|
6
|
+
*/
|
|
7
|
+
export type FetchParameterTypes = string | boolean | Date | number | Array<string | Date | number>;
|
|
8
|
+
/**
|
|
9
|
+
* Enumerates HTTP methods used in fetch requests.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum HTTP_METHODS {
|
|
12
|
+
get = "get",
|
|
13
|
+
delete = "delete",
|
|
14
|
+
put = "put",
|
|
15
|
+
patch = "patch",
|
|
16
|
+
post = "post"
|
|
17
|
+
}
|
|
18
|
+
type NoBodyMethods = "get" | "delete";
|
|
19
|
+
type BodyMethods = "put" | "patch" | "post";
|
|
20
|
+
/**
|
|
21
|
+
* Represents a fetch request with additional properties and body content.
|
|
22
|
+
*/
|
|
23
|
+
export type FetchWith<EXTRA extends Record<never, string> = Record<never, string>, BODY extends TFetchBody = undefined> = Partial<FetchArguments<BODY>> & EXTRA;
|
|
24
|
+
export type FetchProcessTypes = boolean | "text" | "json" | "raw" | undefined;
|
|
25
|
+
type BaseFetchArguments = {
|
|
26
|
+
/**
|
|
27
|
+
* Headers to append
|
|
28
|
+
*/
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Query params to send
|
|
32
|
+
*/
|
|
33
|
+
params?: Record<string, FetchParameterTypes>;
|
|
34
|
+
/**
|
|
35
|
+
* Built in post-processing
|
|
36
|
+
*
|
|
37
|
+
* - true / "json" = attempt to decode as json
|
|
38
|
+
* - false / "raw" = return the node-fetch response object without processing
|
|
39
|
+
* - "text" = return result as text, no additional processing
|
|
40
|
+
*
|
|
41
|
+
* ? boolean values are deprecated
|
|
42
|
+
*/
|
|
43
|
+
process?: FetchProcessTypes;
|
|
44
|
+
/**
|
|
45
|
+
* If provided, metrics will be kept for this request, and associated with labels
|
|
46
|
+
*/
|
|
47
|
+
label?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Defaults to global fetch context
|
|
50
|
+
*/
|
|
51
|
+
context?: TContext;
|
|
52
|
+
};
|
|
53
|
+
type BaseFetchUrl = {
|
|
54
|
+
/**
|
|
55
|
+
* URL to send request to
|
|
56
|
+
*/
|
|
57
|
+
url: string;
|
|
58
|
+
} & MergeExclusive<{
|
|
59
|
+
/**
|
|
60
|
+
* Frequently filled in by wrapper services
|
|
61
|
+
*/
|
|
62
|
+
baseUrl?: string;
|
|
63
|
+
}, {
|
|
64
|
+
/**
|
|
65
|
+
* URL is the full path (includes http://...)
|
|
66
|
+
*
|
|
67
|
+
* Ignores baseUrl if set
|
|
68
|
+
*/
|
|
69
|
+
rawUrl?: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
type BaseFetchBody<BODY extends TFetchBody = undefined> = MergeExclusive<{
|
|
72
|
+
/**
|
|
73
|
+
* POSTDATA
|
|
74
|
+
*/
|
|
75
|
+
body?: BODY;
|
|
76
|
+
/**
|
|
77
|
+
* HTTP method
|
|
78
|
+
*/
|
|
79
|
+
method: BodyMethods;
|
|
80
|
+
}, {
|
|
81
|
+
/**
|
|
82
|
+
* HTTP method
|
|
83
|
+
*/
|
|
84
|
+
method?: NoBodyMethods;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Defines the structure and types for arguments passed to fetch requests.
|
|
88
|
+
*/
|
|
89
|
+
export type FetchArguments<BODY extends TFetchBody = undefined> = BaseFetchUrl & BaseFetchArguments & BaseFetchBody<BODY>;
|
|
90
|
+
/**
|
|
91
|
+
* Represents a subset of FetchArguments for specific use cases.
|
|
92
|
+
*/
|
|
93
|
+
export type FilteredFetchArguments<BODY extends TFetchBody = undefined> = BaseFetchBody<BODY> & Pick<BaseFetchUrl, "url"> & Pick<BaseFetchArguments, "process" | "params">;
|
|
94
|
+
/**
|
|
95
|
+
* Same thing as FetchWith, but the function doesn't need any args
|
|
96
|
+
*
|
|
97
|
+
* This is a work around, for some reason the default value approach isn't work as I had hoped
|
|
98
|
+
*/
|
|
99
|
+
export type BaseFetch = Partial<FetchArguments>;
|
|
100
|
+
/**
|
|
101
|
+
* Defines the types of values that can be used in filter operations.
|
|
102
|
+
*/
|
|
103
|
+
export type FilterValueType = string | boolean | number | Date | RegExp | unknown | Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Enumerates the types of operations available for data filtering.
|
|
106
|
+
*/
|
|
107
|
+
export declare enum FILTER_OPERATIONS {
|
|
108
|
+
elem = "elem",
|
|
109
|
+
regex = "regex",
|
|
110
|
+
in = "in",
|
|
111
|
+
nin = "nin",
|
|
112
|
+
lt = "lt",
|
|
113
|
+
lte = "lte",
|
|
114
|
+
gt = "gt",
|
|
115
|
+
gte = "gte",
|
|
116
|
+
exists = "exists",
|
|
117
|
+
empty = "empty",
|
|
118
|
+
ne = "ne",
|
|
119
|
+
eq = "eq"
|
|
120
|
+
}
|
|
121
|
+
export interface ComparisonDTO {
|
|
122
|
+
operation?: FILTER_OPERATIONS | `${FILTER_OPERATIONS}`;
|
|
123
|
+
value?: FilterValueType | FilterValueType[];
|
|
124
|
+
}
|
|
125
|
+
export interface Filter<FIELDS = string> extends ComparisonDTO {
|
|
126
|
+
empty?: boolean;
|
|
127
|
+
exists?: boolean;
|
|
128
|
+
field?: FIELDS;
|
|
129
|
+
}
|
|
130
|
+
export interface ResultControl {
|
|
131
|
+
filters?: Set<Filter>;
|
|
132
|
+
limit?: number;
|
|
133
|
+
select?: string[];
|
|
134
|
+
skip?: number;
|
|
135
|
+
sort?: string[];
|
|
136
|
+
}
|
|
137
|
+
export declare function controlToQuery(value: Readonly<ResultControl>): Record<string, string>;
|
|
138
|
+
export declare function buildFilter(key: string, value: FilterValueType | FilterValueType[]): Filter;
|
|
139
|
+
export declare function queryToControl(value: Readonly<Record<string, string>>): ResultControl;
|
|
140
|
+
/**
|
|
141
|
+
* Properties that alter the way that fetcher works.
|
|
142
|
+
*/
|
|
143
|
+
export type FetcherOptions = {
|
|
144
|
+
/**
|
|
145
|
+
* typically domain names with scheme, added to the front of urls if the individual request doesn't override
|
|
146
|
+
*/
|
|
147
|
+
baseUrl?: string;
|
|
148
|
+
/**
|
|
149
|
+
* if provided, then requests will be rate limited via the bottleneck library
|
|
150
|
+
*/
|
|
151
|
+
bottleneck?: Bottleneck.ConstructorOptions;
|
|
152
|
+
/**
|
|
153
|
+
* merged into every request
|
|
154
|
+
*/
|
|
155
|
+
headers?: Record<string, string>;
|
|
156
|
+
/**
|
|
157
|
+
* Alter the context attached to the log statements emitted from the fetcher
|
|
158
|
+
*/
|
|
159
|
+
context?: TContext;
|
|
160
|
+
};
|
|
161
|
+
export type DownloadOptions<BODY extends TFetchBody = undefined> = Partial<FetchArguments<BODY>> & {
|
|
162
|
+
destination: string;
|
|
163
|
+
};
|
|
164
|
+
export declare function fetchCast(item: FetchParameterTypes): string;
|
|
165
|
+
export type TFetchBody = object | undefined;
|
|
166
|
+
export declare function buildFilterString(fetchWith: FetchWith<{
|
|
167
|
+
filters?: Readonly<ResultControl>;
|
|
168
|
+
params?: Record<string, FetchParameterTypes>;
|
|
169
|
+
}>): string;
|
|
170
|
+
export {};
|