@strapi/types 5.0.0-beta.1 → 5.0.0-beta.11

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.
Files changed (112) hide show
  1. package/dist/core/strapi.d.ts +10 -23
  2. package/dist/core/strapi.d.ts.map +1 -1
  3. package/dist/data/component.d.ts +9 -0
  4. package/dist/data/component.d.ts.map +1 -1
  5. package/dist/data/constants.d.ts +3 -0
  6. package/dist/data/constants.d.ts.map +1 -1
  7. package/dist/data/content-type.d.ts +9 -0
  8. package/dist/data/content-type.d.ts.map +1 -1
  9. package/dist/data/entity.d.ts +6 -0
  10. package/dist/data/entity.d.ts.map +1 -1
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/internal/uid.d.ts.map +1 -1
  14. package/dist/modules/documents/component-extension.d.ts +22 -0
  15. package/dist/modules/documents/component-extension.d.ts.map +1 -0
  16. package/dist/modules/documents/document-engine.d.ts +0 -1
  17. package/dist/modules/documents/index.d.ts +9 -3
  18. package/dist/modules/documents/index.d.ts.map +1 -1
  19. package/dist/modules/documents/middleware.d.ts +13 -8
  20. package/dist/modules/documents/middleware.d.ts.map +1 -1
  21. package/dist/modules/documents/params/document-engine.d.ts +24 -11
  22. package/dist/modules/documents/params/document-engine.d.ts.map +1 -1
  23. package/dist/modules/documents/params/filters/index.d.ts.map +1 -1
  24. package/dist/modules/documents/params/index.d.ts +16 -4
  25. package/dist/modules/documents/params/index.d.ts.map +1 -1
  26. package/dist/modules/documents/params/locale.d.ts +4 -0
  27. package/dist/modules/documents/params/locale.d.ts.map +1 -0
  28. package/dist/modules/documents/params/populate.d.ts +3 -5
  29. package/dist/modules/documents/params/populate.d.ts.map +1 -1
  30. package/dist/modules/documents/result/document-engine.d.ts +12 -8
  31. package/dist/modules/documents/result/document-engine.d.ts.map +1 -1
  32. package/dist/modules/documents/result/index.d.ts.map +1 -1
  33. package/dist/modules/documents/service-instance.d.ts +40 -15
  34. package/dist/modules/documents/service-instance.d.ts.map +1 -1
  35. package/dist/modules/entity-service/params/attributes/relation.d.ts +1 -1
  36. package/dist/modules/entity-service/params/attributes/relation.d.ts.map +1 -1
  37. package/dist/modules/entity-service/params/filters/index.d.ts.map +1 -1
  38. package/dist/modules/entity-service/params/populate.d.ts +4 -6
  39. package/dist/modules/entity-service/params/populate.d.ts.map +1 -1
  40. package/dist/modules/entity-service/params/sort.d.ts.map +1 -1
  41. package/dist/modules/entity-service/result.d.ts.map +1 -1
  42. package/dist/modules/event-hub.d.ts +1 -0
  43. package/dist/modules/event-hub.d.ts.map +1 -1
  44. package/dist/modules/features.d.ts +0 -1
  45. package/dist/modules/features.d.ts.map +1 -1
  46. package/dist/public/registries.d.ts +38 -0
  47. package/dist/public/registries.d.ts.map +1 -1
  48. package/dist/public/shared.d.ts +53 -0
  49. package/dist/public/shared.d.ts.map +1 -1
  50. package/dist/schema/attribute/base.d.ts +43 -4
  51. package/dist/schema/attribute/base.d.ts.map +1 -1
  52. package/dist/schema/attribute/common.d.ts +9 -0
  53. package/dist/schema/attribute/common.d.ts.map +1 -1
  54. package/dist/schema/attribute/definitions/biginteger.d.ts +3 -0
  55. package/dist/schema/attribute/definitions/biginteger.d.ts.map +1 -1
  56. package/dist/schema/attribute/definitions/blocks.d.ts +4 -0
  57. package/dist/schema/attribute/definitions/blocks.d.ts.map +1 -1
  58. package/dist/schema/attribute/definitions/boolean.d.ts +3 -0
  59. package/dist/schema/attribute/definitions/boolean.d.ts.map +1 -1
  60. package/dist/schema/attribute/definitions/component.d.ts +3 -0
  61. package/dist/schema/attribute/definitions/component.d.ts.map +1 -1
  62. package/dist/schema/attribute/definitions/date-time.d.ts +3 -0
  63. package/dist/schema/attribute/definitions/date-time.d.ts.map +1 -1
  64. package/dist/schema/attribute/definitions/date.d.ts +3 -0
  65. package/dist/schema/attribute/definitions/date.d.ts.map +1 -1
  66. package/dist/schema/attribute/definitions/decimal.d.ts +3 -0
  67. package/dist/schema/attribute/definitions/decimal.d.ts.map +1 -1
  68. package/dist/schema/attribute/definitions/dynamic-zone.d.ts +3 -0
  69. package/dist/schema/attribute/definitions/dynamic-zone.d.ts.map +1 -1
  70. package/dist/schema/attribute/definitions/email.d.ts +3 -0
  71. package/dist/schema/attribute/definitions/email.d.ts.map +1 -1
  72. package/dist/schema/attribute/definitions/enumeration.d.ts +3 -0
  73. package/dist/schema/attribute/definitions/enumeration.d.ts.map +1 -1
  74. package/dist/schema/attribute/definitions/float.d.ts +3 -0
  75. package/dist/schema/attribute/definitions/float.d.ts.map +1 -1
  76. package/dist/schema/attribute/definitions/integer.d.ts +3 -0
  77. package/dist/schema/attribute/definitions/integer.d.ts.map +1 -1
  78. package/dist/schema/attribute/definitions/json.d.ts +3 -0
  79. package/dist/schema/attribute/definitions/json.d.ts.map +1 -1
  80. package/dist/schema/attribute/definitions/media.d.ts +3 -0
  81. package/dist/schema/attribute/definitions/media.d.ts.map +1 -1
  82. package/dist/schema/attribute/definitions/password.d.ts +3 -0
  83. package/dist/schema/attribute/definitions/password.d.ts.map +1 -1
  84. package/dist/schema/attribute/definitions/relation.d.ts +3 -0
  85. package/dist/schema/attribute/definitions/relation.d.ts.map +1 -1
  86. package/dist/schema/attribute/definitions/richtext.d.ts +3 -0
  87. package/dist/schema/attribute/definitions/richtext.d.ts.map +1 -1
  88. package/dist/schema/attribute/definitions/string.d.ts +6 -0
  89. package/dist/schema/attribute/definitions/string.d.ts.map +1 -1
  90. package/dist/schema/attribute/definitions/text.d.ts +3 -0
  91. package/dist/schema/attribute/definitions/text.d.ts.map +1 -1
  92. package/dist/schema/attribute/definitions/time.d.ts +3 -0
  93. package/dist/schema/attribute/definitions/time.d.ts.map +1 -1
  94. package/dist/schema/attribute/definitions/timestamp.d.ts +3 -0
  95. package/dist/schema/attribute/definitions/timestamp.d.ts.map +1 -1
  96. package/dist/schema/attribute/definitions/uid.d.ts +3 -0
  97. package/dist/schema/attribute/definitions/uid.d.ts.map +1 -1
  98. package/dist/schema/attribute/options.d.ts +140 -0
  99. package/dist/schema/attribute/options.d.ts.map +1 -1
  100. package/dist/schema/attribute/utils.d.ts +41 -0
  101. package/dist/schema/attribute/utils.d.ts.map +1 -1
  102. package/dist/schema/index.d.ts +75 -2
  103. package/dist/schema/index.d.ts.map +1 -1
  104. package/dist/struct/schema.d.ts +135 -31
  105. package/dist/struct/schema.d.ts.map +1 -1
  106. package/dist/uid/index.d.ts +134 -9
  107. package/dist/uid/index.d.ts.map +1 -1
  108. package/dist/utils/array.d.ts.map +1 -1
  109. package/dist/utils/index.d.ts +26 -0
  110. package/dist/utils/index.d.ts.map +1 -1
  111. package/dist/utils/string.d.ts.map +1 -1
  112. package/package.json +16 -14
