@oak-digital/types-4-strapi-2 1.0.1 → 1.0.3

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.
Files changed (44) hide show
  1. package/.github/workflows/publish.yml +48 -0
  2. package/README.md +1 -3
  3. package/lib/attributes/Attributes.js +4 -2
  4. package/lib/interface/builtinInterfaces.d.ts +39 -0
  5. package/lib/program/InterfaceManager.d.ts +6 -0
  6. package/lib/readers/by-file.d.ts +6 -0
  7. package/lib/readers/load-strapi/index.d.ts +6 -0
  8. package/lib/readers/load-strapi/index.js +30 -14
  9. package/lib/readers/load-strapi/remote.js +3 -1
  10. package/lib/readers/types/attributes.d.ts +37 -0
  11. package/lib/readers/types/attributes.js +8 -6
  12. package/lib/readers/types/component.d.ts +15 -0
  13. package/lib/readers/types/content-type.d.ts +15 -0
  14. package/package.json +6 -2
  15. package/tests/strapi-project/.editorconfig +0 -16
  16. package/tests/strapi-project/.env.example +0 -6
  17. package/tests/strapi-project/README.md +0 -57
  18. package/tests/strapi-project/config/admin.ts +0 -13
  19. package/tests/strapi-project/config/api.ts +0 -7
  20. package/tests/strapi-project/config/database.ts +0 -93
  21. package/tests/strapi-project/config/middlewares.ts +0 -12
  22. package/tests/strapi-project/config/server.ts +0 -10
  23. package/tests/strapi-project/database/migrations/.gitkeep +0 -0
  24. package/tests/strapi-project/favicon.png +0 -0
  25. package/tests/strapi-project/package-lock.json +0 -16125
  26. package/tests/strapi-project/package.json +0 -30
  27. package/tests/strapi-project/public/robots.txt +0 -3
  28. package/tests/strapi-project/public/uploads/.gitkeep +0 -0
  29. package/tests/strapi-project/src/admin/app.example.tsx +0 -35
  30. package/tests/strapi-project/src/admin/webpack.config.example.js +0 -9
  31. package/tests/strapi-project/src/api/.gitkeep +0 -0
  32. package/tests/strapi-project/src/api/collection-1/content-types/collection-1/schema.json +0 -18
  33. package/tests/strapi-project/src/api/collection-1/content-types/generated-type/schema.json +0 -18
  34. package/tests/strapi-project/src/api/collection-1/controllers/collection-1.ts +0 -7
  35. package/tests/strapi-project/src/api/collection-1/controllers/generated-type.ts +0 -7
  36. package/tests/strapi-project/src/api/collection-1/routes/collection-1.ts +0 -7
  37. package/tests/strapi-project/src/api/collection-1/routes/generated-type.ts +0 -7
  38. package/tests/strapi-project/src/api/collection-1/services/collection-1.ts +0 -7
  39. package/tests/strapi-project/src/api/collection-1/services/generated-type.ts +0 -7
  40. package/tests/strapi-project/src/api/standalone-controller/controllers/standalone-controller.ts +0 -13
  41. package/tests/strapi-project/src/components/my-category/all-types.json +0 -88
  42. package/tests/strapi-project/src/components/other-category/sub-component.json +0 -12
  43. package/tests/strapi-project/src/extensions/.gitkeep +0 -0
  44. package/tests/strapi-project/src/index.ts +0 -18
@@ -0,0 +1,48 @@
1
+ name: Publish
2
+
3
+ permissions:
4
+ contents: write
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - v*.*.*
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v3
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - uses: pnpm/action-setup@v2
22
+ name: Install pnpm
23
+ id: pnpm-install
24
+ with:
25
+ version: 8
26
+
27
+ - name: Install Node.js
28
+ uses: actions/setup-node@v3
29
+ with:
30
+ node-version: 18
31
+ registry-url: 'https://registry.npmjs.org'
32
+ cache: pnpm
33
+
34
+ - name: Install dependencies
35
+ run: pnpm install
36
+
37
+ - name: Build
38
+ run: pnpm run build
39
+
40
+ - name: Publish
41
+ run: pnpm -r publish --access public --no-git-checks
42
+ env:
43
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
44
+
45
+ - name: Create release
46
+ run: npx changelogithub
47
+ env:
48
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
package/README.md CHANGED
@@ -172,7 +172,5 @@ pnpm run build
172
172
  ## Publishing
