@warp-drive/core 5.7.0-alpha.14 → 5.7.0-alpha.16

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.
Files changed (69) hide show
  1. package/declarations/graph/-private/-diff.d.ts +8 -8
  2. package/declarations/graph/-private/-edge-definition.d.ts +2 -2
  3. package/declarations/graph/-private/-state.d.ts +2 -2
  4. package/declarations/graph/-private/-utils.d.ts +5 -5
  5. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +3 -3
  6. package/declarations/graph/-private/edges/collection.d.ts +10 -10
  7. package/declarations/graph/-private/edges/implicit.d.ts +5 -5
  8. package/declarations/graph/-private/edges/resource.d.ts +5 -5
  9. package/declarations/graph/-private/graph.d.ts +15 -15
  10. package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -4
  11. package/declarations/graph/-private/operations/update-relationship.d.ts +3 -3
  12. package/declarations/index.d.ts +1 -1
  13. package/declarations/reactive/-private/default-mode.d.ts +2 -2
  14. package/declarations/reactive/-private/document.d.ts +6 -16
  15. package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
  16. package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
  17. package/declarations/reactive/-private/hooks.d.ts +2 -2
  18. package/declarations/reactive/-private/record.d.ts +44 -5
  19. package/declarations/reactive/-private/schema.d.ts +12 -12
  20. package/declarations/reactive/-private/symbols.d.ts +1 -0
  21. package/declarations/reactive.d.ts +277 -1
  22. package/declarations/request/-private/context.d.ts +2 -2
  23. package/declarations/request/-private/manager.d.ts +2 -2
  24. package/declarations/request/-private/types.d.ts +4 -4
  25. package/declarations/store/-private/cache-handler/types.d.ts +9 -9
  26. package/declarations/store/-private/cache-handler/utils.d.ts +4 -4
  27. package/declarations/store/-private/caches/instance-cache.d.ts +18 -18
  28. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  29. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -11
  30. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +21 -19
  31. package/declarations/store/-private/managers/cache-manager.d.ts +46 -94
  32. package/declarations/store/-private/managers/notification-manager.d.ts +21 -22
  33. package/declarations/store/-private/managers/record-array-manager.d.ts +15 -15
  34. package/declarations/store/-private/network/request-cache.d.ts +11 -11
  35. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  36. package/declarations/store/-private/new-core-tmp/request-state.d.ts +1 -1
  37. package/declarations/store/-private/record-arrays/-utils.d.ts +3 -3
  38. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +2 -2
  39. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +2 -2
  40. package/declarations/store/-private/record-arrays/resource-array.d.ts +9 -9
  41. package/declarations/store/-private/store-service.d.ts +19 -16
  42. package/declarations/store/-private.d.ts +1 -1
  43. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  44. package/declarations/store/-types/q/identifier.d.ts +9 -6
  45. package/declarations/store/-types/q/schema-service.d.ts +9 -9
  46. package/declarations/store/deprecated/-private.d.ts +5 -5
  47. package/declarations/types/-private.d.ts +1 -1
  48. package/declarations/types/cache/aliases.d.ts +2 -2
  49. package/declarations/types/cache/change.d.ts +2 -2
  50. package/declarations/types/cache/mutations.d.ts +13 -13
  51. package/declarations/types/cache/operations.d.ts +20 -20
  52. package/declarations/types/cache/relationship.d.ts +4 -4
  53. package/declarations/types/cache.d.ts +51 -113
  54. package/declarations/types/graph.d.ts +12 -12
  55. package/declarations/types/identifier.d.ts +60 -76
  56. package/declarations/types/request.d.ts +6 -6
  57. package/declarations/types/schema/concepts.d.ts +2 -2
  58. package/declarations/types/spec/document.d.ts +6 -6
  59. package/dist/graph/-private.js +125 -125
  60. package/dist/index.js +2 -2
  61. package/dist/reactive/-private.js +1 -1
  62. package/dist/reactive.js +126 -4
  63. package/dist/{request-state-CCrTjb0Z.js → request-state-CQ0Q6d1V.js} +3493 -3483
  64. package/dist/store/-private.js +1 -1
  65. package/dist/store.js +30 -43
  66. package/dist/{symbols-C5p2hcy9.js → symbols-sql1_mdx.js} +2 -1
  67. package/dist/types/-private.js +1 -1
  68. package/dist/types/identifier.js +19 -45
  69. package/package.json +3 -3
@@ -117,11 +117,11 @@ function inspect(value) {
117
117
  }
118
118
  return 'object';
119
119
  }
