@haverstack/core 0.41.0 → 0.43.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.
Files changed (317) hide show
  1. package/README.md +124 -64
  2. package/dist/access.d.ts +43 -47
  3. package/dist/access.d.ts.map +1 -1
  4. package/dist/access.js +66 -101
  5. package/dist/access.js.map +1 -1
  6. package/dist/{combine.d.ts → adapter/combine.d.ts} +8 -1
  7. package/dist/adapter/combine.d.ts.map +1 -0
  8. package/dist/{combine.js → adapter/combine.js} +18 -3
  9. package/dist/adapter/combine.js.map +1 -0
  10. package/dist/adapter/index.d.ts +19 -0
  11. package/dist/adapter/index.d.ts.map +1 -0
  12. package/dist/adapter/index.js +16 -0
  13. package/dist/adapter/index.js.map +1 -0
  14. package/dist/adapter/reach.d.ts +14 -0
  15. package/dist/adapter/reach.d.ts.map +1 -0
  16. package/dist/adapter/reach.js +31 -0
  17. package/dist/adapter/reach.js.map +1 -0
  18. package/dist/{sort.d.ts → adapter/sort.d.ts} +20 -20
  19. package/dist/adapter/sort.d.ts.map +1 -0
  20. package/dist/{sort.js → adapter/sort.js} +37 -27
  21. package/dist/adapter/sort.js.map +1 -0
  22. package/dist/associations/identity.d.ts +69 -0
  23. package/dist/associations/identity.d.ts.map +1 -0
  24. package/dist/associations/identity.js +174 -0
  25. package/dist/associations/identity.js.map +1 -0
  26. package/dist/associations/validation.d.ts +83 -0
  27. package/dist/associations/validation.d.ts.map +1 -0
  28. package/dist/associations/validation.js +312 -0
  29. package/dist/associations/validation.js.map +1 -0
  30. package/dist/attachment-records.d.ts +48 -0
  31. package/dist/attachment-records.d.ts.map +1 -0
  32. package/dist/attachment-records.js +52 -0
  33. package/dist/attachment-records.js.map +1 -0
  34. package/dist/collection.d.ts +178 -0
  35. package/dist/collection.d.ts.map +1 -0
  36. package/dist/collection.js +397 -0
  37. package/dist/collection.js.map +1 -0
  38. package/dist/content-match.d.ts +25 -0
  39. package/dist/content-match.d.ts.map +1 -0
  40. package/dist/content-match.js +51 -0
  41. package/dist/content-match.js.map +1 -0
  42. package/dist/content-translation.d.ts +42 -0
  43. package/dist/content-translation.d.ts.map +1 -0
  44. package/dist/content-translation.js +108 -0
  45. package/dist/content-translation.js.map +1 -0
  46. package/dist/did/did.d.ts.map +1 -0
  47. package/dist/{did.js → did/did.js} +3 -4
  48. package/dist/did/did.js.map +1 -0
  49. package/dist/{did-entry.d.ts → did/index.d.ts} +1 -1
  50. package/dist/did/index.d.ts.map +1 -0
  51. package/dist/{did-entry.js → did/index.js} +3 -3
  52. package/dist/did/index.js.map +1 -0
  53. package/dist/errors.d.ts +54 -66
  54. package/dist/errors.d.ts.map +1 -1
  55. package/dist/errors.js +58 -62
  56. package/dist/errors.js.map +1 -1
  57. package/dist/grants.d.ts +20 -44
  58. package/dist/grants.d.ts.map +1 -1
  59. package/dist/grants.js +69 -151
  60. package/dist/grants.js.map +1 -1
  61. package/dist/id.d.ts +13 -31
  62. package/dist/id.d.ts.map +1 -1
  63. package/dist/id.js +13 -31
  64. package/dist/id.js.map +1 -1
  65. package/dist/index.d.ts +13 -9
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +9 -6
  68. package/dist/index.js.map +1 -1
  69. package/dist/install.d.ts +3 -6
  70. package/dist/install.d.ts.map +1 -1
  71. package/dist/install.js +6 -10
  72. package/dist/install.js.map +1 -1
  73. package/dist/lazy.d.ts +13 -0
  74. package/dist/lazy.d.ts.map +1 -0
  75. package/dist/lazy.js +27 -0
  76. package/dist/lazy.js.map +1 -0
  77. package/dist/merge.d.ts +1 -1
  78. package/dist/merge.d.ts.map +1 -1
  79. package/dist/merge.js +6 -12
  80. package/dist/merge.js.map +1 -1
  81. package/dist/migration-steps.d.ts +102 -0
  82. package/dist/migration-steps.d.ts.map +1 -0
  83. package/dist/migration-steps.js +293 -0
  84. package/dist/migration-steps.js.map +1 -0
  85. package/dist/query-validation.d.ts +68 -121
  86. package/dist/query-validation.d.ts.map +1 -1
  87. package/dist/query-validation.js +214 -380
  88. package/dist/query-validation.js.map +1 -1
  89. package/dist/record-changes.d.ts +11 -150
  90. package/dist/record-changes.d.ts.map +1 -1
  91. package/dist/record-changes.js +14 -305
  92. package/dist/record-changes.js.map +1 -1
  93. package/dist/schema.d.ts +18 -7
  94. package/dist/schema.d.ts.map +1 -1
  95. package/dist/schema.js +59 -30
  96. package/dist/schema.js.map +1 -1
  97. package/dist/scoped-stack/authority-snapshot.d.ts +37 -0
  98. package/dist/scoped-stack/authority-snapshot.d.ts.map +1 -0
  99. package/dist/scoped-stack/authority-snapshot.js +49 -0
  100. package/dist/scoped-stack/authority-snapshot.js.map +1 -0
  101. package/dist/scoped-stack/authority.d.ts +169 -0
  102. package/dist/scoped-stack/authority.d.ts.map +1 -0
  103. package/dist/scoped-stack/authority.js +408 -0
  104. package/dist/scoped-stack/authority.js.map +1 -0
  105. package/dist/scoped-stack/family-policy.d.ts +59 -0
  106. package/dist/scoped-stack/family-policy.d.ts.map +1 -0
  107. package/dist/scoped-stack/family-policy.js +68 -0
  108. package/dist/scoped-stack/family-policy.js.map +1 -0
  109. package/dist/scoped-stack/scoped-stack.d.ts +318 -0
  110. package/dist/scoped-stack/scoped-stack.d.ts.map +1 -0
  111. package/dist/scoped-stack/scoped-stack.js +695 -0
  112. package/dist/scoped-stack/scoped-stack.js.map +1 -0
  113. package/dist/scoped-stack/subscription.d.ts +36 -0
  114. package/dist/scoped-stack/subscription.d.ts.map +1 -0
  115. package/dist/scoped-stack/subscription.js +69 -0
  116. package/dist/scoped-stack/subscription.js.map +1 -0
  117. package/dist/stack/arguments.d.ts +27 -0
  118. package/dist/stack/arguments.d.ts.map +1 -0
  119. package/dist/stack/arguments.js +53 -0
  120. package/dist/stack/arguments.js.map +1 -0
  121. package/dist/stack/attachments.d.ts +24 -0
  122. package/dist/stack/attachments.d.ts.map +1 -0
  123. package/dist/stack/attachments.js +113 -0
  124. package/dist/stack/attachments.js.map +1 -0
  125. package/dist/{changes.d.ts → stack/changes.d.ts} +30 -72
  126. package/dist/stack/changes.d.ts.map +1 -0
  127. package/dist/{changes.js → stack/changes.js} +40 -74
  128. package/dist/stack/changes.js.map +1 -0
  129. package/dist/stack/client.d.ts +247 -0
  130. package/dist/stack/client.d.ts.map +1 -0
  131. package/dist/stack/client.js +9 -0
  132. package/dist/stack/client.js.map +1 -0
  133. package/dist/stack/identity-bindings.d.ts.map +1 -0
  134. package/dist/{identity-bindings.js → stack/identity-bindings.js} +5 -14
  135. package/dist/stack/identity-bindings.js.map +1 -0
  136. package/dist/stack/install-app.d.ts +22 -0
  137. package/dist/stack/install-app.d.ts.map +1 -0
  138. package/dist/stack/install-app.js +262 -0
  139. package/dist/stack/install-app.js.map +1 -0
  140. package/dist/stack/integrity.d.ts +94 -0
  141. package/dist/stack/integrity.d.ts.map +1 -0
  142. package/dist/stack/integrity.js +268 -0
  143. package/dist/stack/integrity.js.map +1 -0
  144. package/dist/{limits.d.ts → stack/limits.d.ts} +2 -5
  145. package/dist/stack/limits.d.ts.map +1 -0
  146. package/dist/{limits.js → stack/limits.js} +3 -6
  147. package/dist/stack/limits.js.map +1 -0
  148. package/dist/stack/migrations.d.ts +59 -0
  149. package/dist/stack/migrations.d.ts.map +1 -0
  150. package/dist/stack/migrations.js +141 -0
  151. package/dist/stack/migrations.js.map +1 -0
  152. package/dist/stack/reads.d.ts +69 -0
  153. package/dist/stack/reads.d.ts.map +1 -0
  154. package/dist/stack/reads.js +141 -0
  155. package/dist/stack/reads.js.map +1 -0
  156. package/dist/stack/record-id.d.ts +35 -0
  157. package/dist/stack/record-id.d.ts.map +1 -0
  158. package/dist/stack/record-id.js +82 -0
  159. package/dist/stack/record-id.js.map +1 -0
  160. package/dist/stack/stack.d.ts +444 -0
  161. package/dist/stack/stack.d.ts.map +1 -0
  162. package/dist/stack/stack.js +1339 -0
  163. package/dist/stack/stack.js.map +1 -0
  164. package/dist/stack/system-types.d.ts +16 -0
  165. package/dist/stack/system-types.d.ts.map +1 -0
  166. package/dist/stack/system-types.js +111 -0
  167. package/dist/stack/system-types.js.map +1 -0
  168. package/dist/stack/type-grants.d.ts +20 -0
  169. package/dist/stack/type-grants.d.ts.map +1 -0
  170. package/dist/stack/type-grants.js +69 -0
  171. package/dist/stack/type-grants.js.map +1 -0
  172. package/dist/stack/write-expectation.d.ts +79 -0
  173. package/dist/stack/write-expectation.d.ts.map +1 -0
  174. package/dist/stack/write-expectation.js +71 -0
  175. package/dist/stack/write-expectation.js.map +1 -0
  176. package/dist/stack/write-gate.d.ts +23 -0
  177. package/dist/stack/write-gate.d.ts.map +1 -0
  178. package/dist/stack/write-gate.js +17 -0
  179. package/dist/stack/write-gate.js.map +1 -0
  180. package/dist/testing.d.ts +44 -33
  181. package/dist/testing.d.ts.map +1 -1
  182. package/dist/testing.js +180 -176
  183. package/dist/testing.js.map +1 -1
  184. package/dist/type-handle.d.ts +67 -78
  185. package/dist/type-handle.d.ts.map +1 -1
  186. package/dist/type-handle.js +44 -111
  187. package/dist/type-handle.js.map +1 -1
  188. package/dist/types/adapter.d.ts +282 -0
  189. package/dist/types/adapter.d.ts.map +1 -0
  190. package/dist/types/adapter.js +5 -0
  191. package/dist/types/adapter.js.map +1 -0
  192. package/dist/types/associations.d.ts +140 -0
  193. package/dist/types/associations.d.ts.map +1 -0
  194. package/dist/types/associations.js +6 -0
  195. package/dist/types/associations.js.map +1 -0
  196. package/dist/types/capabilities.d.ts +89 -0
  197. package/dist/types/capabilities.d.ts.map +1 -0
  198. package/dist/types/capabilities.js +5 -0
  199. package/dist/types/capabilities.js.map +1 -0
  200. package/dist/types/events.d.ts +150 -0
  201. package/dist/types/events.d.ts.map +1 -0
  202. package/dist/types/events.js +5 -0
  203. package/dist/types/events.js.map +1 -0
  204. package/dist/types/ids.d.ts +43 -0
  205. package/dist/types/ids.d.ts.map +1 -0
  206. package/dist/types/ids.js +5 -0
  207. package/dist/types/ids.js.map +1 -0
  208. package/dist/types/index.d.ts +19 -0
  209. package/dist/types/index.d.ts.map +1 -0
  210. package/dist/types/index.js +19 -0
  211. package/dist/types/index.js.map +1 -0
  212. package/dist/types/journal.d.ts +47 -0
  213. package/dist/types/journal.d.ts.map +1 -0
  214. package/dist/types/journal.js +5 -0
  215. package/dist/types/journal.js.map +1 -0
  216. package/dist/types/query.d.ts +185 -0
  217. package/dist/types/query.d.ts.map +1 -0
  218. package/dist/types/query.js +10 -0
  219. package/dist/types/query.js.map +1 -0
  220. package/dist/types/records.d.ts +76 -0
  221. package/dist/types/records.d.ts.map +1 -0
  222. package/dist/types/records.js +5 -0
  223. package/dist/types/records.js.map +1 -0
  224. package/dist/types/schema.d.ts +74 -0
  225. package/dist/types/schema.d.ts.map +1 -0
  226. package/dist/types/schema.js +5 -0
  227. package/dist/types/schema.js.map +1 -0
  228. package/dist/types/system.d.ts +161 -0
  229. package/dist/types/system.d.ts.map +1 -0
  230. package/dist/types/system.js +32 -0
  231. package/dist/types/system.js.map +1 -0
  232. package/dist/types/tokens.d.ts +39 -0
  233. package/dist/types/tokens.d.ts.map +1 -0
  234. package/dist/types/tokens.js +5 -0
  235. package/dist/types/tokens.js.map +1 -0
  236. package/dist/validate.d.ts +31 -70
  237. package/dist/validate.d.ts.map +1 -1
  238. package/dist/validate.js +52 -92
  239. package/dist/validate.js.map +1 -1
  240. package/dist/{attachment-download.d.ts → wire/attachment-download.d.ts} +0 -57
  241. package/dist/wire/attachment-download.d.ts.map +1 -0
  242. package/dist/{attachment-download.js → wire/attachment-download.js} +0 -61
  243. package/dist/wire/attachment-download.js.map +1 -0
  244. package/dist/{auth.d.ts → wire/auth.d.ts} +5 -8
  245. package/dist/wire/auth.d.ts.map +1 -0
  246. package/dist/{auth.js → wire/auth.js} +5 -8
  247. package/dist/wire/auth.js.map +1 -0
  248. package/dist/{wire-body.d.ts → wire/body.d.ts} +35 -12
  249. package/dist/wire/body.d.ts.map +1 -0
  250. package/dist/{wire-body.js → wire/body.js} +74 -13
  251. package/dist/wire/body.js.map +1 -0
  252. package/dist/{wire-entry.d.ts → wire/index.d.ts} +12 -12
  253. package/dist/wire/index.d.ts.map +1 -0
  254. package/dist/{wire-entry.js → wire/index.js} +13 -17
  255. package/dist/wire/index.js.map +1 -0
  256. package/dist/wire/record.d.ts +31 -0
  257. package/dist/wire/record.d.ts.map +1 -0
  258. package/dist/{wire-record.js → wire/record.js} +7 -67
  259. package/dist/wire/record.js.map +1 -0
  260. package/dist/{wire-request.d.ts → wire/request.d.ts} +32 -49
  261. package/dist/wire/request.d.ts.map +1 -0
  262. package/dist/{wire-request.js → wire/request.js} +113 -83
  263. package/dist/wire/request.js.map +1 -0
  264. package/package.json +7 -7
  265. package/dist/adapter-entry.d.ts +0 -16
  266. package/dist/adapter-entry.d.ts.map +0 -1
  267. package/dist/adapter-entry.js +0 -14
  268. package/dist/adapter-entry.js.map +0 -1
  269. package/dist/attachment-download.d.ts.map +0 -1
  270. package/dist/attachment-download.js.map +0 -1
  271. package/dist/auth.d.ts.map +0 -1
  272. package/dist/auth.js.map +0 -1
  273. package/dist/changes.d.ts.map +0 -1
  274. package/dist/changes.js.map +0 -1
  275. package/dist/combine.d.ts.map +0 -1
  276. package/dist/combine.js.map +0 -1
  277. package/dist/did-entry.d.ts.map +0 -1
  278. package/dist/did-entry.js.map +0 -1
  279. package/dist/did.d.ts.map +0 -1
  280. package/dist/did.js.map +0 -1
  281. package/dist/identity-bindings.d.ts.map +0 -1
  282. package/dist/identity-bindings.js.map +0 -1
  283. package/dist/limits.d.ts.map +0 -1
  284. package/dist/limits.js.map +0 -1
  285. package/dist/record-id.d.ts +0 -70
  286. package/dist/record-id.d.ts.map +0 -1
  287. package/dist/record-id.js +0 -127
  288. package/dist/record-id.js.map +0 -1
  289. package/dist/scoped-stack.d.ts +0 -549
  290. package/dist/scoped-stack.d.ts.map +0 -1
  291. package/dist/scoped-stack.js +0 -1301
  292. package/dist/scoped-stack.js.map +0 -1
  293. package/dist/sort.d.ts.map +0 -1
  294. package/dist/sort.js.map +0 -1
  295. package/dist/stack-reads.d.ts +0 -38
  296. package/dist/stack-reads.d.ts.map +0 -1
  297. package/dist/stack-reads.js +0 -79
  298. package/dist/stack-reads.js.map +0 -1
  299. package/dist/stack.d.ts +0 -1032
  300. package/dist/stack.d.ts.map +0 -1
  301. package/dist/stack.js +0 -2337
  302. package/dist/stack.js.map +0 -1
  303. package/dist/types.d.ts +0 -1278
  304. package/dist/types.d.ts.map +0 -1
  305. package/dist/types.js +0 -51
  306. package/dist/types.js.map +0 -1
  307. package/dist/wire-body.d.ts.map +0 -1
  308. package/dist/wire-body.js.map +0 -1
  309. package/dist/wire-entry.d.ts.map +0 -1
  310. package/dist/wire-entry.js.map +0 -1
  311. package/dist/wire-record.d.ts +0 -50
  312. package/dist/wire-record.d.ts.map +0 -1
  313. package/dist/wire-record.js.map +0 -1
  314. package/dist/wire-request.d.ts.map +0 -1
  315. package/dist/wire-request.js.map +0 -1
  316. /package/dist/{did.d.ts → did/did.d.ts} +0 -0
  317. /package/dist/{identity-bindings.d.ts → stack/identity-bindings.d.ts} +0 -0
