@strapi/types 5.0.0-rc.8 → 5.0.0
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/dist/core/controller.d.ts +1 -0
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/modules/cron.d.ts +3 -3
- package/dist/modules/cron.d.ts.map +1 -1
- package/dist/modules/documents/component-extension.d.ts +62 -11
- package/dist/modules/documents/component-extension.d.ts.map +1 -1
- package/dist/modules/documents/index.d.ts +1 -1
- package/dist/modules/documents/index.d.ts.map +1 -1
- package/dist/modules/documents/params/data.d.ts +63 -0
- package/dist/modules/documents/params/data.d.ts.map +1 -1
- package/dist/modules/documents/params/sort.d.ts +1 -1
- package/dist/modules/documents/params/sort.d.ts.map +1 -1
- package/dist/modules/documents/service-instance.d.ts +78 -30
- package/dist/modules/documents/service-instance.d.ts.map +1 -1
- package/dist/modules/entity-service/params/data.d.ts +48 -0
- package/dist/modules/entity-service/params/data.d.ts.map +1 -1
- package/package.json +12 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/core/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/core/controller.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC3D,MAAM,WAAW,iBAAiB,CAAC,SAAS,GAAG,OAAO;IACpD,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;CAC9E"}
|
package/dist/modules/cron.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Job } from 'node-schedule';
|
|
1
|
+
import type { Job, Spec } from 'node-schedule';
|
|
2
2
|
import type { Strapi } from '../core';
|
|
3
3
|
interface JobSpec {
|
|
4
4
|
job: Job;
|
|
5
|
-
options:
|
|
5
|
+
options: Spec;
|
|
6
6
|
name: string | null;
|
|
7
7
|
}
|
|
8
8
|
type TaskFn = ({ strapi }: {
|
|
@@ -10,7 +10,7 @@ type TaskFn = ({ strapi }: {
|
|
|
10
10
|
}, ...args: unknown[]) => Promise<unknown>;
|
|
11
11
|
type Task = TaskFn | {
|
|
12
12
|
task: TaskFn;
|
|
13
|
-
options:
|
|
13
|
+
options: Spec;
|
|
14
14
|
};
|
|
15
15
|
interface Tasks {
|
|
16
16
|
[key: string]: Task;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../src/modules/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../src/modules/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,UAAU,OAAO;IACf,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,KAAK,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvF,KAAK,IAAI,GACL,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEN,UAAU,KAAK;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAClC,KAAK,IAAI,WAAW,CAAC;IACrB,IAAI,IAAI,WAAW,CAAC;IACpB,OAAO,IAAI,WAAW,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB"}
|
|
@@ -1,22 +1,73 @@
|
|
|
1
|
-
import type { UID, Schema } from '../..';
|
|
2
|
-
import type
|
|
1
|
+
import type { UID, Schema, Utils } from '../..';
|
|
2
|
+
import type { Input, PartialInput } from './params/data';
|
|
3
3
|
import type * as AttributeUtils from './params/attributes';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Defines the structure of component bodies based on the given schema UID and component-like keys.
|
|
6
|
+
*
|
|
7
|
+
* It adapts based on whether schema registries have been extended, either mapping attribute names to
|
|
8
|
+
* their respective values or using a generic key-value structure if the registries have not been extended.
|
|
9
|
+
*
|
|
10
|
+
* @template TSchemaUID - The schema's UID, extending from {@link UID.Schema}, which determines the attribute names and types to use.
|
|
11
|
+
* @template TComponentLikeKeys - A string type representing the keys to keep that are component-like, defaults to a generic string.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Using `ComponentBody` in a situation where the schema registries have been extended:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* type MyComponentSchemaUID = 'default.mycomponent';
|
|
17
|
+
* type MyComponentBody = ComponentBody<MyComponentSchemaUID, 'header' | 'footer'>;
|
|
18
|
+
*
|
|
19
|
+
* // This resolves to:
|
|
20
|
+
* // {
|
|
21
|
+
* // header: AttributeUtils.GetValue<Schema.AttributeByName<MyComponentSchemaUID, 'header'>>;
|
|
22
|
+
* // footer: AttributeUtils.GetValue<Schema.AttributeByName<MyComponentSchemaUID, 'footer'>>;
|
|
23
|
+
* // }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* In cases where it's unknown whether schema registries have been extended:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* type GenericComponentBody = ComponentBody<UID.Schema>;
|
|
29
|
+
*
|
|
30
|
+
* // This resolves to:
|
|
31
|
+
* // {
|
|
32
|
+
* // [key: string]: AttributeUtils.GetValue<
|
|
33
|
+
* // | Schema.Attribute.Component<UID.Component, false>
|
|
34
|
+
* // | Schema.Attribute.Component<UID.Component, true>
|
|
35
|
+
* // | Schema.Attribute.DynamicZone
|
|
36
|
+
* // >;
|
|
37
|
+
* // }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @todo: Move to common data structures and make it available for other use
|
|
41
|
+
*/
|
|
42
|
+
type ComponentBody<TSchemaUID extends UID.Schema = UID.Schema, TComponentLikeKeys extends string = string> = Utils.If<Utils.Constants.AreSchemaRegistriesExtended, {
|
|
43
|
+
[TAttributeName in Extract<Schema.AttributeNamesByType<TSchemaUID, 'component' | 'dynamiczone'>, TComponentLikeKeys>]: AttributeUtils.GetValue<Schema.AttributeByName<TSchemaUID, TAttributeName>>;
|
|
44
|
+
}, {
|
|
5
45
|
[key: string]: AttributeUtils.GetValue<Schema.Attribute.Component<UID.Component, false> | Schema.Attribute.Component<UID.Component, true> | Schema.Attribute.DynamicZone>;
|
|
6
|
-
}
|
|
7
|
-
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Provides methods to manipulate component data in input payloads.
|
|
49
|
+
*
|
|
50
|
+
* @template TSchemaUID - Represents a unique identifier for a schema, extending {@link UID.Schema}.
|
|
51
|
+
*/
|
|
52
|
+
export type ComponentExtension<TSchemaUID extends UID.Schema> = {
|
|
8
53
|
/**
|
|
54
|
+
* Update the component data for a given entity.
|
|
55
|
+
*
|
|
56
|
+
* @remark This method is exposed for use within document service middlewares.
|
|
57
|
+
*
|
|
9
58
|
* @internal
|
|
10
|
-
* Exposed for use within document service middlewares
|
|
11
59
|
*/
|
|
12
|
-
updateComponents
|
|
13
|
-
id:
|
|
14
|
-
}, data:
|
|
60
|
+
updateComponents<const TData extends Input<TSchemaUID>>(entityToUpdate: {
|
|
61
|
+
id: AttributeUtils.ID;
|
|
62
|
+
}, data: TData): Promise<ComponentBody<TSchemaUID, Extract<keyof TData, string>>>;
|
|
15
63
|
/**
|
|
64
|
+
* Omits component-like fields from the given input data.
|
|
65
|
+
*
|
|
66
|
+
* @remark This method is exposed for use within document service middlewares.
|
|
67
|
+
*
|
|
16
68
|
* @internal
|
|
17
|
-
* Exposed for use within document service middlewares
|
|
18
69
|
*/
|
|
19
|
-
omitComponentData
|
|
70
|
+
omitComponentData<const TData extends PartialInput<TSchemaUID>>(data: TData): TData;
|
|
20
71
|
};
|
|
21
72
|
export {};
|
|
22
73
|
//# sourceMappingURL=component-extension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-extension.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/component-extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"component-extension.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/component-extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,KAAK,aAAa,CAChB,UAAU,SAAS,GAAG,CAAC,MA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15
|
export type Service = {
|
|
16
|
-
<TContentTypeUID extends UID.ContentType>(uid: TContentTypeUID): ServiceInstance<TContentTypeUID> & ComponentExtension
|
|
16
|
+
<TContentTypeUID extends UID.ContentType>(uid: TContentTypeUID): ServiceInstance<TContentTypeUID> & ComponentExtension<TContentTypeUID>;
|
|
17
17
|
utils: ServiceUtils;
|
|
18
18
|
/** Add a middleware for all uid's and a specific action
|
|
19
19
|
* @example - Add a default locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AAEnC,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAExB,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,eAAe,SAAS,GAAG,CAAC,WAAW,EACtC,GAAG,EAAE,eAAe,GACnB,eAAe,CAAC,eAAe,CAAC,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AAEnC,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAExB,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,eAAe,SAAS,GAAG,CAAC,WAAW,EACtC,GAAG,EAAE,eAAe,GACnB,eAAe,CAAC,eAAe,CAAC,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAE1E,KAAK,EAAE,YAAY,CAAC;IAEpB;;;;;;OAMG;IACH,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,UAAU,KAAK,OAAO,CAAC;CAC7C,CAAC"}
|
|
@@ -1,4 +1,67 @@
|
|
|
1
1
|
import type * as UID from '../../../uid';
|
|
2
|
+
import type * as Utils from '../../../utils';
|
|
2
3
|
import type * as AttributeUtils from './attributes';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the input data for a given content-type UID.
|
|
6
|
+
*
|
|
7
|
+
* This type evaluates the schema based on the given content-type UID, and extracts the attribute values
|
|
8
|
+
* accordingly.
|
|
9
|
+
*
|
|
10
|
+
* It combines optional and required attributes, while excluding certain relational attributes
|
|
11
|
+
* that don't target specific schemas like polymorphic relations.
|
|
12
|
+
*
|
|
13
|
+
* @template TSchemaUID - A unique identifier for a schema, extending {@link UID.Schema}.
|
|
14
|
+
*
|
|
15
|
+
* @remark
|
|
16
|
+
* The attributes' values are customized to allow additional input formats that are going to be
|
|
17
|
+
* transformed in the document service methods.
|
|
18
|
+
*
|
|
19
|
+
* For example, relational attributes can use the re-ordering API.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* Defining input for a content type schema:
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type { UID } from '@strapi/types';
|
|
26
|
+
*
|
|
27
|
+
* // Assume there's a schema with a UID of 'api::article.article'
|
|
28
|
+
* type ArticleInput = Input<'api::article.article'>;
|
|
29
|
+
*
|
|
30
|
+
* // Example usage of ArticleInput with typed attributes
|
|
31
|
+
* const articleData: ArticleInput = {
|
|
32
|
+
* title: 'My Article', // Required title property
|
|
33
|
+
* content: 'Content of the article', // Required content property
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* Handling component schema with optional and required attributes:
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import type { UID } from '@strapi/types';
|
|
42
|
+
*
|
|
43
|
+
* // Assume there's a component with a UID of 'default.comment'
|
|
44
|
+
* type CommentInput = Input<'default.comment'>;
|
|
45
|
+
*
|
|
46
|
+
* const commentData: CommentInput = {
|
|
47
|
+
* text: 'Great article!', // Required text property
|
|
48
|
+
* author: 'John Doe', // Optional author property
|
|
49
|
+
* };
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
3
52
|
export type Input<TSchemaUID extends UID.Schema> = AttributeUtils.GetValues<TSchemaUID>;
|
|
53
|
+
/**
|
|
54
|
+
* Conditionally applies partial types to schema input data based on the extension status of schema registries.
|
|
55
|
+
*
|
|
56
|
+
* This type evaluates whether the schema registries have been extended.
|
|
57
|
+
*
|
|
58
|
+
* If so, it returns a partial version of `Input<TSchemaUID>`, otherwise it returns the default `Input` type.
|
|
59
|
+
*
|
|
60
|
+
* @template TSchemaUID - Represents a unique identifier for a schema, either content-type or component, extending {@link UID.Schema}.
|
|
61
|
+
*
|
|
62
|
+
* @remark
|
|
63
|
+
* This type is particularly useful for ensuring backward compatibility within input data structures,
|
|
64
|
+
* enabling flexibility during schema transitions or extensions without breaking existing data contracts.
|
|
65
|
+
*/
|
|
66
|
+
export type PartialInput<TSchemaUID extends UID.Schema> = Utils.If<Utils.Constants.AreSchemaRegistriesExtended, Partial<Input<TSchemaUID>>, Input<TSchemaUID>>;
|
|
4
67
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/modules/documents/params/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/modules/documents/params/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,KAAK,cAAc,MAAM,cAAc,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,MAAM,KAAK,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAExF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAChE,KAAK,CAAC,SAAS,CAAC,2BAA2B,EAC3C,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAC1B,KAAK,CAAC,UAAU,CAAC,CAClB,CAAC"}
|
|
@@ -49,7 +49,7 @@ export type StringNotation<TSchemaUID extends UID.Schema> = SingleAttribute<TSch
|
|
|
49
49
|
* type E = [42]; // ❌
|
|
50
50
|
* type F = 'title'; // ❌
|
|
51
51
|
*/
|
|
52
|
-
export type ArrayNotation<TSchemaUID extends UID.Schema> =
|
|
52
|
+
export type ArrayNotation<TSchemaUID extends UID.Schema> = StringNotation<TSchemaUID>[] | ObjectNotation<TSchemaUID>[];
|
|
53
53
|
/**
|
|
54
54
|
* Object notation for a sort
|
|
55
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../src/modules/documents/params/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,yBAAiB,SAAS,CAAC;IACzB,KAAY,GAAG,GAAG,KAAK,CAAC;IACxB,KAAY,IAAI,GAAG,MAAM,CAAC;IAE1B,KAAY,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,KAAK,eAAe,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAC9C,IAAI,GACJ,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,4BAA4B,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,KAAK,sBAAsB,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IACvD,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,GAAG,EAAE,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IACpD,eAAe,CAAC,UAAU,CAAC,GAC3B,sBAAsB,CAAC,UAAU,CAAC,GAElC,GAAG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AM,cAAc,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI;KAEzD,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;CACrD,GAAG;KAGD,GAAG,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,cAAc,CACnE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CACjE;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,GAAG,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IACzC,cAAc,CAAC,UAAU,CAAC,GAC1B,aAAa,CAAC,UAAU,CAAC,GACzB,cAAc,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,48 +1,96 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as Utils from '../../utils';
|
|
2
2
|
import type * as UID from '../../uid';
|
|
3
3
|
import type { IsDraftAndPublishEnabled } from './draft-and-publish';
|
|
4
4
|
import type * as Params from './params/document-engine';
|
|
5
5
|
import type * as Result from './result/document-engine';
|
|
6
|
+
export type ServiceInstance<TContentTypeUID extends UID.ContentType = UID.ContentType> = {
|
|
7
|
+
findMany<const TParams extends Params.FindMany<TContentTypeUID>>(params?: TParams): Result.FindMany<TContentTypeUID, TParams>;
|
|
8
|
+
findFirst<const TParams extends Params.FindFirst<TContentTypeUID>>(params?: TParams): Result.FindFirst<TContentTypeUID, TParams>;
|
|
9
|
+
findOne<const TParams extends Params.FindOne<TContentTypeUID>>(params: TParams): Result.FindOne<TContentTypeUID, TParams>;
|
|
10
|
+
delete<const TParams extends Params.Delete<TContentTypeUID>>(params: TParams): Result.Delete<TContentTypeUID, TParams>;
|
|
11
|
+
create<const TParams extends Params.Create<TContentTypeUID>>(params: TParams): Result.Create<TContentTypeUID, TParams>;
|
|
12
|
+
update<const TParams extends Params.Update<TContentTypeUID>>(params: TParams): Result.Update<TContentTypeUID, TParams>;
|
|
13
|
+
count<const TParams extends Params.Count<TContentTypeUID>>(params: TParams): Result.Count;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
clone<const TParams extends Params.Clone<TContentTypeUID>>(params: TParams): Result.Clone<TContentTypeUID, TParams>;
|
|
18
|
+
} & Utils.If<IsDraftAndPublishEnabled<TContentTypeUID>, DraftAndPublishExtension<TContentTypeUID>, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Provides methods for managing the draft and publish lifecycle of a document.
|
|
21
|
+
*
|
|
22
|
+
* This interface handles publishing, unpublishing, and discarding
|
|
23
|
+
* drafts of documents identified by their unique identifier.
|
|
24
|
+
*
|
|
25
|
+
* @template TContentTypeUID - The unique identifier type for the content-type, constrained to {@link UID.ContentType}.
|
|
26
|
+
*/
|
|
27
|
+
export interface DraftAndPublishExtension<TContentTypeUID extends UID.ContentType = UID.ContentType> {
|
|
28
|
+
/**
|
|
29
|
+
* Publishes the current draft for the given document ID.
|
|
30
|
+
*/
|
|
31
|
+
publish<const TParams extends Params.Publish<TContentTypeUID>>(params: TParams): Result.Publish<TContentTypeUID, TParams>;
|
|
32
|
+
/**
|
|
33
|
+
* Unpublishes a document for the given document ID.
|
|
34
|
+
*/
|
|
35
|
+
unpublish<const TParams extends Params.Unpublish<TContentTypeUID>>(params: TParams): Result.Unpublish<TContentTypeUID, TParams>;
|
|
36
|
+
/**
|
|
37
|
+
* Discards the draft entry for the given document ID and params.
|
|
38
|
+
*/
|
|
39
|
+
discardDraft<const TParams extends Params.DiscardDraft<TContentTypeUID>>(params: TParams): Result.DiscardDraft<TContentTypeUID, TParams>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents the parameters for various service operations on content types.
|
|
43
|
+
*
|
|
44
|
+
* This type aggregates different sets of parameters required for performing operations such as
|
|
45
|
+
* finding, creating, updating, deleting, cloning, and publishing content within a content management system.
|
|
46
|
+
*
|
|
47
|
+
* Each operation has its own set of parameters defined using different subtypes.
|
|
48
|
+
*
|
|
49
|
+
* @template TContentTypeUID - Extends {@link UID.ContentType}, used to specify the unique identifier for a content-type.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* Example of how to specify parameters for different operations on a content-type:
|
|
53
|
+
*
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import type { UID } from '../../uid';
|
|
56
|
+
*
|
|
57
|
+
* type ArticleServiceParams = ServiceParams<'api::article.article'>;
|
|
58
|
+
*
|
|
59
|
+
* // Example: Parameters for finding multiple articles
|
|
60
|
+
* const findManyParams: ArticleServiceParams['findMany'] = {
|
|
61
|
+
* fields: ['title', 'content'],
|
|
62
|
+
* filters: { status: 'published' },
|
|
63
|
+
* sort: { createdAt: 'desc' }
|
|
64
|
+
* };
|
|
65
|
+
*
|
|
66
|
+
* // Example: Parameters for creating a new article
|
|
67
|
+
* const createParams: ArticleServiceParams['create'] = {
|
|
68
|
+
* data: { title: 'New Article', content: 'Article content', status: 'draft' }
|
|
69
|
+
* };
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
6
72
|
export type ServiceParams<TContentTypeUID extends UID.ContentType = UID.ContentType> = {
|
|
73
|
+
/** Parameters for finding multiple documents */
|
|
7
74
|
findMany: Params.FindMany<TContentTypeUID>;
|
|
75
|
+
/** Parameters for finding a single document */
|
|
8
76
|
findFirst: Params.FindFirst<TContentTypeUID>;
|
|
77
|
+
/** Parameters for finding a single document by its ID */
|
|
9
78
|
findOne: Params.FindOne<TContentTypeUID>;
|
|
79
|
+
/** Parameters for deleting a single document */
|
|
10
80
|
delete: Params.Delete<TContentTypeUID>;
|
|
81
|
+
/** Parameters for creating a new document */
|
|
11
82
|
create: Params.Create<TContentTypeUID>;
|
|
83
|
+
/** Parameters for cloning an existing document */
|
|
12
84
|
clone: Params.Clone<TContentTypeUID>;
|
|
85
|
+
/** Parameters for updating an existing document */
|
|
13
86
|
update: Params.Update<TContentTypeUID>;
|
|
87
|
+
/** Parameters for counting the number of documents */
|
|
14
88
|
count: Params.Count<TContentTypeUID>;
|
|
89
|
+
/** Parameters for publishing a document */
|
|
15
90
|
publish: Params.Publish<TContentTypeUID>;
|
|
91
|
+
/** Parameters for unpublishing a document */
|
|
16
92
|
unpublish: Params.Unpublish<TContentTypeUID>;
|
|
93
|
+
/** Parameters for discarding a draft of a document */
|
|
17
94
|
discardDraft: Params.DiscardDraft<TContentTypeUID>;
|
|
18
95
|
};
|
|
19
|
-
export type ServiceResults<TContentTypeUID extends UID.ContentType = UID.ContentType> = {
|
|
20
|
-
findMany: Result.FindMany<TContentTypeUID, Params.FindMany<TContentTypeUID>>;
|
|
21
|
-
findFirst: Result.FindFirst<TContentTypeUID, Params.FindFirst<TContentTypeUID>>;
|
|
22
|
-
findOne: Result.FindOne<TContentTypeUID, Params.FindOne<TContentTypeUID>>;
|
|
23
|
-
delete: Result.Delete<TContentTypeUID, Params.Delete<TContentTypeUID>>;
|
|
24
|
-
create: Result.Create<TContentTypeUID, Params.Create<TContentTypeUID>>;
|
|
25
|
-
clone: Result.Clone<TContentTypeUID, Params.Clone<TContentTypeUID>>;
|
|
26
|
-
update: Result.Update<TContentTypeUID, Params.Update<TContentTypeUID>>;
|
|
27
|
-
count: Result.Count;
|
|
28
|
-
publish: Result.Publish<TContentTypeUID, Params.Publish<TContentTypeUID>>;
|
|
29
|
-
unpublish: Result.Unpublish<TContentTypeUID, Params.Unpublish<TContentTypeUID>>;
|
|
30
|
-
discardDraft: Result.DiscardDraft<TContentTypeUID, Params.DiscardDraft<TContentTypeUID>>;
|
|
31
|
-
};
|
|
32
|
-
export type ServiceInstance<TContentTypeUID extends UID.ContentType = UID.ContentType, TServiceParams extends ServiceParams<TContentTypeUID> = ServiceParams<TContentTypeUID>, TServiceResults extends ServiceResults<TContentTypeUID> = ServiceResults<TContentTypeUID>> = {
|
|
33
|
-
findMany: (params?: TServiceParams['findMany']) => TServiceResults['findMany'];
|
|
34
|
-
findFirst: (params?: TServiceParams['findFirst']) => TServiceResults['findFirst'];
|
|
35
|
-
findOne: (params: TServiceParams['findOne']) => TServiceResults['findOne'];
|
|
36
|
-
delete: (params: TServiceParams['delete']) => TServiceResults['delete'];
|
|
37
|
-
create: (params: TServiceParams['create']) => TServiceResults['create'];
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
clone: (params: TServiceParams['clone']) => TServiceResults['clone'];
|
|
42
|
-
update: (params: TServiceParams['update']) => TServiceResults['update'];
|
|
43
|
-
count: (params?: TServiceParams['count']) => TServiceResults['count'];
|
|
44
|
-
publish: Utils.If<IsDraftAndPublishEnabled<TContentTypeUID>, (params: TServiceParams['publish']) => TServiceResults['publish'], never>;
|
|
45
|
-
unpublish: Utils.If<IsDraftAndPublishEnabled<TContentTypeUID>, (params: TServiceParams['unpublish']) => TServiceResults['unpublish'], never>;
|
|
46
|
-
discardDraft: Utils.If<IsDraftAndPublishEnabled<TContentTypeUID>, (params: TServiceParams['discardDraft']) => TServiceResults['discardDraft'], never>;
|
|
47
|
-
};
|
|
48
96
|
//# sourceMappingURL=service-instance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-instance.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/service-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"service-instance.d.ts","sourceRoot":"","sources":["../../../src/modules/documents/service-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAExD,MAAM,MAAM,eAAe,CAAC,eAAe,SAAS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,CAAC;IAEzC,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAEvC,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAEvC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAErC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAEvC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAErC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAEzC,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAE7C,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC"}
|
|
@@ -1,4 +1,52 @@
|
|
|
1
1
|
import type * as UID from '../../../uid';
|
|
2
2
|
import type * as AttributeUtils from './attributes';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the input data for a given content-type UID.
|
|
5
|
+
*
|
|
6
|
+
* This type evaluates the schema based on the given content-type UID, and extracts the attribute values
|
|
7
|
+
* accordingly.
|
|
8
|
+
*
|
|
9
|
+
* It combines optional and required attributes, while excluding certain relational attributes
|
|
10
|
+
* that don't target specific schemas like polymorphic relations.
|
|
11
|
+
*
|
|
12
|
+
* @template TSchemaUID - A unique identifier for a schema, extending {@link UID.Schema}.
|
|
13
|
+
*
|
|
14
|
+
* @remark
|
|
15
|
+
* The attributes' values are customized to allow additional input formats that are going to be
|
|
16
|
+
* transformed in the document service methods.
|
|
17
|
+
*
|
|
18
|
+
* For example, relational attributes can use the re-ordering API.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* Defining input for a content type schema:
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { UID } from '@strapi/types';
|
|
25
|
+
*
|
|
26
|
+
* // Assume there's a schema with a UID of 'api::article.article'
|
|
27
|
+
* type ArticleInput = Input<'api::article.article'>;
|
|
28
|
+
*
|
|
29
|
+
* // Example usage of ArticleInput with typed attributes
|
|
30
|
+
* const articleData: ArticleInput = {
|
|
31
|
+
* title: 'My Article', // Required title property
|
|
32
|
+
* content: 'Content of the article', // Required content property
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* Handling component schema with optional and required attributes:
|
|
38
|
+
*
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import type { UID } from '@strapi/types';
|
|
41
|
+
*
|
|
42
|
+
* // Assume there's a component with a UID of 'default.comment'
|
|
43
|
+
* type CommentInput = Input<'default.comment'>;
|
|
44
|
+
*
|
|
45
|
+
* const commentData: CommentInput = {
|
|
46
|
+
* text: 'Great article!', // Required text property
|
|
47
|
+
* author: 'John Doe', // Optional author property
|
|
48
|
+
* };
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
3
51
|
export type Input<TSchemaUID extends UID.Schema> = AttributeUtils.GetValues<TSchemaUID>;
|
|
4
52
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/modules/entity-service/params/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,cAAc,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,KAAK,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/modules/entity-service/params/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,cAAc,MAAM,cAAc,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,MAAM,KAAK,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,IAAI,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/types",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Shared typescript types for Strapi internal use",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi"
|
|
@@ -46,13 +46,14 @@
|
|
|
46
46
|
"@casl/ability": "6.5.0",
|
|
47
47
|
"@koa/cors": "5.0.0",
|
|
48
48
|
"@koa/router": "12.0.1",
|
|
49
|
-
"@strapi/database": "5.0.0
|
|
50
|
-
"@strapi/logger": "5.0.0
|
|
51
|
-
"@strapi/permissions": "5.0.0
|
|
52
|
-
"@strapi/utils": "5.0.0
|
|
49
|
+
"@strapi/database": "5.0.0",
|
|
50
|
+
"@strapi/logger": "5.0.0",
|
|
51
|
+
"@strapi/permissions": "5.0.0",
|
|
52
|
+
"@strapi/utils": "5.0.0",
|
|
53
53
|
"commander": "8.3.0",
|
|
54
54
|
"koa": "2.15.2",
|
|
55
|
-
"
|
|
55
|
+
"koa-body": "6.0.1",
|
|
56
|
+
"node-schedule": "2.1.1",
|
|
56
57
|
"typedoc": "0.25.10",
|
|
57
58
|
"typedoc-github-wiki-theme": "1.1.0",
|
|
58
59
|
"typedoc-plugin-markdown": "3.17.1"
|
|
@@ -63,16 +64,16 @@
|
|
|
63
64
|
"@types/jest": "29.5.2",
|
|
64
65
|
"@types/koa": "2.13.4",
|
|
65
66
|
"@types/koa__router": "12.0.0",
|
|
66
|
-
"@types/node-schedule": "2.1.
|
|
67
|
-
"eslint-config-custom": "5.0.0
|
|
67
|
+
"@types/node-schedule": "2.1.7",
|
|
68
|
+
"eslint-config-custom": "5.0.0",
|
|
68
69
|
"lodash": "4.17.21",
|
|
69
|
-
"tsconfig": "5.0.0
|
|
70
|
+
"tsconfig": "5.0.0",
|
|
70
71
|
"typescript": "5.3.2",
|
|
71
|
-
"undici": "6.
|
|
72
|
+
"undici": "6.19.2"
|
|
72
73
|
},
|
|
73
74
|
"engines": {
|
|
74
75
|
"node": ">=18.0.0 <=20.x.x",
|
|
75
76
|
"npm": ">=6.0.0"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "ce84fada19d58a7dfbdd553035e6558f8befcba4"
|
|
78
79
|
}
|