@webiny/api-apw 5.34.4 → 5.34.5-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/index.d.ts +2 -2
- package/package.json +31 -31
- package/plugins/hooks/initializeContentReviewSteps.js +11 -2
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +12 -1
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +16 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +7 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -59
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/utils.d.ts +1 -1
- package/utils/resolve.d.ts +1 -1
package/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import { CreateApwContextParams } from "./scheduler/types";
|
2
|
-
export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/
|
3
|
-
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/
|
2
|
+
export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection)[];
|
3
|
+
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
|
4
4
|
export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webiny/api-apw",
|
3
|
-
"version": "5.34.
|
3
|
+
"version": "5.34.5-beta.0",
|
4
4
|
"keywords": [
|
5
5
|
"apw:base"
|
6
6
|
],
|
@@ -17,27 +17,27 @@
|
|
17
17
|
"@aws-sdk/client-cloudwatch-events": "3.186.0",
|
18
18
|
"@babel/runtime": "7.19.0",
|
19
19
|
"@commodo/fields": "1.1.2-beta.20",
|
20
|
-
"@webiny/api": "5.34.
|
21
|
-
"@webiny/api-admin-settings": "5.34.
|
22
|
-
"@webiny/api-headless-cms": "5.34.
|
23
|
-
"@webiny/api-i18n": "5.34.
|
24
|
-
"@webiny/api-i18n-ddb": "5.34.
|
25
|
-
"@webiny/api-mailer": "5.34.
|
26
|
-
"@webiny/api-page-builder": "5.34.
|
27
|
-
"@webiny/api-security": "5.34.
|
28
|
-
"@webiny/api-tenancy": "5.34.
|
29
|
-
"@webiny/api-wcp": "5.34.
|
30
|
-
"@webiny/db-dynamodb": "5.34.
|
31
|
-
"@webiny/error": "5.34.
|
32
|
-
"@webiny/handler": "5.34.
|
33
|
-
"@webiny/handler-client": "5.34.
|
34
|
-
"@webiny/handler-db": "5.34.
|
35
|
-
"@webiny/handler-graphql": "5.34.
|
36
|
-
"@webiny/handler-logs": "5.34.
|
37
|
-
"@webiny/plugins": "5.34.
|
38
|
-
"@webiny/pubsub": "5.34.
|
39
|
-
"@webiny/utils": "5.34.
|
40
|
-
"@webiny/validation": "5.34.
|
20
|
+
"@webiny/api": "5.34.5-beta.0",
|
21
|
+
"@webiny/api-admin-settings": "5.34.5-beta.0",
|
22
|
+
"@webiny/api-headless-cms": "5.34.5-beta.0",
|
23
|
+
"@webiny/api-i18n": "5.34.5-beta.0",
|
24
|
+
"@webiny/api-i18n-ddb": "5.34.5-beta.0",
|
25
|
+
"@webiny/api-mailer": "5.34.5-beta.0",
|
26
|
+
"@webiny/api-page-builder": "5.34.5-beta.0",
|
27
|
+
"@webiny/api-security": "5.34.5-beta.0",
|
28
|
+
"@webiny/api-tenancy": "5.34.5-beta.0",
|
29
|
+
"@webiny/api-wcp": "5.34.5-beta.0",
|
30
|
+
"@webiny/db-dynamodb": "5.34.5-beta.0",
|
31
|
+
"@webiny/error": "5.34.5-beta.0",
|
32
|
+
"@webiny/handler": "5.34.5-beta.0",
|
33
|
+
"@webiny/handler-client": "5.34.5-beta.0",
|
34
|
+
"@webiny/handler-db": "5.34.5-beta.0",
|
35
|
+
"@webiny/handler-graphql": "5.34.5-beta.0",
|
36
|
+
"@webiny/handler-logs": "5.34.5-beta.0",
|
37
|
+
"@webiny/plugins": "5.34.5-beta.0",
|
38
|
+
"@webiny/pubsub": "5.34.5-beta.0",
|
39
|
+
"@webiny/utils": "5.34.5-beta.0",
|
40
|
+
"@webiny/validation": "5.34.5-beta.0",
|
41
41
|
"dayjs": "1.11.5",
|
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": "^5.34.
|
50
|
-
"@webiny/api-page-builder-so-ddb": "^5.34.
|
51
|
-
"@webiny/api-security-so-ddb": "^5.34.
|
52
|
-
"@webiny/api-tenancy-so-ddb": "^5.34.
|
53
|
-
"@webiny/cli": "^5.34.
|
54
|
-
"@webiny/handler-aws": "^5.34.
|
55
|
-
"@webiny/project-utils": "^5.34.
|
56
|
-
"@webiny/wcp": "^5.34.
|
49
|
+
"@webiny/api-headless-cms-ddb": "^5.34.5-beta.0",
|
50
|
+
"@webiny/api-page-builder-so-ddb": "^5.34.5-beta.0",
|
51
|
+
"@webiny/api-security-so-ddb": "^5.34.5-beta.0",
|
52
|
+
"@webiny/api-tenancy-so-ddb": "^5.34.5-beta.0",
|
53
|
+
"@webiny/cli": "^5.34.5-beta.0",
|
54
|
+
"@webiny/handler-aws": "^5.34.5-beta.0",
|
55
|
+
"@webiny/project-utils": "^5.34.5-beta.0",
|
56
|
+
"@webiny/wcp": "^5.34.5-beta.0",
|
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": "f4d4a6aa81fa91ed922ddfd4a579acd72bf8af2c"
|
76
76
|
}
|
@@ -11,6 +11,8 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
11
11
|
|
12
12
|
var _set = _interopRequireDefault(require("lodash/set"));
|
13
13
|
|
14
|
+
var _types = require("../../types");
|
15
|
+
|
14
16
|
var _utils = require("../utils");
|
15
17
|
|
16
18
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
@@ -75,10 +77,17 @@ const initializeContentReviewSteps = ({
|
|
75
77
|
});
|
76
78
|
});
|
77
79
|
/**
|
78
|
-
*
|
79
|
-
* There is no steps property on CreateApwContentReviewParams
|
80
|
+
* If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.
|
80
81
|
*/
|
81
82
|
|
83
|
+
const isNonMandatory = updatedSteps.every(step => {
|
84
|
+
return step.type === _types.ApwWorkflowStepTypes.NON_MANDATORY;
|
85
|
+
});
|
86
|
+
|
87
|
+
if (isNonMandatory) {
|
88
|
+
input.reviewStatus = _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED;
|
89
|
+
}
|
90
|
+
|
82
91
|
input = (0, _set.default)(input, "steps", updatedSteps);
|
83
92
|
});
|
84
93
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport {
|
1
|
+
{"version":3,"names":["initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments","isNonMandatory","every","ApwWorkflowStepTypes","NON_MANDATORY","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport {\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwContext,\n ApwWorkflowStepTypes\n} from \"~/types\";\nimport { getContentReviewStepInitialStatus } from \"~/plugins/utils\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\n\nexport const initializeContentReviewSteps = ({ apw, plugins }: ApwContext) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { type, id, settings } = input.content;\n /*\n * Let's set \"title\" field value.\n */\n const getContent = apw.getContentGetter(type);\n const content = await getContent(id, settings);\n if (!content) {\n throw new NotFoundError(`Content \"${type}\" with id ${id} not found.`);\n }\n\n const { title } = content;\n input = lodashSet(input, \"title\", title);\n\n /**\n * We need to find a plugin which can get a workflow ID for the given type of content.\n */\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type\n });\n\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n\n /**\n * Let's initialize the \"ContentReview\" steps.\n */\n if (!workflowId) {\n throw new NotFoundError(`Unable to initiate a \"Content review\". No workflow found!`);\n }\n\n input.workflowId = workflowId;\n\n const workflow = await apw.workflow.get(workflowId);\n const workflowSteps = workflow.steps;\n\n let previousStepStatus: ApwContentReviewStepStatus | undefined = undefined;\n const updatedSteps = workflow.steps.map((step, index) => {\n const status = getContentReviewStepInitialStatus(\n workflowSteps,\n index,\n previousStepStatus\n );\n previousStepStatus = status;\n return {\n ...step,\n status,\n pendingChangeRequests: 0,\n totalComments: 0\n };\n });\n /**\n * If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.\n */\n const isNonMandatory = updatedSteps.every(step => {\n return step.type === ApwWorkflowStepTypes.NON_MANDATORY;\n });\n if (isNonMandatory) {\n input.reviewStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n input = lodashSet(input, \"steps\", updatedSteps);\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAMA;;AACA;;AACA;;AAEO,MAAMA,4BAA4B,GAAG,CAAC;EAAEC,GAAF;EAAOC;AAAP,CAAD,KAAkC;EAC1ED,GAAG,CAACE,aAAJ,CAAkBC,2BAAlB,CAA8CC,SAA9C,CAAwD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACzE,MAAM;MAAEC,IAAF;MAAQC,EAAR;MAAYC;IAAZ,IAAyBH,KAAK,CAACI,OAArC;IACA;AACR;AACA;;IACQ,MAAMC,UAAU,GAAGV,GAAG,CAACW,gBAAJ,CAAqB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AACrB,IAAL,KAAc6B,2BAAA,CAAqBC,aAA1C;IACH,CAFsB,CAAvB;;IAGA,IAAIH,cAAJ,EAAoB;MAChB5B,KAAK,CAACgC,YAAN,GAAqBC,6BAAA,CAAuBC,qBAA5C;IACH;;IAEDlC,KAAK,GAAG,IAAAS,YAAA,EAAUT,KAAV,EAAiB,OAAjB,EAA0BoB,YAA1B,CAAR;EACH,CA9DD;AA+DH,CAhEM"}
|
@@ -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/
|
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").EventPlugin<HandlerArgs, import("@webiny/handler/types").Context, any> | ContextPlugin<import("@webiny/api/types").Context>)[];
|
13
13
|
export {};
|
@@ -119,6 +119,17 @@ const createExecuteActionLambda = params => {
|
|
119
119
|
continue;
|
120
120
|
}
|
121
121
|
|
122
|
+
const url = plugin.getUrl({
|
123
|
+
locale,
|
124
|
+
tenant
|
125
|
+
});
|
126
|
+
|
127
|
+
if (!url) {
|
128
|
+
console.error(`There is no url defined, in the Plugin, for type "${item.data.type}".`);
|
129
|
+
console.log(JSON.stringify(item));
|
130
|
+
continue;
|
131
|
+
}
|
132
|
+
|
122
133
|
const body = plugin.getGraphQLBody(item.data);
|
123
134
|
|
124
135
|
if (!body) {
|
@@ -132,7 +143,7 @@ const createExecuteActionLambda = params => {
|
|
132
143
|
name,
|
133
144
|
payload: {
|
134
145
|
httpMethod: "POST",
|
135
|
-
path:
|
146
|
+
path: url,
|
136
147
|
headers: {
|
137
148
|
["content-type"]: "application/json",
|
138
149
|
Authorization: (0, _utils.encodeToken)({
|
@@ -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","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 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: `/cms/manage/${locale}`,\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,MAAD,IAA2B;EACzD,MAAM;IAAEC;EAAF,IAAwBD,MAA9B;EAEA,OAAO,IAAAE,oBAAA,EAAyB,OAAO;IAAEC,OAAF;IAAWC;EAAX,CAAP,KAAgC;IAC5D,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAApB;IAEA,MAAME,yBAAyB,GAAGH,OAAO,CAACI,OAAR,CAAgBC,MAAhB,CAC9BC,sCAAA,CAAmBC,IADW,CAAlC;;IAIA,IAAIJ,yBAAyB,CAACK,MAA1B,KAAqC,CAAzC,EAA4C;MACxCN,OAAO,CAACO,KAAR,CAAe,mEAAf;MACA;IACH;;IAED,MAAMC,6BAAiE,GAAG,EAA1E;;IAEA,MAAMC,2BAA2B,GAC7BC,IADgC,IAEJ;MAC5B,MAAM;QAAEL;MAAF,IAAWK,IAAjB;;MACA,IAAIF,6BAA6B,CAACH,IAAD,CAAjC,EAAyC;QACrC,OAAOG,6BAA6B,CAACH,IAAD,CAApC;MACH;;MACD,KAAK,MAAMM,MAAX,IAAqBV,yBAArB,EAAgD;QAC5C,IAAI,CAACU,MAAM,CAACC,MAAP,CAAcF,IAAd,CAAL,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,EAAE;QAjByC,CAA7B,CAAvB;;QAmBA,IAAIT,QAAJ,aAAIA,QAAJ,eAAIA,QAAQ,CAAEF,IAAd,EAAoB;UAChBjC,OAAO,CAACD,GAAR,CAAY6B,IAAI,CAACC,SAAL,CAAe;YAAEI,IAAI,EAAEE,QAAQ,CAACF;UAAjB,CAAf,EAAwC,IAAxC,EAA8C,CAA9C,CAAZ;UACA;QACH;;QACDjC,OAAO,CAACD,GAAR,CAAY6B,IAAI,CAACC,SAAL,CAAe;UAAEM;QAAF,CAAf,EAA6B,IAA7B,EAAmC,CAAnC,CAAZ,EA5DsB,CA8DtB;MACH;IACJ,CAhGD,CAgGE,OAAOU,CAAP,EAAU;MACR9C,GAAG,CAAC,oCAAD,EAAuC8C,CAAvC,CAAH,CADQ,CAER;IACH;EACJ,CAnIM,CAAP;AAoIH,CAvID;;AAyIO,MAAMC,2BAA2B,GAAIC,MAAD,IAA2B,CAClE,IAAIC,kBAAJ,CAAkB,MAAMlD,OAAN,IAAiB;EAC/BA,OAAO,CAACI,OAAR,CAAgB+C,QAAhB,CAAyB,CAAC,IAAIC,sCAAJ,EAAD,EAA2B,IAAIC,sCAAJ,EAA3B,CAAzB;AACH,CAFD,CADkE,EAIlE,IAAAC,kBAAA,GAJkE,EAKlE3D,yBAAyB,CAACsD,MAAD,CALyC,CAA/D"}
|
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,MAAD,IAA2B;EACzD,MAAM;IAAEC;EAAF,IAAwBD,MAA9B;EAEA,OAAO,IAAAE,oBAAA,EAAyB,OAAO;IAAEC,OAAF;IAAWC;EAAX,CAAP,KAAgC;IAC5D,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAApB;IAEA,MAAME,yBAAyB,GAAGH,OAAO,CAACI,OAAR,CAAgBC,MAAhB,CAC9BC,sCAAA,CAAmBC,IADW,CAAlC;;IAIA,IAAIJ,yBAAyB,CAACK,MAA1B,KAAqC,CAAzC,EAA4C;MACxCN,OAAO,CAACO,KAAR,CAAe,mEAAf;MACA;IACH;;IAED,MAAMC,6BAAiE,GAAG,EAA1E;;IAEA,MAAMC,2BAA2B,GAC7BC,IADgC,IAEJ;MAC5B,MAAM;QAAEL;MAAF,IAAWK,IAAjB;;MACA,IAAIF,6BAA6B,CAACH,IAAD,CAAjC,EAAyC;QACrC,OAAOG,6BAA6B,CAACH,IAAD,CAApC;MACH;;MACD,KAAK,MAAMM,MAAX,IAAqBV,yBAArB,EAAgD;QAC5C,IAAI,CAACU,MAAM,CAACC,MAAP,CAAcF,IAAd,CAAL,EAA0B;UACtB;QACH;;QACDF,6BAA6B,CAACH,IAAD,CAA7B,GAAsCM,MAAtC;QACA,OAAOA,MAAP;MACH;;MACD,OAAO,IAAP;IACH,CAfD;;IAiBA,IAAI;MACA,MAAME,WAAW,GAAG,MAAM,IAAAC,qBAAA,GAA1B;MAEA,MAAM;QAAEC,cAAc,EAAEC,QAAlB;QAA4BC,MAA5B;QAAoCC;MAApC,IAA+CrB,OAArD;MACA;AACZ;AACA;;MACY,IAAI,CAACmB,QAAD,IAAa,OAAOA,QAAP,KAA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AAJ,eAAIA,QAAQ,CAAEF,IAAd,EAAoB;UAChBnC,OAAO,CAACD,GAAR,CAAY6B,IAAI,CAACC,SAAL,CAAe;YAAEM,IAAI,EAAEE,QAAQ,CAACF;UAAjB,CAAf,EAAwC,IAAxC,EAA8C,CAA9C,CAAZ;UACA;QACH;;QACDnC,OAAO,CAACD,GAAR,CAAY6B,IAAI,CAACC,SAAL,CAAe;UAAEQ;QAAF,CAAf,EAA6B,IAA7B,EAAmC,CAAnC,CAAZ,EAxEsB,CA0EtB;MACH;IACJ,CA5GD,CA4GE,OAAOU,CAAP,EAAU;MACRhD,GAAG,CAAC,oCAAD,EAAuCgD,CAAvC,CAAH,CADQ,CAER;IACH;EACJ,CA/IM,CAAP;AAgJH,CAnJD;;AAqJO,MAAMC,2BAA2B,GAAIC,MAAD,IAA2B,CAClE,IAAIC,kBAAJ,CAAkB,MAAMpD,OAAN,IAAiB;EAC/BA,OAAO,CAACI,OAAR,CAAgBiD,QAAhB,CAAyB,CAAC,IAAIC,sCAAJ,EAAD,EAA2B,IAAIC,sCAAJ,EAA3B,CAAzB;AACH,CAFD,CADkE,EAIlE,IAAAC,kBAAA,GAJkE,EAKlE7D,yBAAyB,CAACwD,MAAD,CALyC,CAA/D"}
|
@@ -1,12 +1,18 @@
|
|
1
1
|
import { Plugin } from "@webiny/plugins/Plugin";
|
2
2
|
import { ApwScheduleActionData } from "../../../types";
|
3
3
|
import { ApwSettings } from "../../utils";
|
4
|
+
export { ApwScheduleActionData, ApwSettings };
|
5
|
+
export interface ApplicationGraphQLGetUrlParams {
|
6
|
+
tenant: string;
|
7
|
+
locale: string;
|
8
|
+
}
|
4
9
|
export interface ApplicationGraphQLBody<T = Record<string, any>> {
|
5
10
|
query: string;
|
6
11
|
variables: T;
|
7
12
|
}
|
8
13
|
export declare abstract class ApplicationGraphQL extends Plugin {
|
9
14
|
static readonly type: string;
|
15
|
+
abstract getUrl(params: ApplicationGraphQLGetUrlParams): string;
|
10
16
|
abstract canUse(data: ApwScheduleActionData): boolean;
|
11
17
|
abstract getArn(settings: ApwSettings): string;
|
12
18
|
abstract getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null;
|
@@ -6,11 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
7
7
|
});
|
8
8
|
exports.ApplicationGraphQL = void 0;
|
9
|
+
Object.defineProperty(exports, "ApwScheduleActionData", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function () {
|
12
|
+
return _types.ApwScheduleActionData;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
Object.defineProperty(exports, "ApwSettings", {
|
16
|
+
enumerable: true,
|
17
|
+
get: function () {
|
18
|
+
return _utils.ApwSettings;
|
19
|
+
}
|
20
|
+
});
|
9
21
|
|
10
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
23
|
|
12
24
|
var _Plugin = require("@webiny/plugins/Plugin");
|
13
25
|
|
26
|
+
var _types = require("../../../types");
|
27
|
+
|
28
|
+
var _utils = require("../../utils");
|
29
|
+
|
14
30
|
class ApplicationGraphQL extends _Plugin.Plugin {}
|
15
31
|
|
16
32
|
exports.ApplicationGraphQL = ApplicationGraphQL;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ApplicationGraphQL","Plugin"],"sources":["ApplicationGraphQL.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { ApwScheduleActionData } from \"~/scheduler/types\";\nimport { ApwSettings } from \"~/scheduler/handlers/utils\";\n\nexport interface ApplicationGraphQLBody<T = Record<string, any>> {\n query: string;\n variables: T;\n}\n\nexport abstract class ApplicationGraphQL extends Plugin {\n public static override readonly type: string = \"apw.scheduler.applicationGraphQL\";\n\n public abstract canUse(data: ApwScheduleActionData): boolean;\n\n public abstract getArn(settings: ApwSettings): string;\n\n public abstract getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null;\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["ApplicationGraphQL","Plugin"],"sources":["ApplicationGraphQL.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { ApwScheduleActionData } from \"~/scheduler/types\";\nimport { ApwSettings } from \"~/scheduler/handlers/utils\";\n\nexport { ApwScheduleActionData, ApwSettings };\n\nexport interface ApplicationGraphQLGetUrlParams {\n tenant: string;\n locale: string;\n}\nexport interface ApplicationGraphQLBody<T = Record<string, any>> {\n query: string;\n variables: T;\n}\n\nexport abstract class ApplicationGraphQL extends Plugin {\n public static override readonly type: string = \"apw.scheduler.applicationGraphQL\";\n\n public abstract getUrl(params: ApplicationGraphQLGetUrlParams): string;\n\n public abstract canUse(data: ApwScheduleActionData): boolean;\n\n public abstract getArn(settings: ApwSettings): string;\n\n public abstract getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAaO,MAAeA,kBAAf,SAA0CC,cAA1C,CAAiD;;;8BAAlCD,kB,UAC6B,kC"}
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import { ApplicationGraphQL, ApplicationGraphQLBody } from "./ApplicationGraphQL";
|
2
|
-
import { ApwScheduleActionData } from "../../../types";
|
3
|
-
import { ApwSettings } from "../../utils";
|
1
|
+
import { ApplicationGraphQL, ApplicationGraphQLBody, ApwSettings, ApplicationGraphQLGetUrlParams, ApwScheduleActionData } from "./ApplicationGraphQL";
|
4
2
|
export declare class HeadlessCMSGraphQL extends ApplicationGraphQL {
|
5
3
|
name: string;
|
6
4
|
canUse(data: ApwScheduleActionData): boolean;
|
5
|
+
getUrl({ locale }: ApplicationGraphQLGetUrlParams): string;
|
7
6
|
getArn(settings: ApwSettings): string;
|
8
7
|
getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null;
|
9
8
|
private getPublishBody;
|
@@ -67,13 +67,19 @@ const createUnpublishMutation = modelId => {
|
|
67
67
|
class HeadlessCMSGraphQL extends _ApplicationGraphQL.ApplicationGraphQL {
|
68
68
|
constructor(...args) {
|
69
69
|
super(...args);
|
70
|
-
(0, _defineProperty2.default)(this, "name", "apw.scheduler.applicationGraphQL.
|
70
|
+
(0, _defineProperty2.default)(this, "name", "apw.scheduler.applicationGraphQL.headlessCms");
|
71
71
|
}
|
72
72
|
|
73
73
|
canUse(data) {
|
74
74
|
return data.type === _types.ApwContentTypes.CMS_ENTRY;
|
75
75
|
}
|
76
76
|
|
77
|
+
getUrl({
|
78
|
+
locale
|
79
|
+
}) {
|
80
|
+
return `/cms/manage/${locale}`;
|
81
|
+
}
|
82
|
+
|
77
83
|
getArn(settings) {
|
78
84
|
return settings.cmsGraphqlFunctionArn;
|
79
85
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["META_FIELDS","ERROR_FIELD","createPublishMutation","modelId","ucFirstModelId","upperFirst","createUnpublishMutation","HeadlessCMSGraphQL","ApplicationGraphQL","canUse","data","type","ApwContentTypes","CMS_ENTRY","getArn","settings","cmsGraphqlFunctionArn","getGraphQLBody","action","ApwScheduleActionTypes","PUBLISH","getPublishBody","UNPUBLISH","getUnpublishBody","WebinyError","query","variables","revision","entryId"],"sources":["HeadlessCMSGraphQL.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"names":["META_FIELDS","ERROR_FIELD","createPublishMutation","modelId","ucFirstModelId","upperFirst","createUnpublishMutation","HeadlessCMSGraphQL","ApplicationGraphQL","canUse","data","type","ApwContentTypes","CMS_ENTRY","getUrl","locale","getArn","settings","cmsGraphqlFunctionArn","getGraphQLBody","action","ApwScheduleActionTypes","PUBLISH","getPublishBody","UNPUBLISH","getUnpublishBody","WebinyError","query","variables","revision","entryId"],"sources":["HeadlessCMSGraphQL.ts"],"sourcesContent":["import {\n ApplicationGraphQL,\n ApplicationGraphQLBody,\n ApwSettings,\n ApplicationGraphQLGetUrlParams,\n ApwScheduleActionData\n} from \"./ApplicationGraphQL\";\nimport { ApwContentTypes, ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport WebinyError from \"@webiny/error\";\nimport upperFirst from \"lodash/upperFirst\";\n\nconst META_FIELDS = `\n title\n publishedOn\n version\n locked\n status\n`;\n\nconst ERROR_FIELD = `\n {\n code\n data\n message\n }\n`;\n\nconst createPublishMutation = (modelId: string): string => {\n const ucFirstModelId = upperFirst(modelId);\n\n return `\n mutation CmsPublish${ucFirstModelId}($revision: ID!) {\n content: publish${ucFirstModelId}(revision: $revision) {\n data {\n id\n meta {\n ${META_FIELDS}\n }\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\nconst createUnpublishMutation = (modelId: string) => {\n const ucFirstModelId = upperFirst(modelId);\n\n return `\n mutation CmsUnpublish${ucFirstModelId}($revision: ID!) {\n content: unpublish${ucFirstModelId}(revision: $revision) {\n data {\n id\n meta {\n ${META_FIELDS}\n }\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\ninterface ApplicationGraphQLBodyVariables {\n revision: string;\n}\n\nexport class HeadlessCMSGraphQL extends ApplicationGraphQL {\n public override name = \"apw.scheduler.applicationGraphQL.headlessCms\";\n\n public override canUse(data: ApwScheduleActionData): boolean {\n return data.type === ApwContentTypes.CMS_ENTRY;\n }\n\n public override getUrl({ locale }: ApplicationGraphQLGetUrlParams): string {\n return `/cms/manage/${locale}`;\n }\n\n public override getArn(settings: ApwSettings): string {\n return settings.cmsGraphqlFunctionArn;\n }\n\n public override getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null {\n switch (data.action) {\n case ApwScheduleActionTypes.PUBLISH:\n return this.getPublishBody(data);\n case ApwScheduleActionTypes.UNPUBLISH:\n return this.getUnpublishBody(data);\n default:\n return null;\n }\n }\n\n private getPublishBody(\n data: ApwScheduleActionData\n ): ApplicationGraphQLBody<ApplicationGraphQLBodyVariables> {\n if (!data.modelId) {\n throw new WebinyError(\n \"Missing model ID in the schedule action data.\",\n \"SCHEDULE_ACTION_ERROR\",\n {\n data\n }\n );\n }\n return {\n query: createPublishMutation(data.modelId),\n variables: {\n revision: data.entryId\n }\n };\n }\n\n private getUnpublishBody(\n data: ApwScheduleActionData\n ): ApplicationGraphQLBody<ApplicationGraphQLBodyVariables> {\n if (!data.modelId) {\n throw new WebinyError(\n \"Missing model ID in the schedule action data.\",\n \"SCHEDULE_ACTION_ERROR\",\n {\n data\n }\n );\n }\n return {\n query: createUnpublishMutation(data.modelId),\n variables: {\n revision: data.entryId\n }\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AAEA,MAAMA,WAAW,GAAI;AACrB;AACA;AACA;AACA;AACA;AACA,CANA;AAQA,MAAMC,WAAW,GAAI;AACrB;AACA;AACA;AACA;AACA;AACA,CANA;;AAQA,MAAMC,qBAAqB,GAAIC,OAAD,IAA6B;EACvD,MAAMC,cAAc,GAAG,IAAAC,mBAAA,EAAWF,OAAX,CAAvB;EAEA,OAAQ;AACZ,6BAA6BC,cAAe;AAC5C,8BAA8BA,cAAe;AAC7C;AACA;AACA;AACA,0BAA0BJ,WAAY;AACtC;AACA;AACA,wBAAwBC,WAAY;AACpC;AACA,UAXI;AAYH,CAfD;;AAiBA,MAAMK,uBAAuB,GAAIH,OAAD,IAAqB;EACjD,MAAMC,cAAc,GAAG,IAAAC,mBAAA,EAAWF,OAAX,CAAvB;EAEA,OAAQ;AACZ,+BAA+BC,cAAe;AAC9C,gCAAgCA,cAAe;AAC/C;AACA;AACA;AACA,0BAA0BJ,WAAY;AACtC;AACA;AACA,wBAAwBC,WAAY;AACpC;AACA,UAXI;AAYH,CAfD;;AAqBO,MAAMM,kBAAN,SAAiCC,sCAAjC,CAAoD;EAAA;IAAA;IAAA,4CAChC,8CADgC;EAAA;;EAGvCC,MAAM,CAACC,IAAD,EAAuC;IACzD,OAAOA,IAAI,CAACC,IAAL,KAAcC,sBAAA,CAAgBC,SAArC;EACH;;EAEeC,MAAM,CAAC;IAAEC;EAAF,CAAD,EAAqD;IACvE,OAAQ,eAAcA,MAAO,EAA7B;EACH;;EAEeC,MAAM,CAACC,QAAD,EAAgC;IAClD,OAAOA,QAAQ,CAACC,qBAAhB;EACH;;EAEeC,cAAc,CAACT,IAAD,EAA6D;IACvF,QAAQA,IAAI,CAACU,MAAb;MACI,KAAKC,6BAAA,CAAuBC,OAA5B;QACI,OAAO,KAAKC,cAAL,CAAoBb,IAApB,CAAP;;MACJ,KAAKW,6BAAA,CAAuBG,SAA5B;QACI,OAAO,KAAKC,gBAAL,CAAsBf,IAAtB,CAAP;;MACJ;QACI,OAAO,IAAP;IANR;EAQH;;EAEOa,cAAc,CAClBb,IADkB,EAEqC;IACvD,IAAI,CAACA,IAAI,CAACP,OAAV,EAAmB;MACf,MAAM,IAAIuB,cAAJ,CACF,+CADE,EAEF,uBAFE,EAGF;QACIhB;MADJ,CAHE,CAAN;IAOH;;IACD,OAAO;MACHiB,KAAK,EAAEzB,qBAAqB,CAACQ,IAAI,CAACP,OAAN,CADzB;MAEHyB,SAAS,EAAE;QACPC,QAAQ,EAAEnB,IAAI,CAACoB;MADR;IAFR,CAAP;EAMH;;EAEOL,gBAAgB,CACpBf,IADoB,EAEmC;IACvD,IAAI,CAACA,IAAI,CAACP,OAAV,EAAmB;MACf,MAAM,IAAIuB,cAAJ,CACF,+CADE,EAEF,uBAFE,EAGF;QACIhB;MADJ,CAHE,CAAN;IAOH;;IACD,OAAO;MACHiB,KAAK,EAAErB,uBAAuB,CAACI,IAAI,CAACP,OAAN,CAD3B;MAEHyB,SAAS,EAAE;QACPC,QAAQ,EAAEnB,IAAI,CAACoB;MADR;IAFR,CAAP;EAMH;;AAhEsD"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { ApplicationGraphQL, ApplicationGraphQLBody } from "./ApplicationGraphQL";
|
2
|
-
import { ApwScheduleActionData } from "../../../types";
|
1
|
+
import { ApplicationGraphQL, ApplicationGraphQLBody, ApwScheduleActionData } from "./ApplicationGraphQL";
|
3
2
|
import { ApwSettings } from "../../utils";
|
4
3
|
export declare class PageBuilderGraphQL extends ApplicationGraphQL {
|
5
4
|
name: string;
|
6
5
|
canUse(data: ApwScheduleActionData): boolean;
|
6
|
+
getUrl(): string;
|
7
7
|
getArn(settings: ApwSettings): string;
|
8
8
|
getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null;
|
9
9
|
private getPublishBody;
|
@@ -18,65 +18,6 @@ const PB_PAGE_DATA_FIELD =
|
|
18
18
|
`
|
19
19
|
{
|
20
20
|
id
|
21
|
-
pid
|
22
|
-
editor
|
23
|
-
category {
|
24
|
-
slug
|
25
|
-
}
|
26
|
-
version
|
27
|
-
title
|
28
|
-
path
|
29
|
-
url
|
30
|
-
content
|
31
|
-
savedOn
|
32
|
-
status
|
33
|
-
locked
|
34
|
-
publishedOn
|
35
|
-
locked
|
36
|
-
revisions {
|
37
|
-
id
|
38
|
-
status
|
39
|
-
locked
|
40
|
-
version
|
41
|
-
}
|
42
|
-
settings {
|
43
|
-
general {
|
44
|
-
snippet
|
45
|
-
tags
|
46
|
-
layout
|
47
|
-
image {
|
48
|
-
id
|
49
|
-
src
|
50
|
-
}
|
51
|
-
}
|
52
|
-
social {
|
53
|
-
meta {
|
54
|
-
property
|
55
|
-
content
|
56
|
-
}
|
57
|
-
title
|
58
|
-
description
|
59
|
-
image {
|
60
|
-
id
|
61
|
-
src
|
62
|
-
}
|
63
|
-
}
|
64
|
-
seo {
|
65
|
-
title
|
66
|
-
description
|
67
|
-
meta {
|
68
|
-
name
|
69
|
-
content
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
createdFrom
|
74
|
-
createdOn
|
75
|
-
createdBy {
|
76
|
-
id
|
77
|
-
displayName
|
78
|
-
type
|
79
|
-
}
|
80
21
|
}
|
81
22
|
`;
|
82
23
|
const ERROR_FIELD =
|
@@ -123,6 +64,10 @@ class PageBuilderGraphQL extends _ApplicationGraphQL.ApplicationGraphQL {
|
|
123
64
|
return data.type === _types.ApwContentTypes.PAGE;
|
124
65
|
}
|
125
66
|
|
67
|
+
getUrl() {
|
68
|
+
return `/graphql`;
|
69
|
+
}
|
70
|
+
|
126
71
|
getArn(settings) {
|
127
72
|
return settings.mainGraphqlFunctionArn;
|
128
73
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PB_PAGE_DATA_FIELD","ERROR_FIELD","PUBLISH_MUTATION","UNPUBLISH_MUTATION","PageBuilderGraphQL","ApplicationGraphQL","canUse","data","type","ApwContentTypes","PAGE","getArn","settings","mainGraphqlFunctionArn","getGraphQLBody","action","ApwScheduleActionTypes","PUBLISH","getPublishBody","UNPUBLISH","getUnpublishBody","query","variables","id","entryId"],"sources":["PageBuilderGraphQL.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"names":["PB_PAGE_DATA_FIELD","ERROR_FIELD","PUBLISH_MUTATION","UNPUBLISH_MUTATION","PageBuilderGraphQL","ApplicationGraphQL","canUse","data","type","ApwContentTypes","PAGE","getUrl","getArn","settings","mainGraphqlFunctionArn","getGraphQLBody","action","ApwScheduleActionTypes","PUBLISH","getPublishBody","UNPUBLISH","getUnpublishBody","query","variables","id","entryId"],"sources":["PageBuilderGraphQL.ts"],"sourcesContent":["import {\n ApplicationGraphQL,\n ApplicationGraphQLBody,\n ApwScheduleActionData\n} from \"./ApplicationGraphQL\";\nimport { ApwContentTypes, ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport { ApwSettings } from \"~/scheduler/handlers/utils\";\n\nconst PB_PAGE_DATA_FIELD = /* GraphQL */ `\n {\n id\n }\n`;\n\nconst ERROR_FIELD = /* GraphQL */ `\n {\n code\n data\n message\n }\n`;\n\nconst PUBLISH_MUTATION = /* GraphQL */ `\n mutation PublishPage($id: ID!) {\n pageBuilder {\n publishPage(id: $id) {\n data ${PB_PAGE_DATA_FIELD}\n error ${ERROR_FIELD}\n }\n }\n }\n`;\n\nconst UNPUBLISH_MUTATION = /* GraphQL */ `\n mutation UnpublishPage($id: ID!) {\n pageBuilder {\n unpublishPage(id: $id) {\n data ${PB_PAGE_DATA_FIELD}\n error ${ERROR_FIELD}\n }\n }\n }\n`;\n\ninterface ApplicationGraphQLBodyVariables {\n id: string;\n}\n\nexport class PageBuilderGraphQL extends ApplicationGraphQL {\n public override name = \"apw.scheduler.applicationGraphQL.pageBuilder\";\n\n public override canUse(data: ApwScheduleActionData): boolean {\n return data.type === ApwContentTypes.PAGE;\n }\n\n public override getUrl(): string {\n return `/graphql`;\n }\n\n public override getArn(settings: ApwSettings): string {\n return settings.mainGraphqlFunctionArn;\n }\n\n public override getGraphQLBody(data: ApwScheduleActionData): ApplicationGraphQLBody | null {\n switch (data.action) {\n case ApwScheduleActionTypes.PUBLISH:\n return this.getPublishBody(data);\n case ApwScheduleActionTypes.UNPUBLISH:\n return this.getUnpublishBody(data);\n default:\n return null;\n }\n }\n\n private getPublishBody(\n data: ApwScheduleActionData\n ): ApplicationGraphQLBody<ApplicationGraphQLBodyVariables> {\n return {\n query: PUBLISH_MUTATION,\n variables: {\n id: data.entryId\n }\n };\n }\n\n private getUnpublishBody(\n data: ApwScheduleActionData\n ): ApplicationGraphQLBody<ApplicationGraphQLBodyVariables> {\n return {\n query: UNPUBLISH_MUTATION,\n variables: {\n id: data.entryId\n }\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAKA;;AAGA,MAAMA,kBAAkB;AAAG;AAAe;AAC1C;AACA;AACA;AACA,CAJA;AAMA,MAAMC,WAAW;AAAG;AAAe;AACnC;AACA;AACA;AACA;AACA;AACA,CANA;AAQA,MAAMC,gBAAgB;AAAG;AAAe;AACxC;AACA;AACA;AACA,uBAAuBF,kBAAmB;AAC1C,wBAAwBC,WAAY;AACpC;AACA;AACA;AACA,CATA;AAWA,MAAME,kBAAkB;AAAG;AAAe;AAC1C;AACA;AACA;AACA,uBAAuBH,kBAAmB;AAC1C,wBAAwBC,WAAY;AACpC;AACA;AACA;AACA,CATA;;AAeO,MAAMG,kBAAN,SAAiCC,sCAAjC,CAAoD;EAAA;IAAA;IAAA,4CAChC,8CADgC;EAAA;;EAGvCC,MAAM,CAACC,IAAD,EAAuC;IACzD,OAAOA,IAAI,CAACC,IAAL,KAAcC,sBAAA,CAAgBC,IAArC;EACH;;EAEeC,MAAM,GAAW;IAC7B,OAAQ,UAAR;EACH;;EAEeC,MAAM,CAACC,QAAD,EAAgC;IAClD,OAAOA,QAAQ,CAACC,sBAAhB;EACH;;EAEeC,cAAc,CAACR,IAAD,EAA6D;IACvF,QAAQA,IAAI,CAACS,MAAb;MACI,KAAKC,6BAAA,CAAuBC,OAA5B;QACI,OAAO,KAAKC,cAAL,CAAoBZ,IAApB,CAAP;;MACJ,KAAKU,6BAAA,CAAuBG,SAA5B;QACI,OAAO,KAAKC,gBAAL,CAAsBd,IAAtB,CAAP;;MACJ;QACI,OAAO,IAAP;IANR;EAQH;;EAEOY,cAAc,CAClBZ,IADkB,EAEqC;IACvD,OAAO;MACHe,KAAK,EAAEpB,gBADJ;MAEHqB,SAAS,EAAE;QACPC,EAAE,EAAEjB,IAAI,CAACkB;MADF;IAFR,CAAP;EAMH;;EAEOJ,gBAAgB,CACpBd,IADoB,EAEmC;IACvD,OAAO;MACHe,KAAK,EAAEnB,kBADJ;MAEHoB,SAAS,EAAE;QACPC,EAAE,EAAEjB,IAAI,CAACkB;MADF;IAFR,CAAP;EAMH;;AA9CsD"}
|
@@ -19,4 +19,4 @@ export interface Configuration {
|
|
19
19
|
executeAction: string;
|
20
20
|
};
|
21
21
|
}
|
22
|
-
export declare const scheduleActionHandlerPlugins: (config: Configuration) => ((import("@webiny/
|
22
|
+
export declare const scheduleActionHandlerPlugins: (config: Configuration) => ((import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler-aws").RawEventHandler<HandlerArgs, import("@webiny/handler/types").Context, any>)[];
|
@@ -19,7 +19,7 @@ export declare const encodeToken: ({ id, tenant, locale }: EncodeTokenParams) =>
|
|
19
19
|
export declare const TOKEN_PREFIX = "apw-";
|
20
20
|
export declare const decodeToken: (token: string) => Partial<EncodeTokenParams>;
|
21
21
|
export declare const documentClient: DocumentClient;
|
22
|
-
export declare const basePlugins: () => (import("@webiny/
|
22
|
+
export declare const basePlugins: () => (import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[];
|
23
23
|
/**
|
24
24
|
* Get APW settings record from DDB.
|
25
25
|
*/
|
package/utils/resolve.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import { Response, ErrorResponse } from "@webiny/handler-graphql";
|
2
|
-
declare const _default: (fn: () => Promise<any>) => Promise<
|
2
|
+
declare const _default: (fn: () => Promise<any>) => Promise<Response<any> | ErrorResponse>;
|
3
3
|
export default _default;
|