@noy-db/hub 0.3.0 → 0.4.0-pre.1

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 (375) hide show
  1. package/dist/aggregate/index.js +4 -4
  2. package/dist/api-IQFZJSQO.js +20 -0
  3. package/dist/as/index.js +11 -11
  4. package/dist/attestation/index.js +18 -18
  5. package/dist/{backup-BJ57IKAO.js → backup-LU2DTZTI.js} +11 -11
  6. package/dist/blobs/index.js +12 -12
  7. package/dist/broker/index.js +12 -12
  8. package/dist/bundle/index.js +26 -74
  9. package/dist/bundle/index.js.map +1 -1
  10. package/dist/by/index.js +2 -2
  11. package/dist/cargo/index.js +41 -22
  12. package/dist/chunk-2IALOXZS.js +24 -0
  13. package/dist/chunk-2IALOXZS.js.map +1 -0
  14. package/dist/{chunk-EVVGJDRQ.js → chunk-2MUZ3LY6.js} +3 -3
  15. package/dist/{chunk-NWSGI5C7.js → chunk-2P7EGNKF.js} +3 -3
  16. package/dist/{chunk-ZAJAVEXY.js → chunk-2PCAVW2I.js} +2 -2
  17. package/dist/{chunk-HTJQYHZP.js → chunk-3ELCWU56.js} +2 -2
  18. package/dist/{chunk-X7QBD67R.js → chunk-3PF6CRDT.js} +136 -114
  19. package/dist/chunk-3PF6CRDT.js.map +1 -0
  20. package/dist/{chunk-J2ZX2XUV.js → chunk-3SV2EPMN.js} +5 -5
  21. package/dist/{chunk-FUG4SFN3.js → chunk-3U3FBR7O.js} +2 -2
  22. package/dist/{chunk-VFUPHI2Z.js → chunk-4BRCIYFG.js} +6 -6
  23. package/dist/{chunk-SNZ6URZZ.js → chunk-5OI6BR4H.js} +7 -7
  24. package/dist/{chunk-B3HJYUOF.js → chunk-5WZXVULX.js} +2 -2
  25. package/dist/{chunk-LASZKVMO.js → chunk-6B4DYGWO.js} +3 -3
  26. package/dist/{chunk-ZJ2AK4V7.js → chunk-6HPG2YNX.js} +2 -2
  27. package/dist/{chunk-5M5DVGV7.js → chunk-6HY2X62D.js} +2 -2
  28. package/dist/{chunk-QRB7NAOJ.js → chunk-6NQMXTYC.js} +2 -2
  29. package/dist/{chunk-RIX4V2TB.js → chunk-6XE5TMPR.js} +3 -3
  30. package/dist/{chunk-BDVFPG6Y.js → chunk-7CI6CP7Z.js} +5 -5
  31. package/dist/{chunk-VLFCJYTL.js → chunk-7O3AYBC7.js} +63 -10
  32. package/dist/chunk-7O3AYBC7.js.map +1 -0
  33. package/dist/{chunk-454JXE57.js → chunk-A5BDDEXK.js} +10 -170
  34. package/dist/chunk-A5BDDEXK.js.map +1 -0
  35. package/dist/{chunk-FHS2HQSH.js → chunk-A7JJLVGH.js} +11 -8
  36. package/dist/chunk-A7JJLVGH.js.map +1 -0
  37. package/dist/{chunk-FM3G3NOY.js → chunk-BGK233EA.js} +83 -6
  38. package/dist/chunk-BGK233EA.js.map +1 -0
  39. package/dist/{chunk-OSDB5WW3.js → chunk-BMQWTQZ4.js} +11 -11
  40. package/dist/{chunk-W22IKJE2.js → chunk-BOKIKJJB.js} +2 -2
  41. package/dist/{chunk-CRI4OUV4.js → chunk-CBSY2N76.js} +2 -2
  42. package/dist/{chunk-2NVOWNI3.js → chunk-CCOP5XDW.js} +4 -4
  43. package/dist/{chunk-CDUQTA3Z.js → chunk-DDATL6PU.js} +7 -7
  44. package/dist/{chunk-RCVJZMFE.js → chunk-DDHM2TLX.js} +4 -4
  45. package/dist/{chunk-PN2XMATY.js → chunk-DRWBEDYO.js} +2 -2
  46. package/dist/{chunk-XDYREZWE.js → chunk-DVUZMT2W.js} +12 -8
  47. package/dist/{chunk-XDYREZWE.js.map → chunk-DVUZMT2W.js.map} +1 -1
  48. package/dist/{chunk-T2FFWNPK.js → chunk-EGCRBCNA.js} +3 -3
  49. package/dist/{chunk-VZRODIM3.js → chunk-F6T6L2UK.js} +4 -4
  50. package/dist/chunk-FH52K7EG.js +50 -0
  51. package/dist/chunk-FH52K7EG.js.map +1 -0
  52. package/dist/{chunk-EXK7QRWF.js → chunk-G6EQYAL6.js} +5 -5
  53. package/dist/{chunk-F64IRYG3.js → chunk-GQNGCEP5.js} +2 -2
  54. package/dist/{chunk-6JTIAGHD.js → chunk-GULTLPFB.js} +3 -3
  55. package/dist/chunk-GULTLPFB.js.map +1 -0
  56. package/dist/{chunk-ZUODRVHY.js → chunk-GVZQ4NAM.js} +2 -2
  57. package/dist/{chunk-3B5VVCNY.js → chunk-GWKAVKHI.js} +2 -2
  58. package/dist/{chunk-SLFHQTTW.js → chunk-GYYCX5K6.js} +5 -5
  59. package/dist/{chunk-CIE2BASH.js → chunk-HOONYZY2.js} +2 -2
  60. package/dist/{chunk-EYZ6IQ6X.js → chunk-HPUWOVR7.js} +5 -5
  61. package/dist/{chunk-IL6POWCW.js → chunk-IM3QVF53.js} +6 -6
  62. package/dist/{chunk-NJ4EOKMB.js → chunk-IRQY7IR5.js} +4 -4
  63. package/dist/{chunk-3QCRBHCY.js → chunk-ISMV2QVG.js} +2 -2
  64. package/dist/{chunk-HB3RFQSC.js → chunk-IY23KFNZ.js} +3 -3
  65. package/dist/chunk-J6Q7UVQE.js +248 -0
  66. package/dist/chunk-J6Q7UVQE.js.map +1 -0
  67. package/dist/{chunk-6CRIV7DE.js → chunk-JBBSYJHP.js} +2 -2
  68. package/dist/{chunk-MEFJPTZ4.js → chunk-JRBNCUNT.js} +3 -3
  69. package/dist/{chunk-4VNQOLML.js → chunk-JVBO4SZL.js} +2 -2
  70. package/dist/{chunk-I6GALP6E.js → chunk-JZWWLLVY.js} +6 -6
  71. package/dist/{chunk-RYCTDFUX.js → chunk-KUIB4B5Q.js} +2 -2
  72. package/dist/{chunk-HDQIIUPH.js → chunk-KUPKLSX5.js} +3 -3
  73. package/dist/{chunk-5O3XF4DV.js → chunk-KWVJAOIN.js} +4 -4
  74. package/dist/{chunk-3LQ2YKO4.js → chunk-LB6OH6K2.js} +2 -2
  75. package/dist/{chunk-AUSTCW2X.js → chunk-LOF2W3JU.js} +8 -8
  76. package/dist/{chunk-JNAI2HN2.js → chunk-LSASLXGC.js} +1 -1
  77. package/dist/chunk-LSASLXGC.js.map +1 -0
  78. package/dist/{chunk-K5IMOGHB.js → chunk-M75ZZHSR.js} +2 -2
  79. package/dist/{chunk-GTGPO5KW.js → chunk-MQ6WOPSY.js} +5 -5
  80. package/dist/{chunk-4CTHCN4J.js → chunk-MTQPRQHB.js} +4 -4
  81. package/dist/{chunk-UNFPPVNI.js → chunk-N55W7KUL.js} +2 -2
  82. package/dist/{chunk-JKJOGPZN.js → chunk-N6WF5PKC.js} +2 -2
  83. package/dist/{chunk-6T2SCQRU.js → chunk-O7WJ47EF.js} +4 -4
  84. package/dist/{chunk-JIF24JPM.js → chunk-OF75ACKS.js} +9 -9
  85. package/dist/{chunk-GKEWXIV5.js → chunk-ONTBCHCP.js} +2 -2
  86. package/dist/{chunk-4JBYV75E.js → chunk-PK6QCH2C.js} +5 -5
  87. package/dist/{chunk-6QTNZJBS.js → chunk-PT37L5DV.js} +3 -3
  88. package/dist/{chunk-EVX47VBM.js → chunk-QDPZWTN2.js} +2 -2
  89. package/dist/chunk-RA5VTXXG.js +173 -0
  90. package/dist/chunk-RA5VTXXG.js.map +1 -0
  91. package/dist/{chunk-QLWMEXCT.js → chunk-RDXW3OBQ.js} +2 -2
  92. package/dist/{chunk-Q5VNKNE5.js → chunk-RM2XV574.js} +3 -3
  93. package/dist/{chunk-ERJ7FU55.js → chunk-RND5ZPNP.js} +3 -3
  94. package/dist/{chunk-JZUV47FZ.js → chunk-RTEK4C4I.js} +2 -2
  95. package/dist/{chunk-KSKBRKGJ.js → chunk-S3BFKGET.js} +84 -6
  96. package/dist/chunk-S3BFKGET.js.map +1 -0
  97. package/dist/{chunk-5YOLBEQ6.js → chunk-S6Q37VGE.js} +2 -2
  98. package/dist/{chunk-HDMEGAQE.js → chunk-SMGEYW6G.js} +127 -8
  99. package/dist/chunk-SMGEYW6G.js.map +1 -0
  100. package/dist/{chunk-E5ZQT5KX.js → chunk-SMIRGMS7.js} +2 -2
  101. package/dist/chunk-T36RFODW.js +180 -0
  102. package/dist/chunk-T36RFODW.js.map +1 -0
  103. package/dist/{chunk-EQO2UVP4.js → chunk-T6GU5PPZ.js} +6 -6
  104. package/dist/{chunk-LXEXBTKL.js → chunk-TAGR72IR.js} +4 -4
  105. package/dist/{chunk-YFXZEAYK.js → chunk-TOPYT5U5.js} +6 -6
  106. package/dist/{chunk-MV43JSJF.js → chunk-UBNCR3YK.js} +4 -4
  107. package/dist/{chunk-ZICD77GM.js → chunk-UC2ETWF3.js} +2 -2
  108. package/dist/{chunk-XWZVFISC.js → chunk-UFEVO57O.js} +6 -6
  109. package/dist/{chunk-NR5LT5RY.js → chunk-UNCOC7QH.js} +7 -7
  110. package/dist/{chunk-R4ROFEYC.js → chunk-VAIS3SOM.js} +2 -2
  111. package/dist/{chunk-VN3DBQAU.js → chunk-VCBHAE4R.js} +2 -2
  112. package/dist/{chunk-M4CV6BRT.js → chunk-VEALDPHW.js} +2 -2
  113. package/dist/{chunk-BIOUI4HL.js → chunk-W2OG6JOL.js} +1 -1
  114. package/dist/{chunk-BIOUI4HL.js.map → chunk-W2OG6JOL.js.map} +1 -1
  115. package/dist/{chunk-7DSTRQIJ.js → chunk-WEYZTLXN.js} +2 -2
  116. package/dist/{chunk-CAF6WOK7.js → chunk-WNGGJWF7.js} +2 -2
  117. package/dist/{chunk-IU6SNYX6.js → chunk-YJV2UZ7H.js} +5 -5
  118. package/dist/{chunk-RZ5SVOYR.js → chunk-YTGDPCPW.js} +2 -2
  119. package/dist/{chunk-DLG74CNB.js → chunk-ZEQWCBCM.js} +7 -19
  120. package/dist/chunk-ZEQWCBCM.js.map +1 -0
  121. package/dist/classified/index.js +5 -5
  122. package/dist/{classified-marker-CZKA6ITE.js → classified-marker-WQVIJAW2.js} +3 -3
  123. package/dist/collection-facade-MJXSC3Q6.js +44 -0
  124. package/dist/{computed-ZIQTYTDI.js → computed-DSMPXG2Y.js} +3 -3
  125. package/dist/consent/index.js +9 -9
  126. package/dist/{public-envelope-B4KNWVUA.js → cover-B5SJDHR3.js} +25 -5
  127. package/dist/{dead-filter-ESOBZZP5.js → dead-filter-2A7IAJ3D.js} +2 -2
  128. package/dist/delegation-A5A75KQO.js +25 -0
  129. package/dist/derivations/index.js +12 -12
  130. package/dist/derive-HJSMH7RA.js +21 -0
  131. package/dist/{enclave-AP3I5W7O.js → enclave-7MW6ZGXW.js} +11 -9
  132. package/dist/executor-AXE4XMLT.js +26 -0
  133. package/dist/executor-KGNLJD6M.js +9 -0
  134. package/dist/executor-XGIS6CR7.js +9 -0
  135. package/dist/export-accessible-VVBJM3MM.js +23 -0
  136. package/dist/extract-partition-LGGBTQET.js +38 -0
  137. package/dist/{fanout-sidecar-A765THMX.js → fanout-sidecar-WDYQ77VB.js} +9 -9
  138. package/dist/find-YS6XWB46.js +11 -0
  139. package/dist/forget/index.js +9 -9
  140. package/dist/guards/index.js +6 -6
  141. package/dist/history/index.js +12 -12
  142. package/dist/i18n/index.js +14 -14
  143. package/dist/index.d.ts +6 -3
  144. package/dist/index.js +140 -117
  145. package/dist/index.js.map +1 -1
  146. package/dist/indexing/index.js +2 -2
  147. package/dist/issue-LSR5PS6H.js +19 -0
  148. package/dist/kernel/enclave/index.d.ts +1 -1
  149. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +8 -0
  150. package/dist/kernel/errors.d.ts +10 -5
  151. package/dist/kernel/noydb.d.ts +21 -11
  152. package/dist/kernel/types.d.ts +53 -6
  153. package/dist/kernel/vault.d.ts +10 -6
  154. package/dist/{ledger-GFBKVPV4.js → ledger-33BC4TR7.js} +11 -11
  155. package/dist/liberate-GBSAYLPJ.js +24 -0
  156. package/dist/{link-set-Z7Q2ASFX.js → link-set-QK22TDEX.js} +11 -11
  157. package/dist/materialized-views/index.js +19 -18
  158. package/dist/noydb-MTUBMWFE.js +70 -0
  159. package/dist/on/index.js +9 -9
  160. package/dist/overlay-views/index.js +4 -4
  161. package/dist/periods/index.js +19 -17
  162. package/dist/pod/index.js +13 -11
  163. package/dist/{policy-Z3RUAIY2.js → policy-NAHB2TUT.js} +5 -5
  164. package/dist/portability/index.js +8 -8
  165. package/dist/{post-register-JTH76BLY.js → post-register-JVTMJ6OW.js} +6 -6
  166. package/dist/query/index.js +10 -8
  167. package/dist/register-X462DNDM.js +23 -0
  168. package/dist/registry-3XMCT7MQ.js +18 -0
  169. package/dist/registry-KHD2I3M2.js +19 -0
  170. package/dist/registry-NPOWJHC4.js +9 -0
  171. package/dist/request-withdrawal-U7K3JTMY.js +31 -0
  172. package/dist/{reveal-DIBHLUZX.js → reveal-LGBOM2BO.js} +6 -6
  173. package/dist/revoke-OCWDSWRQ.js +24 -0
  174. package/dist/satellites/index.js +1 -1
  175. package/dist/sealed-record/index.js +12 -12
  176. package/dist/{seed-Q6M2IZFL.js → seed-PWK45HDF.js} +11 -11
  177. package/dist/session/index.js +9 -9
  178. package/dist/shadow/index.js +2 -2
  179. package/dist/share-link/index.d.ts +19 -0
  180. package/dist/share-link/index.js +201 -0
  181. package/dist/share-link/index.js.map +1 -0
  182. package/dist/share-link/share-link.d.ts +123 -0
  183. package/dist/signer-3YFBLZRN.js +25 -0
  184. package/dist/snapshots/index.js +10 -10
  185. package/dist/{stale-OSQ7J3AA.js → stale-FJED42DM.js} +10 -10
  186. package/dist/storage-W3GURVFU.js +23 -0
  187. package/dist/{store-coordination-provider-64OEZFGS.js → store-coordination-provider-APODTV4W.js} +3 -3
  188. package/dist/sync/index.js +10 -9
  189. package/dist/sync/index.js.map +1 -1
  190. package/dist/team/index.js +16 -15
  191. package/dist/tiers/index.js +10 -10
  192. package/dist/to/index.js +1 -1
  193. package/dist/tx/index.js +3 -3
  194. package/dist/util/index.js +1 -1
  195. package/dist/{verify-ZASTRNPR.js → verify-26Y5GNMK.js} +5 -5
  196. package/dist/via/i18n/policy.d.ts +1 -1
  197. package/dist/{walk-SVNDIZ62.js → walk-XS3PKM6I.js} +11 -11
  198. package/dist/with/index.js +11 -11
  199. package/dist/with-audit/periods/periods.d.ts +1 -16
  200. package/dist/with-audit/periods/window.d.ts +16 -0
  201. package/dist/with-cargo/index.d.ts +6 -0
  202. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +15 -0
  203. package/dist/with-formula/materialized-views/index.d.ts +1 -1
  204. package/dist/with-formula/materialized-views/registry.d.ts +29 -0
  205. package/dist/with-formula/materialized-views/types.d.ts +81 -0
  206. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +9 -5
  207. package/dist/with-party/directory/cover/custom.d.ts +34 -0
  208. package/dist/with-party/directory/cover/index.d.ts +19 -0
  209. package/dist/with-party/directory/cover/schema.d.ts +39 -0
  210. package/dist/with-party/directory/cover/storage.d.ts +71 -0
  211. package/dist/with-party/directory/cover/types.d.ts +149 -0
  212. package/dist/with-party/team/noydb-facade.d.ts +1 -1
  213. package/dist/with-party/team/sync-period-scope.d.ts +78 -0
  214. package/dist/with-party/team/sync.d.ts +13 -0
  215. package/dist/with-pod/bundle.d.ts +9 -7
  216. package/dist/with-pod/format.d.ts +8 -4
  217. package/dist/with-pod/index.d.ts +2 -1
  218. package/dist/withdraw-accessible-Y3B2535F.js +28 -0
  219. package/package.json +7 -3
  220. package/dist/api-ZGS6LCOF.js +0 -20
  221. package/dist/chunk-454JXE57.js.map +0 -1
  222. package/dist/chunk-4NXKCLLQ.js +0 -97
  223. package/dist/chunk-4NXKCLLQ.js.map +0 -1
  224. package/dist/chunk-6JTIAGHD.js.map +0 -1
  225. package/dist/chunk-DLG74CNB.js.map +0 -1
  226. package/dist/chunk-FHS2HQSH.js.map +0 -1
  227. package/dist/chunk-FM3G3NOY.js.map +0 -1
  228. package/dist/chunk-HDMEGAQE.js.map +0 -1
  229. package/dist/chunk-JNAI2HN2.js.map +0 -1
  230. package/dist/chunk-KSKBRKGJ.js.map +0 -1
  231. package/dist/chunk-VLFCJYTL.js.map +0 -1
  232. package/dist/chunk-WXSYDNBT.js +0 -39
  233. package/dist/chunk-WXSYDNBT.js.map +0 -1
  234. package/dist/chunk-X3YYQWOQ.js +0 -155
  235. package/dist/chunk-X3YYQWOQ.js.map +0 -1
  236. package/dist/chunk-X7QBD67R.js.map +0 -1
  237. package/dist/collection-facade-TLWIPI76.js +0 -44
  238. package/dist/delegation-W7ZV2322.js +0 -25
  239. package/dist/derive-H2BJTLUI.js +0 -21
  240. package/dist/executor-KGWTNEQD.js +0 -9
  241. package/dist/executor-OVEXR6RT.js +0 -9
  242. package/dist/executor-UNEH5ZYH.js +0 -25
  243. package/dist/export-accessible-PCMXSUZS.js +0 -23
  244. package/dist/extract-partition-SWHFSYJO.js +0 -38
  245. package/dist/find-N6345CNT.js +0 -11
  246. package/dist/issue-5OKB6I2R.js +0 -19
  247. package/dist/liberate-3VDOT4KO.js +0 -24
  248. package/dist/noydb-ZCJOYBDI.js +0 -68
  249. package/dist/register-VAHONCID.js +0 -23
  250. package/dist/registry-7MLVD3VO.js +0 -19
  251. package/dist/registry-EPKPD5SM.js +0 -18
  252. package/dist/registry-P5T7PS2U.js +0 -9
  253. package/dist/request-withdrawal-TI3A5WPS.js +0 -31
  254. package/dist/revoke-FDRD6GRW.js +0 -24
  255. package/dist/signer-MUWEIUI6.js +0 -25
  256. package/dist/storage-MVFCGEQE.js +0 -23
  257. package/dist/with-party/directory/public-envelope/index.d.ts +0 -12
  258. package/dist/with-party/directory/public-envelope/schema.d.ts +0 -24
  259. package/dist/with-party/directory/public-envelope/storage.d.ts +0 -59
  260. package/dist/with-party/directory/public-envelope/types.d.ts +0 -80
  261. package/dist/withdraw-accessible-WZIEVWSR.js +0 -28
  262. /package/dist/{api-ZGS6LCOF.js.map → api-IQFZJSQO.js.map} +0 -0
  263. /package/dist/{backup-BJ57IKAO.js.map → backup-LU2DTZTI.js.map} +0 -0
  264. /package/dist/{chunk-EVVGJDRQ.js.map → chunk-2MUZ3LY6.js.map} +0 -0
  265. /package/dist/{chunk-NWSGI5C7.js.map → chunk-2P7EGNKF.js.map} +0 -0
  266. /package/dist/{chunk-ZAJAVEXY.js.map → chunk-2PCAVW2I.js.map} +0 -0
  267. /package/dist/{chunk-HTJQYHZP.js.map → chunk-3ELCWU56.js.map} +0 -0
  268. /package/dist/{chunk-J2ZX2XUV.js.map → chunk-3SV2EPMN.js.map} +0 -0
  269. /package/dist/{chunk-FUG4SFN3.js.map → chunk-3U3FBR7O.js.map} +0 -0
  270. /package/dist/{chunk-VFUPHI2Z.js.map → chunk-4BRCIYFG.js.map} +0 -0
  271. /package/dist/{chunk-SNZ6URZZ.js.map → chunk-5OI6BR4H.js.map} +0 -0
  272. /package/dist/{chunk-B3HJYUOF.js.map → chunk-5WZXVULX.js.map} +0 -0
  273. /package/dist/{chunk-LASZKVMO.js.map → chunk-6B4DYGWO.js.map} +0 -0
  274. /package/dist/{chunk-ZJ2AK4V7.js.map → chunk-6HPG2YNX.js.map} +0 -0
  275. /package/dist/{chunk-5M5DVGV7.js.map → chunk-6HY2X62D.js.map} +0 -0
  276. /package/dist/{chunk-QRB7NAOJ.js.map → chunk-6NQMXTYC.js.map} +0 -0
  277. /package/dist/{chunk-RIX4V2TB.js.map → chunk-6XE5TMPR.js.map} +0 -0
  278. /package/dist/{chunk-BDVFPG6Y.js.map → chunk-7CI6CP7Z.js.map} +0 -0
  279. /package/dist/{chunk-OSDB5WW3.js.map → chunk-BMQWTQZ4.js.map} +0 -0
  280. /package/dist/{chunk-W22IKJE2.js.map → chunk-BOKIKJJB.js.map} +0 -0
  281. /package/dist/{chunk-CRI4OUV4.js.map → chunk-CBSY2N76.js.map} +0 -0
  282. /package/dist/{chunk-2NVOWNI3.js.map → chunk-CCOP5XDW.js.map} +0 -0
  283. /package/dist/{chunk-CDUQTA3Z.js.map → chunk-DDATL6PU.js.map} +0 -0
  284. /package/dist/{chunk-RCVJZMFE.js.map → chunk-DDHM2TLX.js.map} +0 -0
  285. /package/dist/{chunk-PN2XMATY.js.map → chunk-DRWBEDYO.js.map} +0 -0
  286. /package/dist/{chunk-T2FFWNPK.js.map → chunk-EGCRBCNA.js.map} +0 -0
  287. /package/dist/{chunk-VZRODIM3.js.map → chunk-F6T6L2UK.js.map} +0 -0
  288. /package/dist/{chunk-EXK7QRWF.js.map → chunk-G6EQYAL6.js.map} +0 -0
  289. /package/dist/{chunk-F64IRYG3.js.map → chunk-GQNGCEP5.js.map} +0 -0
  290. /package/dist/{chunk-ZUODRVHY.js.map → chunk-GVZQ4NAM.js.map} +0 -0
  291. /package/dist/{chunk-3B5VVCNY.js.map → chunk-GWKAVKHI.js.map} +0 -0
  292. /package/dist/{chunk-SLFHQTTW.js.map → chunk-GYYCX5K6.js.map} +0 -0
  293. /package/dist/{chunk-CIE2BASH.js.map → chunk-HOONYZY2.js.map} +0 -0
  294. /package/dist/{chunk-EYZ6IQ6X.js.map → chunk-HPUWOVR7.js.map} +0 -0
  295. /package/dist/{chunk-IL6POWCW.js.map → chunk-IM3QVF53.js.map} +0 -0
  296. /package/dist/{chunk-NJ4EOKMB.js.map → chunk-IRQY7IR5.js.map} +0 -0
  297. /package/dist/{chunk-3QCRBHCY.js.map → chunk-ISMV2QVG.js.map} +0 -0
  298. /package/dist/{chunk-HB3RFQSC.js.map → chunk-IY23KFNZ.js.map} +0 -0
  299. /package/dist/{chunk-6CRIV7DE.js.map → chunk-JBBSYJHP.js.map} +0 -0
  300. /package/dist/{chunk-MEFJPTZ4.js.map → chunk-JRBNCUNT.js.map} +0 -0
  301. /package/dist/{chunk-4VNQOLML.js.map → chunk-JVBO4SZL.js.map} +0 -0
  302. /package/dist/{chunk-I6GALP6E.js.map → chunk-JZWWLLVY.js.map} +0 -0
  303. /package/dist/{chunk-RYCTDFUX.js.map → chunk-KUIB4B5Q.js.map} +0 -0
  304. /package/dist/{chunk-HDQIIUPH.js.map → chunk-KUPKLSX5.js.map} +0 -0
  305. /package/dist/{chunk-5O3XF4DV.js.map → chunk-KWVJAOIN.js.map} +0 -0
  306. /package/dist/{chunk-3LQ2YKO4.js.map → chunk-LB6OH6K2.js.map} +0 -0
  307. /package/dist/{chunk-AUSTCW2X.js.map → chunk-LOF2W3JU.js.map} +0 -0
  308. /package/dist/{chunk-K5IMOGHB.js.map → chunk-M75ZZHSR.js.map} +0 -0
  309. /package/dist/{chunk-GTGPO5KW.js.map → chunk-MQ6WOPSY.js.map} +0 -0
  310. /package/dist/{chunk-4CTHCN4J.js.map → chunk-MTQPRQHB.js.map} +0 -0
  311. /package/dist/{chunk-UNFPPVNI.js.map → chunk-N55W7KUL.js.map} +0 -0
  312. /package/dist/{chunk-JKJOGPZN.js.map → chunk-N6WF5PKC.js.map} +0 -0
  313. /package/dist/{chunk-6T2SCQRU.js.map → chunk-O7WJ47EF.js.map} +0 -0
  314. /package/dist/{chunk-JIF24JPM.js.map → chunk-OF75ACKS.js.map} +0 -0
  315. /package/dist/{chunk-GKEWXIV5.js.map → chunk-ONTBCHCP.js.map} +0 -0
  316. /package/dist/{chunk-4JBYV75E.js.map → chunk-PK6QCH2C.js.map} +0 -0
  317. /package/dist/{chunk-6QTNZJBS.js.map → chunk-PT37L5DV.js.map} +0 -0
  318. /package/dist/{chunk-EVX47VBM.js.map → chunk-QDPZWTN2.js.map} +0 -0
  319. /package/dist/{chunk-QLWMEXCT.js.map → chunk-RDXW3OBQ.js.map} +0 -0
  320. /package/dist/{chunk-Q5VNKNE5.js.map → chunk-RM2XV574.js.map} +0 -0
  321. /package/dist/{chunk-ERJ7FU55.js.map → chunk-RND5ZPNP.js.map} +0 -0
  322. /package/dist/{chunk-JZUV47FZ.js.map → chunk-RTEK4C4I.js.map} +0 -0
  323. /package/dist/{chunk-5YOLBEQ6.js.map → chunk-S6Q37VGE.js.map} +0 -0
  324. /package/dist/{chunk-E5ZQT5KX.js.map → chunk-SMIRGMS7.js.map} +0 -0
  325. /package/dist/{chunk-EQO2UVP4.js.map → chunk-T6GU5PPZ.js.map} +0 -0
  326. /package/dist/{chunk-LXEXBTKL.js.map → chunk-TAGR72IR.js.map} +0 -0
  327. /package/dist/{chunk-YFXZEAYK.js.map → chunk-TOPYT5U5.js.map} +0 -0
  328. /package/dist/{chunk-MV43JSJF.js.map → chunk-UBNCR3YK.js.map} +0 -0
  329. /package/dist/{chunk-ZICD77GM.js.map → chunk-UC2ETWF3.js.map} +0 -0
  330. /package/dist/{chunk-XWZVFISC.js.map → chunk-UFEVO57O.js.map} +0 -0
  331. /package/dist/{chunk-NR5LT5RY.js.map → chunk-UNCOC7QH.js.map} +0 -0
  332. /package/dist/{chunk-R4ROFEYC.js.map → chunk-VAIS3SOM.js.map} +0 -0
  333. /package/dist/{chunk-VN3DBQAU.js.map → chunk-VCBHAE4R.js.map} +0 -0
  334. /package/dist/{chunk-M4CV6BRT.js.map → chunk-VEALDPHW.js.map} +0 -0
  335. /package/dist/{chunk-7DSTRQIJ.js.map → chunk-WEYZTLXN.js.map} +0 -0
  336. /package/dist/{chunk-CAF6WOK7.js.map → chunk-WNGGJWF7.js.map} +0 -0
  337. /package/dist/{chunk-IU6SNYX6.js.map → chunk-YJV2UZ7H.js.map} +0 -0
  338. /package/dist/{chunk-RZ5SVOYR.js.map → chunk-YTGDPCPW.js.map} +0 -0
  339. /package/dist/{classified-marker-CZKA6ITE.js.map → classified-marker-WQVIJAW2.js.map} +0 -0
  340. /package/dist/{collection-facade-TLWIPI76.js.map → collection-facade-MJXSC3Q6.js.map} +0 -0
  341. /package/dist/{computed-ZIQTYTDI.js.map → computed-DSMPXG2Y.js.map} +0 -0
  342. /package/dist/{delegation-W7ZV2322.js.map → cover-B5SJDHR3.js.map} +0 -0
  343. /package/dist/{dead-filter-ESOBZZP5.js.map → dead-filter-2A7IAJ3D.js.map} +0 -0
  344. /package/dist/{derive-H2BJTLUI.js.map → delegation-A5A75KQO.js.map} +0 -0
  345. /package/dist/{enclave-AP3I5W7O.js.map → derive-HJSMH7RA.js.map} +0 -0
  346. /package/dist/{executor-KGWTNEQD.js.map → enclave-7MW6ZGXW.js.map} +0 -0
  347. /package/dist/{executor-OVEXR6RT.js.map → executor-AXE4XMLT.js.map} +0 -0
  348. /package/dist/{executor-UNEH5ZYH.js.map → executor-KGNLJD6M.js.map} +0 -0
  349. /package/dist/{export-accessible-PCMXSUZS.js.map → executor-XGIS6CR7.js.map} +0 -0
  350. /package/dist/{extract-partition-SWHFSYJO.js.map → export-accessible-VVBJM3MM.js.map} +0 -0
  351. /package/dist/{find-N6345CNT.js.map → extract-partition-LGGBTQET.js.map} +0 -0
  352. /package/dist/{fanout-sidecar-A765THMX.js.map → fanout-sidecar-WDYQ77VB.js.map} +0 -0
  353. /package/dist/{issue-5OKB6I2R.js.map → find-YS6XWB46.js.map} +0 -0
  354. /package/dist/{ledger-GFBKVPV4.js.map → issue-LSR5PS6H.js.map} +0 -0
  355. /package/dist/{liberate-3VDOT4KO.js.map → ledger-33BC4TR7.js.map} +0 -0
  356. /package/dist/{link-set-Z7Q2ASFX.js.map → liberate-GBSAYLPJ.js.map} +0 -0
  357. /package/dist/{noydb-ZCJOYBDI.js.map → link-set-QK22TDEX.js.map} +0 -0
  358. /package/dist/{policy-Z3RUAIY2.js.map → noydb-MTUBMWFE.js.map} +0 -0
  359. /package/dist/{public-envelope-B4KNWVUA.js.map → policy-NAHB2TUT.js.map} +0 -0
  360. /package/dist/{post-register-JTH76BLY.js.map → post-register-JVTMJ6OW.js.map} +0 -0
  361. /package/dist/{register-VAHONCID.js.map → register-X462DNDM.js.map} +0 -0
  362. /package/dist/{registry-7MLVD3VO.js.map → registry-3XMCT7MQ.js.map} +0 -0
  363. /package/dist/{registry-EPKPD5SM.js.map → registry-KHD2I3M2.js.map} +0 -0
  364. /package/dist/{registry-P5T7PS2U.js.map → registry-NPOWJHC4.js.map} +0 -0
  365. /package/dist/{request-withdrawal-TI3A5WPS.js.map → request-withdrawal-U7K3JTMY.js.map} +0 -0
  366. /package/dist/{reveal-DIBHLUZX.js.map → reveal-LGBOM2BO.js.map} +0 -0
  367. /package/dist/{revoke-FDRD6GRW.js.map → revoke-OCWDSWRQ.js.map} +0 -0
  368. /package/dist/{seed-Q6M2IZFL.js.map → seed-PWK45HDF.js.map} +0 -0
  369. /package/dist/{signer-MUWEIUI6.js.map → signer-3YFBLZRN.js.map} +0 -0
  370. /package/dist/{stale-OSQ7J3AA.js.map → stale-FJED42DM.js.map} +0 -0
  371. /package/dist/{storage-MVFCGEQE.js.map → storage-W3GURVFU.js.map} +0 -0
  372. /package/dist/{store-coordination-provider-64OEZFGS.js.map → store-coordination-provider-APODTV4W.js.map} +0 -0
  373. /package/dist/{verify-ZASTRNPR.js.map → verify-26Y5GNMK.js.map} +0 -0
  374. /package/dist/{walk-SVNDIZ62.js.map → walk-XS3PKM6I.js.map} +0 -0
  375. /package/dist/{withdraw-accessible-WZIEVWSR.js.map → withdraw-accessible-Y3B2535F.js.map} +0 -0
