@primate/core 0.4.5 → 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 +12 -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,57 @@
1
+ import DEFAULT_PERSIST_MODE from "#i18n/constant/DEFAULT_PERSIST_MODE";
2
+ import format from "#i18n/format";
3
+ import Formatter from "#i18n/Formatter";
4
+ import resolve from "#i18n/resolve";
5
+ import server_storage from "#i18n/storage";
6
+ import sInternal from "#i18n/symbol/internal";
7
+ import validate from "#i18n/validate";
8
+ import sConfig from "#symbol/config";
9
+ import is from "@rcompat/is";
10
+ export default function i18n(config) {
11
+ const catalogs = config.locales;
12
+ for (const [locale, catalog] of Object.entries(catalogs)) {
13
+ validate(catalog, locale);
14
+ }
15
+ const default_catalog = catalogs[config.defaultLocale];
16
+ const currency = config.currency ?? "USD";
17
+ const persist = config.persist ?? DEFAULT_PERSIST_MODE;
18
+ const get_locale = () => {
19
+ const storage = server_storage();
20
+ const store = storage.getStore();
21
+ return store?.locale ?? config.defaultLocale;
22
+ };
23
+ function t(...args) {
24
+ const active_locale = get_locale();
25
+ const formatter = new Formatter(active_locale);
26
+ const [key, params] = args;
27
+ const translated = resolve(catalogs[active_locale], key) ??
28
+ resolve(default_catalog, key) ??
29
+ String(key);
30
+ if (is.string(translated)) {
31
+ return format(translated, params ?? {}, currency, formatter);
32
+ }
33
+ return translated;
34
+ }
35
+ const api = t;
36
+ api.locale = {
37
+ get: get_locale,
38
+ set: (_locale) => {
39
+ throw new Error("[i18n] locale.set is not supported on server.");
40
+ },
41
+ };
42
+ Object.defineProperty(api, sInternal, {
43
+ value: {
44
+ restore: () => { },
45
+ init: () => { },
46
+ },
47
+ });
48
+ Object.defineProperty(api, sConfig, {
49
+ get: () => ({ ...config, persist }),
50
+ });
51
+ api.subscribe = (run) => {
52
+ run(api);
53
+ return () => { };
54
+ };
55
+ return api;
56
+ }
57
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1,33 @@
1
+ import type TypeOf from "#i18n/TypeOf";
2
+ import type { Dict } from "@rcompat/type";
3
+ type EntryOf<Body extends string> = Body extends `${infer Name}:${infer Spec}` ? {
4
+ __name: Name & string;
5
+ __type: TypeOf<Spec>;
6
+ } : {
7
+ __name: Body & string;
8
+ __type: string;
9
+ };
10
+ export type EntriesOf<S extends string> = string extends S ? never : S extends `${infer _}{${infer Body}}${infer Rest}` ? EntryOf<Body> | EntriesOf<Rest> : never;
11
+ export type ParamsFromEntries<E> = [
12
+ E
13
+ ] extends [never] ? Dict : {
14
+ [K in E as K extends {
15
+ __name: infer N extends string;
16
+ } ? N : never]: K extends {
17
+ __type: infer T;
18
+ } ? T : never;
19
+ };
20
+ type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8];
21
+ type Primitive = string | number | boolean | null | undefined;
22
+ type NoDot<K extends string> = K extends `${string}.${string}` ? never : K;
23
+ type ObjKeys<T> = NoDot<Extract<keyof T, string>>;
24
+ export type DotPaths<T, D extends number = 6> = [
25
+ D
26
+ ] extends [never] ? never : T extends Primitive ? never : T extends readonly (infer E)[] ? `${number}` | `${number}.${DotPaths<E, Prev[D]> & string}` : T extends object ? string extends keyof T ? string : {
27
+ [K in ObjKeys<T>]: K | (DotPaths<T[K], Prev[D]> extends infer R ? R extends string ? `${K}.${R}` : never : never);
28
+ }[ObjKeys<T>] : never;
29
+ export type PathValue<T, P extends string, D extends number = 6> = string extends P ? unknown : [
30
+ D
31
+ ] extends [never] ? unknown : P extends `${infer Head}.${infer Tail}` ? Head extends `${number}` ? T extends readonly (infer E)[] ? PathValue<E, Tail, Prev[D]> : unknown : T extends object ? Head extends keyof T ? PathValue<T[Head], Tail, Prev[D]> : unknown : unknown : P extends `${number}` ? T extends readonly (infer E)[] ? E : unknown : T extends object ? (P extends keyof T ? T[P] : unknown) : unknown;
32
+ export {};
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1,5 +1,11 @@
1
- import type Dict from "@rcompat/type/Dict";
2
- type MessageMap = Dict<string>;
3
- export default function locale<const M extends MessageMap>(messages: M): M;
1
+ import type Catalog from "#i18n/Catalog";
2
+ type Prev = [never, 0, 1, 2, 3, 4, 5, 6];
3
+ type DotKeyMessage<K extends string> = `i18n: dots not allowed in catalog key '${K}', use nested objects instead`;
4
+ type EnforceNoDots<T, D extends number = 6> = [
5
+ D
6
+ ] extends [never] ? T : T extends string ? T : T extends readonly (infer E)[] ? readonly EnforceNoDots<E, Prev[D]>[] : T extends object ? {
7
+ [K in keyof T]: K extends string ? K extends `${string}.${string}` ? DotKeyMessage<K> : EnforceNoDots<T[K], Prev[D]> : EnforceNoDots<T[K], Prev[D]>;
8
+ } : T;
9
+ export default function locale<const M extends Catalog>(messages: EnforceNoDots<M>): M;
4
10
  export {};
