@primate/core 0.4.6 → 0.5.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 (412) hide show
  1. package/lib/private/App.d.ts +531 -3
  2. package/lib/private/App.js +8 -3
  3. package/lib/private/Binder.d.ts +2 -2
  4. package/lib/private/Flags.d.ts +3 -3
  5. package/lib/private/Module.d.ts +5 -5
  6. package/lib/private/app/Facade.d.ts +566 -0
  7. package/lib/private/app/Facade.js +33 -0
  8. package/lib/private/asset/Asset.d.ts +1 -1
  9. package/lib/private/backend/Module.d.ts +1 -1
  10. package/lib/private/backend/Module.js +2 -5
  11. package/lib/private/backend/TAG.d.ts +1 -1
  12. package/lib/private/backend/TAG.js +1 -1
  13. package/lib/private/build/App.d.ts +2 -2
  14. package/lib/private/build/App.js +0 -2
  15. package/lib/private/build/client/index.js +11 -7
  16. package/lib/private/build/hook.js +4 -3
  17. package/lib/private/build/index.js +14 -13
  18. package/lib/private/build/presets.d.ts +10 -0
  19. package/lib/private/build/presets.js +39 -0
  20. package/lib/private/build/server/index.js +5 -7
  21. package/lib/private/build/server/plugin/assets.js +9 -7
  22. package/lib/private/build/server/plugin/config.js +11 -4
  23. package/lib/private/build/server/plugin/db-default.d.ts +4 -0
  24. package/lib/private/build/server/plugin/db-default.js +45 -0
  25. package/lib/private/build/server/plugin/frontend.js +4 -2
  26. package/lib/private/build/server/plugin/live-reload.d.ts +4 -0
  27. package/lib/private/build/server/plugin/{hot-reload.js → live-reload.js} +4 -4
  28. package/lib/private/build/server/plugin/native-addons.js +6 -4
  29. package/lib/private/build/server/plugin/node-imports.js +2 -2
  30. package/lib/private/build/server/plugin/route.js +2 -2
  31. package/lib/private/build/server/plugin/store-wrap.js +2 -2
  32. package/lib/private/build/server/plugin/store.js +6 -6
  33. package/lib/private/build/server/plugin/stores.js +4 -5
  34. package/lib/private/build/server/plugin/view.js +4 -4
  35. package/lib/private/build/server/plugin/views.js +4 -4
  36. package/lib/private/build/server/plugin/virtual-pages.js +8 -8
  37. package/lib/private/build/server/plugin/virtual-routes.js +8 -13
  38. package/lib/private/build/server/plugin/wasm.js +2 -3
  39. package/lib/private/bye.js +2 -3
  40. package/lib/private/client/Data.d.ts +1 -1
  41. package/lib/private/client/ValidateInit.d.ts +1 -3
  42. package/lib/private/client/ValidationError.d.ts +1 -1
  43. package/lib/private/client/app.js +2 -1
  44. package/lib/private/client/create-form.d.ts +31 -0
  45. package/lib/private/client/create-form.js +124 -0
  46. package/lib/private/client/extract-issues.d.ts +4 -0
  47. package/lib/private/client/extract-issues.js +20 -0
  48. package/lib/private/client/spa/index.d.ts +1 -1
  49. package/lib/private/client/spa/index.js +4 -5
  50. package/lib/private/client/{toValidated.d.ts → to-validated.d.ts} +2 -4
  51. package/lib/private/client/{toValidated.js → to-validated.js} +1 -1
  52. package/lib/private/client/validate-field.d.ts +3 -0
  53. package/lib/private/client/validate-field.js +41 -0
  54. package/lib/private/config/index.d.ts +2 -21
  55. package/lib/private/config/index.js +3 -1
  56. package/lib/private/config/schema.d.ts +13 -9
  57. package/lib/private/config/schema.js +10 -5
  58. package/lib/private/cookie.d.ts +5 -5
  59. package/lib/private/cookie.js +10 -14
  60. package/lib/private/db/As.d.ts +10 -0
  61. package/lib/private/db/DB.d.ts +33 -0
  62. package/lib/private/db/DB.js +2 -0
  63. package/lib/private/db/DataDict.d.ts +5 -0
  64. package/lib/private/db/DataKey.d.ts +4 -0
  65. package/lib/private/db/DataValue.d.ts +17 -0
  66. package/lib/private/db/MemoryDB.d.ts +35 -0
  67. package/lib/private/db/MemoryDB.js +317 -0
  68. package/lib/private/db/PK.d.ts +3 -0
  69. package/lib/private/db/PK.js +2 -0
  70. package/lib/private/{database → db}/Query.d.ts +2 -2
  71. package/lib/private/{database → db}/QueryBuilder.d.ts +2 -3
  72. package/lib/private/db/ReadArgs.d.ts +9 -0
  73. package/lib/private/db/ReadArgs.js +2 -0
  74. package/lib/private/db/ReadRelationsArgs.d.ts +6 -0
  75. package/lib/private/db/ReadRelationsArgs.js +2 -0
  76. package/lib/private/{database → db}/Schema.d.ts +1 -2
  77. package/lib/private/db/Sort.d.ts +4 -0
  78. package/lib/private/{database → db}/TypeMap.d.ts +2 -3
  79. package/lib/private/{database → db}/Types.d.ts +1 -1
  80. package/lib/private/db/With.d.ts +16 -0
  81. package/lib/private/db/With.js +2 -0
  82. package/lib/private/db/common.d.ts +18 -0
  83. package/lib/private/db/common.js +36 -0
  84. package/lib/private/db/error.d.ts +81 -0
  85. package/lib/private/db/error.js +199 -0
  86. package/lib/private/db/sql.d.ts +28 -0
  87. package/lib/private/db/sql.js +177 -0
  88. package/lib/private/db/storage.d.ts +3 -0
  89. package/lib/private/db/storage.js +3 -0
  90. package/lib/private/db/symbol/wrap.js +2 -0
  91. package/lib/private/db/symbol.js +2 -0
  92. package/lib/private/db/test.d.ts +4 -0
  93. package/lib/private/db/test.js +1384 -0
  94. package/lib/private/frontend/Module.d.ts +6 -6
  95. package/lib/private/frontend/Module.js +28 -23
  96. package/lib/private/frontend/Render.d.ts +1 -2
  97. package/lib/private/frontend/ServerData.d.ts +1 -1
  98. package/lib/private/frontend/ServerView.d.ts +1 -2
  99. package/lib/private/frontend/View.d.ts +1 -1
  100. package/lib/private/frontend/ViewOptions.d.ts +1 -1
  101. package/lib/private/frontend/ViewResponse.d.ts +1 -1
  102. package/lib/private/hash.js +0 -1
  103. package/lib/private/i18n/Catalog.d.ts +5 -2
  104. package/lib/private/i18n/Formatter.js +20 -8
  105. package/lib/private/i18n/Module.d.ts +3 -3
  106. package/lib/private/i18n/Module.js +28 -17
  107. package/lib/private/i18n/format.d.ts +4 -0
  108. package/lib/private/i18n/format.js +95 -0
  109. package/lib/private/i18n/index/client.d.ts +9 -0
  110. package/lib/private/i18n/index/client.js +152 -0
  111. package/lib/private/i18n/index/server.d.ts +9 -0
  112. package/lib/private/i18n/index/server.js +57 -0
  113. package/lib/private/i18n/index/types.d.ts +33 -0
  114. package/lib/private/i18n/index/types.js +2 -0
  115. package/lib/private/i18n/locale.d.ts +9 -3
  116. package/lib/private/i18n/ordinals.d.ts +1 -1
  117. package/lib/private/i18n/resolve.d.ts +7 -0
  118. package/lib/private/i18n/resolve.js +30 -0
  119. package/lib/private/i18n/schema.d.ts +4 -4
  120. package/lib/private/i18n/schema.js +6 -10
  121. package/lib/private/i18n/storage.d.ts +3 -0
  122. package/lib/private/i18n/storage.js +5 -0
  123. package/lib/private/i18n/validate.d.ts +2 -0
  124. package/lib/private/i18n/validate.js +21 -0
  125. package/lib/private/log.d.ts +1 -0
  126. package/lib/private/log.js +10 -10
  127. package/lib/private/module/Hook.d.ts +1 -1
  128. package/lib/private/module/Next.d.ts +1 -1
  129. package/lib/private/orm/ForeignKey.d.ts +11 -0
  130. package/lib/private/orm/ForeignKey.js +22 -0
  131. package/lib/private/orm/PrimaryKey.d.ts +15 -0
  132. package/lib/private/orm/PrimaryKey.js +35 -0
  133. package/lib/private/orm/Set.d.ts +11 -0
  134. package/lib/private/orm/Set.js +2 -0
  135. package/lib/private/orm/Store.d.ts +171 -0
  136. package/lib/private/orm/Store.js +518 -0
  137. package/lib/private/orm/foreign.d.ts +4 -0
  138. package/lib/private/orm/foreign.js +5 -0
  139. package/lib/private/orm/key.d.ts +8 -0
  140. package/lib/private/orm/key.js +4 -0
  141. package/lib/private/orm/parse.d.ts +12 -0
  142. package/lib/private/orm/parse.js +29 -0
  143. package/lib/private/orm/primary.d.ts +5 -0
  144. package/lib/private/orm/primary.js +5 -0
  145. package/lib/private/orm/relation.d.ts +43 -0
  146. package/lib/private/orm/relation.js +26 -0
  147. package/lib/private/orm/types.d.ts +18 -0
  148. package/lib/private/orm/types.js +2 -0
  149. package/lib/private/orm/wrap.d.ts +5 -0
  150. package/lib/private/orm/wrap.js +5 -0
  151. package/lib/private/paths.d.ts +2 -2
  152. package/lib/private/request/RequestBag.d.ts +1 -1
  153. package/lib/private/request/RequestBag.js +11 -7
  154. package/lib/private/request/RequestBody.d.ts +2 -4
  155. package/lib/private/request/RequestBody.js +8 -11
  156. package/lib/private/request/RequestContext.d.ts +12 -0
  157. package/lib/private/request/RequestContext.js +31 -0
  158. package/lib/private/request/RequestFacade.d.ts +16 -6
  159. package/lib/private/request/parse.d.ts +2 -2
  160. package/lib/private/request/parse.js +54 -16
  161. package/lib/private/request/route.js +37 -21
  162. package/lib/private/request/router.d.ts +1 -1
  163. package/lib/private/request/router.js +2 -2
  164. package/lib/private/request/sContext.d.ts +3 -0
  165. package/lib/private/request/sContext.js +2 -0
  166. package/lib/private/response/ResponseFunction.d.ts +1 -2
  167. package/lib/private/response/ResponseLike.d.ts +1 -1
  168. package/lib/private/response/binary.d.ts +1 -1
  169. package/lib/private/response/binary.js +4 -3
  170. package/lib/private/response/json.d.ts +1 -1
  171. package/lib/private/response/json.js +2 -2
  172. package/lib/private/response/redirect.js +1 -1
  173. package/lib/private/response/respond.js +7 -10
  174. package/lib/private/response/sse.d.ts +1 -1
  175. package/lib/private/response/sse.js +2 -2
  176. package/lib/private/response/text.d.ts +1 -1
  177. package/lib/private/response/text.js +3 -3
  178. package/lib/private/response/view.d.ts +2 -2
  179. package/lib/private/response/view.js +3 -3
  180. package/lib/private/response.d.ts +1 -1
  181. package/lib/private/route/Handler.d.ts +1 -1
  182. package/lib/private/route/hook.d.ts +6 -0
  183. package/lib/private/route/hook.js +5 -0
  184. package/lib/private/route/router.d.ts +9 -5
  185. package/lib/private/route/router.js +34 -17
  186. package/lib/private/route/wrap.js +2 -2
  187. package/lib/private/serve/App.d.ts +5 -18
  188. package/lib/private/serve/App.js +91 -82
  189. package/lib/private/serve/Init.d.ts +3 -3
  190. package/lib/private/serve/hook.js +1 -7
  191. package/lib/private/serve/index.js +6 -2
  192. package/lib/private/serve/module/Dev.d.ts +1 -1
  193. package/lib/private/serve/module/Dev.js +9 -5
  194. package/lib/private/serve/module/Handle.js +2 -2
  195. package/lib/private/session/Data.d.ts +1 -2
  196. package/lib/private/session/SessionHandle.d.ts +1 -1
  197. package/lib/private/session/SessionHandle.js +10 -9
  198. package/lib/private/session/SessionModule.js +7 -7
  199. package/lib/private/session/index.d.ts +3 -4
  200. package/lib/private/session/schema.d.ts +6 -6
  201. package/lib/private/session/schema.js +5 -4
  202. package/lib/private/session/storage.d.ts +1 -2
  203. package/lib/private/session/storage.js +2 -2
  204. package/lib/private/tags.js +2 -2
  205. package/lib/private/target/Target.d.ts +1 -1
  206. package/lib/public/AppFacade.d.ts +2 -0
  207. package/lib/public/AppFacade.js +2 -0
  208. package/lib/public/build/presets.d.ts +2 -0
  209. package/lib/public/build/presets.js +2 -0
  210. package/lib/public/build/transform.d.ts +2 -0
  211. package/lib/public/build/transform.js +2 -0
  212. package/lib/public/client.d.ts +14 -0
  213. package/lib/public/client.js +10 -0
  214. package/lib/public/db/MemoryDB.d.ts +2 -0
  215. package/lib/public/db/MemoryDB.js +2 -0
  216. package/lib/public/db/error.d.ts +2 -0
  217. package/lib/public/db/error.js +2 -0
  218. package/lib/public/db/sql.d.ts +2 -0
  219. package/lib/public/db/sql.js +2 -0
  220. package/lib/public/db/test.d.ts +2 -0
  221. package/lib/public/db/test.js +2 -0
  222. package/lib/public/db.d.ts +12 -0
  223. package/lib/public/db.js +2 -0
  224. package/lib/public/orm/Store.d.ts +2 -0
  225. package/lib/public/orm/Store.js +2 -0
  226. package/lib/public/orm/key.d.ts +2 -0
  227. package/lib/public/orm/key.js +2 -0
  228. package/lib/public/orm/relation.d.ts +2 -0
  229. package/lib/public/orm/relation.js +2 -0
  230. package/lib/public/orm/wrap.d.ts +2 -0
  231. package/lib/public/orm/wrap.js +2 -0
  232. package/lib/public/request.d.ts +4 -0
  233. package/lib/public/request.js +2 -0
  234. package/lib/public/response.d.ts +22 -0
  235. package/lib/public/response.js +19 -0
  236. package/lib/public/route/hook.d.ts +2 -0
  237. package/lib/public/route/hook.js +2 -0
  238. package/package.json +28 -23
  239. package/lib/private/build/client/reload.d.ts +0 -7
  240. package/lib/private/build/client/reload.js +0 -6
  241. package/lib/private/build/server/plugin/database-default.d.ts +0 -4
  242. package/lib/private/build/server/plugin/database-default.js +0 -48
  243. package/lib/private/build/server/plugin/hot-reload.d.ts +0 -4
  244. package/lib/private/client/validate.d.ts +0 -3
  245. package/lib/private/client/validate.js +0 -54
  246. package/lib/private/database/As.d.ts +0 -7
  247. package/lib/private/database/Binds.d.ts +0 -4
  248. package/lib/private/database/Binds.js +0 -2
  249. package/lib/private/database/Changes.d.ts +0 -11
  250. package/lib/private/database/Changes.js +0 -2
  251. package/lib/private/database/ColumnTypes.d.ts +0 -11
  252. package/lib/private/database/ColumnTypes.js +0 -2
  253. package/lib/private/database/DataDict.d.ts +0 -5
  254. package/lib/private/database/DataKey.d.ts +0 -4
  255. package/lib/private/database/DataValue.d.ts +0 -5
  256. package/lib/private/database/Database.d.ts +0 -56
  257. package/lib/private/database/Database.js +0 -153
  258. package/lib/private/database/InMemoryDatabase.d.ts +0 -37
  259. package/lib/private/database/InMemoryDatabase.js +0 -181
  260. package/lib/private/database/Sort.d.ts +0 -4
  261. package/lib/private/database/Store.d.ts +0 -172
  262. package/lib/private/database/Store.js +0 -261
  263. package/lib/private/database/storage.d.ts +0 -4
  264. package/lib/private/database/storage.js +0 -3
  265. package/lib/private/database/symbol/wrap.js +0 -2
  266. package/lib/private/database/symbol.js +0 -2
  267. package/lib/private/database/test.d.ts +0 -4
  268. package/lib/private/database/test.js +0 -678
  269. package/lib/private/database/wrap.d.ts +0 -5
  270. package/lib/private/database/wrap.js +0 -5
  271. package/lib/private/i18n/index.d.ts +0 -28
  272. package/lib/private/i18n/index.js +0 -236
  273. package/lib/private/route/guard.d.ts +0 -4
  274. package/lib/private/route/guard.js +0 -22
  275. package/lib/private/wasm/API.d.ts +0 -7
  276. package/lib/private/wasm/API.js +0 -2
  277. package/lib/private/wasm/BufferViewSource.d.ts +0 -4
  278. package/lib/private/wasm/BufferViewSource.js +0 -2
  279. package/lib/private/wasm/Exports.d.ts +0 -23
  280. package/lib/private/wasm/Exports.js +0 -2
  281. package/lib/private/wasm/I32.d.ts +0 -5
  282. package/lib/private/wasm/I32.js +0 -2
  283. package/lib/private/wasm/I32_SIZE.d.ts +0 -3
  284. package/lib/private/wasm/I32_SIZE.js +0 -2
  285. package/lib/private/wasm/Instantiation.d.ts +0 -12
  286. package/lib/private/wasm/Instantiation.js +0 -2
  287. package/lib/private/wasm/Tagged.d.ts +0 -7
  288. package/lib/private/wasm/Tagged.js +0 -2
  289. package/lib/private/wasm/buffersize.d.ts +0 -2
  290. package/lib/private/wasm/buffersize.js +0 -5
  291. package/lib/private/wasm/decode-bytes.d.ts +0 -3
  292. package/lib/private/wasm/decode-bytes.js +0 -5
  293. package/lib/private/wasm/decode-json.d.ts +0 -7
  294. package/lib/private/wasm/decode-json.js +0 -11
  295. package/lib/private/wasm/decode-option.d.ts +0 -5
  296. package/lib/private/wasm/decode-option.js +0 -10
  297. package/lib/private/wasm/decode-response.d.ts +0 -19
  298. package/lib/private/wasm/decode-response.js +0 -90
  299. package/lib/private/wasm/decode-string.d.ts +0 -3
  300. package/lib/private/wasm/decode-string.js +0 -5
  301. package/lib/private/wasm/decode-websocket-close.d.ts +0 -5
  302. package/lib/private/wasm/decode-websocket-close.js +0 -6
  303. package/lib/private/wasm/decode-websocket-send.d.ts +0 -6
  304. package/lib/private/wasm/decode-websocket-send.js +0 -19
  305. package/lib/private/wasm/encode-buffer.d.ts +0 -3
  306. package/lib/private/wasm/encode-buffer.js +0 -6
  307. package/lib/private/wasm/encode-request.d.ts +0 -9
  308. package/lib/private/wasm/encode-request.js +0 -195
  309. package/lib/private/wasm/encode-session.d.ts +0 -3
  310. package/lib/private/wasm/encode-session.js +0 -25
  311. package/lib/private/wasm/encode-string-map.d.ts +0 -5
  312. package/lib/private/wasm/encode-string-map.js +0 -14
  313. package/lib/private/wasm/encode-string.d.ts +0 -13
  314. package/lib/private/wasm/encode-string.js +0 -17
  315. package/lib/private/wasm/encode-url.d.ts +0 -11
  316. package/lib/private/wasm/encode-url.js +0 -14
  317. package/lib/private/wasm/encode-websocket-close.d.ts +0 -2
  318. package/lib/private/wasm/encode-websocket-close.js +0 -7
  319. package/lib/private/wasm/encode-websocket-message.d.ts +0 -4
  320. package/lib/private/wasm/encode-websocket-message.js +0 -30
  321. package/lib/private/wasm/encode-websocket-open.d.ts +0 -2
  322. package/lib/private/wasm/encode-websocket-open.js +0 -7
  323. package/lib/private/wasm/filesize.d.ts +0 -2
  324. package/lib/private/wasm/filesize.js +0 -8
  325. package/lib/private/wasm/instantiate.d.ts +0 -37
  326. package/lib/private/wasm/instantiate.js +0 -408
  327. package/lib/private/wasm/open-websocket.d.ts +0 -4
  328. package/lib/private/wasm/open-websocket.js +0 -26
  329. package/lib/private/wasm/stringsize.d.ts +0 -3
  330. package/lib/private/wasm/stringsize.js +0 -5
  331. package/lib/private/wasm/urlsize.d.ts +0 -2
  332. package/lib/private/wasm/urlsize.js +0 -5
  333. package/lib/public/Database.d.ts +0 -2
  334. package/lib/public/Database.js +0 -2
  335. package/lib/public/client/ValidateInit.d.ts +0 -2
  336. package/lib/public/client/ValidateInit.js +0 -2
  337. package/lib/public/client/ValidateUpdater.d.ts +0 -2
  338. package/lib/public/client/ValidateUpdater.js +0 -2
  339. package/lib/public/client/ValidationError.d.ts +0 -2
  340. package/lib/public/client/ValidationError.js +0 -2
  341. package/lib/public/client/toValidated.d.ts +0 -2
  342. package/lib/public/client/toValidated.js +0 -2
  343. package/lib/public/client/validate.d.ts +0 -2
  344. package/lib/public/client/validate.js +0 -2
  345. package/lib/public/database/As.d.ts +0 -2
  346. package/lib/public/database/As.js +0 -2
  347. package/lib/public/database/DataDict.d.ts +0 -2
  348. package/lib/public/database/DataDict.js +0 -2
  349. package/lib/public/database/InMemoryDatabase.d.ts +0 -2
  350. package/lib/public/database/InMemoryDatabase.js +0 -2
  351. package/lib/public/database/Sort.d.ts +0 -2
  352. package/lib/public/database/Sort.js +0 -2
  353. package/lib/public/database/Store.d.ts +0 -2
  354. package/lib/public/database/Store.js +0 -2
  355. package/lib/public/database/TypeMap.d.ts +0 -2
  356. package/lib/public/database/TypeMap.js +0 -2
  357. package/lib/public/database/Types.d.ts +0 -2
  358. package/lib/public/database/Types.js +0 -2
  359. package/lib/public/database/test.d.ts +0 -2
  360. package/lib/public/database/test.js +0 -2
  361. package/lib/public/database/wrap.d.ts +0 -2
  362. package/lib/public/database/wrap.js +0 -2
  363. package/lib/public/request/RequestBody.d.ts +0 -2
  364. package/lib/public/request/RequestBody.js +0 -2
  365. package/lib/public/request/RequestFacade.d.ts +0 -2
  366. package/lib/public/request/RequestFacade.js +0 -2
  367. package/lib/public/request/Verb.d.ts +0 -2
  368. package/lib/public/request/Verb.js +0 -2
  369. package/lib/public/response/ResponseFunction.d.ts +0 -2
  370. package/lib/public/response/ResponseFunction.js +0 -2
  371. package/lib/public/response/ResponseLike.d.ts +0 -2
  372. package/lib/public/response/ResponseLike.js +0 -2
  373. package/lib/public/response/binary.d.ts +0 -2
  374. package/lib/public/response/binary.js +0 -2
  375. package/lib/public/response/error.d.ts +0 -2
  376. package/lib/public/response/error.js +0 -2
  377. package/lib/public/response/json.d.ts +0 -2
  378. package/lib/public/response/json.js +0 -2
  379. package/lib/public/response/redirect.d.ts +0 -2
  380. package/lib/public/response/redirect.js +0 -2
  381. package/lib/public/response/sse.d.ts +0 -2
  382. package/lib/public/response/sse.js +0 -2
  383. package/lib/public/response/text.d.ts +0 -2
  384. package/lib/public/response/text.js +0 -2
  385. package/lib/public/response/view.d.ts +0 -2
  386. package/lib/public/response/view.js +0 -2
  387. package/lib/public/response/ws.d.ts +0 -2
  388. package/lib/public/response/ws.js +0 -2
  389. package/lib/public/wasm/decode-json.d.ts +0 -5
  390. package/lib/public/wasm/decode-json.js +0 -3
  391. package/lib/public/wasm/decode-response.d.ts +0 -3
  392. package/lib/public/wasm/decode-response.js +0 -3
  393. package/lib/public/wasm/encode-request.d.ts +0 -3
  394. package/lib/public/wasm/encode-request.js +0 -3
  395. package/lib/public/wasm/encode-session.d.ts +0 -3
  396. package/lib/public/wasm/encode-session.js +0 -3
  397. package/lib/public/wasm/instantiate.d.ts +0 -4
  398. package/lib/public/wasm/instantiate.js +0 -3
  399. /package/lib/private/{database → db}/As.js +0 -0
  400. /package/lib/private/{database → db}/DataDict.js +0 -0
  401. /package/lib/private/{database → db}/DataKey.js +0 -0
  402. /package/lib/private/{database → db}/DataValue.js +0 -0
  403. /package/lib/private/{database → db}/Query.js +0 -0
  404. /package/lib/private/{database → db}/QueryBuilder.js +0 -0
  405. /package/lib/private/{database → db}/Schema.js +0 -0
  406. /package/lib/private/{database → db}/Sort.js +0 -0
  407. /package/lib/private/{database → db}/TypeMap.js +0 -0
  408. /package/lib/private/{database → db}/Types.js +0 -0
  409. /package/lib/private/{database → db}/primary.d.ts +0 -0
  410. /package/lib/private/{database → db}/primary.js +0 -0
  411. /package/lib/private/{database → db}/symbol/wrap.d.ts +0 -0
  412. /package/lib/private/{database → db}/symbol.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,5 @@