@@ -0,0 +1,201 @@
1
+ import {
2
+ isULID
3
+ } from "../chunk-ZJADGNYF.js";
4
+ import "../chunk-PZ5AY32C.js";
5
+
6
+ // src/share-link/share-link.ts
7
+ var ShareLinkParseError = class extends Error {
8
+ /** Machine-readable error code. Stable across library versions. */
9
+ code;
10
+ constructor(code, message) {
11
+ super(message);
12
+ this.name = "ShareLinkParseError";
13
+ this.code = code;
14
+ }
15
+ };
16
+ var DUMMY_BASE = "https://share-link.invalid";
17
+ function encodeQueryValue(value) {
18
+ return encodeURIComponent(value).replace(/'/g, "%27");
19
+ }
20
+ function decodeCanonical(raw, code, what, { redact = false, encode = encodeURIComponent } = {}) {
21
+ const shown = redact ? "(redacted)" : `"${raw}"`;
22
+ let decoded;
23
+ try {
24
+ decoded = decodeURIComponent(raw);
25
+ } catch {
26
+ throw new ShareLinkParseError(code, `${what}: malformed percent-encoding in ${shown}`);
27
+ }
28
+ if (decoded === "") {
29
+ throw new ShareLinkParseError(code, `${what}: empty`);
30
+ }
31
+ if (encode(decoded) !== raw) {
32
+ throw new ShareLinkParseError(
33
+ code,
34
+ `${what}: ${shown} is not canonical encodeURIComponent output`
35
+ );
36
+ }
37
+ return decoded;
38
+ }
39
+ function decodePathSegment(raw, what) {
40
+ const decoded = decodeCanonical(raw, "MALFORMED_SEGMENT", what);
41
+ if (decoded === "." || decoded === "..") {
42
+ throw new ShareLinkParseError("MALFORMED_SEGMENT", `${what}: "${decoded}" is a dot segment`);
43
+ }
44
+ return decoded;
45
+ }
46
+ function parseVersion(raw) {
47
+ if (!/^(?:0|[1-9][0-9]*)$/.test(raw)) {
48
+ throw new ShareLinkParseError(
49
+ "INVALID_VERSION",
50
+ `version "${raw}" is not a canonical base-10 integer`
51
+ );
52
+ }
53
+ const version = Number(raw);
54
+ if (!Number.isSafeInteger(version)) {
55
+ throw new ShareLinkParseError("INVALID_VERSION", `version "${raw}" exceeds 2^53 - 1`);
56
+ }
57
+ return version;
58
+ }
59
+ function toUrl(input) {
60
+ if (input instanceof URL) {
61
+ if (input.protocol !== "http:" && input.protocol !== "https:") {
62
+ throw new ShareLinkParseError(
63
+ "UNKNOWN_PREFIX",
64
+ `unsupported protocol "${input.protocol}" \u2014 share links are http(s) URLs or bare /r/ paths`
65
+ );
66
+ }
67
+ return input;
68
+ }
69
+ if (input.startsWith("/")) {
70
+ try {
71
+ return new URL(input, DUMMY_BASE);
72
+ } catch {
73
+ throw new ShareLinkParseError("MALFORMED_URL", "unparseable share path");
74
+ }
75
+ }
76
+ if (/^https?:\/\//i.test(input)) {
77
+ try {
78
+ return new URL(input);
79
+ } catch {
80
+ throw new ShareLinkParseError("MALFORMED_URL", "unparseable share URL");
81
+ }
82
+ }
83
+ throw new ShareLinkParseError(
84
+ "UNKNOWN_PREFIX",
85
+ 'input is neither a "/"-rooted share path nor an http(s) URL'
86
+ );
87
+ }
88
+ function parseShareLink(input) {
89
+ const url = toUrl(input);
90
+ let pathname = url.pathname;
91
+ if (!pathname.startsWith("/r/")) {
92
+ const idx = pathname.indexOf("/r/");
93
+ if (idx === -1) {
94
+ throw new ShareLinkParseError(
95
+ "UNKNOWN_PREFIX",
96
+ `path "${pathname}" has no /r/ share prefix`
97
+ );
98
+ }
99
+ pathname = pathname.slice(idx);
100
+ }
101
+ const rawSegments = pathname.split("/");
102
+ if (rawSegments.length !== 5) {
103
+ throw new ShareLinkParseError(
104
+ "MALFORMED_PATH",
105
+ `expected /r/{vaultHandle}/{collection}/{recordId} \u2014 got ${rawSegments.length - 2} segment(s) after /r/`
106
+ );
107
+ }
108
+ const vaultHandle = decodePathSegment(rawSegments[2], "vault handle");
109
+ if (!isULID(vaultHandle)) {
110
+ throw new ShareLinkParseError(
111
+ "INVALID_VAULT_HANDLE",
112
+ `vault handle "${vaultHandle}" is not a ULID`
113
+ );
114
+ }
115
+ const collection = decodePathSegment(rawSegments[3], "collection");
116
+ const recordId = decodePathSegment(rawSegments[4], "record id");
117
+ let period;
118
+ let version;
119
+ if (url.search !== "") {
120
+ const seen = /* @__PURE__ */ new Set();
121
+ for (const pair of url.search.slice(1).split("&")) {
122
+ const eq = pair.indexOf("=");
123
+ if (eq <= 0) {
124
+ throw new ShareLinkParseError("MALFORMED_QUERY", `query pair "${pair}" is not key=value`);
125
+ }
126
+ const key = pair.slice(0, eq);
127
+ const rawValue = pair.slice(eq + 1);
128
+ if (key !== "period" && key !== "v") {
129
+ throw new ShareLinkParseError("UNKNOWN_QUERY_KEY", `unknown query key "${key}"`);
130
+ }
131
+ if (seen.has(key)) {
132
+ throw new ShareLinkParseError("DUPLICATE_QUERY_KEY", `duplicate query key "${key}"`);
133
+ }
134
+ seen.add(key);
135
+ if (key === "period") {
136
+ period = decodeCanonical(rawValue, "MALFORMED_QUERY", "period", {
137
+ encode: encodeQueryValue
138
+ });
139
+ } else {
140
+ version = parseVersion(rawValue);
141
+ }
142
+ }
143
+ }
144
+ let grantToken;
145
+ if (url.hash !== "" && url.hash !== "#") {
146
+ const fragment = url.hash.slice(1);
147
+ if (!fragment.startsWith("g=")) {
148
+ throw new ShareLinkParseError(
149
+ "MALFORMED_FRAGMENT",
150
+ "fragment is not a g={token} grant carrier"
151
+ );
152
+ }
153
+ grantToken = decodeCanonical(fragment.slice(2), "MALFORMED_FRAGMENT", "grant token", {
154
+ redact: true
155
+ });
156
+ }
157
+ return {
158
+ vaultHandle,
159
+ collection,
160
+ recordId,
161
+ ...period !== void 0 ? { period } : {},
162
+ ...version !== void 0 ? { version } : {},
163
+ ...grantToken !== void 0 ? { grantToken } : {}
164
+ };
165
+ }
166
+ function requirePart(value, what, dotSegmentRefused = false) {
167
+ if (typeof value !== "string" || value === "") {
168
+ throw new ShareLinkParseError("INVALID_PARTS", `${what} must be a non-empty string`);
169
+ }
170
+ if (dotSegmentRefused && (value === "." || value === "..")) {
171
+ throw new ShareLinkParseError("INVALID_PARTS", `${what}: "${value}" is a dot segment`);
172
+ }
173
+ return value;
174
+ }
175
+ function buildShareLink(parts, base) {
176
+ const { vaultHandle, collection, recordId, period, version, grantToken } = parts;
177
+ if (typeof vaultHandle !== "string" || !isULID(vaultHandle)) {
178
+ throw new ShareLinkParseError("INVALID_PARTS", "vaultHandle is not a ULID");
179
+ }
180
+ const path = `/r/${vaultHandle}/${encodeURIComponent(
181
+ requirePart(collection, "collection", true)
182
+ )}/${encodeURIComponent(requirePart(recordId, "recordId", true))}`;
183
+ const query = [];
184
+ if (period !== void 0) {
185
+ query.push(`period=${encodeQueryValue(requirePart(period, "period"))}`);
186
+ }
187
+ if (version !== void 0) {
188
+ if (typeof version !== "number" || !Number.isSafeInteger(version) || version < 0) {
189
+ throw new ShareLinkParseError("INVALID_PARTS", "version must be a non-negative safe integer");
190
+ }
191
+ query.push(`v=${version}`);
192
+ }
193
+ const fragment = grantToken !== void 0 ? `#g=${encodeURIComponent(requirePart(grantToken, "grantToken"))}` : "";
194
+ return (base ?? "") + path + (query.length > 0 ? `?${query.join("&")}` : "") + fragment;
195
+ }
196
+ export {
197
+ ShareLinkParseError,
198
+ buildShareLink,
199
+ parseShareLink
200
+ };
201
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/share-link/share-link.ts"],"sourcesContent":["/**\n * Portal share-link grammar + parse/build helper (#806).\n *\n * ONE canonical link grammar addresses `vault / period / collection /\n * record` across all three portal surfaces — the LIFF permalink path\n * (`https://liff.line.me/{liffId}/r/…`), the installed-PWA same-origin\n * path (`https://{portal-origin}/r/…`), and the vendor backend console.\n * The link SHAPE is identical everywhere; only the origin prefix\n * differs, and callers own the prefix.\n *\n * ## Grammar (frozen — see `__tests__/share-link-surface.golden.json`)\n *\n * ```\n * share-link = [ base ] \"/r/\" vault \"/\" collection \"/\" record\n * [ \"?\" query ] [ \"#\" fragment ]\n * vault = ULID ; 26 uppercase Crockford base32 chars\n * collection = segment ; opaque, non-empty after decode\n * record = segment ; opaque, non-empty after decode\n * query = pair *( \"&\" pair ) ; keys unique; ONLY these two keys\n * pair = \"period=\" component ; opaque period id\n * / \"v=\" version ; record version\n * version = \"0\" / %x31-39 *DIGIT ; base-10 integer, ≤ 2^53 − 1\n * fragment = \"g=\" component ; single-use grant token (opaque)\n * ```\n *\n * `segment` / `component` are strict-canonical `encodeURIComponent`\n * output: decoding then re-encoding MUST reproduce the raw text exactly\n * (uppercase-hex escapes, `+` is a literal plus never a space, `%2F`\n * inside a segment never creates an extra segment). Path segments\n * additionally may not decode to `.` or `..`. Links produced by\n * {@link buildShareLink} always satisfy this; hand-written links using\n * only unreserved characters (`inv-001`, ULIDs, …) do too.\n *\n * ## Transport rule for the grant token\n *\n * The optional single-use grant token travels ONLY in the URL fragment\n * (`#g={token}`) — never in the path or query — because fragments are\n * not sent to servers, so the token never reaches server logs, CDNs, or\n * LINE's infrastructure. Same rule `on-magic-link` follows. The token is\n * fully OPAQUE here: no validation beyond non-empty, no decoding of its\n * semantics — grant semantics live in `on-magic-link` (not imported).\n *\n * ## Fail closed\n *\n * {@link parseShareLink} throws a typed {@link ShareLinkParseError} for\n * ANYTHING that is not exactly the grammar above — unknown prefix,\n * missing/extra/empty/malformed segments, a non-ULID vault handle,\n * duplicate or unknown query keys, malformed fragments. There is never a\n * default-vault (or any other) fallback; the app maps the error to a 404.\n *\n * Zero dependencies on the hub floor: pure string/`URL` code, no crypto,\n * no store — LIFF shells, PWAs, and klum-db can import this subpath\n * without dragging anything else. (The one internal import is the pure,\n * leaf ULID shape check shared with the pod format.)\n */\n\nimport { isULID } from '../with-pod/ulid.js'\n\n/** Machine-readable {@link ShareLinkParseError} discriminant. */\nexport type ShareLinkErrorCode =\n | 'MALFORMED_URL'\n | 'UNKNOWN_PREFIX'\n | 'MALFORMED_PATH'\n | 'MALFORMED_SEGMENT'\n | 'INVALID_VAULT_HANDLE'\n | 'MALFORMED_QUERY'\n | 'DUPLICATE_QUERY_KEY'\n | 'UNKNOWN_QUERY_KEY'\n | 'INVALID_VERSION'\n | 'MALFORMED_FRAGMENT'\n | 'INVALID_PARTS'\n\n/**\n * Typed failure for the share-link grammar. Thrown by\n * {@link parseShareLink} for any input outside the grammar (fail closed —\n * map to an app-level 404, never a default-vault fallback), and by\n * {@link buildShareLink} with code `'INVALID_PARTS'` when the caller\n * hands it parts that could not round-trip.\n *\n * Standalone (`extends Error`, not `NoydbError`) so this subpath stays\n * import-light; the `code` field follows the same machine-readable\n * convention as the kernel error classes.\n */\nexport class ShareLinkParseError extends Error {\n /** Machine-readable error code. Stable across library versions. */\n readonly code: ShareLinkErrorCode\n\n constructor(code: ShareLinkErrorCode, message: string) {\n super(message)\n this.name = 'ShareLinkParseError'\n this.code = code\n }\n}\n\n/**\n * The logical address a share link carries. Input to\n * {@link buildShareLink}; {@link parseShareLink} returns the same shape\n * (as the readonly {@link ShareLink} alias) with optional fields OMITTED\n * (not `undefined`) when absent from the link.\n */\nexport interface ShareLinkParts {\n /** Vault handle — a 26-character uppercase Crockford-base32 ULID. */\n vaultHandle: string\n /** Collection name — opaque, non-empty. */\n collection: string\n /** Record id — opaque, non-empty. */\n recordId: string\n /** Optional period id (`?period=`) — opaque, non-empty. */\n period?: string\n /** Optional record version (`?v=`) — non-negative safe integer. */\n version?: number\n /**\n * Optional single-use grant token (`#g=`) — opaque, non-empty. Carried\n * ONLY in the URL fragment; semantics belong to `on-magic-link`.\n */\n grantToken?: string\n}\n\n/** A successfully parsed share link. See {@link ShareLinkParts}. */\nexport type ShareLink = Readonly<ShareLinkParts>\n\n// Dummy base for parsing bare `/r/…` paths with the WHATWG URL parser.\n// `.invalid` is reserved (RFC 2606) — it can never collide with a real\n// origin, and the host is discarded anyway (only path/query/fragment\n// matter to the grammar).\nconst DUMMY_BASE = 'https://share-link.invalid'\n\n/**\n * Canonical encoding of a QUERY value. `encodeURIComponent`, plus `'`\n * → `%27`: the WHATWG URL parser percent-encodes the apostrophe inside\n * the query component of special (http/https) URLs — if we emitted a\n * raw `'`, any URL-object round-trip (browser address bar, `new URL`)\n * would rewrite the link into a form the strict parser then rejects.\n * Path and fragment components don't need this — every character the\n * URL parser escapes there is already escaped by `encodeURIComponent`.\n */\nfunction encodeQueryValue(value: string): string {\n return encodeURIComponent(value).replace(/'/g, '%27')\n}\n\n/**\n * Strict-canonical decode: `raw` must be exactly what the given\n * canonical `encode` produces for the decoded text — no `+`-for-space,\n * no lowercase hex escapes, no unencoded reserved characters,\n * non-empty. `redact` keeps the raw text out of the error message\n * (grant tokens).\n */\nfunction decodeCanonical(\n raw: string,\n code: ShareLinkErrorCode,\n what: string,\n { redact = false, encode = encodeURIComponent }: {\n redact?: boolean\n encode?: (value: string) => string\n } = {},\n): string {\n const shown = redact ? '(redacted)' : `\"${raw}\"`\n let decoded: string\n try {\n decoded = decodeURIComponent(raw)\n } catch {\n throw new ShareLinkParseError(code, `${what}: malformed percent-encoding in ${shown}`)\n }\n if (decoded === '') {\n throw new ShareLinkParseError(code, `${what}: empty`)\n }\n if (encode(decoded) !== raw) {\n throw new ShareLinkParseError(\n code,\n `${what}: ${shown} is not canonical encodeURIComponent output`,\n )\n }\n return decoded\n}\n\n/** Path-segment decode — canonical, plus the dot-segment refusal. */\nfunction decodePathSegment(raw: string, what: string): string {\n const decoded = decodeCanonical(raw, 'MALFORMED_SEGMENT', what)\n if (decoded === '.' || decoded === '..') {\n throw new ShareLinkParseError('MALFORMED_SEGMENT', `${what}: \"${decoded}\" is a dot segment`)\n }\n return decoded\n}\n\n/** `v=` value → non-negative safe integer. Canonical base-10 only. */\nfunction parseVersion(raw: string): number {\n if (!/^(?:0|[1-9][0-9]*)$/.test(raw)) {\n throw new ShareLinkParseError(\n 'INVALID_VERSION',\n `version \"${raw}\" is not a canonical base-10 integer`,\n )\n }\n const version = Number(raw)\n if (!Number.isSafeInteger(version)) {\n throw new ShareLinkParseError('INVALID_VERSION', `version \"${raw}\" exceeds 2^53 - 1`)\n }\n return version\n}\n\n/** Resolve string | URL input to a URL object, fail closed. */\nfunction toUrl(input: string | URL): URL {\n if (input instanceof URL) {\n if (input.protocol !== 'http:' && input.protocol !== 'https:') {\n throw new ShareLinkParseError(\n 'UNKNOWN_PREFIX',\n `unsupported protocol \"${input.protocol}\" — share links are http(s) URLs or bare /r/ paths`,\n )\n }\n return input\n }\n if (input.startsWith('/')) {\n try {\n return new URL(input, DUMMY_BASE)\n } catch {\n throw new ShareLinkParseError('MALFORMED_URL', 'unparseable share path')\n }\n }\n if (/^https?:\\/\\//i.test(input)) {\n try {\n return new URL(input)\n } catch {\n throw new ShareLinkParseError('MALFORMED_URL', 'unparseable share URL')\n }\n }\n throw new ShareLinkParseError(\n 'UNKNOWN_PREFIX',\n 'input is neither a \"/\"-rooted share path nor an http(s) URL',\n )\n}\n\n/**\n * Parse a share link — full URL, `URL` instance, or bare `/r/…` path.\n *\n * A LIFF permalink prefix is tolerated: when the path does not start\n * with `/r/` directly, the share path is taken from the FIRST `/r/`\n * segment boundary (`https://liff.line.me/{liffId}/r/…` → `/r/…`). No\n * fuzzy matching beyond that single rule.\n *\n * Fail closed: anything outside the grammar throws\n * {@link ShareLinkParseError}. Never a default-vault fallback.\n */\nexport function parseShareLink(input: string | URL): ShareLink {\n const url = toUrl(input)\n\n let pathname = url.pathname\n if (!pathname.startsWith('/r/')) {\n // LIFF permalink tolerance — only after the direct parse failed. An\n // indexOf hit is always a whole `r` segment (the match is slash-\n // delimited on both sides), so this cannot fire mid-segment.\n const idx = pathname.indexOf('/r/')\n if (idx === -1) {\n throw new ShareLinkParseError(\n 'UNKNOWN_PREFIX',\n `path \"${pathname}\" has no /r/ share prefix`,\n )\n }\n pathname = pathname.slice(idx)\n }\n\n // \"/r/{vault}/{collection}/{record}\" splits into exactly 5 parts:\n // ['', 'r', vault, collection, record].\n const rawSegments = pathname.split('/')\n if (rawSegments.length !== 5) {\n throw new ShareLinkParseError(\n 'MALFORMED_PATH',\n `expected /r/{vaultHandle}/{collection}/{recordId} — got ${rawSegments.length - 2} segment(s) after /r/`,\n )\n }\n\n const vaultHandle = decodePathSegment(rawSegments[2]!, 'vault handle')\n if (!isULID(vaultHandle)) {\n throw new ShareLinkParseError(\n 'INVALID_VAULT_HANDLE',\n `vault handle \"${vaultHandle}\" is not a ULID`,\n )\n }\n const collection = decodePathSegment(rawSegments[3]!, 'collection')\n const recordId = decodePathSegment(rawSegments[4]!, 'record id')\n\n // Query — manual parse of url.search (NOT URLSearchParams, whose\n // form-urlencoded rules decode \"+\" as a space and hide duplicates).\n let period: string | undefined\n let version: number | undefined\n if (url.search !== '') {\n const seen = new Set<string>()\n for (const pair of url.search.slice(1).split('&')) {\n const eq = pair.indexOf('=')\n if (eq <= 0) {\n throw new ShareLinkParseError('MALFORMED_QUERY', `query pair \"${pair}\" is not key=value`)\n }\n const key = pair.slice(0, eq)\n const rawValue = pair.slice(eq + 1)\n if (key !== 'period' && key !== 'v') {\n throw new ShareLinkParseError('UNKNOWN_QUERY_KEY', `unknown query key \"${key}\"`)\n }\n if (seen.has(key)) {\n throw new ShareLinkParseError('DUPLICATE_QUERY_KEY', `duplicate query key \"${key}\"`)\n }\n seen.add(key)\n if (key === 'period') {\n period = decodeCanonical(rawValue, 'MALFORMED_QUERY', 'period', {\n encode: encodeQueryValue,\n })\n } else {\n version = parseVersion(rawValue)\n }\n }\n }\n\n // Fragment — the ONLY place a grant token may appear.\n let grantToken: string | undefined\n if (url.hash !== '' && url.hash !== '#') {\n const fragment = url.hash.slice(1)\n if (!fragment.startsWith('g=')) {\n throw new ShareLinkParseError(\n 'MALFORMED_FRAGMENT',\n 'fragment is not a g={token} grant carrier',\n )\n }\n grantToken = decodeCanonical(fragment.slice(2), 'MALFORMED_FRAGMENT', 'grant token', {\n redact: true,\n })\n }\n\n return {\n vaultHandle,\n collection,\n recordId,\n ...(period !== undefined ? { period } : {}),\n ...(version !== undefined ? { version } : {}),\n ...(grantToken !== undefined ? { grantToken } : {}),\n }\n}\n\n/** Build-side part validation. Returns the (narrowed) string value. */\nfunction requirePart(value: unknown, what: string, dotSegmentRefused = false): string {\n if (typeof value !== 'string' || value === '') {\n throw new ShareLinkParseError('INVALID_PARTS', `${what} must be a non-empty string`)\n }\n if (dotSegmentRefused && (value === '.' || value === '..')) {\n throw new ShareLinkParseError('INVALID_PARTS', `${what}: \"${value}\" is a dot segment`)\n }\n return value\n}\n\n/**\n * Build a RELATIVE share link (`/r/…`) from typed parts. Callers prefix\n * their surface origin — the LIFF permalink base, the PWA origin, or the\n * vendor console — either themselves or via `base`, which is prepended\n * VERBATIM (no validation, no joining logic; pass it without a trailing\n * slash, e.g. `https://liff.line.me/{liffId}`).\n *\n * The grant token, when present, is emitted ONLY as the `#g=` fragment.\n * Invalid parts throw {@link ShareLinkParseError} with code\n * `'INVALID_PARTS'` — every built link is guaranteed to round-trip\n * through {@link parseShareLink}.\n */\nexport function buildShareLink(parts: ShareLinkParts, base?: string): string {\n const { vaultHandle, collection, recordId, period, version, grantToken } = parts\n\n if (typeof vaultHandle !== 'string' || !isULID(vaultHandle)) {\n throw new ShareLinkParseError('INVALID_PARTS', 'vaultHandle is not a ULID')\n }\n const path = `/r/${vaultHandle}/${encodeURIComponent(\n requirePart(collection, 'collection', true),\n )}/${encodeURIComponent(requirePart(recordId, 'recordId', true))}`\n\n const query: string[] = []\n if (period !== undefined) {\n query.push(`period=${encodeQueryValue(requirePart(period, 'period'))}`)\n }\n if (version !== undefined) {\n if (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 0) {\n throw new ShareLinkParseError('INVALID_PARTS', 'version must be a non-negative safe integer')\n }\n query.push(`v=${version}`)\n }\n\n const fragment =\n grantToken !== undefined\n ? `#g=${encodeURIComponent(requirePart(grantToken, 'grantToken'))}`\n : ''\n\n return (base ?? '') + path + (query.length > 0 ? `?${query.join('&')}` : '') + fragment\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Portal share-link grammar + parse/build helper (#806).
3
+ *
4
+ * ONE canonical link grammar addresses `vault / period / collection /
5
+ * record` across all three portal surfaces — the LIFF permalink path
6
+ * (`https://liff.line.me/{liffId}/r/…`), the installed-PWA same-origin
7
+ * path (`https://{portal-origin}/r/…`), and the vendor backend console.
8
+ * The link SHAPE is identical everywhere; only the origin prefix
9
+ * differs, and callers own the prefix.
10
+ *
11
+ * ## Grammar (frozen — see `__tests__/share-link-surface.golden.json`)
12
+ *
13
+ * ```
14
+ * share-link = [ base ] "/r/" vault "/" collection "/" record
15
+ * [ "?" query ] [ "#" fragment ]
16
+ * vault = ULID ; 26 uppercase Crockford base32 chars
17
+ * collection = segment ; opaque, non-empty after decode
18
+ * record = segment ; opaque, non-empty after decode
19
+ * query = pair *( "&" pair ) ; keys unique; ONLY these two keys
20
+ * pair = "period=" component ; opaque period id
21
+ * / "v=" version ; record version
22
+ * version = "0" / %x31-39 *DIGIT ; base-10 integer, ≤ 2^53 − 1
23
+ * fragment = "g=" component ; single-use grant token (opaque)
24
+ * ```
25
+ *
26
+ * `segment` / `component` are strict-canonical `encodeURIComponent`
27
+ * output: decoding then re-encoding MUST reproduce the raw text exactly
28
+ * (uppercase-hex escapes, `+` is a literal plus never a space, `%2F`
29
+ * inside a segment never creates an extra segment). Path segments
30
+ * additionally may not decode to `.` or `..`. Links produced by
31
+ * {@link buildShareLink} always satisfy this; hand-written links using
32
+ * only unreserved characters (`inv-001`, ULIDs, …) do too.
33
+ *
34
+ * ## Transport rule for the grant token
35
+ *
36
+ * The optional single-use grant token travels ONLY in the URL fragment
37
+ * (`#g={token}`) — never in the path or query — because fragments are
38
+ * not sent to servers, so the token never reaches server logs, CDNs, or
39
+ * LINE's infrastructure. Same rule `on-magic-link` follows. The token is
40
+ * fully OPAQUE here: no validation beyond non-empty, no decoding of its
41
+ * semantics — grant semantics live in `on-magic-link` (not imported).
42
+ *
43
+ * ## Fail closed
44
+ *
45
+ * {@link parseShareLink} throws a typed {@link ShareLinkParseError} for
46
+ * ANYTHING that is not exactly the grammar above — unknown prefix,
47
+ * missing/extra/empty/malformed segments, a non-ULID vault handle,
48
+ * duplicate or unknown query keys, malformed fragments. There is never a
49
+ * default-vault (or any other) fallback; the app maps the error to a 404.
50
+ *
51
+ * Zero dependencies on the hub floor: pure string/`URL` code, no crypto,
52
+ * no store — LIFF shells, PWAs, and klum-db can import this subpath
53
+ * without dragging anything else. (The one internal import is the pure,
54
+ * leaf ULID shape check shared with the pod format.)
55
+ */
56
+ /** Machine-readable {@link ShareLinkParseError} discriminant. */
57
+ export type ShareLinkErrorCode = 'MALFORMED_URL' | 'UNKNOWN_PREFIX' | 'MALFORMED_PATH' | 'MALFORMED_SEGMENT' | 'INVALID_VAULT_HANDLE' | 'MALFORMED_QUERY' | 'DUPLICATE_QUERY_KEY' | 'UNKNOWN_QUERY_KEY' | 'INVALID_VERSION' | 'MALFORMED_FRAGMENT' | 'INVALID_PARTS';
58
+ /**
59
+ * Typed failure for the share-link grammar. Thrown by
60
+ * {@link parseShareLink} for any input outside the grammar (fail closed —
61
+ * map to an app-level 404, never a default-vault fallback), and by
62
+ * {@link buildShareLink} with code `'INVALID_PARTS'` when the caller
63
+ * hands it parts that could not round-trip.
64
+ *
65
+ * Standalone (`extends Error`, not `NoydbError`) so this subpath stays
66
+ * import-light; the `code` field follows the same machine-readable
67
+ * convention as the kernel error classes.
68
+ */
69
+ export declare class ShareLinkParseError extends Error {
70
+ /** Machine-readable error code. Stable across library versions. */
71
+ readonly code: ShareLinkErrorCode;
72
+ constructor(code: ShareLinkErrorCode, message: string);
73
+ }
74
+ /**
75
+ * The logical address a share link carries. Input to
76
+ * {@link buildShareLink}; {@link parseShareLink} returns the same shape
77
+ * (as the readonly {@link ShareLink} alias) with optional fields OMITTED
78
+ * (not `undefined`) when absent from the link.
79
+ */
80
+ export interface ShareLinkParts {
81
+ /** Vault handle — a 26-character uppercase Crockford-base32 ULID. */
82
+ vaultHandle: string;
83
+ /** Collection name — opaque, non-empty. */
84
+ collection: string;
85
+ /** Record id — opaque, non-empty. */
86
+ recordId: string;
87
+ /** Optional period id (`?period=`) — opaque, non-empty. */
88
+ period?: string;
89
+ /** Optional record version (`?v=`) — non-negative safe integer. */
90
+ version?: number;
91
+ /**
92
+ * Optional single-use grant token (`#g=`) — opaque, non-empty. Carried
93
+ * ONLY in the URL fragment; semantics belong to `on-magic-link`.
94
+ */
95
+ grantToken?: string;
96
+ }
97
+ /** A successfully parsed share link. See {@link ShareLinkParts}. */
98
+ export type ShareLink = Readonly<ShareLinkParts>;
99
+ /**
100
+ * Parse a share link — full URL, `URL` instance, or bare `/r/…` path.
101
+ *
102
+ * A LIFF permalink prefix is tolerated: when the path does not start
103
+ * with `/r/` directly, the share path is taken from the FIRST `/r/`
104
+ * segment boundary (`https://liff.line.me/{liffId}/r/…` → `/r/…`). No
105
+ * fuzzy matching beyond that single rule.
106
+ *
107
+ * Fail closed: anything outside the grammar throws
108
+ * {@link ShareLinkParseError}. Never a default-vault fallback.
109
+ */
110
+ export declare function parseShareLink(input: string | URL): ShareLink;
111
+ /**
112
+ * Build a RELATIVE share link (`/r/…`) from typed parts. Callers prefix
113
+ * their surface origin — the LIFF permalink base, the PWA origin, or the
114
+ * vendor console — either themselves or via `base`, which is prepended
115
+ * VERBATIM (no validation, no joining logic; pass it without a trailing
116
+ * slash, e.g. `https://liff.line.me/{liffId}`).
117
+ *
118
+ * The grant token, when present, is emitted ONLY as the `#g=` fragment.
119
+ * Invalid parts throw {@link ShareLinkParseError} with code
120
+ * `'INVALID_PARTS'` — every built link is guaranteed to round-trip
121
+ * through {@link parseShareLink}.
122
+ */
123
+ export declare function buildShareLink(parts: ShareLinkParts, base?: string): string;
@@ -0,0 +1,25 @@
1
+ import {
2
+ ATTESTATIONS_COLLECTION,
3
+ REVOKED_RECORD_ID,
4
+ SIGNER_RECORD_ID,
5
+ loadOrCreateSigner,
6
+ loadSigner
7
+ } from "./chunk-G6EQYAL6.js";
8
+ import "./chunk-DVUZMT2W.js";
9
+ import "./chunk-WEYZTLXN.js";
10
+ import "./chunk-IY23KFNZ.js";
11
+ import "./chunk-N6WF5PKC.js";
12
+ import "./chunk-6HY2X62D.js";
13
+ import "./chunk-LP7BEXCT.js";
14
+ import "./chunk-HOONYZY2.js";
15
+ import "./chunk-LSASLXGC.js";
16
+ import "./chunk-W2OG6JOL.js";
17
+ import "./chunk-PZ5AY32C.js";
18
+ export {
19
+ ATTESTATIONS_COLLECTION,
20
+ REVOKED_RECORD_ID,
21
+ SIGNER_RECORD_ID,
22
+ loadOrCreateSigner,
23
+ loadSigner
24
+ };
25
+ //# sourceMappingURL=signer-3YFBLZRN.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  readPod,
3
3
  writePod
4
- } from "../chunk-FHS2HQSH.js";
5
- import "../chunk-X3YYQWOQ.js";
6
- import "../chunk-XDYREZWE.js";
7
- import "../chunk-7DSTRQIJ.js";
8
- import "../chunk-HB3RFQSC.js";
9
- import "../chunk-JKJOGPZN.js";
10
- import "../chunk-5M5DVGV7.js";
4
+ } from "../chunk-A7JJLVGH.js";
5
+ import "../chunk-J6Q7UVQE.js";
6
+ import "../chunk-DVUZMT2W.js";
7
+ import "../chunk-WEYZTLXN.js";
8
+ import "../chunk-IY23KFNZ.js";
9
+ import "../chunk-N6WF5PKC.js";
10
+ import "../chunk-6HY2X62D.js";
11
11
  import "../chunk-LP7BEXCT.js";
