@punks/backend-entity-manager 0.0.352 → 0.0.354

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 CHANGED
@@ -249,7 +249,7 @@ class EntitySerializer {
249
249
  const validationErrors = [];
250
250
  for (const column of definition.columns) {
251
251
  for (const validator of column.validators ?? []) {
252
- const result = validator.fn((item) => item[column.selector]);
252
+ const result = validator.fn(entity);
253
253
  if (!result.isValid) {
254
254
  validationErrors.push({
255
255
  errorCode: validator.key,
@@ -40337,6 +40337,14 @@ const renderHandlebarsTemplate = (input) => {
40337
40337
 
40338
40338
  const newUuid = backendCore.newUuid;
40339
40339
 
40340
+ const fieldRequiredValidator = (item, selector) => {
40341
+ const value = selector(item);
40342
+ return {
40343
+ isValid: !!value,
40344
+ validationErrors: value ? [] : [{ errorCode: "required" }],
40345
+ };
40346
+ };
40347
+
40340
40348
  const createClient$2 = (settings) => new clientSes.SESClient({
40341
40349
  region: settings.region,
40342
40350
  credentials: settings.awsAccessKeyId && settings.awsSecretAccessKey
@@ -44434,6 +44442,7 @@ exports.buildProviderToken = buildProviderToken;
44434
44442
  exports.buildRolesGuard = buildRolesGuard;
44435
44443
  exports.createContainer = createContainer;
44436
44444
  exports.createExpressFileResponse = createExpressFileResponse;
44445
+ exports.fieldRequiredValidator = fieldRequiredValidator;
44437
44446
  exports.getEntityManagerProviderToken = getEntityManagerProviderToken;
44438
44447
  exports.getLocalizedText = getLocalizedText;
44439
44448
  exports.newUuid = newUuid;