tinybase 4.5.0-beta.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs +1 -0
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/checkpoints.js +8 -8
- package/lib/debug/indexes.js +8 -8
- package/lib/debug/metrics.js +8 -8
- package/lib/debug/persisters/persister-automerge.js +23 -23
- package/lib/debug/persisters/persister-expo-sqlite-next.js +835 -0
- package/lib/debug/persisters/persister-partykit-server.js +35 -21
- package/lib/debug/persisters/persister-yjs.js +23 -23
- package/lib/debug/queries.js +10 -10
- package/lib/debug/relationships.js +6 -6
- package/lib/debug/store.js +10 -10
- package/lib/debug/tinybase.js +24 -24
- package/lib/debug/tools.js +2 -2
- package/lib/debug/ui-react-dom.js +12 -12
- package/lib/debug/ui-react.js +56 -22
- package/lib/es6/persisters/persister-expo-sqlite-next.js +1 -0
- package/lib/es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/es6/persisters/persister-partykit-server.js +1 -1
- package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite-next.js +1 -0
- package/lib/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/persisters/persister-partykit-server.js +1 -1
- package/lib/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/types/metrics.d.ts +2 -2
- package/lib/types/persisters/persister-expo-sqlite-next.d.ts +168 -0
- package/lib/types/persisters/persister-expo-sqlite.d.ts +8 -0
- package/lib/types/persisters/persister-partykit-server.d.ts +58 -2
- package/lib/types/persisters/persister-remote.d.ts +6 -1
- package/lib/types/persisters.d.ts +1 -0
- package/lib/types/queries.d.ts +2 -45
- package/lib/types/ui-react.d.ts +53 -0
- package/lib/types/with-schemas/metrics.d.ts +2 -2
- package/lib/types/with-schemas/persisters/persister-expo-sqlite-next.d.ts +181 -0
- package/lib/types/with-schemas/persisters/persister-expo-sqlite.d.ts +8 -0
- package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +61 -0
- package/lib/types/with-schemas/persisters/persister-remote.d.ts +6 -1
- package/lib/types/with-schemas/persisters.d.ts +1 -0
- package/lib/types/with-schemas/queries.d.ts +2 -45
- package/lib/types/with-schemas/store.d.ts +8 -8
- package/lib/types/with-schemas/ui-react.d.ts +59 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite-next.js +1 -0
- package/lib/umd/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd/persisters/persister-partykit-server.js +1 -1
- package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js +1 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +22 -23
- package/readme.md +13 -13
|
@@ -67,15 +67,12 @@ const RESPONSE_HEADERS = objNew(
|
|
|
67
67
|
'*',
|
|
68
68
|
]),
|
|
69
69
|
);
|
|
70
|
-
const
|
|
71
|
-
await
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
const loadStore = async (that) => {
|
|
70
|
+
const hasStoreInStorage = async (storage, storagePrefix = EMPTY_STRING) =>
|
|
71
|
+
!!(await storage.get(storagePrefix + HAS_STORE));
|
|
72
|
+
const loadStoreFromStorage = async (storage, storagePrefix = EMPTY_STRING) => {
|
|
75
73
|
const tables = {};
|
|
76
74
|
const values = {};
|
|
77
|
-
|
|
78
|
-
mapForEach(await that.party.storage.list(), (key, cellOrValue) =>
|
|
75
|
+
mapForEach(await storage.list(), (key, cellOrValue) =>
|
|
79
76
|
ifNotUndefined(deconstruct(storagePrefix, key), ([type, ids]) => {
|
|
80
77
|
if (type == T) {
|
|
81
78
|
const [tableId, rowId, cellId] = jsonParse('[' + ids + ']');
|
|
@@ -95,9 +92,9 @@ const saveStore = async (
|
|
|
95
92
|
requestOrConnection,
|
|
96
93
|
) => {
|
|
97
94
|
const storage = that.party.storage;
|
|
98
|
-
const
|
|
95
|
+
const storagePrefix = that.config.storagePrefix;
|
|
99
96
|
const keysToSet = {
|
|
100
|
-
[
|
|
97
|
+
[storagePrefix + HAS_STORE]: 1,
|
|
101
98
|
};
|
|
102
99
|
const keysToDel = [];
|
|
103
100
|
const keyPrefixesToDel = [];
|
|
@@ -108,7 +105,7 @@ const saveStore = async (
|
|
|
108
105
|
that.canDelTable(tableId, requestOrConnection) &&
|
|
109
106
|
arrayUnshift(
|
|
110
107
|
keyPrefixesToDel,
|
|
111
|
-
constructStorageKey(
|
|
108
|
+
constructStorageKey(storagePrefix, T, tableId),
|
|
112
109
|
)
|
|
113
110
|
: that.canSetTable(tableId, initialSave, requestOrConnection) &&
|
|
114
111
|
(await promiseAll(
|
|
@@ -118,7 +115,7 @@ const saveStore = async (
|
|
|
118
115
|
that.canDelRow(tableId, rowId, requestOrConnection) &&
|
|
119
116
|
arrayPush(
|
|
120
117
|
keyPrefixesToDel,
|
|
121
|
-
constructStorageKey(
|
|
118
|
+
constructStorageKey(storagePrefix, T, tableId, rowId),
|
|
122
119
|
)
|
|
123
120
|
: that.canSetRow(
|
|
124
121
|
tableId,
|
|
@@ -129,7 +126,7 @@ const saveStore = async (
|
|
|
129
126
|
(await promiseAll(
|
|
130
127
|
objMap(row, async (cell, cellId) => {
|
|
131
128
|
const ids = [tableId, rowId, cellId];
|
|
132
|
-
const key = constructStorageKey(
|
|
129
|
+
const key = constructStorageKey(storagePrefix, T, ...ids);
|
|
133
130
|
isUndefined(cell)
|
|
134
131
|
? !initialSave &&
|
|
135
132
|
that.canDelCell(...ids, requestOrConnection) &&
|
|
@@ -149,7 +146,7 @@ const saveStore = async (
|
|
|
149
146
|
);
|
|
150
147
|
await promiseAll(
|
|
151
148
|
objMap(transactionChanges[1], async (value, valueId) => {
|
|
152
|
-
const key =
|
|
149
|
+
const key = storagePrefix + V + valueId;
|
|
153
150
|
isUndefined(value)
|
|
154
151
|
? !initialSave &&
|
|
155
152
|
that.canDelValue(valueId, requestOrConnection) &&
|
|
@@ -181,17 +178,24 @@ const constructStorageKey = (storagePrefix, type, ...ids) =>
|
|
|
181
178
|
const createResponse = async (that, status, body = null) =>
|
|
182
179
|
new Response(body, {
|
|
183
180
|
status,
|
|
184
|
-
headers: that.config.responseHeaders
|
|
181
|
+
headers: that.config.responseHeaders,
|
|
185
182
|
});
|
|
186
183
|
class TinyBasePartyKitServer {
|
|
187
184
|
constructor(party) {
|
|
188
185
|
this.party = party;
|
|
189
186
|
this.config = {};
|
|
187
|
+
this.config.storePath ??= STORE_PATH;
|
|
188
|
+
this.config.messagePrefix ??= EMPTY_STRING;
|
|
189
|
+
this.config.storagePrefix ??= EMPTY_STRING;
|
|
190
|
+
this.config.responseHeaders ??= RESPONSE_HEADERS;
|
|
190
191
|
}
|
|
191
192
|
async onRequest(request) {
|
|
192
|
-
const
|
|
193
|
+
const {
|
|
194
|
+
party: {storage},
|
|
195
|
+
config: {storePath, storagePrefix},
|
|
196
|
+
} = this;
|
|
193
197
|
if (new URL(request.url).pathname.endsWith(storePath)) {
|
|
194
|
-
const hasExistingStore = await
|
|
198
|
+
const hasExistingStore = await hasStoreInStorage(storage, storagePrefix);
|
|
195
199
|
const text = await request.text();
|
|
196
200
|
if (request.method == PUT) {
|
|
197
201
|
if (hasExistingStore) {
|
|
@@ -203,19 +207,29 @@ class TinyBasePartyKitServer {
|
|
|
203
207
|
return createResponse(
|
|
204
208
|
this,
|
|
205
209
|
200,
|
|
206
|
-
hasExistingStore
|
|
210
|
+
hasExistingStore
|
|
211
|
+
? jsonString(await loadStoreFromStorage(storage, storagePrefix))
|
|
212
|
+
: EMPTY_STRING,
|
|
207
213
|
);
|
|
208
214
|
}
|
|
209
215
|
return createResponse(this, 404);
|
|
210
216
|
}
|
|
211
217
|
async onMessage(message, connection) {
|
|
212
|
-
const
|
|
218
|
+
const {
|
|
219
|
+
party: {storage, broadcast},
|
|
220
|
+
config: {messagePrefix, storagePrefix},
|
|
221
|
+
} = this;
|
|
213
222
|
await ifNotUndefined(
|
|
214
223
|
deconstruct(messagePrefix, message, 1),
|
|
215
224
|
async ([type, payload]) => {
|
|
216
|
-
if (
|
|
225
|
+
if (
|
|
226
|
+
type == SET_CHANGES &&
|
|
227
|
+
(await hasStoreInStorage(storage, storagePrefix))
|
|
228
|
+
) {
|
|
217
229
|
await saveStore(this, payload, false, connection);
|
|
218
|
-
|
|
230
|
+
broadcast(construct(messagePrefix, SET_CHANGES, payload), [
|
|
231
|
+
connection.id,
|
|
232
|
+
]);
|
|
219
233
|
}
|
|
220
234
|
},
|
|
221
235
|
);
|
|
@@ -254,4 +268,4 @@ class TinyBasePartyKitServer {
|
|
|
254
268
|
}
|
|
255
269
|
}
|
|
256
270
|
|
|
257
|
-
export {TinyBasePartyKitServer};
|
|
271
|
+
export {TinyBasePartyKitServer, hasStoreInStorage, loadStoreFromStorage};
|
|
@@ -275,35 +275,35 @@ const setTransactionChangesToYDoc = (
|
|
|
275
275
|
transactionChangesFailed
|
|
276
276
|
? 0
|
|
277
277
|
: isUndefined(table)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
278
|
+
? yTables.delete(tableId)
|
|
279
|
+
: ifNotUndefined(
|
|
280
|
+
yTables.get(tableId),
|
|
281
|
+
(yTable) =>
|
|
282
|
+
objMap(table, (row, rowId) =>
|
|
283
|
+
transactionChangesFailed
|
|
284
|
+
? 0
|
|
285
|
+
: isUndefined(row)
|
|
286
|
+
? yTable.delete(rowId)
|
|
287
|
+
: ifNotUndefined(
|
|
288
|
+
yTable.get(rowId),
|
|
289
|
+
(yRow) =>
|
|
290
|
+
objMap(row, (cell, cellId) =>
|
|
291
|
+
isUndefined(cell)
|
|
292
|
+
? yRow.delete(cellId)
|
|
293
|
+
: yRow.set(cellId, cell),
|
|
294
|
+
),
|
|
295
|
+
transactionChangesDidFail,
|
|
294
296
|
),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
transactionChangesDidFail,
|
|
299
|
-
),
|
|
297
|
+
),
|
|
298
|
+
transactionChangesDidFail,
|
|
299
|
+
),
|
|
300
300
|
);
|
|
301
301
|
objMap(valueChanges, (value, valueId) =>
|
|
302
302
|
transactionChangesFailed
|
|
303
303
|
? 0
|
|
304
304
|
: isUndefined(value)
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
? yValues.delete(valueId)
|
|
306
|
+
: yValues.set(valueId, value),
|
|
307
307
|
);
|
|
308
308
|
});
|
|
309
309
|
if (transactionChangesFailed) {
|
package/lib/debug/queries.js
CHANGED
|
@@ -160,8 +160,8 @@ const getAggregateValue = (
|
|
|
160
160
|
aggregateValue = isUndefined(oldValue)
|
|
161
161
|
? aggregateAdd?.(aggregateValue, newValue, oldLength++)
|
|
162
162
|
: isUndefined(newValue)
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
? aggregateRemove?.(aggregateValue, oldValue, oldLength--)
|
|
164
|
+
: aggregateReplace?.(aggregateValue, newValue, oldValue, oldLength);
|
|
165
165
|
force ||= isUndefined(aggregateValue);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
@@ -454,8 +454,8 @@ const createQueries = getCreateFunction((store) => {
|
|
|
454
454
|
isFunction(arg1)
|
|
455
455
|
? arg1
|
|
456
456
|
: isUndefined(arg3)
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
? (getTableCell) => getTableCell(arg1) === arg2
|
|
458
|
+
: (getTableCell) => getTableCell(arg1, arg2) === arg3,
|
|
459
459
|
);
|
|
460
460
|
const group = (
|
|
461
461
|
selectedCellId,
|
|
@@ -658,12 +658,12 @@ const createQueries = getCreateFunction((store) => {
|
|
|
658
658
|
...(isUndefined(arg2)
|
|
659
659
|
? [tableId, rootRowId, arg1]
|
|
660
660
|
: arg1 === tableId
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
661
|
+
? [tableId, rootRowId, arg2]
|
|
662
|
+
: [
|
|
663
|
+
mapGet(joins, arg1)?.[0],
|
|
664
|
+
mapGet(mapGet(joins, arg1)?.[4], rootRowId)?.[0],
|
|
665
|
+
arg2,
|
|
666
|
+
]),
|
|
667
667
|
);
|
|
668
668
|
selectJoinWhereStore.transaction(() =>
|
|
669
669
|
arrayEvery(wheres, (where2) => where2(getTableCell))
|
|
@@ -268,8 +268,8 @@ const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
|
268
268
|
p == size(path)
|
|
269
269
|
? arrayPush(leaves, node)
|
|
270
270
|
: path[p] === null
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
? collForEach(node, (node2) => deep(node2, p + 1))
|
|
272
|
+
: arrayForEach([path[p], null], (id) => deep(mapGet(node, id), p + 1));
|
|
273
273
|
deep(deepIdSet, 0);
|
|
274
274
|
return leaves;
|
|
275
275
|
};
|
|
@@ -321,10 +321,10 @@ const getListenerFunctions = (getThing) => {
|
|
|
321
321
|
index == size(path)
|
|
322
322
|
? listener(thing, ...ids, ...extraArgsGetter(ids))
|
|
323
323
|
: isUndefined(path[index])
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
? arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
325
|
+
callWithIds(...ids, id2),
|
|
326
|
+
)
|
|
327
|
+
: callWithIds(...ids, path[index]);
|
|
328
328
|
};
|
|
329
329
|
callWithIds();
|
|
330
330
|
},
|
package/lib/debug/store.js
CHANGED
|
@@ -182,8 +182,8 @@ const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
|
182
182
|
p == size(path)
|
|
183
183
|
? arrayPush(leaves, node)
|
|
184
184
|
: path[p] === null
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
? collForEach(node, (node2) => deep(node2, p + 1))
|
|
186
|
+
: arrayForEach([path[p], null], (id) => deep(mapGet(node, id), p + 1));
|
|
187
187
|
deep(deepIdSet, 0);
|
|
188
188
|
return leaves;
|
|
189
189
|
};
|
|
@@ -235,10 +235,10 @@ const getListenerFunctions = (getThing) => {
|
|
|
235
235
|
index == size(path)
|
|
236
236
|
? listener(thing, ...ids, ...extraArgsGetter(ids))
|
|
237
237
|
: isUndefined(path[index])
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
? arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
239
|
+
callWithIds(...ids, id2),
|
|
240
|
+
)
|
|
241
|
+
: callWithIds(...ids, path[index]);
|
|
242
242
|
};
|
|
243
243
|
callWithIds();
|
|
244
244
|
},
|
|
@@ -400,8 +400,8 @@ const createStore = () => {
|
|
|
400
400
|
() => cellInvalid(tableId, rowId, cellId, cell),
|
|
401
401
|
)
|
|
402
402
|
: isUndefined(getCellOrValueType(cell))
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
? cellInvalid(tableId, rowId, cellId, cell)
|
|
404
|
+
: cell;
|
|
405
405
|
const validateValues = (values, skipDefaults) =>
|
|
406
406
|
validate(
|
|
407
407
|
skipDefaults ? values : addDefaultsToValues(values),
|
|
@@ -427,8 +427,8 @@ const createStore = () => {
|
|
|
427
427
|
() => valueInvalid(valueId, value),
|
|
428
428
|
)
|
|
429
429
|
: isUndefined(getCellOrValueType(value))
|
|
430
|
-
|
|
431
|
-
|
|
430
|
+
? valueInvalid(valueId, value)
|
|
431
|
+
: value;
|
|
432
432
|
const addDefaultsToRow = (row, tableId, rowId) => {
|
|
433
433
|
ifNotUndefined(
|
|
434
434
|
mapGet(tablesSchemaRowCache, tableId),
|
package/lib/debug/tinybase.js
CHANGED
|
@@ -386,8 +386,8 @@ const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
|
386
386
|
p == size(path)
|
|
387
387
|
? arrayPush(leaves, node)
|
|
388
388
|
: path[p] === null
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
? collForEach(node, (node2) => deep(node2, p + 1))
|
|
390
|
+
: arrayForEach([path[p], null], (id) => deep(mapGet(node, id), p + 1));
|
|
391
391
|
deep(deepIdSet, 0);
|
|
392
392
|
return leaves;
|
|
393
393
|
};
|
|
@@ -439,10 +439,10 @@ const getListenerFunctions = (getThing) => {
|
|
|
439
439
|
index == size(path)
|
|
440
440
|
? listener(thing, ...ids, ...extraArgsGetter(ids))
|
|
441
441
|
: isUndefined(path[index])
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
442
|
+
? arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
443
|
+
callWithIds(...ids, id2),
|
|
444
|
+
)
|
|
445
|
+
: callWithIds(...ids, path[index]);
|
|
446
446
|
};
|
|
447
447
|
callWithIds();
|
|
448
448
|
},
|
|
@@ -621,8 +621,8 @@ const createCheckpoints = getCreateFunction((store) => {
|
|
|
621
621
|
const action = arrayHas(backwardIds, checkpointId)
|
|
622
622
|
? goBackwardImpl
|
|
623
623
|
: arrayHas(forwardIds, checkpointId)
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
? goForwardImpl
|
|
625
|
+
: null;
|
|
626
626
|
while (!isUndefined(action) && checkpointId != currentId) {
|
|
627
627
|
action();
|
|
628
628
|
}
|
|
@@ -707,8 +707,8 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
707
707
|
isUndefined(value)
|
|
708
708
|
? EMPTY_STRING
|
|
709
709
|
: isArray(value)
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
? arrayMap(value, id)
|
|
711
|
+
: id(value),
|
|
712
712
|
addListener,
|
|
713
713
|
callListeners,
|
|
714
714
|
);
|
|
@@ -938,8 +938,8 @@ const getAggregateValue = (
|
|
|
938
938
|
aggregateValue = isUndefined(oldValue)
|
|
939
939
|
? aggregateAdd?.(aggregateValue, newValue, oldLength++)
|
|
940
940
|
: isUndefined(newValue)
|
|
941
|
-
|
|
942
|
-
|
|
941
|
+
? aggregateRemove?.(aggregateValue, oldValue, oldLength--)
|
|
942
|
+
: aggregateReplace?.(aggregateValue, newValue, oldValue, oldLength);
|
|
943
943
|
force ||= isUndefined(aggregateValue);
|
|
944
944
|
}
|
|
945
945
|
});
|
|
@@ -1301,8 +1301,8 @@ const createQueries = getCreateFunction((store) => {
|
|
|
1301
1301
|
isFunction(arg1)
|
|
1302
1302
|
? arg1
|
|
1303
1303
|
: isUndefined(arg3)
|
|
1304
|
-
|
|
1305
|
-
|
|
1304
|
+
? (getTableCell) => getTableCell(arg1) === arg2
|
|
1305
|
+
: (getTableCell) => getTableCell(arg1, arg2) === arg3,
|
|
1306
1306
|
);
|
|
1307
1307
|
const group = (
|
|
1308
1308
|
selectedCellId,
|
|
@@ -1505,12 +1505,12 @@ const createQueries = getCreateFunction((store) => {
|
|
|
1505
1505
|
...(isUndefined(arg2)
|
|
1506
1506
|
? [tableId, rootRowId, arg1]
|
|
1507
1507
|
: arg1 === tableId
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1508
|
+
? [tableId, rootRowId, arg2]
|
|
1509
|
+
: [
|
|
1510
|
+
mapGet(joins, arg1)?.[0],
|
|
1511
|
+
mapGet(mapGet(joins, arg1)?.[4], rootRowId)?.[0],
|
|
1512
|
+
arg2,
|
|
1513
|
+
]),
|
|
1514
1514
|
);
|
|
1515
1515
|
selectJoinWhereStore.transaction(() =>
|
|
1516
1516
|
arrayEvery(wheres, (where2) => where2(getTableCell))
|
|
@@ -1980,8 +1980,8 @@ const createStore = () => {
|
|
|
1980
1980
|
() => cellInvalid(tableId, rowId, cellId, cell),
|
|
1981
1981
|
)
|
|
1982
1982
|
: isUndefined(getCellOrValueType(cell))
|
|
1983
|
-
|
|
1984
|
-
|
|
1983
|
+
? cellInvalid(tableId, rowId, cellId, cell)
|
|
1984
|
+
: cell;
|
|
1985
1985
|
const validateValues = (values, skipDefaults) =>
|
|
1986
1986
|
validate(
|
|
1987
1987
|
skipDefaults ? values : addDefaultsToValues(values),
|
|
@@ -2007,8 +2007,8 @@ const createStore = () => {
|
|
|
2007
2007
|
() => valueInvalid(valueId, value),
|
|
2008
2008
|
)
|
|
2009
2009
|
: isUndefined(getCellOrValueType(value))
|
|
2010
|
-
|
|
2011
|
-
|
|
2010
|
+
? valueInvalid(valueId, value)
|
|
2011
|
+
: value;
|
|
2012
2012
|
const addDefaultsToRow = (row, tableId, rowId) => {
|
|
2013
2013
|
ifNotUndefined(
|
|
2014
2014
|
mapGet(tablesSchemaRowCache, tableId),
|
package/lib/debug/tools.js
CHANGED
|
@@ -575,8 +575,8 @@ const RelationshipInHtmlRow = ({
|
|
|
575
575
|
tableId === localTableId
|
|
576
576
|
? localRowId
|
|
577
577
|
: tableId === remoteTableId
|
|
578
|
-
|
|
579
|
-
|
|
578
|
+
? remoteRowId
|
|
579
|
+
: null;
|
|
580
580
|
return isUndefined(rowId)
|
|
581
581
|
? null
|
|
582
582
|
: /* @__PURE__ */ createElement(
|
|
@@ -1796,8 +1796,8 @@ const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
|
1796
1796
|
p == size(path)
|
|
1797
1797
|
? arrayPush(leaves, node)
|
|
1798
1798
|
: path[p] === null
|
|
1799
|
-
|
|
1800
|
-
|
|
1799
|
+
? collForEach(node, (node2) => deep(node2, p + 1))
|
|
1800
|
+
: arrayForEach([path[p], null], (id) => deep(mapGet(node, id), p + 1));
|
|
1801
1801
|
deep(deepIdSet, 0);
|
|
1802
1802
|
return leaves;
|
|
1803
1803
|
};
|
|
@@ -1849,10 +1849,10 @@ const getListenerFunctions = (getThing) => {
|
|
|
1849
1849
|
index == size(path)
|
|
1850
1850
|
? listener(thing, ...ids, ...extraArgsGetter(ids))
|
|
1851
1851
|
: isUndefined(path[index])
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1852
|
+
? arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
1853
|
+
callWithIds(...ids, id2),
|
|
1854
|
+
)
|
|
1855
|
+
: callWithIds(...ids, path[index]);
|
|
1856
1856
|
};
|
|
1857
1857
|
callWithIds();
|
|
1858
1858
|
},
|
|
@@ -1995,8 +1995,8 @@ const createStore = () => {
|
|
|
1995
1995
|
() => cellInvalid(tableId, rowId, cellId, cell),
|
|
1996
1996
|
)
|
|
1997
1997
|
: isUndefined(getCellOrValueType(cell))
|
|
1998
|
-
|
|
1999
|
-
|
|
1998
|
+
? cellInvalid(tableId, rowId, cellId, cell)
|
|
1999
|
+
: cell;
|
|
2000
2000
|
const validateValues = (values, skipDefaults) =>
|
|
2001
2001
|
validate(
|
|
2002
2002
|
skipDefaults ? values : addDefaultsToValues(values),
|
|
@@ -2022,8 +2022,8 @@ const createStore = () => {
|
|
|
2022
2022
|
() => valueInvalid(valueId, value),
|
|
2023
2023
|
)
|
|
2024
2024
|
: isUndefined(getCellOrValueType(value))
|
|
2025
|
-
|
|
2026
|
-
|
|
2025
|
+
? valueInvalid(valueId, value)
|
|
2026
|
+
: value;
|
|
2027
2027
|
const addDefaultsToRow = (row, tableId, rowId) => {
|
|
2028
2028
|
ifNotUndefined(
|
|
2029
2029
|
mapGet(tablesSchemaRowCache, tableId),
|