@antcde/connect-ts 0.0.48

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.
Files changed (119) hide show
  1. package/README.md +129 -0
  2. package/build/AntConnect.d.ts +69 -0
  3. package/build/AntConnect.d.ts.map +1 -0
  4. package/build/AntConnect.js +65 -0
  5. package/build/AntHttpClient.d.ts +34 -0
  6. package/build/AntHttpClient.d.ts.map +1 -0
  7. package/build/AntHttpClient.js +101 -0
  8. package/build/ResponseStatusCodes.d.ts +64 -0
  9. package/build/ResponseStatusCodes.d.ts.map +1 -0
  10. package/build/ResponseStatusCodes.js +63 -0
  11. package/build/comms/client.d.ts +33 -0
  12. package/build/comms/client.d.ts.map +1 -0
  13. package/build/comms/client.js +121 -0
  14. package/build/comms/host.d.ts +29 -0
  15. package/build/comms/host.d.ts.map +1 -0
  16. package/build/comms/host.js +129 -0
  17. package/build/comms/models.d.ts +57 -0
  18. package/build/comms/models.d.ts.map +1 -0
  19. package/build/comms/models.js +1 -0
  20. package/build/comms/utils.d.ts +45 -0
  21. package/build/comms/utils.d.ts.map +1 -0
  22. package/build/comms/utils.js +75 -0
  23. package/build/index.d.ts +18 -0
  24. package/build/index.d.ts.map +1 -0
  25. package/build/index.js +8 -0
  26. package/build/services/AppService.d.ts +95 -0
  27. package/build/services/AppService.d.ts.map +1 -0
  28. package/build/services/AppService.js +24 -0
  29. package/build/services/ClientService.d.ts +19 -0
  30. package/build/services/ClientService.d.ts.map +1 -0
  31. package/build/services/ClientService.js +7 -0
  32. package/build/services/ColumnService.d.ts +38 -0
  33. package/build/services/ColumnService.d.ts.map +1 -0
  34. package/build/services/ColumnService.js +9 -0
  35. package/build/services/DmsService.d.ts +46 -0
  36. package/build/services/DmsService.d.ts.map +1 -0
  37. package/build/services/DmsService.js +21 -0
  38. package/build/services/DownloadService.d.ts +16 -0
  39. package/build/services/DownloadService.d.ts.map +1 -0
  40. package/build/services/DownloadService.js +6 -0
  41. package/build/services/LabelService.d.ts +35 -0
  42. package/build/services/LabelService.d.ts.map +1 -0
  43. package/build/services/LabelService.js +9 -0
  44. package/build/services/LaravelQueueService.d.ts +8 -0
  45. package/build/services/LaravelQueueService.d.ts.map +1 -0
  46. package/build/services/LaravelQueueService.js +6 -0
  47. package/build/services/LicenseService.d.ts +27 -0
  48. package/build/services/LicenseService.d.ts.map +1 -0
  49. package/build/services/LicenseService.js +10 -0
  50. package/build/services/LinkService.d.ts +17 -0
  51. package/build/services/LinkService.d.ts.map +1 -0
  52. package/build/services/LinkService.js +8 -0
  53. package/build/services/ModuleService.d.ts +45 -0
  54. package/build/services/ModuleService.d.ts.map +1 -0
  55. package/build/services/ModuleService.js +16 -0
  56. package/build/services/NewsService.d.ts +19 -0
  57. package/build/services/NewsService.d.ts.map +1 -0
  58. package/build/services/NewsService.js +6 -0
  59. package/build/services/PermissionService.d.ts +28 -0
  60. package/build/services/PermissionService.d.ts.map +1 -0
  61. package/build/services/PermissionService.js +9 -0
  62. package/build/services/Project/ProjectUserService.d.ts +17 -0
  63. package/build/services/Project/ProjectUserService.d.ts.map +1 -0
  64. package/build/services/Project/ProjectUserService.js +7 -0
  65. package/build/services/ProjectMemberService.d.ts +24 -0
  66. package/build/services/ProjectMemberService.d.ts.map +1 -0
  67. package/build/services/ProjectMemberService.js +7 -0
  68. package/build/services/ProjectRoleService.d.ts +77 -0
  69. package/build/services/ProjectRoleService.d.ts.map +1 -0
  70. package/build/services/ProjectRoleService.js +13 -0
  71. package/build/services/ProjectService.d.ts +69 -0
  72. package/build/services/ProjectService.d.ts.map +1 -0
  73. package/build/services/ProjectService.js +12 -0
  74. package/build/services/RBAC/PermissionService.d.ts +49 -0
  75. package/build/services/RBAC/PermissionService.d.ts.map +1 -0
  76. package/build/services/RBAC/PermissionService.js +8 -0
  77. package/build/services/RBAC/RoleService.d.ts +36 -0
  78. package/build/services/RBAC/RoleService.d.ts.map +1 -0
  79. package/build/services/RBAC/RoleService.js +15 -0
  80. package/build/services/RecordService.d.ts +50 -0
  81. package/build/services/RecordService.d.ts.map +1 -0
  82. package/build/services/RecordService.js +34 -0
  83. package/build/services/RevisionService.d.ts +29 -0
  84. package/build/services/RevisionService.d.ts.map +1 -0
  85. package/build/services/RevisionService.js +9 -0
  86. package/build/services/SbsService.d.ts +34 -0
  87. package/build/services/SbsService.d.ts.map +1 -0
  88. package/build/services/SbsService.js +10 -0
  89. package/build/services/ScriptsService.d.ts +45 -0
  90. package/build/services/ScriptsService.d.ts.map +1 -0
  91. package/build/services/ScriptsService.js +20 -0
  92. package/build/services/SignService.d.ts +8 -0
  93. package/build/services/SignService.d.ts.map +1 -0
  94. package/build/services/SignService.js +5 -0
  95. package/build/services/TableQueryService.d.ts +46 -0
  96. package/build/services/TableQueryService.d.ts.map +1 -0
  97. package/build/services/TableQueryService.js +10 -0
  98. package/build/services/TableService.d.ts +79 -0
  99. package/build/services/TableService.d.ts.map +1 -0
  100. package/build/services/TableService.js +16 -0
  101. package/build/services/TaskQueryService.d.ts +12 -0
  102. package/build/services/TaskQueryService.d.ts.map +1 -0
  103. package/build/services/TaskQueryService.js +8 -0
  104. package/build/services/TaskService.d.ts +249 -0
  105. package/build/services/TaskService.d.ts.map +1 -0
  106. package/build/services/TaskService.js +138 -0
  107. package/build/services/TokenService.d.ts +32 -0
  108. package/build/services/TokenService.d.ts.map +1 -0
  109. package/build/services/TokenService.js +9 -0
  110. package/build/services/UserService.d.ts +98 -0
  111. package/build/services/UserService.d.ts.map +1 -0
  112. package/build/services/UserService.js +41 -0
  113. package/build/services/WorkflowService.d.ts +112 -0
  114. package/build/services/WorkflowService.d.ts.map +1 -0
  115. package/build/services/WorkflowService.js +181 -0
  116. package/build/types.d.ts +21 -0
  117. package/build/types.d.ts.map +1 -0
  118. package/build/types.js +1 -0
  119. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # ANTCONNECT TS/JS
