You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 207a2ac
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ npm test
25
25
-`queryV1.query` / `queryV1.queries` - reads through query.v1: the same query bodies as `assets.query`, rows translated the same way, but the endpoint is read-only and answers with rows alone, so it is the safe place to explore a query
26
26
-`resolve.numbers` / `resolve.ref` - asset numbers and OID tokens to assets, in one request
27
27
-`assets.sendGuarded` - a batch as a compare-and-set on each asset's ChangeDate; changed assets come back `skipped`
28
-
-`batch.run` / `batch.reversible` - preview, snapshot, (confirm,) send guarded, and a receipt with a reverse batch
28
+
-`batch.run` / `batch.reversible` - preview, snapshot, (confirm,) send guarded, and a receipt with a reverse batch. `confirm` sees the touched assets' names; aliased updates/executes are sent as written with `guard: false`; a failure after the send throws `BatchRecordError` carrying the receipt
29
29
-`createFetchTransport` - configurable HTTP transport: `credentials` for same-origin cookie auth, `onUnauthorized` to re-authenticate on a 401 (resends idempotent requests once), and a per-request `signal`; `client.withSignal(signal)` ties a whole client to one
30
30
-`ApiError` - typed API error; `CommandFailureError` - an api/asset batch in which commands failed (`failures` by index, plus the `response`)
Copy file name to clipboardExpand all lines: plans/001-sdk-adoption-campaign.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,9 +360,10 @@ ESM" here means finishing the edges:
360
360
-[x] A4 slack-shaped reads — `queryV1` wire module, `client.queryV1.query`/`queries` (read-only, idempotent, same row translation as api/asset)
361
361
-[x] A5 services port from gh-v1 — `resolve` (`client.resolve.numbers`/`.ref`), `guard` (`client.assets.sendGuarded`), `batch` (`client.batch.run`/`.reversible`)
362
362
-[ ] A6 CI + prerelease publish — CI (`.github/workflows/ci.yml`: verify on Node 20/22/24, `npm pack` artifact) and git-SHA installs (`prepare`) done; publish waits on the registry decision
for(constdofdescribed.deferred??[])notes.push(`command ${d.index} (${d.alias}): an aliased ${d.kind} of ${d.from}, sent as written with no snapshot; not reversed`);
160
180
if(commands.length)notes.unshift("restores the state recorded at snapshotAt; anything that changed between then and sentAt is not reflected, and a scalar restored to null is cleared, not unset");
161
181
return{ commands, notes };
162
182
}
@@ -169,6 +189,8 @@ export interface Receipt {
169
189
previewedAt: string;
170
190
preview: Command[];
171
191
described: Described;
192
+
/** Numbers and names of the assets the preview touches, looked up before confirm. */
193
+
names: Record<Oid,Named>;
172
194
snapshotAt?: string;
173
195
/** Before values per touched asset, ChangeDate included: what the guard compared and the reverse restores. */
174
196
before: Record<Oid,Record<string,unknown>>;
@@ -187,6 +209,24 @@ export interface Receipt {
187
209
/** Touched assets the guard left alone: changed or gone since the snapshot. */
188
210
skipped: Oid[];
189
211
reverse: Reverse;
212
+
/** What the record could not do and why: a name lookup that failed, deferred commands sent unsnapshotted. */
213
+
notes: string[];
214
+
}
215
+
216
+
/**
217
+
* The batch was sent and the server's outcome is on the receipt
218
+
* (`receipt.sent`, `receipt.outcome`, `receipt.reverse`), but reading the
219
+
* assets back afterwards failed, so `receipt.after` is incomplete: keep the
220
+
* receipt, and know that a reverse built from it cannot check every asset
221
+
* for changes made since.
222
+
*/
223
+
exportclassBatchRecordErrorextendsError{
224
+
readonlyreceipt: Receipt;
225
+
constructor(cause: unknown,receipt: Receipt){
226
+
super(`the batch was sent and its outcome recorded, but reading the assets back afterwards failed, so receipt.after is incomplete: ${causeinstanceofError ? cause.message : String(cause)}`,{ cause });
227
+
this.name="BatchRecordError";
228
+
this.receipt=receipt;
229
+
}
190
230
}
191
231
192
232
/** The send itself failed (a timeout, a 5xx): whether the server applied it is unknown. The receipt holds everything up to the attempt. */
notes.push(`could not look up Name for ${oids.length}${type} asset${oids.length===1 ? "" : "s"}: ${errorinstanceofError ? error.message : String(error)}`);
for(constdofdescribed.deferred)notes.push(`command ${d.index} (${d.alias}): an aliased ${d.kind}, which preview does not expand; sent as written, not snapshotted, not reversible`);
0 commit comments