@oak-digital/types-4-strapi-2 1.0.3 → 1.0.5
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/lib/attributes/Attributes.js +1 -1
- package/lib/events/index.d.ts +2 -2
- package/lib/events/index.js +1 -1
- package/lib/file/File.d.ts +1 -1
- package/lib/interface/builtinInterfaces.d.ts +251 -108
- package/lib/interface/builtinInterfaces.js +1 -1
- package/lib/plugins/PluginManager.d.ts +3 -3
- package/lib/plugins/types.d.ts +2 -2
- package/lib/program/InterfaceManager.d.ts +27 -5
- package/lib/readers/by-file.d.ts +26 -4
- package/lib/readers/load-strapi/index.d.ts +27 -4
- package/lib/readers/types/attributes.d.ts +1018 -125
- package/lib/readers/types/attributes.js +22 -10
- package/lib/readers/types/component.d.ts +92 -37
- package/lib/readers/types/content-type-reader.d.ts +1 -1
- package/lib/readers/types/content-type.d.ts +93 -38
- package/lib/utils/casing/index.d.ts +1 -1
- package/lib/writers/basic-writer.d.ts +1 -1
- package/package.json +2 -2
|
@@ -27,7 +27,7 @@ function createMediaInterface(caseTypeName, prefix) {
|
|
|
27
27
|
const stringFields = [
|
|
28
28
|
'previewUrl',
|
|
29
29
|
'provider_metadata',
|
|
30
|
-
'alternativeText',
|
|
30
|
+
'alternativeText', // nullable in plain text
|
|
31
31
|
'caption', // nullable in plain text
|
|
32
32
|
];
|
|
33
33
|
const numberRequiredFields = ['size'];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Events } from '../events';
|
|
2
2
|
import InterfaceManager from '../program/InterfaceManager';
|
|
3
3
|
import { ContentTypeReader } from '../readers/types/content-type-reader';
|
|
4
|
-
|
|
4
|
+
type Schemas = {
|
|
5
5
|
apiSchemas: Awaited<ReturnType<ContentTypeReader['readContentTypes']>>;
|
|
6
6
|
componentSchemas: Awaited<ReturnType<ContentTypeReader['readComponents']>>;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type HookTypes = {
|
|
9
9
|
[Events.BeforeReadSchema]: (state: InterfaceManager, schema: Schemas) => void;
|
|
10
10
|
[Events.AfterReadSchema]: (state: InterfaceManager, schema: Schemas) => void;
|
|
11
11
|
[Events.BeforeReadSchemas]: (state: InterfaceManager) => void;
|
|
@@ -14,7 +14,7 @@ export declare type HookTypes = {
|
|
|
14
14
|
[Events.BeforeInjectDependencies]: (state: InterfaceManager) => void;
|
|
15
15
|
[Events.AfterInjectDependencies]: (state: InterfaceManager) => void;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type HooksType = {
|
|
18
18
|
[HookType in keyof HookTypes]: {
|
|
19
19
|
fn: HookTypes[HookType];
|
|
20
20
|
priority: number;
|
package/lib/plugins/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HooksType } from './PluginManager';
|
|
2
2
|
export declare const supportedPluginNames: readonly ["url-alias", "i18n"];
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type SupportedPluginNamesType = typeof supportedPluginNames[number];
|
|
4
|
+
export type PluginRegister = () => Partial<HooksType>;
|
|
@@ -3,7 +3,7 @@ import { SupportedPluginNamesType } from '../plugins/types';
|
|
|
3
3
|
import { File } from '../file/File';
|
|
4
4
|
import { ContentTypeReader } from '../readers/types/content-type-reader';
|
|
5
5
|
import { InterfaceWriter } from '../writers/types/writer';
|
|
6
|
-
|
|
6
|
+
type InterfaceManagerOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* @default 'I'
|
|
9
9
|
* @type {string}
|
|
@@ -76,7 +76,7 @@ export default class InterfaceManager {
|
|
|
76
76
|
__t4s_required?: boolean;
|
|
77
77
|
pluginOptions?: any;
|
|
78
78
|
required?: boolean;
|
|
79
|
-
type?: "
|
|
79
|
+
type?: "string" | "text";
|
|
80
80
|
} | {
|
|
81
81
|
__t4s_required?: boolean;
|
|
82
82
|
pluginOptions?: any;
|
|
@@ -204,9 +204,15 @@ export default class InterfaceManager {
|
|
|
204
204
|
target?: string;
|
|
205
205
|
relation?: "oneToMany";
|
|
206
206
|
} | {
|
|
207
|
+
__t4s_required?: boolean;
|
|
208
|
+
pluginOptions?: any;
|
|
209
|
+
required?: boolean;
|
|
207
210
|
type?: "relation";
|
|
208
211
|
relation?: "morphToMany";
|
|
209
212
|
} | {
|
|
213
|
+
__t4s_required?: boolean;
|
|
214
|
+
pluginOptions?: any;
|
|
215
|
+
required?: boolean;
|
|
210
216
|
type?: "relation";
|
|
211
217
|
relation?: "morphToOne";
|
|
212
218
|
} | {
|
|
@@ -222,7 +228,12 @@ export default class InterfaceManager {
|
|
|
222
228
|
required?: boolean;
|
|
223
229
|
type?: "dynamiczone";
|
|
224
230
|
components?: string[];
|
|
225
|
-
}
|
|
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">>;
|
|
226
237
|
collectionName?: string;
|
|
227
238
|
options?: {
|
|
228
239
|
draftAndPublish?: boolean;
|
|
@@ -243,7 +254,7 @@ export default class InterfaceManager {
|
|
|
243
254
|
__t4s_required?: boolean;
|
|
244
255
|
pluginOptions?: any;
|
|
245
256
|
required?: boolean;
|
|
246
|
-
type?: "
|
|
257
|
+
type?: "string" | "text";
|
|
247
258
|
} | {
|
|
248
259
|
__t4s_required?: boolean;
|
|
249
260
|
pluginOptions?: any;
|
|
@@ -371,9 +382,15 @@ export default class InterfaceManager {
|
|
|
371
382
|
target?: string;
|
|
372
383
|
relation?: "oneToMany";
|
|
373
384
|
} | {
|
|
385
|
+
__t4s_required?: boolean;
|
|
386
|
+
pluginOptions?: any;
|
|
387
|
+
required?: boolean;
|
|
374
388
|
type?: "relation";
|
|
375
389
|
relation?: "morphToMany";
|
|
376
390
|
} | {
|
|
391
|
+
__t4s_required?: boolean;
|
|
392
|
+
pluginOptions?: any;
|
|
393
|
+
required?: boolean;
|
|
377
394
|
type?: "relation";
|
|
378
395
|
relation?: "morphToOne";
|
|
379
396
|
} | {
|
|
@@ -383,7 +400,12 @@ export default class InterfaceManager {
|
|
|
383
400
|
type?: "component";
|
|
384
401
|
repeatable?: boolean;
|
|
385
402
|
component?: string;
|
|
386
|
-
}
|
|
403
|
+
} | import("zod").objectOutputType<{
|
|
404
|
+
__t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
405
|
+
pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
|
|
406
|
+
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
407
|
+
type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
|
|
408
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
387
409
|
options?: {};
|
|
388
410
|
uid?: string;
|
|
389
411
|
}>;
|
package/lib/readers/by-file.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
8
8
|
__t4s_required?: boolean;
|
|
9
9
|
pluginOptions?: any;
|
|
10
10
|
required?: boolean;
|
|
11
|
-
type?: "
|
|
11
|
+
type?: "string" | "text";
|
|
12
12
|
} | {
|
|
13
13
|
__t4s_required?: boolean;
|
|
14
14
|
pluginOptions?: any;
|
|
@@ -136,9 +136,15 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
136
136
|
target?: string;
|
|
137
137
|
relation?: "oneToMany";
|
|
138
138
|
} | {
|
|
139
|
+
__t4s_required?: boolean;
|
|
140
|
+
pluginOptions?: any;
|
|
141
|
+
required?: boolean;
|
|
139
142
|
type?: "relation";
|
|
140
143
|
relation?: "morphToMany";
|
|
141
144
|
} | {
|
|
145
|
+
__t4s_required?: boolean;
|
|
146
|
+
pluginOptions?: any;
|
|
147
|
+
required?: boolean;
|
|
142
148
|
type?: "relation";
|
|
143
149
|
relation?: "morphToOne";
|
|
144
150
|
} | {
|
|
@@ -148,7 +154,12 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
148
154
|
type?: "component";
|
|
149
155
|
repeatable?: boolean;
|
|
150
156
|
component?: string;
|
|
151
|
-
}
|
|
157
|
+
} | import("zod").objectOutputType<{
|
|
158
|
+
__t4s_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
159
|
+
pluginOptions: import("zod").ZodOptional<import("zod").ZodAny>;
|
|
160
|
+
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
161
|
+
type: import("zod").ZodEffects<import("zod").ZodType<"any", import("zod").ZodTypeDef, "any">, "any", "any">;
|
|
162
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
152
163
|
options?: {};
|
|
153
164
|
uid?: string;
|
|
154
165
|
}>>;
|
|
@@ -159,7 +170,7 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
159
170
|
__t4s_required?: boolean;
|
|
160
171
|
pluginOptions?: any;
|
|
161
172
|
required?: boolean;
|
|
162
|
-
type?: "
|
|
173
|
+
type?: "string" | "text";
|
|
163
174
|
} | {
|
|
164
175
|
__t4s_required?: boolean;
|
|
165
176
|
pluginOptions?: any;
|
|
@@ -287,9 +298,15 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
287
298
|
target?: string;
|
|
288
299
|
relation?: "oneToMany";
|
|
289
300
|
} | {
|
|
301
|
+
__t4s_required?: boolean;
|
|
302
|
+
pluginOptions?: any;
|
|
303
|
+
required?: boolean;
|
|
290
304
|
type?: "relation";
|
|
291
305
|
relation?: "morphToMany";
|
|
292
306
|
} | {
|
|
307
|
+
__t4s_required?: boolean;
|
|
308
|
+
pluginOptions?: any;
|
|
309
|
+
required?: boolean;
|
|
293
310
|
type?: "relation";
|
|
294
311
|
relation?: "morphToOne";
|
|
295
312
|
} | {
|
|
@@ -305,7 +322,12 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
305
322
|
required?: boolean;
|
|
306
323
|
type?: "dynamiczone";
|
|
307
324
|
components?: string[];
|
|
308
|
-
}
|
|
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">>;
|
|
309
331
|
collectionName?: string;
|
|
310
332
|
options?: {
|
|
311
333
|
draftAndPublish?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { ContentTypeReader } from '../types/content-type-reader';
|
|
2
3
|
export declare class LoadStrapiReader implements ContentTypeReader {
|
|
3
4
|
private strapiRoot;
|
|
@@ -10,7 +11,7 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
10
11
|
__t4s_required?: boolean;
|
|
11
12
|
pluginOptions?: any;
|
|
12
13
|
required?: boolean;
|
|
13
|
-
type?: "
|
|
14
|
+
type?: "string" | "text";
|
|
14
15
|
} | {
|
|
15
16
|
__t4s_required?: boolean;
|
|
16
17
|
pluginOptions?: any;
|
|
@@ -138,9 +139,15 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
138
139
|
target?: string;
|
|
139
140
|
relation?: "oneToMany";
|
|
140
141
|
} | {
|
|
142
|
+
__t4s_required?: boolean;
|
|
143
|
+
pluginOptions?: any;
|
|
144
|
+
required?: boolean;
|
|
141
145
|
type?: "relation";
|
|
142
146
|
relation?: "morphToMany";
|
|
143
147
|
} | {
|
|
148
|
+
__t4s_required?: boolean;
|
|
149
|
+
pluginOptions?: any;
|
|
150
|
+
required?: boolean;
|
|
144
151
|
type?: "relation";
|
|
145
152
|
relation?: "morphToOne";
|
|
146
153
|
} | {
|
|
@@ -156,7 +163,12 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
156
163
|
required?: boolean;
|
|
157
164
|
type?: "dynamiczone";
|
|
158
165
|
components?: string[];
|
|
159
|
-
}
|
|
166
|
+
} | z.objectOutputType<{
|
|
167
|
+
__t4s_required: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
+
pluginOptions: z.ZodOptional<z.ZodAny>;
|
|
169
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
type: z.ZodEffects<z.ZodType<"any", z.ZodTypeDef, "any">, "any", "any">;
|
|
171
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
160
172
|
collectionName?: string;
|
|
161
173
|
options?: {
|
|
162
174
|
draftAndPublish?: boolean;
|
|
@@ -177,7 +189,7 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
177
189
|
__t4s_required?: boolean;
|
|
178
190
|
pluginOptions?: any;
|
|
179
191
|
required?: boolean;
|
|
180
|
-
type?: "
|
|
192
|
+
type?: "string" | "text";
|
|
181
193
|
} | {
|
|
182
194
|
__t4s_required?: boolean;
|
|
183
195
|
pluginOptions?: any;
|
|
@@ -305,9 +317,15 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
305
317
|
target?: string;
|
|
306
318
|
relation?: "oneToMany";
|
|
307
319
|
} | {
|
|
320
|
+
__t4s_required?: boolean;
|
|
321
|
+
pluginOptions?: any;
|
|
322
|
+
required?: boolean;
|
|
308
323
|
type?: "relation";
|
|
309
324
|
relation?: "morphToMany";
|
|
310
325
|
} | {
|
|
326
|
+
__t4s_required?: boolean;
|
|
327
|
+
pluginOptions?: any;
|
|
328
|
+
required?: boolean;
|
|
311
329
|
type?: "relation";
|
|
312
330
|
relation?: "morphToOne";
|
|
313
331
|
} | {
|
|
@@ -317,7 +335,12 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
317
335
|
type?: "component";
|
|
318
336
|
repeatable?: boolean;
|
|
319
337
|
component?: string;
|
|
320
|
-
}
|
|
338
|
+
} | z.objectOutputType<{
|
|
339
|
+
__t4s_required: z.ZodOptional<z.ZodBoolean>;
|
|
340
|
+
pluginOptions: z.ZodOptional<z.ZodAny>;
|
|
341
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
342
|
+
type: z.ZodEffects<z.ZodType<"any", z.ZodTypeDef, "any">, "any", "any">;
|
|
343
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
321
344
|
options?: {};
|
|
322
345
|
uid?: string;
|
|
323
346
|
}>>;
|