@webiny/api-apw 5.35.2 → 5.36.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +1 -1
- package/package.json +32 -34
- package/scheduler/createScheduleActionMethods.js +2 -7
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +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,3 +1,3 @@
|
|
1
1
|
import { CreateApwContextParams } from "./scheduler/types";
|
2
|
-
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/
|
2
|
+
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>)[];
|
3
3
|
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.
|
3
|
+
"version": "5.36.0-beta.0",
|
4
4
|
"keywords": [
|
5
5
|
"apw:base"
|
6
6
|
],
|
@@ -17,47 +17,45 @@
|
|
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": "
|
21
|
-
"@webiny/api-admin-settings": "
|
22
|
-
"@webiny/api-headless-cms": "
|
23
|
-
"@webiny/api-i18n": "
|
24
|
-
"@webiny/api-i18n-ddb": "
|
25
|
-
"@webiny/api-mailer": "
|
26
|
-
"@webiny/api-page-builder": "
|
27
|
-
"@webiny/api-security": "
|
28
|
-
"@webiny/api-tenancy": "
|
29
|
-
"@webiny/api-wcp": "
|
30
|
-
"@webiny/db-dynamodb": "
|
31
|
-
"@webiny/error": "
|
32
|
-
"@webiny/handler": "
|
33
|
-
"@webiny/handler-client": "
|
34
|
-
"@webiny/handler-db": "
|
35
|
-
"@webiny/handler-graphql": "
|
36
|
-
"@webiny/handler-logs": "
|
37
|
-
"@webiny/plugins": "
|
38
|
-
"@webiny/pubsub": "
|
39
|
-
"@webiny/utils": "
|
40
|
-
"@webiny/validation": "
|
20
|
+
"@webiny/api": "5.36.0-beta.0",
|
21
|
+
"@webiny/api-admin-settings": "5.36.0-beta.0",
|
22
|
+
"@webiny/api-headless-cms": "5.36.0-beta.0",
|
23
|
+
"@webiny/api-i18n": "5.36.0-beta.0",
|
24
|
+
"@webiny/api-i18n-ddb": "5.36.0-beta.0",
|
25
|
+
"@webiny/api-mailer": "5.36.0-beta.0",
|
26
|
+
"@webiny/api-page-builder": "5.36.0-beta.0",
|
27
|
+
"@webiny/api-security": "5.36.0-beta.0",
|
28
|
+
"@webiny/api-tenancy": "5.36.0-beta.0",
|
29
|
+
"@webiny/api-wcp": "5.36.0-beta.0",
|
30
|
+
"@webiny/db-dynamodb": "5.36.0-beta.0",
|
31
|
+
"@webiny/error": "5.36.0-beta.0",
|
32
|
+
"@webiny/handler": "5.36.0-beta.0",
|
33
|
+
"@webiny/handler-client": "5.36.0-beta.0",
|
34
|
+
"@webiny/handler-db": "5.36.0-beta.0",
|
35
|
+
"@webiny/handler-graphql": "5.36.0-beta.0",
|
36
|
+
"@webiny/handler-logs": "5.36.0-beta.0",
|
37
|
+
"@webiny/plugins": "5.36.0-beta.0",
|
38
|
+
"@webiny/pubsub": "5.36.0-beta.0",
|
39
|
+
"@webiny/utils": "5.36.0-beta.0",
|
40
|
+
"@webiny/validation": "5.36.0-beta.0",
|
41
41
|
"dayjs": "1.11.7",
|
42
|
-
"lodash": "4.17.21"
|
43
|
-
"mdbid": "1.0.0"
|
42
|
+
"lodash": "4.17.21"
|
44
43
|
},
|
45
44
|
"devDependencies": {
|
46
45
|
"@babel/cli": "7.20.7",
|
47
46
|
"@babel/core": "7.20.12",
|
48
47
|
"@babel/preset-env": "7.20.2",
|
49
|
-
"@webiny/api-headless-cms-ddb": "
|
50
|
-
"@webiny/api-page-builder-so-ddb": "
|
51
|
-
"@webiny/api-security-so-ddb": "
|
52
|
-
"@webiny/api-tenancy-so-ddb": "
|
53
|
-
"@webiny/cli": "
|
54
|
-
"@webiny/handler-aws": "
|
55
|
-
"@webiny/project-utils": "
|
56
|
-
"@webiny/wcp": "
|
48
|
+
"@webiny/api-headless-cms-ddb": "5.36.0-beta.0",
|
49
|
+
"@webiny/api-page-builder-so-ddb": "5.36.0-beta.0",
|
50
|
+
"@webiny/api-security-so-ddb": "5.36.0-beta.0",
|
51
|
+
"@webiny/api-tenancy-so-ddb": "5.36.0-beta.0",
|
52
|
+
"@webiny/cli": "5.36.0-beta.0",
|
53
|
+
"@webiny/handler-aws": "5.36.0-beta.0",
|
54
|
+
"@webiny/project-utils": "5.36.0-beta.0",
|
55
|
+
"@webiny/wcp": "5.36.0-beta.0",
|
57
56
|
"get-yarn-workspaces": "1.0.2",
|
58
57
|
"graphql": "15.8.0",
|
59
58
|
"jest": "28.1.3",
|
60
|
-
"mdbid": "1.0.0",
|
61
59
|
"prettier": "2.8.3",
|
62
60
|
"rimraf": "3.0.2",
|
63
61
|
"sinon": "9.2.4",
|
@@ -72,5 +70,5 @@
|
|
72
70
|
"build": "yarn webiny run build",
|
73
71
|
"watch": "yarn webiny run watch"
|
74
72
|
},
|
75
|
-
"gitHead": "
|
73
|
+
"gitHead": "c59b9cc5b96b7fd91388de93c7fff2d977d25220"
|
76
74
|
}
|
@@ -6,15 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.createScheduleActionMethods = createScheduleActionMethods;
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
|
-
var _mdbid = _interopRequireDefault(require("mdbid"));
|
10
9
|
var _fields = require("@commodo/fields");
|
11
10
|
var _validation = require("@webiny/validation");
|
11
|
+
var _utils = require("@webiny/utils");
|
12
12
|
var _types = require("./types");
|
13
|
-
/**
|
14
|
-
* Package mdbid does not have types.
|
15
|
-
*/
|
16
|
-
// @ts-ignore
|
17
|
-
|
18
13
|
/**
|
19
14
|
* Package @commodo/fields does not have types.
|
20
15
|
*/
|
@@ -76,7 +71,7 @@ function createScheduleActionMethods({
|
|
76
71
|
async create(input) {
|
77
72
|
const createDataModel = new CreateDataModel().populate(input);
|
78
73
|
await createDataModel.validate();
|
79
|
-
const id = (0,
|
74
|
+
const id = (0, _utils.mdbid)();
|
80
75
|
const identity = getIdentity();
|
81
76
|
const data = await createDataModel.toJSON();
|
82
77
|
const scheduleAction = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getTenantAndLocale()), {}, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["CreateDataModel","withFields","instance","datetime","string","validation","create","type","ApwContentTypes","PAGE","CMS_ENTRY","action","ApwScheduleActionTypes","PUBLISH","UNPUBLISH","entryId","modelId","value","Error","createScheduleActionMethods","storageOperations","getIdentity","getTenant","getLocale","getTenantAndLocale","tenant","id","locale","code","get","where","list","params","input","createDataModel","populate","validate","mdbid","identity","data","toJSON","scheduleAction","createdOn","Date","toISOString","savedOn","createdBy","displayName","item","update","updateDataModel","original","delete","getCurrentTask","updateCurrentTask","deleteCurrentTask"],"sources":["createScheduleActionMethods.ts"],"sourcesContent":["/**\n * Package
|
1
|
+
{"version":3,"names":["CreateDataModel","withFields","instance","datetime","string","validation","create","type","ApwContentTypes","PAGE","CMS_ENTRY","action","ApwScheduleActionTypes","PUBLISH","UNPUBLISH","entryId","modelId","value","Error","createScheduleActionMethods","storageOperations","getIdentity","getTenant","getLocale","getTenantAndLocale","tenant","id","locale","code","get","where","list","params","input","createDataModel","populate","validate","mdbid","identity","data","toJSON","scheduleAction","createdOn","Date","toISOString","savedOn","createdBy","displayName","item","update","updateDataModel","original","delete","getCurrentTask","updateCurrentTask","deleteCurrentTask"],"sources":["createScheduleActionMethods.ts"],"sourcesContent":["/**\n * Package @commodo/fields does not have types.\n */\n// @ts-ignore\nimport { string, withFields } from \"@commodo/fields\";\nimport { validation } from \"@webiny/validation\";\nimport { mdbid } from \"@webiny/utils\";\nimport {\n ApwContentTypes,\n ApwScheduleAction,\n ApwScheduleActionCrud,\n ApwScheduleActionData,\n ApwScheduleActionTypes,\n CreateScheduleActionParams\n} from \"~/scheduler/types\";\n\nconst CreateDataModel = withFields((instance: any) => {\n return {\n datetime: string({\n validation: validation.create(`required`)\n }),\n type: string({\n validation: validation.create(\n `required,in:${ApwContentTypes.PAGE}:${ApwContentTypes.CMS_ENTRY}`\n )\n }),\n action: string({\n validation: validation.create(\n `required,in:${ApwScheduleActionTypes.PUBLISH}:${ApwScheduleActionTypes.UNPUBLISH}`\n )\n }),\n entryId: string({\n validation: validation.create(`required`)\n }),\n modelId: string({\n validation: (value: string) => {\n if (instance.type !== ApwContentTypes.CMS_ENTRY) {\n return true;\n } else if (!!value) {\n return true;\n }\n throw new Error(\n `There is no modelId defined when type is \"${ApwContentTypes.CMS_ENTRY}\"`\n );\n }\n })\n };\n})();\n\ninterface GetTenantAndLocaleResult {\n tenant: string;\n locale: string;\n}\n\nexport function createScheduleActionMethods({\n storageOperations,\n getIdentity,\n getTenant,\n getLocale\n}: CreateScheduleActionParams): ApwScheduleActionCrud {\n const getTenantAndLocale = (): GetTenantAndLocaleResult => {\n const tenant = getTenant().id;\n const locale = getLocale().code;\n return {\n tenant,\n locale\n };\n };\n return {\n async get(id) {\n return storageOperations.get({\n where: {\n id,\n ...getTenantAndLocale()\n }\n });\n },\n async list(params) {\n return storageOperations.list({\n ...params,\n where: {\n ...params.where,\n ...getTenantAndLocale()\n }\n });\n },\n async create(input) {\n const createDataModel = new CreateDataModel().populate(input);\n\n await createDataModel.validate();\n\n const id: string = mdbid();\n const identity = getIdentity();\n\n const data: ApwScheduleActionData = await createDataModel.toJSON();\n\n const scheduleAction: ApwScheduleAction = {\n ...getTenantAndLocale(),\n data,\n id,\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n createdBy: {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName\n }\n };\n\n return await storageOperations.create({\n item: scheduleAction,\n input\n });\n },\n async update(id, data) {\n const updateDataModel = new CreateDataModel().populate(data);\n\n await updateDataModel.validate();\n\n const original = await this.get(id);\n\n if (!original) {\n throw new Error(\"Not found!\");\n }\n\n return await storageOperations.update({ item: original, input: data });\n },\n async delete(id: string) {\n await storageOperations.delete({ id, ...getTenantAndLocale() });\n\n return true;\n },\n async getCurrentTask() {\n return await storageOperations.getCurrentTask({ where: { ...getTenantAndLocale() } });\n },\n async updateCurrentTask(item) {\n return await storageOperations.updateCurrentTask({ item });\n },\n async deleteCurrentTask() {\n return await storageOperations.deleteCurrentTask({ ...getTenantAndLocale() });\n }\n };\n}\n"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACA;AAPA;AACA;AACA;AACA;;AAaA,MAAMA,eAAe,GAAG,IAAAC,kBAAU,EAAEC,QAAa,IAAK;EAClD,OAAO;IACHC,QAAQ,EAAE,IAAAC,cAAM,EAAC;MACbC,UAAU,EAAEA,sBAAU,CAACC,MAAM,CAAE,UAAS;IAC5C,CAAC,CAAC;IACFC,IAAI,EAAE,IAAAH,cAAM,EAAC;MACTC,UAAU,EAAEA,sBAAU,CAACC,MAAM,CACxB,eAAcE,sBAAe,CAACC,IAAK,IAAGD,sBAAe,CAACE,SAAU,EAAC;IAE1E,CAAC,CAAC;IACFC,MAAM,EAAE,IAAAP,cAAM,EAAC;MACXC,UAAU,EAAEA,sBAAU,CAACC,MAAM,CACxB,eAAcM,6BAAsB,CAACC,OAAQ,IAAGD,6BAAsB,CAACE,SAAU,EAAC;IAE3F,CAAC,CAAC;IACFC,OAAO,EAAE,IAAAX,cAAM,EAAC;MACZC,UAAU,EAAEA,sBA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G,CAAC,CAAC;IACzF,CAAC;IACD,MAAM8B,iBAAiB,CAACN,IAAI,EAAE;MAC1B,OAAO,MAAM5B,iBAAiB,CAACkC,iBAAiB,CAAC;QAAEN;MAAK,CAAC,CAAC;IAC9D,CAAC;IACD,MAAMO,iBAAiB,GAAG;MACtB,OAAO,MAAMnC,iBAAiB,CAACmC,iBAAiB,iCAAM/B,kBAAkB,EAAE,EAAG;IACjF;EACJ,CAAC;AACL"}
|
@@ -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-aws").RawEventHandler<HandlerArgs, import("@webiny/handler/types").Context, any> | ContextPlugin<import("@webiny/api/types").Context>)[];
|
13
13
|
export {};
|
@@ -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;
|