my-typescript-library-rahul52us 1.2.4 → 1.2.5
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.
- package/dist/repository/filesystem.repository.js +5 -2
- package/dist/repository/filesystem.repository.js.map +1 -1
- package/dist/repository/schemas/fileSystem.schema.js +36 -4
- package/dist/repository/schemas/fileSystem.schema.js.map +1 -1
- package/dist/repository/schemas/workflow.schema.js +50 -16
- package/dist/repository/schemas/workflow.schema.js.map +1 -1
- package/dist/repository/workflow.repository.js +16 -14
- package/dist/repository/workflow.repository.js.map +1 -1
- package/dist/setupModal.js +6 -8
- package/dist/setupModal.js.map +1 -1
- package/dist/types/repository/schemas/fileSystem.schema.d.ts +6 -1
- package/dist/types/repository/schemas/workflow.schema.d.ts +14 -38
- package/dist/types/repository/workflow.repository.d.ts +38 -3
- package/dist/types/setupModal.d.ts +0 -1
- package/package.json +1 -1
- package/src/repository/filesystem.repository.ts +2 -2
- package/src/repository/schemas/fileSystem.schema.ts +17 -2
- package/src/repository/schemas/workflow.schema.ts +69 -39
- package/src/repository/workflow.repository.ts +1 -2
- package/src/setupModal.ts +6 -6
|
@@ -31,11 +31,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
34
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
38
|
exports.getFileData = exports.getFile = exports.uploadFile = void 0;
|
|
36
39
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
37
40
|
const stream_1 = require("stream");
|
|
38
|
-
const
|
|
41
|
+
const fileSystem_schema_1 = __importDefault(require("./schemas/fileSystem.schema"));
|
|
39
42
|
const { GridFSBucket } = mongoose_1.mongo;
|
|
40
43
|
function uploadFile(file, name, type) {
|
|
41
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -54,7 +57,7 @@ function uploadFile(file, name, type) {
|
|
|
54
57
|
readableStream.pipe(uploadStream);
|
|
55
58
|
uploadStream.on("finish", () => {
|
|
56
59
|
const fileId = uploadStream.id;
|
|
57
|
-
|
|
60
|
+
fileSystem_schema_1.default
|
|
58
61
|
.create({
|
|
59
62
|
fileId: fileId,
|
|
60
63
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.repository.js","sourceRoot":"","sources":["../../src/repository/filesystem.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filesystem.repository.js","sourceRoot":"","sources":["../../src/repository/filesystem.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuD;AACvD,mCAAkC;AAClC,oFAA0D;AAE1D,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAK,CAAC;AAE/B,SAAsB,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,IAAY;;QACvE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI;gBACA,MAAM,UAAU,GAAG,kBAAQ,CAAC,UAAU,CAAC;gBACvC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBAE/C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBACjD,MAAM,cAAc,GAAG,IAAI,iBAAQ,EAAE,CAAC;gBACtC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC5B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE1B,MAAM,YAAY,GA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CAAC,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE;oBACR,MAAM,CAAC,8BAA8B,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;aACV;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,wBAAwB,CAAC,CAAC;aACpC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAnDD,kCAmDC"}
|
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.fileSystemSchema = void 0;
|
|
7
|
-
const mongoose_1 =
|
|
8
|
-
|
|
27
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
+
// Define the Mongoose Schema
|
|
29
|
+
exports.fileSystemSchema = new mongoose_1.Schema({
|
|
9
30
|
fileId: {
|
|
10
31
|
type: mongoose_1.default.Types.ObjectId,
|
|
11
32
|
index: true,
|
|
33
|
+
required: true, // Ensure it's a required field to align with interface expectations
|
|
12
34
|
},
|
|
13
35
|
}, { timestamps: true });
|
|
36
|
+
// Handle Model Initialization
|
|
37
|
+
let FileSystemModel = null;
|
|
38
|
+
// Check if the model already exists to avoid overwriting during hot reloads
|
|
39
|
+
if (mongoose_1.default.models.FileSystem) {
|
|
40
|
+
FileSystemModel = mongoose_1.default.models.FileSystem;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
FileSystemModel = mongoose_1.default.model("FileSystem", exports.fileSystemSchema);
|
|
44
|
+
}
|
|
45
|
+
exports.default = FileSystemModel;
|
|
14
46
|
//# sourceMappingURL=fileSystem.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSystem.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/fileSystem.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fileSystem.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/fileSystem.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6D;AAO7D,6BAA6B;AAChB,QAAA,gBAAgB,GAAW,IAAI,iBAAM,CAChD;IACE,MAAM,EAAE;QACN,IAAI,EAAE,kBAAQ,CAAC,KAAK,CAAC,QAAQ;QAC7B,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI,EAAE,oEAAoE;KACrF;CACF,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,8BAA8B;AAC9B,IAAI,eAAe,GAAoC,IAAI,CAAC;AAE5D,4EAA4E;AAC5E,IAAI,kBAAQ,CAAC,MAAM,CAAC,UAAU,EAAE;IAC9B,eAAe,GAAG,kBAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;CAC9C;KAAM;IACL,eAAe,GAAG,kBAAQ,CAAC,KAAK,CAAoB,YAAY,EAAE,wBAAgB,CAAC,CAAC;CACrF;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -1,46 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
26
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
+
// Define the schema
|
|
28
|
+
const workFlowSchema = new mongoose_1.Schema({
|
|
9
29
|
user: {
|
|
10
30
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Accounts'
|
|
31
|
+
ref: 'Accounts',
|
|
32
|
+
required: true, // Ensure it's a required field
|
|
12
33
|
},
|
|
13
34
|
company: {
|
|
14
35
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
15
|
-
ref: 'Organisation'
|
|
36
|
+
ref: 'Organisation',
|
|
37
|
+
required: true, // Ensure it's a required field
|
|
16
38
|
},
|
|
17
39
|
identifier: {
|
|
18
|
-
type: String
|
|
40
|
+
type: String,
|
|
41
|
+
required: true, // Ensure it's a required field
|
|
19
42
|
},
|
|
20
43
|
workFlowName: {
|
|
21
|
-
type: String
|
|
44
|
+
type: String,
|
|
45
|
+
required: true, // Ensure it's a required field
|
|
22
46
|
},
|
|
23
47
|
values: {
|
|
24
|
-
type: mongoose_1.default.Schema.Types.Mixed
|
|
48
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
25
49
|
},
|
|
26
50
|
defaultActive: {
|
|
27
51
|
type: Boolean,
|
|
28
|
-
default: false
|
|
52
|
+
default: false,
|
|
29
53
|
},
|
|
30
54
|
created_At: {
|
|
31
55
|
type: Date,
|
|
32
56
|
default: Date.now,
|
|
33
57
|
},
|
|
34
58
|
updated_At: {
|
|
35
|
-
type: Date
|
|
59
|
+
type: Date,
|
|
36
60
|
},
|
|
37
61
|
deletedAt: {
|
|
38
|
-
type: Date
|
|
62
|
+
type: Date,
|
|
39
63
|
},
|
|
40
64
|
schema: {
|
|
41
65
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
42
|
-
default: {}
|
|
43
|
-
}
|
|
66
|
+
default: {},
|
|
67
|
+
},
|
|
44
68
|
});
|
|
45
|
-
//
|
|
69
|
+
// Handle model initialization
|
|
70
|
+
let WorkFlowModel = null;
|
|
71
|
+
if (mongoose_1.default.models.WorkFlow) {
|
|
72
|
+
console.log("WorkFlow model already exists.");
|
|
73
|
+
WorkFlowModel = mongoose_1.default.models.WorkFlow;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.log("Creating WorkFlow model fallback.");
|
|
77
|
+
WorkFlowModel = mongoose_1.default.model("WorkFlow", workFlowSchema);
|
|
78
|
+
}
|
|
79
|
+
exports.default = WorkFlowModel;
|
|
46
80
|
//# sourceMappingURL=workflow.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/workflow.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow.schema.js","sourceRoot":"","sources":["../../../src/repository/schemas/workflow.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsD;AAgBtD,oBAAoB;AACpB,MAAM,cAAc,GAAW,IAAI,iBAAM,CAAC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,IAAI,EAAE,+BAA+B;KAChD;IACD,OAAO,EAAE;QACP,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ;QACpC,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,IAAI,EAAE,+BAA+B;KAChD;IACD,UAAU,EAAE;QACV,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI,EAAE,+BAA+B;KAChD;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI,EAAE,+BAA+B;KAChD;IACD,MAAM,EAAE;QACN,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK;KAClC;IACD,aAAa,EAAE;QACb,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,KAAK;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,CAAC,GAAG;KAClB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;KACX;IACD,SAAS,EAAE;QACT,IAAI,EAAE,IAAI;KACX;IACD,MAAM,EAAE;QACN,IAAI,EAAE,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK;QACjC,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC;AAEH,8BAA8B;AAC9B,IAAI,aAAa,GAAqC,IAAI,CAAC;AAE3D,IAAI,kBAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC5B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,aAAa,GAAG,kBAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;CAC1C;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACjD,aAAa,GAAG,kBAAQ,CAAC,KAAK,CAAY,UAAU,EAAE,cAAc,CAAC,CAAC;CACvE;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -8,14 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.getWorkFlowByUser = exports.getWorkFlowLevel = exports.getWorkFlow = exports.getDefaultWorkFlows = exports.getSingleWorkFlow = exports.getDefaultWorkFlow = exports.getallUsersWorkFlow = exports.getallWorkFlow = exports.updateWorkFlow = exports.createWorkFlow = void 0;
|
|
13
|
-
const
|
|
14
|
-
const WorkFlow = (0, setupModal_1.getWorkflowModel)();
|
|
16
|
+
const workflow_schema_1 = __importDefault(require("./schemas/workflow.schema"));
|
|
15
17
|
function createWorkFlow(workFlowData) {
|
|
16
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
19
|
try {
|
|
18
|
-
const workflow =
|
|
20
|
+
const workflow = workflow_schema_1.default.create(new workflow_schema_1.default(workFlowData));
|
|
19
21
|
if (!workflow) {
|
|
20
22
|
throw new Error("Workflow creation failed");
|
|
21
23
|
}
|
|
@@ -35,7 +37,7 @@ function updateWorkFlow(id, data) {
|
|
|
35
37
|
if (!id) {
|
|
36
38
|
throw new Error("WorkFlow id is required");
|
|
37
39
|
}
|
|
38
|
-
const result = yield
|
|
40
|
+
const result = yield workflow_schema_1.default.updateOne({ _id: id }, { $set: data });
|
|
39
41
|
return result;
|
|
40
42
|
}
|
|
41
43
|
catch (error) {
|
|
@@ -114,8 +116,8 @@ function getallWorkFlow(searchValue, company, userId, page, limit, searchField)
|
|
|
114
116
|
{ $limit: Number(limit) },
|
|
115
117
|
];
|
|
116
118
|
const [workflow, totalCount] = yield Promise.all([
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
workflow_schema_1.default.aggregate(pipelineData),
|
|
120
|
+
workflow_schema_1.default.aggregate([
|
|
119
121
|
...pipeline,
|
|
120
122
|
{
|
|
121
123
|
$group: {
|
|
@@ -197,7 +199,7 @@ function getallUsersWorkFlow(username, company, userType, role) {
|
|
|
197
199
|
},
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
|
-
const [workflow] = yield Promise.all([
|
|
202
|
+
const [workflow] = yield Promise.all([workflow_schema_1.default.aggregate(pipeline)]);
|
|
201
203
|
return {
|
|
202
204
|
data: workflow,
|
|
203
205
|
};
|
|
@@ -211,7 +213,7 @@ exports.getallUsersWorkFlow = getallUsersWorkFlow;
|
|
|
211
213
|
function getDefaultWorkFlow(data) {
|
|
212
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
215
|
try {
|
|
214
|
-
let workflow = yield
|
|
216
|
+
let workflow = yield workflow_schema_1.default.findOne(data);
|
|
215
217
|
if (workflow) {
|
|
216
218
|
workflow.values = Array.isArray(workflow.values)
|
|
217
219
|
? workflow.values[workflow.values.length - 1]
|
|
@@ -240,8 +242,8 @@ exports.getDefaultWorkFlow = getDefaultWorkFlow;
|
|
|
240
242
|
function getSingleWorkFlow(data) {
|
|
241
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
242
244
|
try {
|
|
243
|
-
console.log(
|
|
244
|
-
let workflow = yield
|
|
245
|
+
console.log(workflow_schema_1.default);
|
|
246
|
+
let workflow = yield workflow_schema_1.default.findOne(data);
|
|
245
247
|
if (workflow) {
|
|
246
248
|
workflow.values = Array.isArray(workflow.values)
|
|
247
249
|
? workflow.values[workflow.values.length - 1]
|
|
@@ -270,7 +272,7 @@ exports.getSingleWorkFlow = getSingleWorkFlow;
|
|
|
270
272
|
function getDefaultWorkFlows(data) {
|
|
271
273
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
274
|
try {
|
|
273
|
-
const workflow = yield
|
|
275
|
+
const workflow = yield workflow_schema_1.default.find(data);
|
|
274
276
|
if (workflow) {
|
|
275
277
|
return {
|
|
276
278
|
status: "success",
|
|
@@ -296,7 +298,7 @@ exports.getDefaultWorkFlows = getDefaultWorkFlows;
|
|
|
296
298
|
function getWorkFlow(data) {
|
|
297
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
300
|
try {
|
|
299
|
-
const workflow = yield
|
|
301
|
+
const workflow = yield workflow_schema_1.default.findOne(data);
|
|
300
302
|
return workflow;
|
|
301
303
|
}
|
|
302
304
|
catch (error) {
|
|
@@ -308,7 +310,7 @@ exports.getWorkFlow = getWorkFlow;
|
|
|
308
310
|
function getWorkFlowLevel(Id) {
|
|
309
311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
310
312
|
try {
|
|
311
|
-
const workflow = yield
|
|
313
|
+
const workflow = yield workflow_schema_1.default.findById(Id);
|
|
312
314
|
return workflow;
|
|
313
315
|
}
|
|
314
316
|
catch (error) {
|
|
@@ -320,7 +322,7 @@ exports.getWorkFlowLevel = getWorkFlowLevel;
|
|
|
320
322
|
function getWorkFlowByUser(user, company) {
|
|
321
323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
324
|
try {
|
|
323
|
-
const workflow = yield
|
|
325
|
+
const workflow = yield workflow_schema_1.default.findOne({
|
|
324
326
|
user: user,
|
|
325
327
|
company: company,
|
|
326
328
|
deletedAt: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.repository.js","sourceRoot":"","sources":["../../src/repository/workflow.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow.repository.js","sourceRoot":"","sources":["../../src/repository/workflow.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gFAAiD;AAYjD,SAAsB,cAAc,CAClC,YAA0B;;QAE1B,IAAI;YACF,MAAM,QAAQ,GAAG,yBAAQ,CAAC,MAAM,CAAC,IAAI,yBAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YAC7D,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;aAC7C;YACD,MAAM,WAAW,GAAG,CAAC,MAAM,QAAQ,CAAC,CAAC,GAAG,CAAC;YACzC,OAAO,WAAW,CAAC;SACpB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;CAAA;AAbD,wCAaC;AAED,SAAsB,cAAc,CAAC,EAAU,EAAE,IAAS;;QACxD,IAAI;YACF,4BAA4B;YAC5B,IAAI,CAAC,EAAE,EAAE;gBACP,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;aAC5C;YACD,MAAM,MAAM,GAAG,MAAM,yBAAQ,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACrE,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAAA;AAXD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AAA;AAPD,kCAOC;AAED,SAAsB,gBAAgB,CAAC,EAAO;;QAC5C,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,yBAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,QAAQ,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;CAAA;AAPD,4CAOC;AAED,SAAsB,iBAAiB,CAAC,IAAY,EAAE,OAAe;;QACnE,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,yBAAQ,CAAC,OAAO,CAAC;gBACtC,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO;gBAChB,SAAS,EAAE;oBACT,OAAO,EAAE,KAAK;iBACf;aACF,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE;gBACZ,OAAO;oBACL,MAAM,EAAE,SAAS;oBACjB,IAAI,EAAE,QAAQ;iBACf,CAAC;aACH;iBAAM;gBACL,OAAO;oBACL,MAAM,EAAE,OAAO;oBACf,IAAI,EAAE,oBAAoB;iBAC3B,CAAC;aACH;SACF;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE,KAAK,CAAC,OAAO;aACpB,CAAC;SACH;IACH,CAAC;CAAA;AA1BD,8CA0BC"}
|
package/dist/setupModal.js
CHANGED
|
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getFileSystemModel = exports.
|
|
6
|
+
exports.getFileSystemModel = exports.getDocumentModel = exports.setupLibrary = void 0;
|
|
7
7
|
// library/mongooseSetup.ts
|
|
8
8
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
9
9
|
const document_schema_1 = require("./repository/schemas/document.schema");
|
|
10
|
-
const workflow_schema_1 = require("./repository/schemas/workflow.schema");
|
|
11
10
|
const fileSystem_schema_1 = require("./repository/schemas/fileSystem.schema");
|
|
12
11
|
/**
|
|
13
12
|
* Utility to ensure initialization has occurred
|
|
@@ -36,7 +35,7 @@ const setupLibrary = (connection) => {
|
|
|
36
35
|
console.log("Initializing library models with provided connection...");
|
|
37
36
|
// Dynamically resolve models and store them
|
|
38
37
|
DocumentModel = getOrCreateModel("Document", document_schema_1.DocumentSchema);
|
|
39
|
-
WorkflowModel = getOrCreateModel("Workflow",
|
|
38
|
+
// WorkflowModel = getOrCreateModel("Workflow", workFlowSchema);
|
|
40
39
|
FileSystemModel = getOrCreateModel("FileSystem", fileSystem_schema_1.fileSystemSchema);
|
|
41
40
|
modelsInitialized = true;
|
|
42
41
|
console.log("Library models initialized.");
|
|
@@ -55,11 +54,10 @@ const getDocumentModel = () => {
|
|
|
55
54
|
return DocumentModel;
|
|
56
55
|
};
|
|
57
56
|
exports.getDocumentModel = getDocumentModel;
|
|
58
|
-
const getWorkflowModel = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
exports.getWorkflowModel = getWorkflowModel;
|
|
57
|
+
// export const getWorkflowModel = () => {
|
|
58
|
+
// checkInitialization();
|
|
59
|
+
// return WorkflowModel;
|
|
60
|
+
// };
|
|
63
61
|
const getFileSystemModel = () => {
|
|
64
62
|
checkInitialization();
|
|
65
63
|
return FileSystemModel;
|
package/dist/setupModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupModal.js","sourceRoot":"","sources":["../src/setupModal.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,wDAAgC;AAChC,0EAAsE;
|
|
1
|
+
{"version":3,"file":"setupModal.js","sourceRoot":"","sources":["../src/setupModal.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,wDAAgC;AAChC,0EAAsE;AAEtE,8EAA0E;AAE1E;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CAAC;AACzB,CAAC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import { Schema } from "mongoose";
|
|
1
|
+
import mongoose, { Document, Model, Schema } from "mongoose";
|
|
2
|
+
export interface IFileSystemSchema extends Document {
|
|
3
|
+
fileId: mongoose.Types.ObjectId;
|
|
4
|
+
}
|
|
2
5
|
export declare const fileSystemSchema: Schema;
|
|
6
|
+
declare let FileSystemModel: Model<IFileSystemSchema> | null;
|
|
7
|
+
export default FileSystemModel;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
|
+
export interface IWorkFlow extends Document {
|
|
3
|
+
user: mongoose.Types.ObjectId;
|
|
4
|
+
company: mongoose.Types.ObjectId;
|
|
5
|
+
identifier: string;
|
|
6
|
+
workFlowName: string;
|
|
7
|
+
values: Record<string, unknown>;
|
|
5
8
|
defaultActive: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
14
|
-
schema: any;
|
|
15
|
-
created_At: NativeDate;
|
|
16
|
-
defaultActive: boolean;
|
|
17
|
-
values?: any;
|
|
18
|
-
company?: mongoose.Types.ObjectId;
|
|
19
|
-
updated_At?: NativeDate;
|
|
20
|
-
user?: mongoose.Types.ObjectId;
|
|
21
|
-
deletedAt?: NativeDate;
|
|
22
|
-
identifier?: string;
|
|
23
|
-
workFlowName?: string;
|
|
24
|
-
}>> & mongoose.FlatRecord<{
|
|
25
|
-
schema: any;
|
|
26
|
-
created_At: NativeDate;
|
|
27
|
-
defaultActive: boolean;
|
|
28
|
-
values?: any;
|
|
29
|
-
company?: mongoose.Types.ObjectId;
|
|
30
|
-
updated_At?: NativeDate;
|
|
31
|
-
user?: mongoose.Types.ObjectId;
|
|
32
|
-
deletedAt?: NativeDate;
|
|
33
|
-
identifier?: string;
|
|
34
|
-
workFlowName?: string;
|
|
35
|
-
}> & {
|
|
36
|
-
_id: mongoose.Types.ObjectId;
|
|
37
|
-
} & {
|
|
38
|
-
__v: number;
|
|
39
|
-
}>;
|
|
9
|
+
created_At: Date;
|
|
10
|
+
updated_At: Date;
|
|
11
|
+
deletedAt: Date;
|
|
12
|
+
schema: mongoose.Schema<any>;
|
|
13
|
+
}
|
|
14
|
+
declare let WorkFlowModel: mongoose.Model<IWorkFlow> | null;
|
|
15
|
+
export default WorkFlowModel;
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="passport-local-mongoose" />
|
|
26
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
27
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
1
28
|
export type WorkFlowData = {
|
|
2
29
|
_id?: string;
|
|
3
30
|
username: string;
|
|
@@ -7,7 +34,7 @@ export type WorkFlowData = {
|
|
|
7
34
|
updatedAt?: Date;
|
|
8
35
|
deletedAt?: Date;
|
|
9
36
|
};
|
|
10
|
-
export declare function createWorkFlow(workFlowData: WorkFlowData): Promise<
|
|
37
|
+
export declare function createWorkFlow(workFlowData: WorkFlowData): Promise<unknown>;
|
|
11
38
|
export declare function updateWorkFlow(id: string, data: any): Promise<any>;
|
|
12
39
|
export declare function getallWorkFlow(searchValue: string, company: string, userId: string, page: number, limit: number, searchField: any): Promise<{
|
|
13
40
|
data: any[];
|
|
@@ -28,8 +55,16 @@ export declare function getDefaultWorkFlows(data: any): Promise<{
|
|
|
28
55
|
status: string;
|
|
29
56
|
data: any;
|
|
30
57
|
}>;
|
|
31
|
-
export declare function getWorkFlow(data: any): Promise<
|
|
32
|
-
|
|
58
|
+
export declare function getWorkFlow(data: any): Promise<import("mongoose").Document<unknown, {}, import("./schemas/workflow.schema").IWorkFlow> & import("./schemas/workflow.schema").IWorkFlow & Required<{
|
|
59
|
+
_id: unknown;
|
|
60
|
+
}> & {
|
|
61
|
+
__v: number;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function getWorkFlowLevel(Id: any): Promise<import("mongoose").Document<unknown, {}, import("./schemas/workflow.schema").IWorkFlow> & import("./schemas/workflow.schema").IWorkFlow & Required<{
|
|
64
|
+
_id: unknown;
|
|
65
|
+
}> & {
|
|
66
|
+
__v: number;
|
|
67
|
+
}>;
|
|
33
68
|
export declare function getWorkFlowByUser(user: string, company: string): Promise<{
|
|
34
69
|
status: string;
|
|
35
70
|
data: any;
|
|
@@ -4,5 +4,4 @@ import mongoose from "mongoose";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const setupLibrary: (connection: typeof mongoose) => void;
|
|
6
6
|
export declare const getDocumentModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
|
|
7
|
-
export declare const getWorkflowModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
|
|
8
7
|
export declare const getFileSystemModel: () => mongoose.Model<any, {}, {}, {}, any, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mongoose, { connection, mongo } from "mongoose";
|
|
2
2
|
import { Readable } from "stream";
|
|
3
|
-
import
|
|
3
|
+
import FileSystemModel from "./schemas/fileSystem.schema";
|
|
4
4
|
|
|
5
5
|
const { GridFSBucket } = mongo;
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ export async function uploadFile(file: string, name: string, type: string) {
|
|
|
24
24
|
|
|
25
25
|
uploadStream.on("finish", () => {
|
|
26
26
|
const fileId = uploadStream.id;
|
|
27
|
-
|
|
27
|
+
FileSystemModel
|
|
28
28
|
.create({
|
|
29
29
|
fileId: fileId,
|
|
30
30
|
})
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import mongoose, { Document, Model, Schema } from "mongoose";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Define the TypeScript Interface for the Schema
|
|
4
|
+
export interface IFileSystemSchema extends Document {
|
|
4
5
|
fileId: mongoose.Types.ObjectId;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
// Define the Mongoose Schema
|
|
9
|
+
export const fileSystemSchema: Schema = new Schema(
|
|
8
10
|
{
|
|
9
11
|
fileId: {
|
|
10
12
|
type: mongoose.Types.ObjectId,
|
|
11
13
|
index: true,
|
|
14
|
+
required: true, // Ensure it's a required field to align with interface expectations
|
|
12
15
|
},
|
|
13
16
|
},
|
|
14
17
|
{ timestamps: true }
|
|
15
18
|
);
|
|
19
|
+
|
|
20
|
+
// Handle Model Initialization
|
|
21
|
+
let FileSystemModel: Model<IFileSystemSchema> | null = null;
|
|
22
|
+
|
|
23
|
+
// Check if the model already exists to avoid overwriting during hot reloads
|
|
24
|
+
if (mongoose.models.FileSystem) {
|
|
25
|
+
FileSystemModel = mongoose.models.FileSystem;
|
|
26
|
+
} else {
|
|
27
|
+
FileSystemModel = mongoose.model<IFileSystemSchema>("FileSystem", fileSystemSchema);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default FileSystemModel;
|
|
@@ -1,41 +1,71 @@
|
|
|
1
|
-
import mongoose from "mongoose"
|
|
1
|
+
import mongoose, { Schema, Document } from "mongoose";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type : String
|
|
17
|
-
},
|
|
18
|
-
values : {
|
|
19
|
-
type : mongoose.Schema.Types.Mixed
|
|
20
|
-
},
|
|
21
|
-
defaultActive : {
|
|
22
|
-
type : Boolean,
|
|
23
|
-
default : false
|
|
24
|
-
},
|
|
25
|
-
created_At: {
|
|
26
|
-
type: Date,
|
|
27
|
-
default: Date.now,
|
|
28
|
-
},
|
|
29
|
-
updated_At : {
|
|
30
|
-
type : Date
|
|
31
|
-
},
|
|
32
|
-
deletedAt: {
|
|
33
|
-
type: Date
|
|
34
|
-
},
|
|
35
|
-
schema : {
|
|
36
|
-
type : mongoose.Schema.Types.Mixed,
|
|
37
|
-
default : {}
|
|
38
|
-
}
|
|
39
|
-
})
|
|
3
|
+
// Define the interface for WorkFlow
|
|
4
|
+
export interface IWorkFlow extends Document {
|
|
5
|
+
user: mongoose.Types.ObjectId; // Required
|
|
6
|
+
company: mongoose.Types.ObjectId; // Required
|
|
7
|
+
identifier: string; // Required
|
|
8
|
+
workFlowName: string; // Required
|
|
9
|
+
values: Record<string, unknown>;
|
|
10
|
+
defaultActive: boolean;
|
|
11
|
+
created_At: Date;
|
|
12
|
+
updated_At: Date;
|
|
13
|
+
deletedAt: Date;
|
|
14
|
+
schema: mongoose.Schema<any>; // Required type correction
|
|
15
|
+
}
|
|
40
16
|
|
|
41
|
-
//
|
|
17
|
+
// Define the schema
|
|
18
|
+
const workFlowSchema: Schema = new Schema({
|
|
19
|
+
user: {
|
|
20
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
21
|
+
ref: 'Accounts',
|
|
22
|
+
required: true, // Ensure it's a required field
|
|
23
|
+
},
|
|
24
|
+
company: {
|
|
25
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
26
|
+
ref: 'Organisation',
|
|
27
|
+
required: true, // Ensure it's a required field
|
|
28
|
+
},
|
|
29
|
+
identifier: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: true, // Ensure it's a required field
|
|
32
|
+
},
|
|
33
|
+
workFlowName: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true, // Ensure it's a required field
|
|
36
|
+
},
|
|
37
|
+
values: {
|
|
38
|
+
type: mongoose.Schema.Types.Mixed,
|
|
39
|
+
},
|
|
40
|
+
defaultActive: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
created_At: {
|
|
45
|
+
type: Date,
|
|
46
|
+
default: Date.now,
|
|
47
|
+
},
|
|
48
|
+
updated_At: {
|
|
49
|
+
type: Date,
|
|
50
|
+
},
|
|
51
|
+
deletedAt: {
|
|
52
|
+
type: Date,
|
|
53
|
+
},
|
|
54
|
+
schema: {
|
|
55
|
+
type: mongoose.Schema.Types.Mixed,
|
|
56
|
+
default: {},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Handle model initialization
|
|
61
|
+
let WorkFlowModel: mongoose.Model<IWorkFlow> | null = null;
|
|
62
|
+
|
|
63
|
+
if (mongoose.models.WorkFlow) {
|
|
64
|
+
console.log("WorkFlow model already exists.");
|
|
65
|
+
WorkFlowModel = mongoose.models.WorkFlow;
|
|
66
|
+
} else {
|
|
67
|
+
console.log("Creating WorkFlow model fallback.");
|
|
68
|
+
WorkFlowModel = mongoose.model<IWorkFlow>("WorkFlow", workFlowSchema);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default WorkFlowModel;
|
package/src/setupModal.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// library/mongooseSetup.ts
|
|
2
2
|
import mongoose from "mongoose";
|
|
3
3
|
import { DocumentSchema } from "./repository/schemas/document.schema";
|
|
4
|
-
import
|
|
4
|
+
import workFlowSchema from "./repository/schemas/workflow.schema";
|
|
5
5
|
import { fileSystemSchema } from './repository/schemas/fileSystem.schema';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -36,7 +36,7 @@ export const setupLibrary = (connection: typeof mongoose) => {
|
|
|
36
36
|
|
|
37
37
|
// Dynamically resolve models and store them
|
|
38
38
|
DocumentModel = getOrCreateModel("Document", DocumentSchema);
|
|
39
|
-
WorkflowModel = getOrCreateModel("Workflow", workFlowSchema);
|
|
39
|
+
// WorkflowModel = getOrCreateModel("Workflow", workFlowSchema);
|
|
40
40
|
FileSystemModel = getOrCreateModel("FileSystem", fileSystemSchema);
|
|
41
41
|
|
|
42
42
|
modelsInitialized = true;
|
|
@@ -58,10 +58,10 @@ export const getDocumentModel = () => {
|
|
|
58
58
|
return DocumentModel;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
export const getWorkflowModel = () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
61
|
+
// export const getWorkflowModel = () => {
|
|
62
|
+
// checkInitialization();
|
|
63
|
+
// return WorkflowModel;
|
|
64
|
+
// };
|
|
65
65
|
|
|
66
66
|
export const getFileSystemModel = () => {
|
|
67
67
|
checkInitialization();
|