12
- import "../chunk-CIE2BASH.js";
13
- import "../chunk-JNAI2HN2.js";
12
+ import "../chunk-HOONYZY2.js";
13
+ import "../chunk-LSASLXGC.js";
14
14
  import {
15
15
  SnapshotNotFoundError
16
- } from "../chunk-BIOUI4HL.js";
16
+ } from "../chunk-W2OG6JOL.js";
17
17
  import "../chunk-PZ5AY32C.js";
18
18
 
19
19
  // src/with-fork/snapshots/engine.ts
@@ -6,16 +6,16 @@ import {
6
6
  isMVStale,
7
7
  markMVStale,
8
8
  resolveStaleMVOnRead
9
- } from "./chunk-HDQIIUPH.js";
10
- import "./chunk-XDYREZWE.js";
11
- import "./chunk-7DSTRQIJ.js";
12
- import "./chunk-HB3RFQSC.js";
13
- import "./chunk-JKJOGPZN.js";
14
- import "./chunk-5M5DVGV7.js";
9
+ } from "./chunk-KUPKLSX5.js";
10
+ import "./chunk-DVUZMT2W.js";
11
+ import "./chunk-WEYZTLXN.js";
12
+ import "./chunk-IY23KFNZ.js";
13
+ import "./chunk-N6WF5PKC.js";
14
+ import "./chunk-6HY2X62D.js";
15
15
  import "./chunk-LP7BEXCT.js";
