@h4ad/serverless-adapter 2.4.0 → 2.5.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/README.md CHANGED
@@ -19,8 +19,8 @@
19
19
  [![Commitizen Friendly][commitizen-img]][commitizen-url]
20
20
  [![Semantic Release][semantic-release-img]][semantic-release-url]
21
21
 
22
- Run REST APIs and other web applications using your existing Node.js application framework (Express, Koa, Hapi and
23
- Fastify), on top of AWS Lambda, Huawei and many other clouds.
22
+ Run REST APIs and other web applications using your existing Node.js application framework (Express, Koa, Hapi,
23
+ Fastify and tRPC), on top of AWS Lambda, Azure, Huawei and many other clouds.
24
24
 
25
25
  This library was a refactored version of [@vendia/serverless-express](https://github.com/vendia/serverless-express), I
26
26
  create a new way to interact and extend event sources by creating contracts to abstract the integrations between each
@@ -38,6 +38,41 @@ Why you would use this libray instead of [@vendia/serverless-express](https://gi
38
38
  - Well documented, any method, class, or interface has comments to explain the behavior.
39
39
  - We have >99% coverage.
40
40
 
41
+ # Usage
42
+
43
+ To start to use, first you need to know what you need to import, let's start showing the [ServerlessAdapter](/docs/api/ServerlessAdapter).
44
+
45
+ ```tsx
46
+ import { ServerlessAdapter } from '@h4ad/serverless-adapter';
47
+ ```
48
+
49
+ We need to pass to [Serverless Adapter](/docs/api/ServerlessAdapter) the instance of your api, let's look an example with:
50
+
51
+ - Framework: [Express](../frameworks/express).
52
+ - Adapters: [AWS Api Gateway V2 Adapter](../adapters/aws/api-gateway-v2).
53
+ - Handler: [Default Handler](../handlers/default).
54
+ - Resolver: [Promise Resolver](../resolvers/promise).
55
+
56
+ ```ts
57
+ import { ServerlessAdapter } from '@h4ad/serverless-adapter';
58
+ import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
59
+ import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default';
60
+ import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise';
61
+ import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws';
62
+
63
+ const express = require('express');
64
+
65
+ const app = express();
66
+ export const handler = ServerlessAdapter.new(app)
67
+ .setFramework(new ExpressFramework())
68
+ .setHandler(new DefaultHandler())
69
+ .setResolver(new PromiseResolver())
70
+ .addAdapter(new ApiGatewayV2Adapter())
71
+ // if you need more adapters
72
+ // just append more `addAdapter` calls
73
+ .build();
74
+ ```
75
+
41
76
  # Documentation
42
77
 
43
78
  See how to use this library [here](https://viniciusl.com.br/serverless-adapter/docs/category/getting-started).
@@ -0,0 +1,81 @@
1
+ import type { Context, Cookie, HttpRequest, HttpResponseSimple } from '@azure/functions';
2
+ import { BothValueHeaders } from '../../@types';
3
+ import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../contracts';
4
+ /**
5
+ * The options to customize the {@link HttpTriggerV4Adapter}
6
+ *
7
+ * @breadcrumb Adapters / Azure / HttpTriggerV4Adapter
8
+ * @public
9
+ */
10
+ export interface HttpTriggerV4AdapterOptions {
11
+ /**
12
+ * Strip base path for custom domains
13
+ *
14
+ * @defaultValue ''
15
+ */
16
+ stripBasePath?: string;
17
+ }
18
+ /**
19
+ * The adapter to handle requests from Http Trigger on Azure Function V4.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const stripBasePath = '/any/custom/base/path'; // default ''
24
+ * const adapter = new HttpTriggerV4Adapter({ stripBasePath });
25
+ * ```
26
+ *
27
+ * @see {@link https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node | Reference}
28
+ *
29
+ * @breadcrumb Adapters / Azure / HttpTriggerV4Adapter
30
+ * @public
31
+ */
32
+ export declare class HttpTriggerV4Adapter implements AdapterContract<HttpRequest, Context, HttpResponseSimple> {
33
+ protected readonly options?: HttpTriggerV4AdapterOptions | undefined;
34
+ /**
35
+ * Default constructor
36
+ *
37
+ * @param options - The options to customize the {@link HttpTriggerV4Adapter}
38
+ */
39
+ constructor(options?: HttpTriggerV4AdapterOptions | undefined);
40
+ /**
41
+ * {@inheritDoc}
42
+ */
43
+ getAdapterName(): string;
44
+ /**
45
+ * {@inheritDoc}
46
+ */
47
+ canHandle(event: unknown, context: unknown): boolean;
48
+ /**
49
+ * {@inheritDoc}
50
+ */
51
+ getRequest(event: HttpRequest): AdapterRequest;
52
+ /**
53
+ * {@inheritDoc}
54
+ */
55
+ getResponse({ body, isBase64Encoded, statusCode, headers: originalHeaders, }: GetResponseAdapterProps<HttpRequest>): HttpResponseSimple;
56
+ /**
57
+ * {@inheritDoc}
58
+ */
59
+ onErrorWhileForwarding({ error, respondWithErrors, event, delegatedResolver, log, }: OnErrorProps<HttpRequest, HttpResponseSimple>): void;
60
+ /**
61
+ * Get path from event with query strings
62
+ *
63
+ * @param event - The event sent by serverless
64
+ */
65
+ protected getPathFromEvent(event: HttpRequest): string;
66
+ /**
67
+ * Get the Azure Cookie list parsed from set-cookie header.
68
+ *
69
+ * @param headers - The headers object
70
+ */
71
+ protected getAzureCookiesFromHeaders(headers: BothValueHeaders): Cookie[];
72
+ /**
73
+ * Parse the string cookie to the Azure Cookie Object.
74
+ * This code was written by {@link https://github.com/zachabney | @zachabney}
75
+ * on {@link https://github.com/zachabney/azure-aws-serverless-express/blob/241d2d5c4d5906e4817662cad6426ec2cbbf9ca7/src/index.js#L4-L49 | this library}.
76
+ *
77
+ * @param cookie - The cookie
78
+ */
79
+ protected parseCookie(cookie: string): Cookie;
80
+ }
81
+ //# sourceMappingURL=http-trigger-v4.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-trigger-v4.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/azure/http-trigger-v4.adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,WAAW,EACX,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAUzB;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBACX,YAAW,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,kBAAkB,CAAC;IASxD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IALvC;;;;OAIG;gBAC4B,OAAO,CAAC,yCAA6B;IAMpE;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAmB3D;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc;IA6BrD;;OAEG;IACI,WAAW,CAAC,EACjB,IAAI,EACJ,eAAe,EACf,UAAU,EACV,OAAO,EAAE,eAAe,GACzB,EAAE,uBAAuB,CAAC,WAAW,CAAC,GAAG,kBAAkB;IAoB5D;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EACjB,GAAG,GACJ,EAAE,YAAY,CAAC,WAAW,EAAE,kBAAkB,CAAC,GAAG,IAAI;IAkBvD;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAiBtD;;;;OAIG;IACH,SAAS,CAAC,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,EAAE;IAYzE;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CA8C9C"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ //#region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HttpTriggerV4Adapter = void 0;
5
+ const url_1 = require("url");
6
+ const core_1 = require("../../core");
7
+ /**
8
+ * The adapter to handle requests from Http Trigger on Azure Function V4.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const stripBasePath = '/any/custom/base/path'; // default ''
13
+ * const adapter = new HttpTriggerV4Adapter({ stripBasePath });
14
+ * ```
15
+ *
16
+ * @see {@link https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node | Reference}
17
+ *
18
+ * @breadcrumb Adapters / Azure / HttpTriggerV4Adapter
19
+ * @public
20
+ */
21
+ class HttpTriggerV4Adapter {
22
+ //#region Constructor
23
+ /**
24
+ * Default constructor
25
+ *
26
+ * @param options - The options to customize the {@link HttpTriggerV4Adapter}
27
+ */
28
+ constructor(options) {
29
+ this.options = options;
30
+ }
31
+ //#endregion
32
+ //#region Public Methods
33
+ /**
34
+ * {@inheritDoc}
35
+ */
36
+ getAdapterName() {
37
+ return HttpTriggerV4Adapter.name;
38
+ }
39
+ /**
40
+ * {@inheritDoc}
41
+ */
42
+ canHandle(event, context) {
43
+ const maybeEvent = event;
44
+ const maybeContext = context;
45
+ return !!(maybeEvent &&
46
+ maybeEvent.method &&
47
+ maybeEvent.headers &&
48
+ maybeEvent.url &&
49
+ maybeEvent.query &&
50
+ maybeContext &&
51
+ maybeContext.traceContext &&
52
+ maybeContext.bindingDefinitions &&
53
+ maybeContext.log &&
54
+ maybeContext.log.info &&
55
+ maybeContext.bindingData);
56
+ }
57
+ /**
58
+ * {@inheritDoc}
59
+ */
60
+ getRequest(event) {
61
+ const path = this.getPathFromEvent(event);
62
+ const method = event.method;
63
+ const headers = (0, core_1.getFlattenedHeadersMap)(event.headers, ',', true);
64
+ let body;
65
+ if (event.body) {
66
+ const [bufferBody, contentLength] = (0, core_1.getEventBodyAsBuffer)(event.rawBody, false);
67
+ body = bufferBody;
68
+ headers['content-length'] = String(contentLength);
69
+ }
70
+ const remoteAddress = headers['x-forwarded-for'];
71
+ return {
72
+ method: method,
73
+ path,
74
+ headers,
75
+ remoteAddress,
76
+ body,
77
+ };
78
+ }
79
+ /**
80
+ * {@inheritDoc}
81
+ */
82
+ getResponse({ body, isBase64Encoded, statusCode, headers: originalHeaders, }) {
83
+ const headers = (0, core_1.getFlattenedHeadersMap)(originalHeaders, ',', true);
84
+ const cookies = this.getAzureCookiesFromHeaders(originalHeaders);
85
+ if (headers['set-cookie'])
86
+ delete headers['set-cookie'];
87
+ return {
88
+ body,
89
+ statusCode,
90
+ headers,
91
+ // I tried to understand this property with
92
+ // https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/content-negotiation
93
+ // but I don't know if it's worth implementing this guy as an option
94
+ // I found out when this guy is set to true and the framework sets content-type, azure returns 500
95
+ // So I'll leave it as is and hope no one has any problems.
96
+ enableContentNegotiation: false,
97
+ cookies,
98
+ };
99
+ }
100
+ /**
101
+ * {@inheritDoc}
102
+ */
103
+ onErrorWhileForwarding({ error, respondWithErrors, event, delegatedResolver, log, }) {
104
+ const body = respondWithErrors ? error.stack : '';
105
+ const errorResponse = this.getResponse({
106
+ event,
107
+ statusCode: 500,
108
+ body: body || '',
109
+ headers: {},
110
+ isBase64Encoded: false,
111
+ log,
112
+ });
113
+ delegatedResolver.succeed(errorResponse);
114
+ }
115
+ //#endregion
116
+ //#region Protected Methods
117
+ /**
118
+ * Get path from event with query strings
119
+ *
120
+ * @param event - The event sent by serverless
121
+ */
122
+ getPathFromEvent(event) {
123
+ var _a;
124
+ const stripBasePath = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.stripBasePath, '');
125
+ const url = new url_1.URL(event.url);
126
+ const originalPath = url.pathname;
127
+ const replaceRegex = new RegExp(`^${stripBasePath}`);
128
+ const path = originalPath.replace(replaceRegex, '');
129
+ const queryParams = event.query;
130
+ return (0, core_1.getPathWithQueryStringParams)(path, queryParams);
131
+ }
132
+ /**
133
+ * Get the Azure Cookie list parsed from set-cookie header.
134
+ *
135
+ * @param headers - The headers object
136
+ */
137
+ getAzureCookiesFromHeaders(headers) {
138
+ const setCookie = headers['set-cookie'];
139
+ const headerCookies = Array.isArray(setCookie)
140
+ ? setCookie
141
+ : setCookie
142
+ ? [setCookie]
143
+ : [];
144
+ return headerCookies.map(cookie => this.parseCookie(cookie));
145
+ }
146
+ /**
147
+ * Parse the string cookie to the Azure Cookie Object.
148
+ * This code was written by {@link https://github.com/zachabney | @zachabney}
149
+ * on {@link https://github.com/zachabney/azure-aws-serverless-express/blob/241d2d5c4d5906e4817662cad6426ec2cbbf9ca7/src/index.js#L4-L49 | this library}.
150
+ *
151
+ * @param cookie - The cookie
152
+ */
153
+ parseCookie(cookie) {
154
+ return cookie.split(';').reduce((azureCookieObject, cookieProperty, index) => {
155
+ const [key, value] = cookieProperty.split('=');
156
+ const sanitizedKey = key.toLowerCase().trim();
157
+ const sanitizedValue = value && value.trim();
158
+ if (index === 0) {
159
+ azureCookieObject.name = sanitizedKey;
160
+ azureCookieObject.value = sanitizedValue;
161
+ return azureCookieObject;
162
+ }
163
+ switch (sanitizedKey) {
164
+ case 'domain':
165
+ azureCookieObject.domain = sanitizedValue;
166
+ break;
167
+ case 'path':
168
+ azureCookieObject.path = sanitizedValue;
169
+ break;
170
+ case 'expires':
171
+ azureCookieObject.expires = new Date(sanitizedValue);
172
+ break;
173
+ case 'secure':
174
+ azureCookieObject.secure = true;
175
+ break;
176
+ case 'httponly':
177
+ azureCookieObject.httpOnly = true;
178
+ break;
179
+ case 'samesite':
180
+ azureCookieObject.sameSite = sanitizedValue;
181
+ break;
182
+ case 'max-age':
183
+ azureCookieObject.maxAge = Number(sanitizedValue);
184
+ break;
185
+ }
186
+ return azureCookieObject;
187
+ }, { name: '', value: '' });
188
+ }
189
+ }
190
+ exports.HttpTriggerV4Adapter = HttpTriggerV4Adapter;
191
+ //# sourceMappingURL=http-trigger-v4.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-trigger-v4.adapter.js","sourceRoot":"","sources":["../../../src/adapters/azure/http-trigger-v4.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAEjB,6BA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,EAAE,CAAC;YAE7C,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,iBAAiB,CAAC,IAAI,GAAG,YAAY,CAAC;gBACtC,iBAAiB,CAAC,KAAK,GAAG,cAAc,CAAC;gBAEzC,OAAO,iBAAiB,CAAC;aAC1B;YAED,QAAQ,YAAY,EAAE;gBACpB,KAAK,QAAQ;oBACX,iBAAiB,CAAC,MAAM,GAAG,cAAc,CAAC;oBAC1C,MAAM;gBACR,KAAK,MAAM;oBACT,iBAAiB,CAAC,IAAI,GAAG,cAAc,CAAC;oBACxC,MAAM;gBACR,KAAK,SAAS;oBACZ,iBAAiB,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;oBACrD,MAAM;gBACR,KAAK,QAAQ;oBACX,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;oBAChC,MAAM;gBACR,KAAK,UAAU;oBACb,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;oBAClC,MAAM;gBACR,KAAK,UAAU;oBACb,iBAAiB,CAAC,QAAQ,GAAG,cAAoC,CAAC;oBAClE,MAAM;gBACR,KAAK,SAAS;oBACZ,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;oBAClD,MAAM;aACT;YAED,OAAO,iBAAiB,CAAC;QAC3B,CAAC,EACD,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAY,CAClC,CAAC;IACJ,CAAC;CAGF;AAhOD,oDAgOC"}
@@ -0,0 +1,2 @@
1
+ export * from './http-trigger-v4.adapter';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/azure/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./http-trigger-v4.adapter"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/azure/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C"}
@@ -52,4 +52,13 @@ export declare type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;
52
52
  * @public
53
53
  */
54
54
  export declare function createDefaultLogger({ level }?: LoggerOptions): ILogger;
55
+ /**
56
+ * The method used to chck if logger was created by this library, or it was defined by the user.
57
+ *
58
+ * @param logger - The instance of the logger to check
59
+ *
60
+ * @breadcrumb Core / Logger
61
+ * @public
62
+ */
63
+ export declare function isInternalLogger(logger: ILogger): boolean;
55
64
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,SAAS,GACjB,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEX;;;;;GAKG;AACH,oBAAY,aAAa,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,QAAQ,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEpE;;;;;GAKG;AACH,oBAAY,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,KAAK,EAAE,GAAE,aAAkC,GAC5C,OAAO,CAiCT"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,SAAS,GACjB,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEX;;;;;GAKG;AACH,oBAAY,aAAa,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,QAAQ,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEpE;;;;;GAKG;AACH,oBAAY,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAUnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,KAAK,EAAE,GAAE,aAAkC,GAC5C,OAAO,CAkCT;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEzD"}
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDefaultLogger = void 0;
3
+ exports.isInternalLogger = exports.createDefaultLogger = void 0;
4
+ /**
5
+ * The symbol used to check against an ILogger instace to verify if that ILogger was created by this library
6
+ *
7
+ * @breadcrumb Core / Logger
8
+ * @public
9
+ */
10
+ const InternalLoggerSymbol = Symbol('InternalLogger');
4
11
  /**
5
12
  * The method used to create a simple logger instance to use in this library.
6
13
  *
@@ -25,6 +32,7 @@ function createDefaultLogger({ level } = { level: 'error' }) {
25
32
  const infoLogLevel = ['debug', 'verbose', 'info'];
26
33
  const verboseLogLevel = ['debug', 'verbose'];
27
34
  return {
35
+ [InternalLoggerSymbol]: true,
28
36
  error: (message, ...additional) => {
29
37
  if (!errorLogLevel.includes(level))
30
38
  return;
@@ -53,4 +61,16 @@ function createDefaultLogger({ level } = { level: 'error' }) {
53
61
  };
54
62
  }
55
63
  exports.createDefaultLogger = createDefaultLogger;
64
+ /**
65
+ * The method used to chck if logger was created by this library, or it was defined by the user.
66
+ *
67
+ * @param logger - The instance of the logger to check
68
+ *
69
+ * @breadcrumb Core / Logger
70
+ * @public
71
+ */
72
+ function isInternalLogger(logger) {
73
+ return !!logger[InternalLoggerSymbol];
74
+ }
75
+ exports.isInternalLogger = isInternalLogger;
56
76
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;;AA6CA;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,mBAAmB,CACjC,EAAE,KAAK,KAAoB,EAAE,KAAK,EAAE,OAAO,EAAE;IAE7C,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO;QACL,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE;YAChC,IA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AO,EAAE,GAAG,UAAU,EAAE,EAAE;YAChC,IAAI,KAAK,KAAK,OAAO;gBAAE,OAAO;YAE9B,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;QACxC,CAAC;KACS,CAAC;AACf,CAAC;AApCD,kDAoCC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,MAAe;IAC9C,OAAO,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACxC,CAAC;AAFD,4CAEC"}
@@ -53,7 +53,14 @@ class TrpcFramework {
53
53
  */
54
54
  sendRequest(app, request, response) {
55
55
  const endpoint = this.getSafeUrlForTrpc(request);
56
- (0, node_http_1.nodeHTTPRequestHandler)(Object.assign(Object.assign({ req: request, res: response, path: endpoint, router: app }, this.options), { createContext: createContextOptions => this.mergeDefaultContextWithOptionsContext(createContextOptions) }));
56
+ (0, node_http_1.nodeHTTPRequestHandler)({
57
+ req: request,
58
+ res: response,
59
+ path: endpoint,
60
+ router: app,
61
+ ...this.options,
62
+ createContext: createContextOptions => this.mergeDefaultContextWithOptionsContext(createContextOptions),
63
+ });
57
64
  }
58
65
  //#endregion
59
66
  //#region Protected Methods
@@ -100,19 +107,30 @@ class TrpcFramework {
100
107
  wrapResolvedContextWithDefaultContext(resolvedContext, createContextOptions) {
101
108
  const request = createContextOptions.req;
102
109
  const response = createContextOptions.res;
103
- return Object.assign(Object.assign({}, resolvedContext), { request,
104
- response, getUrl: () => request.url, getMethod: () => request.method, getHeaders: () => (0, core_1.getFlattenedHeadersMap)(request.headers, ',', true), setHeader: (header, value) => {
110
+ return {
111
+ ...resolvedContext,
112
+ request,
113
+ response,
114
+ getUrl: () => request.url,
115
+ getMethod: () => request.method,
116
+ getHeaders: () => (0, core_1.getFlattenedHeadersMap)(request.headers, ',', true),
117
+ setHeader: (header, value) => {
105
118
  response.setHeader(header, value);
106
- }, removeHeader: header => {
119
+ },
120
+ removeHeader: header => {
107
121
  response.removeHeader(header);
108
- }, getHeader: (header) => {
122
+ },
123
+ getHeader: (header) => {
109
124
  return (0, core_1.getFlattenedHeadersMap)(request.headers, ',', true)[header.toLowerCase()];
110
- }, setStatus: (statusCode) => {
125
+ },
126
+ setStatus: (statusCode) => {
111
127
  response.statusCode = statusCode;
112
128
  // force undefined to get default message for the status code
113
129
  // ref: https://nodejs.org/dist/latest-v16.x/docs/api/http.html#responsestatusmessage
114
130
  response.statusMessage = undefined;
115
- }, getIp: () => request.connection.remoteAddress });
131
+ },
132
+ getIp: () => request.connection.remoteAddress,
133
+ };
116
134
  }
117
135
  }
118
136
  exports.TrpcFramework = TrpcFramework;
@@ -1 +1 @@
1
- {"version":3,"file":"trpc.framework.js","sourceRoot":"","sources":["../../../src/frameworks/trpc/trpc.framework.ts"],"names":[],"mappings":";AAAA,SAAS;;;AAIT,+DAKyC;AAGzC,qCAA2E;AAE3E,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,2BAA2B;IACtC;;;;OAIG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,KAAK,YAAY,MAAM;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAExE,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,KAAU;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AApBD,kEAoBC;AAuGD;;;;;GAKG;AACH,MAAa,aAAa;IAGxB,qBAAqB;IAErB;;OAEG;IACH,YAA+B,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;IAAG,CAAC;IAE3E,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,WAAW,CAChB,GAAwB,EACxB,OAAwB,EACxB,QAAwB;QAExB,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjD,IAAA,kCAAsB,gCACpB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAA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AE,CAAC,UAAkB,EAAE,EAAE;gBAChC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;gBACjC,6DAA6D;gBAC7D,qFAAqF;gBACrF,QAAQ,CAAC,aAAa,GAAG,SAAgB,CAAC;YAC5C,CAAC;YACD,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa;SAC9C,CAAC;IACJ,CAAC;CAGF;AAhJD,sCAgJC"}
@@ -0,0 +1,45 @@
1
+ import type { Context } from '@azure/functions';
2
+ import { BinarySettings } from '../../@types';
3
+ import { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
4
+ import { ILogger } from '../../core';
5
+ import { DefaultHandler } from '../default';
6
+ /**
7
+ * The options to customize {@link AzureHandler}
8
+ *
9
+ * @breadcrumb Handlers / AzureHandler
10
+ * @public
11
+ */
12
+ export interface AzureHandlerOptions {
13
+ /**
14
+ * Indicates to use the context log instead console.log when logger is internal (created by the library)
15
+ *
16
+ * @defaultValue true
17
+ */
18
+ useContextLogWhenInternalLogger: boolean;
19
+ }
20
+ /**
21
+ * The class that implements a serverless handler for Azure Function.
22
+ *
23
+ * When you don't specify a custom logger, the {@link Context} logger is used instead.
24
+ *
25
+ * @breadcrumb Handlers / AzureHandler
26
+ * @public
27
+ */
28
+ export declare class AzureHandler<TApp, TEvent, TCallback, TResponse, TReturn> extends DefaultHandler<TApp, TEvent, Context, TCallback, TResponse, TReturn> {
29
+ protected readonly options?: AzureHandlerOptions | undefined;
30
+ /**
31
+ * Default Constructor
32
+ */
33
+ constructor(options?: AzureHandlerOptions | undefined);
34
+ /**
35
+ * {@inheritDoc}
36
+ */
37
+ getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, Context, TResponse>[], resolverFactory: ResolverContract<TEvent, Context, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
38
+ /**
39
+ * Get the {@link ILogger} instance from logger of the context
40
+ *
41
+ * @param context - The Azure Context
42
+ */
43
+ protected createLoggerFromContext(context: Context): ILogger;
44
+ }
45
+ //# sourceMappingURL=azure.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/azure/azure.handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAA2C,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,+BAA+B,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;;;GAOG;AACH,qBAAa,YAAY,CACvB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,SAAS,EACT,OAAO,CACP,SAAQ,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;IAMhE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IAHvC;;OAEG;gBAC4B,OAAO,CAAC,iCAAqB;IAQ5D;;OAEG;IACI,UAAU,CACf,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EACvD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,OAAO,EACP,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC;IAkC7B;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CAW7D"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/unbound-method */
3
+ //#region Imports
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.AzureHandler = void 0;
6
+ const core_1 = require("../../core");
7
+ const default_1 = require("../default");
8
+ /**
9
+ * The class that implements a serverless handler for Azure Function.
10
+ *
11
+ * When you don't specify a custom logger, the {@link Context} logger is used instead.
12
+ *
13
+ * @breadcrumb Handlers / AzureHandler
14
+ * @public
15
+ */
16
+ class AzureHandler extends default_1.DefaultHandler {
17
+ //#region Constructor
18
+ /**
19
+ * Default Constructor
20
+ */
21
+ constructor(options) {
22
+ super();
23
+ this.options = options;
24
+ }
25
+ //#endregion
26
+ //#region Public Methods
27
+ /**
28
+ * {@inheritDoc}
29
+ */
30
+ getHandler(app, framework, adapters, resolverFactory, binarySettings, respondWithErrors, log) {
31
+ return (context, event) => {
32
+ var _a;
33
+ const useContextLogWhenInternalLogger = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.useContextLogWhenInternalLogger, true);
34
+ if ((0, core_1.isInternalLogger)(log) && useContextLogWhenInternalLogger)
35
+ log = this.createLoggerFromContext(context);
36
+ const defaultHandler = super.getHandler(app, framework, adapters, resolverFactory, binarySettings, respondWithErrors, log);
37
+ // remove this from context
38
+ // because user can mess it-up the things
39
+ // @ts-ignore
40
+ delete context.done;
41
+ delete context.res;
42
+ return defaultHandler(event, context, undefined);
43
+ };
44
+ }
45
+ //#endregion
46
+ //#region Protected Methods
47
+ /**
48
+ * Get the {@link ILogger} instance from logger of the context
49
+ *
50
+ * @param context - The Azure Context
51
+ */
52
+ createLoggerFromContext(context) {
53
+ return {
54
+ error: context.log.error,
55
+ debug: context.log.verbose,
56
+ verbose: context.log.verbose,
57
+ info: context.log.info,
58
+ warn: context.log.warn,
59
+ };
60
+ }
61
+ }
62
+ exports.AzureHandler = AzureHandler;
63
+ //# sourceMappingURL=azure.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.handler.js","sourceRoot":"","sources":["../../../src/handlers/azure/azure.handler.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iBAAiB;;;AAUjB,qCAA8E;AAC9E,wCAA4C;AAmB5C;;;;;;;GAOG;AACH,MAAa,YAMX,SAAQ,wBAAoE;IAC5E,qBAAqB;IAErB;;OAEG;IACH,YAA+B,OAA6B;QAC1D,KAAK,EAAE,CAAC;QADqB,YAAO,GAAP,OAAO,CAAsB;IAE5D,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC,EAClC,QAAuD,EACvD,eAMC,EACD,cAA8B,EAC9B,iBAA0B,EAC1B,GAAY;QAEZ,OAAO,CAAC,OAAgB,EAAE,KAAa,EAAE,EAAE;;YACzC,MAAM,+BAA+B,GAAG,IAAA,4BAAqB,EAC3D,MAAA,IAAI,CAAC,OAAO,0CAAE,+BAA+B,EAC7C,IAAI,CACL,CAAC;YAEF,IAAI,IAAA,uBAAgB,EAAC,GAAG,CAAC,IAAI,+BAA+B;gBAC1D,GAAG,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;YAE9C,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,GAAG,EACH,SAAS,EACT,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,GAAG,CACJ,CAAC;YAEF,2BAA2B;YAC3B,yCAAyC;YACzC,aAAa;YACb,OAAO,OAAO,CAAC,IAAI,CAAC;YACpB,OAAO,OAAO,CAAC,GAAG,CAAC;YAEnB,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC;IAED,YAAY;IAEZ,2BAA2B;IAE3B;;;;OAIG;IACO,uBAAuB,CAAC,OAAgB;QAChD,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;YACxB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YAC1B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YAC5B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;SACvB,CAAC;IACJ,CAAC;CAGF;AAvFD,oCAuFC"}
@@ -0,0 +1,2 @@
1
+ export * from './azure.handler';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlers/azure/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./azure.handler"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/azure/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
@@ -1,14 +1,5 @@
1
1
  "use strict";
2
2
  //#region Imports
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
13
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
5
  };