120
- function checkIfNew(store, identifier) {
121
- if (!identifier.id) {
120
+ function checkIfNew(store, resourceKey) {
121
+ if (!resourceKey.id) {
122
122
  return true;
123
123
  }
124
- return store.cache.isNew(identifier);
124
+ return store.cache.isNew(resourceKey);
125
125
  }
126
126
  function isBelongsTo(relationship) {
127
127
  return relationship.definition.kind === 'belongsTo';
@@ -208,13 +208,13 @@ function notifyChange(graph, relationship) {
208
208
  if (!relationship.accessed) {
209
209
  return;
210
210
  }
211
- const identifier = relationship.identifier;
211
+ const resourceKey = relationship.identifier;
212
212
  const key = relationship.definition.key;
213
- if (identifier === graph._removing) {
213
+ if (resourceKey === graph._removing) {
214
214
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
215
215
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
216
216
  // eslint-disable-next-line no-console
217
- console.log(`Graph: ignoring relationship change for removed identifier ${String(identifier)} ${key}`);
217
+ console.log(`Graph: ignoring relationship change for removed identifier ${String(resourceKey)} ${key}`);
218
218
  }
219
219
  }
220
220
  return;
@@ -222,37 +222,37 @@ function notifyChange(graph, relationship) {
222
222
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
223
223
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
224
224
  // eslint-disable-next-line no-console
225
- console.log(`Graph: notifying relationship change for ${String(identifier)} ${key}`);
225
+ console.log(`Graph: notifying relationship change for ${String(resourceKey)} ${key}`);
226
226
  }
227
227
  }
228
- graph.store.notifyChange(identifier, 'relationships', key);
228
+ graph.store.notifyChange(resourceKey, 'relationships', key);
229
229
  }
230
- function assertRelationshipData(store, identifier, data, meta) {
230
+ function assertRelationshipData(store, resourceKey, data, meta) {
231
231
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
232
232
  if (!test) {
233
- throw new Error(`A ${identifier.type} record was pushed into the store with the value of ${meta.key} being '${JSON.stringify(data)}', but ${meta.key} is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`);
233
+ throw new Error(`A ${resourceKey.type} record was pushed into the store with the value of ${meta.key} being '${JSON.stringify(data)}', but ${meta.key} is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`);
234
234
  }
235
235
  })(!Array.isArray(data)) : {};
236
236
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
237
237
  if (!test) {
238
- throw new Error(`Encountered a relationship identifier without a type for the ${meta.kind} relationship '${meta.key}' on <${identifier.type}:${String(identifier.id)}>, expected an identifier with type '${meta.type}' but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
238
+ throw new Error(`Encountered a relationship identifier without a type for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, expected an identifier with type '${meta.type}' but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
239
239
  }
240
240
  })(data === null || 'type' in data && typeof data.type === 'string' && data.type.length) : {};
241
241
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
242
242
  if (!test) {
243
- throw new Error(`Encountered a relationship identifier without an id for the ${meta.kind} relationship '${meta.key}' on <${identifier.type}:${String(identifier.id)}>, expected an identifier but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
243
+ throw new Error(`Encountered a relationship identifier without an id for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, expected an identifier but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
244
244
  }
245
245
  })(data === null || !!coerceId(data.id)) : {};
246
246
  if (data?.type === meta.type) {
247
247
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
248
248
  if (!test) {
249
- throw new Error(`Missing Schema: Encountered a relationship identifier { type: '${data.type}', id: '${String(data.id)}' } for the '${identifier.type}.${meta.key}' ${meta.kind} relationship on <${identifier.type}:${String(identifier.id)}>, but no schema exists for that type.`);
249
+ throw new Error(`Missing Schema: Encountered a relationship identifier { type: '${data.type}', id: '${String(data.id)}' } for the '${resourceKey.type}.${meta.key}' ${meta.kind} relationship on <${resourceKey.type}:${String(resourceKey.id)}>, but no schema exists for that type.`);
250
250
  }
251
251
  })(store.schema.hasResource(data)) : {};
252
252
  } else {
253
253
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
254
254
  if (!test) {
255
- throw new Error(`Missing Schema: Encountered a relationship identifier with type '${data.type}' for the ${meta.kind} relationship '${meta.key}' on <${identifier.type}:${String(identifier.id)}>, Expected an identifier with type '${meta.type}'. No schema was found for '${data.type}'.`);
255
+ throw new Error(`Missing Schema: Encountered a relationship identifier with type '${data.type}' for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, Expected an identifier with type '${meta.type}'. No schema was found for '${data.type}'.`);
256
256
  }
257
257
  })(data === null || !data.type || store.schema.hasResource(data)) : {};
258
258
  }
@@ -485,13 +485,13 @@ function isLHS(info, type, key) {
485
485
  }
486
486
  return false;
487
487
  }
488
- function upgradeDefinition(graph, identifier, propertyName, isImplicit = false) {
488
+ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
489
489
  const cache = graph._definitionCache;
490
490
  const storeWrapper = graph.store;
491
491
  const polymorphicLookup = graph._potentialPolymorphicTypes;
492
492
  const {
493
493
  type
494
- } = identifier;
494
+ } = key;
495
495
  let cached = /*#__NOINLINE__*/expandingGet(cache, type, propertyName);
