@smthrs/run-store 0.0.0-stage → 1.0.0-rc.4

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 (157) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/LICENSE +21 -0
  3. package/README.md +195 -2
  4. package/dist/cjs/AttemptStore.d.ts +359 -0
  5. package/dist/cjs/AttemptStore.d.ts.map +1 -0
  6. package/dist/cjs/AttemptStore.js +731 -0
  7. package/dist/cjs/AttemptStore.js.map +7 -0
  8. package/dist/cjs/Heartbeat.d.ts +46 -0
  9. package/dist/cjs/Heartbeat.d.ts.map +1 -0
  10. package/dist/cjs/Heartbeat.js +28 -0
  11. package/dist/cjs/Heartbeat.js.map +7 -0
  12. package/dist/cjs/Migrations.d.ts +42 -0
  13. package/dist/cjs/Migrations.d.ts.map +1 -0
  14. package/dist/cjs/Migrations.js +55 -0
  15. package/dist/cjs/Migrations.js.map +7 -0
  16. package/dist/cjs/Ownership.d.ts +275 -0
  17. package/dist/cjs/Ownership.d.ts.map +1 -0
  18. package/dist/cjs/Ownership.js +129 -0
  19. package/dist/cjs/Ownership.js.map +7 -0
  20. package/dist/cjs/RunStore.d.ts +571 -0
  21. package/dist/cjs/RunStore.d.ts.map +1 -0
  22. package/dist/cjs/RunStore.js +1079 -0
  23. package/dist/cjs/RunStore.js.map +7 -0
  24. package/dist/cjs/RunStoreMetrics.d.ts +151 -0
  25. package/dist/cjs/RunStoreMetrics.d.ts.map +1 -0
  26. package/dist/cjs/RunStoreMetrics.js +91 -0
  27. package/dist/cjs/RunStoreMetrics.js.map +7 -0
  28. package/dist/cjs/index.d.ts +47 -0
  29. package/dist/cjs/index.d.ts.map +1 -0
  30. package/dist/cjs/index.js +43 -0
  31. package/dist/cjs/index.js.map +7 -0
  32. package/dist/cjs/internal/Boundary.d.ts +80 -0
  33. package/dist/cjs/internal/Boundary.d.ts.map +1 -0
  34. package/dist/cjs/internal/Boundary.js +92 -0
  35. package/dist/cjs/internal/Boundary.js.map +7 -0
  36. package/dist/cjs/internal/Companion.d.ts +44 -0
  37. package/dist/cjs/internal/Companion.d.ts.map +1 -0
  38. package/dist/cjs/internal/Companion.js +50 -0
  39. package/dist/cjs/internal/Companion.js.map +7 -0
  40. package/dist/cjs/internal/SpanOutcome.d.ts +37 -0
  41. package/dist/cjs/internal/SpanOutcome.d.ts.map +1 -0
  42. package/dist/cjs/internal/SpanOutcome.js +62 -0
  43. package/dist/cjs/internal/SpanOutcome.js.map +7 -0
  44. package/dist/cjs/migrations/0001_initial.d.ts +15 -0
  45. package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
  46. package/dist/cjs/migrations/0001_initial.js +110 -0
  47. package/dist/cjs/migrations/0001_initial.js.map +7 -0
  48. package/dist/cjs/migrations/0002_lineage.d.ts +27 -0
  49. package/dist/cjs/migrations/0002_lineage.d.ts.map +1 -0
  50. package/dist/cjs/migrations/0002_lineage.js +43 -0
  51. package/dist/cjs/migrations/0002_lineage.js.map +7 -0
  52. package/dist/cjs/migrations/0003_execution_revisions.d.ts +15 -0
  53. package/dist/cjs/migrations/0003_execution_revisions.d.ts.map +1 -0
  54. package/dist/cjs/migrations/0003_execution_revisions.js +77 -0
  55. package/dist/cjs/migrations/0003_execution_revisions.js.map +7 -0
  56. package/dist/cjs/migrations/0004_waiting_request.d.ts +32 -0
  57. package/dist/cjs/migrations/0004_waiting_request.d.ts.map +1 -0
  58. package/dist/cjs/migrations/0004_waiting_request.js +42 -0
  59. package/dist/cjs/migrations/0004_waiting_request.js.map +7 -0
  60. package/dist/cjs/package.json +1 -0
  61. package/dist/cjs/test/TestRunStore.d.ts +17 -0
  62. package/dist/cjs/test/TestRunStore.d.ts.map +1 -0
  63. package/dist/cjs/test/TestRunStore.js +42 -0
  64. package/dist/cjs/test/TestRunStore.js.map +7 -0
  65. package/dist/esm/AttemptStore.d.ts +359 -0
  66. package/dist/esm/AttemptStore.d.ts.map +1 -0
  67. package/dist/esm/AttemptStore.js +835 -0
  68. package/dist/esm/AttemptStore.js.map +1 -0
  69. package/dist/esm/Heartbeat.d.ts +46 -0
  70. package/dist/esm/Heartbeat.d.ts.map +1 -0
  71. package/dist/esm/Heartbeat.js +46 -0
  72. package/dist/esm/Heartbeat.js.map +1 -0
  73. package/dist/esm/Migrations.d.ts +42 -0
  74. package/dist/esm/Migrations.d.ts.map +1 -0
  75. package/dist/esm/Migrations.js +56 -0
  76. package/dist/esm/Migrations.js.map +1 -0
  77. package/dist/esm/Ownership.d.ts +275 -0
  78. package/dist/esm/Ownership.d.ts.map +1 -0
  79. package/dist/esm/Ownership.js +299 -0
  80. package/dist/esm/Ownership.js.map +1 -0
  81. package/dist/esm/RunStore.d.ts +571 -0
  82. package/dist/esm/RunStore.d.ts.map +1 -0
  83. package/dist/esm/RunStore.js +1287 -0
  84. package/dist/esm/RunStore.js.map +1 -0
  85. package/dist/esm/RunStoreMetrics.d.ts +151 -0
  86. package/dist/esm/RunStoreMetrics.d.ts.map +1 -0
  87. package/dist/esm/RunStoreMetrics.js +120 -0
  88. package/dist/esm/RunStoreMetrics.js.map +1 -0
  89. package/dist/esm/index.d.ts +47 -0
  90. package/dist/esm/index.d.ts.map +1 -0
  91. package/dist/esm/index.js +47 -0
  92. package/dist/esm/index.js.map +1 -0
  93. package/dist/esm/internal/Boundary.d.ts +80 -0
  94. package/dist/esm/internal/Boundary.d.ts.map +1 -0
  95. package/dist/esm/internal/Boundary.js +109 -0
  96. package/dist/esm/internal/Boundary.js.map +1 -0
  97. package/dist/esm/internal/Companion.d.ts +44 -0
  98. package/dist/esm/internal/Companion.d.ts.map +1 -0
  99. package/dist/esm/internal/Companion.js +53 -0
  100. package/dist/esm/internal/Companion.js.map +1 -0
  101. package/dist/esm/internal/SpanOutcome.d.ts +37 -0
  102. package/dist/esm/internal/SpanOutcome.d.ts.map +1 -0
  103. package/dist/esm/internal/SpanOutcome.js +48 -0
  104. package/dist/esm/internal/SpanOutcome.js.map +1 -0
  105. package/dist/esm/migrations/0001_initial.d.ts +15 -0
  106. package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
  107. package/dist/esm/migrations/0001_initial.js +88 -0
  108. package/dist/esm/migrations/0001_initial.js.map +1 -0
  109. package/dist/esm/migrations/0002_lineage.d.ts +27 -0
  110. package/dist/esm/migrations/0002_lineage.d.ts.map +1 -0
  111. package/dist/esm/migrations/0002_lineage.js +33 -0
  112. package/dist/esm/migrations/0002_lineage.js.map +1 -0
  113. package/dist/esm/migrations/0003_execution_revisions.d.ts +15 -0
  114. package/dist/esm/migrations/0003_execution_revisions.d.ts.map +1 -0
  115. package/dist/esm/migrations/0003_execution_revisions.js +58 -0
  116. package/dist/esm/migrations/0003_execution_revisions.js.map +1 -0
  117. package/dist/esm/migrations/0004_waiting_request.d.ts +32 -0
  118. package/dist/esm/migrations/0004_waiting_request.d.ts.map +1 -0
  119. package/dist/esm/migrations/0004_waiting_request.js +37 -0
  120. package/dist/esm/migrations/0004_waiting_request.js.map +1 -0
  121. package/dist/esm/test/TestRunStore.d.ts +17 -0
  122. package/dist/esm/test/TestRunStore.d.ts.map +1 -0
  123. package/dist/esm/test/TestRunStore.js +19 -0
  124. package/dist/esm/test/TestRunStore.js.map +1 -0
  125. package/docs/README.md +142 -0
  126. package/docs/api.md +901 -0
  127. package/docs/concepts/durable-values.md +140 -0
  128. package/docs/concepts/execution-revisions.md +53 -0
  129. package/docs/concepts/fencing.md +146 -0
  130. package/docs/concepts/leases.md +154 -0
  131. package/docs/concepts/liveness-evidence.md +142 -0
  132. package/docs/guides/cancel-a-run.md +156 -0
  133. package/docs/guides/claim-and-finish-a-run.md +175 -0
  134. package/docs/guides/compose-the-stores.md +142 -0
  135. package/docs/guides/observe-outcomes.md +182 -0
  136. package/docs/guides/record-step-attempts.md +170 -0
  137. package/docs/guides/recover-a-stalled-run.md +173 -0
  138. package/docs/guides/testing.md +141 -0
  139. package/docs/installation.md +109 -0
  140. package/docs/quickstart.md +201 -0
  141. package/docs/troubleshooting.md +255 -0
  142. package/package.json +183 -3
  143. package/src/AttemptStore.ts +1195 -0
  144. package/src/Heartbeat.ts +47 -0
  145. package/src/Migrations.ts +59 -0
  146. package/src/Ownership.ts +407 -0
  147. package/src/RunStore.ts +2063 -0
  148. package/src/RunStoreMetrics.ts +165 -0
  149. package/src/index.ts +51 -0
  150. package/src/internal/Boundary.ts +130 -0
  151. package/src/internal/Companion.ts +64 -0
  152. package/src/internal/SpanOutcome.ts +71 -0
  153. package/src/migrations/0001_initial.ts +114 -0
  154. package/src/migrations/0002_lineage.ts +38 -0
  155. package/src/migrations/0003_execution_revisions.ts +69 -0
  156. package/src/migrations/0004_waiting_request.ts +39 -0
  157. package/src/test/TestRunStore.ts +22 -0
