blixify-server 0.1.23 → 0.1.24
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,8 +1,5 @@
|
|
|
1
1
|
import SecurityConfig from "../model/SecurityConfig";
|
|
2
|
-
|
|
3
|
-
express?: any;
|
|
4
|
-
axios?: any;
|
|
5
|
-
}
|
|
2
|
+
import { WrapperLib } from "./mongoWrapper";
|
|
6
3
|
export declare const queryMondayApi: (token: string, query: any, variables?: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
4
|
/**
|
|
8
5
|
* @Wrapper
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mondayWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mondayWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"mondayWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mondayWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,eAAO,MAAM,cAAc,UAClB,MAAM,SACN,GAAG,cACE,GAAG,qDAahB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAa;IACxB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,OAAO,SAAM;IACb,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAEhB,YAAY,QAAS,GAAG,aAEtB;IACF,SAAS;cAAe,MAAM,EAAE;;;;MAK9B;gBAGA,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,SAAS,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,EACpE,GAAG,EAAE,UAAU;IAWjB,UAAU,eAAgB;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,MAAM,CAAC;QACb,aAAa,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC9D,SAaC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCAoDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG,mBAyCjC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG,mBAyDlC;IAEF,UAAU,QAAe,GAAG,OAAO,GAAG,mBA0DpC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCAwDtC;IAEF,IAAI,YA8CF;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/uploadWrapper.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,yBAAyB,CAAC;
|
|
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,OAAO,QAAe,GAAG,OAAO,GAAG,mBAgCjC;IAEF,IAAI,YAqEF;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,n,r,
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,n,r,l){return new(r=r||Promise)(function(i,t){function s(e){try{o(l.next(e))}catch(e){t(e)}}function a(e){try{o(l.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}o((l=l.apply(e,n||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UploadWrapper=void 0;const QueryModel_1=require("../model/QueryModel"),axios_1=__importDefault(require("axios")),mime_1=__importDefault(require("mime"));class UploadWrapper{constructor(e,t,i,s,a){this.uploadAdmin="",this.isProd=!1,this.config={baseConfig:[],opsConfig:{read:[],create:[],update:[],delete:[]}},this.storageType="firebase",this.modelChecker=(e,t)=>!(!e.assetCollectionName||!e.assetParentId||!t&&!e.assetFileName),this.initUpload=(d,c,u)=>__awaiter(this,void 0,void 0,function*(){try{const l=d.body.data;if(this.modelChecker(l)&&(d.file||l.downloadLink)){var e=(0,QueryModel_1.checkBaseConfig)(this.config,d),t=(0,QueryModel_1.checkOpsConfig)(this.config,u,d,l);if(e&&t){const n=this.lib.randomUUID();if("aws"===this.storageType){var i,s=(n,r)=>new Promise((a,o)=>__awaiter(this,void 0,void 0,function*(){var e="buffer"===n,t=new this.uploadAdmin.S3;let i;e||(s=d.file.originalname.split(".").pop(),i="mbtiles"===s?"application/vnd.mapbox-vector-tile":mime_1.default.getType(s)||d.file.mimetype);var s={Bucket:`${l.bucketName}/${l.assetCollectionName}/`+l.assetParentId,Key:e?l.assetFileName:d.file.originalname,Body:e?r.data:d.file.buffer,ContentType:e?r.headers["content-type"]:i};t.upload(s,function(e){e?o(e):a("aws")})}));l.downloadLink?(i=yield(0,axios_1.default)({method:"GET",url:l.downloadLink,responseType:"arraybuffer"})).data&&(yield s("buffer",i)):yield s("file")}else{const r=this.uploadAdmin.storage().bucket();var a,o=(a,o)=>new Promise((i,s)=>__awaiter(this,void 0,void 0,function*(){var e="buffer"===a,t={contentType:e?o.headers["content-type"]:d.file.mimetype,customMetadata:{"file-name":"buffer"===a?l.assetFileName:d.file.originalname},metadata:{firebaseStorageDownloadTokens:n}},t=r.file(`${l.assetCollectionName}/${l.assetParentId}/`+l.assetFileName).createWriteStream({metadata:t});t.end(e?o.data:d.file.buffer),t.on("error",s),t.on("finish",i)}));l.downloadLink?(a=yield(0,axios_1.default)({method:"GET",url:l.downloadLink,responseType:"arraybuffer"})).data&&(yield o("buffer",a)):yield o("file")}c.send({data:n})}else c.status(400).json({err:"Invalid Security Configuration"})}else c.status(400).json({err:"Invalid Fields"})}catch(e){c.status(400).json({err:e})}}),this.initDelete=(o,n)=>__awaiter(this,void 0,void 0,function*(){try{var e,t,i,s,a=o.body.data;this.modelChecker(a)?(e=(0,QueryModel_1.checkBaseConfig)(this.config,o),t=(0,QueryModel_1.checkOpsConfig)(this.config,"delete",o,a),e&&t?("aws"===this.storageType?(i=new this.uploadAdmin.S3,s={Bucket:`${a.bucketName}/${a.assetCollectionName}/`+a.assetParentId,Key:a.assetFileName},yield i.deleteObject(s).promise()):yield this.uploadAdmin.storage().bucket().file(`${a.assetCollectionName}/${a.assetParentId}/`+a.assetFileName).delete(),n.send({success:!0})):n.status(400).json({err:"Invalid Security Configuration"})):n.status(400).json({err:"Invalid Fields"})}catch(e){n.status(400).json({err:e})}}),this.deleteGoogleFolderContents=o=>__awaiter(this,void 0,void 0,function*(){try{var e={prefix:o.name,autoPaginate:!1},[t]=yield this.uploadAdmin.storage().bucket().getFiles(e),i=[];for(const s of t)i.push(s.delete());for(const a of t)a.name.endsWith("/")&&i.push(this.deleteGoogleFolderContents(a));yield Promise.all(i)}catch(e){}}),this.deleteAWSFolderContent=(a,o)=>__awaiter(this,void 0,void 0,function*(){try{var e=new this.uploadAdmin.S3,t=(yield e.listObjectsV2({Bucket:a,Prefix:o}).promise()).Contents.map(e=>e.Key),i=[];for(const s of t)i.push(e.deleteObject({Bucket:a,Key:s}).promise());yield Promise.all(i)}catch(e){}}),this.initDeleteDirectory=(a,o)=>__awaiter(this,void 0,void 0,function*(){try{var e,t,i,s=a.body.data;this.modelChecker(s,!0)?(e=(0,QueryModel_1.checkBaseConfig)(this.config,a),t=(0,QueryModel_1.checkOpsConfig)(this.config,"delete",a,s),e&&t?("aws"===this.storageType?yield this.deleteAWSFolderContent(""+s.bucketName,`${s.assetCollectionName}/${s.assetParentId}/`):(i=this.uploadAdmin.storage().bucket().file(`${s.assetCollectionName}/${s.assetParentId}/`),yield this.deleteGoogleFolderContents(i)),o.send({success:!0})):o.status(400).json({err:"Invalid Security Configuration"})):o.status(400).json({err:"Invalid Fields"})}catch(e){o.status(400).json({err:e})}}),this.initGet=(n,r)=>__awaiter(this,void 0,void 0,function*(){try{const{bucketName:e,assetCollectionName:t,assetParentId:i,fileName:s}=n.params;if("aws"===this.storageType){const a=new this.uploadAdmin.S3,o={Bucket:e,Key:t+`/${i}/`+s};a.headObject(o,e=>__awaiter(this,void 0,void 0,function*(){if(e&&"NotFound"===e.code)r.status(404).send({message:"File not found"});else{var t=yield a.getObject(o).promise(),i=s.split(".").pop();let e;e="mbtiles"===i?"application/vnd.mapbox-vector-tile":mime_1.default.getType(i)||t.ContentType,r.set("Content-Type",e),r.send(t.Body)}}))}}catch(e){r.status(400).json({err:e})}}),this.init=()=>{var e=this.lib.express.Router();return this.lib.cors&&e.use(this.lib.cors()),e.post("/upload",this.lib.multer.single("file"),(e,t)=>{this.initUpload(e,t,"create")}),e.post("/update",this.lib.multer.single("file"),(e,t)=>{this.initUpload(e,t,"update")}),e.post("/delete",this.initDelete),e.post("/deleteDirectory",this.initDeleteDirectory),e.get("/get/:bucketName/:assetCollectionName/:assetParentId/:fileName",this.initGet),e},this.uploadAdmin=e,this.isProd=t,this.config=i,this.lib=s,this.storageType=null!=a?a:"firebase"}}exports.UploadWrapper=UploadWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blixify-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/apis/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"aws-sdk": "^2.1423.0",
|
|
38
37
|
"axios": "^1.4.0",
|
|
38
|
+
"mime": "^3.0.0",
|
|
39
39
|
"moment": "^2.29.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@types/node": "^17.0.35",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
|
45
45
|
"@typescript-eslint/parser": "^5.25.0",
|
|
46
|
+
"aws-sdk": "^2.1432.0",
|
|
46
47
|
"body-parser": "^1.20.0",
|
|
47
48
|
"branch-naming-check": "^1.0.2",
|
|
48
49
|
"commit-message-validator": "^1.0.2",
|