@neuralinnovations/dataisland-sdk 0.4.0 → 0.4.1
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/package.json +1 -1
- package/dist/src/dto/userInfoResponse.d.ts +5 -0
- package/dist/src/dto/userInfoResponse.d.ts.map +1 -1
- package/dist/src/services/statistics.d.ts +3 -0
- package/dist/src/services/statistics.d.ts.map +1 -1
- package/dist/src/services/statistics.js +5 -0
- package/dist/src/services/statistics.js.map +1 -1
- package/dist/src/storages/administration/administration.d.ts +2 -0
- package/dist/src/storages/administration/administration.d.ts.map +1 -1
- package/dist/src/storages/administration/administration.js.map +1 -1
- package/dist/src/storages/administration/library.administration.impl.js +5 -5
- package/dist/src/storages/administration/statistics.administration.impl.js +2 -2
- package/dist/src/storages/administration/statistics.administration.impl.js.map +1 -1
- package/dist/src/storages/administration/users.administration.d.ts +6 -0
- package/dist/src/storages/administration/users.administration.d.ts.map +1 -0
- package/dist/src/storages/administration/users.administration.impl.d.ts +10 -0
- package/dist/src/storages/administration/users.administration.impl.d.ts.map +1 -0
- package/dist/src/storages/administration/users.administration.impl.js +37 -0
- package/dist/src/storages/administration/users.administration.impl.js.map +1 -0
- package/dist/src/storages/administration/users.administration.js +7 -0
- package/dist/src/storages/administration/users.administration.js.map +1 -0
- package/dist/src/storages/organizations/organizationPrompts.d.ts +12 -6
- package/dist/src/storages/organizations/organizationPrompts.d.ts.map +1 -1
- package/dist/src/storages/organizations/organizationPrompts.impl.d.ts +6 -6
- package/dist/src/storages/organizations/organizationPrompts.impl.d.ts.map +1 -1
- package/dist/src/storages/organizations/organizationPrompts.impl.js +30 -17
- package/dist/src/storages/organizations/organizationPrompts.impl.js.map +1 -1
- package/dist/src/storages/organizations/organizationPrompts.js.map +1 -1
- package/package.json +1 -1
- package/src/dto/userInfoResponse.ts +6 -0
- package/src/services/statistics.ts +9 -0
- package/src/storages/administration/administration.ts +3 -0
- package/src/storages/administration/library.administration.impl.ts +5 -5
- package/src/storages/administration/statistics.administration.impl.ts +2 -2
- package/src/storages/administration/users.administration.impl.ts +48 -0
- package/src/storages/administration/users.administration.ts +15 -0
- package/src/storages/organizations/organizationPrompts.impl.ts +37 -20
- package/src/storages/organizations/organizationPrompts.ts +12 -6
package/dist/package.json
CHANGED
@@ -8,6 +8,11 @@ export interface UserInfoResponse {
|
|
8
8
|
organizations: OrganizationDto[];
|
9
9
|
user: UserDto;
|
10
10
|
}
|
11
|
+
export interface SearchUserResponse {
|
12
|
+
user: UserDto;
|
13
|
+
organizations: OrganizationDto[];
|
14
|
+
segmentKey: string;
|
15
|
+
}
|
11
16
|
export interface UserDto {
|
12
17
|
id: UserId;
|
13
18
|
isDeleted: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userInfoResponse.d.ts","sourceRoot":"","sources":["../../../src/dto/userInfoResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,aAAa,EAAE,eAAe,EAAE,CAAA;IAChC,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,UAAU,CAAA;IACnB,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;CAC/B;AAED,M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AAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAA;IACtB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,qBAAqB,EAAE,OAAO,CAAA;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,kBAAkB,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,cAAc,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,aAAa,EAAE,CAAA;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,sBAAsB,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;CACnB"}
|
@@ -2,11 +2,14 @@ import { Service, ServiceContext } from "./service";
|
|
2
2
|
import { LibraryAdministration } from "../storages/administration/library.administration";
|
3
3
|
import { StatisticAdministrationImpl } from "../storages/administration/statistics.administration.impl";
|
4
4
|
import { Administration } from "../storages/administration/administration";
|
5
|
+
import { UsersAdministrationImpl } from "../storages/administration/users.administration.impl";
|
5
6
|
export declare class AdministrationService extends Service implements Administration {
|
6
7
|
private readonly _libraries;
|
7
8
|
private readonly _statistic;
|
9
|
+
private readonly _users;
|
8
10
|
constructor(context: ServiceContext);
|
9
11
|
get libraries(): LibraryAdministration;
|
10
12
|
get statistic(): StatisticAdministrationImpl;
|
13
|
+
get users(): UsersAdministrationImpl;
|
11
14
|
}
|
12
15
|
//# sourceMappingURL=statistics.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/services/statistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAInD,OAAO,EACL,qBAAqB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACL,2BAA2B,EAC5B,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/services/statistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAInD,OAAO,EACL,qBAAqB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACL,2BAA2B,EAC5B,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EACL,uBAAuB,EACxB,MAAM,sDAAsD,CAAA;AAE7D,qBAAa,qBAAsB,SAAQ,OAAQ,YAAW,cAAc;IAC1E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2B;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;gBAEpC,OAAO,EAAE,cAAc;IAQnC,IAAI,SAAS,IAAI,qBAAqB,CAErC;IAED,IAAI,SAAS,IAAI,2BAA2B,CAE3C;IAED,IAAI,KAAK,IAAI,uBAAuB,CAEnC;CACF"}
|
@@ -4,11 +4,13 @@ exports.AdministrationService = void 0;
|
|
4
4
|
const service_1 = require("./service");
|
5
5
|
const library_administration_impl_1 = require("../storages/administration/library.administration.impl");
|
6
6
|
const statistics_administration_impl_1 = require("../storages/administration/statistics.administration.impl");
|
7
|
+
const users_administration_impl_1 = require("../storages/administration/users.administration.impl");
|
7
8
|
class AdministrationService extends service_1.Service {
|
8
9
|
constructor(context) {
|
9
10
|
super(context);
|
10
11
|
this._libraries = new library_administration_impl_1.LibraryAdministrationImpl(context.context);
|
11
12
|
this._statistic = new statistics_administration_impl_1.StatisticAdministrationImpl(context.context);
|
13
|
+
this._users = new users_administration_impl_1.UsersAdministrationImpl(context.context);
|
12
14
|
}
|
13
15
|
get libraries() {
|
14
16
|
return this._libraries;
|
@@ -16,6 +18,9 @@ class AdministrationService extends service_1.Service {
|
|
16
18
|
get statistic() {
|
17
19
|
return this._statistic;
|
18
20
|
}
|
21
|
+
get users() {
|
22
|
+
return this._users;
|
23
|
+
}
|
19
24
|
}
|
20
25
|
exports.AdministrationService = AdministrationService;
|
21
26
|
//# sourceMappingURL=statistics.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"statistics.js","sourceRoot":"","sources":["../../../src/services/statistics.ts"],"names":[],"mappings":";;;AAAA,uCAAmD;AACnD,wGAE+D;AAI/D,8GAEkE;
|
1
|
+
{"version":3,"file":"statistics.js","sourceRoot":"","sources":["../../../src/services/statistics.ts"],"names":[],"mappings":";;;AAAA,uCAAmD;AACnD,wGAE+D;AAI/D,8GAEkE;AAElE,oGAE6D;AAE7D,MAAa,qBAAsB,SAAQ,iBAAO;IAKhD,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,UAAU,GAAG,IAAI,uDAAyB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAI,4DAA2B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAClE,IAAI,CAAC,MAAM,GAAG,IAAI,mDAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5D,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF;AAxBD,sDAwBC"}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { LibraryAdministration } from "./library.administration";
|
2
2
|
import { StatisticAdministration } from "./statistics.administration";
|
3
|
+
import { UsersAdministration } from "./users.administration";
|
3
4
|
export declare abstract class Administration {
|
4
5
|
abstract get libraries(): LibraryAdministration;
|
5
6
|
abstract get statistic(): StatisticAdministration;
|
7
|
+
abstract get users(): UsersAdministration;
|
6
8
|
}
|
7
9
|
//# sourceMappingURL=administration.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"administration.d.ts","sourceRoot":"","sources":["../../../../src/storages/administration/administration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;
|
1
|
+
{"version":3,"file":"administration.d.ts","sourceRoot":"","sources":["../../../../src/storages/administration/administration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAA;AAE1D,8BAAsB,cAAc;IAClC,QAAQ,KAAK,SAAS,IAAI,qBAAqB,CAAE;IAEjD,QAAQ,KAAK,SAAS,IAAI,uBAAuB,CAAC;IAElD,QAAQ,KAAK,KAAK,IAAI,mBAAmB,CAAC;CAC3C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../../src/storages/administration/administration.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../../src/storages/administration/administration.ts"],"names":[],"mappings":";;;AAIA,MAAsB,cAAc;CAMnC;AAND,wCAMC"}
|
@@ -27,7 +27,7 @@ class LibraryAdministrationImpl extends library_administration_1.LibraryAdminist
|
|
27
27
|
}
|
28
28
|
// send create request to the server
|
29
29
|
const response = await ((_a = this.context
|
30
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/libraries
|
30
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/libraries").sendPostJson({
|
31
31
|
name: name,
|
32
32
|
description: description,
|
33
33
|
region: region,
|
@@ -55,7 +55,7 @@ class LibraryAdministrationImpl extends library_administration_1.LibraryAdminist
|
|
55
55
|
throw new Error("Organization add to from library, organizationId is empty");
|
56
56
|
}
|
57
57
|
const response = await ((_a = this.context
|
58
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/libraries/
|
58
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/libraries/allowed/organization").sendPutJson({
|
59
59
|
libraryId: libraryId,
|
60
60
|
organizationId: organizationId
|
61
61
|
}));
|
@@ -66,7 +66,7 @@ class LibraryAdministrationImpl extends library_administration_1.LibraryAdminist
|
|
66
66
|
async getLibraries() {
|
67
67
|
var _a;
|
68
68
|
const response = await ((_a = this.context
|
69
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/libraries/
|
69
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/libraries/allowed/organizations").sendGet());
|
70
70
|
// check response status
|
71
71
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
72
72
|
await responseUtils_1.ResponseUtils.throwError("Can not get libraries", response);
|
@@ -91,7 +91,7 @@ class LibraryAdministrationImpl extends library_administration_1.LibraryAdminist
|
|
91
91
|
}
|
92
92
|
// send request to the server
|
93
93
|
const response = await ((_a = this.context
|
94
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/libraries/
|
94
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/libraries/allowed/organization").searchParam("libraryId", libraryId).searchParam("organizationId", organizationId).sendDelete());
|
95
95
|
// check response status
|
96
96
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
97
97
|
await responseUtils_1.ResponseUtils.throwError(`Organization ${organizationId} delete from library ${libraryId}, failed`, response);
|
@@ -107,7 +107,7 @@ class LibraryAdministrationImpl extends library_administration_1.LibraryAdminist
|
|
107
107
|
}
|
108
108
|
// send request to the server
|
109
109
|
const response = await ((_a = this.context
|
110
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/libraries
|
110
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/libraries").searchParam("libraryId", libraryId).sendDelete());
|
111
111
|
// check response status
|
112
112
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
113
113
|
await responseUtils_1.ResponseUtils.throwError(`Library ${libraryId} delete, failed`, response);
|
@@ -10,7 +10,7 @@ class StatisticAdministrationImpl {
|
|
10
10
|
async getOrganizationMembers(organizationId, dateFrom, dateTo) {
|
11
11
|
var _a;
|
12
12
|
const response = await ((_a = this.context
|
13
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/
|
13
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/stats/organization/members/total").searchParam("organizationId", organizationId).searchParam("dateFrom", dateFrom.toString()).searchParam("dateTo", dateTo.toString()).sendGet());
|
14
14
|
// check response status
|
15
15
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
16
16
|
await responseUtils_1.ResponseUtils.throwError("Failed to get statistics", response);
|
@@ -20,7 +20,7 @@ class StatisticAdministrationImpl {
|
|
20
20
|
async getOrganizations(dateFrom, dateTo) {
|
21
21
|
var _a;
|
22
22
|
const response = await ((_a = this.context
|
23
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("
|
23
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/stats/organizations").searchParam("dateFrom", dateFrom.toString()).searchParam("dateTo", dateTo.toString()).sendGet());
|
24
24
|
// check response status
|
25
25
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
26
26
|
await responseUtils_1.ResponseUtils.throwError("Failed to get statistics", response);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"statistics.administration.impl.js","sourceRoot":"","sources":["../../../../src/storages/administration/statistics.administration.impl.ts"],"names":[],"mappings":";;;AACA,0DAAsD;AACtD,gEAA4D;AAQ5D,MAAa,2BAA2B;IACtC,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAC7C,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC1B,cAA8B,EAC9B,QAAgB,EAChB,MAAc;;QAEd,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,
|
1
|
+
{"version":3,"file":"statistics.administration.impl.js","sourceRoot":"","sources":["../../../../src/storages/administration/statist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,QAAS,CAAC,IAAI,EAAmC,CAAA;IAChE,CAAC;CACF;AAxCD,kEAwCC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { SearchUserResponse } from "../../dto/userInfoResponse";
|
2
|
+
export declare abstract class UsersAdministration {
|
3
|
+
abstract search(email: string): Promise<SearchUserResponse>;
|
4
|
+
abstract setUserSegment(email: string, userId: string, segmentKey: string): Promise<void>;
|
5
|
+
}
|
6
|
+
//# sourceMappingURL=users.administration.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"users.administration.d.ts","sourceRoot":"","sources":["../../../../src/storages/administration/users.administration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAG7D,8BAAsB,mBAAmB;IAKvC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK3D,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1F"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { UsersAdministration } from "./users.administration";
|
2
|
+
import { SearchUserResponse } from "../../dto/userInfoResponse";
|
3
|
+
import { Context } from "../../context";
|
4
|
+
export declare class UsersAdministrationImpl implements UsersAdministration {
|
5
|
+
private readonly context;
|
6
|
+
constructor(context: Context);
|
7
|
+
search(email: string): Promise<SearchUserResponse>;
|
8
|
+
setUserSegment(email: string, userId: string, segmentKey: string): Promise<void>;
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=users.administration.impl.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"users.administration.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/administration/users.administration.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAG7D,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAGrC,qBAAa,uBAAwB,YAAW,mBAAmB;IAErD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,OAAO;IAGvC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkBlD,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBvF"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UsersAdministrationImpl = void 0;
|
4
|
+
const rpcService_1 = require("../../services/rpcService");
|
5
|
+
const responseUtils_1 = require("../../services/responseUtils");
|
6
|
+
class UsersAdministrationImpl {
|
7
|
+
constructor(context) {
|
8
|
+
this.context = context;
|
9
|
+
}
|
10
|
+
async search(email) {
|
11
|
+
var _a;
|
12
|
+
if (email === undefined || email === null || email.trim() === "") {
|
13
|
+
throw new Error("Email is null or empty");
|
14
|
+
}
|
15
|
+
const response = await ((_a = this.context
|
16
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/users/info/email").searchParam("email", email).sendGet());
|
17
|
+
// check response status
|
18
|
+
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
19
|
+
await responseUtils_1.ResponseUtils.throwError("Failed to search user by email", response);
|
20
|
+
}
|
21
|
+
return await response.json();
|
22
|
+
}
|
23
|
+
async setUserSegment(email, userId, segmentKey) {
|
24
|
+
var _a;
|
25
|
+
const response = await ((_a = this.context
|
26
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/management/users/limits/segment").sendPutJson({
|
27
|
+
userEmail: email,
|
28
|
+
userId: userId,
|
29
|
+
segmentKey: segmentKey
|
30
|
+
}));
|
31
|
+
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
32
|
+
await responseUtils_1.ResponseUtils.throwError(`Set segment ${segmentKey} for user ${email}, id ${userId} failed`, response);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
exports.UsersAdministrationImpl = UsersAdministrationImpl;
|
37
|
+
//# sourceMappingURL=users.administration.impl.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"users.administration.impl.js","sourceRoot":"","sources":["../../../../src/storages/administration/users.administration.impl.ts"],"names":[],"mappings":";;;AAEA,0DAAoD;AACpD,gEAA0D;AAI1D,MAAa,uBAAuB;IAElC,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAC7C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;;QACxB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,CAAC;YAChE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,oCAAoC,EACpD,WAAW,CAAC,OAAO,EAAE,KAAK,EAC1B,OAAO,EAAE,CAAA,CAAA;QAEZ,wBAAwB;QACxB,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAA;QAC5E,CAAC;QAED,OAAO,MAAM,QAAS,CAAC,IAAI,EAAwB,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,MAAc,EAAE,UAAkB;;QACpE,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,wCAAwC,EACxD,WAAW,CAAC;YACX,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,UAAU;SACvB,CAAC,CAAA,CAAA;QACJ,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAC5B,eAAe,UAAU,aAAa,KAAK,QAAQ,MAAM,SAAS,EAClE,QAAQ,CACT,CAAA;QACH,CAAC;IACH,CAAC;CAEF;AAxCD,0DAwCC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"users.administration.js","sourceRoot":"","sources":["../../../../src/storages/administration/users.administration.ts"],"names":[],"mappings":";;;AAGA,MAAsB,mBAAmB;CAWxC;AAXD,kDAWC"}
|
@@ -2,32 +2,38 @@ import { OrganizationPromptDto } from "../../dto/userInfoResponse";
|
|
2
2
|
export declare abstract class OrganizationPrompts {
|
3
3
|
/**
|
4
4
|
* Get default organization prompts
|
5
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
5
6
|
*/
|
6
|
-
abstract getDefaultPrompts(): Promise<OrganizationPromptDto[]>;
|
7
|
+
abstract getDefaultPrompts(sourceName: string): Promise<OrganizationPromptDto[]>;
|
7
8
|
/**
|
8
9
|
* Get all organization prompts
|
10
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
9
11
|
*/
|
10
|
-
abstract getPrompts(): Promise<OrganizationPromptDto[]>;
|
12
|
+
abstract getPrompts(sourceName: string): Promise<OrganizationPromptDto[]>;
|
11
13
|
/**
|
12
14
|
* Create/Update/Delete new prompt
|
15
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
13
16
|
* @param key - key of prompt
|
14
17
|
* @param value - value of prompt, null|undefined to delete
|
15
18
|
*/
|
16
|
-
abstract updatePrompt(key: string, value: string | undefined | null): Promise<void>;
|
19
|
+
abstract updatePrompt(sourceName: string, key: string, value: string | undefined | null): Promise<void>;
|
17
20
|
/**
|
18
21
|
* Update prompts in bulk
|
22
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
19
23
|
* @param prompts - array of prompts (value can be null|undefined to delete)
|
20
24
|
*/
|
21
|
-
abstract updatePrompts(prompts: OrganizationPromptDto[]): Promise<void>;
|
25
|
+
abstract updatePrompts(sourceName: string, prompts: OrganizationPromptDto[]): Promise<void>;
|
22
26
|
/**
|
23
27
|
* Delete prompt
|
28
|
+
* @param sourceName
|
24
29
|
* @param key
|
25
30
|
*/
|
26
|
-
abstract deletePrompt(key: string): Promise<void>;
|
31
|
+
abstract deletePrompt(sourceName: string, key: string): Promise<void>;
|
27
32
|
/**
|
28
33
|
* Delete prompt
|
34
|
+
* @param sourceName
|
29
35
|
* @param keys
|
30
36
|
*/
|
31
|
-
abstract deletePrompts(keys: string[]): Promise<void>;
|
37
|
+
abstract deletePrompts(sourceName: string, keys: string[]): Promise<void>;
|
32
38
|
}
|
33
39
|
//# sourceMappingURL=organizationPrompts.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organizationPrompts.d.ts","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAEnC,8BAAsB,mBAAmB;IAEvC
|
1
|
+
{"version":3,"file":"organizationPrompts.d.ts","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAEnC,8BAAsB,mBAAmB;IAEvC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAEhF;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAEzE;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvG;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3F;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErE;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1E"}
|
@@ -7,11 +7,11 @@ export declare class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
7
7
|
private readonly context;
|
8
8
|
private _cacheDefaultPrompts;
|
9
9
|
constructor(organization: OrganizationImpl, context: Context);
|
10
|
-
getDefaultPrompts(): Promise<OrganizationPromptDto[]>;
|
11
|
-
getPrompts(): Promise<OrganizationPromptDto[]>;
|
12
|
-
updatePrompts(prompts: OrganizationPromptDto[]): Promise<void>;
|
13
|
-
updatePrompt(key: string, value: string | null): Promise<void>;
|
14
|
-
deletePrompt(key: string): Promise<void>;
|
15
|
-
deletePrompts(keys: string[]): Promise<void>;
|
10
|
+
getDefaultPrompts(sourceName: string): Promise<OrganizationPromptDto[]>;
|
11
|
+
getPrompts(sourceName: string): Promise<OrganizationPromptDto[]>;
|
12
|
+
updatePrompts(sourceName: string, prompts: OrganizationPromptDto[]): Promise<void>;
|
13
|
+
updatePrompt(sourceName: string, key: string, value: string | null): Promise<void>;
|
14
|
+
deletePrompt(sourceName: string, key: string): Promise<void>;
|
15
|
+
deletePrompts(sourceName: string, keys: string[]): Promise<void>;
|
16
16
|
}
|
17
17
|
//# sourceMappingURL=organizationPrompts.impl.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organizationPrompts.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,qBAAa,uBAAwB,YAAW,mBAAmB;IAK/D,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,oBAAoB,
|
1
|
+
{"version":3,"file":"organizationPrompts.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,qBAAa,uBAAwB,YAAW,mBAAmB;IAK/D,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,oBAAoB,CAAmF;gBAG5F,YAAY,EAAE,gBAAgB,EAC9B,OAAO,EAAE,OAAO;IAK7B,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA+BvE,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAyBhE,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiClF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvE"}
|
@@ -7,34 +7,43 @@ class OrganizationPromptsImpl {
|
|
7
7
|
constructor(organization, context) {
|
8
8
|
this.organization = organization;
|
9
9
|
this.context = context;
|
10
|
-
this._cacheDefaultPrompts =
|
10
|
+
this._cacheDefaultPrompts = new Map();
|
11
11
|
}
|
12
|
-
async getDefaultPrompts() {
|
12
|
+
async getDefaultPrompts(sourceName) {
|
13
13
|
var _a;
|
14
|
-
if (
|
15
|
-
|
14
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
15
|
+
throw new Error("Source name is empty or null");
|
16
|
+
}
|
17
|
+
if (this._cacheDefaultPrompts.get(sourceName) !== undefined) {
|
18
|
+
return this._cacheDefaultPrompts.get(sourceName);
|
16
19
|
}
|
17
20
|
const response = await ((_a = this.context
|
18
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/
|
21
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Prompts/organization/default").searchParam("organizationId", this.organization.id).searchParam("sourceName", sourceName).sendGet());
|
19
22
|
// check response status
|
20
23
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
21
24
|
await responseUtils_1.ResponseUtils.throwError(`Failed during fetch of organization prompts ${this.organization.id}`, response);
|
22
25
|
}
|
23
|
-
this._cacheDefaultPrompts
|
24
|
-
return this._cacheDefaultPrompts;
|
26
|
+
this._cacheDefaultPrompts.set(sourceName, (await response.json()).prompts);
|
27
|
+
return this._cacheDefaultPrompts.get(sourceName);
|
25
28
|
}
|
26
|
-
async getPrompts() {
|
29
|
+
async getPrompts(sourceName) {
|
27
30
|
var _a;
|
31
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
32
|
+
throw new Error("Source name is empty or null");
|
33
|
+
}
|
28
34
|
const response = await ((_a = this.context
|
29
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/
|
35
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Prompts/organization").searchParam("organizationId", this.organization.id).searchParam("sourceName", sourceName).sendGet());
|
30
36
|
// check response status
|
31
37
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
32
38
|
await responseUtils_1.ResponseUtils.throwError(`Failed during fetch of organization prompts ${this.organization.id}`, response);
|
33
39
|
}
|
34
40
|
return (await response.json()).prompts;
|
35
41
|
}
|
36
|
-
async updatePrompts(prompts) {
|
42
|
+
async updatePrompts(sourceName, prompts) {
|
37
43
|
var _a;
|
44
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
45
|
+
throw new Error("Source name is empty or null");
|
46
|
+
}
|
38
47
|
if (prompts === undefined || prompts === null || prompts.length === 0) {
|
39
48
|
return;
|
40
49
|
}
|
@@ -45,23 +54,27 @@ class OrganizationPromptsImpl {
|
|
45
54
|
}
|
46
55
|
}
|
47
56
|
const response = await ((_a = this.context
|
48
|
-
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/
|
57
|
+
.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Prompts/organization").sendPutJson({
|
58
|
+
"organizationId": this.organization.id,
|
59
|
+
"sourceName": sourceName,
|
60
|
+
"prompts": prompts
|
61
|
+
}));
|
49
62
|
// check response status
|
50
63
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
51
64
|
await responseUtils_1.ResponseUtils.throwError(`Failed during update organization's list of prompts ${this.organization.id}`, response);
|
52
65
|
}
|
53
66
|
}
|
54
|
-
async updatePrompt(key, value) {
|
55
|
-
return this.updatePrompts([{
|
67
|
+
async updatePrompt(sourceName, key, value) {
|
68
|
+
return this.updatePrompts(sourceName, [{
|
56
69
|
key,
|
57
70
|
value
|
58
71
|
}]);
|
59
72
|
}
|
60
|
-
deletePrompt(key) {
|
61
|
-
return this.updatePrompt(key, null);
|
73
|
+
deletePrompt(sourceName, key) {
|
74
|
+
return this.updatePrompt(sourceName, key, null);
|
62
75
|
}
|
63
|
-
async deletePrompts(keys) {
|
64
|
-
return this.updatePrompts(keys.map(key => ({
|
76
|
+
async deletePrompts(sourceName, keys) {
|
77
|
+
return this.updatePrompts(sourceName, keys.map(key => ({
|
65
78
|
key,
|
66
79
|
value: null
|
67
80
|
})));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organizationPrompts.impl.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.impl.ts"],"names":[],"mappings":";;;AAIA,0DAAsD;AACtD,gEAA4D;AAE5D,MAAa,uBAAuB;IAIlC,YACmB,YAA8B,EAC9B,OAAgB;QADhB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,YAAO,GAAP,OAAO,CAAS;QAJ3B,yBAAoB,
|
1
|
+
{"version":3,"file":"organizationPrompts.impl.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.impl.ts"],"names":[],"mappings":";;;AAIA,0DAAsD;AACtD,gEAA4D;AAE5D,MAAa,uBAAuB;IAIlC,YACmB,YAA8B,EAC9B,OAAgB;QADhB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,YAAO,GAAP,OAAO,CAAS;QAJ3B,yBAAoB,GAAyC,IAAI,GAAG,E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GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,6BAA6B,EAC7C,WAAW,CACV;YACE,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE;YACtC,YAAY,EAAE,UAAU;YACxB,SAAS,EAAE,OAAO;SACnB,CAAC,CAAA,CAAA;QAEN,wBAAwB;QACxB,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAC5B,uDAAuD,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,EAC7E,QAAQ,CACT,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,GAAW,EAAE,KAAoB;QACtE,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAC,CAAC;gBACpC,GAAG;gBACH,KAAK;aACN,CAAC,CAAC,CAAA;IACL,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IACjD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,UAAkB,EAAE,IAAc;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACrD,GAAG;YACH,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC,CAAC,CAAA;IACN,CAAC;CAEF;AAtHD,0DAsHC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organizationPrompts.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.ts"],"names":[],"mappings":";;;AAIA,MAAsB,mBAAmB;
|
1
|
+
{"version":3,"file":"organizationPrompts.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organizationPrompts.ts"],"names":[],"mappings":";;;AAIA,MAAsB,mBAAmB;CA0CxC;AA1CD,kDA0CC"}
|
package/package.json
CHANGED
@@ -9,16 +9,21 @@ import {
|
|
9
9
|
StatisticAdministrationImpl
|
10
10
|
} from "../storages/administration/statistics.administration.impl"
|
11
11
|
import { Administration } from "../storages/administration/administration"
|
12
|
+
import {
|
13
|
+
UsersAdministrationImpl
|
14
|
+
} from "../storages/administration/users.administration.impl"
|
12
15
|
|
13
16
|
export class AdministrationService extends Service implements Administration {
|
14
17
|
private readonly _libraries: LibraryAdministrationImpl
|
15
18
|
private readonly _statistic: StatisticAdministrationImpl
|
19
|
+
private readonly _users: UsersAdministrationImpl
|
16
20
|
|
17
21
|
constructor(context: ServiceContext) {
|
18
22
|
super(context)
|
19
23
|
|
20
24
|
this._libraries = new LibraryAdministrationImpl(context.context)
|
21
25
|
this._statistic = new StatisticAdministrationImpl(context.context)
|
26
|
+
this._users = new UsersAdministrationImpl(context.context)
|
22
27
|
}
|
23
28
|
|
24
29
|
get libraries(): LibraryAdministration {
|
@@ -28,4 +33,8 @@ export class AdministrationService extends Service implements Administration {
|
|
28
33
|
get statistic(): StatisticAdministrationImpl {
|
29
34
|
return this._statistic
|
30
35
|
}
|
36
|
+
|
37
|
+
get users(): UsersAdministrationImpl {
|
38
|
+
return this._users
|
39
|
+
}
|
31
40
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import { LibraryAdministration } from "./library.administration"
|
2
2
|
import { StatisticAdministration } from "./statistics.administration"
|
3
|
+
import {UsersAdministration} from "./users.administration"
|
3
4
|
|
4
5
|
export abstract class Administration {
|
5
6
|
abstract get libraries(): LibraryAdministration ;
|
6
7
|
|
7
8
|
abstract get statistic(): StatisticAdministration;
|
9
|
+
|
10
|
+
abstract get users(): UsersAdministration;
|
8
11
|
}
|
@@ -45,7 +45,7 @@ export class LibraryAdministrationImpl extends LibraryAdministration {
|
|
45
45
|
// send create request to the server
|
46
46
|
const response = await this.context
|
47
47
|
.resolve(RpcService)
|
48
|
-
?.requestBuilder("api/v1/libraries
|
48
|
+
?.requestBuilder("api/v1/management/libraries")
|
49
49
|
.sendPostJson({
|
50
50
|
name: name,
|
51
51
|
description: description,
|
@@ -79,7 +79,7 @@ export class LibraryAdministrationImpl extends LibraryAdministration {
|
|
79
79
|
|
80
80
|
const response = await this.context
|
81
81
|
.resolve(RpcService)
|
82
|
-
?.requestBuilder("api/v1/libraries/
|
82
|
+
?.requestBuilder("api/v1/management/libraries/allowed/organization")
|
83
83
|
.sendPutJson({
|
84
84
|
libraryId: libraryId,
|
85
85
|
organizationId: organizationId
|
@@ -95,7 +95,7 @@ export class LibraryAdministrationImpl extends LibraryAdministration {
|
|
95
95
|
async getLibraries(): Promise<LibraryDto[]> {
|
96
96
|
const response = await this.context
|
97
97
|
.resolve(RpcService)
|
98
|
-
?.requestBuilder("api/v1/libraries/
|
98
|
+
?.requestBuilder("api/v1/management/libraries/allowed/organizations")
|
99
99
|
.sendGet()
|
100
100
|
|
101
101
|
// check response status
|
@@ -129,7 +129,7 @@ export class LibraryAdministrationImpl extends LibraryAdministration {
|
|
129
129
|
// send request to the server
|
130
130
|
const response = await this.context
|
131
131
|
.resolve(RpcService)
|
132
|
-
?.requestBuilder("api/v1/libraries/
|
132
|
+
?.requestBuilder("api/v1/management/libraries/allowed/organization")
|
133
133
|
.searchParam("libraryId", libraryId)
|
134
134
|
.searchParam("organizationId", organizationId)
|
135
135
|
.sendDelete()
|
@@ -154,7 +154,7 @@ export class LibraryAdministrationImpl extends LibraryAdministration {
|
|
154
154
|
// send request to the server
|
155
155
|
const response = await this.context
|
156
156
|
.resolve(RpcService)
|
157
|
-
?.requestBuilder("api/v1/libraries
|
157
|
+
?.requestBuilder("api/v1/management/libraries")
|
158
158
|
.searchParam("libraryId", libraryId)
|
159
159
|
.sendDelete()
|
160
160
|
|
@@ -19,7 +19,7 @@ export class StatisticAdministrationImpl implements StatisticAdministration {
|
|
19
19
|
): Promise<OrganizationMembersStatisticResponse> {
|
20
20
|
const response = await this.context
|
21
21
|
.resolve(RpcService)
|
22
|
-
?.requestBuilder("api/v1/
|
22
|
+
?.requestBuilder("api/v1/management/stats/organization/members/total")
|
23
23
|
.searchParam("organizationId", organizationId)
|
24
24
|
.searchParam("dateFrom", dateFrom.toString())
|
25
25
|
.searchParam("dateTo", dateTo.toString())
|
@@ -36,7 +36,7 @@ export class StatisticAdministrationImpl implements StatisticAdministration {
|
|
36
36
|
async getOrganizations(dateFrom: number, dateTo: number): Promise<OrganizationStatisticResponse> {
|
37
37
|
const response = await this.context
|
38
38
|
.resolve(RpcService)
|
39
|
-
?.requestBuilder("
|
39
|
+
?.requestBuilder("api/v1/management/stats/organizations")
|
40
40
|
.searchParam("dateFrom", dateFrom.toString())
|
41
41
|
.searchParam("dateTo", dateTo.toString())
|
42
42
|
.sendGet()
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import {UsersAdministration} from "./users.administration"
|
2
|
+
import {SearchUserResponse} from "../../dto/userInfoResponse"
|
3
|
+
import {RpcService} from "../../services/rpcService"
|
4
|
+
import {ResponseUtils} from "../../services/responseUtils"
|
5
|
+
import {Context} from "../../context"
|
6
|
+
|
7
|
+
|
8
|
+
export class UsersAdministrationImpl implements UsersAdministration {
|
9
|
+
|
10
|
+
constructor(private readonly context: Context) {
|
11
|
+
}
|
12
|
+
|
13
|
+
async search(email: string): Promise<SearchUserResponse> {
|
14
|
+
if (email === undefined || email === null || email.trim() === ""){
|
15
|
+
throw new Error("Email is null or empty")
|
16
|
+
}
|
17
|
+
const response = await this.context
|
18
|
+
.resolve(RpcService)
|
19
|
+
?.requestBuilder("api/v1/management/users/info/email")
|
20
|
+
.searchParam("email", email)
|
21
|
+
.sendGet()
|
22
|
+
|
23
|
+
// check response status
|
24
|
+
if (ResponseUtils.isFail(response)) {
|
25
|
+
await ResponseUtils.throwError("Failed to search user by email", response)
|
26
|
+
}
|
27
|
+
|
28
|
+
return await response!.json() as SearchUserResponse
|
29
|
+
}
|
30
|
+
|
31
|
+
async setUserSegment(email: string, userId: string, segmentKey: string): Promise<void> {
|
32
|
+
const response = await this.context
|
33
|
+
.resolve(RpcService)
|
34
|
+
?.requestBuilder("api/v1/management/users/limits/segment")
|
35
|
+
.sendPutJson({
|
36
|
+
userEmail: email,
|
37
|
+
userId: userId,
|
38
|
+
segmentKey: segmentKey
|
39
|
+
})
|
40
|
+
if (ResponseUtils.isFail(response)) {
|
41
|
+
await ResponseUtils.throwError(
|
42
|
+
`Set segment ${segmentKey} for user ${email}, id ${userId} failed`,
|
43
|
+
response
|
44
|
+
)
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import {SearchUserResponse} from "../../dto/userInfoResponse"
|
2
|
+
|
3
|
+
|
4
|
+
export abstract class UsersAdministration {
|
5
|
+
|
6
|
+
/*
|
7
|
+
Search user by email
|
8
|
+
*/
|
9
|
+
abstract search(email: string): Promise<SearchUserResponse>
|
10
|
+
|
11
|
+
/*
|
12
|
+
Set user segment
|
13
|
+
*/
|
14
|
+
abstract setUserSegment(email: string, userId: string, segmentKey: string): Promise<void>
|
15
|
+
}
|
@@ -7,7 +7,7 @@ import { ResponseUtils } from "../../services/responseUtils"
|
|
7
7
|
|
8
8
|
export class OrganizationPromptsImpl implements OrganizationPrompts {
|
9
9
|
|
10
|
-
private _cacheDefaultPrompts: OrganizationPromptDto[]
|
10
|
+
private _cacheDefaultPrompts: Map<string, OrganizationPromptDto[]> = new Map<string, OrganizationPromptDto[]>()
|
11
11
|
|
12
12
|
constructor(
|
13
13
|
private readonly organization: OrganizationImpl,
|
@@ -16,15 +16,20 @@ export class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
16
16
|
|
17
17
|
}
|
18
18
|
|
19
|
-
async getDefaultPrompts(): Promise<OrganizationPromptDto[]> {
|
20
|
-
if (
|
21
|
-
|
19
|
+
async getDefaultPrompts(sourceName: string): Promise<OrganizationPromptDto[]> {
|
20
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
21
|
+
throw new Error("Source name is empty or null")
|
22
|
+
}
|
23
|
+
|
24
|
+
if (this._cacheDefaultPrompts.get(sourceName) !== undefined) {
|
25
|
+
return this._cacheDefaultPrompts.get(sourceName)!
|
22
26
|
}
|
23
27
|
|
24
28
|
const response = await this.context
|
25
29
|
.resolve(RpcService)
|
26
|
-
?.requestBuilder("api/v1/
|
30
|
+
?.requestBuilder("api/v1/Prompts/organization/default")
|
27
31
|
.searchParam("organizationId", this.organization.id)
|
32
|
+
.searchParam("sourceName", sourceName)
|
28
33
|
.sendGet()
|
29
34
|
|
30
35
|
// check response status
|
@@ -35,18 +40,23 @@ export class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
35
40
|
)
|
36
41
|
}
|
37
42
|
|
38
|
-
this._cacheDefaultPrompts
|
43
|
+
this._cacheDefaultPrompts.set(sourceName, (await response!.json() as {
|
39
44
|
prompts: OrganizationPromptDto[]
|
40
|
-
}).prompts as OrganizationPromptDto[]
|
45
|
+
}).prompts as OrganizationPromptDto[])
|
41
46
|
|
42
|
-
return this._cacheDefaultPrompts
|
47
|
+
return this._cacheDefaultPrompts.get(sourceName)!
|
43
48
|
}
|
44
49
|
|
45
|
-
async getPrompts(): Promise<OrganizationPromptDto[]> {
|
50
|
+
async getPrompts(sourceName: string): Promise<OrganizationPromptDto[]> {
|
51
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
52
|
+
throw new Error("Source name is empty or null")
|
53
|
+
}
|
54
|
+
|
46
55
|
const response = await this.context
|
47
56
|
.resolve(RpcService)
|
48
|
-
?.requestBuilder("api/v1/
|
57
|
+
?.requestBuilder("api/v1/Prompts/organization")
|
49
58
|
.searchParam("organizationId", this.organization.id)
|
59
|
+
.searchParam("sourceName", sourceName)
|
50
60
|
.sendGet()
|
51
61
|
|
52
62
|
// check response status
|
@@ -62,7 +72,10 @@ export class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
62
72
|
}).prompts as OrganizationPromptDto[]
|
63
73
|
}
|
64
74
|
|
65
|
-
async updatePrompts(prompts: OrganizationPromptDto[]): Promise<void> {
|
75
|
+
async updatePrompts(sourceName: string, prompts: OrganizationPromptDto[]): Promise<void> {
|
76
|
+
if (sourceName === undefined || sourceName === null || sourceName.trim() === "") {
|
77
|
+
throw new Error("Source name is empty or null")
|
78
|
+
}
|
66
79
|
if (prompts === undefined || prompts === null || prompts.length === 0) {
|
67
80
|
return
|
68
81
|
}
|
@@ -75,9 +88,13 @@ export class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
75
88
|
|
76
89
|
const response = await this.context
|
77
90
|
.resolve(RpcService)
|
78
|
-
?.requestBuilder("api/v1/
|
79
|
-
.
|
80
|
-
|
91
|
+
?.requestBuilder("api/v1/Prompts/organization")
|
92
|
+
.sendPutJson(
|
93
|
+
{
|
94
|
+
"organizationId": this.organization.id,
|
95
|
+
"sourceName": sourceName,
|
96
|
+
"prompts": prompts
|
97
|
+
})
|
81
98
|
|
82
99
|
// check response status
|
83
100
|
if (ResponseUtils.isFail(response)) {
|
@@ -88,19 +105,19 @@ export class OrganizationPromptsImpl implements OrganizationPrompts {
|
|
88
105
|
}
|
89
106
|
}
|
90
107
|
|
91
|
-
async updatePrompt(key: string, value: string | null): Promise<void> {
|
92
|
-
return this.updatePrompts([{
|
108
|
+
async updatePrompt(sourceName: string, key: string, value: string | null): Promise<void> {
|
109
|
+
return this.updatePrompts(sourceName,[{
|
93
110
|
key,
|
94
111
|
value
|
95
112
|
}])
|
96
113
|
}
|
97
114
|
|
98
|
-
deletePrompt(key: string): Promise<void> {
|
99
|
-
return this.updatePrompt(key, null)
|
115
|
+
deletePrompt(sourceName: string, key: string): Promise<void> {
|
116
|
+
return this.updatePrompt(sourceName, key, null)
|
100
117
|
}
|
101
118
|
|
102
|
-
async deletePrompts(keys: string[]): Promise<void> {
|
103
|
-
return this.updatePrompts(keys.map(key => ({
|
119
|
+
async deletePrompts(sourceName: string, keys: string[]): Promise<void> {
|
120
|
+
return this.updatePrompts(sourceName, keys.map(key => ({
|
104
121
|
key,
|
105
122
|
value: null
|
106
123
|
})))
|
@@ -6,36 +6,42 @@ export abstract class OrganizationPrompts {
|
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Get default organization prompts
|
9
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
9
10
|
*/
|
10
|
-
abstract getDefaultPrompts(): Promise<OrganizationPromptDto[]>
|
11
|
+
abstract getDefaultPrompts(sourceName: string): Promise<OrganizationPromptDto[]>
|
11
12
|
|
12
13
|
/**
|
13
14
|
* Get all organization prompts
|
15
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
14
16
|
*/
|
15
|
-
abstract getPrompts(): Promise<OrganizationPromptDto[]>
|
17
|
+
abstract getPrompts(sourceName: string): Promise<OrganizationPromptDto[]>
|
16
18
|
|
17
19
|
/**
|
18
20
|
* Create/Update/Delete new prompt
|
21
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
19
22
|
* @param key - key of prompt
|
20
23
|
* @param value - value of prompt, null|undefined to delete
|
21
24
|
*/
|
22
|
-
abstract updatePrompt(key: string, value: string | undefined | null): Promise<void>
|
25
|
+
abstract updatePrompt(sourceName: string, key: string, value: string | undefined | null): Promise<void>
|
23
26
|
|
24
27
|
/**
|
25
28
|
* Update prompts in bulk
|
29
|
+
* @param sourceName - service source of prompts, possible options "chat" or "quiz"
|
26
30
|
* @param prompts - array of prompts (value can be null|undefined to delete)
|
27
31
|
*/
|
28
|
-
abstract updatePrompts(prompts: OrganizationPromptDto[]): Promise<void>
|
32
|
+
abstract updatePrompts(sourceName: string, prompts: OrganizationPromptDto[]): Promise<void>
|
29
33
|
|
30
34
|
/**
|
31
35
|
* Delete prompt
|
36
|
+
* @param sourceName
|
32
37
|
* @param key
|
33
38
|
*/
|
34
|
-
abstract deletePrompt(key: string): Promise<void>
|
39
|
+
abstract deletePrompt(sourceName: string, key: string): Promise<void>
|
35
40
|
|
36
41
|
/**
|
37
42
|
* Delete prompt
|
43
|
+
* @param sourceName
|
38
44
|
* @param keys
|
39
45
|
*/
|
40
|
-
abstract deletePrompts(keys: string[]): Promise<void>
|
46
|
+
abstract deletePrompts(sourceName: string, keys: string[]): Promise<void>
|
41
47
|
}
|