@decaf-ts/core 0.26.2 → 0.26.3
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/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/utils/throttling.cjs +103 -78
- package/lib/cjs/utils/throttling.cjs.map +1 -1
- package/lib/esm/index.js +3 -3
- package/lib/esm/utils/throttling.js +101 -78
- package/lib/esm/utils/throttling.js.map +1 -1
- package/lib/types/index.d.cts +3 -3
- package/lib/types/index.d.mts +3 -3
- package/lib/types/utils/throttling.d.cts +13 -8
- package/lib/types/utils/throttling.d.mts +13 -8
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -50,21 +50,21 @@ __exportStar(require("./persistence/index.cjs"), exports);
|
|
|
50
50
|
* @const VERSION
|
|
51
51
|
* @memberOf module:core
|
|
52
52
|
*/
|
|
53
|
-
exports.VERSION = "0.26.
|
|
53
|
+
exports.VERSION = "0.26.2";
|
|
54
54
|
/**
|
|
55
55
|
* @description Represents the current commit hash of the module build.
|
|
56
56
|
* @summary Stores the current git commit hash for the package. The build replaces
|
|
57
57
|
* the placeholder with the actual commit hash at publish time.
|
|
58
58
|
* @const COMMIT
|
|
59
59
|
*/
|
|
60
|
-
exports.COMMIT = "
|
|
60
|
+
exports.COMMIT = "3e8a41d";
|
|
61
61
|
/**
|
|
62
62
|
* @description Represents the full version string of the module.
|
|
63
63
|
* @summary Stores the semver version and commit hash for the package.
|
|
64
64
|
* The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
|
|
65
65
|
* @const FULL_VERSION
|
|
66
66
|
*/
|
|
67
|
-
exports.FULL_VERSION = "0.26.
|
|
67
|
+
exports.FULL_VERSION = "0.26.2-3e8a41d";
|
|
68
68
|
/**
|
|
69
69
|
* @description Stores the current package version
|
|
70
70
|
* @summary A constant representing the version of the core package
|
|
@@ -1,57 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThrottleMode = void 0;
|
|
4
|
+
exports.splitByCount = splitByCount;
|
|
5
|
+
exports.splitBySize = splitBySize;
|
|
3
6
|
exports.throttle = throttle;
|
|
4
7
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
5
8
|
const index_js_1 = require("./../persistence/index.cjs");
|
|
6
9
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
7
|
-
function
|
|
8
|
-
|
|
10
|
+
(function (ThrottleMode) {
|
|
11
|
+
ThrottleMode["BY_COUNT"] = "count";
|
|
12
|
+
ThrottleMode["BY_SIZE"] = "size";
|
|
13
|
+
})(exports.ThrottleMode || (exports.ThrottleMode = {}));
|
|
14
|
+
function splitByCount(count) {
|
|
15
|
+
if (count <= 0)
|
|
16
|
+
throw new db_decorators_1.InternalError("splitByCount: count must be greater than zero");
|
|
17
|
+
return (items) => {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
for (let i = 0; i < items.length; i += count)
|
|
20
|
+
chunks.push(items.slice(i, i + count));
|
|
21
|
+
return chunks;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function splitBySize(maxBytes) {
|
|
25
|
+
if (maxBytes <= 0)
|
|
26
|
+
throw new db_decorators_1.InternalError("splitBySize: maxBytes must be greater than zero");
|
|
27
|
+
return (items) => {
|
|
28
|
+
const chunks = [];
|
|
29
|
+
let current = [];
|
|
30
|
+
let size = 0;
|
|
31
|
+
for (const item of items) {
|
|
32
|
+
const itemSize = safeByteLength(item);
|
|
33
|
+
if (current.length > 0 && size + itemSize > maxBytes) {
|
|
34
|
+
chunks.push(current);
|
|
35
|
+
current = [item];
|
|
36
|
+
size = itemSize;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
current.push(item);
|
|
40
|
+
size += itemSize;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (current.length > 0)
|
|
44
|
+
chunks.push(current);
|
|
45
|
+
return chunks;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function throttle(value, modeOrOptions, maybeOptions) {
|
|
49
|
+
let splitter;
|
|
50
|
+
let options;
|
|
51
|
+
if (typeof value === "function") {
|
|
52
|
+
splitter = value;
|
|
53
|
+
options = modeOrOptions ?? {};
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const mode = typeof modeOrOptions === "string"
|
|
57
|
+
? modeOrOptions
|
|
58
|
+
: exports.ThrottleMode.BY_COUNT;
|
|
59
|
+
options =
|
|
60
|
+
(typeof modeOrOptions === "object" && !Array.isArray(modeOrOptions)
|
|
61
|
+
? modeOrOptions
|
|
62
|
+
: maybeOptions) ?? {};
|
|
63
|
+
splitter =
|
|
64
|
+
mode === exports.ThrottleMode.BY_SIZE ? splitBySize(value) : splitByCount(value);
|
|
65
|
+
}
|
|
66
|
+
const { delayMs, argIndex = 0 } = options;
|
|
67
|
+
return function throttleDecorator(target, propertyKey, descriptor) {
|
|
9
68
|
function throttleDec(target, propertyKey, descriptor) {
|
|
10
69
|
descriptor.value = new Proxy(descriptor.value, {
|
|
11
|
-
async apply(
|
|
70
|
+
async apply(originalFn, thisArg, args) {
|
|
12
71
|
const invocationArgs = args;
|
|
13
|
-
const
|
|
14
|
-
try {
|
|
15
|
-
return typeof cfg === "function"
|
|
16
|
-
? cfg(...invocationArgs)
|
|
17
|
-
: cfg;
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
throw new db_decorators_1.InternalError(`Failed to obtain throttling configuration from handler: ${e}`);
|
|
21
|
-
}
|
|
22
|
-
})();
|
|
23
|
-
const { log, ctx } = (await thisArg["logCtx"](args, index_js_1.PersistenceKeys.THROTTLE, true)).for(throttle);
|
|
72
|
+
const { log, ctx } = (await thisArg["logCtx"](args, originalFn.name, true)).for(throttle);
|
|
24
73
|
const normalizedIndices = normalizeArgIndex(argIndex);
|
|
25
|
-
if (!normalizedIndices.length)
|
|
26
|
-
throw new db_decorators_1.InternalError("@
|
|
27
|
-
}
|
|
74
|
+
if (!normalizedIndices.length)
|
|
75
|
+
throw new db_decorators_1.InternalError("@throttle() expects at least one argument index to throttle");
|
|
28
76
|
normalizedIndices.forEach((index) => {
|
|
29
77
|
if (index >= invocationArgs.length)
|
|
30
|
-
throw new db_decorators_1.InternalError(`@
|
|
78
|
+
throw new db_decorators_1.InternalError(`@throttle() requires argument index ${index} but only ${invocationArgs.length} provided`);
|
|
31
79
|
if (!Array.isArray(invocationArgs[index]))
|
|
32
|
-
throw new db_decorators_1.InternalError(`@
|
|
80
|
+
throw new db_decorators_1.InternalError(`@throttle() expects argument at index ${index} to be an array`);
|
|
33
81
|
});
|
|
34
82
|
const arrays = normalizedIndices.map((idx) => invocationArgs[idx]);
|
|
35
83
|
const total = arrays[0].length;
|
|
36
|
-
if (!arrays.every((arr) => arr.length === total))
|
|
37
|
-
throw new db_decorators_1.InternalError("@
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
84
|
+
if (!arrays.every((arr) => arr.length === total))
|
|
85
|
+
throw new db_decorators_1.InternalError("@throttle() requires all targeted arguments to have the same length");
|
|
86
|
+
if (total === 0)
|
|
87
|
+
return originalFn.apply(thisArg, invocationArgs);
|
|
88
|
+
const primaryChunks = splitter(arrays[0]);
|
|
89
|
+
const chunkArgsList = buildChunkArgsList(primaryChunks, arrays, normalizedIndices, invocationArgs);
|
|
90
|
+
const breakOnSingleFailure = options.breakOnSingleFailure ??
|
|
91
|
+
(() => {
|
|
92
|
+
try {
|
|
93
|
+
return ctx.get("breakOnSingleFailureInBulk");
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
})() ??
|
|
99
|
+
true;
|
|
50
100
|
const collectedResults = [];
|
|
51
101
|
const errors = [];
|
|
52
102
|
for (const chunkArgs of chunkArgsList) {
|
|
53
103
|
try {
|
|
54
|
-
const chunkResult = await
|
|
104
|
+
const chunkResult = await originalFn.apply(thisArg, chunkArgs);
|
|
55
105
|
mergeResult(chunkResult, collectedResults);
|
|
56
106
|
}
|
|
57
107
|
catch (error) {
|
|
@@ -59,9 +109,8 @@ function throttle(cfg = { count: 1 }, argIndex = 0) {
|
|
|
59
109
|
throw error;
|
|
60
110
|
errors.push(error);
|
|
61
111
|
}
|
|
62
|
-
if (
|
|
63
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
64
|
-
}
|
|
112
|
+
if (delayMs)
|
|
113
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
65
114
|
}
|
|
66
115
|
if (errors.length) {
|
|
67
116
|
log.warn(`${String(propertyKey)} throttled execution continued with ${errors.length} failure(s)`);
|
|
@@ -73,56 +122,32 @@ function throttle(cfg = { count: 1 }, argIndex = 0) {
|
|
|
73
122
|
},
|
|
74
123
|
});
|
|
75
124
|
}
|
|
76
|
-
return (0, decoration_1.apply)((0, decoration_1.methodMetadata)(decoration_1.Metadata.key(index_js_1.PersistenceKeys.THROTTLE, propertyKey),
|
|
125
|
+
return (0, decoration_1.apply)((0, decoration_1.methodMetadata)(decoration_1.Metadata.key(index_js_1.PersistenceKeys.THROTTLE, propertyKey), options), throttleDec)(target, propertyKey, descriptor);
|
|
77
126
|
};
|
|
78
127
|
}
|
|
79
128
|
function normalizeArgIndex(argIndex) {
|
|
80
129
|
const entries = (Array.isArray(argIndex) ? argIndex : [argIndex]).map((idx) => {
|
|
81
130
|
if (!Number.isFinite(idx) || idx < 0)
|
|
82
|
-
throw new db_decorators_1.InternalError("@
|
|
131
|
+
throw new db_decorators_1.InternalError("@throttle() argument indexes must be non-negative integers");
|
|
83
132
|
return idx;
|
|
84
133
|
});
|
|
85
134
|
return Array.from(new Set(entries)).sort((a, b) => a - b);
|
|
86
135
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
throw new db_decorators_1.InternalError("@throttling() configuration 'bufferSize' must be greater than zero");
|
|
103
|
-
const spans = [];
|
|
104
|
-
let start = 0;
|
|
105
|
-
let size = 0;
|
|
106
|
-
for (let idx = 0; idx < total; idx++) {
|
|
107
|
-
const entrySize = estimateEntrySize(arrays, idx);
|
|
108
|
-
if (size > 0 && size + entrySize > cfg.bufferSize) {
|
|
109
|
-
spans.push({ start, end: idx });
|
|
110
|
-
start = idx;
|
|
111
|
-
size = entrySize;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
size += entrySize;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (start < total || !spans.length) {
|
|
118
|
-
spans.push({ start, end: total });
|
|
119
|
-
}
|
|
120
|
-
return spans;
|
|
121
|
-
}
|
|
122
|
-
return [{ start: 0, end: total }];
|
|
123
|
-
}
|
|
124
|
-
function estimateEntrySize(arrays, index) {
|
|
125
|
-
return arrays.reduce((acc, array) => acc + safeByteLength(array[index]), 0);
|
|
136
|
+
function buildChunkArgsList(primaryChunks, arrays, normalizedIndices, invocationArgs) {
|
|
137
|
+
let offset = 0;
|
|
138
|
+
return primaryChunks.map((chunk) => {
|
|
139
|
+
const chunkLen = chunk.length;
|
|
140
|
+
const args = invocationArgs.map((arg, idx) => {
|
|
141
|
+
const targetIdx = normalizedIndices.indexOf(idx);
|
|
142
|
+
if (targetIdx === -1)
|
|
143
|
+
return arg;
|
|
144
|
+
return targetIdx === 0
|
|
145
|
+
? chunk
|
|
146
|
+
: arrays[targetIdx].slice(offset, offset + chunkLen);
|
|
147
|
+
});
|
|
148
|
+
offset += chunkLen;
|
|
149
|
+
return args;
|
|
150
|
+
});
|
|
126
151
|
}
|
|
127
152
|
function safeByteLength(value) {
|
|
128
153
|
if (value === null || typeof value === "undefined")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttling.js","sourceRoot":"","sources":["throttling.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"throttling.js","sourceRoot":"","sources":["throttling.js"],"names":[],"mappings":";;;AAQA,oCASC;AACD,kCAuBC;AACD,4BA+EC;AAzHD,qDAAuE;AACvE,wDAA4D;AAC5D,2DAAwD;AAExD,CAAC,UAAU,YAAY;IACnB,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IACnC,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AACrC,CAAC,CAAC,CAAC,oBAAY,IAAI,CAAC,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AACxC,SAAgB,YAAY,CAAC,KAAK;IAC9B,IAAI,KAAK,IAAI,CAAC;QACV,MAAM,IAAI,6BAAa,CAAC,+CAA+C,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,KAAK;YACxC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC;AACD,SAAgB,WAAW,CAAC,QAAQ;IAChC,IAAI,QAAQ,IAAI,CAAC;QACb,MAAM,IAAI,6BAAa,CAAC,iDAAiD,CAAC,CAAC;IAC/E,OAAO,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,IAAI,IAA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AC,GAAG,MAAM,CAAC,CAAC;IAC9B,CAAC;SACI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACrC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;AACL,CAAC;AACD,sCAAsC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -33,21 +33,21 @@ export * from "./persistence/index.js";
|
|
|
33
33
|
* @const VERSION
|
|
34
34
|
* @memberOf module:core
|
|
35
35
|
*/
|
|
36
|
-
export const VERSION = "0.26.
|
|
36
|
+
export const VERSION = "0.26.2";
|
|
37
37
|
/**
|
|
38
38
|
* @description Represents the current commit hash of the module build.
|
|
39
39
|
* @summary Stores the current git commit hash for the package. The build replaces
|
|
40
40
|
* the placeholder with the actual commit hash at publish time.
|
|
41
41
|
* @const COMMIT
|
|
42
42
|
*/
|
|
43
|
-
export const COMMIT = "
|
|
43
|
+
export const COMMIT = "3e8a41d";
|
|
44
44
|
/**
|
|
45
45
|
* @description Represents the full version string of the module.
|
|
46
46
|
* @summary Stores the semver version and commit hash for the package.
|
|
47
47
|
* The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
|
|
48
48
|
* @const FULL_VERSION
|
|
49
49
|
*/
|
|
50
|
-
export const FULL_VERSION = "0.26.
|
|
50
|
+
export const FULL_VERSION = "0.26.2-3e8a41d";
|
|
51
51
|
/**
|
|
52
52
|
* @description Stores the current package version
|
|
53
53
|
* @summary A constant representing the version of the core package
|
|
@@ -1,54 +1,102 @@
|
|
|
1
1
|
import { apply, Metadata, methodMetadata } from "@decaf-ts/decoration";
|
|
2
2
|
import { PersistenceKeys } from "./../persistence/index.js";
|
|
3
3
|
import { InternalError } from "@decaf-ts/db-decorators";
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export var ThrottleMode;
|
|
5
|
+
(function (ThrottleMode) {
|
|
6
|
+
ThrottleMode["BY_COUNT"] = "count";
|
|
7
|
+
ThrottleMode["BY_SIZE"] = "size";
|
|
8
|
+
})(ThrottleMode || (ThrottleMode = {}));
|
|
9
|
+
export function splitByCount(count) {
|
|
10
|
+
if (count <= 0)
|
|
11
|
+
throw new InternalError("splitByCount: count must be greater than zero");
|
|
12
|
+
return (items) => {
|
|
13
|
+
const chunks = [];
|
|
14
|
+
for (let i = 0; i < items.length; i += count)
|
|
15
|
+
chunks.push(items.slice(i, i + count));
|
|
16
|
+
return chunks;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function splitBySize(maxBytes) {
|
|
20
|
+
if (maxBytes <= 0)
|
|
21
|
+
throw new InternalError("splitBySize: maxBytes must be greater than zero");
|
|
22
|
+
return (items) => {
|
|
23
|
+
const chunks = [];
|
|
24
|
+
let current = [];
|
|
25
|
+
let size = 0;
|
|
26
|
+
for (const item of items) {
|
|
27
|
+
const itemSize = safeByteLength(item);
|
|
28
|
+
if (current.length > 0 && size + itemSize > maxBytes) {
|
|
29
|
+
chunks.push(current);
|
|
30
|
+
current = [item];
|
|
31
|
+
size = itemSize;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
current.push(item);
|
|
35
|
+
size += itemSize;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (current.length > 0)
|
|
39
|
+
chunks.push(current);
|
|
40
|
+
return chunks;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function throttle(value, modeOrOptions, maybeOptions) {
|
|
44
|
+
let splitter;
|
|
45
|
+
let options;
|
|
46
|
+
if (typeof value === "function") {
|
|
47
|
+
splitter = value;
|
|
48
|
+
options = modeOrOptions ?? {};
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const mode = typeof modeOrOptions === "string"
|
|
52
|
+
? modeOrOptions
|
|
53
|
+
: ThrottleMode.BY_COUNT;
|
|
54
|
+
options =
|
|
55
|
+
(typeof modeOrOptions === "object" && !Array.isArray(modeOrOptions)
|
|
56
|
+
? modeOrOptions
|
|
57
|
+
: maybeOptions) ?? {};
|
|
58
|
+
splitter =
|
|
59
|
+
mode === ThrottleMode.BY_SIZE ? splitBySize(value) : splitByCount(value);
|
|
60
|
+
}
|
|
61
|
+
const { delayMs, argIndex = 0 } = options;
|
|
62
|
+
return function throttleDecorator(target, propertyKey, descriptor) {
|
|
6
63
|
function throttleDec(target, propertyKey, descriptor) {
|
|
7
64
|
descriptor.value = new Proxy(descriptor.value, {
|
|
8
|
-
async apply(
|
|
65
|
+
async apply(originalFn, thisArg, args) {
|
|
9
66
|
const invocationArgs = args;
|
|
10
|
-
const
|
|
11
|
-
try {
|
|
12
|
-
return typeof cfg === "function"
|
|
13
|
-
? cfg(...invocationArgs)
|
|
14
|
-
: cfg;
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
throw new InternalError(`Failed to obtain throttling configuration from handler: ${e}`);
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
const { log, ctx } = (await thisArg["logCtx"](args, PersistenceKeys.THROTTLE, true)).for(throttle);
|
|
67
|
+
const { log, ctx } = (await thisArg["logCtx"](args, originalFn.name, true)).for(throttle);
|
|
21
68
|
const normalizedIndices = normalizeArgIndex(argIndex);
|
|
22
|
-
if (!normalizedIndices.length)
|
|
23
|
-
throw new InternalError("@
|
|
24
|
-
}
|
|
69
|
+
if (!normalizedIndices.length)
|
|
70
|
+
throw new InternalError("@throttle() expects at least one argument index to throttle");
|
|
25
71
|
normalizedIndices.forEach((index) => {
|
|
26
72
|
if (index >= invocationArgs.length)
|
|
27
|
-
throw new InternalError(`@
|
|
73
|
+
throw new InternalError(`@throttle() requires argument index ${index} but only ${invocationArgs.length} provided`);
|
|
28
74
|
if (!Array.isArray(invocationArgs[index]))
|
|
29
|
-
throw new InternalError(`@
|
|
75
|
+
throw new InternalError(`@throttle() expects argument at index ${index} to be an array`);
|
|
30
76
|
});
|
|
31
77
|
const arrays = normalizedIndices.map((idx) => invocationArgs[idx]);
|
|
32
78
|
const total = arrays[0].length;
|
|
33
|
-
if (!arrays.every((arr) => arr.length === total))
|
|
34
|
-
throw new InternalError("@
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
79
|
+
if (!arrays.every((arr) => arr.length === total))
|
|
80
|
+
throw new InternalError("@throttle() requires all targeted arguments to have the same length");
|
|
81
|
+
if (total === 0)
|
|
82
|
+
return originalFn.apply(thisArg, invocationArgs);
|
|
83
|
+
const primaryChunks = splitter(arrays[0]);
|
|
84
|
+
const chunkArgsList = buildChunkArgsList(primaryChunks, arrays, normalizedIndices, invocationArgs);
|
|
85
|
+
const breakOnSingleFailure = options.breakOnSingleFailure ??
|
|
86
|
+
(() => {
|
|
87
|
+
try {
|
|
88
|
+
return ctx.get("breakOnSingleFailureInBulk");
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
})() ??
|
|
94
|
+
true;
|
|
47
95
|
const collectedResults = [];
|
|
48
96
|
const errors = [];
|
|
49
97
|
for (const chunkArgs of chunkArgsList) {
|
|
50
98
|
try {
|
|
51
|
-
const chunkResult = await
|
|
99
|
+
const chunkResult = await originalFn.apply(thisArg, chunkArgs);
|
|
52
100
|
mergeResult(chunkResult, collectedResults);
|
|
53
101
|
}
|
|
54
102
|
catch (error) {
|
|
@@ -56,9 +104,8 @@ export function throttle(cfg = { count: 1 }, argIndex = 0) {
|
|
|
56
104
|
throw error;
|
|
57
105
|
errors.push(error);
|
|
58
106
|
}
|
|
59
|
-
if (
|
|
60
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
61
|
-
}
|
|
107
|
+
if (delayMs)
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
62
109
|
}
|
|
63
110
|
if (errors.length) {
|
|
64
111
|
log.warn(`${String(propertyKey)} throttled execution continued with ${errors.length} failure(s)`);
|
|
@@ -70,56 +117,32 @@ export function throttle(cfg = { count: 1 }, argIndex = 0) {
|
|
|
70
117
|
},
|
|
71
118
|
});
|
|
72
119
|
}
|
|
73
|
-
return apply(methodMetadata(Metadata.key(PersistenceKeys.THROTTLE, propertyKey),
|
|
120
|
+
return apply(methodMetadata(Metadata.key(PersistenceKeys.THROTTLE, propertyKey), options), throttleDec)(target, propertyKey, descriptor);
|
|
74
121
|
};
|
|
75
122
|
}
|
|
76
123
|
function normalizeArgIndex(argIndex) {
|
|
77
124
|
const entries = (Array.isArray(argIndex) ? argIndex : [argIndex]).map((idx) => {
|
|
78
125
|
if (!Number.isFinite(idx) || idx < 0)
|
|
79
|
-
throw new InternalError("@
|
|
126
|
+
throw new InternalError("@throttle() argument indexes must be non-negative integers");
|
|
80
127
|
return idx;
|
|
81
128
|
});
|
|
82
129
|
return Array.from(new Set(entries)).sort((a, b) => a - b);
|
|
83
130
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
throw new InternalError("@throttling() configuration 'bufferSize' must be greater than zero");
|
|
100
|
-
const spans = [];
|
|
101
|
-
let start = 0;
|
|
102
|
-
let size = 0;
|
|
103
|
-
for (let idx = 0; idx < total; idx++) {
|
|
104
|
-
const entrySize = estimateEntrySize(arrays, idx);
|
|
105
|
-
if (size > 0 && size + entrySize > cfg.bufferSize) {
|
|
106
|
-
spans.push({ start, end: idx });
|
|
107
|
-
start = idx;
|
|
108
|
-
size = entrySize;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
size += entrySize;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (start < total || !spans.length) {
|
|
115
|
-
spans.push({ start, end: total });
|
|
116
|
-
}
|
|
117
|
-
return spans;
|
|
118
|
-
}
|
|
119
|
-
return [{ start: 0, end: total }];
|
|
120
|
-
}
|
|
121
|
-
function estimateEntrySize(arrays, index) {
|
|
122
|
-
return arrays.reduce((acc, array) => acc + safeByteLength(array[index]), 0);
|
|
131
|
+
function buildChunkArgsList(primaryChunks, arrays, normalizedIndices, invocationArgs) {
|
|
132
|
+
let offset = 0;
|
|
133
|
+
return primaryChunks.map((chunk) => {
|
|
134
|
+
const chunkLen = chunk.length;
|
|
135
|
+
const args = invocationArgs.map((arg, idx) => {
|
|
136
|
+
const targetIdx = normalizedIndices.indexOf(idx);
|
|
137
|
+
if (targetIdx === -1)
|
|
138
|
+
return arg;
|
|
139
|
+
return targetIdx === 0
|
|
140
|
+
? chunk
|
|
141
|
+
: arrays[targetIdx].slice(offset, offset + chunkLen);
|
|
142
|
+
});
|
|
143
|
+
offset += chunkLen;
|
|
144
|
+
return args;
|
|
145
|
+
});
|
|
123
146
|
}
|
|
124
147
|
function safeByteLength(value) {
|
|
125
148
|
if (value === null || typeof value === "undefined")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttling.js","sourceRoot":"","sources":["../../../src/utils/throttling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,kCAA6B;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"throttling.js","sourceRoot":"","sources":["../../../src/utils/throttling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,kCAA6B;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,kCAAkB,CAAA;IAClB,gCAAgB,CAAA;AAClB,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KAAK,CAAC,CAAC;gBAAE,OAAO,GAAG,CAAC;YACjC,OAAO,SAAS,KAAK,CAAC;gBACpB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,QAAQ,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAChC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW;QAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,SAAgB;IACpD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC5B,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
package/lib/types/index.d.cts
CHANGED
|
@@ -24,21 +24,21 @@ export * from "./persistence/index.d.cts";
|
|
|
24
24
|
* @const VERSION
|
|
25
25
|
* @memberOf module:core
|
|
26
26
|
*/
|
|
27
|
-
export declare const VERSION = "0.26.
|
|
27
|
+
export declare const VERSION = "0.26.2";
|
|
28
28
|
/**
|
|
29
29
|
* @description Represents the current commit hash of the module build.
|
|
30
30
|
* @summary Stores the current git commit hash for the package. The build replaces
|
|
31
31
|
* the placeholder with the actual commit hash at publish time.
|
|
32
32
|
* @const COMMIT
|
|
33
33
|
*/
|
|
34
|
-
export declare const COMMIT = "
|
|
34
|
+
export declare const COMMIT = "3e8a41d";
|
|
35
35
|
/**
|
|
36
36
|
* @description Represents the full version string of the module.
|
|
37
37
|
* @summary Stores the semver version and commit hash for the package.
|
|
38
38
|
* The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
|
|
39
39
|
* @const FULL_VERSION
|
|
40
40
|
*/
|
|
41
|
-
export declare const FULL_VERSION = "0.26.
|
|
41
|
+
export declare const FULL_VERSION = "0.26.2-3e8a41d";
|
|
42
42
|
/**
|
|
43
43
|
* @description Stores the current package version
|
|
44
44
|
* @summary A constant representing the version of the core package
|
package/lib/types/index.d.mts
CHANGED
|
@@ -24,21 +24,21 @@ export * from "./persistence/index.d.mts";
|
|
|
24
24
|
* @const VERSION
|
|
25
25
|
* @memberOf module:core
|
|
26
26
|
*/
|
|
27
|
-
export declare const VERSION = "0.26.
|
|
27
|
+
export declare const VERSION = "0.26.2";
|
|
28
28
|
/**
|
|
29
29
|
* @description Represents the current commit hash of the module build.
|
|
30
30
|
* @summary Stores the current git commit hash for the package. The build replaces
|
|
31
31
|
* the placeholder with the actual commit hash at publish time.
|
|
32
32
|
* @const COMMIT
|
|
33
33
|
*/
|
|
34
|
-
export declare const COMMIT = "
|
|
34
|
+
export declare const COMMIT = "3e8a41d";
|
|
35
35
|
/**
|
|
36
36
|
* @description Represents the full version string of the module.
|
|
37
37
|
* @summary Stores the semver version and commit hash for the package.
|
|
38
38
|
* The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
|
|
39
39
|
* @const FULL_VERSION
|
|
40
40
|
*/
|
|
41
|
-
export declare const FULL_VERSION = "0.26.
|
|
41
|
+
export declare const FULL_VERSION = "0.26.2-3e8a41d";
|
|
42
42
|
/**
|
|
43
43
|
* @description Stores the current package version
|
|
44
44
|
* @summary A constant representing the version of the core package
|