@neuralinnovations/dataisland-sdk 0.0.1-dev27 → 0.0.1-dev28
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 +6 -2
- package/dist/src/commands/startCommandHandler.d.ts.map +1 -1
- package/dist/src/commands/startCommandHandler.js +12 -2
- package/dist/src/commands/startCommandHandler.js.map +1 -1
- package/dist/src/context.d.ts +3 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +2 -2
- package/dist/src/context.js.map +1 -1
- package/dist/src/credentials.d.ts +5 -0
- package/dist/src/credentials.d.ts.map +1 -1
- package/dist/src/credentials.js +18 -1
- package/dist/src/credentials.js.map +1 -1
- package/dist/src/dto/accessGroupResponse.d.ts.map +1 -1
- package/dist/src/dto/userInfoResponse.d.ts +1 -0
- package/dist/src/dto/userInfoResponse.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- 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 +20 -2
- package/dist/src/internal/app.impl.js.map +1 -1
- package/dist/src/middleware.d.ts +2 -0
- package/dist/src/middleware.d.ts.map +1 -1
- package/dist/src/services/anonymousService.d.ts +8 -0
- package/dist/src/services/anonymousService.d.ts.map +1 -0
- package/dist/src/services/anonymousService.js +41 -0
- package/dist/src/services/anonymousService.js.map +1 -0
- package/dist/src/services/commandService.d.ts.map +1 -1
- package/dist/src/services/commandService.js.map +1 -1
- package/dist/src/services/cookieService.d.ts +7 -0
- package/dist/src/services/cookieService.d.ts.map +1 -0
- package/dist/src/services/cookieService.js +18 -0
- package/dist/src/services/cookieService.js.map +1 -0
- package/dist/src/services/httpMethod.d.ts +2 -0
- package/dist/src/services/httpMethod.d.ts.map +1 -0
- package/dist/src/services/httpMethod.js +3 -0
- package/dist/src/services/httpMethod.js.map +1 -0
- package/dist/src/services/middlewareService.d.ts +2 -0
- package/dist/src/services/middlewareService.d.ts.map +1 -1
- package/dist/src/services/middlewareService.js.map +1 -1
- package/dist/src/services/requestBuilder.d.ts +2 -0
- package/dist/src/services/requestBuilder.d.ts.map +1 -1
- package/dist/src/services/requestBuilder.js +11 -10
- package/dist/src/services/requestBuilder.js.map +1 -1
- package/dist/src/services/responseUtils.d.ts +1 -0
- package/dist/src/services/responseUtils.d.ts.map +1 -1
- package/dist/src/services/responseUtils.js.map +1 -1
- package/dist/src/services/rpcService.d.ts +1 -0
- package/dist/src/services/rpcService.d.ts.map +1 -1
- package/dist/src/services/rpcService.js +4 -2
- package/dist/src/services/rpcService.js.map +1 -1
- package/dist/src/services/userProfileService.d.ts +1 -0
- package/dist/src/services/userProfileService.d.ts.map +1 -1
- package/dist/src/services/userProfileService.js +11 -0
- package/dist/src/services/userProfileService.js.map +1 -1
- package/dist/src/storages/chats/answer.impl.d.ts.map +1 -1
- package/dist/src/storages/chats/answer.impl.js.map +1 -1
- package/dist/src/storages/chats/chat.impl.js.map +1 -1
- package/dist/src/storages/chats/chats.impl.d.ts.map +1 -1
- package/dist/src/storages/chats/chats.impl.js.map +1 -1
- package/dist/src/storages/files/file.impl.d.ts.map +1 -1
- package/dist/src/storages/files/file.impl.js.map +1 -1
- package/dist/src/storages/files/files.d.ts +5 -1
- package/dist/src/storages/files/files.d.ts.map +1 -1
- package/dist/src/storages/files/files.impl.d.ts +1 -1
- package/dist/src/storages/files/files.impl.d.ts.map +1 -1
- package/dist/src/storages/files/files.impl.js +4 -2
- package/dist/src/storages/files/files.impl.js.map +1 -1
- package/dist/src/storages/files/files.js.map +1 -1
- package/dist/src/storages/organizations/organization.d.ts.map +1 -1
- package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -1
- 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/organizations/organizations.impl.d.ts.map +1 -1
- package/dist/src/storages/organizations/organizations.impl.js.map +1 -1
- package/dist/src/storages/user/userProfile.d.ts +4 -0
- package/dist/src/storages/user/userProfile.d.ts.map +1 -1
- package/dist/src/storages/user/userProfile.impl.d.ts +1 -0
- package/dist/src/storages/user/userProfile.impl.d.ts.map +1 -1
- package/dist/src/storages/user/userProfile.impl.js +6 -0
- package/dist/src/storages/user/userProfile.impl.js.map +1 -1
- package/dist/src/storages/user/userProfile.js.map +1 -1
- package/dist/src/storages/workspaces/workspace.impl.js.map +1 -1
- package/dist/src/storages/workspaces/workspaces.d.ts.map +1 -1
- package/dist/src/storages/workspaces/workspaces.impl.d.ts.map +1 -1
- package/dist/src/storages/workspaces/workspaces.impl.js.map +1 -1
- package/dist/src/storages/workspaces/workspaces.js.map +1 -1
- package/dist/src/utils/browserUtils.d.ts +4 -0
- package/dist/src/utils/browserUtils.d.ts.map +1 -0
- package/dist/src/utils/browserUtils.js +68 -0
- package/dist/src/utils/browserUtils.js.map +1 -0
- package/package.json +6 -2
- package/src/commands/startCommandHandler.ts +16 -5
- package/src/context.ts +2 -1
- package/src/credentials.ts +22 -0
- package/src/dto/accessGroupResponse.ts +15 -16
- package/src/dto/userInfoResponse.ts +1 -0
- package/src/index.ts +2 -0
- package/src/internal/app.impl.ts +30 -4
- package/src/middleware.ts +3 -0
- package/src/services/anonymousService.ts +43 -0
- package/src/services/commandService.ts +4 -2
- package/src/services/cookieService.ts +16 -0
- package/src/services/httpMethod.ts +1 -0
- package/src/services/middlewareService.ts +2 -0
- package/src/services/requestBuilder.ts +6 -3
- package/src/services/responseUtils.ts +2 -0
- package/src/services/rpcService.ts +2 -0
- package/src/services/userProfileService.ts +14 -0
- package/src/storages/chats/answer.impl.ts +4 -5
- package/src/storages/chats/chat.impl.ts +1 -1
- package/src/storages/chats/chats.impl.ts +3 -1
- package/src/storages/files/file.impl.ts +4 -2
- package/src/storages/files/files.impl.ts +4 -3
- package/src/storages/files/files.ts +5 -1
- package/src/storages/groups/group.impl.ts +1 -1
- package/src/storages/organizations/organization.impl.ts +4 -2
- package/src/storages/organizations/organization.ts +3 -4
- package/src/storages/organizations/organizations.impl.ts +3 -1
- package/src/storages/user/userProfile.impl.ts +7 -0
- package/src/storages/user/userProfile.ts +5 -0
- package/src/storages/workspaces/workspace.impl.ts +1 -1
- package/src/storages/workspaces/workspaces.impl.ts +3 -1
- package/src/storages/workspaces/workspaces.ts +5 -1
- package/src/utils/browserUtils.ts +72 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../../src/storages/workspaces/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC;;GAEG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,8BAAsB,UAAW,SAAQ,eAAe,CACtD,eAAe,EACf,SAAS,CACV;IACC;;OAEG;IACH,QAAQ,KAAK,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,CAAA;IAEnD;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS;IAExC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS;IAEvD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO;IAE3C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE;
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../../src/storages/workspaces/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE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AAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAExE,4CAA4C;YAC5C,MAAM,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;YAEvC,kCAAkC;YAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAEpC,iBAAiB;YACjB,IAAI,CAAC,QAAQ,CAAC;gBACZ,IAAI,EAAE,4BAAe,CAAC,KAAK;gBAC3B,IAAI,EAAE,aAAa;aACpB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF;AA3MD,wCA2MC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../../src/storages/workspaces/workspaces.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;AACrB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAED;;GAEG;AACH,MAAsB,UAAW,SAAQ,wBAGxC;
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../../src/storages/workspaces/workspaces.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;AACrB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAED;;GAEG;AACH,MAAsB,UAAW,SAAQ,wBAGxC;CAqCA;AAxCD,gCAwCC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"browserUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/browserUtils.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,SAAS,SAAU,MAAM,SAAS,MAAM,GAAG,SAAS,KAAG,IAGnE,CAAA;AAED,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,GAAG,SAkBjD,CAAA;AAED,eAAO,MAAM,iBAAiB,wBAc7B,CAAA"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createFingerprint = exports.getCookie = exports.setCookie = void 0;
|
4
|
+
const getDocument = () => {
|
5
|
+
if (!globalThis.document) {
|
6
|
+
globalThis.document = {
|
7
|
+
cookie: ""
|
8
|
+
};
|
9
|
+
}
|
10
|
+
return document;
|
11
|
+
};
|
12
|
+
const getNavigator = () => {
|
13
|
+
if (!globalThis.navigator) {
|
14
|
+
globalThis.navigator = {
|
15
|
+
userAgent: "",
|
16
|
+
language: "",
|
17
|
+
hardwareConcurrency: 0,
|
18
|
+
cookieEnabled: false
|
19
|
+
};
|
20
|
+
}
|
21
|
+
return navigator;
|
22
|
+
};
|
23
|
+
const getWidow = () => {
|
24
|
+
if (!globalThis.window) {
|
25
|
+
globalThis.window = {
|
26
|
+
devicePixelRatio: 16 / 9.0,
|
27
|
+
sessionStorage: {},
|
28
|
+
localStorage: {}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
return window;
|
32
|
+
};
|
33
|
+
const setCookie = (name, value) => {
|
34
|
+
const doc = getDocument();
|
35
|
+
doc.cookie = `${name}=${value || ""};`;
|
36
|
+
};
|
37
|
+
exports.setCookie = setCookie;
|
38
|
+
const getCookie = (name) => {
|
39
|
+
const doc = getDocument();
|
40
|
+
const nameValidator = `${name}=`;
|
41
|
+
const cookieItems = doc.cookie.split(";");
|
42
|
+
for (let index = 0; index < cookieItems.length; index++) {
|
43
|
+
let cookie = cookieItems[index];
|
44
|
+
while (cookie.charAt(0) === " ") {
|
45
|
+
cookie = cookie.substring(1, cookie.length);
|
46
|
+
}
|
47
|
+
if (cookie.indexOf(nameValidator) === 0) {
|
48
|
+
return cookie.substring(nameValidator.length, cookie.length);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return undefined;
|
52
|
+
};
|
53
|
+
exports.getCookie = getCookie;
|
54
|
+
const createFingerprint = () => {
|
55
|
+
const nav = getNavigator();
|
56
|
+
const win = getWidow();
|
57
|
+
const fingerprint = new Map();
|
58
|
+
fingerprint.set("userAgent", nav.userAgent);
|
59
|
+
fingerprint.set("language", nav.language);
|
60
|
+
fingerprint.set("hardware_concurrency", nav.hardwareConcurrency);
|
61
|
+
fingerprint.set("cookie_enabled", nav.cookieEnabled);
|
62
|
+
fingerprint.set("pixel_ratio", win.devicePixelRatio);
|
63
|
+
fingerprint.set("session_storage", win.sessionStorage);
|
64
|
+
fingerprint.set("local_storage", win.localStorage);
|
65
|
+
return fingerprint;
|
66
|
+
};
|
67
|
+
exports.createFingerprint = createFingerprint;
|
68
|
+
//# sourceMappingURL=browserUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"browserUtils.js","sourceRoot":"","sources":["../../../src/utils/browserUtils.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,CAAE,UAAkB,CAAC,QAAQ,EAAE,CAAC;QACjC,UAAkB,CAAC,QAAQ,GAAG;YAC7B,MAAM,EAAE,EAAE;SACX,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,IAAI,CAAE,UAAkB,CAAC,SAAS,EAAE,CAAC;QAClC,UAAkB,CAAC,SAAS,GAAG;YAC9B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,mBAAmB,EAAE,CAAC;YACtB,aAAa,EAAE,KAAK;SACrB,CAAA;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,IAAI,CAAE,UAAkB,CAAC,MAAM,EAAE,CAAC;QAC/B,UAAkB,CAAC,MAAM,GAAG;YAC3B,gBAAgB,EAAE,EAAE,GAAG,GAAG;YAC1B,cAAc,EAAE,EAAE;YACl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AA;IACtB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAe,CAAA;IAE1C,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAC3C,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IACzC,WAAW,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAChE,WAAW,CAAC,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;IACpD,WAAW,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;IACpD,WAAW,CAAC,GAAG,CAAC,iBAAiB,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;IACtD,WAAW,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;IAElD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAdY,QAAA,iBAAiB,qBAc7B"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@neuralinnovations/dataisland-sdk",
|
3
|
-
"version": "0.0.1-
|
3
|
+
"version": "0.0.1-dev28",
|
4
4
|
"description": "SDK for DataIsland project",
|
5
5
|
"licenses": [
|
6
6
|
{
|
@@ -64,6 +64,7 @@
|
|
64
64
|
"@babel/register": "7.22.5",
|
65
65
|
"@jest/globals": "^29.7.0",
|
66
66
|
"@types/jest": "^29.5.11",
|
67
|
+
"@types/node-fetch": "^2.6.11",
|
67
68
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
68
69
|
"@typescript-eslint/parser": "^6.19.0",
|
69
70
|
"babel-jest": "^29.7.0",
|
@@ -80,6 +81,7 @@
|
|
80
81
|
"eslint-plugin-react": "^7.33.2",
|
81
82
|
"glob": "7.2.3",
|
82
83
|
"jest": "^29.7.0",
|
84
|
+
"jest-environment-jsdom": "^29.7.0",
|
83
85
|
"prettier": "2.8.7",
|
84
86
|
"ts-jest": "^29.1.1",
|
85
87
|
"ts-loader": "8.4.0",
|
@@ -95,6 +97,8 @@
|
|
95
97
|
},
|
96
98
|
"dependencies": {
|
97
99
|
"dotenv": "^16.3.2",
|
98
|
-
"
|
100
|
+
"form-data": "^4.0.0",
|
101
|
+
"jsdom": "^23.2.0",
|
102
|
+
"node-fetch": "^2.7.0"
|
99
103
|
}
|
100
104
|
}
|
@@ -1,14 +1,25 @@
|
|
1
1
|
import { CommandHandler, Command } from "../services/commandService"
|
2
2
|
import { UserProfileService } from "../services/userProfileService"
|
3
|
+
import { CookieService } from "../services/cookieService"
|
4
|
+
import { AnonymousCredential } from "../credentials"
|
3
5
|
|
4
|
-
export class StartCommand extends Command {
|
6
|
+
export class StartCommand extends Command {
|
7
|
+
}
|
5
8
|
|
6
9
|
export class StartCommandHandler extends CommandHandler<StartCommand> {
|
7
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
8
11
|
async execute(message: StartCommand): Promise<void> {
|
9
|
-
const
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
const userService = this.resolve(UserProfileService)!
|
13
|
+
|
14
|
+
// Merge anonymous user if needed
|
15
|
+
if (!(this.context.app.credential instanceof AnonymousCredential)) {
|
16
|
+
const cookie = this.resolve(CookieService)!
|
17
|
+
if (cookie.anonymousTokenIsValid) {
|
18
|
+
await userService.merge(cookie.anonymousToken!)
|
19
|
+
cookie.anonymousToken = undefined
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
await userService.fetch()
|
13
24
|
}
|
14
25
|
}
|
package/src/context.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { type Constructor, type Registry } from "./internal/registry"
|
2
2
|
import { type Lifetime } from "./disposable"
|
3
3
|
import { Command, CommandService } from "./services/commandService"
|
4
|
+
import { DataIslandApp } from "./dataIslandApp"
|
4
5
|
|
5
6
|
/**
|
6
7
|
* DataIsland App context.
|
@@ -9,7 +10,7 @@ export class Context {
|
|
9
10
|
constructor(
|
10
11
|
private readonly registry: Registry,
|
11
12
|
public readonly lifetime: Lifetime,
|
12
|
-
public readonly
|
13
|
+
public readonly app: DataIslandApp
|
13
14
|
) {
|
14
15
|
}
|
15
16
|
|
package/src/credentials.ts
CHANGED
@@ -83,3 +83,25 @@ export class BearerCredential extends CredentialBase {
|
|
83
83
|
)
|
84
84
|
}
|
85
85
|
}
|
86
|
+
|
87
|
+
export class AnonymousCredential extends CredentialBase {
|
88
|
+
readonly token: string
|
89
|
+
|
90
|
+
constructor(token: string) {
|
91
|
+
super()
|
92
|
+
this.token = token
|
93
|
+
}
|
94
|
+
|
95
|
+
onRegister(lifetime: Lifetime, context: Context): void {
|
96
|
+
const service = context.resolve(MiddlewareService)
|
97
|
+
if (service === undefined) {
|
98
|
+
throw new Error("MiddlewareService is not registered.")
|
99
|
+
}
|
100
|
+
lifetime.add(
|
101
|
+
service.useMiddleware(async (req, next) => {
|
102
|
+
req.headers.set("Authorization", `InternalJWT ${this.token}`)
|
103
|
+
return await next(req)
|
104
|
+
})
|
105
|
+
)
|
106
|
+
}
|
107
|
+
}
|
@@ -1,34 +1,33 @@
|
|
1
1
|
import { UserDto } from "./userInfoResponse"
|
2
2
|
|
3
|
-
|
4
3
|
export interface PermitsDto {
|
5
|
-
|
4
|
+
isAdmin: boolean;
|
6
5
|
}
|
7
6
|
|
8
7
|
export interface RegulationDto {
|
9
|
-
|
10
|
-
|
8
|
+
isRegulateOrganization: boolean;
|
9
|
+
regulateWorkspaceIds: string[];
|
11
10
|
}
|
12
11
|
|
13
12
|
export interface AccessGroupDto {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
id: string;
|
14
|
+
name: string;
|
15
|
+
type: number;
|
16
|
+
createdAt: number;
|
17
|
+
modifiedAt: number;
|
18
|
+
organizationId: string;
|
19
|
+
permits: PermitsDto;
|
20
|
+
regulation: RegulationDto;
|
21
|
+
membersCount: number;
|
23
22
|
}
|
24
23
|
|
25
24
|
export interface AccessGroupResponse {
|
26
|
-
|
27
|
-
|
25
|
+
group: AccessGroupDto;
|
26
|
+
members: UserDto[];
|
28
27
|
}
|
29
28
|
|
30
29
|
export interface AccessGroupsResponse {
|
31
|
-
|
30
|
+
groups: AccessGroupDto[];
|
32
31
|
}
|
33
32
|
|
34
33
|
|
package/src/index.ts
CHANGED
@@ -25,6 +25,7 @@ export * from "./storages/files/file"
|
|
25
25
|
export * from "./storages/files/filesPage"
|
26
26
|
export * from "./storages/chats/chats"
|
27
27
|
export * from "./storages/chats/chat"
|
28
|
+
export * from "./storages/chats/answer"
|
28
29
|
|
29
30
|
// map of apps that are not ready to be used
|
30
31
|
const _appsNotReady = new Map<string, Promise<DataIslandApp>>()
|
@@ -96,6 +97,7 @@ export async function dataIslandApp(
|
|
96
97
|
}
|
97
98
|
return await appPromise
|
98
99
|
}
|
100
|
+
|
99
101
|
export { Group } from "./storages/groups/group"
|
100
102
|
export { GroupEvent } from "./storages/groups/group"
|
101
103
|
export { GroupId } from "./storages/groups/group"
|
package/src/internal/app.impl.ts
CHANGED
@@ -7,7 +7,11 @@ import { DisposableContainer, type Lifetime } from "../disposable"
|
|
7
7
|
import { type Service, ServiceContext } from "../services/service"
|
8
8
|
import { CredentialService } from "../services/credentialService"
|
9
9
|
import { MiddlewareService } from "../services/middlewareService"
|
10
|
-
import {
|
10
|
+
import {
|
11
|
+
DefaultCredential,
|
12
|
+
type CredentialBase,
|
13
|
+
AnonymousCredential
|
14
|
+
} from "../credentials"
|
11
15
|
import { DataIslandApp } from "../dataIslandApp"
|
12
16
|
import { RpcService } from "../services/rpcService"
|
13
17
|
import { CommandService } from "../services/commandService"
|
@@ -24,6 +28,8 @@ import {
|
|
24
28
|
DeleteUserFullCommand,
|
25
29
|
DeleteUserFullCommandHandler
|
26
30
|
} from "../commands/deleteUserFullCommandHandler"
|
31
|
+
import { CookieService } from "../services/cookieService"
|
32
|
+
import { AnonymousService } from "../services/anonymousService"
|
27
33
|
|
28
34
|
export class DataIslandAppImpl extends DataIslandApp {
|
29
35
|
readonly name: string
|
@@ -38,7 +44,7 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
38
44
|
this.name = name
|
39
45
|
this._registry = new Registry()
|
40
46
|
this._disposable = new DisposableContainer()
|
41
|
-
this._context = new Context(this._registry, this._disposable.lifetime,
|
47
|
+
this._context = new Context(this._registry, this._disposable.lifetime, this)
|
42
48
|
|
43
49
|
this._registry.map(Context).asValue(this._context)
|
44
50
|
}
|
@@ -92,6 +98,9 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
92
98
|
})
|
93
99
|
|
94
100
|
// register services
|
101
|
+
builder.registerService(CookieService, (context: ServiceContext) => {
|
102
|
+
return new CookieService(context)
|
103
|
+
})
|
95
104
|
builder.registerService(CredentialService, (context: ServiceContext) => {
|
96
105
|
return new CredentialService(context)
|
97
106
|
})
|
@@ -110,6 +119,9 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
110
119
|
builder.registerService(OrganizationService, (context: ServiceContext) => {
|
111
120
|
return new OrganizationService(context)
|
112
121
|
})
|
122
|
+
builder.registerService(AnonymousService, (context: ServiceContext) => {
|
123
|
+
return new AnonymousService(context)
|
124
|
+
})
|
113
125
|
|
114
126
|
// call customer setup
|
115
127
|
if (setup !== undefined) {
|
@@ -146,8 +158,6 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
146
158
|
this.resolve(CommandService)?.register(command[0], command[1])
|
147
159
|
})
|
148
160
|
|
149
|
-
this.credential = builder.credential
|
150
|
-
|
151
161
|
//-------------------------------------------------------------------------
|
152
162
|
// register services
|
153
163
|
//-------------------------------------------------------------------------
|
@@ -178,6 +188,22 @@ export class DataIslandAppImpl extends DataIslandApp {
|
|
178
188
|
await Promise.all(waitList)
|
179
189
|
//-------------------------------------------------------------------------
|
180
190
|
|
191
|
+
// set credential
|
192
|
+
this.credential = builder.credential
|
193
|
+
|
194
|
+
// Check anonymous authorization
|
195
|
+
if (!isUnitTest(UnitTest.DO_NOT_START) && builder.credential instanceof DefaultCredential) {
|
196
|
+
const anonymous = this.resolve(AnonymousService)!
|
197
|
+
const {
|
198
|
+
token,
|
199
|
+
isValid
|
200
|
+
} = await anonymous.getToken()
|
201
|
+
|
202
|
+
if (isValid) {
|
203
|
+
this.credential = new AnonymousCredential(token)
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
181
207
|
// start app, execute start command
|
182
208
|
if (!isUnitTest(UnitTest.DO_NOT_START)) {
|
183
209
|
await this.context.execute(new StartCommand())
|
package/src/middleware.ts
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Service } from "./service"
|
2
|
+
import { CookieService } from "./cookieService"
|
3
|
+
import { createFingerprint } from "../utils/browserUtils"
|
4
|
+
import { RpcService } from "./rpcService"
|
5
|
+
import { ResponseUtils } from "./responseUtils"
|
6
|
+
|
7
|
+
export class AnonymousService extends Service {
|
8
|
+
|
9
|
+
async getToken(): Promise<{ token: string, isValid: boolean }> {
|
10
|
+
const cookie = this.resolve(CookieService)!
|
11
|
+
let token = cookie.anonymousToken
|
12
|
+
if (token === undefined || token === null || token.length === 0) {
|
13
|
+
const fingerprint = createFingerprint()
|
14
|
+
const response = await this.context
|
15
|
+
.resolve(RpcService)
|
16
|
+
?.requestBuilder("api/v1/Users/anonymous")
|
17
|
+
.sendPutJson({
|
18
|
+
info: {
|
19
|
+
fingerprint: JSON.stringify({
|
20
|
+
userAgent: fingerprint.get("userAgent"),
|
21
|
+
language: fingerprint.get("language"),
|
22
|
+
hardwareConcurrency: fingerprint.get("hardware_concurrency"),
|
23
|
+
cookieEnabled: fingerprint.get("cookie_enabled"),
|
24
|
+
pixelRatio: fingerprint.get("pixel_ratio")
|
25
|
+
})
|
26
|
+
}
|
27
|
+
})
|
28
|
+
|
29
|
+
if (ResponseUtils.isFail(response)) {
|
30
|
+
await ResponseUtils.throwError("Failed to create anonymous token", response)
|
31
|
+
}
|
32
|
+
|
33
|
+
token = (await response!.json() as { token: string }).token
|
34
|
+
|
35
|
+
cookie.anonymousToken = token!
|
36
|
+
}
|
37
|
+
|
38
|
+
return {
|
39
|
+
token: token!,
|
40
|
+
isValid: token !== undefined && token !== null && token.length > 0
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -3,7 +3,8 @@ import { Context } from "../context"
|
|
3
3
|
import { Constructor } from "../internal/registry"
|
4
4
|
|
5
5
|
export abstract class CommandHandler<T> {
|
6
|
-
constructor(protected readonly context: Context) {
|
6
|
+
constructor(protected readonly context: Context) {
|
7
|
+
}
|
7
8
|
|
8
9
|
resolve<T>(type: Constructor<T>): T | undefined {
|
9
10
|
return this.context.resolve<T>(type)
|
@@ -12,7 +13,8 @@ export abstract class CommandHandler<T> {
|
|
12
13
|
abstract execute(message: T): Promise<void>
|
13
14
|
}
|
14
15
|
|
15
|
-
export abstract class Command {
|
16
|
+
export abstract class Command {
|
17
|
+
}
|
16
18
|
|
17
19
|
export class CommandService extends Service {
|
18
20
|
private readonly _registry: Map<
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Service } from "./service"
|
2
|
+
import { getCookie, setCookie } from "../utils/browserUtils"
|
3
|
+
|
4
|
+
export class CookieService extends Service {
|
5
|
+
get anonymousToken(): string | undefined {
|
6
|
+
return getCookie("anonymous-token")
|
7
|
+
}
|
8
|
+
|
9
|
+
get anonymousTokenIsValid(): boolean {
|
10
|
+
return this.anonymousToken !== undefined && this.anonymousToken !== null && this.anonymousToken.length > 0
|
11
|
+
}
|
12
|
+
|
13
|
+
set anonymousToken(value: string | undefined) {
|
14
|
+
setCookie("anonymous-token", value)
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type HttpMethod = "POST" | "GET" | "PUT" | "DELETE" | "PATCH"
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Service } from "./service"
|
2
2
|
import { type Middleware } from "../middleware"
|
3
3
|
import { type Disposable } from "../disposable"
|
4
|
+
import { Request } from "node-fetch"
|
5
|
+
import { Response } from "node-fetch"
|
4
6
|
|
5
7
|
export class MiddlewareService extends Service {
|
6
8
|
private _middlewares: Middleware[] = []
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import { Request, Response, Headers } from "node-fetch"
|
2
|
+
import FormData from "form-data"
|
3
|
+
|
1
4
|
export class RequestBuilder {
|
2
5
|
private readonly _headers: Headers
|
3
6
|
private readonly _searchParams: URLSearchParams
|
@@ -58,7 +61,7 @@ export class RequestBuilder {
|
|
58
61
|
const req = new Request(url, {
|
59
62
|
method: "POST",
|
60
63
|
headers: this._headers,
|
61
|
-
body
|
64
|
+
body: body
|
62
65
|
})
|
63
66
|
|
64
67
|
// discard content type
|
@@ -73,7 +76,7 @@ export class RequestBuilder {
|
|
73
76
|
public async sendPostJson(body: object | null | undefined): Promise<Response> {
|
74
77
|
const url = this._url
|
75
78
|
url.search = this._searchParams.toString()
|
76
|
-
let json: string |
|
79
|
+
let json: string | undefined = undefined
|
77
80
|
if (body !== undefined && body !== null && typeof body === "object") {
|
78
81
|
json = JSON.stringify(body)
|
79
82
|
}
|
@@ -112,7 +115,7 @@ export class RequestBuilder {
|
|
112
115
|
public async sendPutJson(body: object | null | undefined): Promise<Response> {
|
113
116
|
const url = this._url
|
114
117
|
url.search = this._searchParams.toString()
|
115
|
-
let json: string |
|
118
|
+
let json: string | undefined = undefined
|
116
119
|
if (body !== undefined && body !== null && typeof body === "object") {
|
117
120
|
json = JSON.stringify(body)
|
118
121
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Service, type ServiceContext } from "./service"
|
2
2
|
import { MiddlewareService } from "./middlewareService"
|
3
3
|
import { RequestBuilder } from "./requestBuilder"
|
4
|
+
import { Request, Response, Headers } from "node-fetch"
|
5
|
+
import fetch from "node-fetch"
|
4
6
|
|
5
7
|
/**
|
6
8
|
* Options for the RpcService.
|
@@ -13,6 +13,20 @@ export class UserProfileService extends Service {
|
|
13
13
|
return this.impl
|
14
14
|
}
|
15
15
|
|
16
|
+
async merge(anonymous_token: string) {
|
17
|
+
const rpc = this.resolve(RpcService) as RpcService
|
18
|
+
const response = await rpc.requestBuilder("api/v1/Users/anonymous/merge")
|
19
|
+
.sendPostJson({
|
20
|
+
anonymousToken: anonymous_token
|
21
|
+
})
|
22
|
+
|
23
|
+
if (ResponseUtils.isFail(response)) {
|
24
|
+
await ResponseUtils.throwError("Failed to merge anonymous user", response)
|
25
|
+
}
|
26
|
+
|
27
|
+
await this.fetch()
|
28
|
+
}
|
29
|
+
|
16
30
|
async fetch() {
|
17
31
|
const rpc = this.resolve(RpcService) as RpcService
|
18
32
|
const response = await rpc.requestBuilder("api/v1/Users/self2").sendGet()
|
@@ -105,12 +105,11 @@ export class AnswerImpl extends Answer {
|
|
105
105
|
// update answer
|
106
106
|
this._status = <AnswerStatus>answer.status
|
107
107
|
this._steps = <AnswerStepDto[]>answer.steps
|
108
|
-
|
109
108
|
|
110
109
|
if (this.getStep(StepType.GENERATE_ANSWER) !== undefined) {
|
111
110
|
const step = this.getStep(StepType.GENERATE_ANSWER)
|
112
111
|
const step_tokens = step?.tokens.join("")
|
113
|
-
if (this._answer !== step_tokens){
|
112
|
+
if (this._answer !== step_tokens) {
|
114
113
|
this._answer = step_tokens
|
115
114
|
|
116
115
|
this.dispatch({
|
@@ -122,15 +121,15 @@ export class AnswerImpl extends Answer {
|
|
122
121
|
|
123
122
|
if (this.getStep(StepType.SOURCES) !== undefined && this._sources === undefined) {
|
124
123
|
const sources_step = this.getStep(StepType.SOURCES)
|
125
|
-
this._sources = sources_step?.sources
|
126
|
-
|
124
|
+
this._sources = sources_step?.sources
|
125
|
+
|
127
126
|
this.dispatch({
|
128
127
|
type: AnswerEvent.UPDATED,
|
129
128
|
data: this
|
130
129
|
})
|
131
130
|
}
|
132
131
|
|
133
|
-
if (this.getStep(StepType.DONE) !== undefined){
|
132
|
+
if (this.getStep(StepType.DONE) !== undefined) {
|
134
133
|
const step = this.getStep(StepType.DONE)
|
135
134
|
this._timestamp = Date.parse(step!.end_at)
|
136
135
|
}
|
@@ -77,7 +77,7 @@ export class ChatImpl extends Chat implements Disposable {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
// parse answer id from the server's response
|
80
|
-
const id = (await response!.json()).id
|
80
|
+
const id = (await response!.json() as { id: string }).id
|
81
81
|
|
82
82
|
// create answer implementation
|
83
83
|
const answer = await new AnswerImpl(this, this.context).initNew(id, message)
|
@@ -84,7 +84,9 @@ export class ChatsImpl extends Chats {
|
|
84
84
|
}
|
85
85
|
|
86
86
|
// parse workspace from the server's response
|
87
|
-
const content = (await response!.json()
|
87
|
+
const content = (await response!.json() as {
|
88
|
+
chat: ChatDto
|
89
|
+
}).chat as ChatDto
|
88
90
|
|
89
91
|
// create workspace implementation
|
90
92
|
const chat = new ChatImpl(this.context, this.organization)
|
@@ -72,7 +72,7 @@ export class FileImpl extends File implements Disposable {
|
|
72
72
|
)
|
73
73
|
}
|
74
74
|
|
75
|
-
return (await response!.json()).url
|
75
|
+
return (await response!.json() as { url: string }).url
|
76
76
|
}
|
77
77
|
|
78
78
|
public fetchAfter() {
|
@@ -93,7 +93,9 @@ export class FileImpl extends File implements Disposable {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
const prev_progress = this._progress
|
96
|
-
this._progress = (await response!.json()
|
96
|
+
this._progress = (await response!.json() as {
|
97
|
+
progress: FileProgressDto
|
98
|
+
}).progress as FileProgressDto
|
97
99
|
|
98
100
|
if (prev_progress === undefined ||
|
99
101
|
(this.progress.success !== null && this.progress.completed_parts_count > prev_progress.completed_parts_count) ||
|