1
+ import type DB from "#db/DB";
2
+ import type Store from "#orm/Store";
3
+ import type { StoreSchema } from "pema";
4
+ export default function wrapStore<T extends StoreSchema>(name: string, store: Store<T>, db: DB): Store<T, {}>;
5
+ //# sourceMappingURL=wrap.d.ts.map
@@ -0,0 +1,5 @@
1
+ import wrap from "#db/symbol/wrap";
2
+ export default function wrapStore(name, store, db) {
3
+ return store[wrap](name, db);
4
+ }
5
+ //# sourceMappingURL=wrap.js.map
@@ -1,5 +1,5 @@
1
- import type FileRef from "@rcompat/fs/FileRef";
2
- import type Dict from "@rcompat/type/Dict";
1
+ import type { FileRef } from "@rcompat/fs";
2
+ import type { Dict } from "@rcompat/type";
3
3
  declare function resolve(root: FileRef, config_paths?: Dict<string[]>): Promise<any>;
4
4
  export default resolve;
5
5
  //# sourceMappingURL=paths.d.ts.map
@@ -1,4 +1,4 @@
1
- import type PartialDict from "@rcompat/type/PartialDict";
1
+ import type { PartialDict } from "@rcompat/type";
2
2
  type Contents = PartialDict<string>;
