@dialecte/core 0.8.1 → 0.10.0
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/dist/assets/hub.worker-35vzG0HK.js +2 -0
- package/dist/dialecte/create-dialecte-project.d.ts +1 -2
- package/dist/dialecte/create-dialecte-project.d.ts.map +1 -1
- package/dist/dialecte/create-project-factory.d.ts +5 -5
- package/dist/dialecte/create-project-factory.d.ts.map +1 -1
- package/dist/dialecte/define-dialecte.d.ts +2 -2
- package/dist/dialecte/dialecte.types.d.ts +11 -23
- package/dist/dialecte/dialecte.types.d.ts.map +1 -1
- package/dist/{dialecte-gIPrRzni.js → dialecte-CVLWSkgW.js} +1726 -1673
- package/dist/document/document.d.ts +1 -1
- package/dist/document/query/get/record/get-record.d.ts +14 -1
- package/dist/document/query/get/record/get-record.d.ts.map +1 -1
- package/dist/document/query/get/record/get-records.d.ts +12 -2
- package/dist/document/query/get/record/get-records.d.ts.map +1 -1
- package/dist/{engine-store-CIEqgPUb.js → engine-store-Deo9XNhr.js} +21 -21
- package/dist/engine.constants-Bi4gw6BR.js +205 -0
- package/dist/errors/{codes.d.ts → codes.constants.d.ts} +33 -105
- package/dist/errors/{codes.d.ts.map → codes.constants.d.ts.map} +1 -1
- package/dist/errors/core-codes.constants.d.ts +3 -0
- package/dist/errors/core-codes.constants.d.ts.map +1 -0
- package/dist/errors/errors.constants.d.ts +5 -0
- package/dist/errors/errors.constants.d.ts.map +1 -1
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/types.d.ts +1 -1
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/{helpers-DVShv41E.js → helpers-D8p0KiJu.js} +1 -1
- package/dist/helpers.js +2 -2
- package/dist/{in-process-link-DBeAOZRp.js → in-process-link-B-TCHrlb.js} +996 -993
- package/dist/index.js +8 -7
- package/dist/project/index.d.ts +1 -1
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/io/store-runtime.types.d.ts +1 -3
- package/dist/project/io/store-runtime.types.d.ts.map +1 -1
- package/dist/project/project.d.ts +13 -15
- package/dist/project/project.d.ts.map +1 -1
- package/dist/project/types.d.ts +24 -19
- package/dist/project/types.d.ts.map +1 -1
- package/dist/{project-key-Ch34EtFa.js → project-key-2ccZ-0gu.js} +195 -205
- package/dist/running-operations-DCKvzlU7.js +107 -0
- package/dist/{same-json-value-C6kUaoyt.js → same-json-value-_AChwM_n.js} +41 -41
- package/dist/sqlite-engine.d.ts +7 -0
- package/dist/sqlite-engine.d.ts.map +1 -0
- package/dist/{engine.js → sqlite-engine.js} +4144 -4079
- package/dist/sqlite.d.ts +27 -2
- package/dist/sqlite.d.ts.map +1 -1
- package/dist/sqlite.js +1118 -917
- package/dist/store/in-memory/in-memory-state.constants.d.ts +14 -0
- package/dist/store/in-memory/in-memory-state.constants.d.ts.map +1 -0
- package/dist/store/in-memory/in-memory-state.d.ts +0 -4
- package/dist/store/in-memory/in-memory-state.d.ts.map +1 -1
- package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
- package/dist/store/in-memory/types.d.ts +1 -2
- package/dist/store/in-memory/types.d.ts.map +1 -1
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/lost-write.d.ts +8 -8
- package/dist/store/lost-write.d.ts.map +1 -1
- package/dist/store/lost-write.types.d.ts +1 -1
- package/dist/store/lost-write.types.d.ts.map +1 -1
- package/dist/store/{engine/project-key.d.ts → project-key.d.ts} +0 -5
- package/dist/store/project-key.d.ts.map +1 -0
- package/dist/store/resolve-store.d.ts +6 -18
- package/dist/store/resolve-store.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/in-process-link.constants.d.ts +12 -0
- package/dist/store/sqlite/adapter/in-process-link.constants.d.ts.map +1 -0
- package/dist/store/sqlite/adapter/in-process-link.d.ts +1 -1
- package/dist/store/sqlite/adapter/in-process-link.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/sqlite-connector.d.ts +12 -11
- package/dist/store/sqlite/adapter/sqlite-connector.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/sqlite-connector.types.d.ts +7 -0
- package/dist/store/sqlite/adapter/sqlite-connector.types.d.ts.map +1 -0
- package/dist/store/sqlite/adapter/sqlite-hub-spawner.d.ts +8 -3
- package/dist/store/sqlite/adapter/sqlite-hub-spawner.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/sqlite-hub-spawner.types.d.ts +12 -1
- package/dist/store/sqlite/adapter/sqlite-hub-spawner.types.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/sqlite-worker-connector.d.ts +2 -2
- package/dist/store/sqlite/adapter/sqlite-worker-connector.d.ts.map +1 -1
- package/dist/store/sqlite/adapter/sqlite-worker-connector.types.d.ts +1 -1
- package/dist/store/sqlite/adapter/sqlite-worker-connector.types.d.ts.map +1 -1
- package/dist/store/sqlite/engine/engine.types.d.ts +2 -2
- package/dist/store/sqlite/engine/engine.types.d.ts.map +1 -1
- package/dist/store/sqlite/engine/schema.d.ts.map +1 -1
- package/dist/store/sqlite/engine/sqlite-engine.d.ts.map +1 -1
- package/dist/store/{hub-public.d.ts → sqlite/hub-public.d.ts} +9 -9
- package/dist/store/sqlite/hub-public.d.ts.map +1 -0
- package/dist/store/sqlite/packaging/engine-packaging.constants.d.ts +15 -0
- package/dist/store/sqlite/packaging/engine-packaging.constants.d.ts.map +1 -0
- package/dist/store/sqlite/runtime/close-engine.d.ts +5 -2
- package/dist/store/sqlite/runtime/close-engine.d.ts.map +1 -1
- package/dist/store/sqlite/runtime/engine-control-loop.d.ts +11 -0
- package/dist/store/sqlite/runtime/engine-control-loop.d.ts.map +1 -0
- package/dist/store/sqlite/runtime/install-pool.d.ts +1 -1
- package/dist/store/sqlite/runtime/install-pool.d.ts.map +1 -1
- package/dist/store/sqlite/runtime/progress-beat.d.ts +1 -1
- package/dist/store/sqlite/runtime/progress-beat.d.ts.map +1 -1
- package/dist/store/sqlite/runtime/runtime.types.d.ts +7 -4
- package/dist/store/sqlite/runtime/runtime.types.d.ts.map +1 -1
- package/dist/store/sqlite/runtime/serve-sqlite-engine.d.ts +9 -0
- package/dist/store/sqlite/runtime/serve-sqlite-engine.d.ts.map +1 -0
- package/dist/store/sqlite/runtime/serve-sqlite-engine.types.d.ts +27 -0
- package/dist/store/sqlite/runtime/serve-sqlite-engine.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/client/check-engine-wire.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/client/client.constants.d.ts +3 -3
- package/dist/store/sqlite/served/client/client.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/client/client.types.d.ts +13 -8
- package/dist/store/sqlite/served/client/client.types.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/client/engine-client.d.ts +1 -1
- package/dist/store/sqlite/served/client/engine-client.d.ts.map +1 -0
- package/dist/store/sqlite/served/client/engine-control.d.ts.map +1 -0
- package/dist/store/sqlite/served/client/heartbeat-watch.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/client/hub-connector.d.ts +1 -1
- package/dist/store/sqlite/served/client/hub-connector.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/client/hub-connector.types.d.ts +6 -7
- package/dist/store/sqlite/served/client/hub-connector.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/client/worker-connector.d.ts.map +1 -0
- package/dist/store/sqlite/served/creation-refusal.d.ts.map +1 -0
- package/dist/store/sqlite/served/dialecte-refusal.d.ts +19 -0
- package/dist/store/sqlite/served/dialecte-refusal.d.ts.map +1 -0
- package/dist/store/sqlite/served/engine-lock.d.ts +6 -0
- package/dist/store/sqlite/served/engine-lock.d.ts.map +1 -0
- package/dist/store/sqlite/served/engine-store.constants.d.ts +3 -0
- package/dist/store/sqlite/served/engine-store.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/engine-store.d.ts +6 -6
- package/dist/store/sqlite/served/engine-store.d.ts.map +1 -0
- package/dist/store/sqlite/served/engine-store.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/engine.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/engine.types.d.ts +2 -4
- package/dist/store/sqlite/served/engine.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/host/changed.d.ts +5 -0
- package/dist/store/sqlite/served/host/changed.d.ts.map +1 -0
- package/dist/store/sqlite/served/host/engine-wire.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/host/heartbeat.d.ts +1 -1
- package/dist/store/sqlite/served/host/heartbeat.d.ts.map +1 -0
- package/dist/store/sqlite/served/host/host.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/host/host.types.d.ts +4 -3
- package/dist/store/sqlite/served/host/host.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/host/store-events.constants.d.ts +9 -0
- package/dist/store/sqlite/served/host/store-events.constants.d.ts.map +1 -0
- package/dist/store/sqlite/served/host/store-events.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-client.constants.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-client.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/hub/hub-client.types.d.ts +2 -9
- package/dist/store/sqlite/served/hub/hub-client.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-protocol.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-router.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-shell.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub-shell.types.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/hub/hub.constants.d.ts +3 -3
- package/dist/store/sqlite/served/hub/hub.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/hub/hub.types.d.ts +2 -2
- package/dist/store/sqlite/served/hub/hub.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/hub.worker.d.ts.map +1 -0
- package/dist/store/sqlite/served/hub/realm-host.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/hub/realm-host.types.d.ts +3 -3
- package/dist/store/sqlite/served/hub/realm-host.types.d.ts.map +1 -0
- package/dist/store/sqlite/served/wire/error-envelope.d.ts.map +1 -0
- package/dist/store/sqlite/served/wire/wire-values.d.ts.map +1 -0
- package/dist/store/sqlite/served/wire/wire.constants.d.ts.map +1 -0
- package/dist/store/{engine → sqlite/served}/wire/wire.types.d.ts +1 -1
- package/dist/store/sqlite/served/wire/wire.types.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-connector-params.d.ts +13 -0
- package/dist/store/sqlite/sqlite-connector-params.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-engine-registration.d.ts +30 -0
- package/dist/store/sqlite/sqlite-engine-registration.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-error-entry.d.ts +10 -0
- package/dist/store/sqlite/sqlite-error-entry.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-errors.constants.d.ts +110 -0
- package/dist/store/sqlite/sqlite-errors.constants.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-errors.types.d.ts +7 -0
- package/dist/store/sqlite/sqlite-errors.types.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-storage-kind.constants.d.ts +10 -0
- package/dist/store/sqlite/sqlite-storage-kind.constants.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-storage-kind.d.ts +3 -0
- package/dist/store/sqlite/sqlite-storage-kind.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-storage.constants.d.ts +24 -0
- package/dist/store/sqlite/sqlite-storage.constants.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-storage.types.d.ts +27 -0
- package/dist/store/sqlite/sqlite-storage.types.d.ts.map +1 -0
- package/dist/store/sqlite/sqlite-store-of.d.ts +8 -3
- package/dist/store/sqlite/sqlite-store-of.d.ts.map +1 -1
- package/dist/store/storage-kinds.constants.d.ts +16 -0
- package/dist/store/storage-kinds.constants.d.ts.map +1 -0
- package/dist/store/storage-kinds.d.ts +43 -0
- package/dist/store/storage-kinds.d.ts.map +1 -0
- package/dist/store/storage-kinds.types.d.ts +46 -0
- package/dist/store/storage-kinds.types.d.ts.map +1 -0
- package/dist/store/store.types.d.ts +6 -4
- package/dist/store/store.types.d.ts.map +1 -1
- package/dist/test/assert-xml/assert-xml.d.ts +4 -2
- package/dist/test/assert-xml/assert-xml.d.ts.map +1 -1
- package/dist/test/assert-xml/index.d.ts +1 -0
- package/dist/test/assert-xml/index.d.ts.map +1 -1
- package/dist/test/assert-xml/xml-assertion-error.d.ts +8 -0
- package/dist/test/assert-xml/xml-assertion-error.d.ts.map +1 -0
- package/dist/test/create-test-dialecte.constants.d.ts +4 -0
- package/dist/test/create-test-dialecte.constants.d.ts.map +1 -0
- package/dist/test/create-test-dialecte.d.ts.map +1 -1
- package/dist/test/indexeddb-storage.setup.d.ts +1 -0
- package/dist/test/indexeddb-storage.setup.d.ts.map +1 -0
- package/dist/test/test-storage/index.d.ts +1 -1
- package/dist/test/test-storage/index.d.ts.map +1 -1
- package/dist/test/test-storage/sqlite-test-store.d.ts +15 -0
- package/dist/test/test-storage/sqlite-test-store.d.ts.map +1 -0
- package/dist/test/test-storage/test-storage.types.d.ts +12 -0
- package/dist/test/test-storage/test-storage.types.d.ts.map +1 -1
- package/dist/test/test-storage/test-store-for.d.ts +18 -6
- package/dist/test/test-storage/test-store-for.d.ts.map +1 -1
- package/dist/test/test-storage/test-store-providers.constants.d.ts +8 -0
- package/dist/test/test-storage/test-store-providers.constants.d.ts.map +1 -0
- package/dist/test/test-storage/test-store-providers.d.ts +11 -0
- package/dist/test/test-storage/test-store-providers.d.ts.map +1 -0
- package/dist/test.js +805 -765
- package/dist/{utils-USNkj4sT.js → utils-Cv4oHia0.js} +63 -137
- package/dist/utils.js +1 -1
- package/package.json +40 -8
- package/skills/dialecte/SKILL.md +8 -6
- package/skills/dialecte/references/api.json +93 -66
- package/skills/dialecte/references/api.md +463 -461
- package/skills/dialecte/references/core-api.md +42 -15
- package/skills/dialecte/references/testing.md +167 -11
- package/skills/dialecte-contributing/SKILL.md +1 -1
- package/skills/dialecte-contributing/references/code-rules.md +7 -0
- package/skills/dialecte-contributing/references/landing-changes.md +4 -4
- package/skills/dialecte-lot/SKILL.md +67 -28
- package/skills/dialecte-lot/references/briefs.md +30 -6
- package/skills/dialecte-lot/references/standard-check.md +2 -2
- package/skills/dialecte-lot/references/stations.md +5 -3
- package/dist/assets/hub.worker-B1HcVDhn.js +0 -2
- package/dist/engine.constants-DBMjMmV9.js +0 -98
- package/dist/engine.d.ts +0 -9
- package/dist/engine.d.ts.map +0 -1
- package/dist/running-operations-vnijBvn7.js +0 -76
- package/dist/store/engine/client/check-engine-wire.d.ts.map +0 -1
- package/dist/store/engine/client/client.constants.d.ts.map +0 -1
- package/dist/store/engine/client/client.types.d.ts.map +0 -1
- package/dist/store/engine/client/engine-client.d.ts.map +0 -1
- package/dist/store/engine/client/engine-control.d.ts.map +0 -1
- package/dist/store/engine/client/heartbeat-watch.d.ts.map +0 -1
- package/dist/store/engine/client/hub-connector.d.ts.map +0 -1
- package/dist/store/engine/client/hub-connector.types.d.ts.map +0 -1
- package/dist/store/engine/client/worker-connector.d.ts.map +0 -1
- package/dist/store/engine/creation-refusal.d.ts.map +0 -1
- package/dist/store/engine/dialecte-refusal.d.ts +0 -18
- package/dist/store/engine/dialecte-refusal.d.ts.map +0 -1
- package/dist/store/engine/engine-store.d.ts.map +0 -1
- package/dist/store/engine/engine-store.types.d.ts.map +0 -1
- package/dist/store/engine/engine.constants.d.ts.map +0 -1
- package/dist/store/engine/engine.types.d.ts.map +0 -1
- package/dist/store/engine/host/engine-wire.d.ts.map +0 -1
- package/dist/store/engine/host/heartbeat.d.ts.map +0 -1
- package/dist/store/engine/host/host.constants.d.ts.map +0 -1
- package/dist/store/engine/host/host.types.d.ts.map +0 -1
- package/dist/store/engine/host/store-events.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-client.constants.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-client.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-client.types.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-protocol.types.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-router.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-shell.d.ts.map +0 -1
- package/dist/store/engine/hub/hub-shell.types.d.ts.map +0 -1
- package/dist/store/engine/hub/hub.constants.d.ts.map +0 -1
- package/dist/store/engine/hub/hub.types.d.ts.map +0 -1
- package/dist/store/engine/hub/hub.worker.d.ts.map +0 -1
- package/dist/store/engine/hub/realm-host.d.ts.map +0 -1
- package/dist/store/engine/hub/realm-host.types.d.ts.map +0 -1
- package/dist/store/engine/project-key.d.ts.map +0 -1
- package/dist/store/engine/wire/error-envelope.d.ts.map +0 -1
- package/dist/store/engine/wire/wire-values.d.ts.map +0 -1
- package/dist/store/engine/wire/wire.constants.d.ts.map +0 -1
- package/dist/store/engine/wire/wire.types.d.ts.map +0 -1
- package/dist/store/hub-public.d.ts.map +0 -1
- package/dist/store/sqlite/runtime/serve-dialecte-engine.d.ts +0 -16
- package/dist/store/sqlite/runtime/serve-dialecte-engine.d.ts.map +0 -1
- package/dist/store/sqlite-storage.constants.d.ts +0 -14
- package/dist/store/sqlite-storage.constants.d.ts.map +0 -1
- package/dist/store/sqlite-storage.d.ts +0 -22
- package/dist/store/sqlite-storage.d.ts.map +0 -1
- package/dist/store/sqlite-storage.types.d.ts +0 -24
- package/dist/store/sqlite-storage.types.d.ts.map +0 -1
- package/dist/test/test-dialecte.worker.d.ts +0 -2
- package/dist/test/test-dialecte.worker.d.ts.map +0 -1
- /package/dist/store/{engine → sqlite/served}/client/check-engine-wire.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/client/engine-control.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/client/heartbeat-watch.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/client/worker-connector.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/creation-refusal.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/engine-store.types.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/engine.constants.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/host/engine-wire.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/host/host.constants.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/host/store-events.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-client.constants.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-client.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-protocol.types.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-router.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-shell.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub-shell.types.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/hub.worker.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/hub/realm-host.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/wire/error-envelope.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/wire/wire-values.d.ts +0 -0
- /package/dist/store/{engine → sqlite/served}/wire/wire.constants.d.ts +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){let e=`https://dialecte.github.io/core`,t=/* @__PURE__ */ new Set([`throwDialecteError`,`createDialecteError`,`invariant`,`reportFailure`]),n={UNKNOWN:{code:`D0001`,message:`An unknown error occurred`,explanation:{when:"A transaction's callback threw something that is not a structured error (a plain `Error`, a value); the original is its `cause`.",fix:"Read `cause` and `detail`; raise your own failures with `throwDialecteError` or `invariant` so callers get a key.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},ASSERTION_FAILED:{code:`D0002`,message:`Assertion failed`,explanation:{when:"An `invariant` without its own key failed, or core met a state it never expects (a catalogue built wrong, an inconsistent export, a store running on a dependency older than the one it supports).",fix:"Read `detail`: it names the condition. Give `invariant` a key of its own when the failure is one a caller should handle.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},STORE_CONNECTION_FAILED:{code:`D1001`,message:`Failed to open database`,explanation:{when:"The store could not open the project's data, or could not reach what serves it (its database, a worker, a server): it failed to start, was blocked, or went unanswered; the failure is the `cause` when there is one.",fix:`Check the browser supports what the store needs and that no other tab holds the project; reload, or open the project with another storage. The store's own docs name what it needs.`,docs:`${e}/api/project#store-errors`}},STORE_COMMIT_FAILED:{code:`D1002`,message:`Failed to commit changes`,explanation:{when:"The database refused a transaction's write as it committed (the failure is the `cause`).",fix:"Read `cause`; a full disk or a lost connection are the usual reasons. Retry the transaction once the store is back.",docs:`${e}/api/project#store-errors`}},STORE_RECORD_NOT_FOUND:{code:`D1003`,message:`Record not found in database`,explanation:{when:`A write updated or deleted a record the store does not hold in that document.`,fix:`Read the record again before writing: it was deleted, or the ref names another document.`,docs:`${e}/api/project#store-errors`}},STORE_BULK_ADD_FAILED:{code:`D1004`,message:`Failed to add records to database`,explanation:{when:"The database refused to add a batch of records (import, commit); the failure is the `cause`.",fix:"Read `cause`; a full disk or a closed store are the usual reasons.",docs:`${e}/api/project#store-errors`}},STORE_BULK_UPDATE_FAILED:{code:`D1005`,message:`Failed to update records in database`,explanation:{when:"The database refused to update a batch of records; the failure is the `cause`.",fix:"Read `cause`; a full disk or a closed store are the usual reasons.",docs:`${e}/api/project#store-errors`}},STORE_DELETE_FAILED:{code:`D1006`,message:`Failed to delete records from database`,explanation:{when:"The database refused to delete records; the failure is the `cause`.",fix:"Read `cause`; a closed store is the usual reason.",docs:`${e}/api/project#store-errors`}},STORE_NOT_WRITABLE:{code:`D1007`,message:`Store is not writable`,explanation:{when:`A write reached an in-memory store created read-only.`,fix:"Create the project with `storage: { type: 'inMemory', writable: true }` when the script writes.",docs:`${e}/api/project#in-memory-storage`}},STORE_BLOB_NOT_FOUND:{code:`D1008`,message:`Blob not found`,explanation:{when:`A blob operation named a blob id the store does not hold.`,fix:"List the blobs (`project.getBlobsByDocument`) and use an id from there.",docs:`${e}/api/project#blobs`}},STORE_DUPLICATE_ID:{code:`D1009`,message:`An id is already taken in the store`,explanation:{when:"A write would create a record (or register a document) with an id the store already holds; `meta.recordIds` lists them.",fix:"Let core mint ids (omit `id`), or pick ids no record of the document has; `deepClone` mints new ids itself.",docs:`${e}/api/project#store-errors`}},STORE_CLOSED:{code:`D1010`,message:`Store is closed`,explanation:{when:"A store operation was still in flight when its store closed, or code holding the store itself (a custom store, a test context) called it after its `close()`. A project closed with `project.close()` answers `PROJECT_NOT_OPENED` instead.",fix:`Await every operation before closing the store or the project; open it again before using it.`,docs:`${e}/api/project#lifecycle`}},STORE_READ_FAILED:{code:`D1011`,message:`Failed to read from database`,explanation:{when:"The store's database failed under a read; the failure is the `cause`.",fix:"Read `cause`; reopen the project. A lasting failure means the file is damaged: import its documents again.",docs:`${e}/api/project#store-errors`}},STORE_VALUE_NOT_JSON:{code:`D1015`,message:`A value handed to the store is not JSON`,explanation:{when:`A write handed the store a value that is not plain JSON (a function, a Map, undefined, a class instance) in a record or in document metadata.`,fix:"Pass plain strings, numbers, booleans, arrays and objects; `detail` names the value and the field.",docs:`${e}/io/#values-a-store-keeps`}},STORE_UNAVAILABLE:{code:`D1016`,message:`This browser gives the page no storage for a project`,explanation:{when:`The browser gives the page none of the storage the store needs (a private window, an API the browser lacks), so it cannot create, open or destroy the project; nothing is changed.`,fix:`Open the app in a normal (not private) window of a browser that supports what the project's store needs, or open the project with another storage.`,docs:`${e}/api/project#store-errors`}},STORE_QUOTA_EXCEEDED:{code:`D1017`,message:`Not enough storage left for the project`,explanation:{when:"The origin has too little storage left for what the call needs (a new project's files, an import's room ahead of it), or the store's storage refused a write for want of space; nothing of the call applied. A store that checks the room it needs answers it; the local (IndexedDB) store answers the failing write's own error (`STORE_COMMIT_FAILED`, `STORE_BULK_ADD_FAILED`, `STORE_BULK_UPDATE_FAILED`; an import `IMPORT_FAILED`); the in-memory store has no limit.",fix:"Free storage for the origin (delete projects no longer needed) or import a smaller file, then try again; `meta.needed` and `meta.available` give the sizes when known.",docs:`${e}/api/project#store-errors`}},STORE_CONNECTION_LOST:{code:`D1018`,message:`The store lost its connection`,explanation:{when:"A call to a store whose project is served elsewhere (a worker, another realm, a server) lost its connection to what serves it: that went away or gave no answer within its budget, sent nothing for too long while the call waited (the call may still finish), or dropped this view. `meta.reason` is the store's own word for why, listed in its docs; a write's refusal carries `meta.writeId`.",fix:"A Document's commit and a Project's import ask the outcome themselves, once: a commit that landed resolves; otherwise the refusal says `meta.outcome` - `not-applied` (make it again if wanted), `running` (what serves the store may still apply it: tell the user, read again later), `unknown` (it could not be asked), or `applied` for an import (its document is in the project; its diagnostics were lost). Elsewhere ask `getWriteOutcome({ writeId })` with `meta.writeId` before writing again; never retry a write blindly. The store's docs say what each `meta.reason` asks of the app.",docs:`${e}/api/project#a-lost-connection`}},STORE_KIND_TAKEN:{code:`D1021`,message:`This storage type is registered already by another kind`,explanation:{when:"`registerStorageKind({ type, kind })` named a type a kind of another `id` holds already: the first registration in the realm is kept, nothing replaced (the same `id` again does nothing: a module evaluated twice, or another copy of the package). `meta`: `type`, `registered` (the id kept), `asked` (the id refused).",fix:`Register each storage type once, from one package: import the entry that registers it from a single copy, or give the other kind a type of its own.`,docs:`${e}/guide/development/implementing-a-store#register-a-storage-kind`}},ELEMENT_NOT_FOUND:{code:`D2001`,message:`Element not found`,explanation:{when:`A ref names an element the document does not hold (deleted, never created, or from another document).`,fix:"Read the ref from a query in the same document (`getRecord`, `findDescendants`) instead of keeping an old one.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},ROOT_NOT_FOUND:{code:`D2002`,message:`Root element not found`,explanation:{when:`The document holds no root element of the dialecte's root tag (an empty or foreign document).`,fix:"Import a file whose root is the dialecte's root element, or create the document with `project.initEmptyDocument`.",docs:`${e}/api/project#initemptydocument`}},DUPLICATE_ID:{code:`D2003`,message:`Duplicate element ID`,explanation:{when:`Not raised by core itself: a dialecte or app code raises it when two elements carry the same id.`,fix:`Give each element its own id; let core mint them.`,docs:`${e}/guide/development/state-and-errors#error-catalog`}},ELEMENT_TAGNAME_MISMATCH:{code:`D2004`,message:`Element tagName does not match the expected type`,explanation:{when:"A ref's `tagName` is not the tag of the record its id names.",fix:"Build refs with `toRef(record)` from a record you read, never by hand with a guessed tag.",docs:`${e}/api/transaction#reforrecord`}},INVALID_PARENT_CHILD:{code:`D3001`,message:`Invalid parent-child relationship`,explanation:{when:`Not raised by core itself: a dialecte or app code raises it when an element is placed under a parent the schema does not admit.`,fix:"Read the parent's children in the definition (`query.getDefinition`) and add the element under an admitted parent.",docs:`${e}/api/transaction#addchild`}},INVALID_ATTRIBUTE:{code:`D3002`,message:`Invalid attribute for element`,explanation:{when:`Not raised by core itself: a dialecte or app code raises it for an attribute the element does not declare.`,fix:`Use an attribute the element's definition lists.`,docs:`${e}/guide/development/state-and-errors#error-catalog`}},PROTECTED_ROOT:{code:`D3003`,message:`Root element cannot be deleted`,explanation:{when:`A transaction tried to delete the document's root element.`,fix:"Delete the root's children instead, or remove the whole document with `project.removeDocument`.",docs:`${e}/api/transaction#delete`}},REQUIRED_ATTRIBUTE_MISSING:{code:`D3004`,message:`Required attribute is missing`,explanation:{when:`Not raised by core itself: a dialecte or app code raises it when a required attribute is absent.`,fix:`Give the attribute a value when creating the element.`,docs:`${e}/guide/development/state-and-errors#error-catalog`}},UNIQUE_CONSTRAINT_VIOLATION:{code:`D3005`,message:`Value is already used within its scope`,explanation:{when:`Not raised by core itself: a dialecte raises it when a value is already used within the scope where it must be unique.`,fix:`Pick another value, or let the dialecte's hook name the element.`,docs:`${e}/guide/development/state-and-errors#error-catalog`}},UNKNOWN_NAMESPACE_PREFIX:{code:`D3006`,message:`Unknown namespace prefix on attribute — pass it explicitly as { name, namespace: { prefix, uri } }`,explanation:{when:`An attribute was written with a namespace key or prefix the dialecte does not declare.`,fix:"Use a namespace key of the dialecte's config, or pass the namespace in full: `{ name, namespace: { prefix, uri } }`.",docs:`${e}/api/transaction#addchild`}},PREFIXED_ATTRIBUTE_NAME:{code:`D3007`,message:`Authored attribute name must be a local name — pass the namespace separately as { name, namespace }, not a prefixed name`,explanation:{when:"An attribute was written with a prefixed name (`ext:attr`) on create or update.",fix:"Pass the local name and the namespace apart: `{ name: 'attr', namespace }`.",docs:`${e}/api/transaction#addchild`}},FIXED_VALUE_VIOLATION:{code:`D3008`,message:`Attribute value differs from the schema-fixed value`,explanation:{when:`A write gave an attribute another value than the one the schema fixes.`,fix:"Leave the attribute out (core writes the fixed value) or give exactly the fixed value; `getAttributeRules` reads it.",docs:`${e}/api/transaction#addchild`}},XSI_TYPE_REQUIRED:{code:`D3009`,message:`The element is declared with an abstract type: name a type with xsi:type`,explanation:{when:"An element declared with an abstract type was created without naming a concrete type in `xsi:type`.",fix:"Name one of the admitted types: `attributes: { 'xsi:type': '<Type>' }`; `admittedXsiTypes` lists them.",docs:`${e}/api/transaction#addchild`}},XSI_TYPE_NOT_ADMITTED:{code:`D3010`,message:`The element may not take the type named with xsi:type`,explanation:{when:"A write named in `xsi:type` a type the element may not take.",fix:"Pick a type from `admittedXsiTypes` for that element.",docs:`${e}/api/transaction#addchild`}},XSI_TYPE_CHANGE_LEAVES_CONTENT:{code:`D3011`,message:`The new xsi:type does not admit content the element still holds`,explanation:{when:"An update changed `xsi:type` to a type that does not admit attributes or children the element still holds.",fix:`Remove that content in the same transaction before changing the type, or pick a type that admits it.`,docs:`${e}/api/transaction#update`}},XML_CHARACTER_NOT_ALLOWED:{code:`D3012`,message:`The text holds a character XML does not allow`,explanation:{when:`A write, an import session's own writes or an export met a character XML does not allow (a control character below U+0020 but tab, line feed and carriage return, U+FFFE, U+FFFF) in a value, a name, a prefix, a namespace URI or an id; nothing was written, no file.`,fix:"Remove or replace the character named in `meta.character` at `meta.part` of the record `meta.recordId` before writing or exporting it.",docs:`${e}/io/#values-a-store-keeps`}},ALREADY_COMMITTED:{code:`D4001`,message:`Transaction already committed`,explanation:{when:`Not raised by core today: kept for a transaction used after its commit.`,fix:"Start a new `doc.transaction` for further writes.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},ALREADY_FAILED:{code:`D4002`,message:`Transaction already failed`,explanation:{when:`Not raised by core today: kept for a transaction used after it failed.`,fix:"Start a new `doc.transaction`; the failed one wrote nothing.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},DATABASE_COMMIT_ERROR:{code:`D4003`,message:`An error occurred while committing changes to the database`,explanation:{when:"Not raised by core today: store commit failures are `STORE_COMMIT_FAILED`.",fix:"Read `cause`; see `STORE_COMMIT_FAILED`.",docs:`${e}/guide/development/state-and-errors#error-catalog`}},CONCURRENT_TRANSACTION:{code:`D4004`,message:`A transaction is already in progress. Concurrent transactions are not supported yet — serialize them or implement a transaction queue.`,explanation:{when:"A `doc.transaction` started on a Document while another transaction or `doc.prepare` was still running on it (a missing `await`, or a nested transaction).",fix:"Await each transaction before the next; inside a transaction, write through its `tx`, never through `doc.transaction` again.",docs:`${e}/api/document`}},EXPORT_ROOT_NOT_FOUND:{code:`D5001`,message:`Root element not found in records during export`,explanation:{when:`The export found no root record in the document.`,fix:"The document is empty or damaged: import it again, or create it with `project.initEmptyDocument`.",docs:`${e}/api/project#export`}},EXPORT_ORPHAN_CHILD_REF:{code:`D5002`,message:`Parent references non-existent child record`,explanation:{when:`The export met a parent whose list of children names a record that does not exist.`,fix:"A hook or a raw write left a dangling child ref: a hook that deletes must also return the parent's `updated` operation.",docs:`${e}/api/project#export`}},PARSE_ERROR:{code:`D5003`,message:`Failed to parse XML`,explanation:{when:"The file given to import (or to `parseXmlDocument`) is not well-formed XML.",fix:"Fix the XML where `detail` points (line and column); check the file's encoding.",docs:`${e}/api/project#import`}},IMPORT_FAILED:{code:`D5004`,message:`Failed to import the file`,explanation:{when:`Importing a file failed after it was parsed (a hook threw, the store refused the records); nothing of the file remains.`,fix:"Read `cause` and `detail`; an import hook must not read the store or throw on data it can report as a diagnostic.",docs:`${e}/api/project#import`}},IMPORT_ABORTED:{code:`D5005`,message:`The import was aborted`,explanation:{when:"The import's `signal` was aborted; nothing of the file remains.",fix:`Nothing to fix when the abort was wanted; import the file again otherwise.`,docs:`${e}/api/project#import`}},EXPORT_CONFLICT:{code:`D5006`,message:`The document changed while it was exported`,explanation:{when:`The document was written twice while it was being exported, so no consistent file could be read.`,fix:`Export when no transaction or import is writing the document, or retry.`,docs:`${e}/api/project#export`}},EXPORT_ABORTED:{code:`D5007`,message:`The export was aborted`,explanation:{when:"The export's `signal` was aborted.",fix:`Nothing to fix when the abort was wanted; export again otherwise.`,docs:`${e}/api/project#export`}},EXTENSION_METHOD_COLLISION:{code:`D6001`,message:`Extension method name collision detected`,explanation:{when:`Two extension modules merged under one key define a method of the same name.`,fix:`Rename your method, or put your module under a key of its own.`,docs:`${e}/guide/extensions/#registering-extensions`}},UNKNOWN_CONFIG_KEY:{code:`D7001`,message:`Unknown config key`,explanation:{when:`A document, a test or a declaration named a config key the dialecte does not declare.`,fix:"Use a key of the dialecte's `configs` (its `defaultConfigKey` when in doubt).",docs:`${e}/api/dialecte#definedialecte`}},DOCUMENT_NOT_REGISTERED:{code:`D7002`,message:`Document not registered in project`,explanation:{when:`A document id names no document of the open project (removed, or from another project).`,fix:"Use an id from `project.getDocuments()` or from the import result.",docs:`${e}/api/project#document-access`}},PROJECT_NOT_OPENED:{code:`D7003`,message:`Project not opened`,explanation:{when:"The project was used before `open(name)` resolved, or once `close()`, `destroy()` or another `open()` was called on it - a batch import's file whose turn came after that is refused the same.",fix:"Keep the instance and await its `open(name)` before using the project; open it again after `close()` or `destroy()`, and await an `open()` of another project before using the Project again.",docs:`${e}/api/project#lifecycle`}},BLOB_NOT_FOUND:{code:`D7004`,message:`Blob not found in store`,explanation:{when:"`project.exportBlob` named a blob the project does not hold.",fix:"Use an id from `project.getBlobsByDocument` or `getStandaloneBlobs`.",docs:`${e}/api/project#blobs`}},PROJECT_DIALECTE_MISMATCH:{code:`D7008`,message:`The project's data is of another dialecte`,explanation:{when:"A project stored by another dialecte was opened (nothing of it written), or what serves the store (a worker, a server) was asked for a project of a dialecte it does not serve. Two dialectes' projects of one name are two projects: opening one never meets the other. `meta`: `project`, `realmDialecteId` (the one asked), and `projectDialecteId` (the project's), or the dialectes served, as the store's docs name them.",fix:`Open the project with the dialecte it was created with; serve every dialecte the app opens projects of, as the store's docs say.`,docs:`${e}/api/project#store-errors`}},PROJECT_DIALECTE_VERSION_MISMATCH:{code:`D7009`,message:`The project's store runs another version of the dialecte`,explanation:{when:`What serves the project's store (a worker, a server) runs another version of the dialecte than this view: another tab's, or one this page runs already for the project (a page runs one version of each dialecte).`,fix:`Reload every tab of the app so they run the same version.`,docs:`${e}/api/project#store-errors`}},PROJECT_DESTROY_FAILED:{code:`D7010`,message:`The project could not be deleted`,explanation:{when:`Destroying a project left its data in place: another tab, window or connection still holds it.`,fix:`Close the other tabs or windows of the app that have the project open, then destroy it again.`,docs:`${e}/api/project#lifecycle`}},PROJECT_OPEN_ELSEWHERE:{code:`D7011`,message:`The project is open in another tab, window or connection`,explanation:{when:"Another tab or window has the project open and there is no shared connection between them; or a destroy was asked while another connection - a store or project of the name in this page, or another tab - has the project open (`meta.connections`, where the store counts them).",fix:`Close the project in the other tab, window or connection, then open or destroy it here again.`,docs:`${e}/api/project#lifecycle`}},PROJECT_DESTROYED_WHILE_AWAY:{code:`D7013`,message:`The project was deleted while this view was away`,explanation:{when:"A view's connection to a project came back - the page back from a freeze or the back/forward cache, what serves its store started again - and the project it had open was destroyed meanwhile by another tab (and maybe made again under its name): nothing is opened in its place and nothing of it is read. `meta.project` names the project.",fix:"Tell the user the project was deleted elsewhere; close it in this view (`project.close()`), then open it again by its name for what is there now, or choose another.",docs:`${e}/api/project#lifecycle`}},PROJECT_NAME_INVALID:{code:`D7014`,message:`The project's name cannot name its files`,explanation:{when:"A project's name or its dialecte's id is empty, `.` or `..`: every store refuses it before it is built (a store may name its files after both, which no file can be); nothing was opened or written. `meta.project` and `meta.dialecteId` say which.",fix:"Give the project a name of its own (and the dialecte an id) other than an empty one, `.` or `..`.",docs:`${e}/api/project#lifecycle`}},PROJECT_STORAGE_NOT_REGISTERED:{code:`D7018`,message:`The project's storage type is not registered`,explanation:{when:"A project was opened (or destroyed by name), or a test asked for a test store, on a `storage.type` no kind is registered for in this realm: core serves `local`, `inMemory` and `custom` itself, every other type comes from the entry that registers it (`registerStorageKind`). Nothing was opened. `meta`: `project`, `type`.",fix:`Import the entry that registers the type once in the app's entry (for tests, in the test runner's setup file), before the first project opens on it; or open the project on another storage. Imported already? A kind is shared by every copy of @dialecte/core of the same storage version in the realm: one registered by a copy of another version (a package bringing its own core) is not seen - align the core versions.`,docs:`${e}/guide/development/implementing-a-store#register-a-storage-kind`}},DOCUMENT_PATH_INVALID:{code:`D7030`,message:`A document's path is not valid`,explanation:{when:"A document's path breaks a rule (empty, `.` or `..` segment, backslash, invisible character, not NFC, too long), names another file than the document's, changes its extension, or was handed to `project.import` of several files; nothing was written. `detail` says which rule.",fix:"Write the path relative, joined by `/`, in NFC, ending with the document's file name; pass a path to `importFile`, not to `import`.",docs:`${e}/api/project#a-document-s-path`}},DOCUMENT_PATH_TAKEN:{code:`D7031`,message:`A document's path is another document's place`,explanation:{when:"Another document already holds the place (`meta.takenBy`), a document still importing included: the same path, a path under another document's file, or a file at a folder another document's path uses.",fix:`Choose a path no other document holds, or move the other document first.`,docs:`${e}/api/project#a-document-s-path`}}},r=new Set(Object.values(n).map(e=>e.code));function i(e,t){throw a(e,t)}function a(e,t){let r=typeof e==`string`?{key:e,...n[e]}:e,i={code:r.code,key:r.key,message:t.message??r.message,detail:t.detail,method:c((/* @__PURE__ */ Error()).stack),ref:t.ref,meta:t.meta,cause:t.cause},a=Error(t.detail);return a.cause=i,a}function o(e){let t={},a=/* @__PURE__ */ new Map;for(let[o,s]of Object.entries(e)){Object.hasOwn(n,o)&&i(`ASSERTION_FAILED`,{detail:`defineErrors: "${o}" is a key of the core catalogue`}),r.has(s.code)&&i(`ASSERTION_FAILED`,{detail:`defineErrors: "${o}" uses "${s.code}", a code of the core catalogue`});let e=a.get(s.code);e&&i(`ASSERTION_FAILED`,{detail:`defineErrors: "${o}" uses "${s.code}", the code of "${e}"`}),a.set(s.code,o),t[o]={key:o,...s}}return t}function s(e){if(!(e instanceof Error))return;let t=e.cause;if(!(!t||t instanceof Error)&&typeof t.key==`string`&&typeof t.code==`string`)return t}function c(e){if(!e)return`unknown`;let t=e.split(`
|
|
2
|
+
`).slice(1).map(e=>e.match(/\bat\s+(?:async\s+)?(\S+)(?:\s+\[as\s+[^\]]+\])?\s+\(([^)]+)\)/)).find(e=>!l(e?.[1])),n=t?.[1]?.replace(/^Object\./,``),r=t?.[2];if(!r||!n)return n??`unknown`;let i=r.match(/(\w[\w-]*\/src\/[^?:]+)/);return i?`${i[1].replace(/\.[^/.]+$/,``)}::${n}`:n}function l(e){return e?t.has(e.slice(e.lastIndexOf(`.`)+1)):!1}let u=o({STORE_PROTOCOL_MISMATCH:{code:`D1012`,message:`Another version of the library holds the shared store connection`,explanation:{when:`Another version of the library already holds the origin's hub, or an engine worker speaks another wire than the page (another tab runs an older or newer build, or the worker file was built from another copy).`,fix:"Close the other tabs of the app, or reload them all on the same version; build the engine worker file from the copy of `@dialecte/core` the page uses.",docs:`${e}/api/project#sqlite-errors`}},STORE_REALM_ID_TAKEN:{code:`D1013`,message:`A view with this id is already connected to the shared store`,explanation:{when:`A view joined the origin's hub with an id another connected view already uses.`,fix:`Give each view its own id; reload the page that reused one.`,docs:`${e}/api/project#sqlite-errors`}},STORE_REALM_UNKNOWN:{code:`D1014`,message:`The shared store does not know this view`,explanation:{when:`A view spoke to the origin's hub without having joined it, or after it left; or a child view was bound by a page the hub no longer knows.`,fix:"Join (open the project) before reading or writing; reload a view that was disconnected; a child is bound again by its page (`createHubPort`, then `adoptHubPort`).",docs:`${e}/api/project#sqlite-errors`}},STORE_HUB_SPAWNERS_FIXED:{code:`D1019`,message:`The page's hub connection runs another version of this dialecte's engine`,explanation:{when:"`registerSqliteEngine({ url, dialectes })` named two versions of one dialecte (nothing kept), or the engines the app registered name a dialecte the page's connection already runs at another version, as `connectHub()` or a project opening on `sqlite` offers them to the hub: a page runs one version of each dialecte's engine (two would split a project's views between two engines). `meta.spawners` names the dialectes (id and version) refused; nothing of the call was added, nothing opened.",fix:"Ship one version of each dialecte in the app, and name it once in `registerSqliteEngine({ url, dialectes })` and in `serveSqliteEngine({ dialectes })`, from the copy the app opens its projects with.",docs:`${e}/api/project#sqlite-errors`}},STORE_SQLITE_ENGINE_FIXED:{code:`D1020`,message:`This page's SQLite engine is registered already`,explanation:{when:"A second `registerSqliteEngine({ url, dialectes })` named another URL or other dialectes than the first (the same URL and the same dialectes, in any order, do nothing: a module evaluated twice). There is no additive call. `meta`: `registered` (kept), `asked` (refused), each `{ url, dialectes }`.",fix:"Name all the dialectes of the app in one call, once, before the first project opens; the worker file serves them all (`serveSqliteEngine({ dialectes })`).",docs:`${e}/api/dialecte#the-engine-worker-and-its-packaging`}},PROJECT_LAYOUT_OUTDATED:{code:`D7005`,message:`Project stored by another version of the library`,explanation:{when:`The project's SQLite file was stored by another version of the library (another layout); nothing was written to it.`,fix:"Delete the project (the dialecte factory's `destroyProject({ name, storage: { type: 'sqlite' } })`) and import its files again with this version.",docs:`${e}/api/project#sqlite-errors`}},PROJECT_ENGINE_UNAVAILABLE:{code:`D7006`,message:`No view can start the project engine`,explanation:{when:`The project's SQLite engine could not be started or reached: its worker failed to load, could not load the engine's chunk (a build or a precache list that leaves it out), or never answered its open within the open budget; through the origin's hub, no open view offers an engine for the project's dialecte, or the engine never said it opened; a destroy still running past the open budget, or one asked by a page suspended before the hub granted it.`,fix:"Keep one tab of the app open and reload; check the `url` given to `registerSqliteEngine` points at the app's engine worker file and that it loads (the console names a script that fails); a destroy refused so is asked again once the project is closed elsewhere.",docs:`${e}/api/project#sqlite-errors`}},PROJECT_ENGINE_BUSY:{code:`D7007`,message:`The project is still held by another engine`,explanation:{when:`Another SQLite engine still holds the project's files (another tab or a worker that did not stop).`,fix:`Close the other tabs of the app, then open the project again.`,docs:`${e}/api/project#sqlite-errors`}},PROJECT_DATABASE_LOST:{code:`D7012`,message:`The project's database is gone`,explanation:{when:"The project's files hold data but none of them is its SQLite database any more: the database file's header was damaged (by the disk, another program, or site data changed outside the app). Nothing is opened or changed: no empty database is made in its place. `meta.project` names the project.",fix:"The project's data cannot be read back. Offer the user a reset, never automatically: `destroy()` on the same Project instance whose `open` was refused (keep it: `const project = new Project(params)`, then `await project.open(name)`) removes what the refused store holds, without opening it; `open(name)` then makes it again, empty, and its documents can be imported again.",docs:`${e}/api/project#lifecycle`}},PROJECT_ENGINE_NOT_DECLARED:{code:`D7015`,message:`This project has no engine to open it on SQLite`,explanation:{when:"A project was opened on `storage: { type: 'sqlite' }` but made by no dialecte's project factory: its dialecte's id or version is known to no one, so no engine can be asked for it. Nothing was opened.",fix:"Make the project with the dialecte's project factory (`createProjectFactory({ dialecte })`, as a dialecte package exports it), or open it on another storage.",docs:`${e}/api/project#sqlite-storage`}},PROJECT_SQLITE_ENGINE_NOT_REGISTERED:{code:`D7017`,message:`SQLite storage needs the engine registered for this dialecte`,explanation:{when:"A project was opened (or destroyed by name) on `storage: { type: 'sqlite' }` in a realm that can store, but the app told the page of no engine for its dialecte: no `registerSqliteEngine` call, or one that does not name it. Nothing was started. A child its page bound through `adoptHubPort` is not refused: it goes through its page's engine. `meta`: `project`, `dialecteId`.",fix:"Write the app's one worker file (`serveSqliteEngine({ dialectes })`) and call `registerSqliteEngine({ url, dialectes })` from `@dialecte/core/sqlite` once, before the first project opens, naming every dialecte of the app; `url` is a `?worker&url` import of that file. The registration is the page's: a frame of the same origin joining the hub on its own registers too (or is bound by its page); a frame of another origin never registers - it joins through `adoptHubPort` before it opens a project. Registered already? The registration is shared by every copy of @dialecte/core of the same SQLite version in the realm: one made by a copy of another version (a dialecte bringing its own core) is not seen - align the core versions.",docs:`${e}/api/dialecte#the-engine-worker-and-its-packaging`}}});function d(e){let{key:t}=e;return f(t)?u[t]:t}function f(e){return Object.hasOwn(u,e)}function p(e){return m({thrown:e.thrown,depth:0})}function m(e){let{thrown:t,depth:n}=e,r=s(t);if(r&&t instanceof Error){let{cause:e,meta:i,ref:a,...o}=r,s={...o};return i!==void 0&&(s.meta=h({value:i})),a!==void 0&&(s.ref=h({value:a})),e!==void 0&&n<4&&(s.cause=m({thrown:e,depth:n+1})),{kind:`dialecte`,message:t.message,stack:t.stack,error:s}}if(t instanceof Error){let e={kind:`error`,name:t.name,message:t.message,stack:t.stack};return t.cause!==void 0&&n<4&&(e.cause=m({thrown:t.cause,depth:n+1})),e}return{kind:`value`,value:h({value:t})}}function h(e){let{value:t,ancestors:n=/* @__PURE__ */ new Set}=e;if(ee({value:t}))return t;if(typeof t!=`object`||!t||n.has(t))return String(t);let r=Object.getPrototypeOf(t),i=Array.isArray(t);if(r!==(i?Array.prototype:Object.prototype)&&r!==null)return String(t);n.add(t);let a=i?t.map(function(e){return h({value:e,ancestors:n})}):Object.fromEntries(Object.entries(t).map(function([e,t]){return[e,h({value:t,ancestors:n})]}));return n.delete(t),a}function ee(e){try{return structuredClone(e.value),!0}catch{return!1}}let g=3e4;u.STORE_PROTOCOL_MISMATCH.key;function _(e){let{dialecteId:t,project:n}=e;return`${encodeURIComponent(t)}/${encodeURIComponent(n)}`}function te(){let e={realms:/* @__PURE__ */ new Map,projects:/* @__PURE__ */ new Map,holds:/* @__PURE__ */ new Map,nextGeneration:1,nextOrder:0};return{handle:function(t){let n={state:e,now:t.now,commands:[]};return ne({step:n,event:t}),{commands:n.commands,wakeAt:_e({state:e})}}}}function ne(e){let{step:t,event:n}=e;switch(n.type){case`hello`:return re({step:t,hello:n});case`spawners`:return ie({step:t,added:n});case`open`:return y({step:t,open:n});case`leave`:return ce({step:t,leave:n});case`realm-gone`:return fe({step:t,realmId:n.realmId});case`engine-opened`:return I({step:t,opened:n});case`engine-open-failed`:return L({step:t,failed:n});case`engine-ended`:return B({step:t,ended:n});case`destroy`:return le({step:t,destroy:n});case`destroyed`:return O({step:t,key:_(n),realmId:n.realmId});case`destroy-elsewhere`:return ue({step:t,destroy:n});case`files-deleted`:return E({step:t,deleted:n});case`tick`:return he({step:t});default:return n}}function re(e){let{step:t,hello:n}=e;if(n.protocol!==6){v({step:t,realmId:n.realmId,refusal:{origin:`hub`,key:u.STORE_PROTOCOL_MISMATCH.key,detail:`the hub speaks protocol 6, the view ${n.protocol}`,meta:{hubProtocol:6,realmProtocol:n.protocol}}});return}if(t.state.realms.has(n.realmId)){v({step:t,realmId:n.realmId,refusal:{origin:`hub`,key:u.STORE_REALM_ID_TAKEN.key,detail:`a view "${n.realmId}" is already connected`,meta:{realmId:n.realmId}}});return}if(n.parentRealmId!==void 0&&!t.state.realms.has(n.parentRealmId)){v({step:t,realmId:n.realmId,refusal:{origin:`hub`,key:u.STORE_REALM_UNKNOWN.key,detail:`the hub knows no view "${n.parentRealmId}", the parent of "${n.realmId}"`,meta:{realmId:n.realmId,parentRealmId:n.parentRealmId}}});return}let r=n.parentRealmId===void 0?n.spawners:[];t.state.realms.set(n.realmId,{realmId:n.realmId,topLevel:n.topLevel,spawners:new Map(r.map(e=>[e.dialecteId,e.dialecteVersion])),parentRealmId:n.parentRealmId,order:t.state.nextOrder++}),t.commands.push({type:`welcome`,realmId:n.realmId}),n.parentRealmId===void 0&&t.commands.push({type:`watch-realm-lock`,realmId:n.realmId})}function ie(e){let{step:t,added:n}=e,r=t.state.realms.get(n.realmId);if(r&&r.parentRealmId===void 0)for(let e of n.spawners)r.spawners.has(e.dialecteId)||r.spawners.set(e.dialecteId,e.dialecteVersion)}function v(e){let{step:t,realmId:n,refusal:r}=e;t.commands.push({type:`refuse-hello`,realmId:n,refusal:r})}function y(e){let{step:t,open:n}=e;if(!t.state.realms.has(n.realmId)){U({step:t,realmId:n.realmId,project:n.project,dialecteId:n.dialecteId,refusal:{origin:`hub`,key:u.STORE_REALM_UNKNOWN.key,detail:`the hub knows no view "${n.realmId}"`,meta:{realmId:n.realmId}}});return}let r=t.state.holds.get(_(n));if(r){r.opens.set(n.realmId,n);return}let i=t.state.projects.get(_(n));if(i){let e=se({project:i,open:n});if(!e)return b({step:t,project:i,open:n});if(!ae({state:t.state,project:i,open:n}))return U({step:t,realmId:n.realmId,project:n.project,dialecteId:n.dialecteId,refusal:e});W({step:t,project:i}),t.state.projects.delete(_(i))}oe({step:t,open:n})}function ae(e){let{state:t,project:n,open:r}=e;if(n.clients.size>0)return!1;let i=/* @__PURE__ */ new Map([[r.realmId,r.dialecteVersion]]),[a]=K({state:t,dialecteId:r.dialecteId,clients:i});return a?.dialecteVersion===r.dialecteVersion}function b(e){let{step:t,project:n,open:r}=e;n.clients.set(r.realmId,r.dialecteVersion),x({project:n,open:r}),n.idleDeadline=void 0,n.engine.status===`opening`?M({step:t,project:n}):G({step:t,project:n,realmId:r.realmId})}function oe(e){let{step:t,open:n}=e,r=/* @__PURE__ */ new Map([[n.realmId,n.dialecteVersion]]),i=N({step:t,project:n.project,dialecteId:n.dialecteId,clients:r});if(!i)return;let a=t.now+g,o={project:n.project,dialecteId:n.dialecteId,clients:r,expectations:/* @__PURE__ */ new Map,engine:F({step:t,project:n.project,dialecteId:n.dialecteId,host:i,openDeadline:a,expectedCreationId:n.expectedCreationId}),openDeadline:a,idleDeadline:void 0,triedHosts:[]};x({project:o,open:n}),t.state.projects.set(_(n),o)}function x(e){let{project:t,open:n}=e;n.expectedCreationId===void 0?t.expectations.delete(n.realmId):t.expectations.set(n.realmId,n.expectedCreationId)}function S(e){let{project:t}=e,n=[...t.clients.keys()].map(function(e){return t.expectations.get(e)});return n.some(function(e){return e===void 0})?void 0:n[0]}function se(e){let{project:t,open:n}=e;if(n.dialecteVersion!==t.engine.dialecteVersion)return C({project:t.project,dialecteId:t.dialecteId,engineVersion:t.engine.dialecteVersion,realmVersion:n.dialecteVersion})}function C(e){let{project:t,dialecteId:n,engineVersion:r,realmVersion:i}=e;return{origin:`hub`,key:`PROJECT_DIALECTE_VERSION_MISMATCH`,detail:`the engine of "${t}" runs ${n} ${r}, the view ${i}`,meta:{project:t,dialecteId:n,engineVersion:r,realmVersion:i}}}function ce(e){let{step:t,leave:n}=e;t.state.holds.get(_(n))?.opens.delete(n.realmId);let r=t.state.projects.get(_(n));r&&k({step:t,project:r,realmId:n.realmId}),t.commands.push({type:`left`,realmId:n.realmId,project:n.project,dialecteId:n.dialecteId})}function le(e){let{step:t,destroy:n}=e,r=D({state:t.state,destroy:n});r?w({step:t,destroy:n,refusal:r}):(T({step:t,destroy:n,deleterRealmId:void 0}),t.commands.push({type:`destroy-granted`,realmId:n.realmId,project:n.project,dialecteId:n.dialecteId}))}function ue(e){let{step:t,destroy:n}=e,r=D({state:t.state,destroy:n});if(r){w({step:t,destroy:n,refusal:r});return}let i=de({state:t.state,destroy:n});i===void 0?w({step:t,destroy:n,refusal:{origin:`hub`,key:`STORE_UNAVAILABLE`,detail:`no view of the origin runs an engine of "${n.dialecteId}" to delete "${n.project}"`,meta:{project:n.project,dialecteId:n.dialecteId}}}):(T({step:t,destroy:n,deleterRealmId:i}),t.commands.push({type:`delete-files`,realmId:i,project:n.project,dialecteId:n.dialecteId}))}function de(e){let{state:t,destroy:n}=e,r=t.realms.get(n.realmId),i=r?.parentRealmId===void 0?void 0:t.realms.get(r.parentRealmId),a=[...t.realms.values()].filter(function(e){return e.realmId!==n.realmId&&e!==i}).sort(function(e,t){return e.order-t.order}),o=i?[i,...a]:a;function s(e){return e.spawners.get(n.dialecteId)===n.dialecteVersion}function c(e){return e.spawners.has(n.dialecteId)}return(o.find(s)??o.find(c))?.realmId}function w(e){let{step:t,destroy:n,refusal:r}=e;t.commands.push({type:`refuse-destroy`,realmId:n.realmId,project:n.project,dialecteId:n.dialecteId,refusal:r})}function T(e){let{step:t,destroy:n,deleterRealmId:r}=e,{realmId:i}=n,a={project:n.project,dialecteId:n.dialecteId,realmId:i,...r!==void 0&&{deleterRealmId:r},opens:/* @__PURE__ */ new Map},o=t.state.projects.get(_(n));if(o){let e=o.clients.get(i);e!==void 0&&(r===void 0&&a.opens.set(i,{type:`open`,now:t.now,realmId:i,project:o.project,dialecteId:o.dialecteId,dialecteVersion:e}),o.engine.status===`ready`&&t.commands.push({type:`engine-lost`,realmId:i,project:o.project,dialecteId:o.dialecteId,generation:o.engine.generation})),W({step:t,project:o}),t.state.projects.delete(_(o))}t.state.holds.set(_(n),a)}function E(e){let{step:t,deleted:n}=e,r=_(n),i=t.state.holds.get(r);i?.deleterRealmId!==void 0&&i.deleterRealmId===n.realmId&&(t.state.realms.has(i.realmId)&&(n.error===void 0?t.commands.push({type:`destroyed-elsewhere`,realmId:i.realmId,project:i.project,dialecteId:i.dialecteId}):w({step:t,destroy:i,refusal:{origin:`engine`,error:n.error}})),O({step:t,key:r,realmId:i.realmId,held:!0}))}function D(e){let{state:t,destroy:n}=e,{realmId:r,project:i}=n,a=_(n);if(!t.realms.has(r))return{origin:`hub`,key:u.STORE_REALM_UNKNOWN.key,detail:`the hub knows no view "${r}"`,meta:{realmId:r}};if(t.holds.has(a))return{origin:`hub`,key:`PROJECT_OPEN_ELSEWHERE`,detail:`"${i}" is being destroyed by another view`,meta:{project:i}};let o=[...t.projects.get(a)?.clients.keys()??[]].filter(function(e){return e!==r});if(o.length!==0)return{origin:`hub`,key:`PROJECT_OPEN_ELSEWHERE`,detail:`"${i}" is open in ${o.length} other view(s)`,meta:{project:i,connections:o.length}}}function O(e){let{step:t,key:n,realmId:r,held:i=!1}=e,a=t.state.holds.get(n);if(a?.realmId===r&&(a.deleterRealmId===void 0||i)){t.state.holds.delete(n);for(let e of a.opens.values())y({step:t,open:{...e,now:t.now}})}}function k(e){let{step:t,project:n,realmId:r}=e;z({project:n,realmId:r})&&(n.engine.status===`ready`&&t.commands.push({type:`client-gone`,project:n.project,dialecteId:n.dialecteId,generation:n.engine.generation,realmId:r}),n.clients.size>0||(n.idleDeadline=t.now+5e3,n.openDeadline=void 0))}function fe(e){let{step:t,realmId:n}=e;if(!t.state.realms.has(n))return;let r=pe({state:t.state,realmId:n});for(let e of r)t.state.realms.delete(e),t.commands.push({type:`drop-realm`,realmId:e});for(let e of t.state.holds.values()){for(let t of r)e.opens.delete(t);e.deleterRealmId!==void 0&&r.includes(e.deleterRealmId)?(r.includes(e.realmId)||w({step:t,destroy:e,refusal:{origin:`hub`,key:`STORE_CONNECTION_LOST`,detail:`the view deleting "${e.project}" is gone: its files may be partly deleted`,meta:{project:e.project,reason:`host-gone`}}}),O({step:t,key:_(e),realmId:e.realmId,held:!0})):r.includes(e.realmId)&&O({step:t,key:_(e),realmId:e.realmId})}for(let e of t.state.projects.values())if(r.includes(e.engine.hostRealmId)){for(let t of r)z({project:e,realmId:t});A({step:t,project:e})}else for(let n of r)k({step:t,project:e,realmId:n})}function pe(e){let{state:t,realmId:n}=e,r=[n];for(let e of r)for(let n of t.realms.values())n.parentRealmId===e&&r.push(n.realmId);return r}function A(e){let{step:t,project:n}=e;if(W({step:t,project:n}),n.engine.status===`ready`)for(let e of n.clients.keys())t.commands.push({type:`engine-lost`,realmId:e,project:n.project,dialecteId:n.dialecteId,generation:n.engine.generation});if(n.openDeadline!==void 0&&n.openDeadline-t.now<1e3){j({step:t,project:n});return}let r=n.clients.size>0?N({step:t,project:n.project,dialecteId:n.dialecteId,clients:n.clients}):void 0;r?n.engine=F({step:t,project:n.project,dialecteId:n.dialecteId,host:r,openDeadline:M({step:t,project:n}),expectedCreationId:S({project:n})}):t.state.projects.delete(_(n))}function j(e){let{step:t,project:n}=e;H({step:t,project:n.project,dialecteId:n.dialecteId,clients:n.clients,refusal:{origin:`hub`,key:u.PROJECT_ENGINE_UNAVAILABLE.key,detail:`no engine for "${n.project}" opened within ${g} ms`,meta:{project:n.project,dialecteId:n.dialecteId,openBudgetMs:g}}}),t.state.projects.delete(_(n))}function M(e){let{step:t,project:n}=e;return n.openDeadline===void 0&&(n.openDeadline=t.now+g,n.triedHosts=[]),n.openDeadline}function N(e){let{step:t,project:n,dialecteId:r,clients:i}=e,[a]=K({state:t.state,dialecteId:r,clients:i});if(a)return P({step:t,project:n,dialecteId:r,clients:i,host:a});H({step:t,project:n,dialecteId:r,clients:i,refusal:{origin:`hub`,key:u.PROJECT_ENGINE_UNAVAILABLE.key,detail:`no connected view can start an engine of "${r}"`,meta:{project:n,dialecteId:r}}})}function P(e){let{step:t,project:n,dialecteId:r,clients:i,host:a}=e;for(let[e,o]of i)o!==a.dialecteVersion&&(U({step:t,realmId:e,project:n,dialecteId:r,refusal:C({project:n,dialecteId:r,engineVersion:a.dialecteVersion,realmVersion:o})}),i.delete(e));return i.size>0?a:void 0}function F(e){let{step:t,project:n,dialecteId:r,host:i,openDeadline:a,expectedCreationId:o}=e,s={hostRealmId:i.realm.realmId,generation:t.state.nextGeneration++,dialecteVersion:i.dialecteVersion,status:`opening`,creationId:void 0,expectedCreationId:o};return t.commands.push({type:`spawn-engine`,realmId:s.hostRealmId,project:n,dialecteId:r,generation:s.generation,openBudgetMs:Math.min(1e4,a-t.now),...o!==void 0&&{expectedCreationId:o}}),s}function I(e){let{step:t,opened:n}=e,r=V({state:t.state,project:n.project,dialecteId:n.dialecteId,generation:n.generation});if(r?.engine.status===`opening`){r.engine.status=`ready`,r.engine.creationId=n.creationId,r.openDeadline=void 0;for(let e of r.clients.keys())G({step:t,project:r,realmId:e})}}function L(e){let{step:t,failed:n}=e,r=V({state:t.state,project:n.project,dialecteId:n.dialecteId,generation:n.generation});if(r?.engine.status!==`opening`)return;W({step:t,project:r});let i=M({step:t,project:r});if(r.triedHosts.push(r.engine.hostRealmId),n.failure.key===`PROJECT_DESTROYED_WHILE_AWAY`)return R({step:t,project:r,error:n.failure.error,openDeadline:i});let a=n.failure.key===u.PROJECT_ENGINE_BUSY.key&&r.clients.size>0&&i-t.now>=1e3?me({step:t,project:r}):void 0;a?r.engine=F({step:t,project:r.project,dialecteId:r.dialecteId,host:a,openDeadline:i,expectedCreationId:S({project:r})}):(H({step:t,project:r.project,dialecteId:r.dialecteId,clients:r.clients,refusal:{origin:`engine`,error:n.failure.error}}),t.state.projects.delete(_(r)))}function R(e){let{step:t,project:n,error:r,openDeadline:i}=e,a=n.engine.expectedCreationId,o=new Map([...n.clients].filter(function([e]){return n.expectations.get(e)===a}));for(let e of o.keys())z({project:n,realmId:e});if(H({step:t,project:n.project,dialecteId:n.dialecteId,clients:o,refusal:{origin:`engine`,error:r}}),n.clients.size===0){t.state.projects.delete(_(n));return}if(i-t.now<1e3)return j({step:t,project:n});let s=N({step:t,project:n.project,dialecteId:n.dialecteId,clients:n.clients});s?n.engine=F({step:t,project:n.project,dialecteId:n.dialecteId,host:s,openDeadline:i,expectedCreationId:S({project:n})}):t.state.projects.delete(_(n))}function z(e){let{project:t,realmId:n}=e;return t.expectations.delete(n),t.clients.delete(n)}function B(e){let{step:t,ended:n}=e,r=V({state:t.state,project:n.project,dialecteId:n.dialecteId,generation:n.generation});r&&(r.engine.status===`ready`?A({step:t,project:r}):(W({step:t,project:r}),H({step:t,project:r.project,dialecteId:r.dialecteId,clients:r.clients,refusal:{origin:`hub`,key:u.PROJECT_ENGINE_UNAVAILABLE.key,detail:`the engine of "${r.project}" ended before it opened`,meta:{project:r.project,dialecteId:r.dialecteId}}}),t.state.projects.delete(_(r))))}function me(e){let{step:t,project:n}=e,r=K({state:t.state,dialecteId:n.dialecteId,clients:n.clients}),i=n.triedHosts.at(-1);return r.find(e=>!n.triedHosts.includes(e.realm.realmId)&&q({clients:n.clients,candidate:e})>0)??r.find(e=>e.realm.realmId===i)}function he(e){let{step:t}=e;for(let e of t.state.projects.values())e.openDeadline===void 0||e.openDeadline>t.now||(W({step:t,project:e}),j({step:t,project:e}));for(let e of t.state.projects.values())e.idleDeadline===void 0||e.idleDeadline>t.now||(W({step:t,project:e}),t.state.projects.delete(_(e)));for(let e of t.state.holds.values())ge({step:t,hold:e})}function ge(e){let{step:t,hold:n}=e;for(let e of n.opens.values())e.now+g>t.now||(n.opens.delete(e.realmId),U({step:t,realmId:e.realmId,project:n.project,dialecteId:n.dialecteId,refusal:{origin:`hub`,key:u.PROJECT_ENGINE_UNAVAILABLE.key,detail:`"${n.project}" is being destroyed and was not done within ${g} ms`,meta:{project:n.project,openBudgetMs:g}}}))}function V(e){let t=e.state.projects.get(_(e));return t?.engine.generation===e.generation?t:void 0}function H(e){let{step:t,project:n,dialecteId:r,clients:i,refusal:a}=e;for(let e of i.keys())U({step:t,realmId:e,project:n,dialecteId:r,refusal:a});i.clear()}function U(e){let{step:t,realmId:n,project:r,dialecteId:i,refusal:a}=e;t.commands.push({type:`refuse-open`,realmId:n,project:r,dialecteId:i,refusal:a})}function W(e){let{step:t,project:n}=e;t.commands.push({type:`release-engine`,project:n.project,dialecteId:n.dialecteId,generation:n.engine.generation,hostRealmId:n.engine.hostRealmId})}function _e(e){let t=[...e.state.projects.values()].flatMap(e=>[e.openDeadline,e.idleDeadline].filter(e=>e!==void 0));for(let n of e.state.holds.values())for(let e of n.opens.values())t.push(e.now+g);return t.length>0?Math.min(...t):void 0}function G(e){let{step:t,project:n,realmId:r}=e,{creationId:i}=n.engine;i!==void 0&&(n.expectations.set(r,i),t.commands.push({type:`connect-client`,creationId:i,project:n.project,dialecteId:n.dialecteId,generation:n.engine.generation,realmId:r}))}function K(e){let{state:t,dialecteId:n,clients:r}=e;return[...t.realms.values()].flatMap(e=>ve({realm:e,dialecteId:n})).sort((e,t)=>ye({left:e,right:t,clients:r}))}function ve(e){let{realm:t,dialecteId:n}=e,r=t.spawners.get(n);return r===void 0?[]:[{realm:t,dialecteVersion:r}]}function ye(e){let{left:t,right:n,clients:r}=e;return Number(n.realm.topLevel)-Number(t.realm.topLevel)||q({clients:r,candidate:n})-q({clients:r,candidate:t})||Number(r.has(n.realm.realmId))-Number(r.has(t.realm.realmId))||t.realm.order-n.realm.order}function q(e){let{clients:t,candidate:n}=e;return[...t.values()].filter(e=>e===n.dialecteVersion).length}function be(e={}){let{helloBudgetMs:t=2e4}=e,n=te(),r={realms:/* @__PURE__ */ new Map,hosts:/* @__PURE__ */ new Map,adoptions:/* @__PURE__ */ new Map,nextAdoptionId:0,bindings:/* @__PURE__ */ new Map,timer:void 0,hubLock:`dialecte:hub:${crypto.randomUUID()}`},i=Me({name:r.hubLock});i.catch(je);function o(e){let t=n.handle(e.event);for(let n of t.commands)xe({state:r,command:n,hello:e.hello,feed:o});Ae({state:r,wakeAt:t.wakeAt,feed:o})}function s(e){let{port:n,parentRealmId:i,bindingId:a}=e,s,l=a===void 0?setTimeout(function(){n.onmessage=null,n.close()},t):void 0;n.onmessage=function(e){let t=e.data;if(typeof t?.type==`string`){if(t.type===`hello`){if(s!==void 0)return;clearTimeout(l),s=t.realmId,o({event:{type:`hello`,now:performance.now(),realmId:t.realmId,protocol:t.protocol,topLevel:t.topLevel,spawners:t.spawners,parentRealmId:i},hello:{port:n,bindingId:a}})}else t.type===`port-unused`&&s===void 0?(clearTimeout(l),a!==void 0&&r.bindings.delete(a),n.close()):s!==void 0&&r.realms.get(s)?.port===n&&c({realmId:s,message:t})}}}function c(e){let{realmId:t,message:n}=e,i=performance.now();switch(n.type){case`open`:return o({event:{...n,now:i,realmId:t}});case`spawners`:return o({event:{type:`spawners`,now:i,realmId:t,spawners:n.spawners}});case`ping`:return $({port:r.realms.get(t).port,message:{type:`pong`}});case`files-deleted`:return o({event:{type:`files-deleted`,now:i,realmId:t,project:n.project,dialecteId:n.dialecteId,...n.error!==void 0&&{error:n.error}}});case`destroy-elsewhere`:return o({event:{type:`destroy-elsewhere`,now:i,realmId:t,project:n.project,dialecteId:n.dialecteId,dialecteVersion:n.dialecteVersion}});case`leave`:case`destroy`:case`destroyed`:return o({event:{type:n.type,now:i,realmId:t,project:n.project,dialecteId:n.dialecteId}});case`bind-child`:return r.bindings.set(n.bindingId,{port:n.port,parentRealmId:t,realmId:void 0}),s({port:n.port,parentRealmId:t,bindingId:n.bindingId});case`unbind-child`:return Ee({state:r,bindingId:n.bindingId,feed:o});case`engine-opened`:return J({state:r,realmId:t,engine:n})?o({event:{type:`engine-opened`,now:i,project:n.project,dialecteId:n.dialecteId,generation:n.generation,creationId:n.creationId}}):void 0;case`engine-ended`:return J({state:r,realmId:t,engine:n})?o({event:{type:`engine-ended`,now:i,project:n.project,dialecteId:n.dialecteId,generation:n.generation}}):void 0;case`engine-open-failed`:return J({state:r,realmId:t,engine:n})?o({event:{type:`engine-open-failed`,now:i,project:n.project,dialecteId:n.dialecteId,generation:n.generation,failure:{key:n.key,error:n.error}}}):void 0;case`client-adopted`:return Oe({state:r,realmId:t,adoptionId:n.adoptionId});case`client-adopt-failed`:return ke({state:r,realmId:t,adoptionId:n.adoptionId,feed:o});default:return}}return{connect:function({port:e}){i.then(function(){s({port:e})},function(t){$({port:e,message:{type:`hello-refused`,error:p({thrown:a(`STORE_CONNECTION_FAILED`,{detail:`The origin's hub could not hold its lock: it welcomes no view`,...t instanceof Error&&{cause:t}})})}}),e.close()})}}}function xe(e){let{state:t,command:n,hello:r,feed:i}=e;switch(n.type){case`welcome`:return Se({state:t,realmId:n.realmId,hello:r});case`refuse-hello`:if(!r)return;$({port:r.port,message:{type:`hello-refused`,error:X(n.refusal)}}),r.port.close(),r.bindingId!==void 0&&t.bindings.delete(r.bindingId);return;case`drop-realm`:return Ce({state:t,realmId:n.realmId});case`watch-realm-lock`:return Te({state:t,realmId:n.realmId,feed:i});case`spawn-engine`:return t.hosts.set(Z(n),n.realmId),Q({state:t,realmId:n.realmId,message:{type:`spawn-engine`,project:n.project,dialecteId:n.dialecteId,generation:n.generation,openBudgetMs:n.openBudgetMs,...n.expectedCreationId!==void 0&&{expectedCreationId:n.expectedCreationId}}});case`connect-client`:return De({state:t,project:n.project,dialecteId:n.dialecteId,generation:n.generation,creationId:n.creationId,clientRealmId:n.realmId,feed:i});case`engine-lost`:return Y({state:t,realmId:n.realmId,engine:n}),Q({state:t,realmId:n.realmId,message:{type:`engine-lost`,project:n.project,dialecteId:n.dialecteId,generation:n.generation}});case`refuse-open`:return Y({state:t,realmId:n.realmId,engine:n}),Q({state:t,realmId:n.realmId,message:{type:`open-refused`,project:n.project,dialecteId:n.dialecteId,error:X(n.refusal)}});case`client-gone`:{Y({state:t,realmId:n.realmId,engine:n});let e=t.hosts.get(Z(n));return e===void 0?void 0:Q({state:t,realmId:e,message:{type:`client-gone`,project:n.project,dialecteId:n.dialecteId,generation:n.generation,clientId:n.realmId}})}case`release-engine`:return t.hosts.delete(Z(n)),Q({state:t,realmId:n.hostRealmId,message:{type:`release-engine`,project:n.project,dialecteId:n.dialecteId,generation:n.generation}});case`left`:return Q({state:t,realmId:n.realmId,message:{type:`left`,project:n.project,dialecteId:n.dialecteId}});case`destroy-granted`:return Q({state:t,realmId:n.realmId,message:{type:`destroy-granted`,project:n.project,dialecteId:n.dialecteId}});case`delete-files`:case`destroyed-elsewhere`:return Q({state:t,realmId:n.realmId,message:{type:n.type,project:n.project,dialecteId:n.dialecteId}});case`refuse-destroy`:return Q({state:t,realmId:n.realmId,message:{type:`destroy-refused`,project:n.project,dialecteId:n.dialecteId,error:X(n.refusal)}});default:return n}}function Se(e){let{state:t,realmId:n,hello:r}=e;if(r){if(t.realms.set(n,{realmId:n,port:r.port,watch:void 0}),r.bindingId!==void 0){let e=t.bindings.get(r.bindingId);e&&(e.realmId=n)}$({port:r.port,message:{type:`welcome`,realmId:n,hubLock:t.hubLock}})}}function Ce(e){let{state:t,realmId:n}=e,r=t.realms.get(n);if(r){t.realms.delete(n),r.watch?.abort(),we({state:t,realmId:n})&&$({port:r.port,message:{type:`dropped`}}),r.port.close();for(let[e,r]of t.adoptions)r.clientRealmId===n&&(r.port.close(),t.adoptions.delete(e));for(let[e,r]of t.bindings)r.realmId===n&&t.bindings.delete(e),r.realmId===void 0&&r.parentRealmId===n&&($({port:r.port,message:{type:`hello-refused`,error:X({origin:`hub`,key:u.STORE_REALM_UNKNOWN.key,detail:`the view that bound this one ("${n}") is gone`,meta:{realmId:n}})}}),r.port.close(),t.bindings.delete(e))}}function we(e){for(let t of e.state.bindings.values())if(t.realmId===e.realmId)return!0;return!1}function Te(e){let{state:t,realmId:n,feed:r}=e,i=t.realms.get(n);if(!i)return;let a=new AbortController;i.watch=a,navigator.locks.request(`dialecte:realm:${n}`,{signal:a.signal},function(){r({event:{type:`realm-gone`,now:performance.now(),realmId:n}})}).catch(function(e){e?.name!==`AbortError`&&console.error(`The hub could not watch a view for its end:`,e)})}function Ee(e){let{state:t,bindingId:n,feed:r}=e,i=t.bindings.get(n);i&&(i.realmId===void 0?(t.bindings.delete(n),i.port.close()):(r({event:{type:`realm-gone`,now:performance.now(),realmId:i.realmId}}),t.bindings.delete(n)))}function De(e){let{state:t,project:n,dialecteId:r,generation:i,creationId:a,clientRealmId:o,feed:s}=e,c=t.hosts.get(Z({project:n,generation:i})),l=c===void 0?void 0:t.realms.get(c);if(c===void 0||!l){queueMicrotask(function(){s({event:{type:`engine-ended`,now:performance.now(),project:n,dialecteId:r,generation:i}})});return}let u=new MessageChannel;t.nextAdoptionId+=1;let d=t.nextAdoptionId;t.adoptions.set(d,{hostRealmId:c,clientRealmId:o,project:n,dialecteId:r,generation:i,creationId:a,port:u.port1}),$({port:l.port,message:{type:`adopt-client`,project:n,dialecteId:r,generation:i,adoptionId:d,clientId:o,port:u.port2},transfer:[u.port2]})}function Oe(e){let{state:t,realmId:n,adoptionId:r}=e,i=t.adoptions.get(r);if(i?.hostRealmId!==n)return;t.adoptions.delete(r);let a=t.realms.get(i.clientRealmId);!a||t.hosts.get(Z(i))!==n?i.port.close():$({port:a.port,message:{type:`engine-ready`,project:i.project,dialecteId:i.dialecteId,generation:i.generation,creationId:i.creationId,port:i.port},transfer:[i.port]})}function ke(e){let{state:t,realmId:n,adoptionId:r,feed:i}=e,a=t.adoptions.get(r);a?.hostRealmId===n&&(t.adoptions.delete(r),a.port.close(),i({event:{type:`engine-ended`,now:performance.now(),project:a.project,dialecteId:a.dialecteId,generation:a.generation}}))}function J(e){return e.state.hosts.get(Z(e.engine))===e.realmId}function Y(e){let{state:t,realmId:n,engine:r}=e;for(let[e,i]of t.adoptions){let a=i.project===r.project&&i.dialecteId===r.dialecteId;i.clientRealmId===n&&a&&(i.port.close(),t.adoptions.delete(e))}}function Ae(e){let{state:t,wakeAt:n,feed:r}=e;clearTimeout(t.timer),t.timer=void 0,n!==void 0&&(t.timer=setTimeout(function(){t.timer=void 0;let e={type:`tick`,now:performance.now()};r({event:e})},Math.max(0,n-performance.now())))}function X(e){return e.origin===`engine`?e.error:p({thrown:a(d({key:e.key}),{detail:e.detail,meta:e.meta})})}function Z(e){return`${e.project}#${e.generation}`}function Q(e){let t=e.state.realms.get(e.realmId);t&&$({port:t.port,message:e.message})}function $(e){e.port.postMessage(e.message,e.transfer??[])}function je(){}function Me(e){return new Promise(function(t,n){navigator.locks.request(e.name,function(){return t(),new Promise(function(){})}).catch(n)})}let Ne=be();self.onconnect=function(e){for(let t of e.ports)Ne.connect({port:t})}})();
|
|
@@ -4,8 +4,7 @@ import { ExtensionModules } from '../document';
|
|
|
4
4
|
import { AnyDialecteConfig } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* The one place a Project of a declared dialecte is wired: every config, the default key, the
|
|
7
|
-
* dialecte's extensions under the consumer's, a fresh hooks instance, the local store by default
|
|
8
|
-
* worker's address when its factory gives one (what `sqlite` storage starts).
|
|
7
|
+
* dialecte's extensions under the consumer's, a fresh hooks instance, the local store by default.
|
|
9
8
|
*/
|
|
10
9
|
export declare function createDialecteProject<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, CustomModules extends ExtensionModules = Record<never, never>>(params: CreateDialecteProjectParams<GenericConfig, GenericModules, CustomModules>): Project<GenericConfig, GenericModules & CustomModules>;
|
|
11
10
|
//# sourceMappingURL=create-dialecte-project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-dialecte-project.d.ts","sourceRoot":"","sources":["../../src/dialecte/create-dialecte-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD
|
|
1
|
+
{"version":3,"file":"create-dialecte-project.d.ts","sourceRoot":"","sources":["../../src/dialecte/create-dialecte-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,aAAa,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAE7D,MAAM,EAAE,2BAA2B,CAAC,aAAa,EAAE,cAAc,EAAE,aAAa,CAAC,GAC/E,OAAO,CAAC,aAAa,EAAE,cAAc,GAAG,aAAa,CAAC,CAYxD"}
|
|
@@ -3,12 +3,12 @@ import { ExtensionModules } from '../document';
|
|
|
3
3
|
import { AnyDialecteConfig } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* The project factory of a dialecte: every config, the default key, the dialecte's extensions
|
|
6
|
-
* merged under the consumer's, and a fresh hooks instance per Project. It carries the declaration
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* dialecte's project of that name on
|
|
6
|
+
* merged under the consumer's, and a fresh hooks instance per Project. It carries the declaration and names no store:
|
|
7
|
+
* each Project it makes opens on the `storage` given to it, core's own or a kind an entry registers (SQLite storage
|
|
8
|
+
* with `@dialecte/core/sqlite`, whose page tells once where its engine worker is). `destroyProject({ name, storage })`
|
|
9
|
+
* deletes the dialecte's project of that name on that storage without opening it (one a store cannot open too).
|
|
10
10
|
*
|
|
11
|
-
* @intent open projects of a dialecte from an app, get the factory that creates a dialecte's projects, delete a dialecte's project without opening it,
|
|
11
|
+
* @intent open projects of a dialecte from an app, get the factory that creates a dialecte's projects, delete a dialecte's project without opening it, use SQLite storage in an app (register the app's engine with `registerSqliteEngine` from `@dialecte/core/sqlite` and open with `storage: { type: 'sqlite' }`), share one SQLite engine per project between the tabs of an app
|
|
12
12
|
*/
|
|
13
13
|
export declare function createProjectFactory<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, GenericConfigKey extends string = string>(params: CreateProjectFactoryParams<GenericConfig, GenericModules, GenericConfigKey>): ProjectFactory<GenericConfig, GenericModules, GenericConfigKey>;
|
|
14
14
|
//# sourceMappingURL=create-project-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project-factory.d.ts","sourceRoot":"","sources":["../../src/dialecte/create-project-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,0BAA0B,EAE1B,cAAc,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"create-project-factory.d.ts","sourceRoot":"","sources":["../../src/dialecte/create-project-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,0BAA0B,EAE1B,cAAc,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,gBAAgB,SAAS,MAAM,GAAG,MAAM,EAExC,MAAM,EAAE,0BAA0B,CAAC,aAAa,EAAE,cAAc,EAAE,gBAAgB,CAAC,GACjF,cAAc,CAAC,aAAa,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAqCjE"}
|
|
@@ -3,8 +3,8 @@ import { ExtensionModules } from '../document';
|
|
|
3
3
|
import { AnyDialecteConfig } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Declare a dialecte once: its identity, its configs, its extensions and how its hooks are made.
|
|
6
|
-
* Core derives the rest: `createProjectFactory`, `createTestRunner`, `createTestProject` and
|
|
7
|
-
*
|
|
6
|
+
* Core derives the rest: `createProjectFactory`, `createTestRunner`, `createTestProject` and
|
|
7
|
+
* what a store serving it elsewhere runs (SQLite's engine worker). The declaration is frozen.
|
|
8
8
|
*
|
|
9
9
|
* @intent declare a dialecte package, register a dialecte's configs and extensions and hooks once, set up a new dialecte
|
|
10
10
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ExtensionModules } from '../document';
|
|
2
2
|
import { Project, StorageParam } from '../project';
|
|
3
|
-
import { HubEngineSpawner } from '../store';
|
|
4
3
|
import { AnyDialecteConfig, DialecteHooks } from '../types';
|
|
5
|
-
/** What a dialecte gives `defineDialecte`: everything core derives a Project, a test runner and
|
|
4
|
+
/** What a dialecte gives `defineDialecte`: everything core derives a Project, a test runner and a store's runtime from. */
|
|
6
5
|
export type DefineDialecteParams<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, GenericConfigKey extends string = string> = {
|
|
7
|
-
/** The dialecte's identity:
|
|
6
|
+
/** The dialecte's identity: a store keeps it with each project, so two dialectes' projects of one name stay apart. */
|
|
8
7
|
id: string;
|
|
9
|
-
/** The dialecte package's version: a
|
|
8
|
+
/** The dialecte package's version: a view and a store that runs the dialecte elsewhere must run the same one. */
|
|
10
9
|
version: string;
|
|
11
10
|
/** Every config of the dialecte, under the keys `configKey` names them by. */
|
|
12
11
|
configs: Record<GenericConfigKey, GenericConfig>;
|
|
@@ -15,8 +14,8 @@ export type DefineDialecteParams<GenericConfig extends AnyDialecteConfig, Generi
|
|
|
15
14
|
/** The dialecte's own extension modules, merged under the ones a consumer adds per project. */
|
|
16
15
|
extensions?: GenericModules;
|
|
17
16
|
/**
|
|
18
|
-
* Makes the dialecte's hooks (IO and transaction). Called once per Project and once per
|
|
19
|
-
* the state a hook keeps belongs to that one owner, never shared across realms.
|
|
17
|
+
* Makes the dialecte's hooks (IO and transaction). Called once per Project and once per store that runs the dialecte
|
|
18
|
+
* elsewhere: the state a hook keeps belongs to that one owner, never shared across realms.
|
|
20
19
|
*/
|
|
21
20
|
createHooks?: () => DialecteHooks<GenericConfig>;
|
|
22
21
|
};
|
|
@@ -31,12 +30,6 @@ export type DialecteDeclaration<GenericConfig extends AnyDialecteConfig, Generic
|
|
|
31
30
|
};
|
|
32
31
|
export type CreateProjectFactoryParams<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, GenericConfigKey extends string = string> = {
|
|
33
32
|
dialecte: DialecteDeclaration<GenericConfig, GenericModules, GenericConfigKey>;
|
|
34
|
-
/**
|
|
35
|
-
* The address of the dialecte's engine worker: the URL its module exports from a `?worker&url`
|
|
36
|
-
* import of its worker entry. The store that runs the engine spawns
|
|
37
|
-
* `new Worker(engineUrl, { type: 'module' })` on it.
|
|
38
|
-
*/
|
|
39
|
-
engineUrl: string;
|
|
40
33
|
};
|
|
41
34
|
/** What a consumer chooses per project; everything else comes from the declaration. */
|
|
42
35
|
export type CreateProjectParams<CustomModules extends ExtensionModules = Record<never, never>> = {
|
|
@@ -48,28 +41,23 @@ export type CreateProjectParams<CustomModules extends ExtensionModules = Record<
|
|
|
48
41
|
perf?: boolean;
|
|
49
42
|
};
|
|
50
43
|
};
|
|
51
|
-
/**
|
|
52
|
-
* Makes a Project of the dialecte: call it, then `open(name)`. Carries the declaration and the
|
|
53
|
-
* engine address it was made with.
|
|
54
|
-
*/
|
|
44
|
+
/** Makes a Project of the dialecte: call it, then `open(name)`. Carries the declaration it was made with. */
|
|
55
45
|
export type ProjectFactory<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, GenericConfigKey extends string = string> = {
|
|
56
46
|
<CustomModules extends ExtensionModules = Record<never, never>>(params?: CreateProjectParams<CustomModules>): Project<GenericConfig, GenericModules & CustomModules>;
|
|
57
47
|
readonly dialecte: DialecteDeclaration<GenericConfig, GenericModules, GenericConfigKey>;
|
|
58
|
-
readonly engineUrl: string;
|
|
59
|
-
/** The dialecte's engine as a page registers it with the hub: `connectHub({ spawners: [factory.spawner] })`. */
|
|
60
|
-
readonly spawner: HubEngineSpawner;
|
|
61
48
|
/**
|
|
62
|
-
* Delete the dialecte's project of that name on
|
|
63
|
-
* `
|
|
49
|
+
* Delete the dialecte's project of that name on `storage` without opening it - any kind, core's own or a
|
|
50
|
+
* registered one (on SQLite, an `outdated` or `lost` project of `listProjects` too); refused
|
|
51
|
+
* `PROJECT_OPEN_ELSEWHERE` while another connection has it open, `PROJECT_STORAGE_NOT_REGISTERED` on a type no
|
|
52
|
+
* kind is registered for.
|
|
64
53
|
*/
|
|
65
54
|
readonly destroyProject: (params: {
|
|
66
55
|
name: string;
|
|
56
|
+
storage: StorageParam;
|
|
67
57
|
}) => Promise<void>;
|
|
68
58
|
};
|
|
69
59
|
/** What every Project of a dialecte is made from: the declaration and what one consumer chooses. */
|
|
70
60
|
export type CreateDialecteProjectParams<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>, CustomModules extends ExtensionModules = Record<never, never>> = CreateProjectParams<CustomModules> & {
|
|
71
61
|
dialecte: DialecteDeclaration<GenericConfig, GenericModules, string>;
|
|
72
|
-
/** The address of the dialecte's engine worker, from its project factory: `sqlite` storage needs it. */
|
|
73
|
-
engineUrl?: string;
|
|
74
62
|
};
|
|
75
63
|
//# sourceMappingURL=dialecte.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialecte.types.d.ts","sourceRoot":"","sources":["../../src/dialecte/dialecte.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dialecte.types.d.ts","sourceRoot":"","sources":["../../src/dialecte/dialecte.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE/D,2HAA2H;AAC3H,MAAM,MAAM,oBAAoB,CAC/B,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,gBAAgB,SAAS,MAAM,GAAG,MAAM,IACrC;IACH,sHAAsH;IACtH,EAAE,EAAE,MAAM,CAAA;IACV,iHAAiH;IACjH,OAAO,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;IAChD,qDAAqD;IACrD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC3C,+FAA+F;IAC/F,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,aAAa,CAAC,aAAa,CAAC,CAAA;CAChD,CAAA;AAED,2FAA2F;AAC3F,MAAM,MAAM,mBAAmB,CAC9B,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,gBAAgB,SAAS,MAAM,GAAG,MAAM,IACrC;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAA;IACnE,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;IAC3C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAA;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,aAAa,CAAC,aAAa,CAAC,CAAA;CACxD,CAAA;AAED,MAAM,MAAM,0BAA0B,CACrC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,gBAAgB,SAAS,MAAM,GAAG,MAAM,IACrC;IACH,QAAQ,EAAE,mBAAmB,CAAC,aAAa,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAA;CAC9E,CAAA;AAED,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,CAAC,aAAa,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IAChG,mCAAmC;IACnC,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,wEAAwE;IACxE,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CACxB,CAAA;AAED,6GAA6G;AAC7G,MAAM,MAAM,cAAc,CACzB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,gBAAgB,SAAS,MAAM,GAAG,MAAM,IACrC;IACH,CAAC,aAAa,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7D,MAAM,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,GACzC,OAAO,CAAC,aAAa,EAAE,cAAc,GAAG,aAAa,CAAC,CAAA;IACzD,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC,aAAa,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAA;IACvF;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3F,CAAA;AAED,oGAAoG;AACpG,MAAM,MAAM,2BAA2B,CACtC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9D,aAAa,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAC1D,mBAAmB,CAAC,aAAa,CAAC,GAAG;IACxC,QAAQ,EAAE,mBAAmB,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,CAAC,CAAA;CACpE,CAAA"}
|