@instantdb/core 0.22.90-experimental.drewh-ssr.20320632959.1 → 0.22.90-experimental.trim-env-vars.20311878601.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 (56) hide show
  1. package/dist/commonjs/Reactor.d.ts +1 -13
  2. package/dist/commonjs/Reactor.d.ts.map +1 -1
  3. package/dist/commonjs/Reactor.js +5 -69
  4. package/dist/commonjs/Reactor.js.map +1 -1
  5. package/dist/commonjs/index.d.ts +1 -5
  6. package/dist/commonjs/index.d.ts.map +1 -1
  7. package/dist/commonjs/index.js +2 -8
  8. package/dist/commonjs/index.js.map +1 -1
  9. package/dist/commonjs/reactorTypes.d.ts +4 -5
  10. package/dist/commonjs/reactorTypes.d.ts.map +1 -1
  11. package/dist/commonjs/reactorTypes.js.map +1 -1
  12. package/dist/esm/Reactor.d.ts +1 -13
  13. package/dist/esm/Reactor.d.ts.map +1 -1
  14. package/dist/esm/Reactor.js +5 -69
  15. package/dist/esm/Reactor.js.map +1 -1
  16. package/dist/esm/index.d.ts +1 -5
  17. package/dist/esm/index.d.ts.map +1 -1
  18. package/dist/esm/index.js +3 -6
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/reactorTypes.d.ts +4 -5
  21. package/dist/esm/reactorTypes.d.ts.map +1 -1
  22. package/dist/esm/reactorTypes.js.map +1 -1
  23. package/dist/standalone/index.js +2377 -2696
  24. package/dist/standalone/index.umd.cjs +3 -3
  25. package/package.json +2 -2
  26. package/src/Reactor.js +6 -84
  27. package/src/index.ts +1 -9
  28. package/src/reactorTypes.ts +4 -5
  29. package/__tests__/src/serializeSchema.test.ts +0 -123
  30. package/dist/commonjs/createRouteHandler.d.ts +0 -8
  31. package/dist/commonjs/createRouteHandler.d.ts.map +0 -1
  32. package/dist/commonjs/createRouteHandler.js +0 -57
  33. package/dist/commonjs/createRouteHandler.js.map +0 -1
  34. package/dist/commonjs/framework.d.ts +0 -77
  35. package/dist/commonjs/framework.d.ts.map +0 -1
  36. package/dist/commonjs/framework.js +0 -210
  37. package/dist/commonjs/framework.js.map +0 -1
  38. package/dist/commonjs/parseSchemaFromJSON.d.ts +0 -3
  39. package/dist/commonjs/parseSchemaFromJSON.d.ts.map +0 -1
  40. package/dist/commonjs/parseSchemaFromJSON.js +0 -148
  41. package/dist/commonjs/parseSchemaFromJSON.js.map +0 -1
  42. package/dist/esm/createRouteHandler.d.ts +0 -8
  43. package/dist/esm/createRouteHandler.d.ts.map +0 -1
  44. package/dist/esm/createRouteHandler.js +0 -53
  45. package/dist/esm/createRouteHandler.js.map +0 -1
  46. package/dist/esm/framework.d.ts +0 -77
  47. package/dist/esm/framework.d.ts.map +0 -1
  48. package/dist/esm/framework.js +0 -170
  49. package/dist/esm/framework.js.map +0 -1
  50. package/dist/esm/parseSchemaFromJSON.d.ts +0 -3
  51. package/dist/esm/parseSchemaFromJSON.d.ts.map +0 -1
  52. package/dist/esm/parseSchemaFromJSON.js +0 -144
  53. package/dist/esm/parseSchemaFromJSON.js.map +0 -1
  54. package/src/createRouteHandler.ts +0 -44
  55. package/src/framework.ts +0 -295
  56. 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.90-experimental.drewh-ssr.20320632959.1",