5
11
  //# sourceMappingURL=locale.d.ts.map
@@ -1,4 +1,4 @@
1
- import type Dict from "@rcompat/type/Dict";
1
+ import type { Dict } from "@rcompat/type";
2
2
  declare const ordinals: Dict<Dict<string>>;
3
3
  export default ordinals;
4
4
  //# sourceMappingURL=ordinals.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Resolve a translation key from a catalog:
3
+ * - try exact flat-key match (including keys containing dots)
4
+ * - otherwise traverse dot-path segments
5
+ */
6
+ export default function resolve(root: unknown, key: string): unknown;
7
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Resolve a translation key from a catalog:
3
+ * - try exact flat-key match (including keys containing dots)
4
+ * - otherwise traverse dot-path segments
5
+ */
6
+ export default function resolve(root, key) {
7
+ if (root == null)
8
+ return undefined;
9
+ const parts = key.split(".");
10
+ let current = root;
11
+ for (const part of parts) {
12
+ if (part === "")
13
+ continue;
14
+ if (current == null)
15
+ return undefined;
16
+ if (Array.isArray(current)) {
17
+ if (!/^(0|[1-9]\d*)$/.test(part))
18
+ return undefined;
19
+ current = current[Number(part)];
20
+ continue;
21
+ }
22
+ if (typeof current === "object") {
23
+ current = current[part];
24
+ continue;
25
+ }
26
+ return undefined;
27
+ }
28
+ return current;
29
+ }
30
+ //# sourceMappingURL=resolve.js.map
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("pema").ObjectType<{
2
- defaultLocale: import("pema/string").StringType;
3
- locales: import("pema/record").RecordType<import("pema/string").StringType, import("pema/unknown").UnknownType>;
4
- currency: import("pema").DefaultType<import("pema/string").StringType, "USD">;
5
- persist: import("pema").DefaultType<import("pema/union").UnionType<[import("pema").LiteralType<"cookie">, import("pema").LiteralType<"localStorage">, import("pema").LiteralType<"sessionStorage">, import("pema").LiteralType<false>]>, false | "cookie" | "localStorage" | "sessionStorage">;
2
+ defaultLocale: import("pema").StringType;
3
+ locales: import("pema").RecordType<import("pema").StringType, import("pema").UnknownType>;
4
+ currency: import("pema").DefaultType<import("pema").StringType, "USD">;
5
+ persist: import("pema").DefaultType<import("pema").UnionType<[import("pema").LiteralType<"cookie">, import("pema").LiteralType<"localStorage">, import("pema").LiteralType<"sessionStorage">, import("pema").LiteralType<false>]>, false | "cookie" | "localStorage" | "sessionStorage">;
6
6
  }>;
7
7
  export default _default;
8
8
  //# sourceMappingURL=schema.d.ts.map
