@smartsoft001/trans-shell-nestjs 2.101.0 → 2.102.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 +74 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -38,25 +38,17 @@ import "reflect-metadata";
|
|
|
38
38
|
// packages/shared/models/src/lib/decorators/field/field.decorator.ts
|
|
39
39
|
import "reflect-metadata";
|
|
40
40
|
|
|
41
|
-
// packages/shared/utils/src/lib/services/
|
|
42
|
-
import
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
static hash(p) {
|
|
50
|
-
return Promise.resolve(md5(p));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Compare password text with hashed text
|
|
54
|
-
* @param p {string} - password text
|
|
55
|
-
* @param h {string} - hashed text
|
|
41
|
+
// packages/shared/utils/src/lib/services/array/array.service.ts
|
|
42
|
+
import * as _ from "lodash";
|
|
43
|
+
|
|
44
|
+
// packages/shared/utils/src/lib/services/guid/guid.service.ts
|
|
45
|
+
import { Guid } from "guid-typescript";
|
|
46
|
+
var GuidService = class {
|
|
47
|
+
/***
|
|
48
|
+
* Create guid as string
|
|
56
49
|
*/
|
|
57
|
-
static
|
|
58
|
-
|
|
59
|
-
return hp === h;
|
|
50
|
+
static create() {
|
|
51
|
+
return Guid.raw();
|
|
60
52
|
}
|
|
61
53
|
};
|
|
62
54
|
|
|
@@ -111,19 +103,74 @@ var ObjectService = class {
|
|
|
111
103
|
}
|
|
112
104
|
};
|
|
113
105
|
|
|
114
|
-
// packages/shared/utils/src/lib/services/
|
|
115
|
-
import
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
*
|
|
106
|
+
// packages/shared/utils/src/lib/services/password/password.service.ts
|
|
107
|
+
import md5 from "md5";
|
|
108
|
+
var PasswordService = class _PasswordService {
|
|
109
|
+
/**
|
|
110
|
+
* Hash password text
|
|
111
|
+
* @param p {string} - text
|
|
112
|
+
* @return - hashed text
|
|
119
113
|
*/
|
|
120
|
-
static
|
|
121
|
-
return
|
|
114
|
+
static hash(p) {
|
|
115
|
+
return Promise.resolve(md5(p));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Compare password text with hashed text
|
|
119
|
+
* @param p {string} - password text
|
|
120
|
+
* @param h {string} - hashed text
|
|
121
|
+
*/
|
|
122
|
+
static async compare(p, h) {
|
|
123
|
+
const hp = await _PasswordService.hash(p);
|
|
124
|
+
return hp === h;
|
|
122
125
|
}
|
|
123
126
|
};
|
|
124
127
|
|
|
125
|
-
// packages/shared/utils/src/lib/services/
|
|
126
|
-
|
|
128
|
+
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
129
|
+
var SlugService = class _SlugService {
|
|
130
|
+
static {
|
|
131
|
+
this.polishToEnglishMap = {
|
|
132
|
+
"\u0105": "a",
|
|
133
|
+
"\u0107": "c",
|
|
134
|
+
"\u0119": "e",
|
|
135
|
+
"\u0142": "l",
|
|
136
|
+
"\u0144": "n",
|
|
137
|
+
"\xF3": "o",
|
|
138
|
+
"\u015B": "s",
|
|
139
|
+
"\u017A": "z",
|
|
140
|
+
"\u017C": "z",
|
|
141
|
+
"\u0104": "A",
|
|
142
|
+
"\u0106": "C",
|
|
143
|
+
"\u0118": "E",
|
|
144
|
+
"\u0141": "L",
|
|
145
|
+
"\u0143": "N",
|
|
146
|
+
"\xD3": "O",
|
|
147
|
+
"\u015A": "S",
|
|
148
|
+
"\u0179": "Z",
|
|
149
|
+
"\u017B": "Z"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Convert text to URL-friendly slug
|
|
154
|
+
* - Replaces Polish characters with English equivalents
|
|
155
|
+
* - Converts to lowercase
|
|
156
|
+
* - Replaces spaces and special characters with hyphens
|
|
157
|
+
* - Removes multiple consecutive hyphens
|
|
158
|
+
* - Trims hyphens from start and end
|
|
159
|
+
*/
|
|
160
|
+
static create(text) {
|
|
161
|
+
if (!text) {
|
|
162
|
+
return "";
|
|
163
|
+
}
|
|
164
|
+
let slug = text.split("").map(
|
|
165
|
+
(char) => _SlugService.polishToEnglishMap[char] || char
|
|
166
|
+
).join("");
|
|
167
|
+
slug = slug.toLowerCase();
|
|
168
|
+
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
169
|
+
slug = slug.replace(/-+/g, "-");
|
|
170
|
+
slug = slug.replace(/^-+|-+$/g, "");
|
|
171
|
+
return slug;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
127
174
|
|
|
128
175
|
// packages/shared/models/src/lib/utils.ts
|
|
129
176
|
function getModelFieldKeys(type) {
|