return res.end(buf);
}
- // GET /api/v1/blueprint-model/ (list all)
- if (method === 'GET' && pathname === `${BASE}/blueprint-model/`) {
+ // GET /api/v1/blueprint-model (list all)
+ if (method === 'GET' && (pathname === `${BASE}/blueprint-model/` || pathname === `${BASE}/blueprint-model`)) {
return json(res, blueprints);
}
return json(res, { message: 'deleted', id: m[1] });
}
- // POST /api/v1/blueprint-model/enrich/ – returns enriched CBA zip
- if (method === 'POST' && pathname === `${BASE}/blueprint-model/enrich/`) {
+ // POST /api/v1/blueprint-model/enrich – returns enriched CBA zip
+ if (method === 'POST' && (pathname === `${BASE}/blueprint-model/enrich` || pathname === `${BASE}/blueprint-model/enrich/`)) {
await readBody(req); // drain multipart body
const buf = minimalZip();
res.writeHead(200, {
// POST upload stubs – drain multipart body, echo back first fixture blueprint
if (method === 'POST' && (
+ pathname === `${BASE}/blueprint-model` ||
pathname === `${BASE}/blueprint-model/` ||
+ pathname === `${BASE}/blueprint-model/publish` ||
pathname === `${BASE}/blueprint-model/publish/` ||
- pathname === `${BASE}/blueprint-model/enrichandpublish/` ||
- pathname === `${BASE}/blueprint-model/publish` // deploy (no trailing slash)
+ pathname === `${BASE}/blueprint-model/enrichandpublish` ||
+ pathname === `${BASE}/blueprint-model/enrichandpublish/`
)) {
await readBody(req);
return json(res, blueprints[0]);
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file => {
- // if (appConfig.action.deployBlueprint.grpcEnabled)
if (appConfig.action.grpcEnabled)
return this.uploadFileToBlueprintProcessorGrpc(file, 'DRAFT', response);
else
- return this.uploadFileToBlueprintController(file, '/blueprint-model/', response);
- }, err => {
+ return this.uploadFileToBlueprintController(file, '/blueprint-model', response);
+ }).then(resp => {
+ resolve(resp);
+ }).catch(err => {
reject(err);
});
});
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file => {
- // if (appConfig.action.deployBlueprint.grpcEnabled)
if (appConfig.action.grpcEnabled)
return this.uploadFileToBlueprintProcessorGrpc(file, 'PUBLISH', response);
else
- return this.uploadFileToBlueprintController(file, '/blueprint-model/publish/', response);
- }, err => {
+ return this.uploadFileToBlueprintController(file, '/blueprint-model/publish', response);
+ }).then(resp => {
+ resolve(resp);
+ }).catch(err => {
reject(err);
});
});
if (appConfig.action.grpcEnabled)
return this.uploadFileToBlueprintProcessorGrpc(file, 'ENRICH', response);
else
- return this.uploadFileToBlueprintController(file, '/blueprint-model/enrich/', response);
+ return this.uploadFileToBlueprintController(file, '/blueprint-model/enrich', response);
// this.uploadFileToBlueprintController(file, "/blueprint-model/enrich/", response).then(resp => {
// resolve(resp);
// }, err => {
// });
// }, err => {
// reject(err);
+ }).then(resp => {
+ resolve(resp);
+ }).catch(err => {
+ reject(err);
});
});
}
if (appConfig.action.grpcEnabled)
return this.uploadFileToBlueprintProcessorGrpc(file, 'ENRICH', response);
else
- return this.uploadFileToBlueprintController(file, '/blueprint-model/enrichandpublish/', response);
+ return this.uploadFileToBlueprintController(file, '/blueprint-model/enrichandpublish', response);
+ }).then(resp => {
+ resolve(resp);
+ }).catch(err => {
+ reject(err);
});
});
}
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file => {
- // if (appConfig.action.deployBlueprint.grpcEnabled)
if (appConfig.action.grpcEnabled)
return this.uploadFileToBlueprintProcessorGrpc(file, 'PUBLISH', response);
else
return this.uploadFileToBlueprintProcessor(file, '/blueprint-model/publish', response);
- }, err => {
+ }).then(resp => {
+ resolve(resp);
+ }).catch(err => {
reject(err);
});
});