@minca/core 0.1.18 → 0.3.1
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 +1 -1
- 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 +45 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -53
- package/dist/index.js.map +1 -1
- package/dist/network/mesh.d.ts.map +1 -1
- package/dist/network/mesh.js +10 -0
- package/dist/network/mesh.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 +8 -3
- package/dist/network/rtc-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 +7 -14
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +4 -8
- 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 +13 -4
- package/dist/node/node-hosting.js.map +1 -1
- package/dist/node/node-records.js +1 -1
- package/dist/node/node-records.js.map +1 -1
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +134 -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-peers.d.ts +5 -2
- package/dist/node/space-peers.d.ts.map +1 -1
- package/dist/node/space-peers.js +3 -2
- package/dist/node/space-peers.js.map +1 -1
- package/dist/node/space-runtime.d.ts +3 -1
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +29 -8
- 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 +11 -4
- package/dist/node/space-standing.js.map +1 -1
- package/dist/node/space-writing.d.ts.map +1 -1
- package/dist/node/space-writing.js +9 -0
- package/dist/node/space-writing.js.map +1 -1
- package/dist/node/stores.d.ts +9 -1
- package/dist/node/stores.d.ts.map +1 -1
- package/dist/node/stores.js +4 -2
- package/dist/node/stores.js.map +1 -1
- package/dist/node/types.d.ts +16 -5
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/worker.d.ts +14 -6
- package/dist/node/worker.d.ts.map +1 -1
- package/dist/node/worker.js +59 -20
- package/dist/node/worker.js.map +1 -1
- package/dist/node/writer-keys.d.ts +2 -2
- package/dist/node/writer-keys.d.ts.map +1 -1
- package/dist/node/writer-keys.js +12 -14
- 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 +2 -0
- package/dist/records/key.d.ts.map +1 -1
- package/dist/records/key.js +4 -0
- package/dist/records/key.js.map +1 -1
- package/dist/records/links.js +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/session/account-hint.d.ts +2 -2
- package/dist/session/account-hint.d.ts.map +1 -1
- package/dist/session/account-hint.js +3 -3
- package/dist/session/account-hint.js.map +1 -1
- package/dist/session/connect.d.ts +12 -5
- package/dist/session/connect.d.ts.map +1 -1
- package/dist/session/connect.js +25 -21
- package/dist/session/connect.js.map +1 -1
- package/dist/session/connection.d.ts +26 -2
- package/dist/session/connection.d.ts.map +1 -1
- package/dist/session/connection.js +151 -11
- package/dist/session/connection.js.map +1 -1
- package/dist/session/hosting.d.ts +1 -7
- package/dist/session/hosting.d.ts.map +1 -1
- package/dist/session/hosting.js +3 -3
- package/dist/session/hosting.js.map +1 -1
- package/dist/session/index.d.ts +9 -14
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +8 -11
- package/dist/session/index.js.map +1 -1
- package/dist/session/stay-signed-in.d.ts +0 -1
- package/dist/session/stay-signed-in.d.ts.map +1 -1
- package/dist/session/stay-signed-in.js +1 -1
- package/dist/session/stay-signed-in.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 +26 -0
- package/dist/storage/body-cache.d.ts.map +1 -0
- package/dist/storage/body-cache.js +41 -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/folder-adapter.d.ts +8 -2
- package/dist/storage/folder-adapter.d.ts.map +1 -1
- package/dist/storage/folder-adapter.js +43 -26
- package/dist/storage/folder-adapter.js.map +1 -1
- package/dist/storage/indexeddb-adapter.js +27 -2
- package/dist/storage/indexeddb-adapter.js.map +1 -1
- package/dist/storage/sqlite-adapter.d.ts +57 -0
- package/dist/storage/sqlite-adapter.d.ts.map +1 -0
- package/dist/storage/sqlite-adapter.js +213 -0
- package/dist/storage/sqlite-adapter.js.map +1 -0
- package/dist/storage/storage-provider.d.ts +21 -2
- package/dist/storage/storage-provider.d.ts.map +1 -1
- package/dist/storage/storage-provider.js +149 -56
- package/dist/storage/storage-provider.js.map +1 -1
- package/dist/sync/sync-engine.d.ts +10 -4
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-engine.js +120 -38
- package/dist/sync/sync-engine.js.map +1 -1
- package/dist/sync/sync-messages.d.ts +4 -0
- package/dist/sync/sync-messages.d.ts.map +1 -1
- package/dist/sync/sync-messages.js.map +1 -1
- package/dist/types.d.ts +0 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/dist/types.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 +1 -1
- 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 +16 -0
- package/docs/collections.md +2 -4
- package/docs/computed.md +1 -2
- package/docs/node.md +112 -39
- package/docs/proposing-collections.md +3 -3
- package/docs/sign-in.md +45 -52
- package/docs/spaces.md +0 -5
- package/docs/standard-library.md +20 -8
- package/docs/storage.md +78 -12
- package/docs/usernames.md +3 -3
- package/package.json +7 -13
- package/dist/elements/auth-styles.d.ts +0 -18
- package/dist/elements/auth-styles.d.ts.map +0 -1
- package/dist/elements/auth-styles.js +0 -206
- package/dist/elements/auth-styles.js.map +0 -1
- package/dist/elements/dom.d.ts +0 -29
- package/dist/elements/dom.d.ts.map +0 -1
- package/dist/elements/dom.js +0 -91
- package/dist/elements/dom.js.map +0 -1
- package/dist/elements/index.d.ts +0 -13
- package/dist/elements/index.d.ts.map +0 -1
- package/dist/elements/index.js +0 -11
- package/dist/elements/index.js.map +0 -1
- package/dist/elements/minca-auth.d.ts +0 -55
- package/dist/elements/minca-auth.d.ts.map +0 -1
- package/dist/elements/minca-auth.js +0 -768
- package/dist/elements/minca-auth.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 -19
- package/dist/node/watch-notifications.d.ts.map +0 -1
- package/dist/node/watch-notifications.js +0 -128
- package/dist/node/watch-notifications.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/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/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/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/docs/node.md
CHANGED
|
@@ -53,7 +53,10 @@ the signer refuses, `createNode` fails.
|
|
|
53
53
|
|
|
54
54
|
With an account key, the node also opens the account registry and makes its
|
|
55
55
|
spaces match it before `createNode` returns
|
|
56
|
-
([following the account](#following-the-account)).
|
|
56
|
+
([following the account](#following-the-account)). That waits on nothing
|
|
57
|
+
from the network: a node starts from what it holds, with no host answering.
|
|
58
|
+
Recording in the registry a space it holds but the registry doesn't name asks
|
|
59
|
+
the account's hosts for an invite, so it happens in the background.
|
|
57
60
|
|
|
58
61
|
A node acts for one account (`node.did`) and signs with one key for its whole
|
|
59
62
|
life. To act for another account, start another node.
|
|
@@ -99,6 +102,15 @@ There are three kinds:
|
|
|
99
102
|
only session notes (command `/`, no subject, no policy) and refuses anything
|
|
100
103
|
else without asking the signer behind it.
|
|
101
104
|
|
|
105
|
+
An app's node signs as its session with the app's key. A node in a worker is
|
|
106
|
+
handed the seed the key is derived from and signs with it there. No
|
|
107
|
+
`CryptoKey` is ever sent to a worker, since WebKit drops a message to a shared
|
|
108
|
+
worker that holds one.
|
|
109
|
+
|
|
110
|
+
When several tabs share the node, a session note is asked of one tab at a
|
|
111
|
+
time, the one that signed last first, then the newest, each for up to five
|
|
112
|
+
minutes, long enough for a passkey prompt.
|
|
113
|
+
|
|
102
114
|
### The session note
|
|
103
115
|
|
|
104
116
|
This is the note a node asks for when it starts:
|
|
@@ -178,6 +190,9 @@ What a path means is up to the factory:
|
|
|
178
190
|
- `directoryStores(directory, { localKey? })` uses a directory on this
|
|
179
191
|
device, one file per entry and per version, sealing the `registry` the same
|
|
180
192
|
way.
|
|
193
|
+
- `sqliteStores(db, { localKey? })` keeps every path in one SQLite database,
|
|
194
|
+
given its connection ([SQLite](storage.md#sqlite)), sealing the `registry`
|
|
195
|
+
the same way.
|
|
181
196
|
|
|
182
197
|
[Sign-in](sign-in.md) picks stores with `storesFor(account)`: IndexedDB with
|
|
183
198
|
prefix `minca:<dataPath with : for />` in the browser, or `folderStores(pod,
|
|
@@ -231,8 +246,8 @@ or none can be locked, the node makes a key for this run instead.
|
|
|
231
246
|
In the browser, `browserWriterKeys(name)` keeps up to 32 keys in IndexedDB,
|
|
232
247
|
one database per slot (`<name>:writer:<slot>`), each claimed under a Web Lock
|
|
233
248
|
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
|
-
|
|
249
|
+
closes or crashes frees its slot. A slot keeps the seed its key is derived
|
|
250
|
+
from, so a shared worker can read it in every browser.
|
|
236
251
|
Without IndexedDB or Web Locks there are no writer keys.
|
|
237
252
|
|
|
238
253
|
A node started from a store description, such as `startPageNode` or a node in
|
|
@@ -399,6 +414,29 @@ when it was first level with a whole-space peer, and `missing` to the version
|
|
|
399
414
|
ids a writer's line names that aren't here.
|
|
400
415
|
[Spec 05 §9](https://github.com/leifriksheim/minca/blob/main/spec/05-sync-and-storage.md).
|
|
401
416
|
|
|
417
|
+
### Syncing shallow
|
|
418
|
+
|
|
419
|
+
A record edited thousands of times has thousands of versions, and an agent
|
|
420
|
+
answering one question doesn't need them. With `shallow: true`, a node syncs
|
|
421
|
+
a space with its keepers by **shallow sets**: each record's current and
|
|
422
|
+
first versions, what its writer retained, and every version in a line, not
|
|
423
|
+
every superseded stub.
|
|
424
|
+
|
|
425
|
+
It is for a node that lives for a session and can't work without the
|
|
426
|
+
space's always-on nodes anyway, as a remote MCP session's. Apps and devices
|
|
427
|
+
leave it off and hold every version, so they work the same with no host.
|
|
428
|
+
|
|
429
|
+
A shallow node takes its keepers' word for the history it skips. A keeper
|
|
430
|
+
can hold a record back or show an older edit, but it can't forge one:
|
|
431
|
+
signatures, standing and first versions are checked as always. With no
|
|
432
|
+
keeper connected the node syncs whole from its other peers, and a space
|
|
433
|
+
that names no keepers syncs whole.
|
|
434
|
+
|
|
435
|
+
Removing someone, or taking a role away (`unassign`, `removeMember`,
|
|
436
|
+
`stepDown`), needs everything they wrote, which a shallow node doesn't
|
|
437
|
+
hold: it refuses. `revoke` always goes through.
|
|
438
|
+
[Spec 05 §5.1](https://github.com/leifriksheim/minca/blob/main/spec/05-sync-and-storage.md).
|
|
439
|
+
|
|
402
440
|
### Planned: caches that widen and trim
|
|
403
441
|
|
|
404
442
|
> **Planned.** A node holding part of a space would hold all of it when too
|
|
@@ -435,16 +473,33 @@ one run at a time:
|
|
|
435
473
|
|
|
436
474
|
1. It joins every space a `sys.joined` record names that it doesn't hold,
|
|
437
475
|
with the view-only invite in the record.
|
|
438
|
-
2. It leaves every space whose `sys.joined` record was deleted.
|
|
476
|
+
2. It leaves every space whose `sys.joined` record was deleted, all at once.
|
|
477
|
+
The space leaves the list right away. If the account still holds a place
|
|
478
|
+
there, giving it up runs in the background, as [leaving](#leaving-a-space)
|
|
479
|
+
describes.
|
|
439
480
|
3. It writes a `sys.joined` record for a space it holds that the registry
|
|
440
|
-
doesn't know.
|
|
441
|
-
|
|
442
|
-
|
|
481
|
+
doesn't know. That asks the account's hosts for the space's invite, so it
|
|
482
|
+
runs in the background, one run at a time apart from reconciling, reading
|
|
483
|
+
afresh each run what the registry still lacks. A space left meanwhile
|
|
484
|
+
stays left.
|
|
485
|
+
4. It brings every carrier's passes up to date.
|
|
486
|
+
5. It names the account's carriers as keepers of the open spaces it manages,
|
|
487
|
+
the account registry and contacts space among them: a carrier keeps the
|
|
488
|
+
account's personal space. Carry spaces name none.
|
|
443
489
|
6. It asks each host the account uses how it stands, without waiting, and
|
|
444
490
|
hands it the spaces if it was paid ([hosting](#carriers-hosting-and-notifications)).
|
|
491
|
+
A host whose signed status says the account's subscription lapsed, or has
|
|
492
|
+
none, and that it won't carry for it as things stand, stops being a carrier,
|
|
493
|
+
and so a keeper. A host that doesn't answer stays one.
|
|
445
494
|
|
|
446
495
|
Creating or joining a space writes its `sys.joined` record. Leaving deletes it.
|
|
447
496
|
|
|
497
|
+
The account's own spaces (the table above) are never in the list: joining a
|
|
498
|
+
carry space's invite writes no record, and a record that names one is passed
|
|
499
|
+
over in every step, neither joined nor left. A device that hadn't heard of the
|
|
500
|
+
carrier yet may have written one, and may have joined the space from the list;
|
|
501
|
+
it opens the space directly once it hears.
|
|
502
|
+
|
|
448
503
|
### Profiles
|
|
449
504
|
|
|
450
505
|
The node publishes the account's profile, `{ name, contactKey? }`, in a space
|
|
@@ -776,10 +831,12 @@ says what the app and the home send each other.
|
|
|
776
831
|
|
|
777
832
|
### The app's key
|
|
778
833
|
|
|
779
|
-
`appKey(name = 'default')` makes the app's P-256 key once and keeps
|
|
780
|
-
|
|
834
|
+
`appKey(name = 'default')` makes the app's P-256 key once and keeps the seed
|
|
835
|
+
it is derived from in the IndexedDB database `minca-app-key`, store `keys`,
|
|
781
836
|
under `name`. `forgetAppKey` deletes it, and the next connection makes a new
|
|
782
|
-
one.
|
|
837
|
+
one. A script running in the app's origin can read the seed, as it can the
|
|
838
|
+
session of any web app: the grant runs out, and the person can disconnect the
|
|
839
|
+
app at their account home.
|
|
783
840
|
|
|
784
841
|
### An app's node outside the page
|
|
785
842
|
|
|
@@ -861,6 +918,21 @@ and its status is a [`ConnectionStatus`](https://minca.dev/api/session/type-alia
|
|
|
861
918
|
- With `worker`, the node runs in a worker. If the worker fails to load or
|
|
862
919
|
doesn't start the node within 30 seconds (`WorkerNotStarted`), the node runs
|
|
863
920
|
in the page instead. A worker that started and refused passes its reason on.
|
|
921
|
+
- Opening an account that takes more than 10 seconds says so in `error`,
|
|
922
|
+
while the status stays `starting`: what is likely wrong (another tab
|
|
923
|
+
holding the browser's storage) and what to try (closing other tabs,
|
|
924
|
+
reloading). A store in IndexedDB that won't open within 15 seconds fails
|
|
925
|
+
with the same advice, rather than waiting for ever. An account that can't
|
|
926
|
+
be opened is `disconnected`, its `error` saying why.
|
|
927
|
+
- A tab whose node is its own (a dedicated worker's, or the page's) runs it
|
|
928
|
+
only in view, one at a time per account (a Web Lock,
|
|
929
|
+
`minca-node:<account DID>`): two nodes on one site's stores get in each
|
|
930
|
+
other's way, and a browser that freezes background tabs, as an iPhone
|
|
931
|
+
does, would freeze one holding them. Put away, the tab closes its node
|
|
932
|
+
(`starting`, with no node) and opens it again on coming back. A node the
|
|
933
|
+
tabs share, in a shared worker, stays.
|
|
934
|
+
- `keepAwake()` keeps the node open while the tab is put away, as a call
|
|
935
|
+
must, and returns what lets it go.
|
|
864
936
|
- It turns `expired` when the grant's `expiresAt` passes.
|
|
865
937
|
- When the node sees its note revoked (`revoked`), the connection forgets that
|
|
866
938
|
account's grant and key.
|
|
@@ -909,7 +981,9 @@ An app shows its own notifications with
|
|
|
909
981
|
`watchNotifications(node, { origin?, onNotify })`. It needs the account key,
|
|
910
982
|
so an app with `scope: account`. It reads the account's automations for the
|
|
911
983
|
app's origin, and calls `onNotify({ automation, record })` for each record
|
|
912
|
-
that arrives matching one.
|
|
984
|
+
that arrives matching one. With `origin: null` it reads every app's
|
|
985
|
+
automations and the person's own: for something that speaks for every app
|
|
986
|
+
while none is open, as the Chrome extension does.
|
|
913
987
|
|
|
914
988
|
A record matches when the automation isn't paused, and the record is in its
|
|
915
989
|
collection and one of its spaces, created after `since` and within the last
|
|
@@ -920,6 +994,28 @@ and nor is what a collection held when an automation first looked there.
|
|
|
920
994
|
How to show a match is up to the app. A "Notify me" button is usually where a
|
|
921
995
|
proposal starts.
|
|
922
996
|
|
|
997
|
+
For a list of what happened, pass `onActivity` too. After each change it gets
|
|
998
|
+
what the automations match now, newest first, up to 50, each record once under
|
|
999
|
+
the automation that asks about it most particularly. A match is dated by what
|
|
1000
|
+
set it off, and listed if it would have notified when that was written, so
|
|
1001
|
+
the 24 hours don't apply. It comes from the records, so it holds what arrived
|
|
1002
|
+
while the app was closed, and devices holding the same records list the same.
|
|
1003
|
+
Like notifications, it looks at the newest 50 records of a collection, by the
|
|
1004
|
+
time their writers gave them, so an older match drops out under newer ones. A
|
|
1005
|
+
match dated more than five minutes ahead waits for its time.
|
|
1006
|
+
|
|
1007
|
+
```js
|
|
1008
|
+
watchNotifications(node, {
|
|
1009
|
+
onNotify: ({ automation, record }) => showPopup(automation, record),
|
|
1010
|
+
onActivity: (matches) => setActivity(matches),
|
|
1011
|
+
});
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
What the person has read of it is the app's to keep: a time in the account
|
|
1015
|
+
registry, say, and what is newer counts as new. A record that arrives late,
|
|
1016
|
+
dated before that time, then isn't new, though it still notifies within its
|
|
1017
|
+
24 hours.
|
|
1018
|
+
|
|
923
1019
|
## Carriers, hosting and notifications
|
|
924
1020
|
|
|
925
1021
|
A carrier is an always-on node that keeps the account's spaces online while
|
|
@@ -939,8 +1035,7 @@ returns that one.
|
|
|
939
1035
|
Carry spaces aren't kept in the node's list. Each is derived again from its
|
|
940
1036
|
record. When the node starts, or the registry changes, it refills every carry
|
|
941
1037
|
space in the background. That opens every space the account holds, which is
|
|
942
|
-
slow from a data folder, so signing in doesn't wait for it
|
|
943
|
-
adding an automation. Adding a carrier writes its passes before it returns.
|
|
1038
|
+
slow from a data folder, so signing in doesn't wait for it. Adding a carrier writes its passes before it returns.
|
|
944
1039
|
|
|
945
1040
|
- `carriers.settled(waitMs)` waits for the refill under way, and says whether
|
|
946
1041
|
it finished. Use it before a window closes.
|
|
@@ -973,19 +1068,10 @@ wrote.
|
|
|
973
1068
|
|
|
974
1069
|
`node.automations` needs the account key. It lists, adds, updates (`name`,
|
|
975
1070
|
`paused`) and removes the account's own
|
|
976
|
-
[automations](automations.md#the-accounts-own), kept in its registry
|
|
977
|
-
copies a wake for each into every carry space. The reference home adds them
|
|
1071
|
+
[automations](automations.md#the-accounts-own), kept in its registry. The reference home adds them
|
|
978
1072
|
when a person keeps an app's proposal, and lists them by app to pause or
|
|
979
1073
|
remove ([the account home's side](sign-in.md#the-account-homes-side)).
|
|
980
1074
|
|
|
981
|
-
### A carrier's matches
|
|
982
|
-
|
|
983
|
-
When a version wakes one of the account's wakes, a `CarrierNode` sends a
|
|
984
|
-
`wake` event with only the wake, the space, and the record's key, collection
|
|
985
|
-
and `createdAt`. `wakes()` lists the wakes it holds. The desktop app shows
|
|
986
|
-
these as notifications. The browser
|
|
987
|
-
extension doesn't yet.
|
|
988
|
-
|
|
989
1075
|
### Hosting
|
|
990
1076
|
|
|
991
1077
|
`node.hosting` pays a host and hands it the account's spaces. Its calls are
|
|
@@ -1131,28 +1217,15 @@ a [`KnockView`](https://minca.dev/api/core/interfaces/KnockView/). Knocking and
|
|
|
1131
1217
|
These aren't protocol. Another client may draw sign-in and
|
|
1132
1218
|
[calls](../../calls/README.md) however it likes.
|
|
1133
1219
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
```html
|
|
1138
|
-
<minca-auth app-name="Todo" relays="wss://relay.minca.social"></minca-auth>
|
|
1139
|
-
```
|
|
1140
|
-
|
|
1141
|
-
- Attributes: `app-name`, and `relays` and `nodes`, comma-separated.
|
|
1142
|
-
- It fires `minca-session` with `detail: { session }`, or `null` when signed
|
|
1143
|
-
out. The event bubbles and is composed.
|
|
1144
|
-
- A page can give it its own flow with `element.auth = createMincaAuth(…)`.
|
|
1145
|
-
- It sizes to its container, so it fits a page, a modal or a side panel, and
|
|
1146
|
-
draws nothing once someone is in.
|
|
1147
|
-
- Colours, font and radius are custom properties (`--minca-accent`,
|
|
1148
|
-
`--minca-font`, …).
|
|
1220
|
+
Sign-in has no drawn screens in the library: a page draws its own on
|
|
1221
|
+
[`createMincaAuth`](sign-in.md), as the account home does.
|
|
1149
1222
|
|
|
1150
1223
|
## React
|
|
1151
1224
|
|
|
1152
1225
|
`@minca/react` follows sign-in or the connection, and keeps what you read
|
|
1153
1226
|
live. `MincaProvider` goes at the top, given an `auth` or a `connection`;
|
|
1154
1227
|
`useMinca`, `useAuth`, `useSession`, `useConnection` and `useAccount` read
|
|
1155
|
-
it
|
|
1228
|
+
it. Below it, hooks such as `useNode`,
|
|
1156
1229
|
`useSpaces`, `useQuery`, `useRecord` and `useCan` read and keep current what
|
|
1157
1230
|
you show, with `useLive` and `useWatched` for anything else. Each one, and what
|
|
1158
1231
|
it gives, is in the [React reference](https://minca.dev/api/react/).
|
|
@@ -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/sign-in.md
CHANGED
|
@@ -8,33 +8,34 @@ pairing a phone.
|
|
|
8
8
|
|
|
9
9
|
## The sign-in screen
|
|
10
10
|
|
|
11
|
-
The
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
The flow is state and actions: draw a screen for each `stage`, and call an
|
|
12
|
+
action from its buttons. `subscribe` calls back after every change.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { createMincaAuth } from '@minca/auth';
|
|
16
|
+
|
|
17
|
+
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
18
|
+
|
|
19
|
+
auth.subscribe((state) => {
|
|
20
|
+
if (state.stage === 'ready') start(state.session.node);
|
|
21
|
+
else draw(state); // a screen for state.stage
|
|
22
|
+
});
|
|
23
|
+
passkeyButton.addEventListener('click', () => auth.signInWithPasskey());
|
|
24
|
+
void auth.start();
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
In React,
|
|
26
|
-
and show `<MincaAuth>` until the person is signed in:
|
|
27
|
+
In React, hand the flow to `MincaProvider`, and read it with `useMinca`:
|
|
27
28
|
|
|
28
29
|
```tsx
|
|
29
30
|
import { createRoot } from 'react-dom/client';
|
|
30
|
-
import { createMincaAuth } from '@minca/
|
|
31
|
-
import { MincaProvider,
|
|
31
|
+
import { createMincaAuth } from '@minca/auth';
|
|
32
|
+
import { MincaProvider, useMinca } from '@minca/react';
|
|
32
33
|
|
|
33
34
|
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
34
35
|
|
|
35
36
|
function App() {
|
|
36
37
|
const { state } = useMinca();
|
|
37
|
-
if (state?.stage !== 'ready') return <
|
|
38
|
+
if (state?.stage !== 'ready') return <p>{state?.stage}</p>; // a screen for each stage
|
|
38
39
|
return <p>Signed in.</p>;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -45,9 +46,11 @@ createRoot(root).render(
|
|
|
45
46
|
);
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
The account home draws every stage
|
|
50
|
+
([its screens](https://github.com/leifriksheim/minca/tree/main/apps/home/src/components));
|
|
51
|
+
start from those. Everything below the provider works as it does for a
|
|
52
|
+
connected app. The rest of this page is what each stage means and which
|
|
53
|
+
action moves it on.
|
|
51
54
|
|
|
52
55
|
## Places
|
|
53
56
|
|
|
@@ -68,13 +71,13 @@ them most recently used first.
|
|
|
68
71
|
The flow is a state to read and actions to call. `auth.getState().stage`
|
|
69
72
|
says which screen it is on. It goes from `starting` through the screens of signing in or setting up,
|
|
70
73
|
to `ready`. What each stage means is in
|
|
71
|
-
[`AuthStage`](https://minca.dev/api/
|
|
74
|
+
[`AuthStage`](https://minca.dev/api/auth/type-aliases/AuthStage/).
|
|
72
75
|
|
|
73
76
|
Where data lives is asked at `existing`, not up front. A page that waits for
|
|
74
77
|
`ready` doesn't see the session during `recovery`, `unlock` or `pod`.
|
|
75
78
|
|
|
76
79
|
A failed action sets `error`, an
|
|
77
|
-
[`AuthError`](https://minca.dev/api/
|
|
80
|
+
[`AuthError`](https://minca.dev/api/auth/interfaces/AuthError/), and stays
|
|
78
81
|
on the same stage. A dismissed passkey or folder prompt sets no error.
|
|
79
82
|
|
|
80
83
|
### Moving between stages
|
|
@@ -107,7 +110,7 @@ on the same stage. A dismissed passkey or folder prompt sets no error.
|
|
|
107
110
|
Chrome keeps a pod's folder between visits, but not the permission to use
|
|
108
111
|
it, unless the person chose "Allow on every visit". Then `start()` sets
|
|
109
112
|
`podToReopen` to the folder's name and goes on as if there were no pod.
|
|
110
|
-
|
|
113
|
+
Offer it first on the welcome screen. `reopenPod()`, called
|
|
111
114
|
from that click, asks for the permission and carries on as `start()` would
|
|
112
115
|
have.
|
|
113
116
|
|
|
@@ -176,7 +179,7 @@ doesn't ask again. The choices are `never`, `1d`, `7d` and `30d`. The default
|
|
|
176
179
|
is `7d`, and each use pushes the expiry forward.
|
|
177
180
|
|
|
178
181
|
```ts
|
|
179
|
-
import { createMincaAuth } from '@minca/
|
|
182
|
+
import { createMincaAuth } from '@minca/auth';
|
|
180
183
|
|
|
181
184
|
const auth = createMincaAuth();
|
|
182
185
|
await auth.staySignedIn.setChoice('30d');
|
|
@@ -222,7 +225,7 @@ sign-in kept for days. So anything that hands out the whole account, or
|
|
|
222
225
|
changes how it signs in, asks again first:
|
|
223
226
|
|
|
224
227
|
```ts
|
|
225
|
-
import { createMincaAuth } from '@minca/
|
|
228
|
+
import { createMincaAuth } from '@minca/auth';
|
|
226
229
|
|
|
227
230
|
const auth = createMincaAuth();
|
|
228
231
|
const ok = await auth.confirm({ password: 'correct horse battery staple' });
|
|
@@ -230,7 +233,7 @@ const ok = await auth.confirm({ password: 'correct horse battery staple' });
|
|
|
230
233
|
|
|
231
234
|
The proof is the password, the passkey's own check (a fingerprint, a face or
|
|
232
235
|
a PIN), or the recovery code itself
|
|
233
|
-
([`MincaAuth.confirm`](https://minca.dev/api/
|
|
236
|
+
([`MincaAuth.confirm`](https://minca.dev/api/auth/interfaces/MincaAuth/)).
|
|
234
237
|
A wrong answer resolves false and sets `error`. A passkey with nothing behind
|
|
235
238
|
it is no proof.
|
|
236
239
|
|
|
@@ -285,8 +288,8 @@ the person confirms on the computer. The phone then signs in, joins each
|
|
|
285
288
|
space (`{ kind: 'joining', joined, total }`), and ends on `received`.
|
|
286
289
|
|
|
287
290
|
It waits 60 seconds for the computer to answer, and 10 minutes for the
|
|
288
|
-
person to confirm. Where accounts are already kept,
|
|
289
|
-
before
|
|
291
|
+
person to confirm. Where accounts are already kept, a page drawing its own
|
|
292
|
+
screens must warn the person before the tap that calls `acceptPairing()`: a link someone else sent would put the phone in their
|
|
290
293
|
account.
|
|
291
294
|
|
|
292
295
|
After that, the account goes to `unlock` with `setup: 'paired'` if it has no
|
|
@@ -302,7 +305,7 @@ asking, and only its spaces are joined.
|
|
|
302
305
|
|
|
303
306
|
`answerPairing(true)` adds the account, or switches to it, and keeps the
|
|
304
307
|
other one filed to switch back to. `answerPairing(false)` lets it go.
|
|
305
|
-
|
|
308
|
+
Ask the person: "Add this account?" or "Switch to <name>?".
|
|
306
309
|
|
|
307
310
|
Switching doesn't sign the other account out: its session key is left as it
|
|
308
311
|
is, as when a tab closes. Only the session open when the account arrives
|
|
@@ -339,10 +342,9 @@ the person chooses:
|
|
|
339
342
|
`forgetBrowserCopy()` then deletes the browser's copy. Other accounts in the
|
|
340
343
|
pod are never touched.
|
|
341
344
|
|
|
342
|
-
The page writes to the pod only while it is open.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
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.
|
|
346
348
|
|
|
347
349
|
## Removing an account
|
|
348
350
|
|
|
@@ -361,20 +363,10 @@ in a pod is not removed this way: the pod is its copy.
|
|
|
361
363
|
|
|
362
364
|
## Linking to the account home
|
|
363
365
|
|
|
364
|
-
|
|
365
|
-
`
|
|
366
|
-
account
|
|
367
|
-
|
|
368
|
-
```ts
|
|
369
|
-
import { accountHomeLink, popupFeatures } from '@minca/core/session';
|
|
370
|
-
|
|
371
|
-
const home = 'https://home.minca.social/connect';
|
|
372
|
-
window.open(accountHomeLink(home, did, 'notifications'), 'minca', popupFeatures(480, 640));
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
That opens `…#notifications&account=<did>`. `popupFeatures(width, height)`
|
|
376
|
-
centres the popup on the window it opens from. Given only a size, a browser
|
|
377
|
-
puts it where it likes, often the top left of the screen.
|
|
366
|
+
A connected app opens the person's account home with
|
|
367
|
+
[`connection.openHome()`](building-an-app.md#the-account-home). It opens the
|
|
368
|
+
account page beside the connect page, with the account in the fragment, so it
|
|
369
|
+
never reaches the home's server: `…#notifications&account=<did>`.
|
|
378
370
|
|
|
379
371
|
On the home, `readAccountHint()` gives the DID, or null when there is none or
|
|
380
372
|
it isn't a P-256 `did:key`. `clearAccountHint()` takes it out of the address
|
|
@@ -391,7 +383,7 @@ no proof. [Threat model §3.1](https://github.com/leifriksheim/minca/blob/main/s
|
|
|
391
383
|
## Options
|
|
392
384
|
|
|
393
385
|
`createMincaAuth(config)` takes the options in
|
|
394
|
-
[`MincaAuthConfig`](https://minca.dev/api/
|
|
386
|
+
[`MincaAuthConfig`](https://minca.dev/api/auth/interfaces/MincaAuthConfig/).
|
|
395
387
|
Every one has a default, so `createMincaAuth()` alone signs in offline, in
|
|
396
388
|
this browser.
|
|
397
389
|
|
|
@@ -455,7 +447,7 @@ Device keys in the vault are in
|
|
|
455
447
|
|
|
456
448
|
A sign-in starts a node with the account's keys, the place's stores for that
|
|
457
449
|
account ([stores](node.md#stores)) and the configured network. The session is a
|
|
458
|
-
[`MincaSession`](https://minca.dev/api/
|
|
450
|
+
[`MincaSession`](https://minca.dev/api/auth/interfaces/MincaSession/).
|
|
459
451
|
|
|
460
452
|
The seed stays inside the auth object. `recoveryCode()` returns it as a
|
|
461
453
|
recovery code. The page also holds the local key, which seals a pod's
|
|
@@ -488,7 +480,7 @@ chose, from 1/24 to 365.
|
|
|
488
480
|
### Connections
|
|
489
481
|
|
|
490
482
|
`auth.connections()` lists what the home has connected, each a
|
|
491
|
-
[`Connection`](https://minca.dev/api/
|
|
483
|
+
[`Connection`](https://minca.dev/api/auth/interfaces/Connection/). They are kept
|
|
492
484
|
per account in `localStorage` under `<prefix>.connections:<accountId>`. A kept
|
|
493
485
|
connection in any other shape is dropped when read, and its app connects
|
|
494
486
|
again.
|
|
@@ -499,8 +491,9 @@ revokes an app just because its time has passed.
|
|
|
499
491
|
|
|
500
492
|
A program connected by code at the home's own origin (`via: 'code'`) is kept
|
|
501
493
|
by its key instead, so each such program is its own (`connectionKey`). A
|
|
502
|
-
carrier is kept
|
|
503
|
-
|
|
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.
|
|
504
497
|
|
|
505
498
|
### Disconnecting
|
|
506
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
|
```
|
|
@@ -308,6 +308,20 @@ until an admin redefines the member role.
|
|
|
308
308
|
The example app reads no `std.space-profile` in a space for two. It names
|
|
309
309
|
the space for the other person.
|
|
310
310
|
|
|
311
|
+
## Text is Markdown
|
|
312
|
+
|
|
313
|
+
The `text` of a `std.message`, `std.comment` or `std.post` is Markdown:
|
|
314
|
+
CommonMark, with GitHub's tables and `~~strikethrough~~`. A plain sentence is
|
|
315
|
+
Markdown too, so an app that shows text as it is still shows it right.
|
|
316
|
+
|
|
317
|
+
````json
|
|
318
|
+
{ "text": "Shipped **today**:\n\n- the chat\n- `code` blocks\n\n```\nnpm run dev\n```" }
|
|
319
|
+
````
|
|
320
|
+
|
|
321
|
+
Draw it as elements, never as HTML, so a message can't put markup on the
|
|
322
|
+
screen. A screen gets this from the kit: `MentionText` draws it and
|
|
323
|
+
`MentionInput` writes it.
|
|
324
|
+
|
|
311
325
|
## Mentions and replies
|
|
312
326
|
|
|
313
327
|
A `std.message`, `std.comment` or `std.post` names the accounts it calls on
|
|
@@ -324,7 +338,7 @@ message they replied to. Never fill them by matching text.
|
|
|
324
338
|
|
|
325
339
|
They are topics, as is a message's `in` link. So an automation of the
|
|
326
340
|
account's own can ask for only what mentions it, replies to it, or is in one
|
|
327
|
-
channel
|
|
341
|
+
channel:
|
|
328
342
|
|
|
329
343
|
```json
|
|
330
344
|
{ "where": { "mentions": { "$contains": "$me" } } }
|
|
@@ -354,9 +368,7 @@ A record written in answer to someone's record names them in
|
|
|
354
368
|
| `std.order`, `std.order-update` | the listing's or the order's author |
|
|
355
369
|
|
|
356
370
|
It's a topic, so "someone answered what I wrote" is
|
|
357
|
-
`where: { "respondingTo": { "$contains": "$me" } }
|
|
358
|
-
match it unread. The link says the same to a node that can read, but a
|
|
359
|
-
carrier can't read a private space's links, so the account is written out.
|
|
371
|
+
`where: { "respondingTo": { "$contains": "$me" } }`.
|
|
360
372
|
Fill it from the author of the linked record, and leave it out when that's
|
|
361
373
|
the writer.
|
|
362
374
|
|
|
@@ -432,7 +444,7 @@ import type { NodeRecord } from '@minca/core';
|
|
|
432
444
|
declare const above: NodeRecord<{ position: string }> | undefined;
|
|
433
445
|
declare const below: NodeRecord<{ position: string }> | undefined;
|
|
434
446
|
// ---cut---
|
|
435
|
-
import { positionBetween } from '@minca/
|
|
447
|
+
import { positionBetween } from '@minca/std';
|
|
436
448
|
|
|
437
449
|
positionBetween(above?.body?.position, below?.body?.position);
|
|
438
450
|
```
|