16
- import "./chunk-CIE2BASH.js";
17
- import "./chunk-JNAI2HN2.js";
18
- import "./chunk-BIOUI4HL.js";
16
+ import "./chunk-HOONYZY2.js";
17
+ import "./chunk-LSASLXGC.js";
18
+ import "./chunk-W2OG6JOL.js";
19
19
  import "./chunk-PZ5AY32C.js";
20
20
  export {
21
21
  MV_STALE_COLLECTION,
@@ -26,4 +26,4 @@ export {
26
26
  markMVStale,
27
27
  resolveStaleMVOnRead
28
28
  };
29
- //# sourceMappingURL=stale-OSQ7J3AA.js.map
29
+ //# sourceMappingURL=stale-FJED42DM.js.map
@@ -0,0 +1,23 @@
1
+ import {
2
+ SCHEMAS_COLLECTION,
3
+ loadPersistedSchema,
4
+ loadPersistedSchemaEntry,
5
+ savePersistedSchema
6
+ } from "./chunk-F6T6L2UK.js";
7
+ import "./chunk-DVUZMT2W.js";
8
+ import "./chunk-WEYZTLXN.js";
9
+ import "./chunk-IY23KFNZ.js";
10
+ import "./chunk-N6WF5PKC.js";
11
+ import "./chunk-6HY2X62D.js";
12
+ import "./chunk-LP7BEXCT.js";
13
+ import "./chunk-HOONYZY2.js";
14
+ import "./chunk-LSASLXGC.js";
15
+ import "./chunk-W2OG6JOL.js";
16
+ import "./chunk-PZ5AY32C.js";
17
+ export {
18
+ SCHEMAS_COLLECTION,
19
+ loadPersistedSchema,
20
+ loadPersistedSchemaEntry,
21
+ savePersistedSchema
22
+ };
23
+ //# sourceMappingURL=storage-W3GURVFU.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadFence,
3
3
  saveFence
4
- } from "./chunk-RYCTDFUX.js";
4
+ } from "./chunk-KUIB4B5Q.js";
5
5
  import {
6
6
  NOYDB_FORMAT_VERSION
7
- } from "./chunk-JNAI2HN2.js";
7
+ } from "./chunk-LSASLXGC.js";
8
8
  import "./chunk-PZ5AY32C.js";
