@punks/backend-entity-manager 0.0.380 → 0.0.381
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/cjs/index.js +9 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +9 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -201,8 +201,14 @@ class EntitySeeder {
|
|
|
201
201
|
const normalizeSheetColumn = (column) => column.replace(/ /g, "").toLowerCase();
|
|
202
202
|
const DEFAULT_DELIMITER = ";";
|
|
203
203
|
const DEFAULT_ARRAY_SEPARATOR = "|";
|
|
204
|
-
const splitArrayColumn = (value, separator) => value
|
|
205
|
-
|
|
204
|
+
const splitArrayColumn = (value, separator) => value
|
|
205
|
+
?.toString()
|
|
206
|
+
.split(separator ?? DEFAULT_ARRAY_SEPARATOR)
|
|
207
|
+
.filter((x) => x.trim());
|
|
208
|
+
const joinArrayColumn = (value, separator) => value
|
|
209
|
+
?.map((x) => x.toString().trim())
|
|
210
|
+
.filter((x) => x)
|
|
211
|
+
.join(separator ?? DEFAULT_ARRAY_SEPARATOR);
|
|
206
212
|
class EntitySerializer {
|
|
207
213
|
constructor(services, options) {
|
|
208
214
|
this.services = services;
|
|
@@ -40746,7 +40752,7 @@ const fieldOptionValidator = (item, selector, { availableOptions, required, }) =
|
|
|
40746
40752
|
};
|
|
40747
40753
|
};
|
|
40748
40754
|
const fieldOptionsValidator = (item, selector, { availableOptions, minSelected, maxSelected, }) => {
|
|
40749
|
-
const values = selector(item);
|
|
40755
|
+
const values = selector(item).filter((x) => x) ?? [];
|
|
40750
40756
|
const errors = [];
|
|
40751
40757
|
const invalidOptions = values.filter((x) => !availableOptions.includes(x));
|
|
40752
40758
|
invalidOptions.forEach((x) => errors.push({ errorCode: "invalidOption", value: x }));
|