@@ -1,13 +1,9 @@
1
- import pema from "pema";
2
- import record from "pema/record";
3
- import string from "pema/string";
4
- import union from "pema/union";
5
- import unknown from "pema/unknown";
6
- export default pema({
7
- defaultLocale: string,
8
- locales: record(string, unknown),
9
- currency: string.default("USD"),
10
- persist: union("cookie", "localStorage", "sessionStorage", false)
1
+ import p from "pema";
2
+ export default p({
3
+ defaultLocale: p.string,
4
+ locales: p.dict(p.unknown),
5
+ currency: p.string.default("USD"),
6
+ persist: p.union("cookie", "localStorage", "sessionStorage", false)
11
7
  .default("cookie"),
12
8
  });
13
9
  //# sourceMappingURL=schema.js.map
@@ -0,0 +1,3 @@
1
+ declare const _default: () => import("node:async_hooks").AsyncLocalStorage<any>;
2
+ export default _default;
3
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1,5 @@
1
+ import io from "@rcompat/io";
2
+ import cache from "@rcompat/kv/cache";
3
+ const s = Symbol("primate/i18n");
4
+ export default () => cache.get(s, () => new io.async.Context());
5
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1,2 @@
1
+ export default function validate(key: unknown, locale: string, path?: string): void;
2
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1,21 @@
1
+ import is from "@rcompat/is";
2
+ export default function validate(key, locale, path = "") {
3
+ if (Array.isArray(key)) {
4
+ for (let i = 0; i < key.length; i++) {
5
+ validate(key[i], locale, `${path}.${i}`);
6
+ }
7
+ return;
8
+ }
9
+ if (!is.dict(key))
10
+ return;
11
+ for (const [k, v] of Object.entries(key)) {
12
+ if (k.includes(".")) {
13
+ const at = path ? `${path}.${k}` : k;
14
+ throw new Error("[i18n] Dots are not allowed in catalog key names. " +
15
+ `Found "${k}" at "${at}" (locale "${locale}").`);
16
+ }
17
+ const next = path ? `${path}.${k}` : k;
18
+ validate(v, locale, next);
19
+ }
20
+ }
21
+ //# sourceMappingURL=validate.js.map
@@ -9,6 +9,7 @@ type N = Levels[Level];
9
9
  declare class Log {
10
10
  #private;
11
11
  constructor(level: N);
12
+ print(message: string, ...params: unknown[]): void;
12
13
  system(message: string, ...params: unknown[]): void;
13
14
  info(message: string, ...params: unknown[]): void;
14
15
  warn(message: string, ...params: unknown[]): void;
@@ -1,12 +1,9 @@
1
1
  import AppError from "#AppError";
2
2
  import args from "@rcompat/args";
3
- import blue from "@rcompat/cli/color/blue";
4
- import green from "@rcompat/cli/color/green";
5
- import red from "@rcompat/cli/color/red";
6
- import yellow from "@rcompat/cli/color/yellow";
3
+ import color from "@rcompat/cli/color";
7
4
  import mark from "@rcompat/cli/mark";
8
5
  import print from "@rcompat/cli/print";
9
- import union from "pema/union";
6
+ import p from "pema";
10
7
  const levels = {
11
8
  error: 0,
12
9
  info: 2,
@@ -14,28 +11,31 @@ const levels = {
14
11
  };
15
12
  const flag = "--log=";
16
13
  const n = args.find(arg => arg.startsWith(flag))?.slice(flag.length);
17
- const vn = union(...Object.keys(levels)).optional().parse(n);
14
+ const vn = p.union(...Object.keys(levels)).optional().parse(n);
18
15
  class Log {
19
16
  #level;
20
17
  constructor(level) {
21
18
  this.#level = level;
22
19
  }
20
+ print(message, ...params) {
21
+ print(mark(message, ...params));
22
+ }
23
23
  system(message, ...params) {
24
- print(`${blue("++")} ${mark(message, ...params)}\n`);
24
+ print(` ${mark(message, ...params)}\n`);
25
25
  }
26
26
  info(message, ...params) {
27
27
  if (this.#level === levels.info) {
28
- print(green("--"), mark(message, ...params), "\n");
28
+ print(color.green("[INFO]"), mark(message, ...params), "\n");
29
29
  }
30
30
  }
31
31
  warn(message, ...params) {
32
32
  if (this.#level >= levels.warn) {
33
- print(yellow("??"), mark(message, ...params), "\n");
33
+ print(color.yellow("[WARN]"), mark(message, ...params), "\n");
34
34
  }
35
35
  }
36
36
  error(error) {
37
37
  if (error instanceof AppError) {
38
- print(red("!!"), error.message, "\n");
38
+ print(color.red("[ERROR]"), error.message, "\n");
39
39
  }
40
40
  else {
41
41
  console.error(error);
@@ -1,5 +1,5 @@
1
- import type MaybePromise from "@rcompat/type/MaybePromise";
2
1
  import type Next from "#module/Next";
2
+ import type { MaybePromise } from "@rcompat/type";
3
3
  type Hook<I, O = I> = (t: I, next: Next<I, O>) => MaybePromise<O>;
4
4
  export type { Hook as default };
5
5
  //# sourceMappingURL=Hook.d.ts.map
@@ -1,4 +1,4 @@
1
- import type MaybePromise from "@rcompat/type/MaybePromise";
1
+ import type { MaybePromise } from "@rcompat/type";
2
2
  type Next<I, O = I> = (i: I) => MaybePromise<O>;
3
3
  export type { Next as default };
4
4
  //# sourceMappingURL=Next.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { DataKey, Storable } from "pema";
2
+ export default class ForeignKey<T extends Storable<DataKey>> {
3
+ #private;
4
+ constructor(type: T);
5
+ get type(): T;
6
+ get datatype(): keyof import("pema").DataType;
7
+ get name(): string;
8
+ get nullable(): boolean;
9
+ parse(value: unknown): unknown;
10
+ }
11
+ //# sourceMappingURL=ForeignKey.d.ts.map
@@ -0,0 +1,22 @@
1
+ export default class ForeignKey {
2
+ #type;
3
+ constructor(type) {
4
+ this.#type = type;
5
+ }
6
+ get type() {
7
+ return this.#type;
8
+ }
9
+ get datatype() {
10
+ return this.#type.datatype;
11
+ }
12
+ get name() {
13
+ return this.#type.name;
14
+ }
15
+ get nullable() {
16
+ return this.#type.nullable;
17
+ }
18
+ parse(value) {
19
+ return this.#type.parse(value);
20
+ }
21
+ }
22
+ //# sourceMappingURL=ForeignKey.js.map
@@ -0,0 +1,15 @@
1
+ import type { DataKey, Storable } from "pema";
2
+ export type Options = {
3
+ generate?: boolean;
4
+ };
5
+ export default class PrimaryKey<T extends Storable<DataKey>> {
6
+ #private;
7
+ constructor(type: T, options?: Options);
8
+ get type(): T;
9
+ get datatype(): keyof import("pema").DataType;
10
+ get name(): string;
11
+ get nullable(): boolean;
12
+ get generate(): boolean;
13
+ parse(value: unknown): unknown;
14
+ }
15
+ //# sourceMappingURL=PrimaryKey.d.ts.map
@@ -0,0 +1,35 @@
1
+ import log from "#log";
2
+ const RECOMMENDED_TYPES = new Set([
3
+ "string", "u16", "u32", "u64", "u128",
4
+ ]);
5
+ export default class PrimaryKey {
6
+ #type;
7
+ #generate;
8
+ constructor(type, options) {
9
+ this.#type = type;
10
+ this.#generate = options?.generate ?? true;
11
+ const datatype = this.#type.datatype;
12
+ if (!RECOMMENDED_TYPES.has(datatype)) {
13
+ log.warn("key.primary: {0} is unusual for a primary key", datatype);
14
+ }
15
+ }
16
+ get type() {
17
+ return this.#type;
18
+ }
19
+ get datatype() {
20
+ return this.#type.datatype;
21
+ }
22
+ get name() {
23
+ return this.#type.name;
24
+ }
25
+ get nullable() {
26
+ return false;
27
+ }
28
+ get generate() {
29
+ return this.#generate;
30
+ }
31
+ parse(value) {
32
+ return this.#type.parse(value);
33
+ }
34
+ }
35
+ //# sourceMappingURL=PrimaryKey.js.map
@@ -0,0 +1,11 @@
1
+ import type { ExtractSchema, StoreInput } from "#orm/types";
2
+ import type { InferStore } from "pema";
3
+ type X<T> = {
4
+ [K in keyof T]: T[K];
5
+ } & {};
6
+ type OrNull<T> = {
7
+ [P in keyof T]?: null | T[P];
8
+ };
9
+ type $Set<T extends StoreInput> = X<OrNull<InferStore<ExtractSchema<T>>>>;
10
+ export type { $Set as default };
11
+ //# sourceMappingURL=Set.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Set.js.map
@@ -0,0 +1,171 @@
1
+ import type DB from "#db/DB";
2
+ import wrap from "#db/symbol/wrap";
3
+ import type Types from "#db/Types";
4
+ import type PrimaryKey from "#orm/PrimaryKey";
5
+ import type { ManyRelation, OneRelation, Relation } from "#orm/relation";
6
+ import type $Set from "#orm/Set";
7
+ import type { ExtractSchema, InferRecord, Insertable, PrimaryKeyField, StoreInput } from "#orm/types";
8
+ import type { Dict, EmptyObject, Serializable } from "@rcompat/type";
9
+ import type { Storable } from "pema";
10
+ import StoreType from "pema/StoreType";
11
+ type X<T> = {
12
+ [K in keyof T]: T[K];
13
+ } & {};
14
+ type StringOperators = {
15
+ $like?: string;
16
+ $ilike?: string;
17
+ };
18
+ type NumberOperators = {
19
+ $gt?: number;
20
+ $gte?: number;
21
+ $lt?: number;
22
+ $lte?: number;
23
+ $ne?: number;
24
+ };
25
+ type BigIntOperators = {
26
+ $gt?: bigint;
27
+ $gte?: bigint;
28
+ $lt?: bigint;
29
+ $lte?: bigint;
30
+ $ne?: bigint;
31
+ };
32
+ type DateOperators = {
33
+ $before?: Date;
34
+ $after?: Date;
35
+ $ne?: Date;
36
+ };
37
+ type QueryOperators<T> = T extends string ? (T | StringOperators | null) : T extends number ? (T | NumberOperators | null) : T extends bigint ? (T | BigIntOperators | null) : T extends Date ? (T | DateOperators | null) : (T | null);
38
+ type Schema<T extends StoreInput> = X<InferRecord<T>>;
39
+ type Where<T extends StoreInput> = X<{
40
+ [K in keyof Schema<T>]?: QueryOperators<Schema<T>[K]>;
41
+ }>;
42
+ type SelectKey<T> = Extract<keyof T, string>;
43
+ type Select<T> = readonly SelectKey<T>[];
44
+ type Sort<T> = Partial<Record<SelectKey<T>, "asc" | "desc">>;
45
+ type Projected<T, S extends Select<T> | undefined> = S extends readonly (keyof T)[] ? X<Pick<T, S[number]>> : T;
46
+ declare const NUMBER_KEYS: readonly ["u8", "u16", "u32", "i8", "i16", "i32", "f32", "f64"];
47
+ declare const BIGINT_KEYS: readonly ["u64", "u128", "i64", "i128"];
48
+ type NumberKey = typeof NUMBER_KEYS[number];
49
+ type BigIntKey = typeof BIGINT_KEYS[number];
50
+ type PKV<T extends StoreInput> = T[PrimaryKeyField<T>] extends PrimaryKey<infer P> ? P extends Storable<infer D> ? D extends "string" ? string : D extends NumberKey ? number : D extends BigIntKey ? bigint : string | number | bigint : string | number | bigint : string | number | bigint;
51
+ type WithQuery<T extends StoreInput> = true | {
52
+ where?: Where<T>;
53
+ select?: Select<Schema<T>>;
54
+ sort?: Sort<Schema<T>>;
55
+ limit?: number;
56
+ };
57
+ type With<R extends Dict<Relation>> = {
58
+ [K in keyof R]?: R[K] extends OneRelation<infer S, string> ? WithQuery<S> : R[K] extends ManyRelation<infer S, string> ? WithQuery<S> : never;
59
+ };
60
+ type RelationResult<Rel, Q> = Rel extends OneRelation<infer S, string> ? Q extends {
61
+ select: infer Sel;
62
+ } ? Sel extends Select<Schema<S>> ? Projected<Schema<S>, Sel> | null : Schema<S> | null : Schema<S> | null : Rel extends ManyRelation<infer S, string> ? Q extends {
63
+ select: infer Sel;
64
+ } ? Sel extends Select<Schema<S>> ? Projected<Schema<S>, Sel>[] : Schema<S>[] : Schema<S>[] : never;
65
+ type WithRelations<Base, Relations extends Dict<Relation>, W extends With<Relations> | undefined> = W extends object ? X<Base & {
66
+ [K in keyof W & keyof Relations]: RelationResult<Relations[K], W[K]>;
67
+ }> : Base;
68
+ type Config<R extends Dict<Relation>> = {
69
+ db?: DB;
70
+ name?: string;
71
+ relations?: R;
72
+ };
73
+ /**
74
+ * Database-backed store.
75
+ *
76
+ * A `Store` exposes a typed, validated interface over a relational or
77
+ * document database table/collection. It pairs a Pema schema with a uniform
78
+ * CRUD/query API.
79
+ */
80
+ export default class Store<T extends StoreInput, R extends Dict<Relation> = EmptyObject> implements Serializable {
81
+ #private;
82
+ [wrap]: (name: string, db: DB) => this;
83
+ readonly Schema: Schema<T>;
84
+ constructor(input: T, config?: Config<R>);
85
+ static new<T extends StoreInput, R extends Dict<Relation> = EmptyObject>(input: T, config?: Config<R>): Store<T, R>;
86
+ get collection(): {
87
+ create: () => import("@rcompat/type").MaybePromise<void>;
88
+ delete: () => import("@rcompat/type").MaybePromise<void>;
89
+ };
90
+ get infer(): InferRecord<T>;
91
+ get schema(): Dict<Storable<keyof import("pema").DataType>>;
92
+ get type(): StoreType<ExtractSchema<T>>;
93
+ get db(): DB;
94
+ get types(): Types;
95
+ get name(): string;
96
+ /**
97
+ * Count records
98
+ */
99
+ count(options?: {
100
+ where?: Where<T>;
101
+ }): Promise<number>;
102
+ /**
103
+ * Check whether a record with the given primary key exists.
104
+ */
105
+ has(pkv: PKV<T>): Promise<boolean>;
106
+ /**
107
+ * Get a record by primary key.
108
+ *
109
+ * - Without options: returns the full base record.
110
+ * - With `select`: returns a projected record.
111
+ * - With `with`: augments the record with relations.
112
+ */
113
+ get(pkv: PKV<T>): Promise<Schema<T>>;
114
+ get<const S extends Select<Schema<T>> | undefined = undefined, const W extends With<R> | undefined = undefined>(pkv: PKV<T>, options: {
115
+ select?: S;
116
+ with?: W;
117
+ }): Promise<WithRelations<Projected<Schema<T>, S>, R, W>>;
118
+ /**
119
+ * Try to get a record by primary key.
120
+ */
121
+ try(pkv: PKV<T>): Promise<Schema<T> | undefined>;
122
+ try<const S extends Select<Schema<T>> | undefined = undefined, const W extends With<R> | undefined = undefined>(pkv: PKV<T>, options: {
123
+ select?: S;
124
+ with?: W;
125
+ }): Promise<WithRelations<Projected<Schema<T>, S>, R, W> | undefined>;
126
+ /**
127
+ * Insert a single record.
128
+ */
129
+ insert(record: Insertable<T>): Promise<Schema<T>>;
130
+ /**
131
+ * Update a single record by primary key.
132
+ */
133
+ update(pkv: PKV<T>, options: {
134
+ set: $Set<T>;
135
+ }): Promise<void>;
136
+ /**
137
+ * Update multiple records (requires non-empty where).
138
+ */
139
+ update(options: {
140
+ where?: Where<T>;
141
+ set: $Set<T>;
142
+ }): Promise<number>;
143
+ /**
144
+ * Delete a single record by primary key.
145
+ */
146
+ delete(pkv: PKV<T>): Promise<void>;
147
+ /**
148
+ * Delete multiple records (requires non-empty where).
149
+ */
150
+ delete(options: {
151
+ where: Where<T>;
152
+ }): Promise<number>;
153
+ /**
154
+ * Find matching records
155
+ *
156
+ */
157
+ find<const S extends Select<Schema<T>> | undefined = undefined, const W extends With<R> | undefined = undefined>(options?: {
158
+ where?: Where<T>;
159
+ select?: S;
160
+ sort?: Sort<Schema<T>>;
161
+ limit?: number;
162
+ with?: W;
163
+ }): Promise<WithRelations<Projected<Schema<T>, S>, R, W>[]>;
164
+ toJSON(): {
165
+ type: "object";
166
+ properties: Dict<import("pema").Serialized>;
167
+ };
168
+ extend<A extends Dict>(extensor: (This: this) => A): this & A;
169
+ }
170
+ export {};
171
+ //# sourceMappingURL=Store.d.ts.map