blixify-server 0.2.21 → 0.2.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"uploadWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/uploadWrapper.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAIrD,UAAU,SAAS;IACjB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,WAAW,EAAE,GAAG,CAAM;IACtB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,SAAc;IAEzB,YAAY,QAAS,GAAG,sBAAsB,OAAO,aAUnD;gBAGA,WAAW,EAAE,GAAG,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,SAAS,EACd,WAAW,CAAC,EAAE,UAAU,GAAG,KAAK;IASlC,UAAU,QAAe,GAAG,OAAO,GAAG,QAAQ,QAAQ,GAAG,QAAQ,mBAkG/D;IAEF,UAAU,QAAe,GAAG,OAAO,GAAG,mBAuCpC;IAEF,0BAA0B,cAAqB,GAAG,mBAwBhD;IAEF,sBAAsB,eACR,MAAM,mBACD,MAAM,mBAiBvB;IAEF,mBAAmB,QAAe,GAAG,OAAO,GAAG,mBAqC7C;IAEF,wBAAwB,QAAe,GAAG,OAAO,GAAG,mBA2ClD;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG,mBAgCjC;IAEF,IAAI,YA6EF;CACH"}
1
+ {"version":3,"file":"uploadWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/uploadWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAErD,UAAU,SAAS;IACjB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,WAAW,EAAE,GAAG,CAAM;IACtB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,SAAc;IAEzB,YAAY,QAAS,GAAG,sBAAsB,OAAO,aAUnD;gBAGA,WAAW,EAAE,GAAG,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,SAAS,EACd,WAAW,CAAC,EAAE,UAAU,GAAG,KAAK;IASlC,UAAU,QAAe,GAAG,OAAO,GAAG,QAAQ,QAAQ,GAAG,QAAQ,mBAkG/D;IAEF,UAAU,QAAe,GAAG,OAAO,GAAG,mBAuCpC;IAEF,0BAA0B,cAAqB,GAAG,mBAwBhD;IAEF,sBAAsB,eACR,MAAM,mBACD,MAAM,mBAiBvB;IAEF,mBAAmB,QAAe,GAAG,OAAO,GAAG,mBAqC7C;IAEF,wBAAwB,QAAe,GAAG,OAAO,GAAG,mBA2ClD;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG,mBAqCjC;IAEF,IAAI,YA6EF;CACH"}
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.UploadWrapper = void 0;
16
- const QueryModel_1 = require("../model/QueryModel");
17
16
  const axios_1 = __importDefault(require("axios"));
18
17
  const mime_1 = __importDefault(require("mime"));
18
+ const QueryModel_1 = require("../model/QueryModel");
19
19
  /**
20
20
  * @Wrapper
21
21
  *
@@ -294,12 +294,16 @@ class UploadWrapper {
294
294
  this.initGet = (req, res) => __awaiter(this, void 0, void 0, function* () {
295
295
  //TODO: add FB initGet
296
296
  try {
297
- const { bucketName, assetCollectionName, assetParentId, fileName } = req.params;
297
+ const { bucketName, assetCollectionName, assetParentId } = req.params;
298
+ const fullPath = req.path;
299
+ const basePath = `/get/${bucketName}/${assetCollectionName}/${assetParentId}/`;
300
+ const nestedPath = fullPath.replace(basePath, "");
298
301
  if (this.storageType === "aws") {
299
302
  const s3 = new this.uploadAdmin.S3();
303
+ const key = `${assetCollectionName}/${assetParentId}/${nestedPath}`;
300
304
  const params = {
301
305
  Bucket: bucketName,
302
- Key: `${assetCollectionName}/${assetParentId}/${fileName}`,
306
+ Key: key,
303
307
  };
304
308
  s3.headObject(params, (err) => __awaiter(this, void 0, void 0, function* () {
305
309
  if (err && err.code === "NotFound") {
@@ -307,7 +311,7 @@ class UploadWrapper {
307
311
  }
308
312
  else {
309
313
  const resp = yield s3.getObject(params).promise();
310
- const extension = fileName.split(".").pop();
314
+ const extension = nestedPath.split(".").pop();
311
315
  let contentType;
312
316
  if (extension === "mbtiles") {
313
317
  contentType = "application/vnd.mapbox-vector-tile";
@@ -381,9 +385,9 @@ class UploadWrapper {
381
385
  * bucketName - string
382
386
  * assetCollectionName - string
383
387
  * assetParentId - string
384
- * fileName - string
388
+ * * - string - Any number of nested paths and the final filename
385
389
  */
386
- router.get("/get/:bucketName/:assetCollectionName/:assetParentId/:fileName", this.initGet);
390
+ router.get("/get/:bucketName/:assetCollectionName/:assetParentId/*", this.initGet);
387
391
  return router;
388
392
  };
389
393
  this.uploadAdmin = uploadAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blixify-server",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "license": "MIT",
5
5
  "main": "dist/apis/index.js",
6
6
  "private": false,