@oak-digital/types-4-strapi-2 1.0.6 → 1.0.8

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,189 +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?: "blocks";
101
- } | {
102
- __t4s_required?: boolean;
103
- pluginOptions?: any;
104
- required?: boolean;
105
- type?: "json";
106
- } | {
107
- __t4s_required?: boolean;
108
- pluginOptions?: any;
109
- required?: boolean;
110
- type?: "password";
111
- } | {
112
- __t4s_required?: boolean;
113
- pluginOptions?: any;
114
- required?: boolean;
115
- type?: "integer";
116
- } | {
117
- __t4s_required?: boolean;
118
- pluginOptions?: any;
119
- required?: boolean;
120
- type?: "float";
121
- } | {
122
- __t4s_required?: boolean;
123
- pluginOptions?: any;
124
- required?: boolean;
125
- type?: "biginteger";
126
- } | {
127
- __t4s_required?: boolean;
128
- pluginOptions?: any;
129
- required?: boolean;
130
- type?: "decimal";
131
- } | {
132
- __t4s_required?: boolean;
133
- pluginOptions?: any;
134
- required?: boolean;
135
- type?: "enumeration";
136
- enum?: string[];
137
- } | {
138
- __t4s_required?: boolean;
139
- pluginOptions?: any;
140
- required?: boolean;
141
- type?: "date";
142
- } | {
143
- __t4s_required?: boolean;
144
- pluginOptions?: any;
145
- required?: boolean;
146
- type?: "datetime";
147
- } | {
148
- __t4s_required?: boolean;
149
- pluginOptions?: any;
150
- required?: boolean;
151
- type?: "time";
152
- } | {
153
- __t4s_required?: boolean;
154
- pluginOptions?: any;
155
- required?: boolean;
156
- type?: "media";
157
- multiple?: boolean;
158
- allowedTypes?: ("images" | "videos" | "audios" | "files")[];
159
- } | {
160
- __t4s_required?: boolean;
161
- pluginOptions?: any;
162
- required?: boolean;
163
- type?: "boolean";
164
- } | {
165
- __t4s_required?: boolean;
166
- pluginOptions?: any;
167
- required?: boolean;
168
- type?: "relation";
169
- target?: string;
170
- relation?: "oneToOne";
171
- } | {
172
- __t4s_required?: boolean;
173
- pluginOptions?: any;
174
- required?: boolean;
175
- type?: "relation";
176
- target?: string;
177
- relation?: "oneToOne";
178
- inversedBy?: string;
179
- } | {
180
- __t4s_required?: boolean;
181
- pluginOptions?: any;
182
- required?: boolean;
183
- type?: "relation";
184
- target?: string;
185
- mappedBy?: string;
186
- relation?: "oneToMany";
187
- } | {
188
- __t4s_required?: boolean;
189
- pluginOptions?: any;
190
- required?: boolean;
191
- type?: "relation";
192
- target?: string;
193
- relation?: "manyToOne";
194
- inversedBy?: string;
195
- } | {
196
- __t4s_required?: boolean;
197
- pluginOptions?: any;
198
- required?: boolean;
199
- type?: "relation";
200
- target?: string;
201
- relation?: "manyToMany";
202
- inversedBy?: string;
203
- mappedBy?: string;
204
- } | {
205
- __t4s_required?: boolean;
206
- pluginOptions?: any;
207
- required?: boolean;
208
- type?: "relation";
209
- target?: string;
210
- relation?: "oneToMany";
211
- } | {
212
- __t4s_required?: boolean;
213
- pluginOptions?: any;
214
- required?: boolean;
215
- type?: "relation";
216
- relation?: "morphToMany";
217
- } | {
218
- __t4s_required?: boolean;
219
- pluginOptions?: any;
220
- required?: boolean;
221
- type?: "relation";
222
- relation?: "morphToOne";
223
- } | {
224
- __t4s_required?: boolean;
225
- pluginOptions?: any;
226
- required?: boolean;
227
- type?: "component";
228
- repeatable?: boolean;
229
- component?: string;
230
- } | {
231
- __t4s_required?: boolean;
232
- pluginOptions?: any;
233
- required?: boolean;
234
- type?: "dynamiczone";
235
- components?: string[];
236
- } | import("zod").objectOutputType<{
237
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
238
- pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
239
- required: import("zod").ZodOptional<import("zod").ZodBoolean>;
240
- type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
241
- }, import("zod").ZodTypeAny, "passthrough">>;
242
- collectionName?: string;
243
- options?: {
244
- draftAndPublish?: boolean;
245
- };
246
- pluginOptions?: Record<string, any>;
247
- uid?: string;
248
- };
74
+ contentType: import("../readers/types/content-type").StrapiContentType;
249
75
  } & ({
250
76
  namespace: "api" | "plugin";
251
77
  collection: string;
252
78
  } | {
253
79
  namespace: "admin";
254
- collection?: null;
80
+ collection?: null | undefined;
255
81
  })>;
