@haverstack/core 0.41.0 → 0.42.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 (287) hide show
  1. package/README.md +121 -59
  2. package/dist/access.d.ts +34 -36
  3. package/dist/access.d.ts.map +1 -1
  4. package/dist/access.js +65 -42
  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} +7 -0
  9. package/dist/adapter/combine.js.map +1 -0
  10. package/dist/{adapter-entry.d.ts → adapter/index.d.ts} +6 -5
  11. package/dist/adapter/index.d.ts.map +1 -0
  12. package/dist/{adapter-entry.js → adapter/index.js} +5 -4
  13. package/dist/adapter/index.js.map +1 -0
  14. package/dist/{sort.d.ts → adapter/sort.d.ts} +20 -20
  15. package/dist/adapter/sort.d.ts.map +1 -0
  16. package/dist/{sort.js → adapter/sort.js} +37 -27
  17. package/dist/adapter/sort.js.map +1 -0
  18. package/dist/associations/identity.d.ts +93 -0
  19. package/dist/associations/identity.d.ts.map +1 -0
  20. package/dist/associations/identity.js +198 -0
  21. package/dist/associations/identity.js.map +1 -0
  22. package/dist/associations/validation.d.ts +90 -0
  23. package/dist/associations/validation.d.ts.map +1 -0
  24. package/dist/associations/validation.js +339 -0
  25. package/dist/associations/validation.js.map +1 -0
  26. package/dist/attachment-records.d.ts +48 -0
  27. package/dist/attachment-records.d.ts.map +1 -0
  28. package/dist/attachment-records.js +52 -0
  29. package/dist/attachment-records.js.map +1 -0
  30. package/dist/collection.d.ts +182 -0
  31. package/dist/collection.d.ts.map +1 -0
  32. package/dist/collection.js +407 -0
  33. package/dist/collection.js.map +1 -0
  34. package/dist/content-match.d.ts +25 -0
  35. package/dist/content-match.d.ts.map +1 -0
  36. package/dist/content-match.js +51 -0
  37. package/dist/content-match.js.map +1 -0
  38. package/dist/content-translation.d.ts +42 -0
  39. package/dist/content-translation.d.ts.map +1 -0
  40. package/dist/content-translation.js +108 -0
  41. package/dist/content-translation.js.map +1 -0
  42. package/dist/did/did.d.ts.map +1 -0
  43. package/dist/{did.js → did/did.js} +3 -4
  44. package/dist/did/did.js.map +1 -0
  45. package/dist/{did-entry.d.ts → did/index.d.ts} +1 -1
  46. package/dist/did/index.d.ts.map +1 -0
  47. package/dist/{did-entry.js → did/index.js} +3 -3
  48. package/dist/did/index.js.map +1 -0
  49. package/dist/errors.d.ts +36 -63
  50. package/dist/errors.d.ts.map +1 -1
  51. package/dist/errors.js +35 -58
  52. package/dist/errors.js.map +1 -1
  53. package/dist/grants.d.ts +18 -42
  54. package/dist/grants.d.ts.map +1 -1
  55. package/dist/grants.js +68 -133
  56. package/dist/grants.js.map +1 -1
  57. package/dist/id.d.ts +13 -31
  58. package/dist/id.d.ts.map +1 -1
  59. package/dist/id.js +13 -31
  60. package/dist/id.js.map +1 -1
  61. package/dist/index.d.ts +12 -8
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +8 -5
  64. package/dist/index.js.map +1 -1
  65. package/dist/install.d.ts +3 -6
  66. package/dist/install.d.ts.map +1 -1
  67. package/dist/install.js +6 -10
  68. package/dist/install.js.map +1 -1
  69. package/dist/merge.d.ts.map +1 -1
  70. package/dist/merge.js +5 -11
  71. package/dist/merge.js.map +1 -1
  72. package/dist/migration-steps.d.ts +102 -0
  73. package/dist/migration-steps.d.ts.map +1 -0
  74. package/dist/migration-steps.js +293 -0
  75. package/dist/migration-steps.js.map +1 -0
  76. package/dist/query-validation.d.ts +28 -94
  77. package/dist/query-validation.d.ts.map +1 -1
  78. package/dist/query-validation.js +156 -336
  79. package/dist/query-validation.js.map +1 -1
  80. package/dist/record-changes.d.ts +2 -117
  81. package/dist/record-changes.d.ts.map +1 -1
  82. package/dist/record-changes.js +10 -212
  83. package/dist/record-changes.js.map +1 -1
  84. package/dist/schema.d.ts +18 -7
  85. package/dist/schema.d.ts.map +1 -1
  86. package/dist/schema.js +59 -30
  87. package/dist/schema.js.map +1 -1
  88. package/dist/scoped-stack/authority.d.ts +156 -0
  89. package/dist/scoped-stack/authority.d.ts.map +1 -0
  90. package/dist/scoped-stack/authority.js +384 -0
  91. package/dist/scoped-stack/authority.js.map +1 -0
  92. package/dist/scoped-stack/scoped-stack.d.ts +338 -0
  93. package/dist/scoped-stack/scoped-stack.d.ts.map +1 -0
  94. package/dist/scoped-stack/scoped-stack.js +776 -0
  95. package/dist/scoped-stack/scoped-stack.js.map +1 -0
  96. package/dist/scoped-stack/subscription.d.ts +55 -0
  97. package/dist/scoped-stack/subscription.d.ts.map +1 -0
  98. package/dist/scoped-stack/subscription.js +110 -0
  99. package/dist/scoped-stack/subscription.js.map +1 -0
  100. package/dist/stack/attachments.d.ts +24 -0
  101. package/dist/stack/attachments.d.ts.map +1 -0
  102. package/dist/stack/attachments.js +113 -0
  103. package/dist/stack/attachments.js.map +1 -0
  104. package/dist/{changes.d.ts → stack/changes.d.ts} +29 -65
  105. package/dist/stack/changes.d.ts.map +1 -0
  106. package/dist/{changes.js → stack/changes.js} +32 -66
  107. package/dist/stack/changes.js.map +1 -0
  108. package/dist/stack/client.d.ts +271 -0
  109. package/dist/stack/client.d.ts.map +1 -0
  110. package/dist/stack/client.js +9 -0
  111. package/dist/stack/client.js.map +1 -0
  112. package/dist/stack/identity-bindings.d.ts.map +1 -0
  113. package/dist/{identity-bindings.js → stack/identity-bindings.js} +5 -14
  114. package/dist/stack/identity-bindings.js.map +1 -0
  115. package/dist/stack/install-app.d.ts +22 -0
  116. package/dist/stack/install-app.d.ts.map +1 -0
  117. package/dist/stack/install-app.js +260 -0
  118. package/dist/stack/install-app.js.map +1 -0
  119. package/dist/stack/integrity.d.ts +94 -0
  120. package/dist/stack/integrity.d.ts.map +1 -0
  121. package/dist/stack/integrity.js +268 -0
  122. package/dist/stack/integrity.js.map +1 -0
  123. package/dist/{limits.d.ts → stack/limits.d.ts} +2 -5
  124. package/dist/stack/limits.d.ts.map +1 -0
  125. package/dist/{limits.js → stack/limits.js} +3 -6
  126. package/dist/stack/limits.js.map +1 -0
  127. package/dist/stack/migrations.d.ts +59 -0
  128. package/dist/stack/migrations.d.ts.map +1 -0
  129. package/dist/stack/migrations.js +141 -0
  130. package/dist/stack/migrations.js.map +1 -0
  131. package/dist/{stack-reads.d.ts → stack/reads.d.ts} +33 -6
  132. package/dist/stack/reads.d.ts.map +1 -0
  133. package/dist/{stack-reads.js → stack/reads.js} +49 -7
  134. package/dist/stack/reads.js.map +1 -0
  135. package/dist/stack/record-id.d.ts +35 -0
  136. package/dist/stack/record-id.d.ts.map +1 -0
  137. package/dist/stack/record-id.js +82 -0
  138. package/dist/stack/record-id.js.map +1 -0
  139. package/dist/stack/stack.d.ts +438 -0
  140. package/dist/stack/stack.d.ts.map +1 -0
  141. package/dist/stack/stack.js +1366 -0
  142. package/dist/stack/stack.js.map +1 -0
  143. package/dist/stack/system-types.d.ts +16 -0
  144. package/dist/stack/system-types.d.ts.map +1 -0
  145. package/dist/stack/system-types.js +111 -0
  146. package/dist/stack/system-types.js.map +1 -0
  147. package/dist/stack/type-grants.d.ts +20 -0
  148. package/dist/stack/type-grants.d.ts.map +1 -0
  149. package/dist/stack/type-grants.js +69 -0
  150. package/dist/stack/type-grants.js.map +1 -0
  151. package/dist/stack/write-expectation.d.ts +78 -0
  152. package/dist/stack/write-expectation.d.ts.map +1 -0
  153. package/dist/stack/write-expectation.js +71 -0
  154. package/dist/stack/write-expectation.js.map +1 -0
  155. package/dist/testing.d.ts +21 -26
  156. package/dist/testing.d.ts.map +1 -1
  157. package/dist/testing.js +50 -70
  158. package/dist/testing.js.map +1 -1
  159. package/dist/type-handle.d.ts +67 -78
  160. package/dist/type-handle.d.ts.map +1 -1
  161. package/dist/type-handle.js +44 -111
  162. package/dist/type-handle.js.map +1 -1
  163. package/dist/types/adapter.d.ts +223 -0
  164. package/dist/types/adapter.d.ts.map +1 -0
  165. package/dist/types/adapter.js +5 -0
  166. package/dist/types/adapter.js.map +1 -0
  167. package/dist/types/associations.d.ts +156 -0
  168. package/dist/types/associations.d.ts.map +1 -0
  169. package/dist/types/associations.js +13 -0
  170. package/dist/types/associations.js.map +1 -0
  171. package/dist/types/capabilities.d.ts +89 -0
  172. package/dist/types/capabilities.d.ts.map +1 -0
  173. package/dist/types/capabilities.js +5 -0
  174. package/dist/types/capabilities.js.map +1 -0
  175. package/dist/types/events.d.ts +155 -0
  176. package/dist/types/events.d.ts.map +1 -0
  177. package/dist/types/events.js +5 -0
  178. package/dist/types/events.js.map +1 -0
  179. package/dist/types/ids.d.ts +43 -0
  180. package/dist/types/ids.d.ts.map +1 -0
  181. package/dist/types/ids.js +5 -0
  182. package/dist/types/ids.js.map +1 -0
  183. package/dist/types/index.d.ts +19 -0
  184. package/dist/types/index.d.ts.map +1 -0
  185. package/dist/types/index.js +19 -0
  186. package/dist/types/index.js.map +1 -0
  187. package/dist/types/journal.d.ts +47 -0
  188. package/dist/types/journal.d.ts.map +1 -0
  189. package/dist/types/journal.js +5 -0
  190. package/dist/types/journal.js.map +1 -0
  191. package/dist/types/query.d.ts +185 -0
  192. package/dist/types/query.d.ts.map +1 -0
  193. package/dist/types/query.js +10 -0
  194. package/dist/types/query.js.map +1 -0
  195. package/dist/types/records.d.ts +76 -0
  196. package/dist/types/records.d.ts.map +1 -0
  197. package/dist/types/records.js +5 -0
  198. package/dist/types/records.js.map +1 -0
  199. package/dist/types/schema.d.ts +74 -0
  200. package/dist/types/schema.d.ts.map +1 -0
  201. package/dist/types/schema.js +5 -0
  202. package/dist/types/schema.js.map +1 -0
  203. package/dist/types/system.d.ts +161 -0
  204. package/dist/types/system.d.ts.map +1 -0
  205. package/dist/types/system.js +32 -0
  206. package/dist/types/system.js.map +1 -0
  207. package/dist/types/tokens.d.ts +39 -0
  208. package/dist/types/tokens.d.ts.map +1 -0
  209. package/dist/types/tokens.js +5 -0
  210. package/dist/types/tokens.js.map +1 -0
  211. package/dist/validate.d.ts +29 -70
  212. package/dist/validate.d.ts.map +1 -1
  213. package/dist/validate.js +50 -91
  214. package/dist/validate.js.map +1 -1
  215. package/dist/{attachment-download.d.ts → wire/attachment-download.d.ts} +0 -57
  216. package/dist/wire/attachment-download.d.ts.map +1 -0
  217. package/dist/{attachment-download.js → wire/attachment-download.js} +0 -61
  218. package/dist/wire/attachment-download.js.map +1 -0
  219. package/dist/{auth.d.ts → wire/auth.d.ts} +5 -8
  220. package/dist/wire/auth.d.ts.map +1 -0
  221. package/dist/{auth.js → wire/auth.js} +5 -8
  222. package/dist/wire/auth.js.map +1 -0
  223. package/dist/{wire-body.d.ts → wire/body.d.ts} +4 -4
  224. package/dist/wire/body.d.ts.map +1 -0
  225. package/dist/{wire-body.js → wire/body.js} +5 -5
  226. package/dist/wire/body.js.map +1 -0
  227. package/dist/{wire-entry.d.ts → wire/index.d.ts} +12 -12
  228. package/dist/wire/index.d.ts.map +1 -0
  229. package/dist/{wire-entry.js → wire/index.js} +13 -17
  230. package/dist/wire/index.js.map +1 -0
  231. package/dist/{wire-record.d.ts → wire/record.d.ts} +10 -22
  232. package/dist/wire/record.d.ts.map +1 -0
  233. package/dist/{wire-record.js → wire/record.js} +12 -24
  234. package/dist/wire/record.js.map +1 -0
  235. package/dist/{wire-request.d.ts → wire/request.d.ts} +20 -37
  236. package/dist/wire/request.d.ts.map +1 -0
  237. package/dist/{wire-request.js → wire/request.js} +79 -54
  238. package/dist/wire/request.js.map +1 -0
  239. package/package.json +7 -7
  240. package/dist/adapter-entry.d.ts.map +0 -1
  241. package/dist/adapter-entry.js.map +0 -1
  242. package/dist/attachment-download.d.ts.map +0 -1
  243. package/dist/attachment-download.js.map +0 -1
  244. package/dist/auth.d.ts.map +0 -1
  245. package/dist/auth.js.map +0 -1
  246. package/dist/changes.d.ts.map +0 -1
  247. package/dist/changes.js.map +0 -1
  248. package/dist/combine.d.ts.map +0 -1
  249. package/dist/combine.js.map +0 -1
  250. package/dist/did-entry.d.ts.map +0 -1
  251. package/dist/did-entry.js.map +0 -1
  252. package/dist/did.d.ts.map +0 -1
  253. package/dist/did.js.map +0 -1
  254. package/dist/identity-bindings.d.ts.map +0 -1
  255. package/dist/identity-bindings.js.map +0 -1
  256. package/dist/limits.d.ts.map +0 -1
  257. package/dist/limits.js.map +0 -1
  258. package/dist/record-id.d.ts +0 -70
  259. package/dist/record-id.d.ts.map +0 -1
  260. package/dist/record-id.js +0 -127
  261. package/dist/record-id.js.map +0 -1
  262. package/dist/scoped-stack.d.ts +0 -549
  263. package/dist/scoped-stack.d.ts.map +0 -1
  264. package/dist/scoped-stack.js +0 -1301
  265. package/dist/scoped-stack.js.map +0 -1
  266. package/dist/sort.d.ts.map +0 -1
  267. package/dist/sort.js.map +0 -1
  268. package/dist/stack-reads.d.ts.map +0 -1
  269. package/dist/stack-reads.js.map +0 -1
  270. package/dist/stack.d.ts +0 -1032
  271. package/dist/stack.d.ts.map +0 -1
  272. package/dist/stack.js +0 -2337
  273. package/dist/stack.js.map +0 -1
  274. package/dist/types.d.ts +0 -1278
  275. package/dist/types.d.ts.map +0 -1
  276. package/dist/types.js +0 -51
  277. package/dist/types.js.map +0 -1
  278. package/dist/wire-body.d.ts.map +0 -1
  279. package/dist/wire-body.js.map +0 -1
  280. package/dist/wire-entry.d.ts.map +0 -1
  281. package/dist/wire-entry.js.map +0 -1
  282. package/dist/wire-record.d.ts.map +0 -1
  283. package/dist/wire-record.js.map +0 -1
  284. package/dist/wire-request.d.ts.map +0 -1
  285. package/dist/wire-request.js.map +0 -1
  286. /package/dist/{did.d.ts → did/did.d.ts} +0 -0
  287. /package/dist/{identity-bindings.d.ts → stack/identity-bindings.d.ts} +0 -0
