@minca/core 0.1.9 → 0.1.11

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.
Files changed (195) hide show
  1. package/README.md +2 -2
  2. package/dist/identity/abilities.d.ts +3 -3
  3. package/dist/identity/abilities.d.ts.map +1 -1
  4. package/dist/identity/abilities.js +9 -11
  5. package/dist/identity/abilities.js.map +1 -1
  6. package/dist/identity/contact-key.d.ts +15 -15
  7. package/dist/identity/contact-key.d.ts.map +1 -1
  8. package/dist/identity/contact-key.js +21 -28
  9. package/dist/identity/contact-key.js.map +1 -1
  10. package/dist/identity/root-signer.d.ts +0 -5
  11. package/dist/identity/root-signer.d.ts.map +1 -1
  12. package/dist/identity/root-signer.js +0 -1
  13. package/dist/identity/root-signer.js.map +1 -1
  14. package/dist/inbox/inbox.d.ts +140 -0
  15. package/dist/inbox/inbox.d.ts.map +1 -0
  16. package/dist/inbox/inbox.js +212 -0
  17. package/dist/inbox/inbox.js.map +1 -0
  18. package/dist/inbox/index.d.ts +9 -0
  19. package/dist/inbox/index.d.ts.map +1 -0
  20. package/dist/inbox/index.js +7 -0
  21. package/dist/inbox/index.js.map +1 -0
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/network/mailbox.d.ts +4 -4
  27. package/dist/network/mailbox.d.ts.map +1 -1
  28. package/dist/network/mailbox.js +5 -5
  29. package/dist/network/mailbox.js.map +1 -1
  30. package/dist/node/actions.d.ts.map +1 -1
  31. package/dist/node/actions.js +28 -18
  32. package/dist/node/actions.js.map +1 -1
  33. package/dist/node/api.d.ts +11 -10
  34. package/dist/node/api.d.ts.map +1 -1
  35. package/dist/node/api.js +11 -10
  36. package/dist/node/api.js.map +1 -1
  37. package/dist/node/carrier.d.ts +11 -5
  38. package/dist/node/carrier.d.ts.map +1 -1
  39. package/dist/node/carrier.js +42 -1
  40. package/dist/node/carrier.js.map +1 -1
  41. package/dist/node/copy.d.ts +1 -1
  42. package/dist/node/copy.d.ts.map +1 -1
  43. package/dist/node/copy.js +10 -4
  44. package/dist/node/copy.js.map +1 -1
  45. package/dist/node/host.d.ts +2 -0
  46. package/dist/node/host.d.ts.map +1 -1
  47. package/dist/node/host.js +2 -0
  48. package/dist/node/host.js.map +1 -1
  49. package/dist/node/index.d.ts +1 -1
  50. package/dist/node/index.d.ts.map +1 -1
  51. package/dist/node/node.d.ts.map +1 -1
  52. package/dist/node/node.js +720 -542
  53. package/dist/node/node.js.map +1 -1
  54. package/dist/node/remote.d.ts +6 -5
  55. package/dist/node/remote.d.ts.map +1 -1
  56. package/dist/node/remote.js +140 -195
  57. package/dist/node/remote.js.map +1 -1
  58. package/dist/node/space-runtime.d.ts +2 -1
  59. package/dist/node/space-runtime.d.ts.map +1 -1
  60. package/dist/node/space-runtime.js +71 -84
  61. package/dist/node/space-runtime.js.map +1 -1
  62. package/dist/node/types.d.ts +84 -47
  63. package/dist/node/types.d.ts.map +1 -1
  64. package/dist/node/worker.d.ts +1 -1
  65. package/dist/node/worker.d.ts.map +1 -1
  66. package/dist/node/worker.js +10 -6
  67. package/dist/node/worker.js.map +1 -1
  68. package/dist/react/use-invite-link.d.ts +1 -1
  69. package/dist/react/use-invite-link.d.ts.map +1 -1
  70. package/dist/react/use-invite-link.js +18 -11
  71. package/dist/react/use-invite-link.js.map +1 -1
  72. package/dist/records/loose.d.ts +52 -0
  73. package/dist/records/loose.d.ts.map +1 -0
  74. package/dist/records/loose.js +86 -0
  75. package/dist/records/loose.js.map +1 -0
  76. package/dist/schema/version.d.ts +2 -0
  77. package/dist/schema/version.d.ts.map +1 -1
  78. package/dist/schema/version.js +2 -1
  79. package/dist/schema/version.js.map +1 -1
  80. package/dist/schemas/choosing.d.ts +19 -0
  81. package/dist/schemas/choosing.d.ts.map +1 -0
  82. package/dist/schemas/choosing.js +69 -0
  83. package/dist/schemas/choosing.js.map +1 -0
  84. package/dist/schemas/contacts.d.ts +34 -87
  85. package/dist/schemas/contacts.d.ts.map +1 -1
  86. package/dist/schemas/contacts.js +32 -76
  87. package/dist/schemas/contacts.js.map +1 -1
  88. package/dist/schemas/index.d.ts +2 -2
  89. package/dist/schemas/index.d.ts.map +1 -1
  90. package/dist/schemas/index.js +1 -1
  91. package/dist/schemas/index.js.map +1 -1
  92. package/dist/schemas/library/annotations.d.ts +17 -285
  93. package/dist/schemas/library/annotations.d.ts.map +1 -1
  94. package/dist/schemas/library/annotations.js +9 -65
  95. package/dist/schemas/library/annotations.js.map +1 -1
  96. package/dist/schemas/library/community.d.ts +9 -17
  97. package/dist/schemas/library/community.d.ts.map +1 -1
  98. package/dist/schemas/library/community.js +5 -5
  99. package/dist/schemas/library/community.js.map +1 -1
  100. package/dist/schemas/library/life.d.ts +3 -3
  101. package/dist/schemas/library/life.d.ts.map +1 -1
  102. package/dist/schemas/library/life.js +2 -2
  103. package/dist/schemas/library/life.js.map +1 -1
  104. package/dist/schemas/library/media.d.ts +148 -541
  105. package/dist/schemas/library/media.d.ts.map +1 -1
  106. package/dist/schemas/library/media.js +28 -64
  107. package/dist/schemas/library/media.js.map +1 -1
  108. package/dist/schemas/library/money.d.ts +8 -8
  109. package/dist/schemas/library/money.d.ts.map +1 -1
  110. package/dist/schemas/library/money.js +4 -4
  111. package/dist/schemas/library/money.js.map +1 -1
  112. package/dist/schemas/library/planning.d.ts +23 -87
  113. package/dist/schemas/library/planning.d.ts.map +1 -1
  114. package/dist/schemas/library/planning.js +10 -26
  115. package/dist/schemas/library/planning.js.map +1 -1
  116. package/dist/schemas/library/publishing.d.ts +14 -14
  117. package/dist/schemas/library/publishing.d.ts.map +1 -1
  118. package/dist/schemas/library/publishing.js +7 -7
  119. package/dist/schemas/library/publishing.js.map +1 -1
  120. package/dist/schemas/library/social.d.ts +2 -2
  121. package/dist/schemas/library/social.d.ts.map +1 -1
  122. package/dist/schemas/library/social.js +1 -1
  123. package/dist/schemas/library/social.js.map +1 -1
  124. package/dist/schemas/standard.d.ts +1 -1
  125. package/dist/schemas/standard.d.ts.map +1 -1
  126. package/dist/schemas/standard.js +3 -3
  127. package/dist/schemas/standard.js.map +1 -1
  128. package/dist/session/auth.d.ts +20 -0
  129. package/dist/session/auth.d.ts.map +1 -1
  130. package/dist/session/auth.js +81 -64
  131. package/dist/session/auth.js.map +1 -1
  132. package/dist/session/connect.d.ts +50 -8
  133. package/dist/session/connect.d.ts.map +1 -1
  134. package/dist/session/connect.js +91 -27
  135. package/dist/session/connect.js.map +1 -1
  136. package/dist/session/connection.d.ts +39 -6
  137. package/dist/session/connection.d.ts.map +1 -1
  138. package/dist/session/connection.js +107 -38
  139. package/dist/session/connection.js.map +1 -1
  140. package/dist/session/hosting.d.ts +15 -0
  141. package/dist/session/hosting.d.ts.map +1 -1
  142. package/dist/session/hosting.js +55 -4
  143. package/dist/session/hosting.js.map +1 -1
  144. package/dist/session/index.d.ts +5 -5
  145. package/dist/session/index.d.ts.map +1 -1
  146. package/dist/session/index.js +2 -2
  147. package/dist/session/index.js.map +1 -1
  148. package/dist/space/account-registry.d.ts +36 -4
  149. package/dist/space/account-registry.d.ts.map +1 -1
  150. package/dist/space/account-registry.js +30 -3
  151. package/dist/space/account-registry.js.map +1 -1
  152. package/dist/space/invitation.d.ts +61 -0
  153. package/dist/space/invitation.d.ts.map +1 -0
  154. package/dist/space/invitation.js +84 -0
  155. package/dist/space/invitation.js.map +1 -0
  156. package/dist/space/invite-link.d.ts +64 -0
  157. package/dist/space/invite-link.d.ts.map +1 -0
  158. package/dist/space/invite-link.js +212 -0
  159. package/dist/space/invite-link.js.map +1 -0
  160. package/dist/space/roles.d.ts +59 -140
  161. package/dist/space/roles.d.ts.map +1 -1
  162. package/dist/space/roles.js +328 -427
  163. package/dist/space/roles.js.map +1 -1
  164. package/dist/space/space-manager.d.ts +21 -6
  165. package/dist/space/space-manager.d.ts.map +1 -1
  166. package/dist/space/space-manager.js +40 -23
  167. package/dist/space/space-manager.js.map +1 -1
  168. package/dist/types.d.ts +2 -0
  169. package/dist/types.d.ts.map +1 -1
  170. package/dist/types.js.map +1 -1
  171. package/docs/README.md +2 -2
  172. package/docs/actions.md +40 -40
  173. package/docs/agents.md +2 -2
  174. package/docs/automations.md +2 -2
  175. package/docs/blueprints-and-guides.md +61 -1
  176. package/docs/bots.md +1 -1
  177. package/docs/building-an-app.md +2 -2
  178. package/docs/contacts.md +48 -69
  179. package/docs/inbox.md +145 -0
  180. package/docs/node.md +135 -76
  181. package/docs/query-format.md +1 -1
  182. package/docs/sign-in.md +16 -9
  183. package/docs/spaces.md +33 -5
  184. package/docs/standard-library.md +111 -86
  185. package/docs/storage.md +1 -1
  186. package/package.json +5 -5
  187. package/dist/doors/doors.d.ts +0 -140
  188. package/dist/doors/doors.d.ts.map +0 -1
  189. package/dist/doors/doors.js +0 -226
  190. package/dist/doors/doors.js.map +0 -1
  191. package/dist/doors/index.d.ts +0 -9
  192. package/dist/doors/index.d.ts.map +0 -1
  193. package/dist/doors/index.js +0 -7
  194. package/dist/doors/index.js.map +0 -1
  195. package/docs/doors.md +0 -151
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Loose versions (spec 02 §3.5): signed versions that belong to no space.
3
+ *
4
+ * A loose version is a version of 02 §3 with no `space`, `log` or `seen`, at
5
+ * `seq` 0. It is never stored in a space or synced: it is handed over, in a
6
+ * link, a QR code, a mailbox or sealed inside a record. Its collection says
7
+ * what it is (`sys.invitation`, `sys.inbox`, `sys.knock`), so a new kind is a
8
+ * new collection name and is checked the same way.
9
+ *
10
+ * It is checked as any version is, its shape, id and signature, and its
11
+ * `proof` against its `createdAt`. What a valid one counts as is its
12
+ * collection's business; no space's history or rules are consulted.
13
+ */
14
+ import type { CryptoProvider, Version } from '../types.js';
15
+ import { type Delegation } from '../identity/ucan.js';
16
+ /** Who signs a loose version: a key, and the note that lets it act for its account (none when the account signs) */
17
+ export interface LooseSigner {
18
+ readonly did: string;
19
+ readonly key: CryptoKey;
20
+ readonly proof?: Delegation;
21
+ }
22
+ /** A loose version that checked out */
23
+ export interface CheckedLoose<T = unknown> {
24
+ readonly version: Version<T> & {
25
+ readonly body: T;
26
+ };
27
+ /** The account it speaks for: the note's issuer, or the author when there is none */
28
+ readonly root: string;
29
+ /** The note, when one was carried */
30
+ readonly note: Delegation | null;
31
+ /** `createdAt`, ms */
32
+ readonly at: number;
33
+ }
34
+ /** Signs a loose version */
35
+ export declare function signLoose<T>(signer: LooseSigner, collection: string, body: T, provider: CryptoProvider, options?: {
36
+ readonly to?: string;
37
+ readonly createdAt?: string;
38
+ }): Promise<Version<T> & {
39
+ readonly body: T;
40
+ }>;
41
+ /**
42
+ * Checks a loose version through: its shape, id, body and signature, and the
43
+ * note it carries, valid at its `createdAt` and made out to its author.
44
+ * @param collection The collection it must be in
45
+ * @returns It, with the account it speaks for, or null when it is anything less
46
+ */
47
+ export declare function checkLoose(value: unknown, collection: string, provider: CryptoProvider): Promise<CheckedLoose | null>;
48
+ /** A loose version as text: base64url of its canonical JSON */
49
+ export declare function encodeLoose(version: Version): string;
50
+ /** Reads what `encodeLoose` wrote, or null when it isn't JSON in base64url */
51
+ export declare function decodeLoose(text: string): unknown;
52
+ //# sourceMappingURL=loose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loose.d.ts","sourceRoot":"","sources":["../../src/records/loose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3D,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI3F,oHAAoH;AACpH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;CAC7B;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;IACpD,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,sBAAsB;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAKD,4BAA4B;AAC5B,wBAAsB,SAAS,CAAC,CAAC,EAC/B,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAClE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAU5C;AAoBD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgB9B;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMjD"}
@@ -0,0 +1,86 @@
1
+ import { createVersion, canonicalize } from '../schema/version.js';
2
+ import { createSigner } from '../schema/signer.js';
3
+ import { checkVersionShape } from './version.js';
4
+ import { didToPublicKey } from '../identity/did.js';
5
+ import { verifyNote, UCAN_CLOCK_SKEW_SECONDS } from '../identity/ucan.js';
6
+ import { base64UrlDecode, base64UrlEncode, utf8Decode, utf8Encode } from '../utils/encoding.js';
7
+ import { isRecord } from '../utils/guards.js';
8
+ /** Members a loose version never has */
9
+ const IN_A_SPACE = ['space', 'log', 'seen', 'prev', 'genesis', 'deleted', 'retain', 'links', 'tags'];
10
+ /** Signs a loose version */
11
+ export async function signLoose(signer, collection, body, provider, options = {}) {
12
+ const unsigned = createVersion({
13
+ author: signer.did,
14
+ collection,
15
+ body,
16
+ ...(options.to ? { to: options.to } : {}),
17
+ ...(options.createdAt ? { createdAt: options.createdAt } : {}),
18
+ ...(signer.proof ? { proof: signer.proof } : {}),
19
+ });
20
+ return createSigner(provider).sign(unsigned, signer.key);
21
+ }
22
+ /** Why a value is not shaped as a loose version, or null */
23
+ function looseShapeProblem(value) {
24
+ if (!isRecord(value))
25
+ return 'It is not a version';
26
+ for (const member of IN_A_SPACE)
27
+ if (member in value)
28
+ return `A loose version has no ${member}`;
29
+ if (value.seq !== 0)
30
+ return 'A loose version is a first version';
31
+ if (typeof value.collection !== 'string' || value.collection.length === 0 || value.collection.length > 128)
32
+ return 'It names no collection';
33
+ if (typeof value.author !== 'string' || typeof value.signature !== 'string' || typeof value.id !== 'string')
34
+ return 'It is not signed';
35
+ if (typeof value.createdAt !== 'string' || !Number.isFinite(Date.parse(value.createdAt)))
36
+ return 'It has no time';
37
+ if (value.to !== undefined && (typeof value.to !== 'string' || value.to.length > 128))
38
+ return 'Its to is not a key';
39
+ if (!('body' in value))
40
+ return 'It has no body';
41
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- its members are checked one by one by checkVersionShape
42
+ return checkVersionShape(value);
43
+ }
44
+ /**
45
+ * Checks a loose version through: its shape, id, body and signature, and the
46
+ * note it carries, valid at its `createdAt` and made out to its author.
47
+ * @param collection The collection it must be in
48
+ * @returns It, with the account it speaks for, or null when it is anything less
49
+ */
50
+ export async function checkLoose(value, collection, provider) {
51
+ if (looseShapeProblem(value) !== null || !isRecord(value) || value.collection !== collection)
52
+ return null;
53
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- shaped as one above; the signature decides the rest
54
+ const version = value;
55
+ const at = Date.parse(version.createdAt);
56
+ if (at > Date.now() + UCAN_CLOCK_SKEW_SECONDS * 1000)
57
+ return null;
58
+ try {
59
+ const key = await provider.importPublicKey(didToPublicKey(version.author).publicKeyBytes);
60
+ if (!(await createSigner(provider).verify(version, key)))
61
+ return null;
62
+ }
63
+ catch {
64
+ return null;
65
+ }
66
+ if (version.proof === undefined)
67
+ return Object.freeze({ version, root: version.author, note: null, at });
68
+ const checked = await verifyNote(version.proof, provider, { at: Math.floor(at / 1000) }).catch(() => null);
69
+ if (!checked?.valid || checked.audience !== version.author)
70
+ return null;
71
+ return Object.freeze({ version, root: checked.root, note: checked.note, at });
72
+ }
73
+ /** A loose version as text: base64url of its canonical JSON */
74
+ export function encodeLoose(version) {
75
+ return base64UrlEncode(utf8Encode(canonicalize(version)));
76
+ }
77
+ /** Reads what `encodeLoose` wrote, or null when it isn't JSON in base64url */
78
+ export function decodeLoose(text) {
79
+ try {
80
+ return JSON.parse(utf8Decode(base64UrlDecode(text.trim())));
81
+ }
82
+ catch {
83
+ return null;
84
+ }
85
+ }
86
+ //# sourceMappingURL=loose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loose.js","sourceRoot":"","sources":["../../src/records/loose.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAmB,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,QAAQ,E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AI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -8,6 +8,8 @@ export interface CreateVersionParams<T> {
8
8
  readonly createdAt?: string;