256
82
  componentSchemas: Record<`${string}.${string}`, {
83
+ options?: {};
84
+ uid?: string;
257
85
  collectionName?: string;
258
86
  attributes?: Record<string, {
259
87
  __t4s_required?: boolean;
@@ -349,39 +177,39 @@ export default class InterfaceManager {
349
177
  pluginOptions?: any;
350
178
  required?: boolean;
351
179
  type?: "relation";
352
- target?: string;
353
180
  relation?: "oneToOne";
181
+ target?: string;
354
182
  } | {
355
183
  __t4s_required?: boolean;
356
184
  pluginOptions?: any;
357
185
  required?: boolean;
358
186
  type?: "relation";
359
- target?: string;
360
187
  relation?: "oneToOne";
188
+ target?: string;
361
189
  inversedBy?: string;
362
190
  } | {
363
191
  __t4s_required?: boolean;
364
192
  pluginOptions?: any;
365
193
  required?: boolean;
366
194
  type?: "relation";
195
+ relation?: "oneToMany";
367
196
  target?: string;
368
197
  mappedBy?: string;
369
- relation?: "oneToMany";
370
198
  } | {
371
199
  __t4s_required?: boolean;
372
200
  pluginOptions?: any;
373
201
  required?: boolean;
374
202
  type?: "relation";
375
- target?: string;
376
203
  relation?: "manyToOne";
204
+ target?: string;
377
205
  inversedBy?: string;
378
206
  } | {
379
207
  __t4s_required?: boolean;
380
208
  pluginOptions?: any;
381
209
  required?: boolean;
382
210
  type?: "relation";
383
- target?: string;
384
211
  relation?: "manyToMany";
212
+ target?: string;
385
213
  inversedBy?: string;
386
214
  mappedBy?: string;
387
215
  } | {
@@ -389,8 +217,8 @@ export default class InterfaceManager {
389
217
  pluginOptions?: any;
390
218
  required?: boolean;
391
219
  type?: "relation";
392
- target?: string;
393
220
  relation?: "oneToMany";
221
+ target?: string;
394
222
  } | {
395
223
  __t4s_required?: boolean;
396
224
  pluginOptions?: any;
@@ -408,16 +236,15 @@ export default class InterfaceManager {
408
236
  pluginOptions?: any;
409
237
  required?: boolean;
410
238
  type?: "component";
411
- repeatable?: boolean;
412
239
  component?: string;
240
+ repeatable?: boolean;
413
241
  } | import("zod").objectOutputType<{
414
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
415
242
  pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
416
243
  required: import("zod").ZodOptional<import("zod").ZodBoolean>;
244
+ __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
245
+ } & {
417
246
  type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
418
247
  }, import("zod").ZodTypeAny, "passthrough">>;
419
- options?: {};
420
- uid?: string;
421
248
  }>;
422
249
  }>;
423
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;
@@ -98,39 +100,39 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
98
100
  pluginOptions?: any;
99
101
  required?: boolean;
100
102
  type?: "relation";
101
- target?: string;
102
103
  relation?: "oneToOne";
104
+ target?: string;
103
105
  } | {
104
106
  __t4s_required?: boolean;
105
107
  pluginOptions?: any;
106
108
  required?: boolean;
107
109
  type?: "relation";
108
- target?: string;
109
110
  relation?: "oneToOne";
111
+ target?: string;
110
112
  inversedBy?: string;
111
113
  } | {
112
114
  __t4s_required?: boolean;
113
115
  pluginOptions?: any;
114
116
  required?: boolean;
115
117
  type?: "relation";
118
+ relation?: "oneToMany";
116
119
  target?: string;
117
120
  mappedBy?: string;
118
- relation?: "oneToMany";
119
121
  } | {
120
122
  __t4s_required?: boolean;
121
123
  pluginOptions?: any;
122
124
  required?: boolean;
123
125
  type?: "relation";
124
- target?: string;
125
126
  relation?: "manyToOne";
127
+ target?: string;
126
128
  inversedBy?: string;
127
129
  } | {
128
130
  __t4s_required?: boolean;
129
131
  pluginOptions?: any;
130
132
  required?: boolean;
131
133
  type?: "relation";
132
- target?: string;
133
134
  relation?: "manyToMany";
135
+ target?: string;
134
136
  inversedBy?: string;
135
137
  mappedBy?: string;
136
138
  } | {
@@ -138,8 +140,8 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
138
140
  pluginOptions?: any;
139
141
  required?: boolean;
140
142
  type?: "relation";
141
- target?: string;
142
143
  relation?: "oneToMany";
144
+ target?: string;
143
145
  } | {
144
146
  __t4s_required?: boolean;
145
147
  pluginOptions?: any;
@@ -157,200 +159,25 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
157
159
  pluginOptions?: any;
158
160
  required?: boolean;
159
161
  type?: "component";
160
- repeatable?: boolean;
161
162
  component?: string;
163
+ repeatable?: boolean;
162
164
  } | import("zod").objectOutputType<{
163
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
164
165
  pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
165
166
  required: import("zod").ZodOptional<import("zod").ZodBoolean>;
167
+ __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
168
+ } & {
166
169
  type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
167
170
  }, import("zod").ZodTypeAny, "passthrough">>;
168
- options?: {};
169
- uid?: string;
170
171
  }>>;
