@backendrelay/core 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (598) hide show
  1. package/dist/standalone/index.js +1 -1
  2. package/dist/standalone/index.umd.cjs +1 -1
  3. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts +20 -0
  4. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  5. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js +5 -0
  6. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js.map +1 -0
  7. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts +2 -0
  8. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  9. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js +88 -0
  10. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js.map +1 -0
  11. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts +2 -0
  12. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts.map +1 -0
  13. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js +131 -0
  14. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js.map +1 -0
  15. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts +2 -0
  16. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts.map +1 -0
  17. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js +65 -0
  18. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js.map +1 -0
  19. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts +725 -0
  20. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts.map +1 -0
  21. package/node_modules/@backendrelay/admin/dist/commonjs/index.js +1159 -0
  22. package/node_modules/@backendrelay/admin/dist/commonjs/index.js.map +1 -0
  23. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts +2 -0
  24. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  25. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js +91 -0
  26. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js.map +1 -0
  27. package/node_modules/@backendrelay/admin/dist/commonjs/package.json +3 -0
  28. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts +17 -0
  29. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts.map +1 -0
  30. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js +26 -0
  31. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js.map +1 -0
  32. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts +2 -0
  33. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts.map +1 -0
  34. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js +50 -0
  35. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js.map +1 -0
  36. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts +2 -0
  37. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts.map +1 -0
  38. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js +33 -0
  39. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js.map +1 -0
  40. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts +39 -0
  41. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts.map +1 -0
  42. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js +306 -0
  43. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js.map +1 -0
  44. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts +3 -0
  45. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts.map +1 -0
  46. package/node_modules/@backendrelay/admin/dist/commonjs/version.js +5 -0
  47. package/node_modules/@backendrelay/admin/dist/commonjs/version.js.map +1 -0
  48. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts +20 -0
  49. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  50. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js +4 -0
  51. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js.map +1 -0
  52. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts +2 -0
  53. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts.map +1 -0
  54. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js +86 -0
  55. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js.map +1 -0
  56. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts +2 -0
  57. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts.map +1 -0
  58. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js +129 -0
  59. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js.map +1 -0
  60. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts +2 -0
  61. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts.map +1 -0
  62. package/node_modules/@backendrelay/admin/dist/esm/config.test.js +63 -0
  63. package/node_modules/@backendrelay/admin/dist/esm/config.test.js.map +1 -0
  64. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts +725 -0
  65. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts.map +1 -0
  66. package/node_modules/@backendrelay/admin/dist/esm/index.js +1146 -0
  67. package/node_modules/@backendrelay/admin/dist/esm/index.js.map +1 -0
  68. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts +2 -0
  69. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts.map +1 -0
  70. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js +89 -0
  71. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js.map +1 -0
  72. package/node_modules/@backendrelay/admin/dist/esm/package.json +3 -0
  73. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts +17 -0
  74. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts.map +1 -0
  75. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js +22 -0
  76. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js.map +1 -0
  77. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts +2 -0
  78. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts.map +1 -0
  79. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js +48 -0
  80. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js.map +1 -0
  81. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts +2 -0
  82. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts.map +1 -0
  83. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js +31 -0
  84. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js.map +1 -0
  85. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts +39 -0
  86. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts.map +1 -0
  87. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js +300 -0
  88. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js.map +1 -0
  89. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts +3 -0
  90. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts.map +1 -0
  91. package/{src/version.ts → node_modules/@backendrelay/admin/dist/esm/version.js} +1 -1
  92. package/node_modules/@backendrelay/admin/dist/esm/version.js.map +1 -0
  93. package/node_modules/@backendrelay/admin/package.json +52 -0
  94. package/node_modules/@backendrelay/functions/README.md +131 -0
  95. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts +3 -0
  96. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  97. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js +3 -0
  98. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js.map +1 -0
  99. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts +2 -0
  100. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  101. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js +51 -0
  102. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js.map +1 -0
  103. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts +230 -0
  104. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts.map +1 -0
  105. package/node_modules/@backendrelay/functions/dist/commonjs/index.js +415 -0
  106. package/node_modules/@backendrelay/functions/dist/commonjs/index.js.map +1 -0
  107. package/node_modules/@backendrelay/functions/dist/commonjs/package.json +3 -0
  108. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts +3 -0
  109. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  110. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js +2 -0
  111. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js.map +1 -0
  112. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts +2 -0
  113. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts.map +1 -0
  114. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js +49 -0
  115. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js.map +1 -0
  116. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts +230 -0
  117. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts.map +1 -0
  118. package/node_modules/@backendrelay/functions/dist/esm/index.js +403 -0
  119. package/node_modules/@backendrelay/functions/dist/esm/index.js.map +1 -0
  120. package/node_modules/@backendrelay/functions/dist/esm/package.json +3 -0
  121. package/node_modules/@backendrelay/functions/package.json +49 -0
  122. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts +43 -0
  123. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts.map +1 -0
  124. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js +63 -0
  125. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js.map +1 -0
  126. package/node_modules/@backendrelay/hatchet/dist/commonjs/package.json +3 -0
  127. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts +43 -0
  128. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts.map +1 -0
  129. package/node_modules/@backendrelay/hatchet/dist/esm/index.js +59 -0
  130. package/node_modules/@backendrelay/hatchet/dist/esm/index.js.map +1 -0
  131. package/node_modules/@backendrelay/hatchet/dist/esm/package.json +3 -0
  132. package/node_modules/@backendrelay/hatchet/package.json +46 -0
  133. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts +18 -0
  134. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts.map +1 -0
  135. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js +77 -0
  136. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js.map +1 -0
  137. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts +99 -0
  138. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts.map +1 -0
  139. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js +177 -0
  140. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js.map +1 -0
  141. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts +7 -0
  142. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts.map +1 -0
  143. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js +15 -0
  144. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js.map +1 -0
  145. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts +3 -0
  146. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts.map +1 -0
  147. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js +46 -0
  148. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js.map +1 -0
  149. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts +13 -0
  150. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts.map +1 -0
  151. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js +25 -0
  152. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js.map +1 -0
  153. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts +285 -0
  154. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts.map +1 -0
  155. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js +426 -0
  156. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js.map +1 -0
  157. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts +24 -0
  158. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts.map +1 -0
  159. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js +108 -0
  160. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js.map +1 -0
  161. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts +188 -0
  162. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts.map +1 -0
  163. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js +412 -0
  164. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js.map +1 -0
  165. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts +9 -0
  166. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts.map +1 -0
  167. package/node_modules/@backendrelay/platform/dist/commonjs/api.js +12 -0
  168. package/node_modules/@backendrelay/platform/dist/commonjs/api.js.map +1 -0
  169. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts +89 -0
  170. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts.map +1 -0
  171. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js +357 -0
  172. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js.map +1 -0
  173. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts +146 -0
  174. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts.map +1 -0
  175. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js +251 -0
  176. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js.map +1 -0
  177. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts +2 -0
  178. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts.map +1 -0
  179. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js +29 -0
  180. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js.map +1 -0
  181. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts +11 -0
  182. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts.map +1 -0
  183. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js +17 -0
  184. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js.map +1 -0
  185. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts +4 -0
  186. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts.map +1 -0
  187. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js +26 -0
  188. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js.map +1 -0
  189. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts +19 -0
  190. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts.map +1 -0
  191. package/node_modules/@backendrelay/platform/dist/commonjs/index.js +76 -0
  192. package/node_modules/@backendrelay/platform/dist/commonjs/index.js.map +1 -0
  193. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts +4 -0
  194. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts.map +1 -0
  195. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js +52 -0
  196. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js.map +1 -0
  197. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts +99 -0
  198. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts.map +1 -0
  199. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js +597 -0
  200. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js.map +1 -0
  201. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts +98 -0
  202. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts.map +1 -0
  203. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js +275 -0
  204. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js.map +1 -0
  205. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts +12 -0
  206. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts.map +1 -0
  207. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js +26 -0
  208. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js.map +1 -0
  209. package/node_modules/@backendrelay/platform/dist/commonjs/package.json +3 -0
  210. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts +3 -0
  211. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts.map +1 -0
  212. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js +66 -0
  213. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js.map +1 -0
  214. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts +13 -0
  215. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts.map +1 -0
  216. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js +31 -0
  217. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js.map +1 -0
  218. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts +7 -0
  219. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts.map +1 -0
  220. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js +46 -0
  221. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js.map +1 -0
  222. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts +161 -0
  223. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts.map +1 -0
  224. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js +174 -0
  225. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js.map +1 -0
  226. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts +25 -0
  227. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts.map +1 -0
  228. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js +68 -0
  229. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js.map +1 -0
  230. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts +17 -0
  231. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts.map +1 -0
  232. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js +314 -0
  233. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js.map +1 -0
  234. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts +13 -0
  235. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts.map +1 -0
  236. package/node_modules/@backendrelay/platform/dist/commonjs/util.js +55 -0
  237. package/node_modules/@backendrelay/platform/dist/commonjs/util.js.map +1 -0
  238. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts +3 -0
  239. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts.map +1 -0
  240. package/node_modules/@backendrelay/platform/dist/commonjs/version.js +5 -0
  241. package/node_modules/@backendrelay/platform/dist/commonjs/version.js.map +1 -0
  242. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts +18 -0
  243. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts.map +1 -0
  244. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js +73 -0
  245. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js.map +1 -0
  246. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts +99 -0
  247. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts.map +1 -0
  248. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js +165 -0
  249. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js.map +1 -0
  250. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts +7 -0
  251. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts.map +1 -0
  252. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js +12 -0
  253. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js.map +1 -0
  254. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts +3 -0
  255. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts.map +1 -0
  256. package/node_modules/@backendrelay/platform/dist/esm/api/http.js +39 -0
  257. package/node_modules/@backendrelay/platform/dist/esm/api/http.js.map +1 -0
  258. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts +13 -0
  259. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts.map +1 -0
  260. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js +21 -0
  261. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js.map +1 -0
  262. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts +285 -0
  263. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts.map +1 -0
  264. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js +421 -0
  265. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js.map +1 -0
  266. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts +24 -0
  267. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts.map +1 -0
  268. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js +99 -0
  269. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js.map +1 -0
  270. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts +188 -0
  271. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts.map +1 -0
  272. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js +393 -0
  273. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js.map +1 -0
  274. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts +9 -0
  275. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts.map +1 -0
  276. package/node_modules/@backendrelay/platform/dist/esm/api.js +4 -0
  277. package/node_modules/@backendrelay/platform/dist/esm/api.js.map +1 -0
  278. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts +89 -0
  279. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts.map +1 -0
  280. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js +354 -0
  281. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js.map +1 -0
  282. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts +146 -0
  283. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts.map +1 -0
  284. package/node_modules/@backendrelay/platform/dist/esm/backups.js +240 -0
  285. package/node_modules/@backendrelay/platform/dist/esm/backups.js.map +1 -0
  286. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts +2 -0
  287. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts.map +1 -0
  288. package/node_modules/@backendrelay/platform/dist/esm/clerk.js +26 -0
  289. package/node_modules/@backendrelay/platform/dist/esm/clerk.js.map +1 -0
  290. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts +11 -0
  291. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts.map +1 -0
  292. package/node_modules/@backendrelay/platform/dist/esm/consts.js +13 -0
  293. package/node_modules/@backendrelay/platform/dist/esm/consts.js.map +1 -0
  294. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts +4 -0
  295. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts.map +1 -0
  296. package/node_modules/@backendrelay/platform/dist/esm/crypto.js +21 -0
  297. package/node_modules/@backendrelay/platform/dist/esm/crypto.js.map +1 -0
  298. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts +19 -0
  299. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts.map +1 -0
  300. package/node_modules/@backendrelay/platform/dist/esm/index.js +18 -0
  301. package/node_modules/@backendrelay/platform/dist/esm/index.js.map +1 -0
  302. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts +4 -0
  303. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts.map +1 -0
  304. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js +47 -0
  305. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js.map +1 -0
  306. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts +99 -0
  307. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts.map +1 -0
  308. package/node_modules/@backendrelay/platform/dist/esm/migrations.js +588 -0
  309. package/node_modules/@backendrelay/platform/dist/esm/migrations.js.map +1 -0
  310. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts +98 -0
  311. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts.map +1 -0
  312. package/node_modules/@backendrelay/platform/dist/esm/oauth.js +266 -0
  313. package/node_modules/@backendrelay/platform/dist/esm/oauth.js.map +1 -0
  314. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts +12 -0
  315. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts.map +1 -0
  316. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js +22 -0
  317. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js.map +1 -0
  318. package/node_modules/@backendrelay/platform/dist/esm/package.json +3 -0
  319. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts +3 -0
  320. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts.map +1 -0
  321. package/node_modules/@backendrelay/platform/dist/esm/perms.js +62 -0
  322. package/node_modules/@backendrelay/platform/dist/esm/perms.js.map +1 -0
  323. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts +13 -0
  324. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts.map +1 -0
  325. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js +28 -0
  326. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js.map +1 -0
  327. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts +7 -0
  328. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts.map +1 -0
  329. package/node_modules/@backendrelay/platform/dist/esm/relationships.js +43 -0
  330. package/node_modules/@backendrelay/platform/dist/esm/relationships.js.map +1 -0
  331. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts +161 -0
  332. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts.map +1 -0
  333. package/node_modules/@backendrelay/platform/dist/esm/schema.js +158 -0
  334. package/node_modules/@backendrelay/platform/dist/esm/schema.js.map +1 -0
  335. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts +25 -0
  336. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts.map +1 -0
  337. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js +64 -0
  338. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js.map +1 -0
  339. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts +17 -0
  340. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts.map +1 -0
  341. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js +310 -0
  342. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js.map +1 -0
  343. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts +13 -0
  344. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts.map +1 -0
  345. package/node_modules/@backendrelay/platform/dist/esm/util.js +46 -0
  346. package/node_modules/@backendrelay/platform/dist/esm/util.js.map +1 -0
  347. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts +3 -0
  348. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts.map +1 -0
  349. package/node_modules/@backendrelay/platform/dist/esm/version.js +3 -0
  350. package/node_modules/@backendrelay/platform/dist/esm/version.js.map +1 -0
  351. package/node_modules/@backendrelay/platform/dist/standalone/index.js +13738 -0
  352. package/node_modules/@backendrelay/platform/dist/standalone/index.umd.cjs +72 -0
  353. package/node_modules/@backendrelay/platform/package.json +51 -0
  354. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts +67 -0
  355. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts.map +1 -0
  356. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js +129 -0
  357. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js.map +1 -0
  358. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/package.json +3 -0
  359. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts +67 -0
  360. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts.map +1 -0
  361. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js +126 -0
  362. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js.map +1 -0
  363. package/node_modules/@backendrelay/resumable-stream/dist/esm/package.json +3 -0
  364. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.js +4354 -0
  365. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.umd.cjs +6 -0
  366. package/node_modules/@backendrelay/resumable-stream/package.json +47 -0
  367. package/node_modules/@backendrelay/rules/README.md +34 -0
  368. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts +117 -0
  369. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts.map +1 -0
  370. package/node_modules/@backendrelay/rules/dist/commonjs/index.js +68 -0
  371. package/node_modules/@backendrelay/rules/dist/commonjs/index.js.map +1 -0
  372. package/node_modules/@backendrelay/rules/dist/commonjs/package.json +3 -0
  373. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts +117 -0
  374. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts.map +1 -0
  375. package/node_modules/@backendrelay/rules/dist/esm/index.js +64 -0
  376. package/node_modules/@backendrelay/rules/dist/esm/index.js.map +1 -0
  377. package/node_modules/@backendrelay/rules/dist/esm/package.json +3 -0
  378. package/node_modules/@backendrelay/rules/package.json +46 -0
  379. package/node_modules/@backendrelay/test/README.md +75 -0
  380. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts +74 -0
  381. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts.map +1 -0
  382. package/node_modules/@backendrelay/test/dist/commonjs/index.js +197 -0
  383. package/node_modules/@backendrelay/test/dist/commonjs/index.js.map +1 -0
  384. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts +2 -0
  385. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  386. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js +45 -0
  387. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js.map +1 -0
  388. package/node_modules/@backendrelay/test/dist/commonjs/package.json +3 -0
  389. package/node_modules/@backendrelay/test/dist/esm/index.d.ts +74 -0
  390. package/node_modules/@backendrelay/test/dist/esm/index.d.ts.map +1 -0
  391. package/node_modules/@backendrelay/test/dist/esm/index.js +192 -0
  392. package/node_modules/@backendrelay/test/dist/esm/index.js.map +1 -0
  393. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts +2 -0
  394. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts.map +1 -0
  395. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js +43 -0
  396. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js.map +1 -0
  397. package/node_modules/@backendrelay/test/dist/esm/package.json +3 -0
  398. package/node_modules/@backendrelay/test/package.json +49 -0
  399. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts +3 -0
  400. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts.map +1 -0
  401. package/node_modules/@backendrelay/version/dist/commonjs/index.js +6 -0
  402. package/node_modules/@backendrelay/version/dist/commonjs/index.js.map +1 -0
  403. package/node_modules/@backendrelay/version/dist/commonjs/package.json +3 -0
  404. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts +3 -0
  405. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts.map +1 -0
  406. package/node_modules/@backendrelay/version/dist/commonjs/version.js +10 -0
  407. package/node_modules/@backendrelay/version/dist/commonjs/version.js.map +1 -0
  408. package/node_modules/@backendrelay/version/dist/esm/index.d.ts +3 -0
  409. package/node_modules/@backendrelay/version/dist/esm/index.d.ts.map +1 -0
  410. package/node_modules/@backendrelay/version/dist/esm/index.js +3 -0
  411. package/node_modules/@backendrelay/version/dist/esm/index.js.map +1 -0
  412. package/node_modules/@backendrelay/version/dist/esm/package.json +3 -0
  413. package/node_modules/@backendrelay/version/dist/esm/version.d.ts +3 -0
  414. package/node_modules/@backendrelay/version/dist/esm/version.d.ts.map +1 -0
  415. package/node_modules/@backendrelay/version/dist/esm/version.js +7 -0
  416. package/node_modules/@backendrelay/version/dist/esm/version.js.map +1 -0
  417. package/node_modules/@backendrelay/version/dist/standalone/index.js +4 -0
  418. package/node_modules/@backendrelay/version/dist/standalone/index.umd.cjs +1 -0
  419. package/node_modules/@backendrelay/version/package.json +44 -0
  420. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts +12 -0
  421. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  422. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js +5 -0
  423. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js.map +1 -0
  424. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts +2 -0
  425. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  426. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js +82 -0
  427. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js.map +1 -0
  428. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts +607 -0
  429. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts.map +1 -0
  430. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js +830 -0
  431. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js.map +1 -0
  432. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts +2 -0
  433. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  434. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js +139 -0
  435. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js.map +1 -0
  436. package/node_modules/@backendrelay/webhooks/dist/commonjs/package.json +3 -0
  437. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts +12 -0
  438. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  439. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js +4 -0
  440. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js.map +1 -0
  441. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts +2 -0
  442. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts.map +1 -0
  443. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js +80 -0
  444. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js.map +1 -0
  445. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts +607 -0
  446. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts.map +1 -0
  447. package/node_modules/@backendrelay/webhooks/dist/esm/index.js +825 -0
  448. package/node_modules/@backendrelay/webhooks/dist/esm/index.js.map +1 -0
  449. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts +2 -0
  450. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts.map +1 -0
  451. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js +137 -0
  452. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js.map +1 -0
  453. package/node_modules/@backendrelay/webhooks/dist/esm/package.json +3 -0
  454. package/node_modules/@backendrelay/webhooks/package.json +46 -0
  455. package/package.json +129 -56
  456. package/subpaths/admin/index.cjs +1 -0
  457. package/subpaths/admin/index.d.ts +1 -0
  458. package/subpaths/admin/index.mjs +3 -0
  459. package/subpaths/functions/index.cjs +1 -0
  460. package/subpaths/functions/index.d.ts +1 -0
  461. package/subpaths/functions/index.mjs +3 -0
  462. package/subpaths/hatchet/index.cjs +1 -0
  463. package/subpaths/hatchet/index.d.ts +1 -0
  464. package/subpaths/hatchet/index.mjs +3 -0
  465. package/subpaths/platform/index.cjs +1 -0
  466. package/subpaths/platform/index.d.ts +1 -0
  467. package/subpaths/platform/index.mjs +3 -0
  468. package/subpaths/resumable-stream/index.cjs +1 -0
  469. package/subpaths/resumable-stream/index.d.ts +1 -0
  470. package/subpaths/resumable-stream/index.mjs +3 -0
  471. package/subpaths/rules/index.cjs +1 -0
  472. package/subpaths/rules/index.d.ts +1 -0
  473. package/subpaths/rules/index.mjs +3 -0
  474. package/subpaths/test/index.cjs +1 -0
  475. package/subpaths/test/index.d.ts +1 -0
  476. package/subpaths/test/index.mjs +3 -0
  477. package/subpaths/version/index.cjs +1 -0
  478. package/subpaths/version/index.d.ts +1 -0
  479. package/subpaths/version/index.mjs +3 -0
  480. package/subpaths/webhooks/index.cjs +1 -0
  481. package/subpaths/webhooks/index.d.ts +1 -0
  482. package/subpaths/webhooks/index.mjs +3 -0
  483. package/.tshy/build.json +0 -8
  484. package/.tshy/commonjs.json +0 -16
  485. package/.tshy/esm.json +0 -15
  486. package/__example__/standalone.esm.html +0 -23
  487. package/__example__/standalone.umd.html +0 -21
  488. package/__tests__/src/Connection.test.ts +0 -292
  489. package/__tests__/src/IndexedDBStorage.test.ts +0 -96
  490. package/__tests__/src/Reactor.test.ts +0 -1179
  491. package/__tests__/src/auth-extra-fields.e2e.test.ts +0 -160
  492. package/__tests__/src/byop.e2e.test.ts +0 -762
  493. package/__tests__/src/config.test.ts +0 -85
  494. package/__tests__/src/cookieSync.e2e.test.ts +0 -163
  495. package/__tests__/src/data/movies/attrs.json +0 -145
  496. package/__tests__/src/data/movies/triples.json +0 -1507
  497. package/__tests__/src/data/zeneca/attrs.json +0 -251
  498. package/__tests__/src/data/zeneca/triples.json +0 -15854
  499. package/__tests__/src/datalog.test.ts +0 -175
  500. package/__tests__/src/devtool.test.ts +0 -23
  501. package/__tests__/src/framework.test.ts +0 -173
  502. package/__tests__/src/infiniteQuery.e2e.test.ts +0 -467
  503. package/__tests__/src/instaml.test.ts +0 -1593
  504. package/__tests__/src/instaql.bench.ts +0 -34
  505. package/__tests__/src/instaql.test.ts +0 -1497
  506. package/__tests__/src/instaqlInference.test.ts +0 -243
  507. package/__tests__/src/presence.test.ts +0 -49
  508. package/__tests__/src/queryValidation.test.ts +0 -1101
  509. package/__tests__/src/schema.test.ts +0 -653
  510. package/__tests__/src/serializeSchema.test.ts +0 -123
  511. package/__tests__/src/simple.e2e.test.ts +0 -133
  512. package/__tests__/src/storage-upload.test.ts +0 -37
  513. package/__tests__/src/store.test.ts +0 -960
  514. package/__tests__/src/syncTable.e2e.test.ts +0 -245
  515. package/__tests__/src/syncTable.test.ts +0 -235
  516. package/__tests__/src/transactionValidation.test.ts +0 -450
  517. package/__tests__/src/typeUtils.ts +0 -39
  518. package/__tests__/src/upstream-improvements.e2e.test.ts +0 -54
  519. package/__tests__/src/utils/MutationStorage.test.ts +0 -77
  520. package/__tests__/src/utils/PersistedObject.test.ts +0 -569
  521. package/__tests__/src/utils/dates.test.ts +0 -111
  522. package/__tests__/src/utils/e2e.ts +0 -100
  523. package/__tests__/src/utils/msw.ts +0 -3
  524. package/__tests__/src/utils/object.test.ts +0 -78
  525. package/__tests__/src/utils/weakHash.test.ts +0 -68
  526. package/__tests__/src/utils/weakHashLegacy.test.ts +0 -22
  527. package/__tests__/src/vite.env.d.ts +0 -1
  528. package/src/BackendRelayError.ts +0 -50
  529. package/src/Connection.ts +0 -361
  530. package/src/InMemoryStorage.ts +0 -34
  531. package/src/IndexedDBStorage.ts +0 -398
  532. package/src/Reactor.js +0 -1541
  533. package/src/StorageAPI.ts +0 -147
  534. package/src/Stream.ts +0 -1252
  535. package/src/SyncTable.ts +0 -750
  536. package/src/WindowNetworkListener.js +0 -19
  537. package/src/__types__/fieldsTypeTest.ts +0 -111
  538. package/src/__types__/typeUtils.ts +0 -39
  539. package/src/__types__/useDatesTypeTest.ts +0 -66
  540. package/src/attrTypes.ts +0 -37
  541. package/src/authAPI.ts +0 -205
  542. package/src/clientTypes.ts +0 -28
  543. package/src/coreTypes.ts +0 -58
  544. package/src/createRouteHandler.ts +0 -68
  545. package/src/datalog.js +0 -116
  546. package/src/devtool.ts +0 -179
  547. package/src/framework.ts +0 -450
  548. package/src/helperTypes.ts +0 -117
  549. package/src/index.ts +0 -1293
  550. package/src/infiniteQuery.ts +0 -599
  551. package/src/instaml.ts +0 -676
  552. package/src/instaql.ts +0 -999
  553. package/src/instatx.ts +0 -265
  554. package/src/model/instaqlResult.js +0 -25
  555. package/src/parseSchemaFromJSON.ts +0 -176
  556. package/src/presence.ts +0 -123
  557. package/src/presenceTypes.ts +0 -19
  558. package/src/queryTypes.ts +0 -749
  559. package/src/queryValidation.ts +0 -598
  560. package/src/reactorAuth.js +0 -236
  561. package/src/reactorEvents.js +0 -414
  562. package/src/reactorMutations.js +0 -354
  563. package/src/reactorRooms.js +0 -297
  564. package/src/reactorStorage.js +0 -180
  565. package/src/reactorSubs.js +0 -275
  566. package/src/reactorTransport.js +0 -391
  567. package/src/reactorTypes.ts +0 -41
  568. package/src/routeHandlerProtocol.ts +0 -25
  569. package/src/rulesTypes.ts +0 -132
  570. package/src/sanityCheckQueries.ts +0 -191
  571. package/src/schema.ts +0 -206
  572. package/src/schemaTypes.ts +0 -664
  573. package/src/store.ts +0 -1165
  574. package/src/transactionValidation.ts +0 -204
  575. package/src/urls.ts +0 -50
  576. package/src/utils/Deferred.ts +0 -20
  577. package/src/utils/MutationStorage.ts +0 -89
  578. package/src/utils/PersistedObject.ts +0 -612
  579. package/src/utils/dates.ts +0 -269
  580. package/src/utils/error.ts +0 -9
  581. package/src/utils/fetch.ts +0 -131
  582. package/src/utils/flags.ts +0 -14
  583. package/src/utils/id.ts +0 -28
  584. package/src/utils/linkIndex.ts +0 -33
  585. package/src/utils/log.ts +0 -23
  586. package/src/utils/object.js +0 -180
  587. package/src/utils/pgtime.ts +0 -199
  588. package/src/utils/pick.js +0 -9
  589. package/src/utils/strings.ts +0 -19
  590. package/src/utils/weakHash.ts +0 -77
  591. package/src/utils/weakHashLegacy.ts +0 -75
  592. package/src/warningToggle.ts +0 -5
  593. package/tsconfig.cjs.dev.json +0 -15
  594. package/tsconfig.dev.json +0 -14
  595. package/tsconfig.json +0 -13
  596. package/tsconfig.test.json +0 -5
  597. package/vite.config.ts +0 -19
  598. package/vitest.config.ts +0 -54
