@webiny/api-apw 5.23.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/createApw/createChangeRequestMethods.d.ts +2 -0
- package/createApw/createChangeRequestMethods.js +95 -0
- package/createApw/createCommentMethods.d.ts +2 -0
- package/createApw/createCommentMethods.js +96 -0
- package/createApw/createContentReviewMethods.d.ts +6 -0
- package/createApw/createContentReviewMethods.js +301 -0
- package/createApw/createReviewerMethods.d.ts +2 -0
- package/createApw/createReviewerMethods.js +96 -0
- package/createApw/createWorkflowMethods.d.ts +2 -0
- package/createApw/createWorkflowMethods.js +96 -0
- package/createApw/index.d.ts +2 -0
- package/createApw/index.js +54 -0
- package/index.d.ts +2 -0
- package/index.js +28 -0
- package/package.json +67 -0
- package/plugins/context.d.ts +4 -0
- package/plugins/context.js +89 -0
- package/plugins/createManageCMSPlugin.d.ts +2 -0
- package/plugins/createManageCMSPlugin.js +31 -0
- package/plugins/graphql/changeRequest.gql.d.ts +4 -0
- package/plugins/graphql/changeRequest.gql.js +152 -0
- package/plugins/graphql/comment.gql.d.ts +4 -0
- package/plugins/graphql/comment.gql.js +166 -0
- package/plugins/graphql/contentReview.gql.d.ts +4 -0
- package/plugins/graphql/contentReview.gql.js +224 -0
- package/plugins/graphql/reviewer.gql.d.ts +4 -0
- package/plugins/graphql/reviewer.gql.js +111 -0
- package/plugins/graphql/workflow.gql.d.ts +4 -0
- package/plugins/graphql/workflow.gql.js +199 -0
- package/plugins/graphql.d.ts +3 -0
- package/plugins/graphql.js +84 -0
- package/plugins/hooks/createReviewerFromIdentity.d.ts +2 -0
- package/plugins/hooks/createReviewerFromIdentity.js +44 -0
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +2 -0
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +66 -0
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +2 -0
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +58 -0
- package/plugins/hooks/extendPbPageSchema.d.ts +4 -0
- package/plugins/hooks/extendPbPageSchema.js +24 -0
- package/plugins/hooks/index.d.ts +4 -0
- package/plugins/hooks/index.js +68 -0
- package/plugins/hooks/initializeContentReviewSteps.d.ts +7 -0
- package/plugins/hooks/initializeContentReviewSteps.js +70 -0
- package/plugins/hooks/linkWorkflowToPage.d.ts +9 -0
- package/plugins/hooks/linkWorkflowToPage.js +154 -0
- package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
- package/plugins/hooks/updatePendingChangeRequests.js +107 -0
- package/plugins/utils.d.ts +15 -0
- package/plugins/utils.js +69 -0
- package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
- package/storageOperations/changeRequestStorageOperations.js +96 -0
- package/storageOperations/commentStorageOperations.d.ts +3 -0
- package/storageOperations/commentStorageOperations.js +101 -0
- package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
- package/storageOperations/contentReviewStorageOperations.js +72 -0
- package/storageOperations/index.d.ts +9 -0
- package/storageOperations/index.js +63 -0
- package/storageOperations/models/changeRequest.model.d.ts +7 -0
- package/storageOperations/models/changeRequest.model.js +52 -0
- package/storageOperations/models/comment.model.d.ts +9 -0
- package/storageOperations/models/comment.model.js +37 -0
- package/storageOperations/models/contentModelPluginFactory.d.ts +17 -0
- package/storageOperations/models/contentModelPluginFactory.js +33 -0
- package/storageOperations/models/contentReview.model.d.ts +25 -0
- package/storageOperations/models/contentReview.model.js +181 -0
- package/storageOperations/models/index.d.ts +1 -0
- package/storageOperations/models/index.js +87 -0
- package/storageOperations/models/reviewer.model.d.ts +7 -0
- package/storageOperations/models/reviewer.model.js +48 -0
- package/storageOperations/models/utils.d.ts +3 -0
- package/storageOperations/models/utils.js +35 -0
- package/storageOperations/models/workflow.model.d.ts +17 -0
- package/storageOperations/models/workflow.model.js +204 -0
- package/storageOperations/reviewerStorageOperations.d.ts +3 -0
- package/storageOperations/reviewerStorageOperations.js +72 -0
- package/storageOperations/types.d.ts +34 -0
- package/storageOperations/types.js +5 -0
- package/storageOperations/workflowStorageOperations.d.ts +3 -0
- package/storageOperations/workflowStorageOperations.js +72 -0
- package/types.d.ts +646 -0
- package/types.js +63 -0
- package/utils/errors.d.ts +16 -0
- package/utils/errors.js +75 -0
- package/utils/fieldResolver.d.ts +15 -0
- package/utils/fieldResolver.js +58 -0
- package/utils/resolve.d.ts +3 -0
- package/utils/resolve.js +18 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _plugins = require("@webiny/handler-graphql/plugins");
|
11
|
+
|
12
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
+
|
14
|
+
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
15
|
+
|
16
|
+
const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
17
|
+
typeDefs:
|
18
|
+
/* GraphQL */
|
19
|
+
`
|
20
|
+
type ApwCommentListItem {
|
21
|
+
# System generated fields
|
22
|
+
id: ID
|
23
|
+
savedOn: DateTime
|
24
|
+
createdOn: DateTime
|
25
|
+
createdBy: ApwCreatedBy
|
26
|
+
# Comment specific fields
|
27
|
+
body: JSON
|
28
|
+
changeRequest: ApwRefField
|
29
|
+
}
|
30
|
+
|
31
|
+
type ApwListCommentsResponse {
|
32
|
+
data: [ApwCommentListItem]
|
33
|
+
error: ApwError
|
34
|
+
meta: ApwMeta
|
35
|
+
}
|
36
|
+
|
37
|
+
type ApwComment {
|
38
|
+
# System generated fields
|
39
|
+
id: ID
|
40
|
+
savedOn: DateTime
|
41
|
+
createdOn: DateTime
|
42
|
+
createdBy: ApwCreatedBy
|
43
|
+
# Comment specific fields
|
44
|
+
body: JSON
|
45
|
+
changeRequest: ApwRefField
|
46
|
+
}
|
47
|
+
|
48
|
+
type ApwCommentResponse {
|
49
|
+
data: ApwComment
|
50
|
+
error: ApwError
|
51
|
+
}
|
52
|
+
|
53
|
+
type ApwDeleteCommentResponse {
|
54
|
+
data: Boolean
|
55
|
+
error: ApwError
|
56
|
+
}
|
57
|
+
|
58
|
+
enum ApwListCommentsSort {
|
59
|
+
id_ASC
|
60
|
+
id_DESC
|
61
|
+
savedOn_ASC
|
62
|
+
savedOn_DESC
|
63
|
+
createdOn_ASC
|
64
|
+
createdOn_DESC
|
65
|
+
publishedOn_ASC
|
66
|
+
publishedOn_DESC
|
67
|
+
title_ASC
|
68
|
+
title_DESC
|
69
|
+
}
|
70
|
+
|
71
|
+
input ApwCreateCommentInput {
|
72
|
+
body: JSON!
|
73
|
+
changeRequest: ApwRefFieldInput!
|
74
|
+
}
|
75
|
+
|
76
|
+
input ApwUpdateCommentInput {
|
77
|
+
body: JSON!
|
78
|
+
}
|
79
|
+
|
80
|
+
input ApwListCommentsWhereInput {
|
81
|
+
id: ID
|
82
|
+
id_not: ID
|
83
|
+
id_in: [ID!]
|
84
|
+
id_not_in: [ID!]
|
85
|
+
entryId: String
|
86
|
+
entryId_not: String
|
87
|
+
entryId_in: [String!]
|
88
|
+
entryId_not_in: [String!]
|
89
|
+
createdOn: DateTime
|
90
|
+
createdOn_gt: DateTime
|
91
|
+
createdOn_gte: DateTime
|
92
|
+
createdOn_lt: DateTime
|
93
|
+
createdOn_lte: DateTime
|
94
|
+
createdOn_between: [DateTime!]
|
95
|
+
createdOn_not_between: [DateTime!]
|
96
|
+
savedOn: DateTime
|
97
|
+
savedOn_gt: DateTime
|
98
|
+
savedOn_gte: DateTime
|
99
|
+
savedOn_lt: DateTime
|
100
|
+
savedOn_lte: DateTime
|
101
|
+
savedOn_between: [DateTime!]
|
102
|
+
savedOn_not_between: [DateTime!]
|
103
|
+
createdBy: String
|
104
|
+
createdBy_not: String
|
105
|
+
createdBy_in: [String!]
|
106
|
+
createdBy_not_in: [String!]
|
107
|
+
ownedBy: String
|
108
|
+
ownedBy_not: String
|
109
|
+
ownedBy_in: [String!]
|
110
|
+
ownedBy_not_in: [String!]
|
111
|
+
changeRequest: ApwRefFieldWhereInput
|
112
|
+
}
|
113
|
+
|
114
|
+
input ApwListCommentsSearchInput {
|
115
|
+
query: String
|
116
|
+
}
|
117
|
+
|
118
|
+
extend type ApwQuery {
|
119
|
+
getComment(id: ID!): ApwCommentResponse
|
120
|
+
|
121
|
+
listComments(
|
122
|
+
where: ApwListCommentsWhereInput
|
123
|
+
limit: Int
|
124
|
+
after: String
|
125
|
+
sort: [ApwListCommentsSort!]
|
126
|
+
search: ApwListCommentsSearchInput
|
127
|
+
): ApwListCommentsResponse
|
128
|
+
}
|
129
|
+
|
130
|
+
extend type ApwMutation {
|
131
|
+
createComment(data: ApwCreateCommentInput!): ApwCommentResponse
|
132
|
+
|
133
|
+
updateComment(id: ID!, data: ApwUpdateCommentInput!): ApwCommentResponse
|
134
|
+
|
135
|
+
deleteComment(id: ID!): ApwDeleteCommentResponse
|
136
|
+
}
|
137
|
+
`,
|
138
|
+
resolvers: {
|
139
|
+
ApwQuery: {
|
140
|
+
getComment: async (_, args, context) => {
|
141
|
+
return (0, _resolve.default)(() => context.apw.comment.get(args.id));
|
142
|
+
},
|
143
|
+
listComments: async (_, args, context) => {
|
144
|
+
try {
|
145
|
+
const [entries, meta] = await context.apw.comment.list(args);
|
146
|
+
return new _handlerGraphql.ListResponse(entries, meta);
|
147
|
+
} catch (e) {
|
148
|
+
return new _handlerGraphql.ErrorResponse(e);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
},
|
152
|
+
ApwMutation: {
|
153
|
+
createComment: async (_, args, context) => {
|
154
|
+
return (0, _resolve.default)(() => context.apw.comment.create(args.data));
|
155
|
+
},
|
156
|
+
updateComment: async (_, args, context) => {
|
157
|
+
return (0, _resolve.default)(() => context.apw.comment.update(args.id, args.data));
|
158
|
+
},
|
159
|
+
deleteComment: async (_, args, context) => {
|
160
|
+
return (0, _resolve.default)(() => context.apw.comment.delete(args.id));
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
});
|
165
|
+
var _default = workflowSchema;
|
166
|
+
exports.default = _default;
|
@@ -0,0 +1,224 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _plugins = require("@webiny/handler-graphql/plugins");
|
11
|
+
|
12
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
+
|
14
|
+
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
15
|
+
|
16
|
+
const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
17
|
+
typeDefs:
|
18
|
+
/* GraphQL */
|
19
|
+
`
|
20
|
+
type ApwContentReviewListItem {
|
21
|
+
# System generated fields
|
22
|
+
id: ID
|
23
|
+
savedOn: DateTime
|
24
|
+
createdOn: DateTime
|
25
|
+
createdBy: ApwCreatedBy
|
26
|
+
# ContentReview specific fields
|
27
|
+
steps: [ApwContentReviewStep]
|
28
|
+
content: ApwContentReviewContent
|
29
|
+
status: ApwContentReviewStatus
|
30
|
+
}
|
31
|
+
|
32
|
+
type ApwListContentReviewsResponse {
|
33
|
+
data: [ApwContentReviewListItem]
|
34
|
+
error: ApwError
|
35
|
+
meta: ApwMeta
|
36
|
+
}
|
37
|
+
|
38
|
+
type ApwContentReviewReviewer {
|
39
|
+
id: ID
|
40
|
+
displayName: String
|
41
|
+
}
|
42
|
+
|
43
|
+
type ApwContentReviewComment {
|
44
|
+
body: JSON
|
45
|
+
author: String
|
46
|
+
}
|
47
|
+
|
48
|
+
type ApwContentReviewChangeRequested {
|
49
|
+
title: String
|
50
|
+
body: JSON
|
51
|
+
media: JSON
|
52
|
+
step: String
|
53
|
+
resolved: Boolean
|
54
|
+
comments: [ApwContentReviewComment]
|
55
|
+
}
|
56
|
+
|
57
|
+
enum ApwContentReviewStepStatus {
|
58
|
+
done
|
59
|
+
active
|
60
|
+
inactive
|
61
|
+
}
|
62
|
+
|
63
|
+
enum ApwContentReviewStatus {
|
64
|
+
underReview
|
65
|
+
readyToBePublished
|
66
|
+
published
|
67
|
+
}
|
68
|
+
|
69
|
+
type ApwContentReviewStep {
|
70
|
+
status: ApwContentReviewStepStatus
|
71
|
+
slug: String
|
72
|
+
pendingChangeRequests: Int
|
73
|
+
signOffProvidedOn: DateTime
|
74
|
+
signOffProvidedBy: ApwCreatedBy
|
75
|
+
}
|
76
|
+
|
77
|
+
type ApwContentReview {
|
78
|
+
# System generated fields
|
79
|
+
id: ID
|
80
|
+
savedOn: DateTime
|
81
|
+
createdOn: DateTime
|
82
|
+
createdBy: ApwCreatedBy
|
83
|
+
# ContentReview specific fields
|
84
|
+
steps: [ApwContentReviewStep]
|
85
|
+
content: ApwContentReviewContent
|
86
|
+
workflow: ID
|
87
|
+
status: ApwContentReviewStatus
|
88
|
+
}
|
89
|
+
|
90
|
+
type ApwContentReviewResponse {
|
91
|
+
data: ApwContentReview
|
92
|
+
error: ApwError
|
93
|
+
}
|
94
|
+
|
95
|
+
type ApwDeleteContentReviewResponse {
|
96
|
+
data: Boolean
|
97
|
+
error: ApwError
|
98
|
+
}
|
99
|
+
|
100
|
+
enum ApwListContentReviewsSort {
|
101
|
+
id_ASC
|
102
|
+
id_DESC
|
103
|
+
savedOn_ASC
|
104
|
+
savedOn_DESC
|
105
|
+
createdOn_ASC
|
106
|
+
createdOn_DESC
|
107
|
+
publishedOn_ASC
|
108
|
+
publishedOn_DESC
|
109
|
+
title_ASC
|
110
|
+
title_DESC
|
111
|
+
}
|
112
|
+
|
113
|
+
input ApwContentReviewReviewerInput {
|
114
|
+
id: ID
|
115
|
+
}
|
116
|
+
|
117
|
+
input ApwContentReviewScopeInput {
|
118
|
+
type: String
|
119
|
+
options: JSON
|
120
|
+
}
|
121
|
+
|
122
|
+
input ApwContentReviewCommentInput {
|
123
|
+
body: JSON
|
124
|
+
author: String
|
125
|
+
}
|
126
|
+
|
127
|
+
input ApwContentReviewChangeRequestedInput {
|
128
|
+
title: String
|
129
|
+
body: JSON
|
130
|
+
media: JSON
|
131
|
+
step: String
|
132
|
+
resolved: Boolean
|
133
|
+
comments: [ApwContentReviewCommentInput]
|
134
|
+
}
|
135
|
+
|
136
|
+
enum ApwContentReviewContentTypes {
|
137
|
+
page
|
138
|
+
cms_entry
|
139
|
+
}
|
140
|
+
|
141
|
+
type ApwContentReviewContent {
|
142
|
+
id: ID
|
143
|
+
type: ApwContentReviewContentTypes
|
144
|
+
settings: String
|
145
|
+
}
|
146
|
+
|
147
|
+
input ApwContentReviewContentInput {
|
148
|
+
id: ID!
|
149
|
+
type: ApwContentReviewContentTypes!
|
150
|
+
settings: String
|
151
|
+
}
|
152
|
+
|
153
|
+
input ApwCreateContentReviewInput {
|
154
|
+
content: ApwContentReviewContentInput!
|
155
|
+
}
|
156
|
+
|
157
|
+
input ApwListContentReviewsWhereInput {
|
158
|
+
id: ID
|
159
|
+
}
|
160
|
+
|
161
|
+
input ApwListContentReviewsSearchInput {
|
162
|
+
# By specifying "query", the search will be performed against workflow' "title" field.
|
163
|
+
query: String
|
164
|
+
}
|
165
|
+
|
166
|
+
type ApwProvideSignOffResponse {
|
167
|
+
data: Boolean
|
168
|
+
error: ApwError
|
169
|
+
}
|
170
|
+
|
171
|
+
extend type ApwQuery {
|
172
|
+
getContentReview(id: ID!): ApwContentReviewResponse
|
173
|
+
|
174
|
+
listContentReviews(
|
175
|
+
where: ApwListContentReviewsWhereInput
|
176
|
+
limit: Int
|
177
|
+
after: String
|
178
|
+
sort: [ApwListContentReviewsSort!]
|
179
|
+
search: ApwListContentReviewsSearchInput
|
180
|
+
): ApwListContentReviewsResponse
|
181
|
+
}
|
182
|
+
|
183
|
+
extend type ApwMutation {
|
184
|
+
createContentReview(data: ApwCreateContentReviewInput!): ApwContentReviewResponse
|
185
|
+
|
186
|
+
deleteContentReview(id: ID!): ApwDeleteContentReviewResponse
|
187
|
+
|
188
|
+
provideSignOff(id: ID!, step: String!): ApwProvideSignOffResponse
|
189
|
+
|
190
|
+
retractSignOff(id: ID!, step: String!): ApwProvideSignOffResponse
|
191
|
+
}
|
192
|
+
`,
|
193
|
+
resolvers: {
|
194
|
+
ApwQuery: {
|
195
|
+
getContentReview: async (_, args, context) => {
|
196
|
+
return (0, _resolve.default)(() => context.apw.contentReview.get(args.id));
|
197
|
+
},
|
198
|
+
listContentReviews: async (_, args, context) => {
|
199
|
+
try {
|
200
|
+
const [entries, meta] = await context.apw.contentReview.list(args);
|
201
|
+
return new _handlerGraphql.ListResponse(entries, meta);
|
202
|
+
} catch (e) {
|
203
|
+
return new _handlerGraphql.ErrorResponse(e);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
},
|
207
|
+
ApwMutation: {
|
208
|
+
createContentReview: async (_, args, context) => {
|
209
|
+
return (0, _resolve.default)(() => context.apw.contentReview.create(args.data));
|
210
|
+
},
|
211
|
+
deleteContentReview: async (_, args, context) => {
|
212
|
+
return (0, _resolve.default)(() => context.apw.contentReview.delete(args.id));
|
213
|
+
},
|
214
|
+
provideSignOff: async (_, args, context) => {
|
215
|
+
return (0, _resolve.default)(() => context.apw.contentReview.provideSignOff(args.id, args.step));
|
216
|
+
},
|
217
|
+
retractSignOff: async (_, args, context) => {
|
218
|
+
return (0, _resolve.default)(() => context.apw.contentReview.retractSignOff(args.id, args.step));
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
});
|
223
|
+
var _default = contentReviewSchema;
|
224
|
+
exports.default = _default;
|
@@ -0,0 +1,111 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _plugins = require("@webiny/handler-graphql/plugins");
|
11
|
+
|
12
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
+
|
14
|
+
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
15
|
+
|
16
|
+
const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
17
|
+
typeDefs:
|
18
|
+
/* GraphQL */
|
19
|
+
`
|
20
|
+
type ApwReviewerListItem {
|
21
|
+
# System generated fields
|
22
|
+
id: ID
|
23
|
+
savedOn: DateTime
|
24
|
+
createdOn: DateTime
|
25
|
+
createdBy: ApwCreatedBy
|
26
|
+
# Reviewer specific fields
|
27
|
+
identityId: ID
|
28
|
+
displayName: String
|
29
|
+
type: String
|
30
|
+
}
|
31
|
+
|
32
|
+
type ApwListReviewersResponse {
|
33
|
+
data: [ApwReviewerListItem]
|
34
|
+
error: ApwError
|
35
|
+
meta: ApwMeta
|
36
|
+
}
|
37
|
+
|
38
|
+
type ApwReviewer {
|
39
|
+
# System generated fields
|
40
|
+
id: ID
|
41
|
+
savedOn: DateTime
|
42
|
+
createdOn: DateTime
|
43
|
+
createdBy: ApwCreatedBy
|
44
|
+
# Reviewer specific fields
|
45
|
+
identityId: ID
|
46
|
+
displayName: String
|
47
|
+
type: String
|
48
|
+
}
|
49
|
+
|
50
|
+
type ApwReviewerResponse {
|
51
|
+
data: ApwReviewer
|
52
|
+
error: ApwError
|
53
|
+
}
|
54
|
+
|
55
|
+
type ApwDeleteReviewerResponse {
|
56
|
+
data: Boolean
|
57
|
+
error: ApwError
|
58
|
+
}
|
59
|
+
|
60
|
+
enum ApwListReviewersSort {
|
61
|
+
id_ASC
|
62
|
+
id_DESC
|
63
|
+
savedOn_ASC
|
64
|
+
savedOn_DESC
|
65
|
+
createdOn_ASC
|
66
|
+
createdOn_DESC
|
67
|
+
publishedOn_ASC
|
68
|
+
publishedOn_DESC
|
69
|
+
title_ASC
|
70
|
+
title_DESC
|
71
|
+
}
|
72
|
+
|
73
|
+
input ApwListReviewersWhereInput {
|
74
|
+
identityId: ID
|
75
|
+
}
|
76
|
+
|
77
|
+
input ApwListReviewersSearchInput {
|
78
|
+
# By specifying "query", the search will be performed against workflow' "title" field.
|
79
|
+
query: String
|
80
|
+
}
|
81
|
+
|
82
|
+
extend type ApwQuery {
|
83
|
+
getReviewer(id: ID!): ApwReviewerResponse
|
84
|
+
|
85
|
+
listReviewers(
|
86
|
+
where: ApwListReviewersWhereInput
|
87
|
+
limit: Int
|
88
|
+
after: String
|
89
|
+
sort: [ApwListReviewersSort!]
|
90
|
+
search: ApwListReviewersSearchInput
|
91
|
+
): ApwListReviewersResponse
|
92
|
+
}
|
93
|
+
`,
|
94
|
+
resolvers: {
|
95
|
+
ApwQuery: {
|
96
|
+
getReviewer: async (_, args, context) => {
|
97
|
+
return (0, _resolve.default)(() => context.apw.reviewer.get(args.id));
|
98
|
+
},
|
99
|
+
listReviewers: async (_, args, context) => {
|
100
|
+
try {
|
101
|
+
const [entries, meta] = await context.apw.reviewer.list(args);
|
102
|
+
return new _handlerGraphql.ListResponse(entries, meta);
|
103
|
+
} catch (e) {
|
104
|
+
return new _handlerGraphql.ErrorResponse(e);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
});
|
110
|
+
var _default = workflowSchema;
|
111
|
+
exports.default = _default;
|
@@ -0,0 +1,199 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _plugins = require("@webiny/handler-graphql/plugins");
|
11
|
+
|
12
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
+
|
14
|
+
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
15
|
+
|
16
|
+
const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
17
|
+
typeDefs:
|
18
|
+
/* GraphQL */
|
19
|
+
`
|
20
|
+
type ApwWorkflowListItem {
|
21
|
+
# System generated fields
|
22
|
+
id: ID
|
23
|
+
savedOn: DateTime
|
24
|
+
createdOn: DateTime
|
25
|
+
createdBy: ApwCreatedBy
|
26
|
+
# Workflow specific fields
|
27
|
+
app: ApwWorkflowApplication
|
28
|
+
title: String
|
29
|
+
steps: [ApwWorkflowStep]
|
30
|
+
scope: ApwWorkflowScope
|
31
|
+
}
|
32
|
+
|
33
|
+
type ApwListWorkflowsResponse {
|
34
|
+
data: [ApwWorkflowListItem]
|
35
|
+
error: ApwError
|
36
|
+
meta: ApwMeta
|
37
|
+
}
|
38
|
+
|
39
|
+
type ApwWorkflowReviewer {
|
40
|
+
id: ID
|
41
|
+
displayName: String
|
42
|
+
}
|
43
|
+
|
44
|
+
type ApwWorkflowStep {
|
45
|
+
title: String
|
46
|
+
slug: String
|
47
|
+
type: ApwWorkflowStepTypes
|
48
|
+
reviewers: [ApwRefField!]
|
49
|
+
}
|
50
|
+
|
51
|
+
type ApwWorkflowScope {
|
52
|
+
type: String
|
53
|
+
data: JSON
|
54
|
+
}
|
55
|
+
|
56
|
+
type ApwWorkflow {
|
57
|
+
# System generated fields
|
58
|
+
id: ID
|
59
|
+
savedOn: DateTime
|
60
|
+
createdOn: DateTime
|
61
|
+
createdBy: ApwCreatedBy
|
62
|
+
# Workflow specific fields
|
63
|
+
app: ApwWorkflowApplication
|
64
|
+
title: String
|
65
|
+
steps: [ApwWorkflowStep]
|
66
|
+
scope: ApwWorkflowScope
|
67
|
+
}
|
68
|
+
|
69
|
+
type ApwWorkflowResponse {
|
70
|
+
data: ApwWorkflow
|
71
|
+
error: ApwError
|
72
|
+
}
|
73
|
+
|
74
|
+
type ApwDeleteWorkflowResponse {
|
75
|
+
data: Boolean
|
76
|
+
error: ApwError
|
77
|
+
}
|
78
|
+
|
79
|
+
enum ApwWorkflowApplication {
|
80
|
+
pageBuilder
|
81
|
+
cms
|
82
|
+
formBuilder
|
83
|
+
}
|
84
|
+
|
85
|
+
enum ApwWorkflowStepTypes {
|
86
|
+
mandatoryBlocking
|
87
|
+
mandatoryNonBlocking
|
88
|
+
notMandatory
|
89
|
+
}
|
90
|
+
|
91
|
+
enum ApwListWorkflowsSort {
|
92
|
+
id_ASC
|
93
|
+
id_DESC
|
94
|
+
savedOn_ASC
|
95
|
+
savedOn_DESC
|
96
|
+
createdOn_ASC
|
97
|
+
createdOn_DESC
|
98
|
+
publishedOn_ASC
|
99
|
+
publishedOn_DESC
|
100
|
+
title_ASC
|
101
|
+
title_DESC
|
102
|
+
}
|
103
|
+
|
104
|
+
input ApwWorkflowReviewerInput {
|
105
|
+
id: ID
|
106
|
+
}
|
107
|
+
|
108
|
+
input ApwCreateWorkflowStepInput {
|
109
|
+
title: String!
|
110
|
+
slug: String!
|
111
|
+
type: ApwWorkflowStepTypes!
|
112
|
+
reviewers: [ApwRefFieldInput!]!
|
113
|
+
}
|
114
|
+
|
115
|
+
input ApwUpdateWorkflowStepInput {
|
116
|
+
title: String!
|
117
|
+
slug: String!
|
118
|
+
type: ApwWorkflowStepTypes!
|
119
|
+
reviewers: [ApwRefFieldInput!]
|
120
|
+
}
|
121
|
+
|
122
|
+
input ApwWorkflowScopeInput {
|
123
|
+
type: String!
|
124
|
+
data: JSON
|
125
|
+
}
|
126
|
+
|
127
|
+
input ApwCreateWorkflowInput {
|
128
|
+
title: String!
|
129
|
+
steps: [ApwCreateWorkflowStepInput]!
|
130
|
+
scope: ApwWorkflowScopeInput!
|
131
|
+
app: ApwWorkflowApplication!
|
132
|
+
}
|
133
|
+
|
134
|
+
input ApwUpdateWorkflowInput {
|
135
|
+
title: String
|
136
|
+
steps: [ApwUpdateWorkflowStepInput]
|
137
|
+
scope: ApwWorkflowScopeInput
|
138
|
+
}
|
139
|
+
|
140
|
+
input ApwListWorkflowsWhereInput {
|
141
|
+
app: ApwWorkflowApplication
|
142
|
+
}
|
143
|
+
|
144
|
+
input ApwListWorkflowsSearchInput {
|
145
|
+
# By specifying "query", the search will be performed against workflow' "title" field.
|
146
|
+
query: String
|
147
|
+
}
|
148
|
+
|
149
|
+
type ApwQuery {
|
150
|
+
getWorkflow(id: ID!): ApwWorkflowResponse
|
151
|
+
|
152
|
+
listWorkflows(
|
153
|
+
where: ApwListWorkflowsWhereInput
|
154
|
+
limit: Int
|
155
|
+
after: String
|
156
|
+
sort: [ApwListWorkflowsSort!]
|
157
|
+
search: ApwListWorkflowsSearchInput
|
158
|
+
): ApwListWorkflowsResponse
|
159
|
+
}
|
160
|
+
|
161
|
+
type ApwMutation {
|
162
|
+
createWorkflow(data: ApwCreateWorkflowInput!): ApwWorkflowResponse
|
163
|
+
|
164
|
+
# Update workflow by given ID.
|
165
|
+
updateWorkflow(id: ID!, data: ApwUpdateWorkflowInput!): ApwWorkflowResponse
|
166
|
+
|
167
|
+
# Delete workflow
|
168
|
+
deleteWorkflow(id: ID!): ApwDeleteWorkflowResponse
|
169
|
+
}
|
170
|
+
`,
|
171
|
+
resolvers: {
|
172
|
+
ApwQuery: {
|
173
|
+
getWorkflow: async (_, args, context) => {
|
174
|
+
return (0, _resolve.default)(() => context.apw.workflow.get(args.id));
|
175
|
+
},
|
176
|
+
listWorkflows: async (_, args, context) => {
|
177
|
+
try {
|
178
|
+
const [entries, meta] = await context.apw.workflow.list(args);
|
179
|
+
return new _handlerGraphql.ListResponse(entries, meta);
|
180
|
+
} catch (e) {
|
181
|
+
return new _handlerGraphql.ErrorResponse(e);
|
182
|
+
}
|
183
|
+
}
|
184
|
+
},
|
185
|
+
ApwMutation: {
|
186
|
+
createWorkflow: async (_, args, context) => {
|
187
|
+
return (0, _resolve.default)(() => context.apw.workflow.create(args.data));
|
188
|
+
},
|
189
|
+
updateWorkflow: async (_, args, context) => {
|
190
|
+
return (0, _resolve.default)(() => context.apw.workflow.update(args.id, args.data));
|
191
|
+
},
|
192
|
+
deleteWorkflow: async (_, args, context) => {
|
193
|
+
return (0, _resolve.default)(() => context.apw.workflow.delete(args.id));
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
197
|
+
});
|
198
|
+
var _default = workflowSchema;
|
199
|
+
exports.default = _default;
|