@oak-digital/types-4-strapi-2 0.3.1 → 0.3.2
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/README.md
CHANGED
|
@@ -5,6 +5,10 @@ This can be useful if you have a frontend written with TypeScript to make sure y
|
|
|
5
5
|
|
|
6
6
|
types-4-strapi-2 is a rewrite of [francescolorenzetti/types-4-strapi](https://github.com/francescolorenzetti/types-4-strapi) written in TypeScript, with the goal of being much easier to extend and maintain.
|
|
7
7
|
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
* Node `>=v16`
|
|
11
|
+
|
|
8
12
|
## Getting started
|
|
9
13
|
|
|
10
14
|
Install the script for your project:
|
|
@@ -7,7 +7,7 @@ exports.createMediaFormatInterface = exports.createMediaInterface = void 0;
|
|
|
7
7
|
var BuiltinComponentInterface_1 = __importDefault(require("./BuiltinComponentInterface"));
|
|
8
8
|
var BuiltinInterface_1 = __importDefault(require("./BuiltinInterface"));
|
|
9
9
|
function createMediaInterface(directory, caseTypeName, prefix) {
|
|
10
|
-
var
|
|
10
|
+
var stringRequiredFields = [
|
|
11
11
|
'name',
|
|
12
12
|
'alternativeText',
|
|
13
13
|
'caption',
|
|
@@ -15,14 +15,13 @@ function createMediaInterface(directory, caseTypeName, prefix) {
|
|
|
15
15
|
'ext',
|
|
16
16
|
'mime',
|
|
17
17
|
'url',
|
|
18
|
-
'previewUrl',
|
|
19
18
|
'provider',
|
|
20
19
|
];
|
|
21
|
-
var
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'size',
|
|
20
|
+
var stringFields = [
|
|
21
|
+
'previewUrl',
|
|
22
|
+
'provider_metadata',
|
|
25
23
|
];
|
|
24
|
+
var numberFields = ['width', 'height', 'size'];
|
|
26
25
|
var mediaFormat = {
|
|
27
26
|
type: 'component',
|
|
28
27
|
repeatable: false,
|
|
@@ -41,11 +40,14 @@ function createMediaInterface(directory, caseTypeName, prefix) {
|
|
|
41
40
|
},
|
|
42
41
|
},
|
|
43
42
|
};
|
|
43
|
+
stringRequiredFields.forEach(function (s) {
|
|
44
|
+
mediaAttrs[s] = { type: 'string', required: true };
|
|
45
|
+
});
|
|
44
46
|
stringFields.forEach(function (s) {
|
|
45
47
|
mediaAttrs[s] = { type: 'string' };
|
|
46
48
|
});
|
|
47
49
|
numberFields.forEach(function (s) {
|
|
48
|
-
mediaAttrs[s] = { type: 'integer' };
|
|
50
|
+
mediaAttrs[s] = { type: 'integer', required: true };
|
|
49
51
|
});
|
|
50
52
|
// const dataAttrs = {
|
|
51
53
|
// data: {
|
|
@@ -58,19 +60,8 @@ function createMediaInterface(directory, caseTypeName, prefix) {
|
|
|
58
60
|
}
|
|
59
61
|
exports.createMediaInterface = createMediaInterface;
|
|
60
62
|
function createMediaFormatInterface(directory, caseTypeName, prefix) {
|
|
61
|
-
var stringFields = [
|
|
62
|
-
|
|
63
|
-
'hash',
|
|
64
|
-
'ext',
|
|
65
|
-
'mime',
|
|
66
|
-
'path',
|
|
67
|
-
'url',
|
|
68
|
-
];
|
|
69
|
-
var numberFields = [
|
|
70
|
-
'width',
|
|
71
|
-
'height',
|
|
72
|
-
'size',
|
|
73
|
-
];
|
|
63
|
+
var stringFields = ['name', 'hash', 'ext', 'mime', 'path', 'url'];
|
|
64
|
+
var numberFields = ['width', 'height', 'size'];
|
|
74
65
|
var mediaAttrs = {};
|
|
75
66
|
stringFields.forEach(function (s) {
|
|
76
67
|
mediaAttrs[s] = { type: 'string' };
|
|
File without changes
|
|
File without changes
|