@@ -1,1593 +0,0 @@
1
- import { test, expect } from 'vitest';
2
- import * as instaml from '../../src/instaml';
3
- import * as instatx from '../../src/instatx';
4
- import zenecaAttrs from './data/zeneca/attrs.json';
5
- import zenecaTriples from './data/zeneca/triples.json';
6
- import { createStore, transact, AttrsStoreClass } from '../../src/store';
7
- import uuid from '../../src/utils/id';
8
- import { i, BackendRelayDBAttr } from '../../src/index';
9
-
10
- const zenecaAttrToId = zenecaAttrs.reduce((res, x) => {
11
- // @ts-expect-error
12
- res[`${x['forward-identity'][1]}/${x['forward-identity'][2]}`] = x.id;
13
- return res;
14
- }, {});
15
-
16
- const zenecaAttrsStore = new AttrsStoreClass(
17
- zenecaAttrs.reduce((res, x) => {
18
- // @ts-expect-error
19
- res[x.id] = x;
20
- return res;
21
- }, {}),
22
- null,
23
- );
24
-
25
- const store = createStore(
26
- zenecaAttrsStore,
27
- zenecaTriples as [string, string, any, number][],
28
- );
29
-
30
- test('simple update transform', () => {
31
- const testId = uuid();
32
-
33
- const ops = instatx.tx.books[testId].update({ title: 'New Title' });
34
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
35
-
36
- const expected = [
37
- // @ts-expect-error
38
- ['add-triple', testId, zenecaAttrToId['books/title'], 'New Title'],
39
- // @ts-expect-error
40
- ['add-triple', testId, zenecaAttrToId['books/id'], testId],
41
- ];
42
-
43
- expect(result).toHaveLength(expected.length);
44
- for (const item of expected) {
45
- expect(result).toContainEqual(item);
46
- }
47
- });
48
-
49
- test('undefined is ignored in update', () => {
50
- const testId = uuid();
51
-
52
- const ops = instatx.tx.users[testId].update({
53
- handle: 'bobby',
54
- fullName: undefined,
55
- });
56
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
57
-
58
- const expected = [
59
- // @ts-expect-error
60
- ['add-triple', testId, zenecaAttrToId['users/id'], testId],
61
- // @ts-expect-error
62
- ['add-triple', testId, zenecaAttrToId['users/handle'], 'bobby'],
63
- ];
64
-
65
- expect(result).toHaveLength(expected.length);
66
- for (const item of expected) {
67
- expect(result).toContainEqual(item);
68
- }
69
- });
70
-
71
- test('ignores id attrs', () => {
72
- const testId = uuid();
73
-
74
- const ops = instatx.tx.books[testId].update({
75
- title: 'New Title',
76
- id: 'ploop',
77
- });
78
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
79
-
80
- const expected = [
81
- // @ts-expect-error
82
- ['add-triple', testId, zenecaAttrToId['books/title'], 'New Title'],
83
- // @ts-expect-error
84
- ['add-triple', testId, zenecaAttrToId['books/id'], testId],
85
- ];
86
- expect(result).toHaveLength(expected.length);
87
- for (const item of expected) {
88
- expect(result).toContainEqual(item);
89
- }
90
- });
91
-
92
- test("optimistically adds attrs if they don't exist", () => {
93
- const testId = uuid();
94
-
95
- const ops = instatx.tx.books[testId].update({ newAttr: 'New Title' });
96
-
97
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
98
-
99
- const expected = [
100
- [
101
- 'add-attr',
102
- {
103
- cardinality: 'one',
104
- 'forward-identity': [expect.any(String), 'books', 'newAttr'],
105
- id: expect.any(String),
106
- 'index?': false,
107
- isUnsynced: true,
108
- 'unique?': false,
109
- 'value-type': 'blob',
110
- },
111
- ],
112
- ['add-triple', testId, expect.any(String), 'New Title'],
113
- // @ts-expect-error
114
- ['add-triple', testId, zenecaAttrToId['books/id'], testId],
115
- ];
116
-
117
- expect(result).toHaveLength(expected.length);
118
- for (const item of expected) {
119
- expect(result).toContainEqual(item);
120
- }
121
- });
122
-
123
- test('lookup resolves attr ids', () => {
124
- const ops = instatx.tx.users[
125
- instatx.lookup('email', 'stopa@backendrelay.com')
126
- ].update({
127
- handle: 'stopa',
128
- });
129
-
130
- // @ts-expect-error
131
- const stopaLookup = [zenecaAttrToId['users/email'], 'stopa@backendrelay.com'];
132
-
133
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
134
-
135
- const expected = [
136
- // @ts-expect-error
137
- ['add-triple', stopaLookup, zenecaAttrToId['users/handle'], 'stopa'],
138
- // @ts-expect-error
139
- ['add-triple', stopaLookup, zenecaAttrToId['users/id'], stopaLookup],
140
- ];
141
-
142
- expect(result).toHaveLength(expected.length);
143
- for (const item of expected) {
144
- expect(result).toContainEqual(item);
145
- }
146
- });
147
-
148
- test('lookup creates unique attrs for custom lookups', () => {
149
- const ops = instatx.tx.users[
150
- instatx.lookup('newAttr', 'newAttrValue')
151
- ].update({
152
- handle: 'stopa',
153
- });
154
-
155
- const lookup = [
156
- // The attr is going to be created, so we don't know its value yet
157
- expect.any(String),
158
- 'newAttrValue',
159
- ];
160
-
161
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
162
- const expected = [
163
- [
164
- 'add-attr',
165
- {
166
- cardinality: 'one',
167
- 'forward-identity': [expect.any(String), 'users', 'newAttr'],
168
- id: expect.any(String),
169
- 'index?': true,
170
- isUnsynced: true,
171
- 'unique?': true,
172
- 'value-type': 'blob',
173
- },
174
- ],
175
- // @ts-expect-error
176
- ['add-triple', lookup, zenecaAttrToId['users/handle'], 'stopa'],
177
- // @ts-expect-error
178
-
179
- ['add-triple', lookup, zenecaAttrToId['users/id'], lookup],
180
- ];
181
-
182
- expect(result).toHaveLength(expected.length);
183
- for (const item of expected) {
184
- expect(result).toContainEqual(item);
185
- }
186
- });
187
-
188
- test('lookup creates unique attrs for lookups in link values', () => {
189
- const uid = uuid();
190
- const ops = instatx.tx.users[uid]
191
- .update({})
192
- .link({ posts: instatx.lookup('slug', 'life-is-good') });
193
-
194
- const result = instaml.transform(
195
- { attrsStore: new AttrsStoreClass({}, null) },
196
- ops,
197
- );
198
-
199
- expect(result).toEqual([
200
- [
201
- 'add-attr',
202
- {
203
- id: expect.any(String),
204
- 'forward-identity': [expect.any(String), 'users', 'posts'],
205
- 'reverse-identity': [expect.any(String), 'posts', 'users'],
206
- 'value-type': 'ref',
207
- cardinality: 'one',
208
- 'unique?': true,
209
- 'index?': true,
210
- isUnsynced: true,
211
- },
212
- ],
213
- [
214
- 'add-attr',
215
- {
216
- id: expect.any(String),
217
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
218
- 'value-type': 'blob',
219
- cardinality: 'one',
220
- 'unique?': true,
221
- 'index?': true,
222
- isUnsynced: true,
223
- },
224
- ],
225
- [
226
- 'add-attr',
227
- {
228
- id: expect.any(String),
229
- 'forward-identity': [expect.any(String), 'users', 'id'],
230
- 'value-type': 'blob',
231
- cardinality: 'one',
232
- 'unique?': true,
233
- 'index?': false,
234
- isUnsynced: true,
235
- },
236
- ],
237
- ['add-triple', uid, expect.any(String), uid],
238
- [
239
- 'add-triple',
240
- uid,
241
- expect.any(String),
242
- [expect.any(String), 'life-is-good'],
243
- ],
244
- ]);
245
- });
246
-
247
- test('lookup creates unique attrs for lookups in link values with arrays', () => {
248
- const uid = uuid();
249
- const ops = instatx.tx.users[uid].update({}).link({
250
- posts: [
251
- instatx.lookup('slug', 'life-is-good'),
252
- instatx.lookup('slug', 'check-this-out'),
253
- ],
254
- });
255
-
256
- const result = instaml.transform(
257
- { attrsStore: new AttrsStoreClass({}, null) },
258
- ops,
259
- );
260
-
261
- const expected = [
262
- [
263
- 'add-attr',
264
- {
265
- id: expect.any(String),
266
- 'forward-identity': [expect.any(String), 'users', 'posts'],
267
- 'reverse-identity': [expect.any(String), 'posts', 'users'],
268
- 'value-type': 'ref',
269
- cardinality: 'one',
270
- 'unique?': true,
271
- 'index?': true,
272
- isUnsynced: true,
273
- },
274
- ],
275
- [
276
- 'add-attr',
277
- {
278
- id: expect.any(String),
279
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
280
- 'value-type': 'blob',
281
- cardinality: 'one',
282
- 'unique?': true,
283
- 'index?': true,
284
- isUnsynced: true,
285
- },
286
- ],
287
- [
288
- 'add-attr',
289
- {
290
- id: expect.any(String),
291
- 'forward-identity': [expect.any(String), 'users', 'id'],
292
- 'value-type': 'blob',
293
- cardinality: 'one',
294
- 'unique?': true,
295
- 'index?': false,
296
- isUnsynced: true,
297
- },
298
- ],
299
- ['add-triple', uid, expect.any(String), uid],
300
- [
301
- 'add-triple',
302
- uid,
303
- expect.any(String),
304
- [expect.any(String), 'life-is-good'],
305
- ],
306
- [
307
- 'add-triple',
308
- uid,
309
- expect.any(String),
310
- [expect.any(String), 'check-this-out'],
311
- ],
312
- ];
313
-
314
- expect(result).toHaveLength(expected.length);
315
- for (const item of expected) {
316
- expect(result).toContainEqual(item);
317
- }
318
- });
319
-
320
- test('lookup creates unique attrs for lookups in link values when fwd-ident exists', () => {
321
- const uid = uuid();
322
- const ops = instatx.tx.users[uid]
323
- .update({})
324
- .link({ posts: instatx.lookup('slug', 'life-is-good') });
325
-
326
- const attrId = uuid();
327
- const existingRefAttr = {
328
- id: attrId,
329
- 'forward-identity': [uuid(), 'users', 'posts'],
330
- 'reverse-identity': [uuid(), 'posts', 'users'],
331
- 'value-type': 'ref',
332
- cardinality: 'one',
333
- 'unique?': true,
334
- 'index?': true,
335
- } as unknown as BackendRelayDBAttr;
336
-
337
- const result = instaml.transform(
338
- { attrsStore: new AttrsStoreClass({ [attrId]: existingRefAttr }, null) },
339
- ops,
340
- );
341
-
342
- expect(result).toEqual([
343
- [
344
- 'add-attr',
345
- {
346
- id: expect.any(String),
347
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
348
- 'value-type': 'blob',
349
- cardinality: 'one',
350
- 'unique?': true,
351
- 'index?': true,
352
- isUnsynced: true,
353
- },
354
- ],
355
- [
356
- 'add-attr',
357
- {
358
- id: expect.any(String),
359
- 'forward-identity': [expect.any(String), 'users', 'id'],
360
- 'value-type': 'blob',
361
- cardinality: 'one',
362
- 'unique?': true,
363
- 'index?': false,
364
- isUnsynced: true,
365
- },
366
- ],
367
- ['add-triple', uid, expect.any(String), uid],
368
- [
369
- 'add-triple',
370
- uid,
371
- expect.any(String),
372
- [expect.any(String), 'life-is-good'],
373
- ],
374
- ]);
375
- });
376
-
377
- test('lookup creates unique attrs for lookups in link values when rev-ident exists', () => {
378
- const uid = uuid();
379
- const ops = instatx.tx.users[uid]
380
- .update({})
381
- .link({ posts: instatx.lookup('slug', 'life-is-good') });
382
-
383
- const attrId = uuid();
384
- const existingRefAttr = {
385
- id: attrId,
386
- 'forward-identity': [uuid(), 'posts', 'users'],
387
- 'reverse-identity': [uuid(), 'users', 'posts'],
388
- 'value-type': 'ref',
389
- cardinality: 'one',
390
- 'unique?': true,
391
- 'index?': true,
392
- } as unknown as BackendRelayDBAttr;
393
-
394
- const result = instaml.transform(
395
- { attrsStore: new AttrsStoreClass({ [attrId]: existingRefAttr }, null) },
396
- ops,
397
- );
398
-
399
- expect(result).toEqual([
400
- [
401
- 'add-attr',
402
- {
403
- id: expect.any(String),
404
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
405
- 'value-type': 'blob',
406
- cardinality: 'one',
407
- 'unique?': true,
408
- 'index?': true,
409
- isUnsynced: true,
410
- },
411
- ],
412
- [
413
- 'add-attr',
414
- {
415
- id: expect.any(String),
416
- 'forward-identity': [expect.any(String), 'users', 'id'],
417
- 'value-type': 'blob',
418
- cardinality: 'one',
419
- 'unique?': true,
420
- 'index?': false,
421
- isUnsynced: true,
422
- },
423
- ],
424
- ['add-triple', uid, expect.any(String), uid],
425
- [
426
- 'add-triple',
427
- [expect.any(String), 'life-is-good'],
428
- expect.any(String),
429
- uid,
430
- ],
431
- ]);
432
- });
433
-
434
- test("lookup doesn't override attrs for lookups in link values", () => {
435
- const uid = uuid();
436
- const ops = instatx.tx.users[uid]
437
- .update({})
438
- .link({ posts: instatx.lookup('slug', 'life-is-good') });
439
-
440
- const refAttrId = uuid();
441
- const userIdAttrId = uuid();
442
- const postsSlugAttrId = uuid();
443
-
444
- const attrsStore = new AttrsStoreClass(
445
- {
446
- [refAttrId]: {
447
- id: refAttrId,
448
- 'forward-identity': [uuid(), 'users', 'posts'],
449
- 'reverse-identity': [uuid(), 'posts', 'users'],
450
- 'value-type': 'ref',
451
- cardinality: 'one',
452
- 'unique?': true,
453
- 'index?': true,
454
- } as unknown as BackendRelayDBAttr,
455
- [userIdAttrId]: {
456
- id: userIdAttrId,
457
- 'forward-identity': [uuid(), 'users', 'id'],
458
- 'value-type': 'blob',
459
- cardinality: 'one',
460
- 'unique?': true,
461
- 'index?': false,
462
- } as unknown as BackendRelayDBAttr,
463
- [postsSlugAttrId]: {
464
- id: postsSlugAttrId,
465
- 'forward-identity': [uuid(), 'posts', 'slug'],
466
- 'value-type': 'blob',
467
- cardinality: 'one',
468
- 'unique?': true,
469
- 'index?': true,
470
- } as unknown as BackendRelayDBAttr,
471
- },
472
- null,
473
- );
474
-
475
- const result = instaml.transform({ attrsStore }, ops);
476
-
477
- expect(result).toEqual([
478
- ['add-triple', uid, userIdAttrId, uid],
479
- ['add-triple', uid, refAttrId, [postsSlugAttrId, 'life-is-good']],
480
- ]);
481
- });
482
-
483
- test("lookup doesn't override attrs for lookups in self links", () => {
484
- const refAttrId = uuid();
485
- const postIdAttrId = uuid();
486
- const postsSlugAttrId = uuid();
487
-
488
- const attrsStore = new AttrsStoreClass(
489
- {
490
- [postIdAttrId]: {
491
- id: postIdAttrId,
492
- 'forward-identity': [uuid(), 'posts', 'id'],
493
- 'value-type': 'blob',
494
- cardinality: 'one',
495
- 'unique?': true,
496
- 'index?': false,
497
- } as unknown as BackendRelayDBAttr,
498
- [postsSlugAttrId]: {
499
- id: postsSlugAttrId,
500
- 'forward-identity': [uuid(), 'posts', 'slug'],
501
- 'value-type': 'blob',
502
- cardinality: 'one',
503
- 'unique?': true,
504
- 'index?': true,
505
- } as unknown as BackendRelayDBAttr,
506
- [refAttrId]: {
507
- id: refAttrId,
508
- 'forward-identity': [uuid(), 'posts', 'parent'],
509
- 'reverse-identity': [uuid(), 'posts', 'child'],
510
- 'value-type': 'ref',
511
- cardinality: 'one',
512
- 'unique?': true,
513
- 'index?': true,
514
- } as unknown as BackendRelayDBAttr,
515
- },
516
- null,
517
- );
518
-
519
- const ops1 = instatx.tx.posts[instatx.lookup('slug', 'life-is-good')]
520
- .update({})
521
- .link({ parent: instatx.lookup('slug', 'life-is-good') });
522
-
523
- const result1 = instaml.transform({ attrsStore }, ops1);
524
-
525
- expect(result1.filter((x) => x[0] !== 'add-triple')).toEqual([]);
526
-
527
- const ops2 = instatx.tx.posts[instatx.lookup('slug', 'life-is-good')]
528
- .update({})
529
- .link({ child: instatx.lookup('slug', 'life-is-good') });
530
-
531
- const result2 = instaml.transform({ attrsStore }, ops2);
532
-
533
- expect(result2.filter((x) => x[0] !== 'add-triple')).toEqual([]);
534
- });
535
-
536
- test('lookup creates unique ref attrs for ref lookup', () => {
537
- const uid = uuid();
538
- const ops = [
539
- instatx.tx.users[uid].update({}),
540
- instatx.tx.user_prefs[instatx.lookup('users.id', uid)].update({}),
541
- ];
542
-
543
- const lookup = [
544
- // The attr is going to be created, so we don't know its value yet
545
- expect.any(String),
546
- uid,
547
- ];
548
-
549
- const result = instaml.transform(
550
- { attrsStore: new AttrsStoreClass({}, null) },
551
- ops,
552
- );
553
- const expected = [
554
- [
555
- 'add-attr',
556
- {
557
- id: expect.any(String),
558
- 'forward-identity': [expect.any(String), 'users', 'id'],
559
- 'value-type': 'blob',
560
- cardinality: 'one',
561
- 'unique?': true,
562
- 'index?': false,
563
- isUnsynced: true,
564
- },
565
- ],
566
- [
567
- 'add-attr',
568
- {
569
- id: expect.any(String),
570
- 'forward-identity': [expect.any(String), 'user_prefs', 'id'],
571
- 'value-type': 'blob',
572
- cardinality: 'one',
573
- 'unique?': true,
574
- 'index?': false,
575
- isUnsynced: true,
576
- },
577
- ],
578
- [
579
- 'add-attr',
580
- {
581
- id: expect.any(String),
582
- 'forward-identity': [expect.any(String), 'user_prefs', 'users'],
583
- 'reverse-identity': [expect.any(String), 'users', 'user_prefs'],
584
- 'value-type': 'ref',
585
- cardinality: 'one',
586
- 'unique?': true,
587
- 'index?': true,
588
- isUnsynced: true,
589
- },
590
- ],
591
- ['add-triple', uid, expect.any(String), uid],
592
- ['add-triple', lookup, expect.any(String), lookup],
593
- ];
594
-
595
- expect(result).toHaveLength(expected.length);
596
- for (const item of expected) {
597
- expect(result).toContainEqual(item);
598
- }
599
- });
600
-
601
- test('lookup creates unique ref attrs for ref lookup in link value', () => {
602
- const uid = uuid();
603
- const ops = [
604
- instatx.tx.users[uid]
605
- .update({})
606
- .link({ user_prefs: instatx.lookup('users.id', uid) }),
607
- ];
608
-
609
- const lookup = [
610
- // The attr is going to be created, so we don't know its value yet
611
- expect.any(String),
612
- uid,
613
- ];
614
-
615
- const result = instaml.transform(
616
- { attrsStore: new AttrsStoreClass({}, null) },
617
- ops,
618
- );
619
-
620
- const expected = [
621
- [
622
- 'add-attr',
623
- {
624
- id: expect.any(String),
625
- 'forward-identity': [expect.any(String), 'users', 'user_prefs'],
626
- 'reverse-identity': [expect.any(String), 'user_prefs', 'users'],
627
- 'value-type': 'ref',
628
- cardinality: 'one',
629
- 'unique?': true,
630
- 'index?': true,
631
- isUnsynced: true,
632
- },
633
- ],
634
- [
635
- 'add-attr',
636
- {
637
- id: expect.any(String),
638
- 'forward-identity': [expect.any(String), 'users', 'id'],
639
- 'value-type': 'blob',
640
- cardinality: 'one',
641
- 'unique?': true,
642
- 'index?': false,
643
- isUnsynced: true,
644
- },
645
- ],
646
- ['add-triple', uid, expect.any(String), uid],
647
- ['add-triple', uid, expect.any(String), lookup],
648
- ];
649
-
650
- expect(result).toHaveLength(expected.length);
651
- for (const item of expected) {
652
- expect(result).toContainEqual(item);
653
- }
654
- });
655
-
656
- test('lookups create entities from links', () => {
657
- const bookshelfId = uuid();
658
-
659
- const ops = instatx.tx.users[instatx.lookup('handle', 'bobby_newuser')].link({
660
- bookshelves: bookshelfId,
661
- });
662
-
663
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
664
- // @ts-expect-error
665
- const expectedLookup = [zenecaAttrToId['users/handle'], 'bobby_newuser'];
666
- const expected = [
667
- // @ts-expect-error
668
- ['add-triple', expectedLookup, zenecaAttrToId['users/id'], expectedLookup],
669
- [
670
- 'add-triple',
671
- expectedLookup,
672
- // @ts-expect-error
673
- zenecaAttrToId['users/bookshelves'],
674
- bookshelfId,
675
- ],
676
- ];
677
-
678
- expect(result).toHaveLength(expected.length);
679
- for (const item of expected) {
680
- expect(result).toContainEqual(item);
681
- }
682
- });
683
-
684
- test('lookups create entities from unlinks', () => {
685
- const bookshelfId = uuid();
686
-
687
- const ops = instatx.tx.users[
688
- instatx.lookup('handle', 'bobby_newuser')
689
- ].unlink({
690
- bookshelves: bookshelfId,
691
- });
692
-
693
- const result = instaml.transform({ attrsStore: zenecaAttrsStore }, ops);
694
- // @ts-expect-error
695
- const expectedLookup = [zenecaAttrToId['users/handle'], 'bobby_newuser'];
696
- const expected = [
697
- // @ts-expect-error
698
- ['add-triple', expectedLookup, zenecaAttrToId['users/id'], expectedLookup],
699
- [
700
- 'retract-triple',
701
- expectedLookup,
702
- // @ts-expect-error
703
- zenecaAttrToId['users/bookshelves'],
704
- bookshelfId,
705
- ],
706
- ];
707
-
708
- expect(result).toHaveLength(expected.length);
709
- for (const item of expected) {
710
- expect(result).toContainEqual(item);
711
- }
712
- });
713
-
714
- test('upstream #2769: stale cached IDs and lookups retain default upsert', () => {
715
- // create
716
- var id = uuid();
717
- var ops = instatx.tx.users[id].update({ handle: 'test' });
718
- var result = instaml.transform(
719
- { attrsStore: zenecaAttrsStore, stores: [store] },
720
- ops,
721
- );
722
- for (const txStep of result) {
723
- expect(txStep[4]).toEqual(undefined);
724
- }
725
-
726
- // update by id
727
- ops = instatx.tx.users['ce942051-2d74-404a-9c7d-4aa3f2d54ae4'].update({
728
- handle: 'joe2',
729
- });
730
- result = instaml.transform(
731
- { attrsStore: zenecaAttrsStore, stores: [store] },
732
- ops,
733
- );
734
- for (const txStep of result) {
735
- expect(txStep[4]).toEqual(undefined);
736
- }
737
-
738
- // update by lookup
739
- ops = instatx.tx.users[
740
- instatx.lookup('email', 'stopa@backendrelay.com')
741
- ].update({ handle: 'stopa2' });
742
- result = instaml.transform(
743
- { attrsStore: zenecaAttrsStore, stores: [store] },
744
- ops,
745
- );
746
- for (const txStep of result) {
747
- expect(txStep[4]).toEqual(undefined);
748
- }
749
-
750
- // forced mode
751
- var ops = instatx.tx.users[id].update({ handle: 'test' }, { upsert: false });
752
- var result = instaml.transform(
753
- { attrsStore: zenecaAttrsStore, stores: [store] },
754
- ops,
755
- );
756
- for (const txStep of result) {
757
- expect(txStep[4]).toEqual({ mode: 'update' });
758
- }
759
-
760
- var ops = instatx.tx.users['ce942051-2d74-404a-9c7d-4aa3f2d54ae4'].update(
761
- { handle: 'test' },
762
- { upsert: true },
763
- );
764
- var result = instaml.transform(
765
- { attrsStore: zenecaAttrsStore, stores: [store] },
766
- ops,
767
- );
768
- for (const txStep of result) {
769
- expect(txStep[4]).toEqual(undefined);
770
- }
771
- });
772
-
773
- test('it throws if you use an invalid link attr', () => {
774
- expect(() =>
775
- instaml.transform(
776
- { attrsStore: new AttrsStoreClass({}, null) },
777
- instatx.tx.users[
778
- instatx.lookup('user_pref.email', 'test@example.com')
779
- ].update({
780
- a: 1,
781
- }),
782
- ),
783
- ).toThrowError('user_pref.email is not a valid lookup attribute.');
784
- });
785
-
786
- test("it doesn't throw if you have a period in your attr", () => {
787
- const aid = uuid();
788
- const iid = uuid();
789
- const pid = uuid();
790
- const attrsStore = new AttrsStoreClass(
791
- {
792
- [aid]: {
793
- id: aid,
794
- cardinality: 'one',
795
- 'forward-identity': [uuid(), 'users', 'attr.with.dot'],
796
- 'index?': true,
797
- 'unique?': true,
798
- 'value-type': 'blob',
799
- } as unknown as BackendRelayDBAttr,
800
- [iid]: {
801
- id: iid,
802
- cardinality: 'one',
803
- 'forward-identity': [uuid(), 'users', 'id'],
804
- 'index?': true,
805
- 'unique?': false,
806
- 'value-type': 'blob',
807
- } as unknown as BackendRelayDBAttr,
808
- [pid]: {
809
- id: pid,
810
- cardinality: 'one',
811
- 'forward-identity': [uuid(), 'users', 'a'],
812
- 'index?': false,
813
- 'unique?': false,
814
- 'value-type': 'blob',
815
- } as unknown as BackendRelayDBAttr,
816
- },
817
- null,
818
- );
819
-
820
- expect(
821
- instaml.transform(
822
- { attrsStore },
823
- instatx.tx.users[instatx.lookup('attr.with.dot', 'value')].update({
824
- a: 1,
825
- }),
826
- ),
827
- ).toEqual([
828
- ['add-triple', [aid, 'value'], iid, [aid, 'value']],
829
- ['add-triple', [aid, 'value'], pid, 1],
830
- ]);
831
- });
832
-
833
- test("it doesn't create duplicate ref attrs", () => {
834
- const aid = uuid();
835
- const bid = uuid();
836
- const ops = [
837
- instatx.tx.nsA[aid].update({}).link({ nsB: bid }),
838
- instatx.tx.nsB[bid].update({}).link({ nsA: aid }),
839
- ];
840
-
841
- const result = instaml.transform(
842
- { attrsStore: new AttrsStoreClass({}, null) },
843
- ops,
844
- );
845
-
846
- const expected = [
847
- [
848
- 'add-attr',
849
- {
850
- cardinality: 'one',
851
- 'forward-identity': [expect.any(String), 'nsA', 'id'],
852
- id: expect.any(String),
853
- 'index?': false,
854
- isUnsynced: true,
855
- 'unique?': true,
856
- 'value-type': 'blob',
857
- },
858
- ],
859
- [
860
- 'add-attr',
861
- {
862
- cardinality: 'one',
863
- 'forward-identity': [expect.any(String), 'nsB', 'id'],
864
- id: expect.any(String),
865
- 'index?': false,
866
- isUnsynced: true,
867
- 'unique?': true,
868
- 'value-type': 'blob',
869
- },
870
- ],
871
- [
872
- 'add-attr',
873
- {
874
- cardinality: 'many',
875
- 'forward-identity': [expect.any(String), 'nsA', 'nsB'],
876
- id: expect.any(String),
877
- 'index?': false,
878
- isUnsynced: true,
879
- 'reverse-identity': [expect.any(String), 'nsB', 'nsA'],
880
- 'unique?': false,
881
- 'value-type': 'ref',
882
- },
883
- ],
884
- ['add-triple', aid, expect.any(String), aid],
885
- ['add-triple', aid, expect.any(String), bid],
886
- ['add-triple', bid, expect.any(String), bid],
887
- ['add-triple', aid, expect.any(String), bid],
888
- ];
889
-
890
- expect(result).toHaveLength(expected.length);
891
- for (const item of expected) {
892
- expect(result).toContainEqual(item);
893
- }
894
- });
895
-
896
- test('Schema: uses info in `attrs` and `links`', () => {
897
- const schema = i.schema({
898
- entities: {
899
- comments: i.entity({
900
- slug: i.string().unique().indexed(),
901
- }),
902
- books: i.entity({}),
903
- },
904
- links: {
905
- commentBooks: {
906
- forward: {
907
- on: 'comments',
908
- has: 'one',
909
- label: 'book',
910
- },
911
- reverse: {
912
- on: 'books',
913
- has: 'many',
914
- label: 'comments',
915
- },
916
- },
917
- },
918
- });
919
-
920
- const commentId = uuid();
921
- const bookId = uuid();
922
- const ops = instatx.tx.comments[commentId]
923
- .update({
924
- slug: 'test-slug',
925
- })
926
- .link({
927
- book: bookId,
928
- });
929
-
930
- const result = instaml.transform(
931
- {
932
- attrsStore: zenecaAttrsStore,
933
- schema: schema,
934
- },
935
- ops,
936
- );
937
-
938
- const expected = [
939
- [
940
- 'add-attr',
941
- {
942
- id: expect.any(String),
943
- 'forward-identity': [expect.any(String), 'comments', 'slug'],
944
- 'value-type': 'blob',
945
- cardinality: 'one',
946
- 'unique?': true,
947
- 'index?': true,
948
- 'checked-data-type': 'string',
949
- isUnsynced: true,
950
- },
951
- ],
952
- [
953
- 'add-attr',
954
- {
955
- id: expect.any(String),
956
- 'forward-identity': [expect.any(String), 'comments', 'id'],
957
- 'value-type': 'blob',
958
- cardinality: 'one',
959
- 'unique?': true,
960
- 'index?': false,
961
- isUnsynced: true,
962
- },
963
- ],
964
- [
965
- 'add-attr',
966
- {
967
- id: expect.any(String),
968
- 'forward-identity': [expect.any(String), 'comments', 'book'],
969
- 'reverse-identity': [expect.any(String), 'books', 'comments'],
970
- 'value-type': 'ref',
971
- cardinality: 'one',
972
- 'unique?': false,
973
- 'index?': false,
974
- isUnsynced: true,
975
- },
976
- ],
977
- ['add-triple', commentId, expect.any(String), commentId],
978
- ['add-triple', commentId, expect.any(String), 'test-slug'],
979
- ['add-triple', commentId, expect.any(String), bookId],
980
- ];
981
- expect(result).toHaveLength(expected.length);
982
- for (const item of expected) {
983
- expect(result).toContainEqual(item);
984
- }
985
- });
986
-
987
- test("Schema: doesn't create duplicate ref attrs", () => {
988
- const schema = i.schema({
989
- entities: {
990
- comments: i.entity({}),
991
- books: i.entity({}),
992
- },
993
- links: {
994
- commentBooks: {
995
- forward: {
996
- on: 'comments',
997
- has: 'one',
998
- label: 'book',
999
- },
1000
- reverse: {
1001
- on: 'books',
1002
- has: 'many',
1003
- label: 'comments',
1004
- },
1005
- },
1006
- },
1007
- });
1008
-
1009
- const commentId = uuid();
1010
- const bookId = uuid();
1011
- const ops = [
1012
- instatx.tx.comments[commentId].update({}).link({ book: bookId }),
1013
- instatx.tx.books[bookId].update({}).link({ comments: commentId }),
1014
- ];
1015
-
1016
- const result = instaml.transform(
1017
- { attrsStore: zenecaAttrsStore, schema },
1018
- ops,
1019
- );
1020
-
1021
- const expected = [
1022
- [
1023
- 'add-attr',
1024
- {
1025
- cardinality: 'one',
1026
- 'forward-identity': [expect.any(String), 'comments', 'id'],
1027
- id: expect.any(String),
1028
- 'index?': false,
1029
- isUnsynced: true,
1030
- 'unique?': true,
1031
- 'value-type': 'blob',
1032
- },
1033
- ],
1034
- [
1035
- 'add-attr',
1036
- {
1037
- cardinality: 'one',
1038
- 'forward-identity': [expect.any(String), 'comments', 'book'],
1039
- id: expect.any(String),
1040
- 'index?': false,
1041
- isUnsynced: true,
1042
- 'reverse-identity': [expect.any(String), 'books', 'comments'],
1043
- 'unique?': false,
1044
- 'value-type': 'ref',
1045
- },
1046
- ],
1047
- ['add-triple', commentId, expect.any(String), commentId],
1048
- ['add-triple', commentId, expect.any(String), bookId],
1049
- ['add-triple', bookId, expect.any(String), bookId],
1050
- ['add-triple', commentId, expect.any(String), bookId],
1051
- ];
1052
- expect(result).toHaveLength(expected.length);
1053
- for (const item of expected) {
1054
- expect(result).toContainEqual(item);
1055
- }
1056
- });
1057
-
1058
- test('Schema: lookup creates unique attrs for custom lookups', () => {
1059
- const schema = i.schema({
1060
- entities: {
1061
- users: i.entity({
1062
- nickname: i.string().unique().indexed(),
1063
- }),
1064
- },
1065
- });
1066
-
1067
- const ops = instatx.tx.users[instatx.lookup('nickname', 'stopanator')].update(
1068
- {
1069
- handle: 'stopa',
1070
- },
1071
- );
1072
-
1073
- const lookup = [
1074
- // The attr is going to be created, so we don't know its value yet
1075
- expect.any(String),
1076
- 'stopanator',
1077
- ];
1078
-
1079
- const result = instaml.transform(
1080
- { attrsStore: zenecaAttrsStore, schema },
1081
- ops,
1082
- );
1083
- const expected = [
1084
- [
1085
- 'add-attr',
1086
- {
1087
- cardinality: 'one',
1088
- 'forward-identity': [expect.any(String), 'users', 'nickname'],
1089
- id: expect.any(String),
1090
- 'index?': true,
1091
- isUnsynced: true,
1092
- 'unique?': true,
1093
- 'checked-data-type': 'string',
1094
- 'value-type': 'blob',
1095
- },
1096
- ],
1097
- // @ts-expect-error
1098
- ['add-triple', lookup, zenecaAttrToId['users/handle'], 'stopa'],
1099
- // @ts-expect-error
1100
- ['add-triple', lookup, zenecaAttrToId['users/id'], lookup],
1101
- ];
1102
-
1103
- expect(result).toHaveLength(expected.length);
1104
- for (const item of expected) {
1105
- expect(result).toContainEqual(item);
1106
- }
1107
- });
1108
-
1109
- test('Schema: lookup creates unique attrs for lookups in link values', () => {
1110
- const schema = i.schema({
1111
- entities: {
1112
- posts: i.entity({
1113
- slug: i.string().unique().indexed(),
1114
- }),
1115
- users: i.entity({}),
1116
- },
1117
- links: {
1118
- postUsers: {
1119
- forward: {
1120
- on: 'users',
1121
- has: 'many',
1122
- label: 'authoredPosts',
1123
- },
1124
- reverse: {
1125
- on: 'posts',
1126
- has: 'one',
1127
- label: 'author',
1128
- },
1129
- },
1130
- },
1131
- });
1132
-
1133
- const uid = uuid();
1134
- const ops = instatx.tx.users[uid]
1135
- .update({})
1136
- .link({ authoredPosts: instatx.lookup('slug', 'life-is-good') });
1137
-
1138
- const result = instaml.transform(
1139
- { attrsStore: new AttrsStoreClass({}, null), schema },
1140
- ops,
1141
- );
1142
-
1143
- expect(result).toEqual([
1144
- [
1145
- 'add-attr',
1146
- {
1147
- id: expect.any(String),
1148
- 'forward-identity': [expect.any(String), 'users', 'authoredPosts'],
1149
- 'reverse-identity': [expect.any(String), 'posts', 'author'],
1150
- 'value-type': 'ref',
1151
- // TODO: should this be one?
1152
- cardinality: 'one',
1153
- 'unique?': true,
1154
- 'index?': true,
1155
- isUnsynced: true,
1156
- },
1157
- ],
1158
- [
1159
- 'add-attr',
1160
- {
1161
- id: expect.any(String),
1162
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
1163
- 'value-type': 'blob',
1164
- cardinality: 'one',
1165
- 'unique?': true,
1166
- 'index?': true,
1167
- 'checked-data-type': 'string',
1168
- isUnsynced: true,
1169
- },
1170
- ],
1171
- [
1172
- 'add-attr',
1173
- {
1174
- id: expect.any(String),
1175
- 'forward-identity': [expect.any(String), 'users', 'id'],
1176
- 'value-type': 'blob',
1177
- cardinality: 'one',
1178
- 'unique?': true,
1179
- 'index?': false,
1180
- isUnsynced: true,
1181
- },
1182
- ],
1183
- ['add-triple', uid, expect.any(String), uid],
1184
- [
1185
- 'add-triple',
1186
- uid,
1187
- expect.any(String),
1188
- [expect.any(String), 'life-is-good'],
1189
- ],
1190
- ]);
1191
- });
1192
-
1193
- test('Schema: lookup creates unique attrs for lookups in link values with arrays', () => {
1194
- const schema = i.schema({
1195
- entities: {
1196
- posts: i.entity({
1197
- slug: i.string().unique().indexed(),
1198
- }),
1199
- users: i.entity({}),
1200
- },
1201
- links: {
1202
- postUsers: {
1203
- forward: {
1204
- on: 'users',
1205
- has: 'many',
1206
- label: 'authoredPosts',
1207
- },
1208
- reverse: {
1209
- on: 'posts',
1210
- has: 'one',
1211
- label: 'author',
1212
- },
1213
- },
1214
- },
1215
- });
1216
-
1217
- const uid = uuid();
1218
- const ops = instatx.tx.users[uid].update({}).link({
1219
- authoredPosts: [
1220
- instatx.lookup('slug', 'life-is-good'),
1221
- instatx.lookup('slug', 'check-this-out'),
1222
- ],
1223
- });
1224
-
1225
- const result = instaml.transform(
1226
- { attrsStore: new AttrsStoreClass({}, null), schema },
1227
- ops,
1228
- );
1229
-
1230
- const expected = [
1231
- [
1232
- 'add-attr',
1233
- {
1234
- id: expect.any(String),
1235
- 'forward-identity': [expect.any(String), 'users', 'authoredPosts'],
1236
- 'reverse-identity': [expect.any(String), 'posts', 'author'],
1237
- 'value-type': 'ref',
1238
- cardinality: 'one',
1239
- 'unique?': true,
1240
- 'index?': true,
1241
- isUnsynced: true,
1242
- },
1243
- ],
1244
- [
1245
- 'add-attr',
1246
- {
1247
- id: expect.any(String),
1248
- 'forward-identity': [expect.any(String), 'posts', 'slug'],
1249
- 'value-type': 'blob',
1250
- cardinality: 'one',
1251
- 'unique?': true,
1252
- 'index?': true,
1253
- 'checked-data-type': 'string',
1254
- isUnsynced: true,
1255
- },
1256
- ],
1257
- [
1258
- 'add-attr',
1259
- {
1260
- id: expect.any(String),
1261
- 'forward-identity': [expect.any(String), 'users', 'id'],
1262
- 'value-type': 'blob',
1263
- cardinality: 'one',
1264
- 'unique?': true,
1265
- 'index?': false,
1266
- isUnsynced: true,
1267
- },
1268
- ],
1269
- ['add-triple', uid, expect.any(String), uid],
1270
- [
1271
- 'add-triple',
1272
- uid,
1273
- expect.any(String),
1274
- [expect.any(String), 'life-is-good'],
1275
- ],
1276
- [
1277
- 'add-triple',
1278
- uid,
1279
- expect.any(String),
1280
- [expect.any(String), 'check-this-out'],
1281
- ],
1282
- ];
1283
-
1284
- expect(result).toHaveLength(expected.length);
1285
- for (const item of expected) {
1286
- expect(result).toContainEqual(item);
1287
- }
1288
- });
1289
-
1290
- test('Schema: lookup creates unique ref attrs for ref lookup', () => {
1291
- const schema = i.schema({
1292
- entities: {
1293
- users: i.entity({}),
1294
- user_prefs: i.entity({}),
1295
- },
1296
- links: {
1297
- user_user_prefs: {
1298
- forward: {
1299
- on: 'user_prefs',
1300
- has: 'one',
1301
- label: 'user',
1302
- },
1303
- reverse: {
1304
- on: 'users',
1305
- has: 'one',
1306
- label: 'user_pref',
1307
- },
1308
- },
1309
- },
1310
- });
1311
-
1312
- const uid = uuid();
1313
- const ops = [
1314
- instatx.tx.users[uid].update({}),
1315
- instatx.tx.user_prefs[instatx.lookup('user.id', uid)].update({}),
1316
- ];
1317
-
1318
- const lookup = [
1319
- // The attr is going to be created, so we don't know its value yet
1320
- expect.any(String),
1321
- uid,
1322
- ];
1323
-
1324
- const result = instaml.transform(
1325
- { attrsStore: new AttrsStoreClass({}, null), schema },
1326
- ops,
1327
- );
1328
- const expected = [
1329
- [
1330
- 'add-attr',
1331
- {
1332
- id: expect.any(String),
1333
- 'forward-identity': [expect.any(String), 'users', 'id'],
1334
- 'value-type': 'blob',
1335
- cardinality: 'one',
1336
- 'unique?': true,
1337
- 'index?': false,
1338
- isUnsynced: true,
1339
- },
1340
- ],
1341
- [
1342
- 'add-attr',
1343
- {
1344
- id: expect.any(String),
1345
- 'forward-identity': [expect.any(String), 'user_prefs', 'id'],
1346
- 'value-type': 'blob',
1347
- cardinality: 'one',
1348
- 'unique?': true,
1349
- 'index?': false,
1350
- isUnsynced: true,
1351
- },
1352
- ],
1353
- [
1354
- 'add-attr',
1355
- {
1356
- id: expect.any(String),
1357
- 'forward-identity': [expect.any(String), 'user_prefs', 'user'],
1358
- 'reverse-identity': [expect.any(String), 'users', 'user_pref'],
1359
- 'value-type': 'ref',
1360
- cardinality: 'one',
1361
- 'unique?': true,
1362
- 'index?': true,
1363
- isUnsynced: true,
1364
- },
1365
- ],
1366
- ['add-triple', uid, expect.any(String), uid],
1367
- ['add-triple', lookup, expect.any(String), lookup],
1368
- ];
1369
-
1370
- expect(result).toHaveLength(expected.length);
1371
- for (const item of expected) {
1372
- expect(result).toContainEqual(item);
1373
- }
1374
- });
1375
-
1376
- test('Schema: lookup creates unique ref attrs for ref lookup in link value', () => {
1377
- const schema = i.schema({
1378
- entities: {
1379
- users: i.entity({}),
1380
- user_prefs: i.entity({}),
1381
- },
1382
- links: {
1383
- user_user_prefs: {
1384
- forward: {
1385
- on: 'users',
1386
- has: 'one',
1387
- label: 'user_pref',
1388
- },
1389
- reverse: {
1390
- on: 'user_prefs',
1391
- has: 'one',
1392
- label: 'user',
1393
- },
1394
- },
1395
- },
1396
- });
1397
- const uid = uuid();
1398
- const ops = [
1399
- instatx.tx.users[uid]
1400
- .update({})
1401
- .link({ user_pref: instatx.lookup('user.id', uid) }),
1402
- ];
1403
-
1404
- const lookup = [
1405
- // The attr is going to be created, so we don't know its value yet
1406
- expect.any(String),
1407
- uid,
1408
- ];
1409
-
1410
- const result = instaml.transform(
1411
- { attrsStore: new AttrsStoreClass({}, null), schema },
1412
- ops,
1413
- );
1414
-
1415
- const expected = [
1416
- [
1417
- 'add-attr',
1418
- {
1419
- id: expect.any(String),
1420
- 'forward-identity': [expect.any(String), 'users', 'user_pref'],
1421
- 'reverse-identity': [expect.any(String), 'user_prefs', 'user'],
1422
- 'value-type': 'ref',
1423
- cardinality: 'one',
1424
- 'unique?': true,
1425
- 'index?': true,
1426
- isUnsynced: true,
1427
- },
1428
- ],
1429
- [
1430
- 'add-attr',
1431
- {
1432
- id: expect.any(String),
1433
- 'forward-identity': [expect.any(String), 'users', 'id'],
1434
- 'value-type': 'blob',
1435
- cardinality: 'one',
1436
- 'unique?': true,
1437
- 'index?': false,
1438
- isUnsynced: true,
1439
- },
1440
- ],
1441
- ['add-triple', uid, expect.any(String), uid],
1442
- ['add-triple', uid, expect.any(String), lookup],
1443
- ];
1444
-
1445
- expect(result).toHaveLength(expected.length);
1446
- for (const item of expected) {
1447
- expect(result).toContainEqual(item);
1448
- }
1449
- });
1450
-
1451
- test('Schema: populates checked-data-type', () => {
1452
- const schema = i.schema({
1453
- entities: {
1454
- comments: i.entity({
1455
- s: i.string(),
1456
- n: i.number(),
1457
- d: i.date(),
1458
- b: i.boolean(),
1459
- a: i.any(),
1460
- j: i.json(),
1461
- }),
1462
- },
1463
- });
1464
-
1465
- const commentId = uuid();
1466
- const ops = instatx.tx.comments[commentId].update({
1467
- s: 'str',
1468
- n: 'num',
1469
- d: 'date',
1470
- b: 'bool',
1471
- a: 'any',
1472
- j: 'json',
1473
- });
1474
-
1475
- const result = instaml.transform(
1476
- {
1477
- attrsStore: zenecaAttrsStore,
1478
- schema: schema,
1479
- },
1480
- ops,
1481
- );
1482
-
1483
- const expected = [
1484
- [
1485
- 'add-attr',
1486
- {
1487
- id: expect.any(String),
1488
- 'forward-identity': [expect.any(String), 'comments', 's'],
1489
- 'value-type': 'blob',
1490
- cardinality: 'one',
1491
- 'unique?': false,
1492
- 'index?': false,
1493
- isUnsynced: true,
1494
- 'checked-data-type': 'string',
1495
- },
1496
- ],
1497
- [
1498
- 'add-attr',
1499
- {
1500
- id: expect.any(String),
1501
- 'forward-identity': [expect.any(String), 'comments', 'n'],
1502
- 'value-type': 'blob',
1503
- cardinality: 'one',
1504
- 'unique?': false,
1505
- 'index?': false,
1506
- isUnsynced: true,
1507
- 'checked-data-type': 'number',
1508
- },
1509
- ],
1510
- [
1511
- 'add-attr',
1512
- {
1513
- id: expect.any(String),
1514
- 'forward-identity': [expect.any(String), 'comments', 'd'],
1515
- 'value-type': 'blob',
1516
- cardinality: 'one',
1517
- 'unique?': false,
1518
- 'index?': false,
1519
- isUnsynced: true,
1520
- 'checked-data-type': 'date',
1521
- },
1522
- ],
1523
- [
1524
- 'add-attr',
1525
- {
1526
- id: expect.any(String),
1527
- 'forward-identity': [expect.any(String), 'comments', 'b'],
1528
- 'value-type': 'blob',
1529
- cardinality: 'one',
1530
- 'unique?': false,
1531
- 'index?': false,
1532
- isUnsynced: true,
1533
- 'checked-data-type': 'boolean',
1534
- },
1535
- ],
1536
- [
1537
- 'add-attr',
1538
- {
1539
- id: expect.any(String),
1540
- 'forward-identity': [expect.any(String), 'comments', 'a'],
1541
- 'value-type': 'blob',
1542
- cardinality: 'one',
1543
- 'unique?': false,
1544
- 'index?': false,
1545
- isUnsynced: true,
1546
- },
1547
- ],
1548
- [
1549
- 'add-attr',
1550
- {
1551
- id: expect.any(String),
1552
- 'forward-identity': [expect.any(String), 'comments', 'j'],
1553
- 'value-type': 'blob',
1554
- cardinality: 'one',
1555
- 'unique?': false,
1556
- 'index?': false,
1557
- isUnsynced: true,
1558
- },
1559
- ],
1560
- [
1561
- 'add-attr',
1562
- {
1563
- id: expect.any(String),
1564
- 'forward-identity': [expect.any(String), 'comments', 'id'],
1565
- 'value-type': 'blob',
1566
- cardinality: 'one',
1567
- 'unique?': true,
1568
- 'index?': false,
1569
- isUnsynced: true,
1570
- },
1571
- ],
1572
- ['add-triple', commentId, expect.any(String), commentId],
1573
- ['add-triple', commentId, expect.any(String), 'str'],
1574
- ['add-triple', commentId, expect.any(String), 'num'],
1575
- ['add-triple', commentId, expect.any(String), 'date'],
1576
- ['add-triple', commentId, expect.any(String), 'bool'],
1577
- ['add-triple', commentId, expect.any(String), 'any'],
1578
- ['add-triple', commentId, expect.any(String), 'json'],
1579
- ];
1580
-
1581
- expect(result).toHaveLength(expected.length);
1582
- for (const item of expected) {
1583
- expect(result).toContainEqual(item);
1584
- }
1585
- });
1586
-
1587
- test('instatx should not be too permissive', () => {
1588
- const ops = instatx.tx.books[uuid()].update({
1589
- title: 'New Title',
1590
- // @ts-expect-error: testing invalid states
1591
- }).this_is_an_unknown_op;
1592
- expect(ops).toBeUndefined();
1593
- });