package/dist/validate.js CHANGED
@@ -1,13 +1,16 @@
1
1
  /**
2
- * Stack — Content Validation
2
+ * Stack — Content and Schema Validation
3
3
  * -------------------------------------------------------
4
- * Validates a Record's content object against a TypeSchema.
5
- * Returns a list of validation errors — empty means valid.
4
+ * Validates a Record's content object against a TypeSchema, and a
5
+ * TypeSchema itself before it is defined — including the field-name rules
6
+ * both share, so no stored name is one a content filter cannot address.
7
+ * Every check returns a list of validation errors — empty means valid.
6
8
  *
7
9
  * Validates recursively for array and object field kinds.
8
10
  * Coercion is never performed — types must match exactly.
9
11
  */
10
- const MAX_VALIDATION_DEPTH = 32;
12
+ /** How deep content may nest below a top-level field, which is depth 0. */
13
+ export const MAX_VALIDATION_DEPTH = 32;
11
14
  /** fileId format: SHA-256 hex, lowercase — matches blob-adapter-disk's assertFileId(). */
12
15
  const FILE_ID_RE = /^[0-9a-f]{64}$/;
13
16
  /**
@@ -20,12 +23,15 @@ const ISO_8601_RE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\
20
23
  // -------------------------------------------------------
21
24
  // Internal helpers
22
25
  // -------------------------------------------------------
26
+ /** Shared by the 422 for a value outside the list and the 409 for removed values. */
27
+ export const formatEnumValues = (values) => values.map((v) => JSON.stringify(v)).join(', ');
23
28
  const jsTypeForScalar = (kind) => {
24
29
  switch (kind) {
25
30
  case 'string':
26
31
  case 'text':
27
32
  case 'record-ref':
28
33
  case 'file-ref':
34
+ case 'enum':
29
35
  return 'string';
30
36
  case 'number':
31
37
  return 'number';
@@ -158,10 +164,10 @@ const validateField = (value, def, path, errors, depth = 0) => {
158
164
  else if (typeof value === 'number' && !Number.isFinite(value)) {
159
165
  errors.push({ path, message: `Expected a finite number, got ${value}` });
160
166
  }
161
- else if (def.kind === 'string' && def.enum && !def.enum.includes(value)) {
167
+ else if (def.kind === 'enum' && !def.values.includes(value)) {
162
168
  errors.push({
163
169
  path,
164
- message: `Expected one of ${def.enum.map((v) => JSON.stringify(v)).join(', ')}, got ${JSON.stringify(value)}`,
170
+ message: `Expected one of ${formatEnumValues(def.values)}, got ${JSON.stringify(value)}`,
165
171
  });
166
172
  }
167
173
  };
@@ -183,11 +189,10 @@ export const validateContent = (content, schema, prefix = '', errors = [], depth
183
189
  });
184
190
  return errors;
185
191
  }
186
- // A field the schema does not declare is refused rather than stored.
187
- // The schema is the record's shape; a key outside it is a typo, a stale
188
- // writer, or a caller reaching for something that isn't content at all,
189
- // and storing it makes all three look like a write that worked. Declare
190
- // an `object` field `open` for a shape a schema cannot describe.
192
+ // An undeclared field is refused rather than stored: a key outside the
193
+ // schema is a typo, a stale writer or not content at all, and storing it
194
+ // makes each look like a write that worked. An `open` object field holds
195
+ // what a schema cannot describe.
191
196
  // See docs/spec/data-model.md § Undeclared content fields.
192
197
  for (const key of Object.keys(content)) {
193
198
  if (Object.hasOwn(schema, key))
@@ -238,23 +243,11 @@ const dropAbsentValue = (value, def, depth) => {
238
243
  return value;
239
244
  };
240
245
  /**
241
- * Content keys that name JavaScript's object machinery rather than a
242
- * field. Undeclared content fields are allowed by design, so without this
243
- * they reach `merged[key] = value` in applyMergePatch — where `__proto__`
244
- * invokes the prototype setter instead of setting a field.
245
- *
246
- * That is not a prototype-pollution gadget today: JSON.stringify writes
247
- * only own-enumerable properties, so a reassigned prototype never reaches
248
- * storage, and JSON.parse recreates `__proto__` as an own property rather
249
- * than invoking the setter, so a stored one round-trips inertly. The
250
- * defect is that the two write paths disagree — a merge patch to
251
- * `__proto__` silently vanishes, while the same key through create()
252
- * stores as an ordinary field — and that a future refactor deepening the
253
- * shallow merge would turn a quiet inconsistency into a real one.
254
- *
255
- * Rejecting is more honest than skipping: a caller who sends one of these
256
- * finds out, rather than watching a write appear to succeed and do
257
- * nothing. See docs/spec/data-model.md § Reserved content keys.
246
+ * Content keys naming JavaScript's object machinery rather than a field.
247
+ * Whether one survives a write would depend on how the code setting it was
248
+ * written — assignment drops `__proto__`, JSON.parse keeps it — so all
249
+ * three are refused at the write, and the caller finds out.
250
+ * See docs/spec/data-model.md § Reserved content keys.
258
251
  */
259
252
  export const RESERVED_CONTENT_KEYS = ['__proto__', 'constructor', 'prototype'];
260
253
  /**
@@ -277,20 +270,21 @@ const SCALAR_KINDS = {
277
270
  text: true,
278
271
  'record-ref': true,
279
272
  'file-ref': true,
273
+ enum: true,
280
274
  };
281
- const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
282
- const validateEnumShape = (list, path, errors) => {
275
+ export const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
276
+ const validateEnumValuesShape = (list, path, errors) => {
283
277
  if (!Array.isArray(list) || list.length === 0) {
284
- errors.push({ path, message: '"enum" must be a non-empty array of strings' });
278
+ errors.push({ path, message: 'An enum must declare "values", a non-empty array of strings' });
285
279
  return;
286
280
  }
287
281
  const seen = new Set();
288
282
  for (const entry of list) {
289
283
  if (typeof entry !== 'string') {
290
- errors.push({ path, message: `"enum" entries must be strings, got ${typeName(entry)}` });
284
+ errors.push({ path, message: `"values" entries must be strings, got ${typeName(entry)}` });
291
285
  }
292
286
  else if (seen.has(entry)) {
293
- errors.push({ path, message: `"enum" lists ${JSON.stringify(entry)} more than once` });
287
+ errors.push({ path, message: `"values" lists ${JSON.stringify(entry)} more than once` });
294
288
  }
295
289
  seen.add(entry);
296
290
  }
@@ -311,8 +305,14 @@ const validateFieldDefShape = (def, path, errors, depth) => {
311
305
  errors.push({ path, message: 'A field definition must name a "kind"' });
312
306
  return;
313
307
  }
314
- if (def.enum !== undefined && (def.kind === 'array' || def.kind === 'object')) {
315
- errors.push({ path, message: `"enum" is only allowed on a string field, not "${def.kind}"` });
308
+ const knownKind = def.kind === 'array' || def.kind === 'object' || Object.hasOwn(SCALAR_KINDS, def.kind);
309
+ if (def.values !== undefined && knownKind && def.kind !== 'enum') {
310
+ errors.push({ path, message: `"values" is only allowed on an enum field, not "${def.kind}"` });
311
+ }
312
+ // Unknown keys are otherwise ignored, but `enum` names a kind: as a key it
313
+ // would read as a constraint that nothing enforces.
314
+ if (def.enum !== undefined) {
315
+ errors.push({ path, message: '"enum" is a field kind, not a field key' });
316
316
  }
317
317
  if (def.kind === 'array') {
318
318
  if (isOpen) {
@@ -355,28 +355,14 @@ const validateFieldDefShape = (def, path, errors, depth) => {
355
355
  });
356
356
  return;
357
357
  }
358
- if (def.enum !== undefined) {
359
- if (def.kind !== 'string') {
360
- errors.push({ path, message: `"enum" is only allowed on a string field, not "${def.kind}"` });
361
- }
362
- else {
363
- validateEnumShape(def.enum, path, errors);
364
- }
365
- }
358
+ if (def.kind === 'enum')
359
+ validateEnumValuesShape(def.values, path, errors);
366
360
  };
367
361
  /**
368
- * Check that a schema is actually a schema, before anything reads it as
369
- * one. `defineType()` takes a TypeSchema, but a schema off the wire is
370
- * parsed JSON that TypeScript never saw, so every shape below is reachable
371
- * at runtime: a container declaring neither its interior nor `open` throws
372
- * out of hashSchema() rather than reporting anything, and a definition with
373
- * an unknown `kind` — or none — defines a field whose every write fails
374
- * against an expectation the schema never actually stated, sending the
375
- * caller looking through their content for a bug that is in their type.
376
- *
377
- * Refused at definition time for the reason a field name no filter could
378
- * address is: a schema is a promise, and one nothing can satisfy is worth
379
- * catching where it is written. See docs/spec/data-model.md § Types.
362
+ * Check that a schema is a schema before anything reads it as one: off the
363
+ * wire it is JSON TypeScript never saw. A container declaring neither its
364
+ * interior nor `open` would throw out of hashSchema(), and an unknown `kind`
365
+ * would define a field every write fails. See docs/spec/data-model.md § Types.
380
366
  */
381
367
  export const validateSchemaShape = (schema, prefix = '', errors = [], depth = 0) => {
382
368
  if (depth > MAX_VALIDATION_DEPTH) {
@@ -399,30 +385,19 @@ export const validateSchemaShape = (schema, prefix = '', errors = [], depth = 0)
399
385
  return errors;
400
386
  };
401
387
  /**
402
- * The same three names, refused where a schema declares them. Top-level
403
- * only, exactly matching the content rule's scope above: a nested
404
- * declaration names a field a record can actually carry, so refusing one
405
- * would deny a writable shape.
406
- *
407
- * A declaration cannot license what the content rule refuses, so accepting
408
- * one would define a field no record could ever hold — and, where the
409
- * declaration is `required`, a type no record could satisfy at all: supply
410
- * the field and the write is refused as a reserved key, omit it and the
411
- * write is refused as a missing required field. Refused at definition time
412
- * for the reason a field name no filter could address is
413
- * (validateSchemaFieldNames): a schema is a promise that a field is
414
- * meaningful. See docs/spec/data-model.md § Reserved content keys.
388
+ * The same names, refused where a schema declares them, top-level only like
389
+ * the content rule. A declaration cannot license what that rule refuses, so
390
+ * it would define a field no record could hold — and if `required`, a type
391
+ * no record could satisfy. See docs/spec/data-model.md § Reserved content keys.
415
392
  */
416
393
  export const validateSchemaReservedNames = (schema) => RESERVED_CONTENT_KEYS.filter((key) => Object.hasOwn(schema, key)).map((key) => ({
417
394
  path: key,
418
395
  message: `"${key}" is a reserved content key and cannot be declared as a field name`,
419
396
  }));
420
397
  /**
421
- * `undefined` is not a value a merge patch can carry: `null` is the
422
- * deletion sentinel, JSON drops the key on the way to storage, and the
423
- * presence checks a patch runs through read the key as a claim on the
424
- * field it names. Top-level only, matching the shallow merge — a nested
425
- * one is part of a value being replaced wholesale.
398
+ * `undefined` is not a value a merge patch can carry: `null` deletes, JSON
399
+ * drops the key, and the presence checks read the key as a claim on its
400
+ * field. Top-level only, matching the shallow merge.
426
401
  * See docs/spec/data-model.md § Undefined values in a patch.
427
402
  */
428
403
  export const validatePatchValues = (patch) => Object.keys(patch)
@@ -432,20 +407,10 @@ export const validatePatchValues = (patch) => Object.keys(patch)
432
407
  message: `"${key}" is undefined; omit it to leave the field unchanged, or use null to remove it`,
433
408
  }));
