@sidekickdb/core 2.0.1 → 3.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 (320) hide show
  1. package/__example__/standalone.esm.html +1 -1
  2. package/__example__/standalone.umd.html +2 -2
  3. package/__tests__/src/Reactor.test.ts +70 -25
  4. package/__tests__/src/batchedFrames.test.ts +110 -0
  5. package/__tests__/src/createRouteHandler.test.ts +30 -0
  6. package/__tests__/src/data/zeneca/triples.json +6 -6
  7. package/__tests__/src/dataForQueryMemo.test.ts +4 -4
  8. package/__tests__/src/datalog.test.ts +2 -2
  9. package/__tests__/src/devtool.test.ts +2 -2
  10. package/__tests__/src/endpoints.test.ts +2 -2
  11. package/__tests__/src/infiniteQuery.test.ts +142 -0
  12. package/__tests__/src/notifyScope.test.ts +6 -6
  13. package/__tests__/src/queryValidation.test.ts +3 -3
  14. package/__tests__/src/schema.test.ts +6 -6
  15. package/__tests__/src/serializeSchema.test.ts +2 -2
  16. package/__tests__/src/{instaml.test.ts → sideml.test.ts} +106 -112
  17. package/__tests__/src/{instaql.bench.ts → sideql.bench.ts} +1 -1
  18. package/__tests__/src/{instaql.test.ts → sideql.test.ts} +25 -34
  19. package/__tests__/src/{instaqlInference.test.ts → sideqlInference.test.ts} +1 -1
  20. package/__tests__/src/store.test.ts +32 -32
  21. package/__tests__/src/transactionValidation.test.ts +4 -4
  22. package/__tests__/src/utils/e2e.ts +8 -8
  23. package/dist/commonjs/Connection.d.ts +1 -0
  24. package/dist/commonjs/Connection.d.ts.map +1 -1
  25. package/dist/commonjs/Connection.js +19 -3
  26. package/dist/commonjs/Connection.js.map +1 -1
  27. package/dist/commonjs/IndexedDBStorage.d.ts.map +1 -1
  28. package/dist/commonjs/IndexedDBStorage.js +3 -160
  29. package/dist/commonjs/IndexedDBStorage.js.map +1 -1
  30. package/dist/commonjs/Reactor.d.ts +7 -7
  31. package/dist/commonjs/Reactor.d.ts.map +1 -1
  32. package/dist/commonjs/Reactor.js +37 -38
  33. package/dist/commonjs/Reactor.js.map +1 -1
  34. package/dist/commonjs/{InstantError.d.ts → SidekickError.d.ts} +2 -2
  35. package/dist/commonjs/SidekickError.d.ts.map +1 -0
  36. package/dist/commonjs/{InstantError.js → SidekickError.js} +7 -7
  37. package/dist/commonjs/SidekickError.js.map +1 -0
  38. package/dist/commonjs/Stream.d.ts +5 -5
  39. package/dist/commonjs/Stream.d.ts.map +1 -1
  40. package/dist/commonjs/Stream.js +14 -14
  41. package/dist/commonjs/Stream.js.map +1 -1
  42. package/dist/commonjs/SyncTable.d.ts +3 -3
  43. package/dist/commonjs/SyncTable.d.ts.map +1 -1
  44. package/dist/commonjs/SyncTable.js +7 -7
  45. package/dist/commonjs/SyncTable.js.map +1 -1
  46. package/dist/commonjs/attrTypes.d.ts +11 -11
  47. package/dist/commonjs/attrTypes.d.ts.map +1 -1
  48. package/dist/commonjs/attrTypes.js.map +1 -1
  49. package/dist/commonjs/coreTypes.d.ts +4 -4
  50. package/dist/commonjs/coreTypes.d.ts.map +1 -1
  51. package/dist/commonjs/coreTypes.js.map +1 -1
  52. package/dist/commonjs/createRouteHandler.d.ts +1 -1
  53. package/dist/commonjs/createRouteHandler.d.ts.map +1 -1
  54. package/dist/commonjs/createRouteHandler.js +5 -5
  55. package/dist/commonjs/createRouteHandler.js.map +1 -1
  56. package/dist/commonjs/devtool.js +13 -6
  57. package/dist/commonjs/devtool.js.map +1 -1
  58. package/dist/commonjs/endpoints.d.ts +2 -2
  59. package/dist/commonjs/endpoints.d.ts.map +1 -1
  60. package/dist/commonjs/endpoints.js +3 -3
  61. package/dist/commonjs/endpoints.js.map +1 -1
  62. package/dist/commonjs/framework.d.ts +4 -4
  63. package/dist/commonjs/framework.d.ts.map +1 -1
  64. package/dist/commonjs/framework.js +5 -5
  65. package/dist/commonjs/framework.js.map +1 -1
  66. package/dist/commonjs/helperTypes.d.ts +24 -24
  67. package/dist/commonjs/helperTypes.d.ts.map +1 -1
  68. package/dist/commonjs/helperTypes.js.map +1 -1
  69. package/dist/commonjs/index.d.ts +36 -36
  70. package/dist/commonjs/index.d.ts.map +1 -1
  71. package/dist/commonjs/index.js +36 -36
  72. package/dist/commonjs/index.js.map +1 -1
  73. package/dist/commonjs/infiniteQuery.d.ts +7 -7
  74. package/dist/commonjs/infiniteQuery.d.ts.map +1 -1
  75. package/dist/commonjs/infiniteQuery.js +16 -3
  76. package/dist/commonjs/infiniteQuery.js.map +1 -1
  77. package/dist/commonjs/model/{instaqlResult.d.ts → sideqlResult.d.ts} +2 -2
  78. package/dist/commonjs/model/sideqlResult.d.ts.map +1 -0
  79. package/dist/commonjs/model/{instaqlResult.js → sideqlResult.js} +2 -2
  80. package/dist/commonjs/model/sideqlResult.js.map +1 -0
  81. package/dist/commonjs/notifyScope.js +3 -3
  82. package/dist/commonjs/notifyScope.js.map +1 -1
  83. package/dist/commonjs/parseSchemaFromJSON.d.ts +2 -2
  84. package/dist/commonjs/parseSchemaFromJSON.d.ts.map +1 -1
  85. package/dist/commonjs/parseSchemaFromJSON.js.map +1 -1
  86. package/dist/commonjs/queryTypes.d.ts +32 -32
  87. package/dist/commonjs/queryTypes.d.ts.map +1 -1
  88. package/dist/commonjs/queryTypes.js.map +1 -1
  89. package/dist/commonjs/routeHandlerProtocol.d.ts +7 -7
  90. package/dist/commonjs/routeHandlerProtocol.d.ts.map +1 -1
  91. package/dist/commonjs/routeHandlerProtocol.js.map +1 -1
  92. package/dist/commonjs/rulesTypes.d.ts +20 -20
  93. package/dist/commonjs/rulesTypes.d.ts.map +1 -1
  94. package/dist/commonjs/rulesTypes.js.map +1 -1
  95. package/dist/commonjs/sanityCheckQueries.d.ts +3 -3
  96. package/dist/commonjs/sanityCheckQueries.d.ts.map +1 -1
  97. package/dist/commonjs/sanityCheckQueries.js.map +1 -1
  98. package/dist/commonjs/schema.d.ts +3 -3
  99. package/dist/commonjs/schema.d.ts.map +1 -1
  100. package/dist/commonjs/schema.js +2 -2
  101. package/dist/commonjs/schema.js.map +1 -1
  102. package/dist/commonjs/schemaTypes.d.ts +8 -8
  103. package/dist/commonjs/schemaTypes.d.ts.map +1 -1
  104. package/dist/commonjs/schemaTypes.js +9 -9
  105. package/dist/commonjs/schemaTypes.js.map +1 -1
  106. package/dist/commonjs/{instaml.d.ts → sideml.d.ts} +1 -1
  107. package/dist/commonjs/sideml.d.ts.map +1 -0
  108. package/dist/commonjs/{instaml.js → sideml.js} +10 -7
  109. package/dist/commonjs/sideml.js.map +1 -0
  110. package/dist/commonjs/{instaql.d.ts → sideql.d.ts} +1 -1
  111. package/dist/commonjs/sideql.d.ts.map +1 -0
  112. package/dist/commonjs/{instaql.js → sideql.js} +1 -1
  113. package/dist/commonjs/sideql.js.map +1 -0
  114. package/dist/commonjs/{instatx.d.ts → sidetx.d.ts} +1 -1
  115. package/dist/commonjs/sidetx.d.ts.map +1 -0
  116. package/dist/commonjs/{instatx.js → sidetx.js} +1 -1
  117. package/dist/commonjs/sidetx.js.map +1 -0
  118. package/dist/commonjs/store.d.ts +22 -22
  119. package/dist/commonjs/store.d.ts.map +1 -1
  120. package/dist/commonjs/store.js +0 -2
  121. package/dist/commonjs/store.js.map +1 -1
  122. package/dist/commonjs/transactionValidation.d.ts +1 -1
  123. package/dist/commonjs/transactionValidation.d.ts.map +1 -1
  124. package/dist/commonjs/transactionValidation.js +2 -2
  125. package/dist/commonjs/transactionValidation.js.map +1 -1
  126. package/dist/commonjs/utils/dates.js +31 -31
  127. package/dist/commonjs/utils/dates.js.map +1 -1
  128. package/dist/commonjs/utils/fetch.d.ts +7 -7
  129. package/dist/commonjs/utils/fetch.d.ts.map +1 -1
  130. package/dist/commonjs/utils/fetch.js +8 -8
  131. package/dist/commonjs/utils/fetch.js.map +1 -1
  132. package/dist/commonjs/utils/flags.d.ts +2 -2
  133. package/dist/commonjs/utils/flags.d.ts.map +1 -1
  134. package/dist/commonjs/utils/flags.js +4 -4
  135. package/dist/commonjs/utils/flags.js.map +1 -1
  136. package/dist/commonjs/utils/linkIndex.d.ts +2 -2
  137. package/dist/commonjs/utils/linkIndex.d.ts.map +1 -1
  138. package/dist/commonjs/utils/linkIndex.js.map +1 -1
  139. package/dist/commonjs/warningToggle.d.ts +1 -1
  140. package/dist/commonjs/warningToggle.d.ts.map +1 -1
  141. package/dist/commonjs/warningToggle.js +3 -3
  142. package/dist/commonjs/warningToggle.js.map +1 -1
  143. package/dist/esm/Connection.d.ts +1 -0
  144. package/dist/esm/Connection.d.ts.map +1 -1
  145. package/dist/esm/Connection.js +18 -3
  146. package/dist/esm/Connection.js.map +1 -1
  147. package/dist/esm/IndexedDBStorage.d.ts.map +1 -1
  148. package/dist/esm/IndexedDBStorage.js +4 -161
  149. package/dist/esm/IndexedDBStorage.js.map +1 -1
  150. package/dist/esm/Reactor.d.ts +7 -7
  151. package/dist/esm/Reactor.d.ts.map +1 -1
  152. package/dist/esm/Reactor.js +38 -39
  153. package/dist/esm/Reactor.js.map +1 -1
  154. package/dist/esm/{InstantError.d.ts → SidekickError.d.ts} +2 -2
  155. package/dist/esm/SidekickError.d.ts.map +1 -0
  156. package/dist/esm/{InstantError.js → SidekickError.js} +5 -5
  157. package/dist/esm/SidekickError.js.map +1 -0
  158. package/dist/esm/Stream.d.ts +5 -5
  159. package/dist/esm/Stream.d.ts.map +1 -1
  160. package/dist/esm/Stream.js +12 -12
  161. package/dist/esm/Stream.js.map +1 -1
  162. package/dist/esm/SyncTable.d.ts +3 -3
  163. package/dist/esm/SyncTable.d.ts.map +1 -1
  164. package/dist/esm/SyncTable.js +3 -3
  165. package/dist/esm/SyncTable.js.map +1 -1
  166. package/dist/esm/attrTypes.d.ts +11 -11
  167. package/dist/esm/attrTypes.d.ts.map +1 -1
  168. package/dist/esm/attrTypes.js.map +1 -1
  169. package/dist/esm/coreTypes.d.ts +4 -4
  170. package/dist/esm/coreTypes.d.ts.map +1 -1
  171. package/dist/esm/coreTypes.js.map +1 -1
  172. package/dist/esm/createRouteHandler.d.ts +1 -1
  173. package/dist/esm/createRouteHandler.d.ts.map +1 -1
  174. package/dist/esm/createRouteHandler.js +3 -3
  175. package/dist/esm/createRouteHandler.js.map +1 -1
  176. package/dist/esm/devtool.js +13 -6
  177. package/dist/esm/devtool.js.map +1 -1
  178. package/dist/esm/endpoints.d.ts +2 -2
  179. package/dist/esm/endpoints.d.ts.map +1 -1
  180. package/dist/esm/endpoints.js +3 -3
  181. package/dist/esm/endpoints.js.map +1 -1
  182. package/dist/esm/framework.d.ts +4 -4
  183. package/dist/esm/framework.d.ts.map +1 -1
  184. package/dist/esm/framework.js +6 -6
  185. package/dist/esm/framework.js.map +1 -1
  186. package/dist/esm/helperTypes.d.ts +24 -24
  187. package/dist/esm/helperTypes.d.ts.map +1 -1
  188. package/dist/esm/helperTypes.js.map +1 -1
  189. package/dist/esm/index.d.ts +36 -36
  190. package/dist/esm/index.d.ts.map +1 -1
  191. package/dist/esm/index.js +33 -33
  192. package/dist/esm/index.js.map +1 -1
  193. package/dist/esm/infiniteQuery.d.ts +7 -7
  194. package/dist/esm/infiniteQuery.d.ts.map +1 -1
  195. package/dist/esm/infiniteQuery.js +16 -3
  196. package/dist/esm/infiniteQuery.js.map +1 -1
  197. package/dist/esm/model/{instaqlResult.d.ts → sideqlResult.d.ts} +2 -2
  198. package/dist/esm/model/sideqlResult.d.ts.map +1 -0
  199. package/dist/esm/model/{instaqlResult.js → sideqlResult.js} +2 -2
  200. package/dist/esm/model/sideqlResult.js.map +1 -0
  201. package/dist/esm/notifyScope.js +3 -3
  202. package/dist/esm/notifyScope.js.map +1 -1
  203. package/dist/esm/parseSchemaFromJSON.d.ts +2 -2
  204. package/dist/esm/parseSchemaFromJSON.d.ts.map +1 -1
  205. package/dist/esm/parseSchemaFromJSON.js.map +1 -1
  206. package/dist/esm/queryTypes.d.ts +32 -32
  207. package/dist/esm/queryTypes.d.ts.map +1 -1
  208. package/dist/esm/queryTypes.js.map +1 -1
  209. package/dist/esm/routeHandlerProtocol.d.ts +7 -7
  210. package/dist/esm/routeHandlerProtocol.d.ts.map +1 -1
  211. package/dist/esm/routeHandlerProtocol.js.map +1 -1
  212. package/dist/esm/rulesTypes.d.ts +20 -20
  213. package/dist/esm/rulesTypes.d.ts.map +1 -1
  214. package/dist/esm/rulesTypes.js.map +1 -1
  215. package/dist/esm/sanityCheckQueries.d.ts +3 -3
  216. package/dist/esm/sanityCheckQueries.d.ts.map +1 -1
  217. package/dist/esm/sanityCheckQueries.js.map +1 -1
  218. package/dist/esm/schema.d.ts +3 -3
  219. package/dist/esm/schema.d.ts.map +1 -1
  220. package/dist/esm/schema.js +3 -3
  221. package/dist/esm/schema.js.map +1 -1
  222. package/dist/esm/schemaTypes.d.ts +8 -8
  223. package/dist/esm/schemaTypes.d.ts.map +1 -1
  224. package/dist/esm/schemaTypes.js +5 -5
  225. package/dist/esm/schemaTypes.js.map +1 -1
  226. package/dist/esm/{instaml.d.ts → sideml.d.ts} +1 -1
  227. package/dist/esm/sideml.d.ts.map +1 -0
  228. package/dist/esm/{instaml.js → sideml.js} +6 -3
  229. package/dist/esm/sideml.js.map +1 -0
  230. package/dist/esm/{instaql.d.ts → sideql.d.ts} +1 -1
  231. package/dist/esm/sideql.d.ts.map +1 -0
  232. package/dist/esm/{instaql.js → sideql.js} +1 -1
  233. package/dist/esm/sideql.js.map +1 -0
  234. package/dist/esm/{instatx.d.ts → sidetx.d.ts} +1 -1
  235. package/dist/esm/sidetx.d.ts.map +1 -0
  236. package/dist/esm/{instatx.js → sidetx.js} +1 -1
  237. package/dist/esm/sidetx.js.map +1 -0
  238. package/dist/esm/store.d.ts +22 -22
  239. package/dist/esm/store.d.ts.map +1 -1
  240. package/dist/esm/store.js +0 -2
  241. package/dist/esm/store.js.map +1 -1
  242. package/dist/esm/transactionValidation.d.ts +1 -1
  243. package/dist/esm/transactionValidation.d.ts.map +1 -1
  244. package/dist/esm/transactionValidation.js +1 -1
  245. package/dist/esm/transactionValidation.js.map +1 -1
  246. package/dist/esm/utils/dates.js +31 -31
  247. package/dist/esm/utils/dates.js.map +1 -1
  248. package/dist/esm/utils/fetch.d.ts +7 -7
  249. package/dist/esm/utils/fetch.d.ts.map +1 -1
  250. package/dist/esm/utils/fetch.js +6 -6
  251. package/dist/esm/utils/fetch.js.map +1 -1
  252. package/dist/esm/utils/flags.d.ts +2 -2
  253. package/dist/esm/utils/flags.d.ts.map +1 -1
  254. package/dist/esm/utils/flags.js +3 -3
  255. package/dist/esm/utils/flags.js.map +1 -1
  256. package/dist/esm/utils/linkIndex.d.ts +2 -2
  257. package/dist/esm/utils/linkIndex.d.ts.map +1 -1
  258. package/dist/esm/utils/linkIndex.js.map +1 -1
  259. package/dist/esm/warningToggle.d.ts +1 -1
  260. package/dist/esm/warningToggle.d.ts.map +1 -1
  261. package/dist/esm/warningToggle.js +1 -1
  262. package/dist/esm/warningToggle.js.map +1 -1
  263. package/dist/standalone/index.js +2705 -2791
  264. package/dist/standalone/index.umd.cjs +9 -6
  265. package/package.json +2 -2
  266. package/src/Connection.ts +18 -3
  267. package/src/IndexedDBStorage.ts +3 -181
  268. package/src/Reactor.js +40 -39
  269. package/src/{InstantError.ts → SidekickError.ts} +4 -4
  270. package/src/Stream.ts +35 -32
  271. package/src/SyncTable.ts +6 -6
  272. package/src/attrTypes.ts +15 -11
  273. package/src/coreTypes.ts +5 -5
  274. package/src/createRouteHandler.ts +9 -7
  275. package/src/devtool.ts +13 -6
  276. package/src/endpoints.ts +4 -4
  277. package/src/framework.ts +13 -13
  278. package/src/helperTypes.ts +37 -37
  279. package/src/index.ts +123 -123
  280. package/src/infiniteQuery.ts +39 -22
  281. package/src/model/{instaqlResult.js → sideqlResult.js} +1 -1
  282. package/src/notifyScope.ts +3 -3
  283. package/src/parseSchemaFromJSON.ts +2 -2
  284. package/src/queryTypes.ts +55 -55
  285. package/src/routeHandlerProtocol.ts +8 -8
  286. package/src/rulesTypes.ts +23 -23
  287. package/src/sanityCheckQueries.ts +9 -9
  288. package/src/schema.ts +3 -3
  289. package/src/schemaTypes.ts +11 -9
  290. package/src/{instaml.ts → sideml.ts} +17 -14
  291. package/src/{instaql.ts → sideql.ts} +5 -5
  292. package/src/store.ts +35 -36
  293. package/src/transactionValidation.ts +1 -1
  294. package/src/utils/dates.ts +31 -31
  295. package/src/utils/fetch.ts +13 -13
  296. package/src/utils/flags.ts +3 -3
  297. package/src/utils/linkIndex.ts +2 -2
  298. package/src/warningToggle.ts +1 -1
  299. package/vite.config.ts +1 -1
  300. package/dist/commonjs/InstantError.d.ts.map +0 -1
  301. package/dist/commonjs/InstantError.js.map +0 -1
  302. package/dist/commonjs/instaml.d.ts.map +0 -1
  303. package/dist/commonjs/instaml.js.map +0 -1
  304. package/dist/commonjs/instaql.d.ts.map +0 -1
  305. package/dist/commonjs/instaql.js.map +0 -1
  306. package/dist/commonjs/instatx.d.ts.map +0 -1
  307. package/dist/commonjs/instatx.js.map +0 -1
  308. package/dist/commonjs/model/instaqlResult.d.ts.map +0 -1
  309. package/dist/commonjs/model/instaqlResult.js.map +0 -1
  310. package/dist/esm/InstantError.d.ts.map +0 -1
  311. package/dist/esm/InstantError.js.map +0 -1
  312. package/dist/esm/instaml.d.ts.map +0 -1
  313. package/dist/esm/instaml.js.map +0 -1
  314. package/dist/esm/instaql.d.ts.map +0 -1
  315. package/dist/esm/instaql.js.map +0 -1
  316. package/dist/esm/instatx.d.ts.map +0 -1
  317. package/dist/esm/instatx.js.map +0 -1
  318. package/dist/esm/model/instaqlResult.d.ts.map +0 -1
  319. package/dist/esm/model/instaqlResult.js.map +0 -1
  320. /package/src/{instatx.ts → sidetx.ts} +0 -0
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getOps,
7
7
  type TxChunk,