9
9
 
10
10
  // src/with-shape/schema-update/client-registry.ts
@@ -139,4 +139,4 @@ function unref(timer) {
139
139
  export {
140
140
  StoreCoordinationProvider
141
141
  };
142
- //# sourceMappingURL=store-coordination-provider-64OEZFGS.js.map
142
+ //# sourceMappingURL=store-coordination-provider-APODTV4W.js.map
@@ -2,17 +2,18 @@ import {
2
2
  PresenceHandle,
3
3
  SyncEngine,
4
4
  SyncTransaction
5
- } from "../chunk-HDMEGAQE.js";
5
+ } from "../chunk-SMGEYW6G.js";
6
6
  import "../chunk-VQNJ7UZL.js";
7
- import "../chunk-XDYREZWE.js";
8
- import "../chunk-7DSTRQIJ.js";
9
- import "../chunk-HB3RFQSC.js";
10
- import "../chunk-JKJOGPZN.js";
11
- import "../chunk-5M5DVGV7.js";
7
+ import "../chunk-2IALOXZS.js";
8
+ import "../chunk-DVUZMT2W.js";
9
+ import "../chunk-WEYZTLXN.js";
10
+ import "../chunk-IY23KFNZ.js";
11
+ import "../chunk-N6WF5PKC.js";
12
+ import "../chunk-6HY2X62D.js";
12
13
  import "../chunk-LP7BEXCT.js";
