@weaveprotocol/core 0.1.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 +1106 -0
- package/dist/elements/auth-styles.d.ts +18 -0
- package/dist/elements/auth-styles.d.ts.map +1 -0
- package/dist/elements/auth-styles.js +150 -0
- package/dist/elements/auth-styles.js.map +1 -0
- package/dist/elements/dom.d.ts +28 -0
- package/dist/elements/dom.d.ts.map +1 -0
- package/dist/elements/dom.js +74 -0
- package/dist/elements/dom.js.map +1 -0
- package/dist/elements/index.d.ts +13 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/index.js +11 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/elements/weave-auth.d.ts +52 -0
- package/dist/elements/weave-auth.d.ts.map +1 -0
- package/dist/elements/weave-auth.js +427 -0
- package/dist/elements/weave-auth.js.map +1 -0
- package/dist/identity/account-store.d.ts +113 -0
- package/dist/identity/account-store.d.ts.map +1 -0
- package/dist/identity/account-store.js +305 -0
- package/dist/identity/account-store.js.map +1 -0
- package/dist/identity/account-vault.d.ts +199 -0
- package/dist/identity/account-vault.d.ts.map +1 -0
- package/dist/identity/account-vault.js +251 -0
- package/dist/identity/account-vault.js.map +1 -0
- package/dist/identity/agent-note.d.ts +19 -0
- package/dist/identity/agent-note.d.ts.map +1 -0
- package/dist/identity/agent-note.js +29 -0
- package/dist/identity/agent-note.js.map +1 -0
- package/dist/identity/crypto-p256.d.ts +7 -0
- package/dist/identity/crypto-p256.d.ts.map +1 -0
- package/dist/identity/crypto-p256.js +84 -0
- package/dist/identity/crypto-p256.js.map +1 -0
- package/dist/identity/device-key.d.ts +60 -0
- package/dist/identity/device-key.d.ts.map +1 -0
- package/dist/identity/device-key.js +103 -0
- package/dist/identity/device-key.js.map +1 -0
- package/dist/identity/did.d.ts +22 -0
- package/dist/identity/did.d.ts.map +1 -0
- package/dist/identity/did.js +37 -0
- package/dist/identity/did.js.map +1 -0
- package/dist/identity/folder-account.d.ts +65 -0
- package/dist/identity/folder-account.d.ts.map +1 -0
- package/dist/identity/folder-account.js +115 -0
- package/dist/identity/folder-account.js.map +1 -0
- package/dist/identity/identity-manager.d.ts +36 -0
- package/dist/identity/identity-manager.d.ts.map +1 -0
- package/dist/identity/identity-manager.js +115 -0
- package/dist/identity/identity-manager.js.map +1 -0
- package/dist/identity/index.d.ts +10 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +10 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/keys.d.ts +24 -0
- package/dist/identity/keys.d.ts.map +1 -0
- package/dist/identity/keys.js +38 -0
- package/dist/identity/keys.js.map +1 -0
- package/dist/identity/pairing.d.ts +83 -0
- package/dist/identity/pairing.d.ts.map +1 -0
- package/dist/identity/pairing.js +120 -0
- package/dist/identity/pairing.js.map +1 -0
- package/dist/identity/passkey-diagnostics.d.ts +54 -0
- package/dist/identity/passkey-diagnostics.d.ts.map +1 -0
- package/dist/identity/passkey-diagnostics.js +178 -0
- package/dist/identity/passkey-diagnostics.js.map +1 -0
- package/dist/identity/recovery-code.d.ts +50 -0
- package/dist/identity/recovery-code.d.ts.map +1 -0
- package/dist/identity/recovery-code.js +116 -0
- package/dist/identity/recovery-code.js.map +1 -0
- package/dist/identity/root-signer.d.ts +59 -0
- package/dist/identity/root-signer.d.ts.map +1 -0
- package/dist/identity/root-signer.js +44 -0
- package/dist/identity/root-signer.js.map +1 -0
- package/dist/identity/ucan.d.ts +164 -0
- package/dist/identity/ucan.d.ts.map +1 -0
- package/dist/identity/ucan.js +273 -0
- package/dist/identity/ucan.js.map +1 -0
- package/dist/identity/webauthn.d.ts +87 -0
- package/dist/identity/webauthn.d.ts.map +1 -0
- package/dist/identity/webauthn.js +155 -0
- package/dist/identity/webauthn.js.map +1 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/network/index.d.ts +17 -0
- package/dist/network/index.d.ts.map +1 -0
- package/dist/network/index.js +10 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/introductions.d.ts +85 -0
- package/dist/network/introductions.d.ts.map +1 -0
- package/dist/network/introductions.js +94 -0
- package/dist/network/introductions.js.map +1 -0
- package/dist/network/local-transport.d.ts +22 -0
- package/dist/network/local-transport.d.ts.map +1 -0
- package/dist/network/local-transport.js +55 -0
- package/dist/network/local-transport.js.map +1 -0
- package/dist/network/mesh.d.ts +31 -0
- package/dist/network/mesh.d.ts.map +1 -0
- package/dist/network/mesh.js +332 -0
- package/dist/network/mesh.js.map +1 -0
- package/dist/network/multi-signaling.d.ts +29 -0
- package/dist/network/multi-signaling.d.ts.map +1 -0
- package/dist/network/multi-signaling.js +125 -0
- package/dist/network/multi-signaling.js.map +1 -0
- package/dist/network/network-manager.d.ts +37 -0
- package/dist/network/network-manager.d.ts.map +1 -0
- package/dist/network/network-manager.js +64 -0
- package/dist/network/network-manager.js.map +1 -0
- package/dist/network/peer-auth.d.ts +98 -0
- package/dist/network/peer-auth.d.ts.map +1 -0
- package/dist/network/peer-auth.js +86 -0
- package/dist/network/peer-auth.js.map +1 -0
- package/dist/network/rtc-transport.d.ts +18 -0
- package/dist/network/rtc-transport.d.ts.map +1 -0
- package/dist/network/rtc-transport.js +149 -0
- package/dist/network/rtc-transport.js.map +1 -0
- package/dist/network/signaling.d.ts +40 -0
- package/dist/network/signaling.d.ts.map +1 -0
- package/dist/network/signaling.js +124 -0
- package/dist/network/signaling.js.map +1 -0
- package/dist/network/transport.d.ts +50 -0
- package/dist/network/transport.d.ts.map +1 -0
- package/dist/network/transport.js +13 -0
- package/dist/network/transport.js.map +1 -0
- package/dist/network/ws-transport.d.ts +42 -0
- package/dist/network/ws-transport.d.ts.map +1 -0
- package/dist/network/ws-transport.js +194 -0
- package/dist/network/ws-transport.js.map +1 -0
- package/dist/node/actions.d.ts +62 -0
- package/dist/node/actions.d.ts.map +1 -0
- package/dist/node/actions.js +500 -0
- package/dist/node/actions.js.map +1 -0
- package/dist/node/carrier.d.ts +85 -0
- package/dist/node/carrier.d.ts.map +1 -0
- package/dist/node/carrier.js +192 -0
- package/dist/node/carrier.js.map +1 -0
- package/dist/node/copy.d.ts +38 -0
- package/dist/node/copy.d.ts.map +1 -0
- package/dist/node/copy.js +53 -0
- package/dist/node/copy.js.map +1 -0
- package/dist/node/index.d.ts +16 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +11 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/node.d.ts +12 -0
- package/dist/node/node.d.ts.map +1 -0
- package/dist/node/node.js +872 -0
- package/dist/node/node.js.map +1 -0
- package/dist/node/space-runtime.d.ts +144 -0
- package/dist/node/space-runtime.d.ts.map +1 -0
- package/dist/node/space-runtime.js +1221 -0
- package/dist/node/space-runtime.js.map +1 -0
- package/dist/node/stores.d.ts +45 -0
- package/dist/node/stores.d.ts.map +1 -0
- package/dist/node/stores.js +31 -0
- package/dist/node/stores.js.map +1 -0
- package/dist/node/types.d.ts +508 -0
- package/dist/node/types.d.ts.map +1 -0
- package/dist/node/types.js +2 -0
- package/dist/node/types.js.map +1 -0
- package/dist/privacy/index.d.ts +4 -0
- package/dist/privacy/index.d.ts.map +1 -0
- package/dist/privacy/index.js +4 -0
- package/dist/privacy/index.js.map +1 -0
- package/dist/privacy/key-distribution.d.ts +42 -0
- package/dist/privacy/key-distribution.d.ts.map +1 -0
- package/dist/privacy/key-distribution.js +50 -0
- package/dist/privacy/key-distribution.js.map +1 -0
- package/dist/privacy/privacy-guard.d.ts +24 -0
- package/dist/privacy/privacy-guard.d.ts.map +1 -0
- package/dist/privacy/privacy-guard.js +87 -0
- package/dist/privacy/privacy-guard.js.map +1 -0
- package/dist/privacy/space-encryption.d.ts +48 -0
- package/dist/privacy/space-encryption.d.ts.map +1 -0
- package/dist/privacy/space-encryption.js +61 -0
- package/dist/privacy/space-encryption.js.map +1 -0
- package/dist/query/engine.d.ts +27 -0
- package/dist/query/engine.d.ts.map +1 -0
- package/dist/query/engine.js +84 -0
- package/dist/query/engine.js.map +1 -0
- package/dist/query/filter.d.ts +15 -0
- package/dist/query/filter.d.ts.map +1 -0
- package/dist/query/filter.js +207 -0
- package/dist/query/filter.js.map +1 -0
- package/dist/query/types.d.ts +144 -0
- package/dist/query/types.d.ts.map +1 -0
- package/dist/query/types.js +22 -0
- package/dist/query/types.js.map +1 -0
- package/dist/react/context.d.ts +81 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +95 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +36 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/use-live.d.ts +16 -0
- package/dist/react/use-live.d.ts.map +1 -0
- package/dist/react/use-live.js +55 -0
- package/dist/react/use-live.js.map +1 -0
- package/dist/react/use-query.d.ts +17 -0
- package/dist/react/use-query.d.ts.map +1 -0
- package/dist/react/use-query.js +23 -0
- package/dist/react/use-query.js.map +1 -0
- package/dist/react/use-space.d.ts +29 -0
- package/dist/react/use-space.d.ts.map +1 -0
- package/dist/react/use-space.js +48 -0
- package/dist/react/use-space.js.map +1 -0
- package/dist/react/use-spaces.d.ts +19 -0
- package/dist/react/use-spaces.d.ts.map +1 -0
- package/dist/react/use-spaces.js +55 -0
- package/dist/react/use-spaces.js.map +1 -0
- package/dist/react/use-weave-auth.d.ts +10 -0
- package/dist/react/use-weave-auth.d.ts.map +1 -0
- package/dist/react/use-weave-auth.js +15 -0
- package/dist/react/use-weave-auth.js.map +1 -0
- package/dist/react/weave-auth.d.ts +17 -0
- package/dist/react/weave-auth.d.ts.map +1 -0
- package/dist/react/weave-auth.js +38 -0
- package/dist/react/weave-auth.js.map +1 -0
- package/dist/records/describe.d.ts +38 -0
- package/dist/records/describe.d.ts.map +1 -0
- package/dist/records/describe.js +101 -0
- package/dist/records/describe.js.map +1 -0
- package/dist/records/links.d.ts +14 -0
- package/dist/records/links.d.ts.map +1 -0
- package/dist/records/links.js +25 -0
- package/dist/records/links.js.map +1 -0
- package/dist/records/rules.d.ts +59 -0
- package/dist/records/rules.d.ts.map +1 -0
- package/dist/records/rules.js +118 -0
- package/dist/records/rules.js.map +1 -0
- package/dist/records/version.d.ts +54 -0
- package/dist/records/version.d.ts.map +1 -0
- package/dist/records/version.js +70 -0
- package/dist/records/version.js.map +1 -0
- package/dist/schema/collection-def.d.ts +96 -0
- package/dist/schema/collection-def.d.ts.map +1 -0
- package/dist/schema/collection-def.js +272 -0
- package/dist/schema/collection-def.js.map +1 -0
- package/dist/schema/expression.d.ts +69 -0
- package/dist/schema/expression.d.ts.map +1 -0
- package/dist/schema/expression.js +92 -0
- package/dist/schema/expression.js.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +4 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/schema-engine.d.ts +42 -0
- package/dist/schema/schema-engine.d.ts.map +1 -0
- package/dist/schema/schema-engine.js +36 -0
- package/dist/schema/schema-engine.js.map +1 -0
- package/dist/schema/signer.d.ts +27 -0
- package/dist/schema/signer.d.ts.map +1 -0
- package/dist/schema/signer.js +36 -0
- package/dist/schema/signer.js.map +1 -0
- package/dist/schemas/apps.d.ts +88 -0
- package/dist/schemas/apps.d.ts.map +1 -0
- package/dist/schemas/apps.js +168 -0
- package/dist/schemas/apps.js.map +1 -0
- package/dist/schemas/index.d.ts +410 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +208 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/screens.d.ts +67 -0
- package/dist/schemas/screens.d.ts.map +1 -0
- package/dist/schemas/screens.js +242 -0
- package/dist/schemas/screens.js.map +1 -0
- package/dist/session/agent-link.d.ts +79 -0
- package/dist/session/agent-link.d.ts.map +1 -0
- package/dist/session/agent-link.js +251 -0
- package/dist/session/agent-link.js.map +1 -0
- package/dist/session/auth.d.ts +233 -0
- package/dist/session/auth.d.ts.map +1 -0
- package/dist/session/auth.js +783 -0
- package/dist/session/auth.js.map +1 -0
- package/dist/session/connect.d.ts +211 -0
- package/dist/session/connect.d.ts.map +1 -0
- package/dist/session/connect.js +355 -0
- package/dist/session/connect.js.map +1 -0
- package/dist/session/connection.d.ts +70 -0
- package/dist/session/connection.d.ts.map +1 -0
- package/dist/session/connection.js +120 -0
- package/dist/session/connection.js.map +1 -0
- package/dist/session/credentials.d.ts +44 -0
- package/dist/session/credentials.d.ts.map +1 -0
- package/dist/session/credentials.js +60 -0
- package/dist/session/credentials.js.map +1 -0
- package/dist/session/index.d.ts +25 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +18 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/pairing.d.ts +59 -0
- package/dist/session/pairing.d.ts.map +1 -0
- package/dist/session/pairing.js +144 -0
- package/dist/session/pairing.js.map +1 -0
- package/dist/session/places.d.ts +62 -0
- package/dist/session/places.d.ts.map +1 -0
- package/dist/session/places.js +101 -0
- package/dist/session/places.js.map +1 -0
- package/dist/session/stay-signed-in.d.ts +37 -0
- package/dist/session/stay-signed-in.d.ts.map +1 -0
- package/dist/session/stay-signed-in.js +124 -0
- package/dist/session/stay-signed-in.js.map +1 -0
- package/dist/space/account-registry.d.ts +64 -0
- package/dist/space/account-registry.d.ts.map +1 -0
- package/dist/space/account-registry.js +66 -0
- package/dist/space/account-registry.js.map +1 -0
- package/dist/space/index.d.ts +3 -0
- package/dist/space/index.d.ts.map +1 -0
- package/dist/space/index.js +3 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/pass.d.ts +63 -0
- package/dist/space/pass.d.ts.map +1 -0
- package/dist/space/pass.js +54 -0
- package/dist/space/pass.js.map +1 -0
- package/dist/space/presets.d.ts +31 -0
- package/dist/space/presets.d.ts.map +1 -0
- package/dist/space/presets.js +24 -0
- package/dist/space/presets.js.map +1 -0
- package/dist/space/roles.d.ts +186 -0
- package/dist/space/roles.d.ts.map +1 -0
- package/dist/space/roles.js +500 -0
- package/dist/space/roles.js.map +1 -0
- package/dist/space/space-access.d.ts +80 -0
- package/dist/space/space-access.d.ts.map +1 -0
- package/dist/space/space-access.js +135 -0
- package/dist/space/space-access.js.map +1 -0
- package/dist/space/space-manager.d.ts +87 -0
- package/dist/space/space-manager.d.ts.map +1 -0
- package/dist/space/space-manager.js +187 -0
- package/dist/space/space-manager.js.map +1 -0
- package/dist/storage/directory-access.d.ts +78 -0
- package/dist/storage/directory-access.d.ts.map +1 -0
- package/dist/storage/directory-access.js +164 -0
- package/dist/storage/directory-access.js.map +1 -0
- package/dist/storage/encrypted-adapter.d.ts +49 -0
- package/dist/storage/encrypted-adapter.d.ts.map +1 -0
- package/dist/storage/encrypted-adapter.js +106 -0
- package/dist/storage/encrypted-adapter.js.map +1 -0
- package/dist/storage/folder-adapter.d.ts +105 -0
- package/dist/storage/folder-adapter.d.ts.map +1 -0
- package/dist/storage/folder-adapter.js +280 -0
- package/dist/storage/folder-adapter.js.map +1 -0
- package/dist/storage/folder-reconcile.d.ts +53 -0
- package/dist/storage/folder-reconcile.d.ts.map +1 -0
- package/dist/storage/folder-reconcile.js +65 -0
- package/dist/storage/folder-reconcile.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +9 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/indexeddb-adapter.d.ts +12 -0
- package/dist/storage/indexeddb-adapter.d.ts.map +1 -0
- package/dist/storage/indexeddb-adapter.js +190 -0
- package/dist/storage/indexeddb-adapter.js.map +1 -0
- package/dist/storage/mst.d.ts +121 -0
- package/dist/storage/mst.d.ts.map +1 -0
- package/dist/storage/mst.js +402 -0
- package/dist/storage/mst.js.map +1 -0
- package/dist/storage/storage-provider.d.ts +85 -0
- package/dist/storage/storage-provider.d.ts.map +1 -0
- package/dist/storage/storage-provider.js +220 -0
- package/dist/storage/storage-provider.js.map +1 -0
- package/dist/sync/anti-entropy.d.ts +49 -0
- package/dist/sync/anti-entropy.d.ts.map +1 -0
- package/dist/sync/anti-entropy.js +62 -0
- package/dist/sync/anti-entropy.js.map +1 -0
- package/dist/sync/index.d.ts +4 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +4 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/sync-engine.d.ts +71 -0
- package/dist/sync/sync-engine.d.ts.map +1 -0
- package/dist/sync/sync-engine.js +309 -0
- package/dist/sync/sync-engine.js.map +1 -0
- package/dist/sync/sync-messages.d.ts +75 -0
- package/dist/sync/sync-messages.d.ts.map +1 -0
- package/dist/sync/sync-messages.js +12 -0
- package/dist/sync/sync-messages.js.map +1 -0
- package/dist/types.d.ts +243 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/encoding.d.ts +63 -0
- package/dist/utils/encoding.d.ts.map +1 -0
- package/dist/utils/encoding.js +130 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/errors.d.ts +43 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +28 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/events.d.ts +19 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +27 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/hash.d.ts +23 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +49 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/validation/capability-gate.d.ts +50 -0
- package/dist/validation/capability-gate.d.ts.map +1 -0
- package/dist/validation/capability-gate.js +71 -0
- package/dist/validation/capability-gate.js.map +1 -0
- package/dist/validation/crypto-gate.d.ts +16 -0
- package/dist/validation/crypto-gate.d.ts.map +1 -0
- package/dist/validation/crypto-gate.js +37 -0
- package/dist/validation/crypto-gate.js.map +1 -0
- package/dist/validation/index.d.ts +6 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +6 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/stateful-gate.d.ts +15 -0
- package/dist/validation/stateful-gate.d.ts.map +1 -0
- package/dist/validation/stateful-gate.js +50 -0
- package/dist/validation/stateful-gate.js.map +1 -0
- package/dist/validation/structural-gate.d.ts +18 -0
- package/dist/validation/structural-gate.d.ts.map +1 -0
- package/dist/validation/structural-gate.js +54 -0
- package/dist/validation/structural-gate.js.map +1 -0
- package/dist/validation/validation-engine.d.ts +28 -0
- package/dist/validation/validation-engine.d.ts.map +1 -0
- package/dist/validation/validation-engine.js +38 -0
- package/dist/validation/validation-engine.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { rolePresets } from '../space/presets.js';
|
|
2
|
+
import { app, appScreen, checkApp, proposeApp, reviewApp } from '../schemas/apps.js';
|
|
3
|
+
import { SCREEN_GUIDE } from '../schemas/screens.js';
|
|
4
|
+
import { describeCollection } from '../records/describe.js';
|
|
5
|
+
const space = { type: 'string', description: 'Space id, from spaces_list' };
|
|
6
|
+
const key = { type: 'string', description: 'Record key — stays the same when the record is edited' };
|
|
7
|
+
const str = (input, key) => input[key];
|
|
8
|
+
const links = {
|
|
9
|
+
type: 'array',
|
|
10
|
+
description: 'What this record points at: [{ "rel": "about", "to": "<record key>" }]. Roles come from the collection\'s declared links.',
|
|
11
|
+
items: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: { rel: { type: 'string' }, to: { type: 'string' } },
|
|
14
|
+
required: ['rel', 'to'],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const linksOf = (input) => (Array.isArray(input.links) ? { links: input.links } : {});
|
|
18
|
+
export const NODE_ACTIONS = Object.freeze([
|
|
19
|
+
{
|
|
20
|
+
name: 'node_info',
|
|
21
|
+
description: 'Who this node acts for: its identity (DID) and the session key signing for it.',
|
|
22
|
+
input: { type: 'object', properties: {} },
|
|
23
|
+
readOnly: true,
|
|
24
|
+
run: async (node) => ({ did: node.did, sessionDid: node.sessionDid }),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'spaces_list',
|
|
28
|
+
description: 'List the spaces this node holds.',
|
|
29
|
+
input: { type: 'object', properties: {} },
|
|
30
|
+
readOnly: true,
|
|
31
|
+
run: (node) => node.spaces.list(),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'spaces_create',
|
|
35
|
+
description: 'Create a space. "private" encrypts every record; "public" signs them in the clear. Roles decide who may ' +
|
|
36
|
+
'write: "solo" (the default) is you alone, and invites only let others read; "team" gives everyone invited ' +
|
|
37
|
+
'the Editor role; "community" has Admin, Moderator and Member.',
|
|
38
|
+
input: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
name: { type: 'string' },
|
|
42
|
+
visibility: { type: 'string', enum: ['private', 'public'] },
|
|
43
|
+
roles: { type: 'string', enum: ['solo', 'team', 'community'], description: 'The roles it starts with' },
|
|
44
|
+
},
|
|
45
|
+
required: ['name', 'visibility'],
|
|
46
|
+
},
|
|
47
|
+
readOnly: false,
|
|
48
|
+
run: (node, input) => node.spaces.create({
|
|
49
|
+
name: str(input, 'name'),
|
|
50
|
+
visibility: input.visibility,
|
|
51
|
+
...rolePresets[input.roles === 'team' || input.roles === 'community' ? input.roles : 'solo'],
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'spaces_invite',
|
|
56
|
+
description: 'Create an invite someone else can use to join a space. For a private space the invite contains ' +
|
|
57
|
+
'the space key: anyone holding it can read everything. Unless viewOnly is set, it also gives them a role — ' +
|
|
58
|
+
'the one named, or the lowest below yours. Only share it with the intended person.',
|
|
59
|
+
input: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
space,
|
|
63
|
+
role: { type: 'string', description: 'The role they will hold — see spaces_access' },
|
|
64
|
+
viewOnly: { type: 'boolean', description: 'They can read the space but not change it' },
|
|
65
|
+
},
|
|
66
|
+
required: ['space'],
|
|
67
|
+
},
|
|
68
|
+
readOnly: false,
|
|
69
|
+
sensitive: true,
|
|
70
|
+
run: async (node, input) => ({
|
|
71
|
+
invite: await node.spaces.invite(str(input, 'space'), input.viewOnly === true ? { write: false } : typeof input.role === 'string' ? { role: input.role } : {}),
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'spaces_preview_invite',
|
|
76
|
+
description: 'Describe what an invite offers without joining.',
|
|
77
|
+
input: { type: 'object', properties: { invite: { type: 'string' } }, required: ['invite'] },
|
|
78
|
+
readOnly: true,
|
|
79
|
+
run: async (node, input) => node.spaces.preview(str(input, 'invite')),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'spaces_join',
|
|
83
|
+
description: 'Join a space from an invite or an invite link, storing it (and its key, if private) on this node.',
|
|
84
|
+
input: { type: 'object', properties: { invite: { type: 'string' } }, required: ['invite'] },
|
|
85
|
+
readOnly: false,
|
|
86
|
+
destructive: true,
|
|
87
|
+
run: (node, input) => node.spaces.join(str(input, 'invite')),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'spaces_leave',
|
|
91
|
+
description: 'Forget a space on this node, with its key. Other members keep their copies.',
|
|
92
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
93
|
+
readOnly: false,
|
|
94
|
+
destructive: true,
|
|
95
|
+
run: async (node, input) => {
|
|
96
|
+
await node.spaces.leave(str(input, 'space'));
|
|
97
|
+
return { left: str(input, 'space') };
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'spaces_access',
|
|
102
|
+
description: 'Who holds what in a space: its roles (highest rank first, each with its permissions), its members by identity ' +
|
|
103
|
+
'(did) and role, its invites, and your own role. You may change people and roles ranked below you.',
|
|
104
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
105
|
+
readOnly: true,
|
|
106
|
+
run: (node, input) => node.spaces.access(str(input, 'space')),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'spaces_set_member',
|
|
110
|
+
description: 'Give someone a role in a space, change it, or take it away (role ""). You may change people ranked below you, ' +
|
|
111
|
+
'give roles up to your own rank, and always remove yourself. Records they wrote that this node has seen stay.',
|
|
112
|
+
input: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
space,
|
|
116
|
+
did: { type: 'string', description: 'Their identity' },
|
|
117
|
+
role: { type: 'string', description: 'The role name, or "" to take their role away' },
|
|
118
|
+
},
|
|
119
|
+
required: ['space', 'did', 'role'],
|
|
120
|
+
},
|
|
121
|
+
readOnly: false,
|
|
122
|
+
destructive: true,
|
|
123
|
+
run: async (node, input) => {
|
|
124
|
+
await node.spaces.setMember(str(input, 'space'), str(input, 'did'), typeof input.role === 'string' && input.role !== '' ? input.role : null);
|
|
125
|
+
return node.spaces.access(str(input, 'space'));
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'spaces_close_invite',
|
|
130
|
+
description: 'Close an invite, by its key from spaces_access. Whoever joined with it before stays.',
|
|
131
|
+
input: { type: 'object', properties: { space, key: { type: 'string' } }, required: ['space', 'key'] },
|
|
132
|
+
readOnly: false,
|
|
133
|
+
destructive: true,
|
|
134
|
+
run: async (node, input) => {
|
|
135
|
+
await node.spaces.closeInvite(str(input, 'space'), str(input, 'key'));
|
|
136
|
+
return node.spaces.access(str(input, 'space'));
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'spaces_status',
|
|
141
|
+
description: 'Connection state, connected peers and data fingerprint for a space.',
|
|
142
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
143
|
+
readOnly: true,
|
|
144
|
+
run: (node, input) => node.spaces.status(str(input, 'space')),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'spaces_profiles',
|
|
148
|
+
description: 'Who is who in a space: the name each person gave, by their identity (did). A record names its author by ' +
|
|
149
|
+
'did in "root" and "createdBy" — look the name up here. Only each person can set their own.',
|
|
150
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
151
|
+
readOnly: true,
|
|
152
|
+
peerContent: true,
|
|
153
|
+
run: (node, input) => node.spaces.profiles(str(input, 'space')),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'collections_list',
|
|
157
|
+
description: 'What a space holds and how it connects: each collection with its title, description, JSON Schema, declared ' +
|
|
158
|
+
'link roles and record count. Read this before writing, to match the shapes and links others use. Common ' +
|
|
159
|
+
'shapes — std.reaction, std.comment, std.tag, std.attachment, std.reference, std.message, std.task, std.column, std.poll, std.vote — appear only once a space defines them.',
|
|
160
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
161
|
+
readOnly: true,
|
|
162
|
+
peerContent: true,
|
|
163
|
+
run: (node, input) => node.collections.list(str(input, 'space')),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'collections_define',
|
|
167
|
+
description: 'Define a collection in a space, so every app and person in it knows its shape. The schema is JSON Schema ' +
|
|
168
|
+
'using only: type, properties, required, items, enum, minimum, maximum, minLength, maxLength, minItems, maxItems, ' +
|
|
169
|
+
'additionalProperties (boolean), title, description. For choices with labels use ' +
|
|
170
|
+
'oneOf: [{ "const": "low", "title": "Low" }, …]. When a value picks from a list in a linked record — a vote\'s choice ' +
|
|
171
|
+
'from its poll\'s options — add "x-choicesFrom": { "rel": "about", "field": "options" } to the field (a number is a ' +
|
|
172
|
+
'position in that list; text is the option itself), so apps can show labels and tallies. Name it reverse-DNS, e.g. "app.trip.expense". ' +
|
|
173
|
+
'Redefining bumps the version; only whoever first defined it, or someone who can manage the space, may. Records are then checked against it when written. ' +
|
|
174
|
+
'An agent acting for someone can\'t define collections: every peer ignores it. Propose an app with apps_propose instead.',
|
|
175
|
+
input: {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
space,
|
|
179
|
+
name: { type: 'string' },
|
|
180
|
+
title: { type: 'string' },
|
|
181
|
+
description: { type: 'string' },
|
|
182
|
+
schema: { type: 'object' },
|
|
183
|
+
version: { type: 'integer' },
|
|
184
|
+
history: { type: 'string', enum: ['latest', 'all'], description: 'Keep every version of its records ("all"), or only the current one' },
|
|
185
|
+
links: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
description: 'Link roles its records may carry: { "about": { "to": ["app.poll"], "cardinality": "one" } }. "to" is "*" for any collection.',
|
|
188
|
+
},
|
|
189
|
+
permissions: {
|
|
190
|
+
type: 'array',
|
|
191
|
+
items: { type: 'string' },
|
|
192
|
+
description: 'Permissions its rules may name, like ["moderate"]. A space\'s roles hold them as "<collection>/<permission>".',
|
|
193
|
+
},
|
|
194
|
+
rules: {
|
|
195
|
+
type: 'object',
|
|
196
|
+
description: 'What its records allow, enforced by every peer: { "create": "member", "edit": "creator", "delete": ["creator", "can:moderate"], ' +
|
|
197
|
+
'"onePer": ["@author", "link:about"], "fixed": ["options"] }. Who is "member" (anyone holding a role here, the default), ' +
|
|
198
|
+
'"creator" (whoever created that record) or "can:<permission>" (anyone whose role holds one of the permissions declared ' +
|
|
199
|
+
'above). onePer makes at most one record per author + linked record (+ body field): writing again changes it. fixed fields ' +
|
|
200
|
+
'keep their first value.',
|
|
201
|
+
},
|
|
202
|
+
screen: { type: 'string', description: 'Optional: its own screen, one HTML document — read apps_screen_guide first' },
|
|
203
|
+
},
|
|
204
|
+
required: ['space', 'name', 'schema'],
|
|
205
|
+
},
|
|
206
|
+
readOnly: false,
|
|
207
|
+
destructive: true,
|
|
208
|
+
run: async (node, input) => {
|
|
209
|
+
const defined = await node.collections.define(str(input, 'space'), {
|
|
210
|
+
name: str(input, 'name'),
|
|
211
|
+
schema: input.schema,
|
|
212
|
+
...(typeof input.title === 'string' ? { title: input.title } : {}),
|
|
213
|
+
...(typeof input.description === 'string' ? { description: input.description } : {}),
|
|
214
|
+
...(typeof input.version === 'number' ? { version: input.version } : {}),
|
|
215
|
+
...(input.history === 'all' || input.history === 'latest' ? { history: input.history } : {}),
|
|
216
|
+
...(typeof input.links === 'object' && input.links !== null ? { links: input.links } : {}),
|
|
217
|
+
...(Array.isArray(input.permissions) ? { permissions: input.permissions.filter((p) => typeof p === 'string') } : {}),
|
|
218
|
+
...(typeof input.rules === 'object' && input.rules !== null ? { rules: input.rules } : {}),
|
|
219
|
+
...(typeof input.screen === 'string' ? { screen: input.screen } : {}),
|
|
220
|
+
});
|
|
221
|
+
// What it allows, from its rules — worth repeating to the person as it is.
|
|
222
|
+
return { ...defined, summary: describeCollection({ ...defined, schema: defined.schema ?? undefined }) };
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: 'apps_list',
|
|
227
|
+
description: 'The apps proposed in a space: each with its title, who proposed it (viaAgent when an agent did), and for every collection ' +
|
|
228
|
+
'it needs whether it is new, already there, or would change one — with what it allows, worked out from its rules. ' +
|
|
229
|
+
'"added" is true once a person has added it.',
|
|
230
|
+
input: { type: 'object', properties: { space }, required: ['space'] },
|
|
231
|
+
readOnly: true,
|
|
232
|
+
peerContent: true,
|
|
233
|
+
run: async (node, input) => {
|
|
234
|
+
const spaceId = str(input, 'space');
|
|
235
|
+
const collections = await node.collections.list(spaceId);
|
|
236
|
+
const found = await node.records.list(spaceId, { collection: app.name });
|
|
237
|
+
return found.map((record) => {
|
|
238
|
+
const review = record.body ? reviewApp(record.body, collections) : null;
|
|
239
|
+
return {
|
|
240
|
+
key: record.key,
|
|
241
|
+
title: record.body?.title ?? null,
|
|
242
|
+
description: record.body?.description ?? null,
|
|
243
|
+
proposedBy: record.createdBy,
|
|
244
|
+
...(record.viaAgent ? { viaAgent: true } : {}),
|
|
245
|
+
...(record.body && appScreen(record.body) ? { screen: appScreen(record.body).collection } : {}),
|
|
246
|
+
added: review?.added ?? false,
|
|
247
|
+
problem: review?.problem ?? (record.body ? null : 'It could not be read'),
|
|
248
|
+
needs: review?.needs.map(({ definition, status, summary, changes }) => ({ name: definition.name, status, summary, changes })) ?? [],
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: 'apps_screen_guide',
|
|
255
|
+
description: 'How to write a screen — an app\'s own HTML UI, kept on its main collection\'s definition as "screen" and run sealed ' +
|
|
256
|
+
'in the app: what it can use (window.weave: list, put, update, remove, onChange, me) and what it can\'t (network, storage).',
|
|
257
|
+
input: { type: 'object', properties: {} },
|
|
258
|
+
readOnly: true,
|
|
259
|
+
run: async () => SCREEN_GUIDE,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'apps_propose',
|
|
263
|
+
description: 'Propose an app in a space: a new way for its people to work together — a carpool, a sign-up sheet, a decision log. ' +
|
|
264
|
+
'Give it a title, a line on what it is for, and the collections it needs, each exactly as collections_define takes it ' +
|
|
265
|
+
'(name, title, description, schema, links, permissions, rules — no version). Nothing is defined yet: everyone in the ' +
|
|
266
|
+
'space sees the proposal, with what it allows worked out from its rules, and a person who may define collections adds it. ' +
|
|
267
|
+
'Read collections_list first and reuse what the space already has (std.poll, std.task…) rather than inventing a twin. ' +
|
|
268
|
+
'For anything plain lists and forms can\'t show — a game board, a calendar, a whiteboard — give the main collection ' +
|
|
269
|
+
'a "screen": its own HTML UI (one document, inline scripts and styles, no network). Inside it, use exactly: ' +
|
|
270
|
+
'weave.me ({ did, name }), await weave.list("<collection>", { where: { "link:<rel>": key } }), ' +
|
|
271
|
+
'await weave.put("<collection>", body, { links: [{ rel, to: key }] }), await weave.update(key, body), await weave.remove(key), ' +
|
|
272
|
+
'weave.onChange(redraw). Records are { key, body, links, createdBy, mine }. Read apps_screen_guide for the rest. ' +
|
|
273
|
+
'Returns what each collection will allow; tell the person that, not your own description.',
|
|
274
|
+
input: {
|
|
275
|
+
type: 'object',
|
|
276
|
+
properties: {
|
|
277
|
+
space,
|
|
278
|
+
title: { type: 'string', description: 'What people will call it, e.g. "Carpool"' },
|
|
279
|
+
description: { type: 'string', description: 'What it is for, in a sentence' },
|
|
280
|
+
needs: {
|
|
281
|
+
type: 'array',
|
|
282
|
+
description: 'Collection definitions, as collections_define takes them — without version',
|
|
283
|
+
items: { type: 'object' },
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
required: ['space', 'title', 'needs'],
|
|
287
|
+
},
|
|
288
|
+
readOnly: false,
|
|
289
|
+
run: async (node, input) => {
|
|
290
|
+
const spaceId = str(input, 'space');
|
|
291
|
+
const body = {
|
|
292
|
+
title: str(input, 'title'),
|
|
293
|
+
...(typeof input.description === 'string' ? { description: input.description } : {}),
|
|
294
|
+
needs: input.needs,
|
|
295
|
+
};
|
|
296
|
+
const problem = checkApp(body);
|
|
297
|
+
if (problem)
|
|
298
|
+
throw new Error(problem);
|
|
299
|
+
const record = await proposeApp(node, spaceId, body);
|
|
300
|
+
const review = reviewApp(body, await node.collections.list(spaceId));
|
|
301
|
+
return {
|
|
302
|
+
key: record.key,
|
|
303
|
+
proposed: true,
|
|
304
|
+
added: false,
|
|
305
|
+
next: 'A person in the space who may define collections adds it from the Apps tab.',
|
|
306
|
+
needs: review.needs.map(({ definition, status, summary, changes }) => ({ name: definition.name, status, summary, changes })),
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'collections_delete',
|
|
312
|
+
description: 'Remove a collection\'s definition from a space. Refused while it still has records — delete those first. ' +
|
|
313
|
+
'Only whoever first defined it, or someone who can manage the space, may.',
|
|
314
|
+
input: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
properties: { space, name: { type: 'string' } },
|
|
317
|
+
required: ['space', 'name'],
|
|
318
|
+
},
|
|
319
|
+
readOnly: false,
|
|
320
|
+
destructive: true,
|
|
321
|
+
run: (node, input) => node.collections.delete(str(input, 'space'), str(input, 'name')),
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: 'records_list',
|
|
325
|
+
description: 'List records in a space, oldest first unless newestFirst is set.',
|
|
326
|
+
input: {
|
|
327
|
+
type: 'object',
|
|
328
|
+
properties: {
|
|
329
|
+
space,
|
|
330
|
+
collection: { type: 'string', description: 'Only this collection, e.g. "app.todo.item"' },
|
|
331
|
+
limit: { type: 'integer' },
|
|
332
|
+
newestFirst: { type: 'boolean' },
|
|
333
|
+
},
|
|
334
|
+
required: ['space'],
|
|
335
|
+
},
|
|
336
|
+
readOnly: true,
|
|
337
|
+
peerContent: true,
|
|
338
|
+
run: (node, input) => node.records.list(str(input, 'space'), {
|
|
339
|
+
...(typeof input.collection === 'string' ? { collection: input.collection } : {}),
|
|
340
|
+
...(typeof input.limit === 'number' ? { limit: input.limit } : {}),
|
|
341
|
+
...(input.newestFirst === true ? { newestFirst: true } : {}),
|
|
342
|
+
}),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: 'records_query',
|
|
346
|
+
description: 'Find records: filter, sort, page, and pull in what links to them. ' +
|
|
347
|
+
'where: { done: false, "@author": "did:…", amount: { "$gt": 10 } } — bare names are body fields (dotted for nested), ' +
|
|
348
|
+
'"@key", "@author", "@root", "@createdAt", "@updatedAt", "@seq" are about the record; ' +
|
|
349
|
+
'operators $eq $ne $gt $gte $lt $lte $in $nin $exists $contains, combined with $and $or $not. ' +
|
|
350
|
+
'include: { reactions: { rel: "about", from: "std.reaction", count: true } } — records linking to each result ' +
|
|
351
|
+
'(direction "out" for what each result links to), nested up to 3 deep. ' +
|
|
352
|
+
'sort: { "@createdAt": "desc" }. Pass the returned cursor back to get the next page.',
|
|
353
|
+
input: {
|
|
354
|
+
type: 'object',
|
|
355
|
+
properties: {
|
|
356
|
+
space,
|
|
357
|
+
collection: { type: 'string', description: 'The collection to query, e.g. "app.todo.item"' },
|
|
358
|
+
where: { type: 'object', description: 'Filter' },
|
|
359
|
+
include: { type: 'object', description: 'Linked records to pull in, by name' },
|
|
360
|
+
sort: { type: 'object', description: '{ field: "asc" | "desc" }; ties break on the key' },
|
|
361
|
+
limit: { type: 'integer' },
|
|
362
|
+
cursor: { type: 'string', description: 'From the previous page' },
|
|
363
|
+
},
|
|
364
|
+
required: ['space', 'collection'],
|
|
365
|
+
},
|
|
366
|
+
readOnly: true,
|
|
367
|
+
peerContent: true,
|
|
368
|
+
run: (node, input) => {
|
|
369
|
+
const { space: spaceId, ...query } = input;
|
|
370
|
+
return node.records.query(spaceId, query);
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: 'records_get',
|
|
375
|
+
description: 'Read one record.',
|
|
376
|
+
input: { type: 'object', properties: { space, key }, required: ['space', 'key'] },
|
|
377
|
+
readOnly: true,
|
|
378
|
+
peerContent: true,
|
|
379
|
+
run: (node, input) => node.records.get(str(input, 'space'), str(input, 'key')),
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: 'records_history',
|
|
383
|
+
description: 'The versions of a record kept here, newest first. Collections defined with history "all" keep every version, ' +
|
|
384
|
+
'each linked to the one before by hash; otherwise only the current and first versions are kept.',
|
|
385
|
+
input: { type: 'object', properties: { space, key }, required: ['space', 'key'] },
|
|
386
|
+
readOnly: true,
|
|
387
|
+
peerContent: true,
|
|
388
|
+
run: (node, input) => node.records.history(str(input, 'space'), str(input, 'key')),
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: 'records_put',
|
|
392
|
+
description: 'Create a record in a collection. Collections are named like "app.todo.item"; the body is any JSON object. ' +
|
|
393
|
+
'It gets a random key unless one is given. It is signed by this node and synced to the space.',
|
|
394
|
+
input: {
|
|
395
|
+
type: 'object',
|
|
396
|
+
properties: {
|
|
397
|
+
space,
|
|
398
|
+
collection: { type: 'string' },
|
|
399
|
+
body: { type: 'object' },
|
|
400
|
+
key: { type: 'string', description: 'Optional chosen key: a–z, 0–9 and : . _ -' },
|
|
401
|
+
links,
|
|
402
|
+
},
|
|
403
|
+
required: ['space', 'collection', 'body'],
|
|
404
|
+
},
|
|
405
|
+
readOnly: false,
|
|
406
|
+
run: (node, input) => node.records.put(str(input, 'space'), str(input, 'collection'), input.body, {
|
|
407
|
+
...(typeof input.key === 'string' ? { key: input.key } : {}),
|
|
408
|
+
...linksOf(input),
|
|
409
|
+
}),
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: 'records_linked',
|
|
413
|
+
description: 'The records pointing at a record: its reactions, comments, tags, votes… Optionally only one link role ' +
|
|
414
|
+
'(e.g. "about") or one collection (e.g. "std.comment").',
|
|
415
|
+
input: {
|
|
416
|
+
type: 'object',
|
|
417
|
+
properties: { space, key, rel: { type: 'string' }, collection: { type: 'string' } },
|
|
418
|
+
required: ['space', 'key'],
|
|
419
|
+
},
|
|
420
|
+
readOnly: true,
|
|
421
|
+
peerContent: true,
|
|
422
|
+
run: (node, input) => node.records.linked(str(input, 'space'), str(input, 'key'), {
|
|
423
|
+
...(typeof input.rel === 'string' ? { rel: input.rel } : {}),
|
|
424
|
+
...(typeof input.collection === 'string' ? { collection: input.collection } : {}),
|
|
425
|
+
}),
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: 'records_can',
|
|
429
|
+
description: 'Whether you may do something before trying: "create" in a collection (target = its name), or "edit" / "delete" a record ' +
|
|
430
|
+
'(target = its key). Follows the collection\'s rules and the space\'s.',
|
|
431
|
+
input: {
|
|
432
|
+
type: 'object',
|
|
433
|
+
properties: { space, action: { type: 'string', enum: ['create', 'edit', 'delete'] }, target: { type: 'string' } },
|
|
434
|
+
required: ['space', 'action', 'target'],
|
|
435
|
+
},
|
|
436
|
+
readOnly: true,
|
|
437
|
+
run: (node, input) => node.records.can(str(input, 'space'), str(input, 'action'), str(input, 'target')),
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: 'records_update',
|
|
441
|
+
description: 'Write the next version of a record: a new body under the same key. Its links are kept unless given.',
|
|
442
|
+
input: {
|
|
443
|
+
type: 'object',
|
|
444
|
+
properties: { space, key, body: { type: 'object' }, links },
|
|
445
|
+
required: ['space', 'key', 'body'],
|
|
446
|
+
},
|
|
447
|
+
readOnly: false,
|
|
448
|
+
destructive: true,
|
|
449
|
+
run: (node, input) => node.records.update(str(input, 'space'), str(input, 'key'), input.body, linksOf(input)),
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: 'records_delete',
|
|
453
|
+
description: 'Delete a record for every member of the space. Anyone who may write in the space may delete in it.',
|
|
454
|
+
input: { type: 'object', properties: { space, key }, required: ['space', 'key'] },
|
|
455
|
+
readOnly: false,
|
|
456
|
+
destructive: true,
|
|
457
|
+
run: async (node, input) => {
|
|
458
|
+
await node.records.delete(str(input, 'space'), str(input, 'key'));
|
|
459
|
+
return { deleted: str(input, 'key') };
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
]);
|
|
463
|
+
/** Why an input does not fit an action's schema, or null when it does. */
|
|
464
|
+
export function checkActionInput(action, input) {
|
|
465
|
+
if (typeof input !== 'object' || input === null || Array.isArray(input))
|
|
466
|
+
return 'Input must be an object';
|
|
467
|
+
const record = input;
|
|
468
|
+
for (const key of action.input.required ?? []) {
|
|
469
|
+
if (record[key] === undefined)
|
|
470
|
+
return `Missing "${key}"`;
|
|
471
|
+
}
|
|
472
|
+
for (const [key, value] of Object.entries(record)) {
|
|
473
|
+
const spec = action.input.properties[key];
|
|
474
|
+
if (!spec)
|
|
475
|
+
return `Unknown field "${key}"`;
|
|
476
|
+
if (spec.enum && !spec.enum.includes(value))
|
|
477
|
+
return `"${key}" must be one of ${spec.enum.join(', ')}`;
|
|
478
|
+
const actual = Array.isArray(value) ? 'array' : value === null ? 'null' : typeof value;
|
|
479
|
+
const expected = spec.type === 'integer' ? 'number' : spec.type;
|
|
480
|
+
if (expected && actual !== expected)
|
|
481
|
+
return `"${key}" must be ${spec.type === 'object' ? 'an object' : `a ${spec.type}`}`;
|
|
482
|
+
if (spec.type === 'integer' && !Number.isInteger(value))
|
|
483
|
+
return `"${key}" must be a whole number`;
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Runs an action by name, checking its input first.
|
|
489
|
+
* @throws When the action is unknown or the input does not fit
|
|
490
|
+
*/
|
|
491
|
+
export async function runAction(node, name, input = {}) {
|
|
492
|
+
const action = NODE_ACTIONS.find((candidate) => candidate.name === name);
|
|
493
|
+
if (!action)
|
|
494
|
+
throw new Error(`Unknown action: ${name}`);
|
|
495
|
+
const problem = checkActionInput(action, input);
|
|
496
|
+
if (problem)
|
|
497
|
+
throw new Error(`${name}: ${problem}`);
|
|
498
|
+
return action.run(node, input);
|
|
499
|
+
}
|
|
500
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/node/actions.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAgC,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAuC5D,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAW,CAAC;AACrF,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uDAAuD,EAAW,CAAC;AAE9G,MAAM,GAAG,GAAG,CAAC,KAA8B,EAAE,GAAW,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAW,CAAC;AAElF,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,2HAA2H;IACxI,KAAK,EAAE;QACL,IAAI,EAAE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AC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChD,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAgC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node/carrier
|
|
3
|
+
* A node that keeps an account's spaces online without being able to read them.
|
|
4
|
+
*
|
|
5
|
+
* It runs in a browser extension, for as long as the browser does: it holds
|
|
6
|
+
* every space the account gave it a pass for (`space/pass.ts`), takes part in
|
|
7
|
+
* each space's gossip, and — when it can reach the person's pod — writes
|
|
8
|
+
* everything into it, so the pod is current even with no app open.
|
|
9
|
+
*
|
|
10
|
+
* What it holds: its own key, the key of its carry space (which holds nothing
|
|
11
|
+
* but passes), and records exactly as they travel — private bodies still
|
|
12
|
+
* encrypted. It has no seed, no space key, no write secret and no note, so it
|
|
13
|
+
* signs nothing and writes nothing. Every record it takes in passes the same
|
|
14
|
+
* gates as at any member's node.
|
|
15
|
+
*
|
|
16
|
+
* **Two copies, two peers.** Each space is kept in the carrier's own database,
|
|
17
|
+
* and — while a pod is attached — in the pod as well, as a second runtime on a
|
|
18
|
+
* local link (`network/local-transport.ts`). Sync keeps them level both ways:
|
|
19
|
+
* the pod catches up on whatever arrived while it was out of reach, and writes
|
|
20
|
+
* another site made to the folder reach the database, and from there the mesh.
|
|
21
|
+
* The pod only ever sees `spaces/<id>`: the account file and its sealed
|
|
22
|
+
* registry are never opened.
|
|
23
|
+
*/
|
|
24
|
+
import type { CryptoProvider } from '../types.js';
|
|
25
|
+
import type { StoreFactory } from './stores.js';
|
|
26
|
+
import type { ConnectionState, NodeNetworkConfig } from './types.js';
|
|
27
|
+
export interface CarrierConfig {
|
|
28
|
+
/** Its own key — who it is to peers. Never the account's. */
|
|
29
|
+
readonly key: CryptoKeyPair;
|
|
30
|
+
/** The account it carries for: only passes the account wrote count */
|
|
31
|
+
readonly account: string;
|
|
32
|
+
/** The view-only invite to its carry space */
|
|
33
|
+
readonly carry: string;
|
|
34
|
+
/** Its own copy of every carried space */
|
|
35
|
+
readonly stores: StoreFactory;
|
|
36
|
+
readonly network?: NodeNetworkConfig;
|
|
37
|
+
readonly provider?: CryptoProvider;
|
|
38
|
+
/** How often to look for writes another site made to the pod. Default 2000. */
|
|
39
|
+
readonly watchIntervalMs?: number;
|
|
40
|
+
}
|
|
41
|
+
/** A space the carrier holds, and how it is doing */
|
|
42
|
+
export interface CarriedSpace {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly visibility: 'public' | 'private';
|
|
46
|
+
/** True for the carry space itself, which holds the passes */
|
|
47
|
+
readonly carry: boolean;
|
|
48
|
+
readonly connection: ConnectionState;
|
|
49
|
+
readonly peers: number;
|
|
50
|
+
/** Whether it is being written into the pod now */
|
|
51
|
+
readonly inPod: boolean;
|
|
52
|
+
}
|
|
53
|
+
export type CarrierEvent =
|
|
54
|
+
/** The set of carried spaces changed */
|
|
55
|
+
{
|
|
56
|
+
readonly type: 'spaces';
|
|
57
|
+
}
|
|
58
|
+
/** Records arrived, or peers came and went, in a space */
|
|
59
|
+
| {
|
|
60
|
+
readonly type: 'status';
|
|
61
|
+
readonly space: string;
|
|
62
|
+
}
|
|
63
|
+
/** The account stopped using this carrier: forget everything */
|
|
64
|
+
| {
|
|
65
|
+
readonly type: 'closed';
|
|
66
|
+
};
|
|
67
|
+
export interface CarrierNode {
|
|
68
|
+
readonly did: string;
|
|
69
|
+
/** The carry space's id */
|
|
70
|
+
readonly carrySpace: string;
|
|
71
|
+
spaces(): Promise<ReadonlyArray<CarriedSpace>>;
|
|
72
|
+
/**
|
|
73
|
+
* Also keeps every carried space in a pod — stores rooted at the account's
|
|
74
|
+
* data path in it. Null stops writing there; the carrier's own copy goes on.
|
|
75
|
+
*/
|
|
76
|
+
usePod(stores: StoreFactory | null): Promise<void>;
|
|
77
|
+
subscribe(listener: (event: CarrierEvent) => void): () => void;
|
|
78
|
+
close(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Starts a carrier.
|
|
82
|
+
* @throws When the carry invite is not a readable invite to a private space
|
|
83
|
+
*/
|
|
84
|
+
export declare function createCarrierNode(config: CarrierConfig): Promise<CarrierNode>;
|
|
85
|
+
//# sourceMappingURL=carrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.d.ts","sourceRoot":"","sources":["../../src/node/carrier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAa,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;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