@instantdb/core 0.22.88-experimental.drewh-ssr.20251523170.1 → 0.22.88-experimental.split-store.20252005043.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.
- package/__tests__/src/Reactor.test.js +18 -11
- package/__tests__/src/{datalog.test.js → datalog.test.ts} +17 -5
- package/__tests__/src/{instaml.test.js → instaml.test.ts} +183 -119
- package/__tests__/src/instaql.bench.ts +34 -0
- package/__tests__/src/{instaql.test.js → instaql.test.ts} +342 -455
- package/__tests__/src/instaqlInference.test.js +13 -9
- package/__tests__/src/{store.test.js → store.test.ts} +215 -212
- package/dist/commonjs/Reactor.d.ts +24 -19
- package/dist/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +112 -106
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/SyncTable.d.ts +4 -1
- package/dist/commonjs/SyncTable.d.ts.map +1 -1
- package/dist/commonjs/SyncTable.js +35 -37
- package/dist/commonjs/SyncTable.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -5
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -7
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/instaml.d.ts +17 -4
- package/dist/commonjs/instaml.d.ts.map +1 -1
- package/dist/commonjs/instaml.js +115 -82
- package/dist/commonjs/instaml.js.map +1 -1
- package/dist/commonjs/instaql.d.ts +4 -3
- package/dist/commonjs/instaql.d.ts.map +1 -1
- package/dist/commonjs/instaql.js +65 -63
- package/dist/commonjs/instaql.js.map +1 -1
- package/dist/commonjs/reactorTypes.d.ts +29 -0
- package/dist/commonjs/reactorTypes.d.ts.map +1 -0
- package/dist/commonjs/reactorTypes.js +3 -0
- package/dist/commonjs/reactorTypes.js.map +1 -0
- package/dist/commonjs/store.d.ts +67 -25
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +177 -81
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/Reactor.d.ts +24 -19
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +113 -107
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/SyncTable.d.ts +4 -1
- package/dist/esm/SyncTable.d.ts.map +1 -1
- package/dist/esm/SyncTable.js +35 -37
- package/dist/esm/SyncTable.js.map +1 -1
- package/dist/esm/index.d.ts +1 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instaml.d.ts +17 -4
- package/dist/esm/instaml.d.ts.map +1 -1
- package/dist/esm/instaml.js +112 -77
- package/dist/esm/instaml.js.map +1 -1
- package/dist/esm/instaql.d.ts +4 -3
- package/dist/esm/instaql.d.ts.map +1 -1
- package/dist/esm/instaql.js +65 -63
- package/dist/esm/instaql.js.map +1 -1
- package/dist/esm/reactorTypes.d.ts +29 -0
- package/dist/esm/reactorTypes.d.ts.map +1 -0
- package/dist/esm/reactorTypes.js +2 -0
- package/dist/esm/reactorTypes.js.map +1 -0
- package/dist/esm/store.d.ts +67 -25
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +174 -81
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +1851 -1961
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Reactor.js +155 -143
- package/src/SyncTable.ts +85 -45
- package/src/index.ts +0 -9
- package/src/{instaml.js → instaml.ts} +201 -96
- package/src/instaql.ts +88 -62
- package/src/reactorTypes.ts +32 -0
- package/src/store.ts +257 -101
- package/__tests__/src/instaql.bench.js +0 -29
- package/__tests__/src/serializeSchema.test.ts +0 -123
- package/dist/commonjs/createRouteHandler.d.ts +0 -8
- package/dist/commonjs/createRouteHandler.d.ts.map +0 -1
- package/dist/commonjs/createRouteHandler.js +0 -57
- package/dist/commonjs/createRouteHandler.js.map +0 -1
- package/dist/commonjs/framework.d.ts +0 -77
- package/dist/commonjs/framework.d.ts.map +0 -1
- package/dist/commonjs/framework.js +0 -199
- package/dist/commonjs/framework.js.map +0 -1
- package/dist/commonjs/parseSchemaFromJSON.d.ts +0 -3
- package/dist/commonjs/parseSchemaFromJSON.d.ts.map +0 -1
- package/dist/commonjs/parseSchemaFromJSON.js +0 -148
- package/dist/commonjs/parseSchemaFromJSON.js.map +0 -1
- package/dist/esm/createRouteHandler.d.ts +0 -8
- package/dist/esm/createRouteHandler.d.ts.map +0 -1
- package/dist/esm/createRouteHandler.js +0 -53
- package/dist/esm/createRouteHandler.js.map +0 -1
- package/dist/esm/framework.d.ts +0 -77
- package/dist/esm/framework.d.ts.map +0 -1
- package/dist/esm/framework.js +0 -159
- package/dist/esm/framework.js.map +0 -1
- package/dist/esm/parseSchemaFromJSON.d.ts +0 -3
- package/dist/esm/parseSchemaFromJSON.d.ts.map +0 -1
- package/dist/esm/parseSchemaFromJSON.js +0 -144
- package/dist/esm/parseSchemaFromJSON.js.map +0 -1
- package/src/createRouteHandler.ts +0 -44
- package/src/framework.ts +0 -281
- package/src/parseSchemaFromJSON.ts +0 -176
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
|
-
import { createStore } from '../../src/store';
|
|
2
|
+
import { createStore, AttrsStoreClass } from '../../src/store';
|
|
3
3
|
import query from '../../src/instaql';
|
|
4
4
|
import { i, id } from '../../src';
|
|
5
5
|
import { createLinkIndex } from '../../src/utils/linkIndex';
|
|
@@ -221,19 +221,23 @@ test('one-to-one without inference', () => {
|
|
|
221
221
|
expect(result.data.profiles.at(0).user.at(0).id).toBe(ids.user1);
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
-
function indexAttrs(attrs) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
function indexAttrs(attrs, schema) {
|
|
225
|
+
const linkIndex = schema ? createLinkIndex(schema) : undefined;
|
|
226
|
+
return new AttrsStoreClass(
|
|
227
|
+
attrs.reduce((acc, attr) => {
|
|
228
|
+
acc[attr.id] = attr;
|
|
229
|
+
return acc;
|
|
230
|
+
}, {}),
|
|
231
|
+
linkIndex,
|
|
232
|
+
);
|
|
229
233
|
}
|
|
230
234
|
|
|
231
235
|
function queryData(config, attrs, triples, q) {
|
|
232
|
-
const
|
|
236
|
+
const attrsStore = indexAttrs(attrs, config.schema);
|
|
237
|
+
const store = createStore(attrsStore, triples);
|
|
233
238
|
store.cardinalityInference = config.cardinalityInference;
|
|
234
|
-
store.linkIndex = config.schema ? createLinkIndex(config.schema) : undefined;
|
|
235
239
|
|
|
236
|
-
const result = query({ store }, q);
|
|
240
|
+
const result = query({ store, attrsStore }, q);
|
|
237
241
|
|
|
238
242
|
return { result, store };
|
|
239
243
|
}
|