eservices-back-core
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -8,3 +8,4 @@ import { Request, Response } from "express"; | ||
static getPresentationStatuses(req: Request, res: Response, next: any): void; | ||
static getRequiredDocuments(req: Request, res: Response, next: any): Promise<Response<any, Record<string, any>>>; | ||
} | ||
//# sourceMappingURL=view-controller.d.ts.map |
@@ -20,2 +20,3 @@ "use strict"; | ||
const get_usage_context_1 = __importDefault(require("../../utils/get-usage-context")); | ||
const rules_validation_service_1 = __importDefault(require("../../services/rules-validation-service")); | ||
class ViewController { | ||
@@ -25,2 +26,3 @@ static getDefault(req, res, next) { | ||
try { | ||
console.log('get default metadata'); | ||
const { entity } = req.params; | ||
@@ -104,4 +106,26 @@ const ms = new metadata_service_1.default(req.__token); | ||
} | ||
static getRequiredDocuments(req, res, next) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
/** | ||
* In Future web-server will get statusCode by entity, primaryKey itself. | ||
*/ | ||
const { entity, primaryKey, statusCode } = req.query; | ||
const rv = new rules_validation_service_1.default(req.__token); | ||
// @ts-ignore | ||
const data = yield rv.validateEntityByStatus(entity, primaryKey, statusCode); | ||
if (!data.info) | ||
return res.json([]); | ||
const documentRule = data.info.find(item => item.ruleName === 'RequiredDocuments'); | ||
if (!documentRule) | ||
return res.json([]); | ||
res.json(documentRule.conditions.map(item => (Object.assign({ label: item.description }, item)))); | ||
} | ||
catch (e) { | ||
next(e); | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = ViewController; | ||
//# sourceMappingURL=view-controller.js.map |
@@ -28,2 +28,20 @@ "use strict"; | ||
TestCloseRouter.use((0, index_1.default)()); | ||
TestCloseRouter.get('/request-success', (req, res) => { | ||
res.json({ | ||
token: req.__token | ||
}); | ||
}); | ||
TestCloseRouter.get('/request-success-text', (req, res) => { | ||
res.send(req.__token); | ||
}); | ||
TestCloseRouter.get('/request-fail', (req, res) => { | ||
res.status(500); | ||
res.json({ | ||
token: req.__token | ||
}); | ||
}); | ||
TestCloseRouter.get('/request-fail-text', (req, res) => { | ||
res.status(500); | ||
res.send(req.__token); | ||
}); | ||
TestCloseRouter.get('/is-real-test', (req, res) => { | ||
@@ -30,0 +48,0 @@ res.json({ |
@@ -14,10 +14,6 @@ "use strict"; | ||
.put(view_controller_1.default.runStep); | ||
/* | ||
ViewRoute.get('/process-wizard/:process/:entity', ViewController.getProcessWizard); | ||
ViewRoute.post('/process-wizard/:process/:entity', ViewController.startProcess); | ||
ViewRoute.put('/process-wizard/:process/:entity', ViewController.runStep); | ||
*/ | ||
ViewRoute.use(WizardRouter); | ||
ViewRoute.get('/:entity', view_controller_1.default.getDefault); | ||
ViewRoute.get('/required-documents', view_controller_1.default.getRequiredDocuments); | ||
// ViewRoute.get('/:entity' , ViewController.getDefault); | ||
exports.default = ViewRoute; | ||
//# sourceMappingURL=view-router.js.map |
@@ -36,3 +36,3 @@ "use strict"; | ||
credentials: true, | ||
origin: ['http://localhost', 'http://localhost:8000', process.env.BASE_URL, 'http://localhost:8001', 'http://localhost:3000'], | ||
origin: ['http://localhost', 'http://localhost:8000', process.env.BASE_URL, 'http://localhost:8081', 'http://localhost:8001', 'http://localhost:3000'], | ||
})); | ||
@@ -39,0 +39,0 @@ app.use(body_parser_1.default.json()); |
@@ -0,1 +1,2 @@ | ||
import { IResultCreatingCommunication, IResultCreatingCommunicationMessage, IResultReadCommunication, IResultReadCommunicationMessage } from "../types/communication"; | ||
export default class CommunicationService { | ||
@@ -7,3 +8,3 @@ /** | ||
*/ | ||
static create(data: ICommunication): Promise<any>; | ||
static create(data: ICommunication): Promise<IResultCreatingCommunication>; | ||
/*** | ||
@@ -13,3 +14,3 @@ * По входным данным получает список коммуникации aka Inquire | ||
* */ | ||
static read(data: IParamsListCommunication): Promise<any>; | ||
static read(data: IParamsListCommunication): Promise<IResultReadCommunication>; | ||
/** | ||
@@ -20,3 +21,3 @@ * @param {String} token | ||
*/ | ||
static readMessages(token: string, data: ITalk): Promise<any>; | ||
static readMessages(token: string, data: ITalk): Promise<IResultReadCommunicationMessage[]>; | ||
/** | ||
@@ -28,3 +29,3 @@ * @description Создание сообщение, использует выделенный метод | ||
*/ | ||
static createMessage(token: string, data: ICreateMessage): Promise<any>; | ||
static createMessage(token: string, data: ICreateMessage): Promise<IResultCreatingCommunicationMessage>; | ||
} | ||
@@ -31,0 +32,0 @@ interface ITalk { |
import InterfaceAuthService from "./interface-auth-service"; | ||
import { IRequestCreateResult, IRequestUpdateResult } from "../types/main"; | ||
export default class DataService extends InterfaceAuthService { | ||
@@ -6,3 +7,3 @@ /** | ||
*/ | ||
create(entityName: any, values: any): Promise<any>; | ||
create(entityName: any, values: any): Promise<IRequestCreateResult>; | ||
/** | ||
@@ -17,6 +18,3 @@ * @description Reading entity using GraphQL. | ||
version?: number; | ||
}): Promise<{ | ||
id: number; | ||
version: number; | ||
}>; | ||
}): Promise<IRequestUpdateResult>; | ||
/** | ||
@@ -23,0 +21,0 @@ * @description Reading list data using standard AppServer API without GraphQL. Return data in pretty user format. |
import InterfaceAuthService from "./interface-auth-service"; | ||
import { IValidateResult } from "../types/validation"; | ||
export default class RulesValidationService extends InterfaceAuthService { | ||
basicUrl: string; | ||
validate(scopeName: string, data: Record<string, any>): Promise<any>; | ||
/** | ||
* @description Выполнение валидации сущности (primaryKey) для предоставленного статуса. | ||
*/ | ||
validateEntityByStatus(entityName: string, primaryKey: any, statusCode: string): Promise<IValidateResult>; | ||
} | ||
//# sourceMappingURL=rules-validation-service.d.ts.map |
@@ -32,4 +32,22 @@ "use strict"; | ||
} | ||
/** | ||
* @description Выполнение валидации сущности (primaryKey) для предоставленного статуса. | ||
*/ | ||
validateEntityByStatus(entityName, primaryKey, statusCode) { | ||
const server = Server_1.default.getServer(); | ||
const url = `${server.apiUrl}/${this.basicUrl}/Entity/${entityName}/${primaryKey}/Status/${statusCode}`; | ||
return (0, nodeFetch_1.default)(url, { | ||
method: "GET", | ||
headers: { | ||
authorization: this.token | ||
} | ||
}) | ||
.then(res => { | ||
if (!res.ok) | ||
throw api_error_1.default.AppServerError(); | ||
return res.json(); | ||
}); | ||
} | ||
} | ||
exports.default = RulesValidationService; | ||
//# sourceMappingURL=rules-validation-service.js.map |
{ | ||
"name": "eservices-back-core", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/Server.js", |
@@ -19,5 +19,6 @@ { | ||
"./src/**/*", | ||
"app.ts" | ||
"app.ts", | ||
"./types/*" | ||
], | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222857
259
3002