@@ -84,7 +75,10 @@ class DefaultHandler extends core_1.BaseHandler {
84
75
  var _a;
85
76
  const body = (_a = requestValues.body) === null || _a === void 0 ? void 0 : _a.toString();
86
77
  log.debug('SERVERLESS_ADAPTER:FORWARD_REQUEST_TO_FRAMEWORK:REQUEST_VALUES', {
87
- requestValues: Object.assign(Object.assign({}, requestValues), { body }),
78
+ requestValues: {
79
+ ...requestValues,
80
+ body,
81
+ },
88
82
  });
89
83
  }
90
84
  /**
@@ -141,16 +135,14 @@ class DefaultHandler extends core_1.BaseHandler {
141
135
  * @param log - The instance of logger
142
136
  * @param binarySettings - The binary settings
143
137
  */
144
- forwardRequestToFramework(app, framework, event, context, adapter, binarySettings, log) {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- const requestValues = adapter.getRequest(event, context, log);
147
- this.onResolveRequestValues(log, requestValues);
148
- const [request, response] = this.getServerlessRequestResponseFromAdapterRequest(requestValues);
149
- framework.sendRequest(app, request, response);
150
- yield (0, core_1.waitForStreamComplete)(response);
151
- this.onResolveForwardedResponseToFramework(log, response);
152
- return this.forwardResponse(event, response, adapter, binarySettings, log);
153
- });
138
+ async forwardRequestToFramework(app, framework, event, context, adapter, binarySettings, log) {
139
+ const requestValues = adapter.getRequest(event, context, log);
140
+ this.onResolveRequestValues(log, requestValues);
141
+ const [request, response] = this.getServerlessRequestResponseFromAdapterRequest(requestValues);
142
+ framework.sendRequest(app, request, response);
143
+ await (0, core_1.waitForStreamComplete)(response);
144
+ this.onResolveForwardedResponseToFramework(log, response);
145
+ return this.forwardResponse(event, response, adapter, binarySettings, log);
154
146
  }
