durability 5.1.0 → 5.2.1
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 +154 -21
- package/dist/{durability-alarms.d.ts → alarms/index.d.ts} +13 -5
- package/dist/{durability-alarms.js → alarms/index.js} +85 -74
- package/dist/alarms/migrations.d.ts +9 -0
- package/dist/alarms/migrations.js +133 -0
- package/dist/experimental.d.ts +10 -10
- package/dist/experimental.js +7 -7
- package/dist/{fanout.d.ts → fanout/index.d.ts} +13 -6
- package/dist/{fanout.js → fanout/index.js} +91 -83
- package/dist/fanout/migrations.d.ts +9 -0
- package/dist/fanout/migrations.js +181 -0
- package/dist/{stored-message.d.ts → fanout/stored-message.d.ts} +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.js +13 -8
- package/dist/{log.d.ts → log/index.d.ts} +27 -20
- package/dist/{log.js → log/index.js} +200 -166
- package/dist/log/migrations.d.ts +18 -0
- package/dist/log/migrations.js +297 -0
- package/dist/{memoize.d.ts → memoize/index.d.ts} +1 -1
- package/dist/{memoize.js → memoize/index.js} +23 -21
- package/dist/memoize/migrations.d.ts +10 -0
- package/dist/memoize/migrations.js +21 -0
- package/dist/migrations.d.ts +0 -111
- package/dist/migrations.js +12 -628
- package/dist/{durability.d.ts → operations/index.d.ts} +13 -5
- package/dist/{durability.js → operations/index.js} +76 -70
- package/dist/operations/migrations.d.ts +10 -0
- package/dist/operations/migrations.js +150 -0
- package/dist/{outbox.d.ts → outbox/index.d.ts} +4 -4
- package/dist/{outbox.js → outbox/index.js} +35 -77
- package/dist/outbox/migrations.d.ts +9 -0
- package/dist/outbox/migrations.js +43 -0
- package/dist/policy.d.ts +19 -19
- package/dist/policy.js +13 -12
- package/dist/{routing-client.js → routing/client.js} +1 -1
- package/dist/{routing.d.ts → routing/index.d.ts} +3 -3
- package/dist/{routing.js → routing/index.js} +3 -3
- package/dist/{load.d.ts → routing/load.d.ts} +1 -1
- package/dist/{schedule.d.ts → schedule/index.d.ts} +16 -8
- package/dist/{schedule.js → schedule/index.js} +97 -83
- package/dist/schedule/migrations.d.ts +9 -0
- package/dist/schedule/migrations.js +118 -0
- package/dist/{scheduler.d.ts → scheduler/index.d.ts} +75 -25
- package/dist/{scheduler.js → scheduler/index.js} +308 -70
- package/dist/{semaphore-client.d.ts → semaphore/client.d.ts} +1 -1
- package/dist/{semaphore-client.js → semaphore/client.js} +8 -7
- package/dist/{semaphore.d.ts → semaphore/index.d.ts} +10 -10
- package/dist/{semaphore.js → semaphore/index.js} +7 -7
- package/dist/{semaphore-leases.d.ts → semaphore/leases.d.ts} +17 -6
- package/dist/{semaphore-leases.js → semaphore/leases.js} +28 -12
- package/dist/semaphore/migrations.d.ts +18 -0
- package/dist/semaphore/migrations.js +444 -0
- package/dist/semaphore/protocol.d.ts +451 -0
- package/dist/semaphore/protocol.js +114 -0
- package/dist/semaphore/queue-store.d.ts +107 -0
- package/dist/semaphore/queue-store.js +258 -0
- package/dist/{semaphore-queue.d.ts → semaphore/queue.d.ts} +15 -5
- package/dist/{semaphore-queue.js → semaphore/queue.js} +105 -46
- package/dist/{semaphore-server.d.ts → semaphore/server.d.ts} +12 -4
- package/dist/{semaphore-server.js → semaphore/server.js} +56 -28
- package/dist/semaphore/store.d.ts +53 -0
- package/dist/semaphore/store.js +107 -0
- package/dist/serialization.d.ts +5 -0
- package/dist/serialization.js +41 -16
- package/dist/{client.d.ts → socket/client.d.ts} +3 -3
- package/dist/{client.js → socket/client.js} +4 -4
- package/dist/{socket.d.ts → socket/index.d.ts} +15 -4
- package/dist/{socket.js → socket/index.js} +66 -20
- package/dist/socket/migrations.d.ts +9 -0
- package/dist/socket/migrations.js +57 -0
- package/dist/{socket-protocol.d.ts → socket/protocol.d.ts} +1 -1
- package/dist/storage.d.ts +4 -0
- package/dist/storage.js +22 -15
- package/dist/{topology-client.d.ts → topology/client.d.ts} +2 -2
- package/dist/{topology-client.js → topology/client.js} +3 -3
- package/dist/{topology.d.ts → topology/index.d.ts} +17 -7
- package/dist/{topology.js → topology/index.js} +106 -72
- package/dist/topology/migrations.d.ts +10 -0
- package/dist/topology/migrations.js +138 -0
- package/dist/topology/snapshot.d.ts +50 -0
- package/dist/topology/snapshot.js +38 -0
- package/dist/{tracker.d.ts → tracker/index.d.ts} +3 -3
- package/dist/{tracker.js → tracker/index.js} +9 -9
- package/package.json +11 -11
- package/dist/semaphore-protocol.d.ts +0 -231
- package/dist/semaphore-protocol.js +0 -106
- package/dist/semaphore-queue-store.d.ts +0 -95
- package/dist/semaphore-queue-store.js +0 -252
- package/dist/semaphore-store.d.ts +0 -43
- package/dist/semaphore-store.js +0 -108
- package/dist/topology-snapshot.d.ts +0 -70
- package/dist/topology-snapshot.js +0 -48
- /package/dist/{stored-message.js → fanout/stored-message.js} +0 -0
- /package/dist/{routing-client.d.ts → routing/client.d.ts} +0 -0
- /package/dist/{load.js → routing/load.js} +0 -0
- /package/dist/{socket-protocol.js → socket/protocol.js} +0 -0
- /package/dist/{tracked-source.d.ts → tracker/source.d.ts} +0 -0
- /package/dist/{tracked-source.js → tracker/source.js} +0 -0
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '
|
|
3
|
-
import { type SchedulerAttachment } from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { RoutingLoad, type EnqueueResult, type LoadSnapshot } from '../routing/load.js';
|
|
3
|
+
import { type SchedulerAttachment } from '../scheduler/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* One in-flight or settled range of offsets held by a consumer. A range is
|
|
6
6
|
* redelivered under a fresh `batch_id`, so an ack from a previous holder is
|
|
7
7
|
* rejected rather than advancing a range someone else now owns.
|
|
8
8
|
*/
|
|
9
|
-
declare const logLeaseRowSchema:
|
|
10
|
-
batch_id:
|
|
11
|
-
consumer:
|
|
12
|
-
first_offset:
|
|
13
|
-
last_offset:
|
|
14
|
-
state:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
attempt: z.ZodNumber;
|
|
21
|
-
expires_at: z.ZodNumber;
|
|
22
|
-
created_at: z.ZodNumber;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
export type LogLeaseRow = z.infer<typeof logLeaseRowSchema>;
|
|
9
|
+
declare const logLeaseRowSchema: v.ObjectSchema<{
|
|
10
|
+
readonly batch_id: v.StringSchema<undefined>;
|
|
11
|
+
readonly consumer: v.StringSchema<undefined>;
|
|
12
|
+
readonly first_offset: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
13
|
+
readonly last_offset: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
14
|
+
readonly state: v.PicklistSchema<["active", "pending", "acked", "skipped"], undefined>;
|
|
15
|
+
readonly attempt: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>]>;
|
|
16
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
17
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
export type LogLeaseRow = v.InferOutput<typeof logLeaseRowSchema>;
|
|
25
20
|
export type LogBounds = {
|
|
26
21
|
/**
|
|
27
22
|
* Lowest readable offset, counting flushed segments that can be rehydrated.
|
|
@@ -60,6 +55,12 @@ export type LogReadOptions = {
|
|
|
60
55
|
};
|
|
61
56
|
/** One contiguous run of records leaving the object, oldest first. */
|
|
62
57
|
export type LogSegment<Body = unknown> = {
|
|
58
|
+
/**
|
|
59
|
+
* The log always supplies its channel. Optional for legacy callers that
|
|
60
|
+
* construct segments themselves; omitted means `default`. Shared external
|
|
61
|
+
* storage must include the channel in the location it writes to.
|
|
62
|
+
*/
|
|
63
|
+
channel?: string;
|
|
63
64
|
firstOffset: number;
|
|
64
65
|
lastOffset: number;
|
|
65
66
|
records: LogRecord<Body>[];
|
|
@@ -109,6 +110,12 @@ export type LogRetention = {
|
|
|
109
110
|
maxBytes?: number;
|
|
110
111
|
};
|
|
111
112
|
export type DurabilityLogConfig<Body = unknown> = SchedulerAttachment & {
|
|
113
|
+
/**
|
|
114
|
+
* Partitions records, offsets, cursors, cold segments, and leases, so
|
|
115
|
+
* several logs share one object without seeing each other. Defaults to
|
|
116
|
+
* `default`; one instance per channel may attach to a scheduler.
|
|
117
|
+
*/
|
|
118
|
+
channel?: string;
|
|
112
119
|
/** Without retention the log grows until the object's storage limit. */
|
|
113
120
|
retention?: LogRetention;
|
|
114
121
|
cold?: LogColdStorage<Body>;
|
|
@@ -135,7 +142,7 @@ export declare const maxLogBytes = 1073741824;
|
|
|
135
142
|
export declare class DurabilityLog<Body = unknown> {
|
|
136
143
|
#private;
|
|
137
144
|
constructor(config: DurabilityLogConfig<Body>);
|
|
138
|
-
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("
|
|
145
|
+
static migrate(context: Pick<DurableObjectState, 'storage'>, target?: string | null): import("../migrations.js").DurabilityMigrationResult;
|
|
139
146
|
/**
|
|
140
147
|
* Appends the batch atomically. Definite input rejections return
|
|
141
148
|
* success:false; storage and commit uncertainty throws, so a caller never
|