@minca/core 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- 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 +35 -9
- 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 +169 -72
- 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/network/ws-transport.d.ts.map +1 -1
- package/dist/network/ws-transport.js +3 -0
- package/dist/network/ws-transport.js.map +1 -1
- package/dist/node/actions.d.ts +2 -0
- package/dist/node/actions.d.ts.map +1 -1
- package/dist/node/actions.js +89 -58
- package/dist/node/actions.js.map +1 -1
- package/dist/node/api.d.ts +7 -0
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +7 -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 +567 -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 +456 -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 +199 -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 +53 -0
- package/dist/node/space-holding.d.ts.map +1 -0
- package/dist/node/space-holding.js +339 -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 +629 -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 +107 -140
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +331 -3985
- 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 +74 -0
- package/dist/node/space-writing.d.ts.map +1 -0
- package/dist/node/space-writing.js +442 -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 +243 -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/schemas/library/social.d.ts +258 -0
- package/dist/schemas/library/social.d.ts.map +1 -1
- package/dist/schemas/library/social.js +28 -1
- package/dist/schemas/library/social.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/hosting.d.ts.map +1 -1
- package/dist/session/hosting.js +8 -2
- package/dist/session/hosting.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/presets.d.ts +2 -2
- package/dist/space/presets.d.ts.map +1 -1
- package/dist/space/presets.js +3 -2
- package/dist/space/presets.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 +32 -25
- package/docs/agents.md +28 -16
- package/docs/automations.md +1 -1
- package/docs/blueprints-and-guides.md +37 -5
- 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 +6 -2
- package/docs/inbox.md +5 -11
- package/docs/node.md +54 -22
- package/docs/records-and-queries.md +1 -1
- package/docs/sign-in.md +54 -26
- package/docs/spaces.md +9 -8
- package/docs/standard-library.md +37 -14
- package/docs/storage.md +5 -6
- package/docs/usernames.md +161 -0
- package/docs/warrants.md +1 -1
- package/package.json +1 -2
package/dist/node/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node/types
|
|
3
|
-
* The shape of a node. Everything a method returns is JSON-serialisable
|
|
4
|
-
*
|
|
3
|
+
* The shape of a node. Everything a method returns is JSON-serialisable: the
|
|
4
|
+
* same calls cross a port, and are actions for a CLI, MCP and WebMCP.
|
|
5
5
|
*/
|
|
6
6
|
import type { MailboxClient } from '../network/relays.js';
|
|
7
7
|
import type { BodyOf, CollectionRef, IncludeMap, Query, ResultFor } from '../query/types.js';
|
|
@@ -21,67 +21,76 @@ import type { StoreFactory } from './stores.js';
|
|
|
21
21
|
import type { JsonSchema, SchemaIssue } from '../schema/collection-def.js';
|
|
22
22
|
import type { Keeper } from '../space/roles.js';
|
|
23
23
|
import type { Automation } from '../schemas/automations.js';
|
|
24
|
+
import type { FundOffer, FundPayment, HostConnectorOffer, HostStatus, HostedBot, OverSpace, PayAnswer } from '../session/hosting.js';
|
|
24
25
|
export interface NodeNetworkConfig {
|
|
25
26
|
/** Relays for WebRTC, browsers only. Each space meets in the room named after its id. */
|
|
26
27
|
readonly relays?: ReadonlyArray<string>;
|
|
27
|
-
/** Always-on nodes to hold a socket to, `wss://host/peer
|
|
28
|
+
/** Always-on nodes to hold a socket to, `wss://host/peer#<DID>` (spec 04 §5.2); the space id is appended */
|
|
28
29
|
readonly nodes?: ReadonlyArray<string>;
|
|
29
|
-
/** Hosts to look for the account registry at,
|
|
30
|
+
/** Hosts to look for the account registry at, so a new device with only the recovery code finds its spaces */
|
|
30
31
|
readonly hosts?: ReadonlyArray<string>;
|
|
31
32
|
readonly iceServers?: ReadonlyArray<RTCIceServer>;
|
|
32
|
-
/** How WebRTC connections are made; a node in a worker passes `remoteTransport
|
|
33
|
+
/** How WebRTC connections are made; a node in a worker passes `remoteTransport` */
|
|
33
34
|
readonly createTransport?: (iceServers: () => ReadonlyArray<RTCIceServer>) => SignalledTransport;
|
|
34
|
-
/** Extra transports per space, given this node's session DID
|
|
35
|
+
/** Extra transports per space, given this node's session DID: for a node serving sockets, or a test */
|
|
35
36
|
readonly transports?: (spaceId: string, sessionDid: string) => ReadonlyArray<PeerTransport>;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this node may connect to an address it found rather than was
|
|
39
|
+
* given: a host or node a record or an invite names, a relay a space or an
|
|
40
|
+
* invite names, a place a short link names, a host it asks to describe
|
|
41
|
+
* itself. Asked before each; `relays`, `nodes` and `hosts` here are taken as
|
|
42
|
+
* given. Default: anywhere. For a node a server runs for someone else, such
|
|
43
|
+
* as the MCP service's: what it reads is theirs to write, and must not make
|
|
44
|
+
* the server connect inside its own network.
|
|
45
|
+
*/
|
|
46
|
+
readonly reach?: (address: string) => Promise<boolean>;
|
|
36
47
|
}
|
|
37
48
|
export interface NodeConfig {
|
|
38
|
-
/** Who this node acts for. The root key only
|
|
49
|
+
/** Who this node acts for. The root key only signs session delegations. */
|
|
39
50
|
readonly signer: RootSigner;
|
|
40
|
-
/** The account key (`deriveAccountKey(seed)`):
|
|
51
|
+
/** The account key (`deriveAccountKey(seed)`): the node then follows the account registry */
|
|
41
52
|
readonly accountKey?: Uint8Array;
|
|
42
|
-
/** The account's contact key (`deriveContactKeyBytes(seed)`),
|
|
53
|
+
/** The account's contact key (`deriveContactKeyBytes(seed)`), to open contact requests and knocks */
|
|
43
54
|
readonly contactKey?: Uint8Array;
|
|
44
55
|
/** The account's contacts space, for a node given it without the account key */
|
|
45
56
|
readonly contactsSpace?: string;
|
|
46
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The account's name as a grant gives it: what knocks and a new inbox say
|
|
59
|
+
* until the account's profile reaches this node from its registry
|
|
60
|
+
*/
|
|
61
|
+
readonly accountName?: string;
|
|
62
|
+
/** How the inbox and short links reach mailboxes. Default: `createMailboxClient` */
|
|
47
63
|
readonly mailbox?: MailboxClient;
|
|
48
64
|
/** Where the registry and each space's store live */
|
|
49
65
|
readonly stores: StoreFactory;
|
|
50
66
|
readonly provider?: CryptoProvider;
|
|
51
|
-
/**
|
|
67
|
+
/** Collection shapes to use where a space has none: checked on write, flagged (`conforms`) on read, never refused */
|
|
52
68
|
readonly collections?: ReadonlyArray<CollectionDef>;
|
|
53
69
|
/** Omit to stay offline */
|
|
54
70
|
readonly network?: NodeNetworkConfig;
|
|
55
|
-
/**
|
|
71
|
+
/** Seconds each session delegation lasts; renewed before it runs out. Default 3600. */
|
|
56
72
|
readonly sessionTtlSeconds?: number;
|
|
57
|
-
/** The key
|
|
73
|
+
/** The key to sign with, when the signer already named it. Default: one claimed from `writerKey`, else a fresh one */
|
|
58
74
|
readonly sessionKey?: CryptoKeyPair;
|
|
59
|
-
/**
|
|
60
|
-
* Where to keep a signing key across runs, so this device keeps one log in
|
|
61
|
-
* each space (`browserWriterKeys`; the CLI keeps them on disk). Ignored with
|
|
62
|
-
* `sessionKey`. Without it, or when no key can be claimed, the node makes a
|
|
63
|
-
* key for this run alone.
|
|
64
|
-
*/
|
|
75
|
+
/** Where to keep a signing key across runs (`browserWriterKeys`). Without one, each run makes a new key. */
|
|
65
76
|
readonly writerKey?: WriterKeySource;
|
|
66
|
-
/** How often to look for
|
|
77
|
+
/** How often to look for another process's writes to a folder store, ms. 0 disables. Default 2000. */
|
|
67
78
|
readonly watchIntervalMs?: number;
|
|
68
79
|
/**
|
|
69
|
-
* Fetch and keep every file
|
|
70
|
-
*
|
|
71
|
-
* fetched unread up to 5 MiB, and past 256 MiB in a space those used
|
|
72
|
-
* longest ago are dropped (spec 05 §16.6).
|
|
80
|
+
* Fetch and keep every file of any size, as a keeper does. Default: others'
|
|
81
|
+
* files up to 5 MiB, dropping the least used past 256 MiB a space (spec 05 §16.6).
|
|
73
82
|
*/
|
|
74
83
|
readonly fetchFiles?: 'all';
|
|
75
84
|
/** Hold only the collections this node uses, once a space names a keeper to hold the rest */
|
|
76
85
|
readonly cache?: CacheConfig;
|
|
77
86
|
}
|
|
78
|
-
/** How a node holds part of a space: its own choice
|
|
87
|
+
/** How a node holds part of a space: its own choice */
|
|
79
88
|
export interface CacheConfig {
|
|
80
89
|
/** Collections this app uses: held from the start, and dropped last */
|
|
81
90
|
readonly collections?: ReadonlyArray<string>;
|
|
82
|
-
/** Drop a collection no query
|
|
91
|
+
/** Drop a collection no query touched for this many days, unless it holds unsent writes. Default 30. */
|
|
83
92
|
readonly unusedAfterDays?: number;
|
|
84
|
-
/** How many keepers a write must reach before it can be dropped; only
|
|
93
|
+
/** How many keepers a write must reach before it can be dropped; only raises the space's `copies` (default 2) */
|
|
85
94
|
readonly copies?: number;
|
|
86
95
|
}
|
|
87
96
|
/** A space, as the node describes it. Never carries the key. */
|
|
@@ -89,37 +98,33 @@ export interface SpaceSummary {
|
|
|
89
98
|
readonly id: string;
|
|
90
99
|
readonly name: string;
|
|
91
100
|
readonly visibility: SpaceVisibility;
|
|
92
|
-
/** Its founders, as its constitution names them
|
|
101
|
+
/** Its founders, as its constitution names them; some may have stepped down since (`access`) */
|
|
93
102
|
readonly founders: ReadonlyArray<string>;
|
|
94
|
-
/** The space it succeeds, as its constitution says
|
|
103
|
+
/** The space it succeeds, as its constitution says */
|
|
95
104
|
readonly succeeds?: string;
|
|
96
105
|
readonly createdAt: string;
|
|
97
|
-
/** Whether this node can read the space:
|
|
106
|
+
/** Whether this node can read the space: public, or private with the key */
|
|
98
107
|
readonly readable: boolean;
|
|
99
|
-
/** Whether this account holds a role here, and so may write
|
|
108
|
+
/** Whether this account holds a role here, and so may write */
|
|
100
109
|
readonly writable: boolean;
|
|
101
110
|
/** What this account is here: `founder`, a role it holds by name, or null when it holds none */
|
|
102
111
|
readonly role: string | null;
|
|
103
|
-
/** Whether an invite is waiting to be used
|
|
112
|
+
/** Whether an invite is waiting to be used: its record has not arrived yet */
|
|
104
113
|
readonly joining: boolean;
|
|
105
114
|
}
|
|
106
115
|
export interface NewSpace {
|
|
107
116
|
readonly name: string;
|
|
108
117
|
/** `private` encrypts every body with the space key */
|
|
109
118
|
readonly visibility: SpaceVisibility;
|
|
110
|
-
/** The roles it is founded with
|
|
119
|
+
/** The roles it is founded with (`rolePresets` has some). Default: none */
|
|
111
120
|
readonly roles?: ReadonlyArray<SpaceRole>;
|
|
112
|
-
/**
|
|
113
|
-
* `founders` (the default): you, and any `cofounders`, hold every command
|
|
114
|
-
* and no one else can remove you. `none`: no one is above the roles, and
|
|
115
|
-
* you hold only `creatorRoles`
|
|
116
|
-
*/
|
|
121
|
+
/** `founders` (default): you and any `cofounders` hold every command. `none`: you hold only `creatorRoles` */
|
|
117
122
|
readonly top?: 'founders' | 'none';
|
|
118
123
|
/** Under `top: founders`, accounts that found it with you */
|
|
119
124
|
readonly cofounders?: ReadonlyArray<string>;
|
|
120
125
|
/** Roles the constitution gives you. Under `top: none` you need one */
|
|
121
126
|
readonly creatorRoles?: ReadonlyArray<string>;
|
|
122
|
-
/** The space this one succeeds
|
|
127
|
+
/** The space this one succeeds; name it there too, with `spaces.succeed` */
|
|
123
128
|
readonly succeeds?: string;
|
|
124
129
|
}
|
|
125
130
|
export interface InvitePreview {
|
|
@@ -127,30 +132,26 @@ export interface InvitePreview {
|
|
|
127
132
|
readonly invitedBy: string;
|
|
128
133
|
/** Whether the invite carries the key to a private space */
|
|
129
134
|
readonly carriesKey: boolean;
|
|
130
|
-
/** Whether the invite
|
|
135
|
+
/** Whether the invite gives a role: false for a view-only one */
|
|
131
136
|
readonly carriesWrite: boolean;
|
|
132
|
-
/** The role it is for, as the link says
|
|
137
|
+
/** The role it is for, as the link says; the space's invite record is what counts */
|
|
133
138
|
readonly role: string | null;
|
|
134
|
-
/** For a short link: when its inviter stops sharing it, ms
|
|
139
|
+
/** For a short link: when its inviter stops sharing it, ms */
|
|
135
140
|
readonly until?: number;
|
|
136
141
|
}
|
|
137
142
|
export interface InviteOptions {
|
|
138
|
-
/** The role
|
|
143
|
+
/** The role it gives. Default: the lowest below yours, or view-only */
|
|
139
144
|
readonly role?: string;
|
|
140
|
-
/** False for a view-only invite: the key
|
|
145
|
+
/** False for a view-only invite: the key, and no role */
|
|
141
146
|
readonly write?: boolean;
|
|
142
|
-
/**
|
|
143
|
-
* A short link (spec 03 §7.7): about 85 characters, the rest of the invite
|
|
144
|
-
* kept sealed in mailboxes. Falls back to the long form when no mailbox
|
|
145
|
-
* takes it, or the space is too large for one.
|
|
146
|
-
*/
|
|
147
|
+
/** A short link, the rest sealed in mailboxes (spec 03 §7.7); the long form when no mailbox takes it */
|
|
147
148
|
readonly short?: boolean;
|
|
148
|
-
/** For a short link: when to stop sharing it, ms. Closing the invite is what ends it */
|
|
149
|
+
/** For a short link: when to stop sharing it, ms. Closing the invite is what ends it. */
|
|
149
150
|
readonly until?: number;
|
|
150
151
|
}
|
|
151
152
|
/** Who holds what in a space, now */
|
|
152
153
|
export interface SpaceAccess {
|
|
153
|
-
/** The space's roles,
|
|
154
|
+
/** The space's roles, each with its current definitions (rivals hold what they share) */
|
|
154
155
|
readonly roles: ReadonlyArray<SpaceRoleView>;
|
|
155
156
|
/** Everyone with a place: the founders, and every account assigned a role */
|
|
156
157
|
readonly members: ReadonlyArray<{
|
|
@@ -164,54 +165,39 @@ export interface SpaceAccess {
|
|
|
164
165
|
readonly role: string;
|
|
165
166
|
readonly open: boolean;
|
|
166
167
|
}>;
|
|
167
|
-
/** Whether this account is a founder
|
|
168
|
+
/** Whether this account is a founder that has not stepped down */
|
|
168
169
|
readonly founder: boolean;
|
|
169
170
|
/** `founders` or `none`, as the constitution says */
|
|
170
171
|
readonly top: 'founders' | 'none';
|
|
171
|
-
/**
|
|
172
|
-
* No founder is left, and no member may change roles: nobody can run the
|
|
173
|
-
* space any more, so a successor is the way on (`spaces.succeed`)
|
|
174
|
-
*/
|
|
172
|
+
/** No founder is left and no member may change roles: only a successor helps (`spaces.succeed`) */
|
|
175
173
|
readonly headless: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Spaces named as this one's successors, each with the accounts that named
|
|
178
|
-
* it. In no order: which to follow is each member's choice, and an app
|
|
179
|
-
* must not pick one for them
|
|
180
|
-
*/
|
|
174
|
+
/** Spaces named as successors, and who named each. In no order: which to follow is each member's choice. */
|
|
181
175
|
readonly successors: ReadonlyArray<{
|
|
182
176
|
readonly space: string;
|
|
183
177
|
readonly by: ReadonlyArray<string>;
|
|
184
178
|
}>;
|
|
185
179
|
/** The roles assigned to this account, by name */
|
|
186
180
|
readonly mine: ReadonlyArray<string>;
|
|
187
|
-
/** The latest access changes held
|
|
181
|
+
/** The latest access changes held: what a record written now names as `seen` */
|
|
188
182
|
readonly heads: ReadonlyArray<string>;
|
|
189
|
-
/** A private space's key: how often it changed, and whether this device holds the current one
|
|
183
|
+
/** A private space's key: how often it changed, and whether this device holds the current one */
|
|
190
184
|
readonly key: {
|
|
191
185
|
readonly changes: number;
|
|
192
186
|
readonly held: boolean;
|
|
193
187
|
} | null;
|
|
194
|
-
/** Where
|
|
188
|
+
/** Where members meet: the relays it names, else the ones its invite did */
|
|
195
189
|
readonly relays: ReadonlyArray<string>;
|
|
196
|
-
/** The nodes that keep the space whole: a host, an extension
|
|
190
|
+
/** The nodes that keep the space whole: a host, an extension */
|
|
197
191
|
readonly keepers: ReadonlyArray<Keeper>;
|
|
198
|
-
/** How many keepers a write should reach before
|
|
192
|
+
/** How many keepers a write should reach before it may be dropped; null for the default */
|
|
199
193
|
readonly copies: number | null;
|
|
200
|
-
/**
|
|
201
|
-
* Keys proven to have signed two versions at one place in their line for a
|
|
202
|
-
* collection here: stolen, or copied where they shouldn't be. What they
|
|
203
|
-
* signed in that collection from `from` on no longer counts (spec 02 §4.10).
|
|
204
|
-
*/
|
|
194
|
+
/** Keys proven to have forked their line in a collection; what they signed from `from` on no longer counts (spec 02 §4.10) */
|
|
205
195
|
readonly forks: ReadonlyArray<{
|
|
206
196
|
readonly writer: string;
|
|
207
197
|
readonly collection: string;
|
|
208
198
|
readonly from: number;
|
|
209
199
|
}>;
|
|
210
|
-
/**
|
|
211
|
-
* Accounts proven, by a warrant every peer checked, to have signed something
|
|
212
|
-
* the protocol refuses and no honest writer could have (spec 03 §6.6). For
|
|
213
|
-
* whoever manages the space to see; nothing is done about it by itself.
|
|
214
|
-
*/
|
|
200
|
+
/** Accounts a checked warrant proves signed what no honest writer could (spec 03 §6.6), for managers to see */
|
|
215
201
|
readonly flagged: ReadonlyArray<FlaggedAccount>;
|
|
216
202
|
}
|
|
217
203
|
/** A role as the history has it now */
|
|
@@ -239,47 +225,39 @@ export interface FlaggedAccount {
|
|
|
239
225
|
/** The id of the offending version */
|
|
240
226
|
readonly offence: string;
|
|
241
227
|
}
|
|
242
|
-
/** A record, opened and checked
|
|
228
|
+
/** A record, opened and checked: its current version, unless listed as history */
|
|
243
229
|
export interface NodeRecord<T = unknown> {
|
|
244
|
-
/** The record's identity
|
|
230
|
+
/** The record's identity, the same across edits; links point here */
|
|
245
231
|
readonly key: string;
|
|
246
|
-
/** This version's id
|
|
232
|
+
/** This version's id: a content hash */
|
|
247
233
|
readonly version: string;
|
|
248
234
|
/** 0 for the first version, one more for each edit */
|
|
249
235
|
readonly seq: number;
|
|
250
236
|
readonly space: string;
|
|
251
237
|
readonly collection: string;
|
|
252
|
-
/** The key that signed this version
|
|
238
|
+
/** The key that signed this version, usually a session key */
|
|
253
239
|
readonly author: string;
|
|
254
240
|
/** The identity that key was acting for, when its delegation checks out */
|
|
255
241
|
readonly root: string | null;
|
|
256
242
|
/** The identity that created the record, when its first version is held */
|
|
257
243
|
readonly createdBy: string | null;
|
|
258
|
-
/** When
|
|
244
|
+
/** When it was created, by its creator's clock: for display only */
|
|
259
245
|
readonly createdAt: string;
|
|
260
|
-
/** When this version was written
|
|
246
|
+
/** When this version was written: for display only */
|
|
261
247
|
readonly updatedAt: string;
|
|
262
248
|
/** The content, or null when it is encrypted and this node has no key */
|
|
263
249
|
readonly body: T | null;
|
|
264
|
-
/** What this record points at
|
|
250
|
+
/** What this record points at; empty when it can't be opened */
|
|
265
251
|
readonly links: ReadonlyArray<Link>;
|
|
266
252
|
readonly encrypted: boolean;
|
|
267
253
|
/** Signature, delegation and shape all check out */
|
|
268
254
|
readonly verified: boolean;
|
|
269
|
-
/**
|
|
270
|
-
* True when the note this version was signed under grants writing records
|
|
271
|
-
* and no more: it could not have defined a collection here. An app that
|
|
272
|
-
* runs what a record holds, as code, trusts only versions without it.
|
|
273
|
-
*/
|
|
255
|
+
/** Signed under a note that grants writing records and no more: an app running records as code trusts only versions without it */
|
|
274
256
|
readonly recordsOnly?: true;
|
|
275
257
|
readonly reason?: string;
|
|
276
|
-
/**
|
|
258
|
+
/** This version deletes the record (listed only with `includeDeleted`) */
|
|
277
259
|
readonly deleted?: true;
|
|
278
|
-
/**
|
|
279
|
-
* Whether the body fits its collection's schema; null when there is none or
|
|
280
|
-
* it could not be opened. A misfit is still kept and synced: refusing it
|
|
281
|
-
* would leave peers that saw different definitions disagreeing forever.
|
|
282
|
-
*/
|
|
260
|
+
/** Whether the body fits its collection's schema; null when there is none or it can't be opened. A misfit still syncs. */
|
|
283
261
|
readonly conforms: boolean | null;
|
|
284
262
|
readonly issues?: ReadonlyArray<SchemaIssue>;
|
|
285
263
|
}
|
|
@@ -291,19 +269,19 @@ export interface NodeCollection {
|
|
|
291
269
|
/** Null when records exist but the space has no definition for them */
|
|
292
270
|
readonly schema: JsonSchema | null;
|
|
293
271
|
readonly version: number | null;
|
|
294
|
-
/** Whether edits keep old versions: `all
|
|
272
|
+
/** Whether edits keep old versions: `all`, or `latest` (the default) */
|
|
295
273
|
readonly history: 'latest' | 'all';
|
|
296
|
-
/** The link roles its records carry, and what each may point at
|
|
274
|
+
/** The link roles its records carry, and what each may point at */
|
|
297
275
|
readonly links: Readonly<Record<string, LinkDeclaration>>;
|
|
298
|
-
/** The identity that first defined it
|
|
276
|
+
/** The identity that first defined it */
|
|
299
277
|
readonly definedBy: string | null;
|
|
300
|
-
/** What must be unique, which fields are fixed
|
|
278
|
+
/** What must be unique, which fields are fixed */
|
|
301
279
|
readonly rules: CollectionRules;
|
|
302
280
|
/** What a version must be to count, judged by readers; absent when it has none */
|
|
303
281
|
readonly contract?: CollectionContract;
|
|
304
282
|
/** Values derived from what links to its records; absent when it has none */
|
|
305
283
|
readonly computed?: ComputedFields;
|
|
306
|
-
/** Fields whose values are
|
|
284
|
+
/** Fields whose values are tagged on each record's outside, so keepers can match them unread */
|
|
307
285
|
readonly topics: ReadonlyArray<string>;
|
|
308
286
|
readonly records: number;
|
|
309
287
|
}
|
|
@@ -311,31 +289,24 @@ export interface DefineCollection {
|
|
|
311
289
|
readonly name: string;
|
|
312
290
|
readonly title?: string;
|
|
313
291
|
readonly description?: string;
|
|
314
|
-
/** JSON Schema in the supported subset, or a
|
|
292
|
+
/** JSON Schema in the supported subset, or a Standard JSON Schema validator */
|
|
315
293
|
readonly schema: JsonSchema | StandardJSONSchemaV1;
|
|
316
294
|
/** Default: one past the current version, or 1 */
|
|
317
295
|
readonly version?: number;
|
|
318
|
-
/** Keep every version
|
|
296
|
+
/** Keep every version (`all`), or only the current one (`latest`, the default) */
|
|
319
297
|
readonly history?: 'latest' | 'all';
|
|
320
298
|
/** The link roles its records may carry, and what each may point at */
|
|
321
299
|
readonly links?: Readonly<Record<string, LinkDeclaration>>;
|
|
322
|
-
/** What must be unique, which fields are fixed, whether records are written once:
|
|
300
|
+
/** What must be unique, which fields are fixed, whether records are written once: every peer checks */
|
|
323
301
|
readonly rules?: CollectionRules;
|
|
324
|
-
/** Fields whose values are topics
|
|
302
|
+
/** Fields whose values are topics, like `channel`, so a keeper can match them unread */
|
|
325
303
|
readonly topics?: ReadonlyArray<string>;
|
|
326
|
-
/**
|
|
327
|
-
* What a version must be to count, judged by readers: `check`, conditions in CEL or built
|
|
328
|
-
* in TypeScript, and `line`, one line per account at `lineKey(account, name)`
|
|
329
|
-
* (packages/core/docs/contracts.md)
|
|
330
|
-
*/
|
|
304
|
+
/** What a version must be to count, judged by readers: `check` conditions and a `line` (packages/core/docs/contracts.md) */
|
|
331
305
|
readonly contract?: CollectionContract | {
|
|
332
306
|
readonly check?: ReadonlyArray<Contract> | ((scope: never) => Readonly<Record<string, unknown>>);
|
|
333
307
|
readonly line?: Line;
|
|
334
308
|
};
|
|
335
|
-
/**
|
|
336
|
-
* Values every app derives the same way from what links to its records, in CEL or built in
|
|
337
|
-
* TypeScript (packages/core/docs/computed.md)
|
|
338
|
-
*/
|
|
309
|
+
/** Values derived from what links to its records (packages/core/docs/computed.md) */
|
|
339
310
|
readonly computed?: ComputedFields | ((scope: never) => ComputedResult);
|
|
340
311
|
}
|
|
341
312
|
export interface NodeCollections {
|
|
@@ -345,7 +316,7 @@ export interface NodeCollections {
|
|
|
345
316
|
define(spaceId: string, definition: DefineCollection): Promise<NodeCollection>;
|
|
346
317
|
/** Takes a definition out of the space; refused while the collection still has records */
|
|
347
318
|
delete(spaceId: string, name: string): Promise<void>;
|
|
348
|
-
/** The topic tag a record with this value carries
|
|
319
|
+
/** The topic tag a record with this value carries; keyed in a private space, so only members can work it out */
|
|
349
320
|
tag(spaceId: string, collection: string, field: string, value: string | number | boolean): Promise<string>;
|
|
350
321
|
}
|
|
351
322
|
/** A version under its collection's contract: `passes` null when it has none, or this node can't judge it */
|
|
@@ -356,7 +327,7 @@ export interface RecordContracts {
|
|
|
356
327
|
readonly reason?: string;
|
|
357
328
|
/** A version it cites, or the one before it, hasn't arrived yet */
|
|
358
329
|
readonly pending?: true;
|
|
359
|
-
/** Its collection declares something this library doesn't know
|
|
330
|
+
/** Its collection declares something this library doesn't know, so it is neither counted nor failed */
|
|
360
331
|
readonly unjudged?: true;
|
|
361
332
|
}
|
|
362
333
|
export interface ListOptions {
|
|
@@ -379,32 +350,28 @@ export interface SpaceStatus {
|
|
|
379
350
|
readonly connection: ConnectionState;
|
|
380
351
|
/** Peers currently connected in this space */
|
|
381
352
|
readonly peers: ReadonlyArray<string>;
|
|
382
|
-
/** Of `peers`, this account's own other devices and apps
|
|
353
|
+
/** Of `peers`, this account's own other devices and apps */
|
|
383
354
|
readonly own: ReadonlyArray<string>;
|
|
384
|
-
/** Of `peers`, carriers the account uses
|
|
355
|
+
/** Of `peers`, carriers the account uses */
|
|
385
356
|
readonly carriers: ReadonlyArray<string>;
|
|
386
|
-
/** The account each peer showed it acts for, by
|
|
357
|
+
/** The account each peer showed it acts for, by session DID */
|
|
387
358
|
readonly accounts: Readonly<Record<string, string>>;
|
|
388
|
-
/** A fingerprint of every version
|
|
359
|
+
/** A fingerprint of every version kept here: equal on two nodes means identical data */
|
|
389
360
|
readonly fingerprint: string;
|
|
390
361
|
/** Records peers sent that failed validation */
|
|
391
362
|
readonly rejected: number;
|
|
392
|
-
/** What this node holds of the space: `all`, or the collections it uses
|
|
363
|
+
/** What this node holds of the space: `all`, or the collections it uses */
|
|
393
364
|
readonly holds: 'all' | ReadonlyArray<string>;
|
|
394
|
-
/** Writes of this node's that haven't reached enough keepers yet
|
|
365
|
+
/** Writes of this node's that haven't reached enough keepers yet */
|
|
395
366
|
readonly pending: number;
|
|
396
367
|
}
|
|
397
368
|
/** A live message as it arrives: what was sent, and who sent it */
|
|
398
369
|
export interface LiveMessage {
|
|
399
|
-
/** The account
|
|
370
|
+
/** The sender's account, proven by its note; null for a peer that showed none */
|
|
400
371
|
readonly from: string | null;
|
|
401
|
-
/** The sending device
|
|
372
|
+
/** The sending device's session DID, where a reply to it goes */
|
|
402
373
|
readonly peer: string;
|
|
403
|
-
/**
|
|
404
|
-
* Whether the sender's note writes records in some space but can't define
|
|
405
|
-
* collections in this one, judged on the whole note so a key for another
|
|
406
|
-
* space is caught too. False for a note that only reads, which writes nothing.
|
|
407
|
-
*/
|
|
374
|
+
/** Whether the sender's note writes records but can't define collections here (false for a read-only note) */
|
|
408
375
|
readonly recordsOnly: boolean;
|
|
409
376
|
readonly message: unknown;
|
|
410
377
|
}
|
|
@@ -437,7 +404,7 @@ export type NodeEvent =
|
|
|
437
404
|
readonly type: 'message';
|
|
438
405
|
readonly space: string;
|
|
439
406
|
} & LiveMessage)
|
|
440
|
-
/** The note this node writes under was revoked in a space
|
|
407
|
+
/** The note this node writes under was revoked in a space */
|
|
441
408
|
| {
|
|
442
409
|
readonly type: 'revoked';
|
|
443
410
|
readonly space: string;
|
|
@@ -450,16 +417,16 @@ export type NodeEvent =
|
|
|
450
417
|
export interface NodeNetwork {
|
|
451
418
|
/** Where each relay and connection stands. No relays when none are configured. */
|
|
452
419
|
status(): MeshStatus;
|
|
453
|
-
/** Tries every relay
|
|
420
|
+
/** Tries every relay waiting to reconnect, now */
|
|
454
421
|
reconnect(): void;
|
|
455
422
|
}
|
|
456
423
|
/** Who someone is in a space: the name they gave there, by their identity */
|
|
457
424
|
export interface SpaceProfile {
|
|
458
|
-
/** Their identity
|
|
425
|
+
/** Their identity, as `root` and `createdBy` on a record name it */
|
|
459
426
|
readonly did: string;
|
|
460
427
|
readonly name: string;
|
|
461
428
|
readonly updatedAt: string;
|
|
462
|
-
/**
|
|
429
|
+
/** Their contact key's public half, which a contact request is sealed to */
|
|
463
430
|
readonly contactKey?: string;
|
|
464
431
|
/** Their picture, a file in this space: read it with `records.readFile` */
|
|
465
432
|
readonly avatar?: FileRef;
|
|
@@ -468,85 +435,74 @@ export interface NodeSpaces {
|
|
|
468
435
|
list(): Promise<ReadonlyArray<SpaceSummary>>;
|
|
469
436
|
get(spaceId: string): Promise<SpaceSummary | null>;
|
|
470
437
|
create(params: NewSpace): Promise<SpaceSummary>;
|
|
471
|
-
/** An invite string
|
|
438
|
+
/** An invite string. For a private space it carries the key: treat it as a secret */
|
|
472
439
|
invite(spaceId: string, options?: InviteOptions): Promise<string>;
|
|
473
440
|
/** What an invite or link is for; a short link is fetched from its mailboxes first */
|
|
474
441
|
preview(invite: string): Promise<InvitePreview>;
|
|
475
|
-
/** Joins a space from an invite. `memberKey
|
|
442
|
+
/** Joins a space from an invite. `memberKey` lets a node without the account key receive new space keys */
|
|
476
443
|
join(invite: string, options?: {
|
|
477
444
|
readonly memberKey?: Uint8Array;
|
|
478
445
|
}): Promise<SpaceSummary>;
|
|
479
|
-
/** Gives up the account's place in a space
|
|
446
|
+
/** Gives up the account's place in a space, then forgets it and its key here */
|
|
480
447
|
leave(spaceId: string): Promise<void>;
|
|
481
448
|
/** Roles, members and invites, as the space's access history says now */
|
|
482
449
|
access(spaceId: string): Promise<SpaceAccess>;
|
|
483
450
|
/** Whether this account, or `account`, may invoke a command with these arguments in a space now (spec 03 §2) */
|
|
484
451
|
may(spaceId: string, cmd: string, args?: Readonly<Record<string, unknown>>, account?: string): Promise<boolean>;
|
|
485
|
-
/**
|
|
486
|
-
* Whether this account, or `account`, holds every grant a role gives, each as
|
|
487
|
-
* wide or wider: what it may hand to a bot or an agent without handing on
|
|
488
|
-
* more than it holds. Compares the policies' words, so it may say no where
|
|
489
|
-
* they would allow, never yes where they wouldn't.
|
|
490
|
-
*/
|
|
452
|
+
/** Whether this account, or `account`, holds every grant of a role at least as wide; may say no wrongly, never yes */
|
|
491
453
|
holdsRole(spaceId: string, role: string, account?: string): Promise<boolean>;
|
|
492
|
-
/** Writes a role's definition, replacing the ones
|
|
454
|
+
/** Writes a role's definition, replacing the ones held. Needs `/role/define` */
|
|
493
455
|
defineRole(spaceId: string, role: SpaceRole): Promise<void>;
|
|
494
456
|
/** Assigns a role to an account. Needs `/role/assign` */
|
|
495
457
|
assign(spaceId: string, did: string, role: string): Promise<void>;
|
|
496
|
-
/** Takes a role from an account
|
|
458
|
+
/** Takes a role from an account. Needs `/role/unassign`, unless it is your own */
|
|
497
459
|
unassign(spaceId: string, did: string, role: string): Promise<void>;
|
|
498
|
-
/** Removes an account and
|
|
460
|
+
/** Removes an account and its roles. Needs `/member/remove`, unless it is you */
|
|
499
461
|
removeMember(spaceId: string, did: string): Promise<void>;
|
|
500
|
-
/**
|
|
501
|
-
* Stops being a founder and stays, with the roles you hold: given `keep`,
|
|
502
|
-
* you take that role first. To go altogether, `leave`. Only a founder steps
|
|
503
|
-
* down, and only itself
|
|
504
|
-
*/
|
|
462
|
+
/** Stops being a founder but stays, taking role `keep` first when given */
|
|
505
463
|
stepDown(spaceId: string, options?: {
|
|
506
464
|
readonly keep?: string;
|
|
507
465
|
}): Promise<void>;
|
|
508
|
-
/**
|
|
509
|
-
* Names a space that succeeds this one (its constitution's `succeeds`
|
|
510
|
-
* naming this one). It changes nothing here. Needs `/space/succeed`, or,
|
|
511
|
-
* where no member holds it, a place here
|
|
512
|
-
*/
|
|
466
|
+
/** Names a space that succeeds this one. Needs `/space/succeed`, or a place here when no one holds it */
|
|
513
467
|
succeed(spaceId: string, successor: string): Promise<void>;
|
|
514
|
-
/** Closes an invite
|
|
468
|
+
/** Closes an invite, by link or by its key from `access().invites`. Who joined with it stays. */
|
|
515
469
|
closeInvite(spaceId: string, keyOrLink: string): Promise<void>;
|
|
516
|
-
/** Gives a private space a new key,
|
|
470
|
+
/** Gives a private space a new key, for a lost device. Needs `/key/change` */
|
|
517
471
|
changeKey(spaceId: string): Promise<void>;
|
|
518
|
-
/** Names the relays (wss://, at most 8) the space's members meet on
|
|
472
|
+
/** Names the relays (wss://, at most 8) the space's members meet on. Needs `/space/relays` */
|
|
519
473
|
setRelays(spaceId: string, relays: ReadonlyArray<string>): Promise<void>;
|
|
520
474
|
/** Names the nodes that keep the space whole (at most 16), and how many a write should reach. Needs `/space/keepers` */
|
|
521
475
|
setKeepers(spaceId: string, keepers: ReadonlyArray<Keeper>, copies?: number | null): Promise<void>;
|
|
522
476
|
/**
|
|
523
|
-
* Revokes one of this account's keys
|
|
524
|
-
* With `waitMs`, waits
|
|
477
|
+
* Revokes one of this account's keys, by DID: nothing it writes counts from then on.
|
|
478
|
+
* With `waitMs`, waits that long for a peer to take it in: true when one did, or with no wait.
|
|
525
479
|
*/
|
|
526
480
|
revoke(spaceId: string, key: string, options?: RevokeOptions): Promise<boolean>;
|
|
527
481
|
/** Keeps a space syncing until the function it returns is called; it stops once nothing holds it */
|
|
528
482
|
hold(spaceId: string): Promise<() => Promise<void>>;
|
|
529
|
-
/** A live message to
|
|
483
|
+
/** A live message (at most 64 KB) to peers connected now, `to` an account or a session DID; kept nowhere */
|
|
530
484
|
send(spaceId: string, message: unknown, to?: string): Promise<void>;
|
|
531
485
|
status(spaceId: string): Promise<SpaceStatus>;
|
|
532
|
-
/**
|
|
533
|
-
* Waits up to `waitMs` (default 3 s) for one of the account's carriers that
|
|
534
|
-
* is connected now to hold everything this node does of a space, so an
|
|
535
|
-
* invite to it works with every device of the account away. False at once
|
|
536
|
-
* when no carrier is connected, and false when it didn't catch up in time.
|
|
537
|
-
*/
|
|
486
|
+
/** Waits up to `waitMs` (default 3 s) for a connected carrier to hold all this node does of a space */
|
|
538
487
|
carried(spaceId: string, options?: {
|
|
539
488
|
readonly waitMs?: number;
|
|
540
489
|
}): Promise<boolean>;
|
|
490
|
+
/** Waits up to `waitMs` (at most a minute) for one peer, by its key, to hold all this node does of a space; for a node about to close */
|
|
491
|
+
reached(spaceId: string, peer: string, waitMs: number): Promise<boolean>;
|
|
492
|
+
/**
|
|
493
|
+
* Waits up to `waitMs` (at most a minute) for this node's writes in a space
|
|
494
|
+
* to be kept elsewhere: by the space's keepers, every write from `since`
|
|
495
|
+
* (ms) on, all by default (`'keepers'`); or, in a space that names none,
|
|
496
|
+
* where every member's node is a copy, by a peer connected now that holds
|
|
497
|
+
* all this node does (`'peer'`). Null when nobody had, in time.
|
|
498
|
+
*/
|
|
499
|
+
kept(spaceId: string, waitMs: number, since?: number): Promise<'keepers' | 'peer' | null>;
|
|
541
500
|
/** How a node serving this space checks connecting peers and signs its welcome; null for a space it does not hold */
|
|
542
501
|
authenticator(spaceId: string): Promise<ServerAuth | null>;
|
|
543
|
-
/** The name each person gave in this space
|
|
502
|
+
/** The name each person gave in this space; yours is published from the account's name */
|
|
544
503
|
profiles(spaceId: string): Promise<ReadonlyArray<SpaceProfile>>;
|
|
545
504
|
}
|
|
546
|
-
/**
|
|
547
|
-
* A file a body refers to, as `records.addFile` gives it: what names it on a
|
|
548
|
-
* version (`hash`, `size`), what opens it (`key`, `salt`), and what it is.
|
|
549
|
-
*/
|
|
505
|
+
/** A file a body refers to, as `records.addFile` gives it */
|
|
550
506
|
export interface FileRef {
|
|
551
507
|
readonly hash: string;
|
|
552
508
|
readonly size: number;
|
|
@@ -560,63 +516,43 @@ export interface NodeRecords {
|
|
|
560
516
|
list<T = unknown>(spaceId: string, options?: ListOptions): Promise<ReadonlyArray<NodeRecord<T>>>;
|
|
561
517
|
/** A record's current version, or null when there is none or it was deleted */
|
|
562
518
|
get<T = unknown>(spaceId: string, key: string): Promise<NodeRecord<T> | null>;
|
|
563
|
-
/**
|
|
564
|
-
* How a record's newest version that stands fares under its collection's
|
|
565
|
-
* contract, or the version named. A version that fails is kept and synced
|
|
566
|
-
* by every peer, but `get`, `list` and queries count only versions that
|
|
567
|
-
* pass (packages/core/docs/contracts.md).
|
|
568
|
-
*/
|
|
519
|
+
/** How a record's newest standing version, or the one named, fares under its collection's contract */
|
|
569
520
|
contracts(spaceId: string, key: string, version?: string): Promise<RecordContracts | null>;
|
|
570
|
-
/**
|
|
571
|
-
* The key `name` has in an account's namespace (this one's unless another
|
|
572
|
-
* is named): where `put(…, { key: name })` writes. Keys belong to the
|
|
573
|
-
* account that creates them (packages/core/docs/records-and-queries.md#keys).
|
|
574
|
-
*/
|
|
521
|
+
/** The key `name` has in an account's namespace (this one's by default): where `put(…, { key: name })` writes */
|
|
575
522
|
keyFor(spaceId: string, name: string, account?: string): Promise<string>;
|
|
576
|
-
/**
|
|
577
|
-
* The key a record with this body and links has under its collection's
|
|
578
|
-
* `onePer`, written by `account` (this one unless named): null when the
|
|
579
|
-
* collection has no `onePer`, or the body lacks a part it names.
|
|
580
|
-
*/
|
|
523
|
+
/** The key a record with this body has under its collection's `onePer`; null when there is none */
|
|
581
524
|
onePerKey(spaceId: string, collection: string, body: unknown, options?: {
|
|
582
525
|
links?: ReadonlyArray<Link>;
|
|
583
526
|
account?: string;
|
|
584
527
|
}): Promise<string | null>;
|
|
585
|
-
/**
|
|
586
|
-
* Creates a record, under a fresh key of this account's, or the name given
|
|
587
|
-
* as `key` in its namespace. Writing a deleted key brings it back
|
|
588
|
-
*/
|
|
528
|
+
/** Creates a record under a fresh key, or `key` in this account's namespace. Writing a deleted key brings it back. */
|
|
589
529
|
put<T = unknown>(spaceId: string, collection: string, body: T, options?: {
|
|
590
530
|
key?: string;
|
|
591
531
|
links?: ReadonlyArray<Link>;
|
|
592
532
|
}): Promise<NodeRecord<T>>;
|
|
593
|
-
/** The same,
|
|
533
|
+
/** The same, typed by the collection's definition */
|
|
594
534
|
put<C extends {
|
|
595
535
|
readonly name: string;
|
|
596
536
|
}>(spaceId: string, collection: C, body: BodyOf<C>, options?: {
|
|
597
537
|
key?: string;
|
|
598
538
|
links?: ReadonlyArray<Link>;
|
|
599
539
|
}): Promise<NodeRecord<BodyOf<C>>>;
|
|
600
|
-
/** Writes the record's next version
|
|
540
|
+
/** Writes the record's next version; links carry over unless given */
|
|
601
541
|
update<T = unknown>(spaceId: string, key: string, body: T, options?: {
|
|
602
542
|
links?: ReadonlyArray<Link>;
|
|
603
543
|
}): Promise<NodeRecord<T>>;
|
|
604
|
-
/** The records whose current version points at this one
|
|
544
|
+
/** The records whose current version points at this one, optionally by role or collection */
|
|
605
545
|
linked<T = unknown>(spaceId: string, key: string, options?: {
|
|
606
546
|
rel?: string;
|
|
607
547
|
collection?: string;
|
|
608
548
|
}): Promise<ReadonlyArray<NodeRecord<T>>>;
|
|
609
549
|
/** Deletes a record everywhere, by writing a version marked deleted */
|
|
610
550
|
delete(spaceId: string, key: string): Promise<void>;
|
|
611
|
-
/** The versions of a record kept here, newest first
|
|
551
|
+
/** The versions of a record kept here, newest first */
|
|
612
552
|
history<T = unknown>(spaceId: string, key: string): Promise<ReadonlyArray<NodeRecord<T>>>;
|
|
613
|
-
/** Whether this account may `create` in a collection
|
|
553
|
+
/** Whether this account may `create` in a collection, or `edit` / `delete` a record; `target` names it */
|
|
614
554
|
can(spaceId: string, action: 'create' | 'edit' | 'delete', target: string): Promise<boolean>;
|
|
615
|
-
/**
|
|
616
|
-
* Seals a file under a key of its own, keeps it, and gives back the
|
|
617
|
-
* reference to put in a body: a version whose body holds it names the file
|
|
618
|
-
* on its outside, so peers fetch and keep it (spec 05 §16.6).
|
|
619
|
-
*/
|
|
555
|
+
/** Seals and keeps a file, giving the reference to put in a body (spec 05 §16.6) */
|
|
620
556
|
addFile(spaceId: string, bytes: Uint8Array, about: {
|
|
621
557
|
mime: string;
|
|
622
558
|
name?: string;
|
|
@@ -633,7 +569,7 @@ export interface NodeRecords {
|
|
|
633
569
|
}
|
|
634
570
|
export interface AccountProfileView {
|
|
635
571
|
readonly name: string;
|
|
636
|
-
/** The account's picture, a file in its registry
|
|
572
|
+
/** The account's picture, a file in its registry */
|
|
637
573
|
readonly avatar?: FileRef;
|
|
638
574
|
/** When it was set, on whichever device set it */
|
|
639
575
|
readonly updatedAt: string;
|
|
@@ -650,11 +586,7 @@ export interface CarrierSummary {
|
|
|
650
586
|
/** Nodes that keep the account's spaces online without reading them (`space/pass.ts`). Needs the account key */
|
|
651
587
|
export interface NodeCarriers {
|
|
652
588
|
list(): Promise<ReadonlyArray<CarrierSummary>>;
|
|
653
|
-
/**
|
|
654
|
-
* Starts using a carrier: a carry space with a pass for every space, kept
|
|
655
|
-
* current by every device. Its invite is the carrier's. The same carrier
|
|
656
|
-
* again, by DID, gets the carry space it has.
|
|
657
|
-
*/
|
|
589
|
+
/** Starts using a carrier: a carry space with a pass for every space, and the invite to give it */
|
|
658
590
|
add(carrier: {
|
|
659
591
|
readonly did: string;
|
|
660
592
|
readonly name: string;
|
|
@@ -662,20 +594,9 @@ export interface NodeCarriers {
|
|
|
662
594
|
readonly space: string;
|
|
663
595
|
readonly invite: string;
|
|
664
596
|
}>;
|
|
665
|
-
/**
|
|
666
|
-
* Waits up to `waitMs` for the carrier to hold what this node wrote for it:
|
|
667
|
-
* level with it in its carry space, then in the account registry. A node
|
|
668
|
-
* about to close — the home's window, once it has answered — waits for this,
|
|
669
|
-
* or nobody may hand the carrier its passes until the home opens again.
|
|
670
|
-
*/
|
|
597
|
+
/** Waits up to `waitMs` for the carrier to hold what this node wrote for it; for a node about to close */
|
|
671
598
|
reached(space: string, waitMs: number): Promise<boolean>;
|
|
672
|
-
/**
|
|
673
|
-
* Waits up to `waitMs` for every carrier's carry space to hold the passes
|
|
674
|
-
* and wakes as they are now, written here, and says whether it does. They
|
|
675
|
-
* are written in the background: adding a carrier or an automation doesn't
|
|
676
|
-
* wait, so a node about to close waits on this. It covers a refill already
|
|
677
|
-
* started, or asked for, and is true at once when there is none.
|
|
678
|
-
*/
|
|
599
|
+
/** Waits up to `waitMs` for the passes and wakes written in the background to be done; for a node about to close */
|
|
679
600
|
settled(waitMs: number): Promise<boolean>;
|
|
680
601
|
/** Stops using a carrier: its passes go, and it is told to forget what it held */
|
|
681
602
|
remove(space: string): Promise<void>;
|
|
@@ -685,11 +606,7 @@ export interface OwnAutomationView extends Automation {
|
|
|
685
606
|
/** Its record key in the registry */
|
|
686
607
|
readonly id: string;
|
|
687
608
|
}
|
|
688
|
-
/**
|
|
689
|
-
* "Let me know when…": the account's own automations, across its spaces,
|
|
690
|
-
* noticed by its carriers, which get each value as a topic tag. Needs the
|
|
691
|
-
* account key.
|
|
692
|
-
*/
|
|
609
|
+
/** "Let me know when…": the account's own automations, noticed by its carriers. Needs the account key. */
|
|
693
610
|
export interface NodeAutomations {
|
|
694
611
|
list(): Promise<ReadonlyArray<OwnAutomationView>>;
|
|
695
612
|
/** Starts one: `when.query` is a collection and a `where` over each new record, `$me` the account */
|
|
@@ -718,66 +635,55 @@ export interface HostingView {
|
|
|
718
635
|
/** The subscription — the key the account made for this host */
|
|
719
636
|
readonly subscription: string;
|
|
720
637
|
readonly since: string;
|
|
721
|
-
/** How the subscription stands, as the host signed it: now when `live`, else
|
|
722
|
-
readonly status:
|
|
638
|
+
/** How the subscription stands, as the host signed it: now when `live`, else last heard */
|
|
639
|
+
readonly status: HostStatus | null;
|
|
723
640
|
/** Whether `status` is what the host said just now */
|
|
724
641
|
readonly live: boolean;
|
|
725
642
|
/** Why it could not be reached */
|
|
726
643
|
readonly error?: string;
|
|
727
|
-
/** How the account's balance there is added to
|
|
728
|
-
readonly fund:
|
|
644
|
+
/** How the account's balance there is added to; null when it takes no payments or can't be reached */
|
|
645
|
+
readonly fund: FundOffer | null;
|
|
729
646
|
/** Whether it sends reminders by email (`remind`) */
|
|
730
647
|
readonly reminds: boolean;
|
|
731
648
|
}
|
|
732
|
-
/**
|
|
733
|
-
* Hosts: carriers the account pays for, online when every device is off. A
|
|
734
|
-
* device never handles a payment (spec/06-nodes-and-sessions.md, Hosts).
|
|
735
|
-
*/
|
|
649
|
+
/** Hosts: carriers the account pays for (spec/06-nodes-and-sessions.md, Hosts) */
|
|
736
650
|
export interface NodeHosting {
|
|
737
|
-
/** The hosts the account uses, each asked how it stands
|
|
651
|
+
/** The hosts the account uses, each asked how it stands; a host paid since gets the spaces */
|
|
738
652
|
list(): Promise<ReadonlyArray<HostingView>>;
|
|
739
653
|
/** Starts using a host: a subscription key every device signs as, and the spaces once it is paid */
|
|
740
654
|
use(url: string): Promise<HostingView>;
|
|
741
|
-
/** Adds to the account's balance at a host: a `checkout` page to open
|
|
742
|
-
pay(url: string, payment:
|
|
743
|
-
/** Asks a host for reminders by email before paid time runs out
|
|
655
|
+
/** Adds to the account's balance at a host: a `checkout` page to open, or a `request` for a wallet */
|
|
656
|
+
pay(url: string, payment: FundPayment): Promise<PayAnswer>;
|
|
657
|
+
/** Asks a host for reminders by email before paid time runs out */
|
|
744
658
|
remind(url: string, email: string): Promise<void>;
|
|
745
|
-
/** Stops using a host: it forgets the spaces
|
|
659
|
+
/** Stops using a host: it forgets the spaces. Cancel a renewing card first (`manage`). */
|
|
746
660
|
stop(url: string): Promise<void>;
|
|
747
|
-
/** The hosts a space pays (`std.host`), each asked how
|
|
661
|
+
/** The hosts a space pays (`std.host`), each asked how it stands; one paid gets the pass */
|
|
748
662
|
space(spaceId: string): Promise<ReadonlyArray<SpaceHostingView>>;
|
|
749
|
-
/**
|
|
750
|
-
* The account's hosts that last said a space is over their free line
|
|
751
|
-
* (spec 08 §1.1), from the statuses they signed: what a member is told
|
|
752
|
-
* before those hosts stop carrying it for members. Asks no host.
|
|
753
|
-
*/
|
|
663
|
+
/** The account's hosts that last said a space is over their free line (spec 08 §1.1). Asks no host. */
|
|
754
664
|
over(spaceId: string): Promise<ReadonlyArray<{
|
|
755
665
|
readonly url: string;
|
|
756
666
|
readonly name: string;
|
|
757
|
-
readonly over:
|
|
667
|
+
readonly over: OverSpace;
|
|
758
668
|
}>>;
|
|
759
|
-
/**
|
|
760
|
-
payForSpace(spaceId: string, url: string, payment:
|
|
669
|
+
/** Adds to a space's fund at a host it names, once or monthly. Anyone in it may. */
|
|
670
|
+
payForSpace(spaceId: string, url: string, payment: FundPayment): Promise<PayAnswer>;
|
|
761
671
|
/** Asks a host a space names for reminders by email before the space's paid time runs out */
|
|
762
672
|
remindForSpace(spaceId: string, url: string, email: string): Promise<void>;
|
|
763
|
-
/**
|
|
764
|
-
* Stops a space using a host: its `std.host` record goes, and with `manage`
|
|
765
|
-
* its bots are removed and a private space gets a new key. Nothing is asked
|
|
766
|
-
* of the host.
|
|
767
|
-
*/
|
|
673
|
+
/** Stops a space using a host: its `std.host` record goes, and with `manage` its bots and key */
|
|
768
674
|
stopForSpace(spaceId: string, url: string): Promise<{
|
|
769
675
|
/** The bots removed from the space, by DID */
|
|
770
676
|
readonly bots: ReadonlyArray<string>;
|
|
771
677
|
/** Whether the space's key changes because of it */
|
|
772
678
|
readonly newKey: boolean;
|
|
773
679
|
}>;
|
|
774
|
-
/** Asks a host the space names to run a bot there
|
|
680
|
+
/** Asks a host the space names to run a bot there with `role`; removing the bot stops it */
|
|
775
681
|
startBot(spaceId: string, url: string, bot: {
|
|
776
682
|
readonly name: string;
|
|
777
683
|
readonly role?: string;
|
|
778
684
|
}): Promise<{
|
|
779
685
|
readonly bot: string;
|
|
780
|
-
readonly status:
|
|
686
|
+
readonly status: HostStatus;
|
|
781
687
|
}>;
|
|
782
688
|
}
|
|
783
689
|
/** A host a space pays for itself, as `hosting.space` sees it */
|
|
@@ -788,33 +694,30 @@ export interface SpaceHostingView {
|
|
|
788
694
|
/** The host's key; null when it could not be reached */
|
|
789
695
|
readonly host: string | null;
|
|
790
696
|
/** How the space's subscription stands there, signed by the host; null when it could not be asked */
|
|
791
|
-
readonly status:
|
|
697
|
+
readonly status: HostStatus | null;
|
|
792
698
|
/** Whether it keeps spaces for nothing: every subscription counts as paid there */
|
|
793
699
|
readonly free: boolean;
|
|
794
|
-
/** How the space's fund is added to there
|
|
795
|
-
readonly fund:
|
|
700
|
+
/** How the space's fund is added to there; null on a free host, or one that takes no communities */
|
|
701
|
+
readonly fund: FundOffer | null;
|
|
796
702
|
/** Whether it sends reminders by email (`remindForSpace`) */
|
|
797
703
|
readonly reminds: boolean;
|
|
798
704
|
/** Whether it runs bots for the spaces it carries (`startBot`) */
|
|
799
705
|
readonly runsBots: boolean;
|
|
800
|
-
/** The bots it runs in this space,
|
|
801
|
-
readonly bots: ReadonlyArray<
|
|
706
|
+
/** The bots it runs in this space, as its signed status says */
|
|
707
|
+
readonly bots: ReadonlyArray<HostedBot>;
|
|
802
708
|
/** The services its bots can be connected to (spec 08 §3.1) */
|
|
803
|
-
readonly connectors: ReadonlyArray<
|
|
709
|
+
readonly connectors: ReadonlyArray<HostConnectorOffer>;
|
|
804
710
|
/** Why it could not be asked, when it couldn't */
|
|
805
711
|
readonly error?: string;
|
|
806
712
|
}
|
|
807
713
|
export interface NodeAccount {
|
|
808
|
-
/** The account's profile
|
|
714
|
+
/** The account's profile; null without an account key, or before one is set */
|
|
809
715
|
profile(): Promise<AccountProfileView | null>;
|
|
810
|
-
/** Renames the account
|
|
716
|
+
/** Renames the account everywhere. Needs an account key. */
|
|
811
717
|
setName(name: string): Promise<AccountProfileView>;
|
|
812
718
|
/**
|
|
813
|
-
* Sets the account's picture
|
|
814
|
-
*
|
|
815
|
-
* takes it away. `name` is the account's name as the app knows it, kept
|
|
816
|
-
* with the picture when the registry has none yet (an app just connected,
|
|
817
|
-
* before the registry has synced). Needs an account key.
|
|
719
|
+
* Sets the account's picture everywhere, already resized; `null` removes it.
|
|
720
|
+
* `name` is kept with it when the registry has no name yet. Needs an account key.
|
|
818
721
|
*/
|
|
819
722
|
setAvatar(image: {
|
|
820
723
|
bytes: Uint8Array;
|
|
@@ -827,27 +730,43 @@ export interface NodeAccount {
|
|
|
827
730
|
bytes: Uint8Array;
|
|
828
731
|
mime: string;
|
|
829
732
|
} | null>;
|
|
830
|
-
/** Revokes one of this account's keys
|
|
733
|
+
/** Revokes one of this account's keys in the account registry. Needs an account key. */
|
|
831
734
|
revoke(key: string, options?: RevokeOptions): Promise<boolean>;
|
|
832
735
|
}
|
|
833
736
|
/** Someone in the account's contact list */
|
|
834
737
|
export interface ContactView {
|
|
835
738
|
/** Their account */
|
|
836
739
|
readonly did: string;
|
|
837
|
-
/** What you call them
|
|
740
|
+
/** What you call them; they never see it */
|
|
838
741
|
readonly name: string;
|
|
839
|
-
/**
|
|
742
|
+
/** Your space for two with them, or null */
|
|
840
743
|
readonly space: string | null;
|
|
841
744
|
readonly note?: string;
|
|
842
745
|
/** Their knocks are hidden, in every space and in your inbox */
|
|
843
746
|
readonly blocked: boolean;
|
|
747
|
+
/** Their username, when you found them by it */
|
|
748
|
+
readonly username?: string;
|
|
844
749
|
readonly updatedAt: string;
|
|
845
750
|
}
|
|
751
|
+
/** An invite to a space a contact left for you in your space for two */
|
|
752
|
+
export interface SpaceInviteView {
|
|
753
|
+
/** Who left it */
|
|
754
|
+
readonly from: string;
|
|
755
|
+
/** The space it invites you to, and what it is called */
|
|
756
|
+
readonly space: string;
|
|
757
|
+
readonly name: string;
|
|
758
|
+
/** What `spaces.join` takes */
|
|
759
|
+
readonly invite: string;
|
|
760
|
+
/** The space for two it was left in, and its record there: what `join` takes */
|
|
761
|
+
readonly pairSpace: string;
|
|
762
|
+
readonly key: string;
|
|
763
|
+
readonly createdAt: string;
|
|
764
|
+
}
|
|
846
765
|
/** A knock left for this account in a space both belong to, opened */
|
|
847
766
|
export interface ContactRequest {
|
|
848
767
|
/** The space it was left in */
|
|
849
768
|
readonly space: string;
|
|
850
|
-
/** Its record there
|
|
769
|
+
/** Its record there: what `accept` takes */
|
|
851
770
|
readonly key: string;
|
|
852
771
|
/** The account asking */
|
|
853
772
|
readonly from: string;
|
|
@@ -858,9 +777,9 @@ export interface ContactRequest {
|
|
|
858
777
|
readonly pairSpace: string;
|
|
859
778
|
readonly createdAt: string;
|
|
860
779
|
}
|
|
861
|
-
/** The account's contacts: each a private space for two, listed in the
|
|
780
|
+
/** The account's contacts: each a private space for two, listed in the contacts space */
|
|
862
781
|
export interface NodeContacts {
|
|
863
|
-
/** The contacts space's id
|
|
782
|
+
/** The contacts space's id, or null for a node not given it */
|
|
864
783
|
space(): Promise<string | null>;
|
|
865
784
|
/** Everyone in the list, blocked people too, by name */
|
|
866
785
|
list(): Promise<ReadonlyArray<ContactView>>;
|
|
@@ -877,11 +796,8 @@ export interface NodeContacts {
|
|
|
877
796
|
/** Leaves your space for two, and hides their knocks from now on */
|
|
878
797
|
block(did: string): Promise<void>;
|
|
879
798
|
/**
|
|
880
|
-
* Asks someone in a space
|
|
881
|
-
*
|
|
882
|
-
* a `std.contact-request`. `carried` is whether a carrier held the space for two before
|
|
883
|
-
* it went out (`spaces.carried`): when false, they can join only while one
|
|
884
|
-
* of your devices is online.
|
|
799
|
+
* Asks someone in a shared space to add you: a space for two, its invite sealed
|
|
800
|
+
* to them as a `std.contact-request`. `carried`: whether a carrier held it first.
|
|
885
801
|
*/
|
|
886
802
|
ask(spaceId: string, did: string, options?: {
|
|
887
803
|
readonly note?: string;
|
|
@@ -890,12 +806,27 @@ export interface NodeContacts {
|
|
|
890
806
|
readonly request: string;
|
|
891
807
|
readonly carried: boolean;
|
|
892
808
|
}>;
|
|
893
|
-
/** Knocks left for this account in a space,
|
|
809
|
+
/** Knocks left for this account in a space, except blocked and accepted ones */
|
|
894
810
|
requests(spaceId: string): Promise<ReadonlyArray<ContactRequest>>;
|
|
895
811
|
/** Joins the space for two a knock invites you to, and puts whoever asked on your list */
|
|
896
812
|
accept(spaceId: string, requestKey: string): Promise<ContactView>;
|
|
897
|
-
/** Accounts in your space for two besides the two of you
|
|
813
|
+
/** Accounts in your space for two besides the two of you */
|
|
898
814
|
others(did: string): Promise<ReadonlyArray<string>>;
|
|
815
|
+
/**
|
|
816
|
+
* Invites a contact into one of your spaces: an invite for `role` (as
|
|
817
|
+
* `spaces.invite` makes one), left in your space for two with them. Only a
|
|
818
|
+
* contact who has joined that space can be invited.
|
|
819
|
+
*/
|
|
820
|
+
invite(did: string, spaceId: string, options?: {
|
|
821
|
+
readonly role?: string;
|
|
822
|
+
}): Promise<void>;
|
|
823
|
+
/**
|
|
824
|
+
* Invites your contacts left for you, to spaces you don't hold yet, newest
|
|
825
|
+
* first. Also closes invites of yours a contact has used, and deletes them.
|
|
826
|
+
*/
|
|
827
|
+
invites(): Promise<ReadonlyArray<SpaceInviteView>>;
|
|
828
|
+
/** Joins the space an invite from a contact is for; its maker closes the invite once they see you there */
|
|
829
|
+
join(pairSpace: string, key: string): Promise<SpaceSummary>;
|
|
899
830
|
}
|
|
900
831
|
/** A direct message, opened (`node.direct`) */
|
|
901
832
|
export interface DirectMessage {
|
|
@@ -905,7 +836,7 @@ export interface DirectMessage {
|
|
|
905
836
|
readonly from: string;
|
|
906
837
|
/** Who it is for, sorted, not counting `from` */
|
|
907
838
|
readonly to: ReadonlyArray<string>;
|
|
908
|
-
/** Null when this node can't open it
|
|
839
|
+
/** Null when this node can't open it */
|
|
909
840
|
readonly text: string | null;
|
|
910
841
|
readonly createdAt: string;
|
|
911
842
|
/** Written under a note that grants records only here, as `NodeRecord.recordsOnly` */
|
|
@@ -913,9 +844,9 @@ export interface DirectMessage {
|
|
|
913
844
|
}
|
|
914
845
|
/** Direct messages: text sealed to some members' member keys, in a private space (`docs/direct-messages.md`) */
|
|
915
846
|
export interface NodeDirect {
|
|
916
|
-
/**
|
|
847
|
+
/** Members who published a member key, besides you */
|
|
917
848
|
reachable(spaceId: string): Promise<ReadonlyArray<string>>;
|
|
918
|
-
/** Seals text for these members and you, and writes it
|
|
849
|
+
/** Seals text for these members and you, and writes it, defining `std.direct` when needed */
|
|
919
850
|
send(spaceId: string, to: ReadonlyArray<string>, text: string): Promise<DirectMessage>;
|
|
920
851
|
/** Every direct message in the space written by or to this account, oldest first */
|
|
921
852
|
list(spaceId: string): Promise<ReadonlyArray<DirectMessage>>;
|
|
@@ -928,19 +859,22 @@ export interface InboxView {
|
|
|
928
859
|
readonly name?: string;
|
|
929
860
|
/** The inbox key's public half: knocks are sealed to it */
|
|
930
861
|
readonly key: string;
|
|
931
|
-
/** Its signing key's public half
|
|
862
|
+
/** Its signing key's public half, which signs the code */
|
|
932
863
|
readonly sign: string;
|
|
933
864
|
/** Mailboxes that hold its knocks */
|
|
934
865
|
readonly places: ReadonlyArray<string>;
|
|
935
|
-
/** The inbox code to hand out
|
|
866
|
+
/** The inbox code to hand out, in a link (`#inbox=…`) or a QR code */
|
|
936
867
|
readonly code: string;
|
|
868
|
+
/** The username that leads to it, and when it lapses unless claimed again (ms) */
|
|
869
|
+
readonly username?: string;
|
|
870
|
+
readonly usernameUntil?: number;
|
|
937
871
|
readonly updatedAt: string;
|
|
938
872
|
}
|
|
939
873
|
/** Someone knocking on your inbox, checked and opened */
|
|
940
874
|
export interface KnockView {
|
|
941
875
|
/** The knock's id, the same on every relay: what `accept` takes */
|
|
942
876
|
readonly id: string;
|
|
943
|
-
/** Their account
|
|
877
|
+
/** Their account, proven by signature and note */
|
|
944
878
|
readonly from: string;
|
|
945
879
|
/** The name they give; nothing vouches for it */
|
|
946
880
|
readonly name: string;
|
|
@@ -956,25 +890,35 @@ export interface SentKnockView {
|
|
|
956
890
|
readonly space: string;
|
|
957
891
|
/** The name their inbox code gave */
|
|
958
892
|
readonly name: string;
|
|
893
|
+
/** The username you knocked on, when it was one */
|
|
894
|
+
readonly username?: string;
|
|
959
895
|
readonly at: string;
|
|
960
896
|
}
|
|
961
|
-
/** The inbox: how people you share no space with ask to become your contact
|
|
897
|
+
/** The inbox: how people you share no space with ask to become your contact (`spec/07-inbox.md`) */
|
|
962
898
|
export interface NodeInbox {
|
|
963
899
|
/** Your inbox, or null until it is opened */
|
|
964
900
|
get(): Promise<InboxView | null>;
|
|
965
|
-
/** Opens your inbox, or changes
|
|
901
|
+
/** Opens your inbox, or changes its mailboxes (1–3) and the name its code gives */
|
|
966
902
|
open(options?: {
|
|
967
903
|
readonly places?: ReadonlyArray<string>;
|
|
968
904
|
readonly name?: string;
|
|
969
905
|
}): Promise<InboxView>;
|
|
970
|
-
/** Replaces your inbox
|
|
906
|
+
/** Replaces your inbox: codes for the old one lead nowhere */
|
|
971
907
|
rotate(): Promise<InboxView>;
|
|
972
|
-
/** Clears every knock waiting in your inbox
|
|
908
|
+
/** Clears every knock waiting in your inbox, and keeps it open */
|
|
973
909
|
clear(): Promise<void>;
|
|
974
910
|
/**
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
*
|
|
911
|
+
* Claims a username (`leif@minca.social`) for your inbox on its domain's
|
|
912
|
+
* name service, opening the inbox first if need be. The name follows the
|
|
913
|
+
* inbox: replacing it, or changing its name or mailboxes, points the name at
|
|
914
|
+
* the new code, and it is renewed before it lapses.
|
|
915
|
+
*/
|
|
916
|
+
claim(username: string): Promise<InboxView>;
|
|
917
|
+
/** Gives your username up: it leads nowhere, and anyone may claim it */
|
|
918
|
+
release(): Promise<InboxView>;
|
|
919
|
+
/**
|
|
920
|
+
* Knocks on someone's inbox, by its code, a link, or a username, with a
|
|
921
|
+
* space for two; `carried` as for `contacts.ask`
|
|
978
922
|
*/
|
|
979
923
|
knock(code: string, options?: {
|
|
980
924
|
readonly note?: string;
|
|
@@ -982,13 +926,13 @@ export interface NodeInbox {
|
|
|
982
926
|
readonly space: string;
|
|
983
927
|
readonly carried: boolean;
|
|
984
928
|
}>;
|
|
985
|
-
/** Knocks waiting in your inbox
|
|
929
|
+
/** Knocks waiting in your inbox; also turns your knocks someone joined into contacts */
|
|
986
930
|
knocks(): Promise<ReadonlyArray<KnockView>>;
|
|
987
931
|
/** Knocks you left that nobody has joined yet */
|
|
988
932
|
sent(): Promise<ReadonlyArray<SentKnockView>>;
|
|
989
933
|
/** Joins the space for two a knock invites you to, and puts whoever knocked on your list */
|
|
990
934
|
accept(id: string): Promise<ContactView>;
|
|
991
|
-
/** Lets a knock go without blocking whoever knocked
|
|
935
|
+
/** Lets a knock go without blocking whoever knocked */
|
|
992
936
|
dismiss(id: string): Promise<void>;
|
|
993
937
|
}
|
|
994
938
|
export interface P2PNode {
|
|
@@ -1015,13 +959,12 @@ export interface P2PNode {
|
|
|
1015
959
|
readonly inbox: NodeInbox;
|
|
1016
960
|
/** The delegation the session key currently writes under (root → session) */
|
|
1017
961
|
delegation(): Delegation;
|
|
1018
|
-
/** ICE servers for the app's own WebRTC
|
|
962
|
+
/** ICE servers for the app's own WebRTC: the configured ones, and a relay's TURN servers */
|
|
1019
963
|
iceServers(): Promise<ReadonlyArray<RTCIceServer>>;
|
|
1020
964
|
/** Relays and connections, for showing why a peer is or is not there */
|
|
1021
965
|
readonly network: NodeNetwork;
|
|
1022
966
|
/**
|
|
1023
|
-
* The same node acting as an agent
|
|
1024
|
-
* its note names, refusing what needs a person (`node/api.ts`).
|
|
967
|
+
* The same node acting as an agent, only in the spaces its note names (`node/api.ts`).
|
|
1025
968
|
* @throws When the note is not an agent's, has run out, or is not made out to `keys`
|
|
1026
969
|
*/
|
|
1027
970
|
asAgent(agent: {
|
|
@@ -1030,19 +973,13 @@ export interface P2PNode {
|
|
|
1030
973
|
}): Promise<P2PNode>;
|
|
1031
974
|
subscribe(listener: (event: NodeEvent) => void): () => void;
|
|
1032
975
|
/**
|
|
1033
|
-
* Revokes a key of this account
|
|
1034
|
-
*
|
|
1035
|
-
* space it lists, its carry spaces, its contacts space and its registry.
|
|
1036
|
-
* True once a peer has taken each in, or at once without `waitMs`.
|
|
976
|
+
* Revokes a key of this account in `spaces`, or everywhere the account writes.
|
|
977
|
+
* True once a peer took each in, or at once without `waitMs`.
|
|
1037
978
|
*/
|
|
1038
979
|
revokeKey(key: string, options?: RevokeOptions & {
|
|
1039
980
|
readonly spaces?: ReadonlyArray<string>;
|
|
1040
981
|
}): Promise<boolean>;
|
|
1041
|
-
/**
|
|
1042
|
-
* Revokes this node's own session key everywhere (`revokeKey`); a lasting
|
|
1043
|
-
* key is forgotten at once, so the next session signs with a new one. For
|
|
1044
|
-
* signing out.
|
|
1045
|
-
*/
|
|
982
|
+
/** Revokes this node's own key everywhere and forgets a lasting one: for signing out */
|
|
1046
983
|
revokeSelf(options?: RevokeOptions): Promise<void>;
|
|
1047
984
|
close(): Promise<void>;
|
|
1048
985
|
}
|