@oneblink/storage 2.0.0-beta.1 → 2.0.0-beta.2
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.
|
@@ -19,9 +19,9 @@ class OneBlinkRequestHandler {
|
|
|
19
19
|
request.query['key'] = this.oneblinkResponse.s3.key;
|
|
20
20
|
}
|
|
21
21
|
const requestUrl = `${request.method} ${request.protocol}//${request.hostname}${request.path}?${new URLSearchParams(request.query).toString()}`;
|
|
22
|
-
console.log('Starting
|
|
22
|
+
console.log('Starting storage upload request', requestUrl);
|
|
23
23
|
const response = await this.oneBlinkHttpHandler.handleRequest(request);
|
|
24
|
-
console.log('Finished
|
|
24
|
+
console.log('Finished storage upload request', requestUrl);
|
|
25
25
|
const oneblinkResponse = response.headers['x-oneblink-response'];
|
|
26
26
|
if (typeof oneblinkResponse === 'string') {
|
|
27
27
|
this.oneblinkResponse = JSON.parse(oneblinkResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneBlinkRequestHandler.js","sourceRoot":"","sources":["../src/OneBlinkRequestHandler.ts"],"names":[],"mappings":";;;AASA;;;;GAIG;AACH,MAAa,sBAAsB;IAQjC,YACE,mBAAyC,EACzC,iBAAqC;QAErC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;QAC9C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAoB;QAC/B,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,SAAS,CACzD,IAAI,CAAC,iBAAiB,CACvB,CAAA;QACH,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAA;QACrD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AAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,UAAU,CAAC,CAAA;QAE1D,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;QAChE,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YACzC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QACtD,CAAC;QAED,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY;gBACf,MAAM,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;QAC/D,CAAC;QAED,OAAO;YACL,QAAQ;SACT,CAAA;IACH,CAAC;CACF;AA9CD,wDA8CC","sourcesContent":["import { HttpRequest, HttpResponse } from '@smithy/protocol-http'\nimport { RequestHandler } from '@smithy/types'\nimport {\n RequestBodyHeader,\n IOneBlinkHttpHandler,\n OneBlinkResponse,\n FailResponse,\n} from './http-handlers/types'\n\n/**\n * Our own custom request handler to allow the response header which includes\n * dynamic data from the lambda at edge to be retrieved and held for later when\n * the upload has completed.\n */\nexport class OneBlinkRequestHandler<T>\n implements RequestHandler<HttpRequest, HttpResponse>\n{\n requestBodyHeader?: RequestBodyHeader\n oneBlinkHttpHandler: IOneBlinkHttpHandler\n oneblinkResponse?: OneBlinkResponse<T>\n failResponse?: FailResponse\n\n constructor(\n oneBlinkHttpHandler: IOneBlinkHttpHandler,\n requestBodyHeader?: RequestBodyHeader,\n ) {\n this.oneBlinkHttpHandler = oneBlinkHttpHandler\n this.requestBodyHeader = requestBodyHeader\n }\n\n async handle(request: HttpRequest) {\n if (this.requestBodyHeader) {\n request.headers['x-oneblink-request-body'] = JSON.stringify(\n this.requestBodyHeader,\n )\n }\n\n if (this.oneblinkResponse) {\n request.query['key'] = this.oneblinkResponse.s3.key\n }\n\n const requestUrl = `${request.method} ${request.protocol}//${request.hostname}${request.path}?${new URLSearchParams(request.query as Record<string, string>).toString()}`\n console.log('Starting storage upload request', requestUrl)\n const response = await this.oneBlinkHttpHandler.handleRequest(request)\n console.log('Finished storage upload request', requestUrl)\n\n const oneblinkResponse = response.headers['x-oneblink-response']\n if (typeof oneblinkResponse === 'string') {\n this.oneblinkResponse = JSON.parse(oneblinkResponse)\n }\n\n if (response.statusCode >= 400) {\n this.failResponse =\n await this.oneBlinkHttpHandler.handleFailResponse(response)\n }\n\n return {\n response,\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/storage",
|
|
3
3
|
"description": "SDK for managing storage files in the OneBlink ecosystem",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.2",
|
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/oneblink/storage/issues"
|