@smartsoft001/crud-shell-app-services 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.
Files changed (2) hide show
  1. package/index.js +60 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -26,6 +26,23 @@ import "reflect-metadata";
26
26
  // packages/shared/models/src/lib/decorators/field/field.decorator.ts
27
27
  import "reflect-metadata";
28
28
 
29
+ // packages/shared/utils/src/lib/services/array/array.service.ts
30
+ import * as _ from "lodash";
31
+
32
+ // packages/shared/utils/src/lib/services/guid/guid.service.ts
33
+ import { Guid } from "guid-typescript";
34
+ var GuidService = class {
35
+ /***
36
+ * Create guid as string
37
+ */
38
+ static create() {
39
+ return Guid.raw();
40
+ }
41
+ };
42
+
43
+ // packages/shared/utils/src/lib/services/object/object.service.ts
44
+ import { stringify } from "flatted";
45
+
29
46
  // packages/shared/utils/src/lib/services/password/password.service.ts
30
47
  import md5 from "md5";
31
48
  var PasswordService = class _PasswordService {
@@ -48,23 +65,53 @@ var PasswordService = class _PasswordService {
48
65
  }
49
66
  };
50
67
 
51
- // packages/shared/utils/src/lib/services/object/object.service.ts
52
- import { stringify } from "flatted";
53
-
54
- // packages/shared/utils/src/lib/services/guid/guid.service.ts
55
- import { Guid } from "guid-typescript";
56
- var GuidService = class {
57
- /***
58
- * Create guid as string
68
+ // packages/shared/utils/src/lib/services/slug/slug.service.ts
69
+ var SlugService = class _SlugService {
70
+ static {
71
+ this.polishToEnglishMap = {
72
+ "\u0105": "a",
73
+ "\u0107": "c",
74
+ "\u0119": "e",
75
+ "\u0142": "l",
76
+ "\u0144": "n",
77
+ "\xF3": "o",
78
+ "\u015B": "s",
79
+ "\u017A": "z",
80
+ "\u017C": "z",
81
+ "\u0104": "A",
82
+ "\u0106": "C",
83
+ "\u0118": "E",
84
+ "\u0141": "L",
85
+ "\u0143": "N",
86
+ "\xD3": "O",
87
+ "\u015A": "S",
88
+ "\u0179": "Z",
89
+ "\u017B": "Z"
90
+ };
91
+ }
92
+ /**
93
+ * Convert text to URL-friendly slug
94
+ * - Replaces Polish characters with English equivalents
95
+ * - Converts to lowercase
96
+ * - Replaces spaces and special characters with hyphens
97
+ * - Removes multiple consecutive hyphens
98
+ * - Trims hyphens from start and end
59
99
  */
60
- static create() {
61
- return Guid.raw();
100
+ static create(text) {
101
+ if (!text) {
102
+ return "";
103
+ }
104
+ let slug = text.split("").map(
105
+ (char) => _SlugService.polishToEnglishMap[char] || char
106
+ ).join("");
107
+ slug = slug.toLowerCase();
108
+ slug = slug.replace(/[^a-z0-9]+/g, "-");
109
+ slug = slug.replace(/-+/g, "-");
110
+ slug = slug.replace(/^-+|-+$/g, "");
111
+ return slug;
62
112
  }
63
113
  };
64
114
 
65
- // packages/shared/utils/src/lib/services/array/array.service.ts
66
- import * as _ from "lodash";
67
-
68
115
  // packages/shared/models/src/lib/utils.ts
69
116
  function getModelFieldKeys(type) {
70
117
  if (!type["__fields"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/crud-shell-app-services",
3
- "version": "2.101.0",
3
+ "version": "2.102.0",
4
4
  "description": "Utils to crud",
5
5
  "repository": {
6
6
  "type": "git",