@warp-drive/core 5.9.0-alpha.16 → 5.9.0-alpha.18
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/declarations/graph/-private/-state.d.ts +1 -0
- package/declarations/reactive/-private/default-mode.d.ts +22 -9
- package/declarations/reactive/-private/kind/belongs-to-field.d.ts +3 -0
- package/declarations/types/runtime.d.ts +16 -0
- package/declarations/types/schema/fields.d.ts +40 -12
- package/dist/graph/-private.js +56 -37
- package/dist/{index-CFwnjldF.js → index-BoY6aNE5.js} +88 -9
- package/dist/index.js +1 -1
- package/dist/reactive.js +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/types/-private.js +1 -1
- package/dist/types/runtime.js +20 -1
- package/dist/unpkg/dev/graph/-private.js +56 -37
- package/dist/unpkg/dev/{index-BZRBBa34.js → index-BZ6PKU-a.js} +88 -9
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive.js +1 -1
- package/dist/unpkg/dev/store/-private.js +2 -2
- package/dist/unpkg/dev/types/-private.js +1 -1
- package/dist/unpkg/dev/types/runtime.js +20 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +56 -37
- package/dist/unpkg/dev-deprecated/{index-Bu52tQ9I.js → index-CDjd631s.js} +88 -9
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +1 -1
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +20 -1
- package/dist/unpkg/prod/{-leaked-BHLmJyaw.js → -leaked-DgjQ5X55.js} +2 -2
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +23 -26
- package/dist/unpkg/prod/{schema-BdC3DirM.js → index-BMBm3kYx.js} +2256 -91
- package/dist/unpkg/prod/index.js +5 -483
- package/dist/unpkg/prod/{promise-cache-DIT8Ypjq.js → promise-cache-DUblkX-U.js} +1 -1
- package/dist/unpkg/prod/reactive.js +3 -29
- package/dist/unpkg/prod/{request-BrJSCG6r.js → request-eb7Zm-oS.js} +1 -1
- package/dist/unpkg/prod/request.js +2 -2
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/store/-private.js +2 -3
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod/types/runtime.js +20 -1
- package/dist/unpkg/prod-deprecated/{-leaked-D_5Yrs5c.js → -leaked-BNVttukY.js} +1 -1
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +23 -26
- package/dist/unpkg/prod-deprecated/{schema-h0nuUTCj.js → index-CZkDXZog.js} +890 -7
- package/dist/unpkg/prod-deprecated/index.js +5 -483
- package/dist/unpkg/prod-deprecated/{promise-cache-DIT8Ypjq.js → promise-cache-DUblkX-U.js} +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +2 -3
- package/dist/unpkg/prod-deprecated/{request-BrJSCG6r.js → request-eb7Zm-oS.js} +1 -1
- package/dist/unpkg/prod-deprecated/request.js +2 -2
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/store/-private.js +1 -2
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +20 -1
- package/package.json +3 -3
- package/dist/unpkg/prod/handler-BJogFbfS.js +0 -1619
- package/dist/unpkg/prod-deprecated/handler-kGR8zguj.js +0 -334
- package/dist/unpkg/prod-deprecated/hooks-wJdveHPi.js +0 -26
|
@@ -827,8 +827,10 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
827
827
|
if (op.value === existingState) {
|
|
828
828
|
// if we were empty before but now know we are empty this needs to be true
|
|
829
829
|
state.hasReceivedData = true;
|
|
830
|
+
|
|
830
831
|
// if this is a remote update we still sync
|
|
831
832
|
if (isRemote) {
|
|
833
|
+
state.hasReceivedRemoteData = true;
|
|
832
834
|
const {
|
|
833
835
|
localState
|
|
834
836
|
} = relationship;
|
|
@@ -858,6 +860,15 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
858
860
|
// update value to the new value
|
|
859
861
|
relationship[prop] = op.value;
|
|
860
862
|
state.hasReceivedData = true;
|
|
863
|
+
/**
|
|
864
|
+
* Local mutations never give us additional information about
|
|
865
|
+
* whether the relationship has received *remote* data. This is
|
|
866
|
+
* what `getRemoteRelationship` relies on to avoid reflecting
|
|
867
|
+
* local-only edits.
|
|
868
|
+
*/
|
|
869
|
+
if (isRemote) {
|
|
870
|
+
state.hasReceivedRemoteData = true;
|
|
871
|
+
}
|
|
861
872
|
state.isEmpty = op.value === null;
|
|
862
873
|
state.isStale = false;
|
|
863
874
|
state.hasFailedLoadAttempt = false;
|
|
@@ -1152,7 +1163,12 @@ function diffCollection(finalState, relationship, onAdd, onDel) {
|
|
|
1152
1163
|
return _compare(priorLocalState, finalState, finalSet, remoteState, remoteMembers, onAdd, onDel, relationship.definition.resetOnRemoteUpdate);
|
|
1153
1164
|
}
|
|
1154
1165
|
function computeLocalState(storage) {
|
|
1155
|
-
|
|
1166
|
+
// When the edge is clean and we already have a materialized localState we can
|
|
1167
|
+
// return it directly. A clean edge can still have a `null` localState though:
|
|
1168
|
+
// dematerializing an inverse member (e.g. when a route reloads its model)
|
|
1169
|
+
// nulls out localState without dirtying the edge. In that case we fall through
|
|
1170
|
+
// and recompute from remoteState rather than asserting.
|
|
1171
|
+
if (!storage.isDirty && storage.localState) {
|
|
1156
1172
|
return storage.localState;
|
|
1157
1173
|
}
|
|
1158
1174
|
const state = storage.remoteState.slice();
|
|
@@ -1374,6 +1390,7 @@ function rollbackRelationship(graph, key, field, relationship) {
|
|
|
1374
1390
|
function createState() {
|
|
1375
1391
|
return {
|
|
1376
1392
|
hasReceivedData: false,
|
|
1393
|
+
hasReceivedRemoteData: false,
|
|
1377
1394
|
isEmpty: true,
|
|
1378
1395
|
isStale: false,
|
|
1379
1396
|
hasFailedLoadAttempt: false,
|
|
@@ -1478,13 +1495,10 @@ function legacyGetResourceRelationshipData(source, getRemoteState) {
|
|
|
1478
1495
|
source.accessed = true;
|
|
1479
1496
|
let data;
|
|
1480
1497
|
const payload = {};
|
|
1481
|
-
if (getRemoteState && source.remoteState) {
|
|
1482
|
-
data = source.remoteState;
|
|
1483
|
-
} else if (!getRemoteState && source.localState) {
|
|
1484
|
-
data = source.localState;
|
|
1485
|
-
}
|
|
1486
|
-
if ((getRemoteState && source.remoteState === null || source.localState === null) && source.state.hasReceivedData) {
|
|
1487
|
-
data = null;
|
|
1498
|
+
if (getRemoteState && (source.remoteState || source.state.hasReceivedRemoteData)) {
|
|
1499
|
+
data = source.remoteState ?? null;
|
|
1500
|
+
} else if (!getRemoteState && (source.localState || source.state.hasReceivedData)) {
|
|
1501
|
+
data = source.localState ?? null;
|
|
1488
1502
|
}
|
|
1489
1503
|
if (source.links) {
|
|
1490
1504
|
payload.links = source.links;
|
|
@@ -1661,7 +1675,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1661
1675
|
const relationship = graph.get(op.record, op.field);
|
|
1662
1676
|
const {
|
|
1663
1677
|
definition,
|
|
1664
|
-
state,
|
|
1665
1678
|
identifier
|
|
1666
1679
|
} = relationship;
|
|
1667
1680
|
const {
|
|
@@ -1696,23 +1709,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1696
1709
|
value: payload.data ? graph.store.cacheKeyManager.upgradeIdentifier(payload.data) : null
|
|
1697
1710
|
}, true);
|
|
1698
1711
|
}
|
|
1699
|
-
} else if (definition.isAsync === false && !state.hasReceivedData) {
|
|
1700
|
-
hasRelationshipDataProperty = true;
|
|
1701
|
-
if (isCollection) {
|
|
1702
|
-
graph.update({
|
|
1703
|
-
op: 'replaceRelatedRecords',
|
|
1704
|
-
record: identifier,
|
|
1705
|
-
field: op.field,
|
|
1706
|
-
value: []
|
|
1707
|
-
}, true);
|
|
1708
|
-
} else {
|
|
1709
|
-
graph.update({
|
|
1710
|
-
op: 'replaceRelatedRecord',
|
|
1711
|
-
record: identifier,
|
|
1712
|
-
field: op.field,
|
|
1713
|
-
value: null
|
|
1714
|
-
}, true);
|
|
1715
|
-
}
|
|
1716
1712
|
}
|
|
1717
1713
|
if (payload.links) {
|
|
1718
1714
|
const originalLinks = relationship.links;
|
|
@@ -1747,6 +1743,7 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1747
1743
|
// we don't need to notify here as the update op we pushed in above will notify once
|
|
1748
1744
|
// membership is in the correct state.
|
|
1749
1745
|
relationship.state.hasReceivedData = true;
|
|
1746
|
+
relationship.state.hasReceivedRemoteData = true;
|
|
1750
1747
|
relationship.state.isStale = false;
|
|
1751
1748
|
relationship.state.hasDematerializedInverse = false;
|
|
1752
1749
|
relationship.state.isEmpty = relationshipIsEmpty;
|