3
3
  type Normalize = (key: string) => string;
4
4
  interface Schema<T> {
@@ -1,5 +1,6 @@
1
1
  import fail from "#fail";
2
- import is from "@rcompat/assert/is";
2
+ import assert from "@rcompat/assert";
3
+ import fn from "@rcompat/fn";
3
4
  export default class RequestBag {
4
5
  #contents;
5
6
  #name;
@@ -12,16 +13,19 @@ export default class RequestBag {
12
13
  * @param name - Human-readable bag name used in error messages.
13
14
  * @param options - Optional `normalize` function and `raw` string.
14
15
  */
15
- constructor(input, name, options = {}) {
16
- is(input).object();
16
+ constructor(input, name, options) {
17
+ assert.dict(input);
18
+ assert.string(name);
19
+ assert.maybe.dict(options);
20
+ assert.maybe.function(options?.normalize);
21
+ assert.maybe.string(options?.raw);
17
22
  this.#name = name;
18
- this.#normalize = options.normalize ?? (k => k);
19
- this.#raw = options.raw ?? "";
23
+ this.#normalize = options?.normalize ?? fn.identity;
24
+ this.#raw = options?.raw ?? "";
20
25
  const contents = Object.create(null);
21
26
  for (const key of Object.keys(input)) {
22
- const normalized = this.#normalize(key);
23
27
  // last-wins semantics if only case differs
24
- contents[normalized] = input[key];
28
+ contents[this.#normalize(key)] = input[key];
25
29
  }
26
30
  this.#contents = contents;
27
31
  }
@@ -1,6 +1,4 @@
1
- import type Dict from "@rcompat/type/Dict";
2
- import type JSONValue from "@rcompat/type/JSONValue";
3
- import type Schema from "@rcompat/type/Schema";
1
+ import type { Dict, JSONValue, Schema } from "@rcompat/type";
4
2
  type Form = Dict<string>;
5
3
  type Parsed = {
6
4
  type: "binary";
@@ -26,7 +24,7 @@ export default class RequestBody {
26
24
  static parse(request: Request, url: URL): Promise<RequestBody>;
27
25
  static none(): RequestBody;
28
26
  constructor(parsed: Parsed, files?: Dict<File>);
29
- get type(): "binary" | "form" | "json" | "none" | "text";
27
+ get type(): "binary" | "json" | "text" | "none" | "form";
30
28
  json(): JSONValue;
31
29
  json<S extends Schema<unknown>>(schema: S): ParseReturn<S>;
32
30
  form(): Form;
@@ -1,14 +1,11 @@
1
1
  import fail from "#fail";
2
- import json from "@rcompat/http/mime/application/json";
3
- import binary from "@rcompat/http/mime/application/octet-stream";
4
- import www_form from "@rcompat/http/mime/application/x-www-form-urlencoded";
5
- import form_data from "@rcompat/http/mime/multipart/form-data";
6
- import text from "@rcompat/http/mime/text/plain";
2
+ import MIME from "@rcompat/http/mime";
3
+ import is from "@rcompat/is";
7
4
  async function anyform(request) {
8
5
  const form = Object.create(null);
9
6
  const files = Object.create(null);
10
7
  for (const [key, value] of (await request.formData()).entries()) {
11
- if (typeof value === "string") {
8
+ if (is.string(value)) {
12
9
  form[key] = value;
13
10
  }
14
11
  else {
@@ -27,16 +24,16 @@ export default class RequestBody {
27
24
  const path = url.pathname;
28
25
  try {
29
26
  switch (type) {
30
- case binary:
27
+ case MIME.APPLICATION_OCTET_STREAM:
31
28
  return new RequestBody({ type: "binary", value: await request.blob() });
32
- case www_form:
33
- case form_data: {
29
+ case MIME.APPLICATION_X_WWW_FORM_URLENCODED:
30
+ case MIME.MULTIPART_FORM_DATA: {
34
31
  const { form, files } = await anyform(request);
35
32
  return new RequestBody({ type: "form", value: form }, files);
36
33
  }
37
- case json:
34
+ case MIME.APPLICATION_JSON:
38
35
  return new RequestBody({ type: "json", value: await request.json() });
39
- case text:
36
+ case MIME.TEXT_PLAIN:
40
37
  return new RequestBody({ type: "text", value: await request.text() });
41
38
  case "none":
42
39
  return RequestBody.none();
@@ -0,0 +1,12 @@
1
+ import type { Dict } from "@rcompat/type";
2
+ export default class RequestContext {
3
+ #private;
4
+ set<T>(key: string, value: T): void;
5
+ update<T>(key: string, fn: (prev: T | undefined) => T): void;
6
+ has(key: string): boolean;
7
+ try<T>(key: string): T | undefined;
8
+ get<T>(key: string): T;
9
+ delete(key: string): void;
10
+ toJSON(): Dict;
11
+ }
12
+ //# sourceMappingURL=RequestContext.d.ts.map
@@ -0,0 +1,31 @@
1
+ export default class RequestContext {
2
+ #data = new Map();
3
+ set(key, value) {
4
+ this.#data.set(key, value);
5
+ }
6
+ update(key, fn) {
7
+ const prev = this.try(key);
8
+ this.set(key, fn(prev));
9
+ }
10
+ has(key) {
11
+ return this.#data.has(key);
12
+ }
13
+ try(key) {
14
+ return this.#data.get(key);
15
+ }
16
+ get(key) {
17
+ if (!this.#data.has(key))
18
+ throw new Error(`Missing context key: ${key}`);
19
+ return this.#data.get(key);
20
+ }
21
+ delete(key) {
22
+ this.#data.delete(key);
23
+ }
24
+ toJSON() {
25
+ const out = Object.create(null);
26
+ for (const [k, v] of this.#data)
27
+ out[k] = v;
28
+ return out;
29
+ }
30
+ }
31
+ //# sourceMappingURL=RequestContext.js.map
@@ -1,20 +1,30 @@
1
1
  import type RequestBag from "#request/RequestBag";
2
2
  import type RequestBody from "#request/RequestBody";
3
- import type Dict from "@rcompat/type/Dict";
3
+ import type { Dict } from "@rcompat/type";
4
+ type RequestView = {
5
+ context: Dict;
6
+ cookies: Dict<string>;
7
+ headers: Dict<string>;
8
+ path: Dict<string>;
9
+ query: Dict<string>;
10
+ url: URL;
11
+ };
4
12
  type RequestFacade = {
5
13
  body: RequestBody;
6
- context: Dict;
7
14
  cookies: RequestBag;
8
15
  forward(to: string, headers?: Dict<string>): Promise<Response>;
9
16
  headers: RequestBag;
10
17
  original: Request;
11
18
  path: RequestBag;
12
19
  query: RequestBag;
13
- /**
14
- * The request's pathname + querystring.
15
- */
16
20
  target: string;
17
21
  url: URL;
18
- } & Dict<Dict | unknown>;
22
+ has(key: string): boolean;
23
+ try<T>(key: string): T | undefined;
24
+ get<T>(key: string): T;
25
+ set<T>(key: string, value: T | ((prev: T | undefined) => T)): RequestFacade;
26
+ delete(key: string): RequestFacade;
27
+ toJSON(): RequestView;
28
+ };
19
29
  export { RequestFacade as default };
20
30
  //# sourceMappingURL=RequestFacade.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import type RequestFacade from "#request/RequestFacade";
2
- declare const _default: (request: Request) => RequestFacade;
3
- export default _default;
2
+ declare function parse(request: Request): RequestFacade;
3
+ export default parse;
4
4
  //# sourceMappingURL=parse.d.ts.map
@@ -1,5 +1,8 @@
1
1
  import RequestBag from "#request/RequestBag";
2
2
  import RequestBody from "#request/RequestBody";
3
+ import RequestContext from "#request/RequestContext";
4
+ import sContext from "#request/sContext";
5
+ import is from "@rcompat/is";
3
6
  function decode(s) {
4
7
  try {
5
8
  return decodeURIComponent(s);
@@ -9,14 +12,16 @@ function decode(s) {
9
12
  }
10
13
  }
11
14
  ;
12
- const normalize = (k) => k.toLowerCase();
13
- function bagHeaders(request) {
15
+ function normalize(k) {
16
+ return k.toLowerCase();
17
+ }
18
+ function header_bag(request) {
14
19
  const headers = Object.fromEntries([...request.headers].map(([k, v]) => [k.toLowerCase(), v]));
15
20
  return new RequestBag(headers, "headers", {
16
21
  normalize,
17
22
  });
18
23
  }
19
- function bagCookies(request) {
24
+ function cookie_bag(request) {
20
25
  const header = request.headers.get("cookie");
21
26
  const entries = Object.fromEntries(header
22
27
  ? header.split(";").map(s => s.trim()).filter(Boolean).map(s => {
@@ -30,23 +35,20 @@ function bagCookies(request) {
30
35
  raw: header ?? "",
31
36
  });
32
37
  }
33
- function bagQuery(url) {
38
+ function query_bag(url) {
34
39
  return new RequestBag(Object.fromEntries(url.searchParams), "query", {
35
40
  normalize,
36
41
  raw: url.search,
37
42
  });
38
43
  }
39
- function bagPath(url) {
40
- return new RequestBag(Object.create(null), "path", {
41
- raw: url.pathname,
42
- });
44
+ function path_bag(url) {
45
+ return new RequestBag(Object.create(null), "path", { raw: url.pathname });
43
46
  }
44
- export default (request) => {
47
+ function parse(request) {
45
48
  const url = new URL(request.url);
46
- return {
49
+ const facade = {
47
50
  body: RequestBody.none(),
48
- context: {},
49
- cookies: bagCookies(request),
51
+ cookies: cookie_bag(request),
50
52
  forward(to, headers) {
51
53
  return fetch(to, {
52
54
  body: request.body,
@@ -58,12 +60,48 @@ export default (request) => {
58
60
  method: request.method,
59
61
  });
60
62
  },
61
- headers: bagHeaders(request),
63
+ headers: header_bag(request),
62
64
  original: request,
63
- path: bagPath(url),
64
- query: bagQuery(url),
65
+ path: path_bag(url),
66
+ query: query_bag(url),
65
67
  target: url.pathname + url.search,
66
68
  url,
69
+ has(key) {
70
+ return this[sContext].has(key);
71
+ },
72
+ try(key) {
73
+ return this[sContext].try(key);
74
+ },
75
+ get(key) {
76
+ return this[sContext].get(key);
77
+ },
78
+ set(key, value) {
79
+ if (is.function(value)) {
80
+ this[sContext].update(key, value);
81
+ }
82
+ else {
83
+ this[sContext].set(key, value);
84
+ }
85
+ return this;
86
+ },
87
+ delete(key) {
88
+ this[sContext].delete(key);
89
+ return this;
90
+ },
91
+ toJSON() {
92
+ return {
93
+ context: this[sContext].toJSON(),
94
+ cookies: this.cookies.toJSON(),
95
+ headers: this.headers.toJSON(),
96
+ path: this.path.toJSON(),
97
+ query: this.query.toJSON(),
98
+ url: this.url,
99
+ };
100
+ },
101
+ [sContext]: new RequestContext(),
67
102
  };
68
- };
103
+ return facade;
104
+ }
105
+ ;
106
+ export default parse;
69
107
  //# sourceMappingURL=parse.js.map
@@ -1,28 +1,44 @@
1
+ import fail from "#fail";
1
2
  import log from "#log";
2
3
  import response_error from "#response/error";
3
4
  import response_json from "#response/json";
4
5
  import respond from "#response/respond";
5
- import guard from "#route/guard";
6
6
  import Status from "@rcompat/http/Status";
7
7
  import ParseError from "pema/ParseError";
8
- async function reducer(hooks, request) {
8
+ const result = (request, response) => ({ request, response });
9
+ function wrap_hook(h) {
10
+ return async (request, next) => {
11
+ let downstream;
12
+ let called_next = false;
13
+ const response = await h(request, async (r) => {
14
+ if (called_next)
15
+ throw fail("hook called next() more than once");
16
+ called_next = true;
17
+ downstream = await next(r);
18
+ return downstream.response;
19
+ });
20
+ // hook returned nothing
21
+ if (response === undefined) {
22
+ if (called_next) {
23
+ throw fail("hook called next() but did not return a result; did you forget `return next(request)`?");
24
+ }
25
+ throw fail("hook must return a response-like value or return next(request)");
26
+ }
27
+ // if the hook called next(), we preserve the downstream request (mutations) but
28
+ // allow the hook to override the response by returning something else.
29
+ return downstream !== undefined
30
+ ? result(downstream.request, response)
31
+ : result(request, response);
32
+ };
33
+ }
34
+ async function run(hooks, request) {
9
35
  const [first, ...rest] = hooks;
36
+ if (first === undefined)
37
+ return result(request, new Response());
10
38
  if (rest.length === 0)
11
- return await first(request, _ => new Response());
12
- return await first(request, _ => reducer(rest, _));
39
+ return first(request, async (r) => result(r, new Response()));
40
+ return first(request, r => run(rest, r));
13
41
  }
14
- ;
15
- // last, preserve final request form
16
- function last(handler) {
17
- return async (request) => {
18
- const response = await handler(request);
19
- return {
20
- request,
21
- response: response,
22
- };
23
- };
24
- }
25
- ;
26
42
  export default async function (app, partial_request) {
27
43
  let errorRoute;
28
44
  try {
@@ -30,12 +46,12 @@ export default async function (app, partial_request) {
30
46
  if (route === undefined) {
31
47
  return response_error()(app, {}, partial_request);
32
48
  }
33
- const { errors, guards, handler, layouts } = route;
49
+ const { errors, hooks, layouts, handler } = route;
34
50
  errorRoute = errors[0];
35
- const route_hooks = app.modules.map(module => module.route.bind(module));
36
- const hooks = [...route_hooks, guard(guards), last(handler)];
37
- // handle request
38
- const { request, response } = await reducer(hooks, route.request);
51
+ const module_hooks = app.modules.map(m => wrap_hook(m.route.bind(m)));
52
+ const route_hooks = hooks.map(wrap_hook);
53
+ const last = async (req, _next) => result(req, await handler(req));
54
+ const { request, response } = await run([...module_hooks, ...route_hooks, last], route.request);
39
55
  return await respond(response)(app, {
40
56
  layouts: await Promise.all(layouts.map(layout => layout(request))),
41
57
  }, request);
@@ -1,4 +1,4 @@
1
- import type FileRef from "@rcompat/fs/FileRef";
1
+ import type { FileRef } from "@rcompat/fs";
2
2
  import FileRouter from "@rcompat/fs/FileRouter";
3
3
  declare const _default: (directory: FileRef, extensions: string[]) => Promise<FileRouter>;
4
4
  export default _default;
@@ -11,7 +11,7 @@ const allowed = {
11
11
  replacements: ["a-Z", "0-9", "-", "_", "+", "[", "]", "."],
12
12
  text: "letters ({1}), digits ({2}), {3}, {4}, {5}, {6}, {7}",
13
13
  };
14
- const specials = ["guard", "error", "layout"];
14
+ const specials = ["error", "hook", "layout"];
15
15
  const _ = allowed.re.source.slice(1, -1);
16
16
  const p = /^(?:[^[\]]+|\[(?:\.{3})?[a-zA-Z0-9_]+\]|\[\[(?:\.{3})?[a-zA-Z0-9_]+\]\])$/;
17
17
  export default async (directory, extensions) => {
@@ -21,7 +21,7 @@ export default async (directory, extensions) => {
21
21
  extensions,
22
22
  specials: {
23
23
  error: { recursive: false },
24
- guard: { recursive: true },
24
+ hook: { recursive: true },
25
25
  layout: { recursive: true },
26
26
  },
27
27
  });
@@ -0,0 +1,3 @@
1
+ declare const _default: symbol;
2
+ export default _default;
3
+ //# sourceMappingURL=sContext.d.ts.map
@@ -0,0 +1,2 @@
1
+ export default Symbol("primate.request.context");
2
+ //# sourceMappingURL=sContext.js.map
@@ -1,8 +1,7 @@
1
1
  import type View from "#frontend/View";
2
2
  import type RequestFacade from "#request/RequestFacade";
3
3
  import type ServeApp from "#serve/App";
4
- import type Dict from "@rcompat/type/Dict";
5
- import type MaybePromise from "@rcompat/type/MaybePromise";
4
+ import type { Dict, MaybePromise } from "@rcompat/type";
6
5
  type ResponseFunction = (app: ServeApp, transfer: Dict, request: RequestFacade) => MaybePromise<View | null | Response | undefined>;
7
6
  export { ResponseFunction as default };
8
7
  //# sourceMappingURL=ResponseFunction.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type ResponseFunction from "#response/ResponseFunction";
2
2
  import type Streamable from "@rcompat/fs/Streamable";
3
- import type Dict from "@rcompat/type/Dict";
3
+ import type { Dict } from "@rcompat/type";
4
4
  type ResponseLike = string | Dict | Dict[] | URL | Blob | ReadableStream | Streamable | Response | ResponseFunction | null;
5
5
  export { ResponseLike as default };
6
6
  //# sourceMappingURL=ResponseLike.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type ServeApp from "#serve/App";
2
- import type StreamSource from "@rcompat/fs/StreamSource";
2
+ import type { StreamSource } from "@rcompat/fs";
3
3
  /**
4
4
  * Stream a binary response.
5
5
  * @param source streamable source
@@ -1,5 +1,6 @@
1
1
  import Streamable from "@rcompat/fs/Streamable";
2
- import mime from "@rcompat/http/mime/application/octet-stream";
2
+ import MIME from "@rcompat/http/mime";
3
+ import is from "@rcompat/is";
3
4
  const encodeRFC5987 = (s) => encodeURIComponent(s).replace(/['()*]/g, c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
4
5
  /**
5
6
  * @security
@@ -30,11 +31,11 @@ function toContentDisposition(filename) {
30
31
  */
31
32
  export default function binary(source, init) {
32
33
  return (app) => {
33
- const { headers, ...rest } = app.media(mime, init);
34
+ const { headers, ...rest } = app.media(MIME.APPLICATION_OCTET_STREAM, init);
34
35
  const name = Streamable.named(source) ? source.name : "default.bin";
35
36
  const out = new Headers(headers);
36
37
  out.set("Content-Disposition", toContentDisposition(name));
37
- if (source instanceof Blob) {
38
+ if (is.blob(source)) {
38
39
  source.type && out.set("Content-Type", source.type);
39
40
  out.set("Content-Length", String(source.size));
40
41
  }
@@ -4,6 +4,6 @@
4
4
  * @param options response options
5
5
  * @return Response rendering function
6
6
  */
7
- declare const _default: (body: unknown, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type/MaybePromise").default<Response>;
7
+ declare const _default: (body: unknown, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type").MaybePromise<Response>;
8
8
  export default _default;
9
9
  //# sourceMappingURL=json.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import response from "#response";
2
- import mime from "@rcompat/http/mime/application/json";
2
+ import MIME from "@rcompat/http/mime";
3
3
  /**
4
4
  * Issue a JSON response
5
5
  * @param body body object
6
6
  * @param options response options
7
7
  * @return Response rendering function
8
8
  */
9
- export default response(mime, JSON.stringify);
9
+ export default response(MIME.APPLICATION_JSON, JSON.stringify);
10
10
  //# sourceMappingURL=json.js.map
@@ -59,7 +59,7 @@ app => app.respond(null, {
59
59
  headers: {
60
60
  "Content-Length": String(0),
61
61
  Location: location,
62
- "Cache-Control": 'no-cache',
62
+ "Cache-Control": "no-cache",
63
63
  },
64
64
  status: status ?? Status.FOUND,
65
65
  });
@@ -5,25 +5,22 @@ import redirect from "#response/redirect";
5
5
  import text from "#response/text";
6
6
  import Streamable from "@rcompat/fs/Streamable";
7
7
  import Status from "@rcompat/http/Status";
8
- import proper from "@rcompat/record/proper";
8
+ import is from "@rcompat/is";
9
9
  function invalid_body(body) {
10
10
  throw fail("invalid body {0} returned from route", body);
11
11
  }
12
- const is_instance = (of) => ((value) => value instanceof of);
13
- const is_response = is_instance(Response);
14
- const is_url = is_instance(URL);
15
- const is_null = (value) => value === null;
16
12
  function match(m) {
17
13
  return m;
18
14
  }
19
15
  // [if, then]
20
16
  const guesses = match([
21
- [is_null, () => () => new Response(null, { status: Status.NO_CONTENT })],
22
- [is_url, value => redirect(value.toString())],
17
+ [is.null, () => () => new Response(null, { status: Status.NO_CONTENT })],
18
+ [is.url, value => redirect(value.toString())],
23
19
  [Streamable.is, value => binary(value)],
24
- [(value) => is_response(value), value => _ => value],
25
- [proper, json],
26
- [(value) => typeof value === "string", text],
20
+ [is.response, value => _ => value],
21
+ [is.dict, json],
22
+ [is.array, json],
23
+ [is.string, text],
27
24
  ]);
28
25
  const guess = (value) => guesses.find(([_if]) => _if(value))?.[1](value)
29
26
  ?? invalid_body(`${value}`);
@@ -10,6 +10,6 @@ type Body = {
10
10
  * @param options response options
11
11
  * @return Response rendering function
12
12
  */
13
- declare const _default: (body: Body, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type/MaybePromise").default<Response>;
13
+ declare const _default: (body: Body, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type").MaybePromise<Response>;
14
14
  export default _default;
15
15
  //# sourceMappingURL=sse.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import response from "#response";
2
- import mime from "@rcompat/http/mime/text/event-stream";
2
+ import MIME from "@rcompat/http/mime";
3
3
  const encode = (input) => new TextEncoder().encode(input);
4
4
  const handle = (body) => new ReadableStream({
5
5
  cancel() {
@@ -21,5 +21,5 @@ const handle = (body) => new ReadableStream({
21
21
  * @param options response options
22
22
  * @return Response rendering function
23
23
  */
24
- export default response(mime, handle);
24
+ export default response(MIME.TEXT_EVENT_STREAM, handle);
25
25
  //# sourceMappingURL=sse.js.map
@@ -4,6 +4,6 @@
4
4
  * @param options response options
5
5
  * @return Response rendering function
6
6
  */
7
- declare const _default: (body: string, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type/MaybePromise").default<Response>;
7
+ declare const _default: (body: string, init?: ResponseInit) => (app: import("../serve/App.js").default) => import("@rcompat/type").MaybePromise<Response>;
8
8
  export default _default;
9
9
  //# sourceMappingURL=text.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import response from "#response";
2
- import identity from "@rcompat/function/identity";
3
- import mime from "@rcompat/http/mime/text/plain";
2
+ import fn from "@rcompat/fn";
3
+ import MIME from "@rcompat/http/mime";
4
4
  /**
5
5
  * Return a plaintext response
6
6
  * @param body plaintext body
7
7
  * @param options response options
8
8
  * @return Response rendering function
9
9
  */
10
- export default response(mime, identity);
10
+ export default response(MIME.TEXT_PLAIN, fn.identity);
11
11
  //# sourceMappingURL=text.js.map
@@ -1,6 +1,6 @@
1
1
  import type ViewOptions from "#frontend/ViewOptions";
2
- import type Dict from "@rcompat/type/Dict";
3
- import type ResponseFunction from "./ResponseFunction.js";
2
+ import type ResponseFunction from "#response/ResponseFunction";
3
+ import type { Dict } from "@rcompat/type";
4
4
  declare function view<Props>(component: (props: Props) => any, props: Props, options?: ViewOptions): ResponseFunction;
5
5
  declare function view(component: () => any, props?: Dict, options?: ViewOptions): ResponseFunction;
6
6
  declare function view(name: string, props?: Dict, options?: ViewOptions): ResponseFunction;
@@ -1,5 +1,5 @@
1
1
  import fail from "#fail";
2
- import FileRef from "@rcompat/fs/FileRef";
2
+ import fs from "@rcompat/fs";
3
3
  const extensions = ["extension", "fullExtension"];
4
4
  const backmap = {
5
5
  "component.ts": "angular",
@@ -18,7 +18,7 @@ const backmap = {
18
18
  jsx: "react",
19
19
  };
20
20
  function no_frontend(view) {
21
- const extension = new FileRef(view).fullExtension.slice(1);
21
+ const extension = fs.ref(view).fullExtension.slice(1);
22
22
  const hasPkg = extension in backmap;
23
23
  const error = "No frontend for {0}";
24
24
  const fix = hasPkg ? ", did you configure {1}?" : "";
@@ -36,7 +36,7 @@ function view(name, props, options) {
36
36
  const _name = name;
37
37
  return async (app, transfer, request) => {
38
38
  const found_view = extensions
39
- .map(extension => app.frontends[new FileRef(_name)[extension]])
39
+ .map(extension => app.frontends[fs.ref(_name)[extension]])
40
40
  .find(extension => extension !== undefined)?.(_name, props, options)(app, transfer, request);
41
41
  if (found_view !== undefined)
42
42
  return found_view;