@digital-alchemy/core 0.1.0 → 0.1.2
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/dist/automation/extensions/aggressive-scenes.extension.js +2 -3
- package/dist/automation/extensions/aggressive-scenes.extension.js.map +1 -1
- package/dist/automation/extensions/circadian.extension.js +0 -1
- package/dist/automation/extensions/circadian.extension.js.map +1 -1
- package/dist/automation/extensions/light-manager.extension.d.ts +1 -1
- package/dist/automation/extensions/light-manager.extension.js +3 -5
- package/dist/automation/extensions/light-manager.extension.js.map +1 -1
- package/dist/automation/extensions/managed-switch.extension.js +1 -1
- package/dist/automation/extensions/managed-switch.extension.js.map +1 -1
- package/dist/automation/extensions/room.extension.js +1 -3
- package/dist/automation/extensions/room.extension.js.map +1 -1
- package/dist/automation/extensions/sequence-matcher.extension.js +1 -5
- package/dist/automation/extensions/sequence-matcher.extension.js.map +1 -1
- package/dist/automation/extensions/solar-calc.extension.d.ts +1 -1
- package/dist/automation/extensions/solar-calc.extension.js +1 -2
- package/dist/automation/extensions/solar-calc.extension.js.map +1 -1
- package/dist/boilerplate/extensions/configuration.extension.js +6 -8
- package/dist/boilerplate/extensions/configuration.extension.js.map +1 -1
- package/dist/boilerplate/extensions/scheduler.extension.d.ts +5 -4
- package/dist/boilerplate/extensions/scheduler.extension.js +87 -86
- package/dist/boilerplate/extensions/scheduler.extension.js.map +1 -1
- package/dist/boilerplate/extensions/wiring.extension.js +8 -11
- package/dist/boilerplate/extensions/wiring.extension.js.map +1 -1
- package/dist/boilerplate/helpers/config-environment-loader.helper.js +2 -3
- package/dist/boilerplate/helpers/config-environment-loader.helper.js.map +1 -1
- package/dist/boilerplate/helpers/wiring.helper.d.ts +0 -1
- package/dist/boilerplate/helpers/wiring.helper.js.map +1 -1
- package/dist/hass/extensions/entity-manager.extension.js +8 -11
- package/dist/hass/extensions/entity-manager.extension.js.map +1 -1
- package/dist/hass/extensions/websocket-api.extension.js +0 -2
- package/dist/hass/extensions/websocket-api.extension.js.map +1 -1
- package/dist/nexus/entities.extension.js +0 -1
- package/dist/nexus/entities.extension.js.map +1 -1
- package/dist/synapse/extensions/registry.extension.js +0 -1
- package/dist/synapse/extensions/registry.extension.js.map +1 -1
- package/dist/type-writer/build.extension.js +1 -2
- package/dist/type-writer/build.extension.js.map +1 -1
- package/dist/type-writer/main.js +0 -0
- package/dist/utilities/extensions/zcc.extension.d.ts +6 -0
- package/dist/utilities/extensions/zcc.extension.js +68 -0
- package/dist/utilities/extensions/zcc.extension.js.map +1 -1
- package/dist/utilities/helpers/async.helper.d.ts +1 -0
- package/dist/utilities/helpers/async.helper.js +27 -2
- package/dist/utilities/helpers/async.helper.js.map +1 -1
- package/package.json +22 -13
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function each<T = unknown>(item: T[], callback: (item: T) => Promise<void | unknown>): Promise<void>;
|
|
2
2
|
export declare function eachSeries<T = void>(item: T[] | Set<T>, callback: (item: T) => Promise<void | unknown>): Promise<void>;
|
|
3
|
+
export declare function eachLimit<T = unknown>(items: T[], limit: number, callback: (item: T) => Promise<void | unknown>): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.eachSeries = exports.each = void 0;
|
|
3
|
+
exports.eachLimit = exports.eachSeries = exports.each = void 0;
|
|
4
4
|
const is_extension_1 = require("../extensions/is.extension");
|
|
5
5
|
const utilities_helper_1 = require("./utilities.helper");
|
|
6
6
|
// ? Functions written to be similar to the offerings from the async library
|
|
@@ -16,11 +16,36 @@ async function eachSeries(item, callback) {
|
|
|
16
16
|
item = [...item.values()];
|
|
17
17
|
}
|
|
18
18
|
if (!is_extension_1.is.array(item)) {
|
|
19
|
-
throw new TypeError(`
|
|
19
|
+
throw new TypeError(`not provided an array`);
|
|
20
20
|
}
|
|
21
21
|
for (let i = utilities_helper_1.START; i <= item.length - utilities_helper_1.ARRAY_OFFSET; i++) {
|
|
22
22
|
await callback(item[i]);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.eachSeries = eachSeries;
|
|
26
|
+
async function eachLimit(items, limit, callback) {
|
|
27
|
+
// Track active promises to ensure we don't exceed the limit
|
|
28
|
+
const activePromises = new Set();
|
|
29
|
+
// A helper function to add a new task
|
|
30
|
+
async function addTask(item) {
|
|
31
|
+
const promise = callback(item).then(() => {
|
|
32
|
+
activePromises.delete(promise); // Remove the promise from the set once it's resolved
|
|
33
|
+
});
|
|
34
|
+
activePromises.add(promise);
|
|
35
|
+
if (activePromises.size >= limit) {
|
|
36
|
+
await Promise.race(activePromises); // Wait for one of the active promises to resolve
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Add initial tasks up to the limit
|
|
40
|
+
const initialTasks = items.slice(utilities_helper_1.SINGLE, limit).map(item => addTask(item));
|
|
41
|
+
// Wait for the initial set of tasks to start processing
|
|
42
|
+
await Promise.all(initialTasks);
|
|
43
|
+
// Process the remaining items, ensuring the limit is respected
|
|
44
|
+
for (let i = limit; i < items.length; i++) {
|
|
45
|
+
await addTask(items[i]);
|
|
46
|
+
}
|
|
47
|
+
// Wait for all remaining tasks to complete
|
|
48
|
+
await Promise.all(activePromises);
|
|
49
|
+
}
|
|
50
|
+
exports.eachLimit = eachLimit;
|
|
26
51
|
//# sourceMappingURL=async.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.helper.js","sourceRoot":"","sources":["../../../src/utilities/helpers/async.helper.ts"],"names":[],"mappings":";;;AAAA,6DAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"async.helper.js","sourceRoot":"","sources":["../../../src/utilities/helpers/async.helper.ts"],"names":[],"mappings":";;;AAAA,6DAAgD;AAChD,yDAAiE;AAEjE,4EAA4E;AAC5E,mDAAmD;AACnD,kEAAkE;AAClE,EAAE;AAEK,KAAK,UAAU,IAAI,CACxB,OAAY,EAAE,EACd,QAA8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IAED,oCAAoC;IACpC,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,yBAAM,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE3E,wDAAwD;IACxD,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEhC,+DAA+D;IAC/D,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,2CAA2C;IAC3C,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC;AAhCD,8BAgCC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"repository": {
|
|
4
4
|
"url": "git+https://github.com/zoe-codez/digital-alchemy.git"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.2",
|
|
7
7
|
"author": {
|
|
8
8
|
"url": "https://github.com/zoe-codez",
|
|
9
9
|
"name": "Zoe"
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"node": ">=20"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"async": "^3.2.5",
|
|
37
36
|
"bottleneck": "^2.19.5",
|
|
38
37
|
"chalk": "^5.3.0",
|
|
39
38
|
"dayjs": "^1.11.10",
|
|
@@ -42,33 +41,31 @@
|
|
|
42
41
|
"minimist": "^1.2.8",
|
|
43
42
|
"node-cache": "^5.1.2",
|
|
44
43
|
"node-cron": "^3.0.3",
|
|
45
|
-
"object-path": "^0.11.8",
|
|
46
44
|
"pino": "^8.18.0",
|
|
47
45
|
"pino-pretty": "^10.3.1",
|
|
48
46
|
"prom-client": "^15.1.0",
|
|
49
47
|
"redis": "^4.6.13",
|
|
50
|
-
"typescript": "^5.3.3",
|
|
51
48
|
"uuid": "^9.0.1",
|
|
52
49
|
"ws": "^8.16.0"
|
|
53
50
|
},
|
|
51
|
+
"optionalDependencies": {
|
|
52
|
+
"typescript": "^5.3.3"
|
|
53
|
+
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@cspell/eslint-plugin": "^8.3.2",
|
|
56
56
|
"@faker-js/faker": "^8.4.0",
|
|
57
|
-
"@types/async": "^3.2.24",
|
|
58
57
|
"@types/ini": "^4.1.0",
|
|
59
58
|
"@types/jest": "^29.5.12",
|
|
60
59
|
"@types/js-yaml": "^4.0.9",
|
|
61
60
|
"@types/minimist": "^1.2.5",
|
|
62
|
-
"@types/node": "^20.11.16",
|
|
63
61
|
"@types/node-cron": "^3.0.11",
|
|
64
|
-
"@types/
|
|
62
|
+
"@types/node": "^20.11.16",
|
|
65
63
|
"@types/semver": "^7.5.6",
|
|
66
64
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
67
65
|
"@types/uuid": "^9.0.8",
|
|
68
66
|
"@types/ws": "^8.5.10",
|
|
69
67
|
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
70
68
|
"@typescript-eslint/parser": "6.21.0",
|
|
71
|
-
"eslint": "8.56.0",
|
|
72
69
|
"eslint-config-prettier": "9.1.0",
|
|
73
70
|
"eslint-plugin-import": "^2.29.1",
|
|
74
71
|
"eslint-plugin-jsonc": "^2.13.0",
|
|
@@ -79,8 +76,9 @@
|
|
|
79
76
|
"eslint-plugin-sonarjs": "^0.23.0",
|
|
80
77
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
81
78
|
"eslint-plugin-unicorn": "^51.0.0",
|
|
82
|
-
"
|
|
79
|
+
"eslint": "8.56.0",
|
|
83
80
|
"jest-environment-node": "^29.7.0",
|
|
81
|
+
"jest": "^29.7.0",
|
|
84
82
|
"npm-check-updates": "^16.14.14",
|
|
85
83
|
"prettier": "^3.2.5",
|
|
86
84
|
"ts-jest": "^29.1.2",
|
|
@@ -91,11 +89,22 @@
|
|
|
91
89
|
"jest": {
|
|
92
90
|
"preset": "ts-jest",
|
|
93
91
|
"testEnvironment": "node",
|
|
94
|
-
"moduleFileExtensions": [
|
|
95
|
-
|
|
92
|
+
"moduleFileExtensions": [
|
|
93
|
+
"ts",
|
|
94
|
+
"js",
|
|
95
|
+
"json",
|
|
96
|
+
"node"
|
|
97
|
+
],
|
|
98
|
+
"testMatch": [
|
|
99
|
+
"**/?(*.)+(spec|test).ts"
|
|
100
|
+
],
|
|
96
101
|
"transform": {
|
|
97
|
-
"^.+\\.ts$": [
|
|
102
|
+
"^.+\\.ts$": [
|
|
103
|
+
"ts-jest",
|
|
104
|
+
{
|
|
105
|
+
"tsconfig": "tsconfig.spec.json"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
|
-
|
|
101
110
|
}
|