aws-service-stack 0.10.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/_examples/model/user.model.d.ts +6 -0
- package/dist/_examples/model/user.model.js +3 -0
- package/dist/_examples/model/user.model.js.map +1 -0
- package/dist/controller/base-controller.d.ts +34 -0
- package/dist/controller/base-controller.js +151 -0
- package/dist/controller/base-controller.js.map +1 -0
- package/dist/controller/index.d.ts +1 -0
- package/dist/controller/index.js +18 -0
- package/dist/controller/index.js.map +1 -0
- package/dist/exception/errors.d.ts +32 -0
- package/dist/exception/errors.js +46 -0
- package/dist/exception/errors.js.map +1 -0
- package/dist/exception/exception-handler.d.ts +238 -0
- package/dist/exception/exception-handler.js +112 -0
- package/dist/exception/exception-handler.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/model/base.model.d.ts +64 -0
- package/dist/model/base.model.js +20 -0
- package/dist/model/base.model.js.map +1 -0
- package/dist/model/cognito-user.model.d.ts +12 -0
- package/dist/model/cognito-user.model.js +3 -0
- package/dist/model/cognito-user.model.js.map +1 -0
- package/dist/model/filter.model.d.ts +46 -0
- package/dist/model/filter.model.js +22 -0
- package/dist/model/filter.model.js.map +1 -0
- package/dist/model/http.model.d.ts +7 -0
- package/dist/model/http.model.js +12 -0
- package/dist/model/http.model.js.map +1 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.js +21 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/schema-validation.d.ts +20 -0
- package/dist/model/schema-validation.js +91 -0
- package/dist/model/schema-validation.js.map +1 -0
- package/dist/provider/apigateway.d.ts +4 -0
- package/dist/provider/apigateway.js +28 -0
- package/dist/provider/apigateway.js.map +1 -0
- package/dist/provider/dynamodb.d.ts +3 -0
- package/dist/provider/dynamodb.js +18 -0
- package/dist/provider/dynamodb.js.map +1 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.js +20 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/opensearch.d.ts +4 -0
- package/dist/provider/opensearch.js +34 -0
- package/dist/provider/opensearch.js.map +1 -0
- package/dist/repositories/base-core.repo.interface.d.ts +129 -0
- package/dist/repositories/base-core.repo.interface.js +3 -0
- package/dist/repositories/base-core.repo.interface.js.map +1 -0
- package/dist/repositories/base-db.repo.d.ts +78 -0
- package/dist/repositories/base-db.repo.interface.d.ts +61 -0
- package/dist/repositories/base-db.repo.interface.js +3 -0
- package/dist/repositories/base-db.repo.interface.js.map +1 -0
- package/dist/repositories/base-db.repo.js +471 -0
- package/dist/repositories/base-db.repo.js.map +1 -0
- package/dist/repositories/base-es.repo.d.ts +31 -0
- package/dist/repositories/base-es.repo.interface.d.ts +13 -0
- package/dist/repositories/base-es.repo.interface.js +3 -0
- package/dist/repositories/base-es.repo.interface.js.map +1 -0
- package/dist/repositories/base-es.repo.js +148 -0
- package/dist/repositories/base-es.repo.js.map +1 -0
- package/dist/repositories/index.d.ts +4 -0
- package/dist/repositories/index.js +21 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/service/api.services/api.service.d.ts +11 -0
- package/dist/service/api.services/api.service.interface.d.ts +8 -0
- package/dist/service/api.services/api.service.interface.js +3 -0
- package/dist/service/api.services/api.service.interface.js.map +1 -0
- package/dist/service/api.services/api.service.js +103 -0
- package/dist/service/api.services/api.service.js.map +1 -0
- package/dist/service/api.services/index.d.ts +2 -0
- package/dist/service/api.services/index.js +19 -0
- package/dist/service/api.services/index.js.map +1 -0
- package/dist/service/auth.service.d.ts +8 -0
- package/dist/service/auth.service.interface.d.ts +6 -0
- package/dist/service/auth.service.interface.js +3 -0
- package/dist/service/auth.service.interface.js.map +1 -0
- package/dist/service/auth.service.js +90 -0
- package/dist/service/auth.service.js.map +1 -0
- package/dist/service/base.service.d.ts +39 -0
- package/dist/service/base.service.interface.d.ts +106 -0
- package/dist/service/base.service.interface.js +3 -0
- package/dist/service/base.service.interface.js.map +1 -0
- package/dist/service/base.service.js +167 -0
- package/dist/service/base.service.js.map +1 -0
- package/dist/service/index.d.ts +5 -0
- package/dist/service/index.js +22 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/key-aws.services.d.ts +6 -0
- package/dist/service/key-aws.services.js +48 -0
- package/dist/service/key-aws.services.js.map +1 -0
- package/dist/service/key.services.interface.d.ts +3 -0
- package/dist/service/key.services.interface.js +3 -0
- package/dist/service/key.services.interface.js.map +1 -0
- package/dist/service/socket.service.d.ts +6 -0
- package/dist/service/socket.service.interface.d.ts +3 -0
- package/dist/service/socket.service.interface.js +3 -0
- package/dist/service/socket.service.interface.js.map +1 -0
- package/dist/service/socket.service.js +33 -0
- package/dist/service/socket.service.js.map +1 -0
- package/dist/service/validation.service.interface.d.ts +2 -0
- package/dist/service/validation.service.interface.js +3 -0
- package/dist/service/validation.service.interface.js.map +1 -0
- package/dist/utils/auth.util.d.ts +13 -0
- package/dist/utils/auth.util.js +17 -0
- package/dist/utils/auth.util.js.map +1 -0
- package/dist/utils/dynamodb.utils.d.ts +43 -0
- package/dist/utils/dynamodb.utils.js +303 -0
- package/dist/utils/dynamodb.utils.js.map +1 -0
- package/dist/utils/env.util.d.ts +1 -0
- package/dist/utils/env.util.js +14 -0
- package/dist/utils/env.util.js.map +1 -0
- package/dist/utils/error.util.d.ts +1 -0
- package/dist/utils/error.util.js +5 -0
- package/dist/utils/error.util.js.map +1 -0
- package/dist/utils/file-handler.d.ts +14 -0
- package/dist/utils/file-handler.js +216 -0
- package/dist/utils/file-handler.js.map +1 -0
- package/dist/utils/http.util.d.ts +27 -0
- package/dist/utils/http.util.js +133 -0
- package/dist/utils/http.util.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json.util.d.ts +1 -0
- package/dist/utils/json.util.js +20 -0
- package/dist/utils/json.util.js.map +1 -0
- package/dist/utils/opensearch.utils.d.ts +40 -0
- package/dist/utils/opensearch.utils.js +293 -0
- package/dist/utils/opensearch.utils.js.map +1 -0
- package/dist/utils/reflection.util.d.ts +20 -0
- package/dist/utils/reflection.util.js +154 -0
- package/dist/utils/reflection.util.js.map +1 -0
- package/dist/utils/validation.util.d.ts +13 -0
- package/dist/utils/validation.util.js +90 -0
- package/dist/utils/validation.util.js.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTTP = exports.errorHandlerHttp = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
const errorHandlerHttp = (error) => {
|
|
6
|
+
const httpStatus = exports.HTTP;
|
|
7
|
+
const msg = error === null || error === void 0 ? void 0 : error.message;
|
|
8
|
+
let response = httpStatus.INTERNAL_SERVER_ERROR;
|
|
9
|
+
let responseMsg = msg;
|
|
10
|
+
let data = error === null || error === void 0 ? void 0 : error.data;
|
|
11
|
+
if (error instanceof errors_1.ErrorValidation) {
|
|
12
|
+
response = httpStatus.BAD_REQUEST;
|
|
13
|
+
response.error = response.error + " - Validation Error";
|
|
14
|
+
// responseMsg = error.validation
|
|
15
|
+
responseMsg = Object.fromEntries(error.validation.entries());
|
|
16
|
+
data = error.content;
|
|
17
|
+
}
|
|
18
|
+
else if (error instanceof errors_1.ErrorHttp) {
|
|
19
|
+
response.code = error.statusCode;
|
|
20
|
+
response.error = error.error;
|
|
21
|
+
responseMsg = error.message;
|
|
22
|
+
data = error.data;
|
|
23
|
+
}
|
|
24
|
+
else if (error instanceof errors_1.ErrorDynamoDB) {
|
|
25
|
+
const err = error;
|
|
26
|
+
if (msg.includes("ConditionalCheckFailedException")) {
|
|
27
|
+
response = httpStatus.CONFLICT;
|
|
28
|
+
response.error = response.error + " - DynamoDB Error";
|
|
29
|
+
responseMsg =
|
|
30
|
+
`ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}, error: ` +
|
|
31
|
+
JSON.stringify(err);
|
|
32
|
+
}
|
|
33
|
+
else if (msg.includes("ResourceNotFoundException")) {
|
|
34
|
+
response = httpStatus.NOT_FOUND;
|
|
35
|
+
responseMsg = `Resource not found: ${err.tableName}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
statusCode: response.code,
|
|
40
|
+
content: {
|
|
41
|
+
error: response.error,
|
|
42
|
+
message: responseMsg,
|
|
43
|
+
data: data,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.errorHandlerHttp = errorHandlerHttp;
|
|
48
|
+
exports.HTTP = {
|
|
49
|
+
// 1xx Informational
|
|
50
|
+
CONTINUE: { error: "Continue", code: 100 },
|
|
51
|
+
SWITCHING_PROTOCOLS: { error: "Switching Protocols", code: 101 },
|
|
52
|
+
PROCESSING: { error: "Processing", code: 102 },
|
|
53
|
+
// 2xx Success
|
|
54
|
+
OK: { error: "OK", code: 200 },
|
|
55
|
+
CREATED: { error: "Created", code: 201 },
|
|
56
|
+
ACCEPTED: { error: "Accepted", code: 202 },
|
|
57
|
+
NON_AUTHORITATIVE_INFORMATION: { error: "Non-Authoritative Information", code: 203 },
|
|
58
|
+
NO_CONTENT: { error: "No Content", code: 204 },
|
|
59
|
+
RESET_CONTENT: { error: "Reset Content", code: 205 },
|
|
60
|
+
PARTIAL_CONTENT: { error: "Partial Content", code: 206 },
|
|
61
|
+
// 3xx Redirection
|
|
62
|
+
MULTIPLE_CHOICES: { error: "Multiple Choices", code: 300 },
|
|
63
|
+
MOVED_PERMANENTLY: { error: "Moved Permanently", code: 301 },
|
|
64
|
+
FOUND: { error: "Found", code: 302 },
|
|
65
|
+
SEE_OTHER: { error: "See Other", code: 303 },
|
|
66
|
+
NOT_MODIFIED: { error: "Not Modified", code: 304 },
|
|
67
|
+
TEMPORARY_REDIRECT: { error: "Temporary Redirect", code: 307 },
|
|
68
|
+
PERMANENT_REDIRECT: { error: "Permanent Redirect", code: 308 },
|
|
69
|
+
// 4xx Client Errors
|
|
70
|
+
BAD_REQUEST: { error: "Bad Request", code: 400 },
|
|
71
|
+
UNAUTHORIZED: { error: "Unauthorized", code: 401 },
|
|
72
|
+
PAYMENT_REQUIRED: { error: "Payment Required", code: 402 },
|
|
73
|
+
FORBIDDEN: { error: "Forbidden", code: 403 },
|
|
74
|
+
NOT_FOUND: { error: "Not Found", code: 404 },
|
|
75
|
+
METHOD_NOT_ALLOWED: { error: "Method Not Allowed", code: 405 },
|
|
76
|
+
NOT_ACCEPTABLE: { error: "Not Acceptable", code: 406 },
|
|
77
|
+
PROXY_AUTHENTICATION_REQUIRED: { error: "Proxy Authentication Required", code: 407 },
|
|
78
|
+
REQUEST_TIMEOUT: { error: "Request Timeout", code: 408 },
|
|
79
|
+
CONFLICT: { error: "Conflict", code: 409 },
|
|
80
|
+
GONE: { error: "Gone", code: 410 },
|
|
81
|
+
LENGTH_REQUIRED: { error: "Length Required", code: 411 },
|
|
82
|
+
PRECONDITION_FAILED: { error: "Precondition Failed", code: 412 },
|
|
83
|
+
PAYLOAD_TOO_LARGE: { error: "Payload Too Large", code: 413 },
|
|
84
|
+
URI_TOO_LONG: { error: "URI Too Long", code: 414 },
|
|
85
|
+
UNSUPPORTED_MEDIA_TYPE: { error: "Unsupported Media Type", code: 415 },
|
|
86
|
+
RANGE_NOT_SATISFIABLE: { error: "Range Not Satisfiable", code: 416 },
|
|
87
|
+
EXPECTATION_FAILED: { error: "Expectation Failed", code: 417 },
|
|
88
|
+
IM_A_TEAPOT: { error: "I'm a teapot", code: 418 },
|
|
89
|
+
MISDIRECTED_REQUEST: { error: "Misdirected Request", code: 421 },
|
|
90
|
+
UNPROCESSABLE_ENTITY: { error: "Unprocessable Entity", code: 422 },
|
|
91
|
+
LOCKED: { error: "Locked", code: 423 },
|
|
92
|
+
FAILED_DEPENDENCY: { error: "Failed Dependency", code: 424 },
|
|
93
|
+
TOO_EARLY: { error: "Too Early", code: 425 },
|
|
94
|
+
UPGRADE_REQUIRED: { error: "Upgrade Required", code: 426 },
|
|
95
|
+
PRECONDITION_REQUIRED: { error: "Precondition Required", code: 428 },
|
|
96
|
+
TOO_MANY_REQUESTS: { error: "Too Many Requests", code: 429 },
|
|
97
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: { error: "Request Header Fields Too Large", code: 431 },
|
|
98
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: { error: "Unavailable For Legal Reasons", code: 451 },
|
|
99
|
+
// 5xx Server Errors
|
|
100
|
+
INTERNAL_SERVER_ERROR: { error: "Internal Server Error", code: 500 },
|
|
101
|
+
NOT_IMPLEMENTED: { error: "Not Implemented", code: 501 },
|
|
102
|
+
BAD_GATEWAY: { error: "Bad Gateway", code: 502 },
|
|
103
|
+
SERVICE_UNAVAILABLE: { error: "Service Unavailable", code: 503 },
|
|
104
|
+
GATEWAY_TIMEOUT: { error: "Gateway Timeout", code: 504 },
|
|
105
|
+
HTTP_VERSION_NOT_SUPPORTED: { error: "HTTP Version Not Supported", code: 505 },
|
|
106
|
+
VARIANT_ALSO_NEGOTIATES: { error: "Variant Also Negotiates", code: 506 },
|
|
107
|
+
INSUFFICIENT_STORAGE: { error: "Insufficient Storage", code: 507 },
|
|
108
|
+
LOOP_DETECTED: { error: "Loop Detected", code: 508 },
|
|
109
|
+
NOT_EXTENDED: { error: "Not Extended", code: 510 },
|
|
110
|
+
NETWORK_AUTHENTICATION_REQUIRED: { error: "Network Authentication Required", code: 511 },
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=exception-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception-handler.js","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":";;;AAAA,qCAAqE;AAE9D,MAAM,gBAAgB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC7C,MAAM,UAAU,GAAG,YAAI,CAAC;IAExB,MAAM,GAAG,GAAG,KAAK,aAAL,KAAK,uB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IAAI,EAAE,GAAG,EAAE;IAC5D,+BAA+B,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;IACxF,6BAA6B,EAAE,EAAE,KAAK,EAAE,+BAA+B,EAAE,IAAI,EAAE,GAAG,EAAE;IAEpF,oBAAoB;IACpB,qBAAqB,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;IACpE,eAAe,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACxD,WAAW,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE;IAChD,mBAAmB,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,EAAE;IAChE,eAAe,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACxD,0BAA0B,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9E,uBAAuB,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,GAAG,EAAE;IACxE,oBAAoB,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,GAAG,EAAE;IAClE,aAAa,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE;IACpD,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;IAClD,+BAA+B,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACzF,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./model"), exports);
|
|
18
|
+
__exportStar(require("./repositories"), exports);
|
|
19
|
+
__exportStar(require("./service"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./controller"), exports);
|
|
22
|
+
__exportStar(require("./provider"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,iDAA+B;AAC/B,4CAA0B;AAC1B,0CAAwB;AACxB,+CAA6B;AAC7B,6CAA2B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface BaseEntity {
|
|
2
|
+
id?: string;
|
|
3
|
+
username?: string;
|
|
4
|
+
createdAt?: string;
|
|
5
|
+
updatedAt?: string;
|
|
6
|
+
createdDate?: string;
|
|
7
|
+
updatedDate?: string;
|
|
8
|
+
createdBy?: string | any;
|
|
9
|
+
updatedBy?: string | any;
|
|
10
|
+
ownerId?: string;
|
|
11
|
+
permission?: Map<string, Permission[]>;
|
|
12
|
+
__typename?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare enum Permission {
|
|
15
|
+
READ = "READ",
|
|
16
|
+
DELETE = "DELETE",
|
|
17
|
+
UPDATE = "UPDATE"
|
|
18
|
+
}
|
|
19
|
+
export interface Attachment {
|
|
20
|
+
thumbnail: string;
|
|
21
|
+
original: string;
|
|
22
|
+
}
|
|
23
|
+
export type GetItems<T> = {
|
|
24
|
+
items: Array<T>;
|
|
25
|
+
total?: number;
|
|
26
|
+
nextToken?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare enum SortType {
|
|
29
|
+
ASC = "asc",
|
|
30
|
+
DESC = "desc"
|
|
31
|
+
}
|
|
32
|
+
export type GetParamPageable = {
|
|
33
|
+
page: string;
|
|
34
|
+
limit: number;
|
|
35
|
+
sort: SortType;
|
|
36
|
+
direction?: string;
|
|
37
|
+
};
|
|
38
|
+
export type KeywordSearchable = {
|
|
39
|
+
keyword?: string;
|
|
40
|
+
};
|
|
41
|
+
export type GetParamRangeDate = {
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
};
|
|
45
|
+
export interface FilterAndSort extends Record<string, any> {
|
|
46
|
+
page?: number;
|
|
47
|
+
size?: number;
|
|
48
|
+
sortBy?: string;
|
|
49
|
+
sort?: SortOrder;
|
|
50
|
+
searchBy?: string;
|
|
51
|
+
searchKeyword?: string;
|
|
52
|
+
rangeFilterBy?: string;
|
|
53
|
+
rangeFilterMin?: number | string;
|
|
54
|
+
rangeFilterMax?: number | string;
|
|
55
|
+
lastKey?: string;
|
|
56
|
+
indexName?: string;
|
|
57
|
+
indexValue?: string;
|
|
58
|
+
fieldsInclude?: string[];
|
|
59
|
+
fieldsExclude?: string[];
|
|
60
|
+
}
|
|
61
|
+
export declare enum SortOrder {
|
|
62
|
+
ASC = "asc",
|
|
63
|
+
DESC = "desc"
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SortOrder = exports.SortType = exports.Permission = void 0;
|
|
4
|
+
var Permission;
|
|
5
|
+
(function (Permission) {
|
|
6
|
+
Permission["READ"] = "READ";
|
|
7
|
+
Permission["DELETE"] = "DELETE";
|
|
8
|
+
Permission["UPDATE"] = "UPDATE";
|
|
9
|
+
})(Permission || (exports.Permission = Permission = {}));
|
|
10
|
+
var SortType;
|
|
11
|
+
(function (SortType) {
|
|
12
|
+
SortType["ASC"] = "asc";
|
|
13
|
+
SortType["DESC"] = "desc";
|
|
14
|
+
})(SortType || (exports.SortType = SortType = {}));
|
|
15
|
+
var SortOrder;
|
|
16
|
+
(function (SortOrder) {
|
|
17
|
+
SortOrder["ASC"] = "asc";
|
|
18
|
+
SortOrder["DESC"] = "desc";
|
|
19
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
20
|
+
//# sourceMappingURL=base.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.model.js","sourceRoot":"","sources":["../../src/model/base.model.ts"],"names":[],"mappings":";;;AAcA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAaD,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAmCD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CognitoUser = {
|
|
2
|
+
sub: string;
|
|
3
|
+
iss?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
client_id?: string;
|
|
6
|
+
aud?: string;
|
|
7
|
+
exp?: string;
|
|
8
|
+
Authorization?: string;
|
|
9
|
+
identityId?: string;
|
|
10
|
+
token_use: "id" | "access" | "pre-authorization";
|
|
11
|
+
phone_number?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognito-user.model.js","sourceRoot":"","sources":["../../src/model/cognito-user.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface DynamoDbFilter {
|
|
2
|
+
keyConditionExpression?: string;
|
|
3
|
+
filterExpression?: string;
|
|
4
|
+
expressionAttributeNames?: {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
expressionAttributeValues?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
scanIndexForward?: boolean;
|
|
11
|
+
size?: number;
|
|
12
|
+
startAt?: string;
|
|
13
|
+
getAllItems?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface DynamoDbListResponse<T> {
|
|
16
|
+
items: Array<T>;
|
|
17
|
+
lastKey?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* map key is indexName, field: indexField, rField: related field names list
|
|
21
|
+
* */
|
|
22
|
+
export declare class DynamoIndexMap extends Map<string, {
|
|
23
|
+
field: string;
|
|
24
|
+
rFields: string[];
|
|
25
|
+
sortKeyField?: string;
|
|
26
|
+
fieldSeparator?: string;
|
|
27
|
+
}> {
|
|
28
|
+
partitionKey: string;
|
|
29
|
+
numberFields?: string[];
|
|
30
|
+
listFields?: string[];
|
|
31
|
+
mapFields?: string[];
|
|
32
|
+
booleanFields?: string[];
|
|
33
|
+
setFields(partitionKey?: string, numberFields?: string[], arrayFields?: string[], booleanFields?: string[], mapFields?: string[]): DynamoIndexMap;
|
|
34
|
+
}
|
|
35
|
+
export interface List<T> {
|
|
36
|
+
items: Array<T>;
|
|
37
|
+
lastKey?: string;
|
|
38
|
+
}
|
|
39
|
+
export type NumberRange = {
|
|
40
|
+
gte?: number;
|
|
41
|
+
lte?: number;
|
|
42
|
+
};
|
|
43
|
+
export type DateRange = {
|
|
44
|
+
gte?: string;
|
|
45
|
+
lte?: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoIndexMap = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* map key is indexName, field: indexField, rField: related field names list
|
|
6
|
+
* */
|
|
7
|
+
class DynamoIndexMap extends Map {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.partitionKey = "id";
|
|
11
|
+
}
|
|
12
|
+
setFields(partitionKey, numberFields, arrayFields, booleanFields, mapFields) {
|
|
13
|
+
this.partitionKey = partitionKey;
|
|
14
|
+
this.numberFields = numberFields;
|
|
15
|
+
this.listFields = arrayFields;
|
|
16
|
+
this.booleanFields = booleanFields;
|
|
17
|
+
this.mapFields = mapFields;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.DynamoIndexMap = DynamoIndexMap;
|
|
22
|
+
//# sourceMappingURL=filter.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.model.js","sourceRoot":"","sources":["../../src/model/filter.model.ts"],"names":[],"mappings":";;;AAmBA;;KAEK;AACL,MAAa,cAAe,SAAQ,GAQnC;IARD;;QASE,iBAAY,GAAW,IAAI,CAAC;IAoB9B,CAAC;IAdC,SAAS,CACP,YAAqB,EACrB,YAAuB,EACvB,WAAsB,EACtB,aAAwB,EACxB,SAAoB;QAEpB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA7BD,wCA6BC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpMethod = void 0;
|
|
4
|
+
var HttpMethod;
|
|
5
|
+
(function (HttpMethod) {
|
|
6
|
+
HttpMethod["GET"] = "GET";
|
|
7
|
+
HttpMethod["POST"] = "POST";
|
|
8
|
+
HttpMethod["PUT"] = "PUT";
|
|
9
|
+
HttpMethod["PATCH"] = "PATCH";
|
|
10
|
+
HttpMethod["DELETE"] = "DELETE";
|
|
11
|
+
})(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
|
|
12
|
+
//# sourceMappingURL=http.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.model.js","sourceRoot":"","sources":["../../src/model/http.model.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;AACnB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cognito-user.model"), exports);
|
|
18
|
+
__exportStar(require("./http.model"), exports);
|
|
19
|
+
__exportStar(require("./filter.model"), exports);
|
|
20
|
+
__exportStar(require("./base.model"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObjectSchema } from "yup";
|
|
2
|
+
import { ZodSchema } from "zod";
|
|
3
|
+
import { BaseEntity } from "../index.js";
|
|
4
|
+
export declare abstract class SchemaValidation {
|
|
5
|
+
abstract validate(value: any, fields?: string[]): boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class SchemaYup<T> extends SchemaValidation {
|
|
8
|
+
private schema;
|
|
9
|
+
constructor(schema: ObjectSchema<T>);
|
|
10
|
+
validate(value: BaseEntity, fields?: string[]): boolean;
|
|
11
|
+
private getSchemaForFields;
|
|
12
|
+
private validateWithSchema;
|
|
13
|
+
private handleValidationError;
|
|
14
|
+
private createValidationErrorMap;
|
|
15
|
+
}
|
|
16
|
+
export declare class SchemaZod<T> extends SchemaValidation {
|
|
17
|
+
private schema;
|
|
18
|
+
constructor(schema: ZodSchema<T>);
|
|
19
|
+
validate(value: any): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SchemaZod = exports.SchemaYup = exports.SchemaValidation = void 0;
|
|
37
|
+
const yup = __importStar(require("yup"));
|
|
38
|
+
const errors_1 = require("../exception/errors");
|
|
39
|
+
class SchemaValidation {
|
|
40
|
+
}
|
|
41
|
+
exports.SchemaValidation = SchemaValidation;
|
|
42
|
+
class SchemaYup extends SchemaValidation {
|
|
43
|
+
constructor(schema) {
|
|
44
|
+
super();
|
|
45
|
+
this.schema = schema;
|
|
46
|
+
}
|
|
47
|
+
validate(value, fields) {
|
|
48
|
+
const schemaToUse = this.getSchemaForFields(fields);
|
|
49
|
+
try {
|
|
50
|
+
this.validateWithSchema(schemaToUse, value);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.handleValidationError(error, value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getSchemaForFields(fields) {
|
|
58
|
+
if (!(fields === null || fields === void 0 ? void 0 : fields.length))
|
|
59
|
+
return this.schema;
|
|
60
|
+
return this.schema.pick(fields);
|
|
61
|
+
}
|
|
62
|
+
validateWithSchema(schema, value) {
|
|
63
|
+
schema.validateSync(value, {
|
|
64
|
+
abortEarly: false,
|
|
65
|
+
stripUnknown: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
handleValidationError(error, value) {
|
|
69
|
+
if (!(error instanceof yup.ValidationError)) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
const errorMap = this.createValidationErrorMap(error);
|
|
73
|
+
throw new errors_1.ErrorValidation(value.__typename, errorMap, value);
|
|
74
|
+
}
|
|
75
|
+
createValidationErrorMap(error) {
|
|
76
|
+
return new Map(error.inner.filter(({ path }) => path).map(({ path, message }) => [path, message]));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SchemaYup = SchemaYup;
|
|
80
|
+
class SchemaZod extends SchemaValidation {
|
|
81
|
+
constructor(schema) {
|
|
82
|
+
super();
|
|
83
|
+
this.schema = schema;
|
|
84
|
+
}
|
|
85
|
+
validate(value) {
|
|
86
|
+
const result = this.schema.safeParse(value);
|
|
87
|
+
return result.success;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.SchemaZod = SchemaZod;
|
|
91
|
+
//# sourceMappingURL=schema-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validation.js","sourceRoot":"","sources":["../../src/model/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AAC,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IAEO,wBAAwB,CAAC,KAA0B;QACzD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACtG,CAAC;CACF;AA3CD,8BA2CC;AAED,MAAa,SAAa,SAAQ,gBAAgB;IAGhD,YAAY,MAAoB;QAC9B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ,CAAC,KAAU;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF;AAZD,8BAYC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ApiGatewayManagement = void 0;
|
|
13
|
+
const client_apigatewaymanagementapi_1 = require("@aws-sdk/client-apigatewaymanagementapi");
|
|
14
|
+
const typedi_1 = require("typedi");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
let ApiGatewayManagement = class ApiGatewayManagement extends client_apigatewaymanagementapi_1.ApiGatewayManagementApiClient {
|
|
17
|
+
constructor() {
|
|
18
|
+
super({
|
|
19
|
+
endpoint: (0, utils_1.getEnvVariable)("WS_ENDPOINT"),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.ApiGatewayManagement = ApiGatewayManagement;
|
|
24
|
+
exports.ApiGatewayManagement = ApiGatewayManagement = __decorate([
|
|
25
|
+
(0, typedi_1.Service)("ApiGatewayManagement"),
|
|
26
|
+
__metadata("design:paramtypes", [])
|
|
27
|
+
], ApiGatewayManagement);
|
|
28
|
+
//# sourceMappingURL=apigateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apigateway.js","sourceRoot":"","sources":["../../src/provider/apigateway.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4FAAwF;AACxF,mCAAiC;AACjC,oCAA0C;AAGnC,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,8DAA6B;IACrE;QACE,KAAK,CAAC;YACJ,QAAQ,EAAE,IAAA,sBAAc,EAAC,aAAa,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AANY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,gBAAO,EAAC,sBAAsB,CAAC;;GACnB,oBAAoB,CAMhC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DBClientDynamoDB = void 0;
|
|
10
|
+
const typedi_1 = require("typedi");
|
|
11
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
12
|
+
let DBClientDynamoDB = class DBClientDynamoDB extends client_dynamodb_1.DynamoDBClient {
|
|
13
|
+
};
|
|
14
|
+
exports.DBClientDynamoDB = DBClientDynamoDB;
|
|
15
|
+
exports.DBClientDynamoDB = DBClientDynamoDB = __decorate([
|
|
16
|
+
(0, typedi_1.Service)("DBClientDynamoDB")
|
|
17
|
+
], DBClientDynamoDB);
|
|
18
|
+
//# sourceMappingURL=dynamodb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../src/provider/dynamodb.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AACjC,8DAA0D;AAGnD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,gCAAc;CAAG,CAAA;AAA1C,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,gBAAO,EAAC,kBAAkB,CAAC;GACf,gBAAgB,CAA0B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./apigateway"), exports);
|
|
18
|
+
__exportStar(require("./dynamodb"), exports);
|
|
19
|
+
__exportStar(require("./opensearch"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,6CAA2B;AAC3B,+CAA6B"}
|