155
147
  /**
156
148
  * The function to forward the response back to the serverless
@@ -1 +1 @@
1
- {"version":3,"file":"default.handler.js","sourceRoot":"","sources":["../../../src/handlers/default/default.handler.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;;;;;;;;;;;AAEjB,gDAAwB;AASxB,qCAMoB;AACpB,2CAAmD;AAEnD,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,cAOX,SAAQ,kBAAkE;IAC1E,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC,EAClC,QAAwD,EACxD,eAMC,EACD,cAA8B,EAC9B,iBAA0B,EAC1B,GAAY;QAEZ,OAAO,CAAC,KAAa,EAAE,OAAiB,EAAE,QAAoB,EAAE,EAAE;YAChE,IAAI,CAAC,gBAAgB,CACnB,GAAG,EACH,KAAK,EACL,OAAO,EACP,cAAc,EACd,iBAAiB,CAClB,CAAC;YAEF,MAAM,OAAO,GAAG,IAAI,CAAC,2BAA2B,CAC9C,KAAK,EACL,OAAO,EACP,QAAQ,EACR,GAAG,CACJ,CAAC;YAEF,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAEpC,IAAA,uBAAgB,EAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;YAErC,MAAM,QAAQ,GAAG,eAAe,CAAC,cAAc,CAAC;gBAC9C,KAAK;gBACL,OAAO;gBACP,QAAQ;gBACR,GAAG;gBACH,iBAAiB;gBACjB,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CACvB,IAAI,CAAC,yBAAyB,CAC5B,GAAG,EACH,SAAS,EACT,KAAK,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"2.4.0",
4
- "description": "Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Huawei and many other clouds.",
3
+ "version": "2.5.0",
4
+ "description": "Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Huawei and many other clouds.",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
7
7
  "lib/**/*"
@@ -54,7 +54,10 @@
54
54
  "http",
55
55
  "huawei",
56
56
  "functiongraph",
57
- "trpc"
57
+ "trpc",
58
+ "azure",
59
+ "azure-functions",
60
+ "http-trigger-v4"
58
61
  ],
59
62
  "bugs": {
60
63
  "url": "https://github.com/H4ad/serverless-adapter/issues"
@@ -97,6 +100,7 @@
97
100
  "typescript": "^4.5.5"
98
101
  },
99
102
  "peerDependencies": {
103
+ "@azure/functions": ">= 2.0.0",
100
104
  "@hapi/hapi": ">= 20.0.0",
101
105
  "@trpc/server": ">= 9.0.0",
102
106
  "@types/aws-lambda": ">= 8.10.92",
@@ -109,6 +113,9 @@
109
113
  "koa": ">= 2.5.1"
110
114
  },
111
115
  "peerDependenciesMeta": {
116
+ "@azure/functions": {
117
+ "optional": true
118
+ },
112
119
  "@hapi/hapi": {
113
120
  "optional": true
114
121
  },