@minca/core 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/elements/auth-styles.d.ts +1 -1
- package/dist/elements/auth-styles.d.ts.map +1 -1
- package/dist/elements/auth-styles.js +21 -4
- package/dist/elements/auth-styles.js.map +1 -1
- package/dist/elements/minca-auth.d.ts.map +1 -1
- package/dist/elements/minca-auth.js +151 -57
- package/dist/elements/minca-auth.js.map +1 -1
- package/dist/identity/abilities.d.ts +2 -0
- package/dist/identity/abilities.d.ts.map +1 -1
- package/dist/identity/abilities.js +2 -0
- package/dist/identity/abilities.js.map +1 -1
- package/dist/identity/account-vault.d.ts +15 -71
- package/dist/identity/account-vault.d.ts.map +1 -1
- package/dist/identity/account-vault.js +45 -104
- package/dist/identity/account-vault.js.map +1 -1
- package/dist/identity/channel.d.ts +3 -9
- package/dist/identity/channel.d.ts.map +1 -1
- package/dist/identity/channel.js +42 -42
- package/dist/identity/channel.js.map +1 -1
- package/dist/identity/contact-key.d.ts +14 -29
- package/dist/identity/contact-key.d.ts.map +1 -1
- package/dist/identity/contact-key.js +31 -51
- package/dist/identity/contact-key.js.map +1 -1
- package/dist/identity/crypto-p256.d.ts.map +1 -1
- package/dist/identity/crypto-p256.js +39 -53
- package/dist/identity/crypto-p256.js.map +1 -1
- package/dist/identity/hpke.d.ts.map +1 -1
- package/dist/identity/hpke.js +19 -19
- package/dist/identity/hpke.js.map +1 -1
- package/dist/identity/identity-manager.d.ts.map +1 -1
- package/dist/identity/identity-manager.js +1 -2
- package/dist/identity/identity-manager.js.map +1 -1
- package/dist/identity/policy.d.ts.map +1 -1
- package/dist/identity/policy.js +35 -61
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/recovery-code.d.ts +2 -8
- package/dist/identity/recovery-code.d.ts.map +1 -1
- package/dist/identity/recovery-code.js +4 -11
- package/dist/identity/recovery-code.js.map +1 -1
- package/dist/identity/root-signer.d.ts +1 -6
- package/dist/identity/root-signer.d.ts.map +1 -1
- package/dist/identity/root-signer.js +12 -15
- package/dist/identity/root-signer.js.map +1 -1
- package/dist/identity/ucan.d.ts.map +1 -1
- package/dist/identity/ucan.js +48 -39
- package/dist/identity/ucan.js.map +1 -1
- package/dist/identity/webauthn.d.ts +6 -11
- package/dist/identity/webauthn.d.ts.map +1 -1
- package/dist/identity/webauthn.js +18 -30
- package/dist/identity/webauthn.js.map +1 -1
- package/dist/inbox/inbox.d.ts.map +1 -1
- package/dist/inbox/inbox.js +40 -30
- package/dist/inbox/inbox.js.map +1 -1
- package/dist/inbox/index.d.ts +2 -0
- package/dist/inbox/index.d.ts.map +1 -1
- package/dist/inbox/index.js +1 -0
- package/dist/inbox/index.js.map +1 -1
- package/dist/inbox/names.d.ts +54 -0
- package/dist/inbox/names.d.ts.map +1 -0
- package/dist/inbox/names.js +299 -0
- package/dist/inbox/names.js.map +1 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -12
- package/dist/index.js.map +1 -1
- package/dist/network/mesh.d.ts +7 -20
- package/dist/network/mesh.d.ts.map +1 -1
- package/dist/network/mesh.js +267 -245
- package/dist/network/mesh.js.map +1 -1
- package/dist/network/relay-link.d.ts +31 -0
- package/dist/network/relay-link.d.ts.map +1 -0
- package/dist/network/relay-link.js +62 -0
- package/dist/network/relay-link.js.map +1 -0
- package/dist/network/relay-minca.d.ts.map +1 -1
- package/dist/network/relay-minca.js +11 -49
- package/dist/network/relay-minca.js.map +1 -1
- package/dist/network/relay-nostr.d.ts.map +1 -1
- package/dist/network/relay-nostr.js +23 -63
- package/dist/network/relay-nostr.js.map +1 -1
- package/dist/network/relay-socket.d.ts +1 -1
- package/dist/network/relay-socket.d.ts.map +1 -1
- package/dist/network/relay-socket.js +3 -1
- package/dist/network/relay-socket.js.map +1 -1
- package/dist/node/actions.d.ts.map +1 -1
- package/dist/node/actions.js +50 -38
- package/dist/node/actions.js.map +1 -1
- package/dist/node/api.d.ts +6 -0
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +6 -0
- package/dist/node/api.js.map +1 -1
- package/dist/node/carrier.d.ts +5 -0
- package/dist/node/carrier.d.ts.map +1 -1
- package/dist/node/carrier.js +94 -73
- package/dist/node/carrier.js.map +1 -1
- package/dist/node/copy.d.ts +8 -7
- package/dist/node/copy.d.ts.map +1 -1
- package/dist/node/copy.js +54 -56
- package/dist/node/copy.js.map +1 -1
- package/dist/node/host.d.ts +39 -65
- package/dist/node/host.d.ts.map +1 -1
- package/dist/node/host.js +362 -379
- package/dist/node/host.js.map +1 -1
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/node-carriers.d.ts +35 -0
- package/dist/node/node-carriers.d.ts.map +1 -0
- package/dist/node/node-carriers.js +562 -0
- package/dist/node/node-carriers.js.map +1 -0
- package/dist/node/node-contacts.d.ts +11 -0
- package/dist/node/node-contacts.d.ts.map +1 -0
- package/dist/node/node-contacts.js +808 -0
- package/dist/node/node-contacts.js.map +1 -0
- package/dist/node/node-context.d.ts +76 -0
- package/dist/node/node-context.d.ts.map +1 -0
- package/dist/node/node-context.js +54 -0
- package/dist/node/node-context.js.map +1 -0
- package/dist/node/node-hosting.d.ts +20 -0
- package/dist/node/node-hosting.d.ts.map +1 -0
- package/dist/node/node-hosting.js +449 -0
- package/dist/node/node-hosting.js.map +1 -0
- package/dist/node/node-records.d.ts +18 -0
- package/dist/node/node-records.d.ts.map +1 -0
- package/dist/node/node-records.js +262 -0
- package/dist/node/node-records.js.map +1 -0
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +198 -1990
- package/dist/node/node.js.map +1 -1
- package/dist/node/remote.d.ts +5 -6
- package/dist/node/remote.d.ts.map +1 -1
- package/dist/node/remote.js +272 -260
- package/dist/node/remote.js.map +1 -1
- package/dist/node/space-catalog.d.ts +40 -0
- package/dist/node/space-catalog.d.ts.map +1 -0
- package/dist/node/space-catalog.js +158 -0
- package/dist/node/space-catalog.js.map +1 -0
- package/dist/node/space-checks.d.ts +25 -0
- package/dist/node/space-checks.d.ts.map +1 -0
- package/dist/node/space-checks.js +343 -0
- package/dist/node/space-checks.js.map +1 -0
- package/dist/node/space-history.d.ts +37 -0
- package/dist/node/space-history.d.ts.map +1 -0
- package/dist/node/space-history.js +350 -0
- package/dist/node/space-history.js.map +1 -0
- package/dist/node/space-holding.d.ts +49 -0
- package/dist/node/space-holding.d.ts.map +1 -0
- package/dist/node/space-holding.js +267 -0
- package/dist/node/space-holding.js.map +1 -0
- package/dist/node/space-index.d.ts +41 -0
- package/dist/node/space-index.d.ts.map +1 -0
- package/dist/node/space-index.js +217 -0
- package/dist/node/space-index.js.map +1 -0
- package/dist/node/space-keys.d.ts +34 -0
- package/dist/node/space-keys.d.ts.map +1 -0
- package/dist/node/space-keys.js +309 -0
- package/dist/node/space-keys.js.map +1 -0
- package/dist/node/space-lines.d.ts +33 -0
- package/dist/node/space-lines.d.ts.map +1 -0
- package/dist/node/space-lines.js +145 -0
- package/dist/node/space-lines.js.map +1 -0
- package/dist/node/space-membership.d.ts +69 -0
- package/dist/node/space-membership.d.ts.map +1 -0
- package/dist/node/space-membership.js +242 -0
- package/dist/node/space-membership.js.map +1 -0
- package/dist/node/space-mirrors.d.ts +43 -0
- package/dist/node/space-mirrors.d.ts.map +1 -0
- package/dist/node/space-mirrors.js +125 -0
- package/dist/node/space-mirrors.js.map +1 -0
- package/dist/node/space-peers.d.ts +104 -0
- package/dist/node/space-peers.d.ts.map +1 -0
- package/dist/node/space-peers.js +595 -0
- package/dist/node/space-peers.js.map +1 -0
- package/dist/node/space-profiles.d.ts +18 -0
- package/dist/node/space-profiles.d.ts.map +1 -0
- package/dist/node/space-profiles.js +105 -0
- package/dist/node/space-profiles.js.map +1 -0
- package/dist/node/space-rules.d.ts +29 -0
- package/dist/node/space-rules.d.ts.map +1 -0
- package/dist/node/space-rules.js +144 -0
- package/dist/node/space-rules.js.map +1 -0
- package/dist/node/space-runtime.d.ts +103 -142
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +290 -3963
- package/dist/node/space-runtime.js.map +1 -1
- package/dist/node/space-standing.d.ts +20 -0
- package/dist/node/space-standing.d.ts.map +1 -0
- package/dist/node/space-standing.js +317 -0
- package/dist/node/space-standing.js.map +1 -0
- package/dist/node/space-versions.d.ts +104 -0
- package/dist/node/space-versions.d.ts.map +1 -0
- package/dist/node/space-versions.js +153 -0
- package/dist/node/space-versions.js.map +1 -0
- package/dist/node/space-warrants.d.ts +25 -0
- package/dist/node/space-warrants.d.ts.map +1 -0
- package/dist/node/space-warrants.js +214 -0
- package/dist/node/space-warrants.js.map +1 -0
- package/dist/node/space-writing.d.ts +72 -0
- package/dist/node/space-writing.d.ts.map +1 -0
- package/dist/node/space-writing.js +440 -0
- package/dist/node/space-writing.js.map +1 -0
- package/dist/node/stores.d.ts +19 -50
- package/dist/node/stores.d.ts.map +1 -1
- package/dist/node/stores.js +14 -33
- package/dist/node/stores.js.map +1 -1
- package/dist/node/types.d.ts +225 -306
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/usage.d.ts +2 -24
- package/dist/node/usage.d.ts.map +1 -1
- package/dist/node/usage.js +118 -102
- package/dist/node/usage.js.map +1 -1
- package/dist/node/watch-notifications.d.ts.map +1 -1
- package/dist/node/watch-notifications.js +32 -29
- package/dist/node/watch-notifications.js.map +1 -1
- package/dist/node/worker.d.ts +5 -6
- package/dist/node/worker.d.ts.map +1 -1
- package/dist/node/worker.js +80 -72
- package/dist/node/worker.js.map +1 -1
- package/dist/node/writer-keys.d.ts +5 -6
- package/dist/node/writer-keys.d.ts.map +1 -1
- package/dist/node/writer-keys.js +66 -57
- package/dist/node/writer-keys.js.map +1 -1
- package/dist/node/writers.d.ts +12 -19
- package/dist/node/writers.d.ts.map +1 -1
- package/dist/node/writers.js +7 -15
- package/dist/node/writers.js.map +1 -1
- package/dist/privacy/direct.d.ts.map +1 -1
- package/dist/privacy/direct.js +31 -27
- package/dist/privacy/direct.js.map +1 -1
- package/dist/privacy/space-encryption.d.ts.map +1 -1
- package/dist/privacy/space-encryption.js +5 -9
- package/dist/privacy/space-encryption.js.map +1 -1
- package/dist/query/computed.d.ts.map +1 -1
- package/dist/query/computed.js +78 -77
- package/dist/query/computed.js.map +1 -1
- package/dist/query/engine.d.ts +3 -4
- package/dist/query/engine.d.ts.map +1 -1
- package/dist/query/engine.js +93 -86
- package/dist/query/engine.js.map +1 -1
- package/dist/query/filter.d.ts +8 -10
- package/dist/query/filter.d.ts.map +1 -1
- package/dist/query/filter.js +144 -161
- package/dist/query/filter.js.map +1 -1
- package/dist/records/cel-types.d.ts.map +1 -1
- package/dist/records/cel-types.js +13 -27
- package/dist/records/cel-types.js.map +1 -1
- package/dist/records/cel.d.ts.map +1 -1
- package/dist/records/cel.js +177 -242
- package/dist/records/cel.js.map +1 -1
- package/dist/records/rules.d.ts.map +1 -1
- package/dist/records/rules.js +46 -50
- package/dist/records/rules.js.map +1 -1
- package/dist/records/topics.d.ts.map +1 -1
- package/dist/records/topics.js +18 -22
- package/dist/records/topics.js.map +1 -1
- package/dist/schemas/automations.d.ts +8 -15
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +203 -165
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/blueprints.d.ts.map +1 -1
- package/dist/schemas/blueprints.js +14 -13
- package/dist/schemas/blueprints.js.map +1 -1
- package/dist/schemas/connectors.d.ts.map +1 -1
- package/dist/schemas/connectors.js +16 -11
- package/dist/schemas/connectors.js.map +1 -1
- package/dist/schemas/contacts.d.ts +57 -0
- package/dist/schemas/contacts.d.ts.map +1 -1
- package/dist/schemas/contacts.js +32 -0
- package/dist/schemas/contacts.js.map +1 -1
- package/dist/schemas/cron.d.ts.map +1 -1
- package/dist/schemas/cron.js +27 -28
- package/dist/schemas/cron.js.map +1 -1
- package/dist/schemas/defined.d.ts +6 -0
- package/dist/schemas/defined.d.ts.map +1 -0
- package/dist/schemas/defined.js +7 -0
- package/dist/schemas/defined.js.map +1 -0
- package/dist/schemas/guides.d.ts +3 -1
- package/dist/schemas/guides.d.ts.map +1 -1
- package/dist/schemas/guides.js +13 -12
- package/dist/schemas/guides.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +18 -14
- package/dist/schemas/index.js.map +1 -1
- package/dist/session/account-hint.d.ts.map +1 -1
- package/dist/session/account-hint.js +8 -5
- package/dist/session/account-hint.js.map +1 -1
- package/dist/session/auth.d.ts +36 -2
- package/dist/session/auth.d.ts.map +1 -1
- package/dist/session/auth.js +95 -2
- package/dist/session/auth.js.map +1 -1
- package/dist/session/connect.d.ts +1 -0
- package/dist/session/connect.d.ts.map +1 -1
- package/dist/session/connect.js +3 -1
- package/dist/session/connect.js.map +1 -1
- package/dist/session/credentials.d.ts +8 -26
- package/dist/session/credentials.d.ts.map +1 -1
- package/dist/session/credentials.js +14 -32
- package/dist/session/credentials.js.map +1 -1
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/index.js.map +1 -1
- package/dist/session/pairing.d.ts.map +1 -1
- package/dist/session/pairing.js +92 -88
- package/dist/session/pairing.js.map +1 -1
- package/dist/session/password-strength.d.ts.map +1 -1
- package/dist/session/password-strength.js +37 -37
- package/dist/session/password-strength.js.map +1 -1
- package/dist/session/places.d.ts.map +1 -1
- package/dist/session/places.js +18 -13
- package/dist/session/places.js.map +1 -1
- package/dist/session/popup.d.ts +13 -0
- package/dist/session/popup.d.ts.map +1 -0
- package/dist/session/popup.js +23 -0
- package/dist/session/popup.js.map +1 -0
- package/dist/space/constitution.d.ts.map +1 -1
- package/dist/space/constitution.js +22 -29
- package/dist/space/constitution.js.map +1 -1
- package/dist/space/grants.d.ts.map +1 -1
- package/dist/space/grants.js +37 -39
- package/dist/space/grants.js.map +1 -1
- package/dist/space/invite-link.d.ts.map +1 -1
- package/dist/space/invite-link.js +33 -33
- package/dist/space/invite-link.js.map +1 -1
- package/dist/space/own-automations.d.ts +13 -24
- package/dist/space/own-automations.d.ts.map +1 -1
- package/dist/space/own-automations.js +47 -37
- package/dist/space/own-automations.js.map +1 -1
- package/dist/space/roles.d.ts +56 -80
- package/dist/space/roles.d.ts.map +1 -1
- package/dist/space/roles.js +448 -441
- package/dist/space/roles.js.map +1 -1
- package/dist/space/space-access.d.ts +3 -4
- package/dist/space/space-access.d.ts.map +1 -1
- package/dist/space/space-access.js +3 -8
- package/dist/space/space-access.js.map +1 -1
- package/dist/storage/blob/directory.d.ts.map +1 -1
- package/dist/storage/blob/directory.js +39 -32
- package/dist/storage/blob/directory.js.map +1 -1
- package/dist/storage/blob/s3.d.ts.map +1 -1
- package/dist/storage/blob/s3.js +21 -19
- package/dist/storage/blob/s3.js.map +1 -1
- package/dist/storage/blob-store.d.ts +0 -9
- package/dist/storage/blob-store.d.ts.map +1 -1
- package/dist/storage/directory-access.d.ts +8 -32
- package/dist/storage/directory-access.d.ts.map +1 -1
- package/dist/storage/directory-access.js +11 -36
- package/dist/storage/directory-access.js.map +1 -1
- package/dist/storage/encrypted-adapter.d.ts +12 -32
- package/dist/storage/encrypted-adapter.d.ts.map +1 -1
- package/dist/storage/encrypted-adapter.js +31 -54
- package/dist/storage/encrypted-adapter.js.map +1 -1
- package/dist/storage/folder-adapter.d.ts +12 -26
- package/dist/storage/folder-adapter.d.ts.map +1 -1
- package/dist/storage/folder-adapter.js +37 -54
- package/dist/storage/folder-adapter.js.map +1 -1
- package/dist/storage/folder-reconcile.d.ts +12 -26
- package/dist/storage/folder-reconcile.d.ts.map +1 -1
- package/dist/storage/folder-reconcile.js +39 -48
- package/dist/storage/folder-reconcile.js.map +1 -1
- package/dist/storage/indexeddb-adapter.d.ts +2 -6
- package/dist/storage/indexeddb-adapter.d.ts.map +1 -1
- package/dist/storage/indexeddb-adapter.js +60 -114
- package/dist/storage/indexeddb-adapter.js.map +1 -1
- package/dist/storage/mirror.d.ts +0 -29
- package/dist/storage/mirror.d.ts.map +1 -1
- package/dist/storage/mirror.js +153 -110
- package/dist/storage/mirror.js.map +1 -1
- package/dist/storage/segment.d.ts.map +1 -1
- package/dist/storage/segment.js +3 -7
- package/dist/storage/segment.js.map +1 -1
- package/dist/storage/storage-provider.d.ts +6 -11
- package/dist/storage/storage-provider.d.ts.map +1 -1
- package/dist/storage/storage-provider.js +112 -116
- package/dist/storage/storage-provider.js.map +1 -1
- package/dist/sync/sync-engine.d.ts +10 -44
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-engine.js +245 -247
- package/dist/sync/sync-engine.js.map +1 -1
- package/dist/sync/sync-messages.d.ts +1 -1
- package/dist/sync/sync-messages.d.ts.map +1 -1
- package/dist/sync/sync-messages.js +1 -1
- package/dist/sync/sync-messages.js.map +1 -1
- package/dist/utils/guards.d.ts +1 -0
- package/dist/utils/guards.d.ts.map +1 -1
- package/dist/utils/guards.js +1 -0
- package/dist/utils/guards.js.map +1 -1
- package/dist/utils/hmac.d.ts +5 -0
- package/dist/utils/hmac.d.ts.map +1 -0
- package/dist/utils/hmac.js +20 -0
- package/dist/utils/hmac.js.map +1 -0
- package/dist/utils/map.d.ts +10 -0
- package/dist/utils/map.d.ts.map +1 -0
- package/dist/utils/map.js +30 -0
- package/dist/utils/map.js.map +1 -0
- package/dist/utils/serial.d.ts +2 -0
- package/dist/utils/serial.d.ts.map +1 -1
- package/dist/utils/serial.js +9 -0
- package/dist/utils/serial.js.map +1 -1
- package/dist/validation/capability-gate.d.ts +7 -15
- package/dist/validation/capability-gate.d.ts.map +1 -1
- package/dist/validation/capability-gate.js +32 -36
- package/dist/validation/capability-gate.js.map +1 -1
- package/dist/validation/crypto-gate.d.ts.map +1 -1
- package/dist/validation/crypto-gate.js +12 -21
- package/dist/validation/crypto-gate.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/actions.md +1 -1
- package/docs/automations.md +1 -1
- package/docs/blueprints-and-guides.md +17 -1
- package/docs/building-an-app.md +7 -4
- package/docs/collections.md +3 -3
- package/docs/contacts.md +34 -1
- package/docs/contracts.md +1 -1
- package/docs/direct-messages.md +1 -1
- package/docs/inbox.md +5 -11
- package/docs/node.md +22 -14
- package/docs/records-and-queries.md +1 -1
- package/docs/sign-in.md +54 -26
- package/docs/spaces.md +6 -6
- package/docs/standard-library.md +7 -6
- package/docs/storage.md +4 -5
- package/docs/usernames.md +161 -0
- package/docs/warrants.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { accessRequirement, actsForAccount, noteGrants } from '../identity/abilities.js';
|
|
2
|
+
import { createVersion, isStub } from '../schema/version.js';
|
|
3
|
+
import { MAX_SEEN, nextVersion } from '../records/version.js';
|
|
4
|
+
import { keyKind, newRecordKey, onePerForm, ownedKey, ownsKey, RECORD_KEY_PATTERN } from '../records/key.js';
|
|
5
|
+
import { hasContract } from '../records/contracts.js';
|
|
6
|
+
import { isSealedBody, sealBody } from '../privacy/space-encryption.js';
|
|
7
|
+
import { BOX_COLLECTION, MEMBER_KEY_COLLECTION, assignKey, removalKey, roleKey, stepDownKey, WARRANT_COLLECTION, } from '../space/space-access.js';
|
|
8
|
+
import { ACCESS_COLLECTIONS, ACCESS_KINDS, isMember, may, replayAccess, rolesOf, } from '../space/roles.js';
|
|
9
|
+
import { RECORD_DELETE, RECORD_WRITE } from '../space/grants.js';
|
|
10
|
+
import { fileRefsIn, MAX_FILES } from '../files/file-id.js';
|
|
11
|
+
import { CATALOG_COLLECTION } from '../schema/collection-def.js';
|
|
12
|
+
import { CARRIER_COLLECTION, MEMBERSHIP_COLLECTION, PROFILE_COLLECTION } from '../space/account-registry.js';
|
|
13
|
+
import { PASS_COLLECTION } from '../space/pass.js';
|
|
14
|
+
import { tagsFor } from '../records/topics.js';
|
|
15
|
+
import { isRecord } from '../utils/guards.js';
|
|
16
|
+
import { sealedKeyId, NO_CHECKS, } from './space-versions.js';
|
|
17
|
+
import { aboutItself } from './space-history.js';
|
|
18
|
+
/** Collections the node writes itself, through their own calls — never through `put` */
|
|
19
|
+
const MANAGED = new Set([
|
|
20
|
+
MEMBERSHIP_COLLECTION,
|
|
21
|
+
WARRANT_COLLECTION,
|
|
22
|
+
PROFILE_COLLECTION,
|
|
23
|
+
CARRIER_COLLECTION,
|
|
24
|
+
PASS_COLLECTION,
|
|
25
|
+
BOX_COLLECTION,
|
|
26
|
+
MEMBER_KEY_COLLECTION,
|
|
27
|
+
...ACCESS_COLLECTIONS,
|
|
28
|
+
]);
|
|
29
|
+
/**
|
|
30
|
+
* Access records a peer without the space key must still judge: who holds
|
|
31
|
+
* which role decides every write. Kept in the clear even in a private space.
|
|
32
|
+
* Collection definitions stay sealed: a peer that can't read the records has
|
|
33
|
+
* no use for their rules.
|
|
34
|
+
*/
|
|
35
|
+
const IN_THE_CLEAR = new Set([
|
|
36
|
+
...Object.values(ACCESS_KINDS)
|
|
37
|
+
.filter(({ clear }) => clear)
|
|
38
|
+
.map(({ collection }) => collection),
|
|
39
|
+
BOX_COLLECTION,
|
|
40
|
+
MEMBER_KEY_COLLECTION,
|
|
41
|
+
]);
|
|
42
|
+
/**
|
|
43
|
+
* Collections whose every version is kept whole. The access history is
|
|
44
|
+
* replayed whole; a warrant's proof is read back after anything written over it.
|
|
45
|
+
*/
|
|
46
|
+
const ALWAYS_RETAINED = new Set([
|
|
47
|
+
...ACCESS_COLLECTIONS,
|
|
48
|
+
WARRANT_COLLECTION,
|
|
49
|
+
PROFILE_COLLECTION,
|
|
50
|
+
BOX_COLLECTION,
|
|
51
|
+
MEMBER_KEY_COLLECTION,
|
|
52
|
+
]);
|
|
53
|
+
/** Said when a key's note doesn't let it define collections — it can propose them instead */
|
|
54
|
+
export const CANNOT_DEFINE = "This key's note doesn't let it add or change collections. Propose them instead (collections_propose), and someone who may adds them.";
|
|
55
|
+
const CANNOT_CHANGE_ACCESS = "This key's note doesn't let it change who may do what in a space. Ask the person.";
|
|
56
|
+
const NOT_ACCOUNT = "This key's note doesn't let it change the account itself. Ask the person.";
|
|
57
|
+
export function createWriting(deps) {
|
|
58
|
+
const { record, keyring, storage, signer, session } = deps;
|
|
59
|
+
const { space } = record;
|
|
60
|
+
const { judge, openBody, genesisOf, consistent } = deps.versions;
|
|
61
|
+
const { access, toEvent, accessGenesis } = deps.history;
|
|
62
|
+
const { rulesAt, tagKey, derivedKey } = deps.rules;
|
|
63
|
+
const { standingOf } = deps.standing;
|
|
64
|
+
const { checksOf } = deps.checks;
|
|
65
|
+
const { catalog, contentIssues } = deps.catalog;
|
|
66
|
+
const { currentOf, view } = deps.index;
|
|
67
|
+
const { currentKey } = deps.keys;
|
|
68
|
+
/** An invite waiting to be used — forgotten here once it is, whatever the stored record still says */
|
|
69
|
+
let waitingInvite = record.invite !== null;
|
|
70
|
+
/** Why this account cannot write here at all, or null when it can */
|
|
71
|
+
async function cannotWrite() {
|
|
72
|
+
const { history } = await access();
|
|
73
|
+
if (isMember(history.current, deps.rootDid))
|
|
74
|
+
return null;
|
|
75
|
+
return waitingInvite
|
|
76
|
+
? `You've joined "${space.name}", but its invite hasn't reached this device yet — connect to someone in the space first`
|
|
77
|
+
: `"${space.name}" was shared with you to view — you can't change it`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The heads a new version names: all of them, or past what a version may
|
|
81
|
+
* name, first those its own standing rests on (its author's place, its
|
|
82
|
+
* role, its collection's definition), then the latest applied. Naming fewer
|
|
83
|
+
* is safe: what it leaves out it is judged as not having seen (03 §3.2).
|
|
84
|
+
*/
|
|
85
|
+
async function seenFor(history, collection) {
|
|
86
|
+
const roles = rolesOf(history.current, deps.rootDid);
|
|
87
|
+
const mine = [
|
|
88
|
+
await removalKey(deps.rootDid),
|
|
89
|
+
await stepDownKey(deps.rootDid),
|
|
90
|
+
...(await Promise.all(roles.map((role) => assignKey(deps.rootDid, role)))),
|
|
91
|
+
...roles.map(roleKey),
|
|
92
|
+
`collection:${collection}`,
|
|
93
|
+
];
|
|
94
|
+
return history.headsFor(mine, MAX_SEEN);
|
|
95
|
+
}
|
|
96
|
+
/** Signs and stores one version. A delete carries no body. */
|
|
97
|
+
async function write(collection, body, version, deleted = false, links = [], options = {}) {
|
|
98
|
+
const writer = options.as ?? session;
|
|
99
|
+
const asAccount = deps.accountOnly || aboutItself(collection, body, deps.rootDid, writer.did);
|
|
100
|
+
if (asAccount && !actsForAccount(writer.proof()))
|
|
101
|
+
throw new Error(NOT_ACCOUNT);
|
|
102
|
+
// Every peer would ignore it (see buildEvent); say why here instead.
|
|
103
|
+
if (ACCESS_COLLECTIONS.has(collection) &&
|
|
104
|
+
!noteGrants(writer.proof(), accessRequirement(space.id, collection, version.key))) {
|
|
105
|
+
throw new Error(collection === CATALOG_COLLECTION ? CANNOT_DEFINE : CANNOT_CHANGE_ACCESS);
|
|
106
|
+
}
|
|
107
|
+
// Every other copy would refuse it, so refuse it here rather than show a
|
|
108
|
+
// change that exists on this device alone.
|
|
109
|
+
if (!options.joining) {
|
|
110
|
+
const problem = await cannotWrite();
|
|
111
|
+
if (problem)
|
|
112
|
+
throw new Error(problem);
|
|
113
|
+
}
|
|
114
|
+
let payload = null;
|
|
115
|
+
let tags = [];
|
|
116
|
+
// The files the body refers to, named on the outside so keepers fetch and keep them.
|
|
117
|
+
const named = deleted ? [] : fileRefsIn(body);
|
|
118
|
+
if (named.length > MAX_FILES)
|
|
119
|
+
throw new Error(`A record names at most ${MAX_FILES} files`);
|
|
120
|
+
if (!deleted) {
|
|
121
|
+
// Refused here, where the writer can fix it. On arrival a misfit is kept
|
|
122
|
+
// and flagged instead — see `conforms`.
|
|
123
|
+
const issues = await contentIssues(collection, body, links);
|
|
124
|
+
if (issues?.length) {
|
|
125
|
+
throw new Error(`Not a valid ${collection}: ${issues.map((i) => (i.path === '/' ? i.message : `${i.path} ${i.message}`)).join('; ')}`);
|
|
126
|
+
}
|
|
127
|
+
// Encrypt *before* signing: peers without the key still verify the
|
|
128
|
+
// signature and relay the record, they just cannot read it.
|
|
129
|
+
payload = body;
|
|
130
|
+
if (space.visibility === 'private' && !IN_THE_CLEAR.has(collection)) {
|
|
131
|
+
// Always the key the history names now: one someone removed still holds would do nothing.
|
|
132
|
+
const key = currentKey((await access()).history.current);
|
|
133
|
+
if (!key) {
|
|
134
|
+
throw new Error(keyring.size
|
|
135
|
+
? `The key of "${space.name}" changed, and the new one hasn't reached this device yet — connect to someone in the space first`
|
|
136
|
+
: 'This private space has no key on this node');
|
|
137
|
+
}
|
|
138
|
+
// Body and links sealed together: a relay learns neither.
|
|
139
|
+
const content = links.length ? { body, links } : { body };
|
|
140
|
+
payload = await sealBody(content, key, { space: space.id, collection, key: version.key });
|
|
141
|
+
}
|
|
142
|
+
// Worked out from the body, with the key it is sealed with: what every reader will check.
|
|
143
|
+
const topics = collection.startsWith('sys.')
|
|
144
|
+
? []
|
|
145
|
+
: ((await catalog()).get(collection)?.definition.topics ?? []);
|
|
146
|
+
if (topics.length) {
|
|
147
|
+
const sealedWith = isSealedBody(payload) ? sealedKeyId(payload) : null;
|
|
148
|
+
const key = tagKey(sealedWith);
|
|
149
|
+
if (key)
|
|
150
|
+
tags = await tagsFor(await key, collection, topics, body, links);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Whether superseded versions are kept is the writer's decision, carried
|
|
154
|
+
// on the version — never each reader's, or nodes that had seen different
|
|
155
|
+
// definitions would store different things and never converge. The access
|
|
156
|
+
// history keeps everything: it is replayed whole. A first version under
|
|
157
|
+
// `onePer` or `fixed` is kept whole, because those rules are checked against it.
|
|
158
|
+
const definition = (await catalog()).get(collection)?.definition;
|
|
159
|
+
const retain = ALWAYS_RETAINED.has(collection) ||
|
|
160
|
+
definition?.history === 'all' ||
|
|
161
|
+
(version.seq === 0 && !!(definition?.rules?.onePer || definition?.rules?.fixed)) ||
|
|
162
|
+
// Every version under a contract: it reads the one before, and others cite it.
|
|
163
|
+
(!deleted && hasContract(definition?.contract));
|
|
164
|
+
// The next place in this key's line for the collection: given back if the version is refused below.
|
|
165
|
+
const signed = await deps.writers.append(writer.did, space.id, collection, async (log) => {
|
|
166
|
+
const { history, events: held } = await access();
|
|
167
|
+
const seen = await seenFor(history, collection);
|
|
168
|
+
// Checks in force as of the very point it names: a definition arriving meanwhile can't leave it unkept.
|
|
169
|
+
const checkedThen = (() => {
|
|
170
|
+
const then = history.at(seen);
|
|
171
|
+
return then ? rulesAt(then, collection) : null;
|
|
172
|
+
})();
|
|
173
|
+
const then = await checkedThen;
|
|
174
|
+
const keep = retain || (!deleted && hasContract(then?.contract));
|
|
175
|
+
const made = await signer.sign(createVersion({
|
|
176
|
+
author: writer.did,
|
|
177
|
+
collection,
|
|
178
|
+
space: space.id,
|
|
179
|
+
body: payload,
|
|
180
|
+
proof: writer.proof(),
|
|
181
|
+
version,
|
|
182
|
+
retain: keep,
|
|
183
|
+
deleted,
|
|
184
|
+
seen,
|
|
185
|
+
// In the clear only where the body is: a private space sealed them above.
|
|
186
|
+
...(space.visibility === 'public' && !deleted && links.length ? { links } : {}),
|
|
187
|
+
...(tags.length ? { tags } : {}),
|
|
188
|
+
...(named.length ? { files: named } : {}),
|
|
189
|
+
log,
|
|
190
|
+
}), writer.key);
|
|
191
|
+
// The same verdict every other peer will reach: refused here, with the reason, rather than there.
|
|
192
|
+
const judged = await judge(made);
|
|
193
|
+
if (!judged.verified)
|
|
194
|
+
throw new Error(judged.reason ?? 'This key may not write here.');
|
|
195
|
+
if (ACCESS_COLLECTIONS.has(collection)) {
|
|
196
|
+
const event = await toEvent(made);
|
|
197
|
+
if (!event)
|
|
198
|
+
throw new Error('That is not a well-formed change to who may do what');
|
|
199
|
+
const status = (history.extend(event) ?? replayAccess(accessGenesis, [...held, event])).status(event.id);
|
|
200
|
+
if (status?.status !== 'applied')
|
|
201
|
+
throw new Error(status?.status === 'dropped' ? status.reason : 'That change could not be made');
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const stands = await standingOf(made);
|
|
205
|
+
// Taken away by a change to its rules that came in after it saw the history: try again.
|
|
206
|
+
if (!stands.ok && stands.withdrawn)
|
|
207
|
+
throw Object.assign(new Error(stands.reason), { rulesMoved: true });
|
|
208
|
+
if (!stands.ok)
|
|
209
|
+
throw new Error(stands.reason);
|
|
210
|
+
// Its checks, here, before anyone else sees it: peers would keep it, but no reader would count it.
|
|
211
|
+
const passes = await checksOf(made);
|
|
212
|
+
if ('pending' in passes)
|
|
213
|
+
throw new Error('Versions it cites have not arrived yet');
|
|
214
|
+
if ('unjudged' in passes)
|
|
215
|
+
throw new Error(passes.unjudged);
|
|
216
|
+
if (passes.passes === false)
|
|
217
|
+
throw new Error(passes.reason);
|
|
218
|
+
}
|
|
219
|
+
return made;
|
|
220
|
+
});
|
|
221
|
+
await storage.addVersion(signed);
|
|
222
|
+
await deps.stored(signed);
|
|
223
|
+
return signed;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* How a record's newest version that stands fares under its checks: kept and
|
|
227
|
+
* synced by every peer either way, counted by a reader only when it passes.
|
|
228
|
+
*/
|
|
229
|
+
async function contractsFor(recordKey, versionId) {
|
|
230
|
+
// A version named is judged even when the history leaves it out (a superseded delete, say).
|
|
231
|
+
const named = versionId !== undefined ? await storage.getVersion(versionId) : null;
|
|
232
|
+
const candidates = versionId === undefined ? await storage.history(recordKey) : named?.key === recordKey ? [named] : [];
|
|
233
|
+
for (const version of candidates) {
|
|
234
|
+
if (isStub(version))
|
|
235
|
+
continue;
|
|
236
|
+
// One named whose first version hasn't arrived waits for it.
|
|
237
|
+
if (!(await consistent(version))) {
|
|
238
|
+
if (versionId !== undefined && version.seq > 0)
|
|
239
|
+
return { version: version.id, passes: null, pending: true };
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const stands = await standingOf(version);
|
|
243
|
+
// One named that waits for what it follows is pending, as a contract waiting on what it cites.
|
|
244
|
+
if (!stands.ok && stands.later && versionId !== undefined)
|
|
245
|
+
return { version: version.id, passes: null, pending: true };
|
|
246
|
+
if (!stands.ok)
|
|
247
|
+
continue;
|
|
248
|
+
const verdict = await checksOf(version);
|
|
249
|
+
if ('pending' in verdict)
|
|
250
|
+
return { version: version.id, passes: null, pending: true };
|
|
251
|
+
if ('unjudged' in verdict)
|
|
252
|
+
return { version: version.id, passes: null, unjudged: true, reason: verdict.unjudged };
|
|
253
|
+
return { version: version.id, ...verdict };
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
/** The live current version of a record, or a clear error. */
|
|
258
|
+
async function requireLive(recordKey) {
|
|
259
|
+
const current = await currentOf(recordKey);
|
|
260
|
+
if (!current || current.deleted)
|
|
261
|
+
throw new Error(`No record ${recordKey} in this space`);
|
|
262
|
+
return current;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The fields for writing a key again: the version after the one that counts.
|
|
266
|
+
* Where the store's newest version fails its checks, after the newest that
|
|
267
|
+
* counts, or afresh as a first version when none does: a version that fails
|
|
268
|
+
* can't make others build on it, or claim a key (a `onePer` key) for good.
|
|
269
|
+
* Otherwise after whatever the store holds, counted or not.
|
|
270
|
+
*/
|
|
271
|
+
async function after(recordKey) {
|
|
272
|
+
const held = await storage.getCurrent(recordKey);
|
|
273
|
+
if (!held)
|
|
274
|
+
return { key: recordKey, seq: 0 };
|
|
275
|
+
const verdict = (await standingOf(held)).ok ? await checksOf(held) : NO_CHECKS;
|
|
276
|
+
// One that fails its checks, or waits for ever on what it cites, can't hold the key.
|
|
277
|
+
if ('passes' in verdict && verdict.passes !== false)
|
|
278
|
+
return nextVersion(held);
|
|
279
|
+
// Waiting only for its own step before: continue it, rather than fork this record.
|
|
280
|
+
if ('pending' in verdict && held.prev && !(await storage.getVersion(held.prev)))
|
|
281
|
+
return nextVersion(held);
|
|
282
|
+
const counted = await currentOf(recordKey);
|
|
283
|
+
return counted ? nextVersion(counted) : { key: recordKey, seq: 0 };
|
|
284
|
+
}
|
|
285
|
+
async function writeFirst(collection, body, recordKey, links, as) {
|
|
286
|
+
const current = await currentOf(recordKey);
|
|
287
|
+
if (current && !current.deleted)
|
|
288
|
+
throw new Error(`A record ${recordKey} already exists — update it instead`);
|
|
289
|
+
// Writing a key that was deleted brings it back: the next version after the delete.
|
|
290
|
+
return write(collection, body, await after(recordKey), false, links, { as });
|
|
291
|
+
}
|
|
292
|
+
async function upsert(collection, recordKey, body, options = {}) {
|
|
293
|
+
return view(await write(collection, body, await after(recordKey), false, [], options));
|
|
294
|
+
}
|
|
295
|
+
async function removeKey(recordKey, as) {
|
|
296
|
+
const current = await requireLive(recordKey);
|
|
297
|
+
await write(current.collection, null, await after(current.key), true, [], { as });
|
|
298
|
+
}
|
|
299
|
+
const guard = (collection) => {
|
|
300
|
+
if (MANAGED.has(collection))
|
|
301
|
+
throw new Error(`${collection} is written by the node itself`);
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Runs a write once more when its collection's rules changed while it was
|
|
305
|
+
* being made — it saw the history before the change, so the change takes
|
|
306
|
+
* it away (03 §5.2) — this time under the new rules: a key they derive,
|
|
307
|
+
* what they keep whole, all worked out again.
|
|
308
|
+
*/
|
|
309
|
+
async function underCurrentRules(run) {
|
|
310
|
+
try {
|
|
311
|
+
return await run();
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
if (!(isRecord(error) && error.rulesMoved === true))
|
|
315
|
+
throw error;
|
|
316
|
+
return run();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async function putOnce(collection, body, options) {
|
|
320
|
+
guard(collection);
|
|
321
|
+
if (options.key !== undefined && !RECORD_KEY_PATTERN.test(options.key)) {
|
|
322
|
+
throw new Error('A record key is 1–128 characters of a–z, 0–9 and : . _ -');
|
|
323
|
+
}
|
|
324
|
+
const links = options.links ?? [];
|
|
325
|
+
// One per something: the key is derived from it, so writing again is the next version of the same record.
|
|
326
|
+
const onePer = (await catalog()).get(collection)?.definition.rules?.onePer;
|
|
327
|
+
if (onePer && options.key === undefined) {
|
|
328
|
+
const derived = await derivedKey(collection, onePer, { root: deps.rootDid, links, body });
|
|
329
|
+
if (!derived)
|
|
330
|
+
throw new Error(`${collection} is one per ${onePer.join(' + ')} — give it every one of those`);
|
|
331
|
+
await keepsCollection(derived, collection);
|
|
332
|
+
return view(await write(collection, body, await after(derived), false, links, { as: options.as }));
|
|
333
|
+
}
|
|
334
|
+
const recordKey = await keyToWrite(collection, options.key, onePer);
|
|
335
|
+
return view(await writeFirst(collection, body, recordKey, links, options.as));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Where a new record goes: a fresh key of this account's, or the key the
|
|
339
|
+
* caller names. A name is put in this account's namespace (`profile` →
|
|
340
|
+
* `<owner>.profile`); a key this account already owns is taken as it is.
|
|
341
|
+
* Not a `one:` key outside a `onePer` collection, which every peer refuses
|
|
342
|
+
* (02 §7.3), nor a key this node holds a record of another collection at.
|
|
343
|
+
*/
|
|
344
|
+
async function keyToWrite(collection, chosen, onePer) {
|
|
345
|
+
if (chosen === undefined)
|
|
346
|
+
return newRecordKey(deps.rootDid);
|
|
347
|
+
let recordKey;
|
|
348
|
+
if (await ownsKey(chosen, deps.rootDid))
|
|
349
|
+
recordKey = chosen;
|
|
350
|
+
else if (keyKind(chosen) === 'owned')
|
|
351
|
+
throw new Error(`${chosen} belongs to another account`);
|
|
352
|
+
else
|
|
353
|
+
recordKey = keyKind(chosen) === 'shared' ? chosen : await ownedKey(deps.rootDid, chosen);
|
|
354
|
+
if (onePerForm(recordKey) && !onePer)
|
|
355
|
+
throw new Error(`${recordKey} is a onePer key, and ${collection} has no onePer`);
|
|
356
|
+
await keepsCollection(recordKey, collection);
|
|
357
|
+
return recordKey;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Refuses a write at a key this node holds a record of another collection
|
|
361
|
+
* at. Keys are unique in a space, and a record keeps its collection for
|
|
362
|
+
* life (02 §4.1, §4.2), so the write could only be refused, or continue the
|
|
363
|
+
* other record's chain.
|
|
364
|
+
*/
|
|
365
|
+
async function keepsCollection(recordKey, collection) {
|
|
366
|
+
const held = (await currentOf(recordKey)) ?? (await storage.getCurrent(recordKey));
|
|
367
|
+
if (held && held.collection !== collection)
|
|
368
|
+
throw new Error(`${recordKey} already holds a ${held.collection} record, and a key keeps its collection for life: ` +
|
|
369
|
+
`choose a name that includes the collection`);
|
|
370
|
+
}
|
|
371
|
+
/** Whether this account holds a grant, now, to do something to a record */
|
|
372
|
+
async function mayNow(collection, action, first) {
|
|
373
|
+
const { history } = await access();
|
|
374
|
+
const state = history.current;
|
|
375
|
+
if (!isMember(state, deps.rootDid))
|
|
376
|
+
return false;
|
|
377
|
+
if (collection.startsWith('sys.'))
|
|
378
|
+
return true;
|
|
379
|
+
const found = await rulesAt(state, collection);
|
|
380
|
+
if (!found && state.contested.has(collection))
|
|
381
|
+
return false;
|
|
382
|
+
if (found?.rules.final && action !== 'create')
|
|
383
|
+
return false;
|
|
384
|
+
const byCreator = action === 'create' || (!!first && (await judge(first)).root === deps.rootDid);
|
|
385
|
+
// The body isn't known yet: a policy on it is decided when the version is written.
|
|
386
|
+
return may(state, deps.rootDid, action === 'delete' ? RECORD_DELETE : RECORD_WRITE, { collection, byCreator }, {
|
|
387
|
+
opaque: action !== 'delete',
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
cannotWrite,
|
|
392
|
+
upsert,
|
|
393
|
+
removeKey,
|
|
394
|
+
contractsFor,
|
|
395
|
+
/** The invite this account waited on has been used */
|
|
396
|
+
joined() {
|
|
397
|
+
waitingInvite = false;
|
|
398
|
+
},
|
|
399
|
+
put: async (collection, body, options = {}) => {
|
|
400
|
+
return underCurrentRules(() => putOnce(collection, body, options));
|
|
401
|
+
},
|
|
402
|
+
update: async (recordKey, body, options = {}) => {
|
|
403
|
+
return underCurrentRules(async () => {
|
|
404
|
+
const current = await requireLive(recordKey);
|
|
405
|
+
guard(current.collection);
|
|
406
|
+
// Links carry over unless replaced: ticking a todo should not unhook it from anything.
|
|
407
|
+
const links = options.links ?? (await openBody(current)).links;
|
|
408
|
+
return view(await write(current.collection, body, await after(recordKey), false, links, { as: options.as }));
|
|
409
|
+
});
|
|
410
|
+
},
|
|
411
|
+
remove: async (recordKey, options = {}) => {
|
|
412
|
+
guard((await requireLive(recordKey)).collection);
|
|
413
|
+
await underCurrentRules(() => removeKey(recordKey, options.as));
|
|
414
|
+
},
|
|
415
|
+
/**
|
|
416
|
+
* The key a record with this body and these links has under its
|
|
417
|
+
* collection's `onePer`, written by `account` (default this one): null
|
|
418
|
+
* when the collection has none, or the body lacks a part it names.
|
|
419
|
+
*/
|
|
420
|
+
onePerKey: async (collection, body, options = {}) => {
|
|
421
|
+
const onePer = options.onePer ?? (await catalog()).get(collection)?.definition.rules?.onePer;
|
|
422
|
+
if (!onePer)
|
|
423
|
+
return null;
|
|
424
|
+
return derivedKey(collection, onePer, {
|
|
425
|
+
root: options.account ?? deps.rootDid,
|
|
426
|
+
links: options.links ?? [],
|
|
427
|
+
body,
|
|
428
|
+
});
|
|
429
|
+
},
|
|
430
|
+
can: async (action, target) => {
|
|
431
|
+
if (action === 'create')
|
|
432
|
+
return mayNow(target, 'create', null);
|
|
433
|
+
const current = await currentOf(target);
|
|
434
|
+
if (!current || current.deleted)
|
|
435
|
+
return false;
|
|
436
|
+
return mayNow(current.collection, action, await genesisOf(current));
|
|
437
|
+
},
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=space-writing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-writing.js","sourceRoot":"","sources":["../../src/node/space-writing.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;A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AE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC;YAC7F,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,OAAO,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO;gBACrC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;gBAC1B,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QAED,GAAG,EAAE,KAAK,EAAE,MAAoC,EAAE,MAAc,EAAoB,EAAE;YACpF,IAAI,MAAM,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC/D,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO;gBAAE,OAAO,KAAK,CAAC;YAC9C,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/node/stores.d.ts
CHANGED
|
@@ -2,78 +2,49 @@
|
|
|
2
2
|
* @module node/stores
|
|
3
3
|
* Where a node keeps its data.
|
|
4
4
|
*
|
|
5
|
-
* A node
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* {@link StoreFactory} decides what a path
|
|
9
|
-
* means: a database in this browser, a file on a server's disk, or, in a data
|
|
10
|
-
* folder, the registry in the folder and the rest beside this device's copy
|
|
11
|
-
* of what the folder's segments hold.
|
|
5
|
+
* A node asks for its stores by path — `registry`, `spaces/<id>`, `writers` —
|
|
6
|
+
* and a {@link StoreFactory} decides what a path means: a database in this
|
|
7
|
+
* browser, files on a disk, or a data folder.
|
|
12
8
|
*/
|
|
13
9
|
import type { StorageAdapter } from '../types.js';
|
|
14
10
|
import { type DirectoryHandleLike } from '../storage/folder-adapter.js';
|
|
15
11
|
import type { BlobStore } from '../storage/blob-store.js';
|
|
16
12
|
import { type WriterKeySource } from './writer-keys.js';
|
|
17
13
|
export interface StoreOptions {
|
|
18
|
-
/**
|
|
19
|
-
* Encrypt space records and space keys at rest. The node sets it for the
|
|
20
|
-
* registry, the one store whose contents would otherwise hand every private
|
|
21
|
-
* space to whoever copied the files.
|
|
22
|
-
*/
|
|
14
|
+
/** Encrypt at rest. The node sets it for the registry, which holds every private space's key. */
|
|
23
15
|
readonly seal?: boolean;
|
|
24
16
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Opens the store for a `/`-separated path. A factory over a data folder
|
|
27
|
-
* also names the folder's segments (`folder`): every space opened from it is
|
|
28
|
-
* mirrored there, as with any blob store (spec 05 §14).
|
|
29
|
-
*/
|
|
17
|
+
/** Opens the store for a `/`-separated path. Over a data folder, `folder` is where spaces are mirrored (spec 05 §14). */
|
|
30
18
|
export type StoreFactory = ((path: string, options?: StoreOptions) => Promise<StorageAdapter>) & {
|
|
31
19
|
readonly folder?: BlobStore;
|
|
32
20
|
};
|
|
33
21
|
/**
|
|
34
|
-
* Stores in this origin's IndexedDB, one database per path.
|
|
35
|
-
*
|
|
36
|
-
* Not sealed: the browser profile already stands between the data and anyone
|
|
37
|
-
* else, and the threat sealing answers — someone holding the files — does not
|
|
38
|
-
* arise.
|
|
39
|
-
*
|
|
22
|
+
* Stores in this origin's IndexedDB, one database per path. Not sealed: the
|
|
23
|
+
* browser profile already keeps the files from anyone else.
|
|
40
24
|
* @param prefix Namespaces the databases, e.g. an app and account id
|
|
41
25
|
*/
|
|
42
26
|
export declare function indexedDBStores(prefix: string): StoreFactory;
|
|
43
27
|
/**
|
|
44
|
-
* Stores in a directory on this device, one file per entry and per version
|
|
45
|
-
*
|
|
46
|
-
* {@link folderStores}.
|
|
47
|
-
*
|
|
28
|
+
* Stores in a directory on this device, one file per entry and per version.
|
|
29
|
+
* A data folder others share is {@link folderStores}.
|
|
48
30
|
* @param options.localKey Seals the registry. Without it nothing is sealed.
|
|
49
31
|
*/
|
|
50
32
|
export declare function directoryStores(directory: DirectoryHandleLike, options?: {
|
|
51
33
|
readonly localKey?: CryptoKey | null;
|
|
52
34
|
}): StoreFactory;
|
|
53
35
|
/**
|
|
54
|
-
* Stores in a data folder
|
|
55
|
-
* devices read and write at once (spec 05 §14).
|
|
56
|
-
*
|
|
57
|
-
* Only the registry is kept in the folder as entries, sealed. Every space is
|
|
58
|
-
* kept in it as segments, the way a mirror keeps one in a bucket: the
|
|
59
|
-
* factory's `folder`, which each space runtime opened from it mirrors to.
|
|
60
|
-
* Everything else — a space's entries and bodies, what the node keeps beside
|
|
61
|
-
* them, each mirror's own state — is this device's own, in `local`, so the
|
|
62
|
-
* folder holds a few files per space and device, not several per version.
|
|
36
|
+
* Stores in a data folder several apps and devices share (spec 05 §14).
|
|
63
37
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
38
|
+
* The folder holds the registry, sealed, and each space as segments, the way
|
|
39
|
+
* a mirror keeps one in a bucket (`folder`). Everything else is this device's
|
|
40
|
+
* own, in `local`. Nothing else is read from the folder: whoever can write it
|
|
41
|
+
* could plant a writer id or a key's last place for this device to take.
|
|
67
42
|
*
|
|
68
|
-
* @param directory The folder
|
|
69
43
|
* @param options.basePath Where this account's data starts, e.g. `accounts/<id>/stores`
|
|
70
44
|
* @param options.localKey Seals the registry. Without it nothing is sealed.
|
|
71
|
-
* @param options.local Where this device keeps its own stores,
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* when the person forgets that copy). Required where there is no IndexedDB:
|
|
75
|
-
* in memory, a lasting key's places would be lost, and a restart would sign
|
|
76
|
-
* at a place it signed before.
|
|
45
|
+
* @param options.local Where this device keeps its own stores, outside the
|
|
46
|
+
* folder. Default: IndexedDB under `minca-pod:<basePath>`. Required without
|
|
47
|
+
* IndexedDB: in memory, a restart would sign at a place it signed before.
|
|
77
48
|
*/
|
|
78
49
|
export declare function folderStores(directory: DirectoryHandleLike, options?: {
|
|
79
50
|
readonly basePath?: string;
|
|
@@ -94,10 +65,8 @@ export type WorkerStores =
|
|
|
94
65
|
};
|
|
95
66
|
/**
|
|
96
67
|
* Where a node started from a description keeps its lasting writer key:
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* devices share: a key there could sign in two places at once. A folder
|
|
100
|
-
* without an account path names no account to keep a key for.
|
|
68
|
+
* IndexedDB under the account's prefix, so signing out deletes it. Never the
|
|
69
|
+
* shared data folder, where it could sign in two places at once.
|
|
101
70
|
*/
|
|
102
71
|
export declare function writerKeysFor(stores: WorkerStores): WriterKeySource | undefined;
|
|
103
72
|
/** The store factory a description stands for */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stores.d.ts","sourceRoot":"","sources":["../../src/node/stores.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stores.d.ts","sourceRoot":"","sources":["../../src/node/stores.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAE7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,YAAY;IAC3B,iGAAiG;IACjG,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,yHAAyH;AACzH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG;IAC/F,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B,CAAC;AAEF;;;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