@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.d.cts CHANGED
@@ -146,6 +146,7 @@ declare class TsSchemaGenerator {
146
146
  private getSubModels;
147
147
  private createTypeDefObject;
148
148
  private createComputedFieldsObject;
149
+ private createUpdatedAtObject;
149
150
  private mapFieldTypeToTSType;
150
151
  private createDataFieldObject;
151
152
  private isDiscriminatorField;
package/dist/index.d.ts CHANGED
@@ -146,6 +146,7 @@ declare class TsSchemaGenerator {
146
146
  private getSubModels;
147
147
  private createTypeDefObject;
148
148
  private createComputedFieldsObject;
149
+ private createUpdatedAtObject;
149
150
  private mapFieldTypeToTSType;
150
151
  private createDataFieldObject;
151
152
  private isDiscriminatorField;
package/dist/index.js CHANGED
@@ -1019,6 +1019,11 @@ var TsSchemaGenerator = class {
1019
1019
  ]))
1020
1020
  ], true))), true);
1021
1021
  }
1022
+ createUpdatedAtObject(ignoreArg) {
1023
+ return ts.factory.createObjectLiteralExpression([
1024
+ ts.factory.createPropertyAssignment("ignore", ts.factory.createArrayLiteralExpression(ignoreArg.value.items.map((item) => ts.factory.createStringLiteral(item.target.$refText))))
1025
+ ]);
1026
+ }
1022
1027
  mapFieldTypeToTSType(type) {
1023
1028
  let result = match2(type.type).with("String", () => "string").with("Boolean", () => "boolean").with("Int", () => "number").with("Float", () => "number").with("BigInt", () => "bigint").with("Decimal", () => "number").otherwise(() => "unknown");
1024
1029
  if (type.array) {
@@ -1048,8 +1053,10 @@ var TsSchemaGenerator = class {
1048
1053
  if (field.type.array) {
1049
1054
  objectFields.push(ts.factory.createPropertyAssignment("array", ts.factory.createTrue()));
1050
1055
  }
1051
- if (hasAttribute(field, "@updatedAt")) {
1052
- objectFields.push(ts.factory.createPropertyAssignment("updatedAt", ts.factory.createTrue()));
1056
+ const updatedAtAttrib = getAttribute(field, "@updatedAt");
1057
+ if (updatedAtAttrib) {
1058
+ const ignoreArg = updatedAtAttrib.args.find((arg) => arg.$resolvedParam?.name === "ignore");
1059
+ objectFields.push(ts.factory.createPropertyAssignment("updatedAt", ignoreArg ? this.createUpdatedAtObject(ignoreArg) : ts.factory.createTrue()));
1053
1060
  }
1054
1061
  if (hasAttribute(field, "@omit")) {
1055
1062
  objectFields.push(ts.factory.createPropertyAssignment("omit", ts.factory.createTrue()));