@strapi/strapi 4.2.1-alpha.0 → 4.3.0-beta.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/bin/strapi.js +19 -1
- package/lib/Strapi.js +37 -8
- package/lib/commands/admin-create.js +2 -1
- package/lib/commands/admin-reset.js +2 -1
- package/lib/commands/build.js +8 -46
- package/lib/commands/builders/admin.js +56 -0
- package/lib/commands/builders/index.js +9 -0
- package/lib/commands/builders/typescript.js +32 -0
- package/lib/commands/configurationDump.js +2 -1
- package/lib/commands/configurationRestore.js +3 -1
- package/lib/commands/console.js +4 -3
- package/lib/commands/content-types/generate-types.js +20 -0
- package/lib/commands/content-types/list.js +2 -1
- package/lib/commands/controllers/list.js +2 -1
- package/lib/commands/develop.js +111 -74
- package/lib/commands/hooks/list.js +2 -1
- package/lib/commands/middlewares/list.js +2 -1
- package/lib/commands/opt-in-telemetry.js +100 -0
- package/lib/commands/policies/list.js +2 -1
- package/lib/commands/routes/list.js +2 -1
- package/lib/commands/services/list.js +2 -1
- package/lib/commands/start.js +18 -2
- package/lib/commands/watchAdmin.js +5 -10
- package/lib/compile.js +20 -0
- package/lib/core/app-configuration/config-loader.js +3 -1
- package/lib/core/app-configuration/index.js +4 -3
- package/lib/core/app-configuration/load-config-file.js +3 -1
- package/lib/core/bootstrap.js +2 -2
- package/lib/core/loaders/apis.js +6 -5
- package/lib/core/loaders/components.js +5 -4
- package/lib/core/loaders/middlewares.js +4 -2
- package/lib/core/loaders/plugins/get-enabled-plugins.js +2 -1
- package/lib/core/loaders/plugins/get-user-plugins-config.js +2 -2
- package/lib/core/loaders/plugins/index.js +1 -1
- package/lib/core/loaders/policies.js +4 -2
- package/lib/core/loaders/src-index.js +6 -4
- package/lib/core/registries/policies.d.ts +1 -1
- package/lib/core-api/controller/index.d.ts +16 -14
- package/lib/core-api/service/index.d.ts +10 -9
- package/lib/global.d.ts +61 -0
- package/lib/index.d.ts +2 -24
- package/lib/index.js +1 -0
- package/lib/load/load-files.js +3 -1
- package/lib/middlewares/favicon.js +1 -1
- package/lib/middlewares/public/index.js +1 -1
- package/lib/services/entity-service/index.d.ts +7 -1
- package/lib/services/entity-service/index.js +11 -1
- package/lib/services/fs.js +1 -1
- package/lib/services/metrics/index.js +5 -1
- package/lib/services/metrics/sender.js +7 -0
- package/lib/services/server/middleware.js +1 -1
- package/lib/services/utils/upload-files.js +1 -1
- package/lib/types/core/attributes/base.d.ts +74 -0
- package/lib/types/core/attributes/biginteger.d.ts +22 -0
- package/lib/types/core/attributes/boolean.d.ts +20 -0
- package/lib/types/core/attributes/common.d.ts +42 -0
- package/lib/types/core/attributes/component.d.ts +41 -0
- package/lib/types/core/attributes/date-time.d.ts +22 -0
- package/lib/types/core/attributes/date.d.ts +22 -0
- package/lib/types/core/attributes/decimal.d.ts +22 -0
- package/lib/types/core/attributes/dynamic-zone.d.ts +29 -0
- package/lib/types/core/attributes/email.d.ts +24 -0
- package/lib/types/core/attributes/enumeration.d.ts +28 -0
- package/lib/types/core/attributes/float.d.ts +22 -0
- package/lib/types/core/attributes/index.d.ts +26 -0
- package/lib/types/core/attributes/integer.d.ts +22 -0
- package/lib/types/core/attributes/json.d.ts +14 -0
- package/lib/types/core/attributes/media.d.ts +36 -0
- package/lib/types/core/attributes/password.d.ts +22 -0
- package/lib/types/core/attributes/relation.d.ts +66 -0
- package/lib/types/core/attributes/richtext.d.ts +22 -0
- package/lib/types/core/attributes/string.d.ts +30 -0
- package/lib/types/core/attributes/text.d.ts +30 -0
- package/lib/types/core/attributes/time.d.ts +22 -0
- package/lib/types/core/attributes/timestamp.d.ts +22 -0
- package/lib/types/core/attributes/uid.d.ts +57 -0
- package/lib/types/core/attributes/utils.d.ts +99 -0
- package/lib/types/core/index.d.ts +3 -0
- package/lib/types/core/schemas/index.d.ts +126 -0
- package/lib/types/core/strapi/index.d.ts +370 -0
- package/lib/types/factories.d.ts +52 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/utils.d.ts +95 -0
- package/lib/utils/get-dirs.js +24 -10
- package/lib/utils/import-default.js +10 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/lifecycles.js +15 -0
- package/lib/utils/update-notifier/index.js +1 -1
- package/package.json +19 -17
- package/lib/factories.d.ts +0 -48
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { SchemaUID } from '../../utils';
|
|
2
|
+
import { Attribute, ConfigurableOption, PrivateOption } from './base';
|
|
3
|
+
import { GetAttributesByType, GetAttributesValues } from './utils';
|
|
4
|
+
|
|
5
|
+
export type BasicRelationsType = 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany';
|
|
6
|
+
export type PolymorphicRelationsType = 'morphToOne' | 'morphToMany' | 'morphOne' | 'morphMany';
|
|
7
|
+
export type RelationsType = BasicRelationsType | PolymorphicRelationsType;
|
|
8
|
+
|
|
9
|
+
export interface BasicRelationAttributeProperties<
|
|
10
|
+
S extends SchemaUID,
|
|
11
|
+
R extends RelationsType,
|
|
12
|
+
T extends SchemaUID
|
|
13
|
+
> {
|
|
14
|
+
relation: R;
|
|
15
|
+
target: T;
|
|
16
|
+
inversedBy?: RelationsKeysFromTo<T, S>;
|
|
17
|
+
mappedBy?: RelationsKeysFromTo<T, S>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PolymorphicRelationAttributeProperties<
|
|
21
|
+
R extends RelationsType,
|
|
22
|
+
> {
|
|
23
|
+
relation: R;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type RelationAttribute<
|
|
27
|
+
S extends SchemaUID,
|
|
28
|
+
R extends RelationsType,
|
|
29
|
+
T extends R extends PolymorphicRelationsType ? never: SchemaUID = never
|
|
30
|
+
> = Attribute<'relation'> &
|
|
31
|
+
// Properties
|
|
32
|
+
(R extends BasicRelationsType
|
|
33
|
+
? BasicRelationAttributeProperties<S, R, T>
|
|
34
|
+
: PolymorphicRelationAttributeProperties<R>) &
|
|
35
|
+
// Options
|
|
36
|
+
ConfigurableOption &
|
|
37
|
+
PrivateOption
|
|
38
|
+
|
|
39
|
+
export type RelationsKeysFromTo<
|
|
40
|
+
TTarget extends SchemaUID,
|
|
41
|
+
TSource extends SchemaUID
|
|
42
|
+
> = keyof PickRelationsFromTo<TTarget, TSource>;
|
|
43
|
+
|
|
44
|
+
export type PickRelationsFromTo<TTarget extends SchemaUID, TSource extends SchemaUID> = GetAttributesByType<
|
|
45
|
+
TTarget,
|
|
46
|
+
'relation',
|
|
47
|
+
{ target: TSource }
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
export type RelationPluralityModifier<
|
|
51
|
+
TRelation extends RelationsType,
|
|
52
|
+
TValue extends Object
|
|
53
|
+
> = TRelation extends `${string}Many` ? TValue[] : TValue;
|
|
54
|
+
|
|
55
|
+
export type RelationValue<
|
|
56
|
+
TRelation extends RelationsType,
|
|
57
|
+
TTarget extends SchemaUID
|
|
58
|
+
> = RelationPluralityModifier<TRelation, GetAttributesValues<TTarget>>;
|
|
59
|
+
|
|
60
|
+
export type GetRelationAttributeValue<T extends Attribute> = T extends RelationAttribute<
|
|
61
|
+
infer _TSource,
|
|
62
|
+
infer TRelation,
|
|
63
|
+
infer TTarget
|
|
64
|
+
>
|
|
65
|
+
? RelationValue<TRelation, TTarget>
|
|
66
|
+
: never;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
MinMaxLengthOption,
|
|
6
|
+
PrivateOption,
|
|
7
|
+
RequiredOption,
|
|
8
|
+
} from './base';
|
|
9
|
+
|
|
10
|
+
export type RichTextAttribute = Attribute<'richtext'> &
|
|
11
|
+
// Options
|
|
12
|
+
ConfigurableOption &
|
|
13
|
+
DefaultOption<RichTextValue> &
|
|
14
|
+
MinMaxLengthOption &
|
|
15
|
+
PrivateOption &
|
|
16
|
+
RequiredOption;
|
|
17
|
+
|
|
18
|
+
export type RichTextValue = string;
|
|
19
|
+
|
|
20
|
+
export type GetRichTextAttributeValue<T extends Attribute> = T extends RichTextAttribute
|
|
21
|
+
? RichTextValue
|
|
22
|
+
: never;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
MinMaxLengthOption,
|
|
6
|
+
PrivateOption,
|
|
7
|
+
RequiredOption,
|
|
8
|
+
UniqueOption,
|
|
9
|
+
} from './base';
|
|
10
|
+
|
|
11
|
+
export interface StringAttributeProperties {
|
|
12
|
+
regex?: RegExp;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type StringAttribute = Attribute<'string'> &
|
|
16
|
+
// Properties
|
|
17
|
+
StringAttributeProperties &
|
|
18
|
+
// Options
|
|
19
|
+
ConfigurableOption &
|
|
20
|
+
DefaultOption<StringValue> &
|
|
21
|
+
MinMaxLengthOption &
|
|
22
|
+
PrivateOption &
|
|
23
|
+
UniqueOption &
|
|
24
|
+
RequiredOption;
|
|
25
|
+
|
|
26
|
+
export type StringValue = string;
|
|
27
|
+
|
|
28
|
+
export type GetStringAttributeValue<T extends Attribute> = T extends StringAttribute
|
|
29
|
+
? StringValue
|
|
30
|
+
: never;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
MinMaxLengthOption,
|
|
6
|
+
PrivateOption,
|
|
7
|
+
RequiredOption,
|
|
8
|
+
UniqueOption,
|
|
9
|
+
} from './base';
|
|
10
|
+
|
|
11
|
+
export interface TextAttributeProperties {
|
|
12
|
+
regex?: RegExp;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TextAttribute = Attribute<'text'> &
|
|
16
|
+
// Properties
|
|
17
|
+
TextAttributeProperties &
|
|
18
|
+
// Options
|
|
19
|
+
ConfigurableOption &
|
|
20
|
+
DefaultOption<TextValue> &
|
|
21
|
+
MinMaxLengthOption &
|
|
22
|
+
PrivateOption &
|
|
23
|
+
UniqueOption &
|
|
24
|
+
RequiredOption;
|
|
25
|
+
|
|
26
|
+
export type TextValue = string;
|
|
27
|
+
|
|
28
|
+
export type GetTextAttributeValue<T extends Attribute> = T extends TextAttribute
|
|
29
|
+
? TextValue
|
|
30
|
+
: never;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
PrivateOption,
|
|
6
|
+
RequiredOption,
|
|
7
|
+
UniqueOption,
|
|
8
|
+
} from './base';
|
|
9
|
+
|
|
10
|
+
export type TimeAttribute = Attribute<'time'> &
|
|
11
|
+
// Options
|
|
12
|
+
ConfigurableOption &
|
|
13
|
+
DefaultOption<TimeValue> &
|
|
14
|
+
PrivateOption &
|
|
15
|
+
RequiredOption &
|
|
16
|
+
UniqueOption;
|
|
17
|
+
|
|
18
|
+
export type TimeValue = string;
|
|
19
|
+
|
|
20
|
+
export type GetTimeAttributeValue<T extends Attribute> = T extends TimeAttribute
|
|
21
|
+
? TimeValue
|
|
22
|
+
: never;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
PrivateOption,
|
|
6
|
+
RequiredOption,
|
|
7
|
+
UniqueOption,
|
|
8
|
+
} from './base';
|
|
9
|
+
|
|
10
|
+
export type TimestampAttribute = Attribute<'timestamp'> &
|
|
11
|
+
// Options
|
|
12
|
+
ConfigurableOption &
|
|
13
|
+
DefaultOption<TimestampValue> &
|
|
14
|
+
PrivateOption &
|
|
15
|
+
RequiredOption &
|
|
16
|
+
UniqueOption;
|
|
17
|
+
|
|
18
|
+
export type TimestampValue = string;
|
|
19
|
+
|
|
20
|
+
export type GetTimestampAttributeValue<T extends Attribute> = T extends TimestampAttribute
|
|
21
|
+
? TimestampValue
|
|
22
|
+
: never;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute,
|
|
3
|
+
ConfigurableOption,
|
|
4
|
+
DefaultOption,
|
|
5
|
+
MinMaxLengthOption,
|
|
6
|
+
PrivateOption,
|
|
7
|
+
RequiredOption,
|
|
8
|
+
} from './base';
|
|
9
|
+
import { SchemaUID } from '../../utils';
|
|
10
|
+
import { GetAttributesKeysByType } from './utils';
|
|
11
|
+
|
|
12
|
+
export interface UIDAttributeOptions {
|
|
13
|
+
separator?: string;
|
|
14
|
+
lowercase?: boolean;
|
|
15
|
+
decamelize?: boolean;
|
|
16
|
+
customReplacements?: Array<[string, string]>;
|
|
17
|
+
preserveLeadingUnderscore?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UIDAttributeProperties<
|
|
21
|
+
// Own Schema Reference
|
|
22
|
+
T extends SchemaUID | undefined = undefined,
|
|
23
|
+
// Target attribute
|
|
24
|
+
U extends T extends SchemaUID
|
|
25
|
+
? GetAttributesKeysByType<T, 'string' | 'text'>
|
|
26
|
+
: undefined = undefined,
|
|
27
|
+
// UID options
|
|
28
|
+
S extends UIDAttributeOptions = UIDAttributeOptions
|
|
29
|
+
> {
|
|
30
|
+
targetField?: U;
|
|
31
|
+
options?: UIDAttributeOptions & S;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type UIDAttribute<
|
|
35
|
+
// Own Schema Reference
|
|
36
|
+
T extends SchemaUID | undefined = undefined,
|
|
37
|
+
// Target attribute
|
|
38
|
+
U extends T extends SchemaUID
|
|
39
|
+
? GetAttributesKeysByType<T, 'string' | 'text'>
|
|
40
|
+
: undefined = undefined,
|
|
41
|
+
// UID options
|
|
42
|
+
S extends UIDAttributeOptions = UIDAttributeOptions
|
|
43
|
+
> = Attribute<'uid'> &
|
|
44
|
+
// Properties
|
|
45
|
+
UIDAttributeProperties<T, U, S> &
|
|
46
|
+
// Options
|
|
47
|
+
ConfigurableOption &
|
|
48
|
+
DefaultOption<UIDValue> &
|
|
49
|
+
MinMaxLengthOption &
|
|
50
|
+
PrivateOption &
|
|
51
|
+
RequiredOption;
|
|
52
|
+
|
|
53
|
+
export type UIDValue = string;
|
|
54
|
+
|
|
55
|
+
export type GetUIDAttributeValue<T extends Attribute> = T extends UIDAttribute<infer _U, infer _P>
|
|
56
|
+
? UIDValue
|
|
57
|
+
: never;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Get, KeysBy, NeverGuard, PickBy, SchemaUID } from '../../utils';
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeType,
|
|
5
|
+
GetBigIntegerAttributeValue,
|
|
6
|
+
GetBooleanAttributeValue,
|
|
7
|
+
GetDecimalAttributeValue,
|
|
8
|
+
GetDynamicZoneAttributeValue,
|
|
9
|
+
GetEnumerationAttributeValue,
|
|
10
|
+
GetFloatAttributeValue,
|
|
11
|
+
GetIntegerAttributeValue,
|
|
12
|
+
GetJsonAttributeValue,
|
|
13
|
+
GetMediaAttributeValue,
|
|
14
|
+
GetPasswordAttributeValue,
|
|
15
|
+
GetRelationAttributeValue,
|
|
16
|
+
GetRichTextAttributeValue,
|
|
17
|
+
GetStringAttributeValue,
|
|
18
|
+
GetTextAttributeValue,
|
|
19
|
+
GetUIDAttributeValue,
|
|
20
|
+
GetComponentAttributeValue,
|
|
21
|
+
GetEmailAttributeValue,
|
|
22
|
+
} from '.';
|
|
23
|
+
import { GetDateAttributeValue } from './date';
|
|
24
|
+
import { GetDateTimeAttributeValue } from './date-time';
|
|
25
|
+
import { GetTimeAttributeValue } from './time';
|
|
26
|
+
import { GetTimestampAttributeValue } from './timestamp';
|
|
27
|
+
|
|
28
|
+
export type PickTypes<T extends AttributeType> = T;
|
|
29
|
+
|
|
30
|
+
export type GetAttributesKeysByType<
|
|
31
|
+
T extends SchemaUID,
|
|
32
|
+
U extends AttributeType,
|
|
33
|
+
P = never
|
|
34
|
+
> = KeysBy<GetAttributes<T>, Attribute<U> & NeverGuard<P, unknown>>;
|
|
35
|
+
|
|
36
|
+
export type GetAttributesByType<T extends SchemaUID, U extends AttributeType, P = never> = PickBy<
|
|
37
|
+
GetAttributes<T>,
|
|
38
|
+
Attribute<U> & NeverGuard<P, unknown>
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
export type GetAttribute<T extends SchemaUID, U extends GetAttributesKey<T>> = Get<
|
|
42
|
+
GetAttributes<T>,
|
|
43
|
+
U
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
export type GetAttributes<T extends SchemaUID> = Get<Strapi.Schemas[T], 'attributes'>;
|
|
47
|
+
|
|
48
|
+
export type GetAttributesKey<T extends SchemaUID> = keyof GetAttributes<T>;
|
|
49
|
+
|
|
50
|
+
export type GetAttributeValue<T extends Attribute> =
|
|
51
|
+
| GetBigIntegerAttributeValue<T>
|
|
52
|
+
| GetBooleanAttributeValue<T>
|
|
53
|
+
| GetComponentAttributeValue<T>
|
|
54
|
+
| GetDecimalAttributeValue<T>
|
|
55
|
+
| GetDynamicZoneAttributeValue<T>
|
|
56
|
+
| GetEnumerationAttributeValue<T>
|
|
57
|
+
| GetEmailAttributeValue<T>
|
|
58
|
+
| GetFloatAttributeValue<T>
|
|
59
|
+
| GetIntegerAttributeValue<T>
|
|
60
|
+
| GetJsonAttributeValue<T>
|
|
61
|
+
| GetMediaAttributeValue<T>
|
|
62
|
+
| GetPasswordAttributeValue<T>
|
|
63
|
+
| GetRelationAttributeValue<T>
|
|
64
|
+
| GetRichTextAttributeValue<T>
|
|
65
|
+
| GetStringAttributeValue<T>
|
|
66
|
+
| GetTextAttributeValue<T>
|
|
67
|
+
| GetUIDAttributeValue<T>
|
|
68
|
+
| GetMediaAttributeValue<T>
|
|
69
|
+
| GetDateAttributeValue<T>
|
|
70
|
+
| GetDateTimeAttributeValue<T>
|
|
71
|
+
| GetTimeAttributeValue<T>
|
|
72
|
+
| GetTimestampAttributeValue<T>;
|
|
73
|
+
|
|
74
|
+
export type GetAttributeValueByKey<
|
|
75
|
+
T extends SchemaUID,
|
|
76
|
+
U extends GetAttributesKey<T>
|
|
77
|
+
> = GetAttribute<T, U> extends infer P
|
|
78
|
+
? P extends Attribute
|
|
79
|
+
? GetAttributeValue<P>
|
|
80
|
+
: never
|
|
81
|
+
: never;
|
|
82
|
+
|
|
83
|
+
export type GetAttributesValues<T extends SchemaUID> = {
|
|
84
|
+
// Handle required attributes
|
|
85
|
+
[key in GetAttributesRequiredKeys<T>]-?: GetAttributeValueByKey<T, key>;
|
|
86
|
+
} &
|
|
87
|
+
{
|
|
88
|
+
// Handle optional attributes
|
|
89
|
+
[key in GetAttributesOptionalKeys<T>]?: GetAttributeValueByKey<T, key>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type GetAttributesRequiredKeys<T extends SchemaUID> = KeysBy<
|
|
93
|
+
GetAttributes<T>,
|
|
94
|
+
{ required: true }
|
|
95
|
+
>;
|
|
96
|
+
export type GetAttributesOptionalKeys<T extends SchemaUID> = keyof Omit<
|
|
97
|
+
GetAttributes<T>,
|
|
98
|
+
GetAttributesRequiredKeys<T>
|
|
99
|
+
>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Attribute, ComponentAttribute } from '../attributes';
|
|
2
|
+
import { KeysBy, StringRecord } from '../../utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Literal union type representing the possible natures of a content type
|
|
6
|
+
*/
|
|
7
|
+
export type ContentTypeKind = 'singleType' | 'collectionType';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Literal union type representing the possible types of a model
|
|
11
|
+
*/
|
|
12
|
+
export type SchemaModelType = 'contentType' | 'component';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Data structure that can either represent a content type or a component
|
|
16
|
+
*/
|
|
17
|
+
export interface Schema {
|
|
18
|
+
/**
|
|
19
|
+
* The type of the model. Useful to discriminate content-types from component
|
|
20
|
+
*/
|
|
21
|
+
modelType: SchemaModelType;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Informations about schema naming and display
|
|
25
|
+
*/
|
|
26
|
+
info: SchemaInfo;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Map of all the attributes with their name and definition
|
|
30
|
+
*/
|
|
31
|
+
attributes: SchemaAttributes;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Options declared and read by the plugins
|
|
35
|
+
*/
|
|
36
|
+
pluginOptions?: PluginOptions;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Options object dedicated to Strapi core features
|
|
40
|
+
*/
|
|
41
|
+
options?: SchemaOptions;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Custom table name for the schema
|
|
45
|
+
*/
|
|
46
|
+
collectionName?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Data structure containing naming and display information for a Schema
|
|
51
|
+
*/
|
|
52
|
+
export interface SchemaInfo {
|
|
53
|
+
/**
|
|
54
|
+
* Default name to use in the admin panel
|
|
55
|
+
*/
|
|
56
|
+
displayName: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Singular form of the content type name
|
|
60
|
+
*/
|
|
61
|
+
singularName?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Plural form of the collection type name
|
|
65
|
+
*/
|
|
66
|
+
pluralName?: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Description of the model
|
|
70
|
+
*/
|
|
71
|
+
description?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* FontAwesome (v5) icon name to use for the component's icon in the admin panel
|
|
75
|
+
*/
|
|
76
|
+
icon?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Low level data structure referencing every schema attribute and its name
|
|
81
|
+
*/
|
|
82
|
+
export interface SchemaAttributes extends StringRecord<Attribute> {}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Structure containing every core schema options and their associated value
|
|
86
|
+
*/
|
|
87
|
+
export interface SchemaOptions {
|
|
88
|
+
draftAndPublish?: boolean;
|
|
89
|
+
populateCreatorFields?: boolean;
|
|
90
|
+
comment?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface PluginOptions {}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Schema for a content type
|
|
97
|
+
*/
|
|
98
|
+
export interface ContentTypeSchema extends Schema {
|
|
99
|
+
modelType: 'contentType';
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Determine the type of the content type (single-type or collection-type)
|
|
103
|
+
*/
|
|
104
|
+
kind: ContentTypeKind;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Schema for a collection type
|
|
109
|
+
*/
|
|
110
|
+
export interface CollectionTypeSchema extends ContentTypeSchema {
|
|
111
|
+
kind: 'collectionType';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Schema for a single type
|
|
116
|
+
*/
|
|
117
|
+
export interface SingleTypeSchema extends ContentTypeSchema {
|
|
118
|
+
kind: 'singleType';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Schema for a component
|
|
123
|
+
*/
|
|
124
|
+
export interface ComponentSchema extends Schema {
|
|
125
|
+
modelType: 'component';
|
|
126
|
+
}
|