@ultimat3/action
Advanced tools
+6
-6
| { | ||
| "name": "@ultimat3/action", | ||
| "version": "16.0.0", | ||
| "version": "17.0.0", | ||
| "description": "The action primitive: one declaration projected to route, OpenAPI, client, MCP tool, job handle, tests", | ||
@@ -37,8 +37,8 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@ultimat3/cache": "16.0.0", | ||
| "@ultimat3/core": "16.0.0", | ||
| "@ultimat3/http": "16.0.0", | ||
| "@ultimat3/policy": "16.0.0", | ||
| "@ultimat3/schema": "16.0.0" | ||
| "@ultimat3/cache": "17.0.0", | ||
| "@ultimat3/core": "17.0.0", | ||
| "@ultimat3/http": "17.0.0", | ||
| "@ultimat3/policy": "17.0.0", | ||
| "@ultimat3/schema": "17.0.0" | ||
| } | ||
| } |
@@ -6,3 +6,3 @@ /** | ||
| */ | ||
| import { uuid } from '@ultimat3/core'; | ||
| import { finiteCount, uuid } from '@ultimat3/core'; | ||
| import type { | ||
@@ -51,4 +51,17 @@ IdempotencyFailure, | ||
| constructor(options: MemoryIdempotencyStoreOptions = {}) { | ||
| this.windowMs = Math.max(1, Math.floor(options.windowMs ?? DEFAULT_IDEMPOTENCY_WINDOW_MS)); | ||
| this.#maxKeys = Math.max(1, Math.floor(options.maxKeys ?? DEFAULT_MAX_IDEMPOTENCY_KEYS)); | ||
| // Screened, not clamped: `Math.floor(NaN)` is `NaN`, so `size > maxKeys` is false for every | ||
| // size and `now - at > windowMs` is false for every record — a table with no cap, holding keys | ||
| // that never expire, out of a `Math.max` that reads like a guard. | ||
| this.windowMs = finiteCount( | ||
| 'MemoryIdempotencyStore', | ||
| 'windowMs', | ||
| options.windowMs ?? DEFAULT_IDEMPOTENCY_WINDOW_MS, | ||
| 1, | ||
| ); | ||
| this.#maxKeys = finiteCount( | ||
| 'MemoryIdempotencyStore', | ||
| 'maxKeys', | ||
| options.maxKeys ?? DEFAULT_MAX_IDEMPOTENCY_KEYS, | ||
| 1, | ||
| ); | ||
| // Batched down to 90% so the eviction sort is paid once per 10% of the cap, not per write. | ||
@@ -55,0 +68,0 @@ this.#evictTo = Math.max(1, Math.floor(this.#maxKeys * 0.9)); |
@@ -7,3 +7,3 @@ /** | ||
| */ | ||
| import { logger, uuid } from '@ultimat3/core'; | ||
| import { finiteCount, logger, uuid } from '@ultimat3/core'; | ||
| import { IdempotencyStatusUnknownError } from './errors'; | ||
@@ -176,3 +176,10 @@ import type { | ||
| ): PostgresIdempotencyStore { | ||
| const windowMs = Math.max(1, Math.floor(options.windowMs ?? DEFAULT_IDEMPOTENCY_WINDOW_MS)); | ||
| // The same screen as the memory store's, on the number that becomes `windowSecs` and is bound | ||
| // into every statement below: `Math.floor(NaN)` is `NaN`, and NaN/1000 is what reaches Postgres. | ||
| const windowMs = finiteCount( | ||
| 'postgresIdempotencyStore', | ||
| 'windowMs', | ||
| options.windowMs ?? DEFAULT_IDEMPOTENCY_WINDOW_MS, | ||
| 1, | ||
| ); | ||
| const windowSecs = windowMs / 1000; | ||
@@ -179,0 +186,0 @@ const exec = options.executor; |
322555
0.21%4794
0.42%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated