@dvina/sdk 4.0.142 → 4.0.151
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/dist/adapters/angular/index.cjs +3 -3
- package/dist/adapters/angular/index.js +1 -1
- package/dist/{chunk-AYE3QJ2O.js → chunk-N64A3FWK.js} +254 -27
- package/dist/chunk-N64A3FWK.js.map +1 -0
- package/dist/{chunk-UDXG6COO.cjs → chunk-RSSJCKVR.cjs} +254 -27
- package/dist/chunk-RSSJCKVR.cjs.map +1 -0
- package/dist/index.cjs +335 -335
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AYE3QJ2O.js.map +0 -1
- package/dist/chunk-UDXG6COO.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRSSJCKVR_cjs = require('../../chunk-RSSJCKVR.cjs');
|
|
4
4
|
require('../../chunk-342BFYZZ.cjs');
|
|
5
5
|
require('../../chunk-UELAE75E.cjs');
|
|
6
6
|
require('../../chunk-BL3GFOZR.cjs');
|
|
@@ -147,10 +147,10 @@ function hasDispose(value) {
|
|
|
147
147
|
function provideDvina(optionsOrFactory) {
|
|
148
148
|
return core.makeEnvironmentProviders([
|
|
149
149
|
{
|
|
150
|
-
provide:
|
|
150
|
+
provide: chunkRSSJCKVR_cjs.DvinaSdk,
|
|
151
151
|
useFactory: () => {
|
|
152
152
|
const options = typeof optionsOrFactory === "function" ? optionsOrFactory() : optionsOrFactory;
|
|
153
|
-
return new
|
|
153
|
+
return new chunkRSSJCKVR_cjs.DvinaSdk(options);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
]);
|
|
@@ -8670,6 +8670,28 @@ function flattenEntity(data) {
|
|
|
8670
8670
|
}
|
|
8671
8671
|
return result;
|
|
8672
8672
|
}
|
|
8673
|
+
function isPlainObject(value) {
|
|
8674
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
8675
|
+
}
|
|
8676
|
+
function areRecordValuesEqual(left, right) {
|
|
8677
|
+
if (Object.is(left, right)) {
|
|
8678
|
+
return true;
|
|
8679
|
+
}
|
|
8680
|
+
if (left instanceof Date && right instanceof Date) {
|
|
8681
|
+
return left.getTime() === right.getTime();
|
|
8682
|
+
}
|
|
8683
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
8684
|
+
return left.length === right.length && left.every((value, index) => areRecordValuesEqual(value, right[index]));
|
|
8685
|
+
}
|
|
8686
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
8687
|
+
const leftKeys = Object.keys(left);
|
|
8688
|
+
const rightKeys = Object.keys(right);
|
|
8689
|
+
return leftKeys.length === rightKeys.length && leftKeys.every(
|
|
8690
|
+
(key) => Object.prototype.hasOwnProperty.call(right, key) && areRecordValuesEqual(left[key], right[key])
|
|
8691
|
+
);
|
|
8692
|
+
}
|
|
8693
|
+
return false;
|
|
8694
|
+
}
|
|
8673
8695
|
function normalize(data, rootField) {
|
|
8674
8696
|
const entities = /* @__PURE__ */ new Map();
|
|
8675
8697
|
const nestedConnections = /* @__PURE__ */ new Map();
|
|
@@ -8780,33 +8802,73 @@ function extractEntity(data, entities, nestedConnections) {
|
|
|
8780
8802
|
}
|
|
8781
8803
|
}
|
|
8782
8804
|
function mergeEntityRecord(existing, incoming) {
|
|
8783
|
-
|
|
8805
|
+
let result;
|
|
8784
8806
|
for (const [key, value] of Object.entries(incoming)) {
|
|
8785
|
-
if (value
|
|
8786
|
-
|
|
8807
|
+
if (value === void 0) {
|
|
8808
|
+
continue;
|
|
8787
8809
|
}
|
|
8810
|
+
if (Object.prototype.hasOwnProperty.call(existing, key) && areRecordValuesEqual(existing[key], value)) {
|
|
8811
|
+
continue;
|
|
8812
|
+
}
|
|
8813
|
+
result ??= { ...existing };
|
|
8814
|
+
result[key] = value;
|
|
8788
8815
|
}
|
|
8789
|
-
return result;
|
|
8816
|
+
return result ?? existing;
|
|
8790
8817
|
}
|
|
8791
8818
|
|
|
8792
8819
|
// src/store/cache-manager.ts
|
|
8820
|
+
var QUERY_FRESHNESS_KEY_PREFIX = "queryFreshness:";
|
|
8821
|
+
function getQueryFreshnessKey(queryKey) {
|
|
8822
|
+
return `${QUERY_FRESHNESS_KEY_PREFIX}${queryKey}`;
|
|
8823
|
+
}
|
|
8824
|
+
function areArraysEqual(left, right) {
|
|
8825
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
8826
|
+
}
|
|
8827
|
+
function arePageInfosEqual(left, right) {
|
|
8828
|
+
if (left === right) {
|
|
8829
|
+
return true;
|
|
8830
|
+
}
|
|
8831
|
+
if (!left || !right) {
|
|
8832
|
+
return left === right;
|
|
8833
|
+
}
|
|
8834
|
+
return left.hasNextPage === right.hasNextPage && left.hasPreviousPage === right.hasPreviousPage && left.startCursor === right.startCursor && left.endCursor === right.endCursor;
|
|
8835
|
+
}
|
|
8836
|
+
function hasSameQueryResultContents(existing, incoming) {
|
|
8837
|
+
return existing.entityType === incoming.entityType && areArraysEqual(existing.entityIds, incoming.entityIds) && arePageInfosEqual(existing.pageInfo, incoming.pageInfo) && existing.totalCount === incoming.totalCount;
|
|
8838
|
+
}
|
|
8793
8839
|
var CacheManager = class {
|
|
8794
8840
|
constructor(_db) {
|
|
8795
8841
|
this._db = _db;
|
|
8796
8842
|
}
|
|
8843
|
+
async _touchQueryFreshness(queryKey, fetchedAt = Date.now()) {
|
|
8844
|
+
await this._db._sync.put({ key: getQueryFreshnessKey(queryKey), value: fetchedAt });
|
|
8845
|
+
}
|
|
8846
|
+
async getQueryFetchedAt(queryKey, fallback) {
|
|
8847
|
+
const freshness = await this._db._sync.get(getQueryFreshnessKey(queryKey));
|
|
8848
|
+
return typeof freshness?.value === "number" ? freshness.value : fallback?.fetchedAt;
|
|
8849
|
+
}
|
|
8797
8850
|
/**
|
|
8798
8851
|
* Write connection metadata to the `_queryResults` table.
|
|
8799
8852
|
*/
|
|
8800
8853
|
async writeQueryResult(queryKey, connection) {
|
|
8854
|
+
const fetchedAt = Date.now();
|
|
8855
|
+
const existing = await this._db._queryResults.get(queryKey);
|
|
8856
|
+
if (existing && hasSameQueryResultContents(existing, connection)) {
|
|
8857
|
+
await this._touchQueryFreshness(queryKey, fetchedAt);
|
|
8858
|
+
return;
|
|
8859
|
+
}
|
|
8801
8860
|
const entry = {
|
|
8802
8861
|
key: queryKey,
|
|
8803
8862
|
entityType: connection.entityType,
|
|
8804
8863
|
entityIds: connection.entityIds,
|
|
8805
8864
|
pageInfo: connection.pageInfo,
|
|
8806
8865
|
totalCount: connection.totalCount,
|
|
8807
|
-
fetchedAt
|
|
8866
|
+
fetchedAt
|
|
8808
8867
|
};
|
|
8809
|
-
await this._db._queryResults.
|
|
8868
|
+
await this._db.transaction("rw", [this._db._queryResults, this._db._sync], async () => {
|
|
8869
|
+
await this._db._queryResults.put(entry);
|
|
8870
|
+
await this._touchQueryFreshness(queryKey, fetchedAt);
|
|
8871
|
+
});
|
|
8810
8872
|
}
|
|
8811
8873
|
/**
|
|
8812
8874
|
* Append new page results to an existing query result entry.
|
|
@@ -8815,13 +8877,24 @@ var CacheManager = class {
|
|
|
8815
8877
|
async appendQueryResult(queryKey, connection) {
|
|
8816
8878
|
const existing = await this._db._queryResults.get(queryKey);
|
|
8817
8879
|
if (existing) {
|
|
8880
|
+
const fetchedAt = Date.now();
|
|
8818
8881
|
const existingIds = new Set(existing.entityIds);
|
|
8819
8882
|
const newIds = connection.entityIds.filter((id) => !existingIds.has(id));
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
existing.
|
|
8824
|
-
|
|
8883
|
+
const nextEntityIds = newIds.length > 0 ? [...existing.entityIds, ...newIds] : existing.entityIds;
|
|
8884
|
+
const nextPageInfo = connection.pageInfo ?? existing.pageInfo;
|
|
8885
|
+
const nextTotalCount = connection.totalCount ?? existing.totalCount;
|
|
8886
|
+
if (areArraysEqual(existing.entityIds, nextEntityIds) && arePageInfosEqual(existing.pageInfo, nextPageInfo) && existing.totalCount === nextTotalCount) {
|
|
8887
|
+
await this._touchQueryFreshness(queryKey, fetchedAt);
|
|
8888
|
+
return;
|
|
8889
|
+
}
|
|
8890
|
+
existing.entityIds = nextEntityIds;
|
|
8891
|
+
existing.pageInfo = nextPageInfo;
|
|
8892
|
+
existing.totalCount = nextTotalCount;
|
|
8893
|
+
existing.fetchedAt = fetchedAt;
|
|
8894
|
+
await this._db.transaction("rw", [this._db._queryResults, this._db._sync], async () => {
|
|
8895
|
+
await this._db._queryResults.put(existing);
|
|
8896
|
+
await this._touchQueryFreshness(queryKey, fetchedAt);
|
|
8897
|
+
});
|
|
8825
8898
|
} else {
|
|
8826
8899
|
await this.writeQueryResult(queryKey, connection);
|
|
8827
8900
|
}
|
|
@@ -8838,7 +8911,10 @@ var CacheManager = class {
|
|
|
8838
8911
|
*/
|
|
8839
8912
|
async invalidateQuery(operationName, variables) {
|
|
8840
8913
|
const key = buildQueryKey(operationName, variables);
|
|
8841
|
-
await this._db._queryResults.
|
|
8914
|
+
await this._db.transaction("rw", [this._db._queryResults, this._db._sync], async () => {
|
|
8915
|
+
await this._db._queryResults.delete(key);
|
|
8916
|
+
await this._db._sync.delete(getQueryFreshnessKey(key));
|
|
8917
|
+
});
|
|
8842
8918
|
}
|
|
8843
8919
|
/**
|
|
8844
8920
|
* Remove an entity ID from all query results for a given entity type.
|
|
@@ -9124,7 +9200,8 @@ var QueryExecutor = class {
|
|
|
9124
9200
|
try {
|
|
9125
9201
|
const result = await buildResult(this._db);
|
|
9126
9202
|
ref._markInitialized(result);
|
|
9127
|
-
|
|
9203
|
+
const fetchedAt = await this._cache.getQueryFetchedAt(queryKey, cached);
|
|
9204
|
+
if (!fetchedAt || Date.now() - fetchedAt > CACHE_TTL_MS) {
|
|
9128
9205
|
this.query(document2, variables, operationName).catch(() => {
|
|
9129
9206
|
});
|
|
9130
9207
|
}
|
|
@@ -9173,10 +9250,17 @@ var QueryExecutor = class {
|
|
|
9173
9250
|
return record[pkField];
|
|
9174
9251
|
});
|
|
9175
9252
|
const existingRecords = await table.bulkGet(pks);
|
|
9176
|
-
const toPut = records.
|
|
9253
|
+
const toPut = records.flatMap((record, i) => {
|
|
9177
9254
|
const existing = existingRecords[i];
|
|
9178
|
-
|
|
9255
|
+
if (!existing) {
|
|
9256
|
+
return [record];
|
|
9257
|
+
}
|
|
9258
|
+
const merged = mergeEntityRecord(existing, record);
|
|
9259
|
+
return merged === existing ? [] : [merged];
|
|
9179
9260
|
});
|
|
9261
|
+
if (toPut.length === 0) {
|
|
9262
|
+
continue;
|
|
9263
|
+
}
|
|
9180
9264
|
await table.bulkPut(toPut);
|
|
9181
9265
|
}
|
|
9182
9266
|
});
|
|
@@ -9296,7 +9380,9 @@ var OptimisticManager = class {
|
|
|
9296
9380
|
const snapshot = existing ? structuredClone(existing) : void 0;
|
|
9297
9381
|
if (existing) {
|
|
9298
9382
|
const merged = mergeEntityRecord(existing, data);
|
|
9299
|
-
|
|
9383
|
+
if (merged !== existing) {
|
|
9384
|
+
await table.put(merged);
|
|
9385
|
+
}
|
|
9300
9386
|
}
|
|
9301
9387
|
return async () => {
|
|
9302
9388
|
if (snapshot) {
|
|
@@ -9763,7 +9849,9 @@ var SyncEngine = class {
|
|
|
9763
9849
|
await this._queryExecutor.writeEntities(entities);
|
|
9764
9850
|
} else if (existing) {
|
|
9765
9851
|
const merged = mergeEntityRecord(existing, record);
|
|
9766
|
-
|
|
9852
|
+
if (merged !== existing) {
|
|
9853
|
+
await table.put(merged);
|
|
9854
|
+
}
|
|
9767
9855
|
} else {
|
|
9768
9856
|
await table.put(record);
|
|
9769
9857
|
}
|
|
@@ -9807,7 +9895,8 @@ var SyncEngine = class {
|
|
|
9807
9895
|
if (!touchedAt) return;
|
|
9808
9896
|
const cached = await this._db._queryResults.get(sub.queryKey);
|
|
9809
9897
|
if (!cached) return;
|
|
9810
|
-
|
|
9898
|
+
const fetchedAt = await this._cache.getQueryFetchedAt(sub.queryKey, cached);
|
|
9899
|
+
if ((fetchedAt ?? cached.fetchedAt) >= touchedAt) return;
|
|
9811
9900
|
await this.query(sub.document, sub.variables, sub.operationName).catch(() => void 0);
|
|
9812
9901
|
}
|
|
9813
9902
|
async _revalidateAllActiveSubscriptions() {
|
|
@@ -10498,6 +10587,124 @@ function inferTargetTables(fieldName) {
|
|
|
10498
10587
|
return normalizedTypeName === normalizedFieldName || normalizedTypeName.endsWith(normalizedFieldName) || normalizedTableName === normalizedFieldName || normalizedTableName === `${normalizedFieldName}s`;
|
|
10499
10588
|
}).map(([tableName]) => tableName);
|
|
10500
10589
|
}
|
|
10590
|
+
function getIncludeQueryKey(parentTable, parentId, fieldName) {
|
|
10591
|
+
return `${parentTable}.${parentId}.${fieldName}`;
|
|
10592
|
+
}
|
|
10593
|
+
function hasNestedIncludes(include) {
|
|
10594
|
+
return Boolean(include.children?.length);
|
|
10595
|
+
}
|
|
10596
|
+
function canUseFlatIncludeBatch(includes) {
|
|
10597
|
+
return includes.length > 0 && includes.every((include) => !hasNestedIncludes(include));
|
|
10598
|
+
}
|
|
10599
|
+
function cloneEntity(entity) {
|
|
10600
|
+
return { ...entity };
|
|
10601
|
+
}
|
|
10602
|
+
function defaultIncludeValue(inc) {
|
|
10603
|
+
if (inc.isConnection) {
|
|
10604
|
+
return {
|
|
10605
|
+
__typename: "Unknown",
|
|
10606
|
+
nodes: [],
|
|
10607
|
+
pageInfo: { hasNextPage: false, hasPreviousPage: false },
|
|
10608
|
+
totalCount: 0
|
|
10609
|
+
};
|
|
10610
|
+
}
|
|
10611
|
+
if (inc.isList) {
|
|
10612
|
+
return [];
|
|
10613
|
+
}
|
|
10614
|
+
return null;
|
|
10615
|
+
}
|
|
10616
|
+
async function preloadFlatIncludeContext(db, parentTable, parentIds, includes) {
|
|
10617
|
+
const queryKeys = [];
|
|
10618
|
+
for (const parentId of parentIds) {
|
|
10619
|
+
for (const include of includes) {
|
|
10620
|
+
queryKeys.push(getIncludeQueryKey(parentTable, parentId, include.fieldName));
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10623
|
+
const queryResults = queryKeys.length > 0 ? await db._queryResults.bulkGet(queryKeys) : [];
|
|
10624
|
+
const queryResultsByKey = /* @__PURE__ */ new Map();
|
|
10625
|
+
const childIdsByType = /* @__PURE__ */ new Map();
|
|
10626
|
+
for (let i = 0; i < queryKeys.length; i++) {
|
|
10627
|
+
const queryResult = queryResults[i];
|
|
10628
|
+
if (!queryResult) {
|
|
10629
|
+
continue;
|
|
10630
|
+
}
|
|
10631
|
+
queryResultsByKey.set(queryKeys[i], queryResult);
|
|
10632
|
+
let entityIds = childIdsByType.get(queryResult.entityType);
|
|
10633
|
+
if (!entityIds) {
|
|
10634
|
+
entityIds = /* @__PURE__ */ new Set();
|
|
10635
|
+
childIdsByType.set(queryResult.entityType, entityIds);
|
|
10636
|
+
}
|
|
10637
|
+
for (const entityId of queryResult.entityIds) {
|
|
10638
|
+
entityIds.add(entityId);
|
|
10639
|
+
}
|
|
10640
|
+
}
|
|
10641
|
+
const childEntitiesByType = /* @__PURE__ */ new Map();
|
|
10642
|
+
await Promise.all(
|
|
10643
|
+
Array.from(childIdsByType.entries()).map(async ([entityType, entityIds]) => {
|
|
10644
|
+
const idList = Array.from(entityIds);
|
|
10645
|
+
const childRecords = await db.table(entityType).bulkGet(idList.map((id) => parsePrimaryKeyString(entityType, id)));
|
|
10646
|
+
const childMap = /* @__PURE__ */ new Map();
|
|
10647
|
+
for (let i = 0; i < idList.length; i++) {
|
|
10648
|
+
const childRecord = childRecords[i];
|
|
10649
|
+
if (!childRecord || typeof childRecord !== "object") {
|
|
10650
|
+
continue;
|
|
10651
|
+
}
|
|
10652
|
+
childMap.set(idList[i], childRecord);
|
|
10653
|
+
}
|
|
10654
|
+
childEntitiesByType.set(entityType, childMap);
|
|
10655
|
+
})
|
|
10656
|
+
);
|
|
10657
|
+
return { childEntitiesByType, queryResultsByKey };
|
|
10658
|
+
}
|
|
10659
|
+
function resolveFlatChildEntities(context, queryResult) {
|
|
10660
|
+
const childMap = context.childEntitiesByType.get(queryResult.entityType);
|
|
10661
|
+
if (!childMap) {
|
|
10662
|
+
return [];
|
|
10663
|
+
}
|
|
10664
|
+
const children = [];
|
|
10665
|
+
for (const entityId of queryResult.entityIds) {
|
|
10666
|
+
const child = childMap.get(entityId);
|
|
10667
|
+
if (child) {
|
|
10668
|
+
children.push(child);
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
return children;
|
|
10672
|
+
}
|
|
10673
|
+
async function reconstructFlatEntity(db, parentTable, parentEntity, parentId, includes, context) {
|
|
10674
|
+
const result = cloneEntity(parentEntity);
|
|
10675
|
+
for (const inc of includes) {
|
|
10676
|
+
const queryResult = context.queryResultsByKey.get(getIncludeQueryKey(parentTable, parentId, inc.fieldName));
|
|
10677
|
+
if (!queryResult) {
|
|
10678
|
+
const fallback = inc.isConnection ? void 0 : await resolveSingleRelationFallback(db, parentTable, result, inc);
|
|
10679
|
+
if (fallback) {
|
|
10680
|
+
result[inc.fieldName] = fallback.entity;
|
|
10681
|
+
continue;
|
|
10682
|
+
}
|
|
10683
|
+
result[inc.fieldName] = defaultIncludeValue(inc);
|
|
10684
|
+
continue;
|
|
10685
|
+
}
|
|
10686
|
+
const childEntities = resolveFlatChildEntities(context, queryResult);
|
|
10687
|
+
if (inc.isConnection) {
|
|
10688
|
+
result[inc.fieldName] = {
|
|
10689
|
+
__typename: (TABLE_TO_TYPENAME[queryResult.entityType] ?? queryResult.entityType) + "Connection",
|
|
10690
|
+
nodes: childEntities.map(cloneEntity),
|
|
10691
|
+
pageInfo: queryResult.pageInfo ?? {
|
|
10692
|
+
hasNextPage: false,
|
|
10693
|
+
hasPreviousPage: false
|
|
10694
|
+
},
|
|
10695
|
+
totalCount: queryResult.totalCount ?? 0
|
|
10696
|
+
};
|
|
10697
|
+
continue;
|
|
10698
|
+
}
|
|
10699
|
+
if (inc.isList) {
|
|
10700
|
+
result[inc.fieldName] = childEntities.map(cloneEntity);
|
|
10701
|
+
continue;
|
|
10702
|
+
}
|
|
10703
|
+
const child = childEntities[0];
|
|
10704
|
+
result[inc.fieldName] = child ? cloneEntity(child) : null;
|
|
10705
|
+
}
|
|
10706
|
+
return result;
|
|
10707
|
+
}
|
|
10501
10708
|
async function resolveSingleRelationFallback(db, parentTable, parentEntity, inc) {
|
|
10502
10709
|
const targetTables = inc.syncMetadata?.entityType ? [inc.syncMetadata.entityType] : inferTargetTables(inc.fieldName);
|
|
10503
10710
|
if (targetTables.length === 0) {
|
|
@@ -10522,9 +10729,13 @@ async function reconstructEntity(db, tableName, entityId, includes) {
|
|
|
10522
10729
|
const dexieKey = parsePrimaryKeyString(tableName, entityId);
|
|
10523
10730
|
const entity = await db.table(tableName).get(dexieKey);
|
|
10524
10731
|
if (!entity) return {};
|
|
10732
|
+
if (canUseFlatIncludeBatch(includes)) {
|
|
10733
|
+
const context = await preloadFlatIncludeContext(db, tableName, [entityId], includes);
|
|
10734
|
+
return reconstructFlatEntity(db, tableName, entity, entityId, includes, context);
|
|
10735
|
+
}
|
|
10525
10736
|
const result = { ...entity };
|
|
10526
10737
|
for (const inc of includes) {
|
|
10527
|
-
const connKey =
|
|
10738
|
+
const connKey = getIncludeQueryKey(tableName, entityId, inc.fieldName);
|
|
10528
10739
|
const qr = await db._queryResults.get(connKey);
|
|
10529
10740
|
if (!qr) {
|
|
10530
10741
|
const fallback = inc.isConnection ? void 0 : await resolveSingleRelationFallback(db, tableName, result, inc);
|
|
@@ -10537,12 +10748,7 @@ async function reconstructEntity(db, tableName, entityId, includes) {
|
|
|
10537
10748
|
result[inc.fieldName] = fallback.entity;
|
|
10538
10749
|
continue;
|
|
10539
10750
|
}
|
|
10540
|
-
result[inc.fieldName] = inc
|
|
10541
|
-
__typename: "Unknown",
|
|
10542
|
-
nodes: [],
|
|
10543
|
-
pageInfo: { hasNextPage: false, hasPreviousPage: false },
|
|
10544
|
-
totalCount: 0
|
|
10545
|
-
} : inc.isList ? [] : null;
|
|
10751
|
+
result[inc.fieldName] = defaultIncludeValue(inc);
|
|
10546
10752
|
continue;
|
|
10547
10753
|
}
|
|
10548
10754
|
if (inc.isConnection) {
|
|
@@ -10591,6 +10797,27 @@ async function reconstructEntity(db, tableName, entityId, includes) {
|
|
|
10591
10797
|
}
|
|
10592
10798
|
async function reconstructConnectionNodes(db, entityTable, nodes, includes) {
|
|
10593
10799
|
if (includes.length === 0) return nodes;
|
|
10800
|
+
if (canUseFlatIncludeBatch(includes)) {
|
|
10801
|
+
const nodeIds = nodes.map((node) => primaryKeyToString(entityTable, node));
|
|
10802
|
+
const parentEntities = await db.table(entityTable).bulkGet(nodeIds.map((id) => parsePrimaryKeyString(entityTable, id)));
|
|
10803
|
+
const context = await preloadFlatIncludeContext(db, entityTable, nodeIds, includes);
|
|
10804
|
+
return Promise.all(
|
|
10805
|
+
nodeIds.map(async (nodeId, index) => {
|
|
10806
|
+
const parentEntity = parentEntities[index];
|
|
10807
|
+
if (!parentEntity || typeof parentEntity !== "object") {
|
|
10808
|
+
return {};
|
|
10809
|
+
}
|
|
10810
|
+
return reconstructFlatEntity(
|
|
10811
|
+
db,
|
|
10812
|
+
entityTable,
|
|
10813
|
+
parentEntity,
|
|
10814
|
+
nodeId,
|
|
10815
|
+
includes,
|
|
10816
|
+
context
|
|
10817
|
+
);
|
|
10818
|
+
})
|
|
10819
|
+
);
|
|
10820
|
+
}
|
|
10594
10821
|
return Promise.all(
|
|
10595
10822
|
nodes.map(async (node) => {
|
|
10596
10823
|
const nodeId = primaryKeyToString(entityTable, node);
|
|
@@ -20399,5 +20626,5 @@ var DvinaSdk = class extends Request {
|
|
|
20399
20626
|
};
|
|
20400
20627
|
|
|
20401
20628
|
export { AbortChatMutation, Action, AddInsightToReportMutation, Agent, AgentConnection, AgentQuery, AgentSubBuilder, Agent_ChatsQuery, AgentsQuery, Artifact, ArtifactConnection, ArtifactQuery, ArtifactSubBuilder, Artifact_ChatQuery, Artifact_Chat_InsightQuery, Artifact_FileQuery, Artifact_MessageQuery, Artifact_Message_ChatQuery, Artifact_Message_ContentsQuery, Artifact_Message_FeedbackQuery, ArtifactsQuery, AudioEventOutput, CancelOauthFlowMutation, CancelWorkspaceDeletionMutation, Candidate, CandidateEvidence, Chat, ChatConnection, ChatImportExecuteOutput, ChatImportPreviewOutput, ChatMessage, ChatMessageConnection, ChatMessageQuery, ChatMessageSubBuilder, ChatMessage_ArtifactsQuery, ChatMessage_ChatQuery, ChatMessage_Chat_InsightQuery, ChatMessage_ContentsQuery, ChatMessage_FeedbackQuery, ChatMessagesQuery, ChatQuery, ChatSubBuilder, ChatTitleEventOutput, Chat_AgentsQuery, Chat_ArtifactsQuery, Chat_InsightQuery, Chat_Insight_ReportMembersQuery, Chat_Insight_ThumbnailFileQuery, Chat_MessagesQuery, ChatsQuery, ConnectIntegrationMutation, ConsumePulseEventsMutation, ContentBlock, ContentMask, ContinueImportedChatMutation, ContinueInterpretationMutation, CreateAgentMutation, CreateChatMutation, CreateDatabaseMutation, CreateDocumentMutation, CreateFeedbackMutation, CreateFolderMutation, CreateInsightMutation, CreateIntegrationMutation, CreateIntegrationOutput, CreateReportMutation, CreateTableMutation, CreateUserSkillFileMutation, CreateUserSkillFolderMutation, CubeModel, DB_ENTITY_SCHEMA, Database, DatabaseCatalog, DatabaseCatalogConnection, DatabaseCatalogQuery, DatabaseCatalogSubBuilder, DatabaseCatalog_EngineQuery, DatabaseCatalogsQuery, DatabaseConnection, DatabaseEngine, DatabaseQuery, DatabaseSchemaQuery, DatabaseSubBuilder, Database_EngineQuery, Database_Engine_CatalogQuery, Database_TablesQuery, DatabasesQuery, DeepAnalysisUsage, DeferredDvinaQueryRef, DeleteAgentMutation, DeleteArtifactMutation, DeleteChatMutation, DeleteDatabaseMutation, DeleteDocumentMutation, DeleteFolderMutation, DeleteInsightMutation, DeleteInsightsMutation, DeleteIntegrationMutation, DeleteReportMutation, DeleteTableMutation, DeleteUserSkillFileMutation, DeleteUserSkillFolderMutation, DevAccessTokenOutput, DexieLiveQueryRef, DisconnectIntegrationMutation, DismissPulseEventMutation, Document, DocumentCatalog, DocumentCatalogConnection, DocumentCatalogQuery, DocumentCatalogSubBuilder, DocumentCatalog_FormatQuery, DocumentCatalogsQuery, DocumentConnection, DocumentContent, DocumentFormat, DocumentQuery, DocumentSubBuilder, Document_ContentsQuery, Document_FileQuery, Document_FormatQuery, Document_Format_CatalogQuery, Document_TablesQuery, DocumentsQuery, DvinaDatabase, DvinaModel, DvinaSdk, Evidence, ExecuteChatImportMutation, ExportQuery, ExportWithInsightIdQuery, FailedSyncEventIngestion, FeedArtifactData, FeedConnection, FeedDatabaseData, FeedDocumentData, FeedIntegrationData, FeedItem, FeedItemGenerated, FeedItemQuery, FeedItemSubBuilder, FeedItem_ActionQuery, FeedItem_DataQuery, FeedItemsQuery, FeedLiveContextData, FeedPulseData, FeedSendMessageAction, Feedback, File, FileMetaQuery, FileModel, FileQuery, FileUrlsQuery, FinalContentEventOutput, FindFitTierQuery, Folder, FolderConnection, FolderQuery, FoldersQuery, GenerateUploadUriMutation, GetCapabilityQuery, GetDevAccessTokenQuery, GetLimitQuery, GetRemainingQuery, GetTokenUsageByModelQuery, GetTokenUsageHistoryQuery, GetTokenUsageStatusQuery, GetTokenUsageStatus_WindowsQuery, GetTokenUsageStatus_Windows_DayQuery, GetTokenUsageStatus_Windows_FiveHourQuery, GetTokenUsageStatus_Windows_MonthQuery, GetTokenUsageStatus_Windows_WeekQuery, GetUsageQuery, ImportedChatSummaryOutput, InferenceRequestAudit, Insight, InsightConnection, InsightQuery, InsightSubBuilder, Insight_ChatQuery, Insight_ReportMembersQuery, Insight_ReportsQuery, Insight_ThumbnailFileQuery, InsightsQuery, Integration, IntegrationCatalog, IntegrationCatalogConnection, IntegrationCatalogQuery, IntegrationCatalogSubBuilder, IntegrationCatalogToolsQuery, IntegrationCatalog_ProviderQuery, IntegrationCatalogsQuery, IntegrationConnection, IntegrationProvider, IntegrationQuery, IntegrationSubBuilder, Integration_ProviderQuery, Integration_Provider_CatalogQuery, IntegrationsQuery, Interpretation, InterpretationConnection, InterpretationsQuery, Invocation, LiveContext, MUTATION_CACHE_RULES, MappedDvinaQueryRef, McpAuthUpdateModel, McpAuthUpdatesSubscription, McpClientInformation, McpCodeVerifier, McpServer, McpTokens, McpTool, MessageEndEventOutput, MessageStartEventOutput, ModelTokenUsage, Notification, NotificationConnection, NotificationQuery, NotificationsByReferenceQuery, NotificationsQuery, PRIMARY_KEY_CONFIG, PreviewChatImportMutation, PrivacyStats, PrivacyStatsQuery, PulseAppSummaryModel, PulseAppSummaryQuery, PulseEvent, PulseEventConnection, PulseEventQuery, PulseEventSubBuilder, PulseEvent_IntegrationQuery, PulseEvent_Integration_ProviderQuery, PulseEventsQuery, PulseTriggerSettingModel, PulseTriggerSettingsQuery, QueryQuery, QueryWithInsightIdQuery, QueryWithMessageIdQuery, ReanalyzeDocumentMutation, ReasoningEventOutput, RefineMindInstructionMutation, RefreshDatabaseSchemaMutation, RefreshInsightMutation, ReinterpretSourceMutation, ReinterpretSourcesOfuserMutation, Relation, RelocateInsightMutation, RemoveInsightFromReportMutation, Report, ReportConnection, ReportMember, ReportQuery, ReportSubBuilder, Report_InsightsQuery, Report_LayoutQuery, ReportsQuery, ResetWorkspaceMutation, ResolvePulseEventMutation, ResolvedFileUrl, ScheduleWorkspaceDeletionMutation, SendMessageMutation, SetDatabasePrimaryKeyMutation, StreamEventSchemaAnchor, StreamMessageContentOutput, StreamMessageOutput, StreamableUiDeltaEventOutput, SyncEngine, SyncEvent, SyncEventCursor, TABLE_TO_TYPENAME, TYPENAME_TO_TABLE, Table, TableConnection, TableQuery, TableSubBuilder, Table_DatabaseQuery, Table_Database_EngineQuery, Table_DocumentQuery, Table_Document_ContentsQuery, Table_Document_FileQuery, Table_Document_FormatQuery, Table_FromRelationsQuery, Table_ToRelationsQuery, TablesQuery, TextBlockEventOutput, TextDeltaEventOutput, TokenUsage, TokenUsageUpdatesSubscription, ToolInputDeltaEventOutput, ToolResultArtifactOutput, ToolResultEventOutput, ToolStartEventOutput, UpdateAgentMutation, UpdateArtifactNameMutation, UpdateChatMutation, UpdateDatabaseMutation, UpdateDocumentMutation, UpdateFolderMutation, UpdateInsightInReportMutation, UpdateInsightMutation, UpdateInsightThumbnailMutation, UpdateInterpMutation, UpdateLiveContextMutation, UpdatePulseTriggerMutation, UpdateReportMutation, UpdateTableMutation, UpdateUserSkillFileMutation, UpdateUserSkillFolderMutation, UsageMetaOutput, UsageStatus, UsageWindowsStatusType, UserSkillFile, UserSkillFileModel, UserSkillFileQuery, UserSkillFilesQuery, UserSkillFolder, UserSkillFolderModel, UserSkillFolderQuery, UserSkillFoldersQuery, WindowDetailType, WorkspaceDeleteSchedule, WorkspaceDeletionScheduleQuery, closeDatabase, createChatStreamClient, createDvinaClient, createLazySyncEngine, createSseTransport, createWsTransport, deleteDatabase, getOrCreateDatabase, reconstructConnectionNodes, reconstructEntity, uploadFile };
|
|
20402
|
-
//# sourceMappingURL=chunk-
|
|
20403
|
-
//# sourceMappingURL=chunk-
|
|
20629
|
+
//# sourceMappingURL=chunk-N64A3FWK.js.map
|
|
20630
|
+
//# sourceMappingURL=chunk-N64A3FWK.js.map
|