@webiny/api-apw 5.25.0 → 5.30.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/ContentApwSettingsPlugin.d.ts +10 -0
- package/ContentApwSettingsPlugin.js +17 -0
- package/ContentApwSettingsPlugin.js.map +1 -0
- package/README.md +7 -6
- package/{createApw → crud}/createChangeRequestMethods.d.ts +0 -0
- package/{createApw → crud}/createChangeRequestMethods.js +0 -0
- package/crud/createChangeRequestMethods.js.map +1 -0
- package/{createApw → crud}/createCommentMethods.d.ts +0 -0
- package/{createApw → crud}/createCommentMethods.js +0 -0
- package/crud/createCommentMethods.js.map +1 -0
- package/crud/createContentReviewMethods.d.ts +10 -0
- package/{createApw → crud}/createContentReviewMethods.js +269 -19
- package/crud/createContentReviewMethods.js.map +1 -0
- package/{createApw → crud}/createReviewerMethods.d.ts +0 -0
- package/{createApw → crud}/createReviewerMethods.js +0 -0
- package/crud/createReviewerMethods.js.map +1 -0
- package/{createApw → crud}/createWorkflowMethods.d.ts +0 -0
- package/{createApw → crud}/createWorkflowMethods.js +0 -0
- package/crud/createWorkflowMethods.js.map +1 -0
- package/{createApw → crud}/index.d.ts +0 -0
- package/{createApw → crud}/index.js +55 -11
- package/crud/index.js.map +1 -0
- package/crud/utils.d.ts +21 -0
- package/crud/utils.js +142 -0
- package/crud/utils.js.map +1 -0
- package/index.d.ts +4 -2
- package/index.js +11 -5
- package/index.js.map +1 -1
- package/package.json +37 -30
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +10 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +51 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -0
- package/plugins/cms/README.md +49 -0
- package/plugins/cms/apwEntryPlugins.d.ts +8 -0
- package/plugins/cms/apwEntryPlugins.js +50 -0
- package/plugins/cms/apwEntryPlugins.js.map +1 -0
- package/plugins/cms/index.d.ts +12 -0
- package/plugins/cms/index.js +37 -0
- package/plugins/cms/index.js.map +1 -0
- package/plugins/cms/linkContentReviewToEntry.d.ts +8 -0
- package/plugins/cms/linkContentReviewToEntry.js +108 -0
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -0
- package/plugins/cms/linkWorkflowToEntry.d.ts +8 -0
- package/plugins/cms/linkWorkflowToEntry.js +166 -0
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -0
- package/plugins/cms/triggerContentReview.d.ts +8 -0
- package/plugins/cms/triggerContentReview.js +59 -0
- package/plugins/cms/triggerContentReview.js.map +1 -0
- package/plugins/cms/updateContentReviewStatus.d.ts +10 -0
- package/plugins/cms/updateContentReviewStatus.js +101 -0
- package/plugins/cms/updateContentReviewStatus.js.map +1 -0
- package/plugins/cms/utils.d.ts +27 -0
- package/plugins/cms/utils.js +211 -0
- package/plugins/cms/utils.js.map +1 -0
- package/plugins/context.d.ts +3 -2
- package/plugins/context.js +82 -49
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +1 -1
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +8 -17
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +168 -13
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +1 -1
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +18 -15
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.d.ts +3 -2
- package/plugins/graphql.js +11 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +18 -0
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +8 -8
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +6 -6
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.d.ts +1 -2
- package/plugins/hooks/index.js +25 -25
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.d.ts +2 -7
- package/plugins/hooks/initializeContentReviewSteps.js +42 -24
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +27 -39
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.d.ts +3 -0
- package/plugins/hooks/updateTotalComments.js +157 -0
- package/plugins/hooks/updateTotalComments.js.map +1 -0
- package/plugins/hooks/validateChangeRequest.d.ts +2 -0
- package/plugins/hooks/validateChangeRequest.js +64 -0
- package/plugins/hooks/validateChangeRequest.js.map +1 -0
- package/plugins/hooks/validateComment.d.ts +2 -0
- package/plugins/hooks/validateComment.js +45 -0
- package/plugins/hooks/validateComment.js.map +1 -0
- package/plugins/hooks/validateContentReview.d.ts +2 -0
- package/plugins/hooks/validateContentReview.js +38 -0
- package/plugins/hooks/validateContentReview.js.map +1 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
- package/plugins/{hooks/extendPbPageSchema.d.ts → pageBuilder/extendPbPageSettingsSchema.d.ts} +1 -2
- package/plugins/{hooks/extendPbPageSchema.js → pageBuilder/extendPbPageSettingsSchema.js} +4 -3
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
- package/plugins/pageBuilder/index.d.ts +11 -0
- package/plugins/pageBuilder/index.js +45 -0
- package/plugins/pageBuilder/index.js.map +1 -0
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js +93 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
- package/plugins/pageBuilder/linkWorkflowToPage.js +182 -0
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
- package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
- package/plugins/pageBuilder/triggerContentReview.js +50 -0
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js +83 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
- package/plugins/pageBuilder/utils.d.ts +22 -0
- package/plugins/pageBuilder/utils.js +184 -0
- package/plugins/pageBuilder/utils.js.map +1 -0
- package/plugins/utils.d.ts +22 -2
- package/plugins/utils.js +128 -2
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.d.ts +2 -0
- package/scheduler/createScheduleActionMethods.js +146 -0
- package/scheduler/createScheduleActionMethods.js.map +1 -0
- package/scheduler/handlers/executeAction/index.d.ts +16 -0
- package/scheduler/handlers/executeAction/index.js +148 -0
- package/scheduler/handlers/executeAction/index.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/security.d.ts +4 -0
- package/scheduler/handlers/executeAction/security.js +68 -0
- package/scheduler/handlers/executeAction/security.js.map +1 -0
- package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
- package/scheduler/handlers/scheduleAction/index.js +162 -0
- package/scheduler/handlers/scheduleAction/index.js.map +1 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +176 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
- package/scheduler/handlers/utils.d.ts +33 -0
- package/scheduler/handlers/utils.js +168 -0
- package/scheduler/handlers/utils.js.map +1 -0
- package/scheduler/index.d.ts +2 -0
- package/scheduler/index.js +27 -0
- package/scheduler/index.js.map +1 -0
- package/scheduler/types.d.ts +171 -0
- package/scheduler/types.js +34 -0
- package/scheduler/types.js.map +1 -0
- package/storageOperations/changeRequestStorageOperations.js +1 -3
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +25 -11
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +1 -3
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -0
- package/storageOperations/models/changeRequest.model.js +10 -5
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -0
- package/storageOperations/models/comment.model.js +24 -3
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +2 -2
- package/storageOperations/models/contentModelPluginFactory.js +2 -2
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -0
- package/storageOperations/models/contentReview.model.js +98 -26
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +25 -5
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -0
- package/storageOperations/models/reviewer.model.js +11 -6
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +2 -1
- package/storageOperations/models/workflow.model.js +32 -30
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +1 -3
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +21 -7
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +138 -49
- package/types.js +9 -3
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.d.ts +9 -0
- package/utils/contentApwSettingsPlugin.js +26 -0
- package/utils/contentApwSettingsPlugin.js.map +1 -0
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +2 -2
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.js.map +1 -1
- package/createApw/createChangeRequestMethods.js.map +0 -1
- package/createApw/createCommentMethods.js.map +0 -1
- package/createApw/createContentReviewMethods.d.ts +0 -6
- package/createApw/createContentReviewMethods.js.map +0 -1
- package/createApw/createReviewerMethods.js.map +0 -1
- package/createApw/createWorkflowMethods.js.map +0 -1
- package/createApw/index.js.map +0 -1
- package/plugins/createManageCMSPlugin.d.ts +0 -2
- package/plugins/createManageCMSPlugin.js +0 -31
- package/plugins/createManageCMSPlugin.js.map +0 -1
- package/plugins/hooks/extendPbPageSchema.js.map +0 -1
- package/plugins/hooks/linkWorkflowToPage.d.ts +0 -9
- package/plugins/hooks/linkWorkflowToPage.js +0 -155
- package/plugins/hooks/linkWorkflowToPage.js.map +0 -1
package/types.d.ts
CHANGED
@@ -1,12 +1,31 @@
|
|
1
|
-
|
2
|
-
import { Page, OnBeforePageCreateFromTopicParams } from "@webiny/api-page-builder/types";
|
3
|
-
import { CmsContext, CmsModel } from "@webiny/api-headless-cms/types";
|
1
|
+
import { CmsContext, CmsEntry as BaseCmsEntry, CmsModel, BeforeEntryPublishTopicParams, AfterEntryPublishTopicParams, AfterEntryUnpublishTopicParams } from "@webiny/api-headless-cms/types";
|
2
|
+
import { Page, OnBeforePageCreateTopicParams, OnBeforePageCreateFromTopicParams, OnBeforePageUpdateTopicParams, OnBeforePagePublishTopicParams, OnBeforePageRequestReviewTopicParams, PageSettings } from "@webiny/api-page-builder/types";
|
4
3
|
import { Context } from "@webiny/handler/types";
|
5
4
|
import { PageBuilderContextObject } from "@webiny/api-page-builder/graphql/types";
|
6
5
|
import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
|
7
6
|
import { I18NLocale } from "@webiny/api-i18n/types";
|
8
7
|
import { Tenant } from "@webiny/api-tenancy/types";
|
9
8
|
import { Topic } from "@webiny/pubsub/types";
|
9
|
+
import { ApwScheduleActionCrud, ScheduleActionContext } from "./scheduler/types";
|
10
|
+
import HandlerClient from "@webiny/handler-client/HandlerClient";
|
11
|
+
import { PluginsContainer } from "@webiny/plugins";
|
12
|
+
import { WcpContextObject } from "@webiny/api-wcp/types";
|
13
|
+
export interface ApwCmsEntry extends BaseCmsEntry {
|
14
|
+
title: string;
|
15
|
+
meta: {
|
16
|
+
apw?: {
|
17
|
+
contentReviewId?: string | null;
|
18
|
+
workflowId?: string | null;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
}
|
22
|
+
export interface ApwFile {
|
23
|
+
id: string;
|
24
|
+
key: string;
|
25
|
+
size: number;
|
26
|
+
type: string;
|
27
|
+
name: string;
|
28
|
+
}
|
10
29
|
export interface ListWhere {
|
11
30
|
/**
|
12
31
|
* Fields.
|
@@ -24,7 +43,7 @@ export interface ListWhere {
|
|
24
43
|
createdBy_not_in?: string[];
|
25
44
|
}
|
26
45
|
export interface ListParams {
|
27
|
-
where
|
46
|
+
where?: ListWhere;
|
28
47
|
sort?: string[];
|
29
48
|
limit?: number;
|
30
49
|
after?: string | null;
|
@@ -47,20 +66,23 @@ export declare enum ApwContentTypes {
|
|
47
66
|
PAGE = "page",
|
48
67
|
CMS_ENTRY = "cms_entry"
|
49
68
|
}
|
50
|
-
export interface
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
};
|
69
|
+
export interface PageSettingsWithWorkflow extends PageSettings {
|
70
|
+
apw: {
|
71
|
+
workflowId: string;
|
72
|
+
contentReviewId: string | null;
|
55
73
|
};
|
56
74
|
}
|
57
|
-
export interface
|
58
|
-
|
75
|
+
export interface PageWithWorkflow extends Page {
|
76
|
+
settings: PageSettingsWithWorkflow;
|
59
77
|
}
|
78
|
+
export declare type ApwOnBeforePageCreateTopicParams = OnBeforePageCreateTopicParams<PageWithWorkflow>;
|
79
|
+
export declare type ApwOnBeforePageCreateFromTopicParams = OnBeforePageCreateFromTopicParams<PageWithWorkflow>;
|
80
|
+
export declare type ApwOnBeforePageUpdateTopicParams = OnBeforePageUpdateTopicParams<PageWithWorkflow>;
|
81
|
+
export declare type ApwOnBeforePagePublishTopicParams = OnBeforePagePublishTopicParams<PageWithWorkflow>;
|
82
|
+
export declare type ApwOnBeforePageRequestReviewTopicParams = OnBeforePageRequestReviewTopicParams<PageWithWorkflow>;
|
60
83
|
export declare enum WorkflowScopeTypes {
|
61
84
|
DEFAULT = "default",
|
62
|
-
|
63
|
-
CMS = "cms"
|
85
|
+
CUSTOM = "custom"
|
64
86
|
}
|
65
87
|
export declare enum ApwContentReviewStepStatus {
|
66
88
|
DONE = "done",
|
@@ -103,18 +125,16 @@ export interface ApwReviewer extends ApwBaseFields {
|
|
103
125
|
}
|
104
126
|
export interface ApwComment extends ApwBaseFields {
|
105
127
|
body: Record<string, any>;
|
106
|
-
changeRequest:
|
107
|
-
|
108
|
-
|
109
|
-
modelId: string;
|
110
|
-
};
|
128
|
+
changeRequest: string;
|
129
|
+
step: string;
|
130
|
+
media: ApwFile;
|
111
131
|
}
|
112
132
|
export interface ApwChangeRequest extends ApwBaseFields {
|
113
133
|
body: Record<string, any>;
|
114
134
|
title: string;
|
115
135
|
resolved: boolean;
|
116
136
|
step: string;
|
117
|
-
media:
|
137
|
+
media: ApwFile;
|
118
138
|
}
|
119
139
|
export interface ApwContentReviewStep {
|
120
140
|
type: ApwWorkflowStepTypes;
|
@@ -123,31 +143,34 @@ export interface ApwContentReviewStep {
|
|
123
143
|
reviewers: ApwReviewer[];
|
124
144
|
status: ApwContentReviewStepStatus;
|
125
145
|
pendingChangeRequests: number;
|
146
|
+
totalComments: number;
|
126
147
|
signOffProvidedOn: string | null;
|
127
148
|
signOffProvidedBy: CreatedBy | null;
|
128
149
|
}
|
129
150
|
export interface ApwContentReview extends ApwBaseFields {
|
151
|
+
title: string;
|
130
152
|
status: ApwContentReviewStatus;
|
131
|
-
content:
|
132
|
-
id: string;
|
133
|
-
type: string;
|
134
|
-
settings: Record<string, any>;
|
135
|
-
};
|
153
|
+
content: ApwContentReviewContent;
|
136
154
|
steps: Array<ApwContentReviewStep>;
|
155
|
+
latestCommentId: string | null;
|
137
156
|
}
|
138
157
|
export interface ApwWorkflow extends ApwBaseFields {
|
139
158
|
title: string;
|
140
159
|
steps: ApwWorkflowStep[];
|
141
160
|
scope: ApwWorkflowScope;
|
142
|
-
app:
|
161
|
+
app: ApwWorkflowApplications;
|
143
162
|
}
|
144
|
-
interface
|
163
|
+
interface ApwWorkflowScopeCmsEntry {
|
164
|
+
id: string;
|
165
|
+
modelId: string;
|
166
|
+
}
|
167
|
+
export interface ApwWorkflowScope {
|
145
168
|
type: WorkflowScopeTypes;
|
146
169
|
data: {
|
147
170
|
categories?: string[];
|
148
171
|
pages?: string[];
|
149
172
|
models?: string[];
|
150
|
-
entries?:
|
173
|
+
entries?: ApwWorkflowScopeCmsEntry[];
|
151
174
|
};
|
152
175
|
}
|
153
176
|
export declare enum ApwWorkflowStepTypes {
|
@@ -160,26 +183,27 @@ export declare enum ApwContentReviewStatus {
|
|
160
183
|
READY_TO_BE_PUBLISHED = "readyToBePublished",
|
161
184
|
PUBLISHED = "published"
|
162
185
|
}
|
163
|
-
export
|
186
|
+
export declare type ApwContentReviewListFilter = ApwContentReviewStatus | "requiresMyAttention";
|
187
|
+
export interface ApwWorkflowStep<TReviewer = ApwReviewer> {
|
164
188
|
title: string;
|
165
189
|
type: ApwWorkflowStepTypes;
|
166
|
-
reviewers:
|
167
|
-
|
190
|
+
reviewers: TReviewer[];
|
191
|
+
id: string;
|
168
192
|
}
|
169
193
|
export interface ApwContentReviewStep extends ApwWorkflowStep {
|
170
194
|
status: ApwContentReviewStepStatus;
|
171
195
|
pendingChangeRequests: number;
|
172
196
|
}
|
173
|
-
interface CreateApwWorkflowParams {
|
197
|
+
export interface CreateApwWorkflowParams<TReviewer = string> {
|
174
198
|
app: ApwWorkflowApplications;
|
175
199
|
title: string;
|
176
200
|
scope: ApwWorkflowScope;
|
177
|
-
steps: ApwWorkflowStep[];
|
201
|
+
steps: ApwWorkflowStep<TReviewer>[];
|
178
202
|
}
|
179
|
-
interface UpdateApwWorkflowParams {
|
203
|
+
export interface UpdateApwWorkflowParams<TReviewer = string> {
|
180
204
|
title?: string;
|
181
205
|
scope?: ApwWorkflowScope;
|
182
|
-
steps?: ApwWorkflowStep[];
|
206
|
+
steps?: ApwWorkflowStep<TReviewer>[];
|
183
207
|
}
|
184
208
|
export interface ListWorkflowsParams extends ListParams {
|
185
209
|
where: ListWhere & {
|
@@ -193,15 +217,16 @@ interface CreateReviewerParams {
|
|
193
217
|
}
|
194
218
|
interface CreateApwCommentParams {
|
195
219
|
body: Record<string, any>;
|
196
|
-
changeRequest:
|
197
|
-
|
198
|
-
|
220
|
+
changeRequest: string;
|
221
|
+
step: string;
|
222
|
+
media: ApwFile;
|
199
223
|
}
|
200
224
|
interface UpdateApwCommentParams {
|
201
225
|
body: Record<string, any>;
|
202
226
|
}
|
203
227
|
interface CreateApwChangeRequestParams {
|
204
228
|
title: string;
|
229
|
+
step: string;
|
205
230
|
body: Record<string, any>;
|
206
231
|
resolved: boolean;
|
207
232
|
media: Record<string, any>;
|
@@ -212,19 +237,40 @@ interface UpdateApwChangeRequestParams {
|
|
212
237
|
resolved: boolean;
|
213
238
|
media: Record<string, any>;
|
214
239
|
}
|
240
|
+
declare enum ApwScheduleActionTypes {
|
241
|
+
PUBLISH = "publish",
|
242
|
+
UNPUBLISH = "unpublish"
|
243
|
+
}
|
244
|
+
export interface ApwScheduleActionData {
|
245
|
+
action: ApwScheduleActionTypes;
|
246
|
+
type: ApwContentTypes;
|
247
|
+
datetime: string;
|
248
|
+
entryId: string;
|
249
|
+
/**
|
250
|
+
* We will add modelId to the data for now.
|
251
|
+
* TODO extract in separate package?
|
252
|
+
*/
|
253
|
+
modelId?: string;
|
254
|
+
}
|
215
255
|
export interface ApwContentReviewContent {
|
216
256
|
id: string;
|
217
257
|
type: ApwContentTypes;
|
218
|
-
settings:
|
258
|
+
settings: {
|
259
|
+
modelId?: string;
|
260
|
+
};
|
261
|
+
scheduledOn?: string | null;
|
262
|
+
scheduledBy?: string | null;
|
263
|
+
scheduledActionId?: string | null;
|
264
|
+
publishedBy?: string | null;
|
219
265
|
}
|
220
266
|
export interface CreateApwContentReviewParams {
|
221
267
|
content: ApwContentReviewContent;
|
222
|
-
workflow: string;
|
223
|
-
steps: ApwContentReviewStep[];
|
224
|
-
status: ApwContentReviewStatus;
|
225
268
|
}
|
226
269
|
interface UpdateApwContentReviewParams {
|
227
|
-
|
270
|
+
title?: string;
|
271
|
+
steps?: ApwContentReviewStep[];
|
272
|
+
status?: ApwContentReviewStatus;
|
273
|
+
content?: ApwContentReviewContent;
|
228
274
|
}
|
229
275
|
interface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {
|
230
276
|
get(id: string): Promise<TEntry>;
|
@@ -298,9 +344,17 @@ export interface ApwChangeRequestCrud extends BaseApwCrud<ApwChangeRequest, Crea
|
|
298
344
|
onAfterChangeRequestDelete: Topic<OnAfterChangeRequestDeleteTopicParams>;
|
299
345
|
}
|
300
346
|
export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, CreateApwContentReviewParams, UpdateApwContentReviewParams> {
|
301
|
-
list(params:
|
347
|
+
list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;
|
302
348
|
provideSignOff(id: string, step: string): Promise<Boolean>;
|
303
349
|
retractSignOff(id: string, step: string): Promise<Boolean>;
|
350
|
+
isReviewRequired(data: ApwContentReviewContent): Promise<{
|
351
|
+
isReviewRequired: boolean;
|
352
|
+
contentReviewId?: string | null;
|
353
|
+
}>;
|
354
|
+
publishContent(id: string, datetime?: string): Promise<Boolean>;
|
355
|
+
unpublishContent(id: string, datetime?: string): Promise<Boolean>;
|
356
|
+
scheduleAction(data: ApwScheduleActionData): Promise<string>;
|
357
|
+
deleteScheduledAction(id: string): Promise<boolean>;
|
304
358
|
/**
|
305
359
|
* Lifecycle events
|
306
360
|
*/
|
@@ -311,21 +365,34 @@ export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, Crea
|
|
311
365
|
onBeforeContentReviewDelete: Topic<OnBeforeContentReviewDeleteTopicParams>;
|
312
366
|
onAfterContentReviewDelete: Topic<OnAfterContentReviewDeleteTopicParams>;
|
313
367
|
}
|
314
|
-
export declare type
|
368
|
+
export declare type ContentGetter = (id: string, settings: {
|
369
|
+
modelId?: string;
|
370
|
+
}) => Promise<PageWithWorkflow | ApwCmsEntry | null>;
|
371
|
+
export declare type ContentPublisher = (id: string, settings: {
|
315
372
|
modelId?: string;
|
316
|
-
}) => Promise<
|
373
|
+
}) => Promise<Boolean | null>;
|
374
|
+
export declare type ContentUnPublisher = (id: string, settings: {
|
375
|
+
modelId?: string;
|
376
|
+
}) => Promise<Boolean | null>;
|
317
377
|
export interface AdvancedPublishingWorkflow {
|
318
|
-
|
319
|
-
|
378
|
+
addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;
|
379
|
+
getContentGetter: (type: ApwContentTypes) => ContentGetter;
|
380
|
+
addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;
|
381
|
+
getContentPublisher: (type: ApwContentTypes) => ContentPublisher;
|
382
|
+
addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;
|
383
|
+
getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;
|
320
384
|
workflow: ApwWorkflowCrud;
|
321
385
|
reviewer: ApwReviewerCrud;
|
322
386
|
comment: ApwCommentCrud;
|
323
387
|
changeRequest: ApwChangeRequestCrud;
|
324
388
|
contentReview: ApwContentReviewCrud;
|
389
|
+
scheduleAction: ApwScheduleActionCrud;
|
325
390
|
}
|
326
391
|
export interface ApwContext extends Context, CmsContext {
|
327
392
|
apw: AdvancedPublishingWorkflow;
|
328
393
|
pageBuilder: PageBuilderContextObject;
|
394
|
+
wcp: WcpContextObject;
|
395
|
+
scheduleAction: ScheduleActionContext["scheduleAction"];
|
329
396
|
}
|
330
397
|
export interface LifeCycleHookCallbackParams {
|
331
398
|
apw: ApwContext["apw"];
|
@@ -338,6 +405,9 @@ export interface CreateApwParams {
|
|
338
405
|
getTenant: () => Tenant;
|
339
406
|
getPermission: (name: string) => Promise<SecurityPermission | null>;
|
340
407
|
storageOperations: ApwStorageOperations;
|
408
|
+
scheduler: ApwScheduleActionCrud;
|
409
|
+
handlerClient: HandlerClient;
|
410
|
+
plugins: PluginsContainer;
|
341
411
|
}
|
342
412
|
interface StorageOperationsGetReviewerParams {
|
343
413
|
id: string;
|
@@ -380,7 +450,14 @@ interface StorageOperationsUpdateWorkflowParams {
|
|
380
450
|
}
|
381
451
|
declare type StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;
|
382
452
|
declare type StorageOperationsGetContentReviewParams = StorageOperationsGetParams;
|
383
|
-
|
453
|
+
export interface ApwContentReviewListParams extends ListParams {
|
454
|
+
where?: ListWhere & {
|
455
|
+
status?: ApwContentReviewListFilter;
|
456
|
+
title?: string;
|
457
|
+
title_contains?: string;
|
458
|
+
};
|
459
|
+
}
|
460
|
+
declare type StorageOperationsListContentReviewsParams = ApwContentReviewListParams;
|
384
461
|
interface StorageOperationsCreateContentReviewParams {
|
385
462
|
data: CreateApwContentReviewParams;
|
386
463
|
}
|
@@ -644,5 +721,17 @@ export interface OnBeforeWorkflowDeleteTopicParams {
|
|
644
721
|
export interface OnAfterWorkflowDeleteTopicParams {
|
645
722
|
workflow: ApwWorkflow;
|
646
723
|
}
|
647
|
-
export declare type WorkflowModelDefinition = Pick<CmsModel, "name" | "modelId" | "layout" | "titleFieldId" | "description" | "fields">;
|
724
|
+
export declare type WorkflowModelDefinition = Pick<CmsModel, "name" | "modelId" | "layout" | "titleFieldId" | "description" | "fields" | "isPrivate">;
|
725
|
+
/**
|
726
|
+
* Headless CMS
|
727
|
+
*/
|
728
|
+
export interface OnBeforeCmsEntryPublishTopicParams extends Omit<BeforeEntryPublishTopicParams, "entry"> {
|
729
|
+
entry: ApwCmsEntry;
|
730
|
+
}
|
731
|
+
export interface OnAfterCmsEntryPublishTopicParams extends Omit<AfterEntryPublishTopicParams, "entry"> {
|
732
|
+
entry: ApwCmsEntry;
|
733
|
+
}
|
734
|
+
export interface OnAfterCmsEntryUnpublishTopicParams extends Omit<AfterEntryUnpublishTopicParams, "entry"> {
|
735
|
+
entry: ApwCmsEntry;
|
736
|
+
}
|
648
737
|
export {};
|
package/types.js
CHANGED
@@ -17,8 +17,7 @@ exports.WorkflowScopeTypes = WorkflowScopeTypes;
|
|
17
17
|
|
18
18
|
(function (WorkflowScopeTypes) {
|
19
19
|
WorkflowScopeTypes["DEFAULT"] = "default";
|
20
|
-
WorkflowScopeTypes["
|
21
|
-
WorkflowScopeTypes["CMS"] = "cms";
|
20
|
+
WorkflowScopeTypes["CUSTOM"] = "custom";
|
22
21
|
})(WorkflowScopeTypes || (exports.WorkflowScopeTypes = WorkflowScopeTypes = {}));
|
23
22
|
|
24
23
|
let ApwContentReviewStepStatus;
|
@@ -60,4 +59,11 @@ exports.ApwContentReviewStatus = ApwContentReviewStatus;
|
|
60
59
|
ApwContentReviewStatus["UNDER_REVIEW"] = "underReview";
|
61
60
|
ApwContentReviewStatus["READY_TO_BE_PUBLISHED"] = "readyToBePublished";
|
62
61
|
ApwContentReviewStatus["PUBLISHED"] = "published";
|
63
|
-
})(ApwContentReviewStatus || (exports.ApwContentReviewStatus = ApwContentReviewStatus = {}));
|
62
|
+
})(ApwContentReviewStatus || (exports.ApwContentReviewStatus = ApwContentReviewStatus = {}));
|
63
|
+
|
64
|
+
var ApwScheduleActionTypes;
|
65
|
+
|
66
|
+
(function (ApwScheduleActionTypes) {
|
67
|
+
ApwScheduleActionTypes["PUBLISH"] = "publish";
|
68
|
+
ApwScheduleActionTypes["UNPUBLISH"] = "unpublish";
|
69
|
+
})(ApwScheduleActionTypes || (ApwScheduleActionTypes = {}));
|
package/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"names":["ApwContentTypes","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus"],"mappings":";;;;;;IAgDYA,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e;;IAiBAC,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB;;IAMAC,0B;;;WAAAA,0B;AAAAA,EAAAA,0B;AAAAA,EAAAA,0B;AAAAA,EAAAA,0B;GAAAA,0B,0CAAAA,0B;;IAMAC,uB;AAKZ;AACA;AACA;AACA;AACA;;;;WATYA,uB;AAAAA,EAAAA,uB;AAAAA,EAAAA,uB;GAAAA,uB,uCAAAA,uB;;IA6FAC,oB;;;WAAAA,oB;AAAAA,EAAAA,oB;AAAAA,EAAAA,oB;AAAAA,EAAAA,oB;GAAAA,oB,oCAAAA,oB;;IAMAC,sB;;;WAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;GAAAA,sB,sCAAAA,sB","sourcesContent":["import { Page, OnBeforePageCreateFromTopicParams } from \"@webiny/api-page-builder/types\";\nimport { CmsContext, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { Context } from \"@webiny/handler/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where: ListWhere;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport interface PageWithWorkflow extends Page {\n settings: Page[\"settings\"] & {\n apw: {\n workflowId: string;\n };\n };\n}\n\nexport interface CustomEventParams extends OnBeforePageCreateFromTopicParams {\n page: PageWithWorkflow;\n}\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n PB = \"pb\",\n CMS = \"cms\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CreatedBy {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n createdOn: string;\n savedOn: string;\n createdBy: CreatedBy;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: {\n id: string;\n entryId: string;\n modelId: string;\n };\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: File;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: CreatedBy | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n status: ApwContentReviewStatus;\n content: {\n id: string;\n type: string;\n settings: Record<string, any>;\n };\n steps: Array<ApwContentReviewStep>;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: string;\n}\n\ninterface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: string[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport interface ApwWorkflowStep {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: ApwReviewer[];\n slug: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\ninterface CreateApwWorkflowParams {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep[];\n}\n\ninterface UpdateApwWorkflowParams {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateReviewerParams {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: {\n id: string;\n };\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: Record<string, any>;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n workflow: string;\n steps: ApwContentReviewStep[];\n status: ApwContentReviewStatus;\n}\n\ninterface UpdateApwContentReviewParams {\n steps: ApwContentReviewStep[];\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<Boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeWorkflowCreate: Topic<OnBeforeWorkflowCreateTopicParams>;\n onAfterWorkflowCreate: Topic<OnAfterWorkflowCreateTopicParams>;\n onBeforeWorkflowUpdate: Topic<OnBeforeWorkflowUpdateTopicParams>;\n onAfterWorkflowUpdate: Topic<OnAfterWorkflowUpdateTopicParams>;\n onBeforeWorkflowDelete: Topic<OnBeforeWorkflowDeleteTopicParams>;\n onAfterWorkflowDelete: Topic<OnAfterWorkflowDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateReviewerParams, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeReviewerCreate: Topic<OnBeforeReviewerCreateTopicParams>;\n onAfterReviewerCreate: Topic<OnAfterReviewerCreateTopicParams>;\n onBeforeReviewerUpdate: Topic<OnBeforeReviewerUpdateTopicParams>;\n onAfterReviewerUpdate: Topic<OnAfterReviewerUpdateTopicParams>;\n onBeforeReviewerDelete: Topic<OnBeforeReviewerDeleteTopicParams>;\n onAfterReviewerDelete: Topic<OnAfterReviewerDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeCommentCreate: Topic<OnBeforeCommentCreateTopicParams>;\n onAfterCommentCreate: Topic<OnAfterCommentCreateTopicParams>;\n onBeforeCommentUpdate: Topic<OnBeforeCommentUpdateTopicParams>;\n onAfterCommentUpdate: Topic<OnAfterCommentUpdateTopicParams>;\n onBeforeCommentDelete: Topic<OnBeforeCommentDeleteTopicParams>;\n onAfterCommentDelete: Topic<OnAfterCommentDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeChangeRequestCreate: Topic<OnBeforeChangeRequestCreateTopicParams>;\n onAfterChangeRequestCreate: Topic<OnAfterChangeRequestCreateTopicParams>;\n onBeforeChangeRequestUpdate: Topic<OnBeforeChangeRequestUpdateTopicParams>;\n onAfterChangeRequestUpdate: Topic<OnAfterChangeRequestUpdateTopicParams>;\n onBeforeChangeRequestDelete: Topic<OnBeforeChangeRequestDeleteTopicParams>;\n onAfterChangeRequestDelete: Topic<OnAfterChangeRequestDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<Boolean>;\n\n retractSignOff(id: string, step: string): Promise<Boolean>;\n\n /**\n * Lifecycle events\n */\n onBeforeContentReviewCreate: Topic<OnBeforeContentReviewCreateTopicParams>;\n onAfterContentReviewCreate: Topic<OnAfterContentReviewCreateTopicParams>;\n onBeforeContentReviewUpdate: Topic<OnBeforeContentReviewUpdateTopicParams>;\n onAfterContentReviewUpdate: Topic<OnAfterContentReviewUpdateTopicParams>;\n onBeforeContentReviewDelete: Topic<OnBeforeContentReviewDeleteTopicParams>;\n onAfterContentReviewDelete: Topic<OnAfterContentReviewDeleteTopicParams>;\n}\n\nexport type WorkflowGetter = (id: string, settings: { modelId?: string }) => Promise<string | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addWorkflowGetter: (type: ApwContentTypes, func: WorkflowGetter) => void;\n getWorkflowGetter: (type: ApwContentTypes) => WorkflowGetter;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n}\n\nexport interface ApwContext extends Context, CmsContext {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\ntype StorageOperationsListContentReviewsParams = ListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<Boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<Boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<Boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<Boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<Boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\nexport type WorkflowModelDefinition = Pick<\n CmsModel,\n \"name\" | \"modelId\" | \"layout\" | \"titleFieldId\" | \"description\" | \"fields\"\n>;\n"]}
|
1
|
+
{"version":3,"names":["ApwContentTypes","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsContext,\n CmsEntry as BaseCmsEntry,\n CmsModel,\n BeforeEntryPublishTopicParams,\n AfterEntryPublishTopicParams,\n AfterEntryUnpublishTopicParams\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnBeforePageCreateTopicParams,\n OnBeforePageCreateFromTopicParams,\n OnBeforePageUpdateTopicParams,\n OnBeforePagePublishTopicParams,\n OnBeforePageRequestReviewTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/handler/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { ApwScheduleActionCrud, ScheduleActionContext } from \"~/scheduler/types\";\nimport HandlerClient from \"@webiny/handler-client/HandlerClient\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { WcpContextObject } from \"@webiny/api-wcp/types\";\n\nexport interface ApwCmsEntry extends BaseCmsEntry {\n title: string;\n meta: {\n apw?: {\n contentReviewId?: string | null;\n workflowId?: string | null;\n };\n };\n}\n\nexport interface ApwFile {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n}\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where?: ListWhere;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport interface PageSettingsWithWorkflow extends PageSettings {\n apw: {\n workflowId: string;\n contentReviewId: string | null;\n };\n}\nexport interface PageWithWorkflow extends Page {\n settings: PageSettingsWithWorkflow;\n}\n\nexport type ApwOnBeforePageCreateTopicParams = OnBeforePageCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnBeforePageCreateFromTopicParams =\n OnBeforePageCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnBeforePageUpdateTopicParams = OnBeforePageUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnBeforePagePublishTopicParams = OnBeforePagePublishTopicParams<PageWithWorkflow>;\n\nexport type ApwOnBeforePageRequestReviewTopicParams =\n OnBeforePageRequestReviewTopicParams<PageWithWorkflow>;\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n CUSTOM = \"custom\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CreatedBy {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n createdOn: string;\n savedOn: string;\n createdBy: CreatedBy;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n totalComments: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: CreatedBy | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n status: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: ApwWorkflowApplications;\n}\n\ninterface ApwWorkflowScopeCmsEntry {\n id: string;\n modelId: string;\n}\nexport interface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: ApwWorkflowScopeCmsEntry[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport type ApwContentReviewListFilter = ApwContentReviewStatus | \"requiresMyAttention\";\n\nexport interface ApwWorkflowStep<TReviewer = ApwReviewer> {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: TReviewer[];\n id: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\nexport interface CreateApwWorkflowParams<TReviewer = string> {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface UpdateApwWorkflowParams<TReviewer = string> {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateReviewerParams {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n step: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nenum ApwScheduleActionTypes {\n PUBLISH = \"publish\",\n UNPUBLISH = \"unpublish\"\n}\n\nexport interface ApwScheduleActionData {\n action: ApwScheduleActionTypes;\n type: ApwContentTypes;\n datetime: string;\n entryId: string;\n /**\n * We will add modelId to the data for now.\n * TODO extract in separate package?\n */\n modelId?: string;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: {\n modelId?: string;\n };\n scheduledOn?: string | null;\n scheduledBy?: string | null;\n scheduledActionId?: string | null;\n publishedBy?: string | null;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n}\n\ninterface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n status?: ApwContentReviewStatus;\n content?: ApwContentReviewContent;\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<Boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeWorkflowCreate: Topic<OnBeforeWorkflowCreateTopicParams>;\n onAfterWorkflowCreate: Topic<OnAfterWorkflowCreateTopicParams>;\n onBeforeWorkflowUpdate: Topic<OnBeforeWorkflowUpdateTopicParams>;\n onAfterWorkflowUpdate: Topic<OnAfterWorkflowUpdateTopicParams>;\n onBeforeWorkflowDelete: Topic<OnBeforeWorkflowDeleteTopicParams>;\n onAfterWorkflowDelete: Topic<OnAfterWorkflowDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateReviewerParams, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeReviewerCreate: Topic<OnBeforeReviewerCreateTopicParams>;\n onAfterReviewerCreate: Topic<OnAfterReviewerCreateTopicParams>;\n onBeforeReviewerUpdate: Topic<OnBeforeReviewerUpdateTopicParams>;\n onAfterReviewerUpdate: Topic<OnAfterReviewerUpdateTopicParams>;\n onBeforeReviewerDelete: Topic<OnBeforeReviewerDeleteTopicParams>;\n onAfterReviewerDelete: Topic<OnAfterReviewerDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeCommentCreate: Topic<OnBeforeCommentCreateTopicParams>;\n onAfterCommentCreate: Topic<OnAfterCommentCreateTopicParams>;\n onBeforeCommentUpdate: Topic<OnBeforeCommentUpdateTopicParams>;\n onAfterCommentUpdate: Topic<OnAfterCommentUpdateTopicParams>;\n onBeforeCommentDelete: Topic<OnBeforeCommentDeleteTopicParams>;\n onAfterCommentDelete: Topic<OnAfterCommentDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onBeforeChangeRequestCreate: Topic<OnBeforeChangeRequestCreateTopicParams>;\n onAfterChangeRequestCreate: Topic<OnAfterChangeRequestCreateTopicParams>;\n onBeforeChangeRequestUpdate: Topic<OnBeforeChangeRequestUpdateTopicParams>;\n onAfterChangeRequestUpdate: Topic<OnAfterChangeRequestUpdateTopicParams>;\n onBeforeChangeRequestDelete: Topic<OnBeforeChangeRequestDeleteTopicParams>;\n onAfterChangeRequestDelete: Topic<OnAfterChangeRequestDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<Boolean>;\n\n retractSignOff(id: string, step: string): Promise<Boolean>;\n\n isReviewRequired(data: ApwContentReviewContent): Promise<{\n isReviewRequired: boolean;\n contentReviewId?: string | null;\n }>;\n\n publishContent(id: string, datetime?: string): Promise<Boolean>;\n\n unpublishContent(id: string, datetime?: string): Promise<Boolean>;\n\n scheduleAction(data: ApwScheduleActionData): Promise<string>;\n\n deleteScheduledAction(id: string): Promise<boolean>;\n\n /**\n * Lifecycle events\n */\n onBeforeContentReviewCreate: Topic<OnBeforeContentReviewCreateTopicParams>;\n onAfterContentReviewCreate: Topic<OnAfterContentReviewCreateTopicParams>;\n onBeforeContentReviewUpdate: Topic<OnBeforeContentReviewUpdateTopicParams>;\n onAfterContentReviewUpdate: Topic<OnAfterContentReviewUpdateTopicParams>;\n onBeforeContentReviewDelete: Topic<OnBeforeContentReviewDeleteTopicParams>;\n onAfterContentReviewDelete: Topic<OnAfterContentReviewDeleteTopicParams>;\n}\n\nexport type ContentGetter = (\n id: string,\n settings: { modelId?: string }\n) => Promise<PageWithWorkflow | ApwCmsEntry | null>;\n\nexport type ContentPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<Boolean | null>;\n\nexport type ContentUnPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<Boolean | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;\n getContentGetter: (type: ApwContentTypes) => ContentGetter;\n addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;\n getContentPublisher: (type: ApwContentTypes) => ContentPublisher;\n addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;\n getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface ApwContext extends Context, CmsContext {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n wcp: WcpContextObject;\n scheduleAction: ScheduleActionContext[\"scheduleAction\"];\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n scheduler: ApwScheduleActionCrud;\n handlerClient: HandlerClient;\n plugins: PluginsContainer;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\n\nexport interface ApwContentReviewListParams extends ListParams {\n where?: ListWhere & {\n status?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n };\n}\n\ntype StorageOperationsListContentReviewsParams = ApwContentReviewListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<Boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<Boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<Boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<Boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<Boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeCommentDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterCommentDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeChangeRequestDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterChangeRequestDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeContentReviewDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterContentReviewDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeReviewerDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterReviewerDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnBeforeWorkflowDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnAfterWorkflowDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\nexport type WorkflowModelDefinition = Pick<\n CmsModel,\n \"name\" | \"modelId\" | \"layout\" | \"titleFieldId\" | \"description\" | \"fields\" | \"isPrivate\"\n>;\n\n/**\n * Headless CMS\n */\nexport interface OnBeforeCmsEntryPublishTopicParams\n extends Omit<BeforeEntryPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\nexport interface OnAfterCmsEntryPublishTopicParams\n extends Omit<AfterEntryPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\nexport interface OnAfterCmsEntryUnpublishTopicParams\n extends Omit<AfterEntryUnpublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n"],"mappings":";;;;;;IAqFYA,e;;;WAAAA,e;EAAAA,e;EAAAA,e;GAAAA,e,+BAAAA,e;;IA2BAC,kB;;;WAAAA,kB;EAAAA,kB;EAAAA,kB;GAAAA,kB,kCAAAA,kB;;IAKAC,0B;;;WAAAA,0B;EAAAA,0B;EAAAA,0B;EAAAA,0B;GAAAA,0B,0CAAAA,0B;;IAMAC,uB;AAKZ;AACA;AACA;AACA;AACA;;;;WATYA,uB;EAAAA,uB;EAAAA,uB;GAAAA,uB,uCAAAA,uB;;IA8FAC,oB;;;WAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB;;IAMAC,sB;;;WAAAA,sB;EAAAA,sB;EAAAA,sB;EAAAA,sB;GAAAA,sB,sCAAAA,sB;;IAuEPC,sB;;WAAAA,sB;EAAAA,sB;EAAAA,sB;GAAAA,sB,KAAAA,sB"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ApwContentTypes } from "../types";
|
2
|
+
import { PluginsContainer } from "@webiny/plugins";
|
3
|
+
import { ContentApwSettingsPlugin } from "../ContentApwSettingsPlugin";
|
4
|
+
interface GetContentApwSettingsPluginParams {
|
5
|
+
type: ApwContentTypes;
|
6
|
+
plugins: PluginsContainer;
|
7
|
+
}
|
8
|
+
export declare const getContentApwSettingsPlugin: <T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin>(params: GetContentApwSettingsPluginParams) => T;
|
9
|
+
export {};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getContentApwSettingsPlugin = void 0;
|
7
|
+
|
8
|
+
var _ContentApwSettingsPlugin = require("../ContentApwSettingsPlugin");
|
9
|
+
|
10
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
11
|
+
|
12
|
+
const getContentApwSettingsPlugin = params => {
|
13
|
+
const {
|
14
|
+
type,
|
15
|
+
plugins
|
16
|
+
} = params;
|
17
|
+
const plugin = plugins.byType(_ContentApwSettingsPlugin.ContentApwSettingsPlugin.type).find(p => p.canUse(type));
|
18
|
+
|
19
|
+
if (plugin) {
|
20
|
+
return plugin;
|
21
|
+
}
|
22
|
+
|
23
|
+
throw new _handlerGraphql.NotFoundError(`Could not find a "ContentApwSettingsPlugin" for "${type}".`);
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.getContentApwSettingsPlugin = getContentApwSettingsPlugin;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getContentApwSettingsPlugin","params","type","plugins","plugin","byType","ContentApwSettingsPlugin","find","p","canUse","NotFoundError"],"sources":["contentApwSettingsPlugin.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\n\ninterface GetContentApwSettingsPluginParams {\n type: ApwContentTypes;\n plugins: PluginsContainer;\n}\nexport const getContentApwSettingsPlugin = <\n T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin\n>(\n params: GetContentApwSettingsPluginParams\n): T => {\n const { type, plugins } = params;\n const plugin = plugins.byType<T>(ContentApwSettingsPlugin.type).find(p => p.canUse(type));\n if (plugin) {\n return plugin;\n }\n throw new NotFoundError(`Could not find a \"ContentApwSettingsPlugin\" for \"${type}\".`);\n};\n"],"mappings":";;;;;;;AAEA;;AACA;;AAMO,MAAMA,2BAA2B,GAGpCC,MAHuC,IAInC;EACJ,MAAM;IAAEC,IAAF;IAAQC;EAAR,IAAoBF,MAA1B;EACA,MAAMG,MAAM,GAAGD,OAAO,CAACE,MAAR,CAAkBC,kDAAA,CAAyBJ,IAA3C,EAAiDK,IAAjD,CAAsDC,CAAC,IAAIA,CAAC,CAACC,MAAF,CAASP,IAAT,CAA3D,CAAf;;EACA,IAAIE,MAAJ,EAAY;IACR,OAAOA,MAAP;EACH;;EACD,MAAM,IAAIM,6BAAJ,CAAmB,oDAAmDR,IAAK,IAA3E,CAAN;AACH,CAXM"}
|
package/utils/errors.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["NotAuthorizedError","Error","constructor","data","code","message","StepMissingError","PendingChangeRequestsError","StepInActiveError","NoSignOffProvidedError"],"sources":["errors.ts"],"sourcesContent":["import Error from \"@webiny/error\";\n\nexport class NotAuthorizedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NOT_AUTHORISED\",\n message: `Not a reviewer, couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepMissingError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"MISSING_STEP\",\n message: `Please complete previous steps first.`,\n data: data || null\n });\n }\n}\n\nexport class PendingChangeRequestsError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"PENDING_CHANGE_REQUESTS\",\n message: `Change requests are pending couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepInActiveError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"STEP_NOT_ACTIVE\",\n message: `Step needs to be in active state before providing sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class NoSignOffProvidedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NO_SIGN_OFF_PROVIDED\",\n message: `Sign-off must be provided in order for it to be retracted.`,\n data: data || null\n });\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEO,MAAMA,kBAAN,SAAiCC,cAAjC,CAAuC;EAC1CC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,gBADJ;MAEFC,OAAO,EAAG,4CAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPyC;;;;AAUvC,MAAMG,gBAAN,SAA+BL,cAA/B,CAAqC;EACxCC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,cADJ;MAEFC,OAAO,EAAG,uCAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPuC;;;;AAUrC,MAAMI,0BAAN,SAAyCN,cAAzC,CAA+C;EAClDC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,yBADJ;MAEFC,OAAO,EAAG,wDAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPiD;;;;AAU/C,MAAMK,iBAAN,SAAgCP,cAAhC,CAAsC;EACzCC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,iBADJ;MAEFC,OAAO,EAAG,6DAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPwC;;;;AAUtC,MAAMM,sBAAN,SAAqCR,cAArC,CAA2C;EAC9CC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,sBADJ;MAEFC,OAAO,EAAG,4DAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAP6C"}
|
package/utils/fieldResolver.js
CHANGED
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
11
11
|
|
12
12
|
var _pick = _interopRequireDefault(require("lodash/pick"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
15
15
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
17
17
|
|
@@ -38,7 +38,7 @@ const getFieldValues = async params => {
|
|
38
38
|
field
|
39
39
|
} = transformers[i]; // Get transformed value (eg. data decompression)
|
40
40
|
|
41
|
-
values[fieldId] = await (0,
|
41
|
+
values[fieldId] = await (0, _apiHeadlessCms.entryFieldFromStorageTransform)({
|
42
42
|
context,
|
43
43
|
model,
|
44
44
|
field,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getFieldValues","params","entry","context","transformers","fields","values","pick","i","length","fieldId","model","field","entryFieldFromStorageTransform","value","getTransformer","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { ApwBaseFields } from \"~/types\";\n\ninterface Transformer {\n fieldId: keyof ApwBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends ApwBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [], fields } = params;\n const values = {\n ...pick(entry, fields),\n ...entry.values\n } as T;\n /**\n * Transform field value for each transformers.\n */\n for (let i = 0; i < transformers.length; i++) {\n const { fieldId, model, field } = transformers[i];\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof ApwBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;AAgBO,MAAMA,cAAc,GAAG,MAC1BC,MAD0B,IAEb;EACb,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC,YAAY,GAAG,EAAjC;IAAqCC;EAArC,IAAgDJ,MAAtD;;EACA,MAAMK,MAAM,mCACL,IAAAC,aAAA,EAAKL,KAAL,EAAYG,MAAZ,CADK,GAELH,KAAK,CAACI,MAFD,CAAZ;EAIA;AACJ;AACA;;;EACI,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,YAAY,CAACK,MAAjC,EAAyCD,CAAC,EAA1C,EAA8C;IAC1C,MAAM;MAAEE,OAAF;MAAWC,KAAX;MAAkBC;IAAlB,IAA4BR,YAAY,CAACI,CAAD,CAA9C,CAD0C,CAE1C;;IACAF,MAAM,CAACI,OAAD,CAAN,GAAkB,MAAM,IAAAG,8CAAA,EAA+B;MACnDV,OADmD;MAEnDQ,KAFmD;MAGnDC,KAHmD;MAInDE,KAAK,EAAER,MAAM,CAACI,OAAD;IAJsC,CAA/B,CAAxB;EAMH;;EAED,OAAOJ,MAAP;AACH,CAvBM;;;;AAyBA,MAAMS,cAAc,GAAG,CAACJ,KAAD,EAAkBD,OAAlB,MAAoD;EAC9EA,OAAO,EAAEA,OADqE;EAE9EC,KAAK,EAAEA,KAFuE;EAG9EC,KAAK,EAAED,KAAK,CAACN,MAAN,CAAaW,IAAb,CAAkBJ,KAAK,IAAIA,KAAK,CAACF,OAAN,KAAkBA,OAA7C;AAHuE,CAApD,CAAvB"}
|
package/utils/resolve.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["fn","Response","e","ErrorResponse"],"sources":["resolve.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql\";\n\nexport default async (fn: () => Promise<any>) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n"],"mappings":";;;;;;;AAAA;;eAEe,MAAOA,EAAP,IAAkC;EAC7C,IAAI;IACA,OAAO,IAAIC,wBAAJ,CAAa,MAAMD,EAAE,EAArB,CAAP;EACH,CAFD,CAEE,OAAOE,CAAP,EAAU;IACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;EACH;AACJ,C"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["createChangeRequestMethods.ts"],"names":["createChangeRequestMethods","storageOperations","onBeforeChangeRequestCreate","onAfterChangeRequestCreate","onBeforeChangeRequestUpdate","onAfterChangeRequestUpdate","onBeforeChangeRequestDelete","onAfterChangeRequestDelete","get","id","getChangeRequest","list","params","listChangeRequests","create","data","publish","input","changeRequest","createChangeRequest","update","original","updateChangeRequest","delete","deleteChangeRequest"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,0BAAT,CAAoC;AACvCC,EAAAA;AADuC,CAApC,EAEmC;AACtC,QAAMC,2BAA2B,GAAG,0BAApC;AACA,QAAMC,0BAA0B,GAAG,0BAAnC;AACA,QAAMC,2BAA2B,GAAG,0BAApC;AACA,QAAMC,0BAA0B,GAAG,0BAAnC;AACA,QAAMC,2BAA2B,GAAG,0BAApC;AACA,QAAMC,0BAA0B,GAAG,0BAAnC;AAEA,SAAO;AACH,UAAMC,GAAN,CAAUC,EAAV,EAAc;AACV,aAAOR,iBAAiB,CAACS,gBAAlB,CAAmC;AAAED,QAAAA;AAAF,OAAnC,CAAP;AACH,KAHE;;AAIH,UAAME,IAAN,CAAWC,MAAX,EAAmB;AACf,aAAOX,iBAAiB,CAACY,kBAAlB,CAAqCD,MAArC,CAAP;AACH,KANE;;AAOH,UAAME,MAAN,CAAaC,IAAb,EAAmB;AACf,YAAMb,2BAA2B,CAACc,OAA5B,CAAoC;AAAEC,QAAAA,KAAK,EAAEF;AAAT,OAApC,CAAN;AAEA,YAAMG,aAAa,GAAG,MAAMjB,iBAAiB,CAACkB,mBAAlB,CAAsC;AAAEJ,QAAAA;AAAF,OAAtC,CAA5B;AAEA,YAAMZ,0BAA0B,CAACa,OAA3B,CAAmC;AAAEE,QAAAA;AAAF,OAAnC,CAAN;AAEA,aAAOA,aAAP;AACH,KAfE;;AAgBH,UAAME,MAAN,CAAaX,EAAb,EAAiBM,IAAjB,EAAuB;AACnB,YAAMM,QAAQ,GAAG,MAAMpB,iBAAiB,CAACS,gBAAlB,CAAmC;AAAED,QAAAA;AAAF,OAAnC,CAAvB;AAEA,YAAML,2BAA2B,CAACY,OAA5B,CAAoC;AAAEK,QAAAA,QAAF;AAAYJ,QAAAA,KAAK,EAAE;AAAER,UAAAA,EAAF;AAAMM,UAAAA;AAAN;AAAnB,OAApC,CAAN;AAEA,YAAMG,aAAa,GAAG,MAAMjB,iBAAiB,CAACqB,mBAAlB,CAAsC;AAAEb,QAAAA,EAAF;AAAMM,QAAAA;AAAN,OAAtC,CAA5B;AAEA,YAAMV,0BAA0B,CAACW,OAA3B,CAAmC;AACrCK,QAAAA,QADqC;AAErCJ,QAAAA,KAAK,EAAE;AAAER,UAAAA,EAAF;AAAMM,UAAAA;AAAN,SAF8B;AAGrCG,QAAAA;AAHqC,OAAnC,CAAN;AAMA,aAAOA,aAAP;AACH,KA9BE;;AA+BH,UAAMK,MAAN,CAAad,EAAb,EAAyB;AACrB,YAAMS,aAAa,GAAG,MAAMjB,iBAAiB,CAACS,gBAAlB,CAAmC;AAAED,QAAAA;AAAF,OAAnC,CAA5B;AAEA,YAAMH,2BAA2B,CAACU,OAA5B,CAAoC;AAAEE,QAAAA;AAAF,OAApC,CAAN;AAEA,YAAMjB,iBAAiB,CAACuB,mBAAlB,CAAsC;AAAEf,QAAAA;AAAF,OAAtC,CAAN;AAEA,YAAMF,0BAA0B,CAACS,OAA3B,CAAmC;AAAEE,QAAAA;AAAF,OAAnC,CAAN;AAEA,aAAO,IAAP;AACH,KAzCE;;AA0CH;AACR;AACA;AACQhB,IAAAA,2BA7CG;AA8CHC,IAAAA,0BA9CG;AA+CHC,IAAAA,2BA/CG;AAgDHC,IAAAA,0BAhDG;AAiDHC,IAAAA,2BAjDG;AAkDHC,IAAAA;AAlDG,GAAP;AAoDH","sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwChangeRequestCrud,\n CreateApwParams,\n OnAfterChangeRequestCreateTopicParams,\n OnAfterChangeRequestDeleteTopicParams,\n OnAfterChangeRequestUpdateTopicParams,\n OnBeforeChangeRequestCreateTopicParams,\n OnBeforeChangeRequestDeleteTopicParams,\n OnBeforeChangeRequestUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n const onBeforeChangeRequestCreate = createTopic<OnBeforeChangeRequestCreateTopicParams>();\n const onAfterChangeRequestCreate = createTopic<OnAfterChangeRequestCreateTopicParams>();\n const onBeforeChangeRequestUpdate = createTopic<OnBeforeChangeRequestUpdateTopicParams>();\n const onAfterChangeRequestUpdate = createTopic<OnAfterChangeRequestUpdateTopicParams>();\n const onBeforeChangeRequestDelete = createTopic<OnBeforeChangeRequestDeleteTopicParams>();\n const onAfterChangeRequestDelete = createTopic<OnAfterChangeRequestDeleteTopicParams>();\n\n return {\n async get(id) {\n return storageOperations.getChangeRequest({ id });\n },\n async list(params) {\n return storageOperations.listChangeRequests(params);\n },\n async create(data) {\n await onBeforeChangeRequestCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onAfterChangeRequestCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onBeforeChangeRequestUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onAfterChangeRequestUpdate.publish({\n original,\n input: { id, data },\n changeRequest\n });\n\n return changeRequest;\n },\n async delete(id: string) {\n const changeRequest = await storageOperations.getChangeRequest({ id });\n\n await onBeforeChangeRequestDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onAfterChangeRequestDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onBeforeChangeRequestCreate,\n onAfterChangeRequestCreate,\n onBeforeChangeRequestUpdate,\n onAfterChangeRequestUpdate,\n onBeforeChangeRequestDelete,\n onAfterChangeRequestDelete\n };\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["createCommentMethods.ts"],"names":["createCommentMethods","storageOperations","onBeforeCommentCreate","onAfterCommentCreate","onBeforeCommentUpdate","onAfterCommentUpdate","onBeforeCommentDelete","onAfterCommentDelete","get","id","getComment","list","params","listComments","create","data","publish","input","comment","createComment","update","original","updateComment","delete","deleteComment"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,oBAAT,CAA8B;AAAEC,EAAAA;AAAF,CAA9B,EAAsF;AACzF,QAAMC,qBAAqB,GAAG,0BAA9B;AACA,QAAMC,oBAAoB,GAAG,0BAA7B;AACA,QAAMC,qBAAqB,GAAG,0BAA9B;AACA,QAAMC,oBAAoB,GAAG,0BAA7B;AACA,QAAMC,qBAAqB,GAAG,0BAA9B;AACA,QAAMC,oBAAoB,GAAG,0BAA7B;AAEA,SAAO;AACH;AACR;AACA;AACQL,IAAAA,qBAJG;AAKHC,IAAAA,oBALG;AAMHC,IAAAA,qBANG;AAOHC,IAAAA,oBAPG;AAQHC,IAAAA,qBARG;AASHC,IAAAA,oBATG;;AAUH,UAAMC,GAAN,CAAUC,EAAV,EAAc;AACV,aAAOR,iBAAiB,CAACS,UAAlB,CAA6B;AAAED,QAAAA;AAAF,OAA7B,CAAP;AACH,KAZE;;AAaH,UAAME,IAAN,CAAWC,MAAX,EAAmB;AACf,aAAOX,iBAAiB,CAACY,YAAlB,CAA+BD,MAA/B,CAAP;AACH,KAfE;;AAgBH,UAAME,MAAN,CAAaC,IAAb,EAAmB;AACf,YAAMb,qBAAqB,CAACc,OAAtB,CAA8B;AAAEC,QAAAA,KAAK,EAAEF;AAAT,OAA9B,CAAN;AAEA,YAAMG,OAAO,GAAG,MAAMjB,iBAAiB,CAACkB,aAAlB,CAAgC;AAClDJ,QAAAA;AADkD,OAAhC,CAAtB;AAGA,YAAMZ,oBAAoB,CAACa,OAArB,CAA6B;AAAEE,QAAAA;AAAF,OAA7B,CAAN;AAEA,aAAOA,OAAP;AACH,KAzBE;;AA0BH,UAAME,MAAN,CAAaX,EAAb,EAAiBM,IAAjB,EAAuB;AACnB,YAAMM,QAAQ,GAAG,MAAMpB,iBAAiB,CAACS,UAAlB,CAA6B;AAAED,QAAAA;AAAF,OAA7B,CAAvB;AAEA,YAAML,qBAAqB,CAACY,OAAtB,CAA8B;AAAEK,QAAAA,QAAF;AAAYJ,QAAAA,KAAK,EAAE;AAAER,UAAAA,EAAF;AAAMM,UAAAA;AAAN;AAAnB,OAA9B,CAAN;AAEA,YAAMG,OAAO,GAAG,MAAMjB,iBAAiB,CAACqB,aAAlB,CAAgC;AAAEb,QAAAA,EAAF;AAAMM,QAAAA;AAAN,OAAhC,CAAtB;AAEA,YAAMV,oBAAoB,CAACW,OAArB,CAA6B;AAAEK,QAAAA,QAAF;AAAYH,QAAAA,OAAZ;AAAqBD,QAAAA,KAAK,EAAE;AAAER,UAAAA,EAAF;AAAMM,UAAAA;AAAN;AAA5B,OAA7B,CAAN;AAEA,aAAOG,OAAP;AACH,KApCE;;AAqCH,UAAMK,MAAN,CAAad,EAAb,EAAyB;AACrB,YAAMS,OAAO,GAAG,MAAMjB,iBAAiB,CAACS,UAAlB,CAA6B;AAAED,QAAAA;AAAF,OAA7B,CAAtB;AAEA,YAAMH,qBAAqB,CAACU,OAAtB,CAA8B;AAAEE,QAAAA;AAAF,OAA9B,CAAN;AAEA,YAAMjB,iBAAiB,CAACuB,aAAlB,CAAgC;AAAEf,QAAAA;AAAF,OAAhC,CAAN;AAEA,YAAMF,oBAAoB,CAACS,OAArB,CAA6B;AAAEE,QAAAA;AAAF,OAA7B,CAAN;AAEA,aAAO,IAAP;AACH;;AA/CE,GAAP;AAiDH","sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwCommentCrud,\n CreateApwParams,\n OnBeforeCommentCreateTopicParams,\n OnAfterCommentCreateTopicParams,\n OnBeforeCommentUpdateTopicParams,\n OnAfterCommentUpdateTopicParams,\n OnBeforeCommentDeleteTopicParams,\n OnAfterCommentDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n const onBeforeCommentCreate = createTopic<OnBeforeCommentCreateTopicParams>();\n const onAfterCommentCreate = createTopic<OnAfterCommentCreateTopicParams>();\n const onBeforeCommentUpdate = createTopic<OnBeforeCommentUpdateTopicParams>();\n const onAfterCommentUpdate = createTopic<OnAfterCommentUpdateTopicParams>();\n const onBeforeCommentDelete = createTopic<OnBeforeCommentDeleteTopicParams>();\n const onAfterCommentDelete = createTopic<OnAfterCommentDeleteTopicParams>();\n\n return {\n /**\n * Lifecycle events\n */\n onBeforeCommentCreate,\n onAfterCommentCreate,\n onBeforeCommentUpdate,\n onAfterCommentUpdate,\n onBeforeCommentDelete,\n onAfterCommentDelete,\n async get(id) {\n return storageOperations.getComment({ id });\n },\n async list(params) {\n return storageOperations.listComments(params);\n },\n async create(data) {\n await onBeforeCommentCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onAfterCommentCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onBeforeCommentUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onAfterCommentUpdate.publish({ original, comment, input: { id, data } });\n\n return comment;\n },\n async delete(id: string) {\n const comment = await storageOperations.getComment({ id });\n\n await onBeforeCommentDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onAfterCommentDelete.publish({ comment });\n\n return true;\n }\n };\n}\n"]}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { ApwContentReviewCrud, CreateApwParams, ApwReviewerCrud } from "../types";
|
2
|
-
interface CreateContentReviewMethodsParams extends CreateApwParams {
|
3
|
-
getReviewer: ApwReviewerCrud["get"];
|
4
|
-
}
|
5
|
-
export declare function createContentReviewMethods({ getIdentity, storageOperations, getReviewer }: CreateContentReviewMethodsParams): ApwContentReviewCrud;
|
6
|
-
export {};
|