@webiny/handler-aws 0.0.0-unstable.df6d94b531 → 0.0.0-unstable.df7a8bb475

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.
Files changed (103) hide show
  1. package/README.md +10 -14
  2. package/createHandler.d.ts +2 -0
  3. package/createHandler.js +29 -0
  4. package/createHandler.js.map +1 -0
  5. package/dynamodb/index.d.ts +5 -8
  6. package/dynamodb/index.js +26 -56
  7. package/dynamodb/index.js.map +1 -1
  8. package/dynamodb/plugins/DynamoDBEventHandler.d.ts +8 -7
  9. package/dynamodb/plugins/DynamoDBEventHandler.js +5 -22
  10. package/dynamodb/plugins/DynamoDBEventHandler.js.map +1 -1
  11. package/dynamodb/register.d.ts +1 -0
  12. package/dynamodb/register.js +26 -0
  13. package/dynamodb/register.js.map +1 -0
  14. package/eventBridge/index.d.ts +7 -10
  15. package/eventBridge/index.js +27 -57
  16. package/eventBridge/index.js.map +1 -1
  17. package/eventBridge/plugins/EventBridgeEventHandler.d.ts +8 -7
  18. package/eventBridge/plugins/EventBridgeEventHandler.js +5 -22
  19. package/eventBridge/plugins/EventBridgeEventHandler.js.map +1 -1
  20. package/eventBridge/register.d.ts +4 -0
  21. package/eventBridge/register.js +19 -0
  22. package/eventBridge/register.js.map +1 -0
  23. package/execute.d.ts +1 -1
  24. package/execute.js +18 -23
  25. package/execute.js.map +1 -1
  26. package/gateway/index.d.ts +7 -11
  27. package/gateway/index.js +27 -57
  28. package/gateway/index.js.map +1 -1
  29. package/gateway/register.d.ts +1 -0
  30. package/gateway/register.js +19 -0
  31. package/gateway/register.js.map +1 -0
  32. package/index.d.ts +35 -6
  33. package/index.js +41 -238
  34. package/index.js.map +1 -1
  35. package/package.json +15 -22
  36. package/plugins/handlerClient.js +11 -27
  37. package/plugins/handlerClient.js.map +1 -1
  38. package/plugins/index.d.ts +1 -1
  39. package/plugins/index.js +4 -12
  40. package/plugins/index.js.map +1 -1
  41. package/raw/index.d.ts +5 -10
  42. package/raw/index.js +32 -57
  43. package/raw/index.js.map +1 -1
  44. package/raw/plugins/RawEventHandler.d.ts +17 -6
  45. package/raw/plugins/RawEventHandler.js +21 -18
  46. package/raw/plugins/RawEventHandler.js.map +1 -1
  47. package/registry.d.ts +17 -0
  48. package/registry.js +38 -0
  49. package/registry.js.map +1 -0
  50. package/s3/index.d.ts +6 -9
  51. package/s3/index.js +29 -59
  52. package/s3/index.js.map +1 -1
  53. package/s3/plugins/S3EventHandler.d.ts +8 -7
  54. package/s3/plugins/S3EventHandler.js +5 -22
  55. package/s3/plugins/S3EventHandler.js.map +1 -1
  56. package/s3/register.d.ts +4 -0
  57. package/s3/register.js +23 -0
  58. package/s3/register.js.map +1 -0
  59. package/sns/index.d.ts +8 -0
  60. package/sns/index.js +57 -0
  61. package/sns/index.js.map +1 -0
  62. package/sns/plugins/SNSEventHandler.d.ts +20 -0
  63. package/sns/plugins/SNSEventHandler.js +13 -0
  64. package/sns/plugins/SNSEventHandler.js.map +1 -0
  65. package/sns/register.d.ts +1 -0
  66. package/sns/register.js +23 -0
  67. package/sns/register.js.map +1 -0
  68. package/sourceHandler.d.ts +2 -0
  69. package/sourceHandler.js +5 -0
  70. package/sourceHandler.js.map +1 -0
  71. package/sqs/index.d.ts +6 -9
  72. package/sqs/index.js +33 -60
  73. package/sqs/index.js.map +1 -1
  74. package/sqs/plugins/SQSEventHandler.d.ts +8 -7
  75. package/sqs/plugins/SQSEventHandler.js +5 -22
  76. package/sqs/plugins/SQSEventHandler.js.map +1 -1
  77. package/sqs/register.d.ts +1 -0
  78. package/sqs/register.js +26 -0
  79. package/sqs/register.js.map +1 -0
  80. package/types.d.ts +28 -5
  81. package/types.js +7 -30
  82. package/types.js.map +1 -1
  83. package/utils/composedHandler.d.ts +6 -0
  84. package/utils/composedHandler.js +17 -0
  85. package/utils/composedHandler.js.map +1 -0
  86. package/utils/index.d.ts +2 -0
  87. package/utils/index.js +4 -0
  88. package/utils/index.js.map +1 -0
  89. package/utils/timer/CustomTimer.d.ts +5 -0
  90. package/utils/timer/CustomTimer.js +12 -0
  91. package/utils/timer/CustomTimer.js.map +1 -0
  92. package/utils/timer/Timer.d.ts +10 -0
  93. package/utils/timer/Timer.js +17 -0
  94. package/utils/timer/Timer.js.map +1 -0
  95. package/utils/timer/abstractions/ITimer.d.ts +10 -0
  96. package/utils/timer/abstractions/ITimer.js +3 -0
  97. package/utils/timer/abstractions/ITimer.js.map +1 -0
  98. package/utils/timer/factory.d.ts +4 -0
  99. package/utils/timer/factory.js +13 -0
  100. package/utils/timer/factory.js.map +1 -0
  101. package/utils/timer/index.d.ts +4 -0
  102. package/utils/timer/index.js +5 -0
  103. package/utils/timer/index.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["registry","createSourceHandler","createHandler","handler","name","canUse","event","source","handle","params","context","register"],"sources":["register.ts"],"sourcesContent":["import type { EventBridgeEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { registry } from \"~/registry.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\nimport { createSourceHandler } from \"~/sourceHandler.js\";\nimport { createHandler } from \"~/eventBridge/index.js\";\n\nexport interface HandlerParams extends HandlerFactoryParams {\n debug?: boolean;\n}\n\nconst handler = createSourceHandler<EventBridgeEvent<string, string>, HandlerParams>({\n name: \"handler-aws-event-bridge\",\n canUse: event => {\n return !!event.source;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"mappings":"AACA,SAASA,QAAQ;AAEjB,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AAMtB,MAAMC,OAAO,GAAGF,mBAAmB,CAAkD;EACjFG,IAAI,EAAE,0BAA0B;EAChCC,MAAM,EAAEC,KAAK,IAAI;IACb,OAAO,CAAC,CAACA,KAAK,CAACC,MAAM;EACzB,CAAC;EACDC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAEH,KAAK;IAAEI;EAAQ,CAAC,KAAK;IAC1C,OAAOR,aAAa,CAACO,MAAM,CAAC,CAACH,KAAK,EAAEI,OAAO,CAAC;EAChD;AACJ,CAAC,CAAC;AAEFV,QAAQ,CAACW,QAAQ,CAACR,OAAO,CAAC","ignoreList":[]}
package/execute.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FastifyInstance } from "@webiny/handler/types";
1
+ import type { FastifyInstance } from "@webiny/handler/types.js";
2
2
  export interface ExecuteParams {
3
3
  app: FastifyInstance;
4
4
  url: string;
package/execute.js CHANGED
@@ -1,16 +1,4 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.execute = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _types = require("./types");
13
-
1
+ import { Base64EncodeHeader } from "./types.js";
14
2
  const createHandleResponse = (app, resolve) => {
15
3
  return (err, result) => {
16
4
  if (err) {
@@ -20,12 +8,18 @@ const createHandleResponse = (app, resolve) => {
20
8
  headers: {}
21
9
  });
22
10
  }
23
-
24
11
  if (app.__webiny_raw_result) {
25
12
  return resolve(app.__webiny_raw_result);
13
+ } else if (!result) {
14
+ const response = {
15
+ statusCode: 200,
16
+ body: "",
17
+ headers: {},
18
+ isBase64Encoded: false
19
+ };
20
+ return resolve(response);
26
21
  }
27
-
28
- const isBase64Encoded = !!result.headers[_types.Base64EncodeHeader.encoded] || !!result.headers[_types.Base64EncodeHeader.binary];
22
+ const isBase64Encoded = !!result.headers[Base64EncodeHeader.encoded] || !!result.headers[Base64EncodeHeader.binary];
29
23
  const response = {
30
24
  statusCode: result.statusCode,
31
25
  body: isBase64Encoded ? result.rawPayload.toString("base64") : result.payload,
@@ -35,17 +29,17 @@ const createHandleResponse = (app, resolve) => {
35
29
  return resolve(response);
36
30
  };
37
31
  };
38
-
39
32
  const getPayloadProperty = (payload, prop, defaults = {}) => {
40
- if (typeof payload === "object") {
33
+ if (payload && typeof payload === "object") {
41
34
  const value = payload[prop] ? payload[prop] : {};
42
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaults), value);
35
+ return {
36
+ ...defaults,
37
+ ...value
38
+ };
43
39
  }
44
-
45
40
  return defaults;
46
41
  };
47
-
48
- const execute = params => {
42
+ export const execute = params => {
49
43
  const {
50
44
  app,
51
45
  url,
@@ -61,6 +55,7 @@ const execute = params => {
61
55
  method: "POST",
62
56
  url,
63
57
  payload: payload || {},
58
+ body: payload || {},
64
59
  query,
65
60
  headers,
66
61
  cookies
@@ -68,4 +63,4 @@ const execute = params => {
68
63
  });
69
64
  };
70
65
 
71
- exports.execute = execute;
66
+ //# sourceMappingURL=execute.js.map
package/execute.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createHandleResponse","app","resolve","err","result","statusCode","body","JSON","stringify","headers","__webiny_raw_result","isBase64Encoded","Base64EncodeHeader","encoded","binary","response","rawPayload","toString","payload","getPayloadProperty","prop","defaults","value","execute","params","url","query","cookies","Promise","inject","method"],"sources":["execute.ts"],"sourcesContent":["import { FastifyInstance } from \"@webiny/handler/types\";\nimport { APIGatewayProxyResult } from \"aws-lambda/trigger/api-gateway-proxy\";\nimport { LightMyRequestCallback } from \"fastify\";\nimport { Base64EncodeHeader } from \"~/types\";\n\ninterface Resolve {\n (response: APIGatewayProxyResult | any): void;\n}\nconst createHandleResponse = (app: FastifyInstance, resolve: Resolve): LightMyRequestCallback => {\n return (err, result) => {\n if (err) {\n return resolve({\n statusCode: 500,\n body: JSON.stringify(err),\n headers: {}\n });\n }\n if (app.__webiny_raw_result) {\n return resolve(app.__webiny_raw_result);\n }\n const isBase64Encoded =\n !!result.headers[Base64EncodeHeader.encoded] ||\n !!result.headers[Base64EncodeHeader.binary];\n const response: APIGatewayProxyResult = {\n statusCode: result.statusCode,\n body: isBase64Encoded ? result.rawPayload.toString(\"base64\") : result.payload,\n headers: result.headers as APIGatewayProxyResult[\"headers\"],\n isBase64Encoded\n };\n return resolve(response);\n };\n};\n\nconst getPayloadProperty = (\n payload: any,\n prop: string,\n defaults: Record<string, any> = {}\n): Record<string, any> => {\n if (typeof payload === \"object\") {\n const value = payload[prop] ? payload[prop] : {};\n\n return {\n ...defaults,\n ...value\n };\n }\n return defaults;\n};\n\nexport interface ExecuteParams {\n app: FastifyInstance;\n url: string;\n payload: any;\n}\n\nexport const execute = (params: ExecuteParams): Promise<any> => {\n const { app, url, payload } = params;\n\n const query = getPayloadProperty(payload, \"query\", {});\n const headers = getPayloadProperty(payload, \"headers\", {\n [\"content-type\"]: \"application/json\"\n });\n const cookies = getPayloadProperty(payload, \"cookies\", {});\n\n return new Promise(resolve => {\n app.inject(\n {\n method: \"POST\",\n url,\n payload: payload || {},\n query,\n headers,\n cookies\n },\n createHandleResponse(app, resolve)\n );\n });\n};\n"],"mappings":";;;;;;;;;;;AAGA;;AAKA,MAAMA,oBAAoB,GAAG,CAACC,GAAD,EAAuBC,OAAvB,KAAoE;EAC7F,OAAO,CAACC,GAAD,EAAMC,MAAN,KAAiB;IACpB,IAAID,GAAJ,EAAS;MACL,OAAOD,OAAO,CAAC;QACXG,UAAU,EAAE,GADD;QAEXC,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAeL,GAAf,CAFK;QAGXM,OAAO,EAAE;MAHE,CAAD,CAAd;IAKH;;IACD,IAAIR,GAAG,CAACS,mBAAR,EAA6B;MACzB,OAAOR,OAAO,CAACD,GAAG,CAACS,mBAAL,CAAd;IACH;;IACD,MAAMC,eAAe,GACjB,CAAC,CAACP,MAAM,CAACK,OAAP,CAAeG,yBAAA,CAAmBC,OAAlC,CAAF,IACA,CAAC,CAACT,MAAM,CAACK,OAAP,CAAeG,yBAAA,CAAmBE,MAAlC,CAFN;IAGA,MAAMC,QAA+B,GAAG;MACpCV,UAAU,EAAED,MAAM,CAACC,UADiB;MAEpCC,IAAI,EAAEK,eAAe,GAAGP,MAAM,CAACY,UAAP,CAAkBC,QAAlB,CAA2B,QAA3B,CAAH,GAA0Cb,MAAM,CAACc,OAFlC;MAGpCT,OAAO,EAAEL,MAAM,CAACK,OAHoB;MAIpCE;IAJoC,CAAxC;IAMA,OAAOT,OAAO,CAACa,QAAD,CAAd;EACH,CArBD;AAsBH,CAvBD;;AAyBA,MAAMI,kBAAkB,GAAG,CACvBD,OADuB,EAEvBE,IAFuB,EAGvBC,QAA6B,GAAG,EAHT,KAID;EACtB,IAAI,OAAOH,OAAP,KAAmB,QAAvB,EAAiC;IAC7B,MAAMI,KAAK,GAAGJ,OAAO,CAACE,IAAD,CAAP,GAAgBF,OAAO,CAACE,IAAD,CAAvB,GAAgC,EAA9C;IAEA,mEACOC,QADP,GAEOC,KAFP;EAIH;;EACD,OAAOD,QAAP;AACH,CAdD;;AAsBO,MAAME,OAAO,GAAIC,MAAD,IAAyC;EAC5D,MAAM;IAAEvB,GAAF;IAAOwB,GAAP;IAAYP;EAAZ,IAAwBM,MAA9B;EAEA,MAAME,KAAK,GAAGP,kBAAkB,CAACD,OAAD,EAAU,OAAV,EAAmB,EAAnB,CAAhC;EACA,MAAMT,OAAO,GAAGU,kBAAkB,CAACD,OAAD,EAAU,SAAV,EAAqB;IACnD,CAAC,cAAD,GAAkB;EADiC,CAArB,CAAlC;EAGA,MAAMS,OAAO,GAAGR,kBAAkB,CAACD,OAAD,EAAU,SAAV,EAAqB,EAArB,CAAlC;EAEA,OAAO,IAAIU,OAAJ,CAAY1B,OAAO,IAAI;IAC1BD,GAAG,CAAC4B,MAAJ,CACI;MACIC,MAAM,EAAE,MADZ;MAEIL,GAFJ;MAGIP,OAAO,EAAEA,OAAO,IAAI,EAHxB;MAIIQ,KAJJ;MAKIjB,OALJ;MAMIkB;IANJ,CADJ,EASI3B,oBAAoB,CAACC,GAAD,EAAMC,OAAN,CATxB;EAWH,CAZM,CAAP;AAaH,CAtBM"}
1
+ {"version":3,"names":["Base64EncodeHeader","createHandleResponse","app","resolve","err","result","statusCode","body","JSON","stringify","headers","__webiny_raw_result","response","isBase64Encoded","encoded","binary","rawPayload","toString","payload","getPayloadProperty","prop","defaults","value","execute","params","url","query","cookies","Promise","inject","method"],"sources":["execute.ts"],"sourcesContent":["import type { FastifyInstance } from \"@webiny/handler/types.js\";\nimport type { APIGatewayProxyResult } from \"@webiny/aws-sdk/types/index.js\";\nimport type { LightMyRequestCallback } from \"fastify\";\nimport { Base64EncodeHeader } from \"~/types.js\";\n\ninterface Resolve {\n (response: APIGatewayProxyResult | any): void;\n}\nconst createHandleResponse = (app: FastifyInstance, resolve: Resolve): LightMyRequestCallback => {\n return (err, result) => {\n if (err) {\n return resolve({\n statusCode: 500,\n body: JSON.stringify(err),\n headers: {}\n });\n }\n if (app.__webiny_raw_result) {\n return resolve(app.__webiny_raw_result);\n } else if (!result) {\n const response: APIGatewayProxyResult = {\n statusCode: 200,\n body: \"\",\n headers: {},\n isBase64Encoded: false\n };\n return resolve(response);\n }\n\n const isBase64Encoded =\n !!result.headers[Base64EncodeHeader.encoded] ||\n !!result.headers[Base64EncodeHeader.binary];\n const response: APIGatewayProxyResult = {\n statusCode: result.statusCode,\n body: isBase64Encoded ? result.rawPayload.toString(\"base64\") : result.payload,\n headers: result.headers as APIGatewayProxyResult[\"headers\"],\n isBase64Encoded\n };\n return resolve(response);\n };\n};\n\nconst getPayloadProperty = (\n payload: any,\n prop: string,\n defaults: Record<string, any> = {}\n): Record<string, any> => {\n if (payload && typeof payload === \"object\") {\n const value = payload[prop] ? payload[prop] : {};\n\n return {\n ...defaults,\n ...value\n };\n }\n return defaults;\n};\n\nexport interface ExecuteParams {\n app: FastifyInstance;\n url: string;\n payload: any;\n}\n\nexport const execute = (params: ExecuteParams): Promise<any> => {\n const { app, url, payload } = params;\n\n const query = getPayloadProperty(payload, \"query\", {});\n const headers = getPayloadProperty(payload, \"headers\", {\n [\"content-type\"]: \"application/json\"\n });\n\n const cookies = getPayloadProperty(payload, \"cookies\", {});\n\n return new Promise(resolve => {\n app.inject(\n {\n method: \"POST\",\n url,\n payload: payload || {},\n body: payload || {},\n query,\n headers,\n cookies\n },\n createHandleResponse(app, resolve)\n );\n });\n};\n"],"mappings":"AAGA,SAASA,kBAAkB;AAK3B,MAAMC,oBAAoB,GAAGA,CAACC,GAAoB,EAAEC,OAAgB,KAA6B;EAC7F,OAAO,CAACC,GAAG,EAAEC,MAAM,KAAK;IACpB,IAAID,GAAG,EAAE;MACL,OAAOD,OAAO,CAAC;QACXG,UAAU,EAAE,GAAG;QACfC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACL,GAAG,CAAC;QACzBM,OAAO,EAAE,CAAC;MACd,CAAC,CAAC;IACN;IACA,IAAIR,GAAG,CAACS,mBAAmB,EAAE;MACzB,OAAOR,OAAO,CAACD,GAAG,CAACS,mBAAmB,CAAC;IAC3C,CAAC,MAAM,IAAI,CAACN,MAAM,EAAE;MAChB,MAAMO,QAA+B,GAAG;QACpCN,UAAU,EAAE,GAAG;QACfC,IAAI,EAAE,EAAE;QACRG,OAAO,EAAE,CAAC,CAAC;QACXG,eAAe,EAAE;MACrB,CAAC;MACD,OAAOV,OAAO,CAACS,QAAQ,CAAC;IAC5B;IAEA,MAAMC,eAAe,GACjB,CAAC,CAACR,MAAM,CAACK,OAAO,CAACV,kBAAkB,CAACc,OAAO,CAAC,IAC5C,CAAC,CAACT,MAAM,CAACK,OAAO,CAACV,kBAAkB,CAACe,MAAM,CAAC;IAC/C,MAAMH,QAA+B,GAAG;MACpCN,UAAU,EAAED,MAAM,CAACC,UAAU;MAC7BC,IAAI,EAAEM,eAAe,GAAGR,MAAM,CAACW,UAAU,CAACC,QAAQ,CAAC,QAAQ,CAAC,GAAGZ,MAAM,CAACa,OAAO;MAC7ER,OAAO,EAAEL,MAAM,CAACK,OAA2C;MAC3DG;IACJ,CAAC;IACD,OAAOV,OAAO,CAACS,QAAQ,CAAC;EAC5B,CAAC;AACL,CAAC;AAED,MAAMO,kBAAkB,GAAGA,CACvBD,OAAY,EACZE,IAAY,EACZC,QAA6B,GAAG,CAAC,CAAC,KACZ;EACtB,IAAIH,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IACxC,MAAMI,KAAK,GAAGJ,OAAO,CAACE,IAAI,CAAC,GAAGF,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO;MACH,GAAGC,QAAQ;MACX,GAAGC;IACP,CAAC;EACL;EACA,OAAOD,QAAQ;AACnB,CAAC;AAQD,OAAO,MAAME,OAAO,GAAIC,MAAqB,IAAmB;EAC5D,MAAM;IAAEtB,GAAG;IAAEuB,GAAG;IAAEP;EAAQ,CAAC,GAAGM,MAAM;EAEpC,MAAME,KAAK,GAAGP,kBAAkB,CAACD,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;EACtD,MAAMR,OAAO,GAAGS,kBAAkB,CAACD,OAAO,EAAE,SAAS,EAAE;IACnD,CAAC,cAAc,GAAG;EACtB,CAAC,CAAC;EAEF,MAAMS,OAAO,GAAGR,kBAAkB,CAACD,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;EAE1D,OAAO,IAAIU,OAAO,CAACzB,OAAO,IAAI;IAC1BD,GAAG,CAAC2B,MAAM,CACN;MACIC,MAAM,EAAE,MAAM;MACdL,GAAG;MACHP,OAAO,EAAEA,OAAO,IAAI,CAAC,CAAC;MACtBX,IAAI,EAAEW,OAAO,IAAI,CAAC,CAAC;MACnBQ,KAAK;MACLhB,OAAO;MACPiB;IACJ,CAAC,EACD1B,oBAAoB,CAACC,GAAG,EAAEC,OAAO,CACrC,CAAC;EACL,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,14 +1,10 @@
1
- import { LambdaFastifyOptions as LambdaOptions, LambdaResponse } from "@fastify/aws-lambda";
2
- import { APIGatewayEvent, Context as LambdaContext } from "aws-lambda";
3
- import { CreateHandlerParams as BaseCreateHandlerParams, RoutePlugin, createRoute } from "@webiny/handler";
1
+ import type { APIGatewayEvent, Context as LambdaContext } from "@webiny/aws-sdk/types/index.js";
2
+ import type { LambdaResponse } from "@fastify/aws-lambda";
3
+ import { createRoute, RoutePlugin } from "@webiny/handler";
4
+ import type { HandlerFactoryParams } from "../types.js";
5
+ export { RoutePlugin, createRoute };
6
+ export type HandlerParams = HandlerFactoryParams;
4
7
  export interface HandlerCallable {
5
8
  (event: APIGatewayEvent, ctx: LambdaContext): Promise<LambdaResponse>;
6
9
  }
7
- export interface CreateHandlerParams extends BaseCreateHandlerParams {
8
- http?: {
9
- debug?: boolean;
10
- };
11
- lambdaOptions?: LambdaOptions;
12
- }
13
- export declare const createHandler: (params: CreateHandlerParams) => HandlerCallable;
14
- export { RoutePlugin, createRoute };
10
+ export declare const createHandler: (params: HandlerParams) => HandlerCallable;
package/gateway/index.js CHANGED
@@ -1,53 +1,24 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "RoutePlugin", {
9
- enumerable: true,
10
- get: function () {
11
- return _handler.RoutePlugin;
12
- }
13
- });
14
- exports.createHandler = void 0;
15
- Object.defineProperty(exports, "createRoute", {
16
- enumerable: true,
17
- get: function () {
18
- return _handler.createRoute;
19
- }
20
- });
21
-
22
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
23
-
24
- var _awsLambda = _interopRequireDefault(require("@fastify/aws-lambda"));
25
-
26
- var _handler = require("@webiny/handler");
27
-
28
- var _plugins = require("../plugins");
29
-
30
- var _types = require("../types");
31
-
1
+ import awsLambdaFastify from "@fastify/aws-lambda";
2
+ import { createHandler as createBaseHandler, createRoute, RoutePlugin } from "@webiny/handler";
3
+ import { registerDefaultPlugins } from "../plugins/index.js";
4
+ import { Base64EncodeHeader } from "../types.js";
5
+ export { RoutePlugin, createRoute };
32
6
  const getHeader = (headers, header) => {
33
7
  for (const key in headers) {
34
8
  if (key.toLowerCase() !== header) {
35
9
  continue;
36
10
  }
37
-
38
11
  return headers[key];
39
12
  }
40
-
41
13
  return undefined;
42
14
  };
43
-
44
15
  const defaultContentType = "application/json";
45
16
  const defaultCharset = "utf-8";
46
17
  /**
47
18
  * We need to attach default headers to the request, so it does not break if there is none sent.
48
19
  */
49
-
50
20
  const attachRequiredProperties = event => {
21
+ const isOptions = event.httpMethod.toLowerCase() === "options";
51
22
  /**
52
23
  * A possibility that headers are not defined?
53
24
  * Maybe during testing?
@@ -55,52 +26,51 @@ const attachRequiredProperties = event => {
55
26
  if (!event.headers) {
56
27
  event.headers = {};
57
28
  }
58
-
59
29
  const contentType = getHeader(event.headers, "content-type");
60
30
  /**
61
31
  * We check the existing content type and add the default one if it does not exist.
62
32
  *
63
33
  * Also, if the content-type is the application/json, and the body is not sent, we add it.
64
34
  */
65
-
66
35
  if (!contentType) {
67
36
  event.headers["content-type"] = [defaultContentType, `charset=${defaultCharset}`].join(";");
68
37
  event.body = "{}";
69
38
  } else if (!event.body && contentType.startsWith(defaultContentType)) {
70
39
  event.body = "{}";
71
40
  }
41
+ if (!isOptions) {
42
+ return;
43
+ }
44
+ event.body = null;
72
45
  };
73
-
74
- const createHandler = params => {
75
- return (event, context) => {
76
- var _params$http;
77
-
78
- const app = (0, _handler.createHandler)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
79
- options: (0, _objectSpread2.default)({
80
- logger: ((_params$http = params.http) === null || _params$http === void 0 ? void 0 : _params$http.debug) === true
81
- }, params.options || {})
82
- }));
46
+ export const createHandler = params => {
47
+ return async (event, context) => {
48
+ const app = createBaseHandler({
49
+ ...params,
50
+ options: {
51
+ logger: params.debug === true,
52
+ ...(params.options || {})
53
+ }
54
+ });
83
55
  /**
84
56
  * We always must add our default plugins to the app.
85
57
  */
86
-
87
- (0, _plugins.registerDefaultPlugins)(app.webiny);
88
-
89
- if (app.webiny.plugins.byType(_handler.RoutePlugin.type).length === 0) {
58
+ registerDefaultPlugins(app.webiny);
59
+ if (app.webiny.plugins.byType(RoutePlugin.type).length === 0) {
90
60
  throw new Error(`To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`);
91
61
  }
92
-
93
62
  attachRequiredProperties(event);
94
- const appLambda = (0, _awsLambda.default)(app, (0, _objectSpread2.default)({
63
+ const appLambda = awsLambdaFastify(app, {
95
64
  decorateRequest: true,
96
65
  serializeLambdaArguments: true,
97
66
  decorationPropertyName: "awsLambda",
98
67
  enforceBase64: response => {
99
- return !!response.headers[_types.Base64EncodeHeader.encoded] || !!response.headers[_types.Base64EncodeHeader.binary];
100
- }
101
- }, params.lambdaOptions || {}));
68
+ return !!response.headers[Base64EncodeHeader.encoded] || !!response.headers[Base64EncodeHeader.binary];
69
+ },
70
+ ...(params.lambdaOptions || {})
71
+ });
102
72
  return appLambda(event, context);
103
73
  };
104
74
  };
