@zenstackhq/sdk 3.3.0-beta.4 → 3.3.0

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
@@ -1051,6 +1051,11 @@ var TsSchemaGenerator = class {
1051
1051
  ]))
1052
1052
  ], true))), true);
1053
1053
  }
1054
+ createUpdatedAtObject(ignoreArg) {
1055
+ return ts.factory.createObjectLiteralExpression([
1056
+ ts.factory.createPropertyAssignment("ignore", ts.factory.createArrayLiteralExpression(ignoreArg.value.items.map((item) => ts.factory.createStringLiteral(item.target.$refText))))
1057
+ ]);
1058
+ }
1054
1059
  mapFieldTypeToTSType(type) {
1055
1060
  let result = (0, import_ts_pattern2.match)(type.type).with("String", () => "string").with("Boolean", () => "boolean").with("Int", () => "number").with("Float", () => "number").with("BigInt", () => "bigint").with("Decimal", () => "number").otherwise(() => "unknown");
1056
1061
  if (type.array) {
@@ -1080,8 +1085,10 @@ var TsSchemaGenerator = class {
1080
1085
  if (field.type.array) {
1081
1086
  objectFields.push(ts.factory.createPropertyAssignment("array", ts.factory.createTrue()));
1082
1087
  }
1083
- if (hasAttribute(field, "@updatedAt")) {
1084
- objectFields.push(ts.factory.createPropertyAssignment("updatedAt", ts.factory.createTrue()));
1088
+ const updatedAtAttrib = getAttribute(field, "@updatedAt");
1089
+ if (updatedAtAttrib) {
1090
+ const ignoreArg = updatedAtAttrib.args.find((arg) => arg.$resolvedParam?.name === "ignore");
1091
+ objectFields.push(ts.factory.createPropertyAssignment("updatedAt", ignoreArg ? this.createUpdatedAtObject(ignoreArg) : ts.factory.createTrue()));
1085
1092
  }
1086
1093
  if (hasAttribute(field, "@omit")) {
1087
1094
  objectFields.push(ts.factory.createPropertyAssignment("omit", ts.factory.createTrue()));