13
- import "../chunk-CIE2BASH.js";
14
- import "../chunk-JNAI2HN2.js";
15
- import "../chunk-BIOUI4HL.js";
14
+ import "../chunk-HOONYZY2.js";
15
+ import "../chunk-LSASLXGC.js";
16
+ import "../chunk-W2OG6JOL.js";
16
17
  import "../chunk-PZ5AY32C.js";
17
18
 
18
19
  // src/with-party/team/sync-active.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/with-party/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../../kernel/vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/with-party/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../../kernel/vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}
@@ -5,7 +5,7 @@ import {
5
5
  listCredentials,
6
6
  putCredential,
7
7
  withTeam
8
- } from "../chunk-I6GALP6E.js";
8
+ } from "../chunk-JZWWLLVY.js";
9
9
  import {
10
10
  NO_TEAM,
11
11
  deriveMagicLinkContentKey,
@@ -23,7 +23,7 @@ import {
23
23
  unwrapMagicLinkGrant,
24
24
  updateAuthenticator,
25
25
  writeMagicLinkGrant
26
- } from "../chunk-AUSTCW2X.js";
26
+ } from "../chunk-LOF2W3JU.js";
27
27
  import {
28
28
  burnPaperRecoveryEntry,
29
29
  loadPaperRecoveryEntries,
@@ -32,13 +32,14 @@ import {
32
32
  savePaperRecoveryEntries,
33
33
  unwrapDeksFromBlob,
34
34
  unwrapDeksFromPaperEntry
35
- } from "../chunk-EVVGJDRQ.js";
35
+ } from "../chunk-2MUZ3LY6.js";
36
36
  import {
37
37
  PresenceHandle,
38
38
  SyncEngine,
39
39
  SyncTransaction
40
- } from "../chunk-HDMEGAQE.js";
40
+ } from "../chunk-SMGEYW6G.js";
41
41
  import "../chunk-VQNJ7UZL.js";
