@ferricstore/ferricstore 0.11.10 → 0.12.0

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.
Files changed (54) hide show
  1. package/README.md +32 -3
  2. package/dist/durability-DlDCsdlo.d.cts +16 -0
  3. package/dist/durability-DplL0SbW.d.ts +16 -0
  4. package/dist/index.cjs +13 -2
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +5 -162
  7. package/dist/index.d.ts +5 -162
  8. package/dist/index.js +13 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/internal-lEEDZpPH.d.cts +4 -0
  11. package/dist/internal-lEEDZpPH.d.ts +4 -0
  12. package/dist/langgraph.cjs +1278 -0
  13. package/dist/langgraph.cjs.map +1 -0
  14. package/dist/langgraph.d.cts +148 -0
  15. package/dist/langgraph.d.ts +148 -0
  16. package/dist/langgraph.js +1252 -0
  17. package/dist/langgraph.js.map +1 -0
  18. package/dist/openai-agents.cjs +580 -0
  19. package/dist/openai-agents.cjs.map +1 -0
  20. package/dist/openai-agents.d.cts +44 -0
  21. package/dist/openai-agents.d.ts +44 -0
  22. package/dist/openai-agents.js +555 -0
  23. package/dist/openai-agents.js.map +1 -0
  24. package/dist/outcomes-BbFDp3AH.d.ts +160 -0
  25. package/dist/outcomes-DmBwnq0Y.d.cts +160 -0
  26. package/docs/agent-frameworks.md +159 -0
  27. package/docs/api/assets/highlight.css +12 -12
  28. package/docs/api/classes/ClaimHydrationError.html +2 -2
  29. package/docs/api/classes/ConnectionClosedError.html +2 -2
  30. package/docs/api/classes/FerricStoreError.html +2 -2
  31. package/docs/api/classes/FlowAlreadyExistsError.html +2 -2
  32. package/docs/api/classes/FlowBatchError.html +2 -2
  33. package/docs/api/classes/FlowNotFoundError.html +2 -2
  34. package/docs/api/classes/FlowQueryError.html +2 -2
  35. package/docs/api/classes/FlowWrongStateError.html +2 -2
  36. package/docs/api/classes/HTTPTransportError.html +2 -2
  37. package/docs/api/classes/InvalidCommandError.html +2 -2
  38. package/docs/api/classes/LeaseRenewalError.html +2 -2
  39. package/docs/api/classes/LockHeldError.html +2 -2
  40. package/docs/api/classes/LockNotOwnedError.html +2 -2
  41. package/docs/api/classes/OverloadedError.html +2 -2
  42. package/docs/api/classes/QueueCompletionError.html +2 -2
  43. package/docs/api/classes/RequestTimeoutError.html +2 -2
  44. package/docs/api/classes/RerouteError.html +2 -2
  45. package/docs/api/classes/StaleLeaseError.html +2 -2
  46. package/docs/api/classes/StalePolicyGenerationError.html +2 -2
  47. package/docs/api/functions/httpCommandDisposition.html +1 -1
  48. package/docs/api/index.html +44 -24
  49. package/docs/api/media/agent-frameworks.md +159 -0
  50. package/docs/api/media/langgraph.ts +23 -0
  51. package/docs/api/media/openai-agents-session.ts +13 -0
  52. package/docs/api/types/HTTPCommandDisposition.html +1 -1
  53. package/docs/api/variables/FERRICSTORE_SDK_VERSION.html +1 -1
  54. package/package.json +42 -2
package/dist/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { ConnectionOptions } from 'node:tls';
2
+ import { C as CommandArgument, a as Command } from './internal-lEEDZpPH.cjs';
2
3
  import { Buffer as Buffer$1 } from 'node:buffer';
4
+ import { F as FencingToken, S as StateMeta, a as FlowRecord, C as ClaimedItem, M as MaxActiveMs, R as RateLimitResult, K as KeyInfo, b as FetchOrComputeResult, c as ChildSpec, d as FencedItem, e as CreateItem, O as Outcome } from './outcomes-DmBwnq0Y.cjs';
5
+ export { f as CompleteOutcome, g as FailOutcome, h as FetchOrComputeComputeResult, i as FetchOrComputeFencedResult, j as FetchOrComputeHitResult, k as FlowMaxActiveFailure, N as NamedValueMutation, l as RetryOutcome, m as StateMetaValue, T as TransitionOutcome, n as complete, o as fail, p as isOutcome, r as retry, t as transition } from './outcomes-DmBwnq0Y.cjs';
3
6
 
