aws-service-stack 0.14.195 → 0.14.197
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/_examples/controller/e-order/e-order-crud.d.ts +1 -1
- package/dist/_examples/controller/entity/entity-config.d.ts +10 -0
- package/dist/_examples/controller/entity/entity-config.js +48 -0
- package/dist/_examples/controller/entity/entity-config.js.map +1 -0
- package/dist/_examples/controller/entity/entity-controller.d.ts +12 -0
- package/dist/_examples/controller/entity/entity-controller.js +118 -0
- package/dist/_examples/controller/entity/entity-controller.js.map +1 -0
- package/dist/_examples/controller/entity/entity-crud.d.ts +4 -0
- package/dist/_examples/controller/entity/entity-crud.js +73 -0
- package/dist/_examples/controller/entity/entity-crud.js.map +1 -0
- package/dist/_examples/controller/profile/profile-crud.d.ts +1 -1
- package/dist/_examples/controller/supplier/supplier-config.js.map +1 -1
- package/dist/_examples/controller/supplier/supplier-crud.d.ts +1 -1
- package/dist/_examples/model-shared/suppler.model.d.ts +48 -48
- package/dist/_examples/model-shared/supplier-portal.model.d.ts +22867 -0
- package/dist/_examples/model-shared/supplier-portal.model.js +1035 -0
- package/dist/_examples/model-shared/supplier-portal.model.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-db.d.ts +6 -0
- package/dist/_examples/repositories/entity/entity-repo-db.interface.d.ts +4 -0
- package/dist/_examples/repositories/entity/entity-repo-db.interface.js +3 -0
- package/dist/_examples/repositories/entity/entity-repo-db.interface.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-db.js +19 -0
- package/dist/_examples/repositories/entity/entity-repo-db.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.d.ts +3 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js +3 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.d.ts +0 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js +2 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-es.d.ts +6 -0
- package/dist/_examples/repositories/entity/entity-repo-es.interface.d.ts +4 -0
- package/dist/_examples/repositories/entity/entity-repo-es.interface.js +3 -0
- package/dist/_examples/repositories/entity/entity-repo-es.interface.js.map +1 -0
- package/dist/_examples/repositories/entity/entity-repo-es.js +19 -0
- package/dist/_examples/repositories/entity/entity-repo-es.js.map +1 -0
- package/dist/_examples/service/entity/entity-service.d.ts +13 -0
- package/dist/_examples/service/entity/entity-service.interface.d.ts +5 -0
- package/dist/_examples/service/entity/entity-service.interface.js +3 -0
- package/dist/_examples/service/entity/entity-service.interface.js.map +1 -0
- package/dist/_examples/service/entity/entity-service.js +102 -0
- package/dist/_examples/service/entity/entity-service.js.map +1 -0
- package/dist/controller/base-controller.js +10 -8
- package/dist/controller/base-controller.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +2 -2
- package/dist/utils/logger.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { APIGatewayProxyEvent } from "aws-lambda";
|
|
3
3
|
import "./e-order.controller";
|
|
4
|
-
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("
|
|
4
|
+
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("src/utils").APIResponse>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EntityConfigImpl } from "../../../index.js";
|
|
2
|
+
export declare const openSearch: {
|
|
3
|
+
domain: string;
|
|
4
|
+
index: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const path = "/supplier/entities";
|
|
7
|
+
export declare class EntityConfig extends EntityConfigImpl {
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare const CONFIG_ENTITY: EntityConfig;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG_ENTITY = exports.EntityConfig = exports.path = exports.openSearch = void 0;
|
|
4
|
+
const core_1 = require("../../../index.js");
|
|
5
|
+
// OPENSEARCH
|
|
6
|
+
exports.openSearch = {
|
|
7
|
+
domain: "https://search-amplify-opense-1qu4zfdauaeh1-ncvbubjnpcsfempstbsykhoadi.ap-southeast-1.es.amazonaws.com",
|
|
8
|
+
index: "entity",
|
|
9
|
+
};
|
|
10
|
+
exports.path = "/supplier/entities"; // url path base
|
|
11
|
+
// Entity configuration
|
|
12
|
+
class EntityConfig extends core_1.EntityConfigImpl {
|
|
13
|
+
constructor() {
|
|
14
|
+
// DYNAMODB
|
|
15
|
+
const tableName = "Entity-2i5o74z4mjf6lpabqp7myrkdre-dev";
|
|
16
|
+
const indexMap = new core_1.DynamoIndexMap()
|
|
17
|
+
.set("byISBN", { field: "isbn", rFields: ["isbn"] })
|
|
18
|
+
.set("byOriginalOwner", { field: "originalOwner", rFields: ["originalOwner"] })
|
|
19
|
+
.set("byStatusByUpdatedAt", { field: "status", rFields: ["status"] });
|
|
20
|
+
// PERMISSIONS
|
|
21
|
+
const ownerFieldName = "owner";
|
|
22
|
+
const adminGroupNames = ["adminUsers"];
|
|
23
|
+
const policies = [
|
|
24
|
+
{ method: core_1.HttpMethod.GET, path: `${exports.path}`, access: [core_1.Access.ADMIN] },
|
|
25
|
+
{ method: core_1.HttpMethod.GET, path: `${exports.path}/search`, access: [core_1.Access.ADMIN] },
|
|
26
|
+
{ method: core_1.HttpMethod.GET, path: `${exports.path}/{id}`, access: [core_1.Access.ADMIN] },
|
|
27
|
+
// { method: m.GET, path: `${path}/search-entities`, access: [a.PUBLIC] },
|
|
28
|
+
{ method: core_1.HttpMethod.GET, path: `${exports.path}/batch`, access: [core_1.Access.PUBLIC] },
|
|
29
|
+
{ method: core_1.HttpMethod.GET, path: `${exports.path}/details/{id}`, access: [core_1.Access.PUBLIC] },
|
|
30
|
+
{ method: core_1.HttpMethod.POST, path: `${exports.path}`, access: [core_1.Access.ADMIN] },
|
|
31
|
+
{ method: core_1.HttpMethod.POST, path: `${exports.path}/add`, access: [core_1.Access.USER] },
|
|
32
|
+
{ method: core_1.HttpMethod.PUT, path: `${exports.path}/{id}`, access: [core_1.Access.ADMIN] },
|
|
33
|
+
{ method: core_1.HttpMethod.PATCH, path: `${exports.path}/{id}`, access: [core_1.Access.ADMIN] },
|
|
34
|
+
{ method: core_1.HttpMethod.DELETE, path: `${exports.path}/{id}`, access: [core_1.Access.ADMIN] },
|
|
35
|
+
{ method: core_1.HttpMethod.GET, path: `/entities/{id}`, access: [core_1.Access.PUBLIC] }, // TODO remove later
|
|
36
|
+
{ method: core_1.HttpMethod.GET, path: `/entities/batch`, access: [core_1.Access.PUBLIC] }, // TODO remove later
|
|
37
|
+
];
|
|
38
|
+
// INIT
|
|
39
|
+
super(exports.path, adminGroupNames);
|
|
40
|
+
this.setDynamoDB(tableName, ownerFieldName, indexMap)
|
|
41
|
+
.setOpenSearch(exports.openSearch.domain, exports.openSearch.index)
|
|
42
|
+
.setPolicies(policies);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.EntityConfig = EntityConfig;
|
|
46
|
+
// Export default Entity configuration
|
|
47
|
+
exports.CONFIG_ENTITY = new EntityConfig();
|
|
48
|
+
//# sourceMappingURL=entity-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-config.js","sourceRoot":"","sources":["../../../../src/_examples/controller/entity/entity-config.ts"],"names":[],"mappings":";;;AAAA,yCAAgH;AAEhH,aAAa;AACA,QAAA,UAAU,GAAG;IACxB,MAAM,EAAE,wGAAwG;IAChH,KAAK,EAAE,QAAQ;CAChB,CAAC;AACW,QAAA,IAAI,GAAG,oBAAoB,CAAC,CAAC,gBAAgB;AAE1D,uBAAuB;AACvB,MAAa,YAAa,SAAQ,uBAAgB;IAChD;QACE,WAAW;QACX,M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AAa,GAAG,IAAI,YAAY,EAAE,CAAC","sourcesContent":["import { Access as a, DynamoIndexMap, EndpointPolicy, EntityConfigImpl, HttpMethod as m } from \"@chinggis/core\";\n\n// OPENSEARCH\nexport const openSearch = {\n domain: \"https://search-amplify-opense-1qu4zfdauaeh1-ncvbubjnpcsfempstbsykhoadi.ap-southeast-1.es.amazonaws.com\",\n index: \"entity\",\n};\nexport const path = \"/supplier/entities\"; // url path base\n\n// Entity configuration\nexport class EntityConfig extends EntityConfigImpl {\n constructor() {\n // DYNAMODB\n const tableName = \"Entity-2i5o74z4mjf6lpabqp7myrkdre-dev\";\n const indexMap = new DynamoIndexMap()\n .set(\"byISBN\", { field: \"isbn\", rFields: [\"isbn\"] })\n .set(\"byOriginalOwner\", { field: \"originalOwner\", rFields: [\"originalOwner\"] })\n .set(\"byStatusByUpdatedAt\", { field: \"status\", rFields: [\"status\"] });\n\n // PERMISSIONS\n const ownerFieldName = \"owner\";\n const adminGroupNames = [\"adminUsers\"];\n const policies: EndpointPolicy[] = [\n { method: m.GET, path: `${path}`, access: [a.ADMIN] },\n { method: m.GET, path: `${path}/search`, access: [a.ADMIN] },\n { method: m.GET, path: `${path}/{id}`, access: [a.ADMIN] },\n // { method: m.GET, path: `${path}/search-entities`, access: [a.PUBLIC] },\n { method: m.GET, path: `${path}/batch`, access: [a.PUBLIC] },\n { method: m.GET, path: `${path}/details/{id}`, access: [a.PUBLIC] },\n { method: m.POST, path: `${path}`, access: [a.ADMIN] },\n { method: m.POST, path: `${path}/add`, access: [a.USER] },\n { method: m.PUT, path: `${path}/{id}`, access: [a.ADMIN] },\n { method: m.PATCH, path: `${path}/{id}`, access: [a.ADMIN] },\n { method: m.DELETE, path: `${path}/{id}`, access: [a.ADMIN] },\n { method: m.GET, path: `/entities/{id}`, access: [a.PUBLIC] }, // TODO remove later\n { method: m.GET, path: `/entities/batch`, access: [a.PUBLIC] }, // TODO remove later\n ];\n\n // INIT\n super(path, adminGroupNames);\n this.setDynamoDB(tableName, ownerFieldName, indexMap)\n .setOpenSearch(openSearch.domain, openSearch.index)\n .setPolicies(policies);\n }\n}\n\n// Export default Entity configuration\nexport const CONFIG_ENTITY = new EntityConfig();\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { APIGatewayProxyEvent, APIGatewayProxyWebsocketEventV2, DynamoDBStreamEvent, ScheduledEvent, SQSEvent } from "aws-lambda";
|
|
2
|
+
import { BaseController } from "../../../index.js";
|
|
3
|
+
import { EntityService } from "../../service/entity/entity-service.interface";
|
|
4
|
+
import "../../service/entity/entity-service";
|
|
5
|
+
export declare class EntityController extends BaseController<EntityService> {
|
|
6
|
+
constructor();
|
|
7
|
+
protected processSQSEvent(sqsEvent: SQSEvent): Promise<any>;
|
|
8
|
+
protected processCrudRequest(apiGatewayProxyEvent: APIGatewayProxyEvent): Promise<any>;
|
|
9
|
+
protected processStreamEvent(dynamoDBStreamEvent: DynamoDBStreamEvent): Promise<void>;
|
|
10
|
+
protected processScheduledEvent(scheduledEvent: ScheduledEvent): Promise<void>;
|
|
11
|
+
protected processWebSocketEvent(event: APIGatewayProxyWebsocketEventV2): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
45
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
46
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
47
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
48
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
49
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
50
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.EntityController = void 0;
|
|
55
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
56
|
+
const entity_config_1 = require("./entity-config");
|
|
57
|
+
const core_1 = require("../../../index.js");
|
|
58
|
+
const supplier_portal_model_1 = require("../../model-shared/supplier-portal.model");
|
|
59
|
+
const errors_1 = require("../../../exception/errors");
|
|
60
|
+
require("../../service/entity/entity-service");
|
|
61
|
+
let EntityController = class EntityController extends core_1.BaseController {
|
|
62
|
+
constructor() {
|
|
63
|
+
const entityService = typedi_1.default.get("EntityService");
|
|
64
|
+
super(entityService, entity_config_1.CONFIG_ENTITY.toObject());
|
|
65
|
+
}
|
|
66
|
+
processSQSEvent(sqsEvent) {
|
|
67
|
+
throw new Error("Method not implemented.");
|
|
68
|
+
}
|
|
69
|
+
processCrudRequest(apiGatewayProxyEvent) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
if (this.resourcePath === `GET ${entity_config_1.path}/search-entities`) {
|
|
73
|
+
const filter = this.request.filterAndSort;
|
|
74
|
+
filter.status = supplier_portal_model_1.Status.active;
|
|
75
|
+
return yield this.service.find(filter);
|
|
76
|
+
}
|
|
77
|
+
if (this.resourcePath === `GET ${entity_config_1.path}/batch`) {
|
|
78
|
+
const ids = (_a = this.request.filterAndSort.ids.split(",")) !== null && _a !== void 0 ? _a : [];
|
|
79
|
+
return yield this.service.findByIds(ids);
|
|
80
|
+
}
|
|
81
|
+
if (this.resourcePath === `GET ${entity_config_1.path}/details/{id}`) {
|
|
82
|
+
const { id } = this.request.pathParameters;
|
|
83
|
+
const result = yield this.service.findById(id);
|
|
84
|
+
if (result.status !== supplier_portal_model_1.Status.active)
|
|
85
|
+
throw new errors_1.ErrorHttp({ code: 404, error: "NotFound" }, "Entity not found");
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
// TODO remove later
|
|
89
|
+
if (this.resourcePath === `GET /entities/batch`) {
|
|
90
|
+
const ids = (_b = this.request.filterAndSort.ids.split(",")) !== null && _b !== void 0 ? _b : [];
|
|
91
|
+
return yield this.service.searchEntityBatch(ids);
|
|
92
|
+
}
|
|
93
|
+
// TODO remove later
|
|
94
|
+
if (this.resourcePath === `GET /entities/{id}`) {
|
|
95
|
+
const { id } = this.request.pathParameters;
|
|
96
|
+
const result = yield this.service.findById(id);
|
|
97
|
+
if (result.status !== supplier_portal_model_1.Status.active)
|
|
98
|
+
throw new errors_1.ErrorHttp({ code: 404, error: "NotFound" }, "Entity not found");
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
processStreamEvent(dynamoDBStreamEvent) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
processScheduledEvent(scheduledEvent) {
|
|
107
|
+
throw new Error("Method not implemented.");
|
|
108
|
+
}
|
|
109
|
+
processWebSocketEvent(event) {
|
|
110
|
+
throw new Error("Method not implemented.");
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.EntityController = EntityController;
|
|
114
|
+
exports.EntityController = EntityController = __decorate([
|
|
115
|
+
(0, typedi_1.Service)("EntityController"),
|
|
116
|
+
__metadata("design:paramtypes", [])
|
|
117
|
+
], EntityController);
|
|
118
|
+
//# sourceMappingURL=entity-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-controller.js","sourceRoot":"","sources":["../../../../src/_examples/controller/entity/entity-controller.ts"],"names":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F,CAAA;AAvDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,gBAAO,EAAC,kBAAkB,CAAC;;GACf,gBAAgB,CAuD5B","sourcesContent":["import Container, { Service } from \"typedi\";\nimport {\n APIGatewayProxyEvent,\n APIGatewayProxyWebsocketEventV2,\n DynamoDBStreamEvent,\n ScheduledEvent,\n SQSEvent,\n} from \"aws-lambda\";\nimport { CONFIG_ENTITY, path } from \"./entity-config\";\nimport { BaseController } from \"@chinggis/core\";\nimport { Status } from \"../../model-shared/supplier-portal.model\";\nimport { ErrorHttp } from \"../../../exception/errors\";\n\nimport { EntityService } from \"../../service/entity/entity-service.interface\";\nimport \"../../service/entity/entity-service\";\n\n@Service(\"EntityController\")\nexport class EntityController extends BaseController<EntityService> {\n constructor() {\n const entityService: EntityService = Container.get(\"EntityService\");\n super(entityService, CONFIG_ENTITY.toObject());\n }\n\n protected processSQSEvent(sqsEvent: SQSEvent): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n\n protected async processCrudRequest(apiGatewayProxyEvent: APIGatewayProxyEvent): Promise<any> {\n if (this.resourcePath === `GET ${path}/search-entities`) {\n const filter = this.request.filterAndSort;\n filter.status = Status.active;\n return await this.service.find(filter);\n }\n\n if (this.resourcePath === `GET ${path}/batch`) {\n const ids = this.request.filterAndSort.ids.split(\",\") ?? [];\n return await this.service.findByIds(ids);\n }\n\n if (this.resourcePath === `GET ${path}/details/{id}`) {\n const { id } = this.request.pathParameters;\n const result = await this.service.findById(id);\n if (result.status !== Status.active) throw new ErrorHttp({ code: 404, error: \"NotFound\" }, \"Entity not found\");\n return result;\n }\n\n // TODO remove later\n if (this.resourcePath === `GET /entities/batch`) {\n const ids = this.request.filterAndSort.ids.split(\",\") ?? [];\n return await this.service.searchEntityBatch(ids);\n }\n\n // TODO remove later\n if (this.resourcePath === `GET /entities/{id}`) {\n const { id } = this.request.pathParameters;\n const result = await this.service.findById(id);\n if (result.status !== Status.active) throw new ErrorHttp({ code: 404, error: \"NotFound\" }, \"Entity not found\");\n return result;\n }\n }\n\n protected processStreamEvent(dynamoDBStreamEvent: DynamoDBStreamEvent): Promise<void> {\n return;\n }\n\n protected processScheduledEvent(scheduledEvent: ScheduledEvent): Promise<void> {\n throw new Error(\"Method not implemented.\");\n }\n\n protected processWebSocketEvent(event: APIGatewayProxyWebsocketEventV2): Promise<void> {\n throw new Error(\"Method not implemented.\");\n }\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
42
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.handler = void 0;
|
|
52
|
+
require("reflect-metadata");
|
|
53
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
54
|
+
require("./entity-controller");
|
|
55
|
+
const handler = (event) => typedi_1.default.get(HelperCDI).process(event);
|
|
56
|
+
exports.handler = handler;
|
|
57
|
+
let HelperCDI = class HelperCDI {
|
|
58
|
+
constructor() {
|
|
59
|
+
this.controller = typedi_1.default.get("EntityController");
|
|
60
|
+
}
|
|
61
|
+
process(event) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
log.debug("_example event start----------------------------------------\n");
|
|
64
|
+
log.debug(JSON.stringify(event, null, 2));
|
|
65
|
+
log.debug("_example event end ----------------------------------------\n\n");
|
|
66
|
+
return this.controller.resolveCrudRequest(event);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
HelperCDI = __decorate([
|
|
71
|
+
(0, typedi_1.Service)()
|
|
72
|
+
], HelperCDI);
|
|
73
|
+
//# sourceMappingURL=entity-crud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-crud.js","sourceRoot":"","sources":["../../../../src/_examples/controller/entity/entity-crud.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA0B;AAC1B,iDAA4C;AAI5C,+BAA6B;AAEtB,MAAM,OAAO,GAAG,CAAC,KAA2B,EAAE,EAAE,CAAC,gBAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAnF,QAAA,OAAO,WAA4E;AAGhG,IAAM,SAAS,GAAf,MAAM,SAAS;IAAf;QACmB,eAAU,GAAqB,gBAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAQpF,CAAC;IANO,OAAO,CAAC,KAA2B;;YACvC,GAAG,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;YAC5E,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC1C,GAAG,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;YAC9E,OAAO,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnD,CAAC;KAAA;CACF,CAAA;AATK,SAAS;IADd,IAAA,gBAAO,GAAE;GACJ,SAAS,CASd","sourcesContent":["import \"reflect-metadata\";\nimport Container, { Service } from \"typedi\";\nimport { APIGatewayProxyEvent } from \"aws-lambda\";\n\nimport { EntityController } from \"./entity-controller\";\nimport \"./entity-controller\";\n\nexport const handler = (event: APIGatewayProxyEvent) => Container.get(HelperCDI).process(event);\n\n@Service()\nclass HelperCDI {\n private readonly controller: EntityController = Container.get(\"EntityController\");\n\n async process(event: APIGatewayProxyEvent) {\n log.debug(\"_example event start----------------------------------------\\n\");\n log.debug(JSON.stringify(event, null, 2));\n log.debug(\"_example event end ----------------------------------------\\n\\n\");\n return this.controller.resolveCrudRequest(event);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { APIGatewayProxyEvent } from "aws-lambda";
|
|
3
3
|
import "./profile.controller";
|
|
4
|
-
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("
|
|
4
|
+
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("src/utils").APIResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-config.js","sourceRoot":"","sources":["../../../../src/_examples/controller/supplier/supplier-config.ts"],"names":[],"mappings":";;;AAAA,yCAAgH;AAChH,oEAM0C;AAE7B,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE,wGAAwG;IAChH,KAAK,EAAE,UAAU;CAClB,CAAC;AACW,QAAA,IAAI,GAAG,oBAAoB,CAAC,CAAC,gBAAgB;AAE1D,yBAAyB;AACzB,MAAa,cAAe,SAAQ,uBAAgB;IAClD;QACE,WAAW;QACX,MAAM,SAAS,GAAG,yCAAyC,CAAC;QAC5D,MAAM,cAAc,GAAG,UAAU,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,qBAAc,EAAE;aAClC,SAAS,CAAC,UAAU,CAAC;aACrB,GAAG,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,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AS,EAAE,uBAAO,EAAE,QAAQ,EAAE,uCAAQ,EAAE;YAElG,EAAE,MAAM,EAAE,iBAAC,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,YAAI,OAAO,EAAE,MAAM,EAAE,CAAC,aAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,sBAAM,EAAE,QAAQ,EAAE,uCAAQ,EAAE;YAEnG,EAAE,MAAM,EAAE,iBAAC,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,YAAI,OAAO,EAAE,MAAM,EAAE,CAAC,aAAC,CAAC,KAAK,CAAC,EAAE;SAC9D,CAAC;QAEF,OAAO;QACP,KAAK,CAAC,YAAI,EAAE,cAAc,CAAC,CAAC;QAC5B,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,CAAC;aAClD,aAAa,CAAC,2BAAmB,CAAC,MAAM,EAAE,2BAAmB,CAAC,KAAK,CAAC;aACpE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;CACF;AAhCD,wCAgCC;AAED,wCAAwC;AAC3B,QAAA,eAAe,GAAG,IAAI,cAAc,EAAE,CAAC","sourcesContent":["import { Access as a, DynamoIndexMap, EndpointPolicy, EntityConfigImpl, HttpMethod as m } from \"@chinggis/core\";\nimport {\n CREATE,\n REPLACE,\n RESPONSE_FIELDS_DETAILS as FIELDS_D,\n RESPONSE_FIELDS_LIST as FIELDS_L,\n UPDATE,\n} from \"../../model-shared/suppler.model\";\n\nexport const openSearch_supplier = {\n domain: \"https://search-amplify-opense-1qu4zfdauaeh1-ncvbubjnpcsfempstbsykhoadi.ap-southeast-1.es.amazonaws.com\",\n index: \"saccount\",\n};\nexport const path = \"/supplier/accounts\"; // url path base\n\n// Supplier configuration\nexport class SupplierConfig extends EntityConfigImpl {\n constructor() {\n // DYNAMODB\n const tableName = \"SAccount-2i5o74z4mjf6lpabqp7myrkdre-dev\";\n const ownerFieldName = \"username\";\n const indexMap = new DynamoIndexMap()\n .setFields(\"username\")\n .set(\"byAccountType\", { field: \"accountType\", rFields: [\"accountType\"] });\n\n // PERMISSIONS\n const adminGroupName = [\"adminUsers\"];\n const policyList: EndpointPolicy[] = [\n { method: m.GET, path: `${path}`, access: [a.ADMIN], response: FIELDS_L },\n { method: m.GET, path: `${path}/search`, access: [a.ADMIN], response: FIELDS_L },\n { method: m.GET, path: `${path}/list-non-level-one`, access: [a.ADMIN], response: FIELDS_L },\n { method: m.GET, path: `${path}/{id}`, access: [a.OWNER, a.ADMIN], response: FIELDS_D },\n\n { method: m.POST, path: `${path}`, access: [a.ADMIN], validator: CREATE, response: FIELDS_D },\n\n { method: m.PUT, path: `${path}/{id}`, access: [a.ADMIN], validator: REPLACE, response: FIELDS_D },\n\n { method: m.PATCH, path: `${path}/{id}`, access: [a.ADMIN], validator: UPDATE, response: FIELDS_D },\n\n { method: m.DELETE, path: `${path}/{id}`, access: [a.ADMIN] },\n ];\n\n // INIT\n super(path, adminGroupName);\n this.setDynamoDB(tableName, ownerFieldName, indexMap)\n .setOpenSearch(openSearch_supplier.domain, openSearch_supplier.index)\n .setPolicies(policyList);\n }\n}\n\n// Export default Supplier configuration\nexport const CONFIG_SUPPLIER = new SupplierConfig();\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { APIGatewayProxyEvent } from "aws-lambda";
|
|
3
3
|
import "./supplier-controller";
|
|
4
|
-
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("
|
|
4
|
+
export declare const handler: (event: APIGatewayProxyEvent) => Promise<import("src/utils").APIResponse>;
|
|
@@ -109,89 +109,89 @@ export declare const CREATE: z.ZodEffects<z.ZodObject<{
|
|
|
109
109
|
email?: string;
|
|
110
110
|
firstName?: string;
|
|
111
111
|
lastName?: string;
|
|
112
|
-
|
|
113
|
-
taxPayer?: boolean;
|
|
114
|
-
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
115
|
-
validUntil?: string;
|
|
116
|
-
phoneList?: string[];
|
|
117
|
-
isForeign?: boolean;
|
|
118
|
-
feeReceivablesPercent?: number;
|
|
119
|
-
feeSOrder?: number;
|
|
120
|
-
internomPercent?: number;
|
|
121
|
-
digitalCommissionRate?: number;
|
|
112
|
+
feeSales?: any[];
|
|
122
113
|
feeTransport?: number;
|
|
123
114
|
feeWarehouse?: number;
|
|
124
|
-
|
|
115
|
+
digitalCommissionRate?: number;
|
|
116
|
+
internomPercent?: number;
|
|
117
|
+
availableCreateOrder?: boolean;
|
|
118
|
+
phoneList?: string[];
|
|
119
|
+
feeSOrder?: number;
|
|
120
|
+
taxPayer?: boolean;
|
|
121
|
+
company?: boolean;
|
|
125
122
|
bankName?: string;
|
|
126
123
|
bankAccountNumber?: string;
|
|
127
124
|
bankReceiverName?: string;
|
|
128
|
-
|
|
125
|
+
validUntil?: string;
|
|
126
|
+
feeReceivablesPercent?: number;
|
|
127
|
+
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
128
|
+
isForeign?: boolean;
|
|
129
129
|
}, {
|
|
130
130
|
username?: string;
|
|
131
131
|
email?: string;
|
|
132
132
|
firstName?: string;
|
|
133
133
|
lastName?: string;
|
|
134
|
-
|
|
135
|
-
taxPayer?: boolean;
|
|
136
|
-
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
137
|
-
validUntil?: string;
|
|
138
|
-
phoneList?: string[];
|
|
139
|
-
isForeign?: boolean;
|
|
140
|
-
feeReceivablesPercent?: number;
|
|
141
|
-
feeSOrder?: number;
|
|
142
|
-
internomPercent?: number;
|
|
143
|
-
digitalCommissionRate?: number;
|
|
134
|
+
feeSales?: any[];
|
|
144
135
|
feeTransport?: number;
|
|
145
136
|
feeWarehouse?: number;
|
|
146
|
-
|
|
137
|
+
digitalCommissionRate?: number;
|
|
138
|
+
internomPercent?: number;
|
|
139
|
+
availableCreateOrder?: boolean;
|
|
140
|
+
phoneList?: string[];
|
|
141
|
+
feeSOrder?: number;
|
|
142
|
+
taxPayer?: boolean;
|
|
143
|
+
company?: boolean;
|
|
147
144
|
bankName?: string;
|
|
148
145
|
bankAccountNumber?: string;
|
|
149
146
|
bankReceiverName?: string;
|
|
150
|
-
|
|
147
|
+
validUntil?: string;
|
|
148
|
+
feeReceivablesPercent?: number;
|
|
149
|
+
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
150
|
+
isForeign?: boolean;
|
|
151
151
|
}>, {
|
|
152
152
|
username?: string;
|
|
153
153
|
email?: string;
|
|
154
154
|
firstName?: string;
|
|
155
155
|
lastName?: string;
|
|
156
|
-
|
|
157
|
-
taxPayer?: boolean;
|
|
158
|
-
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
159
|
-
validUntil?: string;
|
|
160
|
-
phoneList?: string[];
|
|
161
|
-
isForeign?: boolean;
|
|
162
|
-
feeReceivablesPercent?: number;
|
|
163
|
-
feeSOrder?: number;
|
|
164
|
-
internomPercent?: number;
|
|
165
|
-
digitalCommissionRate?: number;
|
|
156
|
+
feeSales?: any[];
|
|
166
157
|
feeTransport?: number;
|
|
167
158
|
feeWarehouse?: number;
|
|
168
|
-
|
|
159
|
+
digitalCommissionRate?: number;
|
|
160
|
+
internomPercent?: number;
|
|
161
|
+
availableCreateOrder?: boolean;
|
|
162
|
+
phoneList?: string[];
|
|
163
|
+
feeSOrder?: number;
|
|
164
|
+
taxPayer?: boolean;
|
|
165
|
+
company?: boolean;
|
|
169
166
|
bankName?: string;
|
|
170
167
|
bankAccountNumber?: string;
|
|
171
168
|
bankReceiverName?: string;
|
|
172
|
-
|
|
169
|
+
validUntil?: string;
|
|
170
|
+
feeReceivablesPercent?: number;
|
|
171
|
+
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
172
|
+
isForeign?: boolean;
|
|
173
173
|
}, {
|
|
174
174
|
username?: string;
|
|
175
175
|
email?: string;
|
|
176
176
|
firstName?: string;
|
|
177
177
|
lastName?: string;
|
|
178
|
-
|
|
179
|
-
taxPayer?: boolean;
|
|
180
|
-
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
181
|
-
validUntil?: string;
|
|
182
|
-
phoneList?: string[];
|
|
183
|
-
isForeign?: boolean;
|
|
184
|
-
feeReceivablesPercent?: number;
|
|
185
|
-
feeSOrder?: number;
|
|
186
|
-
internomPercent?: number;
|
|
187
|
-
digitalCommissionRate?: number;
|
|
178
|
+
feeSales?: any[];
|
|
188
179
|
feeTransport?: number;
|
|
189
180
|
feeWarehouse?: number;
|
|
190
|
-
|
|
181
|
+
digitalCommissionRate?: number;
|
|
182
|
+
internomPercent?: number;
|
|
183
|
+
availableCreateOrder?: boolean;
|
|
184
|
+
phoneList?: string[];
|
|
185
|
+
feeSOrder?: number;
|
|
186
|
+
taxPayer?: boolean;
|
|
187
|
+
company?: boolean;
|
|
191
188
|
bankName?: string;
|
|
192
189
|
bankAccountNumber?: string;
|
|
193
190
|
bankReceiverName?: string;
|
|
194
|
-
|
|
191
|
+
validUntil?: string;
|
|
192
|
+
feeReceivablesPercent?: number;
|
|
193
|
+
accountType?: "level1" | "level2" | "level3" | "level4";
|
|
194
|
+
isForeign?: boolean;
|
|
195
195
|
}>;
|
|
196
196
|
export declare const UPDATE: z.ZodObject<{
|
|
197
197
|
username: z.ZodString;
|