dl-commons 0.0.1-testing.57 → 0.0.2-testing.10

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 (67) hide show
  1. package/dist/index.d.ts +10 -3
  2. package/dist/index.js +29 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/models/consts/env-vars.const.d.ts +1 -0
  5. package/dist/models/consts/env-vars.const.js +2 -1
  6. package/dist/models/consts/env-vars.const.js.map +1 -1
  7. package/dist/models/enums/s3.enum.d.ts +11 -0
  8. package/dist/models/enums/s3.enum.js +17 -0
  9. package/dist/models/enums/s3.enum.js.map +1 -0
  10. package/dist/models/interfaces/group-session.interface.d.ts +6 -2
  11. package/dist/models/interfaces/s3.interface.d.ts +47 -0
  12. package/dist/models/interfaces/s3.interface.js +3 -0
  13. package/dist/models/interfaces/s3.interface.js.map +1 -0
  14. package/dist/models/interfaces/smtp-api-config.interface.d.ts +5 -0
  15. package/dist/models/interfaces/smtp-api-config.interface.js +3 -0
  16. package/dist/models/interfaces/smtp-api-config.interface.js.map +1 -0
  17. package/dist/models/interfaces/smtp.interface.d.ts +5 -0
  18. package/dist/models/interfaces/smtp.interface.js +3 -0
  19. package/dist/models/interfaces/smtp.interface.js.map +1 -0
  20. package/dist/models/interfaces/user-meta.interface.d.ts +4 -0
  21. package/dist/models/interfaces/user-meta.interface.js +3 -0
  22. package/dist/models/interfaces/user-meta.interface.js.map +1 -0
  23. package/dist/models/interfaces/user.interface.d.ts +1 -0
  24. package/dist/models/schemas/base.schema.d.ts +2 -2
  25. package/dist/models/schemas/embedded/contact.schema.d.ts +2 -2
  26. package/dist/models/schemas/embedded/dictionary-embedded.schema.d.ts +2 -2
  27. package/dist/models/schemas/embedded/group-session.schema.d.ts +4 -5
  28. package/dist/models/schemas/embedded/group-session.schema.js +4 -7
  29. package/dist/models/schemas/embedded/group-session.schema.js.map +1 -1
  30. package/dist/models/schemas/embedded/i18n.embedded.d.ts +2 -2
  31. package/dist/models/schemas/embedded/person.schema.d.ts +2 -2
  32. package/dist/models/schemas/embedded/record.embedded.d.ts +2 -2
  33. package/dist/models/schemas/embedded/residence.schema.d.ts +2 -2
  34. package/dist/models/schemas/embedded/s3.schema.d.ts +128 -0
  35. package/dist/models/schemas/embedded/s3.schema.js +188 -0
  36. package/dist/models/schemas/embedded/s3.schema.js.map +1 -0
  37. package/dist/models/schemas/embedded/session-user.schema.d.ts +2 -2
  38. package/dist/models/schemas/embedded/student-embedded.schema.d.ts +2 -2
  39. package/dist/models/schemas/embedded/teacher.schema.d.ts +2 -2
  40. package/dist/models/schemas/embedded/time.schema.d.ts +17 -0
  41. package/dist/models/schemas/embedded/time.schema.js +33 -0
  42. package/dist/models/schemas/embedded/time.schema.js.map +1 -0
  43. package/dist/models/schemas/identifable.schema.d.ts +2 -2
  44. package/dist/models/schemas/parent.schema.d.ts +2 -2
  45. package/dist/models/schemas/session.schema.d.ts +2 -2
  46. package/dist/services/sessions.service.d.ts +4 -1
  47. package/dist/services/sessions.service.js +34 -0
  48. package/dist/services/sessions.service.js.map +1 -1
  49. package/dist/services/smtp.service.d.ts +11 -0
  50. package/dist/services/smtp.service.js +71 -0
  51. package/dist/services/smtp.service.js.map +1 -0
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +1 -1
  54. package/src/index.ts +87 -3
  55. package/src/models/consts/env-vars.const.ts +1 -0
  56. package/src/models/enums/s3.enum.ts +12 -0
  57. package/src/models/interfaces/group-session.interface.ts +7 -2
  58. package/src/models/interfaces/s3.interface.ts +55 -0
  59. package/src/models/interfaces/smtp-api-config.interface.ts +5 -0
  60. package/src/models/interfaces/smtp.interface.ts +5 -0
  61. package/src/models/interfaces/user-meta.interface.ts +4 -0
  62. package/src/models/interfaces/user.interface.ts +1 -0
  63. package/src/models/schemas/embedded/group-session.schema.ts +5 -7
  64. package/src/models/schemas/embedded/s3.schema.ts +133 -0
  65. package/src/models/schemas/embedded/time.schema.ts +18 -0
  66. package/src/services/sessions.service.ts +38 -1
  67. package/src/services/smtp.service.ts +71 -0
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FileEmbeddedSchema = exports.S3FileSchema = exports.FileRecordSchema = exports.FileStateSchema = exports.FileMetaSchema = exports.FileLogSchema = exports.LogInitiatorSchema = exports.S3Schema = exports.FileEmbedded = exports.S3File = exports.FileRecord = exports.FileState = exports.FileMeta = exports.FileLog = exports.LogInitiator = exports.S3 = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const s3_enum_1 = require("../../enums/s3.enum");
16
+ let S3 = class S3 {
17
+ };
18
+ exports.S3 = S3;
19
+ __decorate([
20
+ (0, mongoose_1.Prop)({ type: String, required: true }),
21
+ __metadata("design:type", String)
22
+ ], S3.prototype, "key", void 0);
23
+ __decorate([
24
+ (0, mongoose_1.Prop)({ type: String, required: true }),
25
+ __metadata("design:type", String)
26
+ ], S3.prototype, "bucket", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)({ type: String, required: false }),
29
+ __metadata("design:type", String)
30
+ ], S3.prototype, "etag", void 0);
31
+ exports.S3 = S3 = __decorate([
32
+ (0, mongoose_1.Schema)({ _id: false })
33
+ ], S3);
34
+ let LogInitiator = class LogInitiator {
35
+ };
36
+ exports.LogInitiator = LogInitiator;
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: String, enum: s3_enum_1.FileLogInitType, required: false }),
39
+ __metadata("design:type", String)
40
+ ], LogInitiator.prototype, "type", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: String, required: false }),
43
+ __metadata("design:type", String)
44
+ ], LogInitiator.prototype, "name", void 0);
45
+ exports.LogInitiator = LogInitiator = __decorate([
46
+ (0, mongoose_1.Schema)({ _id: false })
47
+ ], LogInitiator);
48
+ let FileLog = class FileLog {
49
+ };
50
+ exports.FileLog = FileLog;
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
53
+ __metadata("design:type", Date)
54
+ ], FileLog.prototype, "createdAt", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: String, enum: s3_enum_1.S3FileState, required: true }),
57
+ __metadata("design:type", String)
58
+ ], FileLog.prototype, "value", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ type: LogInitiator, required: false }),
61
+ __metadata("design:type", LogInitiator)
62
+ ], FileLog.prototype, "initiator", void 0);
63
+ exports.FileLog = FileLog = __decorate([
64
+ (0, mongoose_1.Schema)()
65
+ ], FileLog);
66
+ let FileMeta = class FileMeta {
67
+ };
68
+ exports.FileMeta = FileMeta;
69
+ __decorate([
70
+ (0, mongoose_1.Prop)({ type: String, required: false }),
71
+ __metadata("design:type", String)
72
+ ], FileMeta.prototype, "name", void 0);
73
+ __decorate([
74
+ (0, mongoose_1.Prop)({ type: Number, required: true }),
75
+ __metadata("design:type", Number)
76
+ ], FileMeta.prototype, "size", void 0);
77
+ __decorate([
78
+ (0, mongoose_1.Prop)({ type: String, required: true }),
79
+ __metadata("design:type", String)
80
+ ], FileMeta.prototype, "mimeType", void 0);
81
+ __decorate([
82
+ (0, mongoose_1.Prop)({ type: String, required: true }),
83
+ __metadata("design:type", String)
84
+ ], FileMeta.prototype, "extension", void 0);
85
+ exports.FileMeta = FileMeta = __decorate([
86
+ (0, mongoose_1.Schema)({ _id: false })
87
+ ], FileMeta);
88
+ let FileState = class FileState {
89
+ };
90
+ exports.FileState = FileState;
91
+ __decorate([
92
+ (0, mongoose_1.Prop)({ type: String, enum: s3_enum_1.S3FileState, required: true }),
93
+ __metadata("design:type", String)
94
+ ], FileState.prototype, "value", void 0);
95
+ __decorate([
96
+ (0, mongoose_1.Prop)({ type: [FileLog], required: true, default: [] }),
97
+ __metadata("design:type", Array)
98
+ ], FileState.prototype, "log", void 0);
99
+ exports.FileState = FileState = __decorate([
100
+ (0, mongoose_1.Schema)({ _id: false })
101
+ ], FileState);
102
+ let FileRecord = class FileRecord {
103
+ };
104
+ exports.FileRecord = FileRecord;
105
+ __decorate([
106
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
107
+ __metadata("design:type", Date)
108
+ ], FileRecord.prototype, "createdAt", void 0);
109
+ __decorate([
110
+ (0, mongoose_1.Prop)({ type: Date, required: false }),
111
+ __metadata("design:type", Date)
112
+ ], FileRecord.prototype, "updatedAt", void 0);
113
+ exports.FileRecord = FileRecord = __decorate([
114
+ (0, mongoose_1.Schema)({ _id: false })
115
+ ], FileRecord);
116
+ let S3File = class S3File {
117
+ };
118
+ exports.S3File = S3File;
119
+ __decorate([
120
+ (0, mongoose_1.Prop)({ type: mongoose_2.SchemaTypes.ObjectId, required: true }),
121
+ __metadata("design:type", mongoose_2.mongo.ObjectId)
122
+ ], S3File.prototype, "id", void 0);
123
+ __decorate([
124
+ (0, mongoose_1.Prop)({ type: FileMeta, required: true, default: null }),
125
+ __metadata("design:type", FileMeta)
126
+ ], S3File.prototype, "fileMeta", void 0);
127
+ __decorate([
128
+ (0, mongoose_1.Prop)({ type: FileState, required: true, default: null }),
129
+ __metadata("design:type", FileState)
130
+ ], S3File.prototype, "state", void 0);
131
+ __decorate([
132
+ (0, mongoose_1.Prop)({ type: S3, required: true, default: null }),
133
+ __metadata("design:type", S3)
134
+ ], S3File.prototype, "s3", void 0);
135
+ __decorate([
136
+ (0, mongoose_1.Prop)({ type: FileRecord, required: true }),
137
+ __metadata("design:type", FileRecord)
138
+ ], S3File.prototype, "record", void 0);
139
+ __decorate([
140
+ (0, mongoose_1.Prop)({ type: String, required: true }),
141
+ __metadata("design:type", String)
142
+ ], S3File.prototype, "owner", void 0);
143
+ exports.S3File = S3File = __decorate([
144
+ (0, mongoose_1.Schema)({ _id: false })
145
+ ], S3File);
146
+ let FileEmbedded = class FileEmbedded {
147
+ };
148
+ exports.FileEmbedded = FileEmbedded;
149
+ __decorate([
150
+ (0, mongoose_1.Prop)({ type: String, required: true }),
151
+ __metadata("design:type", String)
152
+ ], FileEmbedded.prototype, "id", void 0);
153
+ __decorate([
154
+ (0, mongoose_1.Prop)({ type: String, required: false }),
155
+ __metadata("design:type", String)
156
+ ], FileEmbedded.prototype, "name", void 0);
157
+ __decorate([
158
+ (0, mongoose_1.Prop)({ type: Number, required: true }),
159
+ __metadata("design:type", Number)
160
+ ], FileEmbedded.prototype, "size", void 0);
161
+ __decorate([
162
+ (0, mongoose_1.Prop)({ type: String, required: true }),
163
+ __metadata("design:type", String)
164
+ ], FileEmbedded.prototype, "mimeType", void 0);
165
+ __decorate([
166
+ (0, mongoose_1.Prop)({ type: S3, required: true, default: null }),
167
+ __metadata("design:type", S3)
168
+ ], FileEmbedded.prototype, "s3", void 0);
169
+ __decorate([
170
+ (0, mongoose_1.Prop)({ type: String, enum: s3_enum_1.S3FileState, required: true }),
171
+ __metadata("design:type", String)
172
+ ], FileEmbedded.prototype, "state", void 0);
173
+ __decorate([
174
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
175
+ __metadata("design:type", Date)
176
+ ], FileEmbedded.prototype, "createdAt", void 0);
177
+ exports.FileEmbedded = FileEmbedded = __decorate([
178
+ (0, mongoose_1.Schema)({ _id: false })
179
+ ], FileEmbedded);
180
+ exports.S3Schema = mongoose_1.SchemaFactory.createForClass(S3);
181
+ exports.LogInitiatorSchema = mongoose_1.SchemaFactory.createForClass(LogInitiator);
182
+ exports.FileLogSchema = mongoose_1.SchemaFactory.createForClass(FileLog);
183
+ exports.FileMetaSchema = mongoose_1.SchemaFactory.createForClass(FileMeta);
184
+ exports.FileStateSchema = mongoose_1.SchemaFactory.createForClass(FileState);
185
+ exports.FileRecordSchema = mongoose_1.SchemaFactory.createForClass(FileRecord);
186
+ exports.S3FileSchema = mongoose_1.SchemaFactory.createForClass(S3File);
187
+ exports.FileEmbeddedSchema = mongoose_1.SchemaFactory.createForClass(FileEmbedded);
188
+ //# sourceMappingURL=s3.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.schema.js","sourceRoot":"","sources":["../../../../src/models/schemas/embedded/s3.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAAgE;AAEhE,iDAAmE;AAG5D,IAAM,EAAE,GAAR,MAAM,EAAE;CASd,CAAA;AATY,gBAAE;AAEX;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+BAC3B;AAGZ;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kCACxB;AAGf;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;gCAC3B;aARJ,EAAE;IADd,IAAA,iBAAM,EAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;GACV,EAAE,CASd;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAErB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0CACzC;AAGtB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QA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,IAAI;+CAAC;uBApBP,YAAY;IADxB,IAAA,iBAAM,EAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;GACV,YAAY,CAqBxB;AAEY,QAAA,QAAQ,GAAG,wBAAa,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAC5C,QAAA,kBAAkB,GAAG,wBAAa,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAChE,QAAA,aAAa,GAAG,wBAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACtD,QAAA,cAAc,GAAG,wBAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;AACxD,QAAA,eAAe,GAAG,wBAAa,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC1D,QAAA,gBAAgB,GAAG,wBAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;AAC5D,QAAA,YAAY,GAAG,wBAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACpD,QAAA,kBAAkB,GAAG,wBAAa,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC"}
@@ -14,10 +14,10 @@ export declare class SessionUser implements ISessionUser {
14
14
  export declare const SessionUserSchema: import("mongoose").Schema<SessionUser, import("mongoose").Model<SessionUser, any, any, any, import("mongoose").Document<unknown, any, SessionUser> & SessionUser & Required<{
15
15
  _id: string;
16
16
  }> & {
17
- __v?: number;
17
+ __v: number;
18
18
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, SessionUser, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<SessionUser>> & import("mongoose").FlatRecord<SessionUser> & Required<{
19
19
  _id: string;
20
20
  }> & {
21
- __v?: number;
21
+ __v: number;
22
22
  }>;
23
23
  export type SessionUserDocument = HydratedDocument<SessionUser>;
@@ -13,10 +13,10 @@ export declare class StudentEmbedded extends Identifable implements IStudentEmbe
13
13
  export declare const StudentEmbeddedSchema: import("mongoose").Schema<StudentEmbedded, import("mongoose").Model<StudentEmbedded, any, any, any, import("mongoose").Document<unknown, any, StudentEmbedded> & StudentEmbedded & Required<{
14
14
  _id: import("mongoose").Types.ObjectId;
15
15
  }> & {
16
- __v?: number;
16
+ __v: number;
17
17
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StudentEmbedded, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StudentEmbedded>> & import("mongoose").FlatRecord<StudentEmbedded> & Required<{
18
18
  _id: import("mongoose").Types.ObjectId;
19
19
  }> & {
20
- __v?: number;
20
+ __v: number;
21
21
  }>;
22
22
  export type StudentEmbeddedDocument = HydratedDocument<StudentEmbedded>;
@@ -8,10 +8,10 @@ export declare class Teacher implements ITeacher {
8
8
  export declare const TeacherSchema: MongooseSchema<Teacher, import("mongoose").Model<Teacher, any, any, any, import("mongoose").Document<unknown, any, Teacher> & Teacher & {
9
9
  _id: Types.ObjectId;
10
10
  } & {
11
- __v?: number;
11
+ __v: number;
12
12
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Teacher, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Teacher>> & import("mongoose").FlatRecord<Teacher> & {
13
13
  _id: Types.ObjectId;
14
14
  } & {
15
- __v?: number;
15
+ __v: number;
16
16
  }>;
17
17
  export type TeacherDocument = HydratedDocument<Teacher>;
@@ -0,0 +1,17 @@
1
+ import { HydratedDocument } from 'mongoose';
2
+ import { ITime } from '../../interfaces/group-session.interface';
3
+ export declare class Time implements ITime {
4
+ inString: string;
5
+ inNumber: number;
6
+ zone: string;
7
+ }
8
+ export declare const TimeSchema: import("mongoose").Schema<Time, import("mongoose").Model<Time, any, any, any, import("mongoose").Document<unknown, any, Time> & Time & {
9
+ _id: import("mongoose").Types.ObjectId;
10
+ } & {
11
+ __v: number;
12
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Time, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Time>> & import("mongoose").FlatRecord<Time> & {
13
+ _id: import("mongoose").Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }>;
17
+ export type TimeDocument = HydratedDocument<Time>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TimeSchema = exports.Time = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ let Time = class Time {
15
+ };
16
+ exports.Time = Time;
17
+ __decorate([
18
+ (0, mongoose_1.Prop)({ type: String, required: true }),
19
+ __metadata("design:type", String)
20
+ ], Time.prototype, "inString", void 0);
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ type: Number, required: true }),
23
+ __metadata("design:type", Number)
24
+ ], Time.prototype, "inNumber", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: String, required: true }),
27
+ __metadata("design:type", String)
28
+ ], Time.prototype, "zone", void 0);
29
+ exports.Time = Time = __decorate([
30
+ (0, mongoose_1.Schema)({ _id: false })
31
+ ], Time);
32
+ exports.TimeSchema = mongoose_1.SchemaFactory.createForClass(Time);
33
+ //# sourceMappingURL=time.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.schema.js","sourceRoot":"","sources":["../../../../src/models/schemas/embedded/time.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAKxD,IAAM,IAAI,GAAV,MAAM,IAAI;CAShB,CAAA;AATY,oBAAI;AAEb;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACtB;AAGjB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACtB;AAGjB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kCAC1B;eARJ,IAAI;IADhB,IAAA,iBAAM,EAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;GACV,IAAI,CAShB;AAEY,QAAA,UAAU,GAAG,wBAAa,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC"}
@@ -6,10 +6,10 @@ export declare class Identifable implements IIdentifable {
6
6
  export declare const IdentifableSchema: MongooseSchema<Identifable, import("mongoose").Model<Identifable, any, any, any, import("mongoose").Document<unknown, any, Identifable> & Identifable & Required<{
7
7
  _id: Types.ObjectId;
8
8
  }> & {
9
- __v?: number;
9
+ __v: number;
10
10
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Identifable, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Identifable>> & import("mongoose").FlatRecord<Identifable> & Required<{
11
11
  _id: Types.ObjectId;
12
12
  }> & {
13
- __v?: number;
13
+ __v: number;
14
14
  }>;
15
15
  export type IdentifableDocument = HydratedDocument<Identifable>;
@@ -10,10 +10,10 @@ export declare class Parent implements IParent {
10
10
  export declare const ParentSchema: MongooseSchema<Parent, import("mongoose").Model<Parent, any, any, any, import("mongoose").Document<unknown, any, Parent> & Parent & {
11
11
  _id: Types.ObjectId;
12
12
  } & {
13
- __v?: number;
13
+ __v: number;
14
14
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Parent, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Parent>> & import("mongoose").FlatRecord<Parent> & {
15
15
  _id: Types.ObjectId;
16
16
  } & {
17
- __v?: number;
17
+ __v: number;
18
18
  }>;
19
19
  export type ParentDocument = HydratedDocument<Parent>;
@@ -11,10 +11,10 @@ export declare class Session extends Identifable implements ISession {
11
11
  export declare const SessionSchema: import("mongoose").Schema<Session, import("mongoose").Model<Session, any, any, any, import("mongoose").Document<unknown, any, Session> & Session & Required<{
12
12
  _id: import("mongoose").Types.ObjectId;
13
13
  }> & {
14
- __v?: number;
14
+ __v: number;
15
15
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Session, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Session>> & import("mongoose").FlatRecord<Session> & Required<{
16
16
  _id: import("mongoose").Types.ObjectId;
17
17
  }> & {
18
- __v?: number;
18
+ __v: number;
19
19
  }>;
20
20
  export type SessionDocument = HydratedDocument<Session>;
@@ -3,12 +3,15 @@ import { ConfigService } from '@nestjs/config';
3
3
  import { ISession } from '../models/interfaces/session.interface';
4
4
  import { Model } from 'mongoose';
5
5
  import { SessionDocument } from '../models/schemas/session.schema';
6
+ import { Types } from 'mongoose';
6
7
  export declare class SessionsService {
7
8
  private readonly _sessionModel;
8
9
  private readonly _httpService;
9
10
  private readonly _configService;
10
11
  private _baseUrl;
11
12
  constructor(_sessionModel: Model<SessionDocument>, _httpService: HttpService, _configService: ConfigService);
12
- create(userId: string, userAgent: string, ip: string): Promise<ISession>;
13
+ create(userId: string | Types.ObjectId, userAgent: string, ip: string): Promise<ISession>;
13
14
  read(token: string): Promise<ISession>;
15
+ fetchAllById(id: string): Promise<ISession[]>;
16
+ fetchAllByUserId(id: string): Promise<ISession[]>;
14
17
  }
@@ -56,6 +56,40 @@ let SessionsService = class SessionsService {
56
56
  }
57
57
  return session;
58
58
  }
59
+ async fetchAllById(id) {
60
+ try {
61
+ const endpoint = `${this._baseUrl}/v1/sessions/${id}/all`;
62
+ const response$ = this._httpService.get(endpoint);
63
+ const response = await (0, rxjs_1.firstValueFrom)(response$);
64
+ if (response.data.errors) {
65
+ throw new rest_wrapper_class_1.RESTError('sessions_api_error', response.data.errors);
66
+ }
67
+ if (!response.data || !response.data.result) {
68
+ throw new rest_wrapper_class_1.RESTError('sessions_api_error', 'empty response');
69
+ }
70
+ return response.data.result.data;
71
+ }
72
+ catch (e) {
73
+ throw rest_wrapper_class_1.RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
74
+ }
75
+ }
76
+ async fetchAllByUserId(id) {
77
+ try {
78
+ const endpoint = `${this._baseUrl}/v1/sessions/users/${id}/all`;
79
+ const response$ = this._httpService.get(endpoint);
80
+ const response = await (0, rxjs_1.firstValueFrom)(response$);
81
+ if (response.data.errors) {
82
+ throw new rest_wrapper_class_1.RESTError('sessions_api_error', response.data.errors);
83
+ }
84
+ if (!response.data || !response.data.result) {
85
+ throw new rest_wrapper_class_1.RESTError('sessions_api_error', 'empty response');
86
+ }
87
+ return response.data.result.data;
88
+ }
89
+ catch (e) {
90
+ throw rest_wrapper_class_1.RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
91
+ }
92
+ }
59
93
  };
60
94
  exports.SessionsService = SessionsService;
61
95
  exports.SessionsService = SessionsService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"sessions.service.js","sourceRoot":"","sources":["../../src/services/sessions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAAmE;AACnE,2CAA+C;AAC/C,mFAAyF;AAEzF,+BAAsC;AACtC,uCAAiC;AACjC,qEAA4E;AAC5E,+CAA+C;AAGxC,IAAM,eAAe,GAArB,MAAM,eAAe;IAMxB,YAEqB,aAAqC,EACrC,YAAyB,EACzB,cAA6B;QAF7B,kBAAa,GAAb,aAAa,CAAwB;QACrC,iBAAY,GAAZ,YAAY,CAAa;QACzB,mBAAc,GAAd,cAAc,CAAe;QAE9C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,6BAA6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QACrC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,8BAAS,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACL,CAAC;CAEJ,CAAA;AArFY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAQJ,WAAA,IAAA,sBAAW,EAAC,wBAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;qCACZ,gBAAK;QACN,mBAAW;QACT,sBAAa;GAVzC,eAAe,CAqF3B"}
@@ -0,0 +1,11 @@
1
+ import { HttpService } from '@nestjs/axios';
2
+ import { ConfigService } from '@nestjs/config';
3
+ import { ISMTP } from '../models/interfaces/smtp.interface';
4
+ export declare class SMTPService {
5
+ private readonly _httpService;
6
+ private readonly _configService;
7
+ private _baseUrl;
8
+ constructor(_httpService: HttpService, _configService: ConfigService);
9
+ send(subject: string, from: string, to: string, html: string, profileId: string): Promise<ISMTP>;
10
+ send$(subject: string, from: string, to: string, html: string, profileId: string): import("rxjs").Observable<ISMTP>;
11
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SMTPService = void 0;
13
+ const axios_1 = require("@nestjs/axios");
14
+ const config_1 = require("@nestjs/config");
15
+ const rxjs_1 = require("rxjs");
16
+ const common_1 = require("@nestjs/common");
17
+ const rest_wrapper_class_1 = require("../models/dtos/wrappers/rest-wrapper.class");
18
+ let SMTPService = class SMTPService {
19
+ constructor(_httpService, _configService) {
20
+ this._httpService = _httpService;
21
+ this._configService = _configService;
22
+ this._baseUrl = this._configService.getOrThrow('DL_SMTP__REST__BASE_URL');
23
+ }
24
+ async send(subject, from, to, html, profileId) {
25
+ const requestBody = {
26
+ data: {
27
+ from,
28
+ to: [to],
29
+ subject,
30
+ html,
31
+ },
32
+ };
33
+ const response$ = this._httpService.post(`${this._baseUrl}/v1/emails/send`, requestBody, { params: { profileId } });
34
+ const response = await (0, rxjs_1.firstValueFrom)(response$);
35
+ if (response.data.errors) {
36
+ throw new rest_wrapper_class_1.RESTError('smtp_api_error', response.data.errors);
37
+ }
38
+ if (!response.data || !response.data.result) {
39
+ throw new rest_wrapper_class_1.RESTError('smtp_api_error', 'empty response');
40
+ }
41
+ return response.data.result.data;
42
+ }
43
+ send$(subject, from, to, html, profileId) {
44
+ const requestBody = {
45
+ data: {
46
+ from,
47
+ to: [to],
48
+ subject,
49
+ html,
50
+ },
51
+ };
52
+ const response$ = this._httpService.post(`${this._baseUrl}/v1/emails/send`, requestBody, { params: { profileId } });
53
+ return response$.pipe((0, rxjs_1.map)((response) => {
54
+ if (response.data.errors) {
55
+ throw new rest_wrapper_class_1.RESTError('smtp_api_error', response.data.errors);
56
+ }
57
+ if (!response.data || !response.data.result) {
58
+ throw new rest_wrapper_class_1.RESTError('smtp_api_error', 'empty response');
59
+ }
60
+ return response.data.result.data;
61
+ }), (0, rxjs_1.catchError)((e) => {
62
+ throw new rest_wrapper_class_1.RESTError('smtp_api_error', e);
63
+ }));
64
+ }
65
+ };
66
+ exports.SMTPService = SMTPService;
67
+ exports.SMTPService = SMTPService = __decorate([
68
+ (0, common_1.Injectable)(),
69
+ __metadata("design:paramtypes", [axios_1.HttpService, config_1.ConfigService])
70
+ ], SMTPService);
71
+ //# sourceMappingURL=smtp.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smtp.service.js","sourceRoot":"","sources":["../../src/services/smtp.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA+C;AAC/C,+BAAuD;AACvD,2CAA4C;AAC5C,mFAAyF;AAIlF,IAAM,WAAW,GAAjB,MAAM,WAAW;IAMpB,YAA6B,YAAyB,EAAmB,cAA6B;QAAzE,iBAAY,GAAZ,YAAY,CAAa;QAAmB,mBAAc,GAAd,cAAc,CAAe;QAClG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAC9E,CAAC;IAIM,KAAK,CAAC,IAAI,CAAC,OAAe,EAAE,IAAY,EAAE,EAAU,EAAE,IAAY,EAAE,SAAiB;QACxF,MAAM,WAAW,GAAG;YAChB,IAAI,EAAE;gBACF,IAAI;gBACJ,EAAE,EAAE,CAAC,EAAE,CAAC;gBACR,OAAO;gBACP,IAAI;aACP;SACJ,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAA0B,GAAG,IAAI,CAAC,QAAQ,iBAAiB,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QAC7I,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAc,EAAC,SAAS,CAAC,CAAC;QAEjD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,8BAAS,CAAC,gBAAgB,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1C,MAAM,IAAI,8BAAS,CAAC,g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