@astrogate/sdk 0.0.0-stage → 0.1.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 (440) hide show
  1. package/README.md +6 -2
  2. package/THIRD_PARTY_NOTICES.md +17 -0
  3. package/dist/browser.d.ts +85 -0
  4. package/dist/browser.js +16 -0
  5. package/dist/database-binding.d.ts +7 -0
  6. package/dist/database-binding.js +11 -0
  7. package/dist/hosted-session.d.ts +1 -0
  8. package/dist/hosted-session.js +11 -0
  9. package/dist/http.d.ts +24 -0
  10. package/dist/http.js +92 -0
  11. package/dist/inventory.d.ts +7 -0
  12. package/dist/inventory.js +18 -0
  13. package/dist/management-read.d.ts +17 -0
  14. package/dist/management-read.js +104 -0
  15. package/dist/management.d.ts +347 -0
  16. package/dist/management.js +137 -0
  17. package/dist/operator.d.ts +136 -0
  18. package/dist/operator.js +53 -0
  19. package/dist/react.d.ts +16 -0
  20. package/dist/react.js +10 -0
  21. package/dist/server.d.ts +27 -0
  22. package/dist/server.js +30 -0
  23. package/dist/services.d.ts +7 -0
  24. package/dist/services.js +53 -0
  25. package/dist/storage.d.ts +68 -0
  26. package/dist/storage.js +30 -0
  27. package/dist/tasks.d.ts +42 -0
  28. package/dist/tasks.js +24 -0
  29. package/dist/wire.gen.d.ts +7107 -0
  30. package/dist/wire.gen.js +5 -0
  31. package/native-provenance.json +15 -0
  32. package/node_modules/@instantdb/admin/LICENSE +202 -0
  33. package/node_modules/@instantdb/admin/dist/esm/index.d.ts +607 -0
  34. package/node_modules/@instantdb/admin/dist/esm/index.js +1036 -0
  35. package/node_modules/@instantdb/admin/dist/esm/polyfill.d.ts +16 -0
  36. package/node_modules/@instantdb/admin/dist/esm/polyfill.js +21 -0
  37. package/node_modules/@instantdb/admin/dist/esm/subscribe.d.ts +38 -0
  38. package/node_modules/@instantdb/admin/dist/esm/subscribe.js +301 -0
  39. package/node_modules/@instantdb/admin/dist/esm/version.d.ts +2 -0
  40. package/node_modules/@instantdb/admin/dist/esm/version.js +2 -0
  41. package/node_modules/@instantdb/admin/package.json +23 -0
  42. package/node_modules/@instantdb/core/LICENSE +202 -0
  43. package/node_modules/@instantdb/core/dist/esm/Connection.d.ts +92 -0
  44. package/node_modules/@instantdb/core/dist/esm/Connection.js +188 -0
  45. package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.d.ts +10 -0
  46. package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.js +25 -0
  47. package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.d.ts +17 -0
  48. package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.js +309 -0
  49. package/node_modules/@instantdb/core/dist/esm/InstantError.d.ts +6 -0
  50. package/node_modules/@instantdb/core/dist/esm/InstantError.js +23 -0
  51. package/node_modules/@instantdb/core/dist/esm/Reactor.d.ts +430 -0
  52. package/node_modules/@instantdb/core/dist/esm/Reactor.js +2369 -0
  53. package/node_modules/@instantdb/core/dist/esm/StorageAPI.d.ts +39 -0
  54. package/node_modules/@instantdb/core/dist/esm/StorageAPI.js +65 -0
  55. package/node_modules/@instantdb/core/dist/esm/Stream.d.ts +120 -0
  56. package/node_modules/@instantdb/core/dist/esm/Stream.js +811 -0
  57. package/node_modules/@instantdb/core/dist/esm/SyncTable.d.ts +144 -0
  58. package/node_modules/@instantdb/core/dist/esm/SyncTable.js +523 -0
  59. package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.d.ts +4 -0
  60. package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.js +19 -0
  61. package/node_modules/@instantdb/core/dist/esm/attrTypes.d.ts +25 -0
  62. package/node_modules/@instantdb/core/dist/esm/attrTypes.js +1 -0
  63. package/node_modules/@instantdb/core/dist/esm/authAPI.d.ts +64 -0
  64. package/node_modules/@instantdb/core/dist/esm/authAPI.js +103 -0
  65. package/node_modules/@instantdb/core/dist/esm/clientTypes.d.ts +40 -0
  66. package/node_modules/@instantdb/core/dist/esm/clientTypes.js +1 -0
  67. package/node_modules/@instantdb/core/dist/esm/coreTypes.d.ts +33 -0
  68. package/node_modules/@instantdb/core/dist/esm/coreTypes.js +1 -0
  69. package/node_modules/@instantdb/core/dist/esm/createRouteHandler.d.ts +7 -0
  70. package/node_modules/@instantdb/core/dist/esm/createRouteHandler.js +51 -0
  71. package/node_modules/@instantdb/core/dist/esm/datalog.d.ts +7 -0
  72. package/node_modules/@instantdb/core/dist/esm/datalog.js +99 -0
  73. package/node_modules/@instantdb/core/dist/esm/devtool.d.ts +3 -0
  74. package/node_modules/@instantdb/core/dist/esm/devtool.js +144 -0
  75. package/node_modules/@instantdb/core/dist/esm/framework.d.ts +80 -0
  76. package/node_modules/@instantdb/core/dist/esm/framework.js +243 -0
  77. package/node_modules/@instantdb/core/dist/esm/helperTypes.d.ts +75 -0
  78. package/node_modules/@instantdb/core/dist/esm/helperTypes.js +1 -0
  79. package/node_modules/@instantdb/core/dist/esm/index.d.ts +597 -0
  80. package/node_modules/@instantdb/core/dist/esm/index.js +649 -0
  81. package/node_modules/@instantdb/core/dist/esm/infiniteQuery.d.ts +25 -0
  82. package/node_modules/@instantdb/core/dist/esm/infiniteQuery.js +430 -0
  83. package/node_modules/@instantdb/core/dist/esm/instaml.d.ts +17 -0
  84. package/node_modules/@instantdb/core/dist/esm/instaml.js +576 -0
  85. package/node_modules/@instantdb/core/dist/esm/instaql.d.ts +12 -0
  86. package/node_modules/@instantdb/core/dist/esm/instaql.js +632 -0
  87. package/node_modules/@instantdb/core/dist/esm/instatx.d.ts +127 -0
  88. package/node_modules/@instantdb/core/dist/esm/instatx.js +93 -0
  89. package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.d.ts +7 -0
  90. package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.js +24 -0
  91. package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.d.ts +2 -0
  92. package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.js +142 -0
  93. package/node_modules/@instantdb/core/dist/esm/presence.d.ts +50 -0
  94. package/node_modules/@instantdb/core/dist/esm/presence.js +50 -0
  95. package/node_modules/@instantdb/core/dist/esm/presenceTypes.d.ts +9 -0
  96. package/node_modules/@instantdb/core/dist/esm/presenceTypes.js +3 -0
  97. package/node_modules/@instantdb/core/dist/esm/queryTypes.d.ts +271 -0
  98. package/node_modules/@instantdb/core/dist/esm/queryTypes.js +3 -0
  99. package/node_modules/@instantdb/core/dist/esm/queryValidation.d.ts +5 -0
  100. package/node_modules/@instantdb/core/dist/esm/queryValidation.js +287 -0
  101. package/node_modules/@instantdb/core/dist/esm/reactorTypes.d.ts +29 -0
  102. package/node_modules/@instantdb/core/dist/esm/reactorTypes.js +1 -0
  103. package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.d.ts +19 -0
  104. package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.js +1 -0
  105. package/node_modules/@instantdb/core/dist/esm/rulesTypes.d.ts +85 -0
  106. package/node_modules/@instantdb/core/dist/esm/rulesTypes.js +1 -0
  107. package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.d.ts +18 -0
  108. package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.js +152 -0
  109. package/node_modules/@instantdb/core/dist/esm/schema.d.ts +72 -0
  110. package/node_modules/@instantdb/core/dist/esm/schema.js +128 -0
  111. package/node_modules/@instantdb/core/dist/esm/schemaTypes.d.ts +244 -0
  112. package/node_modules/@instantdb/core/dist/esm/schemaTypes.js +106 -0
  113. package/node_modules/@instantdb/core/dist/esm/store.d.ts +89 -0
  114. package/node_modules/@instantdb/core/dist/esm/store.js +722 -0
  115. package/node_modules/@instantdb/core/dist/esm/transactionValidation.d.ts +7 -0
  116. package/node_modules/@instantdb/core/dist/esm/transactionValidation.js +130 -0
  117. package/node_modules/@instantdb/core/dist/esm/utils/Deferred.d.ts +8 -0
  118. package/node_modules/@instantdb/core/dist/esm/utils/Deferred.js +17 -0
  119. package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.d.ts +80 -0
  120. package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.js +448 -0
  121. package/node_modules/@instantdb/core/dist/esm/utils/dates.d.ts +1 -0
  122. package/node_modules/@instantdb/core/dist/esm/utils/dates.js +211 -0
  123. package/node_modules/@instantdb/core/dist/esm/utils/error.d.ts +2 -0
  124. package/node_modules/@instantdb/core/dist/esm/utils/error.js +8 -0
  125. package/node_modules/@instantdb/core/dist/esm/utils/fetch.d.ts +125 -0
  126. package/node_modules/@instantdb/core/dist/esm/utils/fetch.js +31 -0
  127. package/node_modules/@instantdb/core/dist/esm/utils/flags.d.ts +4 -0
  128. package/node_modules/@instantdb/core/dist/esm/utils/flags.js +10 -0
  129. package/node_modules/@instantdb/core/dist/esm/utils/id.d.ts +3 -0
  130. package/node_modules/@instantdb/core/dist/esm/utils/id.js +25 -0
  131. package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.d.ts +7 -0
  132. package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.js +17 -0
  133. package/node_modules/@instantdb/core/dist/esm/utils/log.d.ts +6 -0
  134. package/node_modules/@instantdb/core/dist/esm/utils/log.js +13 -0
  135. package/node_modules/@instantdb/core/dist/esm/utils/object.d.ts +16 -0
  136. package/node_modules/@instantdb/core/dist/esm/utils/object.js +143 -0
  137. package/node_modules/@instantdb/core/dist/esm/utils/pgtime.d.ts +197 -0
  138. package/node_modules/@instantdb/core/dist/esm/utils/pgtime.js +197 -0
  139. package/node_modules/@instantdb/core/dist/esm/utils/pick.d.ts +1 -0
  140. package/node_modules/@instantdb/core/dist/esm/utils/pick.js +9 -0
  141. package/node_modules/@instantdb/core/dist/esm/utils/strings.d.ts +1 -0
  142. package/node_modules/@instantdb/core/dist/esm/utils/strings.js +15 -0
  143. package/node_modules/@instantdb/core/dist/esm/utils/weakHash.d.ts +15 -0
  144. package/node_modules/@instantdb/core/dist/esm/utils/weakHash.js +71 -0
  145. package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.d.ts +7 -0
  146. package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.js +72 -0
  147. package/node_modules/@instantdb/core/dist/esm/version.d.ts +2 -0
  148. package/node_modules/@instantdb/core/dist/esm/version.js +2 -0
  149. package/node_modules/@instantdb/core/dist/esm/warningToggle.d.ts +2 -0
  150. package/node_modules/@instantdb/core/dist/esm/warningToggle.js +4 -0
  151. package/node_modules/@instantdb/core/package.json +20 -0
  152. package/node_modules/@instantdb/eventsource/LICENSE +22 -0
  153. package/node_modules/@instantdb/eventsource/README.md +226 -0
  154. package/node_modules/@instantdb/eventsource/dist/index.cjs +279 -0
  155. package/node_modules/@instantdb/eventsource/dist/index.cjs.map +1 -0
  156. package/node_modules/@instantdb/eventsource/dist/index.d.cts +346 -0
  157. package/node_modules/@instantdb/eventsource/dist/index.d.ts +346 -0
  158. package/node_modules/@instantdb/eventsource/dist/index.js +279 -0
  159. package/node_modules/@instantdb/eventsource/dist/index.js.map +1 -0
  160. package/node_modules/@instantdb/eventsource/package.json +128 -0
  161. package/node_modules/@instantdb/eventsource/src/EventSource.ts +614 -0
  162. package/node_modules/@instantdb/eventsource/src/errors.ts +141 -0
  163. package/node_modules/@instantdb/eventsource/src/index.ts +3 -0
  164. package/node_modules/@instantdb/eventsource/src/types.ts +164 -0
  165. package/node_modules/@instantdb/react/LICENSE +202 -0
  166. package/node_modules/@instantdb/react/dist/esm/Cursors.d.ts +18 -0
  167. package/node_modules/@instantdb/react/dist/esm/Cursors.js +103 -0
  168. package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.d.ts +5 -0
  169. package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.js +5 -0
  170. package/node_modules/@instantdb/react/dist/esm/index.d.ts +6 -0
  171. package/node_modules/@instantdb/react/dist/esm/index.js +22 -0
  172. package/node_modules/@instantdb/react/dist/esm/init.d.ts +40 -0
  173. package/node_modules/@instantdb/react/dist/esm/init.js +49 -0
  174. package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.d.ts +65 -0
  175. package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.js +96 -0
  176. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.d.ts +11 -0
  177. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.js +31 -0
  178. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +24 -0
  179. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.js +162 -0
  180. package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.d.ts +9 -0
  181. package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.js +16 -0
  182. package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.d.ts +2 -0
  183. package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.js +20 -0
  184. package/node_modules/@instantdb/react/dist/esm/next-ssr/index.d.ts +29 -0
  185. package/node_modules/@instantdb/react/dist/esm/next-ssr/index.js +34 -0
  186. package/node_modules/@instantdb/react/dist/esm/version.d.ts +2 -0
  187. package/node_modules/@instantdb/react/dist/esm/version.js +2 -0
  188. package/node_modules/@instantdb/react/package.json +24 -0
  189. package/node_modules/@instantdb/react-common/LICENSE +202 -0
  190. package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.d.ts +282 -0
  191. package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.js +386 -0
  192. package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.d.ts +182 -0
  193. package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.js +280 -0
  194. package/node_modules/@instantdb/react-common/dist/esm/index.d.ts +4 -0
  195. package/node_modules/@instantdb/react-common/dist/esm/index.js +3 -0
  196. package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.d.ts +27 -0
  197. package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.js +53 -0
  198. package/node_modules/@instantdb/react-common/dist/esm/useQuery.d.ts +6 -0
  199. package/node_modules/@instantdb/react-common/dist/esm/useQuery.js +75 -0
  200. package/node_modules/@instantdb/react-common/dist/esm/useTimeout.d.ts +4 -0
  201. package/node_modules/@instantdb/react-common/dist/esm/useTimeout.js +17 -0
  202. package/node_modules/@instantdb/react-common/dist/esm/version.d.ts +2 -0
  203. package/node_modules/@instantdb/react-common/dist/esm/version.js +2 -0
  204. package/node_modules/@instantdb/react-common/package.json +22 -0
  205. package/node_modules/@instantdb/version/LICENSE +202 -0
  206. package/node_modules/@instantdb/version/dist/esm/index.d.ts +2 -0
  207. package/node_modules/@instantdb/version/dist/esm/index.js +2 -0
  208. package/node_modules/@instantdb/version/dist/esm/version.d.ts +2 -0
  209. package/node_modules/@instantdb/version/dist/esm/version.js +5 -0
  210. package/node_modules/@instantdb/version/package.json +16 -0
  211. package/node_modules/@instantdb/webhooks/LICENSE +202 -0
  212. package/node_modules/@instantdb/webhooks/dist/esm/index.d.ts +587 -0
  213. package/node_modules/@instantdb/webhooks/dist/esm/index.js +748 -0
  214. package/node_modules/@instantdb/webhooks/package.json +18 -0
  215. package/node_modules/cookie/LICENSE +24 -0
  216. package/node_modules/cookie/README.md +295 -0
  217. package/node_modules/cookie/dist/index.d.ts +143 -0
  218. package/node_modules/cookie/dist/index.js +355 -0
  219. package/node_modules/cookie/dist/index.js.map +1 -0
  220. package/node_modules/cookie/package.json +57 -0
  221. package/node_modules/eventsource/LICENSE +22 -0
  222. package/node_modules/eventsource/README.md +252 -0
  223. package/node_modules/eventsource/dist/EventSource.d.ts +128 -0
  224. package/node_modules/eventsource/dist/EventSource.d.ts.map +1 -0
  225. package/node_modules/eventsource/dist/EventSource.js +556 -0
  226. package/node_modules/eventsource/dist/EventSource.js.map +1 -0
  227. package/node_modules/eventsource/dist/errors.d.ts +53 -0
  228. package/node_modules/eventsource/dist/errors.d.ts.map +1 -0
  229. package/node_modules/eventsource/dist/errors.js +120 -0
  230. package/node_modules/eventsource/dist/errors.js.map +1 -0
  231. package/node_modules/eventsource/dist/index.d.ts +4 -0
  232. package/node_modules/eventsource/dist/index.d.ts.map +1 -0
  233. package/node_modules/eventsource/dist/index.js +3 -0
  234. package/node_modules/eventsource/dist/index.js.map +1 -0
  235. package/node_modules/eventsource/dist/types.d.ts +156 -0
  236. package/node_modules/eventsource/dist/types.d.ts.map +1 -0
  237. package/node_modules/eventsource/dist/types.js +2 -0
  238. package/node_modules/eventsource/dist/types.js.map +1 -0
  239. package/node_modules/eventsource/node_modules/eventsource-parser/LICENSE +21 -0
  240. package/node_modules/eventsource/node_modules/eventsource-parser/README.md +177 -0
  241. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts +35 -0
  242. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts.map +1 -0
  243. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js +16 -0
  244. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js.map +1 -0
  245. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts +4 -0
  246. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts.map +1 -0
  247. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js +3 -0
  248. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js.map +1 -0
  249. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts +12 -0
  250. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts.map +1 -0
  251. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js +509 -0
  252. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js.map +1 -0
  253. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts +76 -0
  254. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts.map +1 -0
  255. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js +59 -0
  256. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  257. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts +130 -0
  258. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts.map +1 -0
  259. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js +1 -0
  260. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js.map +1 -0
  261. package/node_modules/eventsource/node_modules/eventsource-parser/package.json +96 -0
  262. package/node_modules/eventsource/node_modules/eventsource-parser/src/errors.ts +44 -0
  263. package/node_modules/eventsource/node_modules/eventsource-parser/src/index.ts +3 -0
  264. package/node_modules/eventsource/node_modules/eventsource-parser/src/parse.ts +576 -0
  265. package/node_modules/eventsource/node_modules/eventsource-parser/src/stream.ts +118 -0
  266. package/node_modules/eventsource/node_modules/eventsource-parser/src/types.ts +138 -0
  267. package/node_modules/eventsource/package.json +103 -0
  268. package/node_modules/eventsource/src/EventSource.ts +844 -0
  269. package/node_modules/eventsource/src/errors.ts +141 -0
  270. package/node_modules/eventsource/src/index.ts +3 -0
  271. package/node_modules/eventsource/src/types.ts +166 -0
  272. package/node_modules/eventsource-parser/LICENSE +21 -0
  273. package/node_modules/eventsource-parser/README.md +157 -0
  274. package/node_modules/eventsource-parser/dist/index.cjs +177 -0
  275. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -0
  276. package/node_modules/eventsource-parser/dist/index.d.cts +169 -0
  277. package/node_modules/eventsource-parser/dist/index.d.ts +169 -0
  278. package/node_modules/eventsource-parser/dist/index.js +177 -0
  279. package/node_modules/eventsource-parser/dist/index.js.map +1 -0
  280. package/node_modules/eventsource-parser/dist/stream.cjs +29 -0
  281. package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -0
  282. package/node_modules/eventsource-parser/dist/stream.d.cts +134 -0
  283. package/node_modules/eventsource-parser/dist/stream.d.ts +134 -0
  284. package/node_modules/eventsource-parser/dist/stream.js +30 -0
  285. package/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  286. package/node_modules/eventsource-parser/package.json +92 -0
  287. package/node_modules/eventsource-parser/src/errors.ts +44 -0
  288. package/node_modules/eventsource-parser/src/index.ts +8 -0
  289. package/node_modules/eventsource-parser/src/parse.ts +439 -0
  290. package/node_modules/eventsource-parser/src/stream.ts +107 -0
  291. package/node_modules/eventsource-parser/src/types.ts +122 -0
  292. package/node_modules/eventsource-parser/stream.js +2 -0
  293. package/node_modules/mutative/LICENSE +21 -0
  294. package/node_modules/mutative/README.md +870 -0
  295. package/node_modules/mutative/dist/apply.d.ts +31 -0
  296. package/node_modules/mutative/dist/array.d.ts +45 -0
  297. package/node_modules/mutative/dist/constant.d.ts +8 -0
  298. package/node_modules/mutative/dist/create.d.ts +46 -0
  299. package/node_modules/mutative/dist/current.d.ts +23 -0
  300. package/node_modules/mutative/dist/draft.d.ts +3 -0
  301. package/node_modules/mutative/dist/draftify.d.ts +2 -0
  302. package/node_modules/mutative/dist/error.d.ts +54 -0
  303. package/node_modules/mutative/dist/index.d.mts +1 -0
  304. package/node_modules/mutative/dist/index.d.ts +12 -0
  305. package/node_modules/mutative/dist/index.js +8 -0
  306. package/node_modules/mutative/dist/index.mjs +3 -0
  307. package/node_modules/mutative/dist/interface.d.ts +200 -0
  308. package/node_modules/mutative/dist/internal.d.ts +4 -0
  309. package/node_modules/mutative/dist/makeCreator.d.ts +54 -0
  310. package/node_modules/mutative/dist/map.d.ts +15 -0
  311. package/node_modules/mutative/dist/mutative.cjs.development.js +2126 -0
  312. package/node_modules/mutative/dist/mutative.cjs.development.js.map +1 -0
  313. package/node_modules/mutative/dist/mutative.cjs.production.min.js +2 -0
  314. package/node_modules/mutative/dist/mutative.cjs.production.min.js.map +1 -0
  315. package/node_modules/mutative/dist/mutative.esm.js +2123 -0
  316. package/node_modules/mutative/dist/mutative.esm.js.map +1 -0
  317. package/node_modules/mutative/dist/mutative.esm.mjs +2123 -0
  318. package/node_modules/mutative/dist/mutative.esm.mjs.map +1 -0
  319. package/node_modules/mutative/dist/mutative.esm.production.min.mjs +2 -0
  320. package/node_modules/mutative/dist/mutative.esm.production.min.mjs.map +1 -0
  321. package/node_modules/mutative/dist/mutative.umd.development.js +2132 -0
  322. package/node_modules/mutative/dist/mutative.umd.development.js.map +1 -0
  323. package/node_modules/mutative/dist/mutative.umd.production.min.js +2 -0
  324. package/node_modules/mutative/dist/mutative.umd.production.min.js.map +1 -0
  325. package/node_modules/mutative/dist/original.d.ts +19 -0
  326. package/node_modules/mutative/dist/patch.d.ts +2 -0
  327. package/node_modules/mutative/dist/rawReturn.d.ts +19 -0
  328. package/node_modules/mutative/dist/set.d.ts +14 -0
  329. package/node_modules/mutative/dist/unsafe.d.ts +34 -0
  330. package/node_modules/mutative/dist/utils/cast.d.ts +13 -0
  331. package/node_modules/mutative/dist/utils/copy.d.ts +5 -0
  332. package/node_modules/mutative/dist/utils/deepFreeze.d.ts +1 -0
  333. package/node_modules/mutative/dist/utils/draft.d.ts +27 -0
  334. package/node_modules/mutative/dist/utils/finalize.d.ts +13 -0
  335. package/node_modules/mutative/dist/utils/forEach.d.ts +1 -0
  336. package/node_modules/mutative/dist/utils/index.d.ts +7 -0
  337. package/node_modules/mutative/dist/utils/mark.d.ts +2 -0
  338. package/node_modules/mutative/dist/utils/marker.d.ts +5 -0
  339. package/node_modules/mutative/dist/utils/proto.d.ts +10 -0
  340. package/node_modules/mutative/package.json +142 -0
  341. package/node_modules/mutative/src/apply.ts +239 -0
  342. package/node_modules/mutative/src/array.ts +679 -0
  343. package/node_modules/mutative/src/constant.ts +17 -0
  344. package/node_modules/mutative/src/create.ts +27 -0
  345. package/node_modules/mutative/src/current.ts +206 -0
  346. package/node_modules/mutative/src/draft.ts +489 -0
  347. package/node_modules/mutative/src/draftify.ts +57 -0
  348. package/node_modules/mutative/src/error.ts +129 -0
  349. package/node_modules/mutative/src/index.ts +21 -0
  350. package/node_modules/mutative/src/interface.ts +321 -0
  351. package/node_modules/mutative/src/internal.ts +5 -0
  352. package/node_modules/mutative/src/makeCreator.ts +382 -0
  353. package/node_modules/mutative/src/map.ts +160 -0
  354. package/node_modules/mutative/src/original.ts +28 -0
  355. package/node_modules/mutative/src/patch.ts +386 -0
  356. package/node_modules/mutative/src/rawReturn.ts +41 -0
  357. package/node_modules/mutative/src/set.ts +201 -0
  358. package/node_modules/mutative/src/unsafe.ts +66 -0
  359. package/node_modules/mutative/src/utils/cast.ts +22 -0
  360. package/node_modules/mutative/src/utils/copy.ts +224 -0
  361. package/node_modules/mutative/src/utils/deepFreeze.ts +103 -0
  362. package/node_modules/mutative/src/utils/draft.ts +189 -0
  363. package/node_modules/mutative/src/utils/finalize.ts +232 -0
  364. package/node_modules/mutative/src/utils/forEach.ts +24 -0
  365. package/node_modules/mutative/src/utils/index.ts +7 -0
  366. package/node_modules/mutative/src/utils/mark.ts +11 -0
  367. package/node_modules/mutative/src/utils/marker.ts +34 -0
  368. package/node_modules/mutative/src/utils/proto.ts +38 -0
  369. package/node_modules/uuid/LICENSE.md +9 -0
  370. package/node_modules/uuid/README.md +491 -0
  371. package/node_modules/uuid/dist/index.d.ts +15 -0
  372. package/node_modules/uuid/dist/index.js +14 -0
  373. package/node_modules/uuid/dist/max.d.ts +2 -0
  374. package/node_modules/uuid/dist/max.js +1 -0
  375. package/node_modules/uuid/dist/md5.d.ts +2 -0
  376. package/node_modules/uuid/dist/md5.js +135 -0
  377. package/node_modules/uuid/dist/nil.d.ts +2 -0
  378. package/node_modules/uuid/dist/nil.js +1 -0
  379. package/node_modules/uuid/dist/parse.d.ts +3 -0
  380. package/node_modules/uuid/dist/parse.js +9 -0
  381. package/node_modules/uuid/dist/regex.d.ts +2 -0
  382. package/node_modules/uuid/dist/regex.js +1 -0
  383. package/node_modules/uuid/dist/rng.d.ts +1 -0
  384. package/node_modules/uuid/dist/rng.js +4 -0
  385. package/node_modules/uuid/dist/sha1.d.ts +2 -0
  386. package/node_modules/uuid/dist/sha1.js +70 -0
  387. package/node_modules/uuid/dist/stringify.d.ts +3 -0
  388. package/node_modules/uuid/dist/stringify.js +35 -0
  389. package/node_modules/uuid/dist/types.d.ts +22 -0
  390. package/node_modules/uuid/dist/types.js +1 -0
  391. package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
  392. package/node_modules/uuid/dist/uuid-bin.js +70 -0
  393. package/node_modules/uuid/dist/v1.d.ts +11 -0
  394. package/node_modules/uuid/dist/v1.js +87 -0
  395. package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
  396. package/node_modules/uuid/dist/v1ToV6.js +10 -0
  397. package/node_modules/uuid/dist/v3.d.ts +9 -0
  398. package/node_modules/uuid/dist/v3.js +9 -0
  399. package/node_modules/uuid/dist/v35.d.ts +7 -0
  400. package/node_modules/uuid/dist/v35.js +39 -0
  401. package/node_modules/uuid/dist/v4.d.ts +4 -0
  402. package/node_modules/uuid/dist/v4.js +29 -0
  403. package/node_modules/uuid/dist/v5.d.ts +9 -0
  404. package/node_modules/uuid/dist/v5.js +9 -0
  405. package/node_modules/uuid/dist/v6.d.ts +4 -0
  406. package/node_modules/uuid/dist/v6.js +20 -0
  407. package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
  408. package/node_modules/uuid/dist/v6ToV1.js +10 -0
  409. package/node_modules/uuid/dist/v7.d.ts +9 -0
  410. package/node_modules/uuid/dist/v7.js +68 -0
  411. package/node_modules/uuid/dist/validate.d.ts +2 -0
  412. package/node_modules/uuid/dist/validate.js +5 -0
  413. package/node_modules/uuid/dist/version.d.ts +2 -0
  414. package/node_modules/uuid/dist/version.js +8 -0
  415. package/node_modules/uuid/dist-node/bin/uuid +2 -0
  416. package/node_modules/uuid/dist-node/index.js +14 -0
  417. package/node_modules/uuid/dist-node/max.js +1 -0
  418. package/node_modules/uuid/dist-node/md5.js +11 -0
  419. package/node_modules/uuid/dist-node/nil.js +1 -0
  420. package/node_modules/uuid/dist-node/parse.js +9 -0
  421. package/node_modules/uuid/dist-node/regex.js +1 -0
  422. package/node_modules/uuid/dist-node/rng.js +4 -0
  423. package/node_modules/uuid/dist-node/sha1.js +11 -0
  424. package/node_modules/uuid/dist-node/stringify.js +35 -0
  425. package/node_modules/uuid/dist-node/types.js +1 -0
  426. package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
  427. package/node_modules/uuid/dist-node/v1.js +87 -0
  428. package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
  429. package/node_modules/uuid/dist-node/v3.js +9 -0
  430. package/node_modules/uuid/dist-node/v35.js +39 -0
  431. package/node_modules/uuid/dist-node/v4.js +29 -0
  432. package/node_modules/uuid/dist-node/v5.js +9 -0
  433. package/node_modules/uuid/dist-node/v6.js +20 -0
  434. package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
  435. package/node_modules/uuid/dist-node/v7.js +68 -0
  436. package/node_modules/uuid/dist-node/validate.js +5 -0
  437. package/node_modules/uuid/dist-node/version.js +8 -0
  438. package/node_modules/uuid/package.json +115 -0
  439. package/package.json +80 -4
  440. package/release.json +78 -0
