@smartsoft001/crud-shell-nestjs 2.100.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 +3 -3
package/index.js
CHANGED
|
@@ -32,25 +32,17 @@ import "reflect-metadata";
|
|
|
32
32
|
// packages/shared/models/src/lib/decorators/field/field.decorator.ts
|
|
33
33
|
import "reflect-metadata";
|
|
34
34
|
|
|
35
|
-
// packages/shared/utils/src/lib/services/
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
static hash(p) {
|
|
44
|
-
return Promise.resolve(md5(p));
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Compare password text with hashed text
|
|
48
|
-
* @param p {string} - password text
|
|
49
|
-
* @param h {string} - hashed text
|
|
35
|
+
// packages/shared/utils/src/lib/services/array/array.service.ts
|
|
36
|
+
import * as _ from "lodash";
|
|
37
|
+
|
|
38
|
+
// packages/shared/utils/src/lib/services/guid/guid.service.ts
|
|
39
|
+
import { Guid } from "guid-typescript";
|
|
40
|
+
var GuidService = class {
|
|
41
|
+
/***
|
|
42
|
+
* Create guid as string
|
|
50
43
|
*/
|
|
51
|
-
static
|
|
52
|
-
|
|
53
|
-
return hp === h;
|
|
44
|
+
static create() {
|
|
45
|
+
return Guid.raw();
|
|
54
46
|
}
|
|
55
47
|
};
|
|
56
48
|
|
|
@@ -105,19 +97,74 @@ var ObjectService = class {
|
|
|
105
97
|
}
|
|
106
98
|
};
|
|
107
99
|
|
|
108
|
-
// packages/shared/utils/src/lib/services/
|
|
109
|
-
import
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
*
|
|
100
|
+
// packages/shared/utils/src/lib/services/password/password.service.ts
|
|
101
|
+
import md5 from "md5";
|
|
102
|
+
var PasswordService = class _PasswordService {
|
|
103
|
+
/**
|
|
104
|
+
* Hash password text
|
|
105
|
+
* @param p {string} - text
|
|
106
|
+
* @return - hashed text
|
|
113
107
|
*/
|
|
114
|
-
static
|
|
115
|
-
return
|
|
108
|
+
static hash(p) {
|
|
109
|
+
return Promise.resolve(md5(p));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Compare password text with hashed text
|
|
113
|
+
* @param p {string} - password text
|
|
114
|
+
* @param h {string} - hashed text
|
|
115
|
+
*/
|
|
116
|
+
static async compare(p, h) {
|
|
117
|
+
const hp = await _PasswordService.hash(p);
|
|
118
|
+
return hp === h;
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
121
|
|
|
119
|
-
// packages/shared/utils/src/lib/services/
|
|
120
|
-
|
|
122
|
+
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
123
|
+
var SlugService = class _SlugService {
|
|
124
|
+
static {
|
|
125
|
+
this.polishToEnglishMap = {
|
|
126
|
+
"\u0105": "a",
|
|
127
|
+
"\u0107": "c",
|
|
128
|
+
"\u0119": "e",
|
|
129
|
+
"\u0142": "l",
|
|
130
|
+
"\u0144": "n",
|
|
131
|
+
"\xF3": "o",
|
|
132
|
+
"\u015B": "s",
|
|
133
|
+
"\u017A": "z",
|
|
134
|
+
"\u017C": "z",
|
|
135
|
+
"\u0104": "A",
|
|
136
|
+
"\u0106": "C",
|
|
137
|
+
"\u0118": "E",
|
|
138
|
+
"\u0141": "L",
|
|
139
|
+
"\u0143": "N",
|
|
140
|
+
"\xD3": "O",
|
|
141
|
+
"\u015A": "S",
|
|
142
|
+
"\u0179": "Z",
|
|
143
|
+
"\u017B": "Z"
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Convert text to URL-friendly slug
|
|
148
|
+
* - Replaces Polish characters with English equivalents
|
|
149
|
+
* - Converts to lowercase
|
|
150
|
+
* - Replaces spaces and special characters with hyphens
|
|
151
|
+
* - Removes multiple consecutive hyphens
|
|
152
|
+
* - Trims hyphens from start and end
|
|
153
|
+
*/
|
|
154
|
+
static create(text) {
|
|
155
|
+
if (!text) {
|
|
156
|
+
return "";
|
|
157
|
+
}
|
|
158
|
+
let slug = text.split("").map(
|
|
159
|
+
(char) => _SlugService.polishToEnglishMap[char] || char
|
|
160
|
+
).join("");
|
|
161
|
+
slug = slug.toLowerCase();
|
|
162
|
+
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
163
|
+
slug = slug.replace(/-+/g, "-");
|
|
164
|
+
slug = slug.replace(/^-+|-+$/g, "");
|
|
165
|
+
return slug;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
121
168
|
|
|
122
169
|
// packages/shared/models/src/lib/utils.ts
|
|
123
170
|
function getModelFieldKeys(type) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/crud-shell-nestjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.102.0",
|
|
4
4
|
"description": "Utils to crud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"url": "https://github.com/emiljuchnikowski/smartsoft/issues"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@smartsoft001/crud-shell-app-services": "2.
|
|
20
|
+
"@smartsoft001/crud-shell-app-services": "2.102.0",
|
|
21
21
|
"@smartsoft001/crud-shell-dto": "*",
|
|
22
|
-
"@smartsoft001/domain-core": "2.
|
|
22
|
+
"@smartsoft001/domain-core": "2.102.0"
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/emiljuchnikowski/smartsoft#readme"
|
|
25
25
|
}
|