@warp-drive/core 5.9.0-alpha.17 → 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 +50 -31
- 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 +50 -31
- 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 +50 -31
- 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 +17 -25
- 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 +17 -25
- 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;
|
|
@@ -1379,6 +1390,7 @@ function rollbackRelationship(graph, key, field, relationship) {
|
|
|
1379
1390
|
function createState() {
|
|
1380
1391
|
return {
|
|
1381
1392
|
hasReceivedData: false,
|
|
1393
|
+
hasReceivedRemoteData: false,
|
|
1382
1394
|
isEmpty: true,
|
|
1383
1395
|
isStale: false,
|
|
1384
1396
|
hasFailedLoadAttempt: false,
|
|
@@ -1483,13 +1495,10 @@ function legacyGetResourceRelationshipData(source, getRemoteState) {
|
|
|
1483
1495
|
source.accessed = true;
|
|
1484
1496
|
let data;
|
|
1485
1497
|
const payload = {};
|
|
1486
|
-
if (getRemoteState && source.remoteState) {
|
|
1487
|
-
data = source.remoteState;
|
|
1488
|
-
} else if (!getRemoteState && source.localState) {
|
|
1489
|
-
data = source.localState;
|
|
1490
|
-
}
|
|
1491
|
-
if ((getRemoteState && source.remoteState === null || source.localState === null) && source.state.hasReceivedData) {
|
|
1492
|
-
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;
|
|
1493
1502
|
}
|
|
1494
1503
|
if (source.links) {
|
|
1495
1504
|
payload.links = source.links;
|
|
@@ -1666,7 +1675,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1666
1675
|
const relationship = graph.get(op.record, op.field);
|
|
1667
1676
|
const {
|
|
1668
1677
|
definition,
|
|
1669
|
-
state,
|
|
1670
1678
|
identifier
|
|
1671
1679
|
} = relationship;
|
|
1672
1680
|
const {
|
|
@@ -1701,23 +1709,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1701
1709
|
value: payload.data ? graph.store.cacheKeyManager.upgradeIdentifier(payload.data) : null
|
|
1702
1710
|
}, true);
|
|
1703
1711
|
}
|
|
1704
|
-
} else if (definition.isAsync === false && !state.hasReceivedData) {
|
|
1705
|
-
hasRelationshipDataProperty = true;
|
|
1706
|
-
if (isCollection) {
|
|
1707
|
-
graph.update({
|
|
1708
|
-
op: 'replaceRelatedRecords',
|
|
1709
|
-
record: identifier,
|
|
1710
|
-
field: op.field,
|
|
1711
|
-
value: []
|
|
1712
|
-
}, true);
|
|
1713
|
-
} else {
|
|
1714
|
-
graph.update({
|
|
1715
|
-
op: 'replaceRelatedRecord',
|
|
1716
|
-
record: identifier,
|
|
1717
|
-
field: op.field,
|
|
1718
|
-
value: null
|
|
1719
|
-
}, true);
|
|
1720
|
-
}
|
|
1721
1712
|
}
|
|
1722
1713
|
if (payload.links) {
|
|
1723
1714
|
const originalLinks = relationship.links;
|
|
@@ -1752,6 +1743,7 @@ function updateRelationshipOperation(graph, op) {
|
|
|
1752
1743
|
// we don't need to notify here as the update op we pushed in above will notify once
|
|
1753
1744
|
// membership is in the correct state.
|
|
1754
1745
|
relationship.state.hasReceivedData = true;
|
|
1746
|
+
relationship.state.hasReceivedRemoteData = true;
|
|
1755
1747
|
relationship.state.isStale = false;
|
|
1756
1748
|
relationship.state.hasDematerializedInverse = false;
|
|
1757
1749
|
relationship.state.isEmpty = relationshipIsEmpty;
|