@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,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.createReviewerStorageOperations = void 0;
|
9
|
+
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
|
12
|
+
var _index = require("./index");
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17
|
+
|
18
|
+
const createReviewerStorageOperations = ({
|
19
|
+
cms
|
20
|
+
}) => {
|
21
|
+
const getReviewerModel = () => {
|
22
|
+
return cms.getModel("apwReviewerModelDefinition");
|
23
|
+
};
|
24
|
+
|
25
|
+
const getReviewer = async ({
|
26
|
+
id
|
27
|
+
}) => {
|
28
|
+
const model = await getReviewerModel();
|
29
|
+
const entry = await cms.getEntryById(model, id);
|
30
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
31
|
+
};
|
32
|
+
|
33
|
+
return {
|
34
|
+
getReviewerModel,
|
35
|
+
getReviewer,
|
36
|
+
|
37
|
+
async listReviewers(params) {
|
38
|
+
const model = await getReviewerModel();
|
39
|
+
const [entries, meta] = await cms.listLatestEntries(model, params);
|
40
|
+
return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
|
41
|
+
},
|
42
|
+
|
43
|
+
async createReviewer(params) {
|
44
|
+
const model = await getReviewerModel();
|
45
|
+
const entry = await cms.createEntry(model, params.data);
|
46
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
47
|
+
},
|
48
|
+
|
49
|
+
async updateReviewer(params) {
|
50
|
+
const model = await getReviewerModel();
|
51
|
+
/**
|
52
|
+
* We're fetching the existing entry here because we're not accepting "app" field as input,
|
53
|
+
* but, we still need to retain its value after the "update" operation.
|
54
|
+
*/
|
55
|
+
|
56
|
+
const existingEntry = await getReviewer({
|
57
|
+
id: params.id
|
58
|
+
});
|
59
|
+
const entry = await cms.updateEntry(model, params.id, _objectSpread(_objectSpread({}, existingEntry), params.data));
|
60
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
61
|
+
},
|
62
|
+
|
63
|
+
async deleteReviewer(params) {
|
64
|
+
const model = await getReviewerModel();
|
65
|
+
await cms.deleteEntry(model, params.id);
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
|
69
|
+
};
|
70
|
+
};
|
71
|
+
|
72
|
+
exports.createReviewerStorageOperations = createReviewerStorageOperations;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { CmsModel } from "@webiny/api-headless-cms/types";
|
2
|
+
import { ApwReviewerStorageOperations as BaseApwReviewerStorageOperations, ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations, ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations, ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations, ApwCommentStorageOperations as BaseApwCommentStorageOperations } from "../types";
|
3
|
+
export interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {
|
4
|
+
/**
|
5
|
+
* @internal
|
6
|
+
*/
|
7
|
+
getCommentModel(): Promise<CmsModel>;
|
8
|
+
}
|
9
|
+
export interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {
|
10
|
+
/**
|
11
|
+
* @internal
|
12
|
+
*/
|
13
|
+
getReviewerModel(): Promise<CmsModel>;
|
14
|
+
}
|
15
|
+
export interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {
|
16
|
+
/**
|
17
|
+
* @internal
|
18
|
+
*/
|
19
|
+
getWorkflowModel(): Promise<CmsModel>;
|
20
|
+
}
|
21
|
+
export interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {
|
22
|
+
/**
|
23
|
+
* @internal
|
24
|
+
*/
|
25
|
+
getContentReviewModel(): Promise<CmsModel>;
|
26
|
+
}
|
27
|
+
export interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {
|
28
|
+
/**
|
29
|
+
* @internal
|
30
|
+
*/
|
31
|
+
getChangeRequestModel(): Promise<CmsModel>;
|
32
|
+
}
|
33
|
+
export interface ApwStorageOperations extends ApwReviewerStorageOperations, ApwWorkflowStorageOperations, ApwContentReviewStorageOperations, ApwChangeRequestStorageOperations, ApwCommentStorageOperations {
|
34
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.createWorkflowStorageOperations = void 0;
|
9
|
+
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
|
12
|
+
var _index = require("./index");
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17
|
+
|
18
|
+
const createWorkflowStorageOperations = ({
|
19
|
+
cms
|
20
|
+
}) => {
|
21
|
+
const getWorkflowModel = () => {
|
22
|
+
return cms.getModel("apwWorkflowModelDefinition");
|
23
|
+
};
|
24
|
+
|
25
|
+
const getWorkflow = async ({
|
26
|
+
id
|
27
|
+
}) => {
|
28
|
+
const model = await getWorkflowModel();
|
29
|
+
const entry = await cms.getEntryById(model, id);
|
30
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
31
|
+
};
|
32
|
+
|
33
|
+
return {
|
34
|
+
getWorkflowModel,
|
35
|
+
getWorkflow,
|
36
|
+
|
37
|
+
async listWorkflows(params) {
|
38
|
+
const model = await getWorkflowModel();
|
39
|
+
const [entries, meta] = await cms.listLatestEntries(model, params);
|
40
|
+
return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
|
41
|
+
},
|
42
|
+
|
43
|
+
async createWorkflow(params) {
|
44
|
+
const model = await getWorkflowModel();
|
45
|
+
const entry = await cms.createEntry(model, params.data);
|
46
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
47
|
+
},
|
48
|
+
|
49
|
+
async updateWorkflow(params) {
|
50
|
+
const model = await getWorkflowModel();
|
51
|
+
/**
|
52
|
+
* We're fetching the existing entry here because we're not accepting "app" field as input,
|
53
|
+
* but, we still need to retain its value after the "update" operation.
|
54
|
+
*/
|
55
|
+
|
56
|
+
const existingEntry = await getWorkflow({
|
57
|
+
id: params.id
|
58
|
+
});
|
59
|
+
const entry = await cms.updateEntry(model, params.id, _objectSpread(_objectSpread({}, existingEntry), params.data));
|
60
|
+
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
61
|
+
},
|
62
|
+
|
63
|
+
async deleteWorkflow(params) {
|
64
|
+
const model = await getWorkflowModel();
|
65
|
+
await cms.deleteEntry(model, params.id);
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
|
69
|
+
};
|
70
|
+
};
|
71
|
+
|
72
|
+
exports.createWorkflowStorageOperations = createWorkflowStorageOperations;
|