@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/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.1";
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 = "fdaeb5d";
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.1-fdaeb5d";
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 throttle(cfg = { count: 1 }, argIndex = 0) {
8
- return function throttle(target, propertyKey, descriptor) {
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(target, thisArg, args) {
70
+ async apply(originalFn, thisArg, args) {
12
71
  const invocationArgs = args;
13
- const effectiveCfg = (() => {
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("@throttling() expects at least one argument index to throttle");
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(`@throttling() requires argument index ${index} but only ${invocationArgs.length} provided`);
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(`@throttling() expects argument at index ${index} to be an array`);
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("@throttling() requires all targeted arguments to have the same length");
38
- }
39
- if (total === 0) {
40
- return target.apply(thisArg, invocationArgs);
41
- }
42
- const chunkBounds = buildChunkBounds(total, arrays, effectiveCfg);
43
- const chunkArgsList = chunkBounds.map(({ start, end }) => invocationArgs.map((arg, idx) => {
44
- const targetIdx = normalizedIndices.indexOf(idx);
45
- if (targetIdx === -1)
46
- return arg;
47
- return arrays[targetIdx].slice(start, end);
48
- }));
49
- const breakOnSingleFailure = ctx.get("breakOnSingleFailureInBulk") ?? true;
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 target.apply(thisArg, chunkArgs);
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 (effectiveCfg.delayMs) {
63
- await new Promise((resolve) => setTimeout(resolve, effectiveCfg.delayMs));
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), cfg), throttleDec)(target, propertyKey, descriptor);
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("@throttling() argument indexes must be non-negative integers");
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 buildChunkBounds(total, arrays, cfg) {
88
- if ("count" in cfg) {
89
- if (cfg.count <= 0)
90
- throw new db_decorators_1.InternalError("@throttling() configuration 'count' must be greater than zero");
91
- const spans = [];
92
- for (let start = 0; start < total; start += cfg.count) {
93
- spans.push({
94
- start,
95
- end: Math.min(total, start + cfg.count),
96
- });
97
- }
98
- return spans;
99
- }
100
- if ("bufferSize" in cfg) {
101
- if (cfg.bufferSize <= 0)
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":";;AAGA,4BAuEC;AA1ED,qDAAuE;AACvE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AAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW;QAC9C,OAAO,CAAC,CAAC;IACb,IAAI,CAAC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,CAAC;QACH,OAAO,CAAC,CAAC;IACb,CAAC;AACL,CAAC;AACD,SAAS,WAAW,CAAC,MAAM,EAAE,SAAS;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,SAAS,CAAC,IAAI,CAAC,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.1";
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 = "fdaeb5d";
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.1-fdaeb5d";
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 function throttle(cfg = { count: 1 }, argIndex = 0) {
5
- return function throttle(target, propertyKey, descriptor) {
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(target, thisArg, args) {
65
+ async apply(originalFn, thisArg, args) {
9
66
  const invocationArgs = args;
10
- const effectiveCfg = (() => {
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("@throttling() expects at least one argument index to throttle");
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(`@throttling() requires argument index ${index} but only ${invocationArgs.length} provided`);
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(`@throttling() expects argument at index ${index} to be an array`);
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("@throttling() requires all targeted arguments to have the same length");
35
- }
36
- if (total === 0) {
37
- return target.apply(thisArg, invocationArgs);
38
- }
39
- const chunkBounds = buildChunkBounds(total, arrays, effectiveCfg);
40
- const chunkArgsList = chunkBounds.map(({ start, end }) => invocationArgs.map((arg, idx) => {
41
- const targetIdx = normalizedIndices.indexOf(idx);
42
- if (targetIdx === -1)
43
- return arg;
44
- return arrays[targetIdx].slice(start, end);
45
- }));
46
- const breakOnSingleFailure = ctx.get("breakOnSingleFailureInBulk") ?? true;
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 target.apply(thisArg, chunkArgs);
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 (effectiveCfg.delayMs) {
60
- await new Promise((resolve) => setTimeout(resolve, effectiveCfg.delayMs));
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), cfg), throttleDec)(target, propertyKey, descriptor);
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("@throttling() argument indexes must be non-negative integers");
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 buildChunkBounds(total, arrays, cfg) {
85
- if ("count" in cfg) {
86
- if (cfg.count <= 0)
87
- throw new InternalError("@throttling() configuration 'count' must be greater than zero");
88
- const spans = [];
89
- for (let start = 0; start < total; start += cfg.count) {
90
- spans.push({
91
- start,
92
- end: Math.min(total, start + cfg.count),
93
- });
94
- }
95
- return spans;
96
- }
97
- if ("bufferSize" in cfg) {
98
- if (cfg.bufferSize <= 0)
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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,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"}
@@ -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.1";
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 = "fdaeb5d";
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.1-fdaeb5d";
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
@@ -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.1";
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 = "fdaeb5d";
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.1-fdaeb5d";
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