instill-sdk 0.0.2 → 0.0.3
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/README.md +54 -34
- package/dist/chunk-375TLK3Q.mjs +0 -0
- package/dist/chunk-4BC7UGYC.mjs +114 -0
- package/dist/{chunk-JONZWFL5.mjs → chunk-4LUKB34H.mjs} +48 -52
- package/dist/chunk-5FTGMS4X.mjs +46 -0
- package/dist/chunk-6K6UDAWM.mjs +114 -0
- package/dist/{chunk-IPW3WQCQ.mjs → chunk-7VLTGUGU.mjs} +18 -1
- package/dist/chunk-DZXTDWWF.mjs +69 -0
- package/dist/{chunk-4VWYH26Q.mjs → chunk-EI3U4WOS.mjs} +1 -1
- package/dist/{chunk-KHFNAMT4.mjs → chunk-GEEYB6IX.mjs} +1 -1
- package/dist/{chunk-G5M7VUJT.mjs → chunk-GFLAFXAN.mjs} +1 -1
- package/dist/chunk-GX3ELROF.mjs +141 -0
- package/dist/{chunk-YK7RY2CG.mjs → chunk-I4VMGZBF.mjs} +104 -32
- package/dist/{chunk-YXNMG2RZ.mjs → chunk-JBSVFVPW.mjs} +1 -1
- package/dist/{chunk-NRP5M7FG.mjs → chunk-K7AV4FXF.mjs} +13 -11
- package/dist/{chunk-VIPORJ6H.mjs → chunk-KV3GJM6Q.mjs} +45 -3
- package/dist/{chunk-DIAPO2ML.mjs → chunk-L25EZQ5J.mjs} +16 -5
- package/dist/{chunk-EBWGEVUX.mjs → chunk-QG4SF5DT.mjs} +5 -1
- package/dist/{chunk-GPM5FDRS.mjs → chunk-SFKHRD33.mjs} +18 -18
- package/dist/chunk-UNJKVLJE.mjs +0 -0
- package/dist/{chunk-MS2EILMH.mjs → chunk-V2NMRJ2Y.mjs} +20 -16
- package/dist/connector/ConnectorClient.d.ts +32 -32
- package/dist/connector/ConnectorClient.js +90 -85
- package/dist/connector/ConnectorClient.mjs +5 -5
- package/dist/connector/action.d.ts +19 -9
- package/dist/connector/action.js +17 -17
- package/dist/connector/action.mjs +7 -7
- package/dist/connector/index.mjs +5 -5
- package/dist/connector/mutation.d.ts +13 -13
- package/dist/connector/mutation.js +35 -30
- package/dist/connector/mutation.mjs +9 -9
- package/dist/connector/queries.d.ts +11 -11
- package/dist/connector/queries.js +26 -22
- package/dist/connector/queries.mjs +10 -10
- package/dist/connector/types.d.ts +34 -48
- package/dist/helper/getQueryString.d.ts +3 -2
- package/dist/helper/getQueryString.js +5 -1
- package/dist/helper/getQueryString.mjs +1 -1
- package/dist/helper/getQueryString.test.js +5 -1
- package/dist/helper/getQueryString.test.mjs +1 -1
- package/dist/helper/index.js +5 -1
- package/dist/helper/index.mjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +566 -136
- package/dist/index.mjs +54 -17
- package/dist/metric/MetricClient.js +5 -1
- package/dist/metric/MetricClient.mjs +3 -3
- package/dist/metric/pipeline/queries.js +5 -1
- package/dist/metric/pipeline/queries.mjs +2 -2
- package/dist/mgmt/AuthClient.d.ts +7 -1
- package/dist/mgmt/AuthClient.js +44 -4
- package/dist/mgmt/AuthClient.mjs +4 -4
- package/dist/mgmt/action.d.ts +4 -0
- package/dist/mgmt/action.js +20 -2
- package/dist/mgmt/action.mjs +5 -3
- package/dist/mgmt/index.mjs +4 -4
- package/dist/mgmt/queries.d.ts +11 -2
- package/dist/mgmt/queries.js +52 -4
- package/dist/mgmt/queries.mjs +8 -4
- package/dist/mgmt/types.d.ts +12 -0
- package/dist/model/ModelClient.js +5 -1
- package/dist/model/ModelClient.mjs +3 -3
- package/dist/model/index.mjs +3 -3
- package/dist/model/queries.js +5 -1
- package/dist/model/queries.mjs +2 -2
- package/dist/organization/OrganizationClient.d.ts +43 -0
- package/dist/organization/OrganizationClient.js +378 -0
- package/dist/organization/OrganizationClient.mjs +15 -0
- package/dist/organization/index.d.ts +3 -0
- package/dist/organization/index.js +310 -0
- package/dist/organization/index.mjs +41 -0
- package/dist/organization/mutations.d.ts +32 -0
- package/dist/organization/mutations.js +144 -0
- package/dist/organization/mutations.mjs +19 -0
- package/dist/organization/queries.d.ts +34 -0
- package/dist/organization/queries.js +191 -0
- package/dist/organization/queries.mjs +23 -0
- package/dist/organization/types.d.ts +81 -0
- package/dist/organization/types.js +18 -0
- package/dist/organization/types.mjs +1 -0
- package/dist/pipeline/PipelineClient.d.ts +7 -5
- package/dist/pipeline/PipelineClient.js +81 -47
- package/dist/pipeline/PipelineClient.mjs +4 -4
- package/dist/pipeline/action.d.ts +13 -12
- package/dist/pipeline/action.js +13 -11
- package/dist/pipeline/action.mjs +1 -1
- package/dist/pipeline/index.mjs +5 -5
- package/dist/pipeline/queries.d.ts +37 -18
- package/dist/pipeline/queries.js +110 -32
- package/dist/pipeline/queries.mjs +8 -4
- package/dist/pipeline/types.d.ts +88 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +2 -2
- package/dist/chunk-6M57XUNI.mjs +0 -64
- package/dist/chunk-YT6ZGA4J.mjs +0 -46
package/README.md
CHANGED
|
@@ -229,27 +229,27 @@ client.PipelineClient.createUserPipelineMutation("<userName>",
|
|
|
229
229
|
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
| function | params
|
|
233
|
-
| :------------------------------------ | :---------------------------------------------:
|
|
234
|
-
| listPipelinesQuery |
|
|
235
|
-
| listUserPipelinesQuery |
|
|
236
|
-
| getUserPipelineQuery | pipelineName
|
|
237
|
-
| ListUserPipelineReleasesQuery |
|
|
238
|
-
| getUserPipelineReleaseQuery | pipelineReleaseName
|
|
239
|
-
| watchUserPipelineReleaseQuery | pipelineReleaseName
|
|
240
|
-
| createUserPipelineMutation | userName, payload
|
|
241
|
-
| updateUserPipelineMutation | payload
|
|
242
|
-
| deleteUserPipelineMutation | pipelineName
|
|
243
|
-
| renameUserPipelineMutation | payload
|
|
244
|
-
| createUserPipelineReleaseMutation | pipelineName, payload
|
|
245
|
-
| updateUserPipelineReleaseMutation | pipelineReleaseName, payload
|
|
246
|
-
| deleteUserPipelineReleaseMutation | pipelineReleaseName
|
|
247
|
-
| triggerUserPipelineAction |
|
|
248
|
-
| triggerAsyncUserPipelineAction | pipelineName, payload, returnTraces
|
|
249
|
-
| setDefaultUserPipelineReleaseMutation | pipelineReleaseName
|
|
250
|
-
| restoreUserPipelineReleaseMutation | pipelineReleaseName
|
|
251
|
-
| triggerUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces
|
|
252
|
-
| triggerAsyncUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces
|
|
232
|
+
| function | params |
|
|
233
|
+
| :------------------------------------ | :---------------------------------------------: |
|
|
234
|
+
| listPipelinesQuery | pageSize, nextPageToken,enablePagination |
|
|
235
|
+
| listUserPipelinesQuery | pageSize, nextPageToken, userName,enablePagination |
|
|
236
|
+
| getUserPipelineQuery | pipelineName |
|
|
237
|
+
| ListUserPipelineReleasesQuery | userName, pipelineName, pageSize, nextPageToken |
|
|
238
|
+
| getUserPipelineReleaseQuery | pipelineReleaseName |
|
|
239
|
+
| watchUserPipelineReleaseQuery | pipelineReleaseName |
|
|
240
|
+
| createUserPipelineMutation | userName, payload |
|
|
241
|
+
| updateUserPipelineMutation | payload |
|
|
242
|
+
| deleteUserPipelineMutation | pipelineName |
|
|
243
|
+
| renameUserPipelineMutation | payload |
|
|
244
|
+
| createUserPipelineReleaseMutation | pipelineName, payload |
|
|
245
|
+
| updateUserPipelineReleaseMutation | pipelineReleaseName, payload |
|
|
246
|
+
| deleteUserPipelineReleaseMutation | pipelineReleaseName |
|
|
247
|
+
| triggerUserPipelineAction | pipelineName, payload, returnTraces,shareCode |
|
|
248
|
+
| triggerAsyncUserPipelineAction | pipelineName, payload, returnTraces |
|
|
249
|
+
| setDefaultUserPipelineReleaseMutation | pipelineReleaseName |
|
|
250
|
+
| restoreUserPipelineReleaseMutation | pipelineReleaseName |
|
|
251
|
+
| triggerUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces |
|
|
252
|
+
| triggerAsyncUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces |
|
|
253
253
|
|
|
254
254
|
### Connector
|
|
255
255
|
|
|
@@ -258,7 +258,7 @@ client.PipelineClient.createUserPipelineMutation("<userName>",
|
|
|
258
258
|
```
|
|
259
259
|
userName : check your userName: https://console.instill.tech/settings
|
|
260
260
|
|
|
261
|
-
query.ConnectorClient.
|
|
261
|
+
query.ConnectorClient.createUserConnectorMutation("<userName>",
|
|
262
262
|
{
|
|
263
263
|
"id": "open-ai-model-1",
|
|
264
264
|
"connector_definition_name": "connector-definitions/ai-openai",
|
|
@@ -277,19 +277,19 @@ query.ConnectorClient.createUserConnectorResourceMutation("<userName>",
|
|
|
277
277
|
|
|
278
278
|
| function | params |
|
|
279
279
|
| :---------------------------------------- | :---------------------------------------: |
|
|
280
|
-
|
|
|
281
|
-
|
|
|
280
|
+
| listConnectorsQuery | pageSize, nextPageToken, filter |
|
|
281
|
+
| listUserConnectorsQuery | userName, pageSize, nextPageToken, filter |
|
|
282
282
|
| listConnectorDefinitionsQuery | connectorDefinitionName |
|
|
283
283
|
| getConnectorDefinitionQuery | connectorDefinitionName |
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
284
|
+
| getUserConnectorQuery | connectorName |
|
|
285
|
+
| watchUserConnector | connectorName |
|
|
286
|
+
| createUserConnectorMutation | entityName, payload |
|
|
287
|
+
| deleteUserConnectorMutation | connectorName |
|
|
288
|
+
| updateUserConnectorMutation | payload |
|
|
289
|
+
| renameUserConnector | payload |
|
|
290
|
+
| testUserConnectorConnectionAction | connectorName |
|
|
291
|
+
| connectUserConnectorAction | connectorName |
|
|
292
|
+
| disconnectUserConnectorAction | connectorName |
|
|
293
293
|
|
|
294
294
|
### Metric
|
|
295
295
|
|
|
@@ -323,6 +323,24 @@ query.ConnectorClient.createUserConnectorResourceMutation("<userName>",
|
|
|
323
323
|
| getOperationQuery | operationName |
|
|
324
324
|
| checkUntilOperationIsDoen | operationName |
|
|
325
325
|
|
|
326
|
+
|
|
327
|
+
### Oraganization
|
|
328
|
+
|
|
329
|
+
| function | params |
|
|
330
|
+
| :--------------------------------- | :-----------------------------: |
|
|
331
|
+
| getOrganizationMembershipQuery | organizationID, userID |
|
|
332
|
+
| getOrganizationQuery | organizationID |
|
|
333
|
+
| getUserMembershipQuery | organizationID, userID |
|
|
334
|
+
| getUserMembershipsQuery | userID |
|
|
335
|
+
| listOrganizationsQuery | pageSize, nextPageToken, filter |
|
|
336
|
+
| createOrganizationMutation | payload |
|
|
337
|
+
| deleteOrganizationMutation | organizationName |
|
|
338
|
+
| deleteUserMembershipMutation | organizationID,userID |
|
|
339
|
+
| updateOrganizationMembershipMutation | payload |
|
|
340
|
+
| updateOrganizationMutation | payload |
|
|
341
|
+
| updateUserMembershipMutation | payload |
|
|
342
|
+
|
|
343
|
+
|
|
326
344
|
### Mgmt
|
|
327
345
|
|
|
328
346
|
### create API token
|
|
@@ -343,13 +361,15 @@ client.AuthClient.createApiTokenMutation({
|
|
|
343
361
|
|
|
344
362
|
| function | params |
|
|
345
363
|
| :--------------------- | :---------------------: |
|
|
346
|
-
| getUserQuery |
|
|
364
|
+
| getUserQuery | userName |
|
|
365
|
+
| getUserMeQuery | |
|
|
347
366
|
| checkUserIdExist | id |
|
|
348
367
|
| getApiTokenQuery | tokenName |
|
|
349
368
|
| listApiTokensQuery | pageSize, nextPageToken |
|
|
350
369
|
| updateUserMutation | payload |
|
|
351
370
|
| createApiTokenMutation | payload |
|
|
352
371
|
| deleteApiTokenMutation | tokenName |
|
|
372
|
+
| checkNamespace | id |
|
|
353
373
|
|
|
354
374
|
## Contribution Guidelines:
|
|
355
375
|
|
|
File without changes
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/organization/mutations.ts
|
|
2
|
+
async function createOrganizationMutation({
|
|
3
|
+
payload,
|
|
4
|
+
axiosInstance
|
|
5
|
+
}) {
|
|
6
|
+
try {
|
|
7
|
+
const { data } = await axiosInstance.post(
|
|
8
|
+
"/organizations",
|
|
9
|
+
payload
|
|
10
|
+
);
|
|
11
|
+
return Promise.resolve(data.organization);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
return Promise.reject(err);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function updateOrganizationMutation({
|
|
17
|
+
payload,
|
|
18
|
+
axiosInstance
|
|
19
|
+
}) {
|
|
20
|
+
try {
|
|
21
|
+
const { data } = await axiosInstance.patch(
|
|
22
|
+
`/organizations/${payload.id}`,
|
|
23
|
+
{
|
|
24
|
+
...payload,
|
|
25
|
+
id: void 0
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
return Promise.resolve(data.organization);
|
|
29
|
+
} catch (err) {
|
|
30
|
+
return Promise.reject(err);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function updateOrganizationMembershipMutation({
|
|
34
|
+
payload,
|
|
35
|
+
axiosInstance
|
|
36
|
+
}) {
|
|
37
|
+
try {
|
|
38
|
+
const { data } = await axiosInstance.put(
|
|
39
|
+
`/organizations/${payload.organizationID}/memberships/${payload.userID}`,
|
|
40
|
+
{
|
|
41
|
+
...payload,
|
|
42
|
+
organizationID: void 0,
|
|
43
|
+
userID: void 0
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
return Promise.resolve(data.membership);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
return Promise.reject(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function deleteOrganizationMutation({
|
|
52
|
+
organizationName,
|
|
53
|
+
axiosInstance
|
|
54
|
+
}) {
|
|
55
|
+
try {
|
|
56
|
+
await axiosInstance.delete(`/organizations/${organizationName}`);
|
|
57
|
+
} catch (err) {
|
|
58
|
+
return Promise.reject(err);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function deleteOrganizationMembershipMutation({
|
|
62
|
+
organizationID,
|
|
63
|
+
userID,
|
|
64
|
+
axiosInstance
|
|
65
|
+
}) {
|
|
66
|
+
try {
|
|
67
|
+
await axiosInstance.delete(
|
|
68
|
+
`/organizations/${organizationID}/memberships/${userID}`
|
|
69
|
+
);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return Promise.reject(err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function deleteUserMembershipMutation({
|
|
75
|
+
organizationID,
|
|
76
|
+
userID,
|
|
77
|
+
axiosInstance
|
|
78
|
+
}) {
|
|
79
|
+
try {
|
|
80
|
+
await axiosInstance.delete(
|
|
81
|
+
`/users/${userID}/memberships/${organizationID}`
|
|
82
|
+
);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
return Promise.reject(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function updateUserMembershipMutation({
|
|
88
|
+
payload,
|
|
89
|
+
axiosInstance
|
|
90
|
+
}) {
|
|
91
|
+
try {
|
|
92
|
+
const { data } = await axiosInstance.put(
|
|
93
|
+
`/users/${payload.userID}/memberships/${payload.organizationID}`,
|
|
94
|
+
{
|
|
95
|
+
...payload,
|
|
96
|
+
organizationID: void 0,
|
|
97
|
+
userID: void 0
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
return Promise.resolve(data.membership);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
return Promise.reject(err);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
createOrganizationMutation,
|
|
108
|
+
updateOrganizationMutation,
|
|
109
|
+
updateOrganizationMembershipMutation,
|
|
110
|
+
deleteOrganizationMutation,
|
|
111
|
+
deleteOrganizationMembershipMutation,
|
|
112
|
+
deleteUserMembershipMutation,
|
|
113
|
+
updateUserMembershipMutation
|
|
114
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
2
|
+
connectUserConnectorAction,
|
|
3
|
+
disconnectUserConnectorAction,
|
|
4
|
+
testUserConnectorConnectionAction
|
|
5
|
+
} from "./chunk-5FTGMS4X.mjs";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
7
|
+
createUserConnectorMutation,
|
|
8
|
+
deleteUserConnectorMutation,
|
|
9
|
+
renameUserConnector,
|
|
10
|
+
updateUserConnectorMutation
|
|
11
|
+
} from "./chunk-DZXTDWWF.mjs";
|
|
12
12
|
import {
|
|
13
13
|
getConnectorDefinitionQuery,
|
|
14
|
-
|
|
14
|
+
getUserConnectorQuery,
|
|
15
15
|
listConnectorDefinitionsQuery,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
listConnectorsQuery,
|
|
17
|
+
listUserConnectorsQuery,
|
|
18
|
+
watchUserConnector
|
|
19
|
+
} from "./chunk-SFKHRD33.mjs";
|
|
20
20
|
|
|
21
21
|
// src/connector/ConnectorClient.ts
|
|
22
22
|
import axios from "axios";
|
|
@@ -34,25 +34,25 @@ var ConnectorClient = class {
|
|
|
34
34
|
/* -------------------------------------------------------------------------
|
|
35
35
|
* Connector Queries
|
|
36
36
|
* -----------------------------------------------------------------------*/
|
|
37
|
-
async
|
|
37
|
+
async listConnectorsQuery({
|
|
38
38
|
pageSize,
|
|
39
39
|
nextPageToken,
|
|
40
40
|
filter
|
|
41
41
|
}) {
|
|
42
|
-
return
|
|
42
|
+
return listConnectorsQuery({
|
|
43
43
|
axiosInstance: this.axiosInstance,
|
|
44
44
|
pageSize,
|
|
45
45
|
nextPageToken,
|
|
46
46
|
filter
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
async
|
|
49
|
+
async listUserConnectorsQuery({
|
|
50
50
|
userName,
|
|
51
51
|
pageSize,
|
|
52
52
|
nextPageToken,
|
|
53
53
|
filter
|
|
54
54
|
}) {
|
|
55
|
-
return
|
|
55
|
+
return listUserConnectorsQuery({
|
|
56
56
|
axiosInstance: this.axiosInstance,
|
|
57
57
|
userName,
|
|
58
58
|
pageSize,
|
|
@@ -80,55 +80,51 @@ var ConnectorClient = class {
|
|
|
80
80
|
connectorDefinitionName
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
async
|
|
84
|
-
|
|
85
|
-
}) {
|
|
86
|
-
return getUserConnectorResourceQuery({
|
|
83
|
+
async getUserConnectorQuery({ connectorName }) {
|
|
84
|
+
return getUserConnectorQuery({
|
|
87
85
|
axiosInstance: this.axiosInstance,
|
|
88
|
-
|
|
86
|
+
connectorName
|
|
89
87
|
});
|
|
90
88
|
}
|
|
91
|
-
async
|
|
92
|
-
|
|
93
|
-
}) {
|
|
94
|
-
return watchUserConnectorResource({
|
|
89
|
+
async watchUserConnector({ connectorName }) {
|
|
90
|
+
return watchUserConnector({
|
|
95
91
|
axiosInstance: this.axiosInstance,
|
|
96
|
-
|
|
92
|
+
connectorName
|
|
97
93
|
});
|
|
98
94
|
}
|
|
99
95
|
/* -------------------------------------------------------------------------
|
|
100
96
|
* Connector Mutation
|
|
101
97
|
* -----------------------------------------------------------------------*/
|
|
102
|
-
async
|
|
103
|
-
|
|
98
|
+
async createUserConnectorMutation({
|
|
99
|
+
entityName,
|
|
104
100
|
payload
|
|
105
101
|
}) {
|
|
106
|
-
return
|
|
102
|
+
return createUserConnectorMutation({
|
|
107
103
|
axiosInstance: this.axiosInstance,
|
|
108
|
-
|
|
104
|
+
entityName,
|
|
109
105
|
payload
|
|
110
106
|
});
|
|
111
107
|
}
|
|
112
|
-
async
|
|
113
|
-
|
|
108
|
+
async deleteUserConnectorMutation({
|
|
109
|
+
connectorName
|
|
114
110
|
}) {
|
|
115
|
-
return
|
|
111
|
+
return deleteUserConnectorMutation({
|
|
116
112
|
axiosInstance: this.axiosInstance,
|
|
117
|
-
|
|
113
|
+
connectorName
|
|
118
114
|
});
|
|
119
115
|
}
|
|
120
|
-
async
|
|
116
|
+
async updateUserConnectorMutation({
|
|
121
117
|
payload
|
|
122
118
|
}) {
|
|
123
|
-
return
|
|
119
|
+
return updateUserConnectorMutation({
|
|
124
120
|
axiosInstance: this.axiosInstance,
|
|
125
121
|
payload
|
|
126
122
|
});
|
|
127
123
|
}
|
|
128
|
-
async
|
|
124
|
+
async renameUserConnector({
|
|
129
125
|
payload
|
|
130
126
|
}) {
|
|
131
|
-
return
|
|
127
|
+
return renameUserConnector({
|
|
132
128
|
axiosInstance: this.axiosInstance,
|
|
133
129
|
payload
|
|
134
130
|
});
|
|
@@ -136,28 +132,28 @@ var ConnectorClient = class {
|
|
|
136
132
|
/* -------------------------------------------------------------------------
|
|
137
133
|
* Connector Action
|
|
138
134
|
* -----------------------------------------------------------------------*/
|
|
139
|
-
async
|
|
140
|
-
|
|
135
|
+
async testUserConnectorConnectionAction({
|
|
136
|
+
connectorName
|
|
141
137
|
}) {
|
|
142
|
-
return
|
|
138
|
+
return testUserConnectorConnectionAction({
|
|
143
139
|
axiosInstance: this.axiosInstance,
|
|
144
|
-
|
|
140
|
+
connectorName
|
|
145
141
|
});
|
|
146
142
|
}
|
|
147
|
-
async
|
|
148
|
-
|
|
143
|
+
async connectUserConnectorAction({
|
|
144
|
+
connectorName
|
|
149
145
|
}) {
|
|
150
|
-
return
|
|
146
|
+
return connectUserConnectorAction({
|
|
151
147
|
axiosInstance: this.axiosInstance,
|
|
152
|
-
|
|
148
|
+
connectorName
|
|
153
149
|
});
|
|
154
150
|
}
|
|
155
|
-
async
|
|
156
|
-
|
|
151
|
+
async disconnectUserConnectorAction({
|
|
152
|
+
connectorName
|
|
157
153
|
}) {
|
|
158
|
-
return
|
|
154
|
+
return disconnectUserConnectorAction({
|
|
159
155
|
axiosInstance: this.axiosInstance,
|
|
160
|
-
|
|
156
|
+
connectorName
|
|
161
157
|
});
|
|
162
158
|
}
|
|
163
159
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/connector/action.ts
|
|
2
|
+
async function testUserConnectorConnectionAction({
|
|
3
|
+
axiosInstance,
|
|
4
|
+
connectorName
|
|
5
|
+
}) {
|
|
6
|
+
try {
|
|
7
|
+
const { data } = await axiosInstance.post(
|
|
8
|
+
`/${connectorName}/testConnection`
|
|
9
|
+
);
|
|
10
|
+
return Promise.resolve(data.state);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
return Promise.reject(err);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function connectUserConnectorAction({
|
|
16
|
+
axiosInstance,
|
|
17
|
+
connectorName
|
|
18
|
+
}) {
|
|
19
|
+
try {
|
|
20
|
+
const { data } = await axiosInstance.post(
|
|
21
|
+
`/${connectorName}/connect`
|
|
22
|
+
);
|
|
23
|
+
return Promise.resolve(data.connector);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
return Promise.reject(err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function disconnectUserConnectorAction({
|
|
29
|
+
axiosInstance,
|
|
30
|
+
connectorName
|
|
31
|
+
}) {
|
|
32
|
+
try {
|
|
33
|
+
const { data } = await axiosInstance.post(
|
|
34
|
+
`/${connectorName}/disconnect`
|
|
35
|
+
);
|
|
36
|
+
return Promise.resolve(data.connector);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return Promise.reject(err);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
testUserConnectorConnectionAction,
|
|
44
|
+
connectUserConnectorAction,
|
|
45
|
+
disconnectUserConnectorAction
|
|
46
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getQueryString
|
|
3
|
+
} from "./chunk-QG4SF5DT.mjs";
|
|
4
|
+
|
|
5
|
+
// src/organization/queries.ts
|
|
6
|
+
async function listOrganizationsQuery({
|
|
7
|
+
axiosInstance,
|
|
8
|
+
pageSize,
|
|
9
|
+
nextPageToken,
|
|
10
|
+
filter
|
|
11
|
+
}) {
|
|
12
|
+
try {
|
|
13
|
+
const organizations = [];
|
|
14
|
+
const queryString = getQueryString({
|
|
15
|
+
baseURL: "/organizations",
|
|
16
|
+
pageSize,
|
|
17
|
+
nextPageToken,
|
|
18
|
+
filter
|
|
19
|
+
});
|
|
20
|
+
const { data } = await axiosInstance.get(
|
|
21
|
+
queryString
|
|
22
|
+
);
|
|
23
|
+
organizations.push(...data.organizations);
|
|
24
|
+
if (data.next_page_token) {
|
|
25
|
+
organizations.push(
|
|
26
|
+
...await listOrganizationsQuery({
|
|
27
|
+
axiosInstance,
|
|
28
|
+
pageSize,
|
|
29
|
+
nextPageToken: data.next_page_token,
|
|
30
|
+
filter
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return Promise.resolve(organizations);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return Promise.reject(err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function getOrganizationQuery({
|
|
40
|
+
organizationID,
|
|
41
|
+
axiosInstance
|
|
42
|
+
}) {
|
|
43
|
+
try {
|
|
44
|
+
const { data } = await axiosInstance.get(
|
|
45
|
+
`/organizations/${organizationID}`
|
|
46
|
+
);
|
|
47
|
+
return Promise.resolve(data.organization);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
return Promise.reject(err);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function getOrganizationMembershipsQuery({
|
|
53
|
+
organizationID,
|
|
54
|
+
axiosInstance
|
|
55
|
+
}) {
|
|
56
|
+
try {
|
|
57
|
+
const { data } = await axiosInstance.get(
|
|
58
|
+
`/organizations/${organizationID}/memberships`
|
|
59
|
+
);
|
|
60
|
+
return Promise.resolve(data.memberships);
|
|
61
|
+
} catch (err) {
|
|
62
|
+
return Promise.reject(err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function getOrganizationMembershipQuery({
|
|
66
|
+
organizationID,
|
|
67
|
+
userID,
|
|
68
|
+
axiosInstance
|
|
69
|
+
}) {
|
|
70
|
+
try {
|
|
71
|
+
const { data } = await axiosInstance.get(
|
|
72
|
+
`/organizations/${organizationID}/memberships/${userID}`
|
|
73
|
+
);
|
|
74
|
+
return Promise.resolve(data.membership);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
return Promise.reject(err);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function getUserMembershipsQuery({
|
|
80
|
+
userID,
|
|
81
|
+
axiosInstance
|
|
82
|
+
}) {
|
|
83
|
+
try {
|
|
84
|
+
const { data } = await axiosInstance.get(
|
|
85
|
+
`users/${userID}/memberships`
|
|
86
|
+
);
|
|
87
|
+
return Promise.resolve(data.memberships);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
return Promise.reject(err);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function getUserMembershipQuery({
|
|
93
|
+
userID,
|
|
94
|
+
organizationID,
|
|
95
|
+
axiosInstance
|
|
96
|
+
}) {
|
|
97
|
+
try {
|
|
98
|
+
const { data } = await axiosInstance.get(
|
|
99
|
+
`users/${userID}/memberships/${organizationID}`
|
|
100
|
+
);
|
|
101
|
+
return Promise.resolve(data.memberships);
|
|
102
|
+
} catch (err) {
|
|
103
|
+
return Promise.reject(err);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
listOrganizationsQuery,
|
|
109
|
+
getOrganizationQuery,
|
|
110
|
+
getOrganizationMembershipsQuery,
|
|
111
|
+
getOrganizationMembershipQuery,
|
|
112
|
+
getUserMembershipsQuery,
|
|
113
|
+
getUserMembershipQuery
|
|
114
|
+
};
|
|
@@ -27,9 +27,26 @@ async function authValidateTokenAction(axiosInstance) {
|
|
|
27
27
|
return Promise.reject(err);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
async function checkNamespace({
|
|
31
|
+
id,
|
|
32
|
+
axiosInstance
|
|
33
|
+
}) {
|
|
34
|
+
try {
|
|
35
|
+
const { data } = await axiosInstance.post(
|
|
36
|
+
"/check-namespace",
|
|
37
|
+
{
|
|
38
|
+
id
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return Promise.resolve(data.type);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
return Promise.reject(err);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
30
46
|
|
|
31
47
|
export {
|
|
32
48
|
authLogoutAction,
|
|
33
49
|
authLoginAction,
|
|
34
|
-
authValidateTokenAction
|
|
50
|
+
authValidateTokenAction,
|
|
51
|
+
checkNamespace
|
|
35
52
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/connector/mutation.ts
|
|
2
|
+
async function createUserConnectorMutation({
|
|
3
|
+
entityName,
|
|
4
|
+
payload,
|
|
5
|
+
axiosInstance
|
|
6
|
+
}) {
|
|
7
|
+
try {
|
|
8
|
+
const res = await axiosInstance.post(
|
|
9
|
+
`${entityName}/connectors`,
|
|
10
|
+
payload
|
|
11
|
+
);
|
|
12
|
+
return Promise.resolve(res.data.connector);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
return Promise.reject(err);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function deleteUserConnectorMutation({
|
|
18
|
+
connectorName,
|
|
19
|
+
axiosInstance
|
|
20
|
+
}) {
|
|
21
|
+
try {
|
|
22
|
+
await axiosInstance.delete(`/${connectorName}`);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
return Promise.reject(err);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function updateUserConnectorMutation({
|
|
28
|
+
payload,
|
|
29
|
+
axiosInstance
|
|
30
|
+
}) {
|
|
31
|
+
try {
|
|
32
|
+
const res = await axiosInstance.patch(
|
|
33
|
+
`/${payload.connectorName}`,
|
|
34
|
+
{
|
|
35
|
+
...payload,
|
|
36
|
+
// connector name don't need to be sent to the server
|
|
37
|
+
connectorName: void 0
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
return Promise.resolve(res.data.connector);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
return Promise.reject(err);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function renameUserConnector({
|
|
46
|
+
payload,
|
|
47
|
+
axiosInstance
|
|
48
|
+
}) {
|
|
49
|
+
try {
|
|
50
|
+
const { data } = await axiosInstance.post(
|
|
51
|
+
`/${payload.connectorName}/rename`,
|
|
52
|
+
{
|
|
53
|
+
...payload,
|
|
54
|
+
// connector name don't need to be sent to the server
|
|
55
|
+
connectorName: void 0
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
return Promise.resolve(data.connector);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return Promise.reject(err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
createUserConnectorMutation,
|
|
66
|
+
deleteUserConnectorMutation,
|
|
67
|
+
updateUserConnectorMutation,
|
|
68
|
+
renameUserConnector
|
|
69
|
+
};
|