171
172
  readContentTypes(): Promise<Record<`api::${string}` | `plugin::${string}` | `admin::${string}` | `builtins::${string}`, {
172
173
  name: string;
173
- contentType: {
174
- attributes?: Record<string, {
175
- __t4s_required?: boolean;
176
- pluginOptions?: any;
177
- required?: boolean;
178
- type?: "string" | "text";
179
- } | {
180
- __t4s_required?: boolean;
181
- pluginOptions?: any;
182
- required?: boolean;
183
- type?: "email";
184
- } | {
185
- __t4s_required?: boolean;
186
- pluginOptions?: any;
187
- required?: boolean;
188
- type?: "uid";
189
- targetField?: string;
190
- } | {
191
- __t4s_required?: boolean;
192
- pluginOptions?: any;
193
- required?: boolean;
194
- type?: "richtext";
195
- } | {
196
- __t4s_required?: boolean;
197
- pluginOptions?: any;
198
- required?: boolean;
199
- type?: "blocks";
200
- } | {
201
- __t4s_required?: boolean;
202
- pluginOptions?: any;
203
- required?: boolean;
204
- type?: "json";
205
- } | {
206
- __t4s_required?: boolean;
207
- pluginOptions?: any;
208
- required?: boolean;
209
- type?: "password";
210
- } | {
211
- __t4s_required?: boolean;
212
- pluginOptions?: any;
213
- required?: boolean;
214
- type?: "integer";
215
- } | {
216
- __t4s_required?: boolean;
217
- pluginOptions?: any;
218
- required?: boolean;
219
- type?: "float";
220
- } | {
221
- __t4s_required?: boolean;
222
- pluginOptions?: any;
223
- required?: boolean;
224
- type?: "biginteger";
225
- } | {
226
- __t4s_required?: boolean;
227
- pluginOptions?: any;
228
- required?: boolean;
229
- type?: "decimal";
230
- } | {
231
- __t4s_required?: boolean;
232
- pluginOptions?: any;
233
- required?: boolean;
234
- type?: "enumeration";
235
- enum?: string[];
236
- } | {
237
- __t4s_required?: boolean;
238
- pluginOptions?: any;
239
- required?: boolean;
240
- type?: "date";
241
- } | {
242
- __t4s_required?: boolean;
243
- pluginOptions?: any;
244
- required?: boolean;
245
- type?: "datetime";
246
- } | {
247
- __t4s_required?: boolean;
248
- pluginOptions?: any;
249
- required?: boolean;
250
- type?: "time";
251
- } | {
252
- __t4s_required?: boolean;
253
- pluginOptions?: any;
254
- required?: boolean;
255
- type?: "media";
256
- multiple?: boolean;
257
- allowedTypes?: ("images" | "videos" | "audios" | "files")[];
258
- } | {
259
- __t4s_required?: boolean;
260
- pluginOptions?: any;
261
- required?: boolean;
262
- type?: "boolean";
263
- } | {
264
- __t4s_required?: boolean;
265
- pluginOptions?: any;
266
- required?: boolean;
267
- type?: "relation";
268
- target?: string;
269
- relation?: "oneToOne";
270
- } | {
271
- __t4s_required?: boolean;
272
- pluginOptions?: any;
273
- required?: boolean;
274
- type?: "relation";
275
- target?: string;
276
- relation?: "oneToOne";
277
- inversedBy?: string;
278
- } | {
279
- __t4s_required?: boolean;
280
- pluginOptions?: any;
281
- required?: boolean;
282
- type?: "relation";
283
- target?: string;
284
- mappedBy?: string;
285
- relation?: "oneToMany";
286
- } | {
287
- __t4s_required?: boolean;
288
- pluginOptions?: any;
289
- required?: boolean;
290
- type?: "relation";
291
- target?: string;
292
- relation?: "manyToOne";
293
- inversedBy?: string;
294
- } | {
295
- __t4s_required?: boolean;
296
- pluginOptions?: any;
297
- required?: boolean;
298
- type?: "relation";
299
- target?: string;
300
- relation?: "manyToMany";
301
- inversedBy?: string;
302
- mappedBy?: string;
303
- } | {
304
- __t4s_required?: boolean;
305
- pluginOptions?: any;
306
- required?: boolean;
307
- type?: "relation";
308
- target?: string;
309
- relation?: "oneToMany";
310
- } | {
311
- __t4s_required?: boolean;
312
- pluginOptions?: any;
313
- required?: boolean;
314
- type?: "relation";
315
- relation?: "morphToMany";
316
- } | {
317
- __t4s_required?: boolean;
318
- pluginOptions?: any;
319
- required?: boolean;
320
- type?: "relation";
321
- relation?: "morphToOne";
322
- } | {
323
- __t4s_required?: boolean;
324
- pluginOptions?: any;
325
- required?: boolean;
326
- type?: "component";
327
- repeatable?: boolean;
328
- component?: string;
329
- } | {
330
- __t4s_required?: boolean;
331
- pluginOptions?: any;
332
- required?: boolean;
333
- type?: "dynamiczone";
334
- components?: string[];
335
- } | import("zod").objectOutputType<{
336
- __t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
337
- pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
338
- required: import("zod").ZodOptional<import("zod").ZodBoolean>;
339
- type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
340
- }, import("zod").ZodTypeAny, "passthrough">>;
341
- collectionName?: string;
342
- options?: {
343
- draftAndPublish?: boolean;
344
- };
345
- pluginOptions?: Record<string, any>;
346
- uid?: string;
347
- };
174
+ contentType: import("./types/content-type").StrapiContentType;
348
175
  } & ({
349
176
  namespace: "api" | "plugin";
350
177
  collection: string;
351
178
  } | {
352
179
  namespace: "admin";
353
- collection?: null;
180
+ collection?: null | undefined;
354
181
  })>>;
355
182
  private readComponentSchema;
356
183
  private readContentTypeSchema;