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