@neuralinnovations/dataisland-sdk 0.0.1-dev46 → 0.0.1-dev48
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/commands/startCommandHandler.d.ts.map +1 -1
- package/dist/src/commands/startCommandHandler.js +3 -0
- package/dist/src/commands/startCommandHandler.js.map +1 -1
- package/dist/src/dataIslandApp.d.ts +5 -0
- package/dist/src/dataIslandApp.d.ts.map +1 -1
- package/dist/src/dataIslandApp.js.map +1 -1
- package/dist/src/dto/acquiringResponse.d.ts +3 -3
- package/dist/src/dto/acquiringResponse.d.ts.map +1 -1
- package/dist/src/dto/acquiringResponse.js.map +1 -1
- package/dist/src/dto/limitsResponse.d.ts.map +1 -1
- package/dist/src/dto/limitsResponse.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/app.impl.d.ts.map +1 -1
- package/dist/src/internal/app.impl.js +11 -8
- package/dist/src/internal/app.impl.js.map +1 -1
- package/dist/src/services/acquiringService.d.ts +9 -0
- package/dist/src/services/acquiringService.d.ts.map +1 -0
- package/dist/src/services/acquiringService.js +19 -0
- package/dist/src/services/acquiringService.js.map +1 -0
- package/dist/src/storages/acquirings/acquiring.d.ts +20 -4
- package/dist/src/storages/acquirings/acquiring.d.ts.map +1 -1
- package/dist/src/storages/acquirings/acquiring.impl.d.ts +11 -5
- package/dist/src/storages/acquirings/acquiring.impl.d.ts.map +1 -1
- package/dist/src/storages/acquirings/acquiring.impl.js +36 -5
- package/dist/src/storages/acquirings/acquiring.impl.js.map +1 -1
- package/dist/src/storages/acquirings/acquiring.js.map +1 -1
- package/dist/src/storages/organizations/organization.d.ts +1 -5
- package/dist/src/storages/organizations/organization.d.ts.map +1 -1
- package/dist/src/storages/organizations/organization.impl.d.ts +0 -3
- package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -1
- package/dist/src/storages/organizations/organization.impl.js +8 -10
- package/dist/src/storages/organizations/organization.impl.js.map +1 -1
- package/dist/src/storages/organizations/organization.js.map +1 -1
- package/dist/src/storages/user/userProfile.d.ts +1 -0
- package/dist/src/storages/user/userProfile.d.ts.map +1 -1
- package/dist/src/storages/user/userProfile.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/startCommandHandler.ts +3 -0
- package/src/dataIslandApp.ts +6 -0
- package/src/dto/acquiringResponse.ts +5 -6
- package/src/dto/limitsResponse.ts +20 -21
- package/src/index.ts +16 -1
- package/src/internal/app.impl.ts +11 -8
- package/src/services/acquiringService.ts +21 -0
- package/src/storages/acquirings/acquiring.impl.ts +55 -10
- package/src/storages/acquirings/acquiring.ts +26 -5
- package/src/storages/organizations/organization.impl.ts +7 -13
- package/src/storages/organizations/organization.ts +1 -6
- package/src/storages/user/userProfile.ts +3 -2
@@ -7,7 +7,6 @@ const groups_impl_1 = require("../groups/groups.impl");
|
|
7
7
|
const chats_impl_1 = require("../chats/chats.impl");
|
8
8
|
const rpcService_1 = require("../../services/rpcService");
|
9
9
|
const responseUtils_1 = require("../../services/responseUtils");
|
10
|
-
const acquiring_impl_1 = require("../acquirings/acquiring.impl");
|
11
10
|
class OrganizationImpl extends organization_1.Organization {
|
12
11
|
constructor(context) {
|
13
12
|
super();
|
@@ -17,15 +16,17 @@ class OrganizationImpl extends organization_1.Organization {
|
|
17
16
|
this._workspaces = new workspaces_impl_1.WorkspacesImpl(this, this.context);
|
18
17
|
this._accessGroups = new groups_impl_1.GroupsImpl(this, this.context);
|
19
18
|
this._chats = new chats_impl_1.ChatsImpl(this, this.context);
|
20
|
-
this._acquiring = new acquiring_impl_1.AcquiringImpl(this, this.context);
|
21
19
|
}
|
22
20
|
async initFrom(content, isAdmin) {
|
23
21
|
this._content = content;
|
24
22
|
this._isAdmin = isAdmin;
|
25
23
|
// init workspaces by organization id
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
const promises = [
|
25
|
+
this._workspaces.initFrom(content.id),
|
26
|
+
this._chats.initFrom(content.id),
|
27
|
+
this._accessGroups.initialize()
|
28
|
+
];
|
29
|
+
await Promise.all(promises);
|
29
30
|
return this;
|
30
31
|
}
|
31
32
|
get isAdmin() {
|
@@ -58,9 +59,6 @@ class OrganizationImpl extends organization_1.Organization {
|
|
58
59
|
get chats() {
|
59
60
|
return this._chats;
|
60
61
|
}
|
61
|
-
get acquiring() {
|
62
|
-
return this._acquiring;
|
63
|
-
}
|
64
62
|
async members() {
|
65
63
|
var _a;
|
66
64
|
// send request to the server
|
@@ -144,7 +142,7 @@ class OrganizationImpl extends organization_1.Organization {
|
|
144
142
|
async userLimits() {
|
145
143
|
var _a, _b, _c;
|
146
144
|
// fetch limits
|
147
|
-
const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Users/limits").
|
145
|
+
const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Users/limits").sendGet());
|
148
146
|
// check response status
|
149
147
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
150
148
|
await responseUtils_1.ResponseUtils.throwError(`Failed to get limits in organization: ${this.id}`, response);
|
@@ -200,7 +198,7 @@ class OrganizationImpl extends organization_1.Organization {
|
|
200
198
|
async limitSegments() {
|
201
199
|
var _a;
|
202
200
|
// fetch limits
|
203
|
-
const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Descriptions/limits/segments").
|
201
|
+
const response = await ((_a = this.context.resolve(rpcService_1.RpcService)) === null || _a === void 0 ? void 0 : _a.requestBuilder("api/v1/Descriptions/limits/segments").sendGet());
|
204
202
|
// check response status
|
205
203
|
if (responseUtils_1.ResponseUtils.isFail(response)) {
|
206
204
|
await responseUtils_1.ResponseUtils.throwError(`Failed to get limits in organization: ${this.id}`, response);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organization.impl.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.impl.ts"],"names":[],"mappings":";;;AAaA,mEAA8D;AAE9D,iDAAgE;AAChE,uDAAkD;AAElD,oDAA+C;AAE/C,0DAAsD;AACtD,gEAA4D;AAS5D,
|
1
|
+
{"version":3,"file":"organization.impl.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.impl.ts"],"names":[],"mappings":";;;AAaA,mEAA8D;AAE9D,iDAAgE;AAChE,uDAAkD;AAElD,oDAA+C;AAE/C,0DAAsD;AACtD,gEAA4D;AAS5D,MAAa,gBAAiB,SAAQ,2BAAY;IAQhD,YAA6B,OAAgB;QAC3C,KAAK,EAAE,CAAA;QADoB,YAAO,GAAP,OAAO,CAAS;QAPrC,gBAAW,GAAY,KAAK,CAAA;QAC5B,aAAQ,GAAY,KAAK,CAAA;QAQ/B,IAAI,CAAC,WAAW,GAAG,IAAI,gCAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACzD,IAAI,CAAC,aAAa,GAAG,IAAI,wBAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAS,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACjD,CAAC;IAEM,KAAK,CAAC,QAAQ,CACnB,OAAwB,EACxB,OAAgB;QAEhB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QAEvB,qCAAqC;QACrC,MAAM,QAAQ,GAAG;YACf,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE;SAChC,CAAA;QAED,MAAM,OAAO,CAAC,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,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAC5B,gDAAgD,IAAI,CAAC,EAAE,EAAE,EACzD,QAAQ,CACT,CAAA;QACH,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAS,CAAC,IAAI,EAAE,CAAA;QAEnC,MAAM,IAAI,GAAI,IAA2B,CAAC,IAAI,CAAA;QAE9C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,IAAY;;QACnC,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,sBAAsB,EACtC,WAAW,CAAC;YACX,IAAI,EAAE,IAAI;SACX,CAAC,CAAA,CAAA;QACJ,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC,UAAU,CAC5B,kDAAkD,IAAI,CAAC,EAAE,EAAE,EAC3D,QAAQ,CACT,CAAA;QACH,CAAC;IACH,CAAC;CACF;AA3VD,4CA2VC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.ts"],"names":[],"mappings":";;;AAIA,yCAA8C;
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../src/storages/organizations/organization.ts"],"names":[],"mappings":";;;AAIA,yCAA8C;AAU9C;;GAEG;AACH,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;AACrB,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED;;GAEG;AACH,MAAsB,YAAa,SAAQ,wBAG1C;CA4FA;AA/FD,oCA+FC"}
|
@@ -44,6 +44,7 @@ export declare abstract class UserProfile extends EventDispatcher<UserEvent, Use
|
|
44
44
|
* Update user profile
|
45
45
|
* @param newName
|
46
46
|
* @param newId
|
47
|
+
* @param newEducationalInstitution
|
47
48
|
*/
|
48
49
|
abstract updateUser(newName: string, newId: string, newEducationalInstitution: string): Promise<void>;
|
49
50
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userProfile.d.ts","sourceRoot":"","sources":["../../../../src/storages/user/userProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,oBAAY,SAAS;IACnB,OAAO,YAAY;CACpB;AAED,8BAAsB,WAAY,SAAQ,eAAe,CACvD,SAAS,EACT,WAAW,CACZ;IACC;;OAEG;IACH,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAA;IAEzB;;OAEG;IACH,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAA;IAE3B;;OAEG;IACH,QAAQ,KAAK,KAAK,IAAI,MAAM,CAAA;IAE5B;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAA;IAEhC;;OAEG;IACH,QAAQ,KAAK,sBAAsB,IAAK,MAAM,CAAA;IAE9C;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAA;IAEjC;;OAEG;IACH,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAA;IAEnC;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAA;IAE9B;;OAEG;IACH,QAAQ,KAAK,UAAU,IAAI,IAAI,CAAA;IAE/B
|
1
|
+
{"version":3,"file":"userProfile.d.ts","sourceRoot":"","sources":["../../../../src/storages/user/userProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,oBAAY,SAAS;IACnB,OAAO,YAAY;CACpB;AAED,8BAAsB,WAAY,SAAQ,eAAe,CACvD,SAAS,EACT,WAAW,CACZ;IACC;;OAEG;IACH,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAA;IAEzB;;OAEG;IACH,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAA;IAE3B;;OAEG;IACH,QAAQ,KAAK,KAAK,IAAI,MAAM,CAAA;IAE5B;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAA;IAEhC;;OAEG;IACH,QAAQ,KAAK,sBAAsB,IAAK,MAAM,CAAA;IAE9C;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAA;IAEjC;;OAEG;IACH,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAA;IAEnC;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAA;IAE9B;;OAEG;IACH,QAAQ,KAAK,UAAU,IAAI,IAAI,CAAA;IAE/B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErG;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;CACxC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userProfile.js","sourceRoot":"","sources":["../../../../src/storages/user/userProfile.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAI9C,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAsB,WAAY,SAAQ,wBAGzC;
|
1
|
+
{"version":3,"file":"userProfile.js","sourceRoot":"","sources":["../../../../src/storages/user/userProfile.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAI9C,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAsB,WAAY,SAAQ,wBAGzC;CA0DA;AA7DD,kCA6DC"}
|
package/package.json
CHANGED
@@ -2,6 +2,7 @@ import { CommandHandler, Command } from "../services/commandService"
|
|
2
2
|
import { UserProfileService } from "../services/userProfileService"
|
3
3
|
import { CookieService } from "../services/cookieService"
|
4
4
|
import { AnonymousCredential } from "../credentials"
|
5
|
+
import { AcquiringService } from "../services/acquiringService"
|
5
6
|
|
6
7
|
export class StartCommand extends Command {
|
7
8
|
}
|
@@ -10,6 +11,7 @@ export class StartCommandHandler extends CommandHandler<StartCommand> {
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
11
12
|
async execute(message: StartCommand): Promise<void> {
|
12
13
|
const userService = this.resolve(UserProfileService)!
|
14
|
+
const acquiringService = this.resolve(AcquiringService)!
|
13
15
|
|
14
16
|
// Merge anonymous user if needed
|
15
17
|
if (!(this.context.app.credential instanceof AnonymousCredential)) {
|
@@ -21,5 +23,6 @@ export class StartCommandHandler extends CommandHandler<StartCommand> {
|
|
21
23
|
}
|
22
24
|
|
23
25
|
await userService.fetch()
|
26
|
+
await acquiringService.initialize()
|
24
27
|
}
|
25
28
|
}
|
package/src/dataIslandApp.ts
CHANGED
@@ -4,6 +4,7 @@ import { Context } from "./context"
|
|
4
4
|
import type { Constructor } from "./internal/registry"
|
5
5
|
import { Organizations } from "./storages/organizations/organizations"
|
6
6
|
import { UserProfile } from "./storages/user/userProfile"
|
7
|
+
import { Acquiring } from "./storages/acquirings/acquiring"
|
7
8
|
|
8
9
|
/**
|
9
10
|
* DataIsland App instance.
|
@@ -51,6 +52,11 @@ export abstract class DataIslandApp {
|
|
51
52
|
*/
|
52
53
|
abstract get userProfile(): UserProfile
|
53
54
|
|
55
|
+
/**
|
56
|
+
* Acquiring.
|
57
|
+
*/
|
58
|
+
abstract get acquiring(): Acquiring
|
59
|
+
|
54
60
|
/**
|
55
61
|
* Resolve a service from the app.
|
56
62
|
* @param type
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import { SegmentItemData } from "./limitsResponse"
|
2
2
|
|
3
|
-
export interface
|
4
|
-
|
3
|
+
export interface OrderResponse {
|
4
|
+
data: OrderData
|
5
5
|
}
|
6
6
|
|
7
|
-
export interface
|
8
|
-
|
9
|
-
|
7
|
+
export interface OrderData {
|
8
|
+
data: string,
|
9
|
+
signature: string
|
10
10
|
}
|
11
|
-
|
12
11
|
export interface GetOrderStateResponse {
|
13
12
|
isValid: boolean,
|
14
13
|
state: OrderState,
|
@@ -1,33 +1,32 @@
|
|
1
|
-
|
2
1
|
export interface SegmentsData {
|
3
|
-
|
2
|
+
segments: SegmentData[]
|
4
3
|
}
|
5
4
|
|
6
5
|
export interface SegmentData {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
key: string
|
7
|
+
isRegisteredDefault: boolean
|
8
|
+
isAnonymousDefault: boolean
|
9
|
+
isAnonymous: boolean
|
10
|
+
isRegistered: boolean
|
11
|
+
dayItems: SegmentItemData[]
|
13
12
|
}
|
14
13
|
|
15
|
-
export interface SegmentItemData{
|
16
|
-
|
17
|
-
|
14
|
+
export interface SegmentItemData {
|
15
|
+
daysCount: number
|
16
|
+
actionItems: SegmentActionData[]
|
18
17
|
}
|
19
18
|
|
20
19
|
export interface SegmentActionData {
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
type: LimitActionType
|
21
|
+
countLimit: number
|
22
|
+
tokenLimit?: number
|
24
23
|
}
|
25
24
|
|
26
25
|
export enum LimitActionType {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
26
|
+
UploadFile = 0,
|
27
|
+
CreateChat = 1,
|
28
|
+
AskQuestion = 2,
|
29
|
+
CreateWorkspace = 3,
|
30
|
+
CreateOrganization = 4,
|
31
|
+
FileSizeKb = 5
|
32
|
+
}
|
package/src/index.ts
CHANGED
@@ -42,7 +42,22 @@ export { UploadFile, Files, FilesEvent } from "./storages/files/files"
|
|
42
42
|
export { Group, GroupEvent, GroupId } from "./storages/groups/group"
|
43
43
|
export { AnswerId, Answer, StepId, AnswerEvent } from "./storages/chats/answer"
|
44
44
|
export { isNullOrUndefined, isEmptyNullOrUndefined } from "./utils/utils"
|
45
|
-
export {
|
45
|
+
export {
|
46
|
+
AcquiringPlan,
|
47
|
+
AcquiringSegmentData,
|
48
|
+
OrderData,
|
49
|
+
OrderResponse,
|
50
|
+
GetOrderStateResponse,
|
51
|
+
OrderState,
|
52
|
+
UserAcquiringPlan
|
53
|
+
} from "./dto/acquiringResponse"
|
54
|
+
export {
|
55
|
+
LimitActionType,
|
56
|
+
SegmentActionData,
|
57
|
+
SegmentData,
|
58
|
+
SegmentItemData,
|
59
|
+
SegmentsData
|
60
|
+
} from "./dto/limitsResponse"
|
46
61
|
|
47
62
|
// map of apps that are not ready to be used
|
48
63
|
const _appsNotReady = new Map<string, Promise<DataIslandApp>>()
|
package/src/internal/app.impl.ts
CHANGED
@@ -30,8 +30,8 @@ import {
|
|
30
30
|
} from "../commands/deleteUserFullCommandHandler"
|
31
31
|
import { CookieService } from "../services/cookieService"
|
32
32
|
import { AnonymousService } from "../services/anonymousService"
|
33
|
-
import { AcquiringImpl } from "../storages/acquirings/acquiring.impl"
|
34
33
|
import { Acquiring } from "../storages/acquirings/acquiring"
|
34
|
+
import { AcquiringService } from "../services/acquiringService"
|
35
35
|
|
36
36
|
export class DataIslandAppImpl extends DataIslandApp {
|
37
37
|
readonly name: string
|
@@ -86,7 +86,7 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
86
86
|
}
|
87
87
|
|
88
88
|
get acquiring(): Acquiring {
|
89
|
-
return this.resolve(
|
89
|
+
return (this.resolve(AcquiringService) as AcquiringService).acquiring
|
90
90
|
}
|
91
91
|
|
92
92
|
async initialize(
|
@@ -128,6 +128,9 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
128
128
|
builder.registerService(AnonymousService, (context: ServiceContext) => {
|
129
129
|
return new AnonymousService(context)
|
130
130
|
})
|
131
|
+
builder.registerService(AcquiringService, (context: ServiceContext) => {
|
132
|
+
return new AcquiringService(context)
|
133
|
+
})
|
131
134
|
|
132
135
|
// call customer setup
|
133
136
|
if (setup !== undefined) {
|
@@ -148,10 +151,10 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
148
151
|
this._context,
|
149
152
|
this._disposable.defineNested()
|
150
153
|
)
|
154
|
+
const serviceInstance = serviceFactory[1](serviceContext)
|
151
155
|
serviceContext.lifetime.addCallback(() => {
|
152
|
-
serviceContext.onUnregister()
|
156
|
+
serviceContext.onUnregister.call(serviceInstance)
|
153
157
|
}, serviceContext)
|
154
|
-
const serviceInstance = serviceFactory[1](serviceContext)
|
155
158
|
services.push([serviceContext, serviceInstance])
|
156
159
|
this._registry.map(serviceFactory[0]).asValue(serviceInstance)
|
157
160
|
})
|
@@ -169,9 +172,9 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
169
172
|
//-------------------------------------------------------------------------
|
170
173
|
const waitList: Array<Promise<void>> = []
|
171
174
|
// call onRegister service's callback
|
172
|
-
services.forEach(([serviceContext]) => {
|
175
|
+
services.forEach(([serviceContext, service]) => {
|
173
176
|
if (typeof serviceContext.onRegister === "function") {
|
174
|
-
waitList.push(serviceContext.onRegister())
|
177
|
+
waitList.push(serviceContext.onRegister.call(service))
|
175
178
|
}
|
176
179
|
})
|
177
180
|
|
@@ -184,9 +187,9 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
184
187
|
//-------------------------------------------------------------------------
|
185
188
|
waitList.length = 0
|
186
189
|
// call onStart service's callback
|
187
|
-
services.forEach(([serviceContext]) => {
|
190
|
+
services.forEach(([serviceContext, service]) => {
|
188
191
|
if (typeof serviceContext.onStart === "function") {
|
189
|
-
waitList.push(serviceContext.onStart())
|
192
|
+
waitList.push(serviceContext.onStart.call(service))
|
190
193
|
}
|
191
194
|
})
|
192
195
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Service, ServiceContext } from "./service"
|
2
|
+
import { AcquiringImpl } from "../storages/acquirings/acquiring.impl"
|
3
|
+
import { Acquiring } from "../storages/acquirings/acquiring"
|
4
|
+
|
5
|
+
export class AcquiringService extends Service {
|
6
|
+
private readonly _acquiring: AcquiringImpl
|
7
|
+
|
8
|
+
constructor(serviceContext: ServiceContext) {
|
9
|
+
super(serviceContext)
|
10
|
+
|
11
|
+
this._acquiring = new AcquiringImpl(serviceContext.context)
|
12
|
+
}
|
13
|
+
|
14
|
+
initialize(): Promise<void> {
|
15
|
+
return this._acquiring.initialize()
|
16
|
+
}
|
17
|
+
|
18
|
+
get acquiring(): Acquiring {
|
19
|
+
return this._acquiring
|
20
|
+
}
|
21
|
+
}
|
@@ -2,34 +2,77 @@ import { RpcService } from "../../services/rpcService"
|
|
2
2
|
import { ResponseUtils } from "../../services/responseUtils"
|
3
3
|
import {
|
4
4
|
AcquiringPlansResponse,
|
5
|
-
|
6
|
-
|
7
|
-
UserAcquiringPlan, GetOrderStateResponse
|
5
|
+
OrderResponse,
|
6
|
+
OrderData,
|
7
|
+
UserAcquiringPlan, GetOrderStateResponse, AcquiringPlan, AcquiringSegmentData
|
8
8
|
} from "../../dto/acquiringResponse"
|
9
9
|
import { Acquiring } from "./acquiring"
|
10
10
|
import { Context } from "../../context"
|
11
|
-
import { Organization } from "../organizations/organization"
|
12
11
|
|
13
12
|
export class AcquiringImpl implements Acquiring {
|
13
|
+
private _userPlan?: UserAcquiringPlan
|
14
|
+
private _plans?: AcquiringPlan[]
|
15
|
+
private _limitSegments?: AcquiringSegmentData[]
|
14
16
|
|
15
17
|
constructor(
|
16
|
-
private readonly organization: Organization,
|
17
18
|
private readonly context: Context) {
|
18
19
|
}
|
19
20
|
|
20
|
-
|
21
|
+
get userPlan(): UserAcquiringPlan {
|
22
|
+
return this._userPlan!
|
23
|
+
}
|
24
|
+
|
25
|
+
get plans(): AcquiringPlan[] {
|
26
|
+
return this._plans!
|
27
|
+
}
|
28
|
+
|
29
|
+
get limitSegments(): AcquiringSegmentData[] {
|
30
|
+
return this._limitSegments!
|
31
|
+
}
|
32
|
+
|
33
|
+
async initialize() {
|
34
|
+
const userPlanPromise = this.getUserPlan()
|
35
|
+
const plansPromise = this.getPlans()
|
36
|
+
const promises = [
|
37
|
+
userPlanPromise,
|
38
|
+
plansPromise
|
39
|
+
]
|
40
|
+
await Promise.all(promises)
|
41
|
+
|
42
|
+
this._userPlan = await userPlanPromise
|
43
|
+
const {
|
44
|
+
plans,
|
45
|
+
limitSegments
|
46
|
+
} = await plansPromise
|
47
|
+
this._plans = plans
|
48
|
+
this._limitSegments = limitSegments
|
49
|
+
}
|
50
|
+
|
51
|
+
async createOrder(key: string): Promise<OrderData> {
|
21
52
|
const rpc = this.context.resolve(RpcService) as RpcService
|
22
53
|
const response = await rpc.requestBuilder("api/v1/Acquiring/order")
|
23
54
|
.sendPostJson({
|
24
|
-
key: key
|
25
|
-
organizationId: this.organization.id
|
55
|
+
key: key
|
26
56
|
})
|
27
57
|
|
28
58
|
if (ResponseUtils.isFail(response)) {
|
29
59
|
await ResponseUtils.throwError("Failed to create order", response)
|
30
60
|
}
|
31
61
|
|
32
|
-
const order = (await response.json()) as
|
62
|
+
const order = (await response.json()) as OrderResponse
|
63
|
+
|
64
|
+
return order.data
|
65
|
+
}
|
66
|
+
|
67
|
+
async unsubscribe(): Promise<OrderData> {
|
68
|
+
const rpc = this.context.resolve(RpcService) as RpcService
|
69
|
+
const response = await rpc.requestBuilder("api/v1/Acquiring/unsubscribe").sendDelete()
|
70
|
+
|
71
|
+
if (ResponseUtils.isFail(response)) {
|
72
|
+
await ResponseUtils.throwError("Failed to unsubscribe", response)
|
73
|
+
}
|
74
|
+
|
75
|
+
const order = (await response.json()) as OrderResponse
|
33
76
|
|
34
77
|
return order.data
|
35
78
|
}
|
@@ -45,6 +88,8 @@ export class AcquiringImpl implements Acquiring {
|
|
45
88
|
}
|
46
89
|
|
47
90
|
const content = (await response.json()) as AcquiringPlansResponse
|
91
|
+
this._plans = content.plans
|
92
|
+
this._limitSegments = content.limitSegments
|
48
93
|
|
49
94
|
return content
|
50
95
|
}
|
@@ -53,7 +98,6 @@ export class AcquiringImpl implements Acquiring {
|
|
53
98
|
const rpc = this.context.resolve(RpcService) as RpcService
|
54
99
|
const response = await rpc
|
55
100
|
.requestBuilder("api/v1/Acquiring/user/subscription")
|
56
|
-
.searchParam("organizationId", <string>this.organization.id)
|
57
101
|
.sendGet()
|
58
102
|
|
59
103
|
if (ResponseUtils.isFail(response)) {
|
@@ -61,6 +105,7 @@ export class AcquiringImpl implements Acquiring {
|
|
61
105
|
}
|
62
106
|
|
63
107
|
const content = (await response.json()) as UserAcquiringPlan
|
108
|
+
this._userPlan = content
|
64
109
|
|
65
110
|
return content
|
66
111
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
2
|
+
AcquiringPlan,
|
3
|
+
AcquiringPlansResponse, AcquiringSegmentData,
|
4
|
+
OrderData, GetOrderStateResponse,
|
4
5
|
UserAcquiringPlan
|
5
6
|
} from "../../dto/acquiringResponse"
|
6
7
|
|
@@ -9,19 +10,39 @@ import {
|
|
9
10
|
*/
|
10
11
|
export abstract class Acquiring {
|
11
12
|
|
13
|
+
/**
|
14
|
+
* Plan
|
15
|
+
*/
|
16
|
+
abstract get userPlan(): UserAcquiringPlan
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Plans
|
20
|
+
*/
|
21
|
+
abstract get plans(): AcquiringPlan[]
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Limit segments
|
25
|
+
*/
|
26
|
+
abstract get limitSegments(): AcquiringSegmentData[]
|
27
|
+
|
12
28
|
/**
|
13
29
|
* Create order
|
14
30
|
* @param key
|
15
31
|
*/
|
16
|
-
abstract createOrder(key: string): Promise<
|
32
|
+
abstract createOrder(key: string): Promise<OrderData>
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Unsubscribe
|
36
|
+
*/
|
37
|
+
abstract unsubscribe(): Promise<OrderData>
|
17
38
|
|
18
39
|
/**
|
19
|
-
*
|
40
|
+
* Update plans
|
20
41
|
*/
|
21
42
|
abstract getPlans(): Promise<AcquiringPlansResponse>
|
22
43
|
|
23
44
|
/**
|
24
|
-
*
|
45
|
+
* Update user plan
|
25
46
|
*/
|
26
47
|
abstract getUserPlan(): Promise<UserAcquiringPlan>
|
27
48
|
|
@@ -27,8 +27,6 @@ import {
|
|
27
27
|
SegmentsData
|
28
28
|
} from "../../dto/limitsResponse"
|
29
29
|
import { InviteCodeResponse } from "../../dto/accessGroupResponse"
|
30
|
-
import { type Acquiring } from "../acquirings/acquiring"
|
31
|
-
import { AcquiringImpl } from "../acquirings/acquiring.impl"
|
32
30
|
|
33
31
|
export class OrganizationImpl extends Organization implements Disposable {
|
34
32
|
private _isDisposed: boolean = false
|
@@ -37,14 +35,12 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
37
35
|
private readonly _workspaces: WorkspacesImpl
|
38
36
|
private readonly _accessGroups: GroupsImpl
|
39
37
|
private readonly _chats: ChatsImpl
|
40
|
-
private readonly _acquiring: AcquiringImpl
|
41
38
|
|
42
39
|
constructor(private readonly context: Context) {
|
43
40
|
super()
|
44
41
|
this._workspaces = new WorkspacesImpl(this, this.context)
|
45
42
|
this._accessGroups = new GroupsImpl(this, this.context)
|
46
43
|
this._chats = new ChatsImpl(this, this.context)
|
47
|
-
this._acquiring = new AcquiringImpl(this, this.context)
|
48
44
|
}
|
49
45
|
|
50
46
|
public async initFrom(
|
@@ -55,9 +51,13 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
55
51
|
this._isAdmin = isAdmin
|
56
52
|
|
57
53
|
// init workspaces by organization id
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
const promises = [
|
55
|
+
this._workspaces.initFrom(content.id),
|
56
|
+
this._chats.initFrom(content.id),
|
57
|
+
this._accessGroups.initialize()
|
58
|
+
]
|
59
|
+
|
60
|
+
await Promise.all(promises)
|
61
61
|
|
62
62
|
return this
|
63
63
|
}
|
@@ -98,10 +98,6 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
98
98
|
return this._chats
|
99
99
|
}
|
100
100
|
|
101
|
-
get acquiring(): Acquiring {
|
102
|
-
return this._acquiring
|
103
|
-
}
|
104
|
-
|
105
101
|
async members(): Promise<UserDto[]> {
|
106
102
|
// send request to the server
|
107
103
|
const response = await this.context
|
@@ -238,7 +234,6 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
238
234
|
// fetch limits
|
239
235
|
const response = await this.context.resolve(RpcService)
|
240
236
|
?.requestBuilder("api/v1/Users/limits")
|
241
|
-
.searchParam("organizationId", this.id)
|
242
237
|
.sendGet()
|
243
238
|
|
244
239
|
// check response status
|
@@ -313,7 +308,6 @@ export class OrganizationImpl extends Organization implements Disposable {
|
|
313
308
|
// fetch limits
|
314
309
|
const response = await this.context.resolve(RpcService)
|
315
310
|
?.requestBuilder("api/v1/Descriptions/limits/segments")
|
316
|
-
.searchParam("organizationId", this.id)
|
317
311
|
.sendGet()
|
318
312
|
|
319
313
|
// check response status
|
@@ -11,7 +11,6 @@ import {
|
|
11
11
|
import { GroupId } from "../groups/group"
|
12
12
|
import { StatisticsResponse } from "../../dto/statisticsResponse"
|
13
13
|
import { SegmentData } from "../../dto/limitsResponse"
|
14
|
-
import { Acquiring } from "../acquirings/acquiring"
|
15
14
|
|
16
15
|
/**
|
17
16
|
* Organization event.
|
@@ -78,6 +77,7 @@ export abstract class Organization extends EventDispatcher<
|
|
78
77
|
|
79
78
|
/**
|
80
79
|
* Get statistics for user
|
80
|
+
* @param userid
|
81
81
|
* @param dateFrom
|
82
82
|
* @param dateTo
|
83
83
|
*/
|
@@ -117,9 +117,4 @@ export abstract class Organization extends EventDispatcher<
|
|
117
117
|
* Validate invite code for user
|
118
118
|
*/
|
119
119
|
abstract validateInviteCode(code: string): Promise<void>
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Acquiring
|
123
|
-
*/
|
124
|
-
abstract get acquiring(): Acquiring
|
125
120
|
}
|
@@ -57,8 +57,9 @@ export abstract class UserProfile extends EventDispatcher<
|
|
57
57
|
|
58
58
|
/**
|
59
59
|
* Update user profile
|
60
|
-
* @param newName
|
61
|
-
* @param newId
|
60
|
+
* @param newName
|
61
|
+
* @param newId
|
62
|
+
* @param newEducationalInstitution
|
62
63
|
*/
|
63
64
|
abstract updateUser(newName: string, newId: string, newEducationalInstitution: string): Promise<void>
|
64
65
|
|