@aws-amplify/data-schema 1.25.1 → 1.25.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.25.1",
3
+ "version": "1.25.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1821,13 +1821,23 @@ const schemaPreprocessor = (
1821
1821
  const refersToString = typeDef.data.originalName
1822
1822
  ? ` @refersTo(name: "${typeDef.data.originalName}")`
1823
1823
  : '';
1824
- // TODO: update @model(timestamps: null) once a longer term solution gets
1825
- // determined.
1826
- //
1827
- // Context: SQL schema should not be automatically inserted with timestamp fields,
1828
- // passing (timestamps: null) to @model to suppress this behavior as a short
1829
- // term solution.
1830
- const model = `type ${typeName} @model(timestamps: null) ${authString}${refersToString}\n{\n ${joined}\n}`;
1824
+
1825
+ const disabledAttrs = modelAttributesFromDisabledOps(
1826
+ typeDef.data.disabledOperations,
1827
+ );
1828
+ const modelAttrs = disabledAttrs
1829
+ ? `timestamps: null, ${disabledAttrs}`
1830
+ : 'timestamps: null';
1831
+
1832
+ /*
1833
+ * TODO: update @model(timestamps: null) once a longer term solution gets
1834
+ * determined.
1835
+ *
1836
+ * Context: SQL schema should not be automatically inserted with timestamp
1837
+ * fields, passing (timestamps: null) to @model to suppress this behavior
1838
+ * as a short term solution.
1839
+ */
1840
+ const model = `type ${typeName} @model(${modelAttrs}) ${authString}${refersToString}\n{\n ${joined}\n}`;
1831
1841
  gqlModels.push(model);
1832
1842
  } else {
1833
1843
  const fields = typeDef.data.fields as Record<string, BaseModelField>;