@smartsoft001/auth-shell-dtos 2.76.0 → 2.81.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 ADDED
@@ -0,0 +1,191 @@
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/auth/shell/dtos/src/lib/login.dto.ts
178
+ var LoginDto = class {
179
+ };
180
+ __decorateClass([
181
+ Field({ required: true, focused: true })
182
+ ], LoginDto.prototype, "username", 2);
183
+ __decorateClass([
184
+ Field({ required: true })
185
+ ], LoginDto.prototype, "password", 2);
186
+ LoginDto = __decorateClass([
187
+ Model({})
188
+ ], LoginDto);
189
+ export {
190
+ LoginDto
191
+ };
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@smartsoft001/auth-shell-dtos",
3
- "version": "2.76.0"
3
+ "version": "2.81.0"
4
4
  }
@@ -0,0 +1,4 @@
1
+ export declare class LoginDto {
2
+ username: string;
3
+ password: string;
4
+ }
package/.eslintrc.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "extends": "../../../../.eslintrc.json",
3
- "ignorePatterns": ["!**/*"],
4
- "rules": {
5
- "import/order": "off"
6
- },
7
- "overrides": [
8
- {
9
- "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
10
- "rules": {}
11
- },
12
- {
13
- "files": ["*.ts", "*.tsx"],
14
- "rules": {}
15
- },
16
- {
17
- "files": ["*.js", "*.jsx"],
18
- "rules": {}
19
- },
20
- {
21
- "files": "package.json",
22
- "parser": "jsonc-eslint-parser",
23
- "rules": {}
24
- }
25
- ]
26
- }
package/jest.config.ts DELETED
@@ -1,26 +0,0 @@
1
- /* eslint-disable */
2
- export default {
3
- displayName: 'auth-shell-dtos',
4
- preset: '../../../../jest.preset.js',
5
- testEnvironment: 'node',
6
- transform: {
7
- '^.+\\.[tj]sx?$': [
8
- 'ts-jest',
9
- {
10
- tsConfig: '<rootDir>/tsconfig.spec.json',
11
- },
12
- ],
13
- },
14
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
15
- coverageDirectory: '../../../../coverage/packages/auth/shell/dtos',
16
- /* TODO: Update to latest Jest snapshotFormat
17
- * By default Nx has kept the older style of Jest Snapshot formats
18
- * to prevent breaking of any existing tests with snapshots.
19
- * It's recommend you update to the latest format.
20
- * You can do this by removing snapshotFormat property
21
- * and running tests with --update-snapshot flag.
22
- * Example: From within the project directory, run "nx test --update-snapshot"
23
- * More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
24
- */
25
- snapshotFormat: { escapeString: true, printBasicPrototype: true },
26
- };
package/project.json DELETED
@@ -1,43 +0,0 @@
1
- {
2
- "name": "auth-shell-dtos",
3
- "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/auth/shell/dtos/src",
5
- "projectType": "library",
6
- "targets": {
7
- "lint": {
8
- "executor": "@nx/eslint:lint",
9
- "options": {
10
- "lintFilePatterns": [
11
- "packages/auth/shell/dtos/**/*.{ts,tsx,js,jsx}",
12
- "packages/auth/shell/dtos/package.json"
13
- ]
14
- }
15
- },
16
- "test": {
17
- "executor": "@nx/jest:jest",
18
- "outputs": ["{workspaceRoot}/coverage/packages/auth/shell/dtos"],
19
- "options": {
20
- "jestConfig": "packages/auth/shell/dtos/jest.config.ts"
21
- }
22
- },
23
- "build": {
24
- "executor": "@nx/esbuild:esbuild",
25
- "outputs": ["{options.outputPath}"],
26
- "options": {
27
- "outputPath": "dist/packages/auth/shell/dtos",
28
- "tsConfig": "packages/auth/shell/dtos/tsconfig.lib.json",
29
- "packageJson": "packages/auth/shell/dtos/package.json",
30
- "main": "packages/auth/shell/dtos/src/index.ts",
31
- "assets": ["packages/auth/shell/dtos/*.md"]
32
- }
33
- },
34
- "deploy": {
35
- "executor": "ngx-deploy-npm:deploy",
36
- "options": {
37
- "access": "public",
38
- "distFolderPath": "dist/packages/auth/shell/dtos"
39
- },
40
- "dependsOn": ["build"]
41
- }
42
- }
43
- }
@@ -1,7 +0,0 @@
1
- import { Field, Model } from '@smartsoft001/models';
2
-
3
- @Model({})
4
- export class LoginDto {
5
- @Field({ required: true, focused: true }) username: string;
6
- @Field({ required: true }) password: string;
7
- }
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "./tsconfig.lib.json"
8
- },
9
- {
10
- "path": "./tsconfig.spec.json"
11
- }
12
- ]
13
- }
package/tsconfig.lib.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "outDir": "../../../../dist/out-tsc",
6
- "declaration": true,
7
- "types": ["node"],
8
- "target": "es6"
9
- },
10
- "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
11
- "include": ["**/*.ts"]
12
- }
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../../dist/out-tsc",
5
- "module": "commonjs",
6
- "types": ["jest", "node"]
7
- },
8
- "include": [
9
- "**/*.spec.ts",
10
- "**/*.test.ts",
11
- "**/*.spec.tsx",
12
- "**/*.test.tsx",
13
- "**/*.spec.js",
14
- "**/*.test.js",
15
- "**/*.spec.jsx",
16
- "**/*.test.jsx",
17
- "**/*.d.ts",
18
- "jest.config.ts"
19
- ]
20
- }
File without changes
File without changes