3
+ "version": "0.22.90-experimental.trim-env-vars.20311878601.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.90-experimental.drewh-ssr.20320632959.1"
56
+ "@instantdb/version": "0.22.90-experimental.trim-env-vars.20311878601.1"
57
57
  },
58
58
  "scripts": {
59
59
  "test": "vitest",
package/src/Reactor.js CHANGED
@@ -348,17 +348,7 @@ export default class Reactor {
348
348
  this._oauthCallbackResponse = this._oauthLoginInit();
349
349
 
350
350
  // kick off a request to cache it
351
- this.getCurrentUser().then((userInfo) => {
352
- this.syncUserToEndpoint(userInfo.user);
353
- });
354
-
355
- setInterval(
356
- async () => {
357
- const currentUser = await this.getCurrentUser();
358
- this.syncUserToEndpoint(currentUser.user);
359
- },
360
- 1000 * 60 * 20,
361
- );
351
+ this.getCurrentUser();
362
352
 
363
353
  NetworkListener.getIsOnline().then((isOnline) => {
364
354
  this._isOnline = isOnline;
@@ -559,43 +549,6 @@ export default class Reactor {
559
549
  }
560
550
  }
561
551
 
562
- /**
563
- * Does the same thing as add-query-ok
564
- * but called as a result of receiving query info from ssr
565
- * @param {any} q
566
- * @param {{ triples: any; pageInfo: any; }} result
567
- * @param {boolean} enableCardinalityInference
568
- */
569
- _addQueryData(q, result, enableCardinalityInference) {
570
- if (!this.attrs) {
571
- throw new Error('Attrs in reactor have not been set');
572
- }
573
- const queryHash = weakHash(q);
574
- const attrsStore = this.ensureAttrs();
575
- const store = s.createStore(
576
- this.attrs,
577
- result.triples,
578
- enableCardinalityInference,
579
- this.config.useDateObjects,
580
- );
581
- this.querySubs.updateInPlace((prev) => {
582
- prev[queryHash] = {
583
- result: {
584
- store,
585
- attrsStore,
586
- pageInfo: result.pageInfo,
587
- processedTxId: undefined,
588
- isExternal: true,
589
- },
590
- q,
591
- };
592
- });
593
- this._cleanupPendingMutationsQueries();
594
- this.notifyOne(queryHash);
595
- this.notifyOneQueryOnce(queryHash);
596
- this._cleanupPendingMutationsTimeout();
597
- }
598
-
599
552
  _handleReceive(connId, msg) {
600
553
  // opt-out, enabled by default if schema
601
554
  const enableCardinalityInference =
@@ -1268,7 +1221,7 @@ export default class Reactor {
1268
1221
  }
1269
1222
 
1270
1223
  /** Runs instaql on a query and a store */
1271
- dataForQuery(hash, applyOptimistic = true) {
1224
+ dataForQuery(hash) {
1272
1225
  const errorMessage = this._errorMessage;
1273
1226
  if (errorMessage) {
1274
1227
  return { error: errorMessage };
@@ -1292,26 +1245,15 @@ export default class Reactor {
1292
1245
  return cached;
1293
1246
  }
1294
1247
 
1295
- let store = result.store;
1296
- let attrsStore = result.attrsStore;
1297
- const { pageInfo, aggregate, processedTxId } = result;
1248
+ const { store, attrsStore, pageInfo, aggregate, processedTxId } = result;
1298
1249
  const mutations = this._rewriteMutationsSorted(
1299
1250
  attrsStore,
1300
1251
  pendingMutations,
1301
1252
  );
1302
- if (applyOptimistic) {
1303
- const optimisticResult = this._applyOptimisticUpdates(
1304
- store,
1305
- attrsStore,
1306
- mutations,
1307
- processedTxId,
1308
- );
1309
-
1310
- store = optimisticResult.store;
1311
- attrsStore = optimisticResult.attrsStore;
1312
- }
1253
+ const { store: newStore, attrsStore: newAttrsStore } =
1254
+ this._applyOptimisticUpdates(store, attrsStore, mutations, processedTxId);
1313
1255
  const resp = instaql(
1314
- { store: store, attrsStore: attrsStore, pageInfo, aggregate },
1256
+ { store: newStore, attrsStore: newAttrsStore, pageInfo, aggregate },
1315
1257
  q,
1316
1258
  );
1317
1259
 
@@ -2047,27 +1989,7 @@ export default class Reactor {
2047
1989
  }
2048
1990
  }
2049
1991
 
2050
- async syncUserToEndpoint(user) {
2051
- if (this.config.cookieEndpoint) {
2052
- try {
2053
- fetch(this.config.cookieEndpoint + '/sync-auth', {
2054
- method: 'POST',
2055
- body: JSON.stringify({
2056
- user: user,
2057
- }),
2058
- headers: {
2059
- 'Content-Type': 'application/json',
2060
- },
2061
- });
2062
- } catch (error) {
2063
- console.error('Error syncing user with external endpoint', error);
2064
- }
2065
- }
2066
- }
2067
-
2068
1992
  updateUser(newUser) {
2069
- this.syncUserToEndpoint(newUser);
2070
-
2071
1993
  const newV = { error: undefined, user: newUser };
2072
1994
  this._currentUserCached = { isLoading: false, ...newV };
2073
1995
  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;
@@ -818,6 +813,7 @@ function init<
818
813
  ): InstantCoreDatabase<Schema, UseDates> {
819
814
  const configStrict = {
820
815
  ...config,
816
+ appId: config.appId.trim(),
821
817
  useDateObjects: (config.useDateObjects ?? false) as UseDates,
822
818
  };
823
819
  const existingClient = globalInstantCoreStore[
@@ -907,9 +903,7 @@ export {
907
903
  validateQuery,
908
904
  QueryValidationError,
909
905
  validateTransactions,
910
- parseSchemaFromJSON,
911
906
  TransactionValidationError,
912
- FrameworkClient,
913
907
 
914
908
  // error
915
909
  InstantAPIError,
@@ -1025,7 +1019,6 @@ export {
1025
1019
 
1026
1020
  // SSE
1027
1021
  type EventSourceType,
1028
- type FrameworkConfig,
1029
1022
 
1030
1023
  // sync table types
1031
1024
  type SyncTableCallback,
@@ -1042,5 +1035,4 @@ export {
1042
1035
  // storage (e.g. indexeddb) interface
1043
1036
  StorageInterface,
1044
1037
  type StorageInterfaceStoreName,
1045
- createInstantRouteHandler,
1046
1038
  };
@@ -6,13 +6,12 @@ export type QuerySubResult = {
6
6
  attrsStore: AttrsStore;
7
7
  pageInfo?: PageInfoResponse<any> | null | undefined;
8
8
  aggregate?: any;
9
- processedTxId?: number;
10
- isExternal?: boolean;
9
+ processedTxId: number;
11
10
  };
12
11
 
13
12
  export type QuerySub = {
14
13
  q: Object;
15
- eventId?: string;
14
+ eventId: string;
16
15
  lastAccessed?: number | null | undefined;
17
16
  result?: QuerySubResult;
18
17
  };
@@ -22,12 +21,12 @@ export type QuerySubResultInStorage = {
22
21
  attrsStore: AttrsStoreJson;
23
22
  pageInfo?: PageInfoResponse<any> | null | undefined;
24
23
  aggregate?: any;
25
- processedTxId?: number;
24
+ processedTxId: number;
26
25
  };
27
26
 
28
27
  export type QuerySubInStorage = {
29
28
  q: Object;
30
- eventId?: string;
29
+ eventId: string;
31
30
  lastAccessed?: number | null | undefined;
32
31
  result?: QuerySubResultInStorage;
33
32
  };
@@ -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;AAG9C,eAAO,MAA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