@ferricstore/ferricstore 0.1.4 → 0.1.6
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 +56 -1
- package/dist/index.cjs +1320 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +282 -9
- package/dist/index.d.ts +282 -9
- package/dist/index.js +1317 -45
- package/dist/index.js.map +1 -1
- package/docs/api/assets/hierarchy.js +1 -1
- package/docs/api/assets/highlight.css +6 -6
- package/docs/api/assets/navigation.js +1 -1
- package/docs/api/assets/search.js +1 -1
- package/docs/api/classes/FerricStoreClient.html +25 -2
- package/docs/api/classes/FerricStoreError.html +3 -3
- 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/InvalidCommandError.html +3 -3
- package/docs/api/classes/LockHeldError.html +3 -3
- package/docs/api/classes/LockNotOwnedError.html +3 -3
- package/docs/api/classes/NativeAdapter.html +3 -2
- package/docs/api/classes/OverloadedError.html +3 -3
- package/docs/api/classes/ReconnectingExecutor.html +4 -2
- package/docs/api/classes/RoutingTopology.html +9 -0
- package/docs/api/classes/StaleLeaseError.html +3 -3
- package/docs/api/classes/TopologyNativeAdapterPool.html +8 -0
- package/docs/api/classes/Workflow.html +3 -2
- package/docs/api/classes/WorkflowClient.html +2 -2
- package/docs/api/classes/WorkflowContext.html +2 -2
- package/docs/api/classes/WorkflowFlowCommands.html +2 -2
- package/docs/api/classes/WorkflowWorker.html +2 -2
- package/docs/api/functions/isReconnectableClosedConnectionError.html +1 -1
- package/docs/api/hierarchy.html +1 -1
- package/docs/api/index.html +21 -7
- package/docs/api/interfaces/AutoBatchOptions.html +2 -2
- package/docs/api/interfaces/CancelOptions.html +2 -2
- package/docs/api/interfaces/ClaimDueOptions.html +2 -2
- package/docs/api/interfaces/ClaimedItem.html +2 -3
- package/docs/api/interfaces/CommandExecutor.html +4 -2
- package/docs/api/interfaces/CompleteOptions.html +2 -2
- package/docs/api/interfaces/CompleteOutcome.html +1 -1
- package/docs/api/interfaces/CreateManyOptions.html +2 -2
- package/docs/api/interfaces/CreateOptions.html +2 -2
- package/docs/api/interfaces/ExecutePipelineOptions.html +2 -2
- package/docs/api/interfaces/FailOptions.html +2 -2
- package/docs/api/interfaces/FailOutcome.html +1 -1
- package/docs/api/interfaces/FencedItem.html +2 -2
- package/docs/api/interfaces/FerricStoreClientFromUrlOptions.html +2 -2
- package/docs/api/interfaces/FerricStoreClientOptions.html +2 -2
- package/docs/api/interfaces/FetchOrComputeResult.html +2 -2
- package/docs/api/interfaces/FlowPolicyOptions.html +7 -0
- package/docs/api/interfaces/FlowRecord.html +2 -2
- package/docs/api/interfaces/FlowStatePolicy.html +3 -0
- package/docs/api/interfaces/InvocationCreateOptions.html +4 -0
- package/docs/api/interfaces/KeyInfo.html +2 -2
- package/docs/api/interfaces/MutateOptions.html +2 -2
- package/docs/api/interfaces/NamedValueMutation.html +1 -1
- package/docs/api/interfaces/NativeAdapterOptions.html +8 -2
- package/docs/api/interfaces/ProtocolCommand.html +5 -0
- package/docs/api/interfaces/RateLimitResult.html +2 -2
- package/docs/api/interfaces/ReadOptions.html +2 -2
- package/docs/api/interfaces/ReclaimOptions.html +2 -2
- package/docs/api/interfaces/ReconnectOptions.html +2 -2
- package/docs/api/interfaces/RequestContext.html +4 -0
- package/docs/api/interfaces/RequestContextOptions.html +2 -0
- package/docs/api/interfaces/RetryOptions.html +2 -2
- package/docs/api/interfaces/RetryOutcome.html +1 -1
- package/docs/api/interfaces/RoutingEndpoint.html +5 -0
- package/docs/api/interfaces/RoutingRoute.html +7 -0
- package/docs/api/interfaces/SearchOptions.html +12 -0
- package/docs/api/interfaces/StateOptions.html +3 -2
- package/docs/api/interfaces/StateRegistration.html +3 -2
- package/docs/api/interfaces/TDigestCreateOptions.html +1 -1
- package/docs/api/interfaces/TDigestMergeOptions.html +1 -1
- package/docs/api/interfaces/TransitionOptions.html +2 -2
- package/docs/api/interfaces/TransitionOutcome.html +1 -1
- package/docs/api/interfaces/WorkflowOptions.html +2 -2
- package/docs/api/interfaces/WorkflowWorkerResult.html +2 -2
- package/docs/api/modules.html +1 -1
- package/docs/api/types/CommandArgument.html +1 -1
- package/docs/api/types/EndpointPolicy.html +1 -0
- package/docs/api/types/FlowStateMode.html +1 -0
- package/docs/api/types/FlowStatePolicyLike.html +1 -0
- package/docs/api/types/ManagementPairs.html +1 -0
- package/docs/api/types/QueueBatchHandler.html +1 -1
- package/docs/api/types/QueueHandler.html +1 -1
- package/docs/api/types/QueueJob.html +1 -0
- package/docs/api/types/SearchStateMeta.html +1 -0
- package/docs/api/types/WorkflowHandler.html +1 -1
- package/docs/api/variables/COMMAND_OPCODES.html +1 -0
- package/docs/python-parity.md +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,43 @@ const { FerricStoreClient, JsonCodec } = require("@ferricstore/ferricstore");
|
|
|
34
34
|
docker run -p 6388:6388 \
|
|
35
35
|
-e FERRICSTORE_PROTECTED_MODE=false \
|
|
36
36
|
-v ferricstore_data:/data \
|
|
37
|
-
ghcr.io/ferricstore/ferricstore:0.
|
|
37
|
+
ghcr.io/ferricstore/ferricstore:0.7.5
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Cluster-aware client
|
|
41
|
+
|
|
42
|
+
For a single node, use `fromUrl`. For a FerricStore cluster, pass multiple seed URLs. The SDK fetches the server `SHARDS` topology, routes keyed commands to the current shard leader, and refuses learned hosts outside the seed-host trust set by default.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const flow = await FerricStoreClient.fromUrls(
|
|
46
|
+
[
|
|
47
|
+
"ferric://fs0.example.com:6388",
|
|
48
|
+
"ferric://fs1.example.com:6388",
|
|
49
|
+
"ferric://fs2.example.com:6388"
|
|
50
|
+
],
|
|
51
|
+
{
|
|
52
|
+
codec: new JsonCodec(),
|
|
53
|
+
nativeOptions: {
|
|
54
|
+
// Use "any" only inside a trusted private network.
|
|
55
|
+
endpointPolicy: "seed_hosts",
|
|
56
|
+
warmConnections: true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
await flow.refreshTopology();
|
|
62
|
+
console.log(await flow.route("tenant-a:order-1"));
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You can also keep one primary URL and add seeds:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
const flow = await FerricStoreClient.fromUrl("ferric://fs0.example.com:6388", {
|
|
69
|
+
nativeOptions: {
|
|
70
|
+
haRouting: true,
|
|
71
|
+
seeds: ["ferric://fs1.example.com:6388", "ferric://fs2.example.com:6388"]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
38
74
|
```
|
|
39
75
|
|
|
40
76
|
## Durable Queue
|
|
@@ -135,6 +171,25 @@ for (const job of jobs) {
|
|
|
135
171
|
}
|
|
136
172
|
```
|
|
137
173
|
|
|
174
|
+
FIFO Flow state policy is opt-in per state:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
await flow.installPolicy("email", {
|
|
178
|
+
states: {
|
|
179
|
+
queued: { mode: "fifo" }
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
await flow.create("email-3", {
|
|
184
|
+
partitionKey: "tenant-a:email",
|
|
185
|
+
payload: Buffer.from("welcome"),
|
|
186
|
+
state: "queued",
|
|
187
|
+
type: "email"
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
FIFO states require a `partitionKey`; priority is for parallel states.
|
|
192
|
+
|
|
138
193
|
## FerricStore KV And Data Structures
|
|
139
194
|
|
|
140
195
|
The same client exposes typed helpers for FerricStore's Redis-compatible store commands:
|