@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.
- package/lib/attributes/Attributes.js +3 -0
- package/lib/content-types/reader.js +5 -6
- package/lib/interface/builtinInterfaces.d.ts +389 -212
- package/lib/interface/builtinInterfaces.js +3 -3
- package/lib/program/InterfaceManager.d.ts +18 -181
- package/lib/readers/by-file.d.ts +18 -181
- package/lib/readers/load-strapi/index.d.ts +19 -181
- package/lib/utils/casing/index.js +3 -3
- package/lib/utils/index.js +2 -3
- package/package.json +50 -49
- package/lib/readers/types/attributes.d.ts +0 -2569
- package/lib/readers/types/attributes.js +0 -158
- package/lib/readers/types/component.d.ts +0 -793
- package/lib/readers/types/component.js +0 -11
- package/lib/readers/types/content-type-reader.d.ts +0 -16
- package/lib/readers/types/content-type-reader.js +0 -2
- package/lib/readers/types/content-type.d.ts +0 -836
- package/lib/readers/types/content-type.js +0 -16
- package/lib/writers/types/writer.d.ts +0 -4
- package/lib/writers/types/writer.js +0 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { StrapiContentType } from '../types/content-type';
|
|
2
3
|
import { ContentTypeReader } from '../types/content-type-reader';
|
|
3
4
|
export declare class LoadStrapiReader implements ContentTypeReader {
|
|
4
5
|
private strapiRoot;
|
|
@@ -6,184 +7,17 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
6
7
|
constructor(strapiRoot: string);
|
|
7
8
|
readContentTypes(): Promise<Record<`api::${string}` | `plugin::${string}` | `admin::${string}` | `builtins::${string}`, {
|
|
8
9
|
name: string;
|
|
9
|
-
contentType:
|
|
10
|
-
attributes?: Record<string, {
|
|
11
|
-
__t4s_required?: boolean;
|
|
12
|
-
pluginOptions?: any;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
type?: "string" | "text";
|
|
15
|
-
} | {
|
|
16
|
-
__t4s_required?: boolean;
|
|
17
|
-
pluginOptions?: any;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
type?: "email";
|
|
20
|
-
} | {
|
|
21
|
-
__t4s_required?: boolean;
|
|
22
|
-
pluginOptions?: any;
|
|
23
|
-
required?: boolean;
|
|
24
|
-
type?: "uid";
|
|
25
|
-
targetField?: string;
|
|
26
|
-
} | {
|
|
27
|
-
__t4s_required?: boolean;
|
|
28
|
-
pluginOptions?: any;
|
|
29
|
-
required?: boolean;
|
|
30
|
-
type?: "richtext";
|
|
31
|
-
} | {
|
|
32
|
-
__t4s_required?: boolean;
|
|
33
|
-
pluginOptions?: any;
|
|
34
|
-
required?: boolean;
|
|
35
|
-
type?: "json";
|
|
36
|
-
} | {
|
|
37
|
-
__t4s_required?: boolean;
|
|
38
|
-
pluginOptions?: any;
|
|
39
|
-
required?: boolean;
|
|
40
|
-
type?: "password";
|
|
41
|
-
} | {
|
|
42
|
-
__t4s_required?: boolean;
|
|
43
|
-
pluginOptions?: any;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
type?: "integer";
|
|
46
|
-
} | {
|
|
47
|
-
__t4s_required?: boolean;
|
|
48
|
-
pluginOptions?: any;
|
|
49
|
-
required?: boolean;
|
|
50
|
-
type?: "float";
|
|
51
|
-
} | {
|
|
52
|
-
__t4s_required?: boolean;
|
|
53
|
-
pluginOptions?: any;
|
|
54
|
-
required?: boolean;
|
|
55
|
-
type?: "biginteger";
|
|
56
|
-
} | {
|
|
57
|
-
__t4s_required?: boolean;
|
|
58
|
-
pluginOptions?: any;
|
|
59
|
-
required?: boolean;
|
|
60
|
-
type?: "decimal";
|
|
61
|
-
} | {
|
|
62
|
-
__t4s_required?: boolean;
|
|
63
|
-
pluginOptions?: any;
|
|
64
|
-
required?: boolean;
|
|
65
|
-
type?: "enumeration";
|
|
66
|
-
enum?: string[];
|
|
67
|
-
} | {
|
|
68
|
-
__t4s_required?: boolean;
|
|
69
|
-
pluginOptions?: any;
|
|
70
|
-
required?: boolean;
|
|
71
|
-
type?: "date";
|
|
72
|
-
} | {
|
|
73
|
-
__t4s_required?: boolean;
|
|
74
|
-
pluginOptions?: any;
|
|
75
|
-
required?: boolean;
|
|
76
|
-
type?: "datetime";
|
|
77
|
-
} | {
|
|
78
|
-
__t4s_required?: boolean;
|
|
79
|
-
pluginOptions?: any;
|
|
80
|
-
required?: boolean;
|
|
81
|
-
type?: "time";
|
|
82
|
-
} | {
|
|
83
|
-
__t4s_required?: boolean;
|
|
84
|
-
pluginOptions?: any;
|
|
85
|
-
required?: boolean;
|
|
86
|
-
type?: "media";
|
|
87
|
-
multiple?: boolean;
|
|
88
|
-
allowedTypes?: ("images" | "videos" | "audios" | "files")[];
|
|
89
|
-
} | {
|
|
90
|
-
__t4s_required?: boolean;
|
|
91
|
-
pluginOptions?: any;
|
|
92
|
-
required?: boolean;
|
|
93
|
-
type?: "boolean";
|
|
94
|
-
} | {
|
|
95
|
-
__t4s_required?: boolean;
|
|
96
|
-
pluginOptions?: any;
|
|
97
|
-
required?: boolean;
|
|
98
|
-
type?: "relation";
|
|
99
|
-
target?: string;
|
|
100
|
-
relation?: "oneToOne";
|
|
101
|
-
} | {
|
|
102
|
-
__t4s_required?: boolean;
|
|
103
|
-
pluginOptions?: any;
|
|
104
|
-
required?: boolean;
|
|
105
|
-
type?: "relation";
|
|
106
|
-
target?: string;
|
|
107
|
-
relation?: "oneToOne";
|
|
108
|
-
inversedBy?: string;
|
|
109
|
-
} | {
|
|
110
|
-
__t4s_required?: boolean;
|
|
111
|
-
pluginOptions?: any;
|
|
112
|
-
required?: boolean;
|
|
113
|
-
type?: "relation";
|
|
114
|
-
target?: string;
|
|
115
|
-
mappedBy?: string;
|
|
116
|
-
relation?: "oneToMany";
|
|
117
|
-
} | {
|
|
118
|
-
__t4s_required?: boolean;
|
|
119
|
-
pluginOptions?: any;
|
|
120
|
-
required?: boolean;
|
|
121
|
-
type?: "relation";
|
|
122
|
-
target?: string;
|
|
123
|
-
relation?: "manyToOne";
|
|
124
|
-
inversedBy?: string;
|
|
125
|
-
} | {
|
|
126
|
-
__t4s_required?: boolean;
|
|
127
|
-
pluginOptions?: any;
|
|
128
|
-
required?: boolean;
|
|
129
|
-
type?: "relation";
|
|
130
|
-
target?: string;
|
|
131
|
-
relation?: "manyToMany";
|
|
132
|
-
inversedBy?: string;
|
|
133
|
-
mappedBy?: string;
|
|
134
|
-
} | {
|
|
135
|
-
__t4s_required?: boolean;
|
|
136
|
-
pluginOptions?: any;
|
|
137
|
-
required?: boolean;
|
|
138
|
-
type?: "relation";
|
|
139
|
-
target?: string;
|
|
140
|
-
relation?: "oneToMany";
|
|
141
|
-
} | {
|
|
142
|
-
__t4s_required?: boolean;
|
|
143
|
-
pluginOptions?: any;
|
|
144
|
-
required?: boolean;
|
|
145
|
-
type?: "relation";
|
|
146
|
-
relation?: "morphToMany";
|
|
147
|
-
} | {
|
|
148
|
-
__t4s_required?: boolean;
|
|
149
|
-
pluginOptions?: any;
|
|
150
|
-
required?: boolean;
|
|
151
|
-
type?: "relation";
|
|
152
|
-
relation?: "morphToOne";
|
|
153
|
-
} | {
|
|
154
|
-
__t4s_required?: boolean;
|
|
155
|
-
pluginOptions?: any;
|
|
156
|
-
required?: boolean;
|
|
157
|
-
type?: "component";
|
|
158
|
-
repeatable?: boolean;
|
|
159
|
-
component?: string;
|
|
160
|
-
} | {
|
|
161
|
-
__t4s_required?: boolean;
|
|
162
|
-
pluginOptions?: any;
|
|
163
|
-
required?: boolean;
|
|
164
|
-
type?: "dynamiczone";
|
|
165
|
-
components?: string[];
|
|
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">>;
|
|
172
|
-
collectionName?: string;
|
|
173
|
-
options?: {
|
|
174
|
-
draftAndPublish?: boolean;
|
|
175
|
-
};
|
|
176
|
-
pluginOptions?: Record<string, any>;
|
|
177
|
-
uid?: string;
|
|
178
|
-
};
|
|
10
|
+
contentType: StrapiContentType;
|
|
179
11
|
} & ({
|
|
180
12
|
namespace: "api" | "plugin";
|
|
181
13
|
collection: string;
|
|
182
14
|
} | {
|
|
183
15
|
namespace: "admin";
|
|
184
|
-
collection?: null;
|
|
16
|
+
collection?: null | undefined;
|
|
185
17
|
})>>;
|
|
186
18
|
readComponents(): Promise<Record<string, {
|
|
19
|
+
options?: {};
|
|
20
|
+
uid?: string;
|
|
187
21
|
collectionName?: string;
|
|
188
22
|
attributes?: Record<string, {
|
|
189
23
|
__t4s_required?: boolean;
|
|
@@ -206,6 +40,11 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
206
40
|
pluginOptions?: any;
|
|
207
41
|
required?: boolean;
|
|
208
42
|
type?: "richtext";
|
|
43
|
+
} | {
|
|
44
|
+
__t4s_required?: boolean;
|
|
45
|
+
pluginOptions?: any;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
type?: "blocks";
|
|
209
48
|
} | {
|
|
210
49
|
__t4s_required?: boolean;
|
|
211
50
|
pluginOptions?: any;
|
|
@@ -274,39 +113,39 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
274
113
|
pluginOptions?: any;
|
|
275
114
|
required?: boolean;
|
|
276
115
|
type?: "relation";
|
|
277
|
-
target?: string;
|
|
278
116
|
relation?: "oneToOne";
|
|
117
|
+
target?: string;
|
|
279
118
|
} | {
|
|
280
119
|
__t4s_required?: boolean;
|
|
281
120
|
pluginOptions?: any;
|
|
282
121
|
required?: boolean;
|
|
283
122
|
type?: "relation";
|
|
284
|
-
target?: string;
|
|
285
123
|
relation?: "oneToOne";
|
|
124
|
+
target?: string;
|
|
286
125
|
inversedBy?: string;
|
|
287
126
|
} | {
|
|
288
127
|
__t4s_required?: boolean;
|
|
289
128
|
pluginOptions?: any;
|
|
290
129
|
required?: boolean;
|
|
291
130
|
type?: "relation";
|
|
131
|
+
relation?: "oneToMany";
|
|
292
132
|
target?: string;
|
|
293
133
|
mappedBy?: string;
|
|
294
|
-
relation?: "oneToMany";
|
|
295
134
|
} | {
|
|
296
135
|
__t4s_required?: boolean;
|
|
297
136
|
pluginOptions?: any;
|
|
298
137
|
required?: boolean;
|
|
299
138
|
type?: "relation";
|
|
300
|
-
target?: string;
|
|
301
139
|
relation?: "manyToOne";
|
|
140
|
+
target?: string;
|
|
302
141
|
inversedBy?: string;
|
|
303
142
|
} | {
|
|
304
143
|
__t4s_required?: boolean;
|
|
305
144
|
pluginOptions?: any;
|
|
306
145
|
required?: boolean;
|
|
307
146
|
type?: "relation";
|
|
308
|
-
target?: string;
|
|
309
147
|
relation?: "manyToMany";
|
|
148
|
+
target?: string;
|
|
310
149
|
inversedBy?: string;
|
|
311
150
|
mappedBy?: string;
|
|
312
151
|
} | {
|
|
@@ -314,8 +153,8 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
314
153
|
pluginOptions?: any;
|
|
315
154
|
required?: boolean;
|
|
316
155
|
type?: "relation";
|
|
317
|
-
target?: string;
|
|
318
156
|
relation?: "oneToMany";
|
|
157
|
+
target?: string;
|
|
319
158
|
} | {
|
|
320
159
|
__t4s_required?: boolean;
|
|
321
160
|
pluginOptions?: any;
|
|
@@ -333,16 +172,15 @@ export declare class LoadStrapiReader implements ContentTypeReader {
|
|
|
333
172
|
pluginOptions?: any;
|
|
334
173
|
required?: boolean;
|
|
335
174
|
type?: "component";
|
|
336
|
-
repeatable?: boolean;
|
|
337
175
|
component?: string;
|
|
176
|
+
repeatable?: boolean;
|
|
338
177
|
} | z.objectOutputType<{
|
|
339
|
-
__t4s_required: z.ZodOptional<z.ZodBoolean>;
|
|
340
178
|
pluginOptions: z.ZodOptional<z.ZodAny>;
|
|
341
179
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
__t4s_required: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
} & {
|
|
342
182
|
type: z.ZodEffects<z.ZodType<"any", z.ZodTypeDef, "any">, "any", "any">;
|
|
343
183
|
}, z.ZodTypeAny, "passthrough">>;
|
|
344
|
-
options?: {};
|
|
345
|
-
uid?: string;
|
|
346
184
|
}>>;
|
|
347
185
|
private loadStrapi;
|
|
348
186
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.caseTypesArray = void 0;
|
|
4
|
+
exports.checkCaseType = checkCaseType;
|
|
5
|
+
exports.changeCase = changeCase;
|
|
4
6
|
const change_case_1 = require("change-case");
|
|
5
7
|
exports.caseTypesArray = [
|
|
6
8
|
'camel',
|
|
@@ -14,7 +16,6 @@ exports.caseTypesArray = [
|
|
|
14
16
|
function checkCaseType(caseName) {
|
|
15
17
|
return exports.caseTypesArray.includes(caseName);
|
|
16
18
|
}
|
|
17
|
-
exports.checkCaseType = checkCaseType;
|
|
18
19
|
function changeCase(text, caseName) {
|
|
19
20
|
let name = text;
|
|
20
21
|
switch (caseName) {
|
|
@@ -44,4 +45,3 @@ function changeCase(text, caseName) {
|
|
|
44
45
|
}
|
|
45
46
|
return name;
|
|
46
47
|
}
|
|
47
|
-
exports.changeCase = changeCase;
|
package/lib/utils/index.js
CHANGED
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.readDirFiltered = readDirFiltered;
|
|
13
|
+
exports.prefixDotSlash = prefixDotSlash;
|
|
13
14
|
const promises_1 = require("fs/promises");
|
|
14
15
|
function readDirFiltered(dir) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17,8 +18,6 @@ function readDirFiltered(dir) {
|
|
|
17
18
|
return folders.filter((folder) => !folder.startsWith('.'));
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
exports.readDirFiltered = readDirFiltered;
|
|
21
21
|
function prefixDotSlash(path) {
|
|
22
22
|
return /^\.?\.\//.test(path) ? path : './' + path;
|
|
23
23
|
}
|
|
24
|
-
exports.prefixDotSlash = prefixDotSlash;
|
package/package.json
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
2
|
+
"name": "@oak-digital/types-4-strapi-2",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Typescript interface generator for Strapi 4 models",
|
|
5
|
+
"bin": {
|
|
6
|
+
"t4s": "./bin/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rimraf lib && tsc -p .",
|
|
10
|
+
"test": "node -r ts-node/register ./tests/dynamiczone-regression.ts",
|
|
11
|
+
"testtypes": "node ./bin/index.js",
|
|
12
|
+
"lint": "eslint src/",
|
|
13
|
+
"prettier": "prettier --write \"src/**/*.ts\"",
|
|
14
|
+
"t4s": "node ./bin/index.js",
|
|
15
|
+
"testdev": "ts-node ./src/index.ts",
|
|
16
|
+
"release": "bumpp"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Oak-Digital/types-4-strapi-2.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"strapi",
|
|
24
|
+
"typescript",
|
|
25
|
+
"types",
|
|
26
|
+
"generator"
|
|
27
|
+
],
|
|
28
|
+
"author": "Oak digital",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/Oak-Digital/types-4-strapi-2/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/Oak-Digital/types-4-strapi-2",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^18.7.2",
|
|
36
|
+
"@types/prettier": "^2.7.0",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
|
38
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
39
|
+
"bumpp": "^9.3.0",
|
|
40
|
+
"eslint": "^8.22.0",
|
|
41
|
+
"rimraf": "^4.4.1",
|
|
42
|
+
"ts-node": "^10.9.1",
|
|
43
|
+
"typescript": "^5.4.5"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"change-case": "^4.1.2",
|
|
47
|
+
"commander": "^9.4.0",
|
|
48
|
+
"prettier": "^2.7.1",
|
|
49
|
+
"zod": "^3.21.4"
|
|
50
|
+
}
|
|
51
|
+
}
|