@ferricstore/ferricstore 0.13.0 → 0.13.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/README.md +53 -1
- package/dist/index.cjs +230 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -6
- package/dist/index.d.ts +30 -6
- package/dist/index.js +229 -82
- package/dist/index.js.map +1 -1
- package/dist/langgraph.cjs.map +1 -1
- package/dist/langgraph.js.map +1 -1
- package/dist/openai-agents.cjs.map +1 -1
- package/dist/openai-agents.js.map +1 -1
- package/docs/api/assets/hierarchy.js +1 -1
- package/docs/api/assets/highlight.css +9 -2
- package/docs/api/assets/navigation.js +1 -1
- package/docs/api/assets/search.js +1 -1
- package/docs/api/classes/ConnectionClosedError.html +4 -4
- package/docs/api/classes/FerricStoreClient.html +13 -13
- package/docs/api/classes/FerricStoreError.html +1 -0
- package/docs/api/classes/FlowAlreadyExistsError.html +3 -3
- package/docs/api/classes/FlowNotFoundError.html +3 -3
- package/docs/api/classes/FlowWrongStateError.html +3 -3
- package/docs/api/classes/HTTPTransportError.html +13 -7
- package/docs/api/classes/InvalidCommandError.html +3 -3
- package/docs/api/classes/LeaseRenewalError.html +1 -1
- package/docs/api/classes/LockHeldError.html +3 -3
- package/docs/api/classes/LockNotOwnedError.html +3 -3
- package/docs/api/classes/NativeAdapter.html +3 -3
- package/docs/api/classes/OverloadedError.html +5 -5
- package/docs/api/classes/QueueCompletionError.html +1 -1
- package/docs/api/classes/RequestNotSentError.html +225 -0
- package/docs/api/classes/RequestTimeoutError.html +6 -6
- package/docs/api/classes/RerouteError.html +3 -3
- package/docs/api/classes/StaleLeaseError.html +3 -3
- package/docs/api/classes/StalePolicyGenerationError.html +3 -3
- package/docs/api/classes/WorkflowContext.html +7 -9
- package/docs/api/functions/classifyServerError.html +1 -1
- package/docs/api/functions/mapException.html +1 -1
- package/docs/api/hierarchy.html +21 -20
- package/docs/api/index.html +38 -2
- package/docs/api/interfaces/AdvanceOptions.html +9 -5
- package/docs/api/interfaces/AlreadyAppliedOutcome.html +1 -1
- package/docs/api/interfaces/AppliedStepOutcome.html +1 -1
- package/docs/api/interfaces/CancelOptions.html +12 -8
- package/docs/api/interfaces/CompleteOptions.html +12 -8
- package/docs/api/interfaces/CompleteOutcome.html +1 -1
- package/docs/api/interfaces/ExtendLeaseOptions.html +10 -8
- package/docs/api/interfaces/FailOptions.html +12 -8
- package/docs/api/interfaces/FailOutcome.html +1 -1
- package/docs/api/interfaces/HistoryOptions.html +16 -16
- package/docs/api/interfaces/LeaseMutationOptions.html +10 -6
- package/docs/api/interfaces/MutateOptions.html +7 -3
- package/docs/api/interfaces/NamedValueMutation.html +1 -1
- package/docs/api/interfaces/ReadOptions.html +11 -11
- package/docs/api/interfaces/RetryOptions.html +12 -8
- package/docs/api/interfaces/RetryOutcome.html +1 -1
- package/docs/api/interfaces/RunStepsItem.html +3 -3
- package/docs/api/interfaces/RunStepsManyOptions.html +11 -11
- package/docs/api/interfaces/SearchOptions.html +12 -12
- package/docs/api/interfaces/StepContinueOptions.html +15 -11
- package/docs/api/interfaces/StepOptions.html +15 -8
- package/docs/api/interfaces/StepResult.html +3 -3
- package/docs/api/interfaces/TDigestCreateOptions.html +1 -1
- package/docs/api/interfaces/TDigestMergeOptions.html +1 -1
- package/docs/api/interfaces/TransitionOptions.html +14 -10
- package/docs/api/interfaces/TransitionOutcome.html +1 -1
- package/docs/api/media/design.md +22 -1
- package/docs/api/modules.html +2 -2
- package/docs/api/types/ConnectionRequestDisposition.html +1 -1
- package/docs/api/types/ManagementPairs.html +1 -1
- package/docs/api/types/RequestDisposition.html +1 -1
- package/docs/api/types/SearchStateMeta.html +1 -1
- package/docs/api/variables/FERRICSTORE_SDK_VERSION.html +1 -1
- package/docs/design.md +22 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ covers every public adapter class and option.
|
|
|
34
34
|
|
|
35
35
|
## Compatibility
|
|
36
36
|
|
|
37
|
-
TypeScript SDK `0.
|
|
37
|
+
TypeScript SDK `0.13.2` requires FerricStore server `0.11.4` or newer. With
|
|
38
38
|
FerricStore 0.11.11 it negotiates compact Stream mode 34 for homogeneous auto-ID
|
|
39
39
|
`XADD` pipelines and compact Pub/Sub mode 35 for homogeneous `PUBLISH`
|
|
40
40
|
pipelines. Native wire protocol v1 and the generic fallback are unchanged.
|
|
@@ -232,6 +232,11 @@ unclassified failures are treated conservatively as possibly sent.
|
|
|
232
232
|
timeouts while waiting for a local flow-control or write-queue slot are
|
|
233
233
|
`"unsent"`, while a request whose frame entered the socket is
|
|
234
234
|
`"possibly_sent"`. Do not automatically retry a possibly-sent mutation.
|
|
235
|
+
HTTP `408` responses, truncated responses, stream resets, and other failures
|
|
236
|
+
after dispatch are also treated as uncertain even if an intermediary labels
|
|
237
|
+
them retry-safe. Local HTTP validation, encoding, size-limit, closed-client,
|
|
238
|
+
and unsupported-command failures are marked `"unsent"` and perform no network
|
|
239
|
+
exchange.
|
|
235
240
|
`autoReconnect` accepts `maxRetries`, `baseDelayMs`, `maxDelayMs`, and
|
|
236
241
|
`jitterPct`; backoff is applied only after a reconnect attempt itself fails.
|
|
237
242
|
|
|
@@ -380,6 +385,53 @@ Handlers return explicit durable outcomes:
|
|
|
380
385
|
|
|
381
386
|
FerricFlow does not replay TypeScript handler code. Workers claim a durable state, run normal code, then write the next state through the FerricFlow API.
|
|
382
387
|
|
|
388
|
+
For chainable state changes, pass the current claim directly to `advance()`.
|
|
389
|
+
It reads the workflow identity, logical state, lease token, and fencing token
|
|
390
|
+
from the claim and returns the renewed claim:
|
|
391
|
+
|
|
392
|
+
```ts
|
|
393
|
+
job = await flow.advance(job, { toState: "schedule_warning" });
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Use `step()` when a closure result must be journaled with the transition:
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
const stepped = await flow.step(job, {
|
|
400
|
+
name: "charge-customer:v1",
|
|
401
|
+
run: async () => await stripe.charges.create(
|
|
402
|
+
{ amount: 150, currency: "usd", customer: customerId },
|
|
403
|
+
{ idempotencyKey: `${job.id}:charge-customer:v1` }
|
|
404
|
+
),
|
|
405
|
+
toState: "schedule_warning"
|
|
406
|
+
});
|
|
407
|
+
job = stepped.job;
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
The step name must remain stable across retries. A committed result is returned
|
|
411
|
+
without running the closure again. A worker can still stop after an external
|
|
412
|
+
effect succeeds but before FerricStore commits the result, so external systems
|
|
413
|
+
still need the same stable provider idempotency key. The closure runs in the
|
|
414
|
+
calling worker's JavaScript execution context; the SDK does not move it to a
|
|
415
|
+
global thread pool.
|
|
416
|
+
|
|
417
|
+
A waiting workflow does not occupy a worker. Persist a timer, signal, approval,
|
|
418
|
+
or scheduled state and return the waiting transition so the current claim is
|
|
419
|
+
released. When the wait condition is satisfied, any available worker can acquire
|
|
420
|
+
a fresh lease and continue from the stored state. If no worker is
|
|
421
|
+
running, the workflow remains durable until one becomes available.
|
|
422
|
+
|
|
423
|
+
`stepContinue()` remains available only as a deprecated low-level migration API.
|
|
424
|
+
Use `advance(job, { toState })` for a state-only transition and
|
|
425
|
+
`step(job, { name, run, toState })` when the closure result must be journaled.
|
|
426
|
+
|
|
427
|
+
`nowMs` is an explicit client timestamp sent with a command. When omitted, the
|
|
428
|
+
SDK samples the client wall clock separately for each request. It is intended
|
|
429
|
+
mainly for deterministic tests and is not a server-response timestamp or a
|
|
430
|
+
transport timeout. `timeoutMs`, by contrast, is the client-side request
|
|
431
|
+
deadline. For a command that intentionally blocks on the server, its declared
|
|
432
|
+
server wait is added to that client deadline; an unbounded server wait has no
|
|
433
|
+
response timer.
|
|
434
|
+
|
|
383
435
|
Per-job `run()` workers cap every claim to currently available concurrency. They continuously refill slots by default, so if five of ten jobs finish and their terminal writes are acknowledged, one client-side `claim(limit: 5)` can start five replacements while the other five continue. Queue completions produced in the same event-loop turn remain batched. A slot stays occupied through its `complete`, `retry`, or `fail` acknowledgement; the worker never exceeds its local concurrency limit.
|
|
384
436
|
|
|
385
437
|
Full-record claims across multiple states are returned by the claim command itself, including requested payloads and named values. `FLOW.GET` hydration is retained only for compatibility with a server that unexpectedly returns legacy compact tuples. That fallback preserves result order and is bounded to 16 concurrent reads by default; set `legacyClaimHydrationConcurrency` on the client to tune it. If a fallback read fails, `ClaimHydrationError.claimed` contains every already-leased job, while `hydratedItems` contains the indexed records that finished successfully; `failedIndex` and `cause` identify the first observed failure. Set `jobOnly: true` when compact claim metadata is sufficient; compact state metadata is decoded directly from the claim response without per-job `FLOW.GET` calls.
|