@webiny/api-apw 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.df6d94b531
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/package.json +31 -31
- package/plugins/graphql/changeRequest.gql.js +2 -2
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +2 -2
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +5 -5
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +2 -2
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +2 -2
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +1 -1
- package/plugins/graphql.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +27 -6
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.js +5 -1
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +2 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/types.d.ts +2 -20
- package/scheduler/types.js +0 -5
- package/scheduler/types.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +5 -2
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/index.js.map +1 -1
- package/types.d.ts +6 -4
- package/types.js.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webiny/api-apw",
|
3
|
-
"version": "0.0.0-unstable.
|
3
|
+
"version": "0.0.0-unstable.df6d94b531",
|
4
4
|
"keywords": [
|
5
5
|
"apw:base"
|
6
6
|
],
|
@@ -17,27 +17,27 @@
|
|
17
17
|
"@aws-sdk/client-cloudwatch-events": "3.54.1",
|
18
18
|
"@babel/runtime": "7.20.13",
|
19
19
|
"@commodo/fields": "1.1.2-beta.20",
|
20
|
-
"@webiny/api": "0.0.0-unstable.
|
21
|
-
"@webiny/api-admin-settings": "0.0.0-unstable.
|
22
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
23
|
-
"@webiny/api-i18n": "0.0.0-unstable.
|
24
|
-
"@webiny/api-i18n-ddb": "0.0.0-unstable.
|
25
|
-
"@webiny/api-mailer": "0.0.0-unstable.
|
26
|
-
"@webiny/api-page-builder": "0.0.0-unstable.
|
27
|
-
"@webiny/api-security": "0.0.0-unstable.
|
28
|
-
"@webiny/api-tenancy": "0.0.0-unstable.
|
29
|
-
"@webiny/api-wcp": "0.0.0-unstable.
|
30
|
-
"@webiny/db-dynamodb": "0.0.0-unstable.
|
31
|
-
"@webiny/error": "0.0.0-unstable.
|
32
|
-
"@webiny/handler": "0.0.0-unstable.
|
33
|
-
"@webiny/handler-client": "0.0.0-unstable.
|
34
|
-
"@webiny/handler-db": "0.0.0-unstable.
|
35
|
-
"@webiny/handler-graphql": "0.0.0-unstable.
|
36
|
-
"@webiny/handler-logs": "0.0.0-unstable.
|
37
|
-
"@webiny/plugins": "0.0.0-unstable.
|
38
|
-
"@webiny/pubsub": "0.0.0-unstable.
|
39
|
-
"@webiny/utils": "0.0.0-unstable.
|
40
|
-
"@webiny/validation": "0.0.0-unstable.
|
20
|
+
"@webiny/api": "0.0.0-unstable.df6d94b531",
|
21
|
+
"@webiny/api-admin-settings": "0.0.0-unstable.df6d94b531",
|
22
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.df6d94b531",
|
23
|
+
"@webiny/api-i18n": "0.0.0-unstable.df6d94b531",
|
24
|
+
"@webiny/api-i18n-ddb": "0.0.0-unstable.df6d94b531",
|
25
|
+
"@webiny/api-mailer": "0.0.0-unstable.df6d94b531",
|
26
|
+
"@webiny/api-page-builder": "0.0.0-unstable.df6d94b531",
|
27
|
+
"@webiny/api-security": "0.0.0-unstable.df6d94b531",
|
28
|
+
"@webiny/api-tenancy": "0.0.0-unstable.df6d94b531",
|
29
|
+
"@webiny/api-wcp": "0.0.0-unstable.df6d94b531",
|
30
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.df6d94b531",
|
31
|
+
"@webiny/error": "0.0.0-unstable.df6d94b531",
|
32
|
+
"@webiny/handler": "0.0.0-unstable.df6d94b531",
|
33
|
+
"@webiny/handler-client": "0.0.0-unstable.df6d94b531",
|
34
|
+
"@webiny/handler-db": "0.0.0-unstable.df6d94b531",
|
35
|
+
"@webiny/handler-graphql": "0.0.0-unstable.df6d94b531",
|
36
|
+
"@webiny/handler-logs": "0.0.0-unstable.df6d94b531",
|
37
|
+
"@webiny/plugins": "0.0.0-unstable.df6d94b531",
|
38
|
+
"@webiny/pubsub": "0.0.0-unstable.df6d94b531",
|
39
|
+
"@webiny/utils": "0.0.0-unstable.df6d94b531",
|
40
|
+
"@webiny/validation": "0.0.0-unstable.df6d94b531",
|
41
41
|
"dayjs": "1.11.7",
|
42
42
|
"lodash": "4.17.21",
|
43
43
|
"mdbid": "1.0.0"
|
@@ -46,14 +46,14 @@
|
|
46
46
|
"@babel/cli": "^7.19.3",
|
47
47
|
"@babel/core": "^7.19.3",
|
48
48
|
"@babel/preset-env": "^7.19.4",
|
49
|
-
"@webiny/api-headless-cms-ddb": "^0.0.0-unstable.
|
50
|
-
"@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.
|
51
|
-
"@webiny/api-security-so-ddb": "^0.0.0-unstable.
|
52
|
-
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.
|
53
|
-
"@webiny/cli": "^0.0.0-unstable.
|
54
|
-
"@webiny/handler-aws": "^0.0.0-unstable.
|
55
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
56
|
-
"@webiny/wcp": "^0.0.0-unstable.
|
49
|
+
"@webiny/api-headless-cms-ddb": "^0.0.0-unstable.df6d94b531",
|
50
|
+
"@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.df6d94b531",
|
51
|
+
"@webiny/api-security-so-ddb": "^0.0.0-unstable.df6d94b531",
|
52
|
+
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.df6d94b531",
|
53
|
+
"@webiny/cli": "^0.0.0-unstable.df6d94b531",
|
54
|
+
"@webiny/handler-aws": "^0.0.0-unstable.df6d94b531",
|
55
|
+
"@webiny/project-utils": "^0.0.0-unstable.df6d94b531",
|
56
|
+
"@webiny/wcp": "^0.0.0-unstable.df6d94b531",
|
57
57
|
"get-yarn-workspaces": "^1.0.2",
|
58
58
|
"graphql": "^15.7.2",
|
59
59
|
"jest": "^28.1.0",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"build": "yarn webiny run build",
|
73
73
|
"watch": "yarn webiny run watch"
|
74
74
|
},
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "df6d94b531ed0453caef22c785d42be580c9df96"
|
76
76
|
}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# ChangeRequest specific fields
|
20
20
|
step: String!
|
21
21
|
title: String!
|
@@ -35,7 +35,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
35
35
|
id: ID
|
36
36
|
savedOn: DateTime
|
37
37
|
createdOn: DateTime
|
38
|
-
createdBy:
|
38
|
+
createdBy: ApwIdentity
|
39
39
|
# ChangeRequest specific fields
|
40
40
|
step: String!
|
41
41
|
title: String!
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwChangeRequestListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwChangeRequestListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwListChangeRequestsResponse {\n data: [ApwChangeRequestListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwChangeRequest {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwChangeRequestResponse {\n data: ApwChangeRequest\n error: ApwError\n }\n\n type ApwDeleteChangeRequestResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListChangeRequestSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwCreateChangeRequestInput {\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n input ApwUpdateChangeRequestInput {\n title: String\n body: JSON\n resolved: Boolean\n media: JSON\n }\n\n input ApwListChangeRequestWhereInput {\n id: ID\n step: String\n }\n\n input ApwListChangeRequestSearchInput {\n query: String\n }\n\n extend type ApwQuery {\n getChangeRequest(id: ID!): ApwChangeRequestResponse\n\n listChangeRequests(\n where: ApwListChangeRequestWhereInput\n limit: Int\n after: String\n sort: [ApwListChangeRequestSort!]\n search: ApwListChangeRequestSearchInput\n ): ApwListChangeRequestsResponse\n }\n\n extend type ApwMutation {\n createChangeRequest(data: ApwCreateChangeRequestInput!): ApwChangeRequestResponse\n\n updateChangeRequest(\n id: ID!\n data: ApwUpdateChangeRequestInput!\n ): ApwChangeRequestResponse\n\n deleteChangeRequest(id: ID!): ApwDeleteChangeRequestResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.get(args.id));\n },\n listChangeRequests: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwChangeRequestListParams.\n */\n const [entries, meta] = await context.apw.changeRequest.list(\n args as unknown as ApwChangeRequestListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.create(args.data));\n },\n updateChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.update(args.id, args.data));\n },\n deleteChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,gBAAgB,EAAE,OAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC/C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,aAAa,CAACC,GAAG,CAACL,IAAI,CAACM,EAAE,CAAC,CAAC;MAChE,CAAC;MACDC,kBAAkB,EAAE,OAAOR,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QACjD,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMR,OAAO,CAACE,GAAG,CAACC,aAAa,CAACM,IAAI,CACxDV,IAAI,CACP;UACD,OAAO,IAAIW,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,mBAAmB,EAAE,OAAOhB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAClD,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,aAAa,CAACY,MAAM,CAAChB,IAAI,CAACiB,IAAI,CAAC,CAAC;MACrE,CAAC;MACDC,mBAAmB,EAAE,OAAOnB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAClD,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,aAAa,CAACe,MAAM,CAACnB,IAAI,CAACM,EAAE,EAAEN,IAAI,CAACiB,IAAI,CAAC,CAAC;MAC9E,CAAC;MACDG,mBAAmB,EAAE,OAAOrB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAClD,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,aAAa,CAACiB,MAAM,CAACrB,IAAI,CAACM,EAAE,CAAC,CAAC;MACnE;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYb,cAAc;AAAA"}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# Comment specific fields
|
20
20
|
body: JSON
|
21
21
|
changeRequest: ID
|
@@ -34,7 +34,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
34
34
|
id: ID
|
35
35
|
savedOn: DateTime
|
36
36
|
createdOn: DateTime
|
37
|
-
createdBy:
|
37
|
+
createdBy: ApwIdentity
|
38
38
|
# Comment specific fields
|
39
39
|
body: JSON
|
40
40
|
changeRequest: ID
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getComment","_","args","context","resolve","apw","comment","get","id","listComments","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createComment","create","data","updateComment","update","deleteComment","delete"],"sources":["comment.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwCommentListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwCommentListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getComment","_","args","context","resolve","apw","comment","get","id","listComments","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createComment","create","data","updateComment","update","deleteComment","delete"],"sources":["comment.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwCommentListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwCommentListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Comment specific fields\n body: JSON\n changeRequest: ID\n # TODO: Remove ApwRefField\n media: JSON\n }\n\n type ApwListCommentsResponse {\n data: [ApwCommentListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwComment {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Comment specific fields\n body: JSON\n changeRequest: ID\n media: JSON\n }\n\n type ApwCommentResponse {\n data: ApwComment\n error: ApwError\n }\n\n type ApwDeleteCommentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListCommentsSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n }\n\n input ApwCreateCommentInput {\n body: JSON!\n changeRequest: ID!\n media: JSON\n }\n\n input ApwUpdateCommentInput {\n body: JSON!\n }\n\n input ApwListCommentsWhereInput {\n id: ID\n id_not: ID\n id_in: [ID!]\n id_not_in: [ID!]\n createdOn: DateTime\n createdOn_gt: DateTime\n createdOn_gte: DateTime\n createdOn_lt: DateTime\n createdOn_lte: DateTime\n createdOn_between: [DateTime!]\n createdOn_not_between: [DateTime!]\n savedOn: DateTime\n savedOn_gt: DateTime\n savedOn_gte: DateTime\n savedOn_lt: DateTime\n savedOn_lte: DateTime\n savedOn_between: [DateTime!]\n savedOn_not_between: [DateTime!]\n createdBy: String\n createdBy_not: String\n createdBy_in: [String!]\n createdBy_not_in: [String!]\n ownedBy: String\n ownedBy_not: String\n ownedBy_in: [String!]\n ownedBy_not_in: [String!]\n changeRequest: ApwRefFieldWhereInput\n }\n\n extend type ApwQuery {\n getComment(id: ID!): ApwCommentResponse\n\n listComments(\n where: ApwListCommentsWhereInput\n limit: Int\n after: String\n sort: [ApwListCommentsSort!]\n ): ApwListCommentsResponse\n }\n\n extend type ApwMutation {\n createComment(data: ApwCreateCommentInput!): ApwCommentResponse\n\n updateComment(id: ID!, data: ApwUpdateCommentInput!): ApwCommentResponse\n\n deleteComment(id: ID!): ApwDeleteCommentResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.get(args.id));\n },\n listComments: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwCommentListParams.\n */\n const [entries, meta] = await context.apw.comment.list(\n args as unknown as ApwCommentListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.create(args.data));\n },\n updateComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.update(args.id, args.data));\n },\n deleteComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,UAAU,EAAE,OAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QACzC,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,OAAO,CAACC,GAAG,CAACL,IAAI,CAACM,EAAE,CAAC,CAAC;MAC1D,CAAC;MACDC,YAAY,EAAE,OAAOR,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC3C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMR,OAAO,CAACE,GAAG,CAACC,OAAO,CAACM,IAAI,CAClDV,IAAI,CACP;UACD,OAAO,IAAIW,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,aAAa,EAAE,OAAOhB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,OAAO,CAACY,MAAM,CAAChB,IAAI,CAACiB,IAAI,CAAC,CAAC;MAC/D,CAAC;MACDC,aAAa,EAAE,OAAOnB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,OAAO,CAACe,MAAM,CAACnB,IAAI,CAACM,EAAE,EAAEN,IAAI,CAACiB,IAAI,CAAC,CAAC;MACxE,CAAC;MACDG,aAAa,EAAE,OAAOrB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,OAAO,CAACiB,MAAM,CAACrB,IAAI,CAACM,EAAE,CAAC,CAAC;MAC7D;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYb,cAAc;AAAA"}
|
@@ -16,7 +16,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
16
16
|
id: ID
|
17
17
|
savedOn: DateTime
|
18
18
|
createdOn: DateTime
|
19
|
-
createdBy:
|
19
|
+
createdBy: ApwIdentity
|
20
20
|
# ContentReview specific fields
|
21
21
|
title: String
|
22
22
|
steps: [ApwContentReviewStep]
|
@@ -72,7 +72,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
72
72
|
title: String
|
73
73
|
pendingChangeRequests: Int
|
74
74
|
signOffProvidedOn: DateTime
|
75
|
-
signOffProvidedBy:
|
75
|
+
signOffProvidedBy: ApwIdentity
|
76
76
|
}
|
77
77
|
|
78
78
|
type ApwContentReview {
|
@@ -80,7 +80,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
80
80
|
id: ID
|
81
81
|
savedOn: DateTime
|
82
82
|
createdOn: DateTime
|
83
|
-
createdBy:
|
83
|
+
createdBy: ApwIdentity
|
84
84
|
# ContentReview specific fields
|
85
85
|
title: String
|
86
86
|
steps: [ApwContentReviewStep]
|
@@ -152,9 +152,9 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
152
152
|
version: Int!
|
153
153
|
settings: ApwContentReviewContentSettings
|
154
154
|
publishedOn: String
|
155
|
-
publishedBy:
|
155
|
+
publishedBy: ApwIdentity
|
156
156
|
scheduledOn: DateTime
|
157
|
-
scheduledBy:
|
157
|
+
scheduledBy: ApwIdentity
|
158
158
|
}
|
159
159
|
|
160
160
|
input ApwContentReviewContentInput {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["contentReviewSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwContentReviewContent","version","parent","_","context","getContent","apw","getContentGetter","type","content","id","settings","publishedOn","publishedBy","reviewer","list","where","identityId","scheduledBy","ApwContentReviewListItem","activeStep","steps","find","step","status","ApwContentReviewStepStatus","ACTIVE","totalComments","reduce","count","isNaN","reviewers","reviewerIds","includes","push","ApwQuery","getContentReview","args","resolve","contentReview","get","listContentReviews","entries","meta","ListResponse","e","ErrorResponse","isReviewRequired","data","ApwMutation","createContentReview","create","deleteContentReview","delete","provideSignOff","retractSignOff","publishContent","datetime","unpublishContent","deleteScheduledAction"],"sources":["contentReview.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport {\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwContext,\n ApwContentReviewListParams,\n ApwContentReviewContent\n} from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst contentReviewSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwContentReviewListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n reviewStatus: ApwContentReviewStatus\n activeStep: ApwContentReviewStep\n totalComments: Int\n latestCommentId: String\n reviewers: [ID!]!\n }\n\n type ApwListContentReviewsResponse {\n data: [ApwContentReviewListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwContentReviewReviewer {\n id: ID\n displayName: String\n }\n\n type ApwContentReviewComment {\n body: JSON\n author: String\n }\n\n type ApwContentReviewChangeRequested {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewComment]\n }\n\n enum ApwContentReviewStepStatus {\n done\n active\n inactive\n }\n\n enum ApwContentReviewStatus {\n underReview\n readyToBePublished\n published\n requiresMyAttention\n }\n\n type ApwContentReviewStep {\n status: ApwContentReviewStepStatus\n id: String\n title: String\n pendingChangeRequests: Int\n signOffProvidedOn: DateTime\n signOffProvidedBy: ApwCreatedBy\n }\n\n type ApwContentReview {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n workflow: ID\n reviewStatus: ApwContentReviewStatus\n }\n\n type ApwContentReviewResponse {\n data: ApwContentReview\n error: ApwError\n }\n\n type ApwDeleteContentReviewResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListContentReviewsSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwContentReviewReviewerInput {\n id: ID\n }\n\n input ApwContentReviewScopeInput {\n type: String\n options: JSON\n }\n\n input ApwContentReviewCommentInput {\n body: JSON\n author: String\n }\n\n input ApwContentReviewChangeRequestedInput {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewCommentInput]\n }\n\n enum ApwContentReviewContentTypes {\n page\n cms_entry\n }\n\n type ApwContentReviewContentSettings {\n modelId: String\n }\n\n input ApwContentReviewContentSettingsInput {\n modelId: String\n }\n\n type ApwContentReviewContent {\n id: ID!\n type: ApwContentReviewContentTypes!\n version: Int!\n settings: ApwContentReviewContentSettings\n publishedOn: String\n publishedBy: ApwCreatedBy\n scheduledOn: DateTime\n scheduledBy: ApwCreatedBy\n }\n\n input ApwContentReviewContentInput {\n id: ID!\n type: ApwContentReviewContentTypes!\n settings: ApwContentReviewContentSettingsInput\n }\n\n input ApwCreateContentReviewInput {\n content: ApwContentReviewContentInput!\n }\n\n input ApwListContentReviewsWhereInput {\n id: ID\n reviewStatus: ApwContentReviewStatus\n title: String\n title_contains: String\n }\n\n type ApwProvideSignOffResponse {\n data: Boolean\n error: ApwError\n }\n\n type ApwIsReviewRequiredData {\n isReviewRequired: Boolean\n contentReviewId: ID\n }\n\n type ApwIsReviewRequiredResponse {\n data: ApwIsReviewRequiredData\n error: ApwError\n }\n\n type ApwPublishContentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwContentActions {\n publish\n unpublish\n }\n\n type ApwScheduleActionResponse {\n data: Boolean\n error: ApwError\n }\n\n input ApwScheduleActionInput {\n action: ApwContentActions!\n datetime: String!\n type: ApwContentReviewContentTypes!\n entryId: ID!\n }\n\n extend type ApwQuery {\n getContentReview(id: ID!): ApwContentReviewResponse\n\n listContentReviews(\n where: ApwListContentReviewsWhereInput\n limit: Int\n after: String\n sort: [ApwListContentReviewsSort!]\n ): ApwListContentReviewsResponse\n\n isReviewRequired(data: ApwContentReviewContentInput!): ApwIsReviewRequiredResponse\n }\n\n extend type ApwMutation {\n createContentReview(data: ApwCreateContentReviewInput!): ApwContentReviewResponse\n\n deleteContentReview(id: ID!): ApwDeleteContentReviewResponse\n\n provideSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n retractSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n publishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n unpublishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n scheduleAction(data: ApwScheduleActionInput!): ApwScheduleActionResponse\n\n deleteScheduledAction(id: ID!): ApwScheduleActionResponse\n }\n `,\n resolvers: {\n ApwContentReviewContent: {\n version: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.version;\n },\n publishedOn: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.publishedOn;\n },\n publishedBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.publishedBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n },\n scheduledBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.scheduledBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n }\n },\n ApwContentReviewListItem: {\n activeStep: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.find(step => step.status === ApwContentReviewStepStatus.ACTIVE);\n },\n totalComments: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.reduce((count, step) => {\n /**\n * Aggregate totalComments from each step.\n */\n if (!isNaN(step.totalComments)) {\n count += step.totalComments;\n }\n\n return count;\n }, 0);\n },\n reviewers: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n const reviewerIds: string[] = [];\n\n for (const step of steps) {\n for (const reviewer of step.reviewers) {\n if (!reviewerIds.includes(reviewer.id)) {\n reviewerIds.push(reviewer.id);\n }\n }\n }\n return reviewerIds;\n }\n },\n ApwQuery: {\n getContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.get(args.id));\n },\n listContentReviews: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwContentReviewListParams.\n */\n const [entries, meta] = await context.apw.contentReview.list(\n args as unknown as ApwContentReviewListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n isReviewRequired: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.isReviewRequired(args.data));\n }\n },\n ApwMutation: {\n createContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.create(args.data));\n },\n deleteContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.delete(args.id));\n },\n provideSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.provideSignOff(args.id, args.step));\n },\n retractSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.retractSignOff(args.id, args.step));\n },\n publishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.publishContent(args.id, args.datetime)\n );\n },\n unpublishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.unpublishContent(args.id, args.datetime)\n );\n },\n deleteScheduledAction: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.deleteScheduledAction(args.id));\n }\n }\n }\n});\n\nexport default contentReviewSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOA;AAEA,MAAMA,mBAAmB,GAAG,IAAIC,4BAAmB,CAAa;EAC5DC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,uBAAuB,EAAE;MACrBC,OAAO,EAAE,OAAOC,MAA+B,EAAEC,CAAC,EAAEC,OAAmB,KAAK;QACxE,MAAMC,UAAU,GAAGD,OAAO,CAACE,GAAG,CAACC,gBAAgB,CAACL,MAAM,CAACM,IAAI,CAAC;QAC5D,MAAMC,OAAO,GAAG,MAAMJ,UAAU,CAACH,MAAM,CAACQ,EAAE,EAAER,MAAM,CAACS,QAAQ,CAAC;QAC5D,IAAI,CAACF,OAAO,EAAE;UACV,OAAO,IAAI;QACf;QACA,OAAOA,OAAO,CAACR,OAAO;MAC1B,CAAC;MACDW,WAAW,EAAE,OAAOV,MAA+B,EAAEC,C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AE2B,IAAI,CAACd,IAAI,CAAC,CAAC;MACtF,CAAC;MACDiC,cAAc,EAAE,OAAOrD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QAC7C,OAAO,IAAAkC,gBAAO,EAAC,MACXlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACiB,cAAc,CAACnB,IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACoB,QAAQ,CAAC,CACnE;MACL,CAAC;MACDC,gBAAgB,EAAE,OAAOvD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QAC/C,OAAO,IAAAkC,gBAAO,EAAC,MACXlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACmB,gBAAgB,CAACrB,IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACoB,QAAQ,CAAC,CACrE;MACL,CAAC;MACDE,qBAAqB,EAAE,OAAOxD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QACpD,OAAO,IAAAkC,gBAAO,EAAC,MAAMlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACoB,qBAAqB,CAACtB,IAAI,CAAC3B,EAAE,CAAC,CAAC;MAClF;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYd,mBAAmB;AAAA"}
|
1
|
+
{"version":3,"names":["contentReviewSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwContentReviewContent","version","parent","_","context","getContent","apw","getContentGetter","type","content","id","settings","publishedOn","publishedBy","reviewer","list","where","identityId","scheduledBy","ApwContentReviewListItem","activeStep","steps","find","step","status","ApwContentReviewStepStatus","ACTIVE","totalComments","reduce","count","isNaN","reviewers","reviewerIds","includes","push","ApwQuery","getContentReview","args","resolve","contentReview","get","listContentReviews","entries","meta","ListResponse","e","ErrorResponse","isReviewRequired","data","ApwMutation","createContentReview","create","deleteContentReview","delete","provideSignOff","retractSignOff","publishContent","datetime","unpublishContent","deleteScheduledAction"],"sources":["contentReview.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport {\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwContext,\n ApwContentReviewListParams,\n ApwContentReviewContent\n} from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst contentReviewSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwContentReviewListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n reviewStatus: ApwContentReviewStatus\n activeStep: ApwContentReviewStep\n totalComments: Int\n latestCommentId: String\n reviewers: [ID!]!\n }\n\n type ApwListContentReviewsResponse {\n data: [ApwContentReviewListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwContentReviewReviewer {\n id: ID\n displayName: String\n }\n\n type ApwContentReviewComment {\n body: JSON\n author: String\n }\n\n type ApwContentReviewChangeRequested {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewComment]\n }\n\n enum ApwContentReviewStepStatus {\n done\n active\n inactive\n }\n\n enum ApwContentReviewStatus {\n underReview\n readyToBePublished\n published\n requiresMyAttention\n }\n\n type ApwContentReviewStep {\n status: ApwContentReviewStepStatus\n id: String\n title: String\n pendingChangeRequests: Int\n signOffProvidedOn: DateTime\n signOffProvidedBy: ApwIdentity\n }\n\n type ApwContentReview {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n workflow: ID\n reviewStatus: ApwContentReviewStatus\n }\n\n type ApwContentReviewResponse {\n data: ApwContentReview\n error: ApwError\n }\n\n type ApwDeleteContentReviewResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListContentReviewsSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwContentReviewReviewerInput {\n id: ID\n }\n\n input ApwContentReviewScopeInput {\n type: String\n options: JSON\n }\n\n input ApwContentReviewCommentInput {\n body: JSON\n author: String\n }\n\n input ApwContentReviewChangeRequestedInput {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewCommentInput]\n }\n\n enum ApwContentReviewContentTypes {\n page\n cms_entry\n }\n\n type ApwContentReviewContentSettings {\n modelId: String\n }\n\n input ApwContentReviewContentSettingsInput {\n modelId: String\n }\n\n type ApwContentReviewContent {\n id: ID!\n type: ApwContentReviewContentTypes!\n version: Int!\n settings: ApwContentReviewContentSettings\n publishedOn: String\n publishedBy: ApwIdentity\n scheduledOn: DateTime\n scheduledBy: ApwIdentity\n }\n\n input ApwContentReviewContentInput {\n id: ID!\n type: ApwContentReviewContentTypes!\n settings: ApwContentReviewContentSettingsInput\n }\n\n input ApwCreateContentReviewInput {\n content: ApwContentReviewContentInput!\n }\n\n input ApwListContentReviewsWhereInput {\n id: ID\n reviewStatus: ApwContentReviewStatus\n title: String\n title_contains: String\n }\n\n type ApwProvideSignOffResponse {\n data: Boolean\n error: ApwError\n }\n\n type ApwIsReviewRequiredData {\n isReviewRequired: Boolean\n contentReviewId: ID\n }\n\n type ApwIsReviewRequiredResponse {\n data: ApwIsReviewRequiredData\n error: ApwError\n }\n\n type ApwPublishContentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwContentActions {\n publish\n unpublish\n }\n\n type ApwScheduleActionResponse {\n data: Boolean\n error: ApwError\n }\n\n input ApwScheduleActionInput {\n action: ApwContentActions!\n datetime: String!\n type: ApwContentReviewContentTypes!\n entryId: ID!\n }\n\n extend type ApwQuery {\n getContentReview(id: ID!): ApwContentReviewResponse\n\n listContentReviews(\n where: ApwListContentReviewsWhereInput\n limit: Int\n after: String\n sort: [ApwListContentReviewsSort!]\n ): ApwListContentReviewsResponse\n\n isReviewRequired(data: ApwContentReviewContentInput!): ApwIsReviewRequiredResponse\n }\n\n extend type ApwMutation {\n createContentReview(data: ApwCreateContentReviewInput!): ApwContentReviewResponse\n\n deleteContentReview(id: ID!): ApwDeleteContentReviewResponse\n\n provideSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n retractSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n publishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n unpublishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n scheduleAction(data: ApwScheduleActionInput!): ApwScheduleActionResponse\n\n deleteScheduledAction(id: ID!): ApwScheduleActionResponse\n }\n `,\n resolvers: {\n ApwContentReviewContent: {\n version: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.version;\n },\n publishedOn: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.publishedOn;\n },\n publishedBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.publishedBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n },\n scheduledBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.scheduledBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n }\n },\n ApwContentReviewListItem: {\n activeStep: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.find(step => step.status === ApwContentReviewStepStatus.ACTIVE);\n },\n totalComments: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.reduce((count, step) => {\n /**\n * Aggregate totalComments from each step.\n */\n if (!isNaN(step.totalComments)) {\n count += step.totalComments;\n }\n\n return count;\n }, 0);\n },\n reviewers: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n const reviewerIds: string[] = [];\n\n for (const step of steps) {\n for (const reviewer of step.reviewers) {\n if (!reviewerIds.includes(reviewer.id)) {\n reviewerIds.push(reviewer.id);\n }\n }\n }\n return reviewerIds;\n }\n },\n ApwQuery: {\n getContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.get(args.id));\n },\n listContentReviews: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwContentReviewListParams.\n */\n const [entries, meta] = await context.apw.contentReview.list(\n args as unknown as ApwContentReviewListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n isReviewRequired: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.isReviewRequired(args.data));\n }\n },\n ApwMutation: {\n createContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.create(args.data));\n },\n deleteContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.delete(args.id));\n },\n provideSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.provideSignOff(args.id, args.step));\n },\n retractSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.retractSignOff(args.id, args.step));\n },\n publishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.publishContent(args.id, args.datetime)\n );\n },\n unpublishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.unpublishContent(args.id, args.datetime)\n );\n },\n deleteScheduledAction: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.deleteScheduledAction(args.id));\n }\n }\n }\n});\n\nexport default contentReviewSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOA;AAEA,MAAMA,mBAAmB,GAAG,IAAIC,4BAAmB,CAAa;EAC5DC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,uBAAuB,EAAE;MACrBC,OAAO,EAAE,OAAOC,MAA+B,EAAEC,CAAC,EAAEC,OAAmB,KAAK;QACxE,MAAMC,UAAU,GAAGD,OAAO,CAACE,GAAG,CAACC,gBAAgB,CAACL,M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IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACd,IAAI,CAAC,CAAC;MACtF,CAAC;MACDgC,cAAc,EAAE,OAAOpD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QAC7C,OAAO,IAAAkC,gBAAO,EAAC,MAAMlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACgB,cAAc,CAAClB,IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACd,IAAI,CAAC,CAAC;MACtF,CAAC;MACDiC,cAAc,EAAE,OAAOrD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QAC7C,OAAO,IAAAkC,gBAAO,EAAC,MACXlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACiB,cAAc,CAACnB,IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACoB,QAAQ,CAAC,CACnE;MACL,CAAC;MACDC,gBAAgB,EAAE,OAAOvD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QAC/C,OAAO,IAAAkC,gBAAO,EAAC,MACXlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACmB,gBAAgB,CAACrB,IAAI,CAAC3B,EAAE,EAAE2B,IAAI,CAACoB,QAAQ,CAAC,CACrE;MACL,CAAC;MACDE,qBAAqB,EAAE,OAAOxD,CAAC,EAAEkC,IAAS,EAAEjC,OAAO,KAAK;QACpD,OAAO,IAAAkC,gBAAO,EAAC,MAAMlC,OAAO,CAACE,GAAG,CAACiC,aAAa,CAACoB,qBAAqB,CAACtB,IAAI,CAAC3B,EAAE,CAAC,CAAC;MAClF;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYd,mBAAmB;AAAA"}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# Reviewer specific fields
|
20
20
|
identityId: ID
|
21
21
|
displayName: String
|
@@ -34,7 +34,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
34
34
|
id: ID
|
35
35
|
savedOn: DateTime
|
36
36
|
createdOn: DateTime
|
37
|
-
createdBy:
|
37
|
+
createdBy: ApwIdentity
|
38
38
|
# Reviewer specific fields
|
39
39
|
identityId: ID
|
40
40
|
displayName: String
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewerListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwReviewerListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewerListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwReviewerListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwListReviewersResponse {\n data: [ApwReviewerListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwReviewer {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwReviewerResponse {\n data: ApwReviewer\n error: ApwError\n }\n\n type ApwDeleteReviewerResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListReviewersSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwListReviewersWhereInput {\n identityId: ID\n }\n\n input ApwListReviewersSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n extend type ApwQuery {\n getReviewer(id: ID!): ApwReviewerResponse\n\n listReviewers(\n where: ApwListReviewersWhereInput\n limit: Int\n after: String\n sort: [ApwListReviewersSort!]\n search: ApwListReviewersSearchInput\n ): ApwListReviewersResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getReviewer: async (_, args: any, context) => {\n return resolve(() => context.apw.reviewer.get(args.id));\n },\n listReviewers: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwReviewerListParams.\n */\n const [entries, meta] = await context.apw.reviewer.list(\n args as unknown as ApwReviewerListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,WAAW,EAAE,OAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC1C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACC,GAAG,CAACL,IAAI,CAACM,EAAE,CAAC,CAAC;MAC3D,CAAC;MACDC,aAAa,EAAE,OAAOR,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMR,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACM,IAAI,CACnDV,IAAI,CACP;UACD,OAAO,IAAIW,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYnB,cAAc;AAAA"}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# Workflow specific fields
|
20
20
|
app: ApwWorkflowApplication
|
21
21
|
title: String
|
@@ -46,7 +46,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
46
46
|
id: ID
|
47
47
|
savedOn: DateTime
|
48
48
|
createdOn: DateTime
|
49
|
-
createdBy:
|
49
|
+
createdBy: ApwIdentity
|
50
50
|
# Workflow specific fields
|
51
51
|
app: ApwWorkflowApplication
|
52
52
|
title: String
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwWorkflowStep","reviewers","parent","map","id","ApwQuery","getWorkflow","_","args","context","resolve","apw","workflow","get","listWorkflows","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createWorkflow","create","data","updateWorkflow","update","deleteWorkflow","delete"],"sources":["workflow.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewer, ListWorkflowsParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwWorkflowListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwWorkflowStep","reviewers","parent","map","id","ApwQuery","getWorkflow","_","args","context","resolve","apw","workflow","get","listWorkflows","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createWorkflow","create","data","updateWorkflow","update","deleteWorkflow","delete"],"sources":["workflow.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewer, ListWorkflowsParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwWorkflowListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Workflow specific fields\n app: ApwWorkflowApplication\n title: String\n steps: [ApwWorkflowStep]\n scope: ApwWorkflowScope\n }\n\n type ApwListWorkflowsResponse {\n data: [ApwWorkflowListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwWorkflowStep {\n title: String!\n id: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]\n }\n\n type ApwWorkflowScope {\n type: String\n data: JSON\n }\n\n type ApwWorkflow {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Workflow specific fields\n app: ApwWorkflowApplication\n title: String\n steps: [ApwWorkflowStep]\n scope: ApwWorkflowScope\n }\n\n type ApwWorkflowResponse {\n data: ApwWorkflow\n error: ApwError\n }\n\n type ApwDeleteWorkflowResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwWorkflowApplication {\n pageBuilder\n cms\n formBuilder\n }\n\n enum ApwWorkflowStepTypes {\n mandatoryBlocking\n mandatoryNonBlocking\n notMandatory\n }\n\n enum ApwListWorkflowsSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwWorkflowReviewerInput {\n id: ID\n }\n\n input ApwCreateWorkflowStepInput {\n id: String!\n title: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]!\n }\n\n input ApwUpdateWorkflowStepInput {\n id: String!\n title: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]\n }\n\n input ApwWorkflowScopeInput {\n type: String!\n data: JSON\n }\n\n input ApwCreateWorkflowInput {\n title: String!\n steps: [ApwCreateWorkflowStepInput!]!\n scope: ApwWorkflowScopeInput!\n app: ApwWorkflowApplication!\n }\n\n input ApwUpdateWorkflowInput {\n title: String\n steps: [ApwUpdateWorkflowStepInput!]\n scope: ApwWorkflowScopeInput\n }\n\n input ApwListWorkflowsWhereInput {\n app: ApwWorkflowApplication\n }\n\n input ApwListWorkflowsSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n type ApwQuery {\n getWorkflow(id: ID!): ApwWorkflowResponse\n\n listWorkflows(\n where: ApwListWorkflowsWhereInput\n limit: Int\n after: String\n sort: [ApwListWorkflowsSort!]\n search: ApwListWorkflowsSearchInput\n ): ApwListWorkflowsResponse\n }\n\n type ApwMutation {\n createWorkflow(data: ApwCreateWorkflowInput!): ApwWorkflowResponse\n\n # Update workflow by given ID.\n updateWorkflow(id: ID!, data: ApwUpdateWorkflowInput!): ApwWorkflowResponse\n\n # Delete workflow\n deleteWorkflow(id: ID!): ApwDeleteWorkflowResponse\n }\n `,\n resolvers: {\n ApwWorkflowStep: {\n reviewers: parent => {\n const reviewers: ApwReviewer[] = parent.reviewers;\n return reviewers.map(({ id }) => id);\n }\n },\n ApwQuery: {\n getWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.get(args.id));\n },\n listWorkflows: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ListWorkflowsParams.\n */\n const [entries, meta] = await context.apw.workflow.list(\n args as unknown as ListWorkflowsParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.create(args.data));\n },\n updateWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.update(args.id, args.data));\n },\n deleteWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,eAAe,EAAE;MACbC,SAAS,EAAEC,MAAM,IAAI;QACjB,MAAMD,SAAwB,GAAGC,MAAM,CAACD,SAAS;QACjD,OAAOA,SAAS,CAACE,GAAG,CAAC,CAAC;UAAEC;QAAG,CAAC,KAAKA,EAAE,CAAC;MACxC;IACJ,CAAC;IACDC,QAAQ,EAAE;MACNC,WAAW,EAAE,OAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC1C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACC,GAAG,CAACL,IAAI,CAACJ,EAAE,CAAC,CAAC;MAC3D,CAAC;MACDU,aAAa,EAAE,OAAOP,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACM,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMP,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACK,IAAI,CACnDT,IAAI,CACP;UACD,OAAO,IAAIU,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,cAAc,EAAE,OAAOf,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACW,MAAM,CAACf,IAAI,CAACgB,IAAI,CAAC,CAAC;MAChE,CAAC;MACDC,cAAc,EAAE,OAAOlB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACc,MAAM,CAAClB,IAAI,CAACJ,EAAE,EAAEI,IAAI,CAACgB,IAAI,CAAC,CAAC;MACzE,CAAC;MACDG,cAAc,EAAE,OAAOpB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACgB,MAAM,CAACpB,IAAI,CAACJ,EAAE,CAAC,CAAC;MAC9D;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYR,cAAc;AAAA"}
|
package/plugins/graphql.js
CHANGED
package/plugins/graphql.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type
|
1
|
+
{"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwIdentity {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAMA,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIC,4BAAmB,CAAC;EACvCC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IACT,CAAC;IACDO,QAAQ,EAAE;MACND,GAAG,EAAEN;IACT;EACJ;AACJ,CAAC,CAAC;AAAC,eAEY,MAAM;EACjB,OAAO,IAAIQ,kBAAa,CAAaC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,aAAa,CAAC,4BAA4B,CAAC,EAAE;MAC1D;IACJ;IAEAF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,CACrBZ,UAAU,EACVa,iBAAc,EACdC,sBAAmB,EACnBC,iBAAc,EACdC,gBAAa,EACbC,sBAAqB,CACxB,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAAA"}
|
@@ -9,5 +9,5 @@ export interface HandlerArgs {
|
|
9
9
|
interface Configuration {
|
10
10
|
storageOperations: ApwScheduleActionStorageOperations;
|
11
11
|
}
|
12
|
-
export declare const executeActionHandlerPlugins: (config: Configuration) => ((import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler").
|
12
|
+
export declare const executeActionHandlerPlugins: (config: Configuration) => ((import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler-aws").RawEventHandler<HandlerArgs, import("@webiny/handler/types").Context, any> | ContextPlugin<import("@webiny/api/types").Context>)[];
|
13
13
|
export {};
|
@@ -9,7 +9,7 @@ var _api = require("@webiny/api");
|
|
9
9
|
var _PageBuilderGraphQL = require("./plugins/PageBuilderGraphQL");
|
10
10
|
var _HeadlessCMSGraphQL = require("./plugins/HeadlessCMSGraphQL");
|
11
11
|
var _ApplicationGraphQL = require("./plugins/ApplicationGraphQL");
|
12
|
-
var
|
12
|
+
var _handlerAws = require("@webiny/handler-aws");
|
13
13
|
/**
|
14
14
|
* Handler that execute the provided action(s) for the schedule action workflow.
|
15
15
|
*/
|
@@ -17,7 +17,7 @@ const createExecuteActionLambda = params => {
|
|
17
17
|
const {
|
18
18
|
storageOperations
|
19
19
|
} = params;
|
20
|
-
return (0,
|
20
|
+
return (0, _handlerAws.createRawEventHandler)(async ({
|
21
21
|
payload,
|
22
22
|
context
|
23
23
|
}) => {
|
@@ -111,7 +111,7 @@ const createExecuteActionLambda = params => {
|
|
111
111
|
console.log(JSON.stringify(item));
|
112
112
|
continue;
|
113
113
|
}
|
114
|
-
|
114
|
+
console.log(`Invoking Lambda "${name}" with url "${url}".`);
|
115
115
|
// Perform the actual action call.
|
116
116
|
const response = await context.handlerClient.invoke({
|
117
117
|
name,
|
@@ -132,9 +132,26 @@ const createExecuteActionLambda = params => {
|
|
132
132
|
},
|
133
133
|
await: true
|
134
134
|
});
|
135
|
+
/**
|
136
|
+
*
|
137
|
+
*/
|
138
|
+
await storageOperations.delete({
|
139
|
+
locale,
|
140
|
+
tenant,
|
141
|
+
id: item.id
|
142
|
+
});
|
143
|
+
/**
|
144
|
+
* Check for the response and log the error if any.
|
145
|
+
*/
|
135
146
|
if (response !== null && response !== void 0 && response.body) {
|
147
|
+
var _response$body$data, _response$body$data$c;
|
148
|
+
const error = (_response$body$data = response.body.data) === null || _response$body$data === void 0 ? void 0 : (_response$body$data$c = _response$body$data.content) === null || _response$body$data$c === void 0 ? void 0 : _response$body$data$c.error;
|
149
|
+
if (!error) {
|
150
|
+
console.log("Invoke successful.");
|
151
|
+
continue;
|
152
|
+
}
|
136
153
|
console.log(JSON.stringify({
|
137
|
-
|
154
|
+
error
|
138
155
|
}, null, 2));
|
139
156
|
continue;
|
140
157
|
}
|
@@ -144,8 +161,12 @@ const createExecuteActionLambda = params => {
|
|
144
161
|
|
145
162
|
// TODO: Maybe update the status like error in original item in DB.
|
146
163
|
}
|
147
|
-
} catch (
|
148
|
-
|
164
|
+
} catch (ex) {
|
165
|
+
console.error("[HANDLER_EXECUTE_ACTION] => ", JSON.stringify({
|
166
|
+
message: ex.message,
|
167
|
+
code: ex.code,
|
168
|
+
data: ex.data
|
169
|
+
}));
|
149
170
|
// TODO: Maybe update the status like error in original item in DB.
|
150
171
|
}
|
151
172
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createExecuteActionLambda","params","storageOperations","createEvent","payload","context","log","console","applicationGraphQLPlugins","plugins","byType","ApplicationGraphQL","type","length","error","applicationGraphQLPluginCache","getApplicationGraphQLPlugin","data","plugin","canUse","apwSettings","getApwSettings","futureDatetime","datetime","locale","tenant","items","list","where","datetime_startsWith","getIsoStringTillMinutes","sort","limit","item","action","JSON","stringify","name","getArn","settings","url","getUrl","body","getGraphQLBody","response","handlerClient","invoke","httpMethod","path","headers","Authorization","encodeToken","id","await","e","executeActionHandlerPlugins","config","ContextPlugin","register","PageBuilderGraphQL","HeadlessCMSGraphQL","basePlugins"],"sources":["index.ts"],"sourcesContent":["import { ApwScheduleActionData, ApwScheduleActionStorageOperations } from \"~/scheduler/types\";\nimport { getIsoStringTillMinutes, encodeToken, basePlugins } from \"~/scheduler/handlers/utils\";\nimport { getApwSettings } from \"~/scheduler/handlers/utils\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { PageBuilderGraphQL } from \"./plugins/PageBuilderGraphQL\";\nimport { HeadlessCMSGraphQL } from \"./plugins/HeadlessCMSGraphQL\";\nimport { ApplicationGraphQL } from \"./plugins/ApplicationGraphQL\";\nimport { createEvent } from \"@webiny/handler\";\n\nexport interface HandlerArgs {\n datetime: string;\n tenant: string;\n locale: string;\n futureDatetime?: string;\n}\n\ninterface Configuration {\n storageOperations: ApwScheduleActionStorageOperations;\n}\n\n/**\n * Handler that execute the provided action(s) for the schedule action workflow.\n */\nconst createExecuteActionLambda = (params: Configuration) => {\n const { storageOperations } = params;\n\n return createEvent<HandlerArgs>(async ({ payload, context }) => {\n const log = console.log;\n\n const applicationGraphQLPlugins = context.plugins.byType<ApplicationGraphQL>(\n ApplicationGraphQL.type\n );\n\n if (applicationGraphQLPlugins.length === 0) {\n console.error(`There are no plugins to determine GraphQL endpoints or mutations.`);\n return;\n }\n\n const applicationGraphQLPluginCache: Record<string, ApplicationGraphQL> = {};\n\n const getApplicationGraphQLPlugin = (\n data: ApwScheduleActionData\n ): ApplicationGraphQL | null => {\n const { type } = data;\n if (applicationGraphQLPluginCache[type]) {\n return applicationGraphQLPluginCache[type];\n }\n for (const plugin of applicationGraphQLPlugins) {\n if (!plugin.canUse(data)) {\n continue;\n }\n applicationGraphQLPluginCache[type] = plugin;\n return plugin;\n }\n return null;\n };\n\n try {\n const apwSettings = await getApwSettings();\n\n const { futureDatetime: datetime, locale, tenant } = payload;\n /**\n * If there is no datetime we bail out early.\n */\n if (!datetime || typeof datetime !== \"string\") {\n log(`Bailing out!!`);\n return;\n }\n\n /**\n * Get tasks from the DB by datetime.\n */\n const [items] = await storageOperations.list({\n where: {\n tenant,\n locale,\n datetime_startsWith: getIsoStringTillMinutes(datetime)\n },\n sort: [\"datetime_ASC\"],\n limit: 1000\n });\n\n /**\n * Execute all actions.\n */\n if (!items || items.length === 0) {\n return;\n }\n log(`Found ${items.length} actions.`);\n for (const item of items) {\n log(\n `Performing mutation \"${item.data.action}\" on \"${item.data.type}\" at \"${item.data.datetime}\"`\n );\n\n const plugin = getApplicationGraphQLPlugin(item.data);\n if (!plugin) {\n console.error(\n `There is no plugin to determine GraphQL endpoint and mutations for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n const name = plugin.getArn(apwSettings);\n if (!name) {\n console.error(`There is no FunctionName found for type \"${item.data.type}\".`);\n console.log(\n JSON.stringify({\n item,\n settings: apwSettings\n })\n );\n continue;\n }\n\n const url = plugin.getUrl({\n locale,\n tenant\n });\n if (!url) {\n console.error(\n `There is no url defined, in the Plugin, for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n const body = plugin.getGraphQLBody(item.data);\n\n if (!body) {\n console.error(\n `There is no GraphQL body defined, in the Plugin, for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n // Perform the actual action call.\n const response = await context.handlerClient.invoke({\n name,\n payload: {\n httpMethod: \"POST\",\n path: url,\n headers: {\n [\"content-type\"]: \"application/json\",\n Authorization: encodeToken({\n id: item.id,\n locale: item.locale,\n tenant: item.tenant\n }),\n [\"x-tenant\"]: tenant,\n [\"x-i18n-locale\"]: `default:${locale};content:${locale};`\n },\n body: JSON.stringify(body)\n },\n await: true\n });\n if (response?.body) {\n console.log(JSON.stringify({ body: response.body }, null, 2));\n continue;\n }\n console.log(JSON.stringify({ response }, null, 2));\n\n // TODO: Maybe update the status like error in original item in DB.\n }\n } catch (e) {\n log(\"[HANDLER_EXECUTE_ACTION] Error => \", e);\n // TODO: Maybe update the status like error in original item in DB.\n }\n });\n};\n\nexport const executeActionHandlerPlugins = (config: Configuration) => [\n new ContextPlugin(async context => {\n context.plugins.register([new PageBuilderGraphQL(), new HeadlessCMSGraphQL()]);\n }),\n basePlugins(),\n createExecuteActionLambda(config)\n];\n"],"mappings":";;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA,MAAMA,yBAAyB,GAAIC,MAAqB,IAAK;EACzD,MAAM;IAAEC;EAAkB,CAAC,GAAGD,MAAM;EAEpC,OAAO,IAAAE,oBAAW,EAAc,OAAO;IAAEC,OAAO;IAAEC;EAAQ,CAAC,KAAK;IAC5D,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG;IAEvB,MAAME,yBAAyB,GAAGH,OAAO,CAACI,OAAO,CAACC,MAAM,CACpDC,sCAAkB,CAACC,IAAI,CAC1B;IAED,IAAIJ,yBAAyB,CAACK,MAAM,KAAK,CAAC,EAAE;MACxCN,OAAO,CAACO,KAAK,CAAE,mEAAkE,CAAC;MAClF;IACJ;IAEA,MAAMC,6BAAiE,GAAG,CAAC,CAAC;IAE5E,MAAMC,2BAA2B,GAC7BC,IAA2B,IACC;MAC5B,MAAM;QAAEL;MAAK,CAAC,GAAGK,IAAI;MACrB,IAAIF,6BAA6B,CAACH,IAAI,CAAC,EAAE;QACrC,OAAOG,6BAA6B,CAACH,IAAI,CAAC;MAC9C;MACA,KAAK,MAAMM,MAAM,IAAIV,yBAAyB,EAAE;QAC5C,IAAI,CAACU,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,EAAE;UACtB;QACJ;QACAF,6BAA6B,CAACH,IAAI,CAAC,GAAGM,MAAM;QAC5C,OAAOA,MAAM;MACjB;MACA,OAAO,IAAI;IACf,CAAC;IAED,IAAI;MACA,MAAME,WAAW,GAAG,MAAM,IAAAC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C3D,CAAC;YACDkB,IAAI,EAAEP,IAAI,CAACC,SAAS,CAACM,IAAI;UAC7B,CAAC;UACDW,KAAK,EAAE;QACX,CAAC,CAAC;QACF,IAAIT,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEF,IAAI,EAAE;UAChBnC,OAAO,CAACD,GAAG,CAAC6B,IAAI,CAACC,SAAS,CAAC;YAAEM,IAAI,EAAEE,QAAQ,CAACF;UAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;UAC7D;QACJ;QACAnC,OAAO,CAACD,GAAG,CAAC6B,IAAI,CAACC,SAAS,CAAC;UAAEQ;QAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;;QAElD;MACJ;IACJ,CAAC,CAAC,OAAOU,CAAC,EAAE;MACRhD,GAAG,CAAC,oCAAoC,EAAEgD,CAAC,CAAC;MAC5C;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;;AAEM,MAAMC,2BAA2B,GAAIC,MAAqB,IAAK,CAClE,IAAIC,kBAAa,CAAC,MAAMpD,OAAO,IAAI;EAC/BA,OAAO,CAACI,OAAO,CAACiD,QAAQ,CAAC,CAAC,IAAIC,sCAAkB,EAAE,EAAE,IAAIC,sCAAkB,EAAE,CAAC,CAAC;AAClF,CAAC,CAAC,EACF,IAAAC,kBAAW,GAAE,EACb7D,yBAAyB,CAACwD,MAAM,CAAC,CACpC;AAAC"}
|
1
|
+
{"version":3,"names":["createExecuteActionLambda","params","storageOperations","createRawEventHandler","payload","context","log","console","applicationGraphQLPlugins","plugins","byType","ApplicationGraphQL","type","length","error","applicationGraphQLPluginCache","getApplicationGraphQLPlugin","data","plugin","canUse","apwSettings","getApwSettings","futureDatetime","datetime","locale","tenant","items","list","where","datetime_startsWith","getIsoStringTillMinutes","sort","limit","item","action","JSON","stringify","name","getArn","settings","url","getUrl","body","getGraphQLBody","response","handlerClient","invoke","httpMethod","path","headers","Authorization","encodeToken","id","await","delete","content","ex","message","code","executeActionHandlerPlugins","config","ContextPlugin","register","PageBuilderGraphQL","HeadlessCMSGraphQL","basePlugins"],"sources":["index.ts"],"sourcesContent":["import { ApwScheduleActionData, ApwScheduleActionStorageOperations } from \"~/scheduler/types\";\nimport { getIsoStringTillMinutes, encodeToken, basePlugins } from \"~/scheduler/handlers/utils\";\nimport { getApwSettings } from \"~/scheduler/handlers/utils\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { PageBuilderGraphQL } from \"./plugins/PageBuilderGraphQL\";\nimport { HeadlessCMSGraphQL } from \"./plugins/HeadlessCMSGraphQL\";\nimport { ApplicationGraphQL } from \"./plugins/ApplicationGraphQL\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\n\nexport interface HandlerArgs {\n datetime: string;\n tenant: string;\n locale: string;\n futureDatetime?: string;\n}\n\ninterface Configuration {\n storageOperations: ApwScheduleActionStorageOperations;\n}\n\n/**\n * Handler that execute the provided action(s) for the schedule action workflow.\n */\nconst createExecuteActionLambda = (params: Configuration) => {\n const { storageOperations } = params;\n\n return createRawEventHandler<HandlerArgs>(async ({ payload, context }) => {\n const log = console.log;\n\n const applicationGraphQLPlugins = context.plugins.byType<ApplicationGraphQL>(\n ApplicationGraphQL.type\n );\n\n if (applicationGraphQLPlugins.length === 0) {\n console.error(`There are no plugins to determine GraphQL endpoints or mutations.`);\n return;\n }\n\n const applicationGraphQLPluginCache: Record<string, ApplicationGraphQL> = {};\n\n const getApplicationGraphQLPlugin = (\n data: ApwScheduleActionData\n ): ApplicationGraphQL | null => {\n const { type } = data;\n if (applicationGraphQLPluginCache[type]) {\n return applicationGraphQLPluginCache[type];\n }\n for (const plugin of applicationGraphQLPlugins) {\n if (!plugin.canUse(data)) {\n continue;\n }\n applicationGraphQLPluginCache[type] = plugin;\n return plugin;\n }\n return null;\n };\n\n try {\n const apwSettings = await getApwSettings();\n\n const { futureDatetime: datetime, locale, tenant } = payload;\n /**\n * If there is no datetime we bail out early.\n */\n if (!datetime || typeof datetime !== \"string\") {\n log(`Bailing out!!`);\n return;\n }\n\n /**\n * Get tasks from the DB by datetime.\n */\n const [items] = await storageOperations.list({\n where: {\n tenant,\n locale,\n datetime_startsWith: getIsoStringTillMinutes(datetime)\n },\n sort: [\"datetime_ASC\"],\n limit: 1000\n });\n\n /**\n * Execute all actions.\n */\n if (!items || items.length === 0) {\n return;\n }\n log(`Found ${items.length} actions.`);\n for (const item of items) {\n log(\n `Performing mutation \"${item.data.action}\" on \"${item.data.type}\" at \"${item.data.datetime}\"`\n );\n\n const plugin = getApplicationGraphQLPlugin(item.data);\n if (!plugin) {\n console.error(\n `There is no plugin to determine GraphQL endpoint and mutations for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n const name = plugin.getArn(apwSettings);\n if (!name) {\n console.error(`There is no FunctionName found for type \"${item.data.type}\".`);\n console.log(\n JSON.stringify({\n item,\n settings: apwSettings\n })\n );\n continue;\n }\n\n const url = plugin.getUrl({\n locale,\n tenant\n });\n if (!url) {\n console.error(\n `There is no url defined, in the Plugin, for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n const body = plugin.getGraphQLBody(item.data);\n\n if (!body) {\n console.error(\n `There is no GraphQL body defined, in the Plugin, for type \"${item.data.type}\".`\n );\n console.log(JSON.stringify(item));\n continue;\n }\n\n console.log(`Invoking Lambda \"${name}\" with url \"${url}\".`);\n // Perform the actual action call.\n const response = await context.handlerClient.invoke({\n name,\n payload: {\n httpMethod: \"POST\",\n path: url,\n headers: {\n [\"content-type\"]: \"application/json\",\n Authorization: encodeToken({\n id: item.id,\n locale: item.locale,\n tenant: item.tenant\n }),\n [\"x-tenant\"]: tenant,\n [\"x-i18n-locale\"]: `default:${locale};content:${locale};`\n },\n body: JSON.stringify(body)\n },\n await: true\n });\n /**\n *\n */\n await storageOperations.delete({\n locale,\n tenant,\n id: item.id\n });\n /**\n * Check for the response and log the error if any.\n */\n if (response?.body) {\n const error = response.body.data?.content?.error;\n if (!error) {\n console.log(\"Invoke successful.\");\n continue;\n }\n console.log(JSON.stringify({ error }, null, 2));\n continue;\n }\n console.log(JSON.stringify({ response }, null, 2));\n\n // TODO: Maybe update the status like error in original item in DB.\n }\n } catch (ex) {\n console.error(\n \"[HANDLER_EXECUTE_ACTION] => \",\n JSON.stringify({\n message: ex.message,\n code: ex.code,\n data: ex.data\n })\n );\n // TODO: Maybe update the status like error in original item in DB.\n }\n });\n};\n\nexport const executeActionHandlerPlugins = (config: Configuration) => [\n new ContextPlugin(async context => {\n context.plugins.register([new PageBuilderGraphQL(), new HeadlessCMSGraphQL()]);\n }),\n basePlugins(),\n createExecuteActionLambda(config)\n];\n"],"mappings":";;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA,MAAMA,yBAAyB,GAAIC,MAAqB,IAAK;EACzD,MAAM;IAAEC;EAAkB,CAAC,GAAGD,MAAM;EAEpC,OAAO,IAAAE,iCAAqB,EAAc,OAAO;IAAEC,OAAO;IAAEC;EAAQ,CAAC,KAAK;IACtE,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG;IAEvB,MAAME,yBAAyB,GAAGH,OAAO,CAACI,OAAO,CAACC,MAAM,CACpDC,sCAAkB,CAACC,IAAI,CAC1B;IAED,IAAIJ,yBAAyB,CAACK,MAAM,KAAK,CAAC,EAAE;MACxCN,OAAO,CAACO,KAAK,CAAE,mEAAkE,CAAC;MAClF;IACJ;IAEA,MAAMC,6BAAiE,GAAG,CAAC,CAAC;IAE5E,MAAMC,2BAA2B,GAC7BC,IAA2B,IACC;MAC5B,MAAM;QAAEL;MAAK,CAAC,GAAGK,IAAI;MACrB,IAAIF,6BAA6B,CAACH,IAAI,CAAC,EAAE;QACrC,OAAOG,6BAA6B,CAACH,IAAI,CAAC;MAC9C;MACA,KAAK,MAAMM,MAAM,IAAIV,yBAAyB,EAAE;QAC5C,IAAI,CAACU,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,EAAE;UACtB;QACJ;QACAF,6BA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C,CACL;MACD;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;;AAEM,MAAM0C,2BAA2B,GAAIC,MAAqB,IAAK,CAClE,IAAIC,kBAAa,CAAC,MAAMxD,OAAO,IAAI;EAC/BA,OAAO,CAACI,OAAO,CAACqD,QAAQ,CAAC,CAAC,IAAIC,sCAAkB,EAAE,EAAE,IAAIC,sCAAkB,EAAE,CAAC,CAAC;AAClF,CAAC,CAAC,EACF,IAAAC,kBAAW,GAAE,EACbjE,yBAAyB,CAAC4D,MAAM,CAAC,CACpC;AAAC"}
|
@@ -134,7 +134,11 @@ const createScheduleActionLambda = params => {
|
|
134
134
|
item: nextItem
|
135
135
|
});
|
136
136
|
} catch (ex) {
|
137
|
-
|
137
|
+
console.error("[HANDLER_CREATE_RULE] => ", JSON.stringify({
|
138
|
+
message: ex.message,
|
139
|
+
code: ex.code,
|
140
|
+
data: ex.data
|
141
|
+
}));
|
138
142
|
// TODO: Handler error. Maybe save it into DB.
|
139
143
|
}
|
140
144
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["InvocationTypes","log","console","createScheduleActionLambda","params","cwClient","cloudWatchEventClient","storageOperations","handlers","createRawEventHandler","payload","context","lambdaContext","eventContext","locale","tenant","invocationType","SCHEDULED","executeTask","args","lambdaName","executeAction","handlerClient","currentTask","getCurrentTask","where","nextItem","list","sort","limit","nextTaskDatetime","data","datetime","currentTaskDatetime","isDateTimeInNextCentury","shouldScheduleTask","futureDatetime","moveDateTimeToNextCentury","update","item","input","shouldRestoreDatetime","restoreDateTime","task","scheduleLambdaExecution","invokedFunctionArn","updateCurrentTask","ex","scheduleActionHandlerPlugins","config","basePlugins"],"sources":["index.ts"],"sourcesContent":["/**\n * This logic/file should be moved somewhere else as it is relying on AWS specific stuff.\n */\nimport { ApwScheduleActionStorageOperations } from \"~/scheduler/types\";\nimport {\n isDateTimeInNextCentury,\n moveDateTimeToNextCentury,\n shouldRestoreDatetime,\n basePlugins\n} from \"~/scheduler/handlers/utils\";\nimport {\n executeTask,\n shouldScheduleTask,\n restoreDateTime,\n scheduleLambdaExecution\n} from \"./scheduleAction.utils\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\n\nexport enum InvocationTypes {\n SCHEDULED = \"scheduled\"\n}\n\nexport interface HandlerArgs {\n datetime: string;\n tenant: string;\n locale: string;\n invocationType?: InvocationTypes;\n futureDatetime?: string;\n}\n\nexport interface Configuration {\n cwClient: any;\n storageOperations: ApwScheduleActionStorageOperations;\n handlers: {\n executeAction: string;\n };\n}\n\nconst log = console.log;\n\n/**\n * Handler that creates a cloudwatch event rule for the schedule action workflow.\n */\nconst createScheduleActionLambda = (params: Configuration) => {\n const { cwClient: cloudWatchEventClient, storageOperations, handlers } = params;\n\n return createRawEventHandler<HandlerArgs>(\n async ({ payload, context, lambdaContext: eventContext }) => {\n try {\n const { locale, tenant, invocationType } = payload;\n /**\n * If invocationType is \"scheduled\", execute the action.\n */\n if (invocationType === InvocationTypes.SCHEDULED) {\n await executeTask({\n args: payload,\n lambdaName: handlers.executeAction,\n handlerClient: context.handlerClient,\n storageOperations\n });\n }\n\n /**\n * Get current scheduled task from the DB.\n */\n const currentTask = await storageOperations.getCurrentTask({\n where: {\n tenant,\n locale\n }\n });\n\n /**\n * Get next task from the DB.\n */\n const [[nextItem]] = await storageOperations.list({\n where: {\n tenant,\n locale\n },\n sort: [\"datetime_ASC\"],\n limit: 1\n });\n\n if (!nextItem) {\n log(`No item found.`);\n return;\n }\n\n const nextTaskDatetime = nextItem.data.datetime;\n const currentTaskDatetime = currentTask && currentTask.data.datetime;\n\n if (isDateTimeInNextCentury(nextTaskDatetime)) {\n log(`Already processed the task.`);\n return;\n }\n\n if (!shouldScheduleTask(nextTaskDatetime, currentTaskDatetime)) {\n log(`Already scheduled the task.`);\n return;\n }\n\n const futureDatetime = moveDateTimeToNextCentury(nextItem.data.datetime);\n /**\n * Update \"datetime\" to a future date to mark it as scheduled.\n */\n log(`Update task's datetime to `, futureDatetime);\n await storageOperations.update({\n item: {\n ...nextItem,\n data: { ...nextItem.data, datetime: futureDatetime }\n },\n input: { ...nextItem.data, datetime: futureDatetime }\n });\n /**\n * Restore \"datetime\" of current task so that it can be schedule in next cycle.\n */\n if (\n currentTaskDatetime &&\n shouldRestoreDatetime({\n invocationType,\n datetime: currentTaskDatetime\n })\n ) {\n await restoreDateTime({\n tenant,\n locale,\n task: currentTask,\n storageOperations\n });\n }\n /**\n * Schedule Lambda\n */\n log(`Schedule Lambda Execution...`);\n await scheduleLambdaExecution({\n cloudWatchEventClient,\n invokedFunctionArn: eventContext.invokedFunctionArn,\n datetime: nextItem.data.datetime,\n futureDatetime: futureDatetime,\n tenant,\n locale\n });\n /**\n * Update current task.\n */\n await storageOperations.updateCurrentTask({ item: nextItem });\n } catch (ex) {\n
|
1
|
+
{"version":3,"names":["InvocationTypes","log","console","createScheduleActionLambda","params","cwClient","cloudWatchEventClient","storageOperations","handlers","createRawEventHandler","payload","context","lambdaContext","eventContext","locale","tenant","invocationType","SCHEDULED","executeTask","args","lambdaName","executeAction","handlerClient","currentTask","getCurrentTask","where","nextItem","list","sort","limit","nextTaskDatetime","data","datetime","currentTaskDatetime","isDateTimeInNextCentury","shouldScheduleTask","futureDatetime","moveDateTimeToNextCentury","update","item","input","shouldRestoreDatetime","restoreDateTime","task","scheduleLambdaExecution","invokedFunctionArn","updateCurrentTask","ex","error","JSON","stringify","message","code","scheduleActionHandlerPlugins","config","basePlugins"],"sources":["index.ts"],"sourcesContent":["/**\n * This logic/file should be moved somewhere else as it is relying on AWS specific stuff.\n */\nimport { ApwScheduleActionStorageOperations } from \"~/scheduler/types\";\nimport {\n isDateTimeInNextCentury,\n moveDateTimeToNextCentury,\n shouldRestoreDatetime,\n basePlugins\n} from \"~/scheduler/handlers/utils\";\nimport {\n executeTask,\n shouldScheduleTask,\n restoreDateTime,\n scheduleLambdaExecution\n} from \"./scheduleAction.utils\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\n\nexport enum InvocationTypes {\n SCHEDULED = \"scheduled\"\n}\n\nexport interface HandlerArgs {\n datetime: string;\n tenant: string;\n locale: string;\n invocationType?: InvocationTypes;\n futureDatetime?: string;\n}\n\nexport interface Configuration {\n cwClient: any;\n storageOperations: ApwScheduleActionStorageOperations;\n handlers: {\n executeAction: string;\n };\n}\n\nconst log = console.log;\n\n/**\n * Handler that creates a cloudwatch event rule for the schedule action workflow.\n */\nconst createScheduleActionLambda = (params: Configuration) => {\n const { cwClient: cloudWatchEventClient, storageOperations, handlers } = params;\n\n return createRawEventHandler<HandlerArgs>(\n async ({ payload, context, lambdaContext: eventContext }) => {\n try {\n const { locale, tenant, invocationType } = payload;\n /**\n * If invocationType is \"scheduled\", execute the action.\n */\n if (invocationType === InvocationTypes.SCHEDULED) {\n await executeTask({\n args: payload,\n lambdaName: handlers.executeAction,\n handlerClient: context.handlerClient,\n storageOperations\n });\n }\n\n /**\n * Get current scheduled task from the DB.\n */\n const currentTask = await storageOperations.getCurrentTask({\n where: {\n tenant,\n locale\n }\n });\n\n /**\n * Get next task from the DB.\n */\n const [[nextItem]] = await storageOperations.list({\n where: {\n tenant,\n locale\n },\n sort: [\"datetime_ASC\"],\n limit: 1\n });\n\n if (!nextItem) {\n log(`No item found.`);\n return;\n }\n\n const nextTaskDatetime = nextItem.data.datetime;\n const currentTaskDatetime = currentTask && currentTask.data.datetime;\n\n if (isDateTimeInNextCentury(nextTaskDatetime)) {\n log(`Already processed the task.`);\n return;\n }\n\n if (!shouldScheduleTask(nextTaskDatetime, currentTaskDatetime)) {\n log(`Already scheduled the task.`);\n return;\n }\n\n const futureDatetime = moveDateTimeToNextCentury(nextItem.data.datetime);\n /**\n * Update \"datetime\" to a future date to mark it as scheduled.\n */\n log(`Update task's datetime to `, futureDatetime);\n await storageOperations.update({\n item: {\n ...nextItem,\n data: { ...nextItem.data, datetime: futureDatetime }\n },\n input: { ...nextItem.data, datetime: futureDatetime }\n });\n /**\n * Restore \"datetime\" of current task so that it can be schedule in next cycle.\n */\n if (\n currentTaskDatetime &&\n shouldRestoreDatetime({\n invocationType,\n datetime: currentTaskDatetime\n })\n ) {\n await restoreDateTime({\n tenant,\n locale,\n task: currentTask,\n storageOperations\n });\n }\n /**\n * Schedule Lambda\n */\n log(`Schedule Lambda Execution...`);\n await scheduleLambdaExecution({\n cloudWatchEventClient,\n invokedFunctionArn: eventContext.invokedFunctionArn,\n datetime: nextItem.data.datetime,\n futureDatetime: futureDatetime,\n tenant,\n locale\n });\n /**\n * Update current task.\n */\n await storageOperations.updateCurrentTask({ item: nextItem });\n } catch (ex) {\n console.error(\n \"[HANDLER_CREATE_RULE] => \",\n JSON.stringify({\n message: ex.message,\n code: ex.code,\n data: ex.data\n })\n );\n // TODO: Handler error. Maybe save it into DB.\n }\n }\n );\n};\n\nexport const scheduleActionHandlerPlugins = (config: Configuration) => [\n basePlugins(),\n createScheduleActionLambda(config)\n];\n"],"mappings":";;;;;;;;AAIA;AAMA;AAMA;AAhBA;AACA;AACA;AAFA,IAkBYA,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe;AAoB3B,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG;;AAEvB;AACA;AACA;AACA,MAAME,0BAA0B,GAAIC,MAAqB,IAAK;EAC1D,MAAM;IAAEC,QAAQ,EAAEC,qBAAqB;IAAEC,iBAAiB;IAAEC;EAAS,CAAC,GAAGJ,MAAM;EAE/E,OAAO,IAAAK,iCAAqB,EACxB,OAAO;IAAEC,OAAO;IAAEC,OAAO;IAAEC,aAAa,EAAEC;EAAa,CAAC,KAAK;IACzD,IAAI;MACA,MAAM;QAAEC,MAAM;QAAEC,MAAM;QAAEC;MAAe,CAAC,GAAGN,OAAO;MAClD;AAChB;AACA;MACgB,IAAIM,cAAc,KAAKhB,eAAe,CAACiB,SAAS,EAAE;QAC9C,MAAM,IAAAC,2BAAW,EAAC;UACdC,IAAI,EAAET,OAAO;UACbU,UAAU,EAAEZ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,CAACK,IAAI;UAAEC,QAAQ,EAAEI;QAAc;MACvD,CAAC,CAAC;MACF;AAChB;AACA;MACgB,IACIH,mBAAmB,IACnB,IAAAQ,4BAAqB,EAAC;QAClBzB,cAAc;QACdgB,QAAQ,EAAEC;MACd,CAAC,CAAC,EACJ;QACE,MAAM,IAAAS,+BAAe,EAAC;UAClB3B,MAAM;UACND,MAAM;UACN6B,IAAI,EAAEpB,WAAW;UACjBhB;QACJ,CAAC,CAAC;MACN;MACA;AAChB;AACA;MACgBN,GAAG,CAAE,8BAA6B,CAAC;MACnC,MAAM,IAAA2C,uCAAuB,EAAC;QAC1BtC,qBAAqB;QACrBuC,kBAAkB,EAAEhC,YAAY,CAACgC,kBAAkB;QACnDb,QAAQ,EAAEN,QAAQ,CAACK,IAAI,CAACC,QAAQ;QAChCI,cAAc,EAAEA,cAAc;QAC9BrB,MAAM;QACND;MACJ,CAAC,CAAC;MACF;AAChB;AACA;MACgB,MAAMP,iBAAiB,CAACuC,iBAAiB,CAAC;QAAEP,IAAI,EAAEb;MAAS,CAAC,CAAC;IACjE,CAAC,CAAC,OAAOqB,EAAE,EAAE;MACT7C,OAAO,CAAC8C,KAAK,CACT,2BAA2B,EAC3BC,IAAI,CAACC,SAAS,CAAC;QACXC,OAAO,EAAEJ,EAAE,CAACI,OAAO;QACnBC,IAAI,EAAEL,EAAE,CAACK,IAAI;QACbrB,IAAI,EAAEgB,EAAE,CAAChB;MACb,CAAC,CAAC,CACL;MACD;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;;AAEM,MAAMsB,4BAA4B,GAAIC,MAAqB,IAAK,CACnE,IAAAC,kBAAW,GAAE,EACbpD,0BAA0B,CAACmD,MAAM,CAAC,CACrC;AAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["log","console","scheduleLambdaExecution","cloudWatchEventClient","invokedFunctionArn","datetime","futureDatetime","tenant","locale","eventTargetId","eventRuleName","getApwSettings","removeTargetsCommand","RemoveTargetsCommand","Rule","Ids","removeTargetsResponse","send","FailedEntryCount","info","FailedEntries","deleteRuleCommand","DeleteRuleCommand","Name","cronExpression","dateTimeToCronExpression","ruleParams","ScheduleExpression","State","Description","PutRuleCommand","PutTargetsCommand","Targets","Arn","Id","Input","JSON","stringify","invocationType","InvocationTypes","SCHEDULED","shouldScheduleTask","nextTaskDatetime","currentTaskDatetime","restoreDateTime","task","currentTask","storageOperations","id","item","get","where","newDateTime","moveDateTimeToCurrentCentury","data","update","input","executeTask","args","lambdaName","handlerClient","Date","toISOString","invoke","name","payload","await","deleteCurrentTask","e","error"],"sources":["scheduleAction.utils.ts"],"sourcesContent":["import { dateTimeToCronExpression, moveDateTimeToCurrentCentury } from \"~/scheduler/handlers/utils\";\nimport { ApwScheduleAction } from \"~/scheduler/types\";\nimport {\n HandlerArgs,\n InvocationTypes,\n Configuration\n} from \"~/scheduler/handlers/scheduleAction/index\";\nimport {\n DeleteRuleCommand,\n RemoveTargetsCommand,\n PutTargetsCommand,\n PutRuleCommand\n} from \"@aws-sdk/client-cloudwatch-events\";\nimport { ClientContext } from \"@webiny/handler-client/types\";\nimport { getApwSettings } from \"~/scheduler/handlers/utils\";\n\nconst log = console.log;\n\ninterface ScheduleLambdaExecutionParams extends Omit<HandlerArgs, \"invocationType\"> {\n cloudWatchEventClient: any;\n invokedFunctionArn: string;\n}\n\n/**\n * Current API limit/quota for Cloudwatch events is sufficient for now. But, we should watch for it;\n * in case of scheduling becoming the most frequently used feature.\n * https://aws.amazon.com/about-aws/whats-new/2017/07/cloudwatch-events-increases-rules-and-api-requests-limits/\n */\nexport async function scheduleLambdaExecution({\n cloudWatchEventClient,\n invokedFunctionArn,\n datetime,\n futureDatetime,\n tenant,\n locale\n}: ScheduleLambdaExecutionParams) {\n const { eventTargetId, eventRuleName } = await getApwSettings();\n /**\n * Remove the target\n */\n const removeTargetsCommand = new RemoveTargetsCommand({\n Rule: eventRuleName,\n Ids: [eventTargetId]\n });\n const removeTargetsResponse = await cloudWatchEventClient.send(removeTargetsCommand);\n /**\n * Log error.\n */\n if (\n typeof removeTargetsResponse.FailedEntryCount === \"number\" &&\n removeTargetsResponse.FailedEntryCount !== 0\n ) {\n console.info(\"Failed in removing the targets!\");\n console.info(removeTargetsResponse.FailedEntries);\n }\n /**\n * Delete the Rule\n */\n const deleteRuleCommand = new DeleteRuleCommand({\n Name: eventRuleName\n });\n await cloudWatchEventClient.send(deleteRuleCommand);\n\n /**\n * Create a new one.\n * Min H D M DW Y\n * 20 10 10 03 * 2022\n */\n const cronExpression = dateTimeToCronExpression(datetime);\n\n const ruleParams = {\n Name: eventRuleName,\n ScheduleExpression: `cron(${cronExpression})`,\n State: \"ENABLED\",\n Description: `Enable us to schedule an action in publishing workflow at a particular datetime`\n };\n\n await cloudWatchEventClient.send(new PutRuleCommand(ruleParams));\n /**\n * Add lambda as target for the rule.\n */\n await cloudWatchEventClient.send(\n new PutTargetsCommand({\n Rule: eventRuleName,\n Targets: [\n {\n Arn: invokedFunctionArn,\n Id: eventTargetId,\n Input: JSON.stringify({\n datetime: datetime,\n tenant: tenant,\n locale: locale,\n invocationType: InvocationTypes.SCHEDULED,\n futureDatetime: futureDatetime\n } as HandlerArgs)\n }\n ]\n })\n );\n}\n\nexport const shouldScheduleTask = (\n nextTaskDatetime: string,\n currentTaskDatetime: string | null\n): boolean => {\n return !currentTaskDatetime || nextTaskDatetime < currentTaskDatetime;\n};\n\ninterface RestoreDateTimeParams\n extends Pick<Configuration, \"storageOperations\">,\n Pick<HandlerArgs, \"tenant\" | \"locale\"> {\n task: ApwScheduleAction;\n}\n\nexport const restoreDateTime = async ({\n locale,\n tenant,\n task: currentTask,\n storageOperations\n}: RestoreDateTimeParams): Promise<void> => {\n log(`Mark task \"${currentTask.id}\" as undone by restoring original \"datetime\".`);\n const item = await storageOperations.get({\n where: {\n tenant,\n locale,\n id: currentTask.id\n }\n });\n if (item) {\n const newDateTime = moveDateTimeToCurrentCentury(item.data.datetime);\n await storageOperations.update({\n item: {\n ...item,\n data: { ...item.data, datetime: newDateTime }\n },\n input: { ...item.data, datetime: newDateTime }\n });\n }\n};\n\ninterface ExecuteTaskParams\n extends Pick<ClientContext, \"handlerClient\">,\n Pick<Configuration, \"storageOperations\"> {\n args: HandlerArgs;\n lambdaName: string;\n}\n\nexport const executeTask = async ({\n args,\n lambdaName,\n handlerClient,\n storageOperations\n}: ExecuteTaskParams): Promise<void> => {\n log(`Executing task at: `, new Date().toISOString());\n\n if (typeof handlerClient.invoke === \"function\") {\n await handlerClient.invoke({\n name: lambdaName,\n payload: {\n futureDatetime: args.futureDatetime,\n datetime: args.datetime,\n tenant: args.tenant,\n locale: args.locale\n },\n await: false\n });\n }\n\n /**\n * Delete current schedule Task. So that, we can schedule a new one later.\n */\n try {\n await storageOperations.deleteCurrentTask({\n tenant: args.tenant,\n locale: args.locale\n });\n } catch (e) {\n console.error(e);\n }\n};\n"],"mappings":";;;;;;;;;;AAAA;AAEA;AAKA;AASA,MAAMA,GAAG,GAAGC,OAAO,CAACD,GAAG;AAOvB;AACA;AACA;AACA;AACA;AACO,eAAeE,uBAAuB,CAAC;EAC1CC,qBAAqB;EACrBC,kBAAkB;EAClBC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC;AAC2B,CAAC,EAAE;EAC9B,MAAM;IAAEC,aAAa;IAAEC;EAAc,CAAC,GAAG,MAAM,IAAAC,qBAAc,GAAE;EAC/D;AACJ;AACA;EACI,MAAMC,oBAAoB,GAAG,IAAIC,4CAAoB,CAAC;IAClDC,IAAI,EAAEJ,aAAa;IACnBK,GAAG,EAAE,CAACN,aAAa;EACvB,CAAC,CAAC;EACF,MAAMO,qBAAqB,GAAG,MAAMb,qBAAqB,CAACc,IAAI,CAACL,oBAAoB,CAAC;EACpF;AACJ;AACA;EACI,IACI,OAAOI,qBAAqB,CAACE,gBAAgB,KAAK,QAAQ,IAC1DF,qBAAqB,CAACE,gBAAgB,KAAK,CAAC,EAC9C;IACEjB,OAAO,CAACkB,IAAI,CAAC,iCAAiC,C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/C,GAAG,CAAE,cAAa8C,WAAW,CAACE,EAAG,+CAA8C,CAAC;EAChF,MAAMC,IAAI,GAAG,MAAMF,iBAAiB,CAACG,GAAG,CAAC;IACrCC,KAAK,EAAE;MACH5C,MAAM;MACNC,MAAM;MACNwC,EAAE,EAAEF,WAAW,CAACE;IACpB;EACJ,CAAC,CAAC;EACF,IAAIC,IAAI,EAAE;IACN,MAAMG,WAAW,GAAG,IAAAC,mCAA4B,EAACJ,IAAI,CAACK,IAAI,CAACjD,QAAQ,CAAC;IACpE,MAAM0C,iBAAiB,CAACQ,MAAM,CAAC;MAC3BN,IAAI,8DACGA,IAAI;QACPK,IAAI,8DAAOL,IAAI,CAACK,IAAI;UAAEjD,QAAQ,EAAE+C;QAAW;MAAE,EAChD;MACDI,KAAK,8DAAOP,IAAI,CAACK,IAAI;QAAEjD,QAAQ,EAAE+C;MAAW;IAChD,CAAC,CAAC;EACN;AACJ,CAAC;AAAC;AASK,MAAMK,WAAW,GAAG,OAAO;EAC9BC,IAAI;EACJC,UAAU;EACVC,aAAa;EACbb;AACe,CAAC,KAAoB;EACpC/C,GAAG,CAAE,qBAAoB,EAAE,IAAI6D,IAAI,EAAE,CAACC,WAAW,EAAE,CAAC;EAEpD,IAAI,OAAOF,aAAa,CAACG,MAAM,KAAK,UAAU,EAAE;IAC5C,MAAMH,aAAa,CAACG,MAAM,CAAC;MACvBC,IAAI,EAAEL,UAAU;MAChBM,OAAO,EAAE;QACL3D,cAAc,EAAEoD,IAAI,CAACpD,cAAc;QACnCD,QAAQ,EAAEqD,IAAI,CAACrD,QAAQ;QACvBE,MAAM,EAAEmD,IAAI,CAACnD,MAAM;QACnBC,MAAM,EAAEkD,IAAI,CAAClD;MACjB,CAAC;MACD0D,KAAK,EAAE;IACX,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAI;IACA,
|
1
|
+
{"version":3,"names":["log","console","scheduleLambdaExecution","cloudWatchEventClient","invokedFunctionArn","datetime","futureDatetime","tenant","locale","eventTargetId","eventRuleName","getApwSettings","removeTargetsCommand","RemoveTargetsCommand","Rule","Ids","removeTargetsResponse","send","FailedEntryCount","info","FailedEntries","deleteRuleCommand","DeleteRuleCommand","Name","cronExpression","dateTimeToCronExpression","ruleParams","ScheduleExpression","State","Description","PutRuleCommand","PutTargetsCommand","Targets","Arn","Id","Input","JSON","stringify","invocationType","InvocationTypes","SCHEDULED","shouldScheduleTask","nextTaskDatetime","currentTaskDatetime","restoreDateTime","task","currentTask","storageOperations","id","item","get","where","newDateTime","moveDateTimeToCurrentCentury","data","update","input","executeTask","args","lambdaName","handlerClient","Date","toISOString","invoke","name","payload","await","deleteCurrentTask","e","error"],"sources":["scheduleAction.utils.ts"],"sourcesContent":["import { dateTimeToCronExpression, moveDateTimeToCurrentCentury } from \"~/scheduler/handlers/utils\";\nimport { ApwScheduleAction } from \"~/scheduler/types\";\nimport {\n HandlerArgs,\n InvocationTypes,\n Configuration\n} from \"~/scheduler/handlers/scheduleAction/index\";\nimport {\n DeleteRuleCommand,\n RemoveTargetsCommand,\n PutTargetsCommand,\n PutRuleCommand\n} from \"@aws-sdk/client-cloudwatch-events\";\nimport { ClientContext } from \"@webiny/handler-client/types\";\nimport { getApwSettings } from \"~/scheduler/handlers/utils\";\n\nconst log = console.log;\n\ninterface ScheduleLambdaExecutionParams extends Omit<HandlerArgs, \"invocationType\"> {\n cloudWatchEventClient: any;\n invokedFunctionArn: string;\n}\n\n/**\n * Current API limit/quota for Cloudwatch events is sufficient for now. But, we should watch for it;\n * in case of scheduling becoming the most frequently used feature.\n * https://aws.amazon.com/about-aws/whats-new/2017/07/cloudwatch-events-increases-rules-and-api-requests-limits/\n */\nexport async function scheduleLambdaExecution({\n cloudWatchEventClient,\n invokedFunctionArn,\n datetime,\n futureDatetime,\n tenant,\n locale\n}: ScheduleLambdaExecutionParams) {\n const { eventTargetId, eventRuleName } = await getApwSettings();\n /**\n * Remove the target\n */\n const removeTargetsCommand = new RemoveTargetsCommand({\n Rule: eventRuleName,\n Ids: [eventTargetId]\n });\n const removeTargetsResponse = await cloudWatchEventClient.send(removeTargetsCommand);\n /**\n * Log error.\n */\n if (\n typeof removeTargetsResponse.FailedEntryCount === \"number\" &&\n removeTargetsResponse.FailedEntryCount !== 0\n ) {\n console.info(\"Failed in removing the targets!\");\n console.info(removeTargetsResponse.FailedEntries);\n }\n /**\n * Delete the Rule\n */\n const deleteRuleCommand = new DeleteRuleCommand({\n Name: eventRuleName\n });\n await cloudWatchEventClient.send(deleteRuleCommand);\n\n /**\n * Create a new one.\n * Min H D M DW Y\n * 20 10 10 03 * 2022\n */\n const cronExpression = dateTimeToCronExpression(datetime);\n\n const ruleParams = {\n Name: eventRuleName,\n ScheduleExpression: `cron(${cronExpression})`,\n State: \"ENABLED\",\n Description: `Enable us to schedule an action in publishing workflow at a particular datetime`\n };\n\n await cloudWatchEventClient.send(new PutRuleCommand(ruleParams));\n /**\n * Add lambda as target for the rule.\n */\n await cloudWatchEventClient.send(\n new PutTargetsCommand({\n Rule: eventRuleName,\n Targets: [\n {\n Arn: invokedFunctionArn,\n Id: eventTargetId,\n Input: JSON.stringify({\n datetime: datetime,\n tenant: tenant,\n locale: locale,\n invocationType: InvocationTypes.SCHEDULED,\n futureDatetime: futureDatetime\n } as HandlerArgs)\n }\n ]\n })\n );\n}\n\nexport const shouldScheduleTask = (\n nextTaskDatetime: string,\n currentTaskDatetime: string | null\n): boolean => {\n return !currentTaskDatetime || nextTaskDatetime < currentTaskDatetime;\n};\n\ninterface RestoreDateTimeParams\n extends Pick<Configuration, \"storageOperations\">,\n Pick<HandlerArgs, \"tenant\" | \"locale\"> {\n task: ApwScheduleAction;\n}\n\nexport const restoreDateTime = async ({\n locale,\n tenant,\n task: currentTask,\n storageOperations\n}: RestoreDateTimeParams): Promise<void> => {\n log(`Mark task \"${currentTask.id}\" as undone by restoring original \"datetime\".`);\n const item = await storageOperations.get({\n where: {\n tenant,\n locale,\n id: currentTask.id\n }\n });\n if (item) {\n const newDateTime = moveDateTimeToCurrentCentury(item.data.datetime);\n await storageOperations.update({\n item: {\n ...item,\n data: { ...item.data, datetime: newDateTime }\n },\n input: { ...item.data, datetime: newDateTime }\n });\n }\n};\n\ninterface ExecuteTaskParams\n extends Pick<ClientContext, \"handlerClient\">,\n Pick<Configuration, \"storageOperations\"> {\n args: HandlerArgs;\n lambdaName: string;\n}\n\nexport const executeTask = async ({\n args,\n lambdaName,\n handlerClient,\n storageOperations\n}: ExecuteTaskParams): Promise<void> => {\n log(`Executing task at: `, new Date().toISOString());\n\n if (typeof handlerClient.invoke === \"function\") {\n await handlerClient.invoke({\n name: lambdaName,\n payload: {\n futureDatetime: args.futureDatetime,\n datetime: args.datetime,\n tenant: args.tenant,\n locale: args.locale\n },\n await: false\n });\n } else {\n console.log(`context.handlerClient.invoke is not a function!`);\n }\n\n /**\n * Delete current schedule Task. So that, we can schedule a new one later.\n */\n try {\n await storageOperations.deleteCurrentTask({\n tenant: args.tenant,\n locale: args.locale\n });\n } catch (e) {\n console.error(e);\n }\n};\n"],"mappings":";;;;;;;;;;AAAA;AAEA;AAKA;AASA,MAAMA,GAAG,GAAGC,OAAO,CAACD,GAAG;AAOvB;AACA;AACA;AACA;AACA;AACO,eAAeE,uBAAuB,CAAC;EAC1CC,qBAAqB;EACrBC,kBAAkB;EAClBC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC;AAC2B,CAAC,EAAE;EAC9B,MAAM;IAAEC,aAAa;IAAEC;EAAc,CAAC,GAAG,MAAM,IAAAC,qBAAc,GAAE;EAC/D;AACJ;AACA;EACI,MAAMC,oBAAoB,GAAG,IAAIC,4CAAoB,CAAC;IAClDC,IAAI,EAAEJ,aAAa;IACnBK,GAAG,EAAE,CAACN,aAAa;EACvB,CAAC,CAAC;EACF,MAAMO,qBAAqB,GAAG,MAAMb,qBAAqB,CAACc,IAAI,CAACL,oBAAoB,CAAC;EACpF;AACJ;AACA;EACI,IACI,OAAOI,qBAAqB,CAACE,gBAAgB,KAAK,QAAQ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AACD,GAAG,CAAE,iDAAgD,CAAC;EAClE;;EAEA;AACJ;AACA;EACI,IAAI;IACA,MAAM+C,iBAAiB,CAACoB,iBAAiB,CAAC;MACtC5D,MAAM,EAAEmD,IAAI,CAACnD,MAAM;MACnBC,MAAM,EAAEkD,IAAI,CAAClD;IACjB,CAAC,CAAC;EACN,CAAC,CAAC,OAAO4D,CAAC,EAAE;IACRnE,OAAO,CAACoE,KAAK,CAACD,CAAC,CAAC;EACpB;AACJ,CAAC;AAAC"}
|
package/scheduler/types.d.ts
CHANGED
@@ -3,6 +3,7 @@ import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types
|
|
3
3
|
import { I18NLocale, I18NContext } from "@webiny/api-i18n/types";
|
4
4
|
import { Tenant } from "@webiny/api-tenancy/types";
|
5
5
|
import { TenancyContext } from "@webiny/api-tenancy/types";
|
6
|
+
import { ApwIdentity } from "../types";
|
6
7
|
export interface ListWhere {
|
7
8
|
/**
|
8
9
|
* Fields.
|
@@ -29,25 +30,6 @@ export interface ListParams {
|
|
29
30
|
limit?: number;
|
30
31
|
after?: string;
|
31
32
|
}
|
32
|
-
/**
|
33
|
-
* A interface describing the reference to a user that created some data in the database.
|
34
|
-
*
|
35
|
-
* @category General
|
36
|
-
*/
|
37
|
-
export interface CreatedBy {
|
38
|
-
/**
|
39
|
-
* ID if the user.
|
40
|
-
*/
|
41
|
-
id: string;
|
42
|
-
/**
|
43
|
-
* Full name of the user.
|
44
|
-
*/
|
45
|
-
displayName: string | null;
|
46
|
-
/**
|
47
|
-
* Type of the user (admin, user)
|
48
|
-
*/
|
49
|
-
type: string;
|
50
|
-
}
|
51
33
|
export interface ListMeta {
|
52
34
|
/**
|
53
35
|
* A cursor for pagination.
|
@@ -70,7 +52,7 @@ export interface BaseFields {
|
|
70
52
|
id: string;
|
71
53
|
createdOn: string;
|
72
54
|
savedOn?: string;
|
73
|
-
createdBy:
|
55
|
+
createdBy: ApwIdentity;
|
74
56
|
tenant: string;
|
75
57
|
locale: string;
|
76
58
|
}
|
package/scheduler/types.js
CHANGED
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.InvocationTypes = exports.ApwScheduleActionTypes = exports.ApwContentTypes = void 0;
|
7
|
-
/**
|
8
|
-
* A interface describing the reference to a user that created some data in the database.
|
9
|
-
*
|
10
|
-
* @category General
|
11
|
-
*/
|
12
7
|
let ApwContentTypes;
|
13
8
|
exports.ApwContentTypes = ApwContentTypes;
|
14
9
|
(function (ApwContentTypes) {
|
package/scheduler/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ApwContentTypes","ApwScheduleActionTypes","InvocationTypes"],"sources":["types.ts"],"sourcesContent":["import { Context } from \"@webiny/api/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale, I18NContext } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { TenancyContext } from \"@webiny/api-tenancy/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 * By datetime field.\n */\n datetime_startsWith?: string;\n}\n\nexport interface ListParams {\n where: ListWhere;\n sort?: (\"datetime_ASC\" | \"datetime_DESC\")[];\n limit?: number;\n after?: string;\n}\n\
|
1
|
+
{"version":3,"names":["ApwContentTypes","ApwScheduleActionTypes","InvocationTypes"],"sources":["types.ts"],"sourcesContent":["import { Context } from \"@webiny/api/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale, I18NContext } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { ApwIdentity } from \"~/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 * By datetime field.\n */\n datetime_startsWith?: string;\n}\n\nexport interface ListParams {\n where: ListWhere;\n sort?: (\"datetime_ASC\" | \"datetime_DESC\")[];\n limit?: number;\n after?: string;\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 BaseFields {\n id: string;\n createdOn: string;\n savedOn?: string;\n createdBy: ApwIdentity;\n tenant: string;\n locale: string;\n}\n\nexport interface ApwScheduleAction extends BaseFields {\n data: ApwScheduleActionData;\n}\n\nexport enum 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 enum InvocationTypes {\n SCHEDULED = \"scheduled\"\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry | null>;\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 ApwScheduleActionCrud\n extends BaseApwCrud<ApwScheduleAction, ApwScheduleActionData, ApwScheduleActionData> {\n list(params: ListParams): Promise<[ApwScheduleAction[], ListMeta]>;\n\n getCurrentTask(): Promise<ApwScheduleAction | null>;\n\n updateCurrentTask(item: ApwScheduleAction): Promise<ApwScheduleAction>;\n\n deleteCurrentTask(): Promise<Boolean>;\n}\n\nexport interface ScheduleActionContext extends Context, I18NContext, TenancyContext {\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface CreateScheduleActionParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwScheduleActionStorageOperations;\n}\n\ninterface CreateApwScheduleActionParams {\n item: ApwScheduleAction;\n input: ApwScheduleActionData;\n}\n\ninterface StorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface ApwScheduleActionListParams extends ListParams {\n where: ListWhere & {\n tenant: string;\n locale: string;\n };\n}\n\nexport type StorageOperationsGetScheduleActionParams = StorageOperationsGetParams;\n\nexport type StorageOperationsDeleteScheduleActionParams = StorageOperationsDeleteParams;\nexport type StorageOperationsListScheduleActionsParams = ApwScheduleActionListParams;\n\nexport type StorageOperationsCreateScheduleActionParams = CreateApwScheduleActionParams;\n\nexport interface StorageOperationsUpdateScheduleActionParams {\n item: ApwScheduleAction;\n input: ApwScheduleActionData;\n}\n\nexport type StorageOperationsListScheduleActionsResponse = [ApwScheduleAction[], ListMeta];\n\nexport interface StorageOperationsUpdateCurrentTaskParams {\n item: ApwScheduleAction;\n}\n\nexport interface StorageOperationsGetCurrentTaskParams {\n where: Pick<StorageOperationsGetParams[\"where\"], \"tenant\" | \"locale\">;\n}\n\nexport type StorageOperationsDeleteCurrentTaskParams = Pick<\n StorageOperationsDeleteParams,\n \"tenant\" | \"locale\"\n>;\n\nexport interface ApwScheduleActionStorageOperations {\n get(params: StorageOperationsGetScheduleActionParams): Promise<ApwScheduleAction | null>;\n\n list(\n params: StorageOperationsListScheduleActionsParams\n ): Promise<StorageOperationsListScheduleActionsResponse>;\n\n create(params: StorageOperationsCreateScheduleActionParams): Promise<ApwScheduleAction>;\n\n update(params: StorageOperationsUpdateScheduleActionParams): Promise<ApwScheduleAction>;\n\n delete(params: StorageOperationsDeleteScheduleActionParams): Promise<Boolean>;\n\n getCurrentTask(\n params: StorageOperationsGetCurrentTaskParams\n ): Promise<ApwScheduleAction | null>;\n\n updateCurrentTask(params: StorageOperationsUpdateCurrentTaskParams): Promise<ApwScheduleAction>;\n\n deleteCurrentTask(params: StorageOperationsDeleteCurrentTaskParams): Promise<Boolean>;\n}\n\nexport interface CreateApwContextParams {\n storageOperations: ApwScheduleActionStorageOperations;\n}\n"],"mappings":";;;;;;IAkDYA,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe;AAAA,IAkBfC,sBAAsB;AAAA;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,sCAAtBA,sBAAsB;AAAA,IAiBtBC,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe"}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import { CmsModelPlugin } from "@webiny/api-headless-cms";
|
2
|
-
import { CmsModel, CmsGroup } from "@webiny/api-headless-cms/types";
|
2
|
+
import { CmsModel as BaseCmsModel, CmsGroup } from "@webiny/api-headless-cms/types";
|
3
|
+
interface CmsModel extends Omit<BaseCmsModel, "locale" | "tenant" | "webinyVersion" | "group" | "singularApiName" | "pluralApiName"> {
|
4
|
+
isPrivate: true;
|
5
|
+
}
|
3
6
|
interface Params {
|
4
7
|
group: Pick<CmsGroup, "id" | "name">;
|
5
|
-
modelDefinition:
|
8
|
+
modelDefinition: CmsModel;
|
6
9
|
}
|
7
10
|
export declare const contentModelPluginFactory: (params: Params) => CmsModelPlugin;
|
8
11
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["contentModelPluginFactory","params","group","modelDefinition","createCmsModel"],"sources":["contentModelPluginFactory.ts"],"sourcesContent":["import { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { CmsModel, CmsGroup } from \"@webiny/api-headless-cms/types\";\n\ninterface
|
1
|
+
{"version":3,"names":["contentModelPluginFactory","params","group","modelDefinition","createCmsModel"],"sources":["contentModelPluginFactory.ts"],"sourcesContent":["import { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { CmsModel as BaseCmsModel, CmsGroup } from \"@webiny/api-headless-cms/types\";\n\ninterface CmsModel\n extends Omit<\n BaseCmsModel,\n \"locale\" | \"tenant\" | \"webinyVersion\" | \"group\" | \"singularApiName\" | \"pluralApiName\"\n > {\n isPrivate: true;\n}\n\ninterface Params {\n group: Pick<CmsGroup, \"id\" | \"name\">;\n modelDefinition: CmsModel;\n}\n\nexport const contentModelPluginFactory = (params: Params): CmsModelPlugin => {\n const { group, modelDefinition } = params;\n\n return createCmsModel({\n group,\n ...modelDefinition\n });\n};\n"],"mappings":";;;;;;;;AAAA;AAgBO,MAAMA,yBAAyB,GAAIC,MAAc,IAAqB;EACzE,MAAM;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAGF,MAAM;EAEzC,OAAO,IAAAG,8BAAc;IACjBF;EAAK,GACFC,eAAe,EACpB;AACN,CAAC;AAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","security","disableAuthorization","locale","getContentLocale","WebinyError","groupId","cmsGroupPlugin","CmsGroupPlugin","id","slug","name","description","icon","isPrivate","changeRequestModelDefinition","createChangeRequestModelDefinition","reviewerModelDefinition","createReviewerModelDefinition","workflowModelDefinition","createWorkflowModelDefinition","reviewerModelId","modelId","commentModelDefinition","createCommentModelDefinition","contentReviewModelDefinition","createContentReviewModelDefinition","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","contentModelPluginFactory","group","contentModelGroup","contentModel","titleFieldId","push","plugins","register","enableAuthorization"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsGroupPlugin } from \"@webiny/api-headless-cms\";\nimport { contentModelPluginFactory } from \"./contentModelPluginFactory\";\nimport { createWorkflowModelDefinition } from \"./workflow.model\";\nimport { createContentReviewModelDefinition } from \"./contentReview.model\";\nimport { createReviewerModelDefinition } from \"./reviewer.model\";\nimport { createCommentModelDefinition } from \"./comment.model\";\nimport { createChangeRequestModelDefinition } from \"./changeRequest.model\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n context.security.disableAuthorization();\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n /**\n * TODO:@ashutosh\n * We need to move these plugin in an installation plugin\n */\n const groupId = \"contentModelGroup_apw\";\n /**\n * Create a CmsGroup.\n */\n const cmsGroupPlugin = new CmsGroupPlugin({\n id: groupId,\n slug: \"apw\",\n name: \"APW\",\n description: \"Group for Advanced Publishing Workflow\",\n icon: \"fas/star\",\n isPrivate: true\n });\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModelDefinition();\n const reviewerModelDefinition = createReviewerModelDefinition();\n const workflowModelDefinition = createWorkflowModelDefinition({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModelDefinition({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModelDefinition({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = contentModelPluginFactory({\n group: cmsGroupPlugin.contentModelGroup,\n modelDefinition\n });\n /**\n * We want \"title\" field as the \"titleField\" for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);\n\n context.security.enableAuthorization();\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEO,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4BAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEAN,OAAO,CAACO,QAAQ,CAACC,oBAAoB,EAAE;EAEvC,MAAMC,MAAM,GAAGT,OAAO,CAACM,IAAI,CAACI,gBAAgB,EAAE;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cAAc,CACjB;EACL;EACA;AACJ;AACA;AACA;EACI,MAAMC,OAAO,GAAG,uBAAuB;EACvC;AACJ;AACA;EACI,MAAMC,cAAc,GAAG,IAAIC,8BAAc,CAAC;IACtCC,EAAE,EAAEH,OAAO;IACXI,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,KAAK;IACXC,WAAW,EAAE,wCAAwC;IACrDC,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE;EACf,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMC,4BAA4B,GAAG,IAAAC,iDAAkC,GAAE;EACzE,MAAMC,uBAAuB,GAAG,IAAAC,uCAA6B,GAAE;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,uCAA6B,EAAC;IAC1DC,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EACF,MAAMC,sBAAsB,GAAG,IAAAC,qCAA4B,EAAC;IACxDF,OAAO,EAAEP,4BAA4B,CAACO;EAC1C,CAAC,CAAC;EACF,MAAMG,4BAA4B,GAAG,IAAAC,iDAAkC,EAAC;IACpEL,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EAEF,MAAMK,gBAAgB,GAAG,CACrBR,uBAAuB,EACvBM,4BAA4B,EAC5BR,uBAAuB,EACvBF,4BAA4B,EAC5BQ,sBAAsB,CACzB;EAED,MAAMK,
|
1
|
+
{"version":3,"names":["createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","security","disableAuthorization","locale","getContentLocale","WebinyError","groupId","cmsGroupPlugin","CmsGroupPlugin","id","slug","name","description","icon","isPrivate","changeRequestModelDefinition","createChangeRequestModelDefinition","reviewerModelDefinition","createReviewerModelDefinition","workflowModelDefinition","createWorkflowModelDefinition","reviewerModelId","modelId","commentModelDefinition","createCommentModelDefinition","contentReviewModelDefinition","createContentReviewModelDefinition","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","contentModelPluginFactory","group","contentModelGroup","contentModel","titleFieldId","push","plugins","register","enableAuthorization"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsGroupPlugin, CmsModelPlugin } from \"@webiny/api-headless-cms\";\nimport { contentModelPluginFactory } from \"./contentModelPluginFactory\";\nimport { createWorkflowModelDefinition } from \"./workflow.model\";\nimport { createContentReviewModelDefinition } from \"./contentReview.model\";\nimport { createReviewerModelDefinition } from \"./reviewer.model\";\nimport { createCommentModelDefinition } from \"./comment.model\";\nimport { createChangeRequestModelDefinition } from \"./changeRequest.model\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n context.security.disableAuthorization();\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n /**\n * TODO:@ashutosh\n * We need to move these plugin in an installation plugin\n */\n const groupId = \"contentModelGroup_apw\";\n /**\n * Create a CmsGroup.\n */\n const cmsGroupPlugin = new CmsGroupPlugin({\n id: groupId,\n slug: \"apw\",\n name: \"APW\",\n description: \"Group for Advanced Publishing Workflow\",\n icon: \"fas/star\",\n isPrivate: true\n });\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModelDefinition();\n const reviewerModelDefinition = createReviewerModelDefinition();\n const workflowModelDefinition = createWorkflowModelDefinition({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModelDefinition({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModelDefinition({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = contentModelPluginFactory({\n group: cmsGroupPlugin.contentModelGroup,\n modelDefinition\n });\n /**\n * We want \"title\" field as the \"titleField\" for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);\n\n context.security.enableAuthorization();\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEO,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4BAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEAN,OAAO,CAACO,QAAQ,CAACC,oBAAoB,EAAE;EAEvC,MAAMC,MAAM,GAAGT,OAAO,CAACM,IAAI,CAACI,gBAAgB,EAAE;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cAAc,CACjB;EACL;EACA;AACJ;AACA;AACA;EACI,MAAMC,OAAO,GAAG,uBAAuB;EACvC;AACJ;AACA;EACI,MAAMC,cAAc,GAAG,IAAIC,8BAAc,CAAC;IACtCC,EAAE,EAAEH,OAAO;IACXI,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,KAAK;IACXC,WAAW,EAAE,wCAAwC;IACrDC,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE;EACf,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMC,4BAA4B,GAAG,IAAAC,iDAAkC,GAAE;EACzE,MAAMC,uBAAuB,GAAG,IAAAC,uCAA6B,GAAE;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,uCAA6B,EAAC;IAC1DC,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EACF,MAAMC,sBAAsB,GAAG,IAAAC,qCAA4B,EAAC;IACxDF,OAAO,EAAEP,4BAA4B,CAACO;EAC1C,CAAC,CAAC;EACF,MAAMG,4BAA4B,GAAG,IAAAC,iDAAkC,EAAC;IACpEL,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EAEF,MAAMK,gBAAgB,GAAG,CACrBR,uBAAuB,EACvBM,4BAA4B,EAC5BR,uBAAuB,EACvBF,4BAA4B,EAC5BQ,sBAAsB,CACzB;EAED,MAAMK,eAAiC,GAAG,EAAE;EAC5C,KAAK,MAAMC,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,cAAc,GAAG,IAAAC,oDAAyB,EAAC;MAC7CC,KAAK,EAAEzB,cAAc,CAAC0B,iBAAiB;MACvCJ;IACJ,CAAC,CAAC;IACF;AACR;AACA;AACA;IACQ,IAAIC,cAAc,CAACI,YAAY,CAACZ,OAAO,KAAK,iCAAiC,EAAE;MAC3EQ,cAAc,CAACI,YAAY,CAACC,YAAY,GAAG,OAAO;IACtD;IACAP,eAAe,CAACQ,IAAI,CAACN,cAAc,CAAC;EACxC;;EAEA;AACJ;AACA;EACIpC,OAAO,CAAC2C,OAAO,CAACC,QAAQ,CAAC,CAAC/B,cAAc,EAAEqB,eAAe,CAAC,CAAC;EAE3DlC,OAAO,CAACO,QAAQ,CAACsC,mBAAmB,EAAE;AAC1C,CAAC;AAAC"}
|
package/types.d.ts
CHANGED
@@ -99,7 +99,7 @@ export declare enum ApwWorkflowApplications {
|
|
99
99
|
*
|
100
100
|
* @category General
|
101
101
|
*/
|
102
|
-
export interface
|
102
|
+
export interface ApwIdentity {
|
103
103
|
/**
|
104
104
|
* ID if the user.
|
105
105
|
*/
|
@@ -118,7 +118,7 @@ export interface ApwBaseFields {
|
|
118
118
|
entryId: string;
|
119
119
|
createdOn: string;
|
120
120
|
savedOn: string;
|
121
|
-
createdBy:
|
121
|
+
createdBy: ApwIdentity;
|
122
122
|
}
|
123
123
|
export interface ApwReviewer extends ApwBaseFields {
|
124
124
|
identityId: string;
|
@@ -151,7 +151,7 @@ export interface ApwContentReviewStep {
|
|
151
151
|
pendingChangeRequests: number;
|
152
152
|
totalComments: number;
|
153
153
|
signOffProvidedOn: string | null;
|
154
|
-
signOffProvidedBy:
|
154
|
+
signOffProvidedBy: ApwIdentity | null;
|
155
155
|
}
|
156
156
|
export interface ApwContentReview extends ApwBaseFields {
|
157
157
|
title: string;
|
@@ -736,7 +736,9 @@ export interface OnWorkflowBeforeDeleteTopicParams {
|
|
736
736
|
export interface OnWorkflowAfterDeleteTopicParams {
|
737
737
|
workflow: ApwWorkflow;
|
738
738
|
}
|
739
|
-
export declare type WorkflowModelDefinition = Pick<CmsModel, "name" | "modelId" | "layout" | "titleFieldId" | "description" | "fields" | "isPrivate"
|
739
|
+
export declare type WorkflowModelDefinition = Pick<CmsModel, "name" | "modelId" | "layout" | "titleFieldId" | "description" | "fields" | "isPrivate"> & {
|
740
|
+
isPrivate: true;
|
741
|
+
};
|
740
742
|
/**
|
741
743
|
* Headless CMS
|
742
744
|
*/
|
package/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ApwContentTypes","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsEntry as BaseCmsEntry,\n CmsModel,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnPageBeforeCreateTopicParams,\n OnPageBeforeCreateFromTopicParams,\n OnPageBeforeUpdateTopicParams,\n OnPageBeforePublishTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/api/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\";\nimport { MailerContext } from \"@webiny/api-mailer/types\";\nimport { AdminSettingsContext } from \"@webiny/api-admin-settings/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 ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeCreateFromTopicParams =\n OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<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 entryId: 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 email?: string;\n}\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: 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 reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\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 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 reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: 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 onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\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 onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\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 onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\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 onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\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, MailerContext, AdminSettingsContext {\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 email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\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 reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: 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 OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\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 OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\nexport interface OnCmsEntryAfterUnpublishTopicParams\n extends Omit<OnEntryAfterUnpublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n"],"mappings":";;;;;;IAqFYA,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe;AAAA,IAwBfC,kBAAkB;AAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB;AAAA,IAKlBC,0BAA0B;AAAA;AAAA,WAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;AAAA,GAA1BA,0BAA0B,0CAA1BA,0BAA0B;AAAA,IAM1BC,uBAAuB;AAKnC;AACA;AACA;AACA;AACA;AAJA;AAAA,WALYA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;AAAA,GAAvBA,uBAAuB,uCAAvBA,uBAAuB;AAAA,IAoGvBC,oBAAoB;AAAA;AAAA,WAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB;AAAA,IAMpBC,sBAAsB;AAAA;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,sCAAtBA,sBAAsB;AAAA,IAiE7BC,sBAAsB;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,KAAtBA,sBAAsB"}
|
1
|
+
{"version":3,"names":["ApwContentTypes","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsEntry as BaseCmsEntry,\n CmsModel,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnPageBeforeCreateTopicParams,\n OnPageBeforeCreateFromTopicParams,\n OnPageBeforeUpdateTopicParams,\n OnPageBeforePublishTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/api/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\";\nimport { MailerContext } from \"@webiny/api-mailer/types\";\nimport { AdminSettingsContext } from \"@webiny/api-admin-settings/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}\n\nexport interface PageWithWorkflow extends Page {\n settings: PageSettingsWithWorkflow;\n}\n\nexport type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeCreateFromTopicParams =\n OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<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 ApwIdentity {\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 entryId: string;\n createdOn: string;\n savedOn: string;\n createdBy: ApwIdentity;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string;\n}\n\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: 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: ApwIdentity | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\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}\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 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 reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: 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 onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\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 onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\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 onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\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 onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\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, MailerContext, AdminSettingsContext {\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 email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\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 reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: 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 OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\nexport type WorkflowModelDefinition = Pick<\n CmsModel,\n \"name\" | \"modelId\" | \"layout\" | \"titleFieldId\" | \"description\" | \"fields\" | \"isPrivate\"\n> & { isPrivate: true };\n\n/**\n * Headless CMS\n */\nexport interface OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterUnpublishTopicParams\n extends Omit<OnEntryAfterUnpublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n"],"mappings":";;;;;;IAqFYA,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe;AAAA,IAyBfC,kBAAkB;AAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB;AAAA,IAKlBC,0BAA0B;AAAA;AAAA,WAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;AAAA,GAA1BA,0BAA0B,0CAA1BA,0BAA0B;AAAA,IAM1BC,uBAAuB;AAKnC;AACA;AACA;AACA;AACA;AAJA;AAAA,WALYA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;AAAA,GAAvBA,uBAAuB,uCAAvBA,uBAAuB;AAAA,IAsGvBC,oBAAoB;AAAA;AAAA,WAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB;AAAA,IAMpBC,sBAAsB;AAAA;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,sCAAtBA,sBAAsB;AAAA,IAiE7BC,sBAAsB;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,KAAtBA,sBAAsB"}
|