105
75
 
106
- exports.createHandler = createHandler;
76
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getHeader","headers","header","key","toLowerCase","undefined","defaultContentType","defaultCharset","attachRequiredProperties","event","contentType","join","body","startsWith","createHandler","params","context","app","createBaseHandler","options","logger","http","debug","registerDefaultPlugins","webiny","plugins","byType","RoutePlugin","type","length","Error","appLambda","awsLambdaFastify","decorateRequest","serializeLambdaArguments","decorationPropertyName","enforceBase64","response","Base64EncodeHeader","encoded","binary","lambdaOptions"],"sources":["index.ts"],"sourcesContent":["import awsLambdaFastify, {\n LambdaFastifyOptions as LambdaOptions,\n LambdaResponse\n} from \"@fastify/aws-lambda\";\nimport { APIGatewayEvent, Context as LambdaContext } from \"aws-lambda\";\nimport {\n createHandler as createBaseHandler,\n CreateHandlerParams as BaseCreateHandlerParams,\n RoutePlugin,\n createRoute\n} from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins\";\nimport { Base64EncodeHeader } from \"~/types\";\nimport { APIGatewayProxyEventHeaders } from \"aws-lambda/trigger/api-gateway-proxy\";\n\nexport interface HandlerCallable {\n (event: APIGatewayEvent, ctx: LambdaContext): Promise<LambdaResponse>;\n}\n\nexport interface CreateHandlerParams extends BaseCreateHandlerParams {\n http?: {\n debug?: boolean;\n };\n lambdaOptions?: LambdaOptions;\n}\n\nconst getHeader = (headers: APIGatewayProxyEventHeaders, header: string): string | undefined => {\n for (const key in headers) {\n if (key.toLowerCase() !== header) {\n continue;\n }\n return headers[key];\n }\n return undefined;\n};\n\nconst defaultContentType = \"application/json\";\nconst defaultCharset = \"utf-8\";\n/**\n * We need to attach default headers to the request, so it does not break if there is none sent.\n */\nconst attachRequiredProperties = (event: APIGatewayEvent): void => {\n /**\n * A possibility that headers are not defined?\n * Maybe during testing?\n */\n if (!event.headers) {\n event.headers = {};\n }\n const contentType = getHeader(event.headers, \"content-type\");\n /**\n * We check the existing content type and add the default one if it does not exist.\n *\n * Also, if the content-type is the application/json, and the body is not sent, we add it.\n */\n if (!contentType) {\n event.headers[\"content-type\"] = [defaultContentType, `charset=${defaultCharset}`].join(\";\");\n event.body = \"{}\";\n } else if (!event.body && contentType.startsWith(defaultContentType)) {\n event.body = \"{}\";\n }\n};\n\nexport const createHandler = (params: CreateHandlerParams): HandlerCallable => {\n return (event, context) => {\n const app = createBaseHandler({\n ...params,\n options: {\n logger: params.http?.debug === true,\n ...(params.options || {})\n }\n });\n /**\n * We always must add our default plugins to the app.\n */\n registerDefaultPlugins(app.webiny);\n\n if (app.webiny.plugins.byType<RoutePlugin>(RoutePlugin.type).length === 0) {\n throw new Error(\n `To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`\n );\n }\n attachRequiredProperties(event);\n\n const appLambda = awsLambdaFastify(app, {\n decorateRequest: true,\n serializeLambdaArguments: true,\n decorationPropertyName: \"awsLambda\",\n enforceBase64: response => {\n return (\n !!response.headers[Base64EncodeHeader.encoded] ||\n !!response.headers[Base64EncodeHeader.binary]\n );\n },\n ...(params.lambdaOptions || {})\n });\n return appLambda(event, context);\n };\n};\n\nexport { RoutePlugin, createRoute };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AAMA;;AACA;;AAcA,MAAMA,SAAS,GAAG,CAACC,OAAD,EAAuCC,MAAvC,KAA8E;EAC5F,KAAK,MAAMC,GAAX,IAAkBF,OAAlB,EAA2B;IACvB,IAAIE,GAAG,CAACC,WAAJ,OAAsBF,MAA1B,EAAkC;MAC9B;IACH;;IACD,OAAOD,OAAO,CAACE,GAAD,CAAd;EACH;;EACD,OAAOE,SAAP;AACH,CARD;;AAUA,MAAMC,kBAAkB,GAAG,kBAA3B;AACA,MAAMC,cAAc,GAAG,OAAvB;AACA;AACA;AACA;;AACA,MAAMC,wBAAwB,GAAIC,KAAD,IAAkC;EAC/D;AACJ;AACA;AACA;EACI,IAAI,CAACA,KAAK,CAACR,OAAX,EAAoB;IAChBQ,KAAK,CAACR,OAAN,GAAgB,EAAhB;EACH;;EACD,MAAMS,WAAW,GAAGV,SAAS,CAACS,KAAK,CAACR,OAAP,EAAgB,cAAhB,CAA7B;EACA;AACJ;AACA;AACA;AACA;;EACI,IAAI,CAACS,WAAL,EAAkB;IACdD,KAAK,CAACR,OAAN,CAAc,cAAd,IAAgC,CAACK,kBAAD,EAAsB,WAAUC,cAAe,EAA/C,EAAkDI,IAAlD,CAAuD,GAAvD,CAAhC;IACAF,KAAK,CAACG,IAAN,GAAa,IAAb;EACH,CAHD,MAGO,IAAI,CAACH,KAAK,CAACG,IAAP,IAAeF,WAAW,CAACG,UAAZ,CAAuBP,kBAAvB,CAAnB,EAA+D;IAClEG,KAAK,CAACG,IAAN,GAAa,IAAb;EACH;AACJ,CApBD;;AAsBO,MAAME,aAAa,GAAIC,MAAD,IAAkD;EAC3E,OAAO,CAACN,KAAD,EAAQO,OAAR,KAAoB;IAAA;;IACvB,MAAMC,GAAG,GAAG,IAAAC,sBAAA,8DACLH,MADK;MAERI,OAAO;QACHC,MAAM,EAAE,iBAAAL,MAAM,CAACM,IAAP,8DAAaC,KAAb,MAAuB;MAD5B,GAECP,MAAM,CAACI,OAAP,IAAkB,EAFnB;IAFC,GAAZ;IAOA;AACR;AACA;;IACQ,IAAAI,+BAAA,EAAuBN,GAAG,CAACO,MAA3B;;IAEA,IAAIP,GAAG,CAACO,MAAJ,CAAWC,OAAX,CAAmBC,MAAnB,CAAuCC,oBAAA,CAAYC,IAAnD,EAAyDC,MAAzD,KAAoE,CAAxE,EAA2E;MACvE,MAAM,IAAIC,KAAJ,CACD,iFADC,CAAN;IAGH;;IACDtB,wBAAwB,CAACC,KAAD,CAAxB;IAEA,MAAMsB,SAAS,GAAG,IAAAC,kBAAA,EAAiBf,GAAjB;MACdgB,eAAe,EAAE,IADH;MAEdC,wBAAwB,EAAE,IAFZ;MAGdC,sBAAsB,EAAE,WAHV;MAIdC,aAAa,EAAEC,QAAQ,IAAI;QACvB,OACI,CAAC,CAACA,QAAQ,CAACpC,OAAT,CAAiBqC,yBAAA,CAAmBC,OAApC,CAAF,IACA,CAAC,CAACF,QAAQ,CAACpC,OAAT,CAAiBqC,yBAAA,CAAmBE,MAApC,CAFN;MAIH;IATa,GAUVzB,MAAM,CAAC0B,aAAP,IAAwB,EAVd,EAAlB;IAYA,OAAOV,SAAS,CAACtB,KAAD,EAAQO,OAAR,CAAhB;EACH,CAjCD;AAkCH,CAnCM"}
1
+ {"version":3,"names":["awsLambdaFastify","createHandler","createBaseHandler","createRoute","RoutePlugin","registerDefaultPlugins","Base64EncodeHeader","getHeader","headers","header","key","toLowerCase","undefined","defaultContentType","defaultCharset","attachRequiredProperties","event","isOptions","httpMethod","contentType","join","body","startsWith","params","context","app","options","logger","debug","webiny","plugins","byType","type","length","Error","appLambda","decorateRequest","serializeLambdaArguments","decorationPropertyName","enforceBase64","response","encoded","binary","lambdaOptions"],"sources":["index.ts"],"sourcesContent":["import type {\n APIGatewayEvent,\n APIGatewayProxyEventHeaders,\n Context as LambdaContext\n} from \"@webiny/aws-sdk/types/index.js\";\nimport type { LambdaResponse } from \"@fastify/aws-lambda\";\nimport awsLambdaFastify from \"@fastify/aws-lambda\";\nimport { createHandler as createBaseHandler, createRoute, RoutePlugin } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins/index.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\nimport { Base64EncodeHeader } from \"~/types.js\";\n\nexport { RoutePlugin, createRoute };\n\nexport type HandlerParams = HandlerFactoryParams;\n\nexport interface HandlerCallable {\n (event: APIGatewayEvent, ctx: LambdaContext): Promise<LambdaResponse>;\n}\n\nconst getHeader = (headers: APIGatewayProxyEventHeaders, header: string): string | undefined => {\n for (const key in headers) {\n if (key.toLowerCase() !== header) {\n continue;\n }\n return headers[key];\n }\n return undefined;\n};\n\nconst defaultContentType = \"application/json\";\nconst defaultCharset = \"utf-8\";\n/**\n * We need to attach default headers to the request, so it does not break if there is none sent.\n */\nconst attachRequiredProperties = (event: APIGatewayEvent): void => {\n const isOptions = event.httpMethod.toLowerCase() === \"options\";\n /**\n * A possibility that headers are not defined?\n * Maybe during testing?\n */\n if (!event.headers) {\n event.headers = {};\n }\n const contentType = getHeader(event.headers, \"content-type\");\n /**\n * We check the existing content type and add the default one if it does not exist.\n *\n * Also, if the content-type is the application/json, and the body is not sent, we add it.\n */\n if (!contentType) {\n event.headers[\"content-type\"] = [defaultContentType, `charset=${defaultCharset}`].join(\";\");\n event.body = \"{}\";\n } else if (!event.body && contentType.startsWith(defaultContentType)) {\n event.body = \"{}\";\n }\n if (!isOptions) {\n return;\n }\n event.body = null;\n};\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 * We always must add our default plugins to the app.\n */\n registerDefaultPlugins(app.webiny);\n\n if (app.webiny.plugins.byType<RoutePlugin>(RoutePlugin.type).length === 0) {\n throw new Error(\n `To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`\n );\n }\n attachRequiredProperties(event);\n\n const appLambda = awsLambdaFastify(app, {\n decorateRequest: true,\n serializeLambdaArguments: true,\n decorationPropertyName: \"awsLambda\",\n enforceBase64: response => {\n return (\n !!response.headers[Base64EncodeHeader.encoded] ||\n !!response.headers[Base64EncodeHeader.binary]\n );\n },\n ...(params.lambdaOptions || {})\n });\n return appLambda(event, context);\n };\n};\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { registry } from "../registry.js";
2
+ import { createSourceHandler } from "../sourceHandler.js";
3
+ import { createHandler } from "./index.js";
4
+ const handler = createSourceHandler({
5
+ name: "handler-aws-api-gateway",
6
+ canUse: event => {
7
+ return !!event.httpMethod;
8
+ },
9
+ handle: async ({
10
+ params,
11
+ event,
12
+ context
13
+ }) => {
14
+ return createHandler(params)(event, context);
15
+ }
16
+ });
17
+ registry.register(handler);
18
+
19
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["registry","createSourceHandler","createHandler","handler","name","canUse","event","httpMethod","handle","params","context","register"],"sources":["register.ts"],"sourcesContent":["import type { APIGatewayEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { registry } from \"~/registry.js\";\nimport { createSourceHandler } from \"~/sourceHandler.js\";\nimport type { HandlerParams } from \"./index.js\";\nimport { createHandler } from \"./index.js\";\n\nconst handler = createSourceHandler<APIGatewayEvent, HandlerParams>({\n name: \"handler-aws-api-gateway\",\n canUse: event => {\n return !!event.httpMethod;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"mappings":"AACA,SAASA,QAAQ;AACjB,SAASC,mBAAmB;AAE5B,SAASC,aAAa;AAEtB,MAAMC,OAAO,GAAGF,mBAAmB,CAAiC;EAChEG,IAAI,EAAE,yBAAyB;EAC/BC,MAAM,EAAEC,KAAK,IAAI;IACb,OAAO,CAAC,CAACA,KAAK,CAACC,UAAU;EAC7B,CAAC;EACDC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAEH,KAAK;IAAEI;EAAQ,CAAC,KAAK;IAC1C,OAAOR,aAAa,CAACO,MAAM,CAAC,CAACH,KAAK,EAAEI,OAAO,CAAC;EAChD;AACJ,CAAC,CAAC;AAEFV,QAAQ,CAACW,QAAQ,CAACR,OAAO,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,6 +1,35 @@
1
- export { createHandler as createApiGatewayHandler, CreateHandlerParams as CreateApiGatewayHandlerParams, RoutePlugin, createRoute as createApiGatewayRoute } from "./gateway";
2
- export { createHandler as createS3Handler, CreateHandlerParams as CreateS3HandlerParams, S3EventHandler, S3EventHandlerCallable, S3EventHandlerCallableParams, createEventHandler as createS3EventHandler } from "./s3";
3
- export { createHandler as createDynamoDBHandler, CreateHandlerParams as CreateDynamoDBHandlerParams, DynamoDBEventHandler, DynamoDBEventHandlerCallable, DynamoDBEventHandlerCallableParams, createEventHandler as createDynamoDBEventHandler, HandlerCallable as DynamoDBHandlerCallable } from "./dynamodb";
4
- export { createHandler as createSQSHandler, CreateHandlerParams as CreateSQSHandlerParams, SQSEventHandler, SQSEventHandlerCallable, SQSEventHandlerCallableParams, createEventHandler as createSQSEventHandler, HandlerCallable as SQSHandlerCallable } from "./sqs";
5
- export { createHandler as createEventBridgeHandler, CreateHandlerParams as CreateEventBridgeHandlerParams, EventBridgeEventHandler, EventBridgeEventHandlerCallable, EventBridgeEventHandlerCallableParams, createEventHandler as createEventBridgeEventHandler, HandlerCallable as EventBridgeHandlerCallable } from "./eventBridge";
6
- export { createHandler as createRawHandler, CreateHandlerParams as CreateRawHandlerParams, HandlerCallable as RawHandlerCallable, createEventHandler as createRawEventHandler, RawEventHandlerCallableParams, RawEventHandlerCallable, RawEventHandler } from "./raw";
1
+ import "./gateway/register.js";
2
+ import "./s3/register.js";
3
+ import "./dynamodb/register.js";
4
+ import "./sqs/register.js";
5
+ import "./eventBridge/register.js";
6
+ import "./sns/register.js";
7
+ export * from "./utils/index.js";
8
+ /**
9
+ * API Gateway
10
+ */
11
+ export { createHandler as createApiGatewayHandler, type HandlerParams as CreateApiGatewayHandlerParams, type HandlerCallable as ApiGatewayHandlerCallable, RoutePlugin, createRoute as createApiGatewayRoute } from "./gateway/index.js";
12
+ /**
13
+ * S3
14
+ */
15
+ export { createHandler as createS3Handler, type HandlerParams as CreateS3HandlerParams, S3EventHandler, type S3EventHandlerCallable, type S3EventHandlerCallableParams, createEventHandler as createS3EventHandler } from "./s3/index.js";
16
+ /**
17
+ * DynamoDB Stream
18
+ */
19
+ export { createHandler as createDynamoDBHandler, type HandlerParams as CreateDynamoDBHandlerParams, DynamoDBEventHandler, type DynamoDBEventHandlerCallable, type DynamoDBEventHandlerCallableParams, createEventHandler as createDynamoDBEventHandler } from "./dynamodb/index.js";
20
+ /**
21
+ * SQS
22
+ */
23
+ export { createHandler as createSQSHandler, type HandlerParams as CreateSQSHandlerParams, SQSEventHandler, type SQSEventHandlerCallable, type SQSEventHandlerCallableParams, createEventHandler as createSQSEventHandler } from "./sqs/index.js";
24
+ /**
25
+ * SNS
26
+ */
27
+ export { createHandler as createSNSHandler, type HandlerParams as CreateSNSHandlerParams, SNSEventHandler, type SNSEventHandlerCallable, type SNSEventHandlerCallableParams, createEventHandler as createSNSEventHandler } from "./sns/index.js";
28
+ /**
29
+ * EventBridge
30
+ */
31
+ export { createHandler as createEventBridgeHandler, type HandlerParams as CreateEventBridgeHandlerParams, EventBridgeEventHandler, type EventBridgeEventHandlerCallable, type EventBridgeEventHandlerCallableParams, createEventHandler as createEventBridgeEventHandler } from "./eventBridge/index.js";
32
+ export { createHandler as createRawHandler, type CreateHandlerParams as CreateRawHandlerParams, type HandlerCallable as RawHandlerCallable, createEventHandler as createRawEventHandler, type RawEventHandlerCallableParams, type RawEventHandlerCallable, RawEventHandler } from "./raw/index.js";
33
+ export { ContextPlugin, createContextPlugin, type ContextPluginCallable } from "@webiny/handler";
34
+ export * from "./createHandler.js";
35
+ export * from "./sourceHandler.js";