@smartsoft001/crud-shell-dtos 2.83.0 → 2.85.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 +6 -3
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
- package/src/lib/interfaces.js +3 -0
- package/src/lib/interfaces.js.map +1 -0
- package/src/lib/user.dto.js +20 -0
- package/src/lib/user.dto.js.map +1 -0
- package/test-setup.js +1 -0
- package/test-setup.js.map +1 -0
- package/index.js +0 -191
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/crud-shell-dtos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.85.0",
|
|
4
4
|
"description": "This library was generated with [Nx](https://nx.dev).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/emiljuchnikowski/smartsoft/issues"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://github.com/emiljuchnikowski/smartsoft#readme"
|
|
15
|
-
|
|
14
|
+
"homepage": "https://github.com/emiljuchnikowski/smartsoft#readme",
|
|
15
|
+
"types": "./src/index.d.ts",
|
|
16
|
+
"main": "./src/index.js",
|
|
17
|
+
"type": "commonjs"
|
|
18
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/interfaces"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/user.dto"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/crud/shell/dtos/src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,yDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../../packages/crud/shell/dtos/src/lib/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const models_1 = require("@smartsoft001/models");
|
|
6
|
+
let UserDto = class UserDto {
|
|
7
|
+
};
|
|
8
|
+
exports.UserDto = UserDto;
|
|
9
|
+
tslib_1.__decorate([
|
|
10
|
+
(0, models_1.Field)({ required: true, focused: true }),
|
|
11
|
+
tslib_1.__metadata("design:type", String)
|
|
12
|
+
], UserDto.prototype, "username", void 0);
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, models_1.Field)({ required: true }),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], UserDto.prototype, "password", void 0);
|
|
17
|
+
exports.UserDto = UserDto = tslib_1.__decorate([
|
|
18
|
+
(0, models_1.Model)({})
|
|
19
|
+
], UserDto);
|
|
20
|
+
//# sourceMappingURL=user.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.dto.js","sourceRoot":"","sources":["../../../../../../../packages/crud/shell/dtos/src/lib/user.dto.ts"],"names":[],"mappings":";;;;AAAA,iDAAoD;AAG7C,IAAM,OAAO,GAAb,MAAM,OAAO;CAGnB,CAAA;AAHY,0BAAO;AACwB;IAAzC,IAAA,cAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCAAkB;AAChC;IAA1B,IAAA,cAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAAkB;kBAFjC,OAAO;IADnB,IAAA,cAAK,EAAC,EAAE,CAAC;GACG,OAAO,CAGnB"}
|
package/test-setup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=test-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../../../../packages/crud/shell/dtos/test-setup.ts"],"names":[],"mappings":""}
|
package/index.js
DELETED
|
@@ -1,191 +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)
|
|
9
|
-
__defProp(target, key, result);
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// packages/shared/models/src/lib/symbols.ts
|
|
14
|
-
var SYMBOL_MODEL = Symbol.for("smartsoft:model");
|
|
15
|
-
var SYMBOL_FIELD = Symbol.for("smartsoft:field");
|
|
16
|
-
|
|
17
|
-
// packages/shared/models/src/lib/interfaces.ts
|
|
18
|
-
var FieldTypeDef = /* @__PURE__ */ ((FieldTypeDef2) => {
|
|
19
|
-
FieldTypeDef2["address"] = "address";
|
|
20
|
-
FieldTypeDef2["currency"] = "currency";
|
|
21
|
-
FieldTypeDef2["date"] = "date";
|
|
22
|
-
FieldTypeDef2["dateTime"] = "dateTime";
|
|
23
|
-
FieldTypeDef2["dateWithEdit"] = "dateWithEdit";
|
|
24
|
-
FieldTypeDef2["email"] = "email";
|
|
25
|
-
FieldTypeDef2["enum"] = "enum";
|
|
26
|
-
FieldTypeDef2["file"] = "file";
|
|
27
|
-
FieldTypeDef2["flag"] = "flag";
|
|
28
|
-
FieldTypeDef2["int"] = "int";
|
|
29
|
-
FieldTypeDef2["nip"] = "nip";
|
|
30
|
-
FieldTypeDef2["object"] = "object";
|
|
31
|
-
FieldTypeDef2["array"] = "array";
|
|
32
|
-
FieldTypeDef2["password"] = "password";
|
|
33
|
-
FieldTypeDef2["radio"] = "radio";
|
|
34
|
-
FieldTypeDef2["text"] = "text";
|
|
35
|
-
FieldTypeDef2["strings"] = "strings";
|
|
36
|
-
FieldTypeDef2["ints"] = "ints";
|
|
37
|
-
FieldTypeDef2["longText"] = "longText";
|
|
38
|
-
FieldTypeDef2["color"] = "color";
|
|
39
|
-
FieldTypeDef2["logo"] = "logo";
|
|
40
|
-
FieldTypeDef2["check"] = "check";
|
|
41
|
-
FieldTypeDef2["phoneNumber"] = "phoneNumber";
|
|
42
|
-
FieldTypeDef2["phoneNumberPl"] = "phoneNumberPl";
|
|
43
|
-
FieldTypeDef2["pesel"] = "pesel";
|
|
44
|
-
FieldTypeDef2["pdf"] = "pdf";
|
|
45
|
-
FieldTypeDef2["video"] = "video";
|
|
46
|
-
FieldTypeDef2["attachment"] = "attachment";
|
|
47
|
-
FieldTypeDef2["dateRange"] = "dateRange";
|
|
48
|
-
FieldTypeDef2["image"] = "image";
|
|
49
|
-
FieldTypeDef2["float"] = "float";
|
|
50
|
-
return FieldTypeDef2;
|
|
51
|
-
})(FieldTypeDef || {});
|
|
52
|
-
var FieldType = FieldTypeDef;
|
|
53
|
-
|
|
54
|
-
// packages/shared/models/src/lib/decorators/model/model.decorator.ts
|
|
55
|
-
import "reflect-metadata";
|
|
56
|
-
var Model = ModelDecorator;
|
|
57
|
-
function ModelDecorator(options) {
|
|
58
|
-
return function(target) {
|
|
59
|
-
options = options ? { ...options } : {};
|
|
60
|
-
Reflect.defineMetadata(SYMBOL_MODEL, options, target);
|
|
61
|
-
target.prototype.toJSON = function() {
|
|
62
|
-
const result = { ...this };
|
|
63
|
-
if (this.constructor["__properties"]) {
|
|
64
|
-
Object.keys(this.constructor["__properties"]).forEach((protoKey) => {
|
|
65
|
-
result[protoKey] = this["_" + protoKey];
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// packages/shared/models/src/lib/decorators/field/field.decorator.ts
|
|
74
|
-
import "reflect-metadata";
|
|
75
|
-
|
|
76
|
-
// packages/shared/utils/src/lib/services/password/password.service.ts
|
|
77
|
-
import * as md5_ from "md5";
|
|
78
|
-
|
|
79
|
-
// packages/shared/utils/src/lib/services/object/object.service.ts
|
|
80
|
-
import { stringify } from "flatted";
|
|
81
|
-
var ObjectService = class {
|
|
82
|
-
/***
|
|
83
|
-
* Create object with data
|
|
84
|
-
* @param data {object} - data to set
|
|
85
|
-
* @param type {type} - new type
|
|
86
|
-
* @return - new type object
|
|
87
|
-
*/
|
|
88
|
-
static createByType(data, type) {
|
|
89
|
-
if (!data)
|
|
90
|
-
return data;
|
|
91
|
-
try {
|
|
92
|
-
if (data instanceof type)
|
|
93
|
-
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)
|
|
110
|
-
return obj;
|
|
111
|
-
const result = {};
|
|
112
|
-
Object.keys(obj).forEach((key) => {
|
|
113
|
-
if (obj[key] && obj[key].constructor && !(obj[key] instanceof Date)) {
|
|
114
|
-
let stringValue = "";
|
|
115
|
-
try {
|
|
116
|
-
stringValue = JSON.stringify(obj[key]);
|
|
117
|
-
} catch (e) {
|
|
118
|
-
console.warn("can't stringify without circular package");
|
|
119
|
-
stringValue = stringify(obj[key]);
|
|
120
|
-
}
|
|
121
|
-
result[key] = JSON.parse(stringValue);
|
|
122
|
-
} else {
|
|
123
|
-
result[key] = obj[key];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// packages/shared/utils/src/lib/services/guid/guid.service.ts
|
|
131
|
-
import { Guid } from "guid-typescript";
|
|
132
|
-
|
|
133
|
-
// packages/shared/utils/src/lib/services/array/array.service.ts
|
|
134
|
-
import * as _ from "lodash";
|
|
135
|
-
|
|
136
|
-
// packages/shared/models/src/lib/decorators/field/field.decorator.ts
|
|
137
|
-
var Field = FieldDecorator;
|
|
138
|
-
function FieldDecorator(options) {
|
|
139
|
-
return (target, key) => {
|
|
140
|
-
options = options ? { ...options } : {};
|
|
141
|
-
if (!target.constructor["__fields"]) {
|
|
142
|
-
target.constructor["__fields"] = {};
|
|
143
|
-
}
|
|
144
|
-
target.constructor["__fields"][key] = true;
|
|
145
|
-
if (!options.type && key === "password") {
|
|
146
|
-
options.type = FieldType.password;
|
|
147
|
-
} else if (!options.type) {
|
|
148
|
-
options.type = FieldType.text;
|
|
149
|
-
}
|
|
150
|
-
if (options.classType) {
|
|
151
|
-
target["_" + key] = target[key];
|
|
152
|
-
delete target[key];
|
|
153
|
-
Object.defineProperty(target, key, {
|
|
154
|
-
get: function() {
|
|
155
|
-
if (!this["_" + key] && options?.type === FieldType.array) {
|
|
156
|
-
this["_" + key] = [];
|
|
157
|
-
}
|
|
158
|
-
return this["_" + key];
|
|
159
|
-
},
|
|
160
|
-
set: function(v) {
|
|
161
|
-
this["_" + key] = options?.type === FieldType.array && v ? v.map(
|
|
162
|
-
(i) => ObjectService.createByType(i, options?.classType)
|
|
163
|
-
) : ObjectService.createByType(v, options?.classType);
|
|
164
|
-
},
|
|
165
|
-
enumerable: true,
|
|
166
|
-
configurable: true
|
|
167
|
-
});
|
|
168
|
-
if (!target.constructor["__properties"]) {
|
|
169
|
-
target.constructor["__properties"] = {};
|
|
170
|
-
}
|
|
171
|
-
target.constructor["__properties"][key] = true;
|
|
172
|
-
}
|
|
173
|
-
Reflect.defineMetadata(SYMBOL_FIELD, options, target, key);
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// packages/crud/shell/dtos/src/lib/user.dto.ts
|
|
178
|
-
var UserDto = class {
|
|
179
|
-
};
|
|
180
|
-
__decorateClass([
|
|
181
|
-
Field({ required: true, focused: true })
|
|
182
|
-
], UserDto.prototype, "username", 2);
|
|
183
|
-
__decorateClass([
|
|
184
|
-
Field({ required: true })
|
|
185
|
-
], UserDto.prototype, "password", 2);
|
|
186
|
-
UserDto = __decorateClass([
|
|
187
|
-
Model({})
|
|
188
|
-
], UserDto);
|
|
189
|
-
export {
|
|
190
|
-
UserDto
|
|
191
|
-
};
|