42
+ import "../chunk-2IALOXZS.js";
42
43
  import {
43
44
  SYNC_CREDENTIALS_COLLECTION,
44
45
  buildRecipientKeyringFile,
@@ -56,20 +57,20 @@ import {
56
57
  persistKeyring,
57
58
  revoke,
58
59
  updateKeyringIdentity
59
- } from "../chunk-J2ZX2XUV.js";
60
- import "../chunk-4JBYV75E.js";
61
- import "../chunk-ZICD77GM.js";
62
- import "../chunk-XDYREZWE.js";
63
- import "../chunk-7DSTRQIJ.js";
64
- import "../chunk-HB3RFQSC.js";
65
- import "../chunk-JKJOGPZN.js";
66
- import "../chunk-5M5DVGV7.js";
60
+ } from "../chunk-3SV2EPMN.js";
61
+ import "../chunk-PK6QCH2C.js";
62
+ import "../chunk-UC2ETWF3.js";
63
+ import "../chunk-DVUZMT2W.js";
64
+ import "../chunk-WEYZTLXN.js";
65
+ import "../chunk-IY23KFNZ.js";
66
+ import "../chunk-N6WF5PKC.js";
67
+ import "../chunk-6HY2X62D.js";
67
68
  import "../chunk-LP7BEXCT.js";