2
+
3
+ With this package you can give your applications simple access to the ANT api
4
+
5
+ ## install npm package
6
+
7
+ ```shell
8
+ npm install axios
9
+ ```
10
+
11
+ axios is needed and not included in the package itself
12
+
13
+ ```shell
14
+ npm install ant_tsconnect
15
+ ```
16
+
17
+ this will give you access to the AntConnect class which needs a httpClient (see below)
18
+
19
+ ### httpclient
20
+
21
+ to connect to one of ANT's environments you need a httpclient where you set the following properties
22
+
23
+ - client_id
24
+ - client_secret
25
+ - base_url
26
+ - api_url
27
+ - this client you will pass on to AntConnect, and you can connect to the given api
28
+
29
+ ```typescript
30
+ const httpClient = new CustomHttpClient('http://api-antcde.io', '/api/1.0', 'X', 'SECRET')
31
+ const antConnect = newAntConnect(httpClient)
32
+ ```
33
+
34
+ ## Authentication
35
+
36
+ to authenticate an user you can access the authenticate method by the following
37
+
38
+ ```typescript
39
+ antConnect.httpClient.authenticate({
40
+ username: 'user@antcde.io',
41
+ password: 'password'
42
+ })
43
+ ```
44
+
45
+ you can save the access token to localstorage or a cookie and add it with the custom interceptors to each request (see below)
46
+
47
+ ## two-factor authorization (2fa)
48
+
49
+ if 2fa is enabled for the user you will receive error response with data
50
+
51
+ ```{ code: 1707747196 }```
52
+
53
+ in
54
+
55
+ ```antConnect.users.getAuthenticatedUser()```
56
+
57
+ In that case the best way is handling this error in custom interceptor by the error code and verify your login token with the prepared request from antConnect
58
+
59
+ ```antConnect.users.verifyTwoFactor({ code })```
60
+
61
+ ## interceptors
62
+
63
+ it is possible to create custom request and response interceptors.
64
+
65
+ you can create a custom class with the following functions:
66
+
67
+ ```typescript
68
+ // Custom request interceptor
69
+ export function requestInterceptor(config) {
70
+ config.headers = {}
71
+
72
+ config.headers['Authorization'] = 'Bearer Client'
73
+ return config
74
+ }
75
+
76
+ // Custom response interceptor
77
+ export function responseInterceptor(response) {
78
+ // Modify the response as needed
79
+ // For example, you can extract specific data or handle errors
80
+ return response
81
+ }
82
+ ```
83
+
84
+ then you can add these interceptors to the httpclient
85
+
86
+ ```typescript
87
+ import { requestInterceptor } from '@/interceptors' // import
88
+
89
+ const httpClient = new CustomHttpClient(
90
+ 'http://192.168.1.50:8000',
91
+ '/api/1.0',
92
+ '2',
93
+ 'OEQWm6a4rsbqTSEiB2y32O2yR0J3MFlUPbZJWI9w'
94
+ )
95
+ httpClient.addRequestInterceptor(requestInterceptor) // add here
96
+ const antConnect = newAntConnect(httpClient)
97
+ ```
98
+
99
+ ### create single instance
100
+
101
+ Depending on your framework there are multiple ways to create a single instance of AntConnect across your whole application
102
+
103
+ #### Vue (3)
104
+
105
+ // TODO change this
106
+
107
+ ```typescript
108
+ const httpClient = new CustomHttpClient(
109
+ 'http://192.168.1.50:8000',
110
+ '/api/1.0',
111
+ '2',
112
+ 'OEQWm6a4rsbqTSEiB2y32O2yR0J3MFlUPbZJWI9w'
113
+ )
114
+ httpClient.addRequestInterceptor(requestInterceptor)
115
+ const antConnect = newAntConnect(httpClient)
116
+
117
+ app.provide('antConnect', antConnect) // here we provide the instance to the whole application
118
+ ```
119
+
120
+ and by injection in our vue components we can access the instance like this:
121
+
122
+ ```typescript
123
+ const antConnect = inject('antConnect')
124
+ let projects = await antConnect.projects.getProjects()
125
+ ```
126
+
127
+ in the above example we fetch the projects of a given user.
128
+
129
+ As we have an idea to move all projects to monorepo, maybe will be better to move to pnpm packager
@@ -0,0 +1,69 @@
1
+ import type { AntHttpClient } from './AntHttpClient';
2
+ import type AppService from './services/AppService';
3
+ import type ClientService from './services/ClientService';
4
+ import type ColumnService from './services/ColumnService';
5
+ import type DmsService from './services/DmsService';
6
+ import type DownloadService from './services/DownloadService';
7
+ import type LabelService from './services/LabelService';
8
+ import type LaravelQueueService from './services/LaravelQueueService';
9
+ import type LicenseService from './services/LicenseService';
10
+ import type LinkService from './services/LinkService';
11
+ import type ModuleService from './services/ModuleService';
12
+ import type NewsService from './services/NewsService';
13
+ import type PermissionService from './services/PermissionService';
14
+ import type { ProjectUserService } from './services/Project/ProjectUserService';
15
+ import type ProjectMemberService from './services/ProjectMemberService';
16
+ import type ProjectRoleService from './services/ProjectRoleService';
17
+ import type ProjectService from './services/ProjectService';
18
+ import type { RBACPermissionService } from './services/RBAC/PermissionService';
19
+ import type { RBACRoleService } from './services/RBAC/RoleService';
20
+ import type RecordService from './services/RecordService';
21
+ import type RevisionService from './services/RevisionService';
22
+ import type SbsService from './services/SbsService';
23
+ import type { ScriptsService } from './services/ScriptsService';
24
+ import type SignService from './services/SignService';
25
+ import type { TableQueryService } from './services/TableQueryService';
26
+ import type TableService from './services/TableService';
27
+ import type { TaskQueryService } from './services/TaskQueryService';
28
+ import type TaskService from './services/TaskService';
29
+ import type TokenService from './services/TokenService';
30
+ import type UserService from './services/UserService';
31
+ import type WorkflowService from './services/WorkflowService';
32
+ export interface MessageResponse {
33
+ message: string;
34
+ }
35
+ export interface AntConnect {
36
+ readonly httpClient?: AntHttpClient;
37
+ readonly columns: ColumnService;
38
+ readonly downloads: DownloadService;
39
+ readonly dms: DmsService;
40
+ readonly queue: LaravelQueueService;
41
+ readonly licenses: LicenseService;
42
+ readonly modules: ModuleService;
43
+ readonly news: NewsService;
44
+ readonly permissions: PermissionService;
45
+ readonly projects: ProjectService;
46
+ readonly projectMembers: ProjectMemberService;
47
+ readonly records: RecordService;
48
+ readonly revisions: RevisionService;
49
+ readonly sbs: SbsService;
50
+ readonly sign: SignService;
51
+ readonly tables: TableService;
52
+ readonly links: LinkService;
53
+ readonly tasks: TaskService;
54
+ readonly tasksQuery: TaskQueryService;
55
+ readonly tokens: TokenService;
56
+ readonly clients: ClientService;
57
+ readonly users: UserService;
58
+ readonly workflows: WorkflowService;
59
+ readonly projectRoles: ProjectRoleService;
60
+ readonly scripts: ScriptsService;
61
+ readonly labels: LabelService;
62
+ readonly apps: AppService;
63
+ readonly rbacRoles: RBACRoleService;
64
+ readonly rbacPermissions: RBACPermissionService;
65
+ readonly tableQueries: TableQueryService;
66
+ readonly projectUsers: ProjectUserService;
67
+ }
68
+ export declare function newAntConnect(httpClient: AntHttpClient): AntConnect;
69
+ //# sourceMappingURL=AntConnect.d.ts.map
@@ -0,0 +1 @@
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B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;IACzC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAA;IAC/C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;IACxC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;CAC1C;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,aAAa,GAAG,UAAU,CAkCnE"}
@@ -0,0 +1,65 @@
1
+ import { newAppService } from './services/AppService';
2
+ import { newClientService } from './services/ClientService';
3
+ import { newColumnService } from './services/ColumnService';
4
+ import { newDmsService } from './services/DmsService';
5
+ import { newDownloadService } from './services/DownloadService';
6
+ import { newLabelService } from './services/LabelService';
7
+ import { newLaravelQueueService } from './services/LaravelQueueService';
8
+ import { newLicenseService } from './services/LicenseService';
9
+ import { newLinkService } from './services/LinkService';
10
+ import { newModuleService } from './services/ModuleService';
11
+ import { newNewsService } from './services/NewsService';
12
+ import { newPermissionService } from './services/PermissionService';
13
+ import { newProjectUserService } from './services/Project/ProjectUserService';
14
+ import { newProjectMemberService } from './services/ProjectMemberService';
15
+ import { newProjectRoleService } from './services/ProjectRoleService';
16
+ import { newProjectService } from './services/ProjectService';
17
+ import { newRBACPermissionService } from './services/RBAC/PermissionService';
18
+ import { newRBACRoleService } from './services/RBAC/RoleService';
19
+ import { newRecordService } from './services/RecordService';
20
+ import { newRevisionService } from './services/RevisionService';
21
+ import { newSbsService } from './services/SbsService';
22
+ import { newScriptsService } from './services/ScriptsService';
23
+ import { newSignService } from './services/SignService';
24
+ import { newTableQueryService } from './services/TableQueryService';
25
+ import { newTableService } from './services/TableService';
26
+ import { newTaskQueryService } from './services/TaskQueryService';
27
+ import { newTaskService } from './services/TaskService';
28
+ import { newTokenService } from './services/TokenService';
29
+ import { newUserService } from './services/UserService';
30
+ import { newWorkflowService } from './services/WorkflowService';
31
+ export function newAntConnect(httpClient) {
32
+ return {
33
+ httpClient,
34
+ projects: newProjectService(httpClient),
35
+ projectMembers: newProjectMemberService(httpClient),
36
+ columns: newColumnService(httpClient),
37
+ downloads: newDownloadService(httpClient),
38
+ dms: newDmsService(httpClient),
39
+ queue: newLaravelQueueService(httpClient),
40
+ licenses: newLicenseService(httpClient),
41
+ modules: newModuleService(httpClient),
42
+ news: newNewsService(httpClient),
43
+ permissions: newPermissionService(httpClient),
44
+ records: newRecordService(httpClient),
45
+ revisions: newRevisionService(httpClient),
46
+ sbs: newSbsService(httpClient),
47
+ sign: newSignService(httpClient),
48
+ tables: newTableService(httpClient),
49
+ links: newLinkService(httpClient),
50
+ tasks: newTaskService(httpClient),
51
+ tasksQuery: newTaskQueryService(httpClient),
52
+ tokens: newTokenService(httpClient),
53
+ clients: newClientService(httpClient),
54
+ users: newUserService(httpClient),
55
+ workflows: newWorkflowService(httpClient),
56
+ projectRoles: newProjectRoleService(httpClient),
57
+ scripts: newScriptsService(httpClient),
58
+ labels: newLabelService(httpClient),
59
+ apps: newAppService(httpClient),
60
+ rbacRoles: newRBACRoleService(httpClient),
61
+ rbacPermissions: newRBACPermissionService(httpClient),
62
+ tableQueries: newTableQueryService(httpClient),
63
+ projectUsers: newProjectUserService(httpClient),
64
+ };
65
+ }
@@ -0,0 +1,34 @@
1
+ import type { AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import type { TokenResponse } from './types';
3
+ export interface NewAntHttpClientArgs {
4
+ baseUrl?: string;
5
+ apiUrl?: string;
6
+ token?: string;
7
+ client: {
8
+ id: string;
9
+ secret: string;
10
+ };
11
+ }
12
+ export declare function newAntHttpClient({ apiUrl, baseUrl, client, token }: NewAntHttpClientArgs): AntHttpClient;
13
+ export declare class AntHttpClient {
14
+ private http;
15
+ private readonly baseUrl;
16
+ private readonly apiUrl;
17
+ private readonly clientId;
18
+ private readonly clientSecret;
19
+ constructor(baseUrl: string, apiUrl: string, clientId: string, clientSecret: string);
20
+ getInterceptorsManager(): {
21
+ request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
22
+ response: import("axios").AxiosInterceptorManager<AxiosResponse>;
23
+ };
24
+ getBaseUrl(): string;
25
+ download<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
26
+ get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
27
+ post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
28
+ put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
29
+ delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
30
+ patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
31
+ authenticate(userData: any): Promise<TokenResponse>;
32
+ params(values: Record<string | number, any>, prefix?: string): string;
33
+ }
34
+ //# sourceMappingURL=AntHttpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AntHttpClient.d.ts","sourceRoot":"","sources":["../src/AntHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE;QAAE,EAAE,EAAE,MAA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G,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1E,YAAY,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBhE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAqBtE"}
@@ -0,0 +1,101 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axios from 'axios';
11
+ export function newAntHttpClient({ apiUrl, baseUrl, client, token }) {
12
+ const httpClient = new AntHttpClient(baseUrl !== null && baseUrl !== void 0 ? baseUrl : 'https://api.alpha.antcde.io', apiUrl !== null && apiUrl !== void 0 ? apiUrl : '/api/2.0', client.id, client.secret);
13
+ if (token) {
14
+ httpClient.getInterceptorsManager().request.use(config => Object.assign({}, config, {
15
+ headers: Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${token}` }),
16
+ }));
17
+ }
18
+ return httpClient;
19
+ }
20
+ export class AntHttpClient {
21
+ constructor(baseUrl, apiUrl, clientId, clientSecret) {
22
+ this.baseUrl = baseUrl;
23
+ this.apiUrl = apiUrl;
24
+ this.clientId = clientId;
25
+ this.clientSecret = clientSecret;
26
+ const fullUrl = baseUrl + apiUrl;
27
+ this.http = axios.create({ baseURL: fullUrl });
28
+ }
29
+ getInterceptorsManager() {
30
+ return this.http.interceptors;
31
+ }
32
+ getBaseUrl() {
33
+ return this.baseUrl;
34
+ }
35
+ download(url, config) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ return this.http.get(url, config).then(response => response);
38
+ });
39
+ }
40
+ // FIXME: Not see any value to save interceptors on our side instead of give client possibility
41
+ // to use axios flows by default.
42
+ get(url, config) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ return this.http.get(url, config).then(response => response.data);
45
+ });
46
+ }
47
+ post(url, data, config) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ return this.http.post(url, data, config).then(response => response.data);
50
+ });
51
+ }
52
+ put(url, data, config) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ return this.http.put(url, data, config).then(response => response.data);
55
+ });
56
+ }
57
+ delete(url, config) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ return this.http.delete(url, config).then(response => response.data);
60
+ });
61
+ }
62
+ patch(url, data, config) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ return this.http.patch(url, data, config).then(response => response.data);
65
+ });
66
+ }
67
+ authenticate(userData) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ try {
70
+ const data = Object.assign({ grant_type: 'password', client_id: this.clientId, client_secret: this.clientSecret }, userData);
71
+ const response = yield this.http.post('/oauth/token', data, {
72
+ baseURL: this.baseUrl,
73
+ });
74
+ return response.data;
75
+ }
76
+ catch (error) {
77
+ return Promise.reject(error);
78
+ }
79
+ });
80
+ }
81
+ params(values, prefix) {
82
+ const encode = encodeURIComponent;
83
+ if (Array.isArray(values)) {
84
+ return values
85
+ .map((v, k) => isComplex(v)
86
+ ? this.params(v, prefix ? `${prefix}[${k}]` : `[${k}]`)
87
+ : `${encode(`${prefix !== null && prefix !== void 0 ? prefix : ''}[${k}]`)}=${encode(v)}`)
88
+ .join('&');
89
+ }
90
+ else {
91
+ return Object.entries(values)
92
+ .map(([k, v]) => isComplex(v)
93
+ ? this.params(v, prefix ? `${prefix}.${k}` : `${k}`)
94
+ : `${encode((prefix ? `${prefix}.` : '') + k)}=${encode(v)}`)
95
+ .join('&');
96
+ }
97
+ }
98
+ }
99
+ function isComplex(value) {
100
+ return Array.isArray(value) || typeof value == 'object';
101
+ }
@@ -0,0 +1,64 @@
1
+ export declare const HTTP_CONTINUE = 100;
2
+ export declare const HTTP_SWITCHING_PROTOCOLS = 101;
3
+ export declare const HTTP_PROCESSING = 102;
4
+ export declare const HTTP_EARLY_HINTS = 103;
5
+ export declare const HTTP_OK = 200;
6
+ export declare const HTTP_CREATED = 201;
7
+ export declare const HTTP_ACCEPTED = 202;
8
+ export declare const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
9
+ export declare const HTTP_NO_CONTENT = 204;
10
+ export declare const HTTP_RESET_CONTENT = 205;
11
+ export declare const HTTP_PARTIAL_CONTENT = 206;
12
+ export declare const HTTP_MULTI_STATUS = 207;
13
+ export declare const HTTP_ALREADY_REPORTED = 208;
14
+ export declare const HTTP_IM_USED = 226;
15
+ export declare const HTTP_MULTIPLE_CHOICES = 300;
16
+ export declare const HTTP_MOVED_PERMANENTLY = 301;
17
+ export declare const HTTP_FOUND = 302;
18
+ export declare const HTTP_SEE_OTHER = 303;
19
+ export declare const HTTP_NOT_MODIFIED = 304;
20
+ export declare const HTTP_USE_PROXY = 305;
21
+ export declare const HTTP_RESERVED = 306;
22
+ export declare const HTTP_TEMPORARY_REDIRECT = 307;
23
+ export declare const HTTP_PERMANENTLY_REDIRECT = 308;
24
+ export declare const HTTP_BAD_REQUEST = 400;
25
+ export declare const HTTP_UNAUTHORIZED = 401;
26
+ export declare const HTTP_PAYMENT_REQUIRED = 402;
27
+ export declare const HTTP_FORBIDDEN = 403;
28
+ export declare const HTTP_NOT_FOUND = 404;
29
+ export declare const HTTP_METHOD_NOT_ALLOWED = 405;
30
+ export declare const HTTP_NOT_ACCEPTABLE = 406;
31
+ export declare const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
32
+ export declare const HTTP_REQUEST_TIMEOUT = 408;
33
+ export declare const HTTP_CONFLICT = 409;
34
+ export declare const HTTP_GONE = 410;
35
+ export declare const HTTP_LENGTH_REQUIRED = 411;
36
+ export declare const HTTP_PRECONDITION_FAILED = 412;
37
+ export declare const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
38
+ export declare const HTTP_REQUEST_URI_TOO_LONG = 414;
39
+ export declare const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
40
+ export declare const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
41
+ export declare const HTTP_EXPECTATION_FAILED = 417;
42
+ export declare const HTTP_I_AM_A_TEAPOT = 418;
43
+ export declare const HTTP_MISDIRECTED_REQUEST = 421;
44
+ export declare const HTTP_UNPROCESSABLE_ENTITY = 422;
45
+ export declare const HTTP_LOCKED = 423;
46
+ export declare const HTTP_FAILED_DEPENDENCY = 424;
47
+ export declare const HTTP_TOO_EARLY = 425;
48
+ export declare const HTTP_UPGRADE_REQUIRED = 426;
49
+ export declare const HTTP_PRECONDITION_REQUIRED = 428;
50
+ export declare const HTTP_TOO_MANY_REQUESTS = 429;
51
+ export declare const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
52
+ export declare const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
53
+ export declare const HTTP_INTERNAL_SERVER_ERROR = 500;
54
+ export declare const HTTP_NOT_IMPLEMENTED = 501;
55
+ export declare const HTTP_BAD_GATEWAY = 502;
56
+ export declare const HTTP_SERVICE_UNAVAILABLE = 503;
57
+ export declare const HTTP_GATEWAY_TIMEOUT = 504;
58
+ export declare const HTTP_VERSION_NOT_SUPPORTED = 505;
59
+ export declare const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506;
60
+ export declare const HTTP_INSUFFICIENT_STORAGE = 507;
61
+ export declare const HTTP_LOOP_DETECTED = 508;
62
+ export declare const HTTP_NOT_EXTENDED = 510;
63
+ export declare const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
64
+ //# sourceMappingURL=ResponseStatusCodes.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iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,oCAAoC,MAAM,CAAA"}
@@ -0,0 +1,63 @@
1
+ export const HTTP_CONTINUE = 100;
2
+ export const HTTP_SWITCHING_PROTOCOLS = 101;
3
+ export const HTTP_PROCESSING = 102; // RFC2518
4
+ export const HTTP_EARLY_HINTS = 103; // RFC8297
5
+ export const HTTP_OK = 200;
6
+ export const HTTP_CREATED = 201;
7
+ export const HTTP_ACCEPTED = 202;
8
+ export const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
9
+ export const HTTP_NO_CONTENT = 204;
10
+ export const HTTP_RESET_CONTENT = 205;
11
+ export const HTTP_PARTIAL_CONTENT = 206;
12
+ export const HTTP_MULTI_STATUS = 207; // RFC4918
13
+ export const HTTP_ALREADY_REPORTED = 208; // RFC5842
14
+ export const HTTP_IM_USED = 226; // RFC3229
15
+ export const HTTP_MULTIPLE_CHOICES = 300;
16
+ export const HTTP_MOVED_PERMANENTLY = 301;
17
+ export const HTTP_FOUND = 302;
18
+ export const HTTP_SEE_OTHER = 303;
19
+ export const HTTP_NOT_MODIFIED = 304;
20
+ export const HTTP_USE_PROXY = 305;
21
+ export const HTTP_RESERVED = 306;
22
+ export const HTTP_TEMPORARY_REDIRECT = 307;
23
+ export const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
24
+ export const HTTP_BAD_REQUEST = 400;
25
+ export const HTTP_UNAUTHORIZED = 401;
26
+ export const HTTP_PAYMENT_REQUIRED = 402;
27
+ export const HTTP_FORBIDDEN = 403;
28
+ export const HTTP_NOT_FOUND = 404;
29
+ export const HTTP_METHOD_NOT_ALLOWED = 405;
30
+ export const HTTP_NOT_ACCEPTABLE = 406;
31
+ export const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
32
+ export const HTTP_REQUEST_TIMEOUT = 408;
33
+ export const HTTP_CONFLICT = 409;
34
+ export const HTTP_GONE = 410;
35
+ export const HTTP_LENGTH_REQUIRED = 411;
36
+ export const HTTP_PRECONDITION_FAILED = 412;
37
+ export const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
38
+ export const HTTP_REQUEST_URI_TOO_LONG = 414;
39
+ export const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
40
+ export const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
41
+ export const HTTP_EXPECTATION_FAILED = 417;
42
+ export const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
43
+ export const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540
44
+ export const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
45
+ export const HTTP_LOCKED = 423; // RFC4918
46
+ export const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
47
+ export const HTTP_TOO_EARLY = 425; // RFC-ietf-httpbis-replay-04
48
+ export const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
49
+ export const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
50
+ export const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
51
+ export const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
52
+ export const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; // RFC7725
53
+ export const HTTP_INTERNAL_SERVER_ERROR = 500;
54
+ export const HTTP_NOT_IMPLEMENTED = 501;
55
+ export const HTTP_BAD_GATEWAY = 502;
56
+ export const HTTP_SERVICE_UNAVAILABLE = 503;
57
+ export const HTTP_GATEWAY_TIMEOUT = 504;
58
+ export const HTTP_VERSION_NOT_SUPPORTED = 505;
59
+ export const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
60
+ export const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
61
+ export const HTTP_LOOP_DETECTED = 508; // RFC5842
62
+ export const HTTP_NOT_EXTENDED = 510; // RFC2774
63
+ export const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
@@ -0,0 +1,33 @@
1
+ import type { AntConnect } from "../AntConnect";
2
+ import type { Observable, SubscriptionLike } from 'rxjs';
3
+ import type { Context, LocaleData, Notepad, Notifications, Toolbar } from './models';
4
+ import { type Scope } from './utils';
5
+ interface ClientParams {
6
+ parent: Window;
7
+ connect?: AntConnect;
8
+ }
9
+ interface Box {
10
+ clientIdChanges: Observable<string>;
11
+ scope: Scope;
12
+ parent: Window;
13
+ }
14
+ export interface Client extends SubscriptionLike {
15
+ notepad: Notepad;
16
+ notifications: Notifications;
17
+ connect: AntConnect;
18
+ context: Observable<Context>;
19
+ toolbar: Observable<Toolbar> & {
20
+ set: (value: Toolbar | ((value: Toolbar) => void | Toolbar)) => void;
21
+ get: () => Toolbar;
22
+ };
23
+ appState: Observable<string> & {
24
+ get: () => Promise<string>;
25
+ set: (state: string) => Promise<void>;
26
+ };
27
+ locales: Observable<LocaleData>;
28
+ }
29
+ export declare function newCommsClient(params: ClientParams): Client;
30
+ export declare function newNotepad({ scope, parent, clientIdChanges }: Box): Notepad;
31
+ export declare function newNotifications({ parent, scope, clientIdChanges }: Box): Notifications;
32
+ export {};
33
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/comms/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAoB;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAepF,OAAO,EAAsC,KAAK,KAAK,EAAmB,MAAM,SAAS,CAAA;AAEzF,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AAED,UAAU,GAAG;IACX,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;IACnC,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,EAAE,MAA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