496
496
 
497
497
  // CASE: We have a cached resolution (null if no relationship exists)
@@ -503,7 +503,7 @@ function upgradeDefinition(graph, identifier, propertyName, isImplicit = false)
503
503
  throw new Error(`Expected to find relationship definition in the cache for the implicit relationship ${propertyName}`);
504
504
  }
505
505
  })(!isImplicit) : {};
506
- const relationships = storeWrapper.schema.fields(identifier);
506
+ const relationships = storeWrapper.schema.fields(key);
507
507
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
508
508
  if (!test) {
509
509
  throw new Error(`Expected to have a relationship definition for ${type} but none was found.`);
@@ -555,7 +555,7 @@ function upgradeDefinition(graph, identifier, propertyName, isImplicit = false)
555
555
  })(getStore(storeWrapper).modelFor(inverseType)) : {};
556
556
  inverseDefinition = null;
557
557
  } else {
558
- inverseKey = /*#__NOINLINE__*/inverseForRelationship(getStore(storeWrapper), identifier, propertyName);
558
+ inverseKey = /*#__NOINLINE__*/inverseForRelationship(getStore(storeWrapper), key, propertyName);
559
559
 
560
560
  // CASE: If we are polymorphic, and we declared an inverse that is non-null
561
561
  // we must assume that the lack of inverseKey means that there is no
@@ -711,8 +711,8 @@ function upgradeDefinition(graph, identifier, propertyName, isImplicit = false)
711
711
  expandingSet(cache, inverseType, inverseKey, info);
712
712
  return info;
713
713
  }
