@neuralinnovations/dataisland-sdk 0.0.1-dev27 → 0.0.1-dev29
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 +4 -1
- 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 +1 -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 +1 -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.map +1 -1
- package/dist/src/services/requestBuilder.js +8 -7
- 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.map +1 -1
- 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 +6 -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 +9 -1
- 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/dist/src/utils/request.d.ts +6 -0
- package/dist/src/utils/request.d.ts.map +1 -0
- package/dist/src/utils/request.js +3 -0
- package/dist/src/utils/request.js.map +1 -0
- package/package.json +4 -1
- 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 +2 -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 +1 -0
- package/src/services/requestBuilder.ts +10 -8
- package/src/services/responseUtils.ts +2 -0
- package/src/services/rpcService.ts +1 -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 +11 -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
- package/src/utils/request.ts +6 -0
@@ -6,7 +6,6 @@ import { EventDispatcher } from "../../events"
|
|
6
6
|
import { UserDto } from "../../dto/userInfoResponse"
|
7
7
|
import { GroupId } from "../groups/group"
|
8
8
|
|
9
|
-
|
10
9
|
/**
|
11
10
|
* Organization event.
|
12
11
|
*/
|
@@ -18,9 +17,9 @@ export enum OrganizationEvent {
|
|
18
17
|
* Organization.
|
19
18
|
*/
|
20
19
|
export abstract class Organization extends EventDispatcher<
|
21
|
-
OrganizationEvent,
|
22
|
-
Organization
|
23
|
-
>
|
20
|
+
OrganizationEvent,
|
21
|
+
Organization
|
22
|
+
> {
|
24
23
|
/**
|
25
24
|
* Organization id.
|
26
25
|
*/
|
@@ -147,7 +147,9 @@ export class OrganizationsImpl extends Organizations {
|
|
147
147
|
response
|
148
148
|
)
|
149
149
|
}
|
150
|
-
const content = (await response!.json()
|
150
|
+
const content = (await response!.json() as {
|
151
|
+
organization: OrganizationDto
|
152
|
+
}).organization as OrganizationDto
|
151
153
|
|
152
154
|
// create organization and init from content
|
153
155
|
const org = await new OrganizationImpl(this.context).initFrom(content, true)
|
@@ -32,6 +32,13 @@ export class UserProfileImpl extends UserProfile {
|
|
32
32
|
throw new Error("The profile is not loaded.")
|
33
33
|
}
|
34
34
|
|
35
|
+
get isAnonymous(): boolean {
|
36
|
+
if (this.content) {
|
37
|
+
return this.content.user.isAnonymousMode
|
38
|
+
}
|
39
|
+
throw new Error("The profile is not loaded.")
|
40
|
+
}
|
41
|
+
|
35
42
|
get createdAt(): Date {
|
36
43
|
if (this.content) {
|
37
44
|
return new Date(this.content.user.created_at)
|
@@ -108,7 +108,9 @@ export class WorkspacesImpl extends Workspaces {
|
|
108
108
|
}
|
109
109
|
|
110
110
|
// parse workspace from the server's response
|
111
|
-
const content = (await response!.json())
|
111
|
+
const content = ((await response!.json()) as {
|
112
|
+
workspace: WorkspaceDto
|
113
|
+
}).workspace as WorkspaceDto
|
112
114
|
|
113
115
|
// create workspace implementation
|
114
116
|
const workspace = new WorkspaceImpl(this.organization, this.context)
|
@@ -44,7 +44,11 @@ export abstract class Workspaces extends EventDispatcher<
|
|
44
44
|
/**
|
45
45
|
* Create workspace.
|
46
46
|
*/
|
47
|
-
abstract create(name: string, description: string, regulation?: {
|
47
|
+
abstract create(name: string, description: string, regulation?: {
|
48
|
+
isCreateNewGroup: boolean,
|
49
|
+
newGroupName: string,
|
50
|
+
groupIds: string[]
|
51
|
+
}): Promise<Workspace>
|
48
52
|
|
49
53
|
/**
|
50
54
|
* Delete workspace.
|
@@ -0,0 +1,72 @@
|
|
1
|
+
const getDocument = () => {
|
2
|
+
if (!(globalThis as any).document) {
|
3
|
+
(globalThis as any).document = {
|
4
|
+
cookie: ""
|
5
|
+
}
|
6
|
+
}
|
7
|
+
return document
|
8
|
+
}
|
9
|
+
|
10
|
+
const getNavigator = () => {
|
11
|
+
if (!(globalThis as any).navigator) {
|
12
|
+
(globalThis as any).navigator = {
|
13
|
+
userAgent: "",
|
14
|
+
language: "",
|
15
|
+
hardwareConcurrency: 0,
|
16
|
+
cookieEnabled: false
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return navigator
|
20
|
+
}
|
21
|
+
|
22
|
+
const getWidow = () => {
|
23
|
+
if (!(globalThis as any).window) {
|
24
|
+
(globalThis as any).window = {
|
25
|
+
devicePixelRatio: 16 / 9.0,
|
26
|
+
sessionStorage: {},
|
27
|
+
localStorage: {}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return window
|
31
|
+
}
|
32
|
+
|
33
|
+
export const setCookie = (name: string, value: string | undefined): void => {
|
34
|
+
const doc = getDocument()
|
35
|
+
doc.cookie = `${name}=${value || ""};`
|
36
|
+
}
|
37
|
+
|
38
|
+
export const getCookie = (name: string): string | undefined => {
|
39
|
+
const doc = getDocument()
|
40
|
+
const nameValidator = `${name}=`
|
41
|
+
const cookieItems = doc.cookie.split(";")
|
42
|
+
|
43
|
+
for (let index = 0; index < cookieItems.length; index++) {
|
44
|
+
let cookie = cookieItems[index]
|
45
|
+
|
46
|
+
while (cookie.charAt(0) === " ") {
|
47
|
+
cookie = cookie.substring(1, cookie.length)
|
48
|
+
}
|
49
|
+
|
50
|
+
if (cookie.indexOf(nameValidator) === 0) {
|
51
|
+
return cookie.substring(nameValidator.length, cookie.length)
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
return undefined
|
56
|
+
}
|
57
|
+
|
58
|
+
export const createFingerprint = () => {
|
59
|
+
const nav = getNavigator()
|
60
|
+
const win = getWidow()
|
61
|
+
const fingerprint = new Map<string, any>()
|
62
|
+
|
63
|
+
fingerprint.set("userAgent", nav.userAgent)
|
64
|
+
fingerprint.set("language", nav.language)
|
65
|
+
fingerprint.set("hardware_concurrency", nav.hardwareConcurrency)
|
66
|
+
fingerprint.set("cookie_enabled", nav.cookieEnabled)
|
67
|
+
fingerprint.set("pixel_ratio", win.devicePixelRatio)
|
68
|
+
fingerprint.set("session_storage", win.sessionStorage)
|
69
|
+
fingerprint.set("local_storage", win.localStorage)
|
70
|
+
|
71
|
+
return fingerprint
|
72
|
+
}
|