blixify-server 0.1.80 → 0.1.81
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.
|
@@ -15,9 +15,10 @@ export declare class MongoWrapper {
|
|
|
15
15
|
lib: WrapperLib;
|
|
16
16
|
tableId: string;
|
|
17
17
|
logId: string;
|
|
18
|
+
logWorkflow: any;
|
|
18
19
|
debug: any;
|
|
19
20
|
modelChecker: (obj: any) => boolean;
|
|
20
|
-
constructor(mongoDB: any, collection: string, isProd: boolean, config: SecurityConfig, modelChecker: (obj: any, ignore?: boolean) => boolean, lib: WrapperLib, tableId?: string, logId?: string, debug?: (reqBody: any, curBody: any, errMsg: any) => void);
|
|
21
|
+
constructor(mongoDB: any, collection: string, isProd: boolean, config: SecurityConfig, modelChecker: (obj: any, ignore?: boolean) => boolean, lib: WrapperLib, tableId?: string, logId?: string, logWorkflow?: (data: any) => Promise<any>, debug?: (reqBody: any, curBody: any, errMsg: any) => void);
|
|
21
22
|
parseModel: (data: any) => any;
|
|
22
23
|
handleLogging: (mongoId: any, type: "create" | "update" | "delete", req: any, value?: {
|
|
23
24
|
new?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AAUA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAmGD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,GAAG,CAAM;IAClB,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,SAAM;IACb,KAAK,SAAM;IACX,KAAK,EAAE,GAAG,CAAC;IAEX,YAAY,QAAS,GAAG,aAEtB;gBAGA,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,M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,EAAE,GAAG,KAAK,IAAI;IAe3D,UAAU,SAAU,GAAG,SAIrB;IAEF,aAAa,YACF,GAAG,QACN,QAAQ,GAAG,QAAQ,GAAG,QAAQ,OAC/B,GAAG,UACA;QACN,GAAG,CAAC,EAAE,GAAG,CAAC;QACV,GAAG,CAAC,EAAE,GAAG,CAAC;KACX,mBA8CD;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBAyE5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAkDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBAgCjC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAsJtC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAgGtC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBA6H5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAwCtC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG;;;;;mBAoQlC;IAEF,IAAI,YA+EF;CACH"}
|
|
@@ -124,7 +124,7 @@ const handleParseQueryFilter = (queryList, prefix) => {
|
|
|
124
124
|
*
|
|
125
125
|
*/
|
|
126
126
|
class MongoWrapper {
|
|
127
|
-
constructor(mongoDB, collection, isProd, config, modelChecker, lib, tableId, logId, debug) {
|
|
127
|
+
constructor(mongoDB, collection, isProd, config, modelChecker, lib, tableId, logId, logWorkflow, debug) {
|
|
128
128
|
this.mongoDB = "";
|
|
129
129
|
this.collection = "";
|
|
130
130
|
this.isProd = false;
|
|
@@ -188,6 +188,8 @@ class MongoWrapper {
|
|
|
188
188
|
.db(this.tableId)
|
|
189
189
|
.collection(this.logId);
|
|
190
190
|
yield mongoLogCollection.insertOne(logItem);
|
|
191
|
+
if (this.logWorkflow)
|
|
192
|
+
yield this.logWorkflow(logItem);
|
|
191
193
|
}
|
|
192
194
|
catch (err) { }
|
|
193
195
|
});
|
|
@@ -286,7 +288,7 @@ class MongoWrapper {
|
|
|
286
288
|
yield workflow(req.body.data);
|
|
287
289
|
const mongoResult = yield mongoCollection.insertOne(req.body.data);
|
|
288
290
|
const mongoId = mongoResult.insertedId.toString();
|
|
289
|
-
this.handleLogging(mongoId, "create", req);
|
|
291
|
+
yield this.handleLogging(mongoId, "create", req);
|
|
290
292
|
const resBody = { success: true };
|
|
291
293
|
if ((_c = req.body) === null || _c === void 0 ? void 0 : _c.stopRes)
|
|
292
294
|
return resBody;
|
|
@@ -520,7 +522,7 @@ class MongoWrapper {
|
|
|
520
522
|
Object.keys(data).map((eachUpdateKey) => {
|
|
521
523
|
oldData[eachUpdateKey] = mongoData[eachUpdateKey];
|
|
522
524
|
});
|
|
523
|
-
this.handleLogging(valid, "update", req, {
|
|
525
|
+
yield this.handleLogging(valid, "update", req, {
|
|
524
526
|
old: oldData,
|
|
525
527
|
new: data,
|
|
526
528
|
});
|
|
@@ -682,7 +684,9 @@ class MongoWrapper {
|
|
|
682
684
|
yield mongoCollection.findOneAndDelete({
|
|
683
685
|
_id: valid,
|
|
684
686
|
});
|
|
685
|
-
this.handleLogging(mongoData._id, "delete", req, {
|
|
687
|
+
yield this.handleLogging(mongoData._id, "delete", req, {
|
|
688
|
+
new: mongoData,
|
|
689
|
+
});
|
|
686
690
|
const resBody = { success: true };
|
|
687
691
|
if ((_o = req.body) === null || _o === void 0 ? void 0 : _o.stopRes)
|
|
688
692
|
return resBody;
|
|
@@ -1000,6 +1004,7 @@ class MongoWrapper {
|
|
|
1000
1004
|
const tableSuffix = this.isProd ? "prod" : "dev";
|
|
1001
1005
|
this.tableId = tableId ? `${tableId}-${tableSuffix}` : tableSuffix;
|
|
1002
1006
|
this.logId = logId !== null && logId !== void 0 ? logId : "";
|
|
1007
|
+
this.logWorkflow = logWorkflow;
|
|
1003
1008
|
this.debug = debug;
|
|
1004
1009
|
}
|
|
1005
1010
|
}
|