434
409
  /**
435
- * Characters a content field name may not contain, because a content
436
- * filter key is a dot-separated path: `{ content: { 'emails.value': x } }`
437
- * addresses `value` inside `emails`. A field literally named `emails.value`
438
- * would make that filter mean two things at once, so the ambiguity is
439
- * removed from the write side — where it is a validation error a caller
440
- * can act on — rather than from the query side, where it would need an
441
- * escape convention that silently misreads when a caller forgets it.
442
- *
443
- * Wider than what SQLite's JSON path grammar treats as syntax today (`.`,
444
- * `[`, `]`, `$`, `"`): `*` and `#` are reserved against a path grammar
445
- * that grows a wildcard or a last-element form. Narrowing a legal charset
446
- * is a one-way door, so the cost of reserving a character now is nothing
447
- * and the cost of reserving it later is every stored record.
448
- *
410
+ * Characters a field name may not contain: a filter key is a dot-separated
411
+ * path, so a field named `emails.value` would make one filter mean two
412
+ * things. `*` and `#` are reserved ahead of the path grammar, as narrowing
413
+ * a legal charset later costs every stored record.
449
414
  * See docs/spec/data-model.md § Content field names.
450
415
  */
451
416
  export const CONTENT_KEY_PATH_METACHARACTERS = ['.', '[', ']', '$', '"', '*', '#'];
