instill-sdk 0.0.2 → 0.0.4
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 +62 -42
- package/dist/{chunk-3VVR3XHW.mjs → chunk-3NVQTT4B.mjs} +5 -5
- package/dist/chunk-4BC7UGYC.mjs +114 -0
- package/dist/chunk-4CRJTVPW.mjs +132 -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-DIAPO2ML.mjs → chunk-LIXOPQVC.mjs} +20 -9
- package/dist/{chunk-EBWGEVUX.mjs → chunk-QG4SF5DT.mjs} +5 -1
- package/dist/{chunk-GPM5FDRS.mjs → chunk-SFKHRD33.mjs} +18 -18
- 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 +36 -50
- 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 +573 -143
- package/dist/index.mjs +55 -20
- 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 +9 -3
- package/dist/mgmt/AuthClient.js +51 -11
- package/dist/mgmt/AuthClient.mjs +5 -5
- 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.d.ts +0 -1
- package/dist/mgmt/index.mjs +6 -7
- package/dist/mgmt/mutation.d.ts +4 -4
- package/dist/mgmt/mutation.js +6 -6
- package/dist/mgmt/mutation.mjs +3 -3
- package/dist/mgmt/queries.d.ts +14 -2
- package/dist/mgmt/queries.js +67 -5
- package/dist/mgmt/queries.mjs +10 -4
- package/dist/mgmt/types.d.ts +62 -1
- package/dist/mgmt/types.mjs +0 -1
- 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 +2 -0
- package/dist/organization/index.js +310 -0
- package/dist/organization/index.mjs +40 -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 +0 -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 +89 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +53 -2
- package/package.json +1 -2
- package/dist/chunk-6M57XUNI.mjs +0 -64
- package/dist/chunk-VIPORJ6H.mjs +0 -77
- package/dist/chunk-YT6ZGA4J.mjs +0 -46
- /package/dist/{chunk-JY37AKV6.mjs → chunk-IESWEQM7.mjs} +0 -0
- /package/dist/{chunk-VASX6R4R.mjs → chunk-ZVLPH226.mjs} +0 -0
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
|
|
@@ -341,15 +359,17 @@ client.AuthClient.createApiTokenMutation({
|
|
|
341
359
|
|
|
342
360
|
```
|
|
343
361
|
|
|
344
|
-
| function
|
|
345
|
-
| :---------------------
|
|
346
|
-
| getUserQuery
|
|
347
|
-
|
|
|
348
|
-
|
|
|
349
|
-
|
|
|
350
|
-
|
|
|
351
|
-
|
|
|
352
|
-
|
|
|
362
|
+
| function | params |
|
|
363
|
+
| :--------------------- | :---------------------: |
|
|
364
|
+
| getUserQuery | userName |
|
|
365
|
+
| getAuthenticatedUserQuery | |
|
|
366
|
+
| checkUserIdExist | id |
|
|
367
|
+
| getApiTokenQuery | tokenName |
|
|
368
|
+
| listApiTokensQuery | pageSize, nextPageToken |
|
|
369
|
+
| updateAuthenticatedUserMutation | payload |
|
|
370
|
+
| createApiTokenMutation | payload |
|
|
371
|
+
| deleteApiTokenMutation | tokenName |
|
|
372
|
+
| checkNamespace | id |
|
|
353
373
|
|
|
354
374
|
## Contribution Guidelines:
|
|
355
375
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/mgmt/mutation.ts
|
|
2
|
-
async function
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
async function updateAuthenticatedUserMutation({
|
|
3
|
+
payload,
|
|
4
|
+
axiosInstance
|
|
5
5
|
}) {
|
|
6
6
|
try {
|
|
7
7
|
const { data } = await axiosInstance.patch(
|
|
8
|
-
"/
|
|
8
|
+
"/user",
|
|
9
9
|
payload
|
|
10
10
|
);
|
|
11
11
|
return Promise.resolve(data.user);
|
|
@@ -49,7 +49,7 @@ async function changePasswordMutation({
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export {
|
|
52
|
-
|
|
52
|
+
updateAuthenticatedUserMutation,
|
|
53
53
|
createApiTokenMutation,
|
|
54
54
|
deleteApiTokenMutation,
|
|
55
55
|
changePasswordMutation
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getQueryString
|
|
3
|
+
} from "./chunk-QG4SF5DT.mjs";
|
|
4
|
+
|
|
5
|
+
// src/mgmt/queries.ts
|
|
6
|
+
async function getAuthenticatedUserQuery(axiosInstance) {
|
|
7
|
+
try {
|
|
8
|
+
const { data } = await axiosInstance.get("/user");
|
|
9
|
+
return Promise.resolve(data.user);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
return Promise.reject(err);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function getAuthenticatedUserSubscriptionsQuery({
|
|
15
|
+
axiosInstance
|
|
16
|
+
}) {
|
|
17
|
+
try {
|
|
18
|
+
const { data } = await axiosInstance.get(
|
|
19
|
+
"/user/subscription"
|
|
20
|
+
);
|
|
21
|
+
return Promise.resolve(data.subscription);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
return Promise.reject(err);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function getUserQuery({
|
|
27
|
+
userName,
|
|
28
|
+
axiosInstance
|
|
29
|
+
}) {
|
|
30
|
+
try {
|
|
31
|
+
const { data } = await axiosInstance.get(`/${userName}`);
|
|
32
|
+
return Promise.resolve(data.user);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
return Promise.reject(err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function checkUserIdExist({
|
|
38
|
+
axiosInstance,
|
|
39
|
+
id
|
|
40
|
+
}) {
|
|
41
|
+
try {
|
|
42
|
+
const { data } = await axiosInstance.get(
|
|
43
|
+
`/users/${id}/exist`
|
|
44
|
+
);
|
|
45
|
+
return Promise.resolve(data.exists);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
return Promise.reject(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function getApiTokenQuery({
|
|
51
|
+
axiosInstance,
|
|
52
|
+
tokenName
|
|
53
|
+
}) {
|
|
54
|
+
try {
|
|
55
|
+
const { data } = await axiosInstance.get(
|
|
56
|
+
`/${tokenName}`
|
|
57
|
+
);
|
|
58
|
+
return Promise.resolve(data.token);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return Promise.reject(err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function listApiTokensQuery({
|
|
64
|
+
axiosInstance,
|
|
65
|
+
pageSize,
|
|
66
|
+
nextPageToken
|
|
67
|
+
}) {
|
|
68
|
+
try {
|
|
69
|
+
const tokens = [];
|
|
70
|
+
const queryString = getQueryString({
|
|
71
|
+
baseURL: "/tokens",
|
|
72
|
+
pageSize,
|
|
73
|
+
nextPageToken,
|
|
74
|
+
filter: null
|
|
75
|
+
});
|
|
76
|
+
const { data } = await axiosInstance.get(
|
|
77
|
+
queryString
|
|
78
|
+
);
|
|
79
|
+
tokens.push(...data.tokens);
|
|
80
|
+
if (data.next_page_token) {
|
|
81
|
+
tokens.push(
|
|
82
|
+
...await listApiTokensQuery({
|
|
83
|
+
axiosInstance,
|
|
84
|
+
pageSize,
|
|
85
|
+
nextPageToken: data.next_page_token
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return Promise.resolve(tokens);
|
|
90
|
+
} catch (err) {
|
|
91
|
+
return Promise.reject(err);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function listUsersQuery({
|
|
95
|
+
pageSize,
|
|
96
|
+
nextPageToken,
|
|
97
|
+
axiosInstance
|
|
98
|
+
}) {
|
|
99
|
+
try {
|
|
100
|
+
const users = [];
|
|
101
|
+
const queryString = getQueryString({
|
|
102
|
+
baseURL: "/users",
|
|
103
|
+
pageSize,
|
|
104
|
+
nextPageToken,
|
|
105
|
+
filter: null
|
|
106
|
+
});
|
|
107
|
+
const { data } = await axiosInstance.get(queryString);
|
|
108
|
+
users.push(...data.users);
|
|
109
|
+
if (data.next_page_token) {
|
|
110
|
+
users.push(
|
|
111
|
+
...await listUsersQuery({
|
|
112
|
+
pageSize,
|
|
113
|
+
axiosInstance,
|
|
114
|
+
nextPageToken: data.next_page_token
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return Promise.resolve(users);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
return Promise.reject(err);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
getAuthenticatedUserQuery,
|
|
126
|
+
getAuthenticatedUserSubscriptionsQuery,
|
|
127
|
+
getUserQuery,
|
|
128
|
+
checkUserIdExist,
|
|
129
|
+
getApiTokenQuery,
|
|
130
|
+
listApiTokensQuery,
|
|
131
|
+
listUsersQuery
|
|
132
|
+
};
|
|
@@ -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
|
+
};
|