714
- function inverseForRelationship(store, identifier, key) {
715
- const definition = store.schema.fields(identifier).get(key);
714
+ function inverseForRelationship(store, resourceKey, key) {
715
+ const definition = store.schema.fields(resourceKey).get(key);
716
716
  if (!definition) {
717
717
  return null;
718
718
  }
@@ -991,7 +991,7 @@ function replaceRelatedRecords(graph, op, isRemote) {
991
991
  }
992
992
  }
993
993
  function replaceRelatedRecordsLocal(graph, op, isRemote) {
994
- const identifiers = op.value;
994
+ const resourceKeys = op.value;
995
995
  const relationship = graph.get(op.record, op.field);
996
996
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
997
997
  if (!test) {
@@ -1017,48 +1017,48 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
1017
1017
  count(`replaceRelatedRecordsLocal ${'type' in record ? record.type : '<document>'} ${op.field}`);
1018
1018
  }
1019
1019
  }
1020
- const onAdd = identifier => {
1020
+ const onAdd = resourceKey => {
1021
1021
  // Since we are diffing against the remote state, we check
1022
- // if our previous local state did not contain this identifier
1023
- const removalsHas = removals?.has(identifier);
1024
- if (removalsHas || !additions?.has(identifier)) {
1025
- if (type !== identifier.type) {
1022
+ // if our previous local state did not contain this ResourceKey
1023
+ const removalsHas = removals?.has(resourceKey);
1024
+ if (removalsHas || !additions?.has(resourceKey)) {
1025
+ if (type !== resourceKey.type) {
1026
1026
  if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
1027
- assertPolymorphicType(relationship.identifier, relationship.definition, identifier, graph.store);
1027
+ assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
1028
1028
  }
1029
- graph.registerPolymorphicType(type, identifier.type);
1029
+ graph.registerPolymorphicType(type, resourceKey.type);
1030
1030
  }
1031
1031
 
1032
1032
  // we've added a record locally that wasn't in the local state before
1033
1033
  localBecameDirty = true;
1034
- addToInverse(graph, identifier, inverseKey, op.record, isRemote);
1034
+ addToInverse(graph, resourceKey, inverseKey, op.record, isRemote);
1035
1035
  if (removalsHas) {
1036
- removals.delete(identifier);
1036
+ removals.delete(resourceKey);
1037
1037
  }
1038
1038
  }
1039
1039
  };
1040
- const onRemove = identifier => {
1040
+ const onRemove = resourceKey => {
1041
1041
  // Since we are diffing against the remote state, we check
1042
- // if our previous local state had contained this identifier
1043
- const additionsHas = additions?.has(identifier);
1044
- if (additionsHas || !removals?.has(identifier)) {
1042
+ // if our previous local state had contained this ResourceKey
1043
+ const additionsHas = additions?.has(resourceKey);
1044
+ if (additionsHas || !removals?.has(resourceKey)) {
1045
1045
  // we've removed a record locally that was in the local state before
1046
1046
  localBecameDirty = true;
1047
- removeFromInverse(graph, identifier, inverseKey, record, isRemote);
1047
+ removeFromInverse(graph, resourceKey, inverseKey, record, isRemote);
1048
1048
  if (additionsHas) {
1049
- additions.delete(identifier);
1049
+ additions.delete(resourceKey);
1050
1050
  }
1051
1051
  }
1052
1052
  };
1053
- const diff = diffCollection(identifiers, relationship, onAdd, onRemove);
1053
+ const diff = diffCollection(resourceKeys, relationship, onAdd, onRemove);
1054
1054
 
1055
1055
  // any additions no longer in the local state
1056
1056
  // also need to be removed from the inverse
1057
1057
  if (additions && additions.size > 0) {
1058
- additions.forEach(identifier => {
1059
- if (!diff.add.has(identifier)) {
1058
+ additions.forEach(resourceKey => {
1059
+ if (!diff.add.has(resourceKey)) {
1060
1060
  localBecameDirty = true;
1061
- onRemove(identifier);
1061
+ onRemove(resourceKey);
1062
1062
  }
1063
1063
  });
1064
1064
  }
@@ -1066,10 +1066,10 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
1066
1066
  // any removals no longer in the local state
1067
1067
  // also need to be added back to the inverse
1068
1068
  if (removals && removals.size > 0) {
1069
- removals.forEach(identifier => {
1070
- if (!diff.del.has(identifier)) {
1069
+ removals.forEach(resourceKey => {
1070
+ if (!diff.del.has(resourceKey)) {
1071
1071
  localBecameDirty = true;
1072
- onAdd(identifier);
1072
+ onAdd(resourceKey);
1073
1073
  }
1074
1074
  });
1075
1075
  }
@@ -1085,7 +1085,7 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
1085
1085
  }
1086
1086
  }
1087
1087
  function replaceRelatedRecordsRemote(graph, op, isRemote) {
1088
- const identifiers = op.value;
1088
+ const resourceKeys = op.value;
1089
1089
  const relationship = graph.get(op.record, op.field);
1090
1090
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
1091
1091
  if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
@@ -1117,18 +1117,18 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
1117
1117
  const {
1118
1118
  type
1119
1119
  } = relationship.definition;
1120
- const diff = diffCollection(identifiers, relationship, identifier => {
1121
- if (type !== identifier.type) {
1120
+ const diff = diffCollection(resourceKeys, relationship, resourceKey => {
1121
+ if (type !== resourceKey.type) {
1122
1122
  if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
1123
- assertPolymorphicType(relationship.identifier, relationship.definition, identifier, graph.store);
1123
+ assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
1124
1124
  }
1125
- graph.registerPolymorphicType(type, identifier.type);
1125
+ graph.registerPolymorphicType(type, resourceKey.type);
1126
1126
  }
1127
1127
  // commit additions
1128
1128
  // TODO build this into the diff?
1129
1129
  // because we are not dirty if this was a committed local addition
1130
- if (relationship.additions?.has(identifier)) {
1131
- relationship.additions.delete(identifier);
1130
+ if (relationship.additions?.has(resourceKey)) {
1131
+ relationship.additions.delete(resourceKey);
1132
1132
  } else {
1133
1133
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
1134
1134
  if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
@@ -1139,13 +1139,13 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
1139
1139
  }
1140
1140
  }
1141
1141
  }
1142
- addToInverse(graph, identifier, definition.inverseKey, op.record, isRemote);
1143
- }, identifier => {
1142
+ addToInverse(graph, resourceKey, definition.inverseKey, op.record, isRemote);
1143
+ }, resourceKey => {
1144
1144
  // commit removals
1145
1145
  // TODO build this into the diff?
1146
1146
  // because we are not dirty if this was a committed local addition
1147
- if (relationship.removals?.has(identifier)) {
1148
- relationship.removals.delete(identifier);
1147
+ if (relationship.removals?.has(resourceKey)) {
1148
+ relationship.removals.delete(resourceKey);
1149
1149
  } else {
1150
1150
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
1151
1151
  if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
@@ -1156,7 +1156,7 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
1156
1156
  }
1157
1157
  }
1158
1158
  }
1159
- removeFromInverse(graph, identifier, definition.inverseKey, op.record, isRemote);
1159
+ removeFromInverse(graph, resourceKey, definition.inverseKey, op.record, isRemote);
1160
1160
  });
1161
1161
 
1162
1162
  // replace existing state
@@ -1187,30 +1187,30 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
1187
1187
  };
1188
1188
  if (relationship.removals) {
1189
1189
  relationship.isDirty = true;
1190
- relationship.removals.forEach(identifier => {
1190
+ relationship.removals.forEach(resourceKey => {
1191
1191
  deprecationInfo.triggered = true;
1192
- deprecationInfo.removals.push(identifier);
1192
+ deprecationInfo.removals.push(resourceKey);
1193
1193
  // reverse the removal
1194
1194
  // if we are still in removals at this point then
1195
1195
  // we were not "committed" which means we are present
1196
1196
  // in the remoteMembers. So we "add back" on the inverse.
1197
- addToInverse(graph, identifier, definition.inverseKey, op.record, false);
1197
+ addToInverse(graph, resourceKey, definition.inverseKey, op.record, false);
1198
1198
  });
1199
1199
  relationship.removals = null;
1200
1200
  }
1201
1201
  if (relationship.additions) {
1202
- relationship.additions.forEach(identifier => {
1202
+ relationship.additions.forEach(resourceKey => {
1203
1203
  // reverse the addition
1204
1204
  // if we are still in additions at this point then
1205
1205
  // we were not "committed" which means we are not present
1206
1206
  // in the remoteMembers. So we "remove" from the inverse.
1207
1207
  // however we only do this if we are not a "new" record.
1208
- if (!checkIfNew(graph._realStore, identifier)) {
1208
+ if (!checkIfNew(graph._realStore, resourceKey)) {
1209
1209
  deprecationInfo.triggered = true;
1210
- deprecationInfo.additions.push(identifier);
1210
+ deprecationInfo.additions.push(resourceKey);
1211
1211
  relationship.isDirty = true;
1212
- relationship.additions.delete(identifier);
1213
- removeFromInverse(graph, identifier, definition.inverseKey, op.record, false);
1212
+ relationship.additions.delete(resourceKey);
1213
+ removeFromInverse(graph, resourceKey, definition.inverseKey, op.record, false);
1214
1214
  }
1215
1215
  });
1216
1216
  if (relationship.additions.size === 0) {
@@ -1235,8 +1235,8 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
1235
1235
  flushCanonical(graph, relationship);
1236
1236
  }
1237
1237
  }
1238
- function addToInverse(graph, identifier, key, value, isRemote) {
1239
- const relationship = graph.get(identifier, key);
1238
+ function addToInverse(graph, resourceKey, key, value, isRemote) {
1239
+ const relationship = graph.get(resourceKey, key);
1240
1240
  const {
1241
1241
  type
1242
1242
  } = relationship.definition;
@@ -1252,13 +1252,13 @@ function addToInverse(graph, identifier, key, value, isRemote) {
1252
1252
  if (isRemote) {
1253
1253
  graph._addToTransaction(relationship);
1254
1254
  if (relationship.remoteState !== null) {
1255
- removeFromInverse(graph, relationship.remoteState, relationship.definition.inverseKey, identifier, isRemote);
1255
+ removeFromInverse(graph, relationship.remoteState, relationship.definition.inverseKey, resourceKey, isRemote);
1256
1256
  }
1257
1257
  relationship.remoteState = value;
1258
1258
  }
1259
1259
  if (relationship.localState !== value) {
1260
1260
  if (!isRemote && relationship.localState) {
1261
- removeFromInverse(graph, relationship.localState, relationship.definition.inverseKey, identifier, isRemote);
1261
+ removeFromInverse(graph, relationship.localState, relationship.definition.inverseKey, resourceKey, isRemote);
1262
1262
  }
1263
1263
  relationship.localState = value;
1264
1264
  notifyChange(graph, relationship);
@@ -1289,7 +1289,7 @@ function addToInverse(graph, identifier, key, value, isRemote) {
1289
1289
  if (!relationship.isDirty && !relationship.localState) {
1290
1290
  relationship.localState = [];
1291
1291
  }
1292
- if (_add(graph, identifier, relationship, value, null, isRemote)) {
1292
+ if (_add(graph, resourceKey, relationship, value, null, isRemote)) {
1293
1293
  notifyChange(graph, relationship);
1294
1294
  }
1295
1295
  }
@@ -1306,14 +1306,14 @@ function addToInverse(graph, identifier, key, value, isRemote) {
1306
1306
  }
1307
1307
  }
1308
1308
  }
1309
- function notifyInverseOfPotentialMaterialization(graph, identifier, key, value, isRemote) {
1310
- const relationship = graph.get(identifier, key);
1309
+ function notifyInverseOfPotentialMaterialization(graph, resourceKey, key, value, isRemote) {
1310
+ const relationship = graph.get(resourceKey, key);
1311
1311
  if (isHasMany(relationship) && isRemote && relationship.remoteMembers.has(value)) {
1312
1312
  notifyChange(graph, relationship);
1313
1313
  }
1314
1314
  }
1315
- function removeFromInverse(graph, identifier, key, value, isRemote) {
1316
- const relationship = graph.get(identifier, key);
1315
+ function removeFromInverse(graph, resourceKey, key, value, isRemote) {
1316
+ const relationship = graph.get(resourceKey, key);
1317
1317
  if (isBelongsTo(relationship)) {
1318
1318
  relationship.state.isEmpty = true;
1319
1319
  if (isRemote) {
@@ -2101,18 +2101,18 @@ function _removeRemote(relationship, value) {
2101
2101
  })(relationship.localState || relationship.isDirty) : {};
2102
2102
  return true;
2103
2103
  }
2104
- function rollbackRelationship(graph, identifier, field, relationship) {
2104
+ function rollbackRelationship(graph, key, field, relationship) {
2105
2105
  if (isBelongsTo(relationship)) {
2106
2106
  replaceRelatedRecord(graph, {
2107
2107
  op: 'replaceRelatedRecord',
2108
- record: identifier,
2108
+ record: key,
2109
2109
  field,
2110
2110
  value: relationship.remoteState
2111
2111
  }, false);
2112
2112
  } else {
2113
2113
  replaceRelatedRecords(graph, {
2114
2114
  op: 'replaceRelatedRecords',
2115
- record: identifier,
2115
+ record: key,
2116
2116
  field,
2117
2117
  value: relationship.remoteState.slice()
2118
2118
  }, false);
@@ -2477,7 +2477,7 @@ function updateRelationshipOperation(graph, op) {
2477
2477
  throw new Error(`Expected an array`);
2478
2478
  }
2479
2479
  })(Array.isArray(payload.data)) : {};
2480
- const cache = graph.store.identifierCache;
2480
+ const cache = graph.store.cacheKeyManager;
2481
2481
  graph.update({
2482
2482
  op: 'replaceRelatedRecords',
2483
2483
  record: identifier,
@@ -2489,7 +2489,7 @@ function updateRelationshipOperation(graph, op) {
2489
2489
  op: 'replaceRelatedRecord',
2490
2490
  record: identifier,
2491
2491
  field: op.field,
2492
- value: payload.data ? graph.store.identifierCache.upgradeIdentifier(payload.data) : null
2492
+ value: payload.data ? graph.store.cacheKeyManager.upgradeIdentifier(payload.data) : null
2493
2493
  }, true);
2494
2494
  }
2495
2495
  } else if (definition.isAsync === false && !state.hasReceivedData) {
@@ -2625,21 +2625,21 @@ class Graph {
2625
2625
  this._removing = null;
2626
2626
  this.silenceNotifications = false;
2627
2627
  }
2628
- has(identifier, propertyName) {
2629
- const relationships = this.identifiers.get(identifier);
2628
+ has(resourceKey, propertyName) {
2629
+ const relationships = this.identifiers.get(resourceKey);
2630
2630
  if (!relationships) {
2631
2631
  return false;
2632
2632
  }
2633
2633
  return relationships[propertyName] !== undefined;
2634
2634
  }
2635
- getDefinition(identifier, propertyName) {
2636
- let defs = this._metaCache[identifier.type];
2635
+ getDefinition(resourceKey, propertyName) {
2636
+ let defs = this._metaCache[resourceKey.type];
2637
2637
  let meta = defs?.[propertyName];
2638
2638
  if (!meta) {
2639
- const info = /*#__NOINLINE__*/upgradeDefinition(this, identifier, propertyName);
2639
+ const info = /*#__NOINLINE__*/upgradeDefinition(this, resourceKey, propertyName);
2640
2640
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2641
2641
  if (!test) {
2642
- throw new Error(`Could not determine relationship information for ${identifier.type}.${propertyName}`);
2642
+ throw new Error(`Could not determine relationship information for ${resourceKey.type}.${propertyName}`);
2643
2643
  }
2644
2644
  })(info !== null) : {};
2645
2645
 
@@ -2649,43 +2649,43 @@ class Graph {
2649
2649
  // this.registerPolymorphicType(info.rhs_baseModelName, identifier.type);
2650
2650
  // }
2651
2651
 
2652
- meta = /*#__NOINLINE__*/isLHS(info, identifier.type, propertyName) ? info.lhs_definition : info.rhs_definition;
2653
- defs = this._metaCache[identifier.type] = defs || {};
2652
+ meta = /*#__NOINLINE__*/isLHS(info, resourceKey.type, propertyName) ? info.lhs_definition : info.rhs_definition;
2653
+ defs = this._metaCache[resourceKey.type] = defs || {};
2654
2654
  defs[propertyName] = meta;
2655
2655
  }
2656
2656
  return meta;
2657
2657
  }
2658
- get(identifier, propertyName) {
2658
+ get(resourceKey, propertyName) {
2659
2659
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2660
2660
  if (!test) {
2661
2661
  throw new Error(`expected propertyName`);
2662
2662
  }
2663
2663
  })(propertyName) : {};
2664
- let relationships = this.identifiers.get(identifier);
2664
+ let relationships = this.identifiers.get(resourceKey);
2665
2665
  if (!relationships) {
2666
2666
  relationships = Object.create(null);
2667
- this.identifiers.set(identifier, relationships);
2667
+ this.identifiers.set(resourceKey, relationships);
2668
2668
  }
2669
2669
  let relationship = relationships[propertyName];
2670
2670
  if (!relationship) {
2671
- const meta = this.getDefinition(identifier, propertyName);
2671
+ const meta = this.getDefinition(resourceKey, propertyName);
2672
2672
  if (meta.kind === 'belongsTo') {
2673
- relationship = relationships[propertyName] = createResourceEdge(meta, identifier);
2673
+ relationship = relationships[propertyName] = createResourceEdge(meta, resourceKey);
2674
2674
  } else if (meta.kind === 'hasMany') {
2675
- relationship = relationships[propertyName] = createCollectionEdge(meta, identifier);
2675
+ relationship = relationships[propertyName] = createCollectionEdge(meta, resourceKey);
2676
2676
  } else {
2677
2677
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2678
2678
  if (!test) {
2679
2679
  throw new Error(`Expected kind to be implicit`);
2680
2680
  }
2681
2681
  })(meta.kind === 'implicit' && meta.isImplicit === true) : {};
2682
- relationship = relationships[propertyName] = createImplicitEdge(meta, identifier);
2682
+ relationship = relationships[propertyName] = createImplicitEdge(meta, resourceKey);
2683
2683
  }
2684
2684
  }
2685
2685
  return relationship;
2686
2686
  }
2687
- getData(identifier, propertyName) {
2688
- const relationship = this.get(identifier, propertyName);
2687
+ getData(resourceKey, propertyName) {
2688
+ const relationship = this.get(resourceKey, propertyName);
2689
2689
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2690
2690
  if (!test) {
2691
2691
  throw new Error(`Cannot getData() on an implicit relationship`);
@@ -2696,8 +2696,8 @@ class Graph {
2696
2696
  }
2697
2697
  return legacyGetCollectionRelationshipData(relationship, false);
2698
2698
  }
2699
- getRemoteData(identifier, propertyName) {
2700
- const relationship = this.get(identifier, propertyName);
2699
+ getRemoteData(resourceKey, propertyName) {
2700
+ const relationship = this.get(resourceKey, propertyName);
2701
2701
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2702
2702
  if (!test) {
2703
2703
  throw new Error(`Cannot getRemoteData() on an implicit relationship`);
@@ -2733,13 +2733,13 @@ class Graph {
2733
2733
  }
2734
2734
  t2[type1] = true;
2735
2735
  }
2736
- isReleasable(identifier) {
2737
- const relationships = this.identifiers.get(identifier);
2736
+ isReleasable(resourceKey) {
2737
+ const relationships = this.identifiers.get(resourceKey);
2738
2738
  if (!relationships) {
2739
2739
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
2740
2740
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
2741
2741
  // eslint-disable-next-line no-console
2742
- console.log(`graph: RELEASABLE ${String(identifier)}`);
2742
+ console.log(`graph: RELEASABLE ${String(resourceKey)}`);
2743
2743
  }
2744
2744
  }
2745
2745
  return true;
@@ -2757,11 +2757,11 @@ class Graph {
2757
2757
  throw new Error(`Expected a relationship`);
2758
2758
  }
2759
2759
  })(relationship) : {};
2760
- if (relationship.definition.inverseIsAsync && !checkIfNew(this._realStore, identifier)) {
2760
+ if (relationship.definition.inverseIsAsync && !checkIfNew(this._realStore, resourceKey)) {
2761
2761
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
2762
2762
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
2763
2763
  // eslint-disable-next-line no-console
2764
- console.log(`graph: <<NOT>> RELEASABLE ${String(identifier)}`);
2764
+ console.log(`graph: <<NOT>> RELEASABLE ${String(resourceKey)}`);
2765
2765
  }
2766
2766
  }
2767
2767
  return false;
@@ -2770,19 +2770,19 @@ class Graph {
2770
2770
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
2771
2771
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
2772
2772
  // eslint-disable-next-line no-console
2773
- console.log(`graph: RELEASABLE ${String(identifier)}`);
2773
+ console.log(`graph: RELEASABLE ${String(resourceKey)}`);
2774
2774
  }
2775
2775
  }
2776
2776
  return true;
2777
2777
  }
2778
- unload(identifier, silenceNotifications) {
2778
+ unload(resourceKey, silenceNotifications) {
2779
2779
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
2780
2780
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
2781
2781
  // eslint-disable-next-line no-console
2782
- console.log(`graph: unload ${String(identifier)}`);
2782
+ console.log(`graph: unload ${String(resourceKey)}`);
2783
2783
  }
2784
2784
  }
2785
- const relationships = this.identifiers.get(identifier);
2785
+ const relationships = this.identifiers.get(resourceKey);
2786
2786
  if (relationships) {
2787
2787
  // cleans up the graph but retains some nodes
2788
2788
  // to allow for rematerialization
@@ -2800,8 +2800,8 @@ class Graph {
2800
2800
  });
2801
2801
  }
2802
2802
  }
2803
- _isDirty(identifier, field) {
2804
- const relationships = this.identifiers.get(identifier);
2803
+ _isDirty(resourceKey, field) {
2804
+ const relationships = this.identifiers.get(resourceKey);
2805
2805
  if (!relationships) {
2806
2806
  return false;
2807
2807
  }
@@ -2818,8 +2818,8 @@ class Graph {
2818
2818
  }
2819
2819
  return false;
2820
2820
  }
2821
- getChanged(identifier) {
2822
- const relationships = this.identifiers.get(identifier);
2821
+ getChanged(resourceKey) {
2822
+ const relationships = this.identifiers.get(resourceKey);
2823
2823
  const changed = new Map();
2824
2824
  if (!relationships) {
2825
2825
  return changed;
@@ -2857,21 +2857,21 @@ class Graph {
2857
2857
  }
2858
2858
  return changed;
2859
2859
  }
2860
- hasChanged(identifier) {
2861
- const relationships = this.identifiers.get(identifier);
2860
+ hasChanged(resourceKey) {
2861
+ const relationships = this.identifiers.get(resourceKey);
2862
2862
  if (!relationships) {
2863
2863
  return false;
2864
2864
  }
2865
2865
  const keys = Object.keys(relationships);
2866
2866
  for (let i = 0; i < keys.length; i++) {
2867
- if (this._isDirty(identifier, keys[i])) {
2867
+ if (this._isDirty(resourceKey, keys[i])) {
2868
2868
  return true;
2869
2869
  }
2870
2870
  }
2871
2871
  return false;
2872
2872
  }
2873
- rollback(identifier) {
2874
- const relationships = this.identifiers.get(identifier);
2873
+ rollback(resourceKey) {
2874
+ const relationships = this.identifiers.get(resourceKey);
2875
2875
  const changed = [];
2876
2876
  if (!relationships) {
2877
2877
  return changed;
@@ -2883,28 +2883,28 @@ class Graph {
2883
2883
  if (!relationship) {
2884
2884
  continue;
2885
2885
  }
2886
- if (this._isDirty(identifier, field)) {
2887
- rollbackRelationship(this, identifier, field, relationship);
2886
+ if (this._isDirty(resourceKey, field)) {
2887
+ rollbackRelationship(this, resourceKey, field, relationship);
2888
2888
  changed.push(field);
2889
2889
  }
2890
2890
  }
2891
2891
  return changed;
2892
2892
  }
2893
- remove(identifier) {
2893
+ remove(resourceKey) {
2894
2894
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
2895
2895
  if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
2896
2896
  // eslint-disable-next-line no-console
2897
- console.log(`graph: remove ${String(identifier)}`);
2897
+ console.log(`graph: remove ${String(resourceKey)}`);
2898
2898
  }
2899
2899
  }
2900
2900
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2901
2901
  if (!test) {
2902
- throw new Error(`Cannot remove ${String(identifier)} while still removing ${String(this._removing)}`);
2902
+ throw new Error(`Cannot remove ${String(resourceKey)} while still removing ${String(this._removing)}`);
2903
2903
  }
2904
2904
  })(!this._removing) : {};
2905
- this._removing = identifier;
2906
- this.unload(identifier);
2907
- this.identifiers.delete(identifier);
2905
+ this._removing = resourceKey;
2906
+ this.unload(resourceKey);
2907
+ this.identifiers.delete(resourceKey);
2908
2908
  this._removing = null;
2909
2909
  }
2910
2910
 
@@ -3176,7 +3176,7 @@ function destroyRelationship(graph, rel, silenceNotifications) {
3176
3176
  }
3177
3177
  }
3178
3178
  }
3179
- function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey, identifier, silenceNotifications) {
3179
+ function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey, resourceKey, silenceNotifications) {
3180
3180
  if (!graph.has(inverseIdentifier, inverseKey)) {
3181
3181
  return;
3182
3182
  }
@@ -3189,8 +3189,8 @@ function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey,
3189
3189
 
3190
3190
  // For remote members, it is possible that inverseRecordData has already been associated to
3191
3191
  // to another record. For such cases, do not dematerialize the inverseRecordData
3192
- if (!isBelongsTo(relationship) || !relationship.localState || identifier === relationship.localState) {
3193
- /*#__NOINLINE__*/removeDematerializedInverse(graph, relationship, identifier, silenceNotifications);
3192
+ if (!isBelongsTo(relationship) || !relationship.localState || resourceKey === relationship.localState) {
3193
+ /*#__NOINLINE__*/removeDematerializedInverse(graph, relationship, resourceKey, silenceNotifications);
3194
3194
  }
3195
3195
  }
3196
3196
  function clearRelationship(relationship) {