@spytecgps/lambda-utils 2.3.1 → 2.3.2
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/dist/config/index.d.ts +14 -13
- package/dist/errors/BadRequestError.d.ts +6 -6
- package/dist/errors/BadRequestError.js +28 -0
- package/dist/errors/BaseError.d.ts +4 -4
- package/dist/errors/BaseError.js +24 -0
- package/dist/errors/ConflictError.d.ts +6 -6
- package/dist/errors/ForbiddenError.d.ts +6 -6
- package/dist/errors/HttpError.d.ts +8 -8
- package/dist/errors/HttpError.js +32 -0
- package/dist/errors/NotFoundError.d.ts +6 -6
- package/dist/errors/NotFoundError.js +28 -0
- package/dist/errors/UnauthorizedError.d.ts +6 -6
- package/dist/errors/UnauthorizedError.js +28 -0
- package/dist/errors/index.d.ts +8 -8
- package/dist/errors/index.js +12 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/logger/index.d.ts +2 -2
- package/dist/logger/logger.d.ts +3 -0
- package/dist/logger/logger.js +57 -0
- package/dist/middleware/contextualLogger.d.ts +12 -12
- package/dist/middleware/contextualLogger.js +87 -0
- package/dist/middleware/index.d.ts +23 -23
- package/dist/middleware/index.js +62 -0
- package/dist/middleware/ioLogger.d.ts +1 -1
- package/dist/middleware/ioLogger.js +14 -0
- package/dist/middleware/middleware.test.d.ts +1 -1
- package/dist/middleware/middleware.test.js +167 -0
- package/dist/middleware/responseWrapper.d.ts +4 -4
- package/dist/middleware/responseWrapper.js +12 -0
- package/dist/middleware/types.d.ts +7 -7
- package/dist/middleware/types.js +2 -0
- package/dist/middleware/validation.d.ts +9 -9
- package/dist/middleware/validation.js +27 -0
- package/dist/middleware/warmup.d.ts +3 -3
- package/dist/types.d.ts +73 -73
- package/dist/types.js +2 -0
- package/dist/utils/cache.d.ts +23 -23
- package/dist/utils/cacheWrapper.d.ts +2 -2
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/timeOut.d.ts +1 -1
- package/dist/validation/custom.d.ts +18 -18
- package/dist/validation/custom.js +122 -0
- package/dist/validation/index.d.ts +6 -6
- package/dist/validation/index.js +20 -0
- package/dist/validation/requestContext.d.ts +14 -14
- package/dist/validation/requestContext.js +54 -0
- package/dist/validation/validateEvent.d.ts +3 -3
- package/dist/validation/validateEvent.js +25 -0
- package/dist/wrappers/apiGatewayEventWrapper.d.ts +4 -4
- package/dist/wrappers/apiGatewayEventWrapper.js +82 -0
- package/dist/wrappers/index.d.ts +5 -5
- package/dist/wrappers/index.js +21 -0
- package/dist/wrappers/response.d.ts +8 -8
- package/dist/wrappers/response.js +35 -0
- package/dist/wrappers/sqsEventWrapper.d.ts +3 -3
- package/dist/wrappers/sqsEventWrapper.js +116 -0
- package/dist/wrappers/sqsEventWrapperWithReturn.d.ts +3 -3
- package/package.json +2 -2
package/dist/config/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export type Env = 'base' | 'local' | 'dev' | 'test' | '
|
|
2
|
-
export type DeepPartial<T> = {
|
|
3
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
-
};
|
|
5
|
-
export type EnvConfigsParam<T> = {
|
|
6
|
-
base: DeepPartial<T>;
|
|
7
|
-
[k: string]: DeepPartial<T>;
|
|
8
|
-
};
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
1
|
+
export type Env = 'base' | 'local' | 'dev' | 'test' | 'prod';
|
|
2
|
+
export type DeepPartial<T> = {
|
|
3
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
+
};
|
|
5
|
+
export type EnvConfigsParam<T> = {
|
|
6
|
+
base: DeepPartial<T>;
|
|
7
|
+
[k: string]: DeepPartial<T>;
|
|
8
|
+
};
|
|
9
|
+
export declare const getEnvKey: () => Env;
|
|
10
|
+
export declare const isLocal: () => boolean;
|
|
11
|
+
export declare const isTest: () => boolean;
|
|
12
|
+
export declare const isDev: () => boolean;
|
|
13
|
+
export declare const isProduction: () => boolean;
|
|
14
|
+
export declare const setupEnvConfig: <T>(envConfigs: EnvConfigsParam<T>) => T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HttpError from './HttpError';
|
|
2
|
-
export default class BadRequestError extends HttpError {
|
|
3
|
-
code: number;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import HttpError from './HttpError';
|
|
2
|
+
export default class BadRequestError extends HttpError {
|
|
3
|
+
code: number;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var HttpError_1 = require("./HttpError");
|
|
17
|
+
var BadRequestError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(BadRequestError, _super);
|
|
19
|
+
function BadRequestError() {
|
|
20
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
_this.code = 400;
|
|
22
|
+
_this.statusCode = 400;
|
|
23
|
+
_this.name = 'BadRequestError';
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return BadRequestError;
|
|
27
|
+
}(HttpError_1.HttpError));
|
|
28
|
+
exports.default = BadRequestError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class BaseError extends Error {
|
|
2
|
-
code: 500;
|
|
3
|
-
statusCode: 500;
|
|
4
|
-
}
|
|
1
|
+
export default class BaseError extends Error {
|
|
2
|
+
code: 500;
|
|
3
|
+
statusCode: 500;
|
|
4
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.BaseError = void 0;
|
|
17
|
+
var BaseError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(BaseError, _super);
|
|
19
|
+
function BaseError() {
|
|
20
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
}
|
|
22
|
+
return BaseError;
|
|
23
|
+
}(Error));
|
|
24
|
+
exports.BaseError = BaseError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HttpError from './HttpError';
|
|
2
|
-
export default class ConflictError extends HttpError {
|
|
3
|
-
code: number;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import HttpError from './HttpError';
|
|
2
|
+
export default class ConflictError extends HttpError {
|
|
3
|
+
code: number;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HttpError from './HttpError';
|
|
2
|
-
export default class ForbiddenError extends HttpError {
|
|
3
|
-
code: number;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import HttpError from './HttpError';
|
|
2
|
+
export default class ForbiddenError extends HttpError {
|
|
3
|
+
code: number;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export default abstract class HttpError extends Error {
|
|
2
|
-
abstract code: number;
|
|
3
|
-
abstract statusCode: number;
|
|
4
|
-
}
|
|
5
|
-
export declare class BaseError extends Error {
|
|
6
|
-
code: 500;
|
|
7
|
-
statusCode: 500;
|
|
8
|
-
}
|
|
1
|
+
export default abstract class HttpError extends Error {
|
|
2
|
+
abstract code: number;
|
|
3
|
+
abstract statusCode: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class BaseError extends Error {
|
|
6
|
+
code: 500;
|
|
7
|
+
statusCode: 500;
|
|
8
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.BaseError = exports.HttpError = void 0;
|
|
17
|
+
var HttpError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(HttpError, _super);
|
|
19
|
+
function HttpError() {
|
|
20
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
}
|
|
22
|
+
return HttpError;
|
|
23
|
+
}(Error));
|
|
24
|
+
exports.HttpError = HttpError;
|
|
25
|
+
var BaseError = /** @class */ (function (_super) {
|
|
26
|
+
__extends(BaseError, _super);
|
|
27
|
+
function BaseError() {
|
|
28
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
}
|
|
30
|
+
return BaseError;
|
|
31
|
+
}(Error));
|
|
32
|
+
exports.BaseError = BaseError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HttpError from './HttpError';
|
|
2
|
-
export default class NotFoundError extends HttpError {
|
|
3
|
-
code: number;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import HttpError from './HttpError';
|
|
2
|
+
export default class NotFoundError extends HttpError {
|
|
3
|
+
code: number;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var HttpError_1 = require("./HttpError");
|
|
17
|
+
var NotFoundError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(NotFoundError, _super);
|
|
19
|
+
function NotFoundError() {
|
|
20
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
_this.code = 404;
|
|
22
|
+
_this.statusCode = 404;
|
|
23
|
+
_this.name = 'NotFoundError';
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return NotFoundError;
|
|
27
|
+
}(HttpError_1.HttpError));
|
|
28
|
+
exports.default = NotFoundError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HttpError from './HttpError';
|
|
2
|
-
export default class UnauthorizedError extends HttpError {
|
|
3
|
-
code: number;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import HttpError from './HttpError';
|
|
2
|
+
export default class UnauthorizedError extends HttpError {
|
|
3
|
+
code: number;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var HttpError_1 = require("./HttpError");
|
|
17
|
+
var UnauthorizedError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(UnauthorizedError, _super);
|
|
19
|
+
function UnauthorizedError() {
|
|
20
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
_this.code = 401;
|
|
22
|
+
_this.statusCode = 401;
|
|
23
|
+
_this.name = 'UnauthorizedError';
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return UnauthorizedError;
|
|
27
|
+
}(HttpError_1.HttpError));
|
|
28
|
+
exports.default = UnauthorizedError;
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BadRequestError from './BadRequestError';
|
|
2
|
-
import BaseError from './BaseError';
|
|
3
|
-
import ConflictError from './ConflictError';
|
|
4
|
-
import ForbiddenError from './ForbiddenError';
|
|
5
|
-
import HttpError from './HttpError';
|
|
6
|
-
import NotFoundError from './NotFoundError';
|
|
7
|
-
import UnauthorizedError from './UnauthorizedError';
|
|
8
|
-
export { BadRequestError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, HttpError, BaseError };
|
|
1
|
+
import BadRequestError from './BadRequestError';
|
|
2
|
+
import BaseError from './BaseError';
|
|
3
|
+
import ConflictError from './ConflictError';
|
|
4
|
+
import ForbiddenError from './ForbiddenError';
|
|
5
|
+
import HttpError from './HttpError';
|
|
6
|
+
import NotFoundError from './NotFoundError';
|
|
7
|
+
import UnauthorizedError from './UnauthorizedError';
|
|
8
|
+
export { BadRequestError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, HttpError, BaseError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UnauthorizedError = exports.NotFoundError = exports.BadRequestError = void 0;
|
|
7
|
+
var BadRequestError_1 = __importDefault(require("./BadRequestError"));
|
|
8
|
+
exports.BadRequestError = BadRequestError_1.default;
|
|
9
|
+
var NotFoundError_1 = __importDefault(require("./NotFoundError"));
|
|
10
|
+
exports.NotFoundError = NotFoundError_1.default;
|
|
11
|
+
var UnauthorizedError_1 = __importDefault(require("./UnauthorizedError"));
|
|
12
|
+
exports.UnauthorizedError = UnauthorizedError_1.default;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './wrappers';
|
|
2
|
-
export * from './errors';
|
|
3
|
-
export * from './validation';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './middleware';
|
|
6
|
-
export * from './logger';
|
|
7
|
-
export * from './utils';
|
|
8
|
-
export * from './config';
|
|
1
|
+
export * from './wrappers';
|
|
2
|
+
export * from './errors';
|
|
3
|
+
export * from './validation';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './middleware';
|
|
6
|
+
export * from './logger';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
export * from './config';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["lambda-utils"]=r():e["lambda-utils"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{BadRequestError:()=>E,BaseError:()=>O,ConflictError:()=>N,ForbiddenError:()=>_,HttpError:()=>v,LambdaCache:()=>oe,NotFoundError:()=>T,SpytecJoi:()=>y,UnauthorizedError:()=>b,apiGatewayEventWrapper:()=>S,apiGatewayMiddlewares:()=>Y,apiGatewayMiddy:()=>re,baseMiddlewares:()=>
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["lambda-utils"]=r():e["lambda-utils"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{BadRequestError:()=>E,BaseError:()=>O,ConflictError:()=>N,ForbiddenError:()=>_,HttpError:()=>v,LambdaCache:()=>oe,NotFoundError:()=>T,SpytecJoi:()=>y,UnauthorizedError:()=>b,apiGatewayEventWrapper:()=>S,apiGatewayMiddlewares:()=>Y,apiGatewayMiddy:()=>re,baseMiddlewares:()=>X,buildProxyResult:()=>x,buildResponseBody:()=>j,defaultApiSchema:()=>A,getAuthorizerValidator:()=>h,getEnvKey:()=>ie,getRequestContextValidator:()=>f,httpErrorHandler:()=>z(),httpResponseSerializer:()=>$(),iccidSchema:()=>m,imeiSchema:()=>g,isDev:()=>ce,isLocal:()=>le,isProduction:()=>ue,isTest:()=>de,json:()=>u,logger:()=>t.logger,merge:()=>ae(),middy:()=>ee,promiseWithCache:()=>se,promiseWithTimeout:()=>ne,requestContextValidator:()=>w,setupEnvConfig:()=>pe,sqsEventWrapper:()=>R,sqsEventWrapperWithReturn:()=>I,sqsJsonBodyParser:()=>U(),urlEncoded:()=>p,validateEvent:()=>C,validatorMiddleware:()=>Z,warmupMiddleware:()=>Q,withRequest:()=>t.withRequest});const t=require("@spytecgps/sdk-logger"),a=require("dayjs");var o=e.n(a);const s=require("dayjs/plugin/timezone");var n=e.n(s);const i=require("dayjs/plugin/utc");var l=e.n(i);const d=require("joi"),c=require("qs");o().extend(l()),o().extend(n());const u=d.extend((e=>({type:"object",base:e.object(),messages:{"json.valid":"must be valid JSON"},coerce(e){try{return{value:JSON.parse(e)}}catch(e){return null}},validate:(e,r)=>e?{value:e}:{value:e,errors:r.error("json.valid")}}))),p=d.extend((e=>({type:"object",base:e.object(),coerce:e=>({value:c.parse(e)})}))),g=d.string().regex(/^\d{15,16}$/).message("Invalid IMEI"),m=d.string().regex(/^[0-9A-Za-z]{18,22}$/).message("Invalid ICCID"),y=d.extend((e=>({type:"imei",messages:"Invalid IMEI",base:e.string().regex(/^\d{15,16}$/)})),(e=>({type:"iccid",messages:"Invalid ICCID",base:e.string().regex(/^[0-9A-Za-z]{18,22}$/)})),(e=>({type:"urlEncodedObject",base:e.object(),coerce:e=>({value:c.parse(e)})})),(e=>({type:"jsonObject",base:e.object(),coerce(e){try{return{value:JSON.parse(e)}}catch(e){return null}},validate:(e,r)=>e?{value:e}:{value:e,errors:r.error("json.valid")}})),(e=>({type:"delimitedArray",base:e.array().default([]),coerce:e=>({value:e.split?e.split(","):e})})),(e=>({type:"queryStringParameters",messages:"Missing query parameters",base:e.object().required()})),(e=>({type:"date",base:e.date(),prepare(e,r){try{const r=o().tz(e,"UTC");if(r.isValid())return{value:r.toDate()}}catch(e){return r.error("any.invalid")}}})),(e=>({type:"jsonArray",base:e.array(),coerce(e){try{return{value:JSON.parse(e)}}catch(e){return{value:null}}},validate:(e,r)=>Array.isArray(e)?{value:e}:{value:e,errors:r.error("jsonArray.schema")}})),(e=>({type:"base64ThenUriEncodedObject",base:e.object(),coerce(e){try{const r=decodeURIComponent(Buffer.from(e,"base64").toString());return{value:JSON.parse(r)}}catch(e){return null}},validate:(e,r)=>e?{value:e}:{value:e,errors:r.error("json.valid")}})));class v extends Error{}class b extends v{code=401;statusCode=401;name="UnauthorizedError"}const h=({scope:e,type:r}={})=>d.object({clientId:d.number(),resources:u.object({}),scope:e?d.string().pattern(new RegExp(`${e}`)).error((()=>new b(`missing scope ${e}`))):d.optional(),type:r?d.any().valid(r).error((()=>new b(`missing user type ${r}`))):d.optional(),enterprise:d.boolean().default(!1),maintenanceModule:d.boolean().default(!1),billingMethod:d.string().optional(),customerSegment:d.string().optional(),securityGroupTagId:d.number().optional().allow(null)}),w=d.object({authorizer:h()}),f=(e={})=>d.object({authorizer:h(e)});class E extends v{code=400;statusCode=400;name="BadRequestError"}const C=(e,r,a)=>{if(!r)return t.logger.warn("skipping validation"),e;const{error:o,value:s}=r.validate(e,{allowUnknown:a?.allowUnknown||!0,errors:{label:"key",wrap:{label:!1}}});if(o)throw t.logger.error({error:o},"Validation error"),o.isJoi?new E(o.message):o;return s},A=y.object({requestContext:f()}),q={"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":!0},j=(e,r,t)=>({success:e<400,message:r,result:t||void 0}),x=({statusCode:e=200,message:r="ok",data:t,headers:a={},rawResult:o=!1,stringifyBody:s=!0})=>{const n=o?t:j(e,r,t),i=s?n&&JSON.stringify(n):t;return{headers:{...q,...a},statusCode:e,body:i}},S=async({event:e,context:r,schema:a,handler:o})=>{e&&r&&(0,t.withRequest)(e,r);try{const r=C(e,a),t=await o(r);return x(t)}catch(r){return t.logger.error({err:r,event:(s=e,{resource:s.resource,httpMethod:s.httpMethod,queryStringParameters:s.queryStringParameters,pathParameters:s.pathParameters,body:s.body})},"apiGatewayWrapper - caught error"),x({statusCode:r.code||500,message:r.message||"Error"})}var s},R=async({event:e,context:r,schema:a,handler:o,singleHandler:s,mode:n="serial"})=>{e&&r&&(0,t.withRequest)(e,r);try{const r=C(e,a);await async function(e,r,t,a){if(!r&&!t)throw new Error("handler or singleHandler not defined");if(r)await r(e);else if(t){const r=e.Records;if("serial"===a)for(const e of r)await t(e);else"parallel"===a&&await Promise.all(r.map((e=>t(e))))}}(r,o,s,n)}catch(r){throw t.logger.error({err:r,event:(i=e,(i.Records||[]).map((e=>({messageId:e.messageId,body:e.body,messageAttributes:e.messageAttributes}))))},"sqsEventWrapper - caught error"),r}var i},I=async({event:e,context:r,schema:a,handler:o,singleHandler:s,mode:n="serial"})=>{e&&r&&(0,t.withRequest)(e,r);try{const r=C(e,a);return await(async(e,r,t,a)=>{if(!r&&!t)throw new Error("handler or singleHandler not defined");if(r)return await r(e);if(t){const r=e.Records;if("serial"===a){const e=[];for(const a of r){const r=await t(a);e.push(r)}return e}if("parallel"===a)return await Promise.all(r.map((e=>t(e))))}})(r,o,s,n)}catch(r){throw t.logger.error({err:r,event:(i=e,(i.Records||[]).map((e=>({messageId:e.messageId,body:e.body,messageAttributes:e.messageAttributes}))))},"sqsEventWrapper - caught error"),r}var i};class O extends Error{code;statusCode}class N extends v{code=409;statusCode=409;name="ConflictError"}class _ extends v{code=403;statusCode=403;name="ForbiddenError"}class T extends v{code=404;statusCode=404;name="NotFoundError"}const M=require("@middy/core");var P=e.n(M);const H=require("@middy/http-error-handler");var z=e.n(H);const G=require("@middy/http-response-serializer");var $=e.n(G);const W=require("@middy/sqs-json-body-parser");var U=e.n(W);const k="_X_AMZN_TRACE_ID",J="x-correlation-",B=`${J}id`,D=`${J}trace-id`,V={before:async({event:e,context:r})=>{const a={awsRequestId:r.awsRequestId},o=e.requestContext?.requestId;o&&(a.apiRequestId=o),e.headers&&Object.keys(e.headers).forEach((r=>{r.toLowerCase().startsWith(J)&&(a[r]=e.headers[r])})),process.env[k]&&(a[D]=process.env[k]),a[B]||(a[B]=r.awsRequestId),t.logger.setHapnContext(a)}},F=require("@middy/input-output-logger"),L=e.n(F)()({omitPaths:["event.multiValueHeaders","event.multiValueQueryStringParameters"],logger:e=>{const r=e?.event?"event":"response";t.logger.info(e.event??e.response,r)}}),Z=({schema:e,allowUnknown:r=!0})=>({before:a=>{const{error:o,value:s}=e.validate(a.event,{allowUnknown:r,errors:{label:"key",wrap:{label:!1}}});if(o)throw t.logger.error("Validation error",{error:o}),o.isJoi?new E(o.message):o;a.event=s}}),K={isWarmingUp:e=>"serverless-plugin-warmup"===e.source},Q=(e={})=>{const r={...K,...e};return{before:e=>{if(r.isWarmingUp(e.event))return"warmup"}}},X=[Q(),V,L],Y=[$()({serializers:[{regex:/^application\/xml$/,serializer:({body:e})=>`<message>${e}</message>`},{regex:/^application\/json$/,serializer:({body:e})=>JSON.stringify(e)},{regex:/^text\/plain$/,serializer:({body:e})=>e}],default:"application/json"}),{after:e=>{e.response=x(e.response)},onError:e=>{t.logger.error(e.error,"Request failed"),e.response=x({statusCode:e.error.code||500,message:e.error.message||"Error"})}}],ee=e=>P()(e).use([...X]),re=e=>P()(e).use([...X,...Y]),te=require("deepmerge");var ae=e.n(te);class oe{collectionName;constructor(e){this.collectionName=e??`${process.env.AWS_LAMBDA_FUNCTION_NAME}-${process.env.AWS_LAMBDA_FUNCTION_VERSION}`,global.CACHE_STORAGE||(global.CACHE_STORAGE={}),global.CACHE_STORAGE[this.collectionName]||(global.CACHE_STORAGE[this.collectionName]=new Map)}set(e,r,t){const a=1e3*t+Date.now();global.CACHE_STORAGE[this.collectionName].set(e,{value:r,expire:a})}get(e){if(!e)throw new Error("key is required!");const r=global.CACHE_STORAGE[this.collectionName].get(e);return r?!r.expire||r.expire>Date.now()?r.value:this.remove(e):null}remove(e){global.CACHE_STORAGE[this.collectionName].get(e)&&global.CACHE_STORAGE[this.collectionName].delete(e)}}const se=async(e,r,t,a)=>{let o=r.get(t);return o||(o=await e(),r.set(t,o,a)),o},ne=(e,r,t=new Error("Promise timed out"))=>{const a=new Promise(((e,a)=>{setTimeout((()=>{a(t)}),r)}));return Promise.race([e,a])},ie=()=>process.env.IS_OFFLINE&&"dev"===process.env.STAGE?"local":process.env.STAGE??"production"??"dev",le=()=>"local"===ie(),de=()=>"test"===ie(),ce=()=>"dev"===ie(),ue=()=>"prod"===ie(),pe=e=>{const r=e.base,t=e[ie()]??{};return ae()(r,t)};return r})()));
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { logger, withRequest } from '@spytecgps/sdk-logger';
|
|
2
|
-
export { logger, withRequest };
|
|
1
|
+
import { logger, withRequest } from '@spytecgps/sdk-logger';
|
|
2
|
+
export { logger, withRequest };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = exports.isTest = exports.isLocal = void 0;
|
|
4
|
+
var winston_1 = require("winston");
|
|
5
|
+
var winston_console_format_1 = require("winston-console-format");
|
|
6
|
+
var combine = winston_1.format.combine, errors = winston_1.format.errors, json = winston_1.format.json, timestamp = winston_1.format.timestamp, colorize = winston_1.format.colorize, padLevels = winston_1.format.padLevels;
|
|
7
|
+
exports.isLocal = function () { return !!process.env.IS_OFFLINE; };
|
|
8
|
+
exports.isTest = function () { return process.env.NODE_ENV == 'test'; };
|
|
9
|
+
var replaceError = function (_a) {
|
|
10
|
+
var label = _a.label, level = _a.level, message = _a.message, stack = _a.stack;
|
|
11
|
+
return ({
|
|
12
|
+
label: label,
|
|
13
|
+
level: level,
|
|
14
|
+
message: message,
|
|
15
|
+
stack: stack,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
var replacer = function (_key, value) {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
return value instanceof Error ? replaceError(value) : value;
|
|
21
|
+
};
|
|
22
|
+
function getDevFormat() {
|
|
23
|
+
return combine(timestamp(), colorize({ all: true }), padLevels(), winston_console_format_1.consoleFormat({
|
|
24
|
+
showMeta: true,
|
|
25
|
+
metaStrip: [
|
|
26
|
+
'timestamp',
|
|
27
|
+
'service',
|
|
28
|
+
'requestId',
|
|
29
|
+
'x-correlation-id',
|
|
30
|
+
'function',
|
|
31
|
+
'contextUserId',
|
|
32
|
+
'contextUserEmail',
|
|
33
|
+
],
|
|
34
|
+
inspectOptions: {
|
|
35
|
+
depth: Infinity,
|
|
36
|
+
colors: true,
|
|
37
|
+
maxArrayLength: Infinity,
|
|
38
|
+
breakLength: 120,
|
|
39
|
+
compact: Infinity,
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function getProductionFormat() {
|
|
44
|
+
return combine(errors({ stack: true }), timestamp(), json({ replacer: replacer }));
|
|
45
|
+
}
|
|
46
|
+
function getFormat() {
|
|
47
|
+
if (exports.isTest() || exports.isLocal()) {
|
|
48
|
+
return getDevFormat();
|
|
49
|
+
}
|
|
50
|
+
return getProductionFormat();
|
|
51
|
+
}
|
|
52
|
+
exports.logger = winston_1.createLogger({
|
|
53
|
+
level: exports.isTest() || exports.isLocal() ? 'info' : 'verbose',
|
|
54
|
+
defaultMeta: {},
|
|
55
|
+
format: getFormat(),
|
|
56
|
+
transports: [new winston_1.transports.Console()],
|
|
57
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const contextualLogger: () => {
|
|
2
|
-
before: ({ event, context }: {
|
|
3
|
-
event: any;
|
|
4
|
-
context: any;
|
|
5
|
-
}) => Promise<void>;
|
|
6
|
-
};
|
|
7
|
-
export declare const contextualLoggerMiddleware: {
|
|
8
|
-
before: ({ event, context }: {
|
|
9
|
-
event: any;
|
|
10
|
-
context: any;
|
|
11
|
-
}) => Promise<void>;
|
|
12
|
-
};
|
|
1
|
+
export declare const contextualLogger: () => {
|
|
2
|
+
before: ({ event, context }: {
|
|
3
|
+
event: any;
|
|
4
|
+
context: any;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const contextualLoggerMiddleware: {
|
|
8
|
+
before: ({ event, context }: {
|
|
9
|
+
event: any;
|
|
10
|
+
context: any;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.contextualLoggerMiddleware = exports.contextualLogger = void 0;
|
|
40
|
+
var logger_1 = require("../logger/logger");
|
|
41
|
+
var AMAZON_TRACE_ID = '_X_AMZN_TRACE_ID';
|
|
42
|
+
var CORRELATION_HEADER = 'x-correlation-';
|
|
43
|
+
var CORRELATION_ID = CORRELATION_HEADER + "id";
|
|
44
|
+
var CORRELATION_TRACE_ID = CORRELATION_HEADER + "trace-id";
|
|
45
|
+
/**
|
|
46
|
+
* Adapted from https://github.com/FormidableLabs/pino-lambda/blob/master/src/request.ts
|
|
47
|
+
*/
|
|
48
|
+
exports.contextualLogger = function () {
|
|
49
|
+
var ctx = logger_1.logger.defaultMeta;
|
|
50
|
+
var before = function (_a) {
|
|
51
|
+
var event = _a.event, context = _a.context;
|
|
52
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var apiEvent_1;
|
|
54
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
55
|
+
return __generator(this, function (_j) {
|
|
56
|
+
if (context) {
|
|
57
|
+
ctx.requestId = context === null || context === void 0 ? void 0 : context.awsRequestId;
|
|
58
|
+
ctx.function = context.functionName;
|
|
59
|
+
}
|
|
60
|
+
if (!ctx.requestId) {
|
|
61
|
+
ctx.requestId = (_b = event === null || event === void 0 ? void 0 : event.requestContext) === null || _b === void 0 ? void 0 : _b.requestId;
|
|
62
|
+
}
|
|
63
|
+
if (Object(event).hasOwnProperty('headers')) {
|
|
64
|
+
apiEvent_1 = event;
|
|
65
|
+
Object.keys(apiEvent_1).forEach(function (header) {
|
|
66
|
+
if (header.toLowerCase().startsWith(CORRELATION_HEADER)) {
|
|
67
|
+
ctx[header] = apiEvent_1[header];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (process.env[AMAZON_TRACE_ID]) {
|
|
72
|
+
ctx[CORRELATION_TRACE_ID] = process.env[AMAZON_TRACE_ID];
|
|
73
|
+
}
|
|
74
|
+
if (!ctx[CORRELATION_ID]) {
|
|
75
|
+
ctx[CORRELATION_ID] = context === null || context === void 0 ? void 0 : context.awsRequestId;
|
|
76
|
+
}
|
|
77
|
+
ctx.contextUserId = (_e = (_d = (_c = event === null || event === void 0 ? void 0 : event.requestContext) === null || _c === void 0 ? void 0 : _c.authorizer) === null || _d === void 0 ? void 0 : _d.claims) === null || _e === void 0 ? void 0 : _e.userId;
|
|
78
|
+
ctx.contextUserEmail = (_h = (_g = (_f = event === null || event === void 0 ? void 0 : event.requestContext) === null || _f === void 0 ? void 0 : _f.authorizer) === null || _g === void 0 ? void 0 : _g.claims) === null || _h === void 0 ? void 0 : _h.email;
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
before: before,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
exports.contextualLoggerMiddleware = exports.contextualLogger();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import rawMiddy from '@middy/core';
|
|
2
|
-
import httpErrorHandler from '@middy/http-error-handler';
|
|
3
|
-
import httpResponseSerializer from '@middy/http-response-serializer';
|
|
4
|
-
import sqsJsonBodyParser from '@middy/sqs-json-body-parser';
|
|
5
|
-
import { Context as LambdaContext } from 'aws-lambda/handler';
|
|
6
|
-
import { MiddyInputHandler } from './types';
|
|
7
|
-
import { validatorMiddleware } from './validation';
|
|
8
|
-
import { warmupMiddleware } from './warmup';
|
|
9
|
-
declare const baseMiddlewares: ({
|
|
10
|
-
before: (request: any) => string;
|
|
11
|
-
} | {
|
|
12
|
-
before: ({ event, context }: {
|
|
13
|
-
event: any;
|
|
14
|
-
context: any;
|
|
15
|
-
}) => Promise<void>;
|
|
16
|
-
} | rawMiddy.MiddlewareObj<any, any, Error, LambdaContext>)[];
|
|
17
|
-
declare const apiGatewayMiddlewares: (rawMiddy.MiddlewareObj<any, any, Error, LambdaContext> | {
|
|
18
|
-
after: (req: any) => void;
|
|
19
|
-
onError: (req: any) => void;
|
|
20
|
-
})[];
|
|
21
|
-
declare const middy: <TEvent, TResult, TContext extends LambdaContext>(handler: MiddyInputHandler<TEvent, TResult, TContext>) => rawMiddy.MiddyfiedHandler<TEvent, TResult, Error, TContext>;
|
|
22
|
-
declare const apiGatewayMiddy: <TEvent, TResult, TContext extends LambdaContext>(handler: MiddyInputHandler<TEvent, TResult, TContext>) => rawMiddy.MiddyfiedHandler<TEvent, TResult, Error, TContext>;
|
|
23
|
-
export { apiGatewayMiddlewares, apiGatewayMiddy, baseMiddlewares, httpErrorHandler, httpResponseSerializer, middy, sqsJsonBodyParser, validatorMiddleware, warmupMiddleware, };
|
|
1
|
+
import rawMiddy from '@middy/core';
|
|
2
|
+
import httpErrorHandler from '@middy/http-error-handler';
|
|
3
|
+
import httpResponseSerializer from '@middy/http-response-serializer';
|
|
4
|
+
import sqsJsonBodyParser from '@middy/sqs-json-body-parser';
|
|
5
|
+
import { Context as LambdaContext } from 'aws-lambda/handler';
|
|
6
|
+
import { MiddyInputHandler } from './types';
|
|
7
|
+
import { validatorMiddleware } from './validation';
|
|
8
|
+
import { warmupMiddleware } from './warmup';
|
|
9
|
+
declare const baseMiddlewares: ({
|
|
10
|
+
before: (request: any) => string;
|
|
11
|
+
} | {
|
|
12
|
+
before: ({ event, context }: {
|
|
13
|
+
event: any;
|
|
14
|
+
context: any;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
} | rawMiddy.MiddlewareObj<any, any, Error, LambdaContext>)[];
|
|
17
|
+
declare const apiGatewayMiddlewares: (rawMiddy.MiddlewareObj<any, any, Error, LambdaContext> | {
|
|
18
|
+
after: (req: any) => void;
|
|
19
|
+
onError: (req: any) => void;
|
|
20
|
+
})[];
|
|
21
|
+
declare const middy: <TEvent, TResult, TContext extends LambdaContext>(handler: MiddyInputHandler<TEvent, TResult, TContext>) => rawMiddy.MiddyfiedHandler<TEvent, TResult, Error, TContext>;
|
|
22
|
+
declare const apiGatewayMiddy: <TEvent, TResult, TContext extends LambdaContext>(handler: MiddyInputHandler<TEvent, TResult, TContext>) => rawMiddy.MiddyfiedHandler<TEvent, TResult, Error, TContext>;
|
|
23
|
+
export { apiGatewayMiddlewares, apiGatewayMiddy, baseMiddlewares, httpErrorHandler, httpResponseSerializer, middy, sqsJsonBodyParser, validatorMiddleware, warmupMiddleware, };
|