@dynrl/data-slammer
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -61,3 +61,3 @@ "use strict"; | ||
query: url, | ||
result: lodash.map(r.data.items, i => { | ||
items: lodash.map(r.data.items, i => { | ||
return { | ||
@@ -64,0 +64,0 @@ id: this.getId(i.link), |
@@ -64,3 +64,3 @@ import { ServiceRequest, ServiceResponse, IStatus, IPayload } from '@dynrl/service-data-models'; | ||
/** List of links with ids. IDs are hashed link values. */ | ||
result: Array<{ | ||
items: Array<{ | ||
id: string; | ||
@@ -67,0 +67,0 @@ url: string; |
export declare class DataSlammerService { | ||
private static getResult; | ||
static handleRequest(context: any, req: any): Promise<void>; | ||
} |
@@ -15,4 +15,13 @@ "use strict"; | ||
class DataSlammerService { | ||
static getResult(r) { | ||
return { | ||
headers: { | ||
'content-type': 'application/json' | ||
}, | ||
body: r | ||
}; | ||
} | ||
static handleRequest(context, req) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// Create a new data slammer | ||
let ds = new index_1.DataSlammer({ | ||
@@ -24,17 +33,7 @@ googleSearchCx: drl_settings_1.DrlSettings.getSetting('GOOGLE_CX'), | ||
context.log('JavaScript HTTP trigger function processed a GET request.'); | ||
const r = yield ds | ||
.slam(req.query['pn'], req.query['mf'], req.query['fileType']) | ||
.catch(function () { | ||
context.res = { | ||
body: 'fail' | ||
}; | ||
}); | ||
context.res = { | ||
body: JSON.stringify(r) | ||
}; | ||
context.res = this.getResult(yield ds.slam(req.query['pn'], req.query['mf'], req.query['fileType'])); | ||
} | ||
else if (req.method === 'POST') { | ||
context.log('JavaScript HTTP trigger function processed a POST request.'); | ||
const r = yield ds.get(req.body); | ||
context.res = JSON.stringify(r); | ||
context.res = this.getResult(yield ds.get(req.body)); | ||
} | ||
@@ -41,0 +40,0 @@ else { |
{ | ||
"name": "@dynrl/data-slammer", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -40,6 +40,2 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/dschomburg/pdfslammer/issues" | ||
}, | ||
"homepage": "https://github.com/dschomburg/pdfslammer#readme", | ||
"dependencies": { | ||
@@ -87,3 +83,3 @@ "@dynrl/service-data-models": "^1.0.1", | ||
"lint-staged": { | ||
"*.ts": [ | ||
"src/*.ts": [ | ||
"tslint --fix --project tsconfig.json", | ||
@@ -90,0 +86,0 @@ "prettier --write", |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
20367
11
288