mastra 0.1.57-unstable.35 → 0.1.57-unstable.37

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 (98) hide show
  1. package/.npmrc +2 -0
  2. package/package.json +4 -17
  3. package/node_modules/express/History.md +0 -3647
  4. package/node_modules/express/LICENSE +0 -24
  5. package/node_modules/express/Readme.md +0 -260
  6. package/node_modules/express/index.js +0 -11
  7. package/node_modules/express/lib/application.js +0 -661
  8. package/node_modules/express/lib/express.js +0 -116
  9. package/node_modules/express/lib/middleware/init.js +0 -43
  10. package/node_modules/express/lib/middleware/query.js +0 -47
  11. package/node_modules/express/lib/request.js +0 -525
  12. package/node_modules/express/lib/response.js +0 -1179
  13. package/node_modules/express/lib/router/index.js +0 -673
  14. package/node_modules/express/lib/router/layer.js +0 -181
  15. package/node_modules/express/lib/router/route.js +0 -230
  16. package/node_modules/express/lib/utils.js +0 -303
  17. package/node_modules/express/lib/view.js +0 -182
  18. package/node_modules/express/package.json +0 -98
  19. package/node_modules/express-jsdoc-swagger/.all-contributorsrc +0 -168
  20. package/node_modules/express-jsdoc-swagger/.eslintignore +0 -6
  21. package/node_modules/express-jsdoc-swagger/.eslintrc.json +0 -37
  22. package/node_modules/express-jsdoc-swagger/CODE_OF_CONDUCT.md +0 -76
  23. package/node_modules/express-jsdoc-swagger/CONTRIBUTING.md +0 -55
  24. package/node_modules/express-jsdoc-swagger/LICENSE.md +0 -21
  25. package/node_modules/express-jsdoc-swagger/README.md +0 -376
  26. package/node_modules/express-jsdoc-swagger/commitlint.config.js +0 -24
  27. package/node_modules/express-jsdoc-swagger/config/default.js +0 -18
  28. package/node_modules/express-jsdoc-swagger/config/swaggerEvents.js +0 -5
  29. package/node_modules/express-jsdoc-swagger/consumers/getOnlyComments.js +0 -21
  30. package/node_modules/express-jsdoc-swagger/consumers/globFilesMatches.js +0 -50
  31. package/node_modules/express-jsdoc-swagger/consumers/jsdocInfo.js +0 -20
  32. package/node_modules/express-jsdoc-swagger/consumers/readFiles.js +0 -9
  33. package/node_modules/express-jsdoc-swagger/consumers/utils/getComments.js +0 -13
  34. package/node_modules/express-jsdoc-swagger/consumers/utils/readFile.js +0 -15
  35. package/node_modules/express-jsdoc-swagger/index.d.ts +0 -65
  36. package/node_modules/express-jsdoc-swagger/index.js +0 -60
  37. package/node_modules/express-jsdoc-swagger/package.json +0 -59
  38. package/node_modules/express-jsdoc-swagger/processSwagger.js +0 -45
  39. package/node_modules/express-jsdoc-swagger/swaggerEvents.js +0 -35
  40. package/node_modules/express-jsdoc-swagger/transforms/basic/contact.js +0 -18
  41. package/node_modules/express-jsdoc-swagger/transforms/basic/index.js +0 -10
  42. package/node_modules/express-jsdoc-swagger/transforms/basic/info.js +0 -26
  43. package/node_modules/express-jsdoc-swagger/transforms/basic/license.js +0 -14
  44. package/node_modules/express-jsdoc-swagger/transforms/basic/servers.js +0 -20
  45. package/node_modules/express-jsdoc-swagger/transforms/components/index.js +0 -130
  46. package/node_modules/express-jsdoc-swagger/transforms/index.js +0 -13
  47. package/node_modules/express-jsdoc-swagger/transforms/paths/content.js +0 -18
  48. package/node_modules/express-jsdoc-swagger/transforms/paths/examples.js +0 -98
  49. package/node_modules/express-jsdoc-swagger/transforms/paths/formParams.js +0 -40
  50. package/node_modules/express-jsdoc-swagger/transforms/paths/index.js +0 -127
  51. package/node_modules/express-jsdoc-swagger/transforms/paths/parameters.js +0 -80
  52. package/node_modules/express-jsdoc-swagger/transforms/paths/requestBody.js +0 -65
  53. package/node_modules/express-jsdoc-swagger/transforms/paths/responses.js +0 -55
  54. package/node_modules/express-jsdoc-swagger/transforms/paths/schema.js +0 -33
  55. package/node_modules/express-jsdoc-swagger/transforms/paths/security.js +0 -31
  56. package/node_modules/express-jsdoc-swagger/transforms/paths/validStatusCodes.js +0 -64
  57. package/node_modules/express-jsdoc-swagger/transforms/security/index.js +0 -18
  58. package/node_modules/express-jsdoc-swagger/transforms/tags/index.js +0 -41
  59. package/node_modules/express-jsdoc-swagger/transforms/utils/arrays.js +0 -12
  60. package/node_modules/express-jsdoc-swagger/transforms/utils/combineSchema.js +0 -67
  61. package/node_modules/express-jsdoc-swagger/transforms/utils/enumValues.js +0 -6
  62. package/node_modules/express-jsdoc-swagger/transforms/utils/errorMessage.js +0 -8
  63. package/node_modules/express-jsdoc-swagger/transforms/utils/formatDescription.js +0 -35
  64. package/node_modules/express-jsdoc-swagger/transforms/utils/formatExamples.js +0 -25
  65. package/node_modules/express-jsdoc-swagger/transforms/utils/generator.js +0 -6
  66. package/node_modules/express-jsdoc-swagger/transforms/utils/httpMethods.js +0 -18
  67. package/node_modules/express-jsdoc-swagger/transforms/utils/mapDescription.js +0 -5
  68. package/node_modules/express-jsdoc-swagger/transforms/utils/refSchema.js +0 -48
  69. package/node_modules/express-jsdoc-swagger/transforms/utils/setProperty.js +0 -25
  70. package/node_modules/express-jsdoc-swagger/transforms/utils/tags.js +0 -16
  71. package/node_modules/express-jsdoc-swagger/transforms/utils/validateTypes.js +0 -11
  72. package/node_modules/serverless-http/LICENSE.txt +0 -33
  73. package/node_modules/serverless-http/README.md +0 -117
  74. package/node_modules/serverless-http/lib/finish.js +0 -42
  75. package/node_modules/serverless-http/lib/framework/get-framework.js +0 -79
  76. package/node_modules/serverless-http/lib/provider/aws/clean-up-event.js +0 -98
  77. package/node_modules/serverless-http/lib/provider/aws/create-request.js +0 -110
  78. package/node_modules/serverless-http/lib/provider/aws/format-response.js +0 -45
  79. package/node_modules/serverless-http/lib/provider/aws/index.js +0 -15
  80. package/node_modules/serverless-http/lib/provider/aws/is-binary.js +0 -42
  81. package/node_modules/serverless-http/lib/provider/aws/sanitize-headers.js +0 -21
  82. package/node_modules/serverless-http/lib/provider/azure/clean-up-request.js +0 -41
  83. package/node_modules/serverless-http/lib/provider/azure/create-request.js +0 -45
  84. package/node_modules/serverless-http/lib/provider/azure/format-response.js +0 -18
  85. package/node_modules/serverless-http/lib/provider/azure/index.js +0 -13
  86. package/node_modules/serverless-http/lib/provider/azure/is-binary.js +0 -42
  87. package/node_modules/serverless-http/lib/provider/azure/sanitize-headers.js +0 -23
  88. package/node_modules/serverless-http/lib/provider/azure/set-cookie.json +0 -1
  89. package/node_modules/serverless-http/lib/provider/get-provider.js +0 -17
  90. package/node_modules/serverless-http/lib/request.js +0 -38
  91. package/node_modules/serverless-http/lib/response.js +0 -135
  92. package/node_modules/serverless-http/package.json +0 -93
  93. package/node_modules/serverless-http/serverless-http.d.ts +0 -41
  94. package/node_modules/serverless-http/serverless-http.js +0 -23
  95. package/node_modules/swagger-ui-express/LICENSE +0 -22
  96. package/node_modules/swagger-ui-express/README.md +0 -360
  97. package/node_modules/swagger-ui-express/index.js +0 -311
  98. package/node_modules/swagger-ui-express/package.json +0 -58
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- const BINARY_ENCODINGS = ['gzip', 'deflate', 'br'];
4
- const BINARY_CONTENT_TYPES = (process.env.BINARY_CONTENT_TYPES || '').split(',');
5
-
6
- function isBinaryEncoding(headers) {
7
- const contentEncoding = headers['content-encoding'];
8
-
9
- if (typeof contentEncoding === 'string') {
10
- return contentEncoding.split(',').some(value =>
11
- BINARY_ENCODINGS.some(binaryEncoding => value.indexOf(binaryEncoding) !== -1)
12
- );
13
- }
14
- }
15
-
16
- function isBinaryContent(headers, options) {
17
- const contentTypes = [].concat(options.binary
18
- ? options.binary
19
- : BINARY_CONTENT_TYPES
20
- ).map(candidate =>
21
- new RegExp(`^${candidate.replace(/\*/g, '.*')}$`)
22
- );
23
-
24
- const contentType = (headers['content-type'] || '').split(';')[0];
25
- return !!contentType && contentTypes.some(candidate => candidate.test(contentType));
26
- }
27
-
28
- module.exports = function isBinary(headers, options) {
29
- if (options.binary === false) {
30
- return false;
31
- }
32
-
33
- if (options.binary === true) {
34
- return true
35
- }
36
-
37
- if (typeof options.binary === 'function') {
38
- return options.binary(headers);
39
- }
40
-
41
- return isBinaryEncoding(headers) || isBinaryContent(headers, options);
42
- };
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = function sanitizeHeaders(headers) {
4
- return Object.keys(headers).reduce((memo, key) => {
5
- const value = headers[key];
6
-
7
- if (Array.isArray(value)) {
8
- memo.multiValueHeaders[key] = value;
9
- if (key.toLowerCase() !== 'set-cookie') {
10
- memo.headers[key] = value.join(", ");
11
- }
12
- } else {
13
- memo.headers[key] = value == null ? '' : value.toString();
14
- }
15
-
16
- return memo;
17
- }, {
18
- headers: {},
19
- multiValueHeaders: {}
20
- });
21
- };
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- function getUrl({ requestPath, url }) {
4
- if (requestPath) {
5
- return requestPath;
6
- }
7
-
8
- return typeof url === 'string' ? url : '/';
9
- }
10
-
11
- function getRequestContext(request) {
12
- const requestContext = {};
13
- requestContext.identity = {};
14
- const forwardedIp = request.headers['x-forwarded-for'];
15
- const clientIp = request.headers['client-ip'];
16
- const ip = forwardedIp ? forwardedIp : (clientIp ? clientIp : '');
17
- if (ip) {
18
- requestContext.identity.sourceIp = ip.split(':')[0];
19
- }
20
- return requestContext;
21
- }
22
-
23
- module.exports = function cleanupRequest(req, options) {
24
- const request = req || {};
25
-
26
- request.requestContext = getRequestContext(req);
27
- request.method = request.method || 'GET';
28
- request.url = getUrl(request);
29
- request.body = request.body || '';
30
- request.headers = request.headers || {};
31
-
32
- if (options.basePath) {
33
- const basePathIndex = request.url.indexOf(options.basePath);
34
-
35
- if (basePathIndex > -1) {
36
- request.url = request.url.substr(basePathIndex + options.basePath.length);
37
- }
38
- }
39
-
40
- return request;
41
- }
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- const url = require('url');
4
-
5
- const Request = require('../../request');
6
-
7
- function requestHeaders(request) {
8
- return Object.keys(request.headers).reduce((headers, key) => {
9
- headers[key.toLowerCase()] = request.headers[key];
10
- return headers;
11
- }, {});
12
- }
13
-
14
- function requestBody(request) {
15
- const type = typeof request.rawBody;
16
-
17
- if (Buffer.isBuffer(request.rawBody)) {
18
- return request.rawBody;
19
- } else if (type === 'string') {
20
- return Buffer.from(request.rawBody, 'utf8');
21
- } else if (type === 'object') {
22
- return Buffer.from(JSON.stringify(request.rawBody));
23
- }
24
-
25
- throw new Error(`Unexpected request.body type: ${typeof request.rawBody}`);
26
- }
27
-
28
- module.exports = (request) => {
29
- const method = request.method;
30
- const query = request.query;
31
- const headers = requestHeaders(request);
32
- const body = requestBody(request);
33
-
34
- const req = new Request({
35
- method,
36
- headers,
37
- body,
38
- url: url.format({
39
- pathname: request.url,
40
- query
41
- })
42
- });
43
- req.requestContext = request.requestContext;
44
- return req;
45
- }
@@ -1,18 +0,0 @@
1
- const isBinary = require('./is-binary');
2
- const Response = require('../../response');
3
- const sanitizeHeaders = require('./sanitize-headers');
4
-
5
- module.exports = (response, options) => {
6
- const { statusCode } = response;
7
- const headers = sanitizeHeaders(Response.headers(response));
8
-
9
- if (headers['transfer-encoding'] === 'chunked' || response.chunkedEncoding) {
10
- throw new Error('chunked encoding not supported');
11
- }
12
-
13
- const isBase64Encoded = isBinary(headers, options);
14
- const encoding = isBase64Encoded ? 'base64' : 'utf8';
15
- const body = Response.body(response).toString(encoding);
16
-
17
- return { status: statusCode, headers, isBase64Encoded, body };
18
- }
@@ -1,13 +0,0 @@
1
- const cleanupRequest = require('./clean-up-request');
2
- const createRequest = require('./create-request');
3
- const formatResponse = require('./format-response');
4
-
5
- module.exports = options => {
6
- return getResponse => async (context, req) => {
7
- const event = cleanupRequest(req, options);
8
- const request = createRequest(event, options);
9
- const response = await getResponse(request, context, event);
10
- context.log(response);
11
- return formatResponse(response, options);
12
- }
13
- };
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- const BINARY_ENCODINGS = ['gzip', 'deflate', 'br'];
4
- const BINARY_CONTENT_TYPES = (process.env.BINARY_CONTENT_TYPES || '').split(',');
5
-
6
- function isBinaryEncoding(headers) {
7
- const contentEncoding = headers['content-encoding'];
8
-
9
- if (typeof contentEncoding === 'string') {
10
- return contentEncoding.split(',').some(value =>
11
- BINARY_ENCODINGS.some(binaryEncoding => value.indexOf(binaryEncoding) !== -1)
12
- );
13
- }
14
- }
15
-
16
- function isBinaryContent(headers, options) {
17
- const contentTypes = [].concat(options.binary
18
- ? options.binary
19
- : BINARY_CONTENT_TYPES
20
- ).map(candidate =>
21
- new RegExp(`^${candidate.replace(/\*/g, '.*')}$`)
22
- );
23
-
24
- const contentType = (headers['content-type'] || '').split(';')[0];
25
- return !!contentType && contentTypes.some(candidate => candidate.test(contentType));
26
- }
27
-
28
- module.exports = function isBinary(headers, options) {
29
- if (options.binary === false) {
30
- return false;
31
- }
32
-
33
- if (options.binary === true) {
34
- return true
35
- }
36
-
37
- if (typeof options.binary === 'function') {
38
- return options.binary(headers);
39
- }
40
-
41
- return isBinaryEncoding(headers) || isBinaryContent(headers, options);
42
- };
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- const setCookieVariations = require('./set-cookie.json').variations;
4
-
5
- module.exports = function sanitizeHeaders(headers) {
6
- return Object.keys(headers).reduce((memo, key) => {
7
- const value = headers[key];
8
-
9
- if (Array.isArray(value)) {
10
- if (key.toLowerCase() === 'set-cookie') {
11
- value.forEach((cookie, i) => {
12
- memo[setCookieVariations[i]] = cookie;
13
- });
14
- } else {
15
- memo[key] = value.join(', ');
16
- }
17
- } else {
18
- memo[key] = value == null ? '' : value.toString();
19
- }
20
-
21
- return memo;
22
- }, {});
23
- };
@@ -1 +0,0 @@
1
- {"variations":["set-cookie","Set-cookie","sEt-cookie","SEt-cookie","seT-cookie","SeT-cookie","sET-cookie","SET-cookie","set-Cookie","Set-Cookie","sEt-Cookie","SEt-Cookie","seT-Cookie","SeT-Cookie","sET-Cookie","SET-Cookie","set-cOokie","Set-cOokie","sEt-cOokie","SEt-cOokie","seT-cOokie","SeT-cOokie","sET-cOokie","SET-cOokie","set-COokie","Set-COokie","sEt-COokie","SEt-COokie","seT-COokie","SeT-COokie","sET-COokie","SET-COokie","set-coOkie","Set-coOkie","sEt-coOkie","SEt-coOkie","seT-coOkie","SeT-coOkie","sET-coOkie","SET-coOkie","set-CoOkie","Set-CoOkie","sEt-CoOkie","SEt-CoOkie","seT-CoOkie","SeT-CoOkie","sET-CoOkie","SET-CoOkie","set-cOOkie","Set-cOOkie","sEt-cOOkie","SEt-cOOkie","seT-cOOkie","SeT-cOOkie","sET-cOOkie","SET-cOOkie","set-COOkie","Set-COOkie","sEt-COOkie","SEt-COOkie","seT-COOkie","SeT-COOkie","sET-COOkie","SET-COOkie","set-cooKie","Set-cooKie","sEt-cooKie","SEt-cooKie","seT-cooKie","SeT-cooKie","sET-cooKie","SET-cooKie","set-CooKie","Set-CooKie","sEt-CooKie","SEt-CooKie","seT-CooKie","SeT-CooKie","sET-CooKie","SET-CooKie","set-cOoKie","Set-cOoKie","sEt-cOoKie","SEt-cOoKie","seT-cOoKie","SeT-cOoKie","sET-cOoKie","SET-cOoKie","set-COoKie","Set-COoKie","sEt-COoKie","SEt-COoKie","seT-COoKie","SeT-COoKie","sET-COoKie","SET-COoKie","set-coOKie","Set-coOKie","sEt-coOKie","SEt-coOKie","seT-coOKie","SeT-coOKie","sET-coOKie","SET-coOKie","set-CoOKie","Set-CoOKie","sEt-CoOKie","SEt-CoOKie","seT-CoOKie","SeT-CoOKie","sET-CoOKie","SET-CoOKie","set-cOOKie","Set-cOOKie","sEt-cOOKie","SEt-cOOKie","seT-cOOKie","SeT-cOOKie","sET-cOOKie","SET-cOOKie","set-COOKie","Set-COOKie","sEt-COOKie","SEt-COOKie","seT-COOKie","SeT-COOKie","sET-COOKie","SET-COOKie","set-cookIe","Set-cookIe","sEt-cookIe","SEt-cookIe","seT-cookIe","SeT-cookIe","sET-cookIe","SET-cookIe","set-CookIe","Set-CookIe","sEt-CookIe","SEt-CookIe","seT-CookIe","SeT-CookIe","sET-CookIe","SET-CookIe","set-cOokIe","Set-cOokIe","sEt-cOokIe","SEt-cOokIe","seT-cOokIe","SeT-cOokIe","sET-cOokIe","SET-cOokIe","set-COokIe","Set-COokIe","sEt-COokIe","SEt-COokIe","seT-COokIe","SeT-COokIe","sET-COokIe","SET-COokIe","set-coOkIe","Set-coOkIe","sEt-coOkIe","SEt-coOkIe","seT-coOkIe","SeT-coOkIe","sET-coOkIe","SET-coOkIe","set-CoOkIe","Set-CoOkIe","sEt-CoOkIe","SEt-CoOkIe","seT-CoOkIe","SeT-CoOkIe","sET-CoOkIe","SET-CoOkIe","set-cOOkIe","Set-cOOkIe","sEt-cOOkIe","SEt-cOOkIe","seT-cOOkIe","SeT-cOOkIe","sET-cOOkIe","SET-cOOkIe","set-COOkIe","Set-COOkIe","sEt-COOkIe","SEt-COOkIe","seT-COOkIe","SeT-COOkIe","sET-COOkIe","SET-COOkIe","set-cooKIe","Set-cooKIe","sEt-cooKIe","SEt-cooKIe","seT-cooKIe","SeT-cooKIe","sET-cooKIe","SET-cooKIe","set-CooKIe","Set-CooKIe","sEt-CooKIe","SEt-CooKIe","seT-CooKIe","SeT-CooKIe","sET-CooKIe","SET-CooKIe","set-cOoKIe","Set-cOoKIe","sEt-cOoKIe","SEt-cOoKIe","seT-cOoKIe","SeT-cOoKIe","sET-cOoKIe","SET-cOoKIe","set-COoKIe","Set-COoKIe","sEt-COoKIe","SEt-COoKIe","seT-COoKIe","SeT-COoKIe","sET-COoKIe","SET-COoKIe","set-coOKIe","Set-coOKIe","sEt-coOKIe","SEt-coOKIe","seT-coOKIe","SeT-coOKIe","sET-coOKIe","SET-coOKIe","set-CoOKIe","Set-CoOKIe","sEt-CoOKIe","SEt-CoOKIe","seT-CoOKIe","SeT-CoOKIe","sET-CoOKIe","SET-CoOKIe","set-cOOKIe","Set-cOOKIe","sEt-cOOKIe","SEt-cOOKIe","seT-cOOKIe","SeT-cOOKIe","sET-cOOKIe","SET-cOOKIe","set-COOKIe","Set-COOKIe","sEt-COOKIe","SEt-COOKIe","seT-COOKIe","SeT-COOKIe","sET-COOKIe","SET-COOKIe","set-cookiE","Set-cookiE","sEt-cookiE","SEt-cookiE","seT-cookiE","SeT-cookiE","sET-cookiE","SET-cookiE","set-CookiE","Set-CookiE","sEt-CookiE","SEt-CookiE","seT-CookiE","SeT-CookiE","sET-CookiE","SET-CookiE","set-cOokiE","Set-cOokiE","sEt-cOokiE","SEt-cOokiE","seT-cOokiE","SeT-cOokiE","sET-cOokiE","SET-cOokiE","set-COokiE","Set-COokiE","sEt-COokiE","SEt-COokiE","seT-COokiE","SeT-COokiE","sET-COokiE","SET-COokiE","set-coOkiE","Set-coOkiE","sEt-coOkiE","SEt-coOkiE","seT-coOkiE","SeT-coOkiE","sET-coOkiE","SET-coOkiE","set-CoOkiE","Set-CoOkiE","sEt-CoOkiE","SEt-CoOkiE","seT-CoOkiE","SeT-CoOkiE","sET-CoOkiE","SET-CoOkiE","set-cOOkiE","Set-cOOkiE","sEt-cOOkiE","SEt-cOOkiE","seT-cOOkiE","SeT-cOOkiE","sET-cOOkiE","SET-cOOkiE","set-COOkiE","Set-COOkiE","sEt-COOkiE","SEt-COOkiE","seT-COOkiE","SeT-COOkiE","sET-COOkiE","SET-COOkiE","set-cooKiE","Set-cooKiE","sEt-cooKiE","SEt-cooKiE","seT-cooKiE","SeT-cooKiE","sET-cooKiE","SET-cooKiE","set-CooKiE","Set-CooKiE","sEt-CooKiE","SEt-CooKiE","seT-CooKiE","SeT-CooKiE","sET-CooKiE","SET-CooKiE","set-cOoKiE","Set-cOoKiE","sEt-cOoKiE","SEt-cOoKiE","seT-cOoKiE","SeT-cOoKiE","sET-cOoKiE","SET-cOoKiE","set-COoKiE","Set-COoKiE","sEt-COoKiE","SEt-COoKiE","seT-COoKiE","SeT-COoKiE","sET-COoKiE","SET-COoKiE","set-coOKiE","Set-coOKiE","sEt-coOKiE","SEt-coOKiE","seT-coOKiE","SeT-coOKiE","sET-coOKiE","SET-coOKiE","set-CoOKiE","Set-CoOKiE","sEt-CoOKiE","SEt-CoOKiE","seT-CoOKiE","SeT-CoOKiE","sET-CoOKiE","SET-CoOKiE","set-cOOKiE","Set-cOOKiE","sEt-cOOKiE","SEt-cOOKiE","seT-cOOKiE","SeT-cOOKiE","sET-cOOKiE","SET-cOOKiE","set-COOKiE","Set-COOKiE","sEt-COOKiE","SEt-COOKiE","seT-COOKiE","SeT-COOKiE","sET-COOKiE","SET-COOKiE","set-cookIE","Set-cookIE","sEt-cookIE","SEt-cookIE","seT-cookIE","SeT-cookIE","sET-cookIE","SET-cookIE","set-CookIE","Set-CookIE","sEt-CookIE","SEt-CookIE","seT-CookIE","SeT-CookIE","sET-CookIE","SET-CookIE","set-cOokIE","Set-cOokIE","sEt-cOokIE","SEt-cOokIE","seT-cOokIE","SeT-cOokIE","sET-cOokIE","SET-cOokIE","set-COokIE","Set-COokIE","sEt-COokIE","SEt-COokIE","seT-COokIE","SeT-COokIE","sET-COokIE","SET-COokIE","set-coOkIE","Set-coOkIE","sEt-coOkIE","SEt-coOkIE","seT-coOkIE","SeT-coOkIE","sET-coOkIE","SET-coOkIE","set-CoOkIE","Set-CoOkIE","sEt-CoOkIE","SEt-CoOkIE","seT-CoOkIE","SeT-CoOkIE","sET-CoOkIE","SET-CoOkIE","set-cOOkIE","Set-cOOkIE","sEt-cOOkIE","SEt-cOOkIE","seT-cOOkIE","SeT-cOOkIE","sET-cOOkIE","SET-cOOkIE","set-COOkIE","Set-COOkIE","sEt-COOkIE","SEt-COOkIE","seT-COOkIE","SeT-COOkIE","sET-COOkIE","SET-COOkIE","set-cooKIE","Set-cooKIE","sEt-cooKIE","SEt-cooKIE","seT-cooKIE","SeT-cooKIE","sET-cooKIE","SET-cooKIE","set-CooKIE","Set-CooKIE","sEt-CooKIE","SEt-CooKIE","seT-CooKIE","SeT-CooKIE","sET-CooKIE","SET-CooKIE","set-cOoKIE","Set-cOoKIE","sEt-cOoKIE","SEt-cOoKIE","seT-cOoKIE","SeT-cOoKIE","sET-cOoKIE","SET-cOoKIE","set-COoKIE","Set-COoKIE","sEt-COoKIE","SEt-COoKIE","seT-COoKIE","SeT-COoKIE","sET-COoKIE","SET-COoKIE","set-coOKIE","Set-coOKIE","sEt-coOKIE","SEt-coOKIE","seT-coOKIE","SeT-coOKIE","sET-coOKIE","SET-coOKIE","set-CoOKIE","Set-CoOKIE","sEt-CoOKIE","SEt-CoOKIE","seT-CoOKIE","SeT-CoOKIE","sET-CoOKIE","SET-CoOKIE","set-cOOKIE","Set-cOOKIE","sEt-cOOKIE","SEt-cOOKIE","seT-cOOKIE","SeT-cOOKIE","sET-cOOKIE","SET-cOOKIE","set-COOKIE","Set-COOKIE","sEt-COOKIE","SEt-COOKIE","seT-COOKIE","SeT-COOKIE","sET-COOKIE","SET-COOKIE"]}
@@ -1,17 +0,0 @@
1
- const aws = require('./aws');
2
- const azure = require('./azure');
3
-
4
- const providers = {
5
- aws,
6
- azure
7
- };
8
-
9
- module.exports = function getProvider(options) {
10
- const { provider = 'aws' } = options;
11
-
12
- if (provider in providers) {
13
- return providers[provider](options);
14
- }
15
-
16
- throw new Error(`Unsupported provider ${provider}`);
17
- };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- const http = require('http');
4
-
5
- module.exports = class ServerlessRequest extends http.IncomingMessage {
6
- constructor({ method, url, headers, body, remoteAddress }) {
7
- super({
8
- encrypted: true,
9
- readable: false,
10
- remoteAddress,
11
- address: () => ({ port: 443 }),
12
- end: Function.prototype,
13
- destroy: Function.prototype
14
- });
15
-
16
- if (typeof headers['content-length'] === 'undefined') {
17
- headers['content-length'] = Buffer.byteLength(body);
18
- }
19
-
20
- Object.assign(this, {
21
- ip: remoteAddress,
22
- complete: true,
23
- httpVersion: '1.1',
24
- httpVersionMajor: '1',
25
- httpVersionMinor: '1',
26
- method,
27
- headers,
28
- body,
29
- url,
30
- });
31
-
32
- this._read = () => {
33
- this.push(body);
34
- this.push(null);
35
- };
36
- }
37
-
38
- }
@@ -1,135 +0,0 @@
1
- 'use strict';
2
-
3
- const http = require('http');
4
-
5
- const headerEnd = '\r\n\r\n';
6
-
7
- const BODY = Symbol();
8
- const HEADERS = Symbol();
9
-
10
- function getString(data) {
11
- if (Buffer.isBuffer(data)) {
12
- return data.toString('utf8');
13
- } else if (typeof data === 'string') {
14
- return data;
15
- } else {
16
- throw new Error(`response.write() of unexpected type: ${typeof data}`);
17
- }
18
- }
19
-
20
- function addData(stream, data) {
21
- if (Buffer.isBuffer(data) || typeof data === 'string' || data instanceof Uint8Array) {
22
- stream[BODY].push(Buffer.from(data));
23
- } else {
24
- throw new Error(`response.write() of unexpected type: ${typeof data}`);
25
- }
26
- }
27
-
28
- module.exports = class ServerlessResponse extends http.ServerResponse {
29
-
30
- static from(res) {
31
- const response = new ServerlessResponse(res);
32
-
33
- response.statusCode = res.statusCode
34
- response[HEADERS] = res.headers;
35
- response[BODY] = [Buffer.from(res.body)];
36
- response.end();
37
-
38
- return response;
39
- }
40
-
41
- static body(res) {
42
- return Buffer.concat(res[BODY]);
43
- }
44
-
45
- static headers(res) {
46
- const headers = typeof res.getHeaders === 'function'
47
- ? res.getHeaders()
48
- : res._headers;
49
-
50
- return Object.assign(headers, res[HEADERS]);
51
- }
52
-
53
- get headers() {
54
- return this[HEADERS];
55
- }
56
-
57
- setHeader(key, value) {
58
- if (this._wroteHeader) {
59
- this[HEADERS][key] = value;
60
- } else {
61
- super.setHeader(key, value);
62
- }
63
- }
64
-
65
- writeHead(statusCode, reason, obj) {
66
- const headers = typeof reason === 'string'
67
- ? obj
68
- : reason
69
-
70
- for (const name in headers) {
71
- this.setHeader(name, headers[name])
72
-
73
- if (!this._wroteHeader) {
74
- // we only need to initiate super.headers once
75
- // writeHead will add the other headers itself
76
- break
77
- }
78
- }
79
-
80
- super.writeHead(statusCode, reason, obj);
81
- }
82
-
83
- constructor({ method }) {
84
- super({ method });
85
-
86
- this[BODY] = [];
87
- this[HEADERS] = {};
88
-
89
- this.useChunkedEncodingByDefault = false;
90
- this.chunkedEncoding = false;
91
- this._header = '';
92
-
93
- this.assignSocket({
94
- _writableState: {},
95
- writable: true,
96
- on: Function.prototype,
97
- removeListener: Function.prototype,
98
- destroy: Function.prototype,
99
- cork: Function.prototype,
100
- uncork: Function.prototype,
101
- write: (data, encoding, cb) => {
102
- if (typeof encoding === 'function') {
103
- cb = encoding;
104
- encoding = null;
105
- }
106
-
107
- if (this._header === '' || this._wroteHeader) {
108
- addData(this, data);
109
- } else {
110
- const string = getString(data);
111
- const index = string.indexOf(headerEnd);
112
-
113
- if (index !== -1) {
114
- const remainder = string.slice(index + headerEnd.length);
115
-
116
- if (remainder) {
117
- addData(this, remainder);
118
- }
119
-
120
- this._wroteHeader = true;
121
- }
122
- }
123
-
124
- if (typeof cb === 'function') {
125
- cb();
126
- }
127
- },
128
- });
129
-
130
- this.once('finish', () => {
131
- this.emit('close')
132
- });
133
- }
134
-
135
- };
@@ -1,93 +0,0 @@
1
- {
2
- "name": "serverless-http",
3
- "version": "3.2.0",
4
- "description": "Use existing web application frameworks in serverless environments",
5
- "main": "serverless-http.js",
6
- "types": "serverless-http.d.ts",
7
- "engines": {
8
- "node": ">=12.0"
9
- },
10
- "directories": {
11
- "test": "test"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/dougmoscrop/serverless-http"
16
- },
17
- "scripts": {
18
- "pretest": "tsc --strict --skipLibCheck --noEmit test/typecheck.ts",
19
- "test": "nyc mocha",
20
- "posttest": "eslint lib test",
21
- "test:integration": "mocha test/integration/test.js",
22
- "postpublish": "git push origin master --tags"
23
- },
24
- "keywords": [
25
- "serverless",
26
- "serverless applications",
27
- "koa",
28
- "express",
29
- "connect",
30
- "api gateway",
31
- "lambda",
32
- "aws",
33
- "aws lambda",
34
- "amazon",
35
- "amazon web services"
36
- ],
37
- "author": "Doug Moscrop <doug.moscrop@gmail.com> (http://www.github.com/dougmoscrop)",
38
- "contributors": [
39
- "Doug Moscrop (https://github.com/dougmoscrop)",
40
- "Kevin Groat (https://github.com/kgroat)",
41
- "Kurt Miller (https://github.com/bsdkurt)",
42
- "Roch Devost (https://github.com/rochdev)",
43
- "Bryan Gamble (https://github.com/bdgamble)",
44
- "Derek MacDonald (https://github.com/demacdonald)",
45
- "Filip Skokan (https://github.com/panva)",
46
- "Kevin Tonon (https://github.com/ktonon)",
47
- "Mark Vayngrib (https://github.com/mvayngrib)",
48
- "Tamás Máhr (https://github.com/tamasmahr)",
49
- "Daniel Martin (https://github.com/daniel-ac-martin)"
50
- ],
51
- "homepage": "https://github.com/dougmoscrop/serverless-http",
52
- "license": "MIT",
53
- "devDependencies": {
54
- "@loopback/rest": "^11.1.2",
55
- "@types/koa": "^2.11.0",
56
- "body-parser": "^1.19.0",
57
- "chai": "^4.2.0",
58
- "chai-as-promised": "^7.1.1",
59
- "cookie-parser": "^1.4.4",
60
- "eslint": "^8.12.0",
61
- "eslint-plugin-mocha": "^10.0.3",
62
- "express": "^4.17.1",
63
- "fastify": "^3.27.4",
64
- "get-stream": "^5.1.0",
65
- "hapi": "^18.1.0",
66
- "inversify": "^6.0.1",
67
- "inversify-express-utils": "^6.3.2",
68
- "koa": "^2.11.0",
69
- "koa-bodyparser": "^4.2.1",
70
- "koa-compress": "^5.1.0",
71
- "koa-route": "^3.2.0",
72
- "koa-router": "^10.1.1",
73
- "koa-static": "^5.0.0",
74
- "lambda-log": "^3.1.0",
75
- "mocha": "^9.2.2",
76
- "morgan": "^1.9.1",
77
- "nyc": "^15.0.0",
78
- "on-finished": "^2.3.0",
79
- "on-headers": "^1.0.2",
80
- "polka": "^0.5.2",
81
- "reflect-metadata": "^0.1.13",
82
- "restana": "^4.0.7",
83
- "sails": "^1.2.3",
84
- "serverless": "^3.10.2",
85
- "serverless-offline": "^8.5.0",
86
- "serverless-plugin-common-excludes": "^4.0.0",
87
- "serverless-plugin-custom-binary": "^2.0.0",
88
- "serverless-plugin-include-dependencies": "^5.0.0",
89
- "sinon": "^13.0.1",
90
- "supertest": "^6.2.2",
91
- "typescript": "^4.6.3"
92
- }
93
- }
@@ -1,41 +0,0 @@
1
- declare namespace ServerlessHttp {
2
- export interface FrameworkApplication {
3
- callback: Function;
4
- handle: Function;
5
- router: {
6
- route: Function;
7
- }
8
- _core: {
9
- _dispatch: Function;
10
- }
11
- }
12
-
13
- /**
14
- * Handler-compatible function or application.
15
- */
16
- export type Application = Function | Partial<FrameworkApplication>;
17
- export type Result = Function | Partial<FrameworkApplication>;
18
-
19
- export type Options = {
20
- provider?: 'aws' | 'azure'
21
- requestId?: string,
22
- request?: Object | Function,
23
- response?: Object | Function,
24
- binary?: boolean | Function | string | string[],
25
- basePath?: string
26
- }
27
- /**
28
- * AWS Lambda APIGatewayProxyHandler-like handler.
29
- */
30
- export type Handler = (
31
- event: Object,
32
- context: Object
33
- ) => Promise<Object>;
34
- }
35
-
36
- /**
37
- * Wraps the application into a Lambda APIGatewayProxyHandler-like handler.
38
- */
39
- declare function ServerlessHttp(application: ServerlessHttp.Application, options?: ServerlessHttp.Options): ServerlessHttp.Handler;
40
-
41
- export = ServerlessHttp;
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- const finish = require('./lib/finish');
4
- const getFramework = require('./lib/framework/get-framework');
5
- const getProvider = require('./lib/provider/get-provider');
6
-
7
- const defaultOptions = {
8
- requestId: 'x-request-id'
9
- };
10
-
11
- module.exports = function (app, opts) {
12
- const options = Object.assign({}, defaultOptions, opts);
13
-
14
- const framework = getFramework(app);
15
- const provider = getProvider(options);
16
-
17
- return provider(async (request, ...context) => {
18
- await finish(request, options.request, ...context);
19
- const response = await framework(request);
20
- await finish(response, options.response, ...context);
21
- return response;
22
- });
23
- };
@@ -1,22 +0,0 @@
1
-
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2018 Scott IT London
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.