@@ -519,9 +484,4 @@ export const validateSchemaFieldNames = (schema, prefix = '', errors = [], depth
519
484
  }
520
485
  return errors;
521
486
  };
522
- /**
523
- * Returns true if the content is valid against the schema.
524
- * Use validateContent() directly to get error details.
525
- */
526
- export const isValid = (content, schema) => validateContent(content, schema).length === 0;
527
487
  //# sourceMappingURL=validate.js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KAAK,GAAG,CAAC,EACU,EAAE;IACrB,IAAI,KAAK,GAAG,oBAAoB;QAAE,OAAO,MAAM,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC/C,IAAI,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI;gBACJ,OAAO,EACL,eAAe,GAAG,kCAAkC;oBACpD,IAAI,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,sCAAsC;aACtF,CAAC,CAAC;QACL,CAAC;QACD,IAAI,KAAK,GAAa,GAAG,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAClE,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI;YACxC,wBAAwB,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -34,63 +34,6 @@ export declare const NOSNIFF_HEADER_VALUE = "nosniff";
34
34
  export declare function isSafeAttachmentContentType(mimeType: string): boolean;
35
35
  /** Infers a candidate MIME type from a filename's extension. Returns undefined for no extension or an unrecognized one — the caller falls through to the next source. */
36
36
  export declare function inferContentTypeFromFilename(filename: string): string | undefined;
