@fireproof/core 0.21.0-dev-preview-6 → 0.22.0-dev-preview

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 (428) hide show
  1. package/index.d.ts +2 -16
  2. package/index.js +2 -15
  3. package/index.js.map +1 -1
  4. package/index.ts +2 -0
  5. package/package.json +11 -70
  6. package/tsconfig.json +18 -0
  7. package/README.md +0 -269
  8. package/apply-head-queue.d.ts +0 -18
  9. package/apply-head-queue.d.ts.map +0 -1
  10. package/apply-head-queue.js +0 -47
  11. package/apply-head-queue.js.map +0 -1
  12. package/blockstore/attachable-store.d.ts +0 -19
  13. package/blockstore/attachable-store.d.ts.map +0 -1
  14. package/blockstore/attachable-store.js +0 -317
  15. package/blockstore/attachable-store.js.map +0 -1
  16. package/blockstore/commit-queue.d.ts +0 -17
  17. package/blockstore/commit-queue.d.ts.map +0 -1
  18. package/blockstore/commit-queue.js +0 -60
  19. package/blockstore/commit-queue.js.map +0 -1
  20. package/blockstore/commitor.d.ts +0 -21
  21. package/blockstore/commitor.d.ts.map +0 -1
  22. package/blockstore/commitor.js +0 -95
  23. package/blockstore/commitor.js.map +0 -1
  24. package/blockstore/connect-raw.d.ts +0 -2
  25. package/blockstore/connect-raw.d.ts.map +0 -1
  26. package/blockstore/connect-raw.js +0 -2
  27. package/blockstore/connect-raw.js.map +0 -1
  28. package/blockstore/connection-base.d.ts +0 -2
  29. package/blockstore/connection-base.d.ts.map +0 -1
  30. package/blockstore/connection-base.js +0 -2
  31. package/blockstore/connection-base.js.map +0 -1
  32. package/blockstore/encrypt-helpers.d.ts +0 -2
  33. package/blockstore/encrypt-helpers.d.ts.map +0 -1
  34. package/blockstore/encrypt-helpers.js +0 -2
  35. package/blockstore/encrypt-helpers.js.map +0 -1
  36. package/blockstore/fp-envelope.d.ts +0 -32
  37. package/blockstore/fp-envelope.d.ts.map +0 -1
  38. package/blockstore/fp-envelope.js +0 -14
  39. package/blockstore/fp-envelope.js.map +0 -1
  40. package/blockstore/gateway.d.ts +0 -20
  41. package/blockstore/gateway.d.ts.map +0 -1
  42. package/blockstore/gateway.js +0 -2
  43. package/blockstore/gateway.js.map +0 -1
  44. package/blockstore/index.d.ts +0 -16
  45. package/blockstore/index.d.ts.map +0 -1
  46. package/blockstore/index.js +0 -16
  47. package/blockstore/index.js.map +0 -1
  48. package/blockstore/interceptor-gateway.d.ts +0 -29
  49. package/blockstore/interceptor-gateway.d.ts.map +0 -1
  50. package/blockstore/interceptor-gateway.js +0 -137
  51. package/blockstore/interceptor-gateway.js.map +0 -1
  52. package/blockstore/loader-helpers.d.ts +0 -10
  53. package/blockstore/loader-helpers.d.ts.map +0 -1
  54. package/blockstore/loader-helpers.js +0 -115
  55. package/blockstore/loader-helpers.js.map +0 -1
  56. package/blockstore/loader.d.ts +0 -61
  57. package/blockstore/loader.d.ts.map +0 -1
  58. package/blockstore/loader.js +0 -493
  59. package/blockstore/loader.js.map +0 -1
  60. package/blockstore/register-store-protocol.d.ts +0 -22
  61. package/blockstore/register-store-protocol.d.ts.map +0 -1
  62. package/blockstore/register-store-protocol.js +0 -125
  63. package/blockstore/register-store-protocol.js.map +0 -1
  64. package/blockstore/serde-gateway.d.ts +0 -78
  65. package/blockstore/serde-gateway.d.ts.map +0 -1
  66. package/blockstore/serde-gateway.js +0 -2
  67. package/blockstore/serde-gateway.js.map +0 -1
  68. package/blockstore/store-factory.d.ts +0 -11
  69. package/blockstore/store-factory.d.ts.map +0 -1
  70. package/blockstore/store-factory.js +0 -104
  71. package/blockstore/store-factory.js.map +0 -1
  72. package/blockstore/store-remote.d.ts +0 -2
  73. package/blockstore/store-remote.d.ts.map +0 -1
  74. package/blockstore/store-remote.js +0 -2
  75. package/blockstore/store-remote.js.map +0 -1
  76. package/blockstore/store.d.ts +0 -86
  77. package/blockstore/store.d.ts.map +0 -1
  78. package/blockstore/store.js +0 -437
  79. package/blockstore/store.js.map +0 -1
  80. package/blockstore/task-manager.d.ts +0 -19
  81. package/blockstore/task-manager.d.ts.map +0 -1
  82. package/blockstore/task-manager.js +0 -50
  83. package/blockstore/task-manager.js.map +0 -1
  84. package/blockstore/transaction.d.ts +0 -62
  85. package/blockstore/transaction.d.ts.map +0 -1
  86. package/blockstore/transaction.js +0 -256
  87. package/blockstore/transaction.js.map +0 -1
  88. package/blockstore/types.d.ts +0 -510
  89. package/blockstore/types.d.ts.map +0 -1
  90. package/blockstore/types.js +0 -83
  91. package/blockstore/types.js.map +0 -1
  92. package/blockstore/uri-interceptor.d.ts +0 -19
  93. package/blockstore/uri-interceptor.d.ts.map +0 -1
  94. package/blockstore/uri-interceptor.js +0 -61
  95. package/blockstore/uri-interceptor.js.map +0 -1
  96. package/bundle-not-impl.d.ts +0 -2
  97. package/bundle-not-impl.d.ts.map +0 -1
  98. package/bundle-not-impl.js +0 -4
  99. package/bundle-not-impl.js.map +0 -1
  100. package/cli/main.js +0 -26613
  101. package/crdt-clock.d.ts +0 -26
  102. package/crdt-clock.d.ts.map +0 -1
  103. package/crdt-clock.js +0 -133
  104. package/crdt-clock.js.map +0 -1
  105. package/crdt-helpers.d.ts +0 -19
  106. package/crdt-helpers.d.ts.map +0 -1
  107. package/crdt-helpers.js +0 -332
  108. package/crdt-helpers.js.map +0 -1
  109. package/crdt.d.ts +0 -41
  110. package/crdt.d.ts.map +0 -1
  111. package/crdt.js +0 -164
  112. package/crdt.js.map +0 -1
  113. package/database.d.ts +0 -34
  114. package/database.d.ts.map +0 -1
  115. package/database.js +0 -133
  116. package/database.js.map +0 -1
  117. package/deno.json +0 -20
  118. package/index.d.ts.map +0 -1
  119. package/indexer-helpers.d.ts +0 -68
  120. package/indexer-helpers.d.ts.map +0 -1
  121. package/indexer-helpers.js +0 -157
  122. package/indexer-helpers.js.map +0 -1
  123. package/indexer.d.ts +0 -24
  124. package/indexer.d.ts.map +0 -1
  125. package/indexer.js +0 -239
  126. package/indexer.js.map +0 -1
  127. package/ledger.d.ts +0 -55
  128. package/ledger.d.ts.map +0 -1
  129. package/ledger.js +0 -240
  130. package/ledger.js.map +0 -1
  131. package/protocols/cloud/http-connection.d.ts +0 -25
  132. package/protocols/cloud/http-connection.d.ts.map +0 -1
  133. package/protocols/cloud/http-connection.js +0 -153
  134. package/protocols/cloud/http-connection.js.map +0 -1
  135. package/protocols/cloud/index.d.ts +0 -10
  136. package/protocols/cloud/index.d.ts.map +0 -1
  137. package/protocols/cloud/index.js +0 -10
  138. package/protocols/cloud/index.js.map +0 -1
  139. package/protocols/cloud/msg-raw-connection-base.d.ts +0 -16
  140. package/protocols/cloud/msg-raw-connection-base.d.ts.map +0 -1
  141. package/protocols/cloud/msg-raw-connection-base.js +0 -22
  142. package/protocols/cloud/msg-raw-connection-base.js.map +0 -1
  143. package/protocols/cloud/msg-types-data.d.ts +0 -36
  144. package/protocols/cloud/msg-types-data.d.ts.map +0 -1
  145. package/protocols/cloud/msg-types-data.js +0 -38
  146. package/protocols/cloud/msg-types-data.js.map +0 -1
  147. package/protocols/cloud/msg-types-meta.d.ts +0 -41
  148. package/protocols/cloud/msg-types-meta.d.ts.map +0 -1
  149. package/protocols/cloud/msg-types-meta.js +0 -98
  150. package/protocols/cloud/msg-types-meta.js.map +0 -1
  151. package/protocols/cloud/msg-types-wal.d.ts +0 -33
  152. package/protocols/cloud/msg-types-wal.d.ts.map +0 -1
  153. package/protocols/cloud/msg-types-wal.js +0 -38
  154. package/protocols/cloud/msg-types-wal.js.map +0 -1
  155. package/protocols/cloud/msg-types.d.ts +0 -296
  156. package/protocols/cloud/msg-types.d.ts.map +0 -1
  157. package/protocols/cloud/msg-types.js +0 -296
  158. package/protocols/cloud/msg-types.js.map +0 -1
  159. package/protocols/cloud/msger.d.ts +0 -79
  160. package/protocols/cloud/msger.d.ts.map +0 -1
  161. package/protocols/cloud/msger.js +0 -198
  162. package/protocols/cloud/msger.js.map +0 -1
  163. package/protocols/cloud/ws-connection.d.ts +0 -29
  164. package/protocols/cloud/ws-connection.d.ts.map +0 -1
  165. package/protocols/cloud/ws-connection.js +0 -166
  166. package/protocols/cloud/ws-connection.js.map +0 -1
  167. package/protocols/index.d.ts +0 -2
  168. package/protocols/index.d.ts.map +0 -1
  169. package/protocols/index.js +0 -2
  170. package/protocols/index.js.map +0 -1
  171. package/react/img-file.d.ts +0 -303
  172. package/react/img-file.d.ts.map +0 -1
  173. package/react/img-file.js +0 -92
  174. package/react/img-file.js.map +0 -1
  175. package/react/index.d.ts +0 -5
  176. package/react/index.d.ts.map +0 -1
  177. package/react/index.js +0 -5
  178. package/react/index.js.map +0 -1
  179. package/react/types.d.ts +0 -71
  180. package/react/types.d.ts.map +0 -1
  181. package/react/types.js +0 -2
  182. package/react/types.js.map +0 -1
  183. package/react/use-all-docs.d.ts +0 -4
  184. package/react/use-all-docs.d.ts.map +0 -1
  185. package/react/use-all-docs.js +0 -25
  186. package/react/use-all-docs.js.map +0 -1
  187. package/react/use-attach.d.ts +0 -6
  188. package/react/use-attach.d.ts.map +0 -1
  189. package/react/use-attach.js +0 -75
  190. package/react/use-attach.js.map +0 -1
  191. package/react/use-changes.d.ts +0 -4
  192. package/react/use-changes.d.ts.map +0 -1
  193. package/react/use-changes.js +0 -19
  194. package/react/use-changes.js.map +0 -1
  195. package/react/use-document.d.ts +0 -4
  196. package/react/use-document.d.ts.map +0 -1
  197. package/react/use-document.js +0 -109
  198. package/react/use-document.js.map +0 -1
  199. package/react/use-fireproof.d.ts +0 -6
  200. package/react/use-fireproof.d.ts.map +0 -1
  201. package/react/use-fireproof.js +0 -20
  202. package/react/use-fireproof.js.map +0 -1
  203. package/react/use-live-query.d.ts +0 -4
  204. package/react/use-live-query.d.ts.map +0 -1
  205. package/react/use-live-query.js +0 -24
  206. package/react/use-live-query.js.map +0 -1
  207. package/runtime/files.d.ts +0 -12
  208. package/runtime/files.d.ts.map +0 -1
  209. package/runtime/files.js +0 -29
  210. package/runtime/files.js.map +0 -1
  211. package/runtime/gateways/cloud/gateway.d.ts +0 -41
  212. package/runtime/gateways/cloud/gateway.d.ts.map +0 -1
  213. package/runtime/gateways/cloud/gateway.js +0 -512
  214. package/runtime/gateways/cloud/gateway.js.map +0 -1
  215. package/runtime/gateways/cloud/index.d.ts +0 -3
  216. package/runtime/gateways/cloud/index.d.ts.map +0 -1
  217. package/runtime/gateways/cloud/index.js +0 -3
  218. package/runtime/gateways/cloud/index.js.map +0 -1
  219. package/runtime/gateways/cloud/to-cloud.d.ts +0 -46
  220. package/runtime/gateways/cloud/to-cloud.d.ts.map +0 -1
  221. package/runtime/gateways/cloud/to-cloud.js +0 -159
  222. package/runtime/gateways/cloud/to-cloud.js.map +0 -1
  223. package/runtime/gateways/def-serde-gateway.d.ts +0 -18
  224. package/runtime/gateways/def-serde-gateway.d.ts.map +0 -1
  225. package/runtime/gateways/def-serde-gateway.js +0 -92
  226. package/runtime/gateways/def-serde-gateway.js.map +0 -1
  227. package/runtime/gateways/file/deno/deno-filesystem.d.ts +0 -27
  228. package/runtime/gateways/file/deno/deno-filesystem.d.ts.map +0 -1
  229. package/runtime/gateways/file/deno/deno-filesystem.js +0 -52
  230. package/runtime/gateways/file/deno/deno-filesystem.js.map +0 -1
  231. package/runtime/gateways/file/deno/get-sys-file-system.d.ts +0 -4
  232. package/runtime/gateways/file/deno/get-sys-file-system.d.ts.map +0 -1
  233. package/runtime/gateways/file/deno/get-sys-file-system.js +0 -11
  234. package/runtime/gateways/file/deno/get-sys-file-system.js.map +0 -1
  235. package/runtime/gateways/file/deno/index.d.ts +0 -2
  236. package/runtime/gateways/file/deno/index.d.ts.map +0 -1
  237. package/runtime/gateways/file/deno/index.js +0 -2
  238. package/runtime/gateways/file/deno/index.js.map +0 -1
  239. package/runtime/gateways/file/gateway-impl.d.ts +0 -18
  240. package/runtime/gateways/file/gateway-impl.d.ts.map +0 -1
  241. package/runtime/gateways/file/gateway-impl.js +0 -121
  242. package/runtime/gateways/file/gateway-impl.js.map +0 -1
  243. package/runtime/gateways/file/index.d.ts +0 -3
  244. package/runtime/gateways/file/index.d.ts.map +0 -1
  245. package/runtime/gateways/file/index.js +0 -3
  246. package/runtime/gateways/file/index.js.map +0 -1
  247. package/runtime/gateways/file/key-bag-file.d.ts +0 -19
  248. package/runtime/gateways/file/key-bag-file.d.ts.map +0 -1
  249. package/runtime/gateways/file/key-bag-file.js +0 -40
  250. package/runtime/gateways/file/key-bag-file.js.map +0 -1
  251. package/runtime/gateways/file/node/get-sys-file-system.d.ts +0 -4
  252. package/runtime/gateways/file/node/get-sys-file-system.d.ts.map +0 -1
  253. package/runtime/gateways/file/node/get-sys-file-system.js +0 -11
  254. package/runtime/gateways/file/node/get-sys-file-system.js.map +0 -1
  255. package/runtime/gateways/file/node/index.d.ts +0 -2
  256. package/runtime/gateways/file/node/index.d.ts.map +0 -1
  257. package/runtime/gateways/file/node/index.js +0 -2
  258. package/runtime/gateways/file/node/index.js.map +0 -1
  259. package/runtime/gateways/file/node/node-filesystem.d.ts +0 -32
  260. package/runtime/gateways/file/node/node-filesystem.d.ts.map +0 -1
  261. package/runtime/gateways/file/node/node-filesystem.js +0 -33
  262. package/runtime/gateways/file/node/node-filesystem.js.map +0 -1
  263. package/runtime/gateways/file/node/to-array-buffer.d.ts +0 -2
  264. package/runtime/gateways/file/node/to-array-buffer.d.ts.map +0 -1
  265. package/runtime/gateways/file/node/to-array-buffer.js +0 -12
  266. package/runtime/gateways/file/node/to-array-buffer.js.map +0 -1
  267. package/runtime/gateways/file/sys-file-system-factory.d.ts +0 -4
  268. package/runtime/gateways/file/sys-file-system-factory.d.ts.map +0 -1
  269. package/runtime/gateways/file/sys-file-system-factory.js +0 -13
  270. package/runtime/gateways/file/sys-file-system-factory.js.map +0 -1
  271. package/runtime/gateways/file/utils.d.ts +0 -5
  272. package/runtime/gateways/file/utils.d.ts.map +0 -1
  273. package/runtime/gateways/file/utils.js +0 -27
  274. package/runtime/gateways/file/utils.js.map +0 -1
  275. package/runtime/gateways/file/version.d.ts +0 -2
  276. package/runtime/gateways/file/version.d.ts.map +0 -1
  277. package/runtime/gateways/file/version.js +0 -2
  278. package/runtime/gateways/file/version.js.map +0 -1
  279. package/runtime/gateways/fp-envelope-serialize.d.ts +0 -50
  280. package/runtime/gateways/fp-envelope-serialize.d.ts.map +0 -1
  281. package/runtime/gateways/fp-envelope-serialize.js +0 -141
  282. package/runtime/gateways/fp-envelope-serialize.js.map +0 -1
  283. package/runtime/gateways/index.d.ts +0 -6
  284. package/runtime/gateways/index.d.ts.map +0 -1
  285. package/runtime/gateways/index.js +0 -6
  286. package/runtime/gateways/index.js.map +0 -1
  287. package/runtime/gateways/indexeddb/gateway-impl.d.ts +0 -22
  288. package/runtime/gateways/indexeddb/gateway-impl.d.ts.map +0 -1
  289. package/runtime/gateways/indexeddb/gateway-impl.js +0 -147
  290. package/runtime/gateways/indexeddb/gateway-impl.js.map +0 -1
  291. package/runtime/gateways/indexeddb/index.d.ts +0 -6
  292. package/runtime/gateways/indexeddb/index.d.ts.map +0 -1
  293. package/runtime/gateways/indexeddb/index.js +0 -6
  294. package/runtime/gateways/indexeddb/index.js.map +0 -1
  295. package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts +0 -15
  296. package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts.map +0 -1
  297. package/runtime/gateways/indexeddb/key-bag-indexeddb.js +0 -42
  298. package/runtime/gateways/indexeddb/key-bag-indexeddb.js.map +0 -1
  299. package/runtime/gateways/indexeddb-version.d.ts +0 -2
  300. package/runtime/gateways/indexeddb-version.d.ts.map +0 -1
  301. package/runtime/gateways/indexeddb-version.js +0 -2
  302. package/runtime/gateways/indexeddb-version.js.map +0 -1
  303. package/runtime/gateways/memory/gateway.d.ts +0 -18
  304. package/runtime/gateways/memory/gateway.d.ts.map +0 -1
  305. package/runtime/gateways/memory/gateway.js +0 -73
  306. package/runtime/gateways/memory/gateway.js.map +0 -1
  307. package/runtime/gateways/memory/version.d.ts +0 -2
  308. package/runtime/gateways/memory/version.d.ts.map +0 -1
  309. package/runtime/gateways/memory/version.js +0 -2
  310. package/runtime/gateways/memory/version.js.map +0 -1
  311. package/runtime/index.d.ts +0 -13
  312. package/runtime/index.d.ts.map +0 -1
  313. package/runtime/index.js +0 -13
  314. package/runtime/index.js.map +0 -1
  315. package/runtime/key-bag-memory.d.ts +0 -12
  316. package/runtime/key-bag-memory.d.ts.map +0 -1
  317. package/runtime/key-bag-memory.js +0 -23
  318. package/runtime/key-bag-memory.js.map +0 -1
  319. package/runtime/key-bag.d.ts +0 -85
  320. package/runtime/key-bag.d.ts.map +0 -1
  321. package/runtime/key-bag.js +0 -411
  322. package/runtime/key-bag.js.map +0 -1
  323. package/runtime/keyed-crypto.d.ts +0 -19
  324. package/runtime/keyed-crypto.d.ts.map +0 -1
  325. package/runtime/keyed-crypto.js +0 -192
  326. package/runtime/keyed-crypto.js.map +0 -1
  327. package/runtime/memory-sys-container.d.ts +0 -2
  328. package/runtime/memory-sys-container.d.ts.map +0 -1
  329. package/runtime/memory-sys-container.js +0 -2
  330. package/runtime/memory-sys-container.js.map +0 -1
  331. package/runtime/meta-key-hack.d.ts +0 -42
  332. package/runtime/meta-key-hack.d.ts.map +0 -1
  333. package/runtime/meta-key-hack.js +0 -201
  334. package/runtime/meta-key-hack.js.map +0 -1
  335. package/runtime/sts-service/index.d.ts +0 -40
  336. package/runtime/sts-service/index.d.ts.map +0 -1
  337. package/runtime/sts-service/index.js +0 -108
  338. package/runtime/sts-service/index.js.map +0 -1
  339. package/runtime/sys-container.d.ts +0 -2
  340. package/runtime/sys-container.d.ts.map +0 -1
  341. package/runtime/sys-container.js +0 -2
  342. package/runtime/sys-container.js.map +0 -1
  343. package/runtime/wait-pr-multiformats/block.d.ts +0 -47
  344. package/runtime/wait-pr-multiformats/block.d.ts.map +0 -1
  345. package/runtime/wait-pr-multiformats/block.js +0 -64
  346. package/runtime/wait-pr-multiformats/block.js.map +0 -1
  347. package/runtime/wait-pr-multiformats/codec-interface.d.ts +0 -29
  348. package/runtime/wait-pr-multiformats/codec-interface.d.ts.map +0 -1
  349. package/runtime/wait-pr-multiformats/codec-interface.js +0 -2
  350. package/runtime/wait-pr-multiformats/codec-interface.js.map +0 -1
  351. package/runtime/wait-pr-multiformats/index.d.ts +0 -3
  352. package/runtime/wait-pr-multiformats/index.d.ts.map +0 -1
  353. package/runtime/wait-pr-multiformats/index.js +0 -3
  354. package/runtime/wait-pr-multiformats/index.js.map +0 -1
  355. package/tests/blockstore/fp-envelope.test.ts-off +0 -65
  356. package/tests/blockstore/fragment-gateway.test.ts-off +0 -106
  357. package/tests/blockstore/interceptor-gateway.test.ts +0 -254
  358. package/tests/blockstore/keyed-crypto-indexeddb-file.test.ts +0 -128
  359. package/tests/blockstore/keyed-crypto.test.ts +0 -526
  360. package/tests/blockstore/loader.test.ts +0 -297
  361. package/tests/blockstore/standalone.test.ts +0 -152
  362. package/tests/blockstore/store.test.ts +0 -192
  363. package/tests/blockstore/transaction.test.ts +0 -130
  364. package/tests/fireproof/all-gateway.test.ts +0 -461
  365. package/tests/fireproof/attachable.test.ts +0 -686
  366. package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
  367. package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +0 -324
  368. package/tests/fireproof/charwise-boolean.test.ts +0 -66
  369. package/tests/fireproof/crdt.test.ts +0 -570
  370. package/tests/fireproof/database.test.ts +0 -779
  371. package/tests/fireproof/deleted-docs-handling.test.ts +0 -111
  372. package/tests/fireproof/fireproof.test.fixture.ts +0 -133
  373. package/tests/fireproof/fireproof.test.ts +0 -777
  374. package/tests/fireproof/hello.test.ts +0 -74
  375. package/tests/fireproof/indexer.test.ts +0 -458
  376. package/tests/fireproof/multiple-ledger.test.ts +0 -65
  377. package/tests/fireproof/query-docs.test.ts +0 -116
  378. package/tests/fireproof/query-limit-issue.test.ts +0 -147
  379. package/tests/fireproof/query-property-inconsistency.test.ts +0 -89
  380. package/tests/fireproof/query-result-properties.test.ts +0 -42
  381. package/tests/fireproof/stable-cid.test.ts +0 -69
  382. package/tests/fireproof/utils.test.ts +0 -135
  383. package/tests/gateway/file/loader-config.test.ts +0 -307
  384. package/tests/gateway/indexeddb/loader-config.test.ts +0 -79
  385. package/tests/helpers.ts +0 -174
  386. package/tests/react/img-file.test.tsx +0 -190
  387. package/tests/react/use-all-docs.test.tsx +0 -173
  388. package/tests/react/use-document-with-nonexistent-id.test.tsx +0 -96
  389. package/tests/react/use-fireproof-db-switch.test.tsx +0 -91
  390. package/tests/react/use-fireproof-stability.test.tsx +0 -145
  391. package/tests/react/use-fireproof.test.tsx +0 -645
  392. package/tests/runtime/fp-envelope-serialize.test.ts +0 -254
  393. package/tests/runtime/meta-key-hack.test.ts +0 -95
  394. package/tests/setup.file.ts +0 -1
  395. package/tests/setup.indexeddb.ts +0 -0
  396. package/tests/setup.memory.ts +0 -2
  397. package/tests/utils.test.ts +0 -192
  398. package/tests/vitest.file.config.ts +0 -14
  399. package/tests/vitest.indexeddb.config.ts +0 -37
  400. package/tests/vitest.memory.config.ts +0 -25
  401. package/types.d.ts +0 -462
  402. package/types.d.ts.map +0 -1
  403. package/types.js +0 -60
  404. package/types.js.map +0 -1
  405. package/use-fireproof/iframe-strategy.d.ts +0 -13
  406. package/use-fireproof/iframe-strategy.d.ts.map +0 -1
  407. package/use-fireproof/iframe-strategy.js +0 -83
  408. package/use-fireproof/iframe-strategy.js.map +0 -1
  409. package/use-fireproof/index.d.ts +0 -10
  410. package/use-fireproof/index.d.ts.map +0 -1
  411. package/use-fireproof/index.js +0 -16
  412. package/use-fireproof/index.js.map +0 -1
  413. package/use-fireproof/redirect-strategy.d.ts +0 -8
  414. package/use-fireproof/redirect-strategy.d.ts.map +0 -1
  415. package/use-fireproof/redirect-strategy.js +0 -31
  416. package/use-fireproof/redirect-strategy.js.map +0 -1
  417. package/utils.d.ts +0 -49
  418. package/utils.d.ts.map +0 -1
  419. package/utils.js +0 -454
  420. package/utils.js.map +0 -1
  421. package/version.d.ts +0 -2
  422. package/version.d.ts.map +0 -1
  423. package/version.js +0 -4
  424. package/version.js.map +0 -1
  425. package/write-queue.d.ts +0 -9
  426. package/write-queue.d.ts.map +0 -1
  427. package/write-queue.js +0 -70
  428. package/write-queue.js.map +0 -1