8
8
  type TransactionChunk,
9
- } from './instatx.js';
9
+ } from './sidetx.js';
10
10
  import weakHash from './utils/weakHash.js';
11
11
  import id from './utils/id.ts';
12
12
  import IndexedDBStorage from './IndexedDBStorage.ts';
@@ -20,18 +20,18 @@ import {
20
20
  validateTransactions,
21
21
  TransactionValidationError,
22
22
  } from './transactionValidation.ts';
23
- import { setInstantWarningsEnabled } from './warningToggle.ts';
23
+ import { setSidekickWarningsEnabled } from './warningToggle.ts';
24
24
 
25
25
  import {
26
26
  StoreInterface,
27
27
  type StoreInterfaceClass,
28
28
  type StoreInterfaceStoreName,
29
29
  } from './utils/PersistedObject.ts';
30
- import { createInstantRouteHandler } from './createRouteHandler.ts';
30
+ import { createSidekickRouteHandler } from './createRouteHandler.ts';
31
31
  import type {
32
- InstantRouteHandlerPayloadByType,
33
- InstantRouteHandlerType,
34
- InstantRouteHandlerBody,
32
+ SidekickRouteHandlerPayloadByType,
33
+ SidekickRouteHandlerType,
34
+ SidekickRouteHandlerBody,
35
35
  } from './routeHandlerProtocol.ts';