37
- /**
38
- * Which `_attachment@1` record establishes a fileId's mimeType — the
39
- * "first-recorded" rule of docs/spec/attachments.md, as a total order:
40
- * earliest `createdAt`, ties broken by the lower `id`.
41
- *
42
- * The tiebreak is what makes it a rule rather than a coincidence of scan
43
- * order. Rejecting a conflicting mimeType at write time is check-then-act
44
- * with no storage-level uniqueness behind it, so two racing first uploads
45
- * of the same bytes can both land on a concurrent server. Determinism
46
- * doesn't depend on that never happening — it depends on every reader
47
- * ordering the records the same way, which is why core's write-time
48
- * conflict check and a server's serving choice both come through here.
49
- *
50
- * Generic over the record shape so a server can pass its own row type.
51
- * Records for other fileIds must be filtered out by the caller.
52
- */
53
- export declare function firstRecordedAttachment<T extends {
54
- id: string;
55
- createdAt: Date;
56
- }>(records: readonly T[]): T | undefined;
57
- /**
58
- * The same total order as a comparator, for a caller handing back the whole
59
- * candidate set rather than the winner — sorted this way, the winner is
60
- * element zero. Package-internal: `core/wire` exports the selection, since
61
- * the ordering is only useful to something that already has every record.
62
- */
63
- export declare function compareRecordedAttachments<T extends {
64
- id: string;
65
- createdAt: Date;
66
- }>(a: T, b: T): number;
67
- /**
68
- * Which `_attachment` record describes a *reference* to a fileId, as
69
- * opposed to the fileId itself: the association's own
70
- * `attachmentRecordId`, else the requester's own upload, else the
71
- * first-recorded record. Where `filename` comes from on a download when
72
- * `?filename` is not given, and the name a consumer shows for an
73
- * attachment association. See docs/spec/attachments.md § Naming the upload
74
- * a reference came from.
75
- *
76
- * Every step falls back rather than failing: a pointer at a record that is
77
- * gone, or at nothing this caller collected, lands on the same answer a
78
- * reference with no pointer at all gets.
79
- *
80
- * Generic over the record shape, like firstRecordedAttachment(), so a
81
- * server can pass its own row type. Records for other fileIds must be
82
- * filtered out by the caller.
83
- */
84
- export declare function resolveReferencedAttachment<T extends {
85
- id: string;
86
- createdAt: Date;
87
- createdBy?: {
88
- subjectId: string;
89
- };
90
- }>(records: readonly T[], opts?: {
91
- attachmentRecordId?: string;
92
- requesterEntityId?: string;
93
- }): T | undefined;
94
37
  export type AttachmentDownloadContentType = {
95
38
  /** The Content-Type header value to serve. */
96
39
  contentType: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-download.d.ts","sourceRoot":"","sources":["../../src/wire/attachment-download.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAqB9C;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMrE;AAmCD,yKAAyK;AACzK,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjF;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,6BAA6B,CAUhC"}
@@ -101,67 +101,6 @@ export function inferContentTypeFromFilename(filename) {
101
101
  const match = /\.([a-z0-9]+)$/i.exec(filename);
102
102
  return match ? EXTENSION_MIME_TYPES[match[1].toLowerCase()] : undefined;
103
103
  }
104
- /**
105
- * Which `_attachment@1` record establishes a fileId's mimeType — the
106
- * "first-recorded" rule of docs/spec/attachments.md, as a total order:
107
- * earliest `createdAt`, ties broken by the lower `id`.
108
- *
109
- * The tiebreak is what makes it a rule rather than a coincidence of scan
110
- * order. Rejecting a conflicting mimeType at write time is check-then-act
111
- * with no storage-level uniqueness behind it, so two racing first uploads
112
- * of the same bytes can both land on a concurrent server. Determinism
113
- * doesn't depend on that never happening — it depends on every reader
114
- * ordering the records the same way, which is why core's write-time
115
- * conflict check and a server's serving choice both come through here.
116
- *
117
- * Generic over the record shape so a server can pass its own row type.
118
- * Records for other fileIds must be filtered out by the caller.
119
- */
120
- export function firstRecordedAttachment(records) {
121
- return records.reduce((first, record) => (!first || compareRecordedAttachments(record, first) < 0 ? record : first), undefined);
122
- }
123
- /**
124
- * The same total order as a comparator, for a caller handing back the whole
125
- * candidate set rather than the winner — sorted this way, the winner is
126
- * element zero. Package-internal: `core/wire` exports the selection, since
127
- * the ordering is only useful to something that already has every record.
128
- */
129
- export function compareRecordedAttachments(a, b) {
130
- const delta = a.createdAt.getTime() - b.createdAt.getTime();
131
- if (delta !== 0)
132
- return delta;
133
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
134
- }
135
- /**
136
- * Which `_attachment` record describes a *reference* to a fileId, as
137
- * opposed to the fileId itself: the association's own
138
- * `attachmentRecordId`, else the requester's own upload, else the
139
- * first-recorded record. Where `filename` comes from on a download when
140
- * `?filename` is not given, and the name a consumer shows for an
141
- * attachment association. See docs/spec/attachments.md § Naming the upload
142
- * a reference came from.
143
- *
144
- * Every step falls back rather than failing: a pointer at a record that is
145
- * gone, or at nothing this caller collected, lands on the same answer a
146
- * reference with no pointer at all gets.
147
- *
148
- * Generic over the record shape, like firstRecordedAttachment(), so a
149
- * server can pass its own row type. Records for other fileIds must be
150
- * filtered out by the caller.
151
- */
152
- export function resolveReferencedAttachment(records, opts = {}) {
153
- if (opts.attachmentRecordId) {
154
- const named = records.find((record) => record.id === opts.attachmentRecordId);
155
- if (named)
156
- return named;
157
- }
158
- if (opts.requesterEntityId) {
159
- const own = records.filter((record) => record.createdBy?.subjectId === opts.requesterEntityId);
160
- if (own.length > 0)
161
- return firstRecordedAttachment(own);
162
- }
163
- return firstRecordedAttachment(records);
164
- }
165
104
  /**
166
105
  * Resolve the Content-Type served for `GET /attachments/:fileId`
167
106
  * (docs/spec/wire-format.md § Download): `?contentType` wins, else
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-download.js","sourceRoot":"","sources":["../../src/wire/attachment-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,CAAC,CAAC;QAC1E,KAAK,CAAC,cAAc;QACpB,mBAAmB,CAAC;IAEtB,OAAO,2BAA2B,CAAC,SAAS,CAAC;QAC3C,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE;QAC3C,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACzD,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * Core verifies signatures; it does not run a server. Nonce storage,
17
17
  * single-use enforcement and token issuance are the server's.
18
18
  */
19
- import { type DidKeypair } from './did.js';
19
+ import { type DidKeypair } from '../did/did.js';
20
20
  /**
21
21
  * Malformed input to a handshake primitive — a bad origin, DID, or nonce,
22
22
  * caught locally before anything is signed or verified. Outside the
@@ -49,13 +49,10 @@ export type AuthChallenge = {
49
49
  */
50
50
  export declare const authOriginFromUrl: (url: string) => string;
51
51
  /**
52
- * Build the exact bytes a client signs and a server verifies.
53
- *
54
- * The origin is in the payload because the nonce alone doesn't scope a
55
- * signature to a server: one that a client connects to can fetch a
56
- * challenge from the client's real stack, pass that nonce along, and
57
- * redeem the returned signature as a token. Signing the origin the client
58
- * believes it is talking to makes such a signature verify nowhere else.
52
+ * Build the exact bytes a client signs and a server verifies. The origin is
53
+ * signed because a nonce alone doesn't scope a signature: a server a client
54
+ * connects to could relay a challenge from the client's real stack and
55
+ * redeem the signature there.
59
56
  */
60
57
  export declare const buildAuthChallengePayload: (challenge: AuthChallenge) => Uint8Array;
61
58
  /** Sign a challenge with the private key behind its DID. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/wire/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA+C,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAM7F;;;;;;GAMG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,SAAK;CAIzB;AAMD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AASvD,MAAM,MAAM,aAAa,GAAG;IAC1B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,MAa/C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,aAAa,KAAG,UAapE,CAAC;AAMF,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,GAC5B,YAAY,SAAS,EACrB,WAAW,aAAa,KACvB,OAAO,CAAC,UAAU,CAAkE,CAAC;AAExF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,aAAa,EACxB,WAAW,UAAU,KACpB,OAAO,CAAC,OAAO,CASjB,CAAC;AAMF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,UAAU,KAAG,aAG7D,CAAC;AAMH,eAAO,MAAM,eAAe,GAAI,OAAO,UAAU,KAAG,MAInD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,UAYjD,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * Core verifies signatures; it does not run a server. Nonce storage,
17
17
  * single-use enforcement and token issuance are the server's.
18
18
  */
19
- import { isValidDid, signWithDid, verifyDidSignature } from './did.js';
19
+ import { isValidDid, signWithDid, verifyDidSignature } from '../did/did.js';
20
20
  // -------------------------------------------------------
21
21
  // Errors
22
22
  // -------------------------------------------------------
@@ -70,13 +70,10 @@ export const authOriginFromUrl = (url) => {
70
70
  return parsed.origin;
71
71
  };
72
72
  /**
73
- * Build the exact bytes a client signs and a server verifies.
74
- *
75
- * The origin is in the payload because the nonce alone doesn't scope a
76
- * signature to a server: one that a client connects to can fetch a
77
- * challenge from the client's real stack, pass that nonce along, and
78
- * redeem the returned signature as a token. Signing the origin the client
79
- * believes it is talking to makes such a signature verify nowhere else.
73
+ * Build the exact bytes a client signs and a server verifies. The origin is
74
+ * signed because a nonce alone doesn't scope a signature: a server a client
75
+ * connects to could relay a challenge from the client's real stack and
76
+ * redeem the signature there.
80
77
  */
81
78
  export const buildAuthChallengePayload = (challenge) => {
82
79
  const origin = authOriginFromUrl(challenge.origin);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/wire/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAmB,MAAM,eAAe,CAAC;AAE7F,0DAA0D;AAC1D,SAAS;AACT,0DAA0D;AAE1D;;;;;;GAMG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAO,GAAG,EAAE;QACtB,KAAK,CAAC,OAAO,IAAI,mCAAmC,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,0DAA0D;AAC1D,qBAAqB;AACrB,0DAA0D;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAWxC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAU,EAAE;IACvD,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC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CAAC,CAAC;IAC7D,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Stack — Wire Request Bodies
3
3
  * -------------------------------------------------------
4
4
  * The JSON bodies of the endpoints core specifies but runs no server for:
5
- * the auth handshake, `PATCH /entity`, `POST /types`,
5
+ * the auth handshake, the per-aspect record writes, `POST /types`,
6
6
  * `POST /records/:id/migrate` and `POST /installs`. Each parser names every key its endpoint
7
7
  * defines, so a server refuses the rest without keeping its own copy of
8
8
  * the list — a copy that drifts the first time core adds a field.
@@ -16,9 +16,9 @@
16
16
  * DID's form — so judging them here would let two answers drift.
17
17
  * See docs/spec/wire-format.md § Unrecognized input.
18
18
  */
19
- import type { DefineTypeOptions } from './stack.js';
20
- import type { AppManifest } from './install.js';
21
- import type { AssociationEdit, TypeId } from './types.js';
19
+ import type { DefineTypeOptions } from '../stack/client.js';
20
+ import type { AppManifest } from '../install.js';
21
+ import type { AssociationEdit, AuthorityAssociation, DataAssociation, TypeId } from '../types/index.js';
22
22
  export declare function requireBody(body: unknown, label: string): Record<string, unknown>;
23
23
  /**
24
24
  * The refusal a present field earns when its value is the wrong shape.
@@ -46,15 +46,38 @@ export declare function parseAuthChallengeBody(body: unknown): WireAuthChallenge
46
46
  * refused rather than read as a request the handshake cannot grant.
47
47
  */
48
48
  export declare function parseAuthTokenBody(body: unknown): WireAuthTokenRequest;
49
- /** A content patch for the owner entity, in the shape `patchContent()` takes. */
50
- export type WireEntityPatch = {
51
- contentPatch: Record<string, unknown | null>;
49
+ /**
50
+ * Parse a content patch body: the bare patch, every key a content key.
51
+ * Which keys the record's type declares is `patchContent()`'s to judge, so
52
+ * an undeclared one is its 422 rather than a 400 here.
53
+ * See docs/spec/wire-format.md § Content.
54
+ */
55
+ export declare function parseContentPatchBody(body: unknown): Record<string, unknown | null>;
56
+ /**
57
+ * Parse a `PUT /records/:id/parent` body. `null` is the root, not a
58
+ * removal spelling. See docs/spec/wire-format.md § Parent.
59
+ */
60
+ export declare function parseParentBody(body: unknown): {
61
+ parentId: string | null;
62
+ };
63
+ /** Parse a `PUT /records/:id/unlisted` body. See docs/spec/wire-format.md § Unlisted. */
64
+ export declare function parseUnlistedBody(body: unknown): {
65
+ unlisted: boolean;
52
66
  };
53
- /** Parse a `PATCH /entity` body. See docs/spec/wire-format.md § Entity. */
54
- export declare function parseEntityPatchBody(body: unknown): WireEntityPatch;
55
67
  /**
56
- * Parse an association or permission amend body into the edits
57
- * `amendAssociations()` takes. `repoint` is something the journal records,
68
+ * Parse a `PUT /records/:id/associations` body into the set
69
+ * `setAssociations()` takes. Elements are `setAssociations()`'s to judge.
70
+ * See docs/spec/wire-format.md § Associations.
71
+ */
72
+ export declare function parseAssociationsBody(body: unknown): DataAssociation[];
73
+ /**
74
+ * Parse a `PUT /records/:id/permissions` body into the set `setAccess()`
75
+ * takes; `[]` makes the record private. See docs/spec/wire-format.md § Permissions.
76
+ */
77
+ export declare function parsePermissionsBody(body: unknown): AuthorityAssociation[];
78
+ /**
79
+ * Parse an association or permission edit body into the edits
80
+ * `editAssociations()` and `editAccess()` take. `repoint` is something the journal records,
58
81
  * never something a caller sends, so it is refused with the other unknown
59
82
  * ops. Which surface an element belongs to is the endpoint's to judge.
60
83
  * See docs/spec/wire-format.md § Associations.
@@ -84,4 +107,4 @@ export declare function parseMigrationBody(body: unknown): WireMigrationRequest;
84
107
  * allow, are `planInstall()`'s to judge. See docs/spec/wire-format.md § Installs.
85
108
  */
86
109
  export declare function parseInstallBody(body: unknown): AppManifest;
87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