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