eh-commons 0.0.1-testing.51 → 0.0.1-testing.53
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/dist/clients/session.client.d.ts +16 -3
- package/dist/clients/session.client.js +44 -3
- package/dist/clients/session.client.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/models/dictionary/embedded/dictionary.embedded.d.ts +3 -2
- package/dist/models/dictionary/embedded/dictionary.embedded.js +9 -4
- package/dist/models/dictionary/embedded/dictionary.embedded.js.map +1 -1
- package/dist/models/dictionary/interfaces/dictionary-embedded.interface.d.ts +1 -0
- package/dist/models/dtos/author.dto.js.map +1 -1
- package/dist/models/interfaces/session/session.interface.d.ts +1 -1
- package/dist/models/session/interfaces/session-client-data.interface.d.ts +20 -0
- package/dist/models/session/interfaces/session-client-data.interface.js +7 -0
- package/dist/models/session/interfaces/session-client-data.interface.js.map +1 -0
- package/dist/models/session/interfaces/session-user-data.interface.d.ts +9 -0
- package/dist/models/session/interfaces/session-user-data.interface.js +3 -0
- package/dist/models/session/interfaces/session-user-data.interface.js.map +1 -0
- package/dist/models/wrappers/permission-guard-config.wrapper.d.ts +1 -4
- package/dist/models/wrappers/permission-guard-config.wrapper.js +0 -3
- package/dist/models/wrappers/permission-guard-config.wrapper.js.map +1 -1
- package/dist/modules/cache/guards/permission.guard.d.ts +4 -3
- package/dist/modules/cache/guards/permission.guard.js +34 -44
- package/dist/modules/cache/guards/permission.guard.js.map +1 -1
- package/dist/modules/cache/services/session.service.d.ts +6 -0
- package/dist/modules/cache/services/session.service.js +9 -0
- package/dist/modules/cache/services/session.service.js.map +1 -1
- package/dist/modules/dictionary/dictionary.module.d.ts +2 -0
- package/dist/modules/dictionary/dictionary.module.js +24 -0
- package/dist/modules/dictionary/dictionary.module.js.map +1 -0
- package/dist/modules/dictionary/dtos/dictionary-list.dto.d.ts +10 -0
- package/dist/modules/dictionary/dtos/dictionary-list.dto.js +59 -0
- package/dist/modules/dictionary/dtos/dictionary-list.dto.js.map +1 -0
- package/dist/modules/dictionary/services/dictionary.service.d.ts +18 -0
- package/dist/modules/dictionary/services/dictionary.service.js +137 -0
- package/dist/modules/dictionary/services/dictionary.service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/clients/session.client.ts +68 -8
- package/src/index.ts +10 -2
- package/src/models/dictionary/embedded/dictionary.embedded.ts +7 -4
- package/src/models/dictionary/interfaces/dictionary-embedded.interface.ts +1 -0
- package/src/models/dtos/author.dto.ts +1 -1
- package/src/models/interfaces/session/session.interface.ts +1 -1
- package/src/models/session/interfaces/session-client-data.interface.ts +21 -0
- package/src/models/session/interfaces/session-user-data.interface.ts +10 -0
- package/src/models/wrappers/permission-guard-config.wrapper.ts +1 -3
- package/src/modules/cache/guards/permission.guard.ts +50 -114
- package/src/modules/cache/services/session.service.ts +12 -0
- package/src/modules/dictionary/dictionary.module.ts +11 -0
- package/src/modules/dictionary/dtos/dictionary-list.dto.ts +46 -0
- package/src/modules/dictionary/services/dictionary.service.ts +177 -0
- package/src/models/interfaces/session/session-data.interface.ts +0 -11
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import * as IORedis from 'ioredis';
|
|
2
|
+
import { ISessionUserData } from '../models/session/interfaces/session-user-data.interface';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { ISessionClientData } from '../models/session/interfaces/session-client-data.interface';
|
|
5
|
+
import { IClient } from '../models/um/interfaces/client.interface';
|
|
6
|
+
import { IPermission } from '../models/um/interfaces/permission.interface';
|
|
2
7
|
export declare class SessionClient {
|
|
3
8
|
private redisClient;
|
|
4
9
|
constructor(client: IORedis.Redis);
|
|
5
|
-
get
|
|
6
|
-
set
|
|
7
|
-
delete
|
|
10
|
+
private get;
|
|
11
|
+
private set;
|
|
12
|
+
private delete;
|
|
13
|
+
getUserData(token: string): Observable<ISessionUserData>;
|
|
14
|
+
getUserClients(userId: string): Observable<Map<string, ISessionClientData>>;
|
|
15
|
+
getUserClientPermissions(userId: string, clientId: string): Observable<{
|
|
16
|
+
client: IClient;
|
|
17
|
+
permissions: IPermission[];
|
|
18
|
+
}>;
|
|
8
19
|
private parseUser;
|
|
20
|
+
private parseClient;
|
|
21
|
+
private parsePermissions;
|
|
9
22
|
private parse;
|
|
10
23
|
}
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SessionClient = void 0;
|
|
4
|
+
const keyword_function_1 = require("../functions/session/keyword.function");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
4
6
|
class SessionClient {
|
|
5
7
|
constructor(client) {
|
|
6
8
|
this.redisClient = client;
|
|
7
9
|
}
|
|
8
10
|
get(key) {
|
|
9
|
-
return this.redisClient.get(key);
|
|
11
|
+
return (0, rxjs_1.from)(this.redisClient.get(key));
|
|
10
12
|
}
|
|
11
13
|
set(key, value) {
|
|
12
|
-
return this.redisClient.set(key, value);
|
|
14
|
+
return (0, rxjs_1.from)(this.redisClient.set(key, value));
|
|
13
15
|
}
|
|
14
16
|
delete(key) {
|
|
15
|
-
return this.redisClient.del(key);
|
|
17
|
+
return (0, rxjs_1.from)(this.redisClient.del(key));
|
|
18
|
+
}
|
|
19
|
+
getUserData(token) {
|
|
20
|
+
const key = (0, keyword_function_1.generateSessionKeyword)(token);
|
|
21
|
+
const userDataString$ = this.get(key);
|
|
22
|
+
return userDataString$.pipe((0, rxjs_1.map)((userDataString) => {
|
|
23
|
+
return this.parseUser(userDataString);
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
getUserClients(userId) {
|
|
27
|
+
const key = (0, keyword_function_1.generateUserClientKeyword)(userId);
|
|
28
|
+
const clientDataString$ = this.get(key);
|
|
29
|
+
return clientDataString$.pipe((0, rxjs_1.map)((clientDataString) => {
|
|
30
|
+
return this.parseClient(clientDataString);
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
getUserClientPermissions(userId, clientId) {
|
|
34
|
+
const key = (0, keyword_function_1.generateUserClientPermissionKeyword)(userId, clientId);
|
|
35
|
+
const userClientPermissionsString$ = this.get(key);
|
|
36
|
+
return userClientPermissionsString$.pipe((0, rxjs_1.map)((userClientPermissionsString) => {
|
|
37
|
+
return this.parsePermissions(userClientPermissionsString);
|
|
38
|
+
}));
|
|
16
39
|
}
|
|
17
40
|
parseUser(jsonString) {
|
|
18
41
|
try {
|
|
@@ -23,6 +46,24 @@ class SessionClient {
|
|
|
23
46
|
return null;
|
|
24
47
|
}
|
|
25
48
|
}
|
|
49
|
+
parseClient(jsonString) {
|
|
50
|
+
try {
|
|
51
|
+
const parsedClient = JSON.parse(jsonString);
|
|
52
|
+
return parsedClient;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
parsePermissions(jsonString) {
|
|
59
|
+
try {
|
|
60
|
+
const parsedPermissions = JSON.parse(jsonString);
|
|
61
|
+
return parsedPermissions;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
26
67
|
parse(jsonString) {
|
|
27
68
|
try {
|
|
28
69
|
const result = JSON.parse(jsonString);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.client.js","sourceRoot":"","sources":["../../src/clients/session.client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"session.client.js","sourceRoot":"","sources":["../../src/clients/session.client.ts"],"names":[],"mappings":";;;AAGA,4EAI+C;AAC/C,+BAA6C;AAK7C,MAAa,aAAa;IAGxB,YAAY,MAAqB;QAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;IAEO,GAAG,CAAC,GAAW;QACrB,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,WA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UAAG,EAAC,CAAC,2BAA2B,EAAE,EAAE;YAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,CAAC;QAC5D,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,UAAkB;QAClC,IAAI,CAAC;YACH,MAAM,UAAU,GAAqB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC5D,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,UAAkB;QACpC,IAAI,CAAC;YACH,MAAM,YAAY,GAChB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACzB,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,UAAkB;QACzC,IAAI,CAAC;YACH,MAAM,iBAAiB,GACrB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACzB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,KAAK,CAAI,UAAkB;QACjC,IAAI,CAAC;YACH,MAAM,MAAM,GAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACzC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAxFD,sCAwFC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { RecordState } from './models/util/enums/record-state.enum';
|
|
|
11
11
|
import { IMongoPage, RESTError, RESTPage, RESTPaging, RESTQueryParams, RESTRequestBody, RESTResponseBody, RESTResult, RESTSort, SortDirection } from './models/wrappers/rest-wrapper.class';
|
|
12
12
|
import { ConfigUtil } from './utils/config-util.class';
|
|
13
13
|
import { ISession } from './models/interfaces/session/session.interface';
|
|
14
|
-
import { ISessionUserData } from './models/interfaces/session
|
|
14
|
+
import { ISessionUserData } from './models/session/interfaces/session-user-data.interface';
|
|
15
15
|
import { SessionClient } from './clients/session.client';
|
|
16
16
|
import { RedisService } from './modules/cache/services/redis.service';
|
|
17
17
|
import { SessionService } from './modules/cache/services/session.service';
|
|
@@ -86,4 +86,6 @@ import { Base } from './models/commons/schemas/base.schema';
|
|
|
86
86
|
import { DictionaryEmbedded, DictionaryEmbeddedDocument, DictionaryEmbeddedSchema } from './models/dictionary/embedded/dictionary.embedded';
|
|
87
87
|
import { IDictionaryEmbedded } from './models/dictionary/interfaces/dictionary-embedded.interface';
|
|
88
88
|
import { IDictionaryEvent } from './models/dictionary/interfaces/dictionary-event.interface';
|
|
89
|
-
|
|
89
|
+
import { DictionaryModule } from './modules/dictionary/dictionary.module';
|
|
90
|
+
import { DictionaryService } from './modules/dictionary/services/dictionary.service';
|
|
91
|
+
export { IsMapOfStringsConstraint, IsRouteConstraint, IsMapOfStrings, IsRoute, HandledException, validationExceptionFactory, BaseExceptionsFilter, RecordDTO, StateParamDTO, RecordState, SortDirection, Sort, Page, SortPage, RESTSort, RESTPaging, RESTRequestBody, RESTPage, RESTResult, RESTError, RESTResponseBody, ConfigUtil, ISession, ISessionUserData, SessionClient, RedisService, SessionService, CacheModule, PermissionGuard, generateUUID, Permission, PermissionsIncludeStrategy, PermissionGuardConfig, ClientPermissions, ValidateMongoIdPipe, escapeRegex, translitGeorgiaToLatin, getRandomNumberFromRange, sizeOfJson, HTTPMethod, LogModule, LogService, LoggerClient, Env, ConsoleLogger, IAddress, Address, AddressSchema, AddressDocument, ClientType, IClient, ContactType, IContact, Contact, ContactSchema, ContactDocument, IGeoLocation, GeoLocation, GeoLocationSchema, GeoLocationDocument, II18n, I18n, I18nSchema, I18nDocument, IPermission, IPerson, Person, PersonSchema, PersonDocument, IRecord, Record, RecordSchema, RecordDocument, IRole, IUserClient, IUser, AuthorDTO, IAuthor, Author, AuthorSchema, IS3File, S3File, S3FileSchema, S3FileDocument, IFileLog, FileLog, FileLogSchema, FileLogDocument, IFileMeta, FileMeta, FileMetaSchema, FileMetaDocument, IFileRecord, FileRecord, FileRecordSchema, FileRecordDocument, IFileState, FileState, FileStateSchema, FileStateDocument, ILogInitiator, LogInitiator, LogInitiatorDocument, LogInitiatorSchema, IS3, S3, S3Document, S3Schema, S3FileState, IDictionarySetting, IDictionary, RESTQueryParams, IMongoPage, ResourceType, ICredentials, IProfInfo, generateSessionKeyword, generateUserClientKeyword, generateUserClientPermissionKeyword, getSortObj, I18nDTO, Base, IBase, DictionaryEmbeddedSchema, DictionaryEmbeddedDocument, DictionaryEmbedded, IDictionaryEmbedded, IDictionaryEvent, DictionaryModule, DictionaryService, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GeoLocation = exports.ContactSchema = exports.Contact = exports.ContactType = exports.ClientType = exports.AddressSchema = exports.Address = exports.ConsoleLogger = exports.Env = exports.LoggerClient = exports.LogService = exports.LogModule = exports.HTTPMethod = exports.sizeOfJson = exports.getRandomNumberFromRange = exports.translitGeorgiaToLatin = exports.escapeRegex = exports.ValidateMongoIdPipe = exports.ClientPermissions = exports.PermissionGuardConfig = exports.PermissionsIncludeStrategy = exports.Permission = exports.generateUUID = exports.PermissionGuard = exports.CacheModule = exports.SessionService = exports.RedisService = exports.SessionClient = exports.ConfigUtil = exports.RESTResponseBody = exports.RESTError = exports.RESTResult = exports.RESTPage = exports.RESTRequestBody = exports.RESTPaging = exports.RESTSort = exports.SortPage = exports.Page = exports.Sort = exports.SortDirection = exports.RecordState = exports.StateParamDTO = exports.RecordDTO = exports.BaseExceptionsFilter = exports.validationExceptionFactory = exports.HandledException = exports.IsRoute = exports.IsMapOfStrings = exports.IsRouteConstraint = exports.IsMapOfStringsConstraint = void 0;
|
|
4
|
-
exports.DictionaryEmbedded = exports.DictionaryEmbeddedSchema = exports.Base = exports.I18nDTO = exports.getSortObj = exports.generateUserClientPermissionKeyword = exports.generateUserClientKeyword = exports.generateSessionKeyword = exports.ResourceType = exports.RESTQueryParams = exports.S3FileState = exports.S3Schema = exports.S3 = exports.LogInitiatorSchema = exports.LogInitiator = exports.FileStateSchema = exports.FileState = exports.FileRecordSchema = exports.FileRecord = exports.FileMetaSchema = exports.FileMeta = exports.FileLogSchema = exports.FileLog = exports.S3FileSchema = exports.S3File = exports.AuthorSchema = exports.Author = exports.AuthorDTO = exports.RecordSchema = exports.Record = exports.PersonSchema = exports.Person = exports.I18nSchema = exports.I18n = exports.GeoLocationSchema = void 0;
|
|
4
|
+
exports.DictionaryService = exports.DictionaryModule = exports.DictionaryEmbedded = exports.DictionaryEmbeddedSchema = exports.Base = exports.I18nDTO = exports.getSortObj = exports.generateUserClientPermissionKeyword = exports.generateUserClientKeyword = exports.generateSessionKeyword = exports.ResourceType = exports.RESTQueryParams = exports.S3FileState = exports.S3Schema = exports.S3 = exports.LogInitiatorSchema = exports.LogInitiator = exports.FileStateSchema = exports.FileState = exports.FileRecordSchema = exports.FileRecord = exports.FileMetaSchema = exports.FileMeta = exports.FileLogSchema = exports.FileLog = exports.S3FileSchema = exports.S3File = exports.AuthorSchema = exports.Author = exports.AuthorDTO = exports.RecordSchema = exports.Record = exports.PersonSchema = exports.Person = exports.I18nSchema = exports.I18n = exports.GeoLocationSchema = void 0;
|
|
5
5
|
const is_map_of_strings_constraint_1 = require("./constraints/is-map-of-strings.constraint");
|
|
6
6
|
Object.defineProperty(exports, "IsMapOfStringsConstraint", { enumerable: true, get: function () { return is_map_of_strings_constraint_1.IsMapOfStringsConstraint; } });
|
|
7
7
|
const is_route_constraint_1 = require("./constraints/is-route.constraint");
|
|
@@ -147,4 +147,8 @@ Object.defineProperty(exports, "Base", { enumerable: true, get: function () { re
|
|
|
147
147
|
const dictionary_embedded_1 = require("./models/dictionary/embedded/dictionary.embedded");
|
|
148
148
|
Object.defineProperty(exports, "DictionaryEmbedded", { enumerable: true, get: function () { return dictionary_embedded_1.DictionaryEmbedded; } });
|
|
149
149
|
Object.defineProperty(exports, "DictionaryEmbeddedSchema", { enumerable: true, get: function () { return dictionary_embedded_1.DictionaryEmbeddedSchema; } });
|
|
150
|
+
const dictionary_module_1 = require("./modules/dictionary/dictionary.module");
|
|
151
|
+
Object.defineProperty(exports, "DictionaryModule", { enumerable: true, get: function () { return dictionary_module_1.DictionaryModule; } });
|
|
152
|
+
const dictionary_service_1 = require("./modules/dictionary/services/dictionary.service");
|
|
153
|
+
Object.defineProperty(exports, "DictionaryService", { enumerable: true, get: function () { return dictionary_service_1.DictionaryService; } });
|
|
150
154
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6FAAsF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6FAAsF;AAoKpF,yGApKO,uDAAwB,OAoKP;AAnK1B,2EAAsE;AAoKpE,kGApKO,uCAAiB,OAoKP;AAnKnB,0FAA0E;AAoKxE,+FApKO,4CAAc,OAoKP;AAnKhB,wEAA0D;AAoKxD,wFApKO,4BAAO,OAoKP;AAnKT,oEAAiE;AAoK/D,iGApKO,mCAAgB,OAoKP;AAnKlB,qEAA2E;AAoKzE,2GApKO,8CAA0B,OAoKP;AAnK5B,2EAAuE;AAoKrE,qGApKO,4CAAoB,OAoKP;AAnKtB,yDAAqD;AAoKnD,0FApKO,sBAAS,OAoKP;AAnKX,qEAA+D;AAoK7D,8FApKO,gCAAa,OAoKP;AAnKf,6EAAoE;AAoKlE,4FApKO,+BAAW,OAoKP;AAnKb,6EAW8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,wFAIsD;AAkGpD,4FArGA,mCAAW,OAqGA;AACX,kGArGA,yCAAiB,OAqGA;AAlGnB,wEAI8C;AAiG5C,qFApGA,oBAAI,OAoGA;AACJ,2FApGA,0BAAU,OAoGA;AAjGZ,4EAIgD;AAiG9C,uFApGA,wBAAM,OAoGA;AACN,6FApGA,8BAAY,OAoGA;AAjGd,4EAIgD;AAgG9C,uFAnGA,wBAAM,OAmGA;AACN,6FAnGA,8BAAY,OAmGA;AA3Fd,2EAI8C;AAoI5C,uGAvIA,yCAAsB,OAuIA;AACtB,0GAvIA,4CAAyB,OAuIA;AACzB,oHAvIA,sDAAmC,OAuIA;AArIrC,2EAA8D;AAsI5D,2FAtIO,iCAAU,OAsIP;AArIZ,qDAAiD;AAsI/C,wFAtIO,kBAAO,OAsIP;AApIT,sEAA4D;AAqI1D,qFArIO,kBAAI,OAqIP;AApIN,0FAI0D;AAoIxD,mGAvIA,wCAAkB,OAuIA;AAFlB,yGAnIA,8CAAwB,OAmIA;AA/H1B,8EAA0E;AAoIxE,iGApIO,oCAAgB,OAoIP;AAnIlB,yFAAqF;AAoInF,kGApIO,sCAAiB,OAoIP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HydratedDocument } from 'mongoose';
|
|
2
|
-
import { mongo
|
|
2
|
+
import { mongo } from 'mongoose';
|
|
3
3
|
import { I18n } from '../../util/embedded/i18n.embedded';
|
|
4
4
|
import { IDictionaryEmbedded } from '../interfaces/dictionary-embedded.interface';
|
|
5
5
|
import { RecordState } from '../../util/enums/record-state.enum';
|
|
@@ -8,9 +8,10 @@ export declare class DictionaryEmbedded implements IDictionaryEmbedded {
|
|
|
8
8
|
keyword: string;
|
|
9
9
|
record: RecordState;
|
|
10
10
|
originId: mongo.ObjectId;
|
|
11
|
+
originIds: mongo.ObjectId[];
|
|
11
12
|
dictionaryId: mongo.ObjectId;
|
|
12
13
|
}
|
|
13
|
-
export declare const DictionaryEmbeddedSchema:
|
|
14
|
+
export declare const DictionaryEmbeddedSchema: import("mongoose").Schema<DictionaryEmbedded, import("mongoose").Model<DictionaryEmbedded, any, any, any, import("mongoose").Document<unknown, any, DictionaryEmbedded> & DictionaryEmbedded & {
|
|
14
15
|
_id: import("mongoose").Types.ObjectId;
|
|
15
16
|
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, DictionaryEmbedded, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<DictionaryEmbedded>> & import("mongoose").FlatRecord<DictionaryEmbedded> & {
|
|
16
17
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DictionaryEmbeddedSchema = exports.DictionaryEmbedded = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
|
+
const mongoose_3 = require("mongoose");
|
|
15
16
|
const i18n_embedded_1 = require("../../util/embedded/i18n.embedded");
|
|
16
17
|
const record_state_enum_1 = require("../../util/enums/record-state.enum");
|
|
17
18
|
let DictionaryEmbedded = class DictionaryEmbedded {
|
|
@@ -30,12 +31,16 @@ __decorate([
|
|
|
30
31
|
__metadata("design:type", String)
|
|
31
32
|
], DictionaryEmbedded.prototype, "record", void 0);
|
|
32
33
|
__decorate([
|
|
33
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.
|
|
34
|
-
__metadata("design:type",
|
|
34
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.SchemaTypes.ObjectId, required: false }),
|
|
35
|
+
__metadata("design:type", mongoose_3.mongo.ObjectId)
|
|
35
36
|
], DictionaryEmbedded.prototype, "originId", void 0);
|
|
36
37
|
__decorate([
|
|
37
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.
|
|
38
|
-
__metadata("design:type",
|
|
38
|
+
(0, mongoose_1.Prop)({ type: [mongoose_2.SchemaTypes.ObjectId], required: false }),
|
|
39
|
+
__metadata("design:type", Array)
|
|
40
|
+
], DictionaryEmbedded.prototype, "originIds", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.SchemaTypes.ObjectId, required: false }),
|
|
43
|
+
__metadata("design:type", mongoose_3.mongo.ObjectId)
|
|
39
44
|
], DictionaryEmbedded.prototype, "dictionaryId", void 0);
|
|
40
45
|
exports.DictionaryEmbedded = DictionaryEmbedded = __decorate([
|
|
41
46
|
(0, mongoose_1.Schema)({ _id: false })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.embedded.js","sourceRoot":"","sources":["../../../../src/models/dictionary/embedded/dictionary.embedded.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;
|
|
1
|
+
{"version":3,"file":"dictionary.embedded.js","sourceRoot":"","sources":["../../../../src/models/dictionary/embedded/dictionary.embedded.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAAyD;AACzD,uCAAiC;AACjC,qEAAqE;AAErE,0EAAiE;AAG1D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAkB9B,CAAA;AAlBY,gDAAkB;AAE7B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,0BAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BACrC,oBAAI;iDAAC;AAGZ;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;mDACxB;AAGhB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,+BAAW,EAAE,CAAC;;kDACvC;AAGpB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,sBAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BAC5C,gBAAK,CAAC,QAAQ;oDAAC;AAGzB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,CAAC,sBAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qDAC5B;AAG5B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,sBAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BACxC,gBAAK,CAAC,QAAQ;wDAAC;6BAjBlB,kBAAkB;IAD9B,IAAA,iBAAM,EAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;GACV,kBAAkB,CAkB9B;AAEY,QAAA,wBAAwB,GACnC,wBAAa,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { II18n } from '../../util/interfaces/i18n.interface';
|
|
|
3
3
|
import { RecordState } from '../../util/enums/record-state.enum';
|
|
4
4
|
export interface IDictionaryEmbedded {
|
|
5
5
|
originId: mongo.ObjectId;
|
|
6
|
+
originIds: mongo.ObjectId[];
|
|
6
7
|
dictionaryId: mongo.ObjectId;
|
|
7
8
|
title: II18n;
|
|
8
9
|
keyword: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"author.dto.js","sourceRoot":"","sources":["../../../src/models/dtos/author.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkE;AAElE,MAAa,SAAS;CAQrB;AARD,8BAQC;
|
|
1
|
+
{"version":3,"file":"author.dto.js","sourceRoot":"","sources":["../../../src/models/dtos/author.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkE;AAElE,MAAa,SAAS;CAQrB;AARD,8BAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;yCACG;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;2CACI"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IDictionaryEmbedded } from '../../dictionary/interfaces/dictionary-embedded.interface';
|
|
2
|
+
import { IPermission } from '../../um/interfaces/permission.interface';
|
|
3
|
+
import { IAddress } from '../../util/interfaces/address.interface';
|
|
4
|
+
import { IContact } from '../../util/interfaces/contact.interface';
|
|
5
|
+
import { II18n } from '../../util/interfaces/i18n.interface';
|
|
6
|
+
export declare class ISessionClientData {
|
|
7
|
+
clientId: string;
|
|
8
|
+
type: IDictionaryEmbedded;
|
|
9
|
+
name: II18n;
|
|
10
|
+
address: IAddress;
|
|
11
|
+
highland: boolean;
|
|
12
|
+
code: string;
|
|
13
|
+
contacts: IContact[];
|
|
14
|
+
region: IDictionaryEmbedded;
|
|
15
|
+
district: IDictionaryEmbedded;
|
|
16
|
+
languageSectors: IDictionaryEmbedded[];
|
|
17
|
+
levels: IDictionaryEmbedded[];
|
|
18
|
+
subjects: IDictionaryEmbedded[];
|
|
19
|
+
permissions: IPermission[];
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-client-data.interface.js","sourceRoot":"","sources":["../../../../src/models/session/interfaces/session-client-data.interface.ts"],"names":[],"mappings":";;;AAMA,MAAa,kBAAkB;CAc9B;AAdD,gDAcC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDictionaryEmbedded } from '../../dictionary/interfaces/dictionary-embedded.interface';
|
|
2
|
+
export interface ISessionUserData {
|
|
3
|
+
userId: string;
|
|
4
|
+
username: string;
|
|
5
|
+
fistName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
pid: string;
|
|
8
|
+
subjects: IDictionaryEmbedded[];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-user-data.interface.js","sourceRoot":"","sources":["../../../../src/models/session/interfaces/session-user-data.interface.ts"],"names":[],"mappings":""}
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PermissionGuardConfig = void 0;
|
|
4
4
|
class PermissionGuardConfig {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.appAbbr = 'EH';
|
|
7
|
-
}
|
|
8
5
|
}
|
|
9
6
|
exports.PermissionGuardConfig = PermissionGuardConfig;
|
|
10
7
|
//# sourceMappingURL=permission-guard-config.wrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-guard-config.wrapper.js","sourceRoot":"","sources":["../../../src/models/wrappers/permission-guard-config.wrapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;
|
|
1
|
+
{"version":3,"file":"permission-guard-config.wrapper.js","sourceRoot":"","sources":["../../../src/models/wrappers/permission-guard-config.wrapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;CAEjC;AAFD,sDAEC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
import { SessionService } from '../services/session.service';
|
|
3
3
|
import { Reflector } from '@nestjs/core';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
4
5
|
export declare class PermissionGuard implements CanActivate {
|
|
5
6
|
private sessionService;
|
|
6
7
|
private reflector;
|
|
7
8
|
constructor(sessionService: SessionService, reflector: Reflector);
|
|
8
|
-
canActivate(context: ExecutionContext):
|
|
9
|
+
canActivate(context: ExecutionContext): Observable<boolean>;
|
|
9
10
|
private getTokenFromHeaders;
|
|
10
11
|
private getClientIdFromQuery;
|
|
11
|
-
private
|
|
12
|
-
private checkPerrmission;
|
|
12
|
+
private checkPermission;
|
|
13
13
|
private setUserData;
|
|
14
|
+
private validateUserData;
|
|
14
15
|
}
|
|
@@ -14,52 +14,39 @@ const common_1 = require("@nestjs/common");
|
|
|
14
14
|
const session_service_1 = require("../services/session.service");
|
|
15
15
|
const core_1 = require("@nestjs/core");
|
|
16
16
|
const permission_reflector_1 = require("../reflector/permission.reflector");
|
|
17
|
-
const permission_include_strategy_enum_1 = require("../../../models/um/enums/permission-include-strategy.enum");
|
|
18
17
|
const rest_wrapper_class_1 = require("../../../models/wrappers/rest-wrapper.class");
|
|
18
|
+
const rxjs_1 = require("rxjs");
|
|
19
19
|
let PermissionGuard = class PermissionGuard {
|
|
20
20
|
constructor(sessionService, reflector) {
|
|
21
21
|
this.sessionService = sessionService;
|
|
22
22
|
this.reflector = reflector;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
canActivate(context) {
|
|
25
25
|
const config = this.reflector.get(permission_reflector_1.Permission, context.getHandler());
|
|
26
26
|
const request = context.switchToHttp().getRequest();
|
|
27
27
|
const queryParameters = request.query;
|
|
28
28
|
const headers = request.headers;
|
|
29
29
|
const token = this.getTokenFromHeaders(headers);
|
|
30
|
-
if (!token)
|
|
31
|
-
rest_wrapper_class_1.RESTError
|
|
32
|
-
const userData = {};
|
|
33
|
-
if (!userData) {
|
|
34
|
-
rest_wrapper_class_1.RESTError.throw('unauthorized', common_1.HttpStatus.UNAUTHORIZED);
|
|
35
|
-
return false;
|
|
30
|
+
if (!token) {
|
|
31
|
+
throw new rest_wrapper_class_1.RESTError('unauthorized', common_1.HttpStatus.UNAUTHORIZED);
|
|
36
32
|
}
|
|
37
|
-
const abbr = config.appAbbr;
|
|
38
33
|
const clientId = this.getClientIdFromQuery(queryParameters);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (!clientPermissionsArray || clientPermissionsArray.length <= 0) {
|
|
56
|
-
}
|
|
57
|
-
const selectedPermissions = clientPermissionsArray.find((clientPermissions) => clientPermissions.clientId === clientId);
|
|
58
|
-
return this.checkPerrmission(((selectedPermissions || {}).permissions || []), config.keyword);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
34
|
+
const userData$ = this.sessionService.getUserData(token);
|
|
35
|
+
const result$ = userData$.pipe((0, rxjs_1.map)(this.validateUserData), (0, rxjs_1.mergeMap)((userData) => {
|
|
36
|
+
return this.sessionService
|
|
37
|
+
.getUserClientPermissions(userData.userId, clientId)
|
|
38
|
+
.pipe((0, rxjs_1.map)((data) => {
|
|
39
|
+
return {
|
|
40
|
+
user: userData,
|
|
41
|
+
client: data.client,
|
|
42
|
+
permissions: data.permissions,
|
|
43
|
+
};
|
|
44
|
+
}));
|
|
45
|
+
}), (0, rxjs_1.map)((data) => {
|
|
46
|
+
this.setUserData(data.user, data.client, data.permissions, request);
|
|
47
|
+
return this.checkPermission(data.permissions, config.keyword);
|
|
48
|
+
}));
|
|
49
|
+
return result$;
|
|
63
50
|
}
|
|
64
51
|
getTokenFromHeaders(headers) {
|
|
65
52
|
let token = headers.authorization;
|
|
@@ -70,24 +57,27 @@ let PermissionGuard = class PermissionGuard {
|
|
|
70
57
|
return token;
|
|
71
58
|
}
|
|
72
59
|
getClientIdFromQuery(queryParameters) {
|
|
73
|
-
return
|
|
60
|
+
return queryParameters.clientId;
|
|
74
61
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return parts[0];
|
|
62
|
+
checkPermission(userPermissions, allowedPermission) {
|
|
63
|
+
if (allowedPermission) {
|
|
64
|
+
return userPermissions.some((item) => item.keyword === allowedPermission);
|
|
79
65
|
}
|
|
80
66
|
else {
|
|
81
|
-
return
|
|
67
|
+
return true;
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setUserData(userData, clientPermissions, request) {
|
|
88
|
-
const userInfo = Object.assign(Object.assign({}, userData), { clientPermissions });
|
|
70
|
+
setUserData(userData, client, permissions, request) {
|
|
71
|
+
const userInfo = Object.assign(Object.assign({}, userData), { client,
|
|
72
|
+
permissions });
|
|
89
73
|
request['user'] = userInfo;
|
|
90
74
|
}
|
|
75
|
+
validateUserData(userData) {
|
|
76
|
+
if (!userData) {
|
|
77
|
+
throw new rest_wrapper_class_1.RESTError('unauthorized', common_1.HttpStatus.UNAUTHORIZED);
|
|
78
|
+
}
|
|
79
|
+
return userData;
|
|
80
|
+
}
|
|
91
81
|
};
|
|
92
82
|
exports.PermissionGuard = PermissionGuard;
|
|
93
83
|
exports.PermissionGuard = PermissionGuard = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../../src/modules/cache/guards/permission.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,iEAA6D;AAC7D,uCAAyC;AACzC,4EAA+D;
|
|
1
|
+
{"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../../src/modules/cache/guards/permission.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,iEAA6D;AAC7D,uCAAyC;AACzC,4EAA+D;AAE/D,oFAAwE;AACxE,+BAAiD;AAK1C,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YACU,cAA8B,EAC9B,SAAoB;QADpB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,cAAS,GAAT,SAAS,CAAW;IAC3B,CAAC;IAEJ,WAAW,CAAC,OAAyB;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC;QACtC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,MAAM,KAAK,GAAW,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,8BAAS,CAAC,cAAc,EAAE,mBAAU,CAAC,YAAY,CAAC,CA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;IACf,CAAC;IAEO,oBAAoB,CAAC,eAAoB;QAC/C,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IAEO,eAAe,CACrB,eAA8B,EAC9B,iBAAyB;QAEzB,IAAI,iBAAiB,EAAE,CAAC;YACtB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,iBAAiB,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,WAAW,CACjB,QAA0B,EAC1B,MAAe,EACf,WAA0B,EAC1B,OAAgB;QAEhB,MAAM,QAAQ,mCACT,QAAQ,KACX,MAAM;YACN,WAAW,GACZ,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEO,gBAAgB,CAAC,QAA0B;QACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,8BAAS,CAAC,cAAc,EAAE,mBAAU,CAAC,YAAY,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AArFY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAGe,gCAAc;QACnB,gBAAS;GAHnB,eAAe,CAqF3B"}
|
|
@@ -3,4 +3,10 @@ export declare class SessionService {
|
|
|
3
3
|
private redisService;
|
|
4
4
|
private sessionClient;
|
|
5
5
|
constructor(redisService: RedisService);
|
|
6
|
+
getUserData(token: string): import("rxjs").Observable<import("../../..").ISessionUserData>;
|
|
7
|
+
getClientData(userId: string): import("rxjs").Observable<Map<string, import("../../../models/session/interfaces/session-client-data.interface").ISessionClientData>>;
|
|
8
|
+
getUserClientPermissions(userId: string, clientId: string): import("rxjs").Observable<{
|
|
9
|
+
client: import("../../..").IClient;
|
|
10
|
+
permissions: import("../../..").IPermission[];
|
|
11
|
+
}>;
|
|
6
12
|
}
|
|
@@ -18,6 +18,15 @@ let SessionService = class SessionService {
|
|
|
18
18
|
this.redisService = redisService;
|
|
19
19
|
this.sessionClient = new session_client_1.SessionClient(this.redisService.getRedisClient());
|
|
20
20
|
}
|
|
21
|
+
getUserData(token) {
|
|
22
|
+
return this.sessionClient.getUserData(token);
|
|
23
|
+
}
|
|
24
|
+
getClientData(userId) {
|
|
25
|
+
return this.sessionClient.getUserClients(userId);
|
|
26
|
+
}
|
|
27
|
+
getUserClientPermissions(userId, clientId) {
|
|
28
|
+
return this.sessionClient.getUserClientPermissions(userId, clientId);
|
|
29
|
+
}
|
|
21
30
|
};
|
|
22
31
|
exports.SessionService = SessionService;
|
|
23
32
|
exports.SessionService = SessionService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.service.js","sourceRoot":"","sources":["../../../../src/modules/cache/services/session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mDAA+C;AAC/C,oEAAgE;AAGzD,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"session.service.js","sourceRoot":"","sources":["../../../../src/modules/cache/services/session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mDAA+C;AAC/C,oEAAgE;AAGzD,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEM,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAEM,aAAa,CAAC,MAAc;QACjC,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAEM,wBAAwB,CAAC,MAAc,EAAE,QAAgB;QAC9D,OAAO,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAC;CACF,CAAA;AAjBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAGuB,4BAAY;GAFnC,cAAc,CAiB1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DictionaryModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const dictionary_service_1 = require("./services/dictionary.service");
|
|
12
|
+
const config_1 = require("@nestjs/config");
|
|
13
|
+
let DictionaryModule = class DictionaryModule {
|
|
14
|
+
};
|
|
15
|
+
exports.DictionaryModule = DictionaryModule;
|
|
16
|
+
exports.DictionaryModule = DictionaryModule = __decorate([
|
|
17
|
+
(0, common_1.Module)({
|
|
18
|
+
imports: [config_1.ConfigModule],
|
|
19
|
+
controllers: [],
|
|
20
|
+
providers: [dictionary_service_1.DictionaryService],
|
|
21
|
+
exports: [dictionary_service_1.DictionaryService],
|
|
22
|
+
})
|
|
23
|
+
], DictionaryModule);
|
|
24
|
+
//# sourceMappingURL=dictionary.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.module.js","sourceRoot":"","sources":["../../../src/modules/dictionary/dictionary.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,sEAAkE;AAClE,2CAA8C;AAQvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAN5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,sCAAiB,CAAC;KAC7B,CAAC;GACW,gBAAgB,CAAG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RecordState } from '../../../models/util/enums/record-state.enum';
|
|
2
|
+
export declare class DictionaryListDTO {
|
|
3
|
+
rootOnly: boolean;
|
|
4
|
+
keyword: string;
|
|
5
|
+
title: string;
|
|
6
|
+
parentId: string;
|
|
7
|
+
originId: string;
|
|
8
|
+
recordStates: RecordState[];
|
|
9
|
+
ids: string[];
|
|
10
|
+
}
|