4
7
  declare class FerricStoreError extends Error {
5
8
  readonly code: string;
@@ -100,9 +103,6 @@ declare class JsonCodec<T = unknown> implements Codec<T> {
100
103
  decode(value: Buffer | null | undefined): T | null;
101
104
  }
102
105
 
103
- type CommandArgument = string | Buffer | number | bigint | boolean | readonly CommandArgument[] | Record<string, unknown> | null | undefined;
104
- type Command = readonly CommandArgument[];
105
-
106
106
  interface ExecutePipelineOptions {
107
107
  /** @internal Earlier command indexes that must settle before each individual fallback command starts. */
108
108
  fallbackDependencies?: readonly (readonly number[])[];
@@ -603,122 +603,6 @@ interface WorkerConfig {
603
603
  worker?: string;
604
604
  }
605
605
 
606
- type MaxActiveMs = number | "infinity";
607
- /** An exact Flow fencing token; bigint is used beyond JavaScript's safe integer range. */
608
- type FencingToken = number | bigint;
609
- interface ChildSpec {
610
- id: string;
611
- type: string;
612
- payload?: unknown;
613
- partitionKey?: string;
614
- values?: Record<string, unknown>;
615
- valueRefs?: Record<string, string>;
616
- }
617
- type StateMetaValue = string | number | boolean | Buffer;
618
- type StateMeta = Record<string, StateMetaValue>;
619
- interface CreateItem {
620
- id: string;
621
- payload?: unknown;
622
- partitionKey?: string;
623
- attributes?: Record<string, CommandArgument>;
624
- values?: Record<string, unknown>;
625
- valueRefs?: Record<string, string>;
626
- stateMeta?: StateMeta;
627
- }
628
- /** @internal */
629
- declare const CLAIMED_ITEM_WIRE: unique symbol;
630
- /** @internal */
631
- interface ClaimedItemWire {
632
- id: Buffer;
633
- partitionKey?: Buffer | null;
634
- leaseToken: Buffer;
635
- fencingToken: FencingToken;
636
- }
637
- interface ClaimedItem<TPayload = unknown> {
638
- id: string;
639
- leaseToken: Buffer;
640
- fencingToken: FencingToken;
641
- partitionKey?: string;
642
- /** Present when supplied by a full response or known compact-claim context. */
643
- type?: string;
644
- state: string;
645
- runState?: string;
646
- payload?: TPayload | null;
647
- attributes?: Record<string, unknown>;
648
- /** @internal */
649
- [CLAIMED_ITEM_WIRE]?: ClaimedItemWire;
650
- }
651
- interface FencedItem {
652
- id: string;
653
- fencingToken: FencingToken;
654
- leaseToken?: Buffer;
655
- partitionKey?: string;
656
- }
657
- interface RateLimitResult {
658
- status: string;
659
- count: number;
660
- remaining: number;
661
- resetMs: number;
662
- allowed: boolean;
663
- }
664
- interface KeyInfo {
665
- type: string;
666
- valueSize: number;
667
- ttlMs: number;
668
- hotCacheStatus: string;
669
- lastWriteShard: number;
670
- raw: Record<string, unknown>;
671
- }
672
- interface FetchOrComputeHitResult<T = unknown> {
673
- readonly computeMode: "hit";
674
- readonly hit: true;
675
- readonly shouldCompute: false;
676
- readonly status: "hit";
677
- readonly value: T | null;
678
- }
679
- interface FetchOrComputeComputeResult {
680
- /** Opaque application hint echoed for the process elected to compute. */
681
- readonly computeHint: Buffer;
682
- readonly computeMode: "fenced";
683
- /** Fencing token required when publishing the computed result or error. */
684
- readonly computeToken: Buffer;
685
- readonly hit: false;
686
- readonly shouldCompute: true;
687
- readonly status: "compute";
688
- }
689
- type FetchOrComputeFencedResult = FetchOrComputeComputeResult;
690
- type FetchOrComputeResult<T = unknown> = FetchOrComputeHitResult<T> | FetchOrComputeComputeResult;
691
- interface FlowMaxActiveFailure {
692
- readonly maxActiveMs: number;
693
- readonly reason: "max_active_ms";
694
- }
695
- interface FlowRecord<TPayload = unknown> {
696
- id: string;
697
- type: string;
698
- state: string;
699
- partitionKey: string;
700
- runState?: string;
701
- payload?: TPayload | null;
702
- leaseToken: Buffer;
703
- fencingToken: FencingToken;
704
- version: number;
705
- parentFlowId?: string;
706
- rootFlowId?: string;
707
- correlationId?: string;
708
- maxActiveMs?: number;
709
- error?: unknown;
710
- failureReason?: string;
711
- valueRefs?: Record<string, unknown>;
712
- values?: Record<string, unknown>;
713
- valueSizes?: Record<string, unknown>;
714
- valueOmitted?: Record<string, unknown>;
715
- valueMissing?: Record<string, unknown>;
716
- attributes?: Record<string, unknown>;
717
- stateMeta?: Record<string, unknown>;
718
- indexedStateMeta?: string;
719
- raw?: unknown;
720
- }
721
-
722
606
  type FlowAdminRecord = Record<string, unknown>;
723
607
  /** Bounded interval recovery; missed occurrences are coalesced into one fire. */
724
608
  type ScheduleCatchupPolicy = "fire_once";
@@ -2430,47 +2314,6 @@ declare const FlowProjection: Readonly<{
2430
2314
  }>;
2431
2315
  declare function projectFlowQuery(query: string, shape: FlowProjectionShape, ...fields: readonly FlowProjectionField[]): string;
2432
2316
 
2433
- type Outcome = TransitionOutcome | CompleteOutcome | RetryOutcome | FailOutcome;
2434
- interface NamedValueMutation {
2435
- values?: Record<string, unknown>;
2436
- valueRefs?: Record<string, string>;
2437
- dropValues?: string[];
2438
- overrideValues?: string[];
2439
- attributesMerge?: Record<string, CommandArgument>;
2440
- attributesDelete?: string[];
2441
- stateMeta?: StateMeta;
2442
- }
2443
- interface TransitionOutcome extends NamedValueMutation {
2444
- readonly kind: "transition";
2445
- readonly toState: string;
2446
- readonly payload?: unknown;
2447
- readonly priority?: number;
2448
- readonly runAtMs?: number;
2449
- }
2450
- interface CompleteOutcome extends NamedValueMutation {
2451
- readonly kind: "complete";
2452
- readonly payload?: unknown;
2453
- readonly result?: unknown;
2454
- readonly ttlMs?: number;
2455
- }
2456
- interface RetryOutcome extends NamedValueMutation {
2457
- readonly kind: "retry";
2458
- readonly error?: unknown;
2459
- readonly payload?: unknown;
2460
- readonly runAtMs?: number;
2461
- }
2462
- interface FailOutcome extends NamedValueMutation {
2463
- readonly kind: "fail";
2464
- readonly error?: unknown;
2465
- readonly payload?: unknown;
2466
- readonly ttlMs?: number;
2467
- }
2468
- declare function transition(toState: string, options?: Omit<TransitionOutcome, "kind" | "toState">): TransitionOutcome;
2469
- declare function complete(options?: Omit<CompleteOutcome, "kind">): CompleteOutcome;
2470
- declare function retry(options?: Omit<RetryOutcome, "kind">): RetryOutcome;
2471
- declare function fail(options?: Omit<FailOutcome, "kind">): FailOutcome;
2472
- declare function isOutcome(value: unknown): value is Outcome;
2473
-
2474
2317
  /** Raised when a worker loses the ability to renew a claimed job's lease. */
2475
2318
  declare class LeaseRenewalError extends Error {
2476
2319
  constructor(cause: unknown);
@@ -2756,7 +2599,7 @@ declare class WorkflowWorker {
2756
2599
  }
2757
2600
 
2758
2601
  /** TypeScript SDK package version. */
2759
- declare const FERRICSTORE_SDK_VERSION = "0.11.10";
2602
+ declare const FERRICSTORE_SDK_VERSION = "0.12.0";
2760
2603
  /** Oldest FerricStore server supported by this breaking beta contract. */
2761
2604
  declare const FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
2762
2605
  /** Native framing and opcode ABI version; unchanged by FerricStore 0.11. */
@@ -2765,4 +2608,4 @@ declare const FERRICSTORE_NATIVE_PROTOCOL_VERSION = 1;
2765
2608
  /** @deprecated Use RequestDisposition; retained for source compatibility. */
2766
2609
  type ConnectionRequestDisposition = RequestDisposition;
2767
2610
 
2768
- export { type AdminListOptions, type ApprovalListOptions, type ApprovalRequestOptions, type AttributeQueryOptions, type AutoBatchOptions, type BackoffKind, type BackpressurePolicy, BitmapStore, BloomFilterStore, type BudgetCommitOptions, type BudgetReserveOptions, COMMAND_OPCODES, type CancelOptions, type ChildSpec, type CircuitOpenOptions, type ClaimDueOptions, ClaimHydrationError, type ClaimHydrationItem, type ClaimedItem, type Codec, type CollectionScanOptions, type Command, type CommandArgument, type CommandExecutor, type CompleteJobsAndClaimJobsResult, type CompleteManyOptions, type CompleteOptions, type CompleteOutcome, ConnectionClosedError, type ConnectionRequestDisposition, type CountMinMergeOptions, CountMinSketchStore, type CreateItem, type CreateManyOptions, type CreateOptions, CuckooFilterStore, type EffectCompensateOptions, type EffectConfirmOptions, type EffectFailOptions, type EffectReserveOptions, type EffectStatusOptions, type EndpointPolicy, type ExceptionPolicy, type ExecutePipelineOptions, type ExpiryCondition, type ExtendLeaseOptions, FERRICSTORE_MINIMUM_SERVER_VERSION, FERRICSTORE_NATIVE_PROTOCOL_VERSION, FERRICSTORE_SDK_VERSION, type FailOptions, type FailOutcome, type FencedItem, type FencingToken, FerricStoreClient, type FerricStoreClientFromUrlOptions, type FerricStoreClientOptions, FerricStoreError, type FetchOrComputeComputeResult, type FetchOrComputeFencedResult, type FetchOrComputeHitResult, type FetchOrComputeResult, type FlowAdminRecord, FlowAlreadyExistsError, type FlowBatchCompletedItem, FlowBatchError, type FlowEventProjectionField, type FlowExplainCapabilities, type FlowExplainResult, type FlowMaxActiveFailure, FlowNotFoundError, type FlowPolicyBackoffKind, type FlowPolicyBackoffSnapshot, type FlowPolicyOptions, type FlowPolicyRetentionSnapshot, type FlowPolicyRetrySnapshot, type FlowPolicySnapshot, type FlowPolicyStateSnapshot, FlowProjection, type FlowProjectionField, type FlowProjectionShape, type FlowQueryCountResult, FlowQueryError, type FlowQueryErrorPosition, type FlowQueryIndex, type FlowQueryIndexBuild, type FlowQueryIndexCoverage, type FlowQueryIndexField, type FlowQueryIndexFormat, type FlowQueryIndexProgress, type FlowQueryIndexRegistry, type FlowQueryIndexRetirement, type FlowQueryIndexServiceState, type FlowQueryIndexServices, type FlowQueryIndexStatistics, type FlowQueryIndexStatus, type FlowQueryIndexValidation, type FlowQueryInteger, type FlowQueryPage, type FlowQueryParameter, type FlowQueryParameters, type FlowQueryQuality, type FlowQueryRecord, type FlowQueryRecordsResult, type FlowQueryResult, type FlowQueryUsage, type FlowRecord, type FlowRunProjectionField, type FlowStateMode, type FlowStatePolicy, type FlowStatePolicyLike, type FlowStatsOptions, FlowWrongStateError, type GeoAddOptions, type GeoMember, GeoStore, type GetExOptions, type GovernanceLedgerOptions, HTTPAdapter, type HTTPAdapterOptions, type HTTPCommandDisposition, HTTPTransportError, type HashScanResult, HashStore, type HistoryOptions, HyperLogLogStore, type IntegerReply, InvalidCommandError, type InvocationCreateOptions, JsonCodec, type KeyInfo, KeyValueStore, type LeaseMutationOptions, LeaseRenewalError, type LimitAmountOptions, type LimitLeaseOptions, type LimitListOptions, type LimitReleaseOptions, ListStore, LockHeldError, LockNotOwnedError, MAX_FLOW_POLICY_GENERATION, type ManagementPairs, type MaxActiveMs, type MutateOptions, type NamedValueMutation, NativeAdapter, type NativeAdapterOptions, type NativeClientOptions, type NativeProtocolEvent, type Outcome, OverloadedError, type ProtocolCommand, Queue, type QueueBatchHandler, QueueClient, QueueCompletionError, type QueueHandler, type QueueJob, type QueueOptions, QueueWorker, type QueueWorkerResult, type RangeLimit, type RateLimitResult, RawCodec, type ReadOptions, type ReclaimOptions, type ReconnectOptions, ReconnectingExecutor, type RequestContext, type RequestContextOptions, type RequestDisposition, RequestTimeoutError, RerouteError, type RetryOptions, type RetryOutcome, type RetryPolicy, type RoutingEndpoint, type RoutingRoute, RoutingTopology, type RunStepsItem, type RunStepsManyOptions, type ScanOptions, type ScheduleCatchupPolicy, type ScheduleFireDueOptions, type ScheduleFireDueResult, type ScheduleFireOptions, type ScheduleFireResult, type ScheduleKind, type ScheduleListOptions, type ScheduleOptions, type ScheduleOverlapPolicy, type ScheduleRecord, type ScheduleState, type SearchOptions, type SearchStateMeta, type SetOptions, type SetScanResult, SetStore, type SortedSetScanResult, SortedSetStore, StaleLeaseError, StalePolicyGenerationError, type StartAndClaimOptions, type StateMeta, type StateMetaValue, type StateOptions, type StateRegistration, type StepContinueOptions, type StoreCommandClient, StreamStore, type TDigestCreateOptions, type TDigestMergeOptions, TDigestStore, type TopKReserveOptions, TopKStore, type TopologyNativeAdapterOptions, TopologyNativeAdapterPool, type TransitionOptions, type TransitionOutcome, type ValueConfig, type WorkerConfig, type WorkerProfile, type WorkerRefillStrategy, Workflow, WorkflowClient, WorkflowContext, WorkflowFlowCommands, type WorkflowHandler, type WorkflowOptions, WorkflowWorker, type WorkflowWorkerResult, type XReadStream, type ZAddMember, type ZAddOptions, classifyServerError, complete, fail, httpCommandDisposition, isOutcome, isReconnectableClosedConnectionError, mapException, projectFlowQuery, retry, transition };
2611
+ export { type AdminListOptions, type ApprovalListOptions, type ApprovalRequestOptions, type AttributeQueryOptions, type AutoBatchOptions, type BackoffKind, type BackpressurePolicy, BitmapStore, BloomFilterStore, type BudgetCommitOptions, type BudgetReserveOptions, COMMAND_OPCODES, type CancelOptions, ChildSpec, type CircuitOpenOptions, type ClaimDueOptions, ClaimHydrationError, type ClaimHydrationItem, ClaimedItem, type Codec, type CollectionScanOptions, Command, CommandArgument, type CommandExecutor, type CompleteJobsAndClaimJobsResult, type CompleteManyOptions, type CompleteOptions, ConnectionClosedError, type ConnectionRequestDisposition, type CountMinMergeOptions, CountMinSketchStore, CreateItem, type CreateManyOptions, type CreateOptions, CuckooFilterStore, type EffectCompensateOptions, type EffectConfirmOptions, type EffectFailOptions, type EffectReserveOptions, type EffectStatusOptions, type EndpointPolicy, type ExceptionPolicy, type ExecutePipelineOptions, type ExpiryCondition, type ExtendLeaseOptions, FERRICSTORE_MINIMUM_SERVER_VERSION, FERRICSTORE_NATIVE_PROTOCOL_VERSION, FERRICSTORE_SDK_VERSION, type FailOptions, FencedItem, FencingToken, FerricStoreClient, type FerricStoreClientFromUrlOptions, type FerricStoreClientOptions, FerricStoreError, FetchOrComputeResult, type FlowAdminRecord, FlowAlreadyExistsError, type FlowBatchCompletedItem, FlowBatchError, type FlowEventProjectionField, type FlowExplainCapabilities, type FlowExplainResult, FlowNotFoundError, type FlowPolicyBackoffKind, type FlowPolicyBackoffSnapshot, type FlowPolicyOptions, type FlowPolicyRetentionSnapshot, type FlowPolicyRetrySnapshot, type FlowPolicySnapshot, type FlowPolicyStateSnapshot, FlowProjection, type FlowProjectionField, type FlowProjectionShape, type FlowQueryCountResult, FlowQueryError, type FlowQueryErrorPosition, type FlowQueryIndex, type FlowQueryIndexBuild, type FlowQueryIndexCoverage, type FlowQueryIndexField, type FlowQueryIndexFormat, type FlowQueryIndexProgress, type FlowQueryIndexRegistry, type FlowQueryIndexRetirement, type FlowQueryIndexServiceState, type FlowQueryIndexServices, type FlowQueryIndexStatistics, type FlowQueryIndexStatus, type FlowQueryIndexValidation, type FlowQueryInteger, type FlowQueryPage, type FlowQueryParameter, type FlowQueryParameters, type FlowQueryQuality, type FlowQueryRecord, type FlowQueryRecordsResult, type FlowQueryResult, type FlowQueryUsage, FlowRecord, type FlowRunProjectionField, type FlowStateMode, type FlowStatePolicy, type FlowStatePolicyLike, type FlowStatsOptions, FlowWrongStateError, type GeoAddOptions, type GeoMember, GeoStore, type GetExOptions, type GovernanceLedgerOptions, HTTPAdapter, type HTTPAdapterOptions, type HTTPCommandDisposition, HTTPTransportError, type HashScanResult, HashStore, type HistoryOptions, HyperLogLogStore, type IntegerReply, InvalidCommandError, type InvocationCreateOptions, JsonCodec, KeyInfo, KeyValueStore, type LeaseMutationOptions, LeaseRenewalError, type LimitAmountOptions, type LimitLeaseOptions, type LimitListOptions, type LimitReleaseOptions, ListStore, LockHeldError, LockNotOwnedError, MAX_FLOW_POLICY_GENERATION, type ManagementPairs, MaxActiveMs, type MutateOptions, NativeAdapter, type NativeAdapterOptions, type NativeClientOptions, type NativeProtocolEvent, Outcome, OverloadedError, type ProtocolCommand, Queue, type QueueBatchHandler, QueueClient, QueueCompletionError, type QueueHandler, type QueueJob, type QueueOptions, QueueWorker, type QueueWorkerResult, type RangeLimit, RateLimitResult, RawCodec, type ReadOptions, type ReclaimOptions, type ReconnectOptions, ReconnectingExecutor, type RequestContext, type RequestContextOptions, type RequestDisposition, RequestTimeoutError, RerouteError, type RetryOptions, type RetryPolicy, type RoutingEndpoint, type RoutingRoute, RoutingTopology, type RunStepsItem, type RunStepsManyOptions, type ScanOptions, type ScheduleCatchupPolicy, type ScheduleFireDueOptions, type ScheduleFireDueResult, type ScheduleFireOptions, type ScheduleFireResult, type ScheduleKind, type ScheduleListOptions, type ScheduleOptions, type ScheduleOverlapPolicy, type ScheduleRecord, type ScheduleState, type SearchOptions, type SearchStateMeta, type SetOptions, type SetScanResult, SetStore, type SortedSetScanResult, SortedSetStore, StaleLeaseError, StalePolicyGenerationError, type StartAndClaimOptions, StateMeta, type StateOptions, type StateRegistration, type StepContinueOptions, type StoreCommandClient, StreamStore, type TDigestCreateOptions, type TDigestMergeOptions, TDigestStore, type TopKReserveOptions, TopKStore, type TopologyNativeAdapterOptions, TopologyNativeAdapterPool, type TransitionOptions, type ValueConfig, type WorkerConfig, type WorkerProfile, type WorkerRefillStrategy, Workflow, WorkflowClient, WorkflowContext, WorkflowFlowCommands, type WorkflowHandler, type WorkflowOptions, WorkflowWorker, type WorkflowWorkerResult, type XReadStream, type ZAddMember, type ZAddOptions, classifyServerError, httpCommandDisposition, isReconnectableClosedConnectionError, mapException, projectFlowQuery };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { ConnectionOptions } from 'node:tls';
2
+ import { C as CommandArgument, a as Command } from './internal-lEEDZpPH.js';
2
3
  import { Buffer as Buffer$1 } from 'node:buffer';
4
+ import { F as FencingToken, S as StateMeta, a as FlowRecord, C as ClaimedItem, M as MaxActiveMs, R as RateLimitResult, K as KeyInfo, b as FetchOrComputeResult, c as ChildSpec, d as FencedItem, e as CreateItem, O as Outcome } from './outcomes-BbFDp3AH.js';
5
+ export { f as CompleteOutcome, g as FailOutcome, h as FetchOrComputeComputeResult, i as FetchOrComputeFencedResult, j as FetchOrComputeHitResult, k as FlowMaxActiveFailure, N as NamedValueMutation, l as RetryOutcome, m as StateMetaValue, T as TransitionOutcome, n as complete, o as fail, p as isOutcome, r as retry, t as transition } from './outcomes-BbFDp3AH.js';
3
6
 
4
7
  declare class FerricStoreError extends Error {
5
8
  readonly code: string;
@@ -100,9 +103,6 @@ declare class JsonCodec<T = unknown> implements Codec<T> {
100
103
  decode(value: Buffer | null | undefined): T | null;
101
104
  }
102
105
 
103
- type CommandArgument = string | Buffer | number | bigint | boolean | readonly CommandArgument[] | Record<string, unknown> | null | undefined;
104
- type Command = readonly CommandArgument[];
105
-
106
106
  interface ExecutePipelineOptions {
107
107
  /** @internal Earlier command indexes that must settle before each individual fallback command starts. */
108
108
  fallbackDependencies?: readonly (readonly number[])[];
@@ -603,122 +603,6 @@ interface WorkerConfig {
603
603
  worker?: string;
604
604
  }
605
605
 
606
- type MaxActiveMs = number | "infinity";
607
- /** An exact Flow fencing token; bigint is used beyond JavaScript's safe integer range. */
608
- type FencingToken = number | bigint;
609
- interface ChildSpec {
610
- id: string;
611
- type: string;
612
- payload?: unknown;
613
- partitionKey?: string;
614
- values?: Record<string, unknown>;
615
- valueRefs?: Record<string, string>;
616
- }
617
- type StateMetaValue = string | number | boolean | Buffer;
618
- type StateMeta = Record<string, StateMetaValue>;
619
- interface CreateItem {
620
- id: string;
621
- payload?: unknown;
622
- partitionKey?: string;
623
- attributes?: Record<string, CommandArgument>;
624
- values?: Record<string, unknown>;
625
- valueRefs?: Record<string, string>;
626
- stateMeta?: StateMeta;
627
- }
628
- /** @internal */
629
- declare const CLAIMED_ITEM_WIRE: unique symbol;
630
- /** @internal */
631
- interface ClaimedItemWire {
632
- id: Buffer;
633
- partitionKey?: Buffer | null;
634
- leaseToken: Buffer;
635
- fencingToken: FencingToken;
636
- }
637
- interface ClaimedItem<TPayload = unknown> {
638
- id: string;
639
- leaseToken: Buffer;
640
- fencingToken: FencingToken;
641
- partitionKey?: string;
642
- /** Present when supplied by a full response or known compact-claim context. */
643
- type?: string;
644
- state: string;
645
- runState?: string;
646
- payload?: TPayload | null;
647
- attributes?: Record<string, unknown>;
648
- /** @internal */
649
- [CLAIMED_ITEM_WIRE]?: ClaimedItemWire;
650
- }
651
- interface FencedItem {
652
- id: string;
653
- fencingToken: FencingToken;
654
- leaseToken?: Buffer;
655
- partitionKey?: string;
656
- }
657
- interface RateLimitResult {
658
- status: string;
659
- count: number;
660
- remaining: number;
661
- resetMs: number;
662
- allowed: boolean;
663
- }
664
- interface KeyInfo {
665
- type: string;
666
- valueSize: number;
667
- ttlMs: number;
668
- hotCacheStatus: string;
669
- lastWriteShard: number;
670
- raw: Record<string, unknown>;
671
- }
672
- interface FetchOrComputeHitResult<T = unknown> {
673
- readonly computeMode: "hit";
674
- readonly hit: true;
675
- readonly shouldCompute: false;
676
- readonly status: "hit";
677
- readonly value: T | null;
678
- }
679
- interface FetchOrComputeComputeResult {
680
- /** Opaque application hint echoed for the process elected to compute. */
681
- readonly computeHint: Buffer;
682
- readonly computeMode: "fenced";
683
- /** Fencing token required when publishing the computed result or error. */
684
- readonly computeToken: Buffer;
685
- readonly hit: false;
686
- readonly shouldCompute: true;
687
- readonly status: "compute";
688
- }
689
- type FetchOrComputeFencedResult = FetchOrComputeComputeResult;
690
- type FetchOrComputeResult<T = unknown> = FetchOrComputeHitResult<T> | FetchOrComputeComputeResult;
691
- interface FlowMaxActiveFailure {
692
- readonly maxActiveMs: number;
693
- readonly reason: "max_active_ms";
694
- }
695
- interface FlowRecord<TPayload = unknown> {
696
- id: string;
697
- type: string;
698
- state: string;
699
- partitionKey: string;
700
- runState?: string;
701
- payload?: TPayload | null;
702
- leaseToken: Buffer;
703
- fencingToken: FencingToken;
704
- version: number;
705
- parentFlowId?: string;
706
- rootFlowId?: string;
707
- correlationId?: string;
708
- maxActiveMs?: number;
709
- error?: unknown;
710
- failureReason?: string;
711
- valueRefs?: Record<string, unknown>;
712
- values?: Record<string, unknown>;
713
- valueSizes?: Record<string, unknown>;
714
- valueOmitted?: Record<string, unknown>;
715
- valueMissing?: Record<string, unknown>;
716
- attributes?: Record<string, unknown>;
717
- stateMeta?: Record<string, unknown>;
718
- indexedStateMeta?: string;
719
- raw?: unknown;
720
- }
721
-
722
606
  type FlowAdminRecord = Record<string, unknown>;
723
607
  /** Bounded interval recovery; missed occurrences are coalesced into one fire. */
724
608
  type ScheduleCatchupPolicy = "fire_once";
@@ -2430,47 +2314,6 @@ declare const FlowProjection: Readonly<{
2430
2314
  }>;
2431
2315
  declare function projectFlowQuery(query: string, shape: FlowProjectionShape, ...fields: readonly FlowProjectionField[]): string;
2432
2316
 
2433
- type Outcome = TransitionOutcome | CompleteOutcome | RetryOutcome | FailOutcome;
2434
- interface NamedValueMutation {
2435
- values?: Record<string, unknown>;
2436
- valueRefs?: Record<string, string>;
2437
- dropValues?: string[];
2438
- overrideValues?: string[];
2439
- attributesMerge?: Record<string, CommandArgument>;
2440
- attributesDelete?: string[];
2441
- stateMeta?: StateMeta;
2442
- }
2443
- interface TransitionOutcome extends NamedValueMutation {
2444
- readonly kind: "transition";
2445
- readonly toState: string;
2446
- readonly payload?: unknown;
2447
- readonly priority?: number;
2448
- readonly runAtMs?: number;
2449
- }
2450
- interface CompleteOutcome extends NamedValueMutation {
2451
- readonly kind: "complete";
2452
- readonly payload?: unknown;
2453
- readonly result?: unknown;
2454
- readonly ttlMs?: number;
2455
- }
2456
- interface RetryOutcome extends NamedValueMutation {
2457
- readonly kind: "retry";
2458
- readonly error?: unknown;
2459
- readonly payload?: unknown;
2460
- readonly runAtMs?: number;
2461
- }
2462
- interface FailOutcome extends NamedValueMutation {
2463
- readonly kind: "fail";
2464
- readonly error?: unknown;
2465
- readonly payload?: unknown;
2466
- readonly ttlMs?: number;
2467
- }
2468
- declare function transition(toState: string, options?: Omit<TransitionOutcome, "kind" | "toState">): TransitionOutcome;
2469
- declare function complete(options?: Omit<CompleteOutcome, "kind">): CompleteOutcome;
2470
- declare function retry(options?: Omit<RetryOutcome, "kind">): RetryOutcome;
2471
- declare function fail(options?: Omit<FailOutcome, "kind">): FailOutcome;
2472
- declare function isOutcome(value: unknown): value is Outcome;
2473
-
2474
2317
  /** Raised when a worker loses the ability to renew a claimed job's lease. */
2475
2318
  declare class LeaseRenewalError extends Error {
2476
2319
  constructor(cause: unknown);
@@ -2756,7 +2599,7 @@ declare class WorkflowWorker {
2756
2599
  }
2757
2600
 
2758
2601
  /** TypeScript SDK package version. */
2759
- declare const FERRICSTORE_SDK_VERSION = "0.11.10";
2602
+ declare const FERRICSTORE_SDK_VERSION = "0.12.0";
2760
2603
  /** Oldest FerricStore server supported by this breaking beta contract. */
2761
2604
  declare const FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
2762
2605
  /** Native framing and opcode ABI version; unchanged by FerricStore 0.11. */
@@ -2765,4 +2608,4 @@ declare const FERRICSTORE_NATIVE_PROTOCOL_VERSION = 1;
2765
2608
  /** @deprecated Use RequestDisposition; retained for source compatibility. */
2766
2609
  type ConnectionRequestDisposition = RequestDisposition;
2767
2610
 
2768
- export { type AdminListOptions, type ApprovalListOptions, type ApprovalRequestOptions, type AttributeQueryOptions, type AutoBatchOptions, type BackoffKind, type BackpressurePolicy, BitmapStore, BloomFilterStore, type BudgetCommitOptions, type BudgetReserveOptions, COMMAND_OPCODES, type CancelOptions, type ChildSpec, type CircuitOpenOptions, type ClaimDueOptions, ClaimHydrationError, type ClaimHydrationItem, type ClaimedItem, type Codec, type CollectionScanOptions, type Command, type CommandArgument, type CommandExecutor, type CompleteJobsAndClaimJobsResult, type CompleteManyOptions, type CompleteOptions, type CompleteOutcome, ConnectionClosedError, type ConnectionRequestDisposition, type CountMinMergeOptions, CountMinSketchStore, type CreateItem, type CreateManyOptions, type CreateOptions, CuckooFilterStore, type EffectCompensateOptions, type EffectConfirmOptions, type EffectFailOptions, type EffectReserveOptions, type EffectStatusOptions, type EndpointPolicy, type ExceptionPolicy, type ExecutePipelineOptions, type ExpiryCondition, type ExtendLeaseOptions, FERRICSTORE_MINIMUM_SERVER_VERSION, FERRICSTORE_NATIVE_PROTOCOL_VERSION, FERRICSTORE_SDK_VERSION, type FailOptions, type FailOutcome, type FencedItem, type FencingToken, FerricStoreClient, type FerricStoreClientFromUrlOptions, type FerricStoreClientOptions, FerricStoreError, type FetchOrComputeComputeResult, type FetchOrComputeFencedResult, type FetchOrComputeHitResult, type FetchOrComputeResult, type FlowAdminRecord, FlowAlreadyExistsError, type FlowBatchCompletedItem, FlowBatchError, type FlowEventProjectionField, type FlowExplainCapabilities, type FlowExplainResult, type FlowMaxActiveFailure, FlowNotFoundError, type FlowPolicyBackoffKind, type FlowPolicyBackoffSnapshot, type FlowPolicyOptions, type FlowPolicyRetentionSnapshot, type FlowPolicyRetrySnapshot, type FlowPolicySnapshot, type FlowPolicyStateSnapshot, FlowProjection, type FlowProjectionField, type FlowProjectionShape, type FlowQueryCountResult, FlowQueryError, type FlowQueryErrorPosition, type FlowQueryIndex, type FlowQueryIndexBuild, type FlowQueryIndexCoverage, type FlowQueryIndexField, type FlowQueryIndexFormat, type FlowQueryIndexProgress, type FlowQueryIndexRegistry, type FlowQueryIndexRetirement, type FlowQueryIndexServiceState, type FlowQueryIndexServices, type FlowQueryIndexStatistics, type FlowQueryIndexStatus, type FlowQueryIndexValidation, type FlowQueryInteger, type FlowQueryPage, type FlowQueryParameter, type FlowQueryParameters, type FlowQueryQuality, type FlowQueryRecord, type FlowQueryRecordsResult, type FlowQueryResult, type FlowQueryUsage, type FlowRecord, type FlowRunProjectionField, type FlowStateMode, type FlowStatePolicy, type FlowStatePolicyLike, type FlowStatsOptions, FlowWrongStateError, type GeoAddOptions, type GeoMember, GeoStore, type GetExOptions, type GovernanceLedgerOptions, HTTPAdapter, type HTTPAdapterOptions, type HTTPCommandDisposition, HTTPTransportError, type HashScanResult, HashStore, type HistoryOptions, HyperLogLogStore, type IntegerReply, InvalidCommandError, type InvocationCreateOptions, JsonCodec, type KeyInfo, KeyValueStore, type LeaseMutationOptions, LeaseRenewalError, type LimitAmountOptions, type LimitLeaseOptions, type LimitListOptions, type LimitReleaseOptions, ListStore, LockHeldError, LockNotOwnedError, MAX_FLOW_POLICY_GENERATION, type ManagementPairs, type MaxActiveMs, type MutateOptions, type NamedValueMutation, NativeAdapter, type NativeAdapterOptions, type NativeClientOptions, type NativeProtocolEvent, type Outcome, OverloadedError, type ProtocolCommand, Queue, type QueueBatchHandler, QueueClient, QueueCompletionError, type QueueHandler, type QueueJob, type QueueOptions, QueueWorker, type QueueWorkerResult, type RangeLimit, type RateLimitResult, RawCodec, type ReadOptions, type ReclaimOptions, type ReconnectOptions, ReconnectingExecutor, type RequestContext, type RequestContextOptions, type RequestDisposition, RequestTimeoutError, RerouteError, type RetryOptions, type RetryOutcome, type RetryPolicy, type RoutingEndpoint, type RoutingRoute, RoutingTopology, type RunStepsItem, type RunStepsManyOptions, type ScanOptions, type ScheduleCatchupPolicy, type ScheduleFireDueOptions, type ScheduleFireDueResult, type ScheduleFireOptions, type ScheduleFireResult, type ScheduleKind, type ScheduleListOptions, type ScheduleOptions, type ScheduleOverlapPolicy, type ScheduleRecord, type ScheduleState, type SearchOptions, type SearchStateMeta, type SetOptions, type SetScanResult, SetStore, type SortedSetScanResult, SortedSetStore, StaleLeaseError, StalePolicyGenerationError, type StartAndClaimOptions, type StateMeta, type StateMetaValue, type StateOptions, type StateRegistration, type StepContinueOptions, type StoreCommandClient, StreamStore, type TDigestCreateOptions, type TDigestMergeOptions, TDigestStore, type TopKReserveOptions, TopKStore, type TopologyNativeAdapterOptions, TopologyNativeAdapterPool, type TransitionOptions, type TransitionOutcome, type ValueConfig, type WorkerConfig, type WorkerProfile, type WorkerRefillStrategy, Workflow, WorkflowClient, WorkflowContext, WorkflowFlowCommands, type WorkflowHandler, type WorkflowOptions, WorkflowWorker, type WorkflowWorkerResult, type XReadStream, type ZAddMember, type ZAddOptions, classifyServerError, complete, fail, httpCommandDisposition, isOutcome, isReconnectableClosedConnectionError, mapException, projectFlowQuery, retry, transition };
2611
+ export { type AdminListOptions, type ApprovalListOptions, type ApprovalRequestOptions, type AttributeQueryOptions, type AutoBatchOptions, type BackoffKind, type BackpressurePolicy, BitmapStore, BloomFilterStore, type BudgetCommitOptions, type BudgetReserveOptions, COMMAND_OPCODES, type CancelOptions, ChildSpec, type CircuitOpenOptions, type ClaimDueOptions, ClaimHydrationError, type ClaimHydrationItem, ClaimedItem, type Codec, type CollectionScanOptions, Command, CommandArgument, type CommandExecutor, type CompleteJobsAndClaimJobsResult, type CompleteManyOptions, type CompleteOptions, ConnectionClosedError, type ConnectionRequestDisposition, type CountMinMergeOptions, CountMinSketchStore, CreateItem, type CreateManyOptions, type CreateOptions, CuckooFilterStore, type EffectCompensateOptions, type EffectConfirmOptions, type EffectFailOptions, type EffectReserveOptions, type EffectStatusOptions, type EndpointPolicy, type ExceptionPolicy, type ExecutePipelineOptions, type ExpiryCondition, type ExtendLeaseOptions, FERRICSTORE_MINIMUM_SERVER_VERSION, FERRICSTORE_NATIVE_PROTOCOL_VERSION, FERRICSTORE_SDK_VERSION, type FailOptions, FencedItem, FencingToken, FerricStoreClient, type FerricStoreClientFromUrlOptions, type FerricStoreClientOptions, FerricStoreError, FetchOrComputeResult, type FlowAdminRecord, FlowAlreadyExistsError, type FlowBatchCompletedItem, FlowBatchError, type FlowEventProjectionField, type FlowExplainCapabilities, type FlowExplainResult, FlowNotFoundError, type FlowPolicyBackoffKind, type FlowPolicyBackoffSnapshot, type FlowPolicyOptions, type FlowPolicyRetentionSnapshot, type FlowPolicyRetrySnapshot, type FlowPolicySnapshot, type FlowPolicyStateSnapshot, FlowProjection, type FlowProjectionField, type FlowProjectionShape, type FlowQueryCountResult, FlowQueryError, type FlowQueryErrorPosition, type FlowQueryIndex, type FlowQueryIndexBuild, type FlowQueryIndexCoverage, type FlowQueryIndexField, type FlowQueryIndexFormat, type FlowQueryIndexProgress, type FlowQueryIndexRegistry, type FlowQueryIndexRetirement, type FlowQueryIndexServiceState, type FlowQueryIndexServices, type FlowQueryIndexStatistics, type FlowQueryIndexStatus, type FlowQueryIndexValidation, type FlowQueryInteger, type FlowQueryPage, type FlowQueryParameter, type FlowQueryParameters, type FlowQueryQuality, type FlowQueryRecord, type FlowQueryRecordsResult, type FlowQueryResult, type FlowQueryUsage, FlowRecord, type FlowRunProjectionField, type FlowStateMode, type FlowStatePolicy, type FlowStatePolicyLike, type FlowStatsOptions, FlowWrongStateError, type GeoAddOptions, type GeoMember, GeoStore, type GetExOptions, type GovernanceLedgerOptions, HTTPAdapter, type HTTPAdapterOptions, type HTTPCommandDisposition, HTTPTransportError, type HashScanResult, HashStore, type HistoryOptions, HyperLogLogStore, type IntegerReply, InvalidCommandError, type InvocationCreateOptions, JsonCodec, KeyInfo, KeyValueStore, type LeaseMutationOptions, LeaseRenewalError, type LimitAmountOptions, type LimitLeaseOptions, type LimitListOptions, type LimitReleaseOptions, ListStore, LockHeldError, LockNotOwnedError, MAX_FLOW_POLICY_GENERATION, type ManagementPairs, MaxActiveMs, type MutateOptions, NativeAdapter, type NativeAdapterOptions, type NativeClientOptions, type NativeProtocolEvent, Outcome, OverloadedError, type ProtocolCommand, Queue, type QueueBatchHandler, QueueClient, QueueCompletionError, type QueueHandler, type QueueJob, type QueueOptions, QueueWorker, type QueueWorkerResult, type RangeLimit, RateLimitResult, RawCodec, type ReadOptions, type ReclaimOptions, type ReconnectOptions, ReconnectingExecutor, type RequestContext, type RequestContextOptions, type RequestDisposition, RequestTimeoutError, RerouteError, type RetryOptions, type RetryPolicy, type RoutingEndpoint, type RoutingRoute, RoutingTopology, type RunStepsItem, type RunStepsManyOptions, type ScanOptions, type ScheduleCatchupPolicy, type ScheduleFireDueOptions, type ScheduleFireDueResult, type ScheduleFireOptions, type ScheduleFireResult, type ScheduleKind, type ScheduleListOptions, type ScheduleOptions, type ScheduleOverlapPolicy, type ScheduleRecord, type ScheduleState, type SearchOptions, type SearchStateMeta, type SetOptions, type SetScanResult, SetStore, type SortedSetScanResult, SortedSetStore, StaleLeaseError, StalePolicyGenerationError, type StartAndClaimOptions, StateMeta, type StateOptions, type StateRegistration, type StepContinueOptions, type StoreCommandClient, StreamStore, type TDigestCreateOptions, type TDigestMergeOptions, TDigestStore, type TopKReserveOptions, TopKStore, type TopologyNativeAdapterOptions, TopologyNativeAdapterPool, type TransitionOptions, type ValueConfig, type WorkerConfig, type WorkerProfile, type WorkerRefillStrategy, Workflow, WorkflowClient, WorkflowContext, WorkflowFlowCommands, type WorkflowHandler, type WorkflowOptions, WorkflowWorker, type WorkflowWorkerResult, type XReadStream, type ZAddMember, type ZAddOptions, classifyServerError, httpCommandDisposition, isReconnectableClosedConnectionError, mapException, projectFlowQuery };
package/dist/index.js CHANGED
@@ -8604,6 +8604,9 @@ var sessionOnlyCommands = /* @__PURE__ */ new Set([
8604
8604
  "CLIENT",
8605
8605
  "DISCARD",
8606
8606
  "EXEC",
8607
+ "FETCH_OR_COMPUTE",
8608
+ "FETCH_OR_COMPUTE_ERROR",
8609
+ "FETCH_OR_COMPUTE_RESULT",
8607
8610
  "HELLO",
8608
8611
  "MONITOR",
8609
8612
  "MULTI",
@@ -8653,6 +8656,7 @@ var encoding = "ferricstore-json-v1";
8653
8656
  var bytesMarker = "$ferricstore_bytes";
8654
8657
  var mapMarker = "$ferricstore_map";
8655
8658
  var maxDepth = 64;
8659
+ var integerJSON = /^-?(?:0|[1-9][0-9]*)$/u;
8656
8660
  var bytesMarkerBaseBytes = Buffer34.byteLength(bytesMarker) + 7;
8657
8661
  var mapMarkerBaseBytes = Buffer34.byteLength(mapMarker) + 7;
8658
8662
  function encodeHTTPCommands(commands, maxBytes = Number.MAX_SAFE_INTEGER) {
@@ -8665,13 +8669,20 @@ function encodeHTTPCommands(commands, maxBytes = Number.MAX_SAFE_INTEGER) {
8665
8669
  function decodeHTTPEnvelope(source) {
8666
8670
  let parsed;
8667
8671
  try {
8668
- parsed = JSON.parse(source.toString("utf8"));
8672
+ parsed = JSON.parse(source.toString("utf8"), preserveIntegerPrecision);
8669
8673
  } catch (error) {
8670
8674
  throw new TypeError("invalid HTTP command response JSON", { cause: error });
8671
8675
  }
8672
8676
  if (!isRecord(parsed)) throw new TypeError("HTTP command response must be an object");
8673
8677
  return decodePlainRecord(parsed, 0);
8674
8678
  }
8679
+ function preserveIntegerPrecision(_key, value, context) {
8680
+ if (typeof value !== "number" || Number.isSafeInteger(value) || !Number.isInteger(value)) {
8681
+ return value;
8682
+ }
8683
+ const literal = context?.source;
8684
+ return literal != null && integerJSON.test(literal) ? BigInt(literal) : value;
8685
+ }
8675
8686
  function encodeValue(value, depth, budget) {
8676
8687
  if (depth > maxDepth) throw new TypeError("HTTP command value exceeds maximum depth");
8677
8688
  if (value == null) {
@@ -21267,7 +21278,7 @@ var WorkflowWorker = class {
21267
21278
  };
21268
21279
 
21269
21280
  // src/version.ts
21270
- var FERRICSTORE_SDK_VERSION = "0.11.10";
21281
+ var FERRICSTORE_SDK_VERSION = "0.12.0";
21271
21282
  var FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
21272
21283
  var FERRICSTORE_NATIVE_PROTOCOL_VERSION = 1;
21273
21284
  export {