@spytecgps/lambda-utils 1.0.0-rc8 → 1.0.1
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/errors/BadRequestError.d.ts +6 -6
- package/dist/errors/BadRequestError.js +28 -28
- package/dist/errors/HttpError.d.ts +8 -8
- package/dist/errors/HttpError.js +32 -32
- package/dist/errors/NotFoundError.d.ts +6 -6
- package/dist/errors/NotFoundError.js +28 -28
- package/dist/errors/UnauthorizedError.d.ts +6 -6
- package/dist/errors/UnauthorizedError.js +28 -28
- package/dist/errors/index.d.ts +4 -4
- package/dist/errors/index.js +12 -12
- package/dist/index.d.ts +6 -6
- package/dist/index.js +18 -18
- package/dist/logger/logger.d.ts +3 -3
- package/dist/logger/logger.js +57 -57
- package/dist/middleware/contextualLogger.d.ts +15 -15
- package/dist/middleware/contextualLogger.js +87 -87
- package/dist/middleware/index.d.ts +12 -12
- package/dist/middleware/index.js +62 -62
- package/dist/middleware/ioLogger.d.ts +1 -1
- package/dist/middleware/ioLogger.js +14 -14
- package/dist/middleware/middleware.test.d.ts +1 -1
- package/dist/middleware/middleware.test.js +167 -167
- package/dist/middleware/responseWrapper.d.ts +3 -3
- package/dist/middleware/responseWrapper.js +12 -12
- package/dist/middleware/types.d.ts +7 -7
- package/dist/middleware/types.js +2 -2
- package/dist/middleware/validation.d.ts +9 -9
- package/dist/middleware/validation.js +27 -27
- package/dist/types.d.ts +52 -52
- package/dist/types.js +2 -2
- package/dist/validation/custom.d.ts +16 -16
- package/dist/validation/custom.js +122 -122
- package/dist/validation/index.d.ts +4 -4
- package/dist/validation/index.js +20 -20
- package/dist/validation/requestContext.d.ts +14 -14
- package/dist/validation/requestContext.js +54 -54
- package/dist/validation/validateEvent.d.ts +3 -3
- package/dist/validation/validateEvent.js +25 -25
- package/dist/wrappers/apiGatewayEventWrapper.d.ts +4 -4
- package/dist/wrappers/apiGatewayEventWrapper.js +82 -82
- package/dist/wrappers/index.d.ts +4 -4
- package/dist/wrappers/index.js +21 -21
- package/dist/wrappers/response.d.ts +8 -8
- package/dist/wrappers/response.js +35 -35
- package/dist/wrappers/sqsEventWrapper.d.ts +3 -3
- package/dist/wrappers/sqsEventWrapper.js +116 -116
- package/package.json +1 -1
- package/dist/errors/BaseError.d.ts +0 -3
- package/dist/errors/BaseError.js +0 -24
|
@@ -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
|
+
}
|
|
@@ -1,28 +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
|
+
"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,8 +1,8 @@
|
|
|
1
|
-
export declare 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 declare 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
|
+
}
|
package/dist/errors/HttpError.js
CHANGED
|
@@ -1,32 +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
|
+
"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
|
+
}
|
|
@@ -1,28 +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
|
+
"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
|
+
}
|
|
@@ -1,28 +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;
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import BadRequestError from './BadRequestError';
|
|
2
|
-
import NotFoundError from './NotFoundError';
|
|
3
|
-
import UnauthorizedError from './UnauthorizedError';
|
|
4
|
-
export { BadRequestError, NotFoundError, UnauthorizedError };
|
|
1
|
+
import BadRequestError from './BadRequestError';
|
|
2
|
+
import NotFoundError from './NotFoundError';
|
|
3
|
+
import UnauthorizedError from './UnauthorizedError';
|
|
4
|
+
export { BadRequestError, NotFoundError, UnauthorizedError };
|
package/dist/errors/index.js
CHANGED
|
@@ -1,12 +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;
|
|
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,6 +1,6 @@
|
|
|
1
|
-
export * from './wrappers';
|
|
2
|
-
export * from './errors';
|
|
3
|
-
export * from './validation';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './middleware';
|
|
6
|
-
export * from './logger/logger';
|
|
1
|
+
export * from './wrappers';
|
|
2
|
+
export * from './errors';
|
|
3
|
+
export * from './validation';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './middleware';
|
|
6
|
+
export * from './logger/logger';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./wrappers"), exports);
|
|
14
|
-
__exportStar(require("./errors"), exports);
|
|
15
|
-
__exportStar(require("./validation"), exports);
|
|
16
|
-
__exportStar(require("./types"), exports);
|
|
17
|
-
__exportStar(require("./middleware"), exports);
|
|
18
|
-
__exportStar(require("./logger/logger"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./wrappers"), exports);
|
|
14
|
+
__exportStar(require("./errors"), exports);
|
|
15
|
+
__exportStar(require("./validation"), exports);
|
|
16
|
+
__exportStar(require("./types"), exports);
|
|
17
|
+
__exportStar(require("./middleware"), exports);
|
|
18
|
+
__exportStar(require("./logger/logger"), exports);
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const isLocal: () => boolean;
|
|
2
|
-
export declare const isTest: () => boolean;
|
|
3
|
-
export declare const logger: import("winston").Logger;
|
|
1
|
+
export declare const isLocal: () => boolean;
|
|
2
|
+
export declare const isTest: () => boolean;
|
|
3
|
+
export declare const logger: import("winston").Logger;
|
package/dist/logger/logger.js
CHANGED
|
@@ -1,57 +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
|
+
"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,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from https://github.com/FormidableLabs/pino-lambda/blob/master/src/request.ts
|
|
3
|
-
*/
|
|
4
|
-
export declare const contextualLogger: () => {
|
|
5
|
-
before: ({ event, context }: {
|
|
6
|
-
event: any;
|
|
7
|
-
context: any;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
export declare const contextualLoggerMiddleware: {
|
|
11
|
-
before: ({ event, context }: {
|
|
12
|
-
event: any;
|
|
13
|
-
context: any;
|
|
14
|
-
}) => Promise<void>;
|
|
15
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from https://github.com/FormidableLabs/pino-lambda/blob/master/src/request.ts
|
|
3
|
+
*/
|
|
4
|
+
export declare const contextualLogger: () => {
|
|
5
|
+
before: ({ event, context }: {
|
|
6
|
+
event: any;
|
|
7
|
+
context: any;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export declare const contextualLoggerMiddleware: {
|
|
11
|
+
before: ({ event, context }: {
|
|
12
|
+
event: any;
|
|
13
|
+
context: any;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
};
|