@isograph/react 0.0.0-main-2a45cb8e → 0.0.0-main-6ea7b362

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.
@@ -7,15 +7,14 @@ const IsographEnvironment_1 = require("./IsographEnvironment");
7
7
  const logging_1 = require("./logging");
8
8
  exports.DEFAULT_FETCH_POLICY = 'IfNecessary';
9
9
  function check(environment, normalizationAst, variables) {
10
- const checkResult = checkFromRecord(environment, normalizationAst, variables, environment.store[IsographEnvironment_1.ROOT_ID], IsographEnvironment_1.ROOT_ID);
10
+ const checkResult = checkFromRecord(environment, normalizationAst, variables, environment.store[IsographEnvironment_1.ROOT_ID], { __link: IsographEnvironment_1.ROOT_ID });
11
11
  (0, logging_1.logMessage)(environment, {
12
12
  kind: 'EnvironmentCheck',
13
13
  result: checkResult,
14
14
  });
15
15
  return checkResult;
16
16
  }
17
- function checkFromRecord(environment, normalizationAst, variables, record, backupId) {
18
- var _a, _b, _c;
17
+ function checkFromRecord(environment, normalizationAst, variables, record, recordLink) {
19
18
  normalizationAstLoop: for (const normalizationAstNode of normalizationAst) {
20
19
  switch (normalizationAstNode.kind) {
21
20
  case 'Scalar': {
@@ -26,9 +25,7 @@ function checkFromRecord(environment, normalizationAst, variables, record, backu
26
25
  if (scalarValue === undefined) {
27
26
  return {
28
27
  kind: 'MissingData',
29
- record: {
30
- __link: (_a = record.id) !== null && _a !== void 0 ? _a : backupId,
31
- },
28
+ record: recordLink,
32
29
  };
33
30
  }
34
31
  continue normalizationAstLoop;
@@ -39,9 +36,7 @@ function checkFromRecord(environment, normalizationAst, variables, record, backu
39
36
  if (linkedValue === undefined) {
40
37
  return {
41
38
  kind: 'MissingData',
42
- record: {
43
- __link: (_b = record.id) !== null && _b !== void 0 ? _b : backupId,
44
- },
39
+ record: recordLink,
45
40
  };
46
41
  }
47
42
  else if (linkedValue === null) {
@@ -66,9 +61,7 @@ function checkFromRecord(environment, normalizationAst, variables, record, backu
66
61
  }
67
62
  else {
68
63
  // TODO in __DEV__ assert linkedRecord is an object
69
- const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord,
70
- // TODO this seems likely to be wrong
71
- backupId + '.' + parentRecordKey);
64
+ const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord, link);
72
65
  if (result.kind === 'MissingData') {
73
66
  return result;
74
67
  }
@@ -93,9 +86,7 @@ function checkFromRecord(environment, normalizationAst, variables, record, backu
93
86
  }
94
87
  else {
95
88
  // TODO in __DEV__ assert linkedRecord is an object
96
- const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord,
97
- // TODO this seems likely to be wrong
98
- backupId + '.' + parentRecordKey);
89
+ const result = checkFromRecord(environment, normalizationAstNode.selections, variables, linkedRecord, link);
99
90
  if (result.kind === 'MissingData') {
100
91
  return result;
101
92
  }
@@ -109,12 +100,10 @@ function checkFromRecord(environment, normalizationAst, variables, record, backu
109
100
  existingRecordTypename !== normalizationAstNode.type) {
110
101
  return {
111
102
  kind: 'MissingData',
112
- record: {
113
- __link: (_c = record.id) !== null && _c !== void 0 ? _c : backupId,
114
- },
103
+ record: recordLink,
115
104
  };
116
105
  }
117
- const result = checkFromRecord(environment, normalizationAstNode.selections, variables, record, backupId);
106
+ const result = checkFromRecord(environment, normalizationAstNode.selections, variables, record, recordLink);
118
107
  if (result.kind === 'MissingData') {
119
108
  return result;
120
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isograph/react",
3
- "version": "0.0.0-main-2a45cb8e",
3
+ "version": "0.0.0-main-6ea7b362",
4
4
  "description": "Use Isograph with React",
5
5
  "homepage": "https://isograph.dev",
6
6
  "main": "dist/index.js",
@@ -19,9 +19,9 @@
19
19
  "iso-watch": "../../target/debug/isograph_cli --config ./isograph.config.json --watch"
20
20
  },
21
21
  "dependencies": {
22
- "@isograph/disposable-types": "0.0.0-main-2a45cb8e",
23
- "@isograph/react-disposable-state": "0.0.0-main-2a45cb8e",
24
- "@isograph/reference-counted-pointer": "0.0.0-main-2a45cb8e"
22
+ "@isograph/disposable-types": "0.0.0-main-6ea7b362",
23
+ "@isograph/react-disposable-state": "0.0.0-main-6ea7b362",
24
+ "@isograph/reference-counted-pointer": "0.0.0-main-6ea7b362"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "18.3.1"
package/src/core/check.ts CHANGED
@@ -37,7 +37,7 @@ export function check(
37
37
  normalizationAst,
38
38
  variables,
39
39
  environment.store[ROOT_ID],
40
- ROOT_ID,
40
+ { __link: ROOT_ID },
41
41
  );
42
42
  logMessage(environment, {
43
43
  kind: 'EnvironmentCheck',
@@ -51,7 +51,7 @@ function checkFromRecord(
51
51
  normalizationAst: NormalizationAst,
52
52
  variables: Variables,
53
53
  record: StoreRecord,
54
- backupId: string,
54
+ recordLink: Link,
55
55
  ): CheckResult {
56
56
  normalizationAstLoop: for (const normalizationAstNode of normalizationAst) {
57
57
  switch (normalizationAstNode.kind) {
@@ -67,9 +67,7 @@ function checkFromRecord(
67
67
  if (scalarValue === undefined) {
68
68
  return {
69
69
  kind: 'MissingData',
70
- record: {
71
- __link: record.id ?? backupId,
72
- },
70
+ record: recordLink,
73
71
  };
74
72
  }
75
73
  continue normalizationAstLoop;
@@ -85,9 +83,7 @@ function checkFromRecord(
85
83
  if (linkedValue === undefined) {
86
84
  return {
87
85
  kind: 'MissingData',
88
- record: {
89
- __link: record.id ?? backupId,
90
- },
86
+ record: recordLink,
91
87
  };
92
88
  } else if (linkedValue === null) {
93
89
  continue;
@@ -117,8 +113,7 @@ function checkFromRecord(
117
113
  normalizationAstNode.selections,
118
114
  variables,
119
115
  linkedRecord,
120
- // TODO this seems likely to be wrong
121
- backupId + '.' + parentRecordKey,
116
+ link,
122
117
  );
123
118
 
124
119
  if (result.kind === 'MissingData') {
@@ -151,8 +146,7 @@ function checkFromRecord(
151
146
  normalizationAstNode.selections,
152
147
  variables,
153
148
  linkedRecord,
154
- // TODO this seems likely to be wrong
155
- backupId + '.' + parentRecordKey,
149
+ link,
156
150
  );
157
151
 
158
152
  if (result.kind === 'MissingData') {
@@ -172,9 +166,7 @@ function checkFromRecord(
172
166
  ) {
173
167
  return {
174
168
  kind: 'MissingData',
175
- record: {
176
- __link: record.id ?? backupId,
177
- },
169
+ record: recordLink,
178
170
  };
179
171
  }
180
172
 
@@ -183,7 +175,7 @@ function checkFromRecord(
183
175
  normalizationAstNode.selections,
184
176
  variables,
185
177
  record,
186
- backupId,
178
+ recordLink,
187
179
  );
188
180
 
189
181
  if (result.kind === 'MissingData') {