@@ -16,15 +16,15 @@ export { authOriginFromUrl } from './auth.js';
16
16
  export { InvalidAuthChallengeError } from './auth.js';
17
17
  export { isSafeAttachmentContentType, inferContentTypeFromFilename, resolveAttachmentDownloadContentType, NOSNIFF_HEADER_NAME, NOSNIFF_HEADER_VALUE, } from './attachment-download.js';
18
18
  export type { AttachmentDownloadContentType } from './attachment-download.js';
19
- export { firstRecordedAttachment, resolveReferencedAttachment } from './attachment-download.js';
20
- export type { StackTokenStore, TokenInfo, TokenSession } from './types.js';
21
- export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parsePositiveInt, } from './wire-request.js';
22
- export { assertQueryTravels } from './wire-request.js';
23
- export type { ParsedChangeParams, ParsedDownloadParams, ParsedAssociationParams, } from './wire-request.js';
24
- export { parseDate } from './wire-request.js';
25
- export { createOptionsFromWireRecord, changesFromWireBody } from './wire-record.js';
26
- export type { WireCreateRequest } from './wire-record.js';
27
- export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody, parseEntityPatchBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './wire-body.js';
28
- export type { WireAuthChallengeRequest, WireAuthTokenRequest, WireEntityPatch, WireMigrationRequest, } from './wire-body.js';
29
- export { isOwnerActingAlone } from './access.js';
30
- //# sourceMappingURL=wire-entry.d.ts.map
19
+ export { firstRecordedAttachment, resolveReferencedAttachment } from '../attachment-records.js';
20
+ export type { StackTokenStore, TokenInfo, TokenSession } from '../types/index.js';
21
+ export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parsePositiveInt, } from './request.js';
22
+ export { assertQueryTravels } from './request.js';
23
+ export type { ParsedChangeParams, ParsedDownloadParams, ParsedAssociationParams, } from './request.js';
24
+ export { parseDate } from './request.js';
25
+ export { createOptionsFromWireRecord, changesFromWireBody } from './record.js';
26
+ export type { WireCreateRequest } from './record.js';
27
+ export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody, parseEntityPatchBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './body.js';
28
+ export type { WireAuthChallengeRequest, WireAuthTokenRequest, WireEntityPatch, WireMigrationRequest, } from './body.js';
29
+ export { isOwnerActingAlone } from '../access.js';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAM9E,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAIhG,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMlF,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -12,8 +12,7 @@
12
12
  */
