@instantdb/core 0.22.96-experimental.add-posthog-frontend.20386914944.1 → 0.22.96
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.
- package/__tests__/src/serializeSchema.test.ts +123 -0
- package/dist/commonjs/Reactor.d.ts +13 -1
- package/dist/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +72 -5
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/SyncTable.d.ts.map +1 -1
- package/dist/commonjs/SyncTable.js +7 -6
- package/dist/commonjs/SyncTable.js.map +1 -1
- package/dist/commonjs/createRouteHandler.d.ts +8 -0
- package/dist/commonjs/createRouteHandler.d.ts.map +1 -0
- package/dist/commonjs/createRouteHandler.js +66 -0
- package/dist/commonjs/createRouteHandler.js.map +1 -0
- package/dist/commonjs/framework.d.ts +77 -0
- package/dist/commonjs/framework.d.ts.map +1 -0
- package/dist/commonjs/framework.js +228 -0
- package/dist/commonjs/framework.js.map +1 -0
- package/dist/commonjs/index.d.ts +5 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +7 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/parseSchemaFromJSON.d.ts +3 -0
- package/dist/commonjs/parseSchemaFromJSON.d.ts.map +1 -0
- package/dist/commonjs/parseSchemaFromJSON.js +148 -0
- package/dist/commonjs/parseSchemaFromJSON.js.map +1 -0
- package/dist/commonjs/reactorTypes.d.ts +5 -4
- package/dist/commonjs/reactorTypes.d.ts.map +1 -1
- package/dist/commonjs/reactorTypes.js.map +1 -1
- package/dist/esm/Reactor.d.ts +13 -1
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +72 -5
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/SyncTable.d.ts.map +1 -1
- package/dist/esm/SyncTable.js +7 -6
- package/dist/esm/SyncTable.js.map +1 -1
- package/dist/esm/createRouteHandler.d.ts +8 -0
- package/dist/esm/createRouteHandler.d.ts.map +1 -0
- package/dist/esm/createRouteHandler.js +62 -0
- package/dist/esm/createRouteHandler.js.map +1 -0
- package/dist/esm/framework.d.ts +77 -0
- package/dist/esm/framework.d.ts.map +1 -0
- package/dist/esm/framework.js +188 -0
- package/dist/esm/framework.js.map +1 -0
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/parseSchemaFromJSON.d.ts +3 -0
- package/dist/esm/parseSchemaFromJSON.d.ts.map +1 -0
- package/dist/esm/parseSchemaFromJSON.js +144 -0
- package/dist/esm/parseSchemaFromJSON.js.map +1 -0
- package/dist/esm/reactorTypes.d.ts +5 -4
- package/dist/esm/reactorTypes.d.ts.map +1 -1
- package/dist/esm/reactorTypes.js.map +1 -1
- package/dist/standalone/index.js +2735 -2400
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Reactor.js +83 -6
- package/src/SyncTable.ts +18 -14
- package/src/createRouteHandler.ts +63 -0
- package/src/framework.ts +318 -0
- package/src/index.ts +9 -0
- package/src/parseSchemaFromJSON.ts +176 -0
- package/src/reactorTypes.ts +5 -4
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.FrameworkClient = exports.isServer = void 0;
|
|
49
|
+
// The FrameworkClient class is a mini version of a query store that allows making queries on both the frontend and backend
|
|
50
|
+
// you can register queries, await their results and serialize them over a server/client boundary.
|
|
51
|
+
// The class is generic so that it can be a good starting off point to make other ssr adapters.
|
|
52
|
+
const index_ts_1 = require("./index.js");
|
|
53
|
+
const s = __importStar(require("./store.js"));
|
|
54
|
+
const instaql_js_1 = __importDefault(require("./instaql.js"));
|
|
55
|
+
const linkIndex_ts_1 = require("./utils/linkIndex.js");
|
|
56
|
+
exports.isServer = typeof window === 'undefined' || 'Deno' in globalThis;
|
|
57
|
+
class FrameworkClient {
|
|
58
|
+
constructor(params) {
|
|
59
|
+
// stores all of the query promises so that ssr can read them
|
|
60
|
+
// and send the relevant results alongside the html that resulted in the query resolving
|
|
61
|
+
this.resultMap = new Map();
|
|
62
|
+
this.queryResolvedCallbacks = [];
|
|
63
|
+
this.subscribe = (callback) => {
|
|
64
|
+
this.queryResolvedCallbacks.push(callback);
|
|
65
|
+
};
|
|
66
|
+
// Runs on the client when ssr gets html script tags
|
|
67
|
+
this.addQueryResult = (queryKey, value) => {
|
|
68
|
+
this.resultMap.set(queryKey, {
|
|
69
|
+
type: value.type,
|
|
70
|
+
status: 'success',
|
|
71
|
+
data: value,
|
|
72
|
+
promise: null,
|
|
73
|
+
error: null,
|
|
74
|
+
});
|
|
75
|
+
// send the result to the client
|
|
76
|
+
if (!exports.isServer) {
|
|
77
|
+
// make sure the attrs are there to create stores
|
|
78
|
+
if (!this.db._reactor.attrs) {
|
|
79
|
+
this.db._reactor._setAttrs(value.attrs);
|
|
80
|
+
}
|
|
81
|
+
this.db._reactor._addQueryData(value.query, value, !!this.db._reactor.config.schema);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
// creates an entry in the results map
|
|
85
|
+
// and returns the same thing added to the map
|
|
86
|
+
this.query = (_query, opts) => {
|
|
87
|
+
const { hash, query } = this.hashQuery(_query, opts);
|
|
88
|
+
if (this.db._reactor.status === 'authenticated') {
|
|
89
|
+
const promise = this.db.queryOnce(_query, opts);
|
|
90
|
+
let entry = {
|
|
91
|
+
status: 'pending',
|
|
92
|
+
type: 'session',
|
|
93
|
+
data: undefined,
|
|
94
|
+
error: undefined,
|
|
95
|
+
promise: promise,
|
|
96
|
+
};
|
|
97
|
+
promise.then((result) => {
|
|
98
|
+
entry.status = 'success';
|
|
99
|
+
entry.data = result;
|
|
100
|
+
entry.promise = null;
|
|
101
|
+
});
|
|
102
|
+
promise.catch((error) => {
|
|
103
|
+
entry.status = 'error';
|
|
104
|
+
entry.error = error;
|
|
105
|
+
entry.promise = null;
|
|
106
|
+
});
|
|
107
|
+
this.resultMap.set(hash, entry);
|
|
108
|
+
return entry;
|
|
109
|
+
}
|
|
110
|
+
const promise = this.getTriplesAndAttrsForQuery(query);
|
|
111
|
+
let entry = {
|
|
112
|
+
status: 'pending',
|
|
113
|
+
type: 'http',
|
|
114
|
+
data: undefined,
|
|
115
|
+
error: undefined,
|
|
116
|
+
promise: promise,
|
|
117
|
+
};
|
|
118
|
+
promise.then((result) => {
|
|
119
|
+
entry.status = 'success';
|
|
120
|
+
entry.data = result;
|
|
121
|
+
entry.promise = null;
|
|
122
|
+
});
|
|
123
|
+
promise.catch((error) => {
|
|
124
|
+
entry.status = 'error';
|
|
125
|
+
entry.error = error;
|
|
126
|
+
entry.promise = null;
|
|
127
|
+
});
|
|
128
|
+
promise.then((result) => {
|
|
129
|
+
this.queryResolvedCallbacks.forEach((callback) => {
|
|
130
|
+
callback({
|
|
131
|
+
queryHash: hash,
|
|
132
|
+
query: query,
|
|
133
|
+
attrs: result.attrs,
|
|
134
|
+
triples: result.triples,
|
|
135
|
+
pageInfo: result.pageInfo,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
this.resultMap.set(hash, entry);
|
|
140
|
+
return entry;
|
|
141
|
+
};
|
|
142
|
+
this.getExistingResultForQuery = (_query, opts) => {
|
|
143
|
+
const { hash } = this.hashQuery(_query, opts);
|
|
144
|
+
return this.resultMap.get(hash);
|
|
145
|
+
};
|
|
146
|
+
// creates a query result from a set of triples, query, and attrs
|
|
147
|
+
// can be run server side or client side
|
|
148
|
+
this.completeIsomorphic = (query, triples, attrs, pageInfo) => {
|
|
149
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
150
|
+
const attrMap = {};
|
|
151
|
+
attrs.forEach((attr) => {
|
|
152
|
+
attrMap[attr.id] = attr;
|
|
153
|
+
});
|
|
154
|
+
const enableCardinalityInference = Boolean((_c = (_b = (_a = this.db) === null || _a === void 0 ? void 0 : _a._reactor) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.schema) &&
|
|
155
|
+
('cardinalityInference' in ((_e = (_d = this.db) === null || _d === void 0 ? void 0 : _d._reactor) === null || _e === void 0 ? void 0 : _e.config)
|
|
156
|
+
? Boolean((_g = (_f = this.db) === null || _f === void 0 ? void 0 : _f._reactor.config) === null || _g === void 0 ? void 0 : _g.cardinalityInference)
|
|
157
|
+
: true);
|
|
158
|
+
const attrsStore = new s.AttrsStoreClass(attrs.reduce((acc, attr) => {
|
|
159
|
+
acc[attr.id] = attr;
|
|
160
|
+
return acc;
|
|
161
|
+
}, {}), (0, linkIndex_ts_1.createLinkIndex)((_h = this.db) === null || _h === void 0 ? void 0 : _h._reactor.config.schema));
|
|
162
|
+
const store = s.createStore(attrsStore, triples, enableCardinalityInference, this.params.db._reactor.config.useDateObjects || false);
|
|
163
|
+
const resp = (0, instaql_js_1.default)({
|
|
164
|
+
store: store,
|
|
165
|
+
attrsStore: attrsStore,
|
|
166
|
+
pageInfo: pageInfo,
|
|
167
|
+
aggregate: undefined,
|
|
168
|
+
}, query);
|
|
169
|
+
return resp;
|
|
170
|
+
};
|
|
171
|
+
this.hashQuery = (_query, opts) => {
|
|
172
|
+
if (_query && opts && 'ruleParams' in opts) {
|
|
173
|
+
_query = Object.assign({ $$ruleParams: opts['ruleParams'] }, _query);
|
|
174
|
+
}
|
|
175
|
+
const query = _query ? (0, index_ts_1.coerceQuery)(_query) : null;
|
|
176
|
+
return { hash: (0, index_ts_1.weakHash)(query), query: query };
|
|
177
|
+
};
|
|
178
|
+
// Run by the server to get triples and attrs
|
|
179
|
+
this.getTriplesAndAttrsForQuery = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
var _a, _b, _c, _d, _e, _f;
|
|
181
|
+
try {
|
|
182
|
+
const response = yield fetch(`${this.db._reactor.config.apiURI}/runtime/framework/query`, {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
headers: {
|
|
185
|
+
'app-id': this.params.db._reactor.config.appId,
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
Authorization: this.params.token
|
|
188
|
+
? `Bearer ${this.params.token}`
|
|
189
|
+
: undefined,
|
|
190
|
+
},
|
|
191
|
+
body: JSON.stringify({
|
|
192
|
+
query: query,
|
|
193
|
+
}),
|
|
194
|
+
});
|
|
195
|
+
if (!response.ok) {
|
|
196
|
+
throw new Error('Error getting triples from server');
|
|
197
|
+
}
|
|
198
|
+
const data = yield response.json();
|
|
199
|
+
const attrs = data === null || data === void 0 ? void 0 : data.attrs;
|
|
200
|
+
if (!attrs) {
|
|
201
|
+
throw new Error('No attrs');
|
|
202
|
+
}
|
|
203
|
+
// TODO: make safer
|
|
204
|
+
const triples = (_c = (_b = (_a = data.result) === null || _a === void 0 ? void 0 : _a[0].data) === null || _b === void 0 ? void 0 : _b['datalog-result']) === null || _c === void 0 ? void 0 : _c['join-rows'][0];
|
|
205
|
+
const pageInfo = (_f = (_e = (_d = data.result) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f['page-info'];
|
|
206
|
+
return {
|
|
207
|
+
attrs,
|
|
208
|
+
triples,
|
|
209
|
+
type: 'http',
|
|
210
|
+
queryHash: this.hashQuery(query).hash,
|
|
211
|
+
query,
|
|
212
|
+
pageInfo,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
const errWithMessage = new Error('Error getting triples from framework client');
|
|
217
|
+
// @ts-expect-error pre es2022
|
|
218
|
+
errWithMessage.cause = err;
|
|
219
|
+
throw errWithMessage;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
this.params = params;
|
|
223
|
+
this.db = params.db;
|
|
224
|
+
this.resultMap = new Map();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.FrameworkClient = FrameworkClient;
|
|
228
|
+
//# sourceMappingURL=framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.js","sourceRoot":"","sources":["../../src/framework.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2HAA2H;AAC3H,kGAAkG;AAClG,+FAA+F;AAC/F,yCAKoB;AACpB,8CAAgC;AAChC,8DAAmC;AAEnC,uDAAuD;AAE1C,QAAA,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,IAAI,UAAU,CAAC;AAuB9E,MAAa,eAAe;IAyB1B,YAAY,MAAuB;QArBnC,6DAA6D;QAC7D,wFAAwF;QACjF,cAAS,GASZ,IAAI,GAAG,EAAE,CAAC;QAEN,2BAAsB,GAMd,EAAE,CAAC;QAiBZ,cAAS,GAAG,CACjB,QAKU,EACV,EAAE;YACF,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC,CAAC;QAEF,oDAAoD;QAC7C,mBAAc,GAAG,CAAC,QAAgB,EAAE,KAAU,EAAE,EAAE;YACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE;gBAC3B,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC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B,6CAA6C,CAC9C,CAAC;gBACF,8BAA8B;gBAC9B,cAAc,CAAC,KAAK,GAAG,GAAG,CAAC;gBAC3B,MAAM,cAAc,CAAC;YACvB,CAAC;QACH,CAAC,CAAA,CAAC;QA7PA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EASrB,CAAC;IACN,CAAC;CAkPF;AAxRD,0CAwRC","sourcesContent":["// The FrameworkClient class is a mini version of a query store that allows making queries on both the frontend and backend\n// you can register queries, await their results and serialize them over a server/client boundary.\n// The class is generic so that it can be a good starting off point to make other ssr adapters.\nimport {\n coerceQuery,\n InstantCoreDatabase,\n InstantDBAttr,\n weakHash,\n} from './index.ts';\nimport * as s from './store.js';\nimport instaql from './instaql.js';\nimport { RuleParams } from './schemaTypes.ts';\nimport { createLinkIndex } from './utils/linkIndex.ts';\n\nexport const isServer = typeof window === 'undefined' || 'Deno' in globalThis;\n\nexport type FrameworkConfig = {\n token?: string | null;\n db: InstantCoreDatabase<any, any>;\n};\n\n// represents an eventual result from running a query\n// either via ssr or by using the existing websocket connection.\ntype QueryPromise =\n | {\n type: 'http';\n triples: any;\n attrs: any;\n queryHash: any;\n query: any;\n pageInfo?: any;\n }\n | {\n type: 'session';\n queryResult: any;\n };\n\nexport class FrameworkClient {\n private params: FrameworkConfig;\n private db: InstantCoreDatabase<any, any>;\n\n // stores all of the query promises so that ssr can read them\n // and send the relevant results alongside the html that resulted in the query resolving\n public resultMap: Map<\n string,\n {\n status: 'pending' | 'success' | 'error';\n type: 'http' | 'session';\n promise?: Promise<QueryPromise> | null;\n data?: any;\n error?: any;\n }\n > = new Map();\n\n private queryResolvedCallbacks: ((result: {\n triples: any;\n attrs: any;\n queryHash: any;\n query: any;\n pageInfo?: any;\n }) => void)[] = [];\n\n constructor(params: FrameworkConfig) {\n this.params = params;\n this.db = params.db;\n this.resultMap = new Map<\n string,\n {\n type: 'http' | 'session';\n status: 'pending' | 'success' | 'error';\n promise?: Promise<QueryPromise>;\n data?: any;\n error?: any;\n }\n >();\n }\n\n public subscribe = (\n callback: (result: {\n triples: any;\n attrs: any;\n queryHash: string;\n pageInfo?: any;\n }) => void,\n ) => {\n this.queryResolvedCallbacks.push(callback);\n };\n\n // Runs on the client when ssr gets html script tags\n public addQueryResult = (queryKey: string, value: any) => {\n this.resultMap.set(queryKey, {\n type: value.type,\n status: 'success',\n data: value,\n promise: null,\n error: null,\n });\n // send the result to the client\n if (!isServer) {\n // make sure the attrs are there to create stores\n if (!this.db._reactor.attrs) {\n this.db._reactor._setAttrs(value.attrs);\n }\n this.db._reactor._addQueryData(\n value.query,\n value,\n !!this.db._reactor.config.schema,\n );\n }\n };\n\n // creates an entry in the results map\n // and returns the same thing added to the map\n public query = (\n _query: any,\n opts?: {\n ruleParams: RuleParams;\n },\n ): {\n type: 'http' | 'session';\n status: 'pending' | 'success' | 'error';\n promise?: Promise<QueryPromise>;\n data?: any;\n error?: any;\n } => {\n const { hash, query } = this.hashQuery(_query, opts);\n\n if (this.db._reactor.status === 'authenticated') {\n const promise = this.db.queryOnce(_query, opts);\n let entry = {\n status: 'pending' as 'pending' | 'success' | 'error',\n type: 'session' as 'http' | 'session',\n data: undefined as any,\n error: undefined as any,\n promise: promise as any,\n };\n promise.then((result) => {\n entry.status = 'success';\n entry.data = result;\n entry.promise = null;\n });\n promise.catch((error) => {\n entry.status = 'error';\n entry.error = error;\n entry.promise = null;\n });\n this.resultMap.set(hash, entry);\n return entry as any;\n }\n\n const promise = this.getTriplesAndAttrsForQuery(query);\n let entry = {\n status: 'pending' as 'pending' | 'success' | 'error',\n type: 'http' as 'http' | 'session',\n data: undefined as any,\n error: undefined as any,\n promise: promise as any,\n };\n\n promise.then((result) => {\n entry.status = 'success';\n entry.data = result;\n entry.promise = null;\n });\n promise.catch((error) => {\n entry.status = 'error';\n entry.error = error;\n entry.promise = null;\n });\n\n promise.then((result) => {\n this.queryResolvedCallbacks.forEach((callback) => {\n callback({\n queryHash: hash,\n query: query,\n attrs: result.attrs,\n triples: result.triples,\n pageInfo: result.pageInfo,\n });\n });\n });\n\n this.resultMap.set(hash, entry);\n return entry;\n };\n\n public getExistingResultForQuery = (\n _query: any,\n opts?: {\n ruleParams: RuleParams;\n },\n ) => {\n const { hash } = this.hashQuery(_query, opts);\n return this.resultMap.get(hash);\n };\n\n // creates a query result from a set of triples, query, and attrs\n // can be run server side or client side\n public completeIsomorphic = (\n query: any,\n triples: any[],\n attrs: InstantDBAttr[],\n pageInfo?: any,\n ) => {\n const attrMap = {};\n attrs.forEach((attr) => {\n attrMap[attr.id] = attr;\n });\n\n const enableCardinalityInference =\n Boolean(this.db?._reactor?.config?.schema) &&\n ('cardinalityInference' in this.db?._reactor?.config\n ? Boolean(this.db?._reactor.config?.cardinalityInference)\n : true);\n\n const attrsStore = new s.AttrsStoreClass(\n attrs.reduce((acc, attr) => {\n acc[attr.id] = attr;\n return acc;\n }, {}),\n createLinkIndex(this.db?._reactor.config.schema),\n );\n\n const store = s.createStore(\n attrsStore,\n triples,\n enableCardinalityInference,\n this.params.db._reactor.config.useDateObjects || false,\n );\n const resp = instaql(\n {\n store: store,\n attrsStore: attrsStore,\n pageInfo: pageInfo,\n aggregate: undefined,\n },\n query,\n );\n return resp;\n };\n\n public hashQuery = (\n _query: any,\n opts?: {\n ruleParams: RuleParams;\n },\n ): { hash: string; query: any } => {\n if (_query && opts && 'ruleParams' in opts) {\n _query = { $$ruleParams: opts['ruleParams'], ..._query };\n }\n const query = _query ? coerceQuery(_query) : null;\n return { hash: weakHash(query), query: query };\n };\n\n // Run by the server to get triples and attrs\n public getTriplesAndAttrsForQuery = async (\n query: any,\n ): Promise<{\n triples: any[];\n attrs: InstantDBAttr[];\n query: any;\n queryHash: string;\n type: 'http';\n pageInfo?: any;\n }> => {\n try {\n const response = await fetch(\n `${this.db._reactor.config.apiURI}/runtime/framework/query`,\n {\n method: 'POST',\n headers: {\n 'app-id': this.params.db._reactor.config.appId,\n 'Content-Type': 'application/json',\n Authorization: this.params.token\n ? `Bearer ${this.params.token}`\n : undefined,\n } as Record<string, string>,\n body: JSON.stringify({\n query: query,\n }),\n },\n );\n\n if (!response.ok) {\n throw new Error('Error getting triples from server');\n }\n\n const data = await response.json();\n\n const attrs = data?.attrs;\n if (!attrs) {\n throw new Error('No attrs');\n }\n\n // TODO: make safer\n const triples =\n data.result?.[0].data?.['datalog-result']?.['join-rows'][0];\n\n const pageInfo = data.result?.[0]?.data?.['page-info'];\n\n return {\n attrs,\n triples,\n type: 'http',\n queryHash: this.hashQuery(query).hash,\n query,\n pageInfo,\n };\n } catch (err: any) {\n const errWithMessage = new Error(\n 'Error getting triples from framework client',\n );\n // @ts-expect-error pre es2022\n errWithMessage.cause = err;\n throw errWithMessage;\n }\n };\n}\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import version from './version.ts';
|
|
|
10
10
|
import { validateQuery, QueryValidationError } from './queryValidation.ts';
|
|
11
11
|
import { validateTransactions, TransactionValidationError } from './transactionValidation.ts';
|
|
12
12
|
import { StorageInterface, type StorageInterfaceStoreName } from './utils/PersistedObject.ts';
|
|
13
|
+
import { createInstantRouteHandler } from './createRouteHandler.ts';
|
|
14
|
+
import { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';
|
|
13
15
|
import type { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from './presence.ts';
|
|
14
16
|
import type { DevtoolConfig, IDatabase, IInstantDatabase } from './coreTypes.ts';
|
|
15
17
|
import type { Query, QueryResponse, InstaQLResponse, PageInfoResponse, Exactly, InstantObject, InstaQLParams, InstaQLOptions, InstaQLQueryParams, InstaQLEntity, InstaQLEntitySubquery, InstaQLResult, InstaQLFields, ValidQuery } from './queryTypes.ts';
|
|
@@ -20,6 +22,7 @@ import type { InstantDBAttr, InstantDBAttrOnDelete, InstantDBCheckedDataType, In
|
|
|
20
22
|
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';
|
|
21
23
|
import type { InstantRules } from './rulesTypes.ts';
|
|
22
24
|
import type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';
|
|
25
|
+
import { FrameworkClient, type FrameworkConfig } from './framework.ts';
|
|
23
26
|
import type { ExchangeCodeForTokenParams, SendMagicCodeParams, SendMagicCodeResponse, SignInWithIdTokenParams, VerifyMagicCodeParams, VerifyResponse } from './authAPI.ts';
|
|
24
27
|
import { InstantAPIError, type InstantIssue } from './utils/fetch.js';
|
|
25
28
|
import { InstantError } from './InstantError.ts';
|
|
@@ -43,6 +46,7 @@ export type InstantConfig<S extends InstantSchemaDef<any, any, any>, UseDates ex
|
|
|
43
46
|
appId: string;
|
|
44
47
|
schema?: S;
|
|
45
48
|
websocketURI?: string;
|
|
49
|
+
firstPartyPath?: string;
|
|
46
50
|
apiURI?: string;
|
|
47
51
|
devtool?: boolean | DevtoolConfig;
|
|
48
52
|
verbose?: boolean;
|
|
@@ -482,5 +486,5 @@ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUn
|
|
|
482
486
|
* const db = init({ ... });
|
|
483
487
|
*/
|
|
484
488
|
declare const init_experimental: typeof init;
|
|
485
|
-
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, TransactionValidationError, InstantAPIError, i, getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError, SyncTableCallbackEventType, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, 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 InstaQLOptions, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type InstaQLFields, 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 ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type EventSourceType, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, StorageInterface, type StorageInterfaceStoreName, };
|
|
489
|
+
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, parseSchemaFromJSON, TransactionValidationError, FrameworkClient, InstantAPIError, i, getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError, SyncTableCallbackEventType, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, 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 InstaQLOptions, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type InstaQLFields, 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 ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type EventSourceType, type FrameworkConfig, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, StorageInterface, type StorageInterfaceStoreName, createInstantRouteHandler, };
|
|
486
490
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,EAAE,EACF,MAAM,EACN,MAAM,EACN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3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StorageInterface = exports.SyncTableCallbackEventType = exports.InstantError = exports.version = exports.Storage = exports.Auth = exports.InstantCoreDatabase = exports.WindowNetworkListener = exports.IndexedDBStorage = exports.coerceToDate = exports.weakHash = exports.getOps = exports.i = exports.InstantAPIError = exports.TransactionValidationError = exports.validateTransactions = exports.QueryValidationError = exports.validateQuery = exports.lookup = exports.txInit = exports.tx = exports.id = exports.init_experimental = void 0;
|
|
6
|
+
exports.createInstantRouteHandler = exports.StorageInterface = exports.SyncTableCallbackEventType = exports.InstantError = exports.version = exports.Storage = exports.Auth = exports.InstantCoreDatabase = exports.WindowNetworkListener = exports.IndexedDBStorage = exports.coerceToDate = exports.weakHash = exports.getOps = exports.i = exports.InstantAPIError = exports.FrameworkClient = exports.TransactionValidationError = exports.parseSchemaFromJSON = exports.validateTransactions = exports.QueryValidationError = exports.validateQuery = exports.lookup = exports.txInit = exports.tx = exports.id = exports.init_experimental = void 0;
|
|
7
7
|
exports.init = init;
|
|
8
8
|
exports.coerceQuery = coerceQuery;
|
|
9
9
|
const Reactor_js_1 = __importDefault(require("./Reactor.js"));
|
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "validateTransactions", { enumerable: true, get:
|
|
|
35
35
|
Object.defineProperty(exports, "TransactionValidationError", { enumerable: true, get: function () { return transactionValidation_ts_1.TransactionValidationError; } });
|
|
36
36
|
const PersistedObject_ts_1 = require("./utils/PersistedObject.js");
|
|
37
37
|
Object.defineProperty(exports, "StorageInterface", { enumerable: true, get: function () { return PersistedObject_ts_1.StorageInterface; } });
|
|
38
|
+
const createRouteHandler_ts_1 = require("./createRouteHandler.js");
|
|
39
|
+
Object.defineProperty(exports, "createInstantRouteHandler", { enumerable: true, get: function () { return createRouteHandler_ts_1.createInstantRouteHandler; } });
|
|
40
|
+
const parseSchemaFromJSON_ts_1 = require("./parseSchemaFromJSON.js");
|
|
41
|
+
Object.defineProperty(exports, "parseSchemaFromJSON", { enumerable: true, get: function () { return parseSchemaFromJSON_ts_1.parseSchemaFromJSON; } });
|
|
42
|
+
const framework_ts_1 = require("./framework.js");
|
|
43
|
+
Object.defineProperty(exports, "FrameworkClient", { enumerable: true, get: function () { return framework_ts_1.FrameworkClient; } });
|
|
38
44
|
const fetch_js_1 = require("./utils/fetch.js");
|
|
39
45
|
Object.defineProperty(exports, "InstantAPIError", { enumerable: true, get: function () { return fetch_js_1.InstantAPIError; } });
|
|
40
46
|
const InstantError_ts_1 = require("./InstantError.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAg4BE,oBAAI;AAmBJ,kCAAW;AAn5Bb,8DAAmC;AACnC,6CAOsB;AA23BpB,mFAj4BA,eAAE,OAi4BA;AACF,uFAj4BA,mBAAM,OAi4BA;AACN,uFAj4BA,mBAAM,OAi4BA;AAaN,uFA74BA,mBAAM,OA64BA;AAz4BR,sEAA2C;AA24BzC,mBA34BK,qBAAQ,CA24BL;AA14BV,0DAA+B;AAw3B7B,aAx3BK,eAAE,CAw3BL;AAv3BJ,gFAAqD;AA24BnD,2BA34BK,6BAAgB,CA24BL;AA14BlB,+CAAgD;AAy4B9C,6FAz4BO,uBAAY,OAy4BP;AAx4Bd,0FAA+D;AA04B7D,gCA14BK,kCAAqB,CA04BL;AAz4BvB,2CAAgC;AAi4B9B,kFAj4BO,aAAC,OAi4BP;AAh4BH,6CAA6C;AAC7C,8DAAmC;AA24BjC,kBA34BK,oBAAO,CA24BL;AA14BT,6DAA2E;AAq3BzE,8FAr3BO,kCAAa,OAq3BP;AACb,qGAt3BsB,yCAAoB,OAs3BtB;AAr3BtB,yEAGoC;AAm3BlC,qGAr3BA,+CAAoB,OAq3BA;AACp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;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAK7B,8CAAiB","sourcesContent":["import Reactor from './Reactor.js';\nimport {\n tx,\n txInit,\n lookup,\n getOps,\n type TxChunk,\n type TransactionChunk,\n} from './instatx.js';\nimport weakHash from './utils/weakHash.js';\nimport id from './utils/id.ts';\nimport IndexedDBStorage from './IndexedDBStorage.ts';\nimport { coerceToDate } from './utils/dates.js';\nimport WindowNetworkListener from './WindowNetworkListener.js';\nimport { i } from './schema.js';\nimport { createDevtool } from './devtool.js';\nimport version from './version.ts';\nimport { validateQuery, QueryValidationError } from './queryValidation.ts';\nimport {\n validateTransactions,\n TransactionValidationError,\n} from './transactionValidation.ts';\nimport {\n StorageInterface,\n type StorageInterfaceStoreName,\n} from './utils/PersistedObject.ts';\n\nimport type {\n PresenceOpts,\n PresenceResponse,\n PresenceSlice,\n RoomSchemaShape,\n} from './presence.ts';\nimport type {\n DevtoolConfig,\n IDatabase,\n IInstantDatabase,\n StrictDevtoolConfig,\n} from './coreTypes.ts';\nimport type {\n Query,\n QueryResponse,\n InstaQLResponse,\n PageInfoResponse,\n Exactly,\n InstantObject,\n InstaQLParams,\n InstaQLOptions,\n InstaQLQueryParams,\n InstaQLEntity,\n InstaQLEntitySubquery,\n InstaQLResult,\n InstaQLFields,\n ValidQuery,\n} from './queryTypes.ts';\nimport type { PresencePeer } from './presenceTypes.ts';\nimport type {\n AuthState,\n User,\n AuthResult,\n ConnectionStatus,\n} from './clientTypes.ts';\nimport type {\n InstantQuery,\n InstantQueryResult,\n InstantSchema,\n InstantEntity,\n InstantSchemaDatabase,\n} from './helperTypes.ts';\nimport type {\n InstantDBAttr,\n InstantDBAttrOnDelete,\n InstantDBCheckedDataType,\n InstantDBIdent,\n InstantDBInferredType,\n} from './attrTypes.ts';\nimport type {\n AttrsDefs,\n CardinalityKind,\n DataAttrDef,\n EntitiesDef,\n EntitiesWithLinks,\n EntityDef,\n RoomsDef,\n InstantSchemaDef,\n InstantGraph,\n LinkAttrDef,\n LinkDef,\n LinksDef,\n PresenceOf,\n ResolveAttrs,\n RoomsOf,\n TopicsOf,\n TopicOf,\n ValueTypes,\n InstantUnknownSchema,\n InstantUnknownSchemaDef,\n BackwardsCompatibleSchema,\n UpdateParams,\n LinkParams,\n CreateParams,\n RuleParams,\n} from './schemaTypes.ts';\nimport type { InstantRules } from './rulesTypes.ts';\nimport type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';\n\nimport type {\n ExchangeCodeForTokenParams,\n SendMagicCodeParams,\n SendMagicCodeResponse,\n SignInWithIdTokenParams,\n VerifyMagicCodeParams,\n VerifyResponse,\n} from './authAPI.ts';\n\nimport { InstantAPIError, type InstantIssue } from './utils/fetch.js';\nimport { InstantError } from './InstantError.ts';\nimport { EventSourceType } from './Connection.ts';\nimport { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';\nimport type {\n SyncTableCallback,\n CallbackEvent as SyncTableCallbackEvent,\n InitialSyncBatch as SyncTableInitialSyncBatch,\n InitialSyncComplete as SyncTableInitialSyncComplete,\n SyncTransaction as SyncTableSyncTransaction,\n LoadFromStorage as SyncTableLoadFromStorage,\n SetupError as SyncTableSetupError,\n} from './SyncTable.ts';\n\nconst defaultOpenDevtool = true;\n\n// types\n\ntype ExactlyOne<T> = {\n [K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;\n}[keyof T];\n\nexport type Config = {\n appId: string;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: boolean;\n disableValidation?: boolean;\n};\n\nexport type InstantConfig<\n S extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> = {\n appId: string;\n schema?: S;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: UseDates;\n disableValidation?: boolean;\n};\n\nexport type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {\n schema: S;\n};\n\nexport type TransactionResult = {\n status: 'synced' | 'enqueued';\n clientId: string;\n};\n\nexport type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(\n topic: Key,\n data: TopicsByKey[Key],\n) => void;\n\nexport type SubscribeTopic<PresenceShape, TopicsByKey> = <\n Key extends keyof TopicsByKey,\n>(\n topic: Key,\n onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void,\n) => () => void;\n\nexport type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(\n opts: PresenceOpts<PresenceShape, Keys>,\n) => PresenceResponse<PresenceShape, Keys> | null;\n\nexport type SubscribePresence<PresenceShape> = <\n Keys extends keyof PresenceShape,\n>(\n opts: PresenceOpts<PresenceShape, Keys>,\n onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void,\n) => () => void;\n\nexport type RoomHandle<PresenceShape, TopicsByKey> = {\n leaveRoom: () => void;\n publishTopic: PublishTopic<TopicsByKey>;\n subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;\n publishPresence: (data: Partial<PresenceShape>) => void;\n getPresence: GetPresence<PresenceShape>;\n subscribePresence: SubscribePresence<PresenceShape>;\n};\n\ntype AuthToken = string;\n\ntype SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: QueryResponse<Q, Schema, WithCardinalityInference>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype LifecycleSubscriptionState<\n Q,\n Schema,\n WithCardinalityInference extends boolean,\n> = SubscriptionState<Q, Schema, WithCardinalityInference> & {\n isLoading: boolean;\n};\n\ntype InstaQLLifecycleState<Schema, Q, UseDates extends boolean = false> =\n | (InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n })\n | {\n isLoading: true;\n data: undefined;\n pageInfo: undefined;\n error: undefined;\n };\n\ntype UnsubscribeFn = () => void;\n\n// consts\n\nconst defaultConfig = {\n apiURI: 'https://api.instantdb.com',\n websocketURI: 'wss://api.instantdb.com/runtime/session',\n};\n\n// hmr\nfunction initSchemaHashStore(): WeakMap<any, string> {\n globalThis.__instantDbSchemaHashStore =\n globalThis.__instantDbSchemaHashStore ?? new WeakMap<any, string>();\n return globalThis.__instantDbSchemaHashStore;\n}\n\nfunction initGlobalInstantCoreStore(): Record<string, any> {\n globalThis.__instantDbStore = globalThis.__instantDbStore ?? {};\n return globalThis.__instantDbStore;\n}\n\nfunction reactorKey(config: InstantConfig<any, boolean>): string {\n // @ts-expect-error\n const adminToken = config.__adminToken;\n return (\n config.appId +\n '_' +\n (config.websocketURI || 'default_ws_uri') +\n '_' +\n (config.apiURI || 'default_api_uri') +\n '_' +\n (adminToken || 'client_only') +\n '_' +\n config.useDateObjects\n );\n}\n\nconst globalInstantCoreStore = initGlobalInstantCoreStore();\nconst schemaHashStore = initSchemaHashStore();\n\ntype SignoutOpts = {\n invalidateToken?: boolean;\n};\n\n/**\n * Functions to log users in and out.\n *\n * @see https://instantdb.com/docs/auth\n */\nclass Auth {\n constructor(private db: Reactor) {}\n\n /**\n * Sends a magic code to the user's email address.\n *\n * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the\n * user verify.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth.sendMagicCode({email: \"example@gmail.com\"})\n * .catch((err) => console.error(err.body?.message))\n */\n sendMagicCode = (\n params: SendMagicCodeParams,\n ): Promise<SendMagicCodeResponse> => {\n return this.db.sendMagicCode(params);\n };\n\n /**\n * Verify a magic code that was sent to the user's email address.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInWithMagicCode({email: \"example@gmail.com\", code: \"123456\"})\n * .catch((err) => console.error(err.body?.message))\n */\n signInWithMagicCode = (\n params: VerifyMagicCodeParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithMagicCode(params);\n };\n\n /**\n * Sign in a user with a refresh token\n *\n * @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token\n *\n * @example\n * // Get the token from your backend\n * const token = await fetch('/signin', ...);\n * //Sign in\n * db.auth.signInWithToken(token);\n */\n signInWithToken = (token: AuthToken): Promise<VerifyResponse> => {\n return this.db.signInWithCustomToken(token);\n };\n\n /**\n * Sign in as guest, creating a new user without email\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInAsGuest();\n */\n signInAsGuest = (): Promise<VerifyResponse> => {\n return this.db.signInAsGuest();\n };\n\n /**\n * Create an authorization url to sign in with an external provider.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * // Get the authorization url from your backend\n * const url = db.auth.createAuthorizationUrl({\n * clientName: \"google\",\n * redirectURL: window.location.href,\n * });\n *\n * // Put it in a sign in link\n * <a href={url}>Log in with Google</a>\n */\n createAuthorizationURL = (params: {\n clientName: string;\n redirectURL: string;\n }): string => {\n return this.db.createAuthorizationURL(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .signInWithIdToken({\n * // Token from external service\n * idToken: id_token,\n * // The name you gave the client when you registered it with Instant\n * clientName: \"google\",\n * // The nonce, if any, that you used when you initiated the auth flow\n * // with the external service.\n * nonce: your_nonce\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n signInWithIdToken = (\n params: SignInWithIdTokenParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithIdToken(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .exchangeOAuthCode({\n * // code received in redirect from OAuth callback\n * code: code\n * // The PKCE code_verifier, if any, that you used when you\n * // initiated the auth flow\n * codeVerifier: your_code_verifier\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n exchangeOAuthCode = (params: ExchangeCodeForTokenParams) => {\n return this.db.exchangeCodeForToken(params);\n };\n\n /**\n * OpenID Discovery path for use with tools like\n * expo-auth-session that use auto-discovery of\n * OAuth parameters.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const discovery = useAutoDiscovery(\n * db.auth.issuerURI()\n * );\n */\n issuerURI = (): string => {\n return this.db.issuerURI();\n };\n\n /**\n * Sign out the current user\n */\n signOut = (opts: SignoutOpts = { invalidateToken: true }): Promise<void> => {\n return this.db.signOut(opts);\n };\n}\n\ntype FileOpts = {\n contentType?: string;\n contentDisposition?: string;\n fileSize?: number; // Required for streaming uploads\n};\n\n/**\n * Functions to manage file storage.\n */\nclass Storage {\n constructor(private db: Reactor) {}\n\n /**\n * Uploads file at the provided path.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * const [file] = e.target.files; // result of file input\n * const data = await db.storage.uploadFile('photos/demo.png', file);\n */\n uploadFile = (\n path: string,\n file: File | Blob,\n opts: FileOpts = {},\n ): Promise<UploadFileResponse> => {\n return this.db.uploadFile(path, file, opts);\n };\n\n /**\n * Deletes a file by path name.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * await db.storage.delete('photos/demo.png');\n */\n delete = (pathname: string) => {\n return this.db.deleteFile(pathname);\n };\n\n // Deprecated Storage API (Jan 2025)\n // ---------------------------------\n\n /**\n * @deprecated. Use `db.storage.uploadFile` instead\n * remove in the future.\n */\n upload = (pathname: string, file: File) => {\n return this.db.upload(pathname, file);\n };\n\n /**\n * @deprecated Use `db.storage.uploadFile` instead\n */\n put = this.upload;\n\n /**\n * @deprecated. getDownloadUrl will be removed in the future.\n * Use `useQuery` instead to query and fetch for valid urls\n *\n * db.useQuery({\n * $files: {\n * $: {\n * where: {\n * path: \"moop.png\"\n * }\n * }\n * }\n * })\n */\n getDownloadUrl = (pathname: string) => {\n return this.db.getDownloadUrl(pathname);\n };\n}\n\n// util\n\nfunction coerceQuery(o: any) {\n // stringify and parse to remove undefined values\n return JSON.parse(JSON.stringify(o));\n}\n\nclass InstantCoreDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> implements IInstantDatabase<Schema>\n{\n public _reactor: Reactor<RoomsOf<Schema>>;\n public auth: Auth;\n public storage: Storage;\n\n public tx = txInit<Schema>();\n\n constructor(reactor: Reactor<RoomsOf<Schema>>) {\n this._reactor = reactor;\n this.auth = new Auth(this._reactor);\n this.storage = new Storage(this._reactor);\n }\n\n /**\n * Use this to write data! You can create, update, delete, and link objects\n *\n * @see https://instantdb.com/docs/instaml\n *\n * @example\n * // Create a new object in the `goals` namespace\n * const goalId = id();\n * db.transact(db.tx.goals[goalId].update({title: \"Get fit\"}))\n *\n * // Update the title\n * db.transact(db.tx.goals[goalId].update({title: \"Get super fit\"}))\n *\n * // Delete it\n * db.transact(db.tx.goals[goalId].delete())\n *\n * // Or create an association:\n * todoId = id();\n * db.transact([\n * db.tx.todos[todoId].update({ title: 'Go on a run' }),\n * db.tx.goals[goalId].link({todos: todoId}),\n * ])\n */\n transact(\n chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],\n ): Promise<TransactionResult> {\n return this._reactor.pushTx(chunks);\n }\n\n getLocalId(name: string): Promise<string> {\n return this._reactor.getLocalId(name);\n }\n\n /**\n * Use this to query your data!\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n * // listen to all goals\n * db.subscribeQuery({ goals: {} }, (resp) => {\n * console.log(resp.data.goals)\n * })\n *\n * // goals where the title is \"Get Fit\"\n * db.subscribeQuery(\n * { goals: { $: { where: { title: \"Get Fit\" } } } },\n * (resp) => {\n * console.log(resp.data.goals)\n * }\n * )\n *\n * // all goals, _alongside_ their todos\n * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {\n * console.log(resp.data.goals)\n * });\n */\n subscribeQuery<\n Q extends ValidQuery<Q, Schema>,\n UseDatesLocal extends boolean = UseDates,\n >(\n query: Q,\n cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,\n opts?: InstaQLOptions,\n ) {\n return this._reactor.subscribeQuery(query, cb, opts);\n }\n\n /**\n * Listen for the logged in state. This is useful\n * for deciding when to show a login screen.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const unsub = db.subscribeAuth((auth) => {\n * if (auth.user) {\n * console.log('logged in as', auth.user.email)\n * } else {\n * console.log('logged out')\n * }\n * })\n */\n subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {\n return this._reactor.subscribeAuth(cb);\n }\n\n /**\n * One time query for the logged in state. This is useful\n * for scenarios where you want to know the current auth\n * state without subscribing to changes.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const user = await db.getAuth();\n * console.log('logged in as', user.email)\n */\n getAuth(): Promise<User | null> {\n return this._reactor.getAuth();\n }\n\n /**\n * Listen for connection status changes to Instant. This is useful\n * for building things like connectivity indicators\n *\n * @see https://www.instantdb.com/docs/patterns#connection-status\n * @example\n * const unsub = db.subscribeConnectionStatus((status) => {\n * const connectionState =\n * status === 'connecting' || status === 'opened'\n * ? 'authenticating'\n * : status === 'authenticated'\n * ? 'connected'\n * : status === 'closed'\n * ? 'closed'\n * : status === 'errored'\n * ? 'errored'\n * : 'unexpected state';\n *\n * console.log('Connection status:', connectionState);\n * });\n */\n subscribeConnectionStatus(\n cb: (status: ConnectionStatus) => void,\n ): UnsubscribeFn {\n return this._reactor.subscribeConnectionStatus(cb);\n }\n\n /**\n * Join a room to publish and subscribe to topics and presence.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * // init\n * const db = init();\n * const room = db.joinRoom(roomType, roomId);\n * // usage\n * const unsubscribeTopic = room.subscribeTopic(\"foo\", console.log);\n * const unsubscribePresence = room.subscribePresence({}, console.log);\n * room.publishTopic(\"hello\", { message: \"hello world!\" });\n * room.publishPresence({ name: \"joe\" });\n * // later\n * unsubscribePresence();\n * unsubscribeTopic();\n * room.leaveRoom();\n */\n joinRoom<RoomType extends keyof RoomsOf<Schema>>(\n roomType: RoomType = '_defaultRoomType' as RoomType,\n roomId: string = '_defaultRoomId',\n opts?: {\n initialPresence?: Partial<PresenceOf<Schema, RoomType>>;\n },\n ): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>> {\n const leaveRoom = this._reactor.joinRoom(roomId, opts?.initialPresence);\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomId, topic, onEvent),\n subscribePresence: (opts, onChange) =>\n this._reactor.subscribePresence(roomType, roomId, opts, onChange),\n publishTopic: (topic, data) =>\n this._reactor.publishTopic({ roomType, roomId, topic, data }),\n publishPresence: (data) =>\n this._reactor.publishPresence(roomType, roomId, data),\n getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),\n };\n }\n\n shutdown() {\n delete globalInstantCoreStore[reactorKey(this._reactor.config)];\n this._reactor.shutdown();\n }\n\n /**\n * Use this for one-off queries.\n * Returns local data if available, otherwise fetches from the server.\n * Because we want to avoid stale data, this method will throw an error\n * if the user is offline or there is no active connection to the server.\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n *\n * const resp = await db.queryOnce({ goals: {} });\n * console.log(resp.data.goals)\n */\n queryOnce<Q extends ValidQuery<Q, Schema>>(\n query: Q,\n opts?: InstaQLOptions,\n ): Promise<{\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n }> {\n return this._reactor.queryOnce(query, opts);\n }\n\n /**\n * @deprecated This is an experimental function that is not yet ready for production use.\n * Use this function to sync an entire namespace.\n * It has many limitations that will be removed in the future:\n * 1. Must be used with an admin token\n * 2. Does not support permissions\n * 3. Does not support where clauses\n * 4. Does not support links\n * It also does not support multiple top-level namespaces. For example,\n * {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.\n */\n _syncTableExperimental<Q extends ValidQuery<Q, Schema>>(\n query: ExactlyOne<Q>,\n cb: SyncTableCallback<Schema, Q, UseDates>,\n ): (\n opts?: { keepSubscription: boolean | null | undefined } | null | undefined,\n ) => void {\n return this._reactor.subscribeTable(query, cb);\n }\n}\n\nfunction schemaHash(schema?: InstantSchemaDef<any, any, any>): string {\n if (!schema) {\n return '0';\n }\n\n const fromStore = schemaHashStore.get(schema);\n if (fromStore) {\n return fromStore;\n }\n const hash = weakHash(schema);\n schemaHashStore.set(schema, hash);\n return hash;\n}\n\nfunction schemaChanged(\n existingClient: InstantCoreDatabase<any, boolean>,\n newSchema?: InstantSchemaDef<any, any, any>,\n): boolean {\n return (\n schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)\n );\n}\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/core\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/core\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n Storage?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const configStrict = {\n ...config,\n appId: config.appId?.trim(),\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n const existingClient = globalInstantCoreStore[\n reactorKey(configStrict)\n ] as InstantCoreDatabase<any, UseDates>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, configStrict.schema)) {\n existingClient._reactor.updateSchema(configStrict.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...configStrict,\n cardinalityInference: configStrict.schema ? true : false,\n },\n Storage || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, UseDates>(reactor);\n globalInstantCoreStore[reactorKey(configStrict)] = client;\n\n handleDevtool(configStrict.appId, configStrict.devtool);\n\n return client;\n}\n\nfunction handleDevtool(\n appId: string,\n devtool: boolean | DevtoolConfig | null | undefined,\n) {\n if (\n typeof window === 'undefined' ||\n typeof window.location === 'undefined' ||\n typeof document === 'undefined'\n ) {\n return;\n }\n\n if (typeof devtool === 'boolean' && !devtool) {\n return;\n }\n\n const config: StrictDevtoolConfig = {\n position: 'bottom-right' as const,\n allowedHosts: ['localhost'],\n ...(typeof devtool === 'object' ? devtool : {}),\n };\n\n if (!config.allowedHosts.includes(window.location.hostname)) {\n return;\n }\n\n createDevtool(appId, config);\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/core\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/core\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nexport {\n // bada bing bada boom\n init,\n init_experimental,\n id,\n tx,\n txInit,\n lookup,\n validateQuery,\n QueryValidationError,\n validateTransactions,\n TransactionValidationError,\n\n // error\n InstantAPIError,\n\n // cli\n i,\n\n // util\n getOps,\n coerceQuery,\n weakHash,\n coerceToDate,\n IndexedDBStorage,\n WindowNetworkListener,\n InstantCoreDatabase,\n Auth,\n Storage,\n version,\n InstantError,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // og types\n type IDatabase,\n type RoomSchemaShape,\n type Query,\n type QueryResponse,\n type InstaQLResponse,\n type PageInfoResponse,\n type InstantObject,\n type Exactly,\n type TransactionChunk,\n type AuthState,\n type ConnectionStatus,\n type User,\n type AuthToken,\n type TxChunk,\n type SubscriptionState,\n type InstaQLSubscriptionState,\n type LifecycleSubscriptionState,\n type InstaQLLifecycleState,\n\n // presence types\n type PresenceOpts,\n type PresenceSlice,\n type PresenceResponse,\n type PresencePeer,\n\n // new query types\n type InstaQLParams,\n type ValidQuery,\n type InstaQLOptions,\n type InstaQLQueryParams,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstaQLFields,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type InstantUnknownSchemaDef,\n type EntitiesWithLinks,\n type EntityDef,\n type RoomsDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type RoomsOf,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type IInstantDatabase,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type RuleParams,\n\n // attr types\n type InstantDBAttr,\n type InstantDBAttrOnDelete,\n type InstantDBCheckedDataType,\n type InstantDBIdent,\n type InstantDBInferredType,\n\n // auth types\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // SSE\n type EventSourceType,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // error types\n type InstantIssue,\n\n // storage (e.g. indexeddb) interface\n StorageInterface,\n type StorageInterfaceStoreName,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js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AEF,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAgB,OAAO,CAAC,CAAC;IAC/D,sBAAsB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC;IAE1D,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CACpB,KAAa,EACb,OAAmD;IAEnD,IACE,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;QACtC,OAAO,QAAQ,KAAK,WAAW,EAC/B,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,MAAM,MAAM,mBACV,QAAQ,EAAE,cAAuB,EACjC,YAAY,EAAE,CAAC,WAAW,CAAC,IACxB,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAChD,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO;IACT,CAAC;IAED,IAAA,0BAAa,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAK7B,8CAAiB","sourcesContent":["import Reactor from './Reactor.js';\nimport {\n tx,\n txInit,\n lookup,\n getOps,\n type TxChunk,\n type TransactionChunk,\n} from './instatx.js';\nimport weakHash from './utils/weakHash.js';\nimport id from './utils/id.ts';\nimport IndexedDBStorage from './IndexedDBStorage.ts';\nimport { coerceToDate } from './utils/dates.js';\nimport WindowNetworkListener from './WindowNetworkListener.js';\nimport { i } from './schema.js';\nimport { createDevtool } from './devtool.js';\nimport version from './version.ts';\nimport { validateQuery, QueryValidationError } from './queryValidation.ts';\nimport {\n validateTransactions,\n TransactionValidationError,\n} from './transactionValidation.ts';\n\nimport {\n StorageInterface,\n type StorageInterfaceStoreName,\n} from './utils/PersistedObject.ts';\nimport { createInstantRouteHandler } from './createRouteHandler.ts';\nimport { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';\n\nimport type {\n PresenceOpts,\n PresenceResponse,\n PresenceSlice,\n RoomSchemaShape,\n} from './presence.ts';\nimport type {\n DevtoolConfig,\n IDatabase,\n IInstantDatabase,\n StrictDevtoolConfig,\n} from './coreTypes.ts';\nimport type {\n Query,\n QueryResponse,\n InstaQLResponse,\n PageInfoResponse,\n Exactly,\n InstantObject,\n InstaQLParams,\n InstaQLOptions,\n InstaQLQueryParams,\n InstaQLEntity,\n InstaQLEntitySubquery,\n InstaQLResult,\n InstaQLFields,\n ValidQuery,\n} from './queryTypes.ts';\nimport type { PresencePeer } from './presenceTypes.ts';\nimport type {\n AuthState,\n User,\n AuthResult,\n ConnectionStatus,\n} from './clientTypes.ts';\nimport type {\n InstantQuery,\n InstantQueryResult,\n InstantSchema,\n InstantEntity,\n InstantSchemaDatabase,\n} from './helperTypes.ts';\nimport type {\n InstantDBAttr,\n InstantDBAttrOnDelete,\n InstantDBCheckedDataType,\n InstantDBIdent,\n InstantDBInferredType,\n} from './attrTypes.ts';\nimport type {\n AttrsDefs,\n CardinalityKind,\n DataAttrDef,\n EntitiesDef,\n EntitiesWithLinks,\n EntityDef,\n RoomsDef,\n InstantSchemaDef,\n InstantGraph,\n LinkAttrDef,\n LinkDef,\n LinksDef,\n PresenceOf,\n ResolveAttrs,\n RoomsOf,\n TopicsOf,\n TopicOf,\n ValueTypes,\n InstantUnknownSchema,\n InstantUnknownSchemaDef,\n BackwardsCompatibleSchema,\n UpdateParams,\n LinkParams,\n CreateParams,\n RuleParams,\n} from './schemaTypes.ts';\nimport type { InstantRules } from './rulesTypes.ts';\nimport type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';\nimport { FrameworkClient, type FrameworkConfig } from './framework.ts';\n\nimport type {\n ExchangeCodeForTokenParams,\n SendMagicCodeParams,\n SendMagicCodeResponse,\n SignInWithIdTokenParams,\n VerifyMagicCodeParams,\n VerifyResponse,\n} from './authAPI.ts';\n\nimport { InstantAPIError, type InstantIssue } from './utils/fetch.js';\nimport { InstantError } from './InstantError.ts';\nimport { EventSourceType } from './Connection.ts';\nimport { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';\nimport type {\n SyncTableCallback,\n CallbackEvent as SyncTableCallbackEvent,\n InitialSyncBatch as SyncTableInitialSyncBatch,\n InitialSyncComplete as SyncTableInitialSyncComplete,\n SyncTransaction as SyncTableSyncTransaction,\n LoadFromStorage as SyncTableLoadFromStorage,\n SetupError as SyncTableSetupError,\n} from './SyncTable.ts';\n\nconst defaultOpenDevtool = true;\n\n// types\n\ntype ExactlyOne<T> = {\n [K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;\n}[keyof T];\n\nexport type Config = {\n appId: string;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: boolean;\n disableValidation?: boolean;\n};\n\nexport type InstantConfig<\n S extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> = {\n appId: string;\n schema?: S;\n websocketURI?: string;\n firstPartyPath?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: UseDates;\n disableValidation?: boolean;\n};\n\nexport type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {\n schema: S;\n};\n\nexport type TransactionResult = {\n status: 'synced' | 'enqueued';\n clientId: string;\n};\n\nexport type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(\n topic: Key,\n data: TopicsByKey[Key],\n) => void;\n\nexport type SubscribeTopic<PresenceShape, TopicsByKey> = <\n Key extends keyof TopicsByKey,\n>(\n topic: Key,\n onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void,\n) => () => void;\n\nexport type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(\n opts: PresenceOpts<PresenceShape, Keys>,\n) => PresenceResponse<PresenceShape, Keys> | null;\n\nexport type SubscribePresence<PresenceShape> = <\n Keys extends keyof PresenceShape,\n>(\n opts: PresenceOpts<PresenceShape, Keys>,\n onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void,\n) => () => void;\n\nexport type RoomHandle<PresenceShape, TopicsByKey> = {\n leaveRoom: () => void;\n publishTopic: PublishTopic<TopicsByKey>;\n subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;\n publishPresence: (data: Partial<PresenceShape>) => void;\n getPresence: GetPresence<PresenceShape>;\n subscribePresence: SubscribePresence<PresenceShape>;\n};\n\ntype AuthToken = string;\n\ntype SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: QueryResponse<Q, Schema, WithCardinalityInference>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype LifecycleSubscriptionState<\n Q,\n Schema,\n WithCardinalityInference extends boolean,\n> = SubscriptionState<Q, Schema, WithCardinalityInference> & {\n isLoading: boolean;\n};\n\ntype InstaQLLifecycleState<Schema, Q, UseDates extends boolean = false> =\n | (InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n })\n | {\n isLoading: true;\n data: undefined;\n pageInfo: undefined;\n error: undefined;\n };\n\ntype UnsubscribeFn = () => void;\n\n// consts\n\nconst defaultConfig = {\n apiURI: 'https://api.instantdb.com',\n websocketURI: 'wss://api.instantdb.com/runtime/session',\n};\n\n// hmr\nfunction initSchemaHashStore(): WeakMap<any, string> {\n globalThis.__instantDbSchemaHashStore =\n globalThis.__instantDbSchemaHashStore ?? new WeakMap<any, string>();\n return globalThis.__instantDbSchemaHashStore;\n}\n\nfunction initGlobalInstantCoreStore(): Record<string, any> {\n globalThis.__instantDbStore = globalThis.__instantDbStore ?? {};\n return globalThis.__instantDbStore;\n}\n\nfunction reactorKey(config: InstantConfig<any, boolean>): string {\n // @ts-expect-error\n const adminToken = config.__adminToken;\n return (\n config.appId +\n '_' +\n (config.websocketURI || 'default_ws_uri') +\n '_' +\n (config.apiURI || 'default_api_uri') +\n '_' +\n (adminToken || 'client_only') +\n '_' +\n config.useDateObjects\n );\n}\n\nconst globalInstantCoreStore = initGlobalInstantCoreStore();\nconst schemaHashStore = initSchemaHashStore();\n\ntype SignoutOpts = {\n invalidateToken?: boolean;\n};\n\n/**\n * Functions to log users in and out.\n *\n * @see https://instantdb.com/docs/auth\n */\nclass Auth {\n constructor(private db: Reactor) {}\n\n /**\n * Sends a magic code to the user's email address.\n *\n * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the\n * user verify.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth.sendMagicCode({email: \"example@gmail.com\"})\n * .catch((err) => console.error(err.body?.message))\n */\n sendMagicCode = (\n params: SendMagicCodeParams,\n ): Promise<SendMagicCodeResponse> => {\n return this.db.sendMagicCode(params);\n };\n\n /**\n * Verify a magic code that was sent to the user's email address.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInWithMagicCode({email: \"example@gmail.com\", code: \"123456\"})\n * .catch((err) => console.error(err.body?.message))\n */\n signInWithMagicCode = (\n params: VerifyMagicCodeParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithMagicCode(params);\n };\n\n /**\n * Sign in a user with a refresh token\n *\n * @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token\n *\n * @example\n * // Get the token from your backend\n * const token = await fetch('/signin', ...);\n * //Sign in\n * db.auth.signInWithToken(token);\n */\n signInWithToken = (token: AuthToken): Promise<VerifyResponse> => {\n return this.db.signInWithCustomToken(token);\n };\n\n /**\n * Sign in as guest, creating a new user without email\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInAsGuest();\n */\n signInAsGuest = (): Promise<VerifyResponse> => {\n return this.db.signInAsGuest();\n };\n\n /**\n * Create an authorization url to sign in with an external provider.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * // Get the authorization url from your backend\n * const url = db.auth.createAuthorizationUrl({\n * clientName: \"google\",\n * redirectURL: window.location.href,\n * });\n *\n * // Put it in a sign in link\n * <a href={url}>Log in with Google</a>\n */\n createAuthorizationURL = (params: {\n clientName: string;\n redirectURL: string;\n }): string => {\n return this.db.createAuthorizationURL(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .signInWithIdToken({\n * // Token from external service\n * idToken: id_token,\n * // The name you gave the client when you registered it with Instant\n * clientName: \"google\",\n * // The nonce, if any, that you used when you initiated the auth flow\n * // with the external service.\n * nonce: your_nonce\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n signInWithIdToken = (\n params: SignInWithIdTokenParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithIdToken(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .exchangeOAuthCode({\n * // code received in redirect from OAuth callback\n * code: code\n * // The PKCE code_verifier, if any, that you used when you\n * // initiated the auth flow\n * codeVerifier: your_code_verifier\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n exchangeOAuthCode = (params: ExchangeCodeForTokenParams) => {\n return this.db.exchangeCodeForToken(params);\n };\n\n /**\n * OpenID Discovery path for use with tools like\n * expo-auth-session that use auto-discovery of\n * OAuth parameters.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const discovery = useAutoDiscovery(\n * db.auth.issuerURI()\n * );\n */\n issuerURI = (): string => {\n return this.db.issuerURI();\n };\n\n /**\n * Sign out the current user\n */\n signOut = (opts: SignoutOpts = { invalidateToken: true }): Promise<void> => {\n return this.db.signOut(opts);\n };\n}\n\ntype FileOpts = {\n contentType?: string;\n contentDisposition?: string;\n fileSize?: number; // Required for streaming uploads\n};\n\n/**\n * Functions to manage file storage.\n */\nclass Storage {\n constructor(private db: Reactor) {}\n\n /**\n * Uploads file at the provided path.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * const [file] = e.target.files; // result of file input\n * const data = await db.storage.uploadFile('photos/demo.png', file);\n */\n uploadFile = (\n path: string,\n file: File | Blob,\n opts: FileOpts = {},\n ): Promise<UploadFileResponse> => {\n return this.db.uploadFile(path, file, opts);\n };\n\n /**\n * Deletes a file by path name.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * await db.storage.delete('photos/demo.png');\n */\n delete = (pathname: string) => {\n return this.db.deleteFile(pathname);\n };\n\n // Deprecated Storage API (Jan 2025)\n // ---------------------------------\n\n /**\n * @deprecated. Use `db.storage.uploadFile` instead\n * remove in the future.\n */\n upload = (pathname: string, file: File) => {\n return this.db.upload(pathname, file);\n };\n\n /**\n * @deprecated Use `db.storage.uploadFile` instead\n */\n put = this.upload;\n\n /**\n * @deprecated. getDownloadUrl will be removed in the future.\n * Use `useQuery` instead to query and fetch for valid urls\n *\n * db.useQuery({\n * $files: {\n * $: {\n * where: {\n * path: \"moop.png\"\n * }\n * }\n * }\n * })\n */\n getDownloadUrl = (pathname: string) => {\n return this.db.getDownloadUrl(pathname);\n };\n}\n\n// util\n\nfunction coerceQuery(o: any) {\n // stringify and parse to remove undefined values\n return JSON.parse(JSON.stringify(o));\n}\n\nclass InstantCoreDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> implements IInstantDatabase<Schema>\n{\n public _reactor: Reactor<RoomsOf<Schema>>;\n public auth: Auth;\n public storage: Storage;\n\n public tx = txInit<Schema>();\n\n constructor(reactor: Reactor<RoomsOf<Schema>>) {\n this._reactor = reactor;\n this.auth = new Auth(this._reactor);\n this.storage = new Storage(this._reactor);\n }\n\n /**\n * Use this to write data! You can create, update, delete, and link objects\n *\n * @see https://instantdb.com/docs/instaml\n *\n * @example\n * // Create a new object in the `goals` namespace\n * const goalId = id();\n * db.transact(db.tx.goals[goalId].update({title: \"Get fit\"}))\n *\n * // Update the title\n * db.transact(db.tx.goals[goalId].update({title: \"Get super fit\"}))\n *\n * // Delete it\n * db.transact(db.tx.goals[goalId].delete())\n *\n * // Or create an association:\n * todoId = id();\n * db.transact([\n * db.tx.todos[todoId].update({ title: 'Go on a run' }),\n * db.tx.goals[goalId].link({todos: todoId}),\n * ])\n */\n transact(\n chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],\n ): Promise<TransactionResult> {\n return this._reactor.pushTx(chunks);\n }\n\n getLocalId(name: string): Promise<string> {\n return this._reactor.getLocalId(name);\n }\n\n /**\n * Use this to query your data!\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n * // listen to all goals\n * db.subscribeQuery({ goals: {} }, (resp) => {\n * console.log(resp.data.goals)\n * })\n *\n * // goals where the title is \"Get Fit\"\n * db.subscribeQuery(\n * { goals: { $: { where: { title: \"Get Fit\" } } } },\n * (resp) => {\n * console.log(resp.data.goals)\n * }\n * )\n *\n * // all goals, _alongside_ their todos\n * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {\n * console.log(resp.data.goals)\n * });\n */\n subscribeQuery<\n Q extends ValidQuery<Q, Schema>,\n UseDatesLocal extends boolean = UseDates,\n >(\n query: Q,\n cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,\n opts?: InstaQLOptions,\n ) {\n return this._reactor.subscribeQuery(query, cb, opts);\n }\n\n /**\n * Listen for the logged in state. This is useful\n * for deciding when to show a login screen.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const unsub = db.subscribeAuth((auth) => {\n * if (auth.user) {\n * console.log('logged in as', auth.user.email)\n * } else {\n * console.log('logged out')\n * }\n * })\n */\n subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {\n return this._reactor.subscribeAuth(cb);\n }\n\n /**\n * One time query for the logged in state. This is useful\n * for scenarios where you want to know the current auth\n * state without subscribing to changes.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const user = await db.getAuth();\n * console.log('logged in as', user.email)\n */\n getAuth(): Promise<User | null> {\n return this._reactor.getAuth();\n }\n\n /**\n * Listen for connection status changes to Instant. This is useful\n * for building things like connectivity indicators\n *\n * @see https://www.instantdb.com/docs/patterns#connection-status\n * @example\n * const unsub = db.subscribeConnectionStatus((status) => {\n * const connectionState =\n * status === 'connecting' || status === 'opened'\n * ? 'authenticating'\n * : status === 'authenticated'\n * ? 'connected'\n * : status === 'closed'\n * ? 'closed'\n * : status === 'errored'\n * ? 'errored'\n * : 'unexpected state';\n *\n * console.log('Connection status:', connectionState);\n * });\n */\n subscribeConnectionStatus(\n cb: (status: ConnectionStatus) => void,\n ): UnsubscribeFn {\n return this._reactor.subscribeConnectionStatus(cb);\n }\n\n /**\n * Join a room to publish and subscribe to topics and presence.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * // init\n * const db = init();\n * const room = db.joinRoom(roomType, roomId);\n * // usage\n * const unsubscribeTopic = room.subscribeTopic(\"foo\", console.log);\n * const unsubscribePresence = room.subscribePresence({}, console.log);\n * room.publishTopic(\"hello\", { message: \"hello world!\" });\n * room.publishPresence({ name: \"joe\" });\n * // later\n * unsubscribePresence();\n * unsubscribeTopic();\n * room.leaveRoom();\n */\n joinRoom<RoomType extends keyof RoomsOf<Schema>>(\n roomType: RoomType = '_defaultRoomType' as RoomType,\n roomId: string = '_defaultRoomId',\n opts?: {\n initialPresence?: Partial<PresenceOf<Schema, RoomType>>;\n },\n ): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>> {\n const leaveRoom = this._reactor.joinRoom(roomId, opts?.initialPresence);\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomId, topic, onEvent),\n subscribePresence: (opts, onChange) =>\n this._reactor.subscribePresence(roomType, roomId, opts, onChange),\n publishTopic: (topic, data) =>\n this._reactor.publishTopic({ roomType, roomId, topic, data }),\n publishPresence: (data) =>\n this._reactor.publishPresence(roomType, roomId, data),\n getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),\n };\n }\n\n shutdown() {\n delete globalInstantCoreStore[reactorKey(this._reactor.config)];\n this._reactor.shutdown();\n }\n\n /**\n * Use this for one-off queries.\n * Returns local data if available, otherwise fetches from the server.\n * Because we want to avoid stale data, this method will throw an error\n * if the user is offline or there is no active connection to the server.\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n *\n * const resp = await db.queryOnce({ goals: {} });\n * console.log(resp.data.goals)\n */\n queryOnce<Q extends ValidQuery<Q, Schema>>(\n query: Q,\n opts?: InstaQLOptions,\n ): Promise<{\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n }> {\n return this._reactor.queryOnce(query, opts);\n }\n\n /**\n * @deprecated This is an experimental function that is not yet ready for production use.\n * Use this function to sync an entire namespace.\n * It has many limitations that will be removed in the future:\n * 1. Must be used with an admin token\n * 2. Does not support permissions\n * 3. Does not support where clauses\n * 4. Does not support links\n * It also does not support multiple top-level namespaces. For example,\n * {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.\n */\n _syncTableExperimental<Q extends ValidQuery<Q, Schema>>(\n query: ExactlyOne<Q>,\n cb: SyncTableCallback<Schema, Q, UseDates>,\n ): (\n opts?: { keepSubscription: boolean | null | undefined } | null | undefined,\n ) => void {\n return this._reactor.subscribeTable(query, cb);\n }\n}\n\nfunction schemaHash(schema?: InstantSchemaDef<any, any, any>): string {\n if (!schema) {\n return '0';\n }\n\n const fromStore = schemaHashStore.get(schema);\n if (fromStore) {\n return fromStore;\n }\n const hash = weakHash(schema);\n schemaHashStore.set(schema, hash);\n return hash;\n}\n\nfunction schemaChanged(\n existingClient: InstantCoreDatabase<any, boolean>,\n newSchema?: InstantSchemaDef<any, any, any>,\n): boolean {\n return (\n schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)\n );\n}\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/core\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/core\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n Storage?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const configStrict = {\n ...config,\n appId: config.appId?.trim(),\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n const existingClient = globalInstantCoreStore[\n reactorKey(configStrict)\n ] as InstantCoreDatabase<any, UseDates>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, configStrict.schema)) {\n existingClient._reactor.updateSchema(configStrict.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...configStrict,\n cardinalityInference: configStrict.schema ? true : false,\n },\n Storage || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, UseDates>(reactor);\n globalInstantCoreStore[reactorKey(configStrict)] = client;\n\n handleDevtool(configStrict.appId, configStrict.devtool);\n\n return client;\n}\n\nfunction handleDevtool(\n appId: string,\n devtool: boolean | DevtoolConfig | null | undefined,\n) {\n if (\n typeof window === 'undefined' ||\n typeof window.location === 'undefined' ||\n typeof document === 'undefined'\n ) {\n return;\n }\n\n if (typeof devtool === 'boolean' && !devtool) {\n return;\n }\n\n const config: StrictDevtoolConfig = {\n position: 'bottom-right' as const,\n allowedHosts: ['localhost'],\n ...(typeof devtool === 'object' ? devtool : {}),\n };\n\n if (!config.allowedHosts.includes(window.location.hostname)) {\n return;\n }\n\n createDevtool(appId, config);\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/core\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/core\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nexport {\n // bada bing bada boom\n init,\n init_experimental,\n id,\n tx,\n txInit,\n lookup,\n validateQuery,\n QueryValidationError,\n validateTransactions,\n parseSchemaFromJSON,\n TransactionValidationError,\n FrameworkClient,\n\n // error\n InstantAPIError,\n\n // cli\n i,\n\n // util\n getOps,\n coerceQuery,\n weakHash,\n coerceToDate,\n IndexedDBStorage,\n WindowNetworkListener,\n InstantCoreDatabase,\n Auth,\n Storage,\n version,\n InstantError,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // og types\n type IDatabase,\n type RoomSchemaShape,\n type Query,\n type QueryResponse,\n type InstaQLResponse,\n type PageInfoResponse,\n type InstantObject,\n type Exactly,\n type TransactionChunk,\n type AuthState,\n type ConnectionStatus,\n type User,\n type AuthToken,\n type TxChunk,\n type SubscriptionState,\n type InstaQLSubscriptionState,\n type LifecycleSubscriptionState,\n type InstaQLLifecycleState,\n\n // presence types\n type PresenceOpts,\n type PresenceSlice,\n type PresenceResponse,\n type PresencePeer,\n\n // new query types\n type InstaQLParams,\n type ValidQuery,\n type InstaQLOptions,\n type InstaQLQueryParams,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstaQLFields,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type InstantUnknownSchemaDef,\n type EntitiesWithLinks,\n type EntityDef,\n type RoomsDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type RoomsOf,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type IInstantDatabase,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type RuleParams,\n\n // attr types\n type InstantDBAttr,\n type InstantDBAttrOnDelete,\n type InstantDBCheckedDataType,\n type InstantDBIdent,\n type InstantDBInferredType,\n\n // auth types\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // SSE\n type EventSourceType,\n type FrameworkConfig,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // error types\n type InstantIssue,\n\n // storage (e.g. indexeddb) interface\n StorageInterface,\n type StorageInterfaceStoreName,\n createInstantRouteHandler,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseSchemaFromJSON.d.ts","sourceRoot":"","sources":["../../src/parseSchemaFromJSON.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,eAAO,MAAM,mBAAmB,GAC9B,GAAG,GAAG,KACL,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CA0KhC,CAAC"}
|