9
9
  /** Space this version belongs to */
10
10
  readonly space?: string;
11
+ /** A loose version's recipient key (02 §3.5) */
12
+ readonly to?: string;
11
13
  /** The note authorizing this author, when signing with a delegated key */
12
14
  readonly proof?: Delegation;
13
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/schema/version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtD,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,OAAO,CAAC,E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,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtE"}
@@ -32,8 +32,9 @@ export function createVersion(params) {
32
32
  author: params.author,
33
33
  collection: params.collection,
34
34
  body: params.body,
35
- createdAt: params.createdAt ?? new Date().toISOString(),
35
+ createdAt: params.createdAt ?? new Date(Date.now()).toISOString(),
36
36
  ...(params.space ? { space: params.space } : {}),
37
+ ...(params.to ? { to: params.to } : {}),
37
38
  ...(params.proof ? { proof: params.proof } : {}),
38
39
  key: params.version?.key ?? base32Encode(globalThis.crypto.getRandomValues(new Uint8Array(16))),
39
40
  seq: params.version?.seq ?? 0,
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/schema/version.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAsC9C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAChE,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC;IACvC,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI;SACf,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,KAAK,GAAG,GA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), and the look-alikes it is warned of
4
+ * when it proposes a collection of its own that the library already has
5
+ * (`collections_propose`). Apps read each other's records only when they
6
+ * reach for the same collection, so the cheapest moment to steer is the one
7
+ * where a twin is about to be made. See "How the library is shaped" in
8
+ * `packages/core/docs/standard-library.md`.
9
+ */
10
+ import type { DefineCollection } from '../node/types.js';
11
+ /** What to use for what, one line each */
12
+ export declare const CHOOSING: ReadonlyArray<string>;
13
+ /**
14
+ * What in a collection of an app's own looks like one the library already
15
+ * has, each as a sentence to show the agent proposing it. Not a refusal: an
16
+ * app may have its reasons, and the person applying the blueprint decides.
17
+ */
18
+ export declare function lookalikes(definition: DefineCollection): string[];
19
+ //# sourceMappingURL=choosing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choosing.d.ts","sourceRoot":"","sources":["../../src/schemas/choosing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,EAAE,aAAa,CAAC,MAAM,CAWzC,CAAC;AAgCH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAuBjE"}
@@ -0,0 +1,69 @@
1
+ import { isRecord } from '../utils/guards.js';
2
+ /** What to use for what, one line each */
3
+ export const CHOOSING = Object.freeze([
4
+ 'Any file (a photo, video, recording, PDF): std.file. On a record, link it "about" that record.',
5
+ 'A group that exists while empty (a folder, album, playlist, category, checklist): std.list, with a std.list-item "in" it, "about" each member.',
6
+ 'A loose label on a record (#urgent): std.tag.',
7
+ 'Something to do: std.task, "in" a std.column on a board.',
8
+ 'Something happening at a time: std.event; answers to it: std.rsvp.',
9
+ 'Chat, in order: std.message, "in" a std.channel when there are several. A remark on a record: std.comment. A feed: std.post.',
10
+ 'A quick question: std.poll and std.vote. A decision: std.proposal, std.ballot and std.decision.',
11
+ 'Taking something on, first come (a task, a slot to book, an item to bring): std.claim.',
12
+ 'More fields on a standard record: a collection of your own with an "about" link to it and onePer ["link:about"]. Never a copy of the standard one.',
13
+ 'Where a record sits (a channel, column, list, calendar): the link role "in".',
14
+ ]);
15
+ /** A definition's fields, when its schema is JSON Schema; a validator's (Zod and the like) say none */
16
+ const propertiesOf = (definition) => {
17
+ const { schema } = definition;
18
+ return isRecord(schema) && isRecord(schema.properties) ? schema.properties : {};
19
+ };
20
+ /** Whether a field holds a file, as `records.addFile` gives one */
21
+ const holdsFile = (definition) => Object.values(propertiesOf(definition)).some((field) => isRecord(field) &&
22
+ isRecord(field.properties) &&
23
+ 'hash' in field.properties &&
24
+ 'mime' in field.properties);
25
+ /** Link roles that say where a record sits, which the library calls `in` */
26
+ const PLACES = [
27
+ 'folder',
28
+ 'album',
29
+ 'playlist',
30
+ 'category',
31
+ 'channel',
32
+ 'column',
33
+ 'board',
34
+ 'project',
35
+ 'calendar',
36
+ 'list',
37
+ ];
38
+ /**
39
+ * What in a collection of an app's own looks like one the library already
40
+ * has, each as a sentence to show the agent proposing it. Not a refusal: an
41
+ * app may have its reasons, and the person applying the blueprint decides.
42
+ */
43
+ export function lookalikes(definition) {
44
+ if (definition.name.startsWith('std.'))
45
+ return [];
46
+ const fields = new Set(Object.keys(propertiesOf(definition)));
47
+ const has = (...names) => names.some((name) => fields.has(name));
48
+ const said = [];
49
+ const twin = (std, why) => said.push(`${definition.name} ${why}, like ${std}. Use ${std} so other apps read these records; ` +
50
+ `for fields of your own, keep a collection about each ${std} record instead.`);
51
+ if (holdsFile(definition) && !has('title', 'question', 'price'))
52
+ twin('std.file', 'keeps a file');
53
+ else if (has('start', 'startsAt') && has('title', 'name'))
54
+ twin('std.event', 'is something at a time');
55
+ else if (has('title') && has('done', 'due', 'assignees', 'status'))
56
+ twin('std.task', 'is something to do');
57
+ else if (has('question') && has('options'))
58
+ twin('std.poll', 'asks a question with options');
59
+ else if (has('emoji') && fields.size <= 2)
60
+ twin('std.reaction', 'is a reaction');
61
+ else if (has('label', 'tag') && fields.size <= 2)
62
+ twin('std.tag', 'is a label');
63
+ for (const role of Object.keys(definition.links ?? {}))
64
+ if (PLACES.includes(role))
65
+ said.push(`${definition.name} says where a record sits with "${role}": the library calls that link "in", ` +
66
+ 'so other apps follow it.');
67
+ return said;
68
+ }
69
+ //# sourceMappingURL=choosing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choosing.js","sourceRoot":"","sources":["../../src/schemas/choosing.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,0CAA0C;AAC1C,MAAM,CAAC,MAAM,QAAQ,GAA0B,MAAM,CAAC,MAAM,CAAC;IAC3D,gGAAgG;IAChG,gJAAgJ;IAChJ,+CAA+C;IAC/C,0DAA0D;IAC1D,oEAAoE;IACpE,8HAA8H;IAC9H,iGAAiG;IACjG,wFAAwF;IACxF,oJAAoJ;IACpJ,8EAA8E;CAC/E,CAAC,CAAC;AAEH,uGAAuG;AACvG,MAAM,YAAY,GAAG,CAAC,UAA4B,EAAqC,EAAE;IACvF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;AAClF,CAAC,CAAC;AAEF,mEAAmE;AACnE,MAAM,SAAS,GAAG,CAAC,UAA4B,EAAW,EAAE,CAC1D,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAC1C,CAAC,KAAK,EAAE,EAAE,CACR,QAAQ,CAAC,KAAK,CAAC;IACf,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1B,MAAM,IAAI,KAAK,CAAC,UAAU;IAC1B,MAAM,IAAI,KAAK,CAAC,UAAU,CAC7B,CAAC;AAEJ,4EA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AAC;SACtG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC;QAAE,IAAI,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;SACxF,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC;QAAE,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;SAC5E,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC;QAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAChF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,IAAI,CACP,GAAG,UAAU,CAAC,IAAI,mCAAmC,IAAI,uCAAuC;gBAC9F,0BAA0B,CAC7B,CAAC;IACN,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -28,12 +28,7 @@ export declare const contact: {
28
28
  };
