@webtypen/webframez-core 0.2.6 → 0.2.8
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/Database/DBConnection.d.ts +1 -1
- package/dist/Database/DBConnection.js +2 -2
- package/dist/Database/Model.d.ts +1 -1
- package/dist/Database/Model.js +2 -2
- package/dist/Functions/FileFunctions.js +3 -0
- package/package.json +1 -1
- package/src/Database/DBConnection.ts +2 -2
- package/src/Database/Model.ts +3 -2
- package/src/Functions/FileFunctions.ts +4 -0
|
@@ -12,7 +12,7 @@ declare class DBConnectionFacade {
|
|
|
12
12
|
runQuery(query: QueryBuilder, options?: {
|
|
13
13
|
[name: string]: any;
|
|
14
14
|
}): Promise<any>;
|
|
15
|
-
execute(data: any, connectionName?: string): Promise<any>;
|
|
15
|
+
execute(data: any, connectionName?: string, options?: any): Promise<any>;
|
|
16
16
|
getDriver(connectionName?: string): Promise<any>;
|
|
17
17
|
objectId(val?: any, connectionName?: string, options?: ObjectIDType): Promise<any>;
|
|
18
18
|
mapDataToModel(model: any, data: any): any;
|
|
@@ -80,10 +80,10 @@ class DBConnectionFacade {
|
|
|
80
80
|
return data;
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
execute(data, connectionName) {
|
|
83
|
+
execute(data, connectionName, options) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
const connection = yield this.getConnection(connectionName);
|
|
86
|
-
return yield connection.driver.execute(connection.client, data);
|
|
86
|
+
return yield connection.driver.execute(connection.client, data, options);
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
getDriver(connectionName) {
|
package/dist/Database/Model.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class Model {
|
|
|
51
51
|
* @param aggregation
|
|
52
52
|
* @returns any
|
|
53
53
|
*/
|
|
54
|
-
static aggregate(aggregation: any, collection?: string): Promise<any>;
|
|
54
|
+
static aggregate(aggregation: any, options?: any, collection?: string): Promise<any>;
|
|
55
55
|
/**
|
|
56
56
|
* Returns the model-data without system- and unmapped-fields (new js-object)
|
|
57
57
|
* @returns object
|
package/dist/Database/Model.js
CHANGED
|
@@ -134,14 +134,14 @@ class Model {
|
|
|
134
134
|
* @param aggregation
|
|
135
135
|
* @returns any
|
|
136
136
|
*/
|
|
137
|
-
static aggregate(aggregation, collection) {
|
|
137
|
+
static aggregate(aggregation, options, collection) {
|
|
138
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
139
139
|
const model = new this();
|
|
140
140
|
return yield DBConnection_1.DBConnection.execute({
|
|
141
141
|
type: "aggregation",
|
|
142
142
|
table: collection ? collection : model ? model.__table : undefined,
|
|
143
143
|
aggregation: aggregation,
|
|
144
|
-
}, model.__connection);
|
|
144
|
+
}, model.__connection, options);
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
@@ -15,6 +15,9 @@ function rootDir(...args) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.rootDir = rootDir;
|
|
17
17
|
function storageDir(...args) {
|
|
18
|
+
if (process.env.STORAGE_DIR && process.env.STORAGE_DIR.trim() !== "") {
|
|
19
|
+
return path_1.default.join(process.env.STORAGE_DIR, ...args);
|
|
20
|
+
}
|
|
18
21
|
const identifierBuild = "/build/node_modules/@webtypen/webframez-core";
|
|
19
22
|
if (__dirname.indexOf(identifierBuild) > 0) {
|
|
20
23
|
return path_1.default.join(__dirname.substring(0, __dirname.indexOf(identifierBuild)), "storage", ...args);
|
package/package.json
CHANGED
|
@@ -88,10 +88,10 @@ class DBConnectionFacade {
|
|
|
88
88
|
return data;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async execute(data: any, connectionName?: string) {
|
|
91
|
+
async execute(data: any, connectionName?: string, options?: any) {
|
|
92
92
|
const connection = await this.getConnection(connectionName);
|
|
93
93
|
|
|
94
|
-
return await connection.driver.execute(connection.client, data);
|
|
94
|
+
return await connection.driver.execute(connection.client, data, options);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
async getDriver(connectionName?: string) {
|
package/src/Database/Model.ts
CHANGED
|
@@ -124,7 +124,7 @@ export class Model {
|
|
|
124
124
|
* @param aggregation
|
|
125
125
|
* @returns any
|
|
126
126
|
*/
|
|
127
|
-
static async aggregate(aggregation: any, collection?: string) {
|
|
127
|
+
static async aggregate(aggregation: any, options?: any,collection?: string) {
|
|
128
128
|
const model = new this();
|
|
129
129
|
return await DBConnection.execute(
|
|
130
130
|
{
|
|
@@ -132,7 +132,8 @@ export class Model {
|
|
|
132
132
|
table: collection ? collection : model ? model.__table : undefined,
|
|
133
133
|
aggregation: aggregation,
|
|
134
134
|
},
|
|
135
|
-
model.__connection
|
|
135
|
+
model.__connection,
|
|
136
|
+
options
|
|
136
137
|
);
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -11,6 +11,10 @@ export function rootDir(...args: any) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function storageDir(...args: any) {
|
|
14
|
+
if (process.env.STORAGE_DIR && process.env.STORAGE_DIR.trim() !== "") {
|
|
15
|
+
return path.join(process.env.STORAGE_DIR, ...args);
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
const identifierBuild = "/build/node_modules/@webtypen/webframez-core";
|
|
15
19
|
if (__dirname.indexOf(identifierBuild) > 0) {
|
|
16
20
|
return path.join(__dirname.substring(0, __dirname.indexOf(identifierBuild)), "storage", ...args);
|