@@ -1,296 +0,0 @@
1
- import { Future, Logger, Result } from "@adviser/cement";
2
- import { SuperThis } from "@fireproof/core";
3
- import { CalculatePreSignedUrl } from "./msg-types-data.js";
4
- import type { JWTPayload } from "jose";
5
- export declare const VERSION = "FP-MSG-1.0";
6
- export interface BaseTokenParam {
7
- readonly alg: string;
8
- readonly issuer: string;
9
- readonly audience: string;
10
- readonly validFor: number;
11
- }
12
- export type ReadWrite = "read" | "write";
13
- export declare function toReadWrite(i: string): ReadWrite;
14
- export type Role = "admin" | "owner" | "member";
15
- export declare function toRole(i: string): Role;
16
- interface TenantClaim {
17
- readonly id: string;
18
- readonly role: Role;
19
- }
20
- interface LedgerClaim {
21
- readonly id: string;
22
- readonly role: Role;
23
- readonly right: ReadWrite;
24
- }
25
- export interface FPCloudClaim extends JWTPayload {
26
- readonly userId: string;
27
- readonly email: string;
28
- readonly nickname?: string;
29
- readonly provider?: "github" | "google";
30
- readonly created: Date;
31
- readonly tenants: TenantClaim[];
32
- readonly ledgers: LedgerClaim[];
33
- readonly selected: TenantLedger;
34
- }
35
- export type TokenForParam = FPCloudClaim & Partial<BaseTokenParam>;
36
- export type MsgWithError<T extends MsgBase> = T | ErrorMsg;
37
- export interface PreSignedMsg extends MsgWithTenantLedger<MsgWithConnAuth> {
38
- readonly methodParam: MethodSignedUrlParam;
39
- readonly urlParam: SignedUrlParam;
40
- }
41
- export interface RequestOpts {
42
- readonly waitFor: (msg: MsgBase) => boolean;
43
- readonly pollInterval?: number;
44
- readonly timeout?: number;
45
- }
46
- export interface EnDeCoder {
47
- encode<T>(node: T): Uint8Array;
48
- decode<T>(data: Uint8Array): T;
49
- }
50
- export interface WaitForTid {
51
- readonly tid: string;
52
- readonly future: Future<MsgBase>;
53
- readonly timeout?: number;
54
- readonly waitFor: (msg: MsgBase) => boolean;
55
- }
56
- export interface NextId {
57
- readonly nextId: SuperThis["nextId"];
58
- }
59
- export interface AuthType {
60
- readonly type: "ucan" | "error" | "fp-cloud-jwk" | "fp-cloud";
61
- }
62
- export declare function isAuthTypeFPCloudJWK(a: AuthType): a is FPJWKCloudAuthType;
63
- export declare function isAuthTypeFPCloud(a: AuthType): a is FPCloudAuthType;
64
- export interface UCanAuth extends AuthType {
65
- readonly type: "ucan";
66
- readonly params: {
67
- readonly tbd: string;
68
- };
69
- }
70
- export interface FPJWKCloudAuthType extends AuthType {
71
- readonly type: "fp-cloud-jwk";
72
- readonly params: {
73
- readonly jwk: string;
74
- };
75
- }
76
- export interface FPCloudAuthType extends AuthType {
77
- readonly type: "fp-cloud";
78
- readonly params: {
79
- readonly claim: TokenForParam;
80
- readonly jwk: string;
81
- };
82
- }
83
- export type AuthFactory = (tp?: Partial<TokenForParam>) => Promise<Result<AuthType>>;
84
- export interface TenantLedger {
85
- readonly tenant: string;
86
- readonly ledger: string;
87
- }
88
- export declare function keyTenantLedger(t: TenantLedger): string;
89
- export interface QSId {
90
- readonly reqId: string;
91
- readonly resId: string;
92
- }
93
- export declare function qsidEqual(a: QSId, b: QSId): boolean;
94
- export declare function qsidKey(qsid: QSId): string;
95
- export interface MsgBase {
96
- readonly tid: string;
97
- readonly type: string;
98
- readonly version: string;
99
- readonly auth: AuthType;
100
- }
101
- export declare function MsgIsTid(msg: MsgBase, tid: string): boolean;
102
- type MsgWithConn<T extends MsgBase = MsgBase> = T & {
103
- readonly conn: QSId;
104
- };
105
- export type MsgWithConnAuth<T extends MsgBase = MsgBase> = MsgWithConn<T> & {
106
- readonly auth: AuthType;
107
- };
108
- export type MsgWithOptionalTenantLedger<T extends MsgWithConnAuth> = T & {
109
- readonly tenant?: Partial<TenantLedger>;
110
- };
111
- export type MsgWithTenantLedger<T extends MsgWithConnAuth> = T & {
112
- readonly tenant: TenantLedger;
113
- };
114
- export interface ErrorMsg extends MsgBase {
115
- readonly type: "error";
116
- readonly src: unknown;
117
- readonly message: string;
118
- readonly body?: string;
119
- readonly stack?: string[];
120
- }
121
- export declare function MsgIsError(rq: MsgBase): rq is ErrorMsg;
122
- export declare function MsgIsQSError(rq: ReqRes<MsgBase, MsgBase>): rq is ReqRes<ErrorMsg, ErrorMsg>;
123
- export type HttpMethods = "GET" | "PUT" | "DELETE";
124
- export type FPStoreTypes = "meta" | "car" | "wal" | "file";
125
- export declare function coerceFPStoreTypes(s?: string): FPStoreTypes;
126
- export type ProtocolCapabilities = "reqRes" | "stream";
127
- export declare function isProtocolCapabilities(s: string): s is ProtocolCapabilities;
128
- export interface Gestalt {
129
- readonly storeTypes: FPStoreTypes[];
130
- readonly id: string;
131
- readonly protocolCapabilities: ProtocolCapabilities[];
132
- readonly httpEndpoints: string[];
133
- readonly wsEndpoints: string[];
134
- readonly encodings: ("JSON" | "CBOR")[];
135
- readonly auth: AuthType[];
136
- readonly requiresAuth: boolean;
137
- readonly data?: {
138
- readonly inband: boolean;
139
- readonly outband: boolean;
140
- };
141
- readonly meta?: {
142
- readonly inband: true;
143
- readonly outband: boolean;
144
- };
145
- readonly wal?: {
146
- readonly inband: boolean;
147
- readonly outband: boolean;
148
- };
149
- readonly reqTypes: string[];
150
- readonly resTypes: string[];
151
- readonly eventTypes: string[];
152
- }
153
- export interface MsgerParams {
154
- readonly mime: string;
155
- readonly auth?: AuthType;
156
- readonly hasPersistent?: boolean;
157
- readonly protocolCapabilities?: ProtocolCapabilities[];
158
- readonly timeout: number;
159
- }
160
- export type GestaltParam = Partial<Gestalt> & {
161
- readonly id: string;
162
- };
163
- export declare function defaultGestalt(msgP: MsgerParams, gestalt: GestaltParam): Gestalt;
164
- export interface ReqChat extends MsgWithConn {
165
- readonly type: "reqChat";
166
- readonly message: string;
167
- readonly targets: QSId[];
168
- }
169
- export interface ResChat extends MsgWithConn {
170
- readonly type: "resChat";
171
- readonly message: string;
172
- readonly targets: QSId[];
173
- }
174
- export declare function buildReqChat(sthis: NextId, auth: AuthType, conn: QSId, message: string, targets?: QSId[]): ReqChat;
175
- export declare function buildResChat(req: ReqChat, conn?: QSId, message?: string, targets?: QSId[], auth?: AuthType): ResChat;
176
- export declare function MsgIsReqChat(msg: MsgBase): msg is ReqChat;
177
- export declare function MsgIsResChat(msg: MsgBase): msg is ResChat;
178
- export interface ReqGestalt extends MsgBase {
179
- readonly type: "reqGestalt";
180
- readonly gestalt: Gestalt;
181
- readonly publish?: boolean;
182
- }
183
- export declare function MsgIsReqGestalt(msg: MsgBase): msg is ReqGestalt;
184
- export declare function buildReqGestalt(sthis: NextId, auth: AuthType, gestalt: Gestalt, publish?: boolean): ReqGestalt;
185
- export interface ConnInfo {
186
- readonly connIds: string[];
187
- }
188
- export interface ResGestalt extends MsgBase {
189
- readonly type: "resGestalt";
190
- readonly gestalt: Gestalt;
191
- }
192
- export declare function buildResGestalt(req: ReqGestalt, gestalt: Gestalt, auth: AuthType): ResGestalt | ErrorMsg;
193
- export declare function MsgIsResGestalt(msg: MsgBase): msg is ResGestalt;
194
- export interface ReqOpenConnection {
195
- readonly reqId?: string;
196
- readonly resId?: string;
197
- }
198
- export interface ReqOpenConn {
199
- readonly reqId: string;
200
- readonly resId?: string;
201
- }
202
- export interface ReqOpen extends MsgBase {
203
- readonly type: "reqOpen";
204
- readonly conn: ReqOpenConn;
205
- }
206
- export declare function buildReqOpen(sthis: NextId, auth: AuthType, conn: ReqOpenConnection): ReqOpen;
207
- export declare function MsgIsReqOpen(imsg: MsgBase): imsg is MsgWithConn<ReqOpen>;
208
- export interface ResOpen extends MsgBase {
209
- readonly type: "resOpen";
210
- readonly conn: QSId;
211
- }
212
- export declare function MsgIsWithConn<T extends MsgBase>(msg: T): msg is MsgWithConn<T>;
213
- export declare function MsgIsWithConnAuth<T extends MsgBase>(msg: T): msg is MsgWithConnAuth<T>;
214
- export declare function MsgIsConnected<T extends MsgBase>(msg: T, qsid: QSId): msg is MsgWithConn<T>;
215
- export declare function buildResOpen(sthis: NextId, req: ReqOpen, resStreamId?: string): ResOpen;
216
- export declare function MsgIsResOpen(msg: MsgBase): msg is ResOpen;
217
- export interface ReqClose extends MsgWithConn {
218
- readonly type: "reqClose";
219
- }
220
- export declare function MsgIsReqClose(msg: MsgBase): msg is ReqClose;
221
- export interface ResClose extends MsgWithConn {
222
- readonly type: "resClose";
223
- }
224
- export declare function MsgIsResClose(msg: MsgBase): msg is ResClose;
225
- export declare function buildResClose(req: ReqClose, conn: QSId): ResClose;
226
- export declare function buildReqClose(sthis: NextId, auth: AuthType, conn: QSId): ReqClose;
227
- export interface SignedUrlParam {
228
- readonly path?: string;
229
- readonly key: string;
230
- readonly expires?: number;
231
- readonly index?: string;
232
- }
233
- export interface MethodSignedUrlParam {
234
- readonly method: HttpMethods;
235
- readonly store: FPStoreTypes;
236
- }
237
- export interface ReqSignedUrlParam {
238
- readonly auth: AuthType;
239
- readonly methodParam: MethodSignedUrlParam;
240
- readonly urlParam: SignedUrlParam;
241
- }
242
- export interface UpdateReqRes<Q extends MsgBase, S extends MsgBase> {
243
- req: Q;
244
- res: S;
245
- }
246
- export type ReqRes<Q extends MsgBase, S extends MsgBase> = Readonly<UpdateReqRes<Q, S>>;
247
- export declare function buildErrorMsg(msgCtx: {
248
- readonly logger: Logger;
249
- readonly sthis: SuperThis;
250
- }, base: Partial<MsgBase & {
251
- ref?: unknown;
252
- }>, error: Error, body?: string, stack?: string[]): ErrorMsg;
253
- export declare function MsgIsTenantLedger<T extends MsgBase>(msg: T): msg is MsgWithTenantLedger<MsgWithConnAuth<T>>;
254
- export interface MethodParams {
255
- readonly methodParam: MethodSignedUrlParam;
256
- }
257
- export interface SignedUrlParams {
258
- readonly urlParam: SignedUrlParam;
259
- }
260
- export type MethodSignedUrlParams = MethodParams & SignedUrlParams;
261
- export type ReqSignedUrlWithoutMethodParams = SignedUrlParams & MsgWithTenantLedger<MsgWithConnAuth>;
262
- export type ReqSignedUrl = MethodSignedUrlParams & MsgWithTenantLedger<MsgWithConnAuth>;
263
- export interface GwCtx {
264
- readonly tid?: string;
265
- readonly conn: QSId;
266
- readonly tenant: TenantLedger;
267
- }
268
- export interface GwCtxConn {
269
- readonly tid?: string;
270
- readonly conn: QSId;
271
- readonly tenant: TenantLedger;
272
- }
273
- export declare function buildReqSignedUrl<T extends ReqSignedUrl>(sthis: NextId, type: string, rparam: ReqSignedUrlParam, gwCtx: GwCtx): T;
274
- export interface ResSignedUrl extends MsgWithTenantLedger<MsgWithConn> {
275
- readonly methodParam: MethodSignedUrlParam;
276
- readonly urlParam: SignedUrlParam;
277
- readonly signedUrl: string;
278
- }
279
- export interface ResOptionalSignedUrl extends MsgWithTenantLedger<MsgWithConn> {
280
- readonly urlParam: SignedUrlParam;
281
- readonly methodParam: MethodSignedUrlParam;
282
- readonly signedUrl?: string;
283
- }
284
- export interface MsgTypesCtx {
285
- readonly sthis: SuperThis;
286
- readonly logger: Logger;
287
- }
288
- export interface MsgTypesCtxSync {
289
- readonly sthis: SuperThis;
290
- readonly logger: Logger;
291
- readonly auth: AuthType;
292
- }
293
- export declare function resAuth(msg: MsgBase): Promise<AuthType>;
294
- export declare function buildRes<Q extends MsgWithTenantLedger<MsgWithConn<ReqSignedUrlWithoutMethodParams>>, S extends ResSignedUrl>(methodParam: MethodSignedUrlParam, type: string, msgCtx: MsgTypesCtx, req: Q, ctx: CalculatePreSignedUrl): Promise<MsgWithError<S>>;
295
- export {};
296
- //# sourceMappingURL=msg-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"msg-types.d.ts","sourceRoot":"","sources":["../../../../../src/protocols/cloud/msg-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC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,CAAC,CAwB1B"}
@@ -1,296 +0,0 @@
1
- export const VERSION = "FP-MSG-1.0";
2
- export function toReadWrite(i) {
3
- switch (i.toLowerCase()) {
4
- case "write":
5
- return "write";
6
- default:
7
- return "read";
8
- }
9
- }
10
- export function toRole(i) {
11
- switch (i.toLowerCase()) {
12
- case "admin":
13
- return "admin";
14
- case "owner":
15
- return "owner";
16
- default:
17
- return "member";
18
- }
19
- }
20
- export function isAuthTypeFPCloudJWK(a) {
21
- return a.type === "fp-cloud-jwk";
22
- }
23
- export function isAuthTypeFPCloud(a) {
24
- return a.type === "fp-cloud";
25
- }
26
- export function keyTenantLedger(t) {
27
- return `${t.tenant}:${t.ledger}`;
28
- }
29
- export function qsidEqual(a, b) {
30
- return a.reqId === b.reqId && a.resId === b.resId;
31
- }
32
- export function qsidKey(qsid) {
33
- return `${qsid.reqId}:${qsid.resId}`;
34
- }
35
- export function MsgIsTid(msg, tid) {
36
- return !msg.tid || msg.tid === tid;
37
- }
38
- export function MsgIsError(rq) {
39
- return rq.type === "error";
40
- }
41
- export function MsgIsQSError(rq) {
42
- return rq.res.type === "error" || rq.req.type === "error";
43
- }
44
- export function coerceFPStoreTypes(s) {
45
- const x = s?.trim();
46
- if (x === "meta" || x === "car" || x === "wal" || x === "file") {
47
- return x;
48
- }
49
- throw new Error(`Invalid FPStoreTypes: ${s}`);
50
- }
51
- export function isProtocolCapabilities(s) {
52
- const x = s.trim();
53
- return x === "reqRes" || x === "stream";
54
- }
55
- export function defaultGestalt(msgP, gestalt) {
56
- return {
57
- storeTypes: ["meta", "file", "car", "wal"],
58
- httpEndpoints: ["/fp"],
59
- wsEndpoints: ["/ws"],
60
- encodings: ["JSON"],
61
- protocolCapabilities: msgP.protocolCapabilities || ["reqRes", "stream"],
62
- auth: [],
63
- requiresAuth: false,
64
- data: msgP.hasPersistent
65
- ? {
66
- inband: true,
67
- outband: true,
68
- }
69
- : undefined,
70
- meta: msgP.hasPersistent
71
- ? {
72
- inband: true,
73
- outband: true,
74
- }
75
- : undefined,
76
- wal: msgP.hasPersistent
77
- ? {
78
- inband: true,
79
- outband: true,
80
- }
81
- : undefined,
82
- reqTypes: [
83
- "reqOpen",
84
- "reqGestalt",
85
- "reqSubscribeMeta",
86
- "reqPutMeta",
87
- "reqBindMeta",
88
- "reqDelMeta",
89
- "reqPutData",
90
- "reqGetData",
91
- "reqDelData",
92
- "reqPutWAL",
93
- "reqGetWAL",
94
- "reqDelWAL",
95
- "reqUpdateMeta",
96
- ],
97
- resTypes: [
98
- "resOpen",
99
- "resGestalt",
100
- "resSubscribeMeta",
101
- "resPutMeta",
102
- "resGetMeta",
103
- "resDelMeta",
104
- "resPutData",
105
- "resGetData",
106
- "resDelData",
107
- "resPutWAL",
108
- "resGetWAL",
109
- "resDelWAL",
110
- "updateMeta",
111
- ],
112
- eventTypes: ["updateMeta"],
113
- ...gestalt,
114
- };
115
- }
116
- export function buildReqChat(sthis, auth, conn, message, targets) {
117
- return {
118
- tid: sthis.nextId().str,
119
- type: "reqChat",
120
- version: VERSION,
121
- auth,
122
- conn,
123
- message,
124
- targets: targets ?? [],
125
- };
126
- }
127
- export function buildResChat(req, conn, message, targets, auth) {
128
- return {
129
- ...req,
130
- auth: auth || req.auth,
131
- conn: conn || req.conn,
132
- message: message || req.message,
133
- targets: targets || req.targets,
134
- type: "resChat",
135
- version: VERSION,
136
- };
137
- }
138
- export function MsgIsReqChat(msg) {
139
- return msg.type === "reqChat";
140
- }
141
- export function MsgIsResChat(msg) {
142
- return msg.type === "resChat";
143
- }
144
- export function MsgIsReqGestalt(msg) {
145
- return msg.type === "reqGestalt";
146
- }
147
- export function buildReqGestalt(sthis, auth, gestalt, publish) {
148
- return {
149
- tid: sthis.nextId().str,
150
- auth,
151
- type: "reqGestalt",
152
- version: VERSION,
153
- gestalt,
154
- publish,
155
- };
156
- }
157
- export function buildResGestalt(req, gestalt, auth) {
158
- return {
159
- tid: req.tid,
160
- auth: auth || req.auth,
161
- type: "resGestalt",
162
- version: VERSION,
163
- gestalt,
164
- };
165
- }
166
- export function MsgIsResGestalt(msg) {
167
- return msg.type === "resGestalt";
168
- }
169
- export function buildReqOpen(sthis, auth, conn) {
170
- return {
171
- tid: sthis.nextId().str,
172
- auth,
173
- type: "reqOpen",
174
- version: VERSION,
175
- conn: {
176
- ...conn,
177
- reqId: conn.reqId || sthis.nextId().str,
178
- },
179
- };
180
- }
181
- export function MsgIsReqOpen(imsg) {
182
- const msg = imsg;
183
- return msg.type === "reqOpen" && !!msg.conn && !!msg.conn.reqId;
184
- }
185
- export function MsgIsWithConn(msg) {
186
- const mwc = msg.conn;
187
- return mwc && !!mwc.reqId && !!mwc.resId;
188
- }
189
- export function MsgIsWithConnAuth(msg) {
190
- return MsgIsWithConn(msg) && !!msg.auth && typeof msg.auth.type === "string";
191
- }
192
- export function MsgIsConnected(msg, qsid) {
193
- return MsgIsWithConn(msg) && msg.conn.reqId === qsid.reqId && msg.conn.resId === qsid.resId;
194
- }
195
- export function buildResOpen(sthis, req, resStreamId) {
196
- if (!(req.conn && req.conn.reqId)) {
197
- throw new Error("req.conn.reqId is required");
198
- }
199
- return {
200
- ...req,
201
- type: "resOpen",
202
- conn: {
203
- ...req.conn,
204
- resId: req.conn.resId || resStreamId || sthis.nextId().str,
205
- },
206
- };
207
- }
208
- export function MsgIsResOpen(msg) {
209
- return msg.type === "resOpen";
210
- }
211
- export function MsgIsReqClose(msg) {
212
- return msg.type === "reqClose" && MsgIsWithConn(msg);
213
- }
214
- export function MsgIsResClose(msg) {
215
- return msg.type === "resClose" && MsgIsWithConn(msg);
216
- }
217
- export function buildResClose(req, conn) {
218
- return {
219
- ...req,
220
- type: "resClose",
221
- conn,
222
- };
223
- }
224
- export function buildReqClose(sthis, auth, conn) {
225
- return {
226
- tid: sthis.nextId().str,
227
- auth,
228
- type: "reqClose",
229
- version: VERSION,
230
- conn,
231
- };
232
- }
233
- export function buildErrorMsg(msgCtx, base, error, body, stack) {
234
- if (!stack && msgCtx.sthis.env.get("FP_STACK")) {
235
- stack = error.stack?.split("\n");
236
- }
237
- const msg = {
238
- auth: base.auth || { type: "error" },
239
- src: base,
240
- type: "error",
241
- tid: base.tid || "internal",
242
- message: error.message,
243
- version: VERSION,
244
- body,
245
- stack,
246
- };
247
- msgCtx.logger.Any("ErrorMsg", msg);
248
- return msg;
249
- }
250
- export function MsgIsTenantLedger(msg) {
251
- if (MsgIsWithConnAuth(msg)) {
252
- const t = msg.tenant;
253
- return !!t && !!t.tenant && !!t.ledger;
254
- }
255
- return false;
256
- }
257
- export function buildReqSignedUrl(sthis, type, rparam, gwCtx) {
258
- return {
259
- tid: sthis.nextId().str,
260
- type,
261
- auth: rparam.auth,
262
- version: VERSION,
263
- ...gwCtx,
264
- methodParam: rparam.methodParam,
265
- urlParam: rparam.urlParam,
266
- };
267
- }
268
- export function resAuth(msg) {
269
- return msg.auth ? Promise.resolve(msg.auth) : Promise.reject(new Error("No Auth"));
270
- }
271
- export async function buildRes(methodParam, type, msgCtx, req, ctx) {
272
- const psm = {
273
- type: "reqSignedUrl",
274
- auth: await resAuth(req),
275
- version: req.version,
276
- methodParam,
277
- urlParam: {
278
- ...req.urlParam,
279
- },
280
- conn: req.conn,
281
- tenant: req.tenant,
282
- tid: req.tid,
283
- };
284
- const rSignedUrl = await ctx.calculatePreSignedUrl(msgCtx, psm);
285
- if (rSignedUrl.isErr()) {
286
- return buildErrorMsg(msgCtx, req, rSignedUrl.Err());
287
- }
288
- return {
289
- ...req,
290
- urlParam: psm.urlParam,
291
- methodParam,
292
- type,
293
- signedUrl: rSignedUrl.Ok().toString(),
294
- };
295
- }
296
- //# sourceMappingURL=msg-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"msg-types.js","sourceRoot":"","sources":["../../../../../src/protocols/cloud/msg-types.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AAWpC,MAAM,UAAU,WAAW,CAAC,CAAS;IACnC,QAAQ,CAAC,CAAC,WAAW,E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