@oak-digital/types-4-strapi-2 1.0.2 → 1.0.4
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/.github/workflows/publish.yml +2 -0
- package/README.md +1 -3
- package/lib/attributes/Attributes.js +4 -2
- 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 +290 -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 +33 -5
- package/lib/readers/by-file.d.ts +32 -4
- package/lib/readers/load-strapi/index.d.ts +33 -4
- package/lib/readers/types/attributes.d.ts +1055 -125
- package/lib/readers/types/attributes.js +28 -14
- package/lib/readers/types/component.d.ts +107 -37
- package/lib/readers/types/content-type-reader.d.ts +1 -1
- package/lib/readers/types/content-type.d.ts +108 -38
- package/lib/utils/casing/index.d.ts +1 -1
- package/lib/writers/basic-writer.d.ts +1 -1
- package/package.json +5 -3
|
@@ -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,8 +204,17 @@ 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";
|
|
212
|
+
} | {
|
|
213
|
+
__t4s_required?: boolean;
|
|
214
|
+
pluginOptions?: any;
|
|
215
|
+
required?: boolean;
|
|
216
|
+
type?: "relation";
|
|
217
|
+
relation?: "morphToOne";
|
|
209
218
|
} | {
|
|
210
219
|
__t4s_required?: boolean;
|
|
211
220
|
pluginOptions?: any;
|
|
@@ -219,7 +228,12 @@ export default class InterfaceManager {
|
|
|
219
228
|
required?: boolean;
|
|
220
229
|
type?: "dynamiczone";
|
|
221
230
|
components?: string[];
|
|
222
|
-
}
|
|
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">>;
|
|
223
237
|
collectionName?: string;
|
|
224
238
|
options?: {
|
|
225
239
|
draftAndPublish?: boolean;
|
|
@@ -240,7 +254,7 @@ export default class InterfaceManager {
|
|
|
240
254
|
__t4s_required?: boolean;
|
|
241
255
|
pluginOptions?: any;
|
|
242
256
|
required?: boolean;
|
|
243
|
-
type?: "
|
|
257
|
+
type?: "string" | "text";
|
|
244
258
|
} | {
|
|
245
259
|
__t4s_required?: boolean;
|
|
246
260
|
pluginOptions?: any;
|
|
@@ -368,8 +382,17 @@ export default class InterfaceManager {
|
|
|
368
382
|
target?: string;
|
|
369
383
|
relation?: "oneToMany";
|
|
370
384
|
} | {
|
|
385
|
+
__t4s_required?: boolean;
|
|
386
|
+
pluginOptions?: any;
|
|
387
|
+
required?: boolean;
|
|
371
388
|
type?: "relation";
|
|
372
389
|
relation?: "morphToMany";
|
|
390
|
+
} | {
|
|
391
|
+
__t4s_required?: boolean;
|
|
392
|
+
pluginOptions?: any;
|
|
393
|
+
required?: boolean;
|
|
394
|
+
type?: "relation";
|
|
395
|
+
relation?: "morphToOne";
|
|
373
396
|
} | {
|
|
374
397
|
__t4s_required?: boolean;
|
|
375
398
|
pluginOptions?: any;
|
|
@@ -377,7 +400,12 @@ export default class InterfaceManager {
|
|
|
377
400
|
type?: "component";
|
|
378
401
|
repeatable?: boolean;
|
|
379
402
|
component?: string;
|
|
380
|
-
}
|
|
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">>;
|
|
381
409
|
options?: {};
|
|
382
410
|
uid?: string;
|
|
383
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,8 +136,17 @@ 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";
|
|
144
|
+
} | {
|
|
145
|
+
__t4s_required?: boolean;
|
|
146
|
+
pluginOptions?: any;
|
|
147
|
+
required?: boolean;
|
|
148
|
+
type?: "relation";
|
|
149
|
+
relation?: "morphToOne";
|
|
141
150
|
} | {
|
|
142
151
|
__t4s_required?: boolean;
|
|
143
152
|
pluginOptions?: any;
|
|
@@ -145,7 +154,12 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
145
154
|
type?: "component";
|
|
146
155
|
repeatable?: boolean;
|
|
147
156
|
component?: string;
|
|
148
|
-
}
|
|
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">>;
|
|
149
163
|
options?: {};
|
|
150
164
|
uid?: string;
|
|
151
165
|
}>>;
|
|
@@ -156,7 +170,7 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
156
170
|
__t4s_required?: boolean;
|
|
157
171
|
pluginOptions?: any;
|
|
158
172
|
required?: boolean;
|
|
159
|
-
type?: "
|
|
173
|
+
type?: "string" | "text";
|
|
160
174
|
} | {
|
|
161
175
|
__t4s_required?: boolean;
|
|
162
176
|
pluginOptions?: any;
|
|
@@ -284,8 +298,17 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
284
298
|
target?: string;
|
|
285
299
|
relation?: "oneToMany";
|
|
286
300
|
} | {
|
|
301
|
+
__t4s_required?: boolean;
|
|
302
|
+
pluginOptions?: any;
|
|
303
|
+
required?: boolean;
|
|
287
304
|
type?: "relation";
|
|
288
305
|
relation?: "morphToMany";
|
|
306
|
+
} | {
|
|
307
|
+
__t4s_required?: boolean;
|
|
308
|
+
pluginOptions?: any;
|
|
309
|
+
required?: boolean;
|
|
310
|
+
type?: "relation";
|
|
311
|
+
relation?: "morphToOne";
|
|
289
312
|
} | {
|
|
290
313
|
__t4s_required?: boolean;
|
|
291
314
|
pluginOptions?: any;
|
|
@@ -299,7 +322,12 @@ export declare class ByFileContentTypeReader implements ContentTypeReader {
|
|
|
299
322
|
required?: boolean;
|
|
300
323
|
type?: "dynamiczone";
|
|
301
324
|
components?: string[];
|
|
302
|
-
}
|
|
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">>;
|
|
303
331
|
collectionName?: string;
|
|
304
332
|
options?: {
|
|
305
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,8 +139,17 @@ 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";
|
|
147
|
+
} | {
|
|
148
|
+
__t4s_required?: boolean;
|
|
149
|
+
pluginOptions?: any;
|
|
150
|
+
required?: boolean;
|
|
151
|
+
type?: "relation";
|
|
152
|
+
relation?: "morphToOne";
|
|
143
153
|
} | {
|
|
144
154
|
__t4s_required?: boolean;
|
|
145
155
|
pluginOptions?: any;
|
|
@@ -153,7 +163,12 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
153
163
|
required?: boolean;
|
|
154
164
|
type?: "dynamiczone";
|
|
155
165
|
components?: string[];
|
|
156
|
-
}
|
|
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">>;
|
|
157
172
|
collectionName?: string;
|
|
158
173
|
options?: {
|
|
159
174
|
draftAndPublish?: boolean;
|
|
@@ -174,7 +189,7 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
174
189
|
__t4s_required?: boolean;
|
|
175
190
|
pluginOptions?: any;
|
|
176
191
|
required?: boolean;
|
|
177
|
-
type?: "
|
|
192
|
+
type?: "string" | "text";
|
|
178
193
|
} | {
|
|
179
194
|
__t4s_required?: boolean;
|
|
180
195
|
pluginOptions?: any;
|
|
@@ -302,8 +317,17 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
302
317
|
target?: string;
|
|
303
318
|
relation?: "oneToMany";
|
|
304
319
|
} | {
|
|
320
|
+
__t4s_required?: boolean;
|
|
321
|
+
pluginOptions?: any;
|
|
322
|
+
required?: boolean;
|
|
305
323
|
type?: "relation";
|
|
306
324
|
relation?: "morphToMany";
|
|
325
|
+
} | {
|
|
326
|
+
__t4s_required?: boolean;
|
|
327
|
+
pluginOptions?: any;
|
|
328
|
+
required?: boolean;
|
|
329
|
+
type?: "relation";
|
|
330
|
+
relation?: "morphToOne";
|
|
307
331
|
} | {
|
|
308
332
|
__t4s_required?: boolean;
|
|
309
333
|
pluginOptions?: any;
|
|
@@ -311,7 +335,12 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
311
335
|
type?: "component";
|
|
312
336
|
repeatable?: boolean;
|
|
313
337
|
component?: string;
|
|
314
|
-
}
|
|
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">>;
|
|
315
344
|
options?: {};
|
|
316
345
|
uid?: string;
|
|
317
346
|
}>>;
|