@dvina/sdk 4.0.109 → 4.0.121
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-TVPEMUOT.js → chunk-ZN2TPYCR.js} +35 -4
- package/dist/chunk-ZN2TPYCR.js.map +1 -0
- package/dist/{chunk-F6T7Z73Y.cjs → chunk-ZWQVDMIR.cjs} +35 -4
- package/dist/chunk-ZWQVDMIR.cjs.map +1 -0
- package/dist/index.cjs +324 -324
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F6T7Z73Y.cjs.map +0 -1
- package/dist/chunk-TVPEMUOT.js.map +0 -1
|
@@ -8423,6 +8423,8 @@ var QueryExecutor = class {
|
|
|
8423
8423
|
*
|
|
8424
8424
|
* For connection queries, also writes the ordered entity IDs to `_queryResults`
|
|
8425
8425
|
* so that `watch()` can reconstruct the same ordered list from the store.
|
|
8426
|
+
* Singular entity roots also get a lightweight cache marker so exact-query
|
|
8427
|
+
* `watch()` calls can cold-start from Dexie instead of re-fetching.
|
|
8426
8428
|
*
|
|
8427
8429
|
* Concurrent calls with the same operationName + variables are deduplicated:
|
|
8428
8430
|
* only one HTTP request is made and all callers receive the same result.
|
|
@@ -8452,9 +8454,15 @@ var QueryExecutor = class {
|
|
|
8452
8454
|
if (rootField) {
|
|
8453
8455
|
const { entities, connection, nestedConnections } = normalize(data, rootField);
|
|
8454
8456
|
await this.writeEntities(entities);
|
|
8455
|
-
if (
|
|
8457
|
+
if (operationName) {
|
|
8456
8458
|
const queryKey = buildQueryKey(operationName, variables, document2);
|
|
8457
|
-
|
|
8459
|
+
const rootValue = data[rootField];
|
|
8460
|
+
const rootEntity = getRootEntityCacheEntry(rootValue);
|
|
8461
|
+
if (connection) {
|
|
8462
|
+
await this._cache.writeQueryResult(queryKey, connection);
|
|
8463
|
+
} else if (rootEntity) {
|
|
8464
|
+
await this._cache.writeQueryResult(queryKey, rootEntity);
|
|
8465
|
+
}
|
|
8458
8466
|
}
|
|
8459
8467
|
if (nestedConnections) {
|
|
8460
8468
|
for (const [connKey, connInfo] of nestedConnections) {
|
|
@@ -8601,6 +8609,29 @@ var QueryExecutor = class {
|
|
|
8601
8609
|
return tables;
|
|
8602
8610
|
}
|
|
8603
8611
|
};
|
|
8612
|
+
function getRootEntityCacheEntry(value) {
|
|
8613
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8614
|
+
return void 0;
|
|
8615
|
+
}
|
|
8616
|
+
const record = value;
|
|
8617
|
+
const typename = record["__typename"];
|
|
8618
|
+
if (typeof typename !== "string") {
|
|
8619
|
+
return void 0;
|
|
8620
|
+
}
|
|
8621
|
+
const entityType = TYPENAME_TO_TABLE[typename];
|
|
8622
|
+
if (!entityType) {
|
|
8623
|
+
return void 0;
|
|
8624
|
+
}
|
|
8625
|
+
const pkField = getPrimaryKeyField(entityType);
|
|
8626
|
+
const entityId = Array.isArray(pkField) ? pkField.every((field) => record[field] !== void 0 && record[field] !== null) ? pkField.map((field) => String(record[field])).join(":") : void 0 : record[pkField] !== void 0 && record[pkField] !== null ? String(record[pkField]) : void 0;
|
|
8627
|
+
if (!entityId) {
|
|
8628
|
+
return void 0;
|
|
8629
|
+
}
|
|
8630
|
+
return {
|
|
8631
|
+
entityIds: [entityId],
|
|
8632
|
+
entityType
|
|
8633
|
+
};
|
|
8634
|
+
}
|
|
8604
8635
|
|
|
8605
8636
|
// src/store/optimistic-manager.ts
|
|
8606
8637
|
var TEMP_ID_PREFIX = "_temp_";
|
|
@@ -19905,5 +19936,5 @@ exports.getOrCreateDatabase = getOrCreateDatabase;
|
|
|
19905
19936
|
exports.reconstructConnectionNodes = reconstructConnectionNodes;
|
|
19906
19937
|
exports.reconstructEntity = reconstructEntity;
|
|
19907
19938
|
exports.uploadFile = uploadFile;
|
|
19908
|
-
//# sourceMappingURL=chunk-
|
|
19909
|
-
//# sourceMappingURL=chunk-
|
|
19939
|
+
//# sourceMappingURL=chunk-ZWQVDMIR.cjs.map
|
|
19940
|
+
//# sourceMappingURL=chunk-ZWQVDMIR.cjs.map
|