@autofleet/sadot 0.6.9-beta.2 → 0.6.10
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/value.js
CHANGED
|
@@ -73,8 +73,11 @@ exports.findValuesByModelIds = findValuesByModelIds;
|
|
|
73
73
|
*/
|
|
74
74
|
const updateValues = async (modelType, modelId, identifiers, valuesToUpdate, options = {}) => {
|
|
75
75
|
const names = Object.keys(valuesToUpdate);
|
|
76
|
-
logger_1.default.
|
|
77
|
-
names,
|
|
76
|
+
logger_1.default.debug(`custom-fields: updating values for ${modelType} ${modelId}`, {
|
|
77
|
+
names,
|
|
78
|
+
optionsKeys: options ? Object.keys(options) : null,
|
|
79
|
+
valuesToUpdate,
|
|
80
|
+
identifiers,
|
|
78
81
|
});
|
|
79
82
|
const { modelOptions, transaction } = options;
|
|
80
83
|
const where = {
|
|
@@ -87,7 +90,7 @@ const updateValues = async (modelType, modelId, identifiers, valuesToUpdate, opt
|
|
|
87
90
|
const fieldDefinitions = await DefinitionRepo.findAll(where, { withDisabled: true, transaction, include: modelOptions.include?.(identifiers) }) || [];
|
|
88
91
|
const disabledDefinitions = fieldDefinitions.filter((def) => def.disabled);
|
|
89
92
|
if (fieldDefinitions.length !== names.length) {
|
|
90
|
-
logger_1.default.
|
|
93
|
+
logger_1.default.warn(`custom-fields: missing definitions for ${modelType} ${modelId}`, { names, fieldDefinitions });
|
|
91
94
|
const missingDefinitions = names.filter((name) => !fieldDefinitions.some((def) => def.name === name));
|
|
92
95
|
throw new errors_1.MissingDefinitionError(missingDefinitions);
|
|
93
96
|
}
|
package/package.json
CHANGED
package/src/repository/value.ts
CHANGED
|
@@ -55,8 +55,11 @@ export const updateValues = async (
|
|
|
55
55
|
options: FindOptions & { modelOptions?: ModelOptions } = {},
|
|
56
56
|
): Promise<CustomFieldValue[]> => {
|
|
57
57
|
const names = Object.keys(valuesToUpdate);
|
|
58
|
-
logger.
|
|
59
|
-
names,
|
|
58
|
+
logger.debug(`custom-fields: updating values for ${modelType} ${modelId}`, {
|
|
59
|
+
names,
|
|
60
|
+
optionsKeys: options ? Object.keys(options) : null,
|
|
61
|
+
valuesToUpdate,
|
|
62
|
+
identifiers,
|
|
60
63
|
});
|
|
61
64
|
const { modelOptions, transaction } = options;
|
|
62
65
|
|
|
@@ -72,7 +75,7 @@ export const updateValues = async (
|
|
|
72
75
|
|
|
73
76
|
const disabledDefinitions = fieldDefinitions.filter((def) => def.disabled);
|
|
74
77
|
if (fieldDefinitions.length !== names.length) {
|
|
75
|
-
logger.
|
|
78
|
+
logger.warn(`custom-fields: missing definitions for ${modelType} ${modelId}`, { names, fieldDefinitions });
|
|
76
79
|
const missingDefinitions = names.filter((name) => !fieldDefinitions.some((def) => def.name === name));
|
|
77
80
|
throw new MissingDefinitionError(missingDefinitions);
|
|
78
81
|
}
|