36
36
  import { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';
37
37
  import type { Logger } from './utils/log.ts';
@@ -45,27 +45,27 @@ import type {
45
45
  import type {
46
46
  DevtoolConfig,
47
47
  IDatabase,
48
- IInstantDatabase,
48
+ ISidekickDatabase,
49
49
  StrictDevtoolConfig,
50
50
  } from './coreTypes.ts';
51
51
  import type {
52
52
  Query,
53
53
  QueryResponse,
54
- InstaQLResponse,
54
+ SideQLResponse,
55
55
  PageInfoResponse,
56
56
  Exactly,
57
- InstantObject,
58
- InstaQLParams,
59
- InstaQLOptions,
60
- InstaQLQueryParams,
61
- InstaQLEntity,
62
- InstaQLEntitySubquery,
63
- InstaQLResult,
64
- InstaQLFields,
57
+ SidekickObject,
58
+ SideQLParams,
59
+ SideQLOptions,
60
+ SideQLQueryParams,
61
+ SideQLEntity,
62
+ SideQLEntitySubquery,
63
+ SideQLResult,
64
+ SideQLFields,
65
65
  ValidQuery,
66
66
  Cursor,
67
67
  Order,
68
- InstaQLQueryEntityResult,
68
+ SideQLQueryEntityResult,
69
69
  } from './queryTypes.ts';
70
70
  import type { PresencePeer } from './presenceTypes.ts';
71
71
  import type {
@@ -76,18 +76,18 @@ import type {
76
76
  AppStatusState,
77
77
  } from './clientTypes.ts';
78
78
  import type {
79
- InstantQuery,
80
- InstantQueryResult,
81
- InstantSchema,
82
- InstantEntity,
83
- InstantSchemaDatabase,
79
+ SidekickQuery,
80
+ SidekickQueryResult,
81
+ SidekickSchema,
82
+ SidekickEntity,
83
+ SidekickSchemaDatabase,
84
84
  } from './helperTypes.ts';
85
85
  import type {
86
- InstantDBAttr,
87
- InstantDBAttrOnDelete,
88
- InstantDBCheckedDataType,
89
- InstantDBIdent,
90
- InstantDBInferredType,
86
+ SidekickDBAttr,
87
+ SidekickDBAttrOnDelete,
88
+ SidekickDBCheckedDataType,
89
+ SidekickDBIdent,
90
+ SidekickDBInferredType,
91
91
  } from './attrTypes.ts';
92
92
  import type {
93
93
  AttrsDefs,
@@ -97,8 +97,8 @@ import type {
97
97
  EntitiesWithLinks,
98
98
  EntityDef,
99
99
  RoomsDef,
100
- InstantSchemaDef,
101
- InstantGraph,
100
+ SidekickSchemaDef,
101
+ SidekickGraph,
102
102
  LinkAttrDef,
103
103
  LinkDef,
104
104
  LinksDef,
@@ -108,15 +108,15 @@ import type {
108
108
  TopicsOf,
109
109
  TopicOf,
110
110
  ValueTypes,
111
- InstantUnknownSchema,
112
- InstantUnknownSchemaDef,
111
+ SidekickUnknownSchema,
112
+ SidekickUnknownSchemaDef,
113
113
  BackwardsCompatibleSchema,
114
114
  UpdateParams,
115
115
  LinkParams,
116
116
  CreateParams,
117
117
  RuleParams,
118
118
  } from './schemaTypes.ts';
119
- import type { InstantRules } from './rulesTypes.ts';
119
+ import type { SidekickRules } from './rulesTypes.ts';
120
120
  import type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';
121
121
  import { FrameworkClient, type FrameworkConfig } from './framework.ts';
122
122
 
@@ -132,8 +132,8 @@ import type {
132
132
  VerifyResponse,
133
133
  } from './authAPI.ts';
134
134
 
135
- import { InstantAPIError, type InstantIssue } from './utils/fetch.js';
136
- import { InstantError } from './InstantError.ts';
135
+ import { SidekickAPIError, type SidekickIssue } from './utils/fetch.js';
136
+ import { SidekickError } from './SidekickError.ts';
137
137
  import {
138
138
  MissingApiURIError,
139
139
  requireApiURI,
@@ -155,9 +155,9 @@ import type {
155
155
  SetupError as SyncTableSetupError,
156
156
  } from './SyncTable.ts';
157
157
  import {
158
- InstantStream,
159
- InstantWritableStream,
160
- InstantReadableStream,
158
+ SidekickStream,
159
+ SidekickWritableStream,
160
+ SidekickReadableStream,
161
161
  ReadableStreamCtor,
162
162
  WritableStreamCtor,
163
163
  } from './Stream.ts';
@@ -188,8 +188,8 @@ export type Config = {
188
188
  disableValidation?: boolean;
189
189
  };
190
190
 
191
- export type InstantConfig<
192
- S extends InstantSchemaDef<any, any, any>,
191
+ export type SidekickConfig<
192
+ S extends SidekickSchemaDef<any, any, any>,
193
193
  UseDates extends boolean = false,
194
194
  > = {
195
195
  appId: string;
@@ -216,7 +216,7 @@ export type InstantConfig<
216
216
  ReadableStream?: ReadableStreamCtor;
217
217
  };
218
218
 
219
- export type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {
219
+ export type ConfigWithSchema<S extends SidekickGraph<any, any>> = Config & {
220
220
  schema: S;
221
221
  };
222
222
 
@@ -271,7 +271,7 @@ type SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =
271
271
  pageInfo: PageInfoResponse<Q>;
272
272
  };
273
273
 
274
- type InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =
274
+ type SideQLSubscriptionState<Schema, Q, UseDates extends boolean> =
275
275
  | {
276
276
  error: { message: string; traceId?: string };
277
277
  data: undefined;
@@ -279,7 +279,7 @@ type InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =
279
279
  }
280
280
  | {
281
281
  error: undefined;
282
- data: InstaQLResponse<Schema, Q, UseDates>;
282
+ data: SideQLResponse<Schema, Q, UseDates>;
283
283
  pageInfo: PageInfoResponse<Q>;
284
284
  };
285
285
 
@@ -291,8 +291,8 @@ type LifecycleSubscriptionState<
291
291
  isLoading: boolean;
292
292
  };
293
293
 
294
- type InstaQLLifecycleState<Schema, Q, UseDates extends boolean = false> =
295
- | (InstaQLSubscriptionState<Schema, Q, UseDates> & {
294
+ type SideQLLifecycleState<Schema, Q, UseDates extends boolean = false> =
295
+ | (SideQLSubscriptionState<Schema, Q, UseDates> & {
296
296
  isLoading: boolean;
297
297
  })
298
298
  | {
@@ -306,17 +306,17 @@ type UnsubscribeFn = () => void;
306
306
 
307
307
  // hmr
308
308
  function initSchemaHashStore(): WeakMap<any, string> {
309
- globalThis.__instantDbSchemaHashStore =
310
- globalThis.__instantDbSchemaHashStore ?? new WeakMap<any, string>();
311
- return globalThis.__instantDbSchemaHashStore;
309
+ globalThis.__sidekickDbSchemaHashStore =
310
+ globalThis.__sidekickDbSchemaHashStore ?? new WeakMap<any, string>();
311
+ return globalThis.__sidekickDbSchemaHashStore;
312
312
  }
313
313
 
314
- function initGlobalInstantCoreStore(): Record<string, any> {
315
- globalThis.__instantDbStore = globalThis.__instantDbStore ?? {};
316
- return globalThis.__instantDbStore;
314
+ function initGlobalSidekickCoreStore(): Record<string, any> {
315
+ globalThis.__sidekickDbStore = globalThis.__sidekickDbStore ?? {};
316
+ return globalThis.__sidekickDbStore;
317
317
  }
318
318
 
319
- function reactorKey(config: InstantConfig<any, boolean>): string {
319
+ function reactorKey(config: SidekickConfig<any, boolean>): string {
320
320
  // @ts-expect-error
321
321
  const adminToken = config.__adminToken;
322
322
  // Sometimes you _want_ to simulate two separate db instances in the same
@@ -340,7 +340,7 @@ function reactorKey(config: InstantConfig<any, boolean>): string {
340
340
  );
341
341
  }
342
342
 
343
- const globalInstantCoreStore = initGlobalInstantCoreStore();
343
+ const globalSidekickCoreStore = initGlobalSidekickCoreStore();
344
344
  const schemaHashStore = initSchemaHashStore();
345
345
 
346
346
  type SignoutOpts = {
@@ -390,7 +390,7 @@ class Auth {
390
390
  /**
391
391
  * Sign in a user with a refresh token
392
392
  *
393
- * @see https://sidekickdb.co/docs/backend#frontend-auth-sign-in-with-token
393
+ * @see https://sidekickdb.co/docs/backend#2-frontend-db-auth-sign-in-with-token
394
394
  *
395
395
  * @example
396
396
  * // Get the token from your backend
@@ -446,7 +446,7 @@ class Auth {
446
446
  * .signInWithIdToken({
447
447
  * // Token from external service
448
448
  * idToken: id_token,
449
- * // The name you gave the client when you registered it with Instant
449
+ * // The name you gave the client when you registered it with SidekickDB
450
450
  * clientName: "google",
451
451
  * // The nonce, if any, that you used when you initiated the auth flow
452
452
  * // with the external service.
@@ -630,7 +630,7 @@ class Streams {
630
630
  */
631
631
  createReadStream = (
632
632
  opts: CreateReadStreamOpts,
633
- ): InstantReadableStream<string> => {
633
+ ): SidekickReadableStream<string> => {
634
634
  return this.db.createReadStream(opts);
635
635
  };
636
636
 
@@ -645,7 +645,7 @@ class Streams {
645
645
  */
646
646
  createWriteStream = (
647
647
  opts: CreateWriteStreamOpts,
648
- ): InstantWritableStream<string> => {
648
+ ): SidekickWritableStream<string> => {
649
649
  return this.db.createWriteStream(opts);
650
650
  };
651
651
  }
@@ -657,10 +657,10 @@ function coerceQuery(o: any) {
657
657
  return JSON.parse(JSON.stringify(o));
658
658
  }
659
659
 
660
- class InstantCoreDatabase<
661
- Schema extends InstantSchemaDef<any, any, any>,
660
+ class SidekickCoreDatabase<
661
+ Schema extends SidekickSchemaDef<any, any, any>,
662
662
  UseDates extends boolean = false,
663
- > implements IInstantDatabase<Schema>
663
+ > implements ISidekickDatabase<Schema>
664
664
  {
665
665
  public _reactor: Reactor<RoomsOf<Schema>>;
666
666
  public auth: Auth;
@@ -679,7 +679,7 @@ class InstantCoreDatabase<
679
679
  /**
680
680
  * Use this to write data! You can create, update, delete, and link objects
681
681
  *
682
- * @see https://sidekickdb.co/docs/instaml
682
+ * @see https://sidekickdb.co/docs/sideml
683
683
  *
684
684
  * @example
685
685
  * // Create a new object in the `goals` namespace
@@ -712,7 +712,7 @@ class InstantCoreDatabase<
712
712
  /**
713
713
  * Use this to query your data!
714
714
  *
715
- * @see https://sidekickdb.co/docs/instaql
715
+ * @see https://sidekickdb.co/docs/sideql
716
716
  *
717
717
  * @example
718
718
  * // listen to all goals
@@ -738,8 +738,8 @@ class InstantCoreDatabase<
738
738
  UseDatesLocal extends boolean = UseDates,
739
739
  >(
740
740
  query: Q,
741
- cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,
742
- opts?: InstaQLOptions,
741
+ cb: (resp: SideQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,
742
+ opts?: SideQLOptions,
743
743
  ) {
744
744
  return this._reactor.subscribeQuery(query, cb, opts);
745
745
  }
@@ -766,7 +766,7 @@ class InstantCoreDatabase<
766
766
  subscribeInfiniteQuery<Q extends ValidQuery<Q, Schema>>(
767
767
  query: Q,
768
768
  cb: (resp: InfiniteQueryCallbackResponse<Schema, Q, UseDates>) => void,
769
- opts?: InstaQLOptions,
769
+ opts?: SideQLOptions,
770
770
  ): InfiniteQuerySubscription {
771
771
  return subscribeInfiniteQuery<Schema, Q, UseDates>(
772
772
  this as any,
@@ -809,10 +809,10 @@ class InstantCoreDatabase<
809
809
  }
810
810
 
811
811
  /**
812
- * Listen for connection status changes to Instant. This is useful
812
+ * Listen for connection status changes to SidekickDB. This is useful
813
813
  * for building things like connectivity indicators
814
814
  *
815
- * @see https://sidekickdb.co/docs/patterns#connection-status
815
+ * @see https://sidekickdb.co/docs/patterns#listen-to-sidekick-db-connection-status
816
816
  * @example
817
817
  * const unsub = db.subscribeConnectionStatus((status) => {
818
818
  * const connectionState =
@@ -896,7 +896,7 @@ class InstantCoreDatabase<
896
896
  }
897
897
 
898
898
  shutdown() {
899
- delete globalInstantCoreStore[reactorKey(this._reactor.config)];
899
+ delete globalSidekickCoreStore[reactorKey(this._reactor.config)];
900
900
  this._reactor.shutdown();
901
901
  }
902
902
 
@@ -906,7 +906,7 @@ class InstantCoreDatabase<
906
906
  * Because we want to avoid stale data, this method will throw an error
907
907
  * if the user is offline or there is no active connection to the server.
908
908
  *
909
- * @see https://sidekickdb.co/docs/instaql
909
+ * @see https://sidekickdb.co/docs/sideql
910
910
  *
911
911
  * @example
912
912
  *
@@ -915,9 +915,9 @@ class InstantCoreDatabase<
915
915
  */
916
916
  queryOnce<Q extends ValidQuery<Q, Schema>>(
917
917
  query: Q,
918
- opts?: InstaQLOptions,
918
+ opts?: SideQLOptions,
919
919
  ): Promise<{
920
- data: InstaQLResponse<Schema, Q, UseDates>;
920
+ data: SideQLResponse<Schema, Q, UseDates>;
921
921
  pageInfo: PageInfoResponse<Q>;
922
922
  }> {
923
923
  return this._reactor.queryOnce(query, opts);
@@ -944,7 +944,7 @@ class InstantCoreDatabase<
944
944
  }
945
945
  }
946
946
 
947
- function schemaHash(schema?: InstantSchemaDef<any, any, any>): string {
947
+ function schemaHash(schema?: SidekickSchemaDef<any, any, any>): string {
948
948
  if (!schema) {
949
949
  return '0';
950
950
  }
@@ -959,8 +959,8 @@ function schemaHash(schema?: InstantSchemaDef<any, any, any>): string {
959
959
  }
960
960
 
961
961
  function schemaChanged(
962
- existingClient: InstantCoreDatabase<any, boolean>,
963
- newSchema?: InstantSchemaDef<any, any, any>,
962
+ existingClient: SidekickCoreDatabase<any, boolean>,
963
+ newSchema?: SidekickSchemaDef<any, any, any>,
964
964
  ): boolean {
965
965
  return (
966
966
  schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)
@@ -984,7 +984,7 @@ function schemaChanged(
984
984
  * // You can also provide a schema for type safety and editor autocomplete!
985
985
  *
986
986
  * import { init } from "@sidekickdb/core"
987
- * import schema from ""../instant.schema.ts";
987
+ * import schema from ""../sidekick.schema.ts";
988
988
  *
989
989
  * const db = init({
990
990
  * appId: "my-app-id",
@@ -995,19 +995,19 @@ function schemaChanged(
995
995
  * // To learn more: https://sidekickdb.co/docs/modeling-data
996
996
  */
997
997
  function init<
998
- Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,
998
+ Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema,
999
999
  UseDates extends boolean = false,
1000
1000
  >(
1001
1001
  // Allows config with missing `useDateObjects`, but keeps `UseDates`
1002
- // as a non-nullable in the InstantConfig type.
1003
- config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
1002
+ // as a non-nullable in the SidekickConfig type.
1003
+ config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {
1004
1004
  useDateObjects?: UseDates;
1005
1005
  },
1006
1006
  Store?: any,
1007
1007
  NetworkListener?: any,
1008
1008
  versions?: { [key: string]: string },
1009
1009
  EventSourceImpl?: any,
1010
- ): InstantCoreDatabase<Schema, UseDates> {
1010
+ ): SidekickCoreDatabase<Schema, UseDates> {
1011
1011
  const apiURI = requireApiURI(config.apiURI, { target: 'init()' });
1012
1012
  const configStrict = {
1013
1013
  ...config,
@@ -1016,9 +1016,9 @@ function init<
1016
1016
  websocketURI: config.websocketURI || websocketURIFromApiURI(apiURI),
1017
1017
  useDateObjects: (config.useDateObjects ?? false) as UseDates,
1018
1018
  };
1019
- const existingClient = globalInstantCoreStore[
1019
+ const existingClient = globalSidekickCoreStore[
1020
1020
  reactorKey(configStrict)
1021
- ] as InstantCoreDatabase<any, UseDates>;
1021
+ ] as SidekickCoreDatabase<any, UseDates>;
1022
1022
 
1023
1023
  if (existingClient) {
1024
1024
  if (schemaChanged(existingClient, configStrict.schema)) {
@@ -1034,12 +1034,12 @@ function init<
1034
1034
  },
1035
1035
  Store || IndexedDBStorage,
1036
1036
  NetworkListener || WindowNetworkListener,
1037
- { ...(versions || {}), '@instantdb/core': version },
1037
+ { ...(versions || {}), '@sidekickdb/core': version },
1038
1038
  EventSourceImpl,
1039
1039
  );
1040
1040
 
1041
- const client = new InstantCoreDatabase<any, UseDates>(reactor);
1042
- globalInstantCoreStore[reactorKey(configStrict)] = client;
1041
+ const client = new SidekickCoreDatabase<any, UseDates>(reactor);
1042
+ globalSidekickCoreStore[reactorKey(configStrict)] = client;
1043
1043
 
1044
1044
  handleDevtool(configStrict.appId, configStrict.devtool);
1045
1045
 
@@ -1108,10 +1108,10 @@ export {
1108
1108
  Reactor,
1109
1109
 
1110
1110
  // error
1111
- InstantAPIError,
1111
+ SidekickAPIError,
1112
1112
 
1113
1113
  // warnings
1114
- setInstantWarningsEnabled,
1114
+ setSidekickWarningsEnabled,
1115
1115
 
1116
1116
  // cli
1117
1117
  i,
@@ -1123,12 +1123,12 @@ export {
1123
1123
  coerceToDate,
1124
1124
  IndexedDBStorage,
1125
1125
  WindowNetworkListener,
1126
- InstantCoreDatabase,
1126
+ SidekickCoreDatabase,
1127
1127
  Auth,
1128
1128
  Storage,
1129
1129
  Streams,
1130
1130
  version,
1131
- InstantError,
1131
+ SidekickError,
1132
1132
  MissingApiURIError,
1133
1133
  requireApiURI,
1134
1134
  websocketURIFromApiURI,
@@ -1144,9 +1144,9 @@ export {
1144
1144
  type RoomSchemaShape,
1145
1145
  type Query,
1146
1146
  type QueryResponse,
1147
- type InstaQLResponse,
1147
+ type SideQLResponse,
1148
1148
  type PageInfoResponse,
1149
- type InstantObject,
1149
+ type SidekickObject,
1150
1150
  type Exactly,
1151
1151
  type TransactionChunk,
1152
1152
  type AuthState,
@@ -1156,9 +1156,9 @@ export {
1156
1156
  type AuthToken,
1157
1157
  type TxChunk,
1158
1158
  type SubscriptionState,
1159
- type InstaQLSubscriptionState,
1159
+ type SideQLSubscriptionState,
1160
1160
  type LifecycleSubscriptionState,
1161
- type InstaQLLifecycleState,
1161
+ type SideQLLifecycleState,
1162
1162
 
1163
1163
  // presence types
1164
1164
  type PresenceOpts,
@@ -1167,19 +1167,19 @@ export {
1167
1167
  type PresencePeer,
1168
1168
 
1169
1169
  // new query types
1170
- type InstaQLParams,
1170
+ type SideQLParams,
1171
1171
  type ValidQuery,
1172
1172
  type Cursor,
1173
- type InstaQLOptions,
1174
- type InstaQLQueryParams,
1175
- type InstantQuery,
1176
- type InstantQueryResult,
1177
- type InstantSchema,
1178
- type InstantEntity,
1179
- type InstantSchemaDatabase,
1180
- type InstaQLFields,
1173
+ type SideQLOptions,
1174
+ type SideQLQueryParams,
1175
+ type SidekickQuery,
1176
+ type SidekickQueryResult,
1177
+ type SidekickSchema,
1178
+ type SidekickEntity,
1179
+ type SidekickSchemaDatabase,
1180
+ type SideQLFields,
1181
1181
  type Order,
1182
- type InstaQLQueryEntityResult,
1182
+ type SideQLQueryEntityResult,
1183
1183
  type InfiniteQueryCallbackResponse,
1184
1184
  type InfiniteQuerySubscription,
1185
1185
 
@@ -1188,11 +1188,11 @@ export {
1188
1188
  type CardinalityKind,
1189
1189
  type DataAttrDef,
1190
1190
  type EntitiesDef,
1191
- type InstantUnknownSchemaDef,
1191
+ type SidekickUnknownSchemaDef,
1192
1192
  type EntitiesWithLinks,
1193
1193
  type EntityDef,
1194
1194
  type RoomsDef,
1195
- type InstantGraph,
1195
+ type SidekickGraph,
1196
1196
  type LinkAttrDef,
1197
1197
  type LinkDef,
1198
1198
  type LinksDef,
@@ -1202,25 +1202,25 @@ export {
1202
1202
  type PresenceOf,
1203
1203
  type TopicsOf,
1204
1204
  type TopicOf,
1205
- type InstaQLEntity,
1206
- type InstaQLResult,
1207
- type InstaQLEntitySubquery,
1208
- type InstantSchemaDef,
1209
- type InstantUnknownSchema,
1210
- type IInstantDatabase,
1205
+ type SideQLEntity,
1206
+ type SideQLResult,
1207
+ type SideQLEntitySubquery,
1208
+ type SidekickSchemaDef,
1209
+ type SidekickUnknownSchema,
1210
+ type ISidekickDatabase,
1211
1211
  type BackwardsCompatibleSchema,
1212
- type InstantRules,
1212
+ type SidekickRules,
1213
1213
  type UpdateParams,
1214
1214
  type LinkParams,
1215
1215
  type CreateParams,
1216
1216
  type RuleParams,
1217
1217
 
1218
1218
  // attr types
1219
- type InstantDBAttr,
1220
- type InstantDBAttrOnDelete,
1221
- type InstantDBCheckedDataType,
1222
- type InstantDBIdent,
1223
- type InstantDBInferredType,
1219
+ type SidekickDBAttr,
1220
+ type SidekickDBAttrOnDelete,
1221
+ type SidekickDBCheckedDataType,
1222
+ type SidekickDBIdent,
1223
+ type SidekickDBInferredType,
1224
1224
 
1225
1225
  // auth types
1226
1226
  type CheckMagicCodeParams,
@@ -1245,13 +1245,13 @@ export {
1245
1245
  type EventSourceConstructor,
1246
1246
 
1247
1247
  // streams
1248
- InstantStream,
1248
+ SidekickStream,
1249
1249
  type WritableStreamCtor,
1250
1250
  type ReadableStreamCtor,
1251
1251
  type CreateReadStreamOpts,
1252
1252
  type CreateWriteStreamOpts,
1253
- type InstantWritableStream,
1254
- type InstantReadableStream,
1253
+ type SidekickWritableStream,
1254
+ type SidekickReadableStream,
1255
1255
 
1256
1256
  // sync table types
1257
1257
  type SyncTableCallback,
@@ -1263,16 +1263,16 @@ export {
1263
1263
  type SyncTableSetupError,
1264
1264
 
1265
1265
  // error types
1266
- type InstantIssue,
1266
+ type SidekickIssue,
1267
1267
 
1268
1268
  // store (e.g. indexeddb) interface
1269
1269
  StoreInterface,
1270
1270
  type StoreInterfaceClass,
1271
1271
  type StoreInterfaceStoreName,
1272
- createInstantRouteHandler,
1273
- type InstantRouteHandlerPayloadByType,
1274
- type InstantRouteHandlerType,
1275
- type InstantRouteHandlerBody,
1272
+ createSidekickRouteHandler,
1273
+ type SidekickRouteHandlerPayloadByType,
1274
+ type SidekickRouteHandlerType,
1275
+ type SidekickRouteHandlerBody,
1276
1276
  type Logger,
1277
1277
  };
1278
1278