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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createOrganizationMutation,
|
|
3
|
+
deleteOrganizationMutation,
|
|
4
|
+
deleteUserMembershipMutation,
|
|
5
|
+
updateOrganizationMembershipMutation,
|
|
6
|
+
updateOrganizationMutation,
|
|
7
|
+
updateUserMembershipMutation
|
|
8
|
+
} from "./chunk-4BC7UGYC.mjs";
|
|
9
|
+
import {
|
|
10
|
+
getOrganizationMembershipQuery,
|
|
11
|
+
getOrganizationQuery,
|
|
12
|
+
getUserMembershipQuery,
|
|
13
|
+
getUserMembershipsQuery,
|
|
14
|
+
listOrganizationsQuery
|
|
15
|
+
} from "./chunk-6K6UDAWM.mjs";
|
|
16
|
+
|
|
17
|
+
// src/organization/OrganizationClient.ts
|
|
18
|
+
import axios from "axios";
|
|
19
|
+
var OrganizationClient = class {
|
|
20
|
+
axiosInstance;
|
|
21
|
+
constructor(baseUrl, appVersion, apiToken) {
|
|
22
|
+
let URL = `${baseUrl}/core/${appVersion}`;
|
|
23
|
+
this.axiosInstance = axios.create({
|
|
24
|
+
baseURL: URL,
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${apiToken}`
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/* -------------------------------------------------------------------------
|
|
31
|
+
* Organization Queries
|
|
32
|
+
* -----------------------------------------------------------------------*/
|
|
33
|
+
async listOrganizationsQuery({
|
|
34
|
+
pageSize,
|
|
35
|
+
nextPageToken,
|
|
36
|
+
filter
|
|
37
|
+
}) {
|
|
38
|
+
return listOrganizationsQuery({
|
|
39
|
+
axiosInstance: this.axiosInstance,
|
|
40
|
+
pageSize,
|
|
41
|
+
nextPageToken,
|
|
42
|
+
filter
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async getOrganizationQuery(organizationID) {
|
|
46
|
+
return getOrganizationQuery({
|
|
47
|
+
axiosInstance: this.axiosInstance,
|
|
48
|
+
organizationID
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async getOrganizationMembershipsQuery(organizationID) {
|
|
52
|
+
return getOrganizationQuery({
|
|
53
|
+
axiosInstance: this.axiosInstance,
|
|
54
|
+
organizationID
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async getOrganizationMembershipQuery({
|
|
58
|
+
organizationID,
|
|
59
|
+
userID
|
|
60
|
+
}) {
|
|
61
|
+
return getOrganizationMembershipQuery({
|
|
62
|
+
axiosInstance: this.axiosInstance,
|
|
63
|
+
organizationID,
|
|
64
|
+
userID
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async getUserMembershipsQuery({ userID }) {
|
|
68
|
+
return getUserMembershipsQuery({
|
|
69
|
+
axiosInstance: this.axiosInstance,
|
|
70
|
+
userID
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async getUserMembershipQuery({
|
|
74
|
+
userID,
|
|
75
|
+
organizationID
|
|
76
|
+
}) {
|
|
77
|
+
return getUserMembershipQuery({
|
|
78
|
+
axiosInstance: this.axiosInstance,
|
|
79
|
+
userID,
|
|
80
|
+
organizationID
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/* -------------------------------------------------------------------------
|
|
84
|
+
* Organization Mutation
|
|
85
|
+
* -----------------------------------------------------------------------*/
|
|
86
|
+
async createOrganizationMutation({
|
|
87
|
+
payload
|
|
88
|
+
}) {
|
|
89
|
+
return createOrganizationMutation({
|
|
90
|
+
axiosInstance: this.axiosInstance,
|
|
91
|
+
payload
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async updateOrganizationMutation({
|
|
95
|
+
payload
|
|
96
|
+
}) {
|
|
97
|
+
return updateOrganizationMutation({
|
|
98
|
+
axiosInstance: this.axiosInstance,
|
|
99
|
+
payload
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async updateOrganizationMembershipMutation({
|
|
103
|
+
payload
|
|
104
|
+
}) {
|
|
105
|
+
return updateOrganizationMembershipMutation({
|
|
106
|
+
axiosInstance: this.axiosInstance,
|
|
107
|
+
payload
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async deleteOrganizationMutation({
|
|
111
|
+
organizationName
|
|
112
|
+
}) {
|
|
113
|
+
return deleteOrganizationMutation({
|
|
114
|
+
axiosInstance: this.axiosInstance,
|
|
115
|
+
organizationName
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async deleteUserMembershipMutation({
|
|
119
|
+
organizationID,
|
|
120
|
+
userID
|
|
121
|
+
}) {
|
|
122
|
+
return deleteUserMembershipMutation({
|
|
123
|
+
axiosInstance: this.axiosInstance,
|
|
124
|
+
organizationID,
|
|
125
|
+
userID
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async updateUserMembershipMutation({
|
|
129
|
+
payload
|
|
130
|
+
}) {
|
|
131
|
+
return updateUserMembershipMutation({
|
|
132
|
+
axiosInstance: this.axiosInstance,
|
|
133
|
+
payload
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
var OrganizationClient_default = OrganizationClient;
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
OrganizationClient_default
|
|
141
|
+
};
|
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getQueryString
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QG4SF5DT.mjs";
|
|
4
4
|
|
|
5
5
|
// src/pipeline/queries.ts
|
|
6
|
-
async function listPipelinesQuery({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
async function listPipelinesQuery(props) {
|
|
7
|
+
const {
|
|
8
|
+
pageSize,
|
|
9
|
+
nextPageToken,
|
|
10
|
+
axiosInstance,
|
|
11
|
+
enablePagination,
|
|
12
|
+
visibility
|
|
13
|
+
} = props;
|
|
11
14
|
try {
|
|
12
15
|
const pipelines = [];
|
|
13
16
|
const queryString = getQueryString({
|
|
14
17
|
baseURL: "/pipelines?view=VIEW_FULL",
|
|
15
18
|
pageSize,
|
|
16
19
|
nextPageToken,
|
|
17
|
-
|
|
20
|
+
queryParams: visibility ? `visibility=${visibility}` : void 0
|
|
18
21
|
});
|
|
19
22
|
const { data } = await axiosInstance.get(
|
|
20
23
|
queryString
|
|
21
24
|
);
|
|
25
|
+
if (enablePagination) {
|
|
26
|
+
return Promise.resolve(data);
|
|
27
|
+
}
|
|
22
28
|
pipelines.push(...data.pipelines);
|
|
23
29
|
if (data.next_page_token) {
|
|
24
30
|
pipelines.push(
|
|
25
31
|
...await listPipelinesQuery({
|
|
26
|
-
axiosInstance,
|
|
27
32
|
pageSize,
|
|
28
|
-
nextPageToken: data.next_page_token
|
|
33
|
+
nextPageToken: data.next_page_token,
|
|
34
|
+
axiosInstance,
|
|
35
|
+
enablePagination: false
|
|
29
36
|
})
|
|
30
37
|
);
|
|
31
38
|
}
|
|
@@ -34,12 +41,8 @@ async function listPipelinesQuery({
|
|
|
34
41
|
return Promise.reject(err);
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
|
-
async function listUserPipelinesQuery({
|
|
38
|
-
axiosInstance,
|
|
39
|
-
pageSize,
|
|
40
|
-
nextPageToken,
|
|
41
|
-
userName
|
|
42
|
-
}) {
|
|
44
|
+
async function listUserPipelinesQuery(props) {
|
|
45
|
+
const { pageSize, nextPageToken, axiosInstance, userName, enablePagination } = props;
|
|
43
46
|
try {
|
|
44
47
|
const pipelines = [];
|
|
45
48
|
const queryString = getQueryString({
|
|
@@ -51,14 +54,18 @@ async function listUserPipelinesQuery({
|
|
|
51
54
|
const { data } = await axiosInstance.get(
|
|
52
55
|
queryString
|
|
53
56
|
);
|
|
57
|
+
if (enablePagination) {
|
|
58
|
+
return Promise.resolve(data);
|
|
59
|
+
}
|
|
54
60
|
pipelines.push(...data.pipelines);
|
|
55
61
|
if (data.next_page_token) {
|
|
56
62
|
pipelines.push(
|
|
57
63
|
...await listUserPipelinesQuery({
|
|
58
|
-
axiosInstance,
|
|
59
64
|
pageSize,
|
|
60
65
|
nextPageToken: data.next_page_token,
|
|
61
|
-
userName
|
|
66
|
+
userName,
|
|
67
|
+
axiosInstance,
|
|
68
|
+
enablePagination: false
|
|
62
69
|
})
|
|
63
70
|
);
|
|
64
71
|
}
|
|
@@ -68,23 +75,32 @@ async function listUserPipelinesQuery({
|
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
async function getUserPipelineQuery({
|
|
78
|
+
pipelineName,
|
|
71
79
|
axiosInstance,
|
|
72
|
-
|
|
80
|
+
shareCode
|
|
73
81
|
}) {
|
|
74
82
|
try {
|
|
75
83
|
const { data } = await axiosInstance.get(
|
|
76
|
-
`/${pipelineName}?view=VIEW_FULL
|
|
84
|
+
`/${pipelineName}?view=VIEW_FULL`,
|
|
85
|
+
{
|
|
86
|
+
headers: {
|
|
87
|
+
"instill-share-code": shareCode,
|
|
88
|
+
"Access-Control-Allow-Headers": shareCode ? "instill-share-code" : void 0,
|
|
89
|
+
"Content-Type": "application/json"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
77
92
|
);
|
|
78
93
|
return Promise.resolve(data.pipeline);
|
|
79
94
|
} catch (err) {
|
|
80
95
|
return Promise.reject(err);
|
|
81
96
|
}
|
|
82
97
|
}
|
|
83
|
-
async function
|
|
84
|
-
axiosInstance,
|
|
98
|
+
async function ListUserPipelineReleasesQuery({
|
|
85
99
|
pipelineName,
|
|
86
100
|
pageSize,
|
|
87
|
-
nextPageToken
|
|
101
|
+
nextPageToken,
|
|
102
|
+
axiosInstance,
|
|
103
|
+
shareCode
|
|
88
104
|
}) {
|
|
89
105
|
try {
|
|
90
106
|
const releases = [];
|
|
@@ -95,16 +111,24 @@ async function listUserPipelineReleasesQuery({
|
|
|
95
111
|
filter: null
|
|
96
112
|
});
|
|
97
113
|
const { data } = await axiosInstance.get(
|
|
98
|
-
queryString
|
|
114
|
+
queryString,
|
|
115
|
+
{
|
|
116
|
+
headers: {
|
|
117
|
+
"instill-share-code": shareCode,
|
|
118
|
+
"Access-Control-Allow-Headers": shareCode ? "instill-share-code" : void 0,
|
|
119
|
+
"Content-Type": "application/json"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
99
122
|
);
|
|
100
123
|
releases.push(...data.releases);
|
|
101
124
|
if (data.next_page_token) {
|
|
102
125
|
releases.push(
|
|
103
|
-
...await
|
|
104
|
-
axiosInstance,
|
|
126
|
+
...await ListUserPipelineReleasesQuery({
|
|
105
127
|
pipelineName,
|
|
106
128
|
pageSize,
|
|
107
|
-
nextPageToken: data.next_page_token
|
|
129
|
+
nextPageToken: data.next_page_token,
|
|
130
|
+
axiosInstance,
|
|
131
|
+
shareCode
|
|
108
132
|
})
|
|
109
133
|
);
|
|
110
134
|
}
|
|
@@ -114,8 +138,8 @@ async function listUserPipelineReleasesQuery({
|
|
|
114
138
|
}
|
|
115
139
|
}
|
|
116
140
|
async function getUserPipelineReleaseQuery({
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
pipelineReleaseName,
|
|
142
|
+
axiosInstance
|
|
119
143
|
}) {
|
|
120
144
|
try {
|
|
121
145
|
const { data } = await axiosInstance.get(
|
|
@@ -127,8 +151,8 @@ async function getUserPipelineReleaseQuery({
|
|
|
127
151
|
}
|
|
128
152
|
}
|
|
129
153
|
async function watchUserPipelineReleaseQuery({
|
|
130
|
-
|
|
131
|
-
|
|
154
|
+
pipelineReleaseName,
|
|
155
|
+
axiosInstance
|
|
132
156
|
}) {
|
|
133
157
|
try {
|
|
134
158
|
const { data } = await axiosInstance.get(
|
|
@@ -139,12 +163,60 @@ async function watchUserPipelineReleaseQuery({
|
|
|
139
163
|
return Promise.reject(err);
|
|
140
164
|
}
|
|
141
165
|
}
|
|
166
|
+
async function listOperatorDefinitionsQuery({
|
|
167
|
+
pageSize,
|
|
168
|
+
nextPageToken,
|
|
169
|
+
axiosInstance,
|
|
170
|
+
filter
|
|
171
|
+
}) {
|
|
172
|
+
try {
|
|
173
|
+
const operatorDefinitions = [];
|
|
174
|
+
const queryString = getQueryString({
|
|
175
|
+
baseURL: `/operator-definitions?view=VIEW_FULL`,
|
|
176
|
+
pageSize,
|
|
177
|
+
nextPageToken,
|
|
178
|
+
filter
|
|
179
|
+
});
|
|
180
|
+
const { data } = await axiosInstance.get(
|
|
181
|
+
queryString
|
|
182
|
+
);
|
|
183
|
+
operatorDefinitions.push(...data.operator_definitions);
|
|
184
|
+
if (data.next_page_token) {
|
|
185
|
+
operatorDefinitions.push(
|
|
186
|
+
...await listOperatorDefinitionsQuery({
|
|
187
|
+
pageSize,
|
|
188
|
+
axiosInstance,
|
|
189
|
+
nextPageToken: data.next_page_token,
|
|
190
|
+
filter
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
return Promise.resolve(operatorDefinitions);
|
|
195
|
+
} catch (err) {
|
|
196
|
+
return Promise.reject(err);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async function getOperatorDefinitionQuery({
|
|
200
|
+
operatorDefinitionName,
|
|
201
|
+
axiosInstance
|
|
202
|
+
}) {
|
|
203
|
+
try {
|
|
204
|
+
const { data } = await axiosInstance.get(
|
|
205
|
+
`/${operatorDefinitionName}?view=VIEW_FULL`
|
|
206
|
+
);
|
|
207
|
+
return Promise.resolve(data.operator_definition);
|
|
208
|
+
} catch (err) {
|
|
209
|
+
return Promise.reject(err);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
142
212
|
|
|
143
213
|
export {
|
|
144
214
|
listPipelinesQuery,
|
|
145
215
|
listUserPipelinesQuery,
|
|
146
216
|
getUserPipelineQuery,
|
|
147
|
-
|
|
217
|
+
ListUserPipelineReleasesQuery,
|
|
148
218
|
getUserPipelineReleaseQuery,
|
|
149
|
-
watchUserPipelineReleaseQuery
|
|
219
|
+
watchUserPipelineReleaseQuery,
|
|
220
|
+
listOperatorDefinitionsQuery,
|
|
221
|
+
getOperatorDefinitionQuery
|
|
150
222
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/pipeline/action.ts
|
|
2
2
|
async function triggerUserPipelineAction({
|
|
3
|
-
axiosInstance,
|
|
4
3
|
pipelineName,
|
|
5
4
|
payload,
|
|
6
|
-
|
|
5
|
+
axiosInstance,
|
|
6
|
+
returnTraces,
|
|
7
|
+
shareCode
|
|
7
8
|
}) {
|
|
8
9
|
try {
|
|
9
10
|
const { data } = await axiosInstance.post(
|
|
@@ -12,7 +13,8 @@ async function triggerUserPipelineAction({
|
|
|
12
13
|
{
|
|
13
14
|
headers: {
|
|
14
15
|
"instill-return-traces": returnTraces ? "true" : "false",
|
|
15
|
-
"
|
|
16
|
+
"instill-share-code": shareCode,
|
|
17
|
+
"Access-Control-Allow-Headers": "instill-return-traces, instill-share-code",
|
|
16
18
|
"Content-Type": "application/json"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -23,9 +25,9 @@ async function triggerUserPipelineAction({
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
async function triggerAsyncUserPipelineAction({
|
|
26
|
-
axiosInstance,
|
|
27
28
|
pipelineName,
|
|
28
29
|
payload,
|
|
30
|
+
axiosInstance,
|
|
29
31
|
returnTraces
|
|
30
32
|
}) {
|
|
31
33
|
try {
|
|
@@ -46,8 +48,8 @@ async function triggerAsyncUserPipelineAction({
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
async function setDefaultUserPipelineReleaseMutation({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
pipelineReleaseName,
|
|
52
|
+
axiosInstance
|
|
51
53
|
}) {
|
|
52
54
|
try {
|
|
53
55
|
const { data } = await axiosInstance.post(
|
|
@@ -59,8 +61,8 @@ async function setDefaultUserPipelineReleaseMutation({
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
async function restoreUserPipelineReleaseMutation({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
pipelineReleaseName,
|
|
65
|
+
axiosInstance
|
|
64
66
|
}) {
|
|
65
67
|
try {
|
|
66
68
|
const { data } = await axiosInstance.post(
|
|
@@ -72,9 +74,9 @@ async function restoreUserPipelineReleaseMutation({
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
async function triggerUserPipelineReleaseAction({
|
|
75
|
-
axiosInstance,
|
|
76
77
|
pipelineReleaseName,
|
|
77
78
|
payload,
|
|
79
|
+
axiosInstance,
|
|
78
80
|
returnTraces
|
|
79
81
|
}) {
|
|
80
82
|
try {
|
|
@@ -95,9 +97,9 @@ async function triggerUserPipelineReleaseAction({
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
async function triggerAsyncUserPipelineReleaseAction({
|
|
98
|
-
axiosInstance,
|
|
99
100
|
pipelineReleaseName,
|
|
100
101
|
payload,
|
|
102
|
+
axiosInstance,
|
|
101
103
|
returnTraces
|
|
102
104
|
}) {
|
|
103
105
|
try {
|
|
@@ -108,7 +110,7 @@ async function triggerAsyncUserPipelineReleaseAction({
|
|
|
108
110
|
headers: {
|
|
109
111
|
"instill-return-traces": returnTraces ? "true" : "false",
|
|
110
112
|
"Access-Control-Allow-Headers": "instill-return-traces",
|
|
111
|
-
"Content-Type": "application
|
|
113
|
+
"Content-Type": "application/json"
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getQueryString
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QG4SF5DT.mjs";
|
|
4
4
|
|
|
5
5
|
// src/mgmt/queries.ts
|
|
6
|
-
async function
|
|
6
|
+
async function getUserMeQuery(axiosInstance) {
|
|
7
7
|
try {
|
|
8
8
|
const { data } = await axiosInstance.get("/users/me");
|
|
9
9
|
return Promise.resolve(data.user);
|
|
@@ -11,6 +11,17 @@ async function getUserQuery(axiosInstance) {
|
|
|
11
11
|
return Promise.reject(err);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
async function getUserQuery({
|
|
15
|
+
userName,
|
|
16
|
+
axiosInstance
|
|
17
|
+
}) {
|
|
18
|
+
try {
|
|
19
|
+
const { data } = await axiosInstance.get(`/${userName}`);
|
|
20
|
+
return Promise.resolve(data.user);
|
|
21
|
+
} catch (err) {
|
|
22
|
+
return Promise.reject(err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
14
25
|
async function checkUserIdExist({
|
|
15
26
|
axiosInstance,
|
|
16
27
|
id
|
|
@@ -68,10 +79,41 @@ async function listApiTokensQuery({
|
|
|
68
79
|
return Promise.reject(err);
|
|
69
80
|
}
|
|
70
81
|
}
|
|
82
|
+
async function listUsersQuery({
|
|
83
|
+
pageSize,
|
|
84
|
+
nextPageToken,
|
|
85
|
+
axiosInstance
|
|
86
|
+
}) {
|
|
87
|
+
try {
|
|
88
|
+
const users = [];
|
|
89
|
+
const queryString = getQueryString({
|
|
90
|
+
baseURL: "/users",
|
|
91
|
+
pageSize,
|
|
92
|
+
nextPageToken,
|
|
93
|
+
filter: null
|
|
94
|
+
});
|
|
95
|
+
const { data } = await axiosInstance.get(queryString);
|
|
96
|
+
users.push(...data.users);
|
|
97
|
+
if (data.next_page_token) {
|
|
98
|
+
users.push(
|
|
99
|
+
...await listUsersQuery({
|
|
100
|
+
pageSize,
|
|
101
|
+
axiosInstance,
|
|
102
|
+
nextPageToken: data.next_page_token
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve(users);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
return Promise.reject(err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
71
111
|
|
|
72
112
|
export {
|
|
113
|
+
getUserMeQuery,
|
|
73
114
|
getUserQuery,
|
|
74
115
|
checkUserIdExist,
|
|
75
116
|
getApiTokenQuery,
|
|
76
|
-
listApiTokensQuery
|
|
117
|
+
listApiTokensQuery,
|
|
118
|
+
listUsersQuery
|
|
77
119
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
authLoginAction,
|
|
3
3
|
authLogoutAction,
|
|
4
|
-
authValidateTokenAction
|
|
5
|
-
|
|
4
|
+
authValidateTokenAction,
|
|
5
|
+
checkNamespace
|
|
6
|
+
} from "./chunk-7VLTGUGU.mjs";
|
|
6
7
|
import {
|
|
7
8
|
changePasswordMutation,
|
|
8
9
|
createApiTokenMutation,
|
|
@@ -12,9 +13,10 @@ import {
|
|
|
12
13
|
import {
|
|
13
14
|
checkUserIdExist,
|
|
14
15
|
getApiTokenQuery,
|
|
16
|
+
getUserMeQuery,
|
|
15
17
|
getUserQuery,
|
|
16
18
|
listApiTokensQuery
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KV3GJM6Q.mjs";
|
|
18
20
|
|
|
19
21
|
// src/mgmt/AuthClient.ts
|
|
20
22
|
import axios from "axios";
|
|
@@ -32,8 +34,14 @@ var AuthClient = class {
|
|
|
32
34
|
/* -------------------------------------------------------------------------
|
|
33
35
|
* MGMT Queries
|
|
34
36
|
* -----------------------------------------------------------------------*/
|
|
35
|
-
async
|
|
36
|
-
return
|
|
37
|
+
async getUserMeQuery() {
|
|
38
|
+
return getUserMeQuery(this.axiosInstance);
|
|
39
|
+
}
|
|
40
|
+
async getUserQuery({ userName }) {
|
|
41
|
+
return getUserQuery({
|
|
42
|
+
axiosInstance: this.axiosInstance,
|
|
43
|
+
userName
|
|
44
|
+
});
|
|
37
45
|
}
|
|
38
46
|
async checkUserIdExist({ id }) {
|
|
39
47
|
return checkUserIdExist({ axiosInstance: this.axiosInstance, id });
|
|
@@ -103,6 +111,9 @@ var AuthClient = class {
|
|
|
103
111
|
async authValidateTokenAction() {
|
|
104
112
|
return authValidateTokenAction(this.axiosInstance);
|
|
105
113
|
}
|
|
114
|
+
async checkNamespace({ id }) {
|
|
115
|
+
return checkNamespace({ axiosInstance: this.axiosInstance, id });
|
|
116
|
+
}
|
|
106
117
|
};
|
|
107
118
|
var AuthClient_default = AuthClient;
|
|
108
119
|
|
|
@@ -3,7 +3,8 @@ var getQueryString = ({
|
|
|
3
3
|
baseURL,
|
|
4
4
|
pageSize,
|
|
5
5
|
nextPageToken,
|
|
6
|
-
filter
|
|
6
|
+
filter,
|
|
7
|
+
queryParams
|
|
7
8
|
}) => {
|
|
8
9
|
let url = baseURL;
|
|
9
10
|
if (pageSize || nextPageToken || filter) {
|
|
@@ -22,6 +23,9 @@ var getQueryString = ({
|
|
|
22
23
|
if (filter) {
|
|
23
24
|
url += `filter=${filter}&`;
|
|
24
25
|
}
|
|
26
|
+
if (queryParams) {
|
|
27
|
+
url += `${queryParams}&`;
|
|
28
|
+
}
|
|
25
29
|
if (url.endsWith("&")) {
|
|
26
30
|
url = url.slice(0, -1);
|
|
27
31
|
}
|