@acmekit/orchestration 2.13.36 → 2.13.37
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/transaction/errors.d.ts +0 -14
- package/dist/transaction/errors.d.ts.map +1 -1
- package/dist/transaction/errors.js +1 -37
- package/dist/transaction/errors.js.map +1 -1
- package/dist/transaction/index.d.ts +0 -4
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction/index.js +0 -4
- package/dist/transaction/index.js.map +1 -1
- package/dist/transaction/transaction-orchestrator.d.ts +0 -31
- package/dist/transaction/transaction-orchestrator.d.ts.map +1 -1
- package/dist/transaction/transaction-orchestrator.js +1 -225
- package/dist/transaction/transaction-orchestrator.js.map +1 -1
- package/dist/transaction/types.d.ts +0 -85
- package/dist/transaction/types.d.ts.map +1 -1
- package/dist/transaction/types.js +0 -1
- package/dist/transaction/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/transaction/audit-log.d.ts +0 -66
- package/dist/transaction/audit-log.d.ts.map +0 -1
- package/dist/transaction/audit-log.js +0 -32
- package/dist/transaction/audit-log.js.map +0 -1
- package/dist/transaction/circuit-breaker.d.ts +0 -48
- package/dist/transaction/circuit-breaker.d.ts.map +0 -1
- package/dist/transaction/circuit-breaker.js +0 -59
- package/dist/transaction/circuit-breaker.js.map +0 -1
- package/dist/transaction/metrics.d.ts +0 -71
- package/dist/transaction/metrics.d.ts.map +0 -1
- package/dist/transaction/metrics.js +0 -37
- package/dist/transaction/metrics.js.map +0 -1
- package/dist/transaction/rate-limiter.d.ts +0 -40
- package/dist/transaction/rate-limiter.d.ts.map +0 -1
- package/dist/transaction/rate-limiter.js +0 -31
- package/dist/transaction/rate-limiter.js.map +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryCircuitBreaker = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default in-memory circuit breaker. Suitable for single-process deployments,
|
|
6
|
-
* development, and testing.
|
|
7
|
-
*/
|
|
8
|
-
class InMemoryCircuitBreaker {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.circuits_ = new Map();
|
|
11
|
-
}
|
|
12
|
-
getOrCreate(key) {
|
|
13
|
-
let entry = this.circuits_.get(key);
|
|
14
|
-
if (!entry) {
|
|
15
|
-
entry = { state: "closed", failures: 0, lastFailureAt: null };
|
|
16
|
-
this.circuits_.set(key, entry);
|
|
17
|
-
}
|
|
18
|
-
return entry;
|
|
19
|
-
}
|
|
20
|
-
getState(key) {
|
|
21
|
-
const entry = this.getOrCreate(key);
|
|
22
|
-
if (entry.state === "open" && entry.lastFailureAt) {
|
|
23
|
-
// This is checked externally via config.resetAfterMs
|
|
24
|
-
// Here we just return the raw state; the orchestrator handles transition
|
|
25
|
-
}
|
|
26
|
-
return entry.state;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Transition from open to half-open if enough time has passed.
|
|
30
|
-
*/
|
|
31
|
-
maybeTransition(key, config) {
|
|
32
|
-
const entry = this.getOrCreate(key);
|
|
33
|
-
if (entry.state === "open" &&
|
|
34
|
-
entry.lastFailureAt &&
|
|
35
|
-
Date.now() - entry.lastFailureAt >= config.resetAfterMs) {
|
|
36
|
-
entry.state = "half_open";
|
|
37
|
-
}
|
|
38
|
-
return entry.state;
|
|
39
|
-
}
|
|
40
|
-
recordSuccess(key) {
|
|
41
|
-
const entry = this.getOrCreate(key);
|
|
42
|
-
entry.state = "closed";
|
|
43
|
-
entry.failures = 0;
|
|
44
|
-
entry.lastFailureAt = null;
|
|
45
|
-
}
|
|
46
|
-
recordFailure(key, config) {
|
|
47
|
-
const entry = this.getOrCreate(key);
|
|
48
|
-
entry.failures++;
|
|
49
|
-
entry.lastFailureAt = Date.now();
|
|
50
|
-
if (entry.failures >= config.threshold) {
|
|
51
|
-
entry.state = "open";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
clear() {
|
|
55
|
-
this.circuits_.clear();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.InMemoryCircuitBreaker = InMemoryCircuitBreaker;
|
|
59
|
-
//# sourceMappingURL=circuit-breaker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circuit-breaker.js","sourceRoot":"","sources":["../../src/transaction/circuit-breaker.ts"],"names":[],"mappings":";;;AA2CA;;;GAGG;AACH,MAAa,sBAAsB;IAAnC;QACU,cAAS,GAA8B,IAAI,GAAG,EAAE,CAAA;IAsD1D,CAAC;IApDS,WAAW,CAAC,GAAW;QAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAA;YAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YAClD,qDAAqD;YACrD,yEAAyE;QAC3E,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,GAAW,EAAE,MAA4B;QACvD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACnC,IACE,KAAK,CAAC,KAAK,KAAK,MAAM;YACtB,KAAK,CAAC,aAAa;YACnB,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,aAAa,IAAI,MAAM,CAAC,YAAY,EACvD,CAAC;YACD,KAAK,CAAC,KAAK,GAAG,WAAW,CAAA;QAC3B,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAA;IACpB,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACnC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAA;QACtB,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAA;QAClB,KAAK,CAAC,aAAa,GAAG,IAAI,CAAA;IAC5B,CAAC;IAED,aAAa,CAAC,GAAW,EAAE,MAA4B;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACnC,KAAK,CAAC,QAAQ,EAAE,CAAA;QAChB,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAChC,IAAI,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACvC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAA;QACtB,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;CACF;AAvDD,wDAuDC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Metrics for an individual step execution.
|
|
3
|
-
*/
|
|
4
|
-
export type StepMetrics = {
|
|
5
|
-
workflowId: string;
|
|
6
|
-
transactionId: string;
|
|
7
|
-
stepId: string;
|
|
8
|
-
action: string;
|
|
9
|
-
type: "invoke" | "compensate";
|
|
10
|
-
status: "success" | "failure" | "skipped" | "timeout";
|
|
11
|
-
attempt: number;
|
|
12
|
-
startedAt: number;
|
|
13
|
-
completedAt: number;
|
|
14
|
-
durationMs: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Aggregated metrics for a complete workflow execution.
|
|
18
|
-
*/
|
|
19
|
-
export type WorkflowMetrics = {
|
|
20
|
-
workflowId: string;
|
|
21
|
-
transactionId: string;
|
|
22
|
-
status: "done" | "reverted" | "failed";
|
|
23
|
-
startedAt: number;
|
|
24
|
-
completedAt: number;
|
|
25
|
-
totalDurationMs: number;
|
|
26
|
-
stepCount: number;
|
|
27
|
-
compensationCount: number;
|
|
28
|
-
retryTotal: number;
|
|
29
|
-
steps: StepMetrics[];
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Interface for collecting workflow and step metrics.
|
|
33
|
-
* Implement this interface to integrate with Prometheus, Datadog, or any monitoring system.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* class PrometheusMetricsCollector implements IMetricsCollector {
|
|
38
|
-
* recordStepMetrics(metrics: StepMetrics) {
|
|
39
|
-
* stepDurationHistogram.observe(
|
|
40
|
-
* { workflow: metrics.workflowId, step: metrics.action, status: metrics.status },
|
|
41
|
-
* metrics.durationMs / 1000
|
|
42
|
-
* )
|
|
43
|
-
* }
|
|
44
|
-
* recordWorkflowMetrics(metrics: WorkflowMetrics) {
|
|
45
|
-
* workflowDurationHistogram.observe(
|
|
46
|
-
* { workflow: metrics.workflowId, status: metrics.status },
|
|
47
|
-
* metrics.totalDurationMs / 1000
|
|
48
|
-
* )
|
|
49
|
-
* }
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export interface IMetricsCollector {
|
|
54
|
-
recordStepMetrics(metrics: StepMetrics): void;
|
|
55
|
-
recordWorkflowMetrics(metrics: WorkflowMetrics): void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Default in-memory metrics collector. Stores metrics in memory for inspection.
|
|
59
|
-
* Useful for development, testing, and lightweight deployments.
|
|
60
|
-
*/
|
|
61
|
-
export declare class InMemoryMetricsCollector implements IMetricsCollector {
|
|
62
|
-
private stepMetrics_;
|
|
63
|
-
private workflowMetrics_;
|
|
64
|
-
recordStepMetrics(metrics: StepMetrics): void;
|
|
65
|
-
recordWorkflowMetrics(metrics: WorkflowMetrics): void;
|
|
66
|
-
getStepMetrics(transactionId?: string): StepMetrics[];
|
|
67
|
-
getWorkflowMetrics(transactionId: string): WorkflowMetrics | undefined;
|
|
68
|
-
getAllWorkflowMetrics(): WorkflowMetrics[];
|
|
69
|
-
clear(): void;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/transaction/metrics.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAA;IAC7B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7C,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,gBAAgB,CAA0C;IAElE,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAI7C,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAIrD,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE;IAOrD,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItE,qBAAqB,IAAI,eAAe,EAAE;IAI1C,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryMetricsCollector = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default in-memory metrics collector. Stores metrics in memory for inspection.
|
|
6
|
-
* Useful for development, testing, and lightweight deployments.
|
|
7
|
-
*/
|
|
8
|
-
class InMemoryMetricsCollector {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.stepMetrics_ = [];
|
|
11
|
-
this.workflowMetrics_ = new Map();
|
|
12
|
-
}
|
|
13
|
-
recordStepMetrics(metrics) {
|
|
14
|
-
this.stepMetrics_.push(metrics);
|
|
15
|
-
}
|
|
16
|
-
recordWorkflowMetrics(metrics) {
|
|
17
|
-
this.workflowMetrics_.set(metrics.transactionId, metrics);
|
|
18
|
-
}
|
|
19
|
-
getStepMetrics(transactionId) {
|
|
20
|
-
if (transactionId) {
|
|
21
|
-
return this.stepMetrics_.filter((m) => m.transactionId === transactionId);
|
|
22
|
-
}
|
|
23
|
-
return [...this.stepMetrics_];
|
|
24
|
-
}
|
|
25
|
-
getWorkflowMetrics(transactionId) {
|
|
26
|
-
return this.workflowMetrics_.get(transactionId);
|
|
27
|
-
}
|
|
28
|
-
getAllWorkflowMetrics() {
|
|
29
|
-
return [...this.workflowMetrics_.values()];
|
|
30
|
-
}
|
|
31
|
-
clear() {
|
|
32
|
-
this.stepMetrics_ = [];
|
|
33
|
-
this.workflowMetrics_.clear();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.InMemoryMetricsCollector = InMemoryMetricsCollector;
|
|
37
|
-
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/transaction/metrics.ts"],"names":[],"mappings":";;;AA2DA;;;GAGG;AACH,MAAa,wBAAwB;IAArC;QACU,iBAAY,GAAkB,EAAE,CAAA;QAChC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAA;IA6BpE,CAAC;IA3BC,iBAAiB,CAAC,OAAoB;QACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;IAED,qBAAqB,CAAC,OAAwB;QAC5C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IAED,cAAc,CAAC,aAAsB;QACnC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,CAAA;QAC3E,CAAC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;IAED,kBAAkB,CAAC,aAAqB;QACtC,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACjD,CAAC;IAED,qBAAqB;QACnB,OAAO,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;QACtB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAA;IAC/B,CAAC;CACF;AA/BD,4DA+BC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for workflow-level rate limiting.
|
|
3
|
-
*/
|
|
4
|
-
export type RateLimitConfig = {
|
|
5
|
-
/** Maximum number of executions allowed in the window. */
|
|
6
|
-
maxExecutions: number;
|
|
7
|
-
/** Rolling window duration in milliseconds. */
|
|
8
|
-
windowMs: number;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Interface for a rate limiter. Implement this to back rate limiting
|
|
12
|
-
* with Redis (sliding window), a database, or any shared state.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* class RedisRateLimiter implements IRateLimiter {
|
|
17
|
-
* async acquire(key: string, config: RateLimitConfig) {
|
|
18
|
-
* // Use ZRANGEBYSCORE + ZADD for sliding window
|
|
19
|
-
* return allowed
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export interface IRateLimiter {
|
|
25
|
-
/**
|
|
26
|
-
* Attempt to acquire a rate limit slot.
|
|
27
|
-
* Returns `true` if the execution is allowed, `false` if rate-limited.
|
|
28
|
-
*/
|
|
29
|
-
acquire(key: string, config: RateLimitConfig): boolean | Promise<boolean>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Default in-memory rate limiter using a sliding window of timestamps.
|
|
33
|
-
* Suitable for single-process deployments, development, and testing.
|
|
34
|
-
*/
|
|
35
|
-
export declare class InMemoryRateLimiter implements IRateLimiter {
|
|
36
|
-
private windows_;
|
|
37
|
-
acquire(key: string, config: RateLimitConfig): boolean;
|
|
38
|
-
clear(): void;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../src/transaction/rate-limiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;IACrB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,OAAO,CACL,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,eAAe,GACtB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IACtD,OAAO,CAAC,QAAQ,CAAmC;IAEnD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO;IAkBtD,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryRateLimiter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default in-memory rate limiter using a sliding window of timestamps.
|
|
6
|
-
* Suitable for single-process deployments, development, and testing.
|
|
7
|
-
*/
|
|
8
|
-
class InMemoryRateLimiter {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.windows_ = new Map();
|
|
11
|
-
}
|
|
12
|
-
acquire(key, config) {
|
|
13
|
-
const now = Date.now();
|
|
14
|
-
const cutoff = now - config.windowMs;
|
|
15
|
-
let timestamps = this.windows_.get(key) ?? [];
|
|
16
|
-
// Remove expired entries
|
|
17
|
-
timestamps = timestamps.filter((t) => t > cutoff);
|
|
18
|
-
if (timestamps.length >= config.maxExecutions) {
|
|
19
|
-
this.windows_.set(key, timestamps);
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
timestamps.push(now);
|
|
23
|
-
this.windows_.set(key, timestamps);
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
clear() {
|
|
27
|
-
this.windows_.clear();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.InMemoryRateLimiter = InMemoryRateLimiter;
|
|
31
|
-
//# sourceMappingURL=rate-limiter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../../src/transaction/rate-limiter.ts"],"names":[],"mappings":";;;AAmCA;;;GAGG;AACH,MAAa,mBAAmB;IAAhC;QACU,aAAQ,GAA0B,IAAI,GAAG,EAAE,CAAA;IAuBrD,CAAC;IArBC,OAAO,CAAC,GAAW,EAAE,MAAuB;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAA;QAEpC,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QAC7C,yBAAyB;QACzB,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;QAEjD,IAAI,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;YAClC,OAAO,KAAK,CAAA;QACd,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CACF;AAxBD,kDAwBC"}
|