@@ -0,0 +1,359 @@
1
+ /**
2
+ * Durable storage for individual step attempts.
3
+ *
4
+ * Attempt metadata is deliberately opaque to this module. Its shape belongs to
5
+ * the step executor, and is persisted unchanged across attempt state changes.
6
+ *
7
+ * The running-state and owner fences mean stale attempts and repeated terminal
8
+ * transitions never overwrite the winning row.
9
+ *
10
+ * @since 0.1.0
11
+ */
12
+ import { DurableWriter } from "@smthrs/database/DurableWriter";
13
+ import type { OwnerId } from "@smthrs/journal/OwnerId";
14
+ import * as Context from "effect/Context";
15
+ import * as Effect from "effect/Effect";
16
+ import * as Layer from "effect/Layer";
17
+ import * as Option from "effect/Option";
18
+ import * as Schema from "effect/Schema";
19
+ import * as SqlClient from "effect/unstable/sql/SqlClient";
20
+ /**
21
+ * Absolute ceiling for {@link Options.maxCheckpointBytes}.
22
+ *
23
+ * This bounds only the configured checkpoint policy; metadata, errors, and
24
+ * outcomes have no byte ceiling.
25
+ *
26
+ * @category constants
27
+ * @since 1.0.0-rc.0
28
+ */
29
+ export declare const maximumCheckpointBytes: number;
30
+ /**
31
+ * Maximum nesting admitted for durable attempt JSON.
32
+ *
33
+ * @category constants
34
+ * @since 1.0.0-rc.0
35
+ */
36
+ export declare const maximumJsonDepth = 128;
37
+ /**
38
+ * Maximum values and members admitted for durable attempt JSON.
39
+ *
40
+ * @category constants
41
+ * @since 1.0.0-rc.0
42
+ */
43
+ export declare const maximumJsonNodes = 100000;
44
+ /**
45
+ * Strict JSON value accepted as executable attempt state.
46
+ *
47
+ * The store still takes an inert snapshot at effect start; this schema is the
48
+ * public declaration contract shared by `Attempt`, `FinishAttempt`, and
49
+ * `AttemptPatch`.
50
+ *
51
+ * @category schemas
52
+ * @since 1.0.0-rc.0
53
+ */
54
+ export declare const JsonValue: Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>;
55
+ /**
56
+ * Strict JSON value accepted as executable attempt state.
57
+ *
58
+ * @category models
59
+ * @since 1.0.0-rc.0
60
+ */
61
+ export type JsonValue = typeof JsonValue.Type;
62
+ /**
63
+ * Stable error codes returned by attempt persistence operations.
64
+ *
65
+ * @category models
66
+ * @since 0.1.0
67
+ */
68
+ export declare const AttemptStoreErrorCode: Schema.Literals<readonly ["invalid_attempt", "constraint", "decode_failed", "persistence_failed", "unknown"]>;
69
+ /**
70
+ * Stable error codes returned by attempt persistence operations.
71
+ *
72
+ * @category models
73
+ * @since 0.1.0
74
+ */
75
+ export type AttemptStoreErrorCode = typeof AttemptStoreErrorCode.Type;
76
+ declare const AttemptStoreError_base: Schema.Class<AttemptStoreError, Schema.TaggedStruct<"@smthrs/run-store/AttemptStoreError", {
77
+ readonly code: Schema.Literals<readonly ["invalid_attempt", "constraint", "decode_failed", "persistence_failed", "unknown"]>;
78
+ readonly method: Schema.String;
79
+ readonly message: Schema.String;
80
+ readonly cause: Schema.optional<Schema.Unknown>;
81
+ }>, import("effect/Cause").YieldableError>;
82
+ /**
83
+ * Error raised by attempt persistence operations.
84
+ *
85
+ * The identity string equals the defining module path, which is how every
86
+ * tagged identity in this package is named.
87
+ *
88
+ * @category errors
89
+ * @since 0.1.0
90
+ */
91
+ export declare class AttemptStoreError extends AttemptStoreError_base {
92
+ }
93
+ /**
94
+ * Identifies one execution of a content-addressed step within a run.
95
+ *
96
+ * @category models
97
+ * @since 0.1.0
98
+ */
99
+ export declare const AttemptId: Schema.Struct<{
100
+ readonly runId: Schema.NonEmptyString;
101
+ readonly stepKeyDigest: Schema.NonEmptyString;
102
+ readonly attempt: Schema.Int;
103
+ }>;
104
+ /**
105
+ * Identifies one execution of a content-addressed step within a run.
106
+ *
107
+ * @category models
108
+ * @since 0.1.0
109
+ */
110
+ export type AttemptId = typeof AttemptId.Type;
111
+ /**
112
+ * A durable attempt row.
113
+ *
114
+ * @category models
115
+ * @since 0.1.0
116
+ */
117
+ export declare const Attempt: Schema.Struct<{
118
+ readonly state: Schema.NonEmptyString;
119
+ readonly startedAtMs: Schema.Int;
120
+ readonly finishedAtMs: Schema.optionalKey<Schema.Int>;
121
+ readonly heartbeatAtMs: Schema.optionalKey<Schema.Int>;
122
+ readonly checkpoint: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
123
+ readonly error: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
124
+ readonly outcome: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
125
+ readonly meta: Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>;
126
+ readonly runId: Schema.NonEmptyString;
127
+ readonly stepKeyDigest: Schema.NonEmptyString;
128
+ readonly attempt: Schema.Int;
129
+ }>;
130
+ /**
131
+ * A durable attempt row.
132
+ *
133
+ * @category models
134
+ * @since 0.1.0
135
+ */
136
+ export type Attempt = typeof Attempt.Type;
137
+ /**
138
+ * Input used to finish an existing attempt. `error`, `outcome`, and `meta`
139
+ * follow the same rule as {@link AttemptPatch}: an omitted field is left as
140
+ * recorded, so a terminal transition never erases a value written mid-flight
141
+ * by `put` or `patch`. Supplying one replaces it atomically with the terminal
142
+ * state, which lets an executor durably record what it discovered while
143
+ * handling a failure.
144
+ *
145
+ * @category models
146
+ * @since 0.1.0
147
+ */
148
+ export declare const FinishAttempt: Schema.Struct<{
149
+ readonly state: Schema.NonEmptyString;
150
+ readonly finishedAtMs: Schema.Int;
151
+ readonly error: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
152
+ readonly outcome: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
153
+ readonly meta: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
154
+ readonly runId: Schema.NonEmptyString;
155
+ readonly stepKeyDigest: Schema.NonEmptyString;
156
+ readonly attempt: Schema.Int;
157
+ }>;
158
+ /**
159
+ * Input used to finish an existing attempt.
160
+ *
161
+ * @category models
162
+ * @since 0.1.0
163
+ */
164
+ export type FinishAttempt = typeof FinishAttempt.Type;
165
+ /**
166
+ * Result of starting an owner-fenced attempt.
167
+ *
168
+ * @category models
169
+ * @since 0.1.0
170
+ */
171
+ export type PutResult = {
172
+ readonly _tag: "Inserted";
173
+ } | {
174
+ readonly _tag: "Upserted";
175
+ } | {
176
+ readonly _tag: "ExistingSame";
177
+ } | {
178
+ readonly _tag: "Conflict";
179
+ } | {
180
+ readonly _tag: "FenceLost";
181
+ } | {
182
+ readonly _tag: "RunNotFound";
183
+ };
184
+ /**
185
+ * Fields a patch may rewrite.
186
+ *
187
+ * A patch never touches `state`, `started_at_ms`, or `finished_at_ms`: those
188
+ * are the lifecycle, and only `put`/`heartbeat`/`finish` move them. An
189
+ * omitted field is left as recorded.
190
+ *
191
+ * @category models
192
+ * @since 0.1.0
193
+ */
194
+ export declare const AttemptPatch: Schema.Struct<{
195
+ readonly checkpoint: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
196
+ readonly error: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
197
+ readonly outcome: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
198
+ readonly meta: Schema.optionalKey<Schema.declare<import("@smthrs/canonical/BoundedJson").Json, import("@smthrs/canonical/BoundedJson").Json>>;
199
+ }>;
200
+ /**
201
+ * Fields a patch may rewrite.
202
+ *
203
+ * @category models
204
+ * @since 0.1.0
205
+ */
206
+ export type AttemptPatch = typeof AttemptPatch.Type;
207
+ /**
208
+ * Result of an owner-fenced attempt patch.
209
+ *
210
+ * @category models
211
+ * @since 0.1.0
212
+ */
213
+ export type PatchResult = {
214
+ readonly _tag: "Patched";
215
+ } | {
216
+ readonly _tag: "NotFound";
217
+ } | {
218
+ readonly _tag: "FenceLost";
219
+ };
220
+ /**
221
+ * Store-wide policy.
222
+ *
223
+ * Defaults treat only `running` attempts as in progress, cap checkpoints at
224
+ * 1 MiB, and make attempt insertion first-writer-wins.
225
+ *
226
+ * @category models
227
+ * @since 0.1.0
228
+ */
229
+ export interface Options {
230
+ /**
231
+ * States the store treats as "attempt still in progress". `heartbeat` and
232
+ * `finish` fence on membership, and `finish` refuses them as targets.
233
+ * Defaults to `["running"]`.
234
+ */
235
+ readonly inProgressStates?: ReadonlyArray<string> | undefined;
236
+ /**
237
+ * Largest encoded checkpoint accepted, in bytes. Defaults to 1 MiB and may
238
+ * not exceed {@link maximumCheckpointBytes}.
239
+ */
240
+ readonly maxCheckpointBytes?: number | undefined;
241
+ /**
242
+ * `"insert"` (the default) is first-writer-wins: a re-put with different
243
+ * content reports `Conflict`. `"upsert"` overwrites it and reports
244
+ * `Upserted` only while the existing row is still in progress. A terminal
245
+ * row remains immutable. Both modes keep the run-ownership fence.
246
+ */
247
+ readonly putMode?: "insert" | "upsert" | undefined;
248
+ }
249
+ /**
250
+ * Result of a fenced attempt heartbeat.
251
+ *
252
+ * @category models
253
+ * @since 0.1.0
254
+ */
255
+ export type HeartbeatResult = {
256
+ readonly _tag: "Updated";
257
+ } | {
258
+ readonly _tag: "FenceLost";
259
+ } | {
260
+ readonly _tag: "NotFound";
261
+ } | {
262
+ readonly _tag: "StateChanged";
263
+ };
264
+ /**
265
+ * Result of a fenced terminal attempt transition.
266
+ *
267
+ * @category models
268
+ * @since 0.1.0
269
+ */
270
+ export type FinishResult = {
271
+ readonly _tag: "Finished";
272
+ } | {
273
+ readonly _tag: "FenceLost";
274
+ } | {
275
+ readonly _tag: "NotFound";
276
+ } | {
277
+ readonly _tag: "StateChanged";
278
+ };
279
+ /**
280
+ * Attempt persistence operations.
281
+ *
282
+ * @category models
283
+ * @since 0.1.0
284
+ */
285
+ export interface Service {
286
+ readonly put: (attempt: Attempt, owner: OwnerId) => Effect.Effect<PutResult, AttemptStoreError>;
287
+ readonly get: (id: AttemptId) => Effect.Effect<Option.Option<Attempt>, AttemptStoreError>;
288
+ readonly heartbeat: (runId: string, stepKeyDigest: string, attempt: number, owner: OwnerId, nowMs: number, checkpoint?: JsonValue) => Effect.Effect<HeartbeatResult, AttemptStoreError>;
289
+ readonly finish: (attempt: FinishAttempt, owner: OwnerId) => Effect.Effect<FinishResult, AttemptStoreError>;
290
+ /**
291
+ * Rewrites opaque fields without competing for the attempt lifecycle: a
292
+ * patch never moves `state`, so executors record response text, worktree
293
+ * pointers, or cache flags on running *and* terminal rows. It is fenced on
294
+ * run ownership like every other write — `outcome` is replayed verbatim as
295
+ * the attempt's result, so a delayed patch from an owner that lost the run
296
+ * (or from any writer after the run reached a terminal status and its
297
+ * owner columns were cleared) reports `FenceLost` instead of rewriting the
298
+ * winning row. Prior art: Temporal conditions every persistence write on
299
+ * the shard `rangeID` (`reference/temporal/service/history/shard/`); there
300
+ * is no unfenced write surface.
301
+ */
302
+ readonly patch: (id: AttemptId, patch: AttemptPatch, owner: OwnerId) => Effect.Effect<PatchResult, AttemptStoreError>;
303
+ }
304
+ declare const AttemptStore_base: Context.ServiceClass<AttemptStore, "@smthrs/run-store/AttemptStore", Service>;
305
+ /**
306
+ * Service tag for durable step attempts.
307
+ *
308
+ * The identity string equals the defining module path, which is how every
309
+ * service in this package is named.
310
+ *
311
+ * @category services
312
+ * @since 0.1.0
313
+ */
314
+ export declare class AttemptStore extends AttemptStore_base {
315
+ }
316
+ /**
317
+ * Builds the SQL-backed attempt store under an explicit policy.
318
+ *
319
+ * @category constructors
320
+ * @since 0.1.0
321
+ */
322
+ export declare const makeWith: (options?: Options) => Effect.Effect<Service, AttemptStoreError, DurableWriter | SqlClient.SqlClient>;
323
+ /**
324
+ * Builds the SQL-backed attempt store with default policy.
325
+ *
326
+ * @category constructors
327
+ * @since 0.1.0
328
+ */
329
+ export declare const make: Effect.Effect<Service, never, DurableWriter | SqlClient.SqlClient>;
330
+ /**
331
+ * Creates an attempt store from an implementation.
332
+ *
333
+ * @category constructors
334
+ * @since 0.1.0
335
+ */
336
+ export declare const makeNoop: (overrides?: Partial<Service>) => Service;
337
+ /**
338
+ * Provides a no-op attempt store.
339
+ *
340
+ * @category layers
341
+ * @since 0.1.0
342
+ */
343
+ export declare const layerNoop: (overrides?: Partial<Service>) => Layer.Layer<AttemptStore>;
344
+ /**
345
+ * Provides the SQL-backed attempt store.
346
+ *
347
+ * @category layers
348
+ * @since 0.1.0
349
+ */
350
+ export declare const layer: Layer.Layer<AttemptStore, never, DurableWriter | SqlClient.SqlClient>;
351
+ /**
352
+ * Provides the SQL-backed attempt store under an explicit policy.
353
+ *
354
+ * @category layers
355
+ * @since 0.1.0
356
+ */
357
+ export declare const layerWith: (options: Options) => Layer.Layer<AttemptStore, AttemptStoreError, DurableWriter | SqlClient.SqlClient>;
358
+ export {};
359
+ //# sourceMappingURL=AttemptStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttemptStore.d.ts","sourceRoot":"","sources":["../../src/AttemptStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAiB,aAAa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