@minca/core 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{session → hosting}/hosting.d.ts +2 -8
- package/dist/hosting/hosting.d.ts.map +1 -0
- package/dist/{session → hosting}/hosting.js +3 -3
- package/dist/hosting/hosting.js.map +1 -0
- package/dist/identity/abilities.d.ts +0 -2
- package/dist/identity/abilities.d.ts.map +1 -1
- package/dist/identity/abilities.js +2 -2
- package/dist/identity/abilities.js.map +1 -1
- package/dist/identity/account-vault.d.ts +0 -2
- package/dist/identity/account-vault.d.ts.map +1 -1
- package/dist/identity/account-vault.js +1 -1
- package/dist/identity/account-vault.js.map +1 -1
- package/dist/identity/crypto-p256.d.ts +1 -1
- package/dist/identity/crypto-p256.d.ts.map +1 -1
- package/dist/identity/ucan.d.ts +2 -1
- package/dist/identity/ucan.d.ts.map +1 -1
- package/dist/identity/ucan.js +1 -1
- package/dist/identity/ucan.js.map +1 -1
- package/dist/inbox/inbox.d.ts +0 -21
- package/dist/inbox/inbox.d.ts.map +1 -1
- package/dist/inbox/inbox.js +4 -4
- package/dist/inbox/inbox.js.map +1 -1
- package/dist/inbox/index.d.ts +4 -5
- package/dist/inbox/index.d.ts.map +1 -1
- package/dist/inbox/index.js +2 -3
- package/dist/inbox/index.js.map +1 -1
- package/dist/inbox/names.d.ts +0 -4
- package/dist/inbox/names.d.ts.map +1 -1
- package/dist/inbox/names.js +2 -2
- package/dist/inbox/names.js.map +1 -1
- package/dist/index.d.ts +50 -84
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -60
- package/dist/index.js.map +1 -1
- package/dist/network/mesh.d.ts.map +1 -1
- package/dist/network/mesh.js +23 -3
- package/dist/network/mesh.js.map +1 -1
- package/dist/network/network-manager.d.ts +5 -0
- package/dist/network/network-manager.d.ts.map +1 -1
- package/dist/network/network-manager.js +3 -0
- package/dist/network/network-manager.js.map +1 -1
- package/dist/network/peer-auth.d.ts +17 -5
- package/dist/network/peer-auth.d.ts.map +1 -1
- package/dist/network/peer-auth.js +19 -9
- package/dist/network/peer-auth.js.map +1 -1
- package/dist/network/rendezvous.d.ts +2 -0
- package/dist/network/rendezvous.d.ts.map +1 -1
- package/dist/network/rendezvous.js +5 -0
- package/dist/network/rendezvous.js.map +1 -1
- package/dist/network/rtc-transport.d.ts.map +1 -1
- package/dist/network/rtc-transport.js +9 -3
- package/dist/network/rtc-transport.js.map +1 -1
- package/dist/network/transport.d.ts +12 -0
- package/dist/network/transport.d.ts.map +1 -1
- package/dist/network/ws-transport.d.ts +1 -1
- package/dist/network/ws-transport.d.ts.map +1 -1
- package/dist/network/ws-transport.js +14 -4
- package/dist/network/ws-transport.js.map +1 -1
- package/dist/node/carrier.d.ts +1 -33
- package/dist/node/carrier.d.ts.map +1 -1
- package/dist/node/carrier.js +38 -68
- package/dist/node/carrier.js.map +1 -1
- package/dist/node/index.d.ts +5 -16
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -9
- package/dist/node/index.js.map +1 -1
- package/dist/node/node-carriers.d.ts.map +1 -1
- package/dist/node/node-carriers.js +21 -52
- package/dist/node/node-carriers.js.map +1 -1
- package/dist/node/node-context.d.ts +0 -2
- package/dist/node/node-context.d.ts.map +1 -1
- package/dist/node/node-context.js.map +1 -1
- package/dist/node/node-hosting.d.ts.map +1 -1
- package/dist/node/node-hosting.js +14 -5
- package/dist/node/node-hosting.js.map +1 -1
- package/dist/node/node-records.js +2 -2
- package/dist/node/node-records.js.map +1 -1
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +152 -36
- package/dist/node/node.js.map +1 -1
- package/dist/node/space-checks.d.ts +3 -1
- package/dist/node/space-checks.d.ts.map +1 -1
- package/dist/node/space-checks.js +7 -3
- package/dist/node/space-checks.js.map +1 -1
- package/dist/node/space-holding.d.ts +5 -0
- package/dist/node/space-holding.d.ts.map +1 -1
- package/dist/node/space-holding.js +90 -5
- package/dist/node/space-holding.js.map +1 -1
- package/dist/node/space-lines.d.ts +3 -0
- package/dist/node/space-lines.d.ts.map +1 -1
- package/dist/node/space-lines.js +13 -1
- package/dist/node/space-lines.js.map +1 -1
- package/dist/node/space-membership.js +4 -4
- package/dist/node/space-membership.js.map +1 -1
- package/dist/node/space-mirrors.d.ts +1 -1
- package/dist/node/space-mirrors.d.ts.map +1 -1
- package/dist/node/space-mirrors.js +17 -5
- package/dist/node/space-mirrors.js.map +1 -1
- package/dist/node/space-peers.d.ts +7 -2
- package/dist/node/space-peers.d.ts.map +1 -1
- package/dist/node/space-peers.js +44 -10
- package/dist/node/space-peers.js.map +1 -1
- package/dist/node/space-runtime.d.ts +7 -3
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +32 -10
- package/dist/node/space-runtime.js.map +1 -1
- package/dist/node/space-standing.d.ts +1 -1
- package/dist/node/space-standing.d.ts.map +1 -1
- package/dist/node/space-standing.js +23 -42
- package/dist/node/space-standing.js.map +1 -1
- package/dist/node/space-warrants.js +1 -1
- package/dist/node/space-warrants.js.map +1 -1
- package/dist/node/space-writing.d.ts.map +1 -1
- package/dist/node/space-writing.js +21 -32
- package/dist/node/space-writing.js.map +1 -1
- package/dist/node/stores.d.ts +9 -57
- package/dist/node/stores.d.ts.map +1 -1
- package/dist/node/stores.js +1 -72
- package/dist/node/stores.js.map +1 -1
- package/dist/node/types.d.ts +19 -8
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/writer-keys.d.ts +15 -14
- package/dist/node/writer-keys.d.ts.map +1 -1
- package/dist/node/writer-keys.js +3 -115
- package/dist/node/writer-keys.js.map +1 -1
- package/dist/privacy/direct.d.ts +0 -7
- package/dist/privacy/direct.d.ts.map +1 -1
- package/dist/privacy/direct.js +2 -2
- package/dist/privacy/direct.js.map +1 -1
- package/dist/query/filter.d.ts +0 -2
- package/dist/query/filter.d.ts.map +1 -1
- package/dist/query/filter.js +1 -1
- package/dist/query/filter.js.map +1 -1
- package/dist/query/types.d.ts +2 -6
- package/dist/query/types.d.ts.map +1 -1
- package/dist/query/types.js.map +1 -1
- package/dist/records/key.d.ts +18 -19
- package/dist/records/key.d.ts.map +1 -1
- package/dist/records/key.js +55 -43
- package/dist/records/key.js.map +1 -1
- package/dist/records/links.js +1 -1
- package/dist/records/rules.d.ts +1 -1
- package/dist/records/rules.d.ts.map +1 -1
- package/dist/records/rules.js +6 -4
- package/dist/records/rules.js.map +1 -1
- package/dist/schemas/direct.d.ts +70 -0
- package/dist/schemas/direct.d.ts.map +1 -0
- package/dist/schemas/direct.js +39 -0
- package/dist/schemas/direct.js.map +1 -0
- package/dist/schemas/index.d.ts +10 -73
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +8 -66
- package/dist/schemas/index.js.map +1 -1
- package/dist/space/account-registry.d.ts +0 -3
- package/dist/space/account-registry.d.ts.map +1 -1
- package/dist/space/account-registry.js.map +1 -1
- package/dist/space/own-automations.d.ts +51 -95
- package/dist/space/own-automations.d.ts.map +1 -1
- package/dist/space/own-automations.js +100 -295
- package/dist/space/own-automations.js.map +1 -1
- package/dist/space/pass.d.ts +8 -3
- package/dist/space/pass.d.ts.map +1 -1
- package/dist/space/pass.js +4 -3
- package/dist/space/pass.js.map +1 -1
- package/dist/space/space-manager.d.ts +1 -3
- package/dist/space/space-manager.d.ts.map +1 -1
- package/dist/space/space-manager.js +5 -7
- package/dist/space/space-manager.js.map +1 -1
- package/dist/storage/body-cache.d.ts +29 -0
- package/dist/storage/body-cache.d.ts.map +1 -0
- package/dist/storage/body-cache.js +64 -0
- package/dist/storage/body-cache.js.map +1 -0
- package/dist/storage/encrypted-adapter.d.ts +0 -5
- package/dist/storage/encrypted-adapter.d.ts.map +1 -1
- package/dist/storage/encrypted-adapter.js +1 -1
- package/dist/storage/encrypted-adapter.js.map +1 -1
- package/dist/storage/mirror.d.ts.map +1 -1
- package/dist/storage/mirror.js +35 -16
- package/dist/storage/mirror.js.map +1 -1
- package/dist/storage/segment.d.ts +6 -2
- package/dist/storage/segment.d.ts.map +1 -1
- package/dist/storage/segment.js +8 -4
- package/dist/storage/segment.js.map +1 -1
- package/dist/storage/shared-store.d.ts +32 -0
- package/dist/storage/shared-store.d.ts.map +1 -0
- package/dist/storage/{folder-reconcile.js → shared-store.js} +15 -15
- package/dist/storage/shared-store.js.map +1 -0
- package/dist/storage/storage-provider.d.ts +19 -9
- package/dist/storage/storage-provider.d.ts.map +1 -1
- package/dist/storage/storage-provider.js +155 -62
- package/dist/storage/storage-provider.js.map +1 -1
- package/dist/sync/sync-engine.d.ts +17 -4
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-engine.js +298 -84
- package/dist/sync/sync-engine.js.map +1 -1
- package/dist/sync/sync-messages.d.ts +5 -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/types.d.ts +19 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/step.d.ts +8 -0
- package/dist/utils/step.d.ts.map +1 -0
- package/dist/utils/step.js +15 -0
- package/dist/utils/step.js.map +1 -0
- package/docs/README.md +4 -3
- package/docs/actions.md +41 -2
- package/docs/agents.md +13 -10
- package/docs/automations.md +16 -48
- package/docs/blueprints-and-guides.md +2 -2
- package/docs/bots.md +3 -3
- package/docs/building-an-app.md +2 -2
- package/docs/collections.md +2 -4
- package/docs/computed.md +1 -2
- package/docs/node.md +108 -40
- package/docs/proposing-collections.md +3 -3
- package/docs/query-format.md +6 -5
- package/docs/records-and-queries.md +12 -13
- package/docs/sign-in.md +16 -16
- package/docs/spaces.md +0 -5
- package/docs/standard-library.md +6 -8
- package/docs/storage.md +114 -22
- package/docs/usernames.md +1 -1
- package/package.json +15 -25
- package/dist/identity/account-store.d.ts +0 -83
- package/dist/identity/account-store.d.ts.map +0 -1
- package/dist/identity/account-store.js +0 -234
- package/dist/identity/account-store.js.map +0 -1
- package/dist/identity/device-key.d.ts +0 -26
- package/dist/identity/device-key.d.ts.map +0 -1
- package/dist/identity/device-key.js +0 -48
- package/dist/identity/device-key.js.map +0 -1
- package/dist/identity/idb.d.ts +0 -19
- package/dist/identity/idb.d.ts.map +0 -1
- package/dist/identity/idb.js +0 -56
- package/dist/identity/idb.js.map +0 -1
- package/dist/node/actions.d.ts +0 -85
- package/dist/node/actions.d.ts.map +0 -1
- package/dist/node/actions.js +0 -921
- package/dist/node/actions.js.map +0 -1
- package/dist/node/host.d.ts +0 -187
- package/dist/node/host.d.ts.map +0 -1
- package/dist/node/host.js +0 -818
- package/dist/node/host.js.map +0 -1
- package/dist/node/usage.d.ts +0 -32
- package/dist/node/usage.d.ts.map +0 -1
- package/dist/node/usage.js +0 -217
- package/dist/node/usage.js.map +0 -1
- package/dist/node/watch-notifications.d.ts +0 -25
- package/dist/node/watch-notifications.d.ts.map +0 -1
- package/dist/node/watch-notifications.js +0 -166
- package/dist/node/watch-notifications.js.map +0 -1
- package/dist/node/worker.d.ts +0 -83
- package/dist/node/worker.d.ts.map +0 -1
- package/dist/node/worker.js +0 -305
- package/dist/node/worker.js.map +0 -1
- package/dist/node-worker.d.ts +0 -2
- package/dist/node-worker.d.ts.map +0 -1
- package/dist/node-worker.js +0 -16
- package/dist/node-worker.js.map +0 -1
- package/dist/schemas/automations.d.ts +0 -390
- package/dist/schemas/automations.d.ts.map +0 -1
- package/dist/schemas/automations.js +0 -619
- package/dist/schemas/automations.js.map +0 -1
- package/dist/schemas/blueprints.d.ts +0 -122
- package/dist/schemas/blueprints.d.ts.map +0 -1
- package/dist/schemas/blueprints.js +0 -337
- package/dist/schemas/blueprints.js.map +0 -1
- package/dist/schemas/choosing.d.ts +0 -19
- package/dist/schemas/choosing.d.ts.map +0 -1
- package/dist/schemas/choosing.js +0 -69
- package/dist/schemas/choosing.js.map +0 -1
- package/dist/schemas/connectors.d.ts +0 -202
- package/dist/schemas/connectors.d.ts.map +0 -1
- package/dist/schemas/connectors.js +0 -140
- package/dist/schemas/connectors.js.map +0 -1
- package/dist/schemas/cron.d.ts +0 -14
- package/dist/schemas/cron.d.ts.map +0 -1
- package/dist/schemas/cron.js +0 -75
- package/dist/schemas/cron.js.map +0 -1
- package/dist/schemas/geo.d.ts +0 -63
- package/dist/schemas/geo.d.ts.map +0 -1
- package/dist/schemas/geo.js +0 -131
- package/dist/schemas/geo.js.map +0 -1
- package/dist/schemas/guides.d.ts +0 -26
- package/dist/schemas/guides.d.ts.map +0 -1
- package/dist/schemas/guides.js +0 -33
- package/dist/schemas/guides.js.map +0 -1
- package/dist/schemas/library/annotations.d.ts +0 -616
- package/dist/schemas/library/annotations.d.ts.map +0 -1
- package/dist/schemas/library/annotations.js +0 -156
- package/dist/schemas/library/annotations.js.map +0 -1
- package/dist/schemas/library/collections.d.ts +0 -211
- package/dist/schemas/library/collections.d.ts.map +0 -1
- package/dist/schemas/library/collections.js +0 -57
- package/dist/schemas/library/collections.js.map +0 -1
- package/dist/schemas/library/community.d.ts +0 -1136
- package/dist/schemas/library/community.d.ts.map +0 -1
- package/dist/schemas/library/community.js +0 -315
- package/dist/schemas/library/community.js.map +0 -1
- package/dist/schemas/library/life.d.ts +0 -1440
- package/dist/schemas/library/life.d.ts.map +0 -1
- package/dist/schemas/library/life.js +0 -202
- package/dist/schemas/library/life.js.map +0 -1
- package/dist/schemas/library/media.d.ts +0 -1002
- package/dist/schemas/library/media.d.ts.map +0 -1
- package/dist/schemas/library/media.js +0 -110
- package/dist/schemas/library/media.js.map +0 -1
- package/dist/schemas/library/money.d.ts +0 -1221
- package/dist/schemas/library/money.d.ts.map +0 -1
- package/dist/schemas/library/money.js +0 -168
- package/dist/schemas/library/money.js.map +0 -1
- package/dist/schemas/library/planning.d.ts +0 -1107
- package/dist/schemas/library/planning.d.ts.map +0 -1
- package/dist/schemas/library/planning.js +0 -214
- package/dist/schemas/library/planning.js.map +0 -1
- package/dist/schemas/library/publishing.d.ts +0 -1499
- package/dist/schemas/library/publishing.d.ts.map +0 -1
- package/dist/schemas/library/publishing.js +0 -285
- package/dist/schemas/library/publishing.js.map +0 -1
- package/dist/schemas/library/social.d.ts +0 -1257
- package/dist/schemas/library/social.d.ts.map +0 -1
- package/dist/schemas/library/social.js +0 -147
- package/dist/schemas/library/social.js.map +0 -1
- package/dist/schemas/standard.d.ts +0 -21
- package/dist/schemas/standard.d.ts.map +0 -1
- package/dist/schemas/standard.js +0 -39
- package/dist/schemas/standard.js.map +0 -1
- package/dist/session/account-hint.d.ts +0 -13
- package/dist/session/account-hint.d.ts.map +0 -1
- package/dist/session/account-hint.js +0 -54
- package/dist/session/account-hint.js.map +0 -1
- package/dist/session/auth.d.ts +0 -411
- package/dist/session/auth.d.ts.map +0 -1
- package/dist/session/auth.js +0 -1529
- package/dist/session/auth.js.map +0 -1
- package/dist/session/channel-room.d.ts +0 -26
- package/dist/session/channel-room.d.ts.map +0 -1
- package/dist/session/channel-room.js +0 -56
- package/dist/session/channel-room.js.map +0 -1
- package/dist/session/connect-code.d.ts +0 -127
- package/dist/session/connect-code.d.ts.map +0 -1
- package/dist/session/connect-code.js +0 -408
- package/dist/session/connect-code.js.map +0 -1
- package/dist/session/connect.d.ts +0 -386
- package/dist/session/connect.d.ts.map +0 -1
- package/dist/session/connect.js +0 -583
- package/dist/session/connect.js.map +0 -1
- package/dist/session/connection.d.ts +0 -135
- package/dist/session/connection.d.ts.map +0 -1
- package/dist/session/connection.js +0 -215
- package/dist/session/connection.js.map +0 -1
- package/dist/session/credentials.d.ts +0 -30
- package/dist/session/credentials.d.ts.map +0 -1
- package/dist/session/credentials.js +0 -63
- package/dist/session/credentials.js.map +0 -1
- package/dist/session/hosting.d.ts.map +0 -1
- package/dist/session/hosting.js.map +0 -1
- package/dist/session/index.d.ts +0 -29
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js +0 -21
- package/dist/session/index.js.map +0 -1
- package/dist/session/pairing.d.ts +0 -97
- package/dist/session/pairing.d.ts.map +0 -1
- package/dist/session/pairing.js +0 -251
- package/dist/session/pairing.js.map +0 -1
- package/dist/session/password-strength.d.ts +0 -22
- package/dist/session/password-strength.d.ts.map +0 -1
- package/dist/session/password-strength.js +0 -130
- package/dist/session/password-strength.js.map +0 -1
- package/dist/session/places.d.ts +0 -71
- package/dist/session/places.d.ts.map +0 -1
- package/dist/session/places.js +0 -130
- package/dist/session/places.js.map +0 -1
- package/dist/session/popup.d.ts +0 -13
- package/dist/session/popup.d.ts.map +0 -1
- package/dist/session/popup.js +0 -23
- package/dist/session/popup.js.map +0 -1
- package/dist/session/stay-signed-in.d.ts +0 -49
- package/dist/session/stay-signed-in.d.ts.map +0 -1
- package/dist/session/stay-signed-in.js +0 -141
- package/dist/session/stay-signed-in.js.map +0 -1
- package/dist/storage/blob/directory.d.ts +0 -14
- package/dist/storage/blob/directory.d.ts.map +0 -1
- package/dist/storage/blob/directory.js +0 -87
- package/dist/storage/blob/directory.js.map +0 -1
- package/dist/storage/blob/memory.d.ts +0 -6
- package/dist/storage/blob/memory.d.ts.map +0 -1
- package/dist/storage/blob/memory.js +0 -20
- package/dist/storage/blob/memory.js.map +0 -1
- package/dist/storage/blob/s3.d.ts +0 -16
- package/dist/storage/blob/s3.d.ts.map +0 -1
- package/dist/storage/blob/s3.js +0 -91
- package/dist/storage/blob/s3.js.map +0 -1
- package/dist/storage/directory-access.d.ts +0 -36
- package/dist/storage/directory-access.d.ts.map +0 -1
- package/dist/storage/directory-access.js +0 -89
- package/dist/storage/directory-access.js.map +0 -1
- package/dist/storage/folder-adapter.d.ts +0 -94
- package/dist/storage/folder-adapter.d.ts.map +0 -1
- package/dist/storage/folder-adapter.js +0 -215
- package/dist/storage/folder-adapter.js.map +0 -1
- package/dist/storage/folder-reconcile.d.ts +0 -33
- package/dist/storage/folder-reconcile.d.ts.map +0 -1
- package/dist/storage/folder-reconcile.js.map +0 -1
- package/dist/storage/index.d.ts +0 -6
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -5
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/indexeddb-adapter.d.ts +0 -8
- package/dist/storage/indexeddb-adapter.d.ts.map +0 -1
- package/dist/storage/indexeddb-adapter.js +0 -103
- package/dist/storage/indexeddb-adapter.js.map +0 -1
|
@@ -22,7 +22,7 @@ A blueprint is the only way such a key gets a collection. Every peer refuses a
|
|
|
22
22
|
definition from a key whose note doesn't grant `/collection/define`.
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import { proposeCollections, reviewBlueprint, applyBlueprint } from '@minca/
|
|
25
|
+
import { proposeCollections, reviewBlueprint, applyBlueprint } from '@minca/std';
|
|
26
26
|
|
|
27
27
|
const proposal = await proposeCollections(node, space.id, {
|
|
28
28
|
title: 'Chores',
|
|
@@ -98,7 +98,7 @@ Each collection comes back as one of three:
|
|
|
98
98
|
Each also has a `summary`: what it allows, in sentences worked out from its
|
|
99
99
|
rules ([describing a collection](#describing-a-collection)). A change also
|
|
100
100
|
says what would be different, and which applied blueprints it could break.
|
|
101
|
-
The rest is on [`CollectionReview`](https://minca.dev/api/
|
|
101
|
+
The rest is on [`CollectionReview`](https://minca.dev/api/std/interfaces/CollectionReview/).
|
|
102
102
|
|
|
103
103
|
A blueprint is `applied` once every collection in it is `same`.
|
|
104
104
|
|
package/docs/bots.md
CHANGED
|
@@ -19,7 +19,7 @@ hold the grant.
|
|
|
19
19
|
Ask with `mayConfigure`:
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import { mayConfigure } from '@minca/
|
|
22
|
+
import { mayConfigure } from '@minca/std';
|
|
23
23
|
|
|
24
24
|
async function openSettings(bot: string, person: string) {
|
|
25
25
|
if (await mayConfigure(node, space.id, bot, person)) {
|
|
@@ -93,7 +93,7 @@ needs each service's id and name.
|
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
95
|
import type { SpaceHostingView } from '@minca/core';
|
|
96
|
-
import { askToConnect, connectPage } from '@minca/
|
|
96
|
+
import { askToConnect, connectPage } from '@minca/std';
|
|
97
97
|
|
|
98
98
|
async function connect(host: SpaceHostingView, bot: string) {
|
|
99
99
|
// Opened in the click, before any await, or the browser blocks it.
|
|
@@ -114,7 +114,7 @@ and the bot deletes its `std.connector`.
|
|
|
114
114
|
|
|
115
115
|
```ts
|
|
116
116
|
import type { SpaceHostingView } from '@minca/core';
|
|
117
|
-
import { askToConnect, askToDisconnect } from '@minca/
|
|
117
|
+
import { askToConnect, askToDisconnect } from '@minca/std';
|
|
118
118
|
|
|
119
119
|
async function disconnect(host: SpaceHostingView, bot: string) {
|
|
120
120
|
const ask = await askToConnect(node, space.id, bot, 'github', { disconnect: true });
|
package/docs/building-an-app.md
CHANGED
|
@@ -14,7 +14,7 @@ Every app starts by asking the person for access, with
|
|
|
14
14
|
declare function Todos(): React.JSX.Element;
|
|
15
15
|
// ---cut---
|
|
16
16
|
import { createRoot } from 'react-dom/client';
|
|
17
|
-
import { createMincaConnection } from '@minca/
|
|
17
|
+
import { createMincaConnection } from '@minca/session';
|
|
18
18
|
import { MincaProvider, useConnection } from '@minca/react';
|
|
19
19
|
|
|
20
20
|
const connection = createMincaConnection({
|
|
@@ -58,7 +58,7 @@ The person's account, its settings and its other apps live at their home, not
|
|
|
58
58
|
in your app. Open it from a click, for the account your app acts for:
|
|
59
59
|
|
|
60
60
|
```ts
|
|
61
|
-
import type { MincaConnection } from '@minca/
|
|
61
|
+
import type { MincaConnection } from '@minca/session';
|
|
62
62
|
declare const connection: MincaConnection;
|
|
63
63
|
// ---cut---
|
|
64
64
|
connection.openHome(); // the account page
|
package/docs/collections.md
CHANGED
|
@@ -278,9 +278,7 @@ record's first version is, when the rules have `onePer` or `fixed`, since
|
|
|
278
278
|
those rules are checked against it. With a `contract`, every version is, so
|
|
279
279
|
the contract can read and cite them.
|
|
280
280
|
|
|
281
|
-
|
|
282
|
-
([automations](automations.md#the-accounts-own)). How `version` is numbered
|
|
283
|
-
is [below](#versions-of-a-definition).
|
|
281
|
+
How `version` is numbered is [below](#versions-of-a-definition).
|
|
284
282
|
|
|
285
283
|
## Versions of a definition
|
|
286
284
|
|
|
@@ -318,7 +316,7 @@ one is how two apps agree: a poll asked in one app can be voted on in
|
|
|
318
316
|
another.
|
|
319
317
|
|
|
320
318
|
```typescript
|
|
321
|
-
import { reaction, comment, poll, vote, useSchemas } from '@minca/
|
|
319
|
+
import { reaction, comment, poll, vote, useSchemas } from '@minca/std';
|
|
322
320
|
|
|
323
321
|
await useSchemas(node, space.id, [poll, vote, reaction, comment]); // defines only what the space is missing
|
|
324
322
|
```
|
package/docs/computed.md
CHANGED
|
@@ -157,8 +157,7 @@ watches what it reads:
|
|
|
157
157
|
|
|
158
158
|
- an [automation](automations.md) sets off when the 👍 is written (after its
|
|
159
159
|
`since`);
|
|
160
|
-
- an app's own notifications say so then, once
|
|
161
|
-
- a carrier wakes the app on a new 👍 as well as on a new to-do.
|
|
160
|
+
- an app's own notifications say so then, once.
|
|
162
161
|
|
|
163
162
|
## Cost
|
|
164
163
|
|
package/docs/node.md
CHANGED
|
@@ -7,7 +7,8 @@ sync. Most apps never make one: the connection starts it for you
|
|
|
7
7
|
that holds the account's keys, such as a script, a server or a test.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { createNode, deriveAccountKey, generateSeed,
|
|
10
|
+
import { createNode, deriveAccountKey, generateSeed, rootFromSeed } from '@minca/core';
|
|
11
|
+
import { indexedDBStores } from '@minca/storage/indexeddb';
|
|
11
12
|
|
|
12
13
|
const seed = generateSeed();
|
|
13
14
|
const { signer } = await rootFromSeed(seed);
|
|
@@ -53,7 +54,10 @@ the signer refuses, `createNode` fails.
|
|
|
53
54
|
|
|
54
55
|
With an account key, the node also opens the account registry and makes its
|
|
55
56
|
spaces match it before `createNode` returns
|
|
56
|
-
([following the account](#following-the-account)).
|
|
57
|
+
([following the account](#following-the-account)). That waits on nothing
|
|
58
|
+
from the network: a node starts from what it holds, with no host answering.
|
|
59
|
+
Recording in the registry a space it holds but the registry doesn't name asks
|
|
60
|
+
the account's hosts for an invite, so it happens in the background.
|
|
57
61
|
|
|
58
62
|
A node acts for one account (`node.did`) and signs with one key for its whole
|
|
59
63
|
life. To act for another account, start another node.
|
|
@@ -99,6 +103,15 @@ There are three kinds:
|
|
|
99
103
|
only session notes (command `/`, no subject, no policy) and refuses anything
|
|
100
104
|
else without asking the signer behind it.
|
|
101
105
|
|
|
106
|
+
An app's node signs as its session with the app's key. A node in a worker is
|
|
107
|
+
handed the seed the key is derived from and signs with it there. No
|
|
108
|
+
`CryptoKey` is ever sent to a worker, since WebKit drops a message to a shared
|
|
109
|
+
worker that holds one.
|
|
110
|
+
|
|
111
|
+
When several tabs share the node, a session note is asked of one tab at a
|
|
112
|
+
time, the one that signed last first, then the newest, each for up to five
|
|
113
|
+
minutes, long enough for a passkey prompt.
|
|
114
|
+
|
|
102
115
|
### The session note
|
|
103
116
|
|
|
104
117
|
This is the note a node asks for when it starts:
|
|
@@ -165,19 +178,23 @@ A node asks its `StoreFactory` for stores by path:
|
|
|
165
178
|
It also opens `mirrors/<spaceId>/<n>` for a [mirror](storage.md#mirrors),
|
|
166
179
|
`folder/<spaceId>` for a data folder, and `host` for a host's subscriptions.
|
|
167
180
|
|
|
168
|
-
What a path means is up to the factory
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
What a path means is up to the factory. Each comes from its own entry point
|
|
182
|
+
of `@minca/storage`, so an app bundles only the one it uses:
|
|
183
|
+
|
|
184
|
+
- `indexedDBStores(prefix)` (`@minca/storage/indexeddb`) makes one
|
|
185
|
+
IndexedDB database per path, named `<prefix>:<path with / replaced by :>`.
|
|
186
|
+
It never seals, since the browser profile already guards it.
|
|
187
|
+
- `folderStores(directory, { basePath?, localKey?, local? })`
|
|
188
|
+
(`@minca/storage/folder`) uses a [data folder](storage.md#data-folders).
|
|
189
|
+
The `registry` goes in the folder under `basePath`, sealed under
|
|
190
|
+
`localKey` (`deriveLocalKey(seed)`) when given. Every other path goes in
|
|
191
|
+
`local`, and each space is mirrored to the folder's segments.
|
|
192
|
+
- `directoryStores(directory, { localKey? })` (`@minca/storage/folder`) uses
|
|
193
|
+
a directory on this device, one file per entry and per version, sealing
|
|
194
|
+
the `registry` the same way.
|
|
195
|
+
- `sqliteStores(db, { localKey? })` (`@minca/storage/sqlite`) keeps every
|
|
196
|
+
path in one SQLite database, given its connection
|
|
197
|
+
([SQLite](storage.md#sqlite)), sealing the `registry` the same way.
|
|
181
198
|
|
|
182
199
|
[Sign-in](sign-in.md) picks stores with `storesFor(account)`: IndexedDB with
|
|
183
200
|
prefix `minca:<dataPath with : for />` in the browser, or `folderStores(pod,
|
|
@@ -231,8 +248,8 @@ or none can be locked, the node makes a key for this run instead.
|
|
|
231
248
|
In the browser, `browserWriterKeys(name)` keeps up to 32 keys in IndexedDB,
|
|
232
249
|
one database per slot (`<name>:writer:<slot>`), each claimed under a Web Lock
|
|
233
250
|
of the same name. A tab that finds a slot taken tries the next. A tab that
|
|
234
|
-
closes or crashes frees its slot.
|
|
235
|
-
|
|
251
|
+
closes or crashes frees its slot. A slot keeps the seed its key is derived
|
|
252
|
+
from, so a shared worker can read it in every browser.
|
|
236
253
|
Without IndexedDB or Web Locks there are no writer keys.
|
|
237
254
|
|
|
238
255
|
A node started from a store description, such as `startPageNode` or a node in
|
|
@@ -323,7 +340,8 @@ by default.
|
|
|
323
340
|
```ts
|
|
324
341
|
declare const signer: RootSigner;
|
|
325
342
|
// ---cut---
|
|
326
|
-
import { createNode,
|
|
343
|
+
import { createNode, type RootSigner } from '@minca/core';
|
|
344
|
+
import { indexedDBStores } from '@minca/storage/indexeddb';
|
|
327
345
|
|
|
328
346
|
const node = await createNode({
|
|
329
347
|
signer,
|
|
@@ -399,6 +417,29 @@ when it was first level with a whole-space peer, and `missing` to the version
|
|
|
399
417
|
ids a writer's line names that aren't here.
|
|
400
418
|
[Spec 05 §9](https://github.com/leifriksheim/minca/blob/main/spec/05-sync-and-storage.md).
|
|
401
419
|
|
|
420
|
+
### Syncing shallow
|
|
421
|
+
|
|
422
|
+
A record edited thousands of times has thousands of versions, and an agent
|
|
423
|
+
answering one question doesn't need them. With `shallow: true`, a node syncs
|
|
424
|
+
a space with its keepers by **shallow sets**: each record's current and
|
|
425
|
+
first versions, what its writer retained, and every version in a line, not
|
|
426
|
+
every superseded stub.
|
|
427
|
+
|
|
428
|
+
It is for a node that lives for a session and can't work without the
|
|
429
|
+
space's always-on nodes anyway, as a remote MCP session's. Apps and devices
|
|
430
|
+
leave it off and hold every version, so they work the same with no host.
|
|
431
|
+
|
|
432
|
+
A shallow node takes its keepers' word for the history it skips. A keeper
|
|
433
|
+
can hold a record back or show an older edit, but it can't forge one:
|
|
434
|
+
signatures, standing and first versions are checked as always. With no
|
|
435
|
+
keeper connected the node syncs whole from its other peers, and a space
|
|
436
|
+
that names no keepers syncs whole.
|
|
437
|
+
|
|
438
|
+
Removing someone, or taking a role away (`unassign`, `removeMember`,
|
|
439
|
+
`stepDown`), needs everything they wrote, which a shallow node doesn't
|
|
440
|
+
hold: it refuses. `revoke` always goes through.
|
|
441
|
+
[Spec 05 §5.1](https://github.com/leifriksheim/minca/blob/main/spec/05-sync-and-storage.md).
|
|
442
|
+
|
|
402
443
|
### Planned: caches that widen and trim
|
|
403
444
|
|
|
404
445
|
> **Planned.** A node holding part of a space would hold all of it when too
|
|
@@ -435,16 +476,33 @@ one run at a time:
|
|
|
435
476
|
|
|
436
477
|
1. It joins every space a `sys.joined` record names that it doesn't hold,
|
|
437
478
|
with the view-only invite in the record.
|
|
438
|
-
2. It leaves every space whose `sys.joined` record was deleted.
|
|
479
|
+
2. It leaves every space whose `sys.joined` record was deleted, all at once.
|
|
480
|
+
The space leaves the list right away. If the account still holds a place
|
|
481
|
+
there, giving it up runs in the background, as [leaving](#leaving-a-space)
|
|
482
|
+
describes.
|
|
439
483
|
3. It writes a `sys.joined` record for a space it holds that the registry
|
|
440
|
-
doesn't know.
|
|
441
|
-
|
|
442
|
-
|
|
484
|
+
doesn't know. That asks the account's hosts for the space's invite, so it
|
|
485
|
+
runs in the background, one run at a time apart from reconciling, reading
|
|
486
|
+
afresh each run what the registry still lacks. A space left meanwhile
|
|
487
|
+
stays left.
|
|
488
|
+
4. It brings every carrier's passes up to date.
|
|
489
|
+
5. It names the account's carriers as keepers of the open spaces it manages,
|
|
490
|
+
the account registry and contacts space among them: a carrier keeps the
|
|
491
|
+
account's personal space. Carry spaces name none.
|
|
443
492
|
6. It asks each host the account uses how it stands, without waiting, and
|
|
444
493
|
hands it the spaces if it was paid ([hosting](#carriers-hosting-and-notifications)).
|
|
494
|
+
A host whose signed status says the account's subscription lapsed, or has
|
|
495
|
+
none, and that it won't carry for it as things stand, stops being a carrier,
|
|
496
|
+
and so a keeper. A host that doesn't answer stays one.
|
|
445
497
|
|
|
446
498
|
Creating or joining a space writes its `sys.joined` record. Leaving deletes it.
|
|
447
499
|
|
|
500
|
+
The account's own spaces (the table above) are never in the list: joining a
|
|
501
|
+
carry space's invite writes no record, and a record that names one is passed
|
|
502
|
+
over in every step, neither joined nor left. A device that hadn't heard of the
|
|
503
|
+
carrier yet may have written one, and may have joined the space from the list;
|
|
504
|
+
it opens the space directly once it hears.
|
|
505
|
+
|
|
448
506
|
### Profiles
|
|
449
507
|
|
|
450
508
|
The node publishes the account's profile, `{ name, contactKey? }`, in a space
|
|
@@ -776,10 +834,12 @@ says what the app and the home send each other.
|
|
|
776
834
|
|
|
777
835
|
### The app's key
|
|
778
836
|
|
|
779
|
-
`appKey(name = 'default')` makes the app's P-256 key once and keeps
|
|
780
|
-
|
|
837
|
+
`appKey(name = 'default')` makes the app's P-256 key once and keeps the seed
|
|
838
|
+
it is derived from in the IndexedDB database `minca-app-key`, store `keys`,
|
|
781
839
|
under `name`. `forgetAppKey` deletes it, and the next connection makes a new
|
|
782
|
-
one.
|
|
840
|
+
one. A script running in the app's origin can read the seed, as it can the
|
|
841
|
+
session of any web app: the grant runs out, and the person can disconnect the
|
|
842
|
+
app at their account home.
|
|
783
843
|
|
|
784
844
|
### An app's node outside the page
|
|
785
845
|
|
|
@@ -815,7 +875,7 @@ starts again unconnected.
|
|
|
815
875
|
`homeAddress(input)` turns what a person typed into the home's connect page:
|
|
816
876
|
|
|
817
877
|
```ts
|
|
818
|
-
import { homeAddress } from '@minca/
|
|
878
|
+
import { homeAddress } from '@minca/session';
|
|
819
879
|
|
|
820
880
|
homeAddress('minca.example.com'); // 'https://minca.example.com/connect'
|
|
821
881
|
```
|
|
@@ -861,6 +921,21 @@ and its status is a [`ConnectionStatus`](https://minca.dev/api/session/type-alia
|
|
|
861
921
|
- With `worker`, the node runs in a worker. If the worker fails to load or
|
|
862
922
|
doesn't start the node within 30 seconds (`WorkerNotStarted`), the node runs
|
|
863
923
|
in the page instead. A worker that started and refused passes its reason on.
|
|
924
|
+
- Opening an account that takes more than 10 seconds says so in `error`,
|
|
925
|
+
while the status stays `starting`: what is likely wrong (another tab
|
|
926
|
+
holding the browser's storage) and what to try (closing other tabs,
|
|
927
|
+
reloading). A store in IndexedDB that won't open within 15 seconds fails
|
|
928
|
+
with the same advice, rather than waiting for ever. An account that can't
|
|
929
|
+
be opened is `disconnected`, its `error` saying why.
|
|
930
|
+
- A tab whose node is its own (a dedicated worker's, or the page's) runs it
|
|
931
|
+
only in view, one at a time per account (a Web Lock,
|
|
932
|
+
`minca-node:<account DID>`): two nodes on one site's stores get in each
|
|
933
|
+
other's way, and a browser that freezes background tabs, as an iPhone
|
|
934
|
+
does, would freeze one holding them. Put away, the tab closes its node
|
|
935
|
+
(`starting`, with no node) and opens it again on coming back. A node the
|
|
936
|
+
tabs share, in a shared worker, stays.
|
|
937
|
+
- `keepAwake()` keeps the node open while the tab is put away, as a call
|
|
938
|
+
must, and returns what lets it go.
|
|
864
939
|
- It turns `expired` when the grant's `expiresAt` passes.
|
|
865
940
|
- When the node sees its note revoked (`revoked`), the connection forgets that
|
|
866
941
|
account's grant and key.
|
|
@@ -900,7 +975,8 @@ Each tab acts for its own account, and sees other tabs' changes to
|
|
|
900
975
|
`state.accounts`. A tab whose account was connected again elsewhere keeps
|
|
901
976
|
its key until it restarts, then takes the newer grant. One whose key was
|
|
902
977
|
revoked takes up a newer grant rather than forgetting it. A shared worker
|
|
903
|
-
runs a node per key. Switching again before a node has started closes it
|
|
978
|
+
runs a node per key. Switching again before a node has started closes it,
|
|
979
|
+
or stops it waiting for its turn.
|
|
904
980
|
[Spec 06 §2.10](https://github.com/leifriksheim/minca/blob/main/spec/06-nodes-and-sessions.md).
|
|
905
981
|
|
|
906
982
|
### Showing notifications
|
|
@@ -909,7 +985,9 @@ An app shows its own notifications with
|
|
|
909
985
|
`watchNotifications(node, { origin?, onNotify })`. It needs the account key,
|
|
910
986
|
so an app with `scope: account`. It reads the account's automations for the
|
|
911
987
|
app's origin, and calls `onNotify({ automation, record })` for each record
|
|
912
|
-
that arrives matching one.
|
|
988
|
+
that arrives matching one. With `origin: null` it reads every app's
|
|
989
|
+
automations and the person's own: for something that speaks for every app
|
|
990
|
+
while none is open, as the Chrome extension does.
|
|
913
991
|
|
|
914
992
|
A record matches when the automation isn't paused, and the record is in its
|
|
915
993
|
collection and one of its spaces, created after `since` and within the last
|
|
@@ -961,8 +1039,7 @@ returns that one.
|
|
|
961
1039
|
Carry spaces aren't kept in the node's list. Each is derived again from its
|
|
962
1040
|
record. When the node starts, or the registry changes, it refills every carry
|
|
963
1041
|
space in the background. That opens every space the account holds, which is
|
|
964
|
-
slow from a data folder, so signing in doesn't wait for it
|
|
965
|
-
adding an automation. Adding a carrier writes its passes before it returns.
|
|
1042
|
+
slow from a data folder, so signing in doesn't wait for it. Adding a carrier writes its passes before it returns.
|
|
966
1043
|
|
|
967
1044
|
- `carriers.settled(waitMs)` waits for the refill under way, and says whether
|
|
968
1045
|
it finished. Use it before a window closes.
|
|
@@ -995,19 +1072,10 @@ wrote.
|
|
|
995
1072
|
|
|
996
1073
|
`node.automations` needs the account key. It lists, adds, updates (`name`,
|
|
997
1074
|
`paused`) and removes the account's own
|
|
998
|
-
[automations](automations.md#the-accounts-own), kept in its registry
|
|
999
|
-
copies a wake for each into every carry space. The reference home adds them
|
|
1075
|
+
[automations](automations.md#the-accounts-own), kept in its registry. The reference home adds them
|
|
1000
1076
|
when a person keeps an app's proposal, and lists them by app to pause or
|
|
1001
1077
|
remove ([the account home's side](sign-in.md#the-account-homes-side)).
|
|
1002
1078
|
|
|
1003
|
-
### A carrier's matches
|
|
1004
|
-
|
|
1005
|
-
When a version wakes one of the account's wakes, a `CarrierNode` sends a
|
|
1006
|
-
`wake` event with only the wake, the space, and the record's key, collection
|
|
1007
|
-
and `createdAt`. `wakes()` lists the wakes it holds. The desktop app shows
|
|
1008
|
-
these as notifications. The browser
|
|
1009
|
-
extension doesn't yet.
|
|
1010
|
-
|
|
1011
1079
|
### Hosting
|
|
1012
1080
|
|
|
1013
1081
|
`node.hosting` pays a host and hands it the account's spaces. Its calls are
|
|
@@ -11,7 +11,7 @@ A proposal is a **blueprint**: one `std.blueprint` record listing the
|
|
|
11
11
|
collections. Nothing is defined yet, so it can't break anything.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { proposeCollections } from '@minca/
|
|
14
|
+
import { proposeCollections } from '@minca/std';
|
|
15
15
|
|
|
16
16
|
const proposal = await proposeCollections(node, space.id, {
|
|
17
17
|
title: 'Chores',
|
|
@@ -43,7 +43,7 @@ the same, with a summary in sentences worked out from its rules:
|
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
45
|
import type { NodeRecord } from '@minca/core';
|
|
46
|
-
import { reviewBlueprint, applyBlueprint, type Blueprint } from '@minca/
|
|
46
|
+
import { reviewBlueprint, applyBlueprint, type Blueprint } from '@minca/std';
|
|
47
47
|
|
|
48
48
|
async function apply(proposal: NodeRecord<Blueprint>) {
|
|
49
49
|
const review = reviewBlueprint(proposal.body!, await node.collections.list(space.id));
|
|
@@ -113,7 +113,7 @@ A definition can't say "write one rota for each week, and say in it who does
|
|
|
113
113
|
what". A guide can, and an agent finds it through `collections_list`:
|
|
114
114
|
|
|
115
115
|
```typescript
|
|
116
|
-
import { writeGuide } from '@minca/
|
|
116
|
+
import { writeGuide } from '@minca/std';
|
|
117
117
|
|
|
118
118
|
await writeGuide(node, space.id, {
|
|
119
119
|
name: 'chores.how',
|
package/docs/query-format.md
CHANGED
|
@@ -83,11 +83,12 @@ open are left out, here and in every include, so a result's `body` is never
|
|
|
83
83
|
`null`. What "stands" means is in
|
|
84
84
|
[spec 02 §9.5](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md).
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
A record whose body or links don't fit its collection's definition is still
|
|
87
|
+
counted, here, in every include and in every count, and comes flagged
|
|
88
|
+
`conforms: false`. Whether it fits depends on the definition in force and on
|
|
89
|
+
the records it links to, which other people write. Leaving it out would let
|
|
90
|
+
whoever defines the collection, or owns a record others link to, hide those
|
|
91
|
+
records from everyone. Show the flag instead.
|
|
91
92
|
|
|
92
93
|
## Field values
|
|
93
94
|
|
|
@@ -204,8 +204,10 @@ signed, not the person. `node.spaces.profiles(space)` maps accounts to names.
|
|
|
204
204
|
|
|
205
205
|
## Keys
|
|
206
206
|
|
|
207
|
-
A record's key says whose it is
|
|
208
|
-
|
|
207
|
+
A record's key says whose it is and which collection it is in. Every key
|
|
208
|
+
starts with its owner's part, a hash of the account and the collection, so no
|
|
209
|
+
one else can create a record there, and no record of another collection can
|
|
210
|
+
take it.
|
|
209
211
|
|
|
210
212
|
Most records just take the fresh key `put` gives them. Some records there is
|
|
211
213
|
one of per account, like settings. For those, pass a name:
|
|
@@ -213,34 +215,31 @@ one of per account, like settings. For those, pass a name:
|
|
|
213
215
|
```typescript
|
|
214
216
|
await node.records.put(space.id, 'app.settings', { theme: 'dark' }, { key: 'settings' });
|
|
215
217
|
|
|
216
|
-
const mine = await node.records.keyFor(space.id, 'settings'); // '
|
|
217
|
-
const theirs = await node.records.keyFor(space.id, 'settings', did); // someone else's, if they wrote one
|
|
218
|
+
const mine = await node.records.keyFor(space.id, 'app.settings', 'settings'); // 'mj6bhbzx5m7tqmu35fjtg4wo4u.settings'
|
|
219
|
+
const theirs = await node.records.keyFor(space.id, 'app.settings', 'settings', did); // someone else's, if they wrote one
|
|
218
220
|
await node.records.get(space.id, theirs);
|
|
219
221
|
```
|
|
220
222
|
|
|
221
|
-
- The name goes in your account's namespace, so two
|
|
222
|
-
choose `settings` get two records
|
|
223
|
+
- The name goes in your account's namespace for that collection, so two
|
|
224
|
+
accounts that both choose `settings` get two records, and so do two
|
|
225
|
+
collections.
|
|
223
226
|
- Names are 1–101 characters of `a`–`z`, `0`–`9` and `: . _ -`.
|
|
224
227
|
- Read and link records by their whole `key`, as `put` gives it, not by the
|
|
225
228
|
name.
|
|
226
|
-
- A name is the same key in every collection, and a record keeps its
|
|
227
|
-
collection for life. So `put` refuses a name you already hold in another
|
|
228
|
-
collection, deleted or not. Put the collection in the name
|
|
229
|
-
(`app.todo.settings`) so two of your apps never clash.
|
|
230
229
|
- Writing a deleted key brings the record back. Pass the whole key when it is
|
|
231
230
|
already yours.
|
|
232
|
-
- A name of the form `one:<hex>` is refused outside a `onePer` collection.
|
|
233
231
|
|
|
234
232
|
In a collection with a `onePer` rule, the node works out the key for you
|
|
235
233
|
from the parts the rule names, and `node.records.onePerKey` tells you what it
|
|
236
234
|
is. With `@author` the key is the writer's. Without, it is a shared `one:…`
|
|
237
|
-
key ([Collections](collections.md#rules)). In a private space it is keyed with
|
|
235
|
+
key of the collection's ([Collections](collections.md#rules)). In a private space it is keyed with
|
|
238
236
|
the space's key, so it says nothing to someone who can't read the space.
|
|
239
237
|
|
|
240
238
|
An account's line in a collection, for contracts, has the key
|
|
241
239
|
`lineKey(account, collection)`, exported by `@minca/core`.
|
|
242
240
|
|
|
243
|
-
Every peer refuses a first version at a key the writer doesn't own
|
|
241
|
+
Every peer refuses a first version at a key the writer doesn't own in that
|
|
242
|
+
collection. The rule
|
|
244
243
|
is in [spec 02 §4.1](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md).
|
|
245
244
|
|
|
246
245
|
## When two devices edit at once
|
package/docs/sign-in.md
CHANGED
|
@@ -12,7 +12,7 @@ The flow is state and actions: draw a screen for each `stage`, and call an
|
|
|
12
12
|
action from its buttons. `subscribe` calls back after every change.
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
|
-
import { createMincaAuth } from '@minca/
|
|
15
|
+
import { createMincaAuth } from '@minca/auth';
|
|
16
16
|
|
|
17
17
|
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
18
18
|
|
|
@@ -28,7 +28,7 @@ In React, hand the flow to `MincaProvider`, and read it with `useMinca`:
|
|
|
28
28
|
|
|
29
29
|
```tsx
|
|
30
30
|
import { createRoot } from 'react-dom/client';
|
|
31
|
-
import { createMincaAuth } from '@minca/
|
|
31
|
+
import { createMincaAuth } from '@minca/auth';
|
|
32
32
|
import { MincaProvider, useMinca } from '@minca/react';
|
|
33
33
|
|
|
34
34
|
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
@@ -71,13 +71,13 @@ them most recently used first.
|
|
|
71
71
|
The flow is a state to read and actions to call. `auth.getState().stage`
|
|
72
72
|
says which screen it is on. It goes from `starting` through the screens of signing in or setting up,
|
|
73
73
|
to `ready`. What each stage means is in
|
|
74
|
-
[`AuthStage`](https://minca.dev/api/
|
|
74
|
+
[`AuthStage`](https://minca.dev/api/auth/type-aliases/AuthStage/).
|
|
75
75
|
|
|
76
76
|
Where data lives is asked at `existing`, not up front. A page that waits for
|
|
77
77
|
`ready` doesn't see the session during `recovery`, `unlock` or `pod`.
|
|
78
78
|
|
|
79
79
|
A failed action sets `error`, an
|
|
80
|
-
[`AuthError`](https://minca.dev/api/
|
|
80
|
+
[`AuthError`](https://minca.dev/api/auth/interfaces/AuthError/), and stays
|
|
81
81
|
on the same stage. A dismissed passkey or folder prompt sets no error.
|
|
82
82
|
|
|
83
83
|
### Moving between stages
|
|
@@ -179,7 +179,7 @@ doesn't ask again. The choices are `never`, `1d`, `7d` and `30d`. The default
|
|
|
179
179
|
is `7d`, and each use pushes the expiry forward.
|
|
180
180
|
|
|
181
181
|
```ts
|
|
182
|
-
import { createMincaAuth } from '@minca/
|
|
182
|
+
import { createMincaAuth } from '@minca/auth';
|
|
183
183
|
|
|
184
184
|
const auth = createMincaAuth();
|
|
185
185
|
await auth.staySignedIn.setChoice('30d');
|
|
@@ -225,7 +225,7 @@ sign-in kept for days. So anything that hands out the whole account, or
|
|
|
225
225
|
changes how it signs in, asks again first:
|
|
226
226
|
|
|
227
227
|
```ts
|
|
228
|
-
import { createMincaAuth } from '@minca/
|
|
228
|
+
import { createMincaAuth } from '@minca/auth';
|
|
229
229
|
|
|
230
230
|
const auth = createMincaAuth();
|
|
231
231
|
const ok = await auth.confirm({ password: 'correct horse battery staple' });
|
|
@@ -233,7 +233,7 @@ const ok = await auth.confirm({ password: 'correct horse battery staple' });
|
|
|
233
233
|
|
|
234
234
|
The proof is the password, the passkey's own check (a fingerprint, a face or
|
|
235
235
|
a PIN), or the recovery code itself
|
|
236
|
-
([`MincaAuth.confirm`](https://minca.dev/api/
|
|
236
|
+
([`MincaAuth.confirm`](https://minca.dev/api/auth/interfaces/MincaAuth/)).
|
|
237
237
|
A wrong answer resolves false and sets `error`. A passkey with nothing behind
|
|
238
238
|
it is no proof.
|
|
239
239
|
|
|
@@ -342,10 +342,9 @@ the person chooses:
|
|
|
342
342
|
`forgetBrowserCopy()` then deletes the browser's copy. Other accounts in the
|
|
343
343
|
pod are never touched.
|
|
344
344
|
|
|
345
|
-
The page writes to the pod only while it is open.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
the move must connect again.
|
|
345
|
+
The page writes to the pod only while it is open. The Chrome extension, given
|
|
346
|
+
the same folder, keeps it up to date while the page is closed: the person
|
|
347
|
+
picks the folder there, and it finds the account in it.
|
|
349
348
|
|
|
350
349
|
## Removing an account
|
|
351
350
|
|
|
@@ -384,7 +383,7 @@ no proof. [Threat model §3.1](https://github.com/leifriksheim/minca/blob/main/s
|
|
|
384
383
|
## Options
|
|
385
384
|
|
|
386
385
|
`createMincaAuth(config)` takes the options in
|
|
387
|
-
[`MincaAuthConfig`](https://minca.dev/api/
|
|
386
|
+
[`MincaAuthConfig`](https://minca.dev/api/auth/interfaces/MincaAuthConfig/).
|
|
388
387
|
Every one has a default, so `createMincaAuth()` alone signs in offline, in
|
|
389
388
|
this browser.
|
|
390
389
|
|
|
@@ -448,7 +447,7 @@ Device keys in the vault are in
|
|
|
448
447
|
|
|
449
448
|
A sign-in starts a node with the account's keys, the place's stores for that
|
|
450
449
|
account ([stores](node.md#stores)) and the configured network. The session is a
|
|
451
|
-
[`MincaSession`](https://minca.dev/api/
|
|
450
|
+
[`MincaSession`](https://minca.dev/api/auth/interfaces/MincaSession/).
|
|
452
451
|
|
|
453
452
|
The seed stays inside the auth object. `recoveryCode()` returns it as a
|
|
454
453
|
recovery code. The page also holds the local key, which seals a pod's
|
|
@@ -481,7 +480,7 @@ chose, from 1/24 to 365.
|
|
|
481
480
|
### Connections
|
|
482
481
|
|
|
483
482
|
`auth.connections()` lists what the home has connected, each a
|
|
484
|
-
[`Connection`](https://minca.dev/api/
|
|
483
|
+
[`Connection`](https://minca.dev/api/auth/interfaces/Connection/). They are kept
|
|
485
484
|
per account in `localStorage` under `<prefix>.connections:<accountId>`. A kept
|
|
486
485
|
connection in any other shape is dropped when read, and its app connects
|
|
487
486
|
again.
|
|
@@ -492,8 +491,9 @@ revokes an app just because its time has passed.
|
|
|
492
491
|
|
|
493
492
|
A program connected by code at the home's own origin (`via: 'code'`) is kept
|
|
494
493
|
by its key instead, so each such program is its own (`connectionKey`). A
|
|
495
|
-
carrier is kept
|
|
496
|
-
|
|
494
|
+
carrier is kept by its key too. One connecting leaves the app at its origin;
|
|
495
|
+
an app connecting from a carrier's origin is that program now holding keys,
|
|
496
|
+
and the home removes the carrier.
|
|
497
497
|
|
|
498
498
|
### Disconnecting
|
|
499
499
|
|
package/docs/spaces.md
CHANGED
|
@@ -327,8 +327,3 @@ await connection.propose([
|
|
|
327
327
|
`checkOwnAutomation` says whether one can be kept. `matches(record, filter)`
|
|
328
328
|
says whether a filter holds, so you can show what it would have matched
|
|
329
329
|
before proposing it.
|
|
330
|
-
|
|
331
|
-
A carrier wakes the app only on a condition on a topic field, at the top of
|
|
332
|
-
`where` or in an `$and` there. The app judges the rest. With no such
|
|
333
|
-
condition, a carrier wakes the app for every new record of the collection,
|
|
334
|
-
and the app turns down the rest.
|
package/docs/standard-library.md
CHANGED
|
@@ -9,7 +9,7 @@ records, and you read theirs.
|
|
|
9
9
|
import type { NodeRecord } from '@minca/core';
|
|
10
10
|
declare const post: NodeRecord;
|
|
11
11
|
// ---cut---
|
|
12
|
-
import { reaction, comment, useSchemas } from '@minca/
|
|
12
|
+
import { reaction, comment, useSchemas } from '@minca/std';
|
|
13
13
|
|
|
14
14
|
await useSchemas(node, space.id, [reaction, comment]);
|
|
15
15
|
await node.records.put(
|
|
@@ -148,7 +148,7 @@ the space's grants. In the `community` template, members change only what
|
|
|
148
148
|
they made, moderators change anything, and only moderators and admins write
|
|
149
149
|
in the collections in `STAFF_COLLECTIONS` ([spaces](permissions.md#presets)).
|
|
150
150
|
|
|
151
|
-
The tables are made from the definitions in `@minca/
|
|
151
|
+
The tables are made from the definitions in `@minca/std` each time
|
|
152
152
|
[minca.dev](https://minca.dev/collections/standard-library/#the-definitions)
|
|
153
153
|
is built, so they always match the code.
|
|
154
154
|
|
|
@@ -249,7 +249,7 @@ the one it had.
|
|
|
249
249
|
import type { NodeRecord } from '@minca/core';
|
|
250
250
|
declare const message: NodeRecord;
|
|
251
251
|
// ---cut---
|
|
252
|
-
import { setActivity, activeNow } from '@minca/
|
|
252
|
+
import { setActivity, activeNow } from '@minca/std';
|
|
253
253
|
|
|
254
254
|
await setActivity(node, space.id, message.key, 'working', 'Reading the thread');
|
|
255
255
|
```
|
|
@@ -338,7 +338,7 @@ message they replied to. Never fill them by matching text.
|
|
|
338
338
|
|
|
339
339
|
They are topics, as is a message's `in` link. So an automation of the
|
|
340
340
|
account's own can ask for only what mentions it, replies to it, or is in one
|
|
341
|
-
channel
|
|
341
|
+
channel:
|
|
342
342
|
|
|
343
343
|
```json
|
|
344
344
|
{ "where": { "mentions": { "$contains": "$me" } } }
|
|
@@ -368,9 +368,7 @@ A record written in answer to someone's record names them in
|
|
|
368
368
|
| `std.order`, `std.order-update` | the listing's or the order's author |
|
|
369
369
|
|
|
370
370
|
It's a topic, so "someone answered what I wrote" is
|
|
371
|
-
`where: { "respondingTo": { "$contains": "$me" } }
|
|
372
|
-
match it unread. The link says the same to a node that can read, but a
|
|
373
|
-
carrier can't read a private space's links, so the account is written out.
|
|
371
|
+
`where: { "respondingTo": { "$contains": "$me" } }`.
|
|
374
372
|
Fill it from the author of the linked record, and leave it out when that's
|
|
375
373
|
the writer.
|
|
376
374
|
|
|
@@ -446,7 +444,7 @@ import type { NodeRecord } from '@minca/core';
|
|
|
446
444
|
declare const above: NodeRecord<{ position: string }> | undefined;
|
|
447
445
|
declare const below: NodeRecord<{ position: string }> | undefined;
|
|
448
446
|
// ---cut---
|
|
449
|
-
import { positionBetween } from '@minca/
|
|
447
|
+
import { positionBetween } from '@minca/std';
|
|
450
448
|
|
|
451
449
|
positionBetween(above?.body?.position, below?.body?.position);
|
|
452
450
|
```
|