173
173
 
174
174
  ```bash
175
- pnpm version # major | minor | patch
176
- pnpm run build
177
- pnpm publish
175
+ pnpm run release
178
176
  ```
@@ -58,7 +58,8 @@ class Attributes {
58
58
  deps.forEach((dep) => dependencies.add(dep));
59
59
  break;
60
60
  case 'relation':
61
- if (attr.relation === 'morphToMany') {
61
+ if (attr.relation === 'morphToMany' ||
62
+ attr.relation === 'morphToOne') {
62
63
  break;
63
64
  }
64
65
  dependencies.add(attr.target);
@@ -109,7 +110,8 @@ class Attributes {
109
110
  str += newAttrs.toString() + nullableString;
110
111
  break;
111
112
  case 'relation':
112
- if (attr.relation === 'morphToMany') {
113
+ if (attr.relation === 'morphToMany' ||
114
+ attr.relation === 'morphToOne') {
113
115
  str += 'any';
114
116
  break;
115
117
  }
@@ -407,6 +407,15 @@ export declare const nestedAttribute: z.ZodObject<{
407
407
  }, {
408
408
  type?: "relation";
409
409
  relation?: "morphToMany";
410
+ }>, z.ZodObject<{
411
+ type: z.ZodLiteral<"relation">;
412
+ relation: z.ZodLiteral<"morphToOne">;
413
+ }, "strip", z.ZodTypeAny, {
414
+ type?: "relation";
415
+ relation?: "morphToOne";
416
+ }, {
417
+ type?: "relation";
418
+ relation?: "morphToOne";
410
419
  }>]>, z.ZodObject<{
411
420
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
412
421
  pluginOptions: z.ZodAny;
@@ -584,6 +593,9 @@ export declare const nestedAttribute: z.ZodObject<{
584
593
  } | {
585
594
  type?: "relation";
586
595
  relation?: "morphToMany";
596
+ } | {
597
+ type?: "relation";
598
+ relation?: "morphToOne";
587
599
  } | {
588
600
  __t4s_required?: boolean;
589
601
  pluginOptions?: any;
@@ -735,6 +747,9 @@ export declare const nestedAttribute: z.ZodObject<{
735
747
  } | {
736
748
  type?: "relation";
737
749
  relation?: "morphToMany";
750
+ } | {
751
+ type?: "relation";
752
+ relation?: "morphToOne";
738
753
  } | {
739
754
  __t4s_required?: boolean;
740
755
  pluginOptions?: any;
@@ -1152,6 +1167,15 @@ export declare const attributeWithNested: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
1152
1167
  }, {
1153
1168
  type?: "relation";
1154
1169
  relation?: "morphToMany";
1170
+ }>, z.ZodObject<{
1171
+ type: z.ZodLiteral<"relation">;
1172
+ relation: z.ZodLiteral<"morphToOne">;
1173
+ }, "strip", z.ZodTypeAny, {
1174
+ type?: "relation";
1175
+ relation?: "morphToOne";
1176
+ }, {
1177
+ type?: "relation";
1178
+ relation?: "morphToOne";
1155
1179
  }>]>, z.ZodObject<{
1156
1180
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
1157
1181
  pluginOptions: z.ZodAny;
@@ -1596,6 +1620,15 @@ export declare const attributeWithNested: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
1596
1620
  }, {
1597
1621
  type?: "relation";
1598
1622
  relation?: "morphToMany";
1623
+ }>, z.ZodObject<{
1624
+ type: z.ZodLiteral<"relation">;
1625
+ relation: z.ZodLiteral<"morphToOne">;
1626
+ }, "strip", z.ZodTypeAny, {
1627
+ type?: "relation";
1628
+ relation?: "morphToOne";
1629
+ }, {
1630
+ type?: "relation";
1631
+ relation?: "morphToOne";
1599
1632
  }>]>, z.ZodObject<{
1600
1633
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
1601
1634
  pluginOptions: z.ZodAny;
@@ -1773,6 +1806,9 @@ export declare const attributeWithNested: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
1773
1806
  } | {
1774
1807
  type?: "relation";
1775
1808
  relation?: "morphToMany";
1809
+ } | {
1810
+ type?: "relation";
1811
+ relation?: "morphToOne";
1776
1812
  } | {
1777
1813
  __t4s_required?: boolean;
1778
1814
  pluginOptions?: any;
@@ -1924,6 +1960,9 @@ export declare const attributeWithNested: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
1924
1960
  } | {
1925
1961
  type?: "relation";
1926
1962
  relation?: "morphToMany";
1963
+ } | {
1964
+ type?: "relation";
1965
+ relation?: "morphToOne";
1927
1966
  } | {
1928
1967
  __t4s_required?: boolean;
1929
1968
  pluginOptions?: any;
@@ -206,6 +206,9 @@ export default class InterfaceManager {
206
206
  } | {
207
207
  type?: "relation";
208
208
  relation?: "morphToMany";
209
+ } | {
210
+ type?: "relation";
211
+ relation?: "morphToOne";
209
212
  } | {
210
213
  __t4s_required?: boolean;
211
214
  pluginOptions?: any;
@@ -370,6 +373,9 @@ export default class InterfaceManager {
370
373
  } | {
371
374
  type?: "relation";
372
375
  relation?: "morphToMany";
376
+ } | {
377
+ type?: "relation";
378
+ relation?: "morphToOne";
373
379
  } | {
374
380
  __t4s_required?: boolean;
375
381
  pluginOptions?: any;
@@ -138,6 +138,9 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
138
138
  } | {
139
139
  type?: "relation";
140
140
  relation?: "morphToMany";
141
+ } | {
142
+ type?: "relation";
143
+ relation?: "morphToOne";
141
144
  } | {
142
145
  __t4s_required?: boolean;
143
146
  pluginOptions?: any;
@@ -286,6 +289,9 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
286
289
  } | {
287
290
  type?: "relation";
288
291
  relation?: "morphToMany";
292
+ } | {
293
+ type?: "relation";
294
+ relation?: "morphToOne";
289
295
  } | {
290
296
  __t4s_required?: boolean;
291
297
  pluginOptions?: any;
@@ -140,6 +140,9 @@ export declare class LoadStrapiReader implements ContentTypeReader {
140
140
  } | {
141
141
  type?: "relation";
142
142
  relation?: "morphToMany";
143
+ } | {
144
+ type?: "relation";
145
+ relation?: "morphToOne";
143
146
  } | {
144
147
  __t4s_required?: boolean;
145
148
  pluginOptions?: any;
@@ -304,6 +307,9 @@ export declare class LoadStrapiReader implements ContentTypeReader {
304
307
  } | {
305
308
  type?: "relation";
306
309
  relation?: "morphToMany";
310
+ } | {
311
+ type?: "relation";
312
+ relation?: "morphToOne";
307
313
  } | {
308
314
  __t4s_required?: boolean;
309
315
  pluginOptions?: any;
@@ -60,33 +60,49 @@ class LoadStrapiReader {
60
60
  loadStrapi() {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
62
  const localRemoteFile = (0, posix_1.join)(__dirname, 'remote.js');
63
- const remoteRemoteFile = (0, posix_1.join)(process.cwd(), this.strapiRoot, '.t4s.remote.js');
63
+ // TODO: Make better check if the path is absolute or not
64
+ const root = this.strapiRoot.startsWith('/') ||
65
+ this.strapiRoot.startsWith('\\') ||
66
+ this.strapiRoot.startsWith('~')
67
+ ? ''
68
+ : process.cwd();
69
+ const remoteRemoteFile = (0, posix_1.join)(root, this.strapiRoot, '.t4s.remote.js');
70
+ const remoteOutputFile = (0, posix_1.join)(root, this.strapiRoot, '.t4s.contentTypes.json');
64
71
  // Plant the remote execution file in the strapi project
65
72
  yield (0, promises_1.cp)(localRemoteFile, remoteRemoteFile);
66
73
  const output = yield new Promise((resolve, reject) => {
67
74
  const remote = (0, child_process_1.spawn)('node', [remoteRemoteFile], {
68
75
  cwd: this.strapiRoot,
69
76
  });
70
- const data = [];
71
- remote.stdout.on('data', (chunk) => {
72
- data.push(chunk);
73
- });
77
+ const errData = [];
74
78
  remote.stderr.on('data', (chunk) => {
75
- console.error(chunk.toString());
76
- });
77
- remote.on('close', () => {
78
- resolve(data.map((b) => b === null || b === void 0 ? void 0 : b.toString()).join(''));
79
- });
80
- remote.on('error', (err) => {
81
- reject(err);
79
+ errData.push(chunk);
82
80
  });
81
+ remote.on('close', (code) => __awaiter(this, void 0, void 0, function* () {
82
+ if (code !== 0) {
83
+ reject(new Error(`Failed to spawn remote strapi: ${errData
84
+ .map((b) => { var _a; return (_a = b === null || b === void 0 ? void 0 : b.toString()) !== null && _a !== void 0 ? _a : ''; })
85
+ .join('')}`));
86
+ return;
87
+ }
88
+ try {
89
+ const output = yield (0, promises_1.readFile)(remoteOutputFile);
90
+ resolve(output.toString());
91
+ }
92
+ catch (err) {
93
+ reject(err);
94
+ }
95
+ }));
83
96
  });
97
+ if (output.length <= 0) {
98
+ throw new Error('Remote program did not return any output');
99
+ }
84
100
  let jsonParsed;
85
101
  try {
86
102
  jsonParsed = JSON.parse(output);
87
103
  }
88
104
  catch (err) {
89
- console.error(err, output.slice(0, 100));
105
+ console.error(err, output);
90
106
  throw new Error('Failed to parse output from remote strapi');
91
107
  }
92
108
  let parsed;
@@ -98,7 +114,7 @@ class LoadStrapiReader {
98
114
  throw new Error('Failed to parse output from remote strapi, something may be malformed');
99
115
  }
100
116
  // Remove the remote execution file after we're done
101
- yield (0, promises_1.rm)(remoteRemoteFile);
117
+ yield Promise.all([(0, promises_1.rm)(remoteOutputFile), (0, promises_1.rm)(remoteRemoteFile)]);
102
118
  return parsed;
103
119
  });
104
120
  }
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  const Strapi = require('@strapi/strapi');
12
+ const fs = require('fs/promises');
12
13
  (() => __awaiter(this, void 0, void 0, function* () {
13
14
  const base = yield Strapi({
14
15
  distDir: 'dist',
@@ -18,7 +19,8 @@ const Strapi = require('@strapi/strapi');
18
19
  base.log.info = () => { };
19
20
  const instance = yield base.load();
20
21
  yield instance.server.mount();
21
- console.log(JSON.stringify([instance.contentTypes, instance.components]));
22
+ // console.log(JSON.stringify([instance.contentTypes, instance.components]));
23
+ yield fs.writeFile('.t4s.contentTypes.json', JSON.stringify([instance.contentTypes, instance.components]));
22
24
  const dbSettings = instance.config.get('database.connection');
23
25
  //close server to release the db-file
24
26
  yield instance.server.httpServer.close();
@@ -574,6 +574,16 @@ export declare const morphToManyAttribute: z.ZodObject<{
574
574
  type?: "relation";
575
575
  relation?: "morphToMany";
576
576
  }>;
577
+ export declare const morphOneAttribute: z.ZodObject<{
578
+ type: z.ZodLiteral<"relation">;
579
+ relation: z.ZodLiteral<"morphToOne">;
580
+ }, "strip", z.ZodTypeAny, {
581
+ type?: "relation";
582
+ relation?: "morphToOne";
583
+ }, {
584
+ type?: "relation";
585
+ relation?: "morphToOne";
586
+ }>;
577
587
  export declare const relationAttribute: z.ZodUnion<[z.ZodObject<{
578
588
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
579
589
  pluginOptions: z.ZodAny;
@@ -724,6 +734,15 @@ export declare const relationAttribute: z.ZodUnion<[z.ZodObject<{
724
734
  }, {
725
735
  type?: "relation";
726
736
  relation?: "morphToMany";
737
+ }>, z.ZodObject<{
738
+ type: z.ZodLiteral<"relation">;
739
+ relation: z.ZodLiteral<"morphToOne">;
740
+ }, "strip", z.ZodTypeAny, {
741
+ type?: "relation";
742
+ relation?: "morphToOne";
743
+ }, {
744
+ type?: "relation";
745
+ relation?: "morphToOne";
727
746
  }>]>;
728
747
  export declare type RelationAttribute = z.infer<typeof relationAttribute>;
729
748
  export declare const componentAttribute: z.ZodObject<{
@@ -1171,6 +1190,15 @@ export declare const attribute: z.ZodUnion<[z.ZodObject<{
1171
1190
  }, {
1172
1191
  type?: "relation";
1173
1192
  relation?: "morphToMany";
1193
+ }>, z.ZodObject<{
1194
+ type: z.ZodLiteral<"relation">;
1195
+ relation: z.ZodLiteral<"morphToOne">;
1196
+ }, "strip", z.ZodTypeAny, {
1197
+ type?: "relation";
1198
+ relation?: "morphToOne";
1199
+ }, {
1200
+ type?: "relation";
1201
+ relation?: "morphToOne";
1174
1202
  }>]>, z.ZodObject<{
1175
1203
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
1176
1204
  pluginOptions: z.ZodAny;
@@ -1596,6 +1624,15 @@ export declare const contentTypeAttribute: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
1596
1624
  }, {
1597
1625
  type?: "relation";
1598
1626
  relation?: "morphToMany";
1627
+ }>, z.ZodObject<{
1628
+ type: z.ZodLiteral<"relation">;
1629
+ relation: z.ZodLiteral<"morphToOne">;
1630
+ }, "strip", z.ZodTypeAny, {
1631
+ type?: "relation";
1632
+ relation?: "morphToOne";
1633
+ }, {
1634
+ type?: "relation";
1635
+ relation?: "morphToOne";
1599
1636
  }>]>, z.ZodObject<{
1600
1637
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
1601
1638
  pluginOptions: z.ZodAny;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.contentTypeAttribute = exports.attribute = exports.dynamiczoneAttribute = exports.componentAttribute = exports.relationAttribute = exports.morphToManyAttribute = exports.hasManyAttribute = exports.manyToManyAttribute = exports.manyToOneAttribute = exports.belongsToManyAttribute = exports.oneToOneAttribute = exports.hasOneAttribute = exports.baseRelationAttribute = exports.booleanAttribute = exports.mediaAttribute = exports.dateAttribute = exports.timeAttribute = exports.dateTimeAttribute = exports.dateOnlyAttribute = exports.enumAttribute = exports.numberAttribute = exports.decimalAttribute = exports.bigIntAttribute = exports.floatAttribute = exports.integerAttribute = exports.passwordAttribute = exports.jsonAttribute = exports.richTextAttribute = exports.uidAttribute = exports.emailAttribute = exports.textAttribute = exports.baseAttribute = void 0;
3
+ exports.contentTypeAttribute = exports.attribute = exports.dynamiczoneAttribute = exports.componentAttribute = exports.relationAttribute = exports.morphOneAttribute = exports.morphToManyAttribute = exports.hasManyAttribute = exports.manyToManyAttribute = exports.manyToOneAttribute = exports.belongsToManyAttribute = exports.oneToOneAttribute = exports.hasOneAttribute = exports.baseRelationAttribute = exports.booleanAttribute = exports.mediaAttribute = exports.dateAttribute = exports.timeAttribute = exports.dateTimeAttribute = exports.dateOnlyAttribute = exports.enumAttribute = exports.numberAttribute = exports.decimalAttribute = exports.bigIntAttribute = exports.floatAttribute = exports.integerAttribute = exports.passwordAttribute = exports.jsonAttribute = exports.richTextAttribute = exports.uidAttribute = exports.emailAttribute = exports.textAttribute = exports.baseAttribute = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
6
  exports.baseAttribute = zod_1.z.object({
@@ -9,7 +9,7 @@ exports.baseAttribute = zod_1.z.object({
9
9
  [constants_1.CERTAINLY_REQUIRED_KEY]: zod_1.z.boolean().optional(),
10
10
  });
11
11
  exports.textAttribute = exports.baseAttribute.extend({
12
- type: zod_1.z.enum(['text', 'string'])
12
+ type: zod_1.z.enum(['text', 'string']),
13
13
  });
14
14
  exports.emailAttribute = exports.baseAttribute.extend({
15
15
  type: zod_1.z.literal('email'),
@@ -105,6 +105,10 @@ exports.morphToManyAttribute = zod_1.z.object({
105
105
  type: zod_1.z.literal('relation'),
106
106
  relation: zod_1.z.literal('morphToMany'),
107
107
  });
108
+ exports.morphOneAttribute = zod_1.z.object({
109
+ type: zod_1.z.literal('relation'),
110
+ relation: zod_1.z.literal('morphToOne'),
111
+ });
108
112
  exports.relationAttribute = zod_1.z.union([
109
113
  exports.hasOneAttribute,
110
114
  exports.oneToOneAttribute,
@@ -113,6 +117,7 @@ exports.relationAttribute = zod_1.z.union([
113
117
  exports.manyToManyAttribute,
114
118
  exports.hasManyAttribute,
115
119
  exports.morphToManyAttribute,
120
+ exports.morphOneAttribute,
116
121
  ]);
117
122
  exports.componentAttribute = exports.baseAttribute.extend({
118
123
  type: zod_1.z.literal('component'),
@@ -138,7 +143,4 @@ exports.attribute = zod_1.z.union([
138
143
  exports.relationAttribute,
139
144
  exports.componentAttribute,
140
145
  ]);
141
- exports.contentTypeAttribute = zod_1.z.union([
142
- exports.attribute,
143
- exports.dynamiczoneAttribute,
144
- ]);
146
+ exports.contentTypeAttribute = zod_1.z.union([exports.attribute, exports.dynamiczoneAttribute]);
@@ -403,6 +403,15 @@ export declare const strapiComponent: z.ZodObject<{
403
403
  }, {
404
404
  type?: "relation";
405
405
  relation?: "morphToMany";
406
+ }>, z.ZodObject<{
407
+ type: z.ZodLiteral<"relation">;
408
+ relation: z.ZodLiteral<"morphToOne">;
409
+ }, "strip", z.ZodTypeAny, {
410
+ type?: "relation";
411
+ relation?: "morphToOne";
412
+ }, {
413
+ type?: "relation";
414
+ relation?: "morphToOne";
406
415
  }>]>, z.ZodObject<{
407
416
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
408
417
  pluginOptions: z.ZodAny;
@@ -563,6 +572,9 @@ export declare const strapiComponent: z.ZodObject<{
563
572
  } | {
564
573
  type?: "relation";
565
574
  relation?: "morphToMany";
575
+ } | {
576
+ type?: "relation";
577
+ relation?: "morphToOne";
566
578
  } | {
567
579
  __t4s_required?: boolean;
568
580
  pluginOptions?: any;
@@ -709,6 +721,9 @@ export declare const strapiComponent: z.ZodObject<{
709
721
  } | {
710
722
  type?: "relation";
711
723
  relation?: "morphToMany";
724
+ } | {
725
+ type?: "relation";
726
+ relation?: "morphToOne";
712
727
  } | {
713
728
  __t4s_required?: boolean;
714
729
  pluginOptions?: any;
@@ -402,6 +402,15 @@ export declare const strapiContentType: z.ZodObject<{
402
402
  }, {
403
403
  type?: "relation";
404
404
  relation?: "morphToMany";
405
+ }>, z.ZodObject<{
406
+ type: z.ZodLiteral<"relation">;
407
+ relation: z.ZodLiteral<"morphToOne">;
408
+ }, "strip", z.ZodTypeAny, {
409
+ type?: "relation";
410
+ relation?: "morphToOne";
411
+ }, {
412
+ type?: "relation";
413
+ relation?: "morphToOne";
405
414
  }>]>, z.ZodObject<{
406
415
  __t4s_required: z.ZodOptional<z.ZodBoolean>;
407
416
  pluginOptions: z.ZodAny;
@@ -587,6 +596,9 @@ export declare const strapiContentType: z.ZodObject<{
587
596
  } | {
588
597
  type?: "relation";
589
598
  relation?: "morphToMany";
599
+ } | {
600
+ type?: "relation";
601
+ relation?: "morphToOne";
590
602
  } | {
591
603
  __t4s_required?: boolean;
592
604
  pluginOptions?: any;
@@ -742,6 +754,9 @@ export declare const strapiContentType: z.ZodObject<{
742
754
  } | {
743
755
  type?: "relation";
744
756
  relation?: "morphToMany";
757
+ } | {
758
+ type?: "relation";
759
+ relation?: "morphToOne";
745
760
  } | {
746
761
  __t4s_required?: boolean;
747
762
  pluginOptions?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oak-digital/types-4-strapi-2",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Typescript interface generator for Strapi 4 models",
5
5
  "bin": {
6
6
  "t4s": "./bin/index.js"
@@ -26,8 +26,10 @@
26
26
  "@types/prettier": "^2.7.0",
27
27
  "@typescript-eslint/eslint-plugin": "^5.33.1",
28
28
  "@typescript-eslint/parser": "^5.33.1",
29
+ "bumpp": "^9.3.0",
29
30
  "eslint": "^8.22.0",
30
31
  "rimraf": "^4.4.1",
32
+ "ts-node": "^10.9.1",
31
33
  "typescript": "^4.7.4"
32
34
  },
33
35
  "dependencies": {
@@ -41,6 +43,8 @@
41
43
  "testtypes": "node ./bin/index.js",
42
44
  "lint": "eslint src/",
43
45
  "prettier": "prettier --write \"src/**/*.ts\"",
44
- "t4s": "node ./bin/index.js"
46
+ "t4s": "node ./bin/index.js",
47
+ "testdev": "ts-node ./src/index.ts",
48
+ "release": "bumpp"
45
49
  }
46
50
  }
@@ -1,16 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [{package.json,*.yml}]
12
- indent_style = space
13
- indent_size = 2
14
-
15
- [*.md]
16
- trim_trailing_whitespace = false
@@ -1,6 +0,0 @@
1
- HOST=0.0.0.0
2
- PORT=1337
3
- APP_KEYS="toBeModified1,toBeModified2"
4
- API_TOKEN_SALT=tobemodified
5
- ADMIN_JWT_SECRET=tobemodified
6
- JWT_SECRET=tobemodified
@@ -1,57 +0,0 @@
1
- # 🚀 Getting started with Strapi
2
-
3
- Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds.
4
-
5
- ### `develop`
6
-
7
- Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop)
8
-
9
- ```
10
- npm run develop
11
- # or
12
- yarn develop
13
- ```
14
-
15
- ### `start`
16
-
17
- Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start)
18
-
19
- ```
20
- npm run start
21
- # or
22
- yarn start
23
- ```
24
-
25
- ### `build`
26
-
27
- Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build)
28
-
29
- ```
30
- npm run build
31
- # or
32
- yarn build
33
- ```
34
-
35
- ## ⚙️ Deployment
36
-
37
- Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html).
38
-
39
- ## 📚 Learn more
40
-
41
- - [Resource center](https://strapi.io/resource-center) - Strapi resource center.
42
- - [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
43
- - [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
44
- - [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community.
45
- - [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
46
-
47
- Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
48
-
49
- ## ✨ Community
50
-
51
- - [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
52
- - [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
53
- - [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
54
-
55
- ---
56
-
57
- <sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
@@ -1,13 +0,0 @@
1
- export default ({ env }) => ({
2
- auth: {
3
- secret: env('ADMIN_JWT_SECRET'),
4
- },
5
- apiToken: {
6
- salt: env('API_TOKEN_SALT'),
7
- },
8
- transfer: {
9
- token: {
10
- salt: env('TRANSFER_TOKEN_SALT'),
11
- },
12
- },
13
- });
@@ -1,7 +0,0 @@
1
- export default {
2
- rest: {
3
- defaultLimit: 25,
4
- maxLimit: 100,
5
- withCount: true,
6
- },
7
- };