@bastani/atomic 0.10.11-alpha.1 → 0.10.11-alpha.2
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/CHANGELOG.md +56 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +7 -7
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +7 -7
- package/dist/_shared/mode-shared-2QJSCUM6.js +7 -7
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-AVFII7NK.js → sdk-IQMULKFU.js} +2438 -470
- package/dist/_shared/sdk-IQMULKFU.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +3 -3
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js +1 -1
- package/dist/_shared/{settings-startup-4QCVCI53.js → settings-startup-HXQLSUWM.js} +8 -2
- package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -0
- package/dist/_shared/{startup-0-0-57KF6LZH.js → startup-0-0-3IXNMFM2.js} +392 -15
- package/dist/_shared/startup-0-0-3IXNMFM2.js.map +1 -0
- package/dist/_shared/{startup-0-1-GIY75K46.js → startup-0-1-7T2IAE7J.js} +51 -243
- package/dist/_shared/startup-0-1-7T2IAE7J.js.map +1 -0
- package/dist/_shared/{startup-0-2-27OWFHV6.js → startup-0-2-5QHPCEON.js} +225 -7
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -0
- package/dist/_shared/{startup-0-3-T4DVFYWX.js → startup-0-3-4ZYBYQNM.js} +273 -14
- package/dist/_shared/startup-0-3-4ZYBYQNM.js.map +1 -0
- package/dist/_shared/startup-0-4-ZMJV547D.js +6 -6
- package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
- package/dist/_shared/startup-10-0-TDQNBDDL.js +7 -7
- package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +5 -5
- package/dist/_shared/startup-15-1-4S7FLMNG.js +7 -7
- package/dist/_shared/startup-8-0-34CBHPZH.js +421 -84
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/startup-8-1-X32CYSXB.js +77 -13
- package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -1
- package/dist/_shared/storage-command-7MGXLJGZ.js +7 -5
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +11 -0
- package/dist/builtin/intercom/broker/broker.bundle.mjs +205 -82
- package/dist/builtin/intercom/broker/sql-lease-store.ts +38 -27
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +228 -65
- package/dist/builtin/intercom/broker/sql-schema.ts +82 -27
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +2 -2
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +2 -2
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +2 -2
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +2 -2
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/runner-context.js +2 -2
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +3 -3
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +26 -14
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +3 -3
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-open-markers.js +3 -0
- package/dist/core/session-open-markers.js.map +1 -0
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/added-exports.js +3 -0
- package/dist/core/storage/added-exports.js.map +1 -1
- package/dist/core/storage/database.d.ts +37 -0
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/index.d.ts +1 -1
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/migrations.d.ts +12 -3
- package/dist/core/storage/migrations.js +24 -11
- package/dist/core/storage/migrations.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +31 -2
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +86 -2
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/prefix.js +5 -0
- package/dist/core/storage/prefix.js.map +1 -1
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +82 -4
- package/dist/core/storage/schema-catalog.js +242 -32
- package/dist/core/storage/schema-catalog.js.map +1 -1
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +9 -8
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +4 -4
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/errors.js +1 -1
- package/dist/core/storage/session/expanded-child-details.code.js +3 -3
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-detach.d.ts +118 -0
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-schema.js +53 -0
- package/dist/core/storage/session/fork-schema.js.map +1 -0
- package/dist/core/storage/session/fork-segments.d.ts +58 -0
- package/dist/core/storage/session/fork-staging.code.js +3 -3
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-sweep.js +61 -0
- package/dist/core/storage/session/fork-sweep.js.map +1 -0
- package/dist/core/storage/session/fork-window.code.js +4 -4
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.d.ts +37 -1
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +3 -3
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.code.js +1 -1
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +4 -4
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +349 -12
- package/dist/core/storage/session/sql-session-store.impl.js +4 -4
- package/dist/core/storage/session/sql-session-store.js +4 -4
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/session/types.d.ts +22 -0
- package/dist/core/storage/sqlite-facade.d.ts +17 -1
- package/dist/core/storage/sqlite-facade.js +33 -0
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +4 -4
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/history-session.d.ts +2 -0
- package/dist/core/tools/read-url.code.js +2 -2
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.d.ts +31 -0
- package/dist/core/worktree-snapshot/blob-store.js +164 -49
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/errors.code.js +3 -3
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/fork-snapshot-index.js +121 -0
- package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -0
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +2 -2
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +1 -1
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +2 -2
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.js +6 -6
- package/dist/main-first-time-setup.code.js +2 -2
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.code.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/print-mode.js +1 -1
- package/dist/package-manager-cli.code.js +5 -5
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/2.js +1 -0
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +5 -1
- package/dist/startup-stages/8.js +2 -2
- package/dist/utils/startup-database-spare.code.js +3 -3
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/guides/postgres-pgbouncer.md +14 -7
- package/docs/guides/postgres-tuning.md +9 -9
- package/docs/sessions.md +9 -0
- package/docs/storage.md +47 -6
- package/package.json +8 -8
- package/dist/_shared/sdk-AVFII7NK.js.map +0 -1
- package/dist/_shared/settings-startup-4QCVCI53.js.map +0 -1
- package/dist/_shared/startup-0-0-57KF6LZH.js.map +0 -1
- package/dist/_shared/startup-0-1-GIY75K46.js.map +0 -1
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +0 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.js.map +0 -1
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../../../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.2`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.11-alpha.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using /tree.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -390,6 +390,8 @@ export interface SessionOpenMarker {
|
|
|
390
390
|
readonly token: string;
|
|
391
391
|
readonly pid: number;
|
|
392
392
|
readonly host: string;
|
|
393
|
+
/** The Atomic version of the process, which a store may record (#6560). */
|
|
394
|
+
readonly build?: string;
|
|
393
395
|
}
|
|
394
396
|
/** A marker as a store lists it. */
|
|
395
397
|
export interface SessionOpenMarkerAge extends SessionOpenMarker {
|
|
@@ -420,6 +422,14 @@ export interface SessionEntriesQuery {
|
|
|
420
422
|
readonly maxChars?: number;
|
|
421
423
|
readonly largeEntryBytes?: number;
|
|
422
424
|
readonly skipTypes?: readonly string[];
|
|
425
|
+
/**
|
|
426
|
+
* Only these sequences, in ascending order, between `fromSeq` and `toSeq`: a store should return no other entry, so a
|
|
427
|
+
* reader that knows which entries it needs reads them all in one call, not one call each, as `history://` searches
|
|
428
|
+
* do. A store that returns the whole range still answers correctly, reading more. `throughSeq` keeps its meaning. A
|
|
429
|
+
* store may end the page sooner than it would for these entries alone, and should end it before an entry that would
|
|
430
|
+
* take it past `maxChars`, unless that entry comes first.
|
|
431
|
+
*/
|
|
432
|
+
readonly seqs?: readonly number[];
|
|
423
433
|
readonly signal?: AbortSignal;
|
|
424
434
|
}
|
|
425
435
|
export interface SessionEntriesPage {
|
|
@@ -427,6 +437,8 @@ export interface SessionEntriesPage {
|
|
|
427
437
|
readonly entries: readonly SessionEntryAt[];
|
|
428
438
|
readonly throughSeq: number;
|
|
429
439
|
}
|
|
440
|
+
/** `entries` without those `seqs` (`SessionEntriesQuery.seqs`) leaves out: what a store that reads the whole range returns. */
|
|
441
|
+
export declare function onlySeqs<T extends SessionEntryAt>(entries: readonly T[], seqs: readonly number[] | undefined): readonly T[];
|
|
430
442
|
export interface SessionSearchText {
|
|
431
443
|
readonly seq: number;
|
|
432
444
|
readonly text?: string;
|
|
@@ -511,6 +523,16 @@ export interface SessionForkRow {
|
|
|
511
523
|
export interface SessionForkStream {
|
|
512
524
|
/** A whole saved session in append order, with sibling branches and labels unchanged. */
|
|
513
525
|
readonly kind?: "complete-session";
|
|
526
|
+
/**
|
|
527
|
+
* Set when the stream yields exactly the stored rows of session `sessionId`, generation `epoch`, from seq 1 through
|
|
528
|
+
* `through`, each unchanged: a store that shares the session's history may record the child as that prefix of it
|
|
529
|
+
* without reading a row (#6560).
|
|
530
|
+
*/
|
|
531
|
+
readonly prefix?: {
|
|
532
|
+
readonly sessionId: string;
|
|
533
|
+
readonly epoch: string | undefined;
|
|
534
|
+
readonly through: number;
|
|
535
|
+
};
|
|
514
536
|
/** The reader is bound to the writing transaction when both sides use the same SQL connection. */
|
|
515
537
|
read(reader: SessionStore, hasWritten: (id: string) => Promise<boolean>, inlineSnapshot?: (ref: OversizedSessionEntry) => Promise<SessionEntry | undefined>): AsyncIterable<SessionForkRow>;
|
|
516
538
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SqliteBatchOptions, SqliteDatabase, SqliteStatement, SqliteValue, StorageDescriptor, StorageNotifications, TransactionConcurrency } from "./database.js";
|
|
1
|
+
import type { SqliteBatchOptions, SqliteDatabase, SqliteStatement, SqliteValue, StorageDescriptor, StorageNotifications, StorageOpenedCatalog, TransactionConcurrency } from "./database.js";
|
|
2
2
|
import { type StorageDialect } from "./dialect.js";
|
|
3
3
|
import { type StorageFailureCause, type StoragePayloadLimits, type StorageTransientErrorCode, type StorageTransientHop, type StorageTransientOutcome } from "./errors.js";
|
|
4
4
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -52,6 +52,17 @@ export interface SqliteDriverTransactionOptions {
|
|
|
52
52
|
* order, from what it got. A call that differs from the next of them ends the lead.
|
|
53
53
|
*/
|
|
54
54
|
readonly leading?: readonly SqliteStatement[];
|
|
55
|
+
/**
|
|
56
|
+
* Optional. `SqliteTransactionOptions.leadingOnly`, set only with every statement of `leading`: a driver with
|
|
57
|
+
* `pipelinedTransactions` may send the commit right behind them, and then fails any other call without sending it.
|
|
58
|
+
*/
|
|
59
|
+
readonly leadingOnly?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Optional. `SqliteTransactionOptions.lockIfLeadingFinds`, set only with `leading` whose first statement is the
|
|
62
|
+
* transaction's: a driver with `pipelinedTransactions` may take a `serial` domain's locks in that statement, for the
|
|
63
|
+
* row it returns, instead of with the begin.
|
|
64
|
+
*/
|
|
65
|
+
readonly lockIfLeadingFinds?: boolean;
|
|
55
66
|
}
|
|
56
67
|
/** The driver calls `createSqliteDatabase` turns into a `SqliteDatabase`. */
|
|
57
68
|
export interface SqliteDriver extends SqliteDriverExecutor {
|
|
@@ -140,6 +151,11 @@ export interface SqliteDriver extends SqliteDriverExecutor {
|
|
|
140
151
|
* the very tables the other's do. Undefined where that cannot be told, as for a database in memory.
|
|
141
152
|
*/
|
|
142
153
|
databaseIdentity?(): string | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Optional. The schema the driver read in its open's own round trip, given once; the facade exposes it as
|
|
156
|
+
* `SqliteDatabase.takeOpenedCatalog`, so the first store open does not read it again (#6560).
|
|
157
|
+
*/
|
|
158
|
+
takeOpenedCatalog?(): StorageOpenedCatalog | undefined;
|
|
143
159
|
}
|
|
144
160
|
/**
|
|
145
161
|
* How many times the facade runs a call that a transient failure ended before it wrote anything, the first run
|
|
@@ -578,6 +578,8 @@ class DriverDatabase {
|
|
|
578
578
|
freeBytes;
|
|
579
579
|
databaseIdentity;
|
|
580
580
|
openReader;
|
|
581
|
+
takeOpenedCatalog;
|
|
582
|
+
autocommit;
|
|
581
583
|
/** Readers this database opened and that are not closed; closing closes them. */
|
|
582
584
|
readers = new Set();
|
|
583
585
|
closed;
|
|
@@ -595,6 +597,9 @@ class DriverDatabase {
|
|
|
595
597
|
const databaseIdentity = driver.databaseIdentity?.bind(driver);
|
|
596
598
|
if (databaseIdentity)
|
|
597
599
|
this.databaseIdentity = databaseIdentity;
|
|
600
|
+
const takeOpenedCatalog = driver.takeOpenedCatalog?.bind(driver);
|
|
601
|
+
if (takeOpenedCatalog)
|
|
602
|
+
this.takeOpenedCatalog = takeOpenedCatalog;
|
|
598
603
|
this.redact = redact;
|
|
599
604
|
this.descriptor = { adapter: driver.descriptor.adapter, location: redact(driver.descriptor.location) };
|
|
600
605
|
const stalled = (ranMs) => new StorageUnavailableError(this.descriptor, undefined, `the call was queued behind an earlier call that ran ${Math.round(ranMs / 1000)} seconds without settling, and did not run; nothing was written, retry it`);
|
|
@@ -616,6 +621,28 @@ class DriverDatabase {
|
|
|
616
621
|
const batch = driver.batch?.bind(driver);
|
|
617
622
|
if (batch)
|
|
618
623
|
this.batch = (statements, options) => this.runBatch(batch, statements, options);
|
|
624
|
+
if (driver.concurrentTransactions === true)
|
|
625
|
+
this.autocommit = (statement, concurrency) => this.runAutocommit(statement, concurrency);
|
|
626
|
+
}
|
|
627
|
+
/** `autocommit`: the statement on its own, through the driver's `execute`, in the queue scope of `concurrency`. */
|
|
628
|
+
runAutocommit(statement, concurrency) {
|
|
629
|
+
if (this.closePromise)
|
|
630
|
+
return Promise.reject(new StoreClosedError(this.descriptor));
|
|
631
|
+
let scope;
|
|
632
|
+
try {
|
|
633
|
+
scope = transactionScope(transactionConcurrency({ concurrency }), false, true);
|
|
634
|
+
}
|
|
635
|
+
catch (error) {
|
|
636
|
+
return Promise.reject(error);
|
|
637
|
+
}
|
|
638
|
+
const bound = snapshotParams(statement.params);
|
|
639
|
+
return this.queue.push(() => this.retrying(async (attempt) => {
|
|
640
|
+
const invalidIndex = bound.findIndex((value) => typeof value === "string" && value.includes("\0"));
|
|
641
|
+
if (invalidIndex !== -1)
|
|
642
|
+
throw new StorageInvalidTextError(invalidIndex);
|
|
643
|
+
const result = await this.call(() => this.driver.execute(statement.sql, bound), attempt, true, bound);
|
|
644
|
+
return result.rows.map((row) => normalizeRow(row, result.columns));
|
|
645
|
+
}, true), false, scope);
|
|
619
646
|
}
|
|
620
647
|
runBatch(batch, statements, options) {
|
|
621
648
|
if (this.closePromise)
|
|
@@ -797,6 +824,12 @@ class DriverDatabase {
|
|
|
797
824
|
...(options?.lockWaitMs === undefined ? {} : { lockWaitMs: options.lockWaitMs }),
|
|
798
825
|
...(options?.readOnly === true ? { readOnly: true } : {}),
|
|
799
826
|
...(leading.length === 0 ? {} : { leading }),
|
|
827
|
+
// Only when the callback makes nothing but calls that went with the start: a statement the facade held back is one.
|
|
828
|
+
...(options?.leadingOnly === true && leading.length > 0 && leading.length === options.leading?.length
|
|
829
|
+
? { leadingOnly: true }
|
|
830
|
+
: {}),
|
|
831
|
+
// `leading` holds the first statement whenever it holds any.
|
|
832
|
+
...(options?.lockIfLeadingFinds === true && leading.length > 0 ? { lockIfLeadingFinds: true } : {}),
|
|
800
833
|
};
|
|
801
834
|
const run = () => this.retrying((attempt) => this.runTransaction(callback, attempt, begin), replay);
|
|
802
835
|
const concurrentWrites = this.driver.concurrentTransactions === true;
|