@instantdb/core 0.22.88-experimental.drewh-ssr.20248787082.1 → 0.22.88-experimental.drewh-entity-caching.20248787059.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/__tests__/src/instaql.bench.js +80 -2
  2. package/__tests__/src/instaqlCache.test.ts +78 -0
  3. package/dist/commonjs/Reactor.d.ts +1 -13
  4. package/dist/commonjs/Reactor.d.ts.map +1 -1
  5. package/dist/commonjs/Reactor.js +5 -64
  6. package/dist/commonjs/Reactor.js.map +1 -1
  7. package/dist/commonjs/index.d.ts +1 -5
  8. package/dist/commonjs/index.d.ts.map +1 -1
  9. package/dist/commonjs/index.js +1 -7
  10. package/dist/commonjs/index.js.map +1 -1
  11. package/dist/commonjs/store.d.ts +1 -1
  12. package/dist/commonjs/store.d.ts.map +1 -1
  13. package/dist/commonjs/store.js +5 -0
  14. package/dist/commonjs/store.js.map +1 -1
  15. package/dist/esm/Reactor.d.ts +1 -13
  16. package/dist/esm/Reactor.d.ts.map +1 -1
  17. package/dist/esm/Reactor.js +5 -64
  18. package/dist/esm/Reactor.js.map +1 -1
  19. package/dist/esm/index.d.ts +1 -5
  20. package/dist/esm/index.d.ts.map +1 -1
  21. package/dist/esm/index.js +2 -5
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/store.d.ts +1 -1
  24. package/dist/esm/store.d.ts.map +1 -1
  25. package/dist/esm/store.js +5 -0
  26. package/dist/esm/store.js.map +1 -1
  27. package/dist/standalone/index.js +1107 -1404
  28. package/dist/standalone/index.umd.cjs +3 -3
  29. package/package.json +2 -2
  30. package/src/Reactor.js +9 -74
  31. package/src/index.ts +0 -9
  32. package/src/store.ts +6 -0
  33. package/__tests__/src/serializeSchema.test.ts +0 -123
  34. package/dist/commonjs/createRouteHandler.d.ts +0 -8
  35. package/dist/commonjs/createRouteHandler.d.ts.map +0 -1
  36. package/dist/commonjs/createRouteHandler.js +0 -57
  37. package/dist/commonjs/createRouteHandler.js.map +0 -1
  38. package/dist/commonjs/framework.d.ts +0 -77
  39. package/dist/commonjs/framework.d.ts.map +0 -1
  40. package/dist/commonjs/framework.js +0 -199
  41. package/dist/commonjs/framework.js.map +0 -1
  42. package/dist/commonjs/parseSchemaFromJSON.d.ts +0 -3
  43. package/dist/commonjs/parseSchemaFromJSON.d.ts.map +0 -1
  44. package/dist/commonjs/parseSchemaFromJSON.js +0 -148
  45. package/dist/commonjs/parseSchemaFromJSON.js.map +0 -1
  46. package/dist/esm/createRouteHandler.d.ts +0 -8
  47. package/dist/esm/createRouteHandler.d.ts.map +0 -1
  48. package/dist/esm/createRouteHandler.js +0 -53
  49. package/dist/esm/createRouteHandler.js.map +0 -1
  50. package/dist/esm/framework.d.ts +0 -77
  51. package/dist/esm/framework.d.ts.map +0 -1
  52. package/dist/esm/framework.js +0 -159
  53. package/dist/esm/framework.js.map +0 -1
  54. package/dist/esm/parseSchemaFromJSON.d.ts +0 -3
  55. package/dist/esm/parseSchemaFromJSON.d.ts.map +0 -1
  56. package/dist/esm/parseSchemaFromJSON.js +0 -144
  57. package/dist/esm/parseSchemaFromJSON.js.map +0 -1
  58. package/src/createRouteHandler.ts +0 -44
  59. package/src/framework.ts +0 -281
  60. package/src/parseSchemaFromJSON.ts +0 -176
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instantdb/core",
3
- "version": "0.22.88-experimental.drewh-ssr.20248787082.1",
3
+ "version": "0.22.88-experimental.drewh-entity-caching.20248787059.1",
4
4
  "description": "Instant's core local abstraction",
5
5
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/core",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "mutative": "^1.0.10",
55
55
  "uuid": "^11.1.0",
56
- "@instantdb/version": "0.22.88-experimental.drewh-ssr.20248787082.1"
56
+ "@instantdb/version": "0.22.88-experimental.drewh-entity-caching.20248787059.1"
57
57
  },