@@ -0,0 +1,597 @@
1
+ import Reactor from './Reactor.js';
2
+ import { tx, txInit, lookup, getOps, type TxChunk, type TransactionChunk } from './instatx.js';
3
+ import weakHash from './utils/weakHash.js';
4
+ import id from './utils/id.ts';
5
+ import IndexedDBStorage from './IndexedDBStorage.ts';
6
+ import { coerceToDate } from './utils/dates.js';
7
+ import WindowNetworkListener from './WindowNetworkListener.js';
8
+ import { i } from './schema.js';
9
+ import version from './version.ts';
10
+ import { validateQuery, QueryValidationError } from './queryValidation.ts';
11
+ import { validateTransactions, TransactionValidationError } from './transactionValidation.ts';
12
+ import { setInstantWarningsEnabled } from './warningToggle.ts';
13
+ import { StoreInterface, type StoreInterfaceClass, type StoreInterfaceStoreName } from './utils/PersistedObject.ts';
14
+ import { createInstantRouteHandler } from './createRouteHandler.ts';
15
+ import type { InstantRouteHandlerPayloadByType, InstantRouteHandlerType, InstantRouteHandlerBody } from './routeHandlerProtocol.ts';
16
+ import { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';
17
+ import type { Logger } from './utils/log.ts';
18
+ import type { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from './presence.ts';
19
+ import type { DevtoolConfig, IDatabase, IInstantDatabase } from './coreTypes.ts';
20
+ import type { Query, QueryResponse, InstaQLResponse, PageInfoResponse, Exactly, InstantObject, InstaQLParams, InstaQLOptions, InstaQLQueryParams, InstaQLEntity, InstaQLEntitySubquery, InstaQLResult, InstaQLFields, ValidQuery, Cursor, Order, InstaQLQueryEntityResult } from './queryTypes.ts';
21
+ import type { PresencePeer } from './presenceTypes.ts';
22
+ import type { AuthState, User, AuthResult, ConnectionStatus, AppStatusState } from './clientTypes.ts';
23
+ import type { InstantQuery, InstantQueryResult, InstantSchema, InstantEntity, InstantSchemaDatabase } from './helperTypes.ts';
24
+ import type { InstantDBAttr, InstantDBAttrOnDelete, InstantDBCheckedDataType, InstantDBIdent, InstantDBInferredType } from './attrTypes.ts';
25
+ import type { AttrsDefs, CardinalityKind, DataAttrDef, EntitiesDef, EntitiesWithLinks, EntityDef, RoomsDef, InstantSchemaDef, InstantGraph, LinkAttrDef, LinkDef, LinksDef, PresenceOf, ResolveAttrs, RoomsOf, TopicsOf, TopicOf, ValueTypes, InstantUnknownSchema, InstantUnknownSchemaDef, BackwardsCompatibleSchema, UpdateParams, LinkParams, CreateParams, RuleParams } from './schemaTypes.ts';
26
+ import type { InstantRules } from './rulesTypes.ts';
27
+ import type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';
28
+ import { FrameworkClient, type FrameworkConfig } from './framework.ts';
29
+ import type { CheckMagicCodeParams, CheckMagicCodeResponse, ExchangeCodeForTokenParams, SendMagicCodeParams, SendMagicCodeResponse, SignInAsGuestParams, SignInWithIdTokenParams, VerifyMagicCodeParams, VerifyResponse } from './authAPI.ts';
30
+ import { InstantAPIError, type InstantIssue } from './utils/fetch.js';
31
+ import { InstantError } from './InstantError.ts';
32
+ import { SSEConnection, EventSourceType, type EventSourceConstructor } from './Connection.ts';
33
+ import { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';
34
+ import type { SyncTableCallback, CallbackEvent as SyncTableCallbackEvent, InitialSyncBatch as SyncTableInitialSyncBatch, InitialSyncComplete as SyncTableInitialSyncComplete, SyncTransaction as SyncTableSyncTransaction, LoadFromStorage as SyncTableLoadFromStorage, SetupError as SyncTableSetupError } from './SyncTable.ts';
35
+ import { InstantStream, InstantWritableStream, InstantReadableStream, ReadableStreamCtor, WritableStreamCtor } from './Stream.ts';
36
+ import { type InfiniteQueryCallbackResponse, type InfiniteQuerySubscription, getInfiniteQueryInitialSnapshot } from './infiniteQuery.ts';
37
+ type ExactlyOne<T> = {
38
+ [K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;
39
+ }[keyof T];
40
+ export type Config = {
41
+ appId: string;
42
+ websocketURI?: string;
43
+ apiURI?: string;
44
+ devtool?: boolean | DevtoolConfig;
45
+ verbose?: boolean;
46
+ logger?: Logger;
47
+ queryCacheLimit?: number;
48
+ useDateObjects: boolean;
49
+ disableValidation?: boolean;
50
+ };
51
+ export type InstantConfig<S extends InstantSchemaDef<any, any, any>, UseDates extends boolean = false> = {
52
+ appId: string;
53
+ schema?: S;
54
+ websocketURI?: string;
55
+ firstPartyPath?: string;
56
+ apiURI?: string;
57
+ devtool?: boolean | DevtoolConfig;
58
+ verbose?: boolean;
59
+ logger?: Logger;
60
+ queryCacheLimit?: number;
61
+ useDateObjects: UseDates;
62
+ disableValidation?: boolean;
63
+ Store?: StoreInterfaceClass;
64
+ WritableStream?: WritableStreamCtor;
65
+ ReadableStream?: ReadableStreamCtor;
66
+ };
67
+ export type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {
68
+ schema: S;
69
+ };
70
+ export type TransactionResult = {
71
+ status: 'synced' | 'enqueued';
72
+ clientId: string;
73
+ };
74
+ export type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(topic: Key, data: TopicsByKey[Key]) => void;
75
+ export type SubscribeTopic<PresenceShape, TopicsByKey> = <Key extends keyof TopicsByKey>(topic: Key, onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void) => () => void;
76
+ export type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(opts: PresenceOpts<PresenceShape, Keys>) => PresenceResponse<PresenceShape, Keys> | null;
77
+ export type SubscribePresence<PresenceShape> = <Keys extends keyof PresenceShape>(opts: PresenceOpts<PresenceShape, Keys>, onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void) => () => void;
78
+ export type RoomHandle<PresenceShape, TopicsByKey> = {
79
+ leaveRoom: () => void;
80
+ publishTopic: PublishTopic<TopicsByKey>;
81
+ subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;
82
+ publishPresence: (data: Partial<PresenceShape>) => void;
83
+ getPresence: GetPresence<PresenceShape>;
84
+ subscribePresence: SubscribePresence<PresenceShape>;
85
+ };
86
+ type AuthToken = string;
87
+ type SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> = {
88
+ error: {
89
+ message: string;
90
+ traceId?: string;
91
+ };
92
+ data: undefined;
93
+ pageInfo: undefined;
94
+ } | {
95
+ error: undefined;
96
+ data: QueryResponse<Q, Schema, WithCardinalityInference>;
97
+ pageInfo: PageInfoResponse<Q>;
98
+ };
99
+ type InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> = {
100
+ error: {
101
+ message: string;
102
+ traceId?: string;
103
+ };
104
+ data: undefined;
105
+ pageInfo: undefined;
106
+ } | {
107
+ error: undefined;
108
+ data: InstaQLResponse<Schema, Q, UseDates>;
109
+ pageInfo: PageInfoResponse<Q>;
110
+ };
111
+ type LifecycleSubscriptionState<Q, Schema, WithCardinalityInference extends boolean> = SubscriptionState<Q, Schema, WithCardinalityInference> & {
112
+ isLoading: boolean;
113
+ };
114
+ type InstaQLLifecycleState<Schema, Q, UseDates extends boolean = false> = (InstaQLSubscriptionState<Schema, Q, UseDates> & {
115
+ isLoading: boolean;
116
+ }) | {
117
+ isLoading: true;
118
+ data: undefined;
119
+ pageInfo: undefined;
120
+ error: undefined;
121
+ };
122
+ type UnsubscribeFn = () => void;
123
+ type SignoutOpts = {
124
+ invalidateToken?: boolean;
125
+ };
126
+ /**
127
+ * Functions to log users in and out.
128
+ *
129
+ * @see https://instantdb.com/docs/auth
130
+ */
131
+ declare class Auth {
132
+ private db;
133
+ constructor(db: Reactor);
134
+ /**
135
+ * Sends a magic code to the user's email address.
136
+ *
137
+ * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the
138
+ * user verify.
139
+ *
140
+ * @see https://instantdb.com/docs/auth
141
+ * @example
142
+ * db.auth.sendMagicCode({email: "example@gmail.com"})
143
+ * .catch((err) => console.error(err.body?.message))
144
+ */
145
+ sendMagicCode: (params: SendMagicCodeParams) => Promise<SendMagicCodeResponse>;
146
+ /**
147
+ * Verify a magic code that was sent to the user's email address.
148
+ *
149
+ * @see https://instantdb.com/docs/auth
150
+ *
151
+ * @example
152
+ * db.auth.signInWithMagicCode({email: "example@gmail.com", code: "123456"})
153
+ * .catch((err) => console.error(err.body?.message))
154
+ */
155
+ signInWithMagicCode: (params: CheckMagicCodeParams) => Promise<CheckMagicCodeResponse>;
156
+ /**
157
+ * Sign in a user with a refresh token
158
+ *
159
+ * @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token
160
+ *
161
+ * @example
162
+ * // Get the token from your backend
163
+ * const token = await fetch('/signin', ...);
164
+ * //Sign in
165
+ * db.auth.signInWithToken(token);
166
+ */
167
+ signInWithToken: (token: AuthToken) => Promise<VerifyResponse>;
168
+ /**
169
+ * Sign in as guest, creating a new user without email
170
+ *
171
+ * @see https://instantdb.com/docs/auth
172
+ *
173
+ * @example
174
+ * db.auth.signInAsGuest();
175
+ */
176
+ signInAsGuest: (params?: SignInAsGuestParams) => Promise<VerifyResponse>;
177
+ /**
178
+ * Create an authorization url to sign in with an external provider.
179
+ *
180
+ * @see https://instantdb.com/docs/auth
181
+ *
182
+ * @example
183
+ * // Get the authorization url from your backend
184
+ * const url = db.auth.createAuthorizationUrl({
185
+ * clientName: "google",
186
+ * redirectURL: window.location.href,
187
+ * });
188
+ *
189
+ * // Put it in a sign in link
190
+ * <a href={url}>Log in with Google</a>
191
+ */
192
+ createAuthorizationURL: (params: {
193
+ clientName: string;
194
+ redirectURL: string;
195
+ extraFields?: Record<string, any>;
196
+ }) => string;
197
+ /**
198
+ * Sign in with the id_token from an external provider like Google
199
+ *
200
+ * @see https://instantdb.com/docs/auth
201
+ * @example
202
+ * db.auth
203
+ * .signInWithIdToken({
204
+ * // Token from external service
205
+ * idToken: id_token,
206
+ * // The name you gave the client when you registered it with Instant
207
+ * clientName: "google",
208
+ * // The nonce, if any, that you used when you initiated the auth flow
209
+ * // with the external service.
210
+ * nonce: your_nonce
211
+ * })
212
+ * .catch((err) => console.error(err.body?.message));
213
+ *
214
+ */
215
+ signInWithIdToken: (params: SignInWithIdTokenParams) => Promise<CheckMagicCodeResponse>;
216
+ /**
217
+ * Sign in with the id_token from an external provider like Google
218
+ *
219
+ * @see https://instantdb.com/docs/auth
220
+ * @example
221
+ * db.auth
222
+ * .exchangeOAuthCode({
223
+ * // code received in redirect from OAuth callback
224
+ * code: code
225
+ * // The PKCE code_verifier, if any, that you used when you
226
+ * // initiated the auth flow
227
+ * codeVerifier: your_code_verifier
228
+ * })
229
+ * .catch((err) => console.error(err.body?.message));
230
+ *
231
+ */
232
+ exchangeOAuthCode: (params: ExchangeCodeForTokenParams) => Promise<CheckMagicCodeResponse>;
233
+ /**
234
+ * OpenID Discovery path for use with tools like
235
+ * expo-auth-session that use auto-discovery of
236
+ * OAuth parameters.
237
+ *
238
+ * @see https://instantdb.com/docs/auth
239
+ * @example
240
+ * const discovery = useAutoDiscovery(
241
+ * db.auth.issuerURI()
242
+ * );
243
+ */
244
+ issuerURI: () => string;
245
+ /**
246
+ * Sign out the current user
247
+ */
248
+ signOut: (opts?: SignoutOpts) => Promise<void>;
249
+ }
250
+ type FileOpts = {
251
+ contentType?: string;
252
+ contentDisposition?: string;
253
+ fileSize?: number;
254
+ };
255
+ /**
256
+ * Functions to manage file storage.
257
+ */
258
+ declare class Storage {
259
+ private db;
260
+ constructor(db: Reactor);
261
+ /**
262
+ * Uploads file at the provided path.
263
+ *
264
+ * @see https://instantdb.com/docs/storage
265
+ * @example
266
+ * const [file] = e.target.files; // result of file input
267
+ * const data = await db.storage.uploadFile('photos/demo.png', file);
268
+ */
269
+ uploadFile: (path: string, file: File | Blob, opts?: FileOpts) => Promise<UploadFileResponse>;
270
+ /**
271
+ * Deletes a file by path name.
272
+ *
273
+ * @deprecated Use `db.transact` to delete files instead:
274
+ * @example
275
+ * // Delete by id
276
+ * db.transact(db.tx.$files[fileId].delete());
277
+ *
278
+ * // Delete by path
279
+ * db.transact(db.tx.$files[lookup('path', 'photos/demo.png')].delete());
280
+ *
281
+ * // Delete multiple files
282
+ * db.transact(fileIds.map(id => db.tx.$files[id].delete()));
283
+ *
284
+ * @see https://instantdb.com/docs/storage
285
+ */
286
+ delete: (pathname: string) => Promise<DeleteFileResponse>;
287
+ /**
288
+ * @deprecated. Use `db.storage.uploadFile` instead
289
+ * remove in the future.
290
+ */
291
+ upload: (pathname: string, file: File) => Promise<boolean>;
292
+ /**
293
+ * @deprecated Use `db.storage.uploadFile` instead
294
+ */
295
+ put: (pathname: string, file: File) => Promise<boolean>;
296
+ /**
297
+ * @deprecated. getDownloadUrl will be removed in the future.
298
+ * Use `useQuery` instead to query and fetch for valid urls
299
+ *
300
+ * db.useQuery({
301
+ * $files: {
302
+ * $: {
303
+ * where: {
304
+ * path: "moop.png"
305
+ * }
306
+ * }
307
+ * }
308
+ * })
309
+ */
310
+ getDownloadUrl: (pathname: string) => Promise<any>;
311
+ }
312
+ type CreateReadStreamOpts = {
313
+ clientId?: string | null | undefined;
314
+ streamId?: string | null | undefined;
315
+ byteOffset?: number | null | undefined;
316
+ ruleParams?: RuleParams | null | undefined;
317
+ };
318
+ type CreateWriteStreamOpts = {
319
+ clientId: string;
320
+ /**
321
+ * A function that takes a promise and ensures that the current program stays alive
322
+ * until the promise is resolved.
323
+ *
324
+ * Useful in serverless environments to ensure the writer fully flushes before the
325
+ * environment is shut down.
326
+ *
327
+ * @example
328
+ * import { after } from 'next/server'
329
+ * db.streams.createWriteStream({clientId, waitUntil: after})
330
+ */
331
+ waitUntil?: (promise: Promise<any>) => void | null | undefined;
332
+ ruleParams?: RuleParams | null | undefined;
333
+ };
334
+ /**
335
+ * Functions to manage streams.
336
+ */
337
+ declare class Streams {
338
+ private db;
339
+ constructor(db: Reactor);
340
+ /**
341
+ * Creates a new ReadableStream for the given clientId.
342
+ *
343
+ * @example
344
+ * const stream = db.streams.createReadStream({clientId: clientId})
345
+ * for await (const chunk of stream) {
346
+ * console.log(chunk);
347
+ * }
348
+ */
349
+ createReadStream: (opts: CreateReadStreamOpts) => InstantReadableStream<string>;
350
+ /**
351
+ * Creates a new WritableStream for the given clientId.
352
+ *
353
+ * @example
354
+ * const writeStream = db.streams.createWriteStream({clientId: clientId})
355
+ * const writer = writeStream.getWriter();
356
+ * writer.write('Hello world');
357
+ * writer.close();
358
+ */
359
+ createWriteStream: (opts: CreateWriteStreamOpts) => InstantWritableStream<string>;
360
+ }
361
+ declare function coerceQuery(o: any): any;
362
+ declare class InstantCoreDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean = false> implements IInstantDatabase<Schema> {
363
+ _reactor: Reactor<RoomsOf<Schema>>;
364
+ auth: Auth;
365
+ storage: Storage;
366
+ streams: Streams;
367
+ tx: TxChunk<Schema>;
368
+ constructor(reactor: Reactor<RoomsOf<Schema>>);
369
+ /**
370
+ * Use this to write data! You can create, update, delete, and link objects
371
+ *
372
+ * @see https://instantdb.com/docs/instaml
373
+ *
374
+ * @example
375
+ * // Create a new object in the `goals` namespace
376
+ * const goalId = id();
377
+ * db.transact(db.tx.goals[goalId].update({title: "Get fit"}))
378
+ *
379
+ * // Update the title
380
+ * db.transact(db.tx.goals[goalId].update({title: "Get super fit"}))
381
+ *
382
+ * // Delete it
383
+ * db.transact(db.tx.goals[goalId].delete())
384
+ *
385
+ * // Or create an association:
386
+ * todoId = id();
387
+ * db.transact([
388
+ * db.tx.todos[todoId].update({ title: 'Go on a run' }),
389
+ * db.tx.goals[goalId].link({todos: todoId}),
390
+ * ])
391
+ */
392
+ transact(chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]): Promise<TransactionResult>;
393
+ getLocalId(name: string): Promise<string>;
394
+ /**
395
+ * Use this to query your data!
396
+ *
397
+ * @see https://instantdb.com/docs/instaql
398
+ *
399
+ * @example
400
+ * // listen to all goals
401
+ * db.subscribeQuery({ goals: {} }, (resp) => {
402
+ * console.log(resp.data.goals)
403
+ * })
404
+ *
405
+ * // goals where the title is "Get Fit"
406
+ * db.subscribeQuery(
407
+ * { goals: { $: { where: { title: "Get Fit" } } } },
408
+ * (resp) => {
409
+ * console.log(resp.data.goals)
410
+ * }
411
+ * )
412
+ *
413
+ * // all goals, _alongside_ their todos
414
+ * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
415
+ * console.log(resp.data.goals)
416
+ * });
417
+ */
418
+ subscribeQuery<Q extends ValidQuery<Q, Schema>, UseDatesLocal extends boolean = UseDates>(query: Q, cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void, opts?: InstaQLOptions): () => void;
419
+ /**
420
+ * Subscribe to a query and incrementally load more items
421
+ *
422
+ * Only one top level namespace in the query is allowed.
423
+ * @example
424
+ * const { unsubscribe, loadNextPage } = db.subscribeInfiniteQuery({
425
+ * posts: {
426
+ * $: {
427
+ * limit: 20, // Load 20 posts at a time
428
+ * order: {
429
+ * createdAt: 'desc',
430
+ * },
431
+ * },
432
+ * },
433
+ * (resp) => {
434
+ * console.log(resp.data.posts);
435
+ * }
436
+ * });
437
+ */
438
+ subscribeInfiniteQuery<Q extends ValidQuery<Q, Schema>>(query: Q, cb: (resp: InfiniteQueryCallbackResponse<Schema, Q, UseDates>) => void, opts?: InstaQLOptions): InfiniteQuerySubscription;
439
+ /**
440
+ * Listen for the logged in state. This is useful
441
+ * for deciding when to show a login screen.
442
+ *
443
+ * @see https://instantdb.com/docs/auth
444
+ * @example
445
+ * const unsub = db.subscribeAuth((auth) => {
446
+ * if (auth.user) {
447
+ * console.log('logged in as', auth.user.email)
448
+ * } else {
449
+ * console.log('logged out')
450
+ * }
451
+ * })
452
+ */
453
+ subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn;
454
+ /**
455
+ * One time query for the logged in state. This is useful
456
+ * for scenarios where you want to know the current auth
457
+ * state without subscribing to changes.
458
+ *
459
+ * @see https://instantdb.com/docs/auth
460
+ * @example
461
+ * const user = await db.getAuth();
462
+ * console.log('logged in as', user.email)
463
+ */
464
+ getAuth(): Promise<User | null>;
465
+ /**
466
+ * Listen for connection status changes to Instant. This is useful
467
+ * for building things like connectivity indicators
468
+ *
469
+ * @see https://www.instantdb.com/docs/patterns#connection-status
470
+ * @example
471
+ * const unsub = db.subscribeConnectionStatus((status) => {
472
+ * const connectionState =
473
+ * status === 'connecting' || status === 'opened'
474
+ * ? 'authenticating'
475
+ * : status === 'authenticated'
476
+ * ? 'connected'
477
+ * : status === 'closed'
478
+ * ? 'closed'
479
+ * : status === 'errored'
480
+ * ? 'errored'
481
+ * : 'unexpected state';
482
+ *
483
+ * console.log('Connection status:', connectionState);
484
+ * });
485
+ */
486
+ subscribeConnectionStatus(cb: (status: ConnectionStatus) => void): UnsubscribeFn;
487
+ /**
488
+ * Observe the app's maintenance-mode state. While read-only, reads and
489
+ * live queries keep working but writes are rejected. The callback fires
490
+ * immediately with the current state and again on every change.
491
+ *
492
+ * @example
493
+ * const unsub = db.subscribeAppStatus(({ isLoading, isReadOnly }) => {
494
+ * if (isLoading) return;
495
+ * if (isReadOnly) showMaintenanceBanner();
496
+ * });
497
+ */
498
+ subscribeAppStatus(cb: (state: AppStatusState) => void): UnsubscribeFn;
499
+ /**
500
+ * Join a room to publish and subscribe to topics and presence.
501
+ *
502
+ * @see https://instantdb.com/docs/presence-and-topics
503
+ * @example
504
+ * // init
505
+ * const db = init();
506
+ * const room = db.joinRoom(roomType, roomId);
507
+ * // usage
508
+ * const unsubscribeTopic = room.subscribeTopic("foo", console.log);
509
+ * const unsubscribePresence = room.subscribePresence({}, console.log);
510
+ * room.publishTopic("hello", { message: "hello world!" });
511
+ * room.publishPresence({ name: "joe" });
512
+ * // later
513
+ * unsubscribePresence();
514
+ * unsubscribeTopic();
515
+ * room.leaveRoom();
516
+ */
517
+ joinRoom<RoomType extends string & keyof RoomsOf<Schema>>(roomType?: RoomType, roomId?: string, opts?: {
518
+ initialPresence?: Partial<PresenceOf<Schema, RoomType>>;
519
+ }): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>>;
520
+ shutdown(): void;
521
+ /**
522
+ * Use this for one-off queries.
523
+ * Returns local data if available, otherwise fetches from the server.
524
+ * Because we want to avoid stale data, this method will throw an error
525
+ * if the user is offline or there is no active connection to the server.
526
+ *
527
+ * @see https://instantdb.com/docs/instaql
528
+ *
529
+ * @example
530
+ *
531
+ * const resp = await db.queryOnce({ goals: {} });
532
+ * console.log(resp.data.goals)
533
+ */
534
+ queryOnce<Q extends ValidQuery<Q, Schema>>(query: Q, opts?: InstaQLOptions): Promise<{
535
+ data: InstaQLResponse<Schema, Q, UseDates>;
536
+ pageInfo: PageInfoResponse<Q>;
537
+ }>;
538
+ /**
539
+ * @deprecated This is an experimental function that is not yet ready for production use.
540
+ * Use this function to sync an entire namespace.
541
+ * It has many limitations that will be removed in the future:
542
+ * 1. Must be used with an admin token
543
+ * 2. Does not support permissions
544
+ * 3. Does not support where clauses
545
+ * 4. Does not support links
546
+ * It also does not support multiple top-level namespaces. For example,
547
+ * {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.
548
+ */
549
+ _syncTableExperimental<Q extends ValidQuery<Q, Schema>>(query: ExactlyOne<Q>, cb: SyncTableCallback<Schema, Q, UseDates>): (opts?: {
550
+ keepSubscription: boolean | null | undefined;
551
+ } | null | undefined) => void;
552
+ }
553
+ /**
554
+ *
555
+ * The first step: init your application!
556
+ *
557
+ * Visit https://instantdb.com/dash to get your `appId` :)
558
+ *
559
+ * @example
560
+ * import { init } from "@instantdb/core"
561
+ *
562
+ * const db = init({ appId: "my-app-id" })
563
+ *
564
+ * // You can also provide a schema for type safety and editor autocomplete!
565
+ *
566
+ * import { init } from "@instantdb/core"
567
+ * import schema from ""../instant.schema.ts";
568
+ *
569
+ * const db = init({ appId: "my-app-id", schema })
570
+ *
571
+ * // To learn more: https://instantdb.com/docs/modeling-data
572
+ */
573
+ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
574
+ useDateObjects?: UseDates;
575
+ }, Store?: any, NetworkListener?: any, versions?: {
576
+ [key: string]: string;
577
+ }, EventSourceImpl?: any): InstantCoreDatabase<Schema, UseDates>;
578
+ /**
579
+ * @deprecated
580
+ * `init_experimental` is deprecated. You can replace it with `init`.
581
+ *
582
+ * @example
583
+ *
584
+ * // Before
585
+ * import { init_experimental } from "@instantdb/core"
586
+ * const db = init_experimental({ ... });
587
+ *
588
+ * // After
589
+ * import { init } from "@instantdb/core"
590
+ * const db = init({ ... });
591
+ */
592
+ declare const init_experimental: typeof init;
593
+ export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, parseSchemaFromJSON, TransactionValidationError, FrameworkClient, Reactor, InstantAPIError, setInstantWarningsEnabled, i, getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, Streams, version, InstantError, getInfiniteQueryInitialSnapshot, SyncTableCallbackEventType, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type AppStatusState, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type PresencePeer, type InstaQLParams, type ValidQuery, type Cursor, type InstaQLOptions, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type InstaQLFields, type Order, type InstaQLQueryEntityResult, type InfiniteQueryCallbackResponse, type InfiniteQuerySubscription, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type InstantUnknownSchemaDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type TopicOf, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type RuleParams, type InstantDBAttr, type InstantDBAttrOnDelete, type InstantDBCheckedDataType, type InstantDBIdent, type InstantDBInferredType, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInAsGuestParams, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, SSEConnection, type EventSourceType, type FrameworkConfig, type EventSourceConstructor, InstantStream, type WritableStreamCtor, type ReadableStreamCtor, type CreateReadStreamOpts, type CreateWriteStreamOpts, type InstantWritableStream, type InstantReadableStream, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, StoreInterface, type StoreInterfaceClass, type StoreInterfaceStoreName, createInstantRouteHandler, type InstantRouteHandlerPayloadByType, type InstantRouteHandlerType, type InstantRouteHandlerBody, type Logger, };
594
+ /** @deprecated Use StoreInterface instead */
595
+ export declare const StorageInterface: typeof StoreInterface;
596
+ /** @deprecated Use StoreInterfaceStoreName instead */
597
+ export type StorageInterfaceStoreName = StoreInterfaceStoreName;