13
13
  export { buildAuthChallengePayload, signAuthChallenge, verifyAuthChallenge, didCredentialFromKeypair, base64urlEncode, base64urlDecode, } from './auth.js';
14
14
  // No in-repo caller: a server must derive the signing origin from its own
15
- // configured public origin (haverstack/server#53) — this is the primitive
16
- // it does that with.
15
+ // configured public origin — this is the primitive it does that with.
17
16
  export { authOriginFromUrl } from './auth.js';
18
17
  // Thrown by authOriginFromUrl, buildAuthChallengePayload and
19
18
  // base64urlDecode above — all public, so a caller needs this to
@@ -23,33 +22,30 @@ export { isSafeAttachmentContentType, inferContentTypeFromFilename, resolveAttac
23
22
  // No in-repo caller: resolveAttachmentDownloadContentType() takes
24
23
  // storedMimeType as an input rather than selecting the record itself — a
25
24
  // server must call these to pick the record a download describes and pass
26
- // the winner in. Contract, not internal. haverstack/server#37
27
- export { firstRecordedAttachment, resolveReferencedAttachment } from './attachment-download.js';
25
+ // the winner in. Contract, not internal.
26
+ export { firstRecordedAttachment, resolveReferencedAttachment } from '../attachment-records.js';
28
27
  // No in-repo caller: the parse half of the request encoding adapter-api
29
- // builds, so a server decodes GET /records, POST /records/query,
30
- // GET /changes, GET /records/:id/journal, GET /records/:id/versions, GET /records/:id,
31
- // DELETE /records/:id, GET /attachments/:fileId and GET /records/:id/associations with these
32
- // rather than transcribing the parameter table.
33
- // Contract, not internal — and the round trip against the builders is
34
- // pinned by a test, which is what having both halves here buys.
35
- export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parsePositiveInt, } from './wire-request.js';
28
+ // builds, so a server decodes every query-bearing route with these rather
29
+ // than transcribing the parameter table. Contract, not internal — the
30
+ // round trip against the builders is pinned by a test.
31
+ export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parsePositiveInt, } from './request.js';
36
32
  // The build-side half of the fields that never travel: adapter-api refuses