58
58
  "scripts": {
59
59
  "test": "vitest",
package/src/Reactor.js CHANGED
@@ -319,17 +319,7 @@ export default class Reactor {
319
319
  this._oauthCallbackResponse = this._oauthLoginInit();
320
320
 
321
321
  // kick off a request to cache it
322
- this.getCurrentUser().then((userInfo) => {
323
- this.syncUserToEndpoint(userInfo.user);
324
- });
325
-
326
- setInterval(
327
- async () => {
328
- const currentUser = await this.getCurrentUser();
329
- this.syncUserToEndpoint(currentUser.user);
330
- },
331
- 1000 * 60 * 20,
332
- );
322
+ this.getCurrentUser();
333
323
 
334
324
  NetworkListener.getIsOnline().then((isOnline) => {
335
325
  this._isOnline = isOnline;
@@ -523,42 +513,6 @@ export default class Reactor {
523
513
  }
524
514
  }
525
515
 
526
- /**
527
- * Does the same thing as add-query-ok
528
- * but called as a result of receiving query info from ssr
529
- * @param {any} q
530
- * @param {{ triples: any; pageInfo: any; }} result
531
- * @param {boolean} enableCardinalityInference
532
- */
533
- _addQueryData(q, result, enableCardinalityInference) {
534
- if (!this.attrs) {
535
- throw new Error('Attrs in reactor have not been set');
536
- }
537
- const queryHash = weakHash(q);
538
- const store = s.createStore(
539
- this.attrs,
540
- result.triples,
541
- enableCardinalityInference,
542
- this._linkIndex,
543
- this.config.useDateObjects,
544
- );
545
- this.querySubs.updateInPlace((prev) => {
546
- prev[queryHash] = {
547
- result: {
548
- store,
549
- pageInfo: result.pageInfo,
550
- processedTxId: undefined,
551
- isExternal: true,
552
- },
553
- q,
554
- };
555
- });
556
- this._cleanupPendingMutationsQueries();
557
- this.notifyOne(queryHash);
558
- this.notifyOneQueryOnce(queryHash);
559
- this._cleanupPendingMutationsTimeout();
560
- }
561
-
562
516
  _handleReceive(connId, msg) {
563
517
  // opt-out, enabled by default if schema
564
518
  const enableCardinalityInference =
@@ -1192,7 +1146,7 @@ export default class Reactor {
1192
1146
  }
1193
1147
 
1194
1148
  /** Runs instaql on a query and a store */
1195
- dataForQuery(hash, applyOptimistic = true) {
1149
+ dataForQuery(hash) {
1196
1150
  const errorMessage = this._errorMessage;
1197
1151
  if (errorMessage) {
1198
1152
  return { error: errorMessage };
@@ -1216,16 +1170,17 @@ export default class Reactor {
1216
1170
  return cached;
1217
1171
  }
1218
1172
 
1219
- let store = result.store;
1220
- const { pageInfo, aggregate, processedTxId } = result;
1173
+ const { store, pageInfo, aggregate, processedTxId } = result;
1221
1174
  const mutations = this._rewriteMutationsSorted(
1222
1175
  store.attrs,
1223
1176
  pendingMutations,
1224
1177
  );
1225
- if (applyOptimistic) {
1226
- store = this._applyOptimisticUpdates(store, mutations, processedTxId);
1227
- }
1228
- const resp = instaql({ store: store, pageInfo, aggregate }, q);
1178
+ const newStore = this._applyOptimisticUpdates(
1179
+ store,
1180
+ mutations,
1181
+ processedTxId,
1182
+ );
1183
+ const resp = instaql({ store: newStore, pageInfo, aggregate }, q);
1229
1184
 
1230
1185
  return { data: resp, querySubVersion, pendingMutationsVersion };
1231
1186
  }
@@ -1957,27 +1912,7 @@ export default class Reactor {
1957
1912
  }
1958
1913
  }
1959
1914
 
1960
- async syncUserToEndpoint(user) {
1961
- if (this.config.cookieEndpoint) {
1962
- try {
1963
- fetch(this.config.cookieEndpoint + '/sync-auth', {
1964
- method: 'POST',
1965
- body: JSON.stringify({
1966
- user: user,
1967
- }),
1968
- headers: {
1969
- 'Content-Type': 'application/json',
1970
- },
1971
- });
1972
- } catch (error) {
1973
- console.error('Error syncing user with external endpoint', error);
1974
- }
1975
- }
1976
- }
1977
-
1978
1915
  updateUser(newUser) {
1979
- this.syncUserToEndpoint(newUser);
1980
-
1981
1916
  const newV = { error: undefined, user: newUser };
1982
1917
  this._currentUserCached = { isLoading: false, ...newV };
1983
1918
  this._dataForQueryCache = {};
package/src/index.ts CHANGED
@@ -20,13 +20,10 @@ import {
20
20
  validateTransactions,
21
21
  TransactionValidationError,
22
22
  } from './transactionValidation.ts';
23
-
24
23
  import {
25
24
  StorageInterface,
26
25
  type StorageInterfaceStoreName,
27
26
  } from './utils/PersistedObject.ts';
28
- import { createInstantRouteHandler } from './createRouteHandler.ts';
29
- import { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';
30
27
 
31
28
  import type {
32
29
  PresenceOpts,
@@ -106,7 +103,6 @@ import type {
106
103
  } from './schemaTypes.ts';
107
104
  import type { InstantRules } from './rulesTypes.ts';
108
105
  import type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';
109
- import { FrameworkClient, type FrameworkConfig } from './framework.ts';
110
106
 
111
107
  import type {
112
108
  ExchangeCodeForTokenParams,
@@ -157,7 +153,6 @@ export type InstantConfig<
157
153
  appId: string;
158
154
  schema?: S;
159
155
  websocketURI?: string;
160
- cookieEndpoint?: string;
161
156
  apiURI?: string;
162
157
  devtool?: boolean | DevtoolConfig;
163
158
  verbose?: boolean;
@@ -907,9 +902,7 @@ export {
907
902
  validateQuery,
908
903
  QueryValidationError,
909
904
  validateTransactions,
910
- parseSchemaFromJSON,
911
905
  TransactionValidationError,
912
- FrameworkClient,
913
906
 
914
907
  // error
915
908
  InstantAPIError,
@@ -1025,7 +1018,6 @@ export {
1025
1018
 
1026
1019
  // SSE
1027
1020
  type EventSourceType,
1028
- type FrameworkConfig,
1029
1021
 
1030
1022
  // sync table types
1031
1023
  type SyncTableCallback,
@@ -1042,5 +1034,4 @@ export {
1042
1034
  // storage (e.g. indexeddb) interface
1043
1035
  StorageInterface,
1044
1036
  type StorageInterfaceStoreName,
1045
- createInstantRouteHandler,
1046
1037
  };
package/src/store.ts CHANGED
@@ -677,11 +677,16 @@ export function getTriples(store, [e, a, v]) {
677
677
  }
678
678
  }
679
679
 
680
+ const cache = {};
681
+
680
682
  export function getAsObject(
681
683
  store: Store,
682
684
  attrs: Map<string, InstantDBAttr> | undefined,
683
685
  e: string,
684
686
  ) {
687
+ if (cache[e]) {
688
+ return cache[e];
689
+ }
685
690
  const obj = {};
686
691
 
687
692
  if (!attrs) {
@@ -695,6 +700,7 @@ export function getAsObject(
695
700
  obj[label] = triple[2];
696
701
  }
697
702
  }
703
+ cache[e] = obj;
698
704
 
699
705
  return obj;
700
706
  }
@@ -1,123 +0,0 @@
1
- import { expect, test } from 'vitest';
2
- import { i } from '../../src/schema';
3
- import { parseSchemaFromJSON } from '../../src/parseSchemaFromJSON';
4
- import { InstantSchemaDef } from '../../src/schemaTypes';
5
-
6
- const schema = i.schema({
7
- entities: {
8
- users: i.entity({
9
- name: i.string(),
10
- email: i.string().indexed().unique(),
11
- bio: i.string().optional(),
12
- // this is a convenient way to typecheck custom JSON fields
13
- // though we should probably have a backend solution for this
14
- stuff: i.json<{ custom: string }>(),
15
- junk: i.any(),
16
- }),
17
- posts: i.entity({
18
- title: i.string().optional(),
19
- body: i.string(),
20
- }),
21
- comments: i.entity({
22
- body: i.string().indexed(),
23
- likes: i.number(),
24
- }),
25
-
26
- birthdays: i.entity({
27
- date: i.date(),
28
- message: i.string(),
29
- prizes: i.json<string | number>(),
30
- }),
31
- },
32
- links: {
33
- usersPosts: {
34
- forward: {
35
- on: 'users',
36
- has: 'many',
37
- label: 'posts',
38
- },
39
- reverse: {
40
- on: 'posts',
41
- has: 'one',
42
- label: 'author',
43
- },
44
- },
45
- postsComments: {
46
- forward: {
47
- on: 'posts',
48
- has: 'many',
49
- label: 'comments',
50
- },
51
- reverse: {
52
- on: 'comments',
53
- has: 'one',
54
- label: 'post',
55
- },
56
- },
57
- friendships: {
58
- forward: {
59
- on: 'users',
60
- has: 'many',
61
- label: 'friends',
62
- },
63
- reverse: {
64
- on: 'users',
65
- has: 'many',
66
- label: '_friends',
67
- },
68
- },
69
- referrals: {
70
- forward: {
71
- on: 'users',
72
- has: 'many',
73
- label: 'referred',
74
- },
75
- reverse: {
76
- on: 'users',
77
- has: 'one',
78
- label: 'referrer',
79
- },
80
- },
81
- },
82
- rooms: {
83
- chat: {
84
- presence: i.entity({
85
- name: i.string(),
86
- status: i.string(),
87
- }),
88
- topics: {
89
- sendEmoji: i.entity({
90
- emoji: i.string(),
91
- }),
92
- },
93
- },
94
- },
95
- });
96
-
97
- type AnySchema = InstantSchemaDef<any, any, any>;
98
-
99
- // compare schemas by stringifying them with json and comparing the strings
100
- const compareSchemas = (schema1: AnySchema, schema2: AnySchema) => {
101
- expect(JSON.stringify(schema1, null, 2)).toBe(
102
- JSON.stringify(schema2, null, 2),
103
- );
104
- };
105
-
106
- test('ability to parse stringified schema into real schema object', () => {
107
- const stringified = JSON.stringify(schema, null, 2);
108
- const parsed = JSON.parse(stringified);
109
- console.log(stringified);
110
-
111
- const otherSide = parseSchemaFromJSON(parsed);
112
-
113
- compareSchemas(schema, otherSide);
114
-
115
- expect(schema.entities.comments.links).toEqual(
116
- otherSide.entities.comments.links,
117
- );
118
- expect(schema.entities.comments.asType).toEqual(
119
- otherSide.entities.comments.asType,
120
- );
121
-
122
- expect(schema).toStrictEqual(otherSide);
123
- });
@@ -1,8 +0,0 @@
1
- export declare const createInstantRouteHandler: (config: {
2
- appId: string;
3
- apiURI?: string;
4
- }) => {
5
- GET: (_req: Request) => Promise<Response>;
6
- POST: (req: Request) => Promise<Response>;
7
- };
8
- //# sourceMappingURL=createRouteHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRouteHandler.d.ts","sourceRoot":"","sources":["../../src/createRouteHandler.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,GAAI,QAAQ;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;gBAqBqB,OAAO;gBAMP,OAAO;CAa5B,CAAC"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createInstantRouteHandler = void 0;
13
- const createInstantRouteHandler = (config) => {
14
- function handleUserSync(req) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const body = yield req.json();
17
- if (body.user && body.user.refresh_token) {
18
- return new Response('sync', {
19
- headers: {
20
- // 7 day expiry
21
- 'Set-Cookie': `instant_user=${JSON.stringify(body.user)}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=604800`,
22
- },
23
- });
24
- }
25
- else {
26
- return new Response('sync', {
27
- headers: {
28
- // remove the cookie (some browsers)
29
- 'Set-Cookie': `instant_user=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=-1`,
30
- },
31
- });
32
- }
33
- });
34
- }
35
- return {
36
- GET: (_req) => __awaiter(void 0, void 0, void 0, function* () {
37
- return new Response('Method not allowed', {
38
- status: 405,
39
- statusText: 'Method Not Allowed',
40
- });
41
- }),
42
- POST: (req) => __awaiter(void 0, void 0, void 0, function* () {
43
- const url = new URL(req.url);
44
- const pathname = url.pathname;
45
- const route = pathname.split('/')[pathname.split('/').length - 1];
46
- switch (route) {
47
- case 'sync-auth':
48
- return yield handleUserSync(req);
49
- }
50
- return new Response('Route not found', {
51
- status: 404,
52
- });
53
- }),
54
- };
55
- };
56
- exports.createInstantRouteHandler = createInstantRouteHandler;
57
- //# sourceMappingURL=createRouteHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRouteHandler.js","sourceRoot":"","sources":["../../src/createRouteHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAO,MAAM,yBAAyB,GAAG,CAAC,MAGzC,EAAE,EAAE;IACH,SAAe,cAAc,CAAC,GAAY;;YACxC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;gBACzC,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE;oBAC1B,OAAO,EAAE;wBACP,eAAe;wBACf,YAAY,EAAE,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,6DAA6D;qBACrH;iBACF,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE;oBAC1B,OAAO,EAAE;wBACP,oCAAoC;wBACpC,YAAY,EAAE,sEAAsE;qBACrF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;IAED,OAAO;QACL,GAAG,EAAE,CAAO,IAAa,EAAE,EAAE;YAC3B,OAAO,IAAI,QAAQ,CAAC,oBAAoB,EAAE;gBACxC,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,oBAAoB;aACjC,CAAC,CAAC;QACL,CAAC,CAAA;QACD,IAAI,EAAE,CAAO,GAAY,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;YAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClE,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,WAAW;oBACd,OAAO,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,IAAI,QAAQ,CAAC,iBAAiB,EAAE;gBACrC,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CAAC;AA3CW,QAAA,yBAAyB,6BA2CpC","sourcesContent":["export const createInstantRouteHandler = (config: {\n appId: string;\n apiURI?: string;\n}) => {\n async function handleUserSync(req: Request) {\n const body = await req.json();\n if (body.user && body.user.refresh_token) {\n return new Response('sync', {\n headers: {\n // 7 day expiry\n 'Set-Cookie': `instant_user=${JSON.stringify(body.user)}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=604800`,\n },\n });\n } else {\n return new Response('sync', {\n headers: {\n // remove the cookie (some browsers)\n 'Set-Cookie': `instant_user=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=-1`,\n },\n });\n }\n }\n\n return {\n GET: async (_req: Request) => {\n return new Response('Method not allowed', {\n status: 405,\n statusText: 'Method Not Allowed',\n });\n },\n POST: async (req: Request) => {\n const url = new URL(req.url);\n const pathname = url.pathname;\n const route = pathname.split('/')[pathname.split('/').length - 1];\n switch (route) {\n case 'sync-auth':\n return await handleUserSync(req);\n }\n return new Response('Route not found', {\n status: 404,\n });\n },\n };\n};\n"]}
@@ -1,77 +0,0 @@
1
- import { InstantCoreDatabase, InstantDBAttr } from './index.ts';
2
- import { RuleParams } from './schemaTypes.ts';
3
- export declare const isServer: boolean;
4
- export type FrameworkConfig = {
5
- token?: string | null;
6
- db: InstantCoreDatabase<any, any>;
7
- };
8
- type QueryPromise = {
9
- type: 'http';
10
- triples: any;
11
- attrs: any;
12
- queryHash: any;
13
- query: any;
14
- pageInfo?: any;
15
- } | {
16
- type: 'session';
17
- queryResult: any;
18
- };
19
- export declare class FrameworkClient {
20
- private params;
21
- private db;
22
- resultMap: Map<string, {
23
- status: 'pending' | 'success' | 'error';
24
- type: 'http' | 'session';
25
- promise?: Promise<QueryPromise> | null;
26
- data?: any;
27
- error?: any;
28
- }>;
29
- private queryResolvedCallbacks;
30
- constructor(params: FrameworkConfig);
31
- subscribe: (callback: (result: {
32
- triples: any;
33
- attrs: any;
34
- queryHash: string;
35
- pageInfo?: any;
36
- }) => void) => void;
37
- addQueryResult: (queryKey: string, value: any) => void;
38
- query: (_query: any, opts?: {
39
- ruleParams: RuleParams;
40
- }) => {
41
- type: "http" | "session";
42
- status: "pending" | "success" | "error";
43
- promise?: Promise<QueryPromise>;
44
- data?: any;
45
- error?: any;
46
- };
47
- getExistingResultForQuery: (_query: any, opts?: {
48
- ruleParams: RuleParams;
49
- }) => {
50
- status: "pending" | "success" | "error";
51
- type: "http" | "session";
52
- promise?: Promise<QueryPromise> | null;
53
- data?: any;
54
- error?: any;
55
- } | undefined;
56
- completeIsomorphic: (query: any, triples: any[], attrs: InstantDBAttr[], pageInfo?: any) => {
57
- data: any;
58
- pageInfo?: any;
59
- aggregate?: any;
60
- };
61
- hashQuery: (_query: any, opts?: {
62
- ruleParams: RuleParams;
63
- }) => {
64
- hash: string;
65
- query: any;
66
- };
67
- getTriplesAndAttrsForQuery: (query: any) => Promise<{
68
- triples: any[];
69
- attrs: InstantDBAttr[];
70
- query: any;
71
- queryHash: string;
72
- type: "http";
73
- pageInfo?: any;
74
- }>;
75
- }
76
- export {};
77
- //# sourceMappingURL=framework.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../src/framework.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,aAAa,EAEd,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,QAAQ,SAAwD,CAAC;AAE9E,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,EAAE,EAAE,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,YAAY,GACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB,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