@oak-digital/types-4-strapi-2 1.0.5 → 1.0.7

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.
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createMediaFormatInterface = exports.createMediaInterface = exports.attributeWithNested = exports.nestedAttribute = void 0;
6
+ exports.attributeWithNested = exports.nestedAttribute = void 0;
7
+ exports.createMediaInterface = createMediaInterface;
8
+ exports.createMediaFormatInterface = createMediaFormatInterface;
7
9
  const zod_1 = require("zod");
8
10
  const constants_1 = require("../constants");
9
11
  const attributes_1 = require("../readers/types/attributes");
@@ -80,7 +82,6 @@ function createMediaInterface(caseTypeName, prefix) {
80
82
  // };
81
83
  return new BuiltinInterface_1.default('Media', mediaAttrs, '', caseTypeName, prefix);
82
84
  }
83
- exports.createMediaInterface = createMediaInterface;
84
85
  function createMediaFormatInterface(caseTypeName, prefix) {
85
86
  const stringRequiredFields = ['name', 'hash', 'ext', 'mime', 'url'];
86
87
  const stringFields = ['path'];
@@ -109,4 +110,3 @@ function createMediaFormatInterface(caseTypeName, prefix) {
109
110
  });
110
111
  return new BuiltinComponentInterface_1.default('MediaFormat', mediaAttrs, '', caseTypeName, prefix);
111
112
  }