37
33
  // them before encoding, so which encoding a server's content reach selects
38
34
  // never decides whether a family query widens or is refused.
39
- export { assertQueryTravels } from './wire-request.js';
35
+ export { assertQueryTravels } from './request.js';
40
36
  // Re-exported by @haverstack/wire-types for the response side: one wire
41
37
  // date decoding, used by both halves.
42
- export { parseDate } from './wire-request.js';
38
+ export { parseDate } from './request.js';
43
39
  // No in-repo caller: the create half of the same contract, so a server
44
40
  // inherits which half of a record body it may trust rather than deciding
45
41
  // field by field. See docs/spec/wire-format.md § Records.
46
- export { createOptionsFromWireRecord, changesFromWireBody } from './wire-record.js';
42
+ export { createOptionsFromWireRecord, changesFromWireBody } from './record.js';
47
43
  // No in-repo caller: the bodies of the remaining endpoints core specifies,
48
44
  // so a server refuses a key they do not define without keeping its own
49
45
  // list of the ones they do. See docs/spec/wire-format.md § Unrecognized input.
50
- export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody, parseEntityPatchBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './wire-body.js';
46
+ export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody, parseEntityPatchBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './body.js';
51
47
  // The tier gating purge, commitMigration() and includeUnlisted, which
52
48
  // a server must decide for those routes itself. Computing it as "is the
53
49
  // owner" is a privilege bug with no symptom.
54
- export { isOwnerActingAlone } from './access.js';
55
- //# sourceMappingURL=wire-entry.js.map
50
+ export { isOwnerActingAlone } from '../access.js';
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,0EAA0E;AAC1E,sEAAsE;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,6DAA6D;AAC7D,gEAAgE;AAChE,oDAAoD;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAGlC,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,yCAAyC;AACzC,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAMhG,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,uDAAuD;AACvD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,2EAA2E;AAC3E,2EAA2E;AAC3E,6DAA6D;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,wEAAwE;AACxE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,uEAAuE;AACvE,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG/E,2EAA2E;AAC3E,uEAAuE;AACvE,+EAA+E;AAC/E,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAQnB,sEAAsE;AACtE,wEAAwE;AACxE,6CAA6C;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -10,8 +10,8 @@
10
10
  * for servers in other languages, so they live in the spec rather than
11
11
  * here: docs/spec/wire-format.md § Records.
12
12
  */
13
- import type { BackdatableCreateRecordOptions } from './stack.js';
14
- import type { EntityId, RecordChangeSet, TokenSession, TypeId } from './types.js';
13
+ import type { BackdatableCreateRecordOptions } from '../stack/client.js';
14
+ import type { EntityId, RecordChangeSet, TokenSession, TypeId } from '../types/index.js';
15
15
  /**
16
16
  * A `POST /records` body as the three arguments `ScopedStack.create()`
17
17
  * takes. Not spread-ready, so a call site reads as three deliberate things.
@@ -23,28 +23,16 @@ export type WireCreateRequest = {
23
23
  options: Omit<BackdatableCreateRecordOptions, 'createdBy'>;
24
24
  };
25
25
  /**
26
- * Read a `POST /records` body as a create. Takes the session rather than a
27
- * pre-computed boolean so the owner-acting-alone determination stays with
28
- * the rule that needs it.
29
- *
30
- * Beyond shape, values are `Stack`'s to judge — an id's legality, a
31
- * permission's contents, the content's schema — since judging them twice
32
- * would let the two answers drift.
26
+ * Read a `POST /records` body as a create. Takes the session, not a
27
+ * precomputed boolean, so the owner-acting-alone decision stays with its
28
+ * rule. Values beyond shape are `Stack`'s to judge, or two answers drift.
33
29
  */
