@webtypen/webframez-core 0.2.42 → 0.2.46
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/.github/workflows/npm-publish.yml +4 -0
- package/dist/DataBuilder/DataBuilder.js +5 -0
- package/dist/Database/Model.js +3 -1
- package/dist/Datatable/Datatable.js +6 -0
- package/package.json +1 -1
- package/src/DataBuilder/DataBuilder.ts +6 -1
- package/src/Database/Model.ts +3 -1
- package/src/Datatable/Datatable.ts +7 -0
|
@@ -28,6 +28,10 @@ jobs:
|
|
|
28
28
|
registry-url: https://registry.npmjs.org/
|
|
29
29
|
- run: npm install
|
|
30
30
|
- run: npm run build
|
|
31
|
+
- run: npm whoami
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
|
+
- run: npm config get registry
|
|
31
35
|
- run: npm publish --access public
|
|
32
36
|
env:
|
|
33
37
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -220,6 +220,11 @@ class DataBuilder {
|
|
|
220
220
|
else if (type.forms[form].fields) {
|
|
221
221
|
newData.forms[form].fields = JSON.parse(JSON.stringify(type.forms[form].fields));
|
|
222
222
|
}
|
|
223
|
+
newData.forms[form].allowDeletion =
|
|
224
|
+
(typeof type.forms[form].allowDeletion === "boolean" && type.forms[form].allowDeletion) ||
|
|
225
|
+
(typeof type.forms[form].allowDeletion === "function" && (yield type.forms[form].allowDeletion(req)))
|
|
226
|
+
? true
|
|
227
|
+
: false;
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
230
|
else {
|
package/dist/Database/Model.js
CHANGED
|
@@ -254,7 +254,9 @@ class Model {
|
|
|
254
254
|
return model.where(foreignKey, "=", this[localKey !== null && localKey !== void 0 ? localKey : "_id"]);
|
|
255
255
|
}
|
|
256
256
|
buildArrayRelationship(model, localArrayKey, foreignKey) {
|
|
257
|
-
return model.where(foreignKey !== null && foreignKey !== void 0 ? foreignKey : "_id", "=", {
|
|
257
|
+
return model.where(foreignKey !== null && foreignKey !== void 0 ? foreignKey : "_id", "=", {
|
|
258
|
+
$in: this[localArrayKey] && Array.isArray(this[localArrayKey]) ? this[localArrayKey] : [],
|
|
259
|
+
});
|
|
258
260
|
}
|
|
259
261
|
/**
|
|
260
262
|
* Returns the model-data without system- and unmapped-fields (new js-object)
|
|
@@ -324,6 +324,12 @@ class Datatable {
|
|
|
324
324
|
if (filterEl && filterEl.ignore) {
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
|
+
if (filterEl.type === "boolean") {
|
|
328
|
+
if ((typeof valueClean === "boolean" && valueClean) || (valueClean && valueClean.toString() === "true")) {
|
|
329
|
+
out[filterEl && filterEl.mapping && filterEl.mapping.trim() !== "" ? filterEl.mapping : key] = true;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
327
333
|
switch (operator) {
|
|
328
334
|
case "empty":
|
|
329
335
|
value = null;
|
package/package.json
CHANGED
|
@@ -259,7 +259,6 @@ export class DataBuilder {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
newData.forms[form] = {};
|
|
262
|
-
|
|
263
262
|
if (typeof type.forms[form].pageActions === "function") {
|
|
264
263
|
newData.forms[form].pageActions = await type.forms[form].pageActions(req);
|
|
265
264
|
} else if (type.forms[form].pageActions) {
|
|
@@ -275,6 +274,12 @@ export class DataBuilder {
|
|
|
275
274
|
} else if (type.forms[form].fields) {
|
|
276
275
|
newData.forms[form].fields = JSON.parse(JSON.stringify(type.forms[form].fields));
|
|
277
276
|
}
|
|
277
|
+
|
|
278
|
+
newData.forms[form].allowDeletion =
|
|
279
|
+
(typeof type.forms[form].allowDeletion === "boolean" && type.forms[form].allowDeletion) ||
|
|
280
|
+
(typeof type.forms[form].allowDeletion === "function" && (await type.forms[form].allowDeletion(req)))
|
|
281
|
+
? true
|
|
282
|
+
: false;
|
|
278
283
|
}
|
|
279
284
|
} else {
|
|
280
285
|
newData[key] = type[key];
|
package/src/Database/Model.ts
CHANGED
|
@@ -253,7 +253,9 @@ export class Model {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
buildArrayRelationship(model: any, localArrayKey: string, foreignKey?: string): any {
|
|
256
|
-
return model.where(foreignKey ?? "_id", "=", {
|
|
256
|
+
return model.where(foreignKey ?? "_id", "=", {
|
|
257
|
+
$in: this[localArrayKey] && Array.isArray(this[localArrayKey]) ? this[localArrayKey] : [],
|
|
258
|
+
});
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
/**
|
|
@@ -337,6 +337,13 @@ export class Datatable {
|
|
|
337
337
|
continue;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
if (filterEl.type === "boolean") {
|
|
341
|
+
if ((typeof valueClean === "boolean" && valueClean) || (valueClean && valueClean.toString() === "true")) {
|
|
342
|
+
out[filterEl && filterEl.mapping && filterEl.mapping.trim() !== "" ? filterEl.mapping : key] = true;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
340
347
|
switch (operator) {
|
|
341
348
|
case "empty":
|
|
342
349
|
value = null;
|