@@ -24,14 +24,55 @@ export type IsPopulatable<TAttribute extends Attribute.Attribute> = IsOfType<TAt
24
24
  * @template TAttribute - Any attribute
25
25
  */
26
26
  export type TypeOf<TAttribute extends Attribute.Attribute> = TAttribute['type'];
27
+ /**
28
+ * Extract the target of an attribute.
29
+ *
30
+ * Returns never if the attribute don't have a target.
31
+ *
32
+ * Returns {@link UID.Schema} if a valid target is found
33
+ *
34
+ * @template TAttribute - The attribute to use
35
+ *
36
+ * @remark Targets can only be inferred from relation, component, and media attributes.
37
+ */
27
38
  export type Target<TAttribute extends Attribute.Attribute> = Attribute.RelationTarget<TAttribute> | Attribute.ComponentTarget<TAttribute> | Attribute.MediaTarget<TAttribute>;
39
+ /**
40
+ * Extract the potential targets of a polymorphic attribute.
41
+ *
42
+ * Returns never if the attribute don't have any target.
43
+ *
44
+ * Returns {@link UID.Schema} if valid targets are found
45
+ *
46
+ * @template TAttribute - The attribute to use
47
+ *
48
+ * @remark Morph targets can only be inferred from dynamic-zone attributes.
49
+ */
28
50
  export type MorphTargets<TAttribute extends Attribute.Attribute> = Attribute.DynamicZoneTargets<TAttribute>;
