@smartsoft001/auth-shell-dtos 2.148.0 → 2.150.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/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@smartsoft001/auth-shell-dtos",
3
- "version": "2.148.0",
3
+ "version": "2.150.0",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "typings": "./src/index.d.ts",
7
+ "description": "LoginDto, the decorated credentials model of the auth family: two required fields the framework can render as a form and check for completeness.",
4
8
  "publishConfig": {
5
9
  "access": "public"
6
- }
10
+ },
11
+ "peerDependencies": {
12
+ "@smartsoft001/models": "2.150.0"
13
+ },
14
+ "types": "./src/index.d.ts"
7
15
  }
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/login.dto"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/auth/shell/dtos/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoginDto = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const models_1 = require("@smartsoft001/models");
6
+ let LoginDto = class LoginDto {
7
+ };
8
+ exports.LoginDto = LoginDto;
9
+ tslib_1.__decorate([
10
+ (0, models_1.Field)({ required: true, focused: true }),
11
+ tslib_1.__metadata("design:type", String)
12
+ ], LoginDto.prototype, "username", void 0);
13
+ tslib_1.__decorate([
14
+ (0, models_1.Field)({ required: true }),
15
+ tslib_1.__metadata("design:type", String)
16
+ ], LoginDto.prototype, "password", void 0);
17
+ exports.LoginDto = LoginDto = tslib_1.__decorate([
18
+ (0, models_1.Model)({})
19
+ ], LoginDto);
20
+ //# sourceMappingURL=login.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.dto.js","sourceRoot":"","sources":["../../../../../../../packages/auth/shell/dtos/src/lib/login.dto.ts"],"names":[],"mappings":";;;;AAAA,iDAAoD;AAG7C,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAGpB,CAAA;AAHY,4BAAQ;AACuB;IAAzC,IAAA,cAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CAAkB;AAChC;IAA1B,IAAA,cAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAAkB;mBAFjC,QAAQ;IADpB,IAAA,cAAK,EAAC,EAAE,CAAC;GACG,QAAQ,CAGpB"}
package/test-setup.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=test-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../../../../packages/auth/shell/dtos/test-setup.ts"],"names":[],"mappings":""}
package/index.js DELETED
@@ -1,259 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
-
12
- // packages/shared/models/src/lib/symbols.ts
13
- var SYMBOL_MODEL = /* @__PURE__ */ Symbol.for("smartsoft:model");
14
- var SYMBOL_FIELD = /* @__PURE__ */ Symbol.for("smartsoft:field");
15
-
16
- // packages/shared/models/src/lib/interfaces.ts
17
- var FieldTypeDef = /* @__PURE__ */ ((FieldTypeDef2) => {
18
- FieldTypeDef2["address"] = "address";
19
- FieldTypeDef2["currency"] = "currency";
20
- FieldTypeDef2["date"] = "date";
21
- FieldTypeDef2["dateTime"] = "dateTime";
22
- FieldTypeDef2["dateWithEdit"] = "dateWithEdit";
23
- FieldTypeDef2["email"] = "email";
24
- FieldTypeDef2["enum"] = "enum";
25
- FieldTypeDef2["file"] = "file";
26
- FieldTypeDef2["flag"] = "flag";
27
- FieldTypeDef2["int"] = "int";
28
- FieldTypeDef2["nip"] = "nip";
29
- FieldTypeDef2["object"] = "object";
30
- FieldTypeDef2["array"] = "array";
31
- FieldTypeDef2["password"] = "password";
32
- FieldTypeDef2["radio"] = "radio";
33
- FieldTypeDef2["text"] = "text";
34
- FieldTypeDef2["strings"] = "strings";
35
- FieldTypeDef2["ints"] = "ints";
36
- FieldTypeDef2["longText"] = "longText";
37
- FieldTypeDef2["color"] = "color";
38
- FieldTypeDef2["logo"] = "logo";
39
- FieldTypeDef2["check"] = "check";
40
- FieldTypeDef2["phoneNumber"] = "phoneNumber";
41
- FieldTypeDef2["phoneNumberPl"] = "phoneNumberPl";
42
- FieldTypeDef2["pesel"] = "pesel";
43
- FieldTypeDef2["pdf"] = "pdf";
44
- FieldTypeDef2["video"] = "video";
45
- FieldTypeDef2["attachment"] = "attachment";
46
- FieldTypeDef2["dateRange"] = "dateRange";
47
- FieldTypeDef2["image"] = "image";
48
- FieldTypeDef2["float"] = "float";
49
- return FieldTypeDef2;
50
- })(FieldTypeDef || {});
51
- var FieldType = FieldTypeDef;
52
-
53
- // packages/shared/models/src/lib/decorators/model/model.decorator.ts
54
- import "reflect-metadata";
55
- var Model = ModelDecorator;
56
- function ModelDecorator(options) {
57
- return function(target) {
58
- options = options ? { ...options } : {};
59
- Reflect.defineMetadata(SYMBOL_MODEL, options, target);
60
- target.prototype.toJSON = function() {
61
- const result = { ...this };
62
- if (this.constructor["__properties"]) {
63
- Object.keys(this.constructor["__properties"]).forEach((protoKey) => {
64
- result[protoKey] = this["_" + protoKey];
65
- });
66
- }
67
- return result;
68
- };
69
- };
70
- }
71
-
72
- // packages/shared/models/src/lib/decorators/field/field.decorator.ts
73
- import "reflect-metadata";
74
-
75
- // packages/shared/utils/src/lib/services/array/array.service.ts
76
- import * as _ from "lodash";
77
-
78
- // packages/shared/utils/src/lib/services/guid/guid.service.ts
79
- import { Guid } from "guid-typescript";
80
-
81
- // packages/shared/utils/src/lib/services/object/object.service.ts
82
- import { stringify } from "flatted";
83
- var ObjectService = class {
84
- /***
85
- * Create object with data
86
- * @param data {object} - data to set
87
- * @param type {type} - new type
88
- * @return - new type object
89
- */
90
- static createByType(data, type) {
91
- if (!data) return data;
92
- try {
93
- if (data instanceof type) return data;
94
- } catch (e) {
95
- console.warn(e);
96
- }
97
- const result = new type();
98
- Object.keys(data).forEach((key) => {
99
- result[key] = data[key];
100
- });
101
- return result;
102
- }
103
- /***
104
- * Remove object type from data
105
- * @param obj {object} - object
106
- * @return - object without type
107
- */
108
- static removeTypes(obj) {
109
- if (!obj) return obj;
110
- const result = {};
111
- Object.keys(obj).forEach((key) => {
112
- if (obj[key] && obj[key].constructor && !(obj[key] instanceof Date)) {
113
- let stringValue = "";
114
- try {
115
- stringValue = JSON.stringify(obj[key]);
116
- } catch (e) {
117
- console.warn("can't stringify without circular package");
118
- stringValue = stringify(obj[key]);
119
- }
120
- result[key] = JSON.parse(stringValue);
121
- } else {
122
- result[key] = obj[key];
123
- }
124
- });
125
- return result;
126
- }
127
- };
128
-
129
- // packages/shared/utils/src/lib/services/password/password.service.ts
130
- import md5 from "md5";
131
-
132
- // packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
133
- var RemoveHtmlService = class {
134
- /**
135
- * Remove HTML tags and decode HTML entities from text
136
- * - Removes HTML tags
137
- * - Decodes common named entities ( , ", etc.)
138
- * - Decodes numeric entities ({ or «)
139
- * - Removes any remaining unrecognized entities
140
- */
141
- static create(val) {
142
- if (!val) {
143
- return "";
144
- }
145
- let result = val;
146
- result = result.replace(/<[^>]*(>|$)/g, "");
147
- result = result.replace(/&nbsp;/g, " ").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&bdquo;/g, "\u201E").replace(/&rdquo;/g, '"').replace(/&ldquo;/g, '"').replace(/&laquo;/g, "\xAB").replace(/&raquo;/g, "\xBB").replace(/&zwnj;/g, "");
148
- result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
149
- /&#x([0-9a-f]+);/gi,
150
- (match, hex) => String.fromCharCode(parseInt(hex, 16))
151
- );
152
- result = result.replace(/&[a-z]+;/gi, "");
153
- return result;
154
- }
155
- };
156
-
157
- // packages/shared/utils/src/lib/services/slug/slug.service.ts
158
- var SlugService = class _SlugService {
159
- static {
160
- this.polishToEnglishMap = {
161
- \u0105: "a",
162
- \u0107: "c",
163
- \u0119: "e",
164
- \u0142: "l",
165
- \u0144: "n",
166
- \u00F3: "o",
167
- \u015B: "s",
168
- \u017A: "z",
169
- \u017C: "z",
170
- \u0104: "A",
171
- \u0106: "C",
172
- \u0118: "E",
173
- \u0141: "L",
174
- \u0143: "N",
175
- \u00D3: "O",
176
- \u015A: "S",
177
- \u0179: "Z",
178
- \u017B: "Z"
179
- };
180
- }
181
- /**
182
- * Convert text to URL-friendly slug
183
- * - Removes HTML tags and entities
184
- * - Replaces Polish characters with English equivalents
185
- * - Converts to lowercase
186
- * - Replaces spaces and special characters with hyphens
187
- * - Removes multiple consecutive hyphens
188
- * - Trims hyphens from start and end
189
- */
190
- static create(text) {
191
- if (!text) {
192
- return "";
193
- }
194
- let slug = RemoveHtmlService.create(text);
195
- slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
196
- slug = slug.toLowerCase();
197
- slug = slug.replace(/[^a-z0-9]+/g, "-");
198
- slug = slug.replace(/-+/g, "-");
199
- slug = slug.replace(/^-+|-+$/g, "");
200
- return slug;
201
- }
202
- };
203
-
204
- // packages/shared/models/src/lib/decorators/field/field.decorator.ts
205
- var Field = FieldDecorator;
206
- function FieldDecorator(options) {
207
- return (target, key) => {
208
- options = options ? { ...options } : {};
209
- if (!target.constructor["__fields"]) {
210
- target.constructor["__fields"] = {};
211
- }
212
- target.constructor["__fields"][key] = true;
213
- if (!options.type && key === "password") {
214
- options.type = FieldType.password;
215
- } else if (!options.type) {
216
- options.type = FieldType.text;
217
- }
218
- if (options.classType) {
219
- target["_" + key] = target[key];
220
- delete target[key];
221
- Object.defineProperty(target, key, {
222
- get: function() {
223
- if (!this["_" + key] && options?.type === FieldType.array) {
224
- this["_" + key] = [];
225
- }
226
- return this["_" + key];
227
- },
228
- set: function(v) {
229
- this["_" + key] = options?.type === FieldType.array && v ? v.map(
230
- (i) => ObjectService.createByType(i, options?.classType)
231
- ) : ObjectService.createByType(v, options?.classType);
232
- },
233
- enumerable: true,
234
- configurable: true
235
- });
236
- if (!target.constructor["__properties"]) {
237
- target.constructor["__properties"] = {};
238
- }
239
- target.constructor["__properties"][key] = true;
240
- }
241
- Reflect.defineMetadata(SYMBOL_FIELD, options, target, key);
242
- };
243
- }
244
-
245
- // packages/auth/shell/dtos/src/lib/login.dto.ts
246
- var LoginDto = class {
247
- };
248
- __decorateClass([
249
- Field({ required: true, focused: true })
250
- ], LoginDto.prototype, "username", 2);
251
- __decorateClass([
252
- Field({ required: true })
253
- ], LoginDto.prototype, "password", 2);
254
- LoginDto = __decorateClass([
255
- Model({})
256
- ], LoginDto);
257
- export {
258
- LoginDto
259
- };