@smartsoft001/crud-shell-app-services 2.111.0 → 2.113.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.
- package/index.js +2 -74
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -65,78 +65,6 @@ var PasswordService = class _PasswordService {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
69
|
-
var RemoveHtmlService = class {
|
|
70
|
-
/**
|
|
71
|
-
* Remove HTML tags and decode HTML entities from text
|
|
72
|
-
* - Removes HTML tags
|
|
73
|
-
* - Decodes common named entities ( , ", etc.)
|
|
74
|
-
* - Decodes numeric entities ({ or «)
|
|
75
|
-
* - Removes any remaining unrecognized entities
|
|
76
|
-
*/
|
|
77
|
-
static create(val) {
|
|
78
|
-
if (!val) {
|
|
79
|
-
return "";
|
|
80
|
-
}
|
|
81
|
-
let result = val;
|
|
82
|
-
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
83
|
-
result = result.replace(/ /g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/„/g, "\u201E").replace(/”/g, '"').replace(/“/g, '"').replace(/«/g, "\xAB").replace(/»/g, "\xBB").replace(/‌/g, "");
|
|
84
|
-
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
85
|
-
/&#x([0-9a-f]+);/gi,
|
|
86
|
-
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
87
|
-
);
|
|
88
|
-
result = result.replace(/&[a-z]+;/gi, "");
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
94
|
-
var SlugService = class _SlugService {
|
|
95
|
-
static {
|
|
96
|
-
this.polishToEnglishMap = {
|
|
97
|
-
\u0105: "a",
|
|
98
|
-
\u0107: "c",
|
|
99
|
-
\u0119: "e",
|
|
100
|
-
\u0142: "l",
|
|
101
|
-
\u0144: "n",
|
|
102
|
-
\u00F3: "o",
|
|
103
|
-
\u015B: "s",
|
|
104
|
-
\u017A: "z",
|
|
105
|
-
\u017C: "z",
|
|
106
|
-
\u0104: "A",
|
|
107
|
-
\u0106: "C",
|
|
108
|
-
\u0118: "E",
|
|
109
|
-
\u0141: "L",
|
|
110
|
-
\u0143: "N",
|
|
111
|
-
\u00D3: "O",
|
|
112
|
-
\u015A: "S",
|
|
113
|
-
\u0179: "Z",
|
|
114
|
-
\u017B: "Z"
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Convert text to URL-friendly slug
|
|
119
|
-
* - Removes HTML tags and entities
|
|
120
|
-
* - Replaces Polish characters with English equivalents
|
|
121
|
-
* - Converts to lowercase
|
|
122
|
-
* - Replaces spaces and special characters with hyphens
|
|
123
|
-
* - Removes multiple consecutive hyphens
|
|
124
|
-
* - Trims hyphens from start and end
|
|
125
|
-
*/
|
|
126
|
-
static create(text) {
|
|
127
|
-
if (!text) {
|
|
128
|
-
return "";
|
|
129
|
-
}
|
|
130
|
-
let slug = RemoveHtmlService.create(text);
|
|
131
|
-
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
132
|
-
slug = slug.toLowerCase();
|
|
133
|
-
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
134
|
-
slug = slug.replace(/-+/g, "-");
|
|
135
|
-
slug = slug.replace(/^-+|-+$/g, "");
|
|
136
|
-
return slug;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
68
|
// packages/shared/models/src/lib/utils.ts
|
|
141
69
|
function getModelFieldKeys(type) {
|
|
142
70
|
if (!type["__fields"])
|
|
@@ -199,9 +127,9 @@ function castModel(instance, mode, permissions) {
|
|
|
199
127
|
|
|
200
128
|
// packages/shared/domain-core/src/lib/errors.ts
|
|
201
129
|
var DomainValidationError = class _DomainValidationError extends Error {
|
|
130
|
+
type = _DomainValidationError;
|
|
202
131
|
constructor(msg) {
|
|
203
132
|
super(msg);
|
|
204
|
-
this.type = _DomainValidationError;
|
|
205
133
|
}
|
|
206
134
|
};
|
|
207
135
|
|
|
@@ -211,8 +139,8 @@ var CrudService = class {
|
|
|
211
139
|
this.permissionService = permissionService;
|
|
212
140
|
this.repository = repository;
|
|
213
141
|
this.attachmentRepository = attachmentRepository;
|
|
214
|
-
this._logger = new Logger(CrudService.name, { timestamp: true });
|
|
215
142
|
}
|
|
143
|
+
_logger = new Logger(CrudService.name, { timestamp: true });
|
|
216
144
|
async create(data, user) {
|
|
217
145
|
data.id = Guid2.raw();
|
|
218
146
|
try {
|