51
+ /**
52
+ * Checks whether an attribute has a valid target.
53
+ *
54
+ * @template TAttribute - The attribute to check
55
+ *
56
+ * @see Target
57
+ *
58
+ * @remark Targets can only be inferred from relation, component, and media attributes.
59
+ */
29
60
  export type HasTarget<TAttribute extends Attribute.Attribute> = Target<TAttribute> extends infer TTarget ? And<IsNotNever<TTarget>, Extends<TTarget, UID.Schema>> : Constants.False;
61
+ /**
62
+ * Checks whether an attribute has valid targets.
63
+ *
64
+ * @template TAttribute - The attribute to check
65
+ *
66
+ * @see MorphTargets
67
+ *
68
+ * @remark Targets can only be inferred from dynamic-zone attributes.
69
+ */
30
70
  export type HasMorphTargets<TAttribute extends Attribute.Attribute> = MorphTargets<TAttribute> extends infer TMaybeTargets ? And<IsNotNever<TMaybeTargets>, Extends<TMaybeTargets, UID.Schema>> : Constants.False;
31
71
  /**
32
72
  * Represents the actual value of a given attribute {@link TAttribute}.
33
73
  *
34
74
  * @template TAttribute - The attribute to extract the value from.
75
+ * @template TGuard - The fallback type to use if it's not possible to infer the correct type value.
35
76
  */
