@aws-amplify/data-schema 1.6.0 → 1.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/data-schema",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -204,8 +204,10 @@ export function initializeModel(
204
204
  .map(([fieldName]) => fieldName);
205
205
 
206
206
  return result.map((record) => {
207
+ if (record === null || record === undefined) {
208
+ return record;
209
+ }
207
210
  const initializedRelationalFields: Record<string, any> = {};
208
-
209
211
  for (const fieldName of modelFields) {
210
212
  const modelField = introModelFields[fieldName];
211
213
  const modelFieldType = modelField?.type as ModelFieldType;
@@ -49,6 +49,7 @@ export const excludeDisabledOps = (
49
49
  "properties": {
50
50
  "subscriptions": null,
51
51
  "mutations": { "delete": null }
52
+ "timestamps": null
52
53
  } }*/
53
54
  const modelAttrs = mis.models[modelName].attributes?.find(
54
55
  (attr) => attr.type === 'model',
@@ -68,6 +69,11 @@ export const excludeDisabledOps = (
68
69
 
69
70
  if (modelAttrs.properties) {
70
71
  for (const [key, value] of Object.entries(modelAttrs.properties)) {
72
+ // model.properties can contain other values that are not relevant to disabling ops, e.g. timestamps
73
+ if (!(key in coarseToFineDict)) {
74
+ continue;
75
+ }
76
+
71
77
  if (value === null) {
72
78
  // coarse-grained disable, e.g. "subscriptions": null,
73
79
  disabledOps.push(...coarseToFineDict[key]);