34
30
  export declare function createOptionsFromWireRecord(body: unknown, session: TokenSession, ownerEntityId: EntityId): WireCreateRequest;
35
31
  /**
36
- * Read a `PATCH /records/:id` body as a change set. The envelope's keys
37
- * are native aspects, so an unrecognized one is a client reaching for
38
- * something this endpoint does not have — refused rather than ignored,
39
- * since a dropped `permissions` silently fails to share and a dropped
40
- * `unlisted` silently fails to publish.
41
- *
42
- * `StackBadRequestError` (400) for a key that addresses nothing and
43
- * `StackValidationError` (422) for one whose value is the wrong shape —
44
- * the same split every other write endpoint makes. Content keys are
45
- * `Stack`'s to judge, so `contentPatch` is checked for being an object and
46
- * nothing more.
47
- * See docs/spec/wire-format.md § Records.
32
+ * Read a `PATCH /records/:id` body as a change set. An unrecognized key is
33
+ * refused (400), not ignored — a dropped `permissions` silently fails to
34
+ * share — and a wrong-shaped value is a 422. `contentPatch` is checked for
35
+ * being an object only; content is `Stack`'s. See docs/spec/wire-format.md § Records.
48
36
  */
49
37
  export declare function changesFromWireBody(body: unknown): RecordChangeSet;
50
- //# sourceMappingURL=wire-record.d.ts.map
38
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/wire/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,KAAK,EACV,QAAQ,EAGR,eAAe,EAEf,YAAY,EACZ,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,0EAA0E;IAC1E,OAAO,EAAE,IAAI,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAAC;CAC5D,CAAC;AAsDF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,QAAQ,GACtB,iBAAiB,CAyCnB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAoDlE"}
@@ -10,10 +10,10 @@
10
10
  * for servers in other languages, so they live in the spec rather than
11
11
  * here: docs/spec/wire-format.md § Records.
12
12
  */
13
- import { isOwnerActingAlone } from './access.js';
14
- import { StackBadRequestError } from './errors.js';
15
- import { fieldError, requireBody } from './wire-body.js';
16
- import { RECORD_CHANGE_SET_KEYS } from './types.js';
13
+ import { isOwnerActingAlone } from '../access.js';
14
+ import { StackBadRequestError } from '../errors.js';
15
+ import { fieldError, requireBody } from './body.js';
16
+ import { RECORD_CHANGE_SET_KEYS } from '../types/index.js';
17
17
  /**
18
18
  * Every top-level key a wire record carries — a `StackRecord`'s, so a new
19
19
  * field fails to compile here until it is listed. A create body is a whole
@@ -69,13 +69,9 @@ function ownerDate(body, key) {
69
69
  return date;
70
70
  }
71
71
  /**
72
- * Read a `POST /records` body as a create. Takes the session rather than a
73
- * pre-computed boolean so the owner-acting-alone determination stays with
74
- * the rule that needs it.
75
- *
76
- * Beyond shape, values are `Stack`'s to judge — an id's legality, a
77
- * permission's contents, the content's schema — since judging them twice
78
- * would let the two answers drift.
72
+ * Read a `POST /records` body as a create. Takes the session, not a
73
+ * precomputed boolean, so the owner-acting-alone decision stays with its
74
+ * rule. Values beyond shape are `Stack`'s to judge, or two answers drift.
79
75
  */