36
77
  export type Value<TAttribute extends Attribute.Attribute, TGuard = unknown> = Guard.Never<{
37
78
  biginteger: Attribute.GetBigIntegerValue<TAttribute>;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/schema/attribute/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAClB,UAAU,SAAS,SAAS,CAAC,SAAS,EACtC,KAAK,SAAS,SAAS,CAAC,IAAI,IAC1B,UAAU,SAAS;IACrB,IAAI,EAAE,KAAK,CAAC;CACb,GACG,IAAI,GACJ,KAAK,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,CAAC,UAAU,SAAS,SAAS,CAAC,SAAS,IAAI,QAAQ,CAC1E,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AAC;IACjD,MAAM,EAAE,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC7C,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACzC,GAAG,EAAE,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACzC,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAEnD,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,WAAW,EAAE,SAAS,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACvD,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;CAClD,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAC/B,MAAM,CACP,CAAC"}
@@ -4,12 +4,24 @@ import type { If, Object, Guard } from '../utils';
4
4
  import type * as Attribute from './attribute';
5
5
  export { Attribute };
6
6
  /**
7
- * The Schemas type represents a combination of both content type and component schemas
7
+ * Combines both content type and component schemas, effectively serving as a consolidated registry of all schemas.
8
8
  *
9
- * Both are fetched from the public registries.
9
+ * Enables mapping between a unique identifier and its corresponding schema.
10
+ *
11
+ @remark Schema definitions are pulled from the public registries
10
12
  */
11
13
  export type Schemas = Public.ContentTypeSchemas & Public.ComponentSchemas;
14
+ /**
15
+ * Content-type schema definitions.
16
+ *
17
+ * @remark Schema definitions are pulled from the public content-type registries
18
+ */
12
19
  export type ContentTypes = Public.ContentTypeSchemas;
20
+ /**
21
+ * Component schema definitions.
22
+ *
23
+ * @remark Schema definitions are pulled from the public component registries
24
+ */
13
25
  export type Components = Public.ComponentSchemas;
14
26
  export type ContentType<TContentTypeUID extends UID.ContentType = UID.ContentType> = ContentTypes[TContentTypeUID];
15
27
  export type Component<TComponentUID extends UID.Component = UID.Component> = Components[TComponentUID];
@@ -17,18 +29,24 @@ export type Component<TComponentUID extends UID.Component = UID.Component> = Com
17
29
  * Returns the Schema data structure associated with the given UID
18
30
  *
19
31
  * @template TSchemaUID - The unique identifier for the schema.
32
+ *
33
+ * @see Schemas
20
34
  */
21
35
  export type Schema<TSchemaUID extends UID.Schema = UID.Schema> = Schemas[TSchemaUID];
22
36
  /**
23
37
  * Returns the `info` property for a given schema.
24
38
  *
25
39
  * @template TSchemaUID - The targeted schema UID.
40
+ *
41
+ * @see Schema
26
42
  */
27
43
  export type Info<TSchemaUID extends UID.Schema> = Schema<TSchemaUID>['info'];
28
44
  /**
29
45
  * Returns the `modelType` property for a given schema.
30
46
  *
31
47
  * @template TSchemaUID - The targeted schema UID.
48
+ *
49
+ * @see Schema
32
50
  */
33
51
  export type ModelType<TSchemaUID extends UID.Schema> = Schema<TSchemaUID>['modelType'];
34
52
  /**
@@ -59,13 +77,68 @@ export type Attributes<TSchemaUID extends UID.Schema = UID.Schema> = {
59
77
  * @template TSchemaUID - The Schema's UID used to get the attributes names.
60
78
  */
61
79
  export type AttributeNames<TSchemaUID extends UID.Schema> = Extract<keyof Attributes<TSchemaUID>, string>;
80
+ /**
81
+ * Create an attribute record whose types matches the given ones.
82
+ *
83
+ * @template TSchemaUID - The Schema's UID used to get the attribute names.
84
+ * @template TKind - The kind of attribute we are searching for.
85
+ * @template TCondition - Optional. An additional condition to match additional attributes properties.
86
+ */
62
87
  export type AttributesByType<TSchemaUID extends UID.Schema, TKind extends Attribute.Kind, TCondition = never> = Object.PickBy<Attributes<TSchemaUID>, Attribute.OfType<TKind> & Guard.Never<TCondition>>;
88
+ /**
89
+ * Returns a union of attribute names whose type matches the given ones.
90
+ *
91
+ * @template TSchemaUID - The Schema's UID used to get the attribute names.
92
+ * @template TKind - The kind of attribute we are searching for.
93
+ * @template TCondition - Optional. An additional condition to match additional attributes properties.
94
+ */
63
95
  export type AttributeNamesByType<TSchemaUID extends UID.Schema, TKind extends Attribute.Kind, TCondition = never> = Object.KeysBy<Attributes<TSchemaUID>, Attribute.OfType<TKind> & Guard.Never<TCondition, unknown>, AttributeNames<TSchemaUID>>;
96
+ /**
97
+ * Provides the names of non-populatable attributes of a Schema.
98
+ *
99
+ * Non-populatable attributes are those which do not need to be populated to get their final value.
100
+ *
101
+ * @template TSchemaUID - The unique identifier of the schema.
102
+ */
64
103
  export type NonPopulatableAttributeNames<TSchemaUID extends UID.Schema> = AttributeNamesByType<TSchemaUID, Attribute.NonPopulatableKind>;
104
+ /**
105
+ * Provides the names of populatable attributes of a Schema.
106
+ *
107
+ * Populatable attributes are those which need to be populated to get their final value, such as {@link Attribute.Relation}, {@link Attribute.DynamicZone}, {@link Attribute.Component} or {@link Attribute.Media}.
108
+ *
109
+ * @template TSchemaUID - The unique identifier of the schema.
110
+ */
65
111
  export type PopulatableAttributeNames<TSchemaUID extends UID.Schema> = AttributeNamesByType<TSchemaUID, Attribute.PopulatableKind>;
112
+ /**
113
+ * Returns a list of attribute names which have associated targets.
114
+ *
115
+ * @remark `
116
+ AttributeNamesWithTarget` maps over the list of attribute for a given schema and filters those
117
+ * with targets (in other words, attribute names that have associated {@link Attribute.HasTarget} true).
118
+ *
119
+ * @returns a union of each attribute's name matching the condition.
120
+ *
121
+ * @template TSchemaUID - The unique identifier of the schema.
122
+ */
66
123
  export type AttributeNamesWithTarget<TSchemaUID extends UID.Schema> = Extract<Object.Values<{
67
124
  [TKey in AttributeNames<TSchemaUID>]: If<Attribute.HasTarget<AttributeByName<TSchemaUID, TKey>>, TKey>;
68
125
  }>, AttributeNames<TSchemaUID>>;
126
+ /**
127
+ * Extracts the names of all required attributes from a given schema.
128
+ *
129
+ * @remark `RequiredAttributeNames` screens attributes based on the {@link Attribute.Required} property,
130
+ * determining mandatory attributes from the given schema.
131
+ *
132
+ * @template TSchemaUID - The identifier of the schema.
133
+ */
69
134
  export type RequiredAttributeNames<TSchemaUID extends UID.Schema> = Object.KeysBy<Attributes<TSchemaUID>, Attribute.Required, AttributeNames<TSchemaUID>>;
135
+ /**
136
+ * Returns a union of every optional attribute name by excluding required attribute keys from the given Schema UID.
137
+ *
138
+ * @remark The `
139
+ OptionalAttributeNames` type utilises the {@link Object.KeysExcept} utility that takes a Schema's attributes and excludes the keys of required attributes.
140
+ *
141
+ * @template TSchemaUID - The unique identifier for the schema.
142
+ */
70
143
  export type OptionalAttributeNames<TSchemaUID extends UID.Schema> = Object.KeysExcept<Attributes<TSchemaUID>, Attribute.Required, AttributeNames<TSchemaUID>>;
71
144
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,KAAK,GAAG,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE1E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAEjD,MAAM,MAAM,WAAW,CAAC,eAAe,SAAS,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,IAC/E,YAAY,CAAC,eAAe,CAAC,CAAC;AAEhC,MAAM,MAAM,SAAS,CAAC,aAAa,SAAS,G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AM,MAAM,sBAAsB,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,CACnF,UAAU,CAAC,UAAU,CAAC,EACtB,SAAS,CAAC,QAAQ,EAClB,cAAc,CAAC,UAAU,CAAC,CAC3B,CAAC"}
@@ -4,141 +4,245 @@ export type ContentTypeKind = 'collectionType' | 'singleType';
4
4
  export type ModelType = 'contentType' | 'component';
5
5
  export type Schema = ContentTypeSchema | ComponentSchema;
6
6
  /**
7
- * Represents a Strapi Schema once loaded by the server
7
+ * A loaded instance of a Strapi Schema accessible to the server.
8
8
  */
9
9
  export interface BaseSchema {
10
10
  /**
11
- * The unique identifier of the Schema
11
+ * The unique identifier of the Schema. This identifier is a combined type encompassing both ContentType and Component UID types.
12
+ *
13
+ * It is mainly used when dealing with either content types or components in a situation where the context is not specific.
12
14
  */
13
15
  uid: UID.Schema;
14
16
  /**
15
- * The type of the model. Useful to discriminate content-types from component
17
+ * This is an identifier type that helps differentiate between a 'contentType' and 'component'.
18
+ * This distinction aids in communication where the ModelType needs to be specified explicitly.
16
19
  */
17
20
  modelType: ModelType;
18
21
  /**
19
- * Unique identifier of the schema
22
+ * Serves as the public name of the schema. Often utilized in referencing a specific schema (e.g. in the database).
20
23
  */
21
24
  modelName: string;
22
25
  /**
23
- * Unique identifier of the schema
26
+ * This global identifier acts as a unique reference to the schema across varying scopes and contexts.
24
27
  */
25
28
  globalId: string;
26
29
  /**
27
- * Options declared and read by the plugins
30
+ * Contains options specific to plugins. It is an optional property and stores configurations that are read by the plugins associated with this Schema.
28
31
  */
29
32
  pluginOptions?: SchemaPluginOptions;
30
33
  /**
31
- * Options object dedicated to Strapi core features
34
+ * Encapsulates all core options related to Strapi features for a given Schema.
32
35
  */
33
36
  options?: SchemaOptions;
34
37
  /**
35
- * Custom table name for the schema
38
+ * Optional property. Specifies the custom table name for the Schema if any.
36
39
  */
37
40
  collectionName?: string;
38
41
  /**
39
- * Information about schema naming and display
42
+ * Contains information related to naming and display characteristics of the Schema.
40
43
  */
41
44
  info: SchemaInfo;
42
45
  /**
43
- * A collection of attributes for a given Schema.
44
- *
45
- * It is stored as a record, where each attribute is associated with a unique string key.
46
+ * Houses a comprehensive collection of attributes for this Schema.
46
47
  *
47
- * The values should be instances of {@link Attribute.AnyAttribute}.
48
+ * Each attribute has a unique string key and corresponding value should be any Attribute type instance.
48
49
  */
49
50
  attributes: SchemaAttributes;
50
51
  }
51
52
  /**
52
- * Data structure containing naming and display information for a Schema
53
+ * Comprises naming and display parameters to customize a Schema's representation.
53
54
  */
54
55
  export interface SchemaInfo {
55
56
  /**
56
- * Default name to use in the admin panel
57
+ * Sets the default nomenclature for the Admin Panel. Acts as the label while identifying
58
+ * the schema or interacting with it within the admin panel. For example, used as a label
59
+ * for fields, table columns, and menu items.
57
60
  */
58
61
  displayName: string;
59
62
  /**
60
- * Description of the model
63
+ * Delineates the purpose of the model, clarifying its intended usage or its function. This
64
+ * property is optional and is primarily meant for further documentation to provide better
65
+ * context and understanding of the schema.
61
66
  */
62
67
  description?: string;
63
68
  /**
64
- * @strapi/icon name to use for the component's icon in the admin panel
69
+ * Specifies the visual identifier - an icon, for the schema inside the admin panel. It eases
70
+ * recognition and improves navigation. The value should be any valid @strapi/icon name. This
71
+ * property is optional, and if omitted, a default icon might be used by the interface.
65
72
  */
66
73
  icon?: string;
67
74
  }
75
+ /**
76
+ * `SchemaAttributes` is a mapping of attribute keys to their corresponding values.
77
+ *
78
+ * These keys and values define the structure and characteristics of a Strapi schema.
79
+ */
68
80
  export type SchemaAttributes = Record<string, Attribute.AnyAttribute>;
69
81
  /**
70
- * Structure containing every core schema options and their associated value
82
+ * Contains various options employed during runtime to tweak certain aspects of Strapi features.
83
+ *
84
+ * Each property under this interface can enable, disable or modify a specific feature or functionality associated with a schema.
71
85
  */
72
86
  export interface SchemaOptions {
73
87
  /**
74
- * EE only.
88
+ * Toggles the review workflow feature on or off.
89
+ *
90
+ * A review workflow is a process that describes the stages a document must go through from creation to publication.
91
+ *
92
+ * @remark This option is Enterprise Edition Exclusive.
75
93
  */
76
94
  reviewWorkflows?: boolean;
95
+ /**
96
+ * Determines if creator fields can be populated.
97
+ *
98
+ * When enabled, this feature will allow populating data about the admin user who created a specific document entry.
99
+ */
77
100
  populateCreatorFields?: boolean;
101
+ /**
102
+ * May be used for providing specific notes or annotations of the schema.
103
+ */
78
104
  comment?: string;
105
+ /**
106
+ * Can be utilized for setting a particular version of schema related to the review-workflow feature.
107
+ *
108
+ * @deprecated As of v5, this is deprecated and will likely be removed soon.
109
+ */
79
110
  version?: string;
111
+ /**
112
+ * Used to enable or disable the draft and publish feature.
113
+ * This would decide whether the changes made to a document are published immediately or saved as a draft for later.
114
+ */
80
115
  draftAndPublish?: boolean;
81
116
  }
82
117
  /**
83
- * Plugins' options for a Schema
118
+ * Provides a flexible configuration method for Strapi plugins.
119
+ *
120
+ * In Strapi, plugins extend the core functionality and enhance features of the application. Each plugin may require
121
+ * prerequisite settings or configurations for successful functioning. `SchemaPluginOptions` facilitates this by storing these configurations
122
+ * as key-value pairs where the key corresponds to the name of the plugin, and the value defines the respective settings of that plugin.
123
+ *
124
+ * @remark The keys/values of configurations are not explicitly defined and are manually defined in each schema definition.
125
+ *
126
+ * @example
127
+ * Using `SchemaPluginOptions` in the schema definition:
128
+ *
129
+ * ```typescript
130
+ * import type { Struct } from '@strapi/types';
131
+ *
132
+ * const strapiPluginOptions: Struct.SchemaPluginOptions = {
133
+ * 'plugin-foo': {
134
+ * prop1: string;
135
+ * prop2: boolean;
136
+ * },
137
+ * 'plugin-bar': {
138
+ * prop1: string;
139
+ * prop2: boolean;
140
+ * },
141
+ * };
142
+ *
143
+ * const articleSchema: Struct.BaseSchema = {
144
+ * uid: 'article',
145
+ * modelType: 'contentType',
146
+ * modelName: 'Article',
147
+ * globalId: 'Article',
148
+ * pluginOptions: strapiPluginOptions,
149
+ * // Other schema properties...
150
+ * };
151
+ * ```
152
+ *
84
153
  */
85
154
  export interface SchemaPluginOptions {
86
155
  [key: string]: unknown;
87
156
  }
88
157
  /**
89
- * Schema for a content type
158
+ * Serves as a layout for a content type.
159
+ *
160
+ * Inherits and enhances various properties from the `BaseSchema`, the `ContentTypeSchema` is a unique derivative of the base schema that distinguishes itself with additional properties.
90
161
  */
91
162
  export interface ContentTypeSchema extends BaseSchema {
163
+ /**
164
+ * Forces the `modelType` to be a `contentType`.
165
+ *
166
+ * @remark Helpful to distinguish a {@link ContentTypeSchema} from a {@link ComponentSchema}
167
+ */
92
168
  modelType: 'contentType';
93
169
  /**
94
- * Unique identifier of the schema
170
+ * Unique identifier associated with the content type. It acts as a reference to work with data structures that are specifically identified by the content type's UID.
95
171
  */
96
172
  uid: UID.ContentType;
97
173
  /**
98
- * Determine the type of the content type (single-type or collection-type)
174
+ * Classifies the content type as 'collection-type' or 'single-type'.
99
175
  */
100
176
  kind: ContentTypeKind;
101
177
  /**
102
- * Information about schema naming and display
178
+ * Brings together attributes related to naming and display characteristics like singular name and plural name of the content type. These names are typically used in user interfaces where these entries are displayed.
103
179
  */
104
180
  info: ContentTypeSchemaInfo;
105
181
  /**
106
- * Indexes to be created on the database
182
+ * Optional attribute to indicate the indexes to be created on the database for this content type.
183
+ *
107
184
  * @internal
108
185
  */
109
186
  indexes?: unknown[];
110
187
  }
111
188
  /**
112
- * Represents information about a content type schema.
189
+ * Contains naming properties specific to a specific content type.
113
190
  */
114
191
  export interface ContentTypeSchemaInfo extends SchemaInfo {
115
192
  /**
116
- * Singular form of the content type name
193
+ * Indicates how a single instance of the content type should be labeled.
117
194
  */
118
195
  singularName: string;
119
196
  /**
120
- * Plural form of the collection type name
197
+ * Provides a human-friendly label for referring to multiple instances of the content type.
121
198
  */
122
199
  pluralName: string;
123
200
  }
124
201
  /**
125
- * Schema for a collection type
202
+ * Schema that represents a collection of content types' entry in the system.
126
203
  */
127
204
  export interface CollectionTypeSchema extends ContentTypeSchema {
205
+ /**
206
+ * Explicitly sets the kind of content type schema to 'collectionType'.
207
+ *
208
+ * This signifies that the content type is organized in a collection, handling multiple entries.
209
+ */
128
210
  kind: 'collectionType';
129
211
  }
130
212
  /**
131
- * Schema for a single type
213
+ * Schema that represents a single of content type's entry in the system.
132
214
  */
133
215
  export interface SingleTypeSchema extends ContentTypeSchema {
216
+ /**
217
+ * Explicitly sets the kind of content type schema to 'singleType'.
218
+ *
219
+ * This signifies that the content type has a single entry.
220
+ */
134
221
  kind: 'singleType';
135
222
  }
136
223
  /**
137
- * Schema for a component
224
+ * Serves as a layout for a component type.
225
+ *
226
+ * Inherits and enhances various properties from the `BaseSchema`, the `ComponentSchema` is a unique derivative of the base schema that distinguishes itself with additional properties.
138
227
  */
139
228
  export interface ComponentSchema extends BaseSchema {
229
+ /**
230
+ * Forces the `modelType` to be a `component`.
231
+ *
232
+ * @remark Helpful to distinguish a {@link ComponentSchema} from a {@link ContentTypeSchema}
233
+ */
140
234
  modelType: 'component';
235
+ /**
236
+ * A unique identifier for the component.
237
+ *
238
+ * It uses `UID.Component` type which encapsulates unique identifiers for any component defined in the public component registry.
239
+ */
141
240
  uid: UID.Component;
241
+ /**
242
+ * A classification field for the component.
243
+ *
244
+ * This string type field is utilized to categorize components into different categories based on their function or feature.
245
+ */
142
246
  category: string;
143
247
  }
144
248
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/struct/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,KAAK,GAAG,MAAM,QAAQ,CAAC;AAEnC,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAEpD,MAAM,MAAM,MAAM,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,GAAG,EAAE,GAAG,CAA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