112
- exports.createMediaFormatInterface = createMediaFormatInterface;
@@ -71,184 +71,17 @@ export default class InterfaceManager {
71
71
  readSchemas(): Promise<{
72
72
  apiSchemas: Record<`api::${string}` | `plugin::${string}` | `admin::${string}` | `builtins::${string}`, {
73
73
  name: string;
74
- contentType: {
75
- attributes?: Record<string, {
76
- __t4s_required?: boolean;
77
- pluginOptions?: any;
78
- required?: boolean;
79
- type?: "string" | "text";
80
- } | {
81
- __t4s_required?: boolean;
82
- pluginOptions?: any;
83
- required?: boolean;
84
- type?: "email";
85
- } | {
86
- __t4s_required?: boolean;
87
- pluginOptions?: any;
88
- required?: boolean;
89
- type?: "uid";
90
- targetField?: string;
91
- } | {
92
- __t4s_required?: boolean;
93
- pluginOptions?: any;
94
- required?: boolean;
95
- type?: "richtext";
96
- } | {
97
- __t4s_required?: boolean;
98
- pluginOptions?: any;
99
- required?: boolean;
100
- type?: "json";
101
- } | {
102
- __t4s_required?: boolean;
103
- pluginOptions?: any;
104
- required?: boolean;
105
- type?: "password";
106
- } | {
107
- __t4s_required?: boolean;
108
- pluginOptions?: any;
109
- required?: boolean;
110
- type?: "integer";
111
- } | {
112
- __t4s_required?: boolean;
113
- pluginOptions?: any;
114
- required?: boolean;
115
- type?: "float";
116
- } | {
117
- __t4s_required?: boolean;
118
- pluginOptions?: any;
119
- required?: boolean;
120
- type?: "biginteger";
121
- } | {
122
- __t4s_required?: boolean;
123
- pluginOptions?: any;
124
- required?: boolean;
125
- type?: "decimal";
126
- } | {
127
- __t4s_required?: boolean;
128
- pluginOptions?: any;
129
- required?: boolean;
130
- type?: "enumeration";
131
- enum?: string[];
132
- } | {
133
- __t4s_required?: boolean;
134
- pluginOptions?: any;
135
- required?: boolean;
136
- type?: "date";
137
- } | {
138
- __t4s_required?: boolean;
139
- pluginOptions?: any;
140
- required?: boolean;
141
- type?: "datetime";
142
- } | {
143
- __t4s_required?: boolean;
144
- pluginOptions?: any;
145
- required?: boolean;
146
- type?: "time";
147
- } | {
148
- __t4s_required?: boolean;
149
- pluginOptions?: any;
150
- required?: boolean;
151
- type?: "media";
152
- multiple?: boolean;
153
- allowedTypes?: ("images" | "videos" | "audios" | "files")[];
154
- } | {
155
- __t4s_required?: boolean;
156
- pluginOptions?: any;
157
- required?: boolean;
158
- type?: "boolean";
159
- } | {
160
- __t4s_required?: boolean;
161
- pluginOptions?: any;
162
- required?: boolean;
163
- type?: "relation";
164
- target?: string;
165
- relation?: "oneToOne";
166
- } | {
167
- __t4s_required?: boolean;
168
- pluginOptions?: any;
169
- required?: boolean;
170
- type?: "relation";
171
- target?: string;
172
- relation?: "oneToOne";
173
- inversedBy?: string;
174
- } | {
175
- __t4s_required?: boolean;
176
- pluginOptions?: any;
177
- required?: boolean;
178
- type?: "relation";
179
- target?: string;
180
- mappedBy?: string;
181
- relation?: "oneToMany";
182
- } | {
183
- __t4s_required?: boolean;
184
- pluginOptions?: any;
185
- required?: boolean;
186
- type?: "relation";
187
- target?: string;
188
- relation?: "manyToOne";
189
- inversedBy?: string;
190
- } | {
191
- __t4s_required?: boolean;
192
- pluginOptions?: any;
193
- required?: boolean;
194
- type?: "relation";
195
- target?: string;
196
- relation?: "manyToMany";
197
- inversedBy?: string;
198
- mappedBy?: string;
199
- } | {
200
- __t4s_required?: boolean;
201
- pluginOptions?: any;
202
- required?: boolean;
203
- type?: "relation";
204
- target?: string;
205
- relation?: "oneToMany";
206
- } | {
207
- __t4s_required?: boolean;
208
- pluginOptions?: any;
209
- required?: boolean;
210
- type?: "relation";
211
- relation?: "morphToMany";
212
- } | {
213
- __t4s_required?: boolean;
214
- pluginOptions?: any;
215
- required?: boolean;
216
- type?: "relation";
217
- relation?: "morphToOne";
218
- } | {
219
- __t4s_required?: boolean;
220
- pluginOptions?: any;
221
- required?: boolean;
222
- type?: "component";
223
- repeatable?: boolean;
224
- component?: string;
225
- } | {
226
- __t4s_required?: boolean;
227
- pluginOptions?: any;
228
- required?: boolean;
229
- type?: "dynamiczone";
230
- components?: string[];
231
- } | import("zod").objectOutputType<{
232
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
233
- pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
234
- required: import("zod").ZodOptional<import("zod").ZodBoolean>;
235
- type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
236
- }, import("zod").ZodTypeAny, "passthrough">>;
237
- collectionName?: string;
238
- options?: {
239
- draftAndPublish?: boolean;
240
- };
241
- pluginOptions?: Record<string, any>;
242
- uid?: string;
243
- };
74
+ contentType: import("../readers/types/content-type").StrapiContentType;
244
75
  } & ({
245
76
  namespace: "api" | "plugin";
246
77
  collection: string;
247
78
  } | {
248
79
  namespace: "admin";
249
- collection?: null;
80
+ collection?: null | undefined;
250
81
  })>;
251
82
  componentSchemas: Record<`${string}.${string}`, {
83
+ options?: {};
84
+ uid?: string;
252
85
  collectionName?: string;
253
86
  attributes?: Record<string, {
254
87
  __t4s_required?: boolean;
@@ -271,6 +104,11 @@ export default class InterfaceManager {
271
104
  pluginOptions?: any;
272
105
  required?: boolean;
273
106
  type?: "richtext";
107
+ } | {
108
+ __t4s_required?: boolean;
109
+ pluginOptions?: any;
110
+ required?: boolean;
111
+ type?: "blocks";
274
112
  } | {
275
113
  __t4s_required?: boolean;
276
114
  pluginOptions?: any;
@@ -339,39 +177,39 @@ export default class InterfaceManager {
339
177
  pluginOptions?: any;
340
178
  required?: boolean;
341
179
  type?: "relation";
342
- target?: string;
343
180
  relation?: "oneToOne";
181
+ target?: string;
344
182
  } | {
345
183
  __t4s_required?: boolean;
346
184
  pluginOptions?: any;
347
185
  required?: boolean;
348
186
  type?: "relation";
349
- target?: string;
350
187
  relation?: "oneToOne";
188
+ target?: string;
351
189
  inversedBy?: string;
352
190
  } | {
353
191
  __t4s_required?: boolean;
354
192
  pluginOptions?: any;
355
193
  required?: boolean;
356
194
  type?: "relation";
195
+ relation?: "oneToMany";
357
196
  target?: string;
358
197
  mappedBy?: string;
359
- relation?: "oneToMany";
360
198
  } | {
361
199
  __t4s_required?: boolean;
362
200
  pluginOptions?: any;
363
201
  required?: boolean;
364
202
  type?: "relation";
365
- target?: string;
366
203
  relation?: "manyToOne";
204
+ target?: string;
367
205
  inversedBy?: string;
368
206
  } | {
369
207
  __t4s_required?: boolean;
370
208
  pluginOptions?: any;
371
209
  required?: boolean;
372
210
  type?: "relation";
373
- target?: string;
374
211
  relation?: "manyToMany";
212
+ target?: string;
375
213
  inversedBy?: string;
376
214
  mappedBy?: string;
377
215
  } | {
@@ -379,8 +217,8 @@ export default class InterfaceManager {
379
217
  pluginOptions?: any;
380
218
  required?: boolean;
381
219
  type?: "relation";
382
- target?: string;
383
220
  relation?: "oneToMany";
221
+ target?: string;
384
222
  } | {
385
223
  __t4s_required?: boolean;
386
224
  pluginOptions?: any;
@@ -398,16 +236,15 @@ export default class InterfaceManager {
398
236
  pluginOptions?: any;
399
237
  required?: boolean;
400
238
  type?: "component";
401
- repeatable?: boolean;
402
239
  component?: string;
240
+ repeatable?: boolean;
403
241
  } | import("zod").objectOutputType<{
404
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
405
242
  pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
406
243
  required: import("zod").ZodOptional<import("zod").ZodBoolean>;
244
+ __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
245
+ } & {
407
246
  type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
408
247
  }, import("zod").ZodTypeAny, "passthrough">>;
409
- options?: {};
410
- uid?: string;
411
248
  }>;
412
249
  }>;
413
250
  addType(name: string, file: File, force?: boolean): boolean;
@@ -3,6 +3,8 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
3
3
  private readonly strapiSrcRoot;
4
4
  constructor(strapiRoot: string);
5
5
  readComponents(): Promise<Record<`${string}.${string}`, {
6
+ options?: {};
7
+ uid?: string;
6
8
  collectionName?: string;
7
9
  attributes?: Record<string, {
8
10
  __t4s_required?: boolean;
@@ -25,6 +27,11 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
25
27
  pluginOptions?: any;
26
28
  required?: boolean;
27
29
  type?: "richtext";
30
+ } | {
31
+ __t4s_required?: boolean;
32
+ pluginOptions?: any;
33
+ required?: boolean;
34
+ type?: "blocks";
28
35
  } | {
29
36
  __t4s_required?: boolean;
30
37
  pluginOptions?: any;
@@ -93,39 +100,39 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
93
100
  pluginOptions?: any;
94
101
  required?: boolean;
95
102
  type?: "relation";
96
- target?: string;
97
103
  relation?: "oneToOne";
104
+ target?: string;
98
105
  } | {
99
106
  __t4s_required?: boolean;
100
107
  pluginOptions?: any;
101
108
  required?: boolean;
102
109
  type?: "relation";
103
- target?: string;
104
110
  relation?: "oneToOne";
111
+ target?: string;
105
112
  inversedBy?: string;
106
113
  } | {
107
114
  __t4s_required?: boolean;
108
115
  pluginOptions?: any;
109
116
  required?: boolean;
110
117
  type?: "relation";
118
+ relation?: "oneToMany";
111
119
  target?: string;
112
120
  mappedBy?: string;
113
- relation?: "oneToMany";
114
121
  } | {
115
122
  __t4s_required?: boolean;
116
123
  pluginOptions?: any;
117
124
  required?: boolean;
118
125
  type?: "relation";
119
- target?: string;
120
126
  relation?: "manyToOne";
127
+ target?: string;
121
128
  inversedBy?: string;
122
129
  } | {
123
130
  __t4s_required?: boolean;
124
131
  pluginOptions?: any;
125
132
  required?: boolean;
126
133
  type?: "relation";
127
- target?: string;
128
134
  relation?: "manyToMany";
135
+ target?: string;
129
136
  inversedBy?: string;
130
137
  mappedBy?: string;
131
138
  } | {
@@ -133,8 +140,8 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
133
140
  pluginOptions?: any;
134
141
  required?: boolean;
135
142
  type?: "relation";
136
- target?: string;
137
143
  relation?: "oneToMany";
144
+ target?: string;
138
145
  } | {
139
146
  __t4s_required?: boolean;
140
147
  pluginOptions?: any;
@@ -152,195 +159,25 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
152
159
  pluginOptions?: any;
153
160
  required?: boolean;
154
161
  type?: "component";
155
- repeatable?: boolean;
156
162
  component?: string;
163
+ repeatable?: boolean;
157
164
  } | import("zod").objectOutputType<{
158
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
159
165
  pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
160
166
  required: import("zod").ZodOptional<import("zod").ZodBoolean>;
167
+ __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
168
+ } & {
161
169
  type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
162
170
  }, import("zod").ZodTypeAny, "passthrough">>;
163
- options?: {};
164
- uid?: string;
165
171
  }>>;
166
172
  readContentTypes(): Promise<Record<`api::${string}` | `plugin::${string}` | `admin::${string}` | `builtins::${string}`, {
167
173
  name: string;
168
- contentType: {
169
- attributes?: Record<string, {
170
- __t4s_required?: boolean;
171
- pluginOptions?: any;
172
- required?: boolean;
173
- type?: "string" | "text";
174
- } | {
175
- __t4s_required?: boolean;
176
- pluginOptions?: any;
177
- required?: boolean;
178
- type?: "email";
179
- } | {
180
- __t4s_required?: boolean;
181
- pluginOptions?: any;
182
- required?: boolean;
183
- type?: "uid";
184
- targetField?: string;
185
- } | {
186
- __t4s_required?: boolean;
187
- pluginOptions?: any;
188
- required?: boolean;
189
- type?: "richtext";
190
- } | {
191
- __t4s_required?: boolean;
192
- pluginOptions?: any;
193
- required?: boolean;
194
- type?: "json";
195
- } | {
196
- __t4s_required?: boolean;
197
- pluginOptions?: any;
198
- required?: boolean;
199
- type?: "password";
200
- } | {
201
- __t4s_required?: boolean;
202
- pluginOptions?: any;
203
- required?: boolean;
204
- type?: "integer";
205
- } | {
206
- __t4s_required?: boolean;
207
- pluginOptions?: any;
208
- required?: boolean;
209
- type?: "float";
210
- } | {
211
- __t4s_required?: boolean;
212
- pluginOptions?: any;
213
- required?: boolean;
214
- type?: "biginteger";
215
- } | {
216
- __t4s_required?: boolean;
217
- pluginOptions?: any;
218
- required?: boolean;
219
- type?: "decimal";
220
- } | {
221
- __t4s_required?: boolean;
222
- pluginOptions?: any;
223
- required?: boolean;
224
- type?: "enumeration";
225
- enum?: string[];
226
- } | {
227
- __t4s_required?: boolean;
228
- pluginOptions?: any;
229
- required?: boolean;
230
- type?: "date";
231
- } | {
232
- __t4s_required?: boolean;
233
- pluginOptions?: any;
234
- required?: boolean;
235
- type?: "datetime";
236
- } | {
237
- __t4s_required?: boolean;
238
- pluginOptions?: any;
239
- required?: boolean;
240
- type?: "time";
241
- } | {
242
- __t4s_required?: boolean;
243
- pluginOptions?: any;
244
- required?: boolean;
245
- type?: "media";
246
- multiple?: boolean;
247
- allowedTypes?: ("images" | "videos" | "audios" | "files")[];
248
- } | {
249
- __t4s_required?: boolean;
250
- pluginOptions?: any;
251
- required?: boolean;
252
- type?: "boolean";
253
- } | {
254
- __t4s_required?: boolean;
255
- pluginOptions?: any;
256
- required?: boolean;
257
- type?: "relation";
258
- target?: string;
259
- relation?: "oneToOne";
260
- } | {
261
- __t4s_required?: boolean;
262
- pluginOptions?: any;
263
- required?: boolean;
264
- type?: "relation";
265
- target?: string;
266
- relation?: "oneToOne";
267
- inversedBy?: string;
268
- } | {
269
- __t4s_required?: boolean;
270
- pluginOptions?: any;
271
- required?: boolean;
272
- type?: "relation";
273
- target?: string;
274
- mappedBy?: string;
275
- relation?: "oneToMany";
276
- } | {
277
- __t4s_required?: boolean;
278
- pluginOptions?: any;
279
- required?: boolean;
280
- type?: "relation";
281
- target?: string;
282
- relation?: "manyToOne";
283
- inversedBy?: string;
284
- } | {
285
- __t4s_required?: boolean;
286
- pluginOptions?: any;
287
- required?: boolean;
288
- type?: "relation";
289
- target?: string;
290
- relation?: "manyToMany";
291
- inversedBy?: string;
292
- mappedBy?: string;
293
- } | {
294
- __t4s_required?: boolean;
295
- pluginOptions?: any;
296
- required?: boolean;
297
- type?: "relation";
298
- target?: string;
299
- relation?: "oneToMany";
300
- } | {
301
- __t4s_required?: boolean;
302
- pluginOptions?: any;
303
- required?: boolean;
304
- type?: "relation";
305
- relation?: "morphToMany";
306
- } | {
307
- __t4s_required?: boolean;
308
- pluginOptions?: any;
309
- required?: boolean;
310
- type?: "relation";
311
- relation?: "morphToOne";
312
- } | {
313
- __t4s_required?: boolean;
314
- pluginOptions?: any;
315
- required?: boolean;
316
- type?: "component";
317
- repeatable?: boolean;
318
- component?: string;
319
- } | {
320
- __t4s_required?: boolean;
321
- pluginOptions?: any;
322
- required?: boolean;
323
- type?: "dynamiczone";
324
- components?: string[];
325
- } | import("zod").objectOutputType<{
326
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
327
- pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
328
- required: import("zod").ZodOptional<import("zod").ZodBoolean>;
329
- type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
330
- }, import("zod").ZodTypeAny, "passthrough">>;
331
- collectionName?: string;
332
- options?: {
333
- draftAndPublish?: boolean;
334
- };
335
- pluginOptions?: Record<string, any>;
336
- uid?: string;
337
- };
174
+ contentType: import("./types/content-type").StrapiContentType;
338
175
  } & ({
339
176
  namespace: "api" | "plugin";
340
177
  collection: string;
341
178
  } | {
342
179
  namespace: "admin";
343
- collection?: null;
180
+ collection?: null | undefined;
344
181
  })>>;
345
182
  private readComponentSchema;
346
183
  private readContentTypeSchema;