80
76
  export function createOptionsFromWireRecord(body, session, ownerEntityId) {
81
77
  const record = requireBody(body, 'record body');
@@ -119,18 +115,10 @@ export function createOptionsFromWireRecord(body, session, ownerEntityId) {
119
115
  return { typeId, content: content, options };
120
116
  }
121
117
  /**
122
- * Read a `PATCH /records/:id` body as a change set. The envelope's keys
123
- * are native aspects, so an unrecognized one is a client reaching for
124
- * something this endpoint does not have — refused rather than ignored,
125
- * since a dropped `permissions` silently fails to share and a dropped
126
- * `unlisted` silently fails to publish.
127
- *
128
- * `StackBadRequestError` (400) for a key that addresses nothing and
129
- * `StackValidationError` (422) for one whose value is the wrong shape —
130
- * the same split every other write endpoint makes. Content keys are
131
- * `Stack`'s to judge, so `contentPatch` is checked for being an object and
132
- * nothing more.
133
- * See docs/spec/wire-format.md § Records.
118
+ * Read a `PATCH /records/:id` body as a change set. An unrecognized key is
119
+ * refused (400), not ignored — a dropped `permissions` silently fails to
120
+ * share — and a wrong-shaped value is a 422. `contentPatch` is checked for
121
+ * being an object only; content is `Stack`'s. See docs/spec/wire-format.md § Records.
134
122
  */
135
123
  export function changesFromWireBody(body) {
136
124
  const envelope = requireBody(body, 'record body');
@@ -173,4 +161,4 @@ export function changesFromWireBody(body) {
173
161
  }
174
162
  return changes;
175
163
  }
176
- //# sourceMappingURL=wire-record.js.map
164
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/wire/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAsB3D;;;;;GAKG;AACH,MAAM,gBAAgB,GAAsB,MAAM,CAAC,IAAI,CAAC;IACtD,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;CACuB,CAAC,CAAC;AAE7C,SAAS,cAAc,CAAC,IAA6B,EAAE,GAAW;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,KAAK,KAAK,SAAS;Q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4B,CAAC,CAAC;QACvD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACvC,CAAC;IAED,wEAAwE;IACxE,uEAAuE;IACvE,sDAAsD;IACtD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,oBAAoB,CAC5B,+DAA+D,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACpG,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -24,7 +24,7 @@
24
24
  * servers already map to 400 — see docs/spec/wire-format.md § Error
25
25
  * responses.
26
26
  */
27
- import type { DataAssociation, ChangeFilter, JournalQuery, VersionsQuery, StackQuery } from './types.js';
27
+ import type { DataAssociation, ChangeFilter, JournalQuery, VersionsQuery, StackQuery } from '../types/index.js';
28
28
  /** Parse an ISO date string from a wire body; undefined if absent or invalid. */
29
29
  export declare function parseDate(val: unknown): Date | undefined;
30
30
  /**
@@ -34,17 +34,11 @@ export declare function parseDate(val: unknown): Date | undefined;
34
34
  */
35
35
  export declare function parsePositiveInt(raw: string, label: string): number;
36
36
  /**
37
- * The client half of the same refusal, applied before a request is built
38
- * rather than after one arrives. `Stack.query()` resolves `filter.baseId`
39
- * against registered Types and applies `presentAt` itself, so neither
40
- * reaches an adapter through it — this catches the direct adapter call,
41
- * where the encoding would otherwise decide the answer: a query body
42
- * carries both fields to a server that refuses them, while search params
43
- * have nowhere to put them and would drop them into a wider result set.
44
- *
45
- * Absent and explicitly `undefined` are the same thing here, as they are
46
- * to `Stack.query()`. The parsers above test key presence instead, because
47
- * over the wire writing the key at all is a client that meant to send it.
37
+ * The client half of the same refusal, before a request is built.
38
+ * `Stack.query()` resolves `baseId` and `presentAt` itself, so this catches
39
+ * the direct adapter call, where search params would drop them into a wider
40
+ * result. Absent and `undefined` are one here; the parsers test presence,
41
+ * since over the wire a written key is one the client meant to send.
48
42
  */
49
43
  export declare function assertQueryTravels(query: StackQuery): void;
50
44
  /**
@@ -56,11 +50,9 @@ export declare function assertQueryTravels(query: StackQuery): void;
56
50
  */
57
51
  export declare function parseQueryParams(url: URL): StackQuery;
58
52
  /**
59
- * Build a `StackQuery` from a `POST /records/query` JSON body — the
60
- * superset form, which additionally carries `filter.content`. Dates arrive
61
- * as the ISO strings `JSON.stringify` made of them and are decoded back to
62
- * `Date`. `undefined` is the absent body; `null` or any other non-object
63
- * is refused, so a server hands over no body as `undefined`.
53
+ * Build a `StackQuery` from a `POST /records/query` body — the superset
54
+ * form, which also carries `filter.content`, with ISO date strings decoded.
55
+ * `undefined` is the absent body; any other non-object is refused.
64
56
  * See docs/spec/wire-format.md § Records.
65
57
  */
66
58
  export declare function parseQueryBody(raw: unknown): StackQuery;
@@ -82,21 +74,15 @@ export type ParsedChangeParams = {
82
74
  */
83
75
  export declare function parseChangeParams(url: URL): ParsedChangeParams;
84
76
  /**
85
- * Parse `GET /records/:id/journal`'s query params into the `JournalQuery`
86
- * `getJournal()` takes. Absent params stay absent rather than defaulting:
87
- * omitting `limit` reads the whole log by contract, so supplying a page
88
- * size here would truncate exactly the caller that omitted it.
89
- *
90
- * `afterSeq` is a journal `seq` — a dense per-record integer, never the
91
- * change feed's opaque cursor. See docs/spec/wire-format.md § Journal.
77
+ * Parse `GET /records/:id/journal`'s params into a `JournalQuery`. Absent
78
+ * stays absent: omitting `limit` reads the whole log, which a default page
79
+ * size would truncate. `afterSeq` is a journal `seq`, never a feed cursor.
80
+ * See docs/spec/wire-format.md § Journal.
92
81
  */
93
82
  export declare function parseJournalParams(url: URL): JournalQuery;
94
83
  /**
95
- * Parse `GET /records/:id/versions`'s query params into the `VersionsQuery`
96
- * `getVersions()` takes. Absent params stay absent, for the reason
97
- * parseJournalParams() leaves them so.
98
- *
99
- * `beforeVersion` is a snapshot's `version`, exclusive.
84
+ * Parse `GET /records/:id/versions`'s params into a `VersionsQuery`; absent
85
+ * stays absent, as in parseJournalParams(). `beforeVersion` is exclusive.
100
86
  * See docs/spec/wire-format.md § Versions.
101
87
  */
102
88
  export declare function parseVersionsParams(url: URL): VersionsQuery;
@@ -140,13 +126,10 @@ export type ParsedAssociationParams = {
140
126
  */
141
127
  export declare function parseAssociationParams(url: URL): ParsedAssociationParams;
142
128
  /**
143
- * Parse an `If-Match: "5"` header into the version for `ifVersion`.
144
- * A value that is not a bare, optionally quoted version is refused rather
145
- * than read as absent: the header exists to fence a write, so degrading a
146
- * malformed one to an unconditional last-writer-wins mutation defeats the
147
- * only thing it was sent to do. Weak comparators (`W/"5"`) are refused for
148
- * the same reason — a version match is exact or it is nothing.
149
- * See docs/spec/wire-format.md § Records.
129
+ * Parse `If-Match: "5"` into `ifVersion`. Anything but a bare, optionally
130
+ * quoted version — weak `W/"5"` included — is refused, not read as absent:
131
+ * degrading the fence to last-writer-wins defeats the one thing it was
132
+ * sent for. See docs/spec/wire-format.md § Records.
150
133
  */
151
134
  export declare function parseIfMatch(header: string | undefined): number | undefined;
152
135
  /**
@@ -156,4 +139,4 @@ export declare function parseIfMatch(header: string | undefined): number | undef
156
139
  * quoted form. See docs/spec/wire-format.md § Upload.
157
140
  */
158
141
  export declare function parseUploadFilename(header: string | undefined): string | undefined;
159
- //# sourceMappingURL=wire-request.d.ts.map
142
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/wire/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAEZ,YAAY,EACZ,aAAa,EASb,UAAU,EACX,MAAM,mBAAmB,CAAC;AAM3B,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAIxD;AA2ED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE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AA;CAAE,CAAC;AAEzF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,uBAAuB,CAYxE;AAMD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAYlF"}
@@ -24,9 +24,9 @@
24
24
  * servers already map to 400 — see docs/spec/wire-format.md § Error
25
25
  * responses.
26
26
  */
27
- import { StackBadRequestError } from './errors.js';
28
- import { TARGET_KEYS } from './query-validation.js';
29
- import { NATIVE_SORT_FIELDS } from './types.js';
27
+ import { StackBadRequestError } from '../errors.js';
28
+ import { TARGET_KEYS } from '../associations/validation.js';
29
+ import { NATIVE_SORT_FIELDS } from '../types/index.js';
30
30
  // -------------------------------------------------------
31
31
  // Shared primitives
32
32
  // -------------------------------------------------------
@@ -84,6 +84,7 @@ const QUERY_BODY_FILTER_KEYS = [
84
84
  'relatedTo',
85
85
  'content',
86
86
  'contentPresent',
87
+ 'contentByType',
87
88
  'search',
88
89
  'includeDeleted',
89
90
  'includeUnlisted',
@@ -127,15 +128,22 @@ function requireSortField(raw) {
127
128
  return raw;
128
129
  }
129
130
  /**
130
- * The two sort forms are mutually exclusive, and a request naming both is
131
- * refused rather than resolved in one direction: a content field may be
132
- * called `version`, so guessing which was meant is exactly the conflation
133
- * the separate member exists to prevent.
131
+ * The sort forms are mutually exclusive, and a request naming more than
132
+ * one is refused rather than resolved in one direction: a content field may
133
+ * be called `version`, so guessing which was meant is exactly the
134
+ * conflation the separate members exist to prevent.
134
135
  */
135
- function buildSort(field, contentField, direction) {
136
- if (field !== undefined && field !== null && contentField !== undefined && contentField !== null)
137
- throw new StackBadRequestError('A sort names either a native field or a content field, never both.');
136
+ function buildSort(field, contentField, direction, contentFieldByType) {
137
+ const named = [field, contentField, contentFieldByType].filter((member) => member !== undefined && member !== null);
138
+ if (named.length > 1)
139
+ throw new StackBadRequestError('A sort names one of a native field, a content field or a content field per type.');
138
140
  const dir = direction === undefined || direction === null ? undefined : requireSortDirection(direction);
141
+ if (contentFieldByType !== undefined && contentFieldByType !== null) {
142
+ return {
143
+ contentFieldByType: parseSortByTypeBody(contentFieldByType),
144
+ ...(dir && { direction: dir }),
145
+ };
146
+ }
139
147
  if (contentField !== undefined && contentField !== null) {
140
148
  return {
141
149
  contentField: requireString(contentField, 'sort content field'),
@@ -230,7 +238,7 @@ function optionalBoolean(raw, label) {
230
238
  // -------------------------------------------------------
231
239
  const BASE_ID_REFUSAL = 'baseId is resolved client-side against registered Types and never travels — send the ' +
232
240
  'concrete typeId set it resolves to. See docs/spec/data-model.md § Filter.';
233
- const PRESENT_AT_REFUSAL = 'presentAt applies migration functions, which are app code rather than server code, so no ' +
241
+ const PRESENT_AT_REFUSAL = 'presentAt applies migrations, which are app code rather than server code, so no ' +
234
242
  'server can honor it — read records as stored and migrate them client-side. See ' +
235
243
  'docs/spec/data-model.md § Type migrations.';
236
244
  /**
@@ -247,17 +255,11 @@ function assertNoUntravelableFields(hasBaseId, hasPresentAt) {
247
255
  throw new StackBadRequestError(PRESENT_AT_REFUSAL);
248
256
  }
249
257
  /**
250
- * The client half of the same refusal, applied before a request is built
251
- * rather than after one arrives. `Stack.query()` resolves `filter.baseId`
252
- * against registered Types and applies `presentAt` itself, so neither
253
- * reaches an adapter through it — this catches the direct adapter call,
254
- * where the encoding would otherwise decide the answer: a query body
255
- * carries both fields to a server that refuses them, while search params
256
- * have nowhere to put them and would drop them into a wider result set.
257
- *
258
- * Absent and explicitly `undefined` are the same thing here, as they are
259
- * to `Stack.query()`. The parsers above test key presence instead, because
260
- * over the wire writing the key at all is a client that meant to send it.
258
+ * The client half of the same refusal, before a request is built.
259
+ * `Stack.query()` resolves `baseId` and `presentAt` itself, so this catches
260
+ * the direct adapter call, where search params would drop them into a wider
261
+ * result. Absent and `undefined` are one here; the parsers test presence,
262
+ * since over the wire a written key is one the client meant to send.
261
263
  */
262
264
  export function assertQueryTravels(query) {
263
265
  assertNoUntravelableFields(query.filter?.baseId !== undefined, query.presentAt !== undefined);
@@ -308,12 +310,10 @@ function parseRelatedToBody(raw) {
308
310
  };
309
311
  }
310
312
  /**
311
- * The `relatedTo*` URL params. Scope is implied by which of them appear and
312
- * the three are mutually exclusive. An empty value passes through raw
313
- * rather than as absent — that is what lets core's target validation tell
313
+ * The `relatedTo*` URL params, mutually exclusive, scope implied by which
314
+ * appear. An empty value passes through raw so target validation can tell
314
315
  * "omitted" from "empty" for `relatedToStack` and `relatedToId`, where the
315
- * two mean different things and neither is a wildcard.
316
- * See docs/spec/wire-format.md § Records.
316
+ * two differ. See docs/spec/wire-format.md § Records.
317
317
  */
318
318
  function parseRelatedToParams(url) {
319
319
  const hasRecord = url.searchParams.has('relatedTo');
@@ -474,11 +474,43 @@ function parseLimitValue(raw) {
474
474
  return raw;
475
475
  }
476
476
  /**
477
- * Build a `StackQuery` from a `POST /records/query` JSON body — the
478
- * superset form, which additionally carries `filter.content`. Dates arrive
479
- * as the ISO strings `JSON.stringify` made of them and are decoded back to
480
- * `Date`. `undefined` is the absent body; `null` or any other non-object
481
- * is refused, so a server hands over no body as `undefined`.
477
+ * `filter.contentByType` as the body carries it: one flat arm per key.
478
+ * What the keys and arms may hold beyond their shape — a TypeId, at least
479
+ * one arm, never beside `content` — is assertValidContentByType()'s, which
480
+ * `Stack.query()` applies to every caller. See docs/spec/data-model.md
481
+ * § Content by type.
482
+ */
483
+ function parseContentByTypeBody(raw) {
484
+ const arms = {};
485
+ for (const [typeId, value] of Object.entries(requirePlainObject(raw, 'filter.contentByType'))) {
486
+ const label = `filter.contentByType["${typeId}"]`;
487
+ const arm = requireKnownKeys(value, ['content', 'contentPresent'], label);
488
+ arms[typeId] = {
489
+ ...(arm.content !== undefined && {
490
+ content: requirePlainObject(arm.content, `${label}.content`),
491
+ }),
492
+ ...(arm.contentPresent !== undefined && {
493
+ contentPresent: requireStringArray(arm.contentPresent, `${label}.contentPresent`),
494
+ }),
495
+ };
496
+ }
497
+ return arms;
498
+ }
499
+ /** `sort.contentFieldByType` as the body carries it; see assertValidSort() for the rest. */
500
+ function parseSortByTypeBody(raw) {
501
+ const keys = {};
502
+ for (const [typeId, value] of Object.entries(requirePlainObject(raw, 'sort.contentFieldByType'))) {
503
+ const label = `sort.contentFieldByType["${typeId}"]`;
504
+ // Copied whole, so a key naming both a field and a value reaches the
505
+ // check that refuses it rather than losing one half here.
506
+ keys[typeId] = { ...requireKnownKeys(value, ['field', 'value'], label) };
507
+ }
508
+ return keys;
509
+ }
510
+ /**
511
+ * Build a `StackQuery` from a `POST /records/query` body — the superset
512
+ * form, which also carries `filter.content`, with ISO date strings decoded.
513
+ * `undefined` is the absent body; any other non-object is refused.
482
514
  * See docs/spec/wire-format.md § Records.
483
515
  */
484
516
  export function parseQueryBody(raw) {
@@ -522,6 +554,8 @@ export function parseQueryBody(raw) {
522
554
  filter.content = requirePlainObject(f.content, 'filter.content');
523
555
  if (f.contentPresent !== undefined)
524
556
  filter.contentPresent = requireStringArray(f.contentPresent, 'filter.contentPresent');
557
+ if (f.contentByType !== undefined)
558
+ filter.contentByType = parseContentByTypeBody(f.contentByType);
525
559
  if (f.search !== undefined)
526
560
  filter.search = requireString(f.search, 'filter.search');
527
561
  if (optionalBoolean(f.includeDeleted, 'filter.includeDeleted'))
@@ -545,8 +579,8 @@ export function parseQueryBody(raw) {
545
579
  query.filter = filter;
546
580
  }
547
581
  if (body.sort !== undefined) {
548
- const s = requireKnownKeys(body.sort, ['field', 'contentField', 'direction'], 'sort');
549
- const sort = buildSort(s.field, s.contentField, s.direction);
582
+ const s = requireKnownKeys(body.sort, ['field', 'contentField', 'contentFieldByType', 'direction'], 'sort');
583
+ const sort = buildSort(s.field, s.contentField, s.direction, s.contentFieldByType);
550
584
  if (!sort)
551
585
  throw new StackBadRequestError('Invalid sort: expected a field or a contentField.');
552
586
  query.sort = sort;
@@ -595,13 +629,10 @@ export function parseChangeParams(url) {
595
629
  };
596
630
  }
597
631
  /**
598
- * Parse `GET /records/:id/journal`'s query params into the `JournalQuery`
599
- * `getJournal()` takes. Absent params stay absent rather than defaulting:
600
- * omitting `limit` reads the whole log by contract, so supplying a page
601
- * size here would truncate exactly the caller that omitted it.
602
- *
603
- * `afterSeq` is a journal `seq` — a dense per-record integer, never the
604
- * change feed's opaque cursor. See docs/spec/wire-format.md § Journal.
632
+ * Parse `GET /records/:id/journal`'s params into a `JournalQuery`. Absent
633
+ * stays absent: omitting `limit` reads the whole log, which a default page
634
+ * size would truncate. `afterSeq` is a journal `seq`, never a feed cursor.
635
+ * See docs/spec/wire-format.md § Journal.
605
636
  */
606
637
  export function parseJournalParams(url) {
607
638
  requireKnownParams(url, ['afterSeq', 'limit']);
@@ -615,11 +646,8 @@ export function parseJournalParams(url) {
615
646
  return query;
616
647
  }
617
648
  /**
618
- * Parse `GET /records/:id/versions`'s query params into the `VersionsQuery`
619
- * `getVersions()` takes. Absent params stay absent, for the reason
620
- * parseJournalParams() leaves them so.
621
- *
622
- * `beforeVersion` is a snapshot's `version`, exclusive.
649
+ * Parse `GET /records/:id/versions`'s params into a `VersionsQuery`; absent
650
+ * stays absent, as in parseJournalParams(). `beforeVersion` is exclusive.
623
651
  * See docs/spec/wire-format.md § Versions.
624
652
  */
625
653
  export function parseVersionsParams(url) {
@@ -692,13 +720,10 @@ export function parseAssociationParams(url) {
692
720
  // Headers
693
721
  // -------------------------------------------------------
694
722
  /**
695
- * Parse an `If-Match: "5"` header into the version for `ifVersion`.
696
- * A value that is not a bare, optionally quoted version is refused rather
697
- * than read as absent: the header exists to fence a write, so degrading a
698
- * malformed one to an unconditional last-writer-wins mutation defeats the
699
- * only thing it was sent to do. Weak comparators (`W/"5"`) are refused for
700
- * the same reason — a version match is exact or it is nothing.
701
- * See docs/spec/wire-format.md § Records.
723
+ * Parse `If-Match: "5"` into `ifVersion`. Anything but a bare, optionally
724
+ * quoted version — weak `W/"5"` included — is refused, not read as absent:
725
+ * degrading the fence to last-writer-wins defeats the one thing it was
726
+ * sent for. See docs/spec/wire-format.md § Records.
702
727
  */
703
728
  export function parseIfMatch(header) {
704
729
  if (header === undefined)
@@ -728,4 +753,4 @@ export function parseUploadFilename(header) {
728
753
  const plain = /filename\s*=\s*"([^"]+)"/i.exec(header);
729
754
  return plain ? plain[1] : undefined;
730
755
  }
731
- //# sourceMappingURL=wire-request.js.map
756
+ //# sourceMappingURL=request.js.map