@mearie/core 0.6.0 → 0.6.1

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/index.cjs CHANGED
@@ -1070,11 +1070,17 @@ const generatePatches = (changedKeys, subscriptions, storage) => {
1070
1070
  const entries = subscriptions.get(depKey);
1071
1071
  if (!entries) continue;
1072
1072
  for (const entry of entries) {
1073
+ let patchValue = newValue;
1074
+ const node = findEntryTreeNode(entry.subscription.entryTree, entry.path);
1075
+ if (node?.selections && isNormalizedRecord(newValue)) {
1076
+ const { data } = denormalize(node.selections, storage, newValue, entry.subscription.variables);
1077
+ patchValue = data;
1078
+ }
1073
1079
  const existing = patchesBySubscription.get(entry.subscription) ?? [];
1074
1080
  existing.push({
1075
1081
  type: "set",
1076
1082
  path: entry.path,
1077
- value: newValue
1083
+ value: patchValue
1078
1084
  });
1079
1085
  patchesBySubscription.set(entry.subscription, existing);
1080
1086
  }
package/dist/index.mjs CHANGED
@@ -1069,11 +1069,17 @@ const generatePatches = (changedKeys, subscriptions, storage) => {
1069
1069
  const entries = subscriptions.get(depKey);
1070
1070
  if (!entries) continue;
1071
1071
  for (const entry of entries) {
1072
+ let patchValue = newValue;
1073
+ const node = findEntryTreeNode(entry.subscription.entryTree, entry.path);
1074
+ if (node?.selections && isNormalizedRecord(newValue)) {
1075
+ const { data } = denormalize(node.selections, storage, newValue, entry.subscription.variables);
1076
+ patchValue = data;
1077
+ }
1072
1078
  const existing = patchesBySubscription.get(entry.subscription) ?? [];
1073
1079
  existing.push({
1074
1080
  type: "set",
1075
1081
  path: entry.path,
1076
- value: newValue
1082
+ value: patchValue
1077
1083
  });
1078
1084
  patchesBySubscription.set(entry.subscription, existing);
1079
1085
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearie/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Type-safe, zero-overhead GraphQL client",
5
5
  "keywords": [
6
6
  "graphql",