@superbee/core 0.2.0-pre.15 → 0.2.0-pre.17
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 +316 -0
- package/dist/backend.d.ts +3 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +7 -0
- package/dist/backend.js.map +1 -1
- package/dist/blob-contract.d.ts +80 -0
- package/dist/blob-contract.d.ts.map +1 -0
- package/dist/blob-contract.js +131 -0
- package/dist/blob-contract.js.map +1 -0
- package/dist/blob-journal.d.ts +117 -0
- package/dist/blob-journal.d.ts.map +1 -0
- package/dist/blob-journal.js +168 -0
- package/dist/blob-journal.js.map +1 -0
- package/dist/bundle-health/index.d.ts +14 -0
- package/dist/bundle-health/index.d.ts.map +1 -0
- package/dist/bundle-health/index.js +12 -0
- package/dist/bundle-health/index.js.map +1 -0
- package/dist/bundle-health/kind-findings.d.ts +44 -0
- package/dist/bundle-health/kind-findings.d.ts.map +1 -0
- package/dist/bundle-health/kind-findings.js +68 -0
- package/dist/bundle-health/kind-findings.js.map +1 -0
- package/dist/bundle-health/legacy-page.d.ts +39 -0
- package/dist/bundle-health/legacy-page.d.ts.map +1 -0
- package/dist/bundle-health/legacy-page.js +50 -0
- package/dist/bundle-health/legacy-page.js.map +1 -0
- package/dist/bundle-health/report.d.ts +202 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +438 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/engine.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js.map +1 -1
- package/dist/file-journaled-backend-internal.d.ts +2 -0
- package/dist/file-journaled-backend-internal.d.ts.map +1 -1
- package/dist/file-journaled-backend-internal.js +2 -0
- package/dist/file-journaled-backend-internal.js.map +1 -1
- package/dist/file-journaled-backend.d.ts +14 -2
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +245 -37
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/hosted-client/binding.d.ts +7 -0
- package/dist/hosted-client/binding.d.ts.map +1 -0
- package/dist/hosted-client/binding.js +10 -0
- package/dist/hosted-client/binding.js.map +1 -0
- package/dist/hosted-client/blob-delivery.d.ts +61 -0
- package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
- package/dist/hosted-client/blob-delivery.js +147 -0
- package/dist/hosted-client/blob-delivery.js.map +1 -0
- package/dist/hosted-client/bundle-listing.d.ts +46 -0
- package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
- package/dist/hosted-client/bundle-listing.js +36 -0
- package/dist/hosted-client/bundle-listing.js.map +1 -0
- package/dist/hosted-client/client.d.ts +155 -0
- package/dist/hosted-client/client.d.ts.map +1 -0
- package/dist/hosted-client/client.js +278 -0
- package/dist/hosted-client/client.js.map +1 -0
- package/dist/hosted-client/errors.d.ts +16 -0
- package/dist/hosted-client/errors.d.ts.map +1 -0
- package/dist/hosted-client/errors.js +22 -0
- package/dist/hosted-client/errors.js.map +1 -0
- package/dist/hosted-client/index.d.ts +23 -0
- package/dist/hosted-client/index.d.ts.map +1 -0
- package/dist/hosted-client/index.js +25 -0
- package/dist/hosted-client/index.js.map +1 -0
- package/dist/hosted-client/node.d.ts +70 -0
- package/dist/hosted-client/node.d.ts.map +1 -0
- package/dist/hosted-client/node.js +214 -0
- package/dist/hosted-client/node.js.map +1 -0
- package/dist/hosted-client/reference.d.ts +12 -0
- package/dist/hosted-client/reference.d.ts.map +1 -0
- package/dist/hosted-client/reference.js +29 -0
- package/dist/hosted-client/reference.js.map +1 -0
- package/dist/hosted-client/write.d.ts +200 -0
- package/dist/hosted-client/write.d.ts.map +1 -0
- package/dist/hosted-client/write.js +401 -0
- package/dist/hosted-client/write.js.map +1 -0
- package/dist/hosted-transport/answer-rows.d.ts +29 -2
- package/dist/hosted-transport/answer-rows.d.ts.map +1 -1
- package/dist/hosted-transport/answer-rows.js +60 -2
- package/dist/hosted-transport/answer-rows.js.map +1 -1
- package/dist/hosted-transport/blob-reads.d.ts +35 -0
- package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
- package/dist/hosted-transport/blob-reads.js +179 -0
- package/dist/hosted-transport/blob-reads.js.map +1 -0
- package/dist/hosted-transport/blob-write.d.ts +34 -0
- package/dist/hosted-transport/blob-write.d.ts.map +1 -0
- package/dist/hosted-transport/blob-write.js +115 -0
- package/dist/hosted-transport/blob-write.js.map +1 -0
- package/dist/hosted-transport/carrier.d.ts +8 -9
- package/dist/hosted-transport/carrier.d.ts.map +1 -1
- package/dist/hosted-transport/carrier.js +40 -41
- package/dist/hosted-transport/carrier.js.map +1 -1
- package/dist/hosted-transport/index.d.ts +4 -4
- package/dist/hosted-transport/index.d.ts.map +1 -1
- package/dist/hosted-transport/index.js +4 -4
- package/dist/hosted-transport/index.js.map +1 -1
- package/dist/hosted-transport/read-adapter.d.ts +6 -0
- package/dist/hosted-transport/read-adapter.d.ts.map +1 -1
- package/dist/hosted-transport/read-adapter.js +11 -0
- package/dist/hosted-transport/read-adapter.js.map +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -1
- package/dist/hosted-transport/whole-document-transport.js +20 -12
- package/dist/hosted-transport/whole-document-transport.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/journaled-backend.d.ts +10 -2
- package/dist/journaled-backend.d.ts.map +1 -1
- package/dist/journaled-backend.js +3 -3
- package/dist/journaled-backend.js.map +1 -1
- package/dist/kinds-load.js +4 -4
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +3 -2
- package/dist/kinds.js.map +1 -1
- package/dist/link-types.d.ts +26 -0
- package/dist/link-types.d.ts.map +1 -0
- package/dist/link-types.js +57 -0
- package/dist/link-types.js.map +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +25 -0
- package/dist/paths.js.map +1 -1
- package/dist/platform.d.ts +4 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +16 -0
- package/dist/platform.js.map +1 -1
- package/dist/query-filter.d.ts +9 -0
- package/dist/query-filter.d.ts.map +1 -1
- package/dist/query-filter.js +19 -3
- package/dist/query-filter.js.map +1 -1
- package/dist/recipe-lifecycle/errors.d.ts +77 -0
- package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
- package/dist/recipe-lifecycle/errors.js +96 -0
- package/dist/recipe-lifecycle/errors.js.map +1 -0
- package/dist/recipe-lifecycle/evolution.d.ts +71 -0
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
- package/dist/recipe-lifecycle/evolution.js +659 -0
- package/dist/recipe-lifecycle/evolution.js.map +1 -0
- package/dist/recipe-lifecycle/index.d.ts +23 -0
- package/dist/recipe-lifecycle/index.d.ts.map +1 -0
- package/dist/recipe-lifecycle/index.js +19 -0
- package/dist/recipe-lifecycle/index.js.map +1 -0
- package/dist/recipe-lifecycle/install.d.ts +111 -0
- package/dist/recipe-lifecycle/install.d.ts.map +1 -0
- package/dist/recipe-lifecycle/install.js +412 -0
- package/dist/recipe-lifecycle/install.js.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
- package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
- package/dist/recipe-lifecycle/stamp.d.ts +98 -0
- package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
- package/dist/recipe-lifecycle/stamp.js +260 -0
- package/dist/recipe-lifecycle/stamp.js.map +1 -0
- package/dist/recipes.d.ts +5 -0
- package/dist/recipes.d.ts.map +1 -1
- package/dist/recipes.js +5 -0
- package/dist/recipes.js.map +1 -1
- package/dist/record-overlay/apply.d.ts +43 -0
- package/dist/record-overlay/apply.d.ts.map +1 -0
- package/dist/record-overlay/apply.js +490 -0
- package/dist/record-overlay/apply.js.map +1 -0
- package/dist/record-overlay/canonical.d.ts +14 -0
- package/dist/record-overlay/canonical.d.ts.map +1 -0
- package/dist/record-overlay/canonical.js +31 -0
- package/dist/record-overlay/canonical.js.map +1 -0
- package/dist/record-overlay/digest.d.ts +4 -0
- package/dist/record-overlay/digest.d.ts.map +1 -0
- package/dist/record-overlay/digest.js +11 -0
- package/dist/record-overlay/digest.js.map +1 -0
- package/dist/record-overlay/errors.d.ts +40 -0
- package/dist/record-overlay/errors.d.ts.map +1 -0
- package/dist/record-overlay/errors.js +51 -0
- package/dist/record-overlay/errors.js.map +1 -0
- package/dist/record-overlay/findings.d.ts +5 -0
- package/dist/record-overlay/findings.d.ts.map +1 -0
- package/dist/record-overlay/findings.js +83 -0
- package/dist/record-overlay/findings.js.map +1 -0
- package/dist/record-overlay/index.d.ts +23 -0
- package/dist/record-overlay/index.d.ts.map +1 -0
- package/dist/record-overlay/index.js +21 -0
- package/dist/record-overlay/index.js.map +1 -0
- package/dist/record-overlay/plan.d.ts +12 -0
- package/dist/record-overlay/plan.d.ts.map +1 -0
- package/dist/record-overlay/plan.js +284 -0
- package/dist/record-overlay/plan.js.map +1 -0
- package/dist/record-overlay/policy.d.ts +60 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +209 -0
- package/dist/record-overlay/policy.js.map +1 -0
- package/dist/record-overlay/redact.d.ts +3 -0
- package/dist/record-overlay/redact.d.ts.map +1 -0
- package/dist/record-overlay/redact.js +27 -0
- package/dist/record-overlay/redact.js.map +1 -0
- package/dist/record-overlay/signal-kind.d.ts +30 -0
- package/dist/record-overlay/signal-kind.d.ts.map +1 -0
- package/dist/record-overlay/signal-kind.js +38 -0
- package/dist/record-overlay/signal-kind.js.map +1 -0
- package/dist/record-overlay/signal-text.d.ts +45 -0
- package/dist/record-overlay/signal-text.d.ts.map +1 -0
- package/dist/record-overlay/signal-text.js +116 -0
- package/dist/record-overlay/signal-text.js.map +1 -0
- package/dist/record-overlay/source-index.d.ts +19 -0
- package/dist/record-overlay/source-index.d.ts.map +1 -0
- package/dist/record-overlay/source-index.js +102 -0
- package/dist/record-overlay/source-index.js.map +1 -0
- package/dist/record-overlay/types.d.ts +286 -0
- package/dist/record-overlay/types.d.ts.map +1 -0
- package/dist/record-overlay/types.js +2 -0
- package/dist/record-overlay/types.js.map +1 -0
- package/dist/remote-operations.js +5 -2
- package/dist/remote-operations.js.map +1 -1
- package/dist/storage.d.ts +5 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +4 -1
- package/dist/storage.js.map +1 -1
- package/dist/uncertain-write.d.ts +107 -6
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +67 -32
- package/dist/uncertain-write.js.map +1 -1
- package/dist/write-identity.d.ts +5 -0
- package/dist/write-identity.d.ts.map +1 -0
- package/dist/write-identity.js +9 -0
- package/dist/write-identity.js.map +1 -0
- package/package.json +21 -1
|
@@ -73,21 +73,98 @@ export type Outcome = {
|
|
|
73
73
|
kind: "conflict";
|
|
74
74
|
actual: Version | null;
|
|
75
75
|
tombstone?: Version;
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `executed` is present only on a refusal that is not the identity's recorded answer: `false`
|
|
79
|
+
* when this attempt was refused before it could execute (nothing was sent, or the authority
|
|
80
|
+
* refused it before dispatch), `"unknown"` when the authority's answer does not say. Such a
|
|
81
|
+
* refusal is evidence about this attempt only, never about an earlier delivery of the identity.
|
|
82
|
+
*/
|
|
83
|
+
| {
|
|
77
84
|
kind: "refused";
|
|
78
85
|
code: string;
|
|
79
86
|
message: string;
|
|
80
|
-
|
|
87
|
+
executed?: false | "unknown";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* `refusal` names the attempt-only refusal that ended the call, when one did: a resend refused
|
|
91
|
+
* before execution while an earlier delivery may still be held. The identity stays unknown;
|
|
92
|
+
* the refusal says why it could not be settled now (for example, access withdrawn).
|
|
93
|
+
*/
|
|
94
|
+
| {
|
|
81
95
|
kind: "unknown";
|
|
96
|
+
refusal?: {
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
};
|
|
82
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* A lookup's answer that the authority holds the identity without a result yet: a delivery of
|
|
103
|
+
* it was admitted and may still commit. Distinct from `null`, which says it was never admitted.
|
|
104
|
+
*/
|
|
105
|
+
export interface LookupPending {
|
|
106
|
+
kind: "pending";
|
|
107
|
+
}
|
|
108
|
+
/** The one {@link LookupPending} answer. */
|
|
109
|
+
export declare const LOOKUP_PENDING: LookupPending;
|
|
83
110
|
/** A transport to a shared authority that records outcomes by request identity. */
|
|
84
111
|
export interface OperationTransport {
|
|
85
112
|
/** Deliver the intent once; a repeated `requestId` must return the recorded outcome unchanged. */
|
|
86
113
|
submit(intent: OperationIntent, options?: {
|
|
87
114
|
signal?: AbortSignal;
|
|
88
115
|
}): Promise<Outcome>;
|
|
89
|
-
/**
|
|
90
|
-
|
|
116
|
+
/**
|
|
117
|
+
* The recorded outcome for `requestId`; {@link LookupPending} when the authority holds it
|
|
118
|
+
* unanswered; or `null` when the authority never recorded it. A transport that cannot tell
|
|
119
|
+
* pending from absent answers `null` for both.
|
|
120
|
+
*/
|
|
121
|
+
lookup(requestId: string): Promise<Outcome | LookupPending | null>;
|
|
122
|
+
}
|
|
123
|
+
/** Minimal classification for recorded-only delivery. A commit need not invent a new-head
|
|
124
|
+
* version (for example, an identified blob delete can carry its complete absence receipt). */
|
|
125
|
+
export interface NonExecutedAttempt {
|
|
126
|
+
kind: "not-executed";
|
|
127
|
+
attempts: number;
|
|
128
|
+
details: unknown;
|
|
129
|
+
}
|
|
130
|
+
export type RecordedWriteOutcome = NonExecutedAttempt | {
|
|
131
|
+
kind: "committed";
|
|
132
|
+
} | {
|
|
133
|
+
kind: "conflict";
|
|
134
|
+
} | {
|
|
135
|
+
kind: "refused";
|
|
136
|
+
code: string;
|
|
137
|
+
message: string;
|
|
138
|
+
} | {
|
|
139
|
+
kind: "unknown";
|
|
140
|
+
};
|
|
141
|
+
export type RecordedWriteIntent = Pick<OperationIntent, "requestId" | "kind" | "target" | "createdAt" | "attempts" | "state"> & {
|
|
142
|
+
/** Opt-in qualification; old no-prefix explicit callers retain their contract. */
|
|
143
|
+
notAppliedThrough?: number;
|
|
144
|
+
};
|
|
145
|
+
export interface RecordedWriteTransport<I extends RecordedWriteIntent, O extends RecordedWriteOutcome> {
|
|
146
|
+
submit(intent: I, options?: {
|
|
147
|
+
signal?: AbortSignal;
|
|
148
|
+
}): Promise<O>;
|
|
149
|
+
/** Null/absence is inconclusive and NEVER grants this path permission to submit. */
|
|
150
|
+
lookup(requestId: string): Promise<O | null>;
|
|
151
|
+
}
|
|
152
|
+
/** Explicit starts are for callers that own persistence, not proof minted by this primitive.
|
|
153
|
+
* submit-claimed requires a freshly successful durable in_flight CAS, held under the checkout
|
|
154
|
+
* lock, immediately before this call; its counted attempt is sent at most once. After reopening,
|
|
155
|
+
* or when that freshness cannot be established, use lookup. Replaying a stored claim is NOT a
|
|
156
|
+
* fresh CAS. Nor does a new CAS prove an earlier unclear delivery cannot still commit: those
|
|
157
|
+
* identities must use lookup. This function creates no ticket or journal persistence itself. */
|
|
158
|
+
export type RecordedWriteOptions = Omit<UncertainWriteOptions, "settlement" | "maxSubmissions" | "earlierDeliveryUnclear"> & {
|
|
159
|
+
settlement: "recorded-only";
|
|
160
|
+
start: "submit-claimed" | "lookup";
|
|
161
|
+
};
|
|
162
|
+
export interface RecordedWriteResult<I extends RecordedWriteIntent, O extends RecordedWriteOutcome> {
|
|
163
|
+
intent: Omit<I, "attempts" | "state"> & Pick<RecordedWriteIntent, "attempts" | "state">;
|
|
164
|
+
outcome: O | {
|
|
165
|
+
kind: "unknown";
|
|
166
|
+
};
|
|
167
|
+
lookups: number;
|
|
91
168
|
}
|
|
92
169
|
/** Wait `ms`, resolving early and harmlessly when `signal` aborts. Injected by tests. */
|
|
93
170
|
export type Sleep = (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
@@ -104,6 +181,20 @@ export interface UncertainWriteOptions {
|
|
|
104
181
|
maxSubmissions?: number;
|
|
105
182
|
/** Timer; defaults to a `setTimeout` sleep. */
|
|
106
183
|
sleep?: Sleep;
|
|
184
|
+
/**
|
|
185
|
+
* Ends the call early once aborted: no further lookup or resubmission starts, the wait between
|
|
186
|
+
* lookups is cut short, and the outcome is `unknown` unless one was already known. Absent, the
|
|
187
|
+
* call runs every lookup and submission it is permitted.
|
|
188
|
+
*/
|
|
189
|
+
signal?: AbortSignal;
|
|
190
|
+
/**
|
|
191
|
+
* The intent's earlier submission, made by an earlier call, ended without a definitive answer
|
|
192
|
+
* (its outcome was unknown, or the call stopped while it was in flight). A resubmission refused
|
|
193
|
+
* before execution is then `unknown`, as one after an unclear submission in this call is.
|
|
194
|
+
* Default false: an earlier submission answered with such a refusal (a paused intent requeued)
|
|
195
|
+
* may be resent and refused again definitively.
|
|
196
|
+
*/
|
|
197
|
+
earlierDeliveryUnclear?: boolean;
|
|
107
198
|
}
|
|
108
199
|
export interface UncertainWriteResult {
|
|
109
200
|
/** The intent with `attempts` and `state` advanced to reflect this call. */
|
|
@@ -119,9 +210,9 @@ export interface UncertainWriteResult {
|
|
|
119
210
|
*/
|
|
120
211
|
export declare const AUTHORIZATION_REFUSAL_CODES: ReadonlySet<string>;
|
|
121
212
|
/** True when a refusal reports lost permission, which pauses further shared operations. */
|
|
122
|
-
export declare function isAuthorizationRefusal(outcome: Outcome): boolean;
|
|
213
|
+
export declare function isAuthorizationRefusal(outcome: Outcome | RecordedWriteOutcome): boolean;
|
|
123
214
|
/** The journal state an outcome settles an intent into. */
|
|
124
|
-
export declare function stateForOutcome(outcome: Outcome): OperationState;
|
|
215
|
+
export declare function stateForOutcome(outcome: Outcome | RecordedWriteOutcome): OperationState;
|
|
125
216
|
/** The longest request identity the wire accepts as `Idempotency-Key`. */
|
|
126
217
|
export declare const REQUEST_ID_MAX_LENGTH = 128;
|
|
127
218
|
/**
|
|
@@ -171,8 +262,18 @@ export declare function settleAgainstIntent(outcome: Outcome, intent: OperationI
|
|
|
171
262
|
* transport never answers `null` for an absent record once the intent is older than the host's
|
|
172
263
|
* stated retention window, less a skew margin, so it does not resubmit there.
|
|
173
264
|
*
|
|
265
|
+
* A refusal before execution ({@link isAuthorizationRefusal}) of a resubmission that follows an
|
|
266
|
+
* unclear submission (in this call, or an earlier one per `earlierDeliveryUnclear`) is `unknown`,
|
|
267
|
+
* carrying that refusal, not settled: a `null` lookup cannot prove an earlier delivery will not
|
|
268
|
+
* still arrive, and the delivery can still commit. After a {@link LookupPending} answer, which
|
|
269
|
+
* says a delivery is held, the same holds for every refusal the transport marks `executed`
|
|
270
|
+
* (a gateway's `400` included). A pending lookup still permits the resubmission.
|
|
271
|
+
*
|
|
174
272
|
* By default every outcome passes through {@link settleAgainstIntent}, so a conflict naming the
|
|
175
273
|
* intent's own version is committed. `recorded-only` preserves the recorded outcome instead.
|
|
176
274
|
*/
|
|
275
|
+
export declare function performUncertainWrite<I extends RecordedWriteIntent, O extends RecordedWriteOutcome>(transport: RecordedWriteTransport<I, O>, intent: I, options: RecordedWriteOptions): Promise<RecordedWriteResult<I, O>>;
|
|
276
|
+
/** Compatibility path: a complete document intent, with the existing counters/resubmission
|
|
277
|
+
* defaults. Body delivery's recorded-only call without start remains on this path. */
|
|
177
278
|
export declare function performUncertainWrite(transport: OperationTransport, intent: OperationIntent, options?: UncertainWriteOptions): Promise<UncertainWriteResult>;
|
|
178
279
|
//# sourceMappingURL=uncertain-write.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uncertain-write.d.ts","sourceRoot":"","sources":["../src/uncertain-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;G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EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAO1D,CAAC;AAEH,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,GAAG,OAAO,CAEvF;AAcD,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,GAAG,cAAc,CAavF;AAED,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED,mGAAmG;AACnG,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAqBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAKtF;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,mBAAmB,EAAE,CAAC,SAAS,oBAAoB,EACjG,SAAS,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,GAChF,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtC;sFACsF;AACtF,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,qBAAqB,GACtF,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
|
package/dist/uncertain-write.js
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* `sleep` used for the submission deadline and the delay between lookups; there is no
|
|
16
16
|
* injectable clock, and a transport's own latency is real.
|
|
17
17
|
*/
|
|
18
|
+
/** The one {@link LookupPending} answer. */
|
|
19
|
+
export const LOOKUP_PENDING = Object.freeze({ kind: "pending" });
|
|
18
20
|
/**
|
|
19
21
|
* Refusal codes that pause shared operations rather than say the content is wrong: the caller's
|
|
20
22
|
* authorization is gone, or a hosted sync quota (`REQUEST_CAPACITY_*`, one per scope the host
|
|
@@ -32,6 +34,17 @@ export const AUTHORIZATION_REFUSAL_CODES = new Set([
|
|
|
32
34
|
export function isAuthorizationRefusal(outcome) {
|
|
33
35
|
return outcome.kind === "refused" && AUTHORIZATION_REFUSAL_CODES.has(outcome.code);
|
|
34
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* True when a resend's refusal cannot settle an identity whose earlier delivery is unclear. An
|
|
39
|
+
* authorization refusal never can: access lost now says nothing about a delivery authorized
|
|
40
|
+
* earlier. Once a lookup answered {@link LookupPending}, an earlier delivery is known to be held,
|
|
41
|
+
* so no refusal the transport marks as attempt-only (`executed`) can either. Without that
|
|
42
|
+
* answer, a marked refusal of the same bytes (a schema `400`, the mass-delete hold) settles, as
|
|
43
|
+
* it would refuse a delayed first delivery too.
|
|
44
|
+
*/
|
|
45
|
+
function refusalLeavesUnknown(outcome, held) {
|
|
46
|
+
return outcome.kind === "refused" && (isAuthorizationRefusal(outcome) || (held && outcome.executed !== undefined));
|
|
47
|
+
}
|
|
35
48
|
/** The journal state an outcome settles an intent into. */
|
|
36
49
|
export function stateForOutcome(outcome) {
|
|
37
50
|
switch (outcome.kind) {
|
|
@@ -41,6 +54,8 @@ export function stateForOutcome(outcome) {
|
|
|
41
54
|
return "conflict";
|
|
42
55
|
case "refused":
|
|
43
56
|
return "refused";
|
|
57
|
+
case "not-executed":
|
|
58
|
+
return "pending";
|
|
44
59
|
case "unknown":
|
|
45
60
|
return "unknown";
|
|
46
61
|
}
|
|
@@ -120,64 +135,76 @@ async function submitOnce(transport, intent, deadlineMs, sleep) {
|
|
|
120
135
|
controller.abort();
|
|
121
136
|
return UNKNOWN;
|
|
122
137
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Deliver `intent` and settle it against the authority's recorded outcome.
|
|
125
|
-
*
|
|
126
|
-
* Flow: when the intent has never been submitted, submit it; when it has (`attempts > 0`), or
|
|
127
|
-
* when a submission's outcome is unknown, look the request identity up. A positive lookup
|
|
128
|
-
* settles the intent. A `null` lookup is taken as proof that the authority never recorded the
|
|
129
|
-
* request, so a resubmission with the same `requestId` is the first delivery and is allowed, up
|
|
130
|
-
* to `maxSubmissions`. A lookup that fails leaves the outcome unknown and the intent for a later
|
|
131
|
-
* call.
|
|
132
|
-
*
|
|
133
|
-
* No resubmission happens without a `null` lookup because a blind retry after an unknown
|
|
134
|
-
* outcome is unsound: on an authority without request identity the retry applies the write
|
|
135
|
-
* twice, and even on one with it the retry can only ever learn what the lookup already knew.
|
|
136
|
-
* The lookup is what turns "unknown" into a fact before any second delivery.
|
|
137
|
-
*
|
|
138
|
-
* That fact is only as good as the transport's `null`. An authority that has expired or lost a
|
|
139
|
-
* record answers as if it never recorded it, and the reference wire transport returns `null`
|
|
140
|
-
* then. The resubmission is guarded only by its `base`, and versions are content hashes: if the
|
|
141
|
-
* write had landed and a third party has since restored `base` exactly, the premise matches, the
|
|
142
|
-
* write is applied a second time over that revert, and the outcome is `committed`. The hosted
|
|
143
|
-
* transport never answers `null` for an absent record once the intent is older than the host's
|
|
144
|
-
* stated retention window, less a skew margin, so it does not resubmit there.
|
|
145
|
-
*
|
|
146
|
-
* By default every outcome passes through {@link settleAgainstIntent}, so a conflict naming the
|
|
147
|
-
* intent's own version is committed. `recorded-only` preserves the recorded outcome instead.
|
|
148
|
-
*/
|
|
149
138
|
export async function performUncertainWrite(transport, intent, options = {}) {
|
|
139
|
+
const explicitStart = "start" in options;
|
|
140
|
+
if (explicitStart) {
|
|
141
|
+
if (options.settlement !== "recorded-only" || (options.start !== "submit-claimed" && options.start !== "lookup") ||
|
|
142
|
+
!Number.isSafeInteger(intent.attempts) || intent.attempts < 0 ||
|
|
143
|
+
!["pending", "in_flight", "acknowledged", "conflict", "refused", "unknown"].includes(intent.state) ||
|
|
144
|
+
(options.start === "submit-claimed" && (intent.state !== "in_flight" || intent.attempts < 1)))
|
|
145
|
+
throw new Error("Invalid recorded-only delivery start or durable claim.");
|
|
146
|
+
if (intent.notAppliedThrough !== undefined && (!Number.isSafeInteger(intent.notAppliedThrough) || intent.notAppliedThrough < 0 || intent.notAppliedThrough > intent.attempts || options.start === "submit-claimed" && intent.notAppliedThrough !== intent.attempts - 1))
|
|
147
|
+
throw new Error("Invalid recorded-only non-execution prefix or durable claim.");
|
|
148
|
+
// Capture the descriptor before the first asynchronous boundary. Additional prepared data
|
|
149
|
+
// belongs to the typed caller; the primitive neither fabricates nor interprets its fields.
|
|
150
|
+
intent = { ...intent };
|
|
151
|
+
options = { ...options };
|
|
152
|
+
}
|
|
150
153
|
if (options.settlement !== undefined && options.settlement !== "exact-content" && options.settlement !== "recorded-only") {
|
|
151
154
|
throw new Error("Unknown uncertain-write settlement mode.");
|
|
152
155
|
}
|
|
153
156
|
const sleep = options.sleep ?? defaultSleep;
|
|
154
157
|
const maxLookups = Math.max(1, options.maxLookups ?? 3);
|
|
155
|
-
const maxSubmissions = Math.max(1, options.maxSubmissions ?? 2);
|
|
158
|
+
const maxSubmissions = explicitStart ? 1 : Math.max(1, options.maxSubmissions ?? 2);
|
|
156
159
|
const lookupDelayMs = options.lookupDelayMs ?? 250;
|
|
160
|
+
const { signal } = options;
|
|
161
|
+
// Whether a submission of this identity may still be held by the authority unanswered.
|
|
162
|
+
let unclear = options.earlierDeliveryUnclear === true && intent.attempts > 0;
|
|
163
|
+
// Whether any lookup in this call answered pending: a delivery of this identity was held, so
|
|
164
|
+
// a later absent answer in the same call does not undo it.
|
|
165
|
+
let held = false;
|
|
157
166
|
let attempts = intent.attempts;
|
|
158
167
|
let submissions = 0;
|
|
159
168
|
let lookups = 0;
|
|
160
169
|
const finish = (raw) => {
|
|
170
|
+
// Only the compatibility overload admits exact-content settlement and it requires the
|
|
171
|
+
// original full OperationIntent/Outcome contract. Explicit starts never use those fields.
|
|
161
172
|
const outcome = options.settlement === "recorded-only" ? raw : settleAgainstIntent(raw, intent);
|
|
162
173
|
return { intent: { ...intent, attempts, state: stateForOutcome(outcome) }, outcome, lookups };
|
|
163
174
|
};
|
|
164
175
|
// A previously submitted intent starts at the lookup, never at a submission.
|
|
165
|
-
let needSubmission = attempts === 0;
|
|
176
|
+
let needSubmission = explicitStart ? options.start === "submit-claimed" : attempts === 0;
|
|
166
177
|
for (;;) {
|
|
167
178
|
if (needSubmission) {
|
|
168
|
-
if (submissions >= maxSubmissions)
|
|
179
|
+
if (submissions >= maxSubmissions || ((explicitStart || submissions > 0) && signal?.aborted))
|
|
169
180
|
return finish(UNKNOWN);
|
|
170
181
|
submissions += 1;
|
|
171
|
-
|
|
182
|
+
if (!explicitStart)
|
|
183
|
+
attempts += 1;
|
|
172
184
|
const outcome = await submitOnce(transport, { ...intent, attempts, state: "in_flight" }, options.deadlineMs, sleep);
|
|
185
|
+
if (outcome.kind === "not-executed") {
|
|
186
|
+
if (!explicitStart || intent.notAppliedThrough === undefined || intent.notAppliedThrough !== attempts - 1 || outcome.attempts !== attempts || signal?.aborted)
|
|
187
|
+
return finish(UNKNOWN);
|
|
188
|
+
return finish(outcome);
|
|
189
|
+
}
|
|
190
|
+
// A resend refused before it reached execution (no credential, access withdrawn, a spent
|
|
191
|
+
// quota, a gateway's schema check) is evidence about that resend only: an earlier, unclear delivery may still be held
|
|
192
|
+
// by the authority and commit, so the identity stays unknown and the intent is kept.
|
|
193
|
+
if (unclear && refusalLeavesUnknown(outcome, held))
|
|
194
|
+
return finish(explicitStart ? UNKNOWN : { kind: "unknown", refusal: { code: outcome.code, message: outcome.message } });
|
|
173
195
|
if (outcome.kind !== "unknown")
|
|
174
196
|
return finish(outcome);
|
|
197
|
+
unclear = true;
|
|
175
198
|
}
|
|
176
199
|
needSubmission = false;
|
|
177
200
|
let recorded;
|
|
178
201
|
for (let round = 0; round < maxLookups; round++) {
|
|
202
|
+
if (signal?.aborted)
|
|
203
|
+
break;
|
|
179
204
|
if (round > 0)
|
|
180
|
-
await sleep(lookupDelayMs);
|
|
205
|
+
await sleep(lookupDelayMs, signal);
|
|
206
|
+
if (signal?.aborted)
|
|
207
|
+
break;
|
|
181
208
|
lookups += 1;
|
|
182
209
|
try {
|
|
183
210
|
recorded = await transport.lookup(intent.requestId);
|
|
@@ -190,8 +217,16 @@ export async function performUncertainWrite(transport, intent, options = {}) {
|
|
|
190
217
|
}
|
|
191
218
|
if (recorded === undefined)
|
|
192
219
|
return finish(UNKNOWN);
|
|
220
|
+
if (recorded !== null && recorded.kind === "pending") {
|
|
221
|
+
// Held unanswered: a delivery of this identity was admitted and may still commit.
|
|
222
|
+
unclear = true;
|
|
223
|
+
held = true;
|
|
224
|
+
recorded = null;
|
|
225
|
+
}
|
|
193
226
|
if (recorded !== null)
|
|
194
|
-
return finish(recorded);
|
|
227
|
+
return finish(recorded.kind === "not-executed" ? UNKNOWN : recorded);
|
|
228
|
+
if (explicitStart)
|
|
229
|
+
return finish(UNKNOWN);
|
|
195
230
|
needSubmission = true;
|
|
196
231
|
}
|
|
197
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uncertain-write.js","sourceRoot":"","sources":["../src/uncertain-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"uncertain-write.js","sourceRoot":"","sources":["../src/uncertain-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiFH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAkB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAwFhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC;IACtE,eAAe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,CAAC;QACtE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC;YAChD,IAAI,MAAM,EAAE,OAAO;gBAAE,MAAM;YAC3B,IAAI,KAAK,GAAG,CAAC;gBAAE,MAAM,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAClD,IAAI,MAAM,EAAE,OAAO;gBAAE,MAAM;YAC3B,OAAO,IAAI,CAAC,CAAC;YACb,IAAI,CAAC;gBACH,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACtD,CAAC;YAAC,MAAM,CAAC;gBACP,QAAQ,GAAG,SAAS,CAAC;gBACrB,SAAS;YACX,CAAC;YACD,MAAM;QACR,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACrD,kFAAkF;YAClF,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,GAAG,IAAI,CAAC;YACZ,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC5F,IAAI,aAAa;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Lexical write identity rules, independent of transport and payload families. */
|
|
2
|
+
export declare function isWriteRequestId(value: string): boolean;
|
|
3
|
+
export declare function isWriteBinding(value: string): boolean;
|
|
4
|
+
export declare function isAgentLabelVia(value: unknown): value is string;
|
|
5
|
+
//# sourceMappingURL=write-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-identity.d.ts","sourceRoot":"","sources":["../src/write-identity.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAgD;AACtG,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Lexical write identity rules, independent of transport and payload families. */
|
|
2
|
+
export function isWriteRequestId(value) {
|
|
3
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(value);
|
|
4
|
+
}
|
|
5
|
+
export function isWriteBinding(value) { return /^sha256:[a-f0-9]{64}$/.test(value); }
|
|
6
|
+
export function isAgentLabelVia(value) {
|
|
7
|
+
return typeof value === "string" && /^[a-z0-9._-]{1,32}$/.test(value) && !value.startsWith("superbee");
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=write-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-identity.js","sourceRoot":"","sources":["../src/write-identity.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,uEAAuE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7F,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,KAAa,IAAa,OAAO,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtG,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACzG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superbee/core",
|
|
3
|
-
"version": "0.2.0-pre.
|
|
3
|
+
"version": "0.2.0-pre.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OKF store engine \u2014 bundle I/O, cross-links, derived backlinks, freshness, and versioned writes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,6 +47,18 @@
|
|
|
47
47
|
"types": "./dist/recipes.d.ts",
|
|
48
48
|
"default": "./dist/recipes.js"
|
|
49
49
|
},
|
|
50
|
+
"./recipe-lifecycle": {
|
|
51
|
+
"types": "./dist/recipe-lifecycle/index.d.ts",
|
|
52
|
+
"default": "./dist/recipe-lifecycle/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./record-overlay": {
|
|
55
|
+
"types": "./dist/record-overlay/index.d.ts",
|
|
56
|
+
"default": "./dist/record-overlay/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./bundle-health": {
|
|
59
|
+
"types": "./dist/bundle-health/index.d.ts",
|
|
60
|
+
"default": "./dist/bundle-health/index.js"
|
|
61
|
+
},
|
|
50
62
|
"./kinds": {
|
|
51
63
|
"types": "./dist/kinds.d.ts",
|
|
52
64
|
"default": "./dist/kinds.js"
|
|
@@ -111,6 +123,14 @@
|
|
|
111
123
|
"types": "./dist/hosted-transport/index.d.ts",
|
|
112
124
|
"default": "./dist/hosted-transport/index.js"
|
|
113
125
|
},
|
|
126
|
+
"./hosted-client": {
|
|
127
|
+
"types": "./dist/hosted-client/index.d.ts",
|
|
128
|
+
"default": "./dist/hosted-client/index.js"
|
|
129
|
+
},
|
|
130
|
+
"./hosted-client/node": {
|
|
131
|
+
"types": "./dist/hosted-client/node.d.ts",
|
|
132
|
+
"default": "./dist/hosted-client/node.js"
|
|
133
|
+
},
|
|
114
134
|
"./storage": {
|
|
115
135
|
"types": "./dist/storage.d.ts",
|
|
116
136
|
"default": "./dist/storage.js"
|