68
- import "../chunk-CIE2BASH.js";
69
- import "../chunk-JNAI2HN2.js";
69
+ import "../chunk-HOONYZY2.js";
70
+ import "../chunk-LSASLXGC.js";
70
71
  import {
71
72
  TeamNotEnabledError
72
- } from "../chunk-BIOUI4HL.js";
73
+ } from "../chunk-W2OG6JOL.js";
73
74
  import "../chunk-PZ5AY32C.js";
74
75
  export {
75
76
  NO_TEAM,
@@ -11,19 +11,19 @@ import {
11
11
  putAtTier,
12
12
  syncDerivedOutputs,
13
13
  withTiers
14
- } from "../chunk-CDUQTA3Z.js";
15
- import "../chunk-ZICD77GM.js";
16
- import "../chunk-XDYREZWE.js";
17
- import "../chunk-7DSTRQIJ.js";
18
- import "../chunk-HB3RFQSC.js";
19
- import "../chunk-JKJOGPZN.js";
20
- import "../chunk-5M5DVGV7.js";
14
+ } from "../chunk-DDATL6PU.js";
15
+ import "../chunk-UC2ETWF3.js";
16
+ import "../chunk-DVUZMT2W.js";
17
+ import "../chunk-WEYZTLXN.js";
18
+ import "../chunk-IY23KFNZ.js";
19
+ import "../chunk-N6WF5PKC.js";
20
+ import "../chunk-6HY2X62D.js";
21
21
  import "../chunk-LP7BEXCT.js";
22
- import "../chunk-CIE2BASH.js";
23
- import "../chunk-JNAI2HN2.js";
22
+ import "../chunk-HOONYZY2.js";
23
+ import "../chunk-LSASLXGC.js";
24
24
  import {
25
25
  TiersNotEnabledError
26
- } from "../chunk-BIOUI4HL.js";
26
+ } from "../chunk-W2OG6JOL.js";
27
27
  import "../chunk-PZ5AY32C.js";
28
28
  export {
29
29
  NO_TIERS,
package/dist/to/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  NetworkError,
5
5
  PodVersionConflictError,
6
6
  StoreCapabilityError
7
- } from "../chunk-BIOUI4HL.js";
7
+ } from "../chunk-W2OG6JOL.js";
8
8
  import "../chunk-PZ5AY32C.js";
9
9
  export {
10
10
  BundleVersionConflictError,