1 | import type { BasicMetaSysProps, DefaultElements, GetSpaceEnvironmentParams, GetWorkflowParams, Link, MakeRequest, PaginationQueryOptions, SysLink } from '../common-types';
|
2 | export type WorkflowSysProps = Pick<BasicMetaSysProps, 'id' | 'version' | 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy'> & {
|
3 | type: 'Workflow';
|
4 | space: SysLink;
|
5 | environment: SysLink;
|
6 | completedBy?: SysLink;
|
7 | completedAt?: string;
|
8 | deletedBy?: SysLink;
|
9 | deletedAt?: string;
|
10 | entity: Link<'Entry'>;
|
11 | workflowDefinition: Link<'WorkflowDefinition'>;
|
12 | };
|
13 | export type WorkflowProps = {
|
14 | sys: WorkflowSysProps;
|
15 | stepId?: string;
|
16 | };
|
17 | export type CreateWorkflowProps = Omit<WorkflowProps, 'sys'> & {
|
18 | entity: Link<'Entry'>;
|
19 | workflowDefinition: Link<'WorkflowDefinition'>;
|
20 | };
|
21 | export type UpdateWorkflowProps = Omit<WorkflowProps, 'sys'> & {
|
22 | sys: Pick<WorkflowSysProps, 'version'>;
|
23 | };
|
24 | export type CreateWorkflowParams = GetSpaceEnvironmentParams;
|
25 | export type UpdateWorkflowParams = GetWorkflowParams;
|
26 | export type DeleteWorkflowParams = GetWorkflowParams & {
|
27 | version: number;
|
28 | };
|
29 | export type CompleteWorkflowParams = DeleteWorkflowParams;
|
30 | type WorkflowApi = {
|
31 | update(): Promise<Workflow>;
|
32 | delete(): Promise<void>;
|
33 | complete(): Promise<void>;
|
34 | };
|
35 | type OrderQueryParam = 'sys.updatedAt' | '-sys.updatedAt' | 'sys.createdAt' | '-sys.createdAt';
|
36 | export interface Workflow extends WorkflowProps, DefaultElements<WorkflowProps>, WorkflowApi {
|
37 | }
|
38 | export type WorkflowQueryOptions = Omit<PaginationQueryOptions, 'order'> & {
|
39 | 'stepId[in]'?: string;
|
40 |
|
41 | 'sys.entity.sys.linkType'?: string;
|
42 |
|
43 | 'sys.entity.sys.id[in]'?: string;
|
44 | 'sys.workflowDefinition.sys.id'?: string;
|
45 | |
46 |
|
47 |
|
48 |
|
49 | order?: OrderQueryParam;
|
50 | };
|
51 |
|
52 |
|
53 |
|
54 | export default function createWorkflowApi(makeRequest: MakeRequest): WorkflowApi;
|
55 |
|
56 |
|
57 |
|
58 | export declare function wrapWorkflow(makeRequest: MakeRequest, data: WorkflowProps): Workflow;
|
59 |
|
60 |
|
61 |
|
62 | export declare const wrapWorkflowCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<WorkflowProps>) => import("../common-types").Collection<Workflow, WorkflowProps>;
|
63 | export {};
|