@webiny/api-apw 0.0.0-unstable.5e7233243f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/ContentApwSettingsPlugin.d.ts +10 -0
  2. package/ContentApwSettingsPlugin.js +17 -0
  3. package/ContentApwSettingsPlugin.js.map +1 -0
  4. package/LICENSE +21 -0
  5. package/README.md +34 -0
  6. package/crud/createChangeRequestMethods.d.ts +2 -0
  7. package/crud/createChangeRequestMethods.js +95 -0
  8. package/crud/createChangeRequestMethods.js.map +1 -0
  9. package/crud/createCommentMethods.d.ts +2 -0
  10. package/crud/createCommentMethods.js +96 -0
  11. package/crud/createCommentMethods.js.map +1 -0
  12. package/crud/createContentReviewMethods.d.ts +10 -0
  13. package/crud/createContentReviewMethods.js +552 -0
  14. package/crud/createContentReviewMethods.js.map +1 -0
  15. package/crud/createReviewerMethods.d.ts +2 -0
  16. package/crud/createReviewerMethods.js +96 -0
  17. package/crud/createReviewerMethods.js.map +1 -0
  18. package/crud/createWorkflowMethods.d.ts +2 -0
  19. package/crud/createWorkflowMethods.js +96 -0
  20. package/crud/createWorkflowMethods.js.map +1 -0
  21. package/crud/index.d.ts +2 -0
  22. package/crud/index.js +100 -0
  23. package/crud/index.js.map +1 -0
  24. package/crud/utils.d.ts +21 -0
  25. package/crud/utils.js +142 -0
  26. package/crud/utils.js.map +1 -0
  27. package/index.d.ts +4 -0
  28. package/index.js +34 -0
  29. package/index.js.map +1 -0
  30. package/package.json +75 -0
  31. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +10 -0
  32. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +51 -0
  33. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -0
  34. package/plugins/cms/README.md +49 -0
  35. package/plugins/cms/apwEntryPlugins.d.ts +8 -0
  36. package/plugins/cms/apwEntryPlugins.js +50 -0
  37. package/plugins/cms/apwEntryPlugins.js.map +1 -0
  38. package/plugins/cms/index.d.ts +12 -0
  39. package/plugins/cms/index.js +37 -0
  40. package/plugins/cms/index.js.map +1 -0
  41. package/plugins/cms/linkContentReviewToEntry.d.ts +8 -0
  42. package/plugins/cms/linkContentReviewToEntry.js +108 -0
  43. package/plugins/cms/linkContentReviewToEntry.js.map +1 -0
  44. package/plugins/cms/linkWorkflowToEntry.d.ts +8 -0
  45. package/plugins/cms/linkWorkflowToEntry.js +166 -0
  46. package/plugins/cms/linkWorkflowToEntry.js.map +1 -0
  47. package/plugins/cms/triggerContentReview.d.ts +8 -0
  48. package/plugins/cms/triggerContentReview.js +59 -0
  49. package/plugins/cms/triggerContentReview.js.map +1 -0
  50. package/plugins/cms/updateContentReviewStatus.d.ts +10 -0
  51. package/plugins/cms/updateContentReviewStatus.js +101 -0
  52. package/plugins/cms/updateContentReviewStatus.js.map +1 -0
  53. package/plugins/cms/utils.d.ts +27 -0
  54. package/plugins/cms/utils.js +211 -0
  55. package/plugins/cms/utils.js.map +1 -0
  56. package/plugins/context.d.ts +5 -0
  57. package/plugins/context.js +146 -0
  58. package/plugins/context.js.map +1 -0
  59. package/plugins/graphql/changeRequest.gql.d.ts +4 -0
  60. package/plugins/graphql/changeRequest.gql.js +155 -0
  61. package/plugins/graphql/changeRequest.gql.js.map +1 -0
  62. package/plugins/graphql/comment.gql.d.ts +4 -0
  63. package/plugins/graphql/comment.gql.js +160 -0
  64. package/plugins/graphql/comment.gql.js.map +1 -0
  65. package/plugins/graphql/contentReview.gql.d.ts +4 -0
  66. package/plugins/graphql/contentReview.gql.js +382 -0
  67. package/plugins/graphql/contentReview.gql.js.map +1 -0
  68. package/plugins/graphql/reviewer.gql.d.ts +4 -0
  69. package/plugins/graphql/reviewer.gql.js +114 -0
  70. package/plugins/graphql/reviewer.gql.js.map +1 -0
  71. package/plugins/graphql/workflow.gql.d.ts +4 -0
  72. package/plugins/graphql/workflow.gql.js +205 -0
  73. package/plugins/graphql/workflow.gql.js.map +1 -0
  74. package/plugins/graphql.d.ts +4 -0
  75. package/plugins/graphql.js +95 -0
  76. package/plugins/graphql.js.map +1 -0
  77. package/plugins/hooks/createReviewerFromIdentity.d.ts +2 -0
  78. package/plugins/hooks/createReviewerFromIdentity.js +62 -0
  79. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -0
  80. package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +2 -0
  81. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +67 -0
  82. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -0
  83. package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +2 -0
  84. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +59 -0
  85. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -0
  86. package/plugins/hooks/index.d.ts +3 -0
  87. package/plugins/hooks/index.js +68 -0
  88. package/plugins/hooks/index.js.map +1 -0
  89. package/plugins/hooks/initializeContentReviewSteps.d.ts +2 -0
  90. package/plugins/hooks/initializeContentReviewSteps.js +89 -0
  91. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -0
  92. package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
  93. package/plugins/hooks/updatePendingChangeRequests.js +98 -0
  94. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -0
  95. package/plugins/hooks/updateTotalComments.d.ts +3 -0
  96. package/plugins/hooks/updateTotalComments.js +157 -0
  97. package/plugins/hooks/updateTotalComments.js.map +1 -0
  98. package/plugins/hooks/validateChangeRequest.d.ts +2 -0
  99. package/plugins/hooks/validateChangeRequest.js +64 -0
  100. package/plugins/hooks/validateChangeRequest.js.map +1 -0
  101. package/plugins/hooks/validateComment.d.ts +2 -0
  102. package/plugins/hooks/validateComment.js +47 -0
  103. package/plugins/hooks/validateComment.js.map +1 -0
  104. package/plugins/hooks/validateContentReview.d.ts +2 -0
  105. package/plugins/hooks/validateContentReview.js +38 -0
  106. package/plugins/hooks/validateContentReview.js.map +1 -0
  107. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
  108. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
  109. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
  110. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
  111. package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
  112. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
  113. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +3 -0
  114. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +25 -0
  115. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
  116. package/plugins/pageBuilder/index.d.ts +11 -0
  117. package/plugins/pageBuilder/index.js +45 -0
  118. package/plugins/pageBuilder/index.js.map +1 -0
  119. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
  120. package/plugins/pageBuilder/linkContentReviewToPage.js +93 -0
  121. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
  122. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
  123. package/plugins/pageBuilder/linkWorkflowToPage.js +182 -0
  124. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
  125. package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
  126. package/plugins/pageBuilder/triggerContentReview.js +50 -0
  127. package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
  128. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
  129. package/plugins/pageBuilder/updateContentReviewStatus.js +83 -0
  130. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
  131. package/plugins/pageBuilder/utils.d.ts +22 -0
  132. package/plugins/pageBuilder/utils.js +184 -0
  133. package/plugins/pageBuilder/utils.js.map +1 -0
  134. package/plugins/utils.d.ts +35 -0
  135. package/plugins/utils.js +197 -0
  136. package/plugins/utils.js.map +1 -0
  137. package/scheduler/createScheduleActionMethods.d.ts +2 -0
  138. package/scheduler/createScheduleActionMethods.js +146 -0
  139. package/scheduler/createScheduleActionMethods.js.map +1 -0
  140. package/scheduler/handlers/executeAction/index.d.ts +13 -0
  141. package/scheduler/handlers/executeAction/index.js +172 -0
  142. package/scheduler/handlers/executeAction/index.js.map +1 -0
  143. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
  144. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
  145. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
  146. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
  147. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
  148. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
  149. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
  150. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
  151. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
  152. package/scheduler/handlers/executeAction/security.d.ts +4 -0
  153. package/scheduler/handlers/executeAction/security.js +68 -0
  154. package/scheduler/handlers/executeAction/security.js.map +1 -0
  155. package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
  156. package/scheduler/handlers/scheduleAction/index.js +165 -0
  157. package/scheduler/handlers/scheduleAction/index.js.map +1 -0
  158. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
  159. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +176 -0
  160. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
  161. package/scheduler/handlers/utils.d.ts +33 -0
  162. package/scheduler/handlers/utils.js +168 -0
  163. package/scheduler/handlers/utils.js.map +1 -0
  164. package/scheduler/index.d.ts +2 -0
  165. package/scheduler/index.js +27 -0
  166. package/scheduler/index.js.map +1 -0
  167. package/scheduler/types.d.ts +171 -0
  168. package/scheduler/types.js +34 -0
  169. package/scheduler/types.js.map +1 -0
  170. package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
  171. package/storageOperations/changeRequestStorageOperations.js +126 -0
  172. package/storageOperations/changeRequestStorageOperations.js.map +1 -0
  173. package/storageOperations/commentStorageOperations.d.ts +3 -0
  174. package/storageOperations/commentStorageOperations.js +142 -0
  175. package/storageOperations/commentStorageOperations.js.map +1 -0
  176. package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
  177. package/storageOperations/contentReviewStorageOperations.js +97 -0
  178. package/storageOperations/contentReviewStorageOperations.js.map +1 -0
  179. package/storageOperations/index.d.ts +15 -0
  180. package/storageOperations/index.js +52 -0
  181. package/storageOperations/index.js.map +1 -0
  182. package/storageOperations/models/changeRequest.model.d.ts +3 -0
  183. package/storageOperations/models/changeRequest.model.js +59 -0
  184. package/storageOperations/models/changeRequest.model.js.map +1 -0
  185. package/storageOperations/models/comment.model.d.ts +7 -0
  186. package/storageOperations/models/comment.model.js +60 -0
  187. package/storageOperations/models/comment.model.js.map +1 -0
  188. package/storageOperations/models/contentModelPluginFactory.d.ts +15 -0
  189. package/storageOperations/models/contentModelPluginFactory.js +32 -0
  190. package/storageOperations/models/contentModelPluginFactory.js.map +1 -0
  191. package/storageOperations/models/contentReview.model.d.ts +7 -0
  192. package/storageOperations/models/contentReview.model.js +257 -0
  193. package/storageOperations/models/contentReview.model.js.map +1 -0
  194. package/storageOperations/models/index.d.ts +2 -0
  195. package/storageOperations/models/index.js +115 -0
  196. package/storageOperations/models/index.js.map +1 -0
  197. package/storageOperations/models/reviewer.model.d.ts +3 -0
  198. package/storageOperations/models/reviewer.model.js +55 -0
  199. package/storageOperations/models/reviewer.model.js.map +1 -0
  200. package/storageOperations/models/utils.d.ts +3 -0
  201. package/storageOperations/models/utils.js +36 -0
  202. package/storageOperations/models/utils.js.map +1 -0
  203. package/storageOperations/models/workflow.model.d.ts +12 -0
  204. package/storageOperations/models/workflow.model.js +208 -0
  205. package/storageOperations/models/workflow.model.js.map +1 -0
  206. package/storageOperations/reviewerStorageOperations.d.ts +3 -0
  207. package/storageOperations/reviewerStorageOperations.js +93 -0
  208. package/storageOperations/reviewerStorageOperations.js.map +1 -0
  209. package/storageOperations/types.d.ts +34 -0
  210. package/storageOperations/types.js +5 -0
  211. package/storageOperations/types.js.map +1 -0
  212. package/storageOperations/workflowStorageOperations.d.ts +3 -0
  213. package/storageOperations/workflowStorageOperations.js +115 -0
  214. package/storageOperations/workflowStorageOperations.js.map +1 -0
  215. package/types.d.ts +737 -0
  216. package/types.js +69 -0
  217. package/types.js.map +1 -0
  218. package/utils/contentApwSettingsPlugin.d.ts +9 -0
  219. package/utils/contentApwSettingsPlugin.js +26 -0
  220. package/utils/contentApwSettingsPlugin.js.map +1 -0
  221. package/utils/errors.d.ts +16 -0
  222. package/utils/errors.js +75 -0
  223. package/utils/errors.js.map +1 -0
  224. package/utils/fieldResolver.d.ts +16 -0
  225. package/utils/fieldResolver.js +60 -0
  226. package/utils/fieldResolver.js.map +1 -0
  227. package/utils/resolve.d.ts +3 -0
  228. package/utils/resolve.js +18 -0
  229. package/utils/resolve.js.map +1 -0
