@smartsoft001/crud-shell-app-services 2.127.0 → 2.128.0

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.
Files changed (2) hide show
  1. package/index.js +11 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
 
@@ -17,8 +16,8 @@ import { Guid as Guid2 } from "guid-typescript";
17
16
  import { Memoize } from "lodash-decorators";
18
17
 
19
18
  // packages/shared/models/src/lib/symbols.ts
20
- var SYMBOL_MODEL = Symbol.for("smartsoft:model");
21
- var SYMBOL_FIELD = Symbol.for("smartsoft:field");
19
+ var SYMBOL_MODEL = /* @__PURE__ */ Symbol.for("smartsoft:model");
20
+ var SYMBOL_FIELD = /* @__PURE__ */ Symbol.for("smartsoft:field");
22
21
 
23
22
  // packages/shared/models/src/lib/decorators/model/model.decorator.ts
24
23
  import "reflect-metadata";
@@ -67,8 +66,7 @@ var PasswordService = class _PasswordService {
67
66
 
68
67
  // packages/shared/models/src/lib/utils.ts
69
68
  function getModelFieldKeys(type) {
70
- if (!type["__fields"])
71
- return [];
69
+ if (!type["__fields"]) return [];
72
70
  return Object.keys(type["__fields"]);
73
71
  }
74
72
  function getModelFieldOptions(instance, fieldKey) {
@@ -84,8 +82,7 @@ function getModelFieldsWithOptions(instance) {
84
82
  });
85
83
  }
86
84
  function isModel(instance) {
87
- if (!instance || !instance.constructor)
88
- return false;
85
+ if (!instance || !instance.constructor) return false;
89
86
  return Reflect.hasMetadata(SYMBOL_MODEL, instance.constructor);
90
87
  }
91
88
  function getInvalidFields(instance, mode, permissions) {
@@ -106,8 +103,7 @@ function getInvalidFields(instance, mode, permissions) {
106
103
  return result;
107
104
  }
108
105
  function castModel(instance, mode, permissions) {
109
- if (!isModel(instance))
110
- return;
106
+ if (!isModel(instance)) return;
111
107
  const fieldsWithOptions = getModelFieldsWithOptions(instance);
112
108
  Object.keys(instance).filter((key) => key !== "id").forEach((key) => {
113
109
  const fieldWidthOptions = fieldsWithOptions.find((f) => f.key === key);
@@ -140,6 +136,9 @@ var CrudService = class {
140
136
  this.repository = repository;
141
137
  this.attachmentRepository = attachmentRepository;
142
138
  }
139
+ permissionService;
140
+ repository;
141
+ attachmentRepository;
143
142
  _logger = new Logger(CrudService.name, { timestamp: true });
144
143
  async create(data, user) {
145
144
  data.id = Guid2.raw();
@@ -277,8 +276,7 @@ var CrudService = class {
277
276
  data.id = GuidService.create();
278
277
  }
279
278
  this.attachmentRepository.upload(data, options);
280
- if (oldId)
281
- await this.attachmentRepository.delete(data.id);
279
+ if (oldId) await this.attachmentRepository.delete(data.id);
282
280
  return data.id;
283
281
  }
284
282
  getAttachmentInfo(id) {
@@ -306,8 +304,7 @@ var CrudService = class {
306
304
  }
307
305
  }
308
306
  checkValidUpdatePartial(item, permissions) {
309
- if (!isModel(item))
310
- return;
307
+ if (!isModel(item)) return;
311
308
  const keys = Object.keys(item);
312
309
  const array = getInvalidFields(item, "update", permissions)?.filter(
313
310
  (invalidField) => keys.some((key) => key === invalidField)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/crud-shell-app-services",
3
- "version": "2.127.0",
3
+ "version": "2.128.0",
4
4
  "description": "Utils to crud",
5
5
  "repository": {
6
6
  "type": "git",