29
29
  readonly blocked: {
30
30
  readonly type: "boolean";
31
- readonly description: "Their contact requests are hidden, in every space";
32
- };
33
- readonly door: {
34
- readonly type: "string";
35
- readonly maxLength: 64;
36
- readonly description: "The door they knocked on, while your answer is still to be written in your space for two";
31
+ readonly description: "Their knocks are hidden, in every space and in your inbox";
37
32
  };
38
33
  };
39
34
  readonly required: readonly ["did", "name"];
@@ -47,26 +42,25 @@ export declare const contact: {
47
42
  readonly space?: string | undefined;
48
43
  readonly note?: string | undefined;
49
44
  readonly blocked?: boolean | undefined;
50
- readonly door?: string | undefined;
51
45
  }>;
52
46
  export type Contact = BodyOf<typeof contact>;
53
- /** An invite to a space for two, sealed so only the person it is for can read it. */
47
+ /** A knock left in a space both belong to: sealed to their contact key, so only they open it. */
54
48
  export declare const contactRequest: {
55
49
  readonly name: "std.contact-request";
56
50
  readonly title: "Contact request";
57
- readonly description: "An invite to a space for two, sealed so only one person can read it.";
51
+ readonly description: "A knock left for someone in a space you share, sealed so only they can open it.";
58
52
  readonly schema: {
59
53
  readonly type: "object";
60
54
  readonly properties: {
61
55
  readonly to: {
62
56
  readonly type: "string";
63
- readonly maxLength: 256;
64
- readonly description: "The account it is for";
57
+ readonly maxLength: 64;
58
+ readonly description: "Their contact key, as on their profile here";
65
59
  };
66
60
  readonly sealed: {
67
61
  readonly type: "string";
68
62
  readonly maxLength: 16000;
69
- readonly description: "The invite and a note, sealed with their contact key";
63
+ readonly description: "The knock, sealed to it (spec 07 §6)";
70
64
  };
71
65
  };
72
66
  readonly required: readonly ["to", "sealed"];
@@ -77,35 +71,23 @@ export declare const contactRequest: {
77
71
  }>;
78
72
  export type ContactRequestRecord = BodyOf<typeof contactRequest>;
79
73
  /**
80
- * A door of yours: a way in for people you share no space with (`node.doors`).
81
- * Kept in your contacts space, so every device of the account opens the same
82
- * doors. Its key is derived from the contact key and `id`; closing the door
83
- * is deleting the record.
74
+ * Your inbox (`node.inbox`): which one it is and where its knocks wait. Its
75
+ * keys are derived from the contact key and `gen`; a new `gen` is a new inbox,
76
+ * and codes for the old one stop working. The newest record is the inbox.
84
77
  */
85
- export declare const door: {
86
- readonly name: "std.door";
87
- readonly title: "Door";
88
- readonly description: "A way for people you share no space with to ask to become your contact.";
78
+ export declare const inbox: {
79
+ readonly name: "std.inbox";
80
+ readonly title: "Inbox";
81
+ readonly description: "Where people you share no space with can ask to become your contact.";
89
82
  readonly schema: {
90
83
  readonly type: "object";
91
84
  readonly properties: {
92
- readonly id: {
93
- readonly type: "string";
94
- readonly minLength: 16;
95
- readonly maxLength: 64;
96
- readonly description: "Random; the door key is derived from it";
97
- };
98
- readonly label: {
99
- readonly type: "string";
100
- readonly maxLength: 64;
101
- readonly description: "What you call this door — only you see it";
85
+ readonly gen: {
86
+ readonly type: "integer";
87
+ readonly minimum: 0;
88
+ readonly description: "Which inbox: its keys are derived from it";
102
89
  };
103
- readonly name: {
104
- readonly type: "string";
105
- readonly maxLength: 64;
106
- readonly description: "The name its code gives, shown to whoever knocks";
107
- };
108
- readonly relays: {
90
+ readonly places: {
109
91
  readonly type: "array";
110
92
  readonly items: {
111
93
  readonly type: "string";
@@ -115,28 +97,29 @@ export declare const door: {
115
97
  readonly maxItems: 3;
116
98
  readonly description: "Whose mailboxes hold its knocks";
117
99
  };
100
+ readonly name: {
101
+ readonly type: "string";
102
+ readonly maxLength: 64;
103
+ readonly description: "The name its code gives, shown to whoever knocks";
104
+ };
118
105
  };
119
- readonly required: readonly ["id", "relays"];
120
- };
121
- readonly rules: {
122
- readonly onePer: readonly ["id"];
106
+ readonly required: readonly ["gen", "places"];
123
107
  };
124
108
  } & import("../index.js").Typed<{
125
- readonly id: string;
126
- readonly label?: string | undefined;
109
+ readonly gen: number;
110
+ readonly places: readonly string[];
127
111
  readonly name?: string | undefined;
128
- readonly relays: readonly string[];
129
112
  }>;
130
- export type Door = BodyOf<typeof door>;
113
+ export type Inbox = BodyOf<typeof inbox>;
131
114
  /**
132
- * A knock you left on someone's door, waiting for them to open it. You don't
133
- * know who they are until they join the space for two; then it becomes a
115
+ * A knock you left on someone's inbox, waiting for them to join the space for
116
+ * two. You don't know who they are until they do; then it becomes a
134
117
  * `std.contact`, and this goes.
135
118
  */
136
119
  export declare const knock: {
137
120
  readonly name: "std.knock";
138
121
  readonly title: "Knock";
139
- readonly description: "A knock left on a door, waiting for an answer.";
122
+ readonly description: "A knock left on an inbox, waiting for them to join.";
140
123
  readonly schema: {
141
124
  readonly type: "object";
142
125
  readonly properties: {
@@ -148,25 +131,15 @@ export declare const knock: {
148
131
  readonly name: {
149
132
  readonly type: "string";
150
133
  readonly maxLength: 64;
151
- readonly description: "The name their door code gave";
152
- };
153
- readonly door: {
154
- readonly type: "string";
155
- readonly maxLength: 64;
156
- readonly description: "The door key knocked on";
157
- };
158
- readonly sign: {
159
- readonly type: "string";
160
- readonly maxLength: 64;
161
- readonly description: "The door's signing key, which their answer must be signed with";
134
+ readonly description: "The name their inbox code gave";
162
135
  };
163
136
  readonly invite: {
164
137
  readonly type: "string";
165
- readonly maxLength: 8000;
166
- readonly description: "The invite sent, to close once they answer";
138
+ readonly maxLength: 12000;
139
+ readonly description: "The invite sent, to close once they join";
167
140
  };
168
141
  };
169
- readonly required: readonly ["space", "name", "door", "sign", "invite"];
142
+ readonly required: readonly ["space", "name", "invite"];
170
143
  };
171
144
  readonly rules: {
172
145
  readonly onePer: readonly ["space"];
@@ -174,33 +147,7 @@ export declare const knock: {
174
147
  } & import("../index.js").Typed<{
175
148
  readonly space: string;
176
149
  readonly name: string;
177
- readonly door: string;
178
- readonly sign: string;
179
150
  readonly invite: string;
180
151
  }>;
181
152
  export type Knock = BodyOf<typeof knock>;
182
- /**
183
- * The answer to a knock, in the space for two: the door's owner, signing with
184
- * the door's signing key that the account writing this is theirs. It is how
185
- * the knocker tells the person behind the door from anyone the invite reached.
186
- */
187
- export declare const knockAnswer: {
188
- readonly name: "std.knock-answer";
189
- readonly title: "Knock answer";
190
- readonly description: "Proof that the account which joined is the one behind the door knocked on.";
191
- readonly schema: {
192
- readonly type: "object";
193
- readonly properties: {
194
- readonly sig: {
195
- readonly type: "string";
196
- readonly maxLength: 200;
197
- readonly description: "The door signing key over \"minca/knock-answer/v1|<space>|<account>\"";
198
- };
199
- };
200
- readonly required: readonly ["sig"];
201
- };
202
- } & import("../index.js").Typed<{
203
- readonly sig: string;
204
- }>;
205
- export type KnockAnswer = BodyOf<typeof knockAnswer>;
206
153
  //# sourceMappingURL=contacts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/schemas/contacts.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,gFAAgF;AAChF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBlB,CAAC;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