@webiny/tasks 5.39.4-beta.0 → 5.40.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/graphql/utils.d.ts +2 -2
- package/handler/index.js +0 -12
- package/handler/index.js.map +1 -1
- package/package.json +18 -18
package/graphql/utils.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare const emptyResolver: () => {};
|
|
|
4
4
|
interface ResolveCallable<T = any> {
|
|
5
5
|
(): Promise<T>;
|
|
6
6
|
}
|
|
7
|
-
export declare const resolve: <T = any>(fn: ResolveCallable<T>) => Promise<Response<Awaited<T
|
|
8
|
-
export declare const resolveList: (fn: ResolveCallable) => Promise<ListResponse<any, CmsEntryMeta
|
|
7
|
+
export declare const resolve: <T = any>(fn: ResolveCallable<T>) => Promise<ErrorResponse | Response<Awaited<T>>>;
|
|
8
|
+
export declare const resolveList: (fn: ResolveCallable) => Promise<ListErrorResponse | ListResponse<any, CmsEntryMeta>>;
|
|
9
9
|
export {};
|
package/handler/index.js
CHANGED
|
@@ -40,18 +40,6 @@ const createHandler = params => {
|
|
|
40
40
|
return reply.send();
|
|
41
41
|
});
|
|
42
42
|
app.post(url, async (_, reply) => {
|
|
43
|
-
/**
|
|
44
|
-
* Happened to a client so adding a check.
|
|
45
|
-
* We cannot reproduce it.
|
|
46
|
-
*/
|
|
47
|
-
if (!context) {
|
|
48
|
-
console.error("Missing Lambda context.");
|
|
49
|
-
return reply.send({
|
|
50
|
-
error: {
|
|
51
|
-
message: "This handler requires Lambda context to be passed."
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
43
|
const handler = new _runner.TaskRunner(
|
|
56
44
|
/**
|
|
57
45
|
* We can safely cast because we know that the context is of type tasks/Context
|
package/handler/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_handler","require","_plugins","_execute","_types","_runner","_timer","_TaskEventValidation","url","createHandler","params","event","context","app","createBaseHandler","options","logger","debug","registerDefaultPlugins","webiny","addHook","_","__","payload","body","setErrorHandler","error","reply","__webiny_raw_result","message","code","data","status","TaskResponseStatus","ERROR","send","post","
|
|
1
|
+
{"version":3,"names":["_handler","require","_plugins","_execute","_types","_runner","_timer","_TaskEventValidation","url","createHandler","params","event","context","app","createBaseHandler","options","logger","debug","registerDefaultPlugins","webiny","addHook","_","__","payload","body","setErrorHandler","error","reply","__webiny_raw_result","message","code","data","status","TaskResponseStatus","ERROR","send","post","handler","TaskRunner","timerFactory","TaskEventValidation","run","execute","headers","tenant","endpoint","locale","exports"],"sources":["index.ts"],"sourcesContent":["import { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"@webiny/handler-aws/plugins\";\nimport { execute } from \"@webiny/handler-aws/execute\";\nimport { HandlerFactoryParams } from \"@webiny/handler-aws/types\";\nimport { APIGatewayProxyResult } from \"aws-lambda\";\nimport { Context as LambdaContext } from \"aws-lambda/handler\";\nimport { Context, TaskResponseStatus } from \"~/types\";\nimport { ITaskRawEvent } from \"~/handler/types\";\nimport { TaskRunner } from \"~/runner\";\nimport WebinyError from \"@webiny/error\";\nimport { timerFactory } from \"~/timer\";\nimport { TaskEventValidation } from \"~/runner/TaskEventValidation\";\n\nexport interface HandlerCallable {\n (event: ITaskRawEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport type HandlerParams = HandlerFactoryParams;\n\nconst url = \"/webiny-background-task-event\";\n\nexport const createHandler = (params: HandlerParams): HandlerCallable => {\n return async (event, context) => {\n const app = createBaseHandler({\n ...params,\n options: {\n logger: params.debug === true,\n ...(params.options || {})\n }\n });\n\n registerDefaultPlugins(app.webiny);\n\n app.addHook(\"preSerialization\", async (_, __, payload: Record<string, any>) => {\n if (!payload.body) {\n return payload;\n }\n return payload.body;\n });\n\n app.setErrorHandler<WebinyError>(async (error, _, reply) => {\n app.__webiny_raw_result = {\n error: {\n message: error.message,\n code: error.code,\n data: error.data\n },\n status: TaskResponseStatus.ERROR\n };\n return reply.send();\n });\n\n app.post(url, async (_, reply) => {\n const handler = new TaskRunner(\n /**\n * We can safely cast because we know that the context is of type tasks/Context\n */\n app.webiny as Context,\n timerFactory(context),\n new TaskEventValidation()\n );\n\n app.__webiny_raw_result = await handler.run(event);\n return reply.send({});\n });\n return execute({\n app,\n url,\n payload: {\n ...event,\n headers: {\n [\"x-tenant\"]: event.tenant,\n [\"x-webiny-cms-endpoint\"]: event.endpoint,\n [\"x-webiny-cms-locale\"]: event.locale\n }\n }\n });\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAQA,MAAMO,GAAG,GAAG,+BAA+B;AAEpC,MAAMC,aAAa,GAAIC,MAAqB,IAAsB;EACrE,OAAO,OAAOC,KAAK,EAAEC,OAAO,KAAK;IAC7B,MAAMC,GAAG,GAAG,IAAAC,sBAAiB,EAAC;MAC1B,GAAGJ,MAAM;MACTK,OAAO,EAAE;QACLC,MAAM,EAAEN,MAAM,CAACO,KAAK,KAAK,IAAI;QAC7B,IAAIP,MAAM,CAACK,OAAO,IAAI,CAAC,CAAC;MAC5B;IACJ,CAAC,CAAC;IAEF,IAAAG,+BAAsB,EAACL,GAAG,CAACM,MAAM,CAAC;IAElCN,GAAG,CAACO,OAAO,CAAC,kBAAkB,EAAE,OAAOC,CAAC,EAAEC,EAAE,EAAEC,OAA4B,KAAK;MAC3E,IAAI,CAACA,OAAO,CAACC,IAAI,EAAE;QACf,OAAOD,OAAO;MAClB;MACA,OAAOA,OAAO,CAACC,IAAI;IACvB,CAAC,CAAC;IAEFX,GAAG,CAACY,eAAe,CAAc,OAAOC,KAAK,EAAEL,CAAC,EAAEM,KAAK,KAAK;MACxDd,GAAG,CAACe,mBAAmB,GAAG;QACtBF,KAAK,EAAE;UACHG,OAAO,EAAEH,KAAK,CAACG,OAAO;UACtBC,IAAI,EAAEJ,KAAK,CAACI,IAAI;UAChBC,IAAI,EAAEL,KAAK,CAACK;QAChB,CAAC;QACDC,MAAM,EAAEC,yBAAkB,CAACC;MAC/B,CAAC;MACD,OAAOP,KAAK,CAACQ,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFtB,GAAG,CAACuB,IAAI,CAAC5B,GAAG,EAAE,OAAOa,CAAC,EAAEM,KAAK,KAAK;MAC9B,MAAMU,OAAO,GAAG,IAAIC,kBAAU;MAC1B;AAChB;AACA;MACgBzB,GAAG,CAACM,MAAM,EACV,IAAAoB,mBAAY,EAAC3B,OAAO,CAAC,EACrB,IAAI4B,wCAAmB,CAAC,CAC5B,CAAC;MAED3B,GAAG,CAACe,mBAAmB,GAAG,MAAMS,OAAO,CAACI,GAAG,CAAC9B,KAAK,CAAC;MAClD,OAAOgB,KAAK,CAACQ,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,OAAO,IAAAO,gBAAO,EAAC;MACX7B,GAAG;MACHL,GAAG;MACHe,OAAO,EAAE;QACL,GAAGZ,KAAK;QACRgC,OAAO,EAAE;UACL,CAAC,UAAU,GAAGhC,KAAK,CAACiC,MAAM;UAC1B,CAAC,uBAAuB,GAAGjC,KAAK,CAACkC,QAAQ;UACzC,CAAC,qBAAqB,GAAGlC,KAAK,CAACmC;QACnC;MACJ;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACC,OAAA,CAAAtC,aAAA,GAAAA,aAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/tasks",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.40.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "7.22.6",
|
|
16
|
-
"@webiny/api": "5.
|
|
17
|
-
"@webiny/api-headless-cms": "5.
|
|
18
|
-
"@webiny/aws-sdk": "5.
|
|
19
|
-
"@webiny/error": "5.
|
|
20
|
-
"@webiny/handler": "5.
|
|
21
|
-
"@webiny/handler-aws": "5.
|
|
22
|
-
"@webiny/handler-graphql": "5.
|
|
23
|
-
"@webiny/plugins": "5.
|
|
24
|
-
"@webiny/pubsub": "5.
|
|
25
|
-
"@webiny/utils": "5.
|
|
16
|
+
"@webiny/api": "5.40.0-beta.0",
|
|
17
|
+
"@webiny/api-headless-cms": "5.40.0-beta.0",
|
|
18
|
+
"@webiny/aws-sdk": "5.40.0-beta.0",
|
|
19
|
+
"@webiny/error": "5.40.0-beta.0",
|
|
20
|
+
"@webiny/handler": "5.40.0-beta.0",
|
|
21
|
+
"@webiny/handler-aws": "5.40.0-beta.0",
|
|
22
|
+
"@webiny/handler-graphql": "5.40.0-beta.0",
|
|
23
|
+
"@webiny/plugins": "5.40.0-beta.0",
|
|
24
|
+
"@webiny/pubsub": "5.40.0-beta.0",
|
|
25
|
+
"@webiny/utils": "5.40.0-beta.0",
|
|
26
26
|
"aws-lambda": "1.0.7",
|
|
27
27
|
"deep-equal": "2.2.3",
|
|
28
28
|
"lodash": "4.17.21",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@babel/core": "7.22.8",
|
|
35
35
|
"@babel/preset-env": "7.22.7",
|
|
36
36
|
"@babel/preset-typescript": "7.22.5",
|
|
37
|
-
"@webiny/api-i18n": "5.
|
|
38
|
-
"@webiny/api-security": "5.
|
|
39
|
-
"@webiny/api-tenancy": "5.
|
|
40
|
-
"@webiny/api-wcp": "5.
|
|
41
|
-
"@webiny/cli": "5.
|
|
42
|
-
"@webiny/project-utils": "5.
|
|
37
|
+
"@webiny/api-i18n": "5.40.0-beta.0",
|
|
38
|
+
"@webiny/api-security": "5.40.0-beta.0",
|
|
39
|
+
"@webiny/api-tenancy": "5.40.0-beta.0",
|
|
40
|
+
"@webiny/api-wcp": "5.40.0-beta.0",
|
|
41
|
+
"@webiny/cli": "5.40.0-beta.0",
|
|
42
|
+
"@webiny/project-utils": "5.40.0-beta.0",
|
|
43
43
|
"rimraf": "3.0.2",
|
|
44
44
|
"ttypescript": "1.5.15",
|
|
45
45
|
"type-fest": "2.19.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"build": "yarn webiny run build",
|
|
54
54
|
"watch": "yarn webiny run watch"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "d716758f56ca020dfaf8147cd908dddfaaf0937f"
|
|
57
57
|
}
|