@oak-digital/types-4-strapi-2 0.2.8 → 0.2.10

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.
@@ -55,7 +55,7 @@ var Attributes = /** @class */ (function () {
55
55
  return dependencies;
56
56
  };
57
57
  Attributes.prototype.attributeToString = function (attrName, attr) {
58
- var _a;
58
+ var _a, _b, _c, _d;
59
59
  var optionalString = this.isAttributeOptional(attr) ? '?' : '';
60
60
  var str = " ".concat(attrName).concat(optionalString, ": ");
61
61
  var isArray = false;
@@ -64,13 +64,14 @@ var Attributes = /** @class */ (function () {
64
64
  case 'nested':
65
65
  // Be careful with recursion
66
66
  // console.log(attr);
67
+ var nullableString = ((_a = attr === null || attr === void 0 ? void 0 : attr.nullable) !== null && _a !== void 0 ? _a : false) ? ' | null' : '';
67
68
  var newAttrs = new Attributes(attr.fields, this.RelationNames);
68
- str += newAttrs.toString();
69
+ str += newAttrs.toString() + nullableString;
69
70
  break;
70
71
  case 'relation':
71
72
  var apiName = attr.target;
72
73
  // console.log(this.RelationNames, apiName)
73
- var dependencyName = this.RelationNames[apiName].name;
74
+ var dependencyName = (_c = (_b = this.RelationNames[apiName]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : 'any';
74
75
  var relationMultipleString = attr.relation.endsWith('ToMany') ? '[]' : ' | null';
75
76
  str += "{ data: ".concat(dependencyName).concat(relationMultipleString, "; }");
76
77
  break;
@@ -78,7 +79,7 @@ var Attributes = /** @class */ (function () {
78
79
  var componentName = attr.component;
79
80
  var relationNameObj = this.RelationNames[componentName];
80
81
  var dependencyComponentName = relationNameObj.name;
81
- isArray = (_a = attr.repeatable) !== null && _a !== void 0 ? _a : false;
82
+ isArray = (_d = attr.repeatable) !== null && _d !== void 0 ? _d : false;
82
83
  str += dependencyComponentName;
83
84
  break;
84
85
  case 'media':
@@ -79,7 +79,9 @@ var InterfaceManager = /** @class */ (function () {
79
79
  this.PrettierOptions = defaultOptions;
80
80
  return [2 /*return*/];
81
81
  }
82
- return [4 /*yield*/, prettier_1.default.resolveConfig(this.Options.prettierFile)];
82
+ return [4 /*yield*/, prettier_1.default.resolveConfig(this.Options.prettierFile, {
83
+ editorconfig: true,
84
+ })];
83
85
  case 1:
84
86
  resolved = _a.sent();
85
87
  this.PrettierOptions = Object.assign({}, defaultOptions, resolved);
@@ -32,8 +32,10 @@ function createMediaInterface(directory, caseTypeName, prefix) {
32
32
  formats: {
33
33
  // types-4-strapi-2 specific
34
34
  type: 'nested',
35
+ nullable: true,
35
36
  fields: {
36
37
  thumbnail: mediaFormat,
38
+ large: mediaFormat,
37
39
  medium: mediaFormat,
38
40
  small: mediaFormat,
39
41
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oak-digital/types-4-strapi-2",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Typescript interface generator for Strapi 4 models",
5
5
  "bin": {
6
6
  "t4s": "./bin/index.js"