package/types.d.ts ADDED
@@ -0,0 +1,737 @@
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";
3
+ import { Context } from "@webiny/api/types";
4
+ import { PageBuilderContextObject } from "@webiny/api-page-builder/graphql/types";
5
+ import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
6
+ import { I18NLocale } from "@webiny/api-i18n/types";
7
+ import { Tenant } from "@webiny/api-tenancy/types";
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
+ }
29
+ export interface ListWhere {
30
+ /**
31
+ * Fields.
32
+ */
33
+ id?: string;
34
+ id_in?: string[];
35
+ id_not?: string;
36
+ id_not_in?: string[];
37
+ /**
38
+ * Who created the entry?
39
+ */
40
+ createdBy?: string;
41
+ createdBy_not?: string;
42
+ createdBy_in?: string[];
43
+ createdBy_not_in?: string[];
44
+ }
45
+ export interface ListParams {
46
+ where?: ListWhere;
47
+ sort?: string[];
48
+ limit?: number;
49
+ after?: string | null;
50
+ }
51
+ export interface ListMeta {
52
+ /**
53
+ * A cursor for pagination.
54
+ */
55
+ cursor: string | null;
56
+ /**
57
+ * Is there more items to load?
58
+ */
59
+ hasMoreItems: boolean;
60
+ /**
61
+ * Total count of the items in the storage.
62
+ */
63
+ totalCount: number;
64
+ }
65
+ export declare enum ApwContentTypes {
66
+ PAGE = "page",
67
+ CMS_ENTRY = "cms_entry"
68
+ }
69
+ export interface PageSettingsWithWorkflow extends PageSettings {
70
+ apw: {
71
+ workflowId: string;
72
+ contentReviewId: string | null;
73
+ };
74
+ }
75
+ export interface PageWithWorkflow extends Page {
76
+ settings: PageSettingsWithWorkflow;
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>;
83
+ export declare enum WorkflowScopeTypes {
84
+ DEFAULT = "default",
85
+ CUSTOM = "custom"
86
+ }
87
+ export declare enum ApwContentReviewStepStatus {
88
+ DONE = "done",
89
+ ACTIVE = "active",
90
+ INACTIVE = "inactive"
91
+ }
92
+ export declare enum ApwWorkflowApplications {
93
+ PB = "pageBuilder",
94
+ CMS = "cms"
95
+ }
96
+ /**
97
+ * A interface describing the reference to a user that created some data in the database.
98
+ *
99
+ * @category General
100
+ */
101
+ export interface CreatedBy {
102
+ /**
103
+ * ID if the user.
104
+ */
105
+ id: string;
106
+ /**
107
+ * Full name of the user.
108
+ */
109
+ displayName: string | null;
110
+ /**
111
+ * Type of the user (admin, user)
112
+ */
113
+ type: string;
114
+ }
115
+ export interface ApwBaseFields {
116
+ id: string;
117
+ createdOn: string;
118
+ savedOn: string;
119
+ createdBy: CreatedBy;
120
+ }
121
+ export interface ApwReviewer extends ApwBaseFields {
122
+ identityId: string;
123
+ displayName: string | null;
124
+ type: string;
125
+ }
126
+ export interface ApwComment extends ApwBaseFields {
127
+ body: Record<string, any>;
128
+ changeRequest: string;
129
+ step: string;
130
+ media: ApwFile;
131
+ }
132
+ export interface ApwChangeRequest extends ApwBaseFields {
133
+ body: Record<string, any>;
134
+ title: string;
135
+ resolved: boolean;
136
+ step: string;
137
+ media: ApwFile;
138
+ }
139
+ export interface ApwContentReviewStep {
140
+ type: ApwWorkflowStepTypes;
141
+ title: string;
142
+ slug: string;
143
+ reviewers: ApwReviewer[];
144
+ status: ApwContentReviewStepStatus;
145
+ pendingChangeRequests: number;
146
+ totalComments: number;
147
+ signOffProvidedOn: string | null;
148
+ signOffProvidedBy: CreatedBy | null;
149
+ }
150
+ export interface ApwContentReview extends ApwBaseFields {
151
+ title: string;
152
+ status: ApwContentReviewStatus;
153
+ content: ApwContentReviewContent;
154
+ steps: Array<ApwContentReviewStep>;
155
+ latestCommentId: string | null;
156
+ }
157
+ export interface ApwWorkflow extends ApwBaseFields {
158
+ title: string;
159
+ steps: ApwWorkflowStep[];
160
+ scope: ApwWorkflowScope;
161
+ app: ApwWorkflowApplications;
162
+ }
163
+ interface ApwWorkflowScopeCmsEntry {
164
+ id: string;
165
+ modelId: string;
166
+ }
167
+ export interface ApwWorkflowScope {
168
+ type: WorkflowScopeTypes;
169
+ data: {
170
+ categories?: string[];
171
+ pages?: string[];
172
+ models?: string[];
173
+ entries?: ApwWorkflowScopeCmsEntry[];
174
+ };
175
+ }
176
+ export declare enum ApwWorkflowStepTypes {
177
+ MANDATORY_BLOCKING = "mandatoryBlocking",
178
+ MANDATORY_NON_BLOCKING = "mandatoryNonBlocking",
179
+ NON_MANDATORY = "notMandatory"
180
+ }
181
+ export declare enum ApwContentReviewStatus {
182
+ UNDER_REVIEW = "underReview",
183
+ READY_TO_BE_PUBLISHED = "readyToBePublished",
184
+ PUBLISHED = "published"
185
+ }
186
+ export declare type ApwContentReviewListFilter = ApwContentReviewStatus | "requiresMyAttention";
187
+ export interface ApwWorkflowStep<TReviewer = ApwReviewer> {
188
+ title: string;
189
+ type: ApwWorkflowStepTypes;
190
+ reviewers: TReviewer[];
191
+ id: string;
192
+ }
193
+ export interface ApwContentReviewStep extends ApwWorkflowStep {
194
+ status: ApwContentReviewStepStatus;
195
+ pendingChangeRequests: number;
196
+ }
197
+ export interface CreateApwWorkflowParams<TReviewer = string> {
198
+ app: ApwWorkflowApplications;
199
+ title: string;
200
+ scope: ApwWorkflowScope;
201
+ steps: ApwWorkflowStep<TReviewer>[];
202
+ }
203
+ export interface UpdateApwWorkflowParams<TReviewer = string> {
204
+ title?: string;
205
+ scope?: ApwWorkflowScope;
206
+ steps?: ApwWorkflowStep<TReviewer>[];
207
+ }
208
+ export interface ListWorkflowsParams extends ListParams {
209
+ where: ListWhere & {
210
+ app?: ApwWorkflowApplications;
211
+ };
212
+ }
213
+ interface CreateReviewerParams {
214
+ identityId: string;
215
+ displayName: string | null;
216
+ type: string;
217
+ }
218
+ interface CreateApwCommentParams {
219
+ body: Record<string, any>;
220
+ changeRequest: string;
221
+ step: string;
222
+ media: ApwFile;
223
+ }
224
+ interface UpdateApwCommentParams {
225
+ body: Record<string, any>;
226
+ }
227
+ interface CreateApwChangeRequestParams {
228
+ title: string;
229
+ step: string;
230
+ body: Record<string, any>;
231
+ resolved: boolean;
232
+ media: Record<string, any>;
233
+ }
234
+ interface UpdateApwChangeRequestParams {
235
+ title: string;
236
+ body: Record<string, any>;
237
+ resolved: boolean;
238
+ media: Record<string, any>;
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
+ }
255
+ export interface ApwContentReviewContent {
256
+ id: string;
257
+ type: ApwContentTypes;
258
+ settings: {
259
+ modelId?: string;
260
+ };
261
+ scheduledOn?: string | null;
262
+ scheduledBy?: string | null;
263
+ scheduledActionId?: string | null;
264
+ publishedBy?: string | null;
265
+ }
266
+ export interface CreateApwContentReviewParams {
267
+ content: ApwContentReviewContent;
268
+ }
269
+ interface UpdateApwContentReviewParams {
270
+ title?: string;
271
+ steps?: ApwContentReviewStep[];
272
+ status?: ApwContentReviewStatus;
273
+ content?: ApwContentReviewContent;
274
+ }
275
+ interface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {
276
+ get(id: string): Promise<TEntry>;
277
+ create(data: TCreateEntryParams): Promise<TEntry>;
278
+ update(id: string, data: TUpdateEntryParams): Promise<TEntry>;
279
+ delete(id: string): Promise<Boolean>;
280
+ }
281
+ export interface ApwWorkflowCrud extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {
282
+ list(params: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;
283
+ /**
284
+ * Lifecycle events
285
+ */
286
+ onBeforeWorkflowCreate: Topic<OnBeforeWorkflowCreateTopicParams>;
287
+ onAfterWorkflowCreate: Topic<OnAfterWorkflowCreateTopicParams>;
288
+ onBeforeWorkflowUpdate: Topic<OnBeforeWorkflowUpdateTopicParams>;
289
+ onAfterWorkflowUpdate: Topic<OnAfterWorkflowUpdateTopicParams>;
290
+ onBeforeWorkflowDelete: Topic<OnBeforeWorkflowDeleteTopicParams>;
291
+ onAfterWorkflowDelete: Topic<OnAfterWorkflowDeleteTopicParams>;
292
+ }
293
+ export interface ApwReviewerListParams extends ListParams {
294
+ where: ListParams["where"] & {
295
+ identityId?: string;
296
+ };
297
+ }
298
+ export interface ApwReviewerCrud extends BaseApwCrud<ApwReviewer, CreateReviewerParams, UpdateApwReviewerData> {
299
+ list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;
300
+ /**
301
+ * Lifecycle events
302
+ */
303
+ onBeforeReviewerCreate: Topic<OnBeforeReviewerCreateTopicParams>;
304
+ onAfterReviewerCreate: Topic<OnAfterReviewerCreateTopicParams>;
305
+ onBeforeReviewerUpdate: Topic<OnBeforeReviewerUpdateTopicParams>;
306
+ onAfterReviewerUpdate: Topic<OnAfterReviewerUpdateTopicParams>;
307
+ onBeforeReviewerDelete: Topic<OnBeforeReviewerDeleteTopicParams>;
308
+ onAfterReviewerDelete: Topic<OnAfterReviewerDeleteTopicParams>;
309
+ }
310
+ export interface ApwCommentListParams extends ListParams {
311
+ where: ListParams["where"] & {
312
+ changeRequest?: {
313
+ id?: string;
314
+ };
315
+ };
316
+ }
317
+ export interface ApwCommentCrud extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {
318
+ list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;
319
+ /**
320
+ * Lifecycle events
321
+ */
322
+ onBeforeCommentCreate: Topic<OnBeforeCommentCreateTopicParams>;
323
+ onAfterCommentCreate: Topic<OnAfterCommentCreateTopicParams>;
324
+ onBeforeCommentUpdate: Topic<OnBeforeCommentUpdateTopicParams>;
325
+ onAfterCommentUpdate: Topic<OnAfterCommentUpdateTopicParams>;
326
+ onBeforeCommentDelete: Topic<OnBeforeCommentDeleteTopicParams>;
327
+ onAfterCommentDelete: Topic<OnAfterCommentDeleteTopicParams>;
328
+ }
329
+ export interface ApwChangeRequestListParams extends ListParams {
330
+ where: ListParams["where"] & {
331
+ step?: string;
332
+ };
333
+ }
334
+ export interface ApwChangeRequestCrud extends BaseApwCrud<ApwChangeRequest, CreateApwChangeRequestParams, UpdateApwChangeRequestParams> {
335
+ list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;
336
+ /**
337
+ * Lifecycle events
338
+ */
339
+ onBeforeChangeRequestCreate: Topic<OnBeforeChangeRequestCreateTopicParams>;
340
+ onAfterChangeRequestCreate: Topic<OnAfterChangeRequestCreateTopicParams>;
341
+ onBeforeChangeRequestUpdate: Topic<OnBeforeChangeRequestUpdateTopicParams>;
342
+ onAfterChangeRequestUpdate: Topic<OnAfterChangeRequestUpdateTopicParams>;
343
+ onBeforeChangeRequestDelete: Topic<OnBeforeChangeRequestDeleteTopicParams>;
344
+ onAfterChangeRequestDelete: Topic<OnAfterChangeRequestDeleteTopicParams>;
345
+ }
346
+ export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, CreateApwContentReviewParams, UpdateApwContentReviewParams> {
347
+ list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;
348
+ provideSignOff(id: string, step: string): Promise<Boolean>;
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>;
358
+ /**
359
+ * Lifecycle events
360
+ */
361
+ onBeforeContentReviewCreate: Topic<OnBeforeContentReviewCreateTopicParams>;
362
+ onAfterContentReviewCreate: Topic<OnAfterContentReviewCreateTopicParams>;
363
+ onBeforeContentReviewUpdate: Topic<OnBeforeContentReviewUpdateTopicParams>;
364
+ onAfterContentReviewUpdate: Topic<OnAfterContentReviewUpdateTopicParams>;
365
+ onBeforeContentReviewDelete: Topic<OnBeforeContentReviewDeleteTopicParams>;
366
+ onAfterContentReviewDelete: Topic<OnAfterContentReviewDeleteTopicParams>;
367
+ }
368
+ export declare type ContentGetter = (id: string, settings: {
369
+ modelId?: string;
370
+ }) => Promise<PageWithWorkflow | ApwCmsEntry | null>;
371
+ export declare type ContentPublisher = (id: string, settings: {
372
+ modelId?: string;
373
+ }) => Promise<Boolean | null>;
374
+ export declare type ContentUnPublisher = (id: string, settings: {
375
+ modelId?: string;
376
+ }) => Promise<Boolean | null>;
377
+ export interface AdvancedPublishingWorkflow {
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;
384
+ workflow: ApwWorkflowCrud;
385
+ reviewer: ApwReviewerCrud;
386
+ comment: ApwCommentCrud;
387
+ changeRequest: ApwChangeRequestCrud;
388
+ contentReview: ApwContentReviewCrud;
389
+ scheduleAction: ApwScheduleActionCrud;
390
+ }
391
+ export interface ApwContext extends Context, CmsContext {
392
+ apw: AdvancedPublishingWorkflow;
393
+ pageBuilder: PageBuilderContextObject;
394
+ wcp: WcpContextObject;
395
+ scheduleAction: ScheduleActionContext["scheduleAction"];
396
+ }
397
+ export interface LifeCycleHookCallbackParams {
398
+ apw: ApwContext["apw"];
399
+ security: ApwContext["security"];
400
+ cms?: ApwContext["cms"];
401
+ }
402
+ export interface CreateApwParams {
403
+ getLocale: () => I18NLocale;
404
+ getIdentity: () => SecurityIdentity;
405
+ getTenant: () => Tenant;
406
+ getPermission: (name: string) => Promise<SecurityPermission | null>;
407
+ storageOperations: ApwStorageOperations;
408
+ scheduler: ApwScheduleActionCrud;
409
+ handlerClient: HandlerClient;
410
+ plugins: PluginsContainer;
411
+ }
412
+ interface StorageOperationsGetReviewerParams {
413
+ id: string;
414
+ }
415
+ declare type StorageOperationsListReviewersParams = ApwReviewerListParams;
416
+ interface CreateApwReviewerData {
417
+ identityId: string;
418
+ displayName: string | null;
419
+ type: string;
420
+ }
421
+ interface UpdateApwReviewerData {
422
+ identityId: string;
423
+ displayName: string | null;
424
+ type: string;
425
+ }
426
+ interface StorageOperationsCreateReviewerParams {
427
+ data: CreateApwReviewerData;
428
+ }
429
+ interface StorageOperationsUpdateReviewerParams {
430
+ id: string;
431
+ data: UpdateApwReviewerData;
432
+ }
433
+ interface StorageOperationsDeleteReviewerParams {
434
+ id: string;
435
+ }
436
+ interface StorageOperationsGetParams {
437
+ id: string;
438
+ }
439
+ interface StorageOperationsDeleteParams {
440
+ id: string;
441
+ }
442
+ declare type StorageOperationsGetWorkflowParams = StorageOperationsGetParams;
443
+ declare type StorageOperationsListWorkflowsParams = ListParams;
444
+ interface StorageOperationsCreateWorkflowParams {
445
+ data: CreateApwWorkflowParams;
446
+ }
447
+ interface StorageOperationsUpdateWorkflowParams {
448
+ id: string;
449
+ data: UpdateApwWorkflowParams;
450
+ }
451
+ declare type StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;
452
+ declare type StorageOperationsGetContentReviewParams = StorageOperationsGetParams;
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;
461
+ interface StorageOperationsCreateContentReviewParams {
462
+ data: CreateApwContentReviewParams;
463
+ }
464
+ interface StorageOperationsUpdateContentReviewParams {
465
+ id: string;
466
+ data: UpdateApwContentReviewParams;
467
+ }
468
+ declare type StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;
469
+ declare type StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;
470
+ declare type StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;
471
+ interface StorageOperationsCreateChangeRequestParams {
472
+ data: CreateApwChangeRequestParams;
473
+ }
474
+ interface StorageOperationsUpdateChangeRequestParams {
475
+ id: string;
476
+ data: UpdateApwChangeRequestParams;
477
+ }
478
+ declare type StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;
479
+ declare type StorageOperationsGetCommentParams = StorageOperationsGetParams;
480
+ declare type StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;
481
+ declare type StorageOperationsListCommentsParams = ApwCommentListParams;
482
+ interface StorageOperationsCreateCommentParams {
483
+ data: CreateApwCommentParams;
484
+ }
485
+ interface StorageOperationsUpdateCommentParams {
486
+ id: string;
487
+ data: UpdateApwCommentParams;
488
+ }
489
+ export interface ApwReviewerStorageOperations {
490
+ getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;
491
+ listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;
492
+ createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;
493
+ updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;
494
+ deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<Boolean>;
495
+ }
496
+ export interface ApwWorkflowStorageOperations {
497
+ getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;
498
+ listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;
499
+ createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;
500
+ updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;
501
+ deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<Boolean>;
502
+ }
503
+ export interface ApwContentReviewStorageOperations {
504
+ getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;
505
+ listContentReviews(params: StorageOperationsListContentReviewsParams): Promise<[ApwContentReview[], ListMeta]>;
506
+ createContentReview(params: StorageOperationsCreateContentReviewParams): Promise<ApwContentReview>;
507
+ updateContentReview(params: StorageOperationsUpdateContentReviewParams): Promise<ApwContentReview>;
508
+ deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<Boolean>;
509
+ }
510
+ export interface ApwChangeRequestStorageOperations {
511
+ getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;
512
+ listChangeRequests(params: StorageOperationsListChangeRequestsParams): Promise<[ApwChangeRequest[], ListMeta]>;
513
+ createChangeRequest(params: StorageOperationsCreateChangeRequestParams): Promise<ApwChangeRequest>;
514
+ updateChangeRequest(params: StorageOperationsUpdateChangeRequestParams): Promise<ApwChangeRequest>;
515
+ deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<Boolean>;
516
+ }
517
+ export interface ApwCommentStorageOperations {
518
+ getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;
519
+ listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;
520
+ createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;
521
+ updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;
522
+ deleteComment(params: StorageOperationsDeleteCommentParams): Promise<Boolean>;
523
+ }
524
+ export interface ApwStorageOperations extends ApwReviewerStorageOperations, ApwWorkflowStorageOperations, ApwContentReviewStorageOperations, ApwChangeRequestStorageOperations, ApwCommentStorageOperations {
525
+ }
526
+ /**
527
+ * @category Lifecycle events
528
+ */
529
+ export interface OnBeforeCommentCreateTopicParams {
530
+ input: CreateApwCommentParams;
531
+ }
532
+ /**
533
+ * @category Lifecycle events
534
+ */
535
+ export interface OnAfterCommentCreateTopicParams {
536
+ comment: ApwComment;
537
+ }
538
+ /**
539
+ * @category Lifecycle events
540
+ */
541
+ export interface OnBeforeCommentUpdateTopicParams {
542
+ original: ApwComment;
543
+ input: Record<string, any>;
544
+ }
545
+ /**
546
+ * @category Lifecycle events
547
+ */
548
+ export interface OnAfterCommentUpdateTopicParams {
549
+ original: ApwComment;
550
+ comment: ApwComment;
551
+ input: Record<string, any>;
552
+ }
553
+ /**
554
+ * @category Lifecycle events
555
+ */
556
+ export interface OnBeforeCommentDeleteTopicParams {
557
+ comment: ApwComment;
558
+ }
559
+ /**
560
+ * @category Lifecycle events
561
+ */
562
+ export interface OnAfterCommentDeleteTopicParams {
563
+ comment: ApwComment;
564
+ }
565
+ /**
566
+ * @category Lifecycle events
567
+ */
568
+ export interface OnBeforeChangeRequestCreateTopicParams {
569
+ input: CreateApwChangeRequestParams;
570
+ }
571
+ /**
572
+ * @category Lifecycle events
573
+ */
574
+ export interface OnAfterChangeRequestCreateTopicParams {
575
+ changeRequest: ApwChangeRequest;
576
+ }
577
+ /**
578
+ * @category Lifecycle events
579
+ */
580
+ export interface OnBeforeChangeRequestUpdateTopicParams {
581
+ original: ApwChangeRequest;
582
+ input: Record<string, any>;
583
+ }
584
+ /**
585
+ * @category Lifecycle events
586
+ */
587
+ export interface OnAfterChangeRequestUpdateTopicParams {
588
+ original: ApwChangeRequest;
589
+ changeRequest: ApwChangeRequest;
590
+ input: Record<string, any>;
591
+ }
592
+ /**
593
+ * @category Lifecycle events
594
+ */
595
+ export interface OnBeforeChangeRequestDeleteTopicParams {
596
+ changeRequest: ApwChangeRequest;
597
+ }
598
+ /**
599
+ * @category Lifecycle events
600
+ */
601
+ export interface OnAfterChangeRequestDeleteTopicParams {
602
+ changeRequest: ApwChangeRequest;
603
+ }
604
+ /**
605
+ * @category Lifecycle events
606
+ */
607
+ export interface OnBeforeContentReviewCreateTopicParams {
608
+ input: CreateApwContentReviewParams;
609
+ }
610
+ /**
611
+ * @category Lifecycle events
612
+ */
613
+ export interface OnAfterContentReviewCreateTopicParams {
614
+ contentReview: ApwContentReview;
615
+ }
616
+ /**
617
+ * @category Lifecycle events
618
+ */
619
+ export interface OnBeforeContentReviewUpdateTopicParams {
620
+ original: ApwContentReview;
621
+ input: Record<string, any>;
622
+ }
623
+ /**
624
+ * @category Lifecycle events
625
+ */
626
+ export interface OnAfterContentReviewUpdateTopicParams {
627
+ original: ApwContentReview;
628
+ contentReview: ApwContentReview;
629
+ input: Record<string, any>;
630
+ }
631
+ /**
632
+ * @category Lifecycle events
633
+ */
634
+ export interface OnBeforeContentReviewDeleteTopicParams {
635
+ contentReview: ApwContentReview;
636
+ }
637
+ /**
638
+ * @category Lifecycle events
639
+ */
640
+ export interface OnAfterContentReviewDeleteTopicParams {
641
+ contentReview: ApwContentReview;
642
+ }
643
+ export interface CreateApwReviewerParams {
644
+ type: string;
645
+ }
646
+ /**
647
+ * @category Lifecycle events
648
+ */
649
+ export interface OnBeforeReviewerCreateTopicParams {
650
+ input: CreateApwReviewerParams;
651
+ }
652
+ /**
653
+ * @category Lifecycle events
654
+ */
655
+ export interface OnAfterReviewerCreateTopicParams {
656
+ reviewer: ApwReviewer;
657
+ }
658
+ /**
659
+ * @category Lifecycle events
660
+ */
661
+ export interface OnBeforeReviewerUpdateTopicParams {
662
+ original: ApwReviewer;
663
+ input: Record<string, any>;
664
+ }
665
+ /**
666
+ * @category Lifecycle events
667
+ */
668
+ export interface OnAfterReviewerUpdateTopicParams {
669
+ original: ApwReviewer;
670
+ reviewer: ApwReviewer;
671
+ input: Record<string, any>;
672
+ }
673
+ /**
674
+ * @category Lifecycle events
675
+ */
676
+ export interface OnBeforeReviewerDeleteTopicParams {
677
+ reviewer: ApwReviewer;
678
+ }
679
+ /**
680
+ * @category Lifecycle events
681
+ */
682
+ export interface OnAfterReviewerDeleteTopicParams {
683
+ reviewer: ApwReviewer;
684
+ }
685
+ /**
686
+ * @category Lifecycle events
687
+ */
688
+ export interface OnBeforeWorkflowCreateTopicParams {
689
+ input: CreateApwWorkflowParams;
690
+ }
691
+ /**
692
+ * @category Lifecycle events
693
+ */
694
+ export interface OnAfterWorkflowCreateTopicParams {
695
+ workflow: ApwWorkflow;
696
+ }
697
+ /**
698
+ * @category Lifecycle events
699
+ */
700
+ export interface OnBeforeWorkflowUpdateTopicParams {
701
+ original: ApwWorkflow;
702
+ input: Record<string, any>;
703
+ }
704
+ /**
705
+ * @category Lifecycle events
706
+ */
707
+ export interface OnAfterWorkflowUpdateTopicParams {
708
+ original: ApwWorkflow;
709
+ workflow: ApwWorkflow;
710
+ input: Record<string, any>;
711
+ }
712
+ /**
713
+ * @category Lifecycle events
714
+ */
715
+ export interface OnBeforeWorkflowDeleteTopicParams {
716
+ workflow: ApwWorkflow;
717
+ }
718
+ /**
719
+ * @category Lifecycle events
720
+ */
721
+ export interface OnAfterWorkflowDeleteTopicParams {
722
+ workflow: ApwWorkflow;
723
+ }
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
+ }
737
+ export {};