instill-sdk 0.0.1
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 +369 -0
- package/dist/chunk-2VZRNT6D.mjs +0 -0
- package/dist/chunk-3VVR3XHW.mjs +56 -0
- package/dist/chunk-42SCMPQP.mjs +0 -0
- package/dist/chunk-4KLHN5HK.mjs +0 -0
- package/dist/chunk-4TKUHGUZ.mjs +244 -0
- package/dist/chunk-4VWYH26Q.mjs +145 -0
- package/dist/chunk-6M57XUNI.mjs +64 -0
- package/dist/chunk-6NTCWRRC.mjs +0 -0
- package/dist/chunk-6ZXT6X3H.mjs +0 -0
- package/dist/chunk-73EPIL2R.mjs +0 -0
- package/dist/chunk-7KV3Y36U.mjs +17 -0
- package/dist/chunk-D5OKZ665.mjs +32 -0
- package/dist/chunk-DXEIDDIA.mjs +32 -0
- package/dist/chunk-EBWGEVUX.mjs +33 -0
- package/dist/chunk-ECC5KF6S.mjs +150 -0
- package/dist/chunk-EHG2FVLQ.mjs +0 -0
- package/dist/chunk-EXJ4UK7Q.mjs +49 -0
- package/dist/chunk-FAXYADOP.mjs +0 -0
- package/dist/chunk-FNCXOA62.mjs +0 -0
- package/dist/chunk-GPM5FDRS.mjs +154 -0
- package/dist/chunk-IB43VC55.mjs +41 -0
- package/dist/chunk-IPW3WQCQ.mjs +35 -0
- package/dist/chunk-IWAQMUMR.mjs +42 -0
- package/dist/chunk-JONZWFL5.mjs +168 -0
- package/dist/chunk-JTTE7IZY.mjs +14 -0
- package/dist/chunk-JY37AKV6.mjs +0 -0
- package/dist/chunk-KCKTAMXW.mjs +0 -0
- package/dist/chunk-KHFNAMT4.mjs +160 -0
- package/dist/chunk-NRP5M7FG.mjs +128 -0
- package/dist/chunk-QLWRKSUE.mjs +104 -0
- package/dist/chunk-QV7PYP7E.mjs +0 -0
- package/dist/chunk-QZOKJQTL.mjs +102 -0
- package/dist/chunk-RVRM4NPL.mjs +29 -0
- package/dist/chunk-VASX6R4R.mjs +0 -0
- package/dist/chunk-VIPORJ6H.mjs +77 -0
- package/dist/chunk-WBQAMGXK.mjs +0 -0
- package/dist/chunk-WL54JNC6.mjs +64 -0
- package/dist/chunk-WLPBUHMI.mjs +0 -0
- package/dist/chunk-YT6ZGA4J.mjs +46 -0
- package/dist/chunk-YXNMG2RZ.mjs +98 -0
- package/dist/chunk-ZRC43MN3.mjs +111 -0
- package/dist/chunk-magic-string.3a794426-OWTMMGNR.mjs +1253 -0
- package/dist/connector/ConnectorClient.d.ts +54 -0
- package/dist/connector/ConnectorClient.js +457 -0
- package/dist/connector/ConnectorClient.mjs +16 -0
- package/dist/connector/action.d.ts +13 -0
- package/dist/connector/action.js +72 -0
- package/dist/connector/action.mjs +11 -0
- package/dist/connector/index.d.ts +2 -0
- package/dist/connector/index.js +37 -0
- package/dist/connector/index.mjs +13 -0
- package/dist/connector/mutation.d.ts +19 -0
- package/dist/connector/mutation.js +91 -0
- package/dist/connector/mutation.mjs +13 -0
- package/dist/connector/queries.d.ts +34 -0
- package/dist/connector/queries.js +227 -0
- package/dist/connector/queries.mjs +23 -0
- package/dist/connector/types.d.ts +102 -0
- package/dist/connector/types.js +18 -0
- package/dist/connector/types.mjs +1 -0
- package/dist/helper/axiosInstance.d.ts +3 -0
- package/dist/helper/axiosInstance.js +44 -0
- package/dist/helper/axiosInstance.mjs +7 -0
- package/dist/helper/config.d.ts +1 -0
- package/dist/helper/config.js +53 -0
- package/dist/helper/config.mjs +7 -0
- package/dist/helper/createClient.d.ts +2 -0
- package/dist/helper/createClient.js +90 -0
- package/dist/helper/createClient.mjs +8 -0
- package/dist/helper/getInstillApiErrorMessage.d.ts +2 -0
- package/dist/helper/getInstillApiErrorMessage.js +41 -0
- package/dist/helper/getInstillApiErrorMessage.mjs +7 -0
- package/dist/helper/getQueryString.d.ts +7 -0
- package/dist/helper/getQueryString.js +57 -0
- package/dist/helper/getQueryString.mjs +7 -0
- package/dist/helper/getQueryString.test.d.ts +1 -0
- package/dist/helper/getQueryString.test.js +15769 -0
- package/dist/helper/getQueryString.test.mjs +14458 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/index.js +145 -0
- package/dist/helper/index.mjs +21 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +1978 -0
- package/dist/index.mjs +87 -0
- package/dist/metric/MetricClient.d.ts +21 -0
- package/dist/metric/MetricClient.js +215 -0
- package/dist/metric/MetricClient.mjs +14 -0
- package/dist/metric/index.d.ts +1 -0
- package/dist/metric/index.js +18 -0
- package/dist/metric/index.mjs +3 -0
- package/dist/metric/pipeline/index.d.ts +1 -0
- package/dist/metric/pipeline/index.js +18 -0
- package/dist/metric/pipeline/index.mjs +2 -0
- package/dist/metric/pipeline/queries.d.ts +21 -0
- package/dist/metric/pipeline/queries.js +168 -0
- package/dist/metric/pipeline/queries.mjs +17 -0
- package/dist/metric/pipeline/types.d.ts +63 -0
- package/dist/metric/pipeline/types.js +18 -0
- package/dist/metric/pipeline/types.mjs +1 -0
- package/dist/mgmt/AuthClient.d.ts +35 -0
- package/dist/mgmt/AuthClient.js +308 -0
- package/dist/mgmt/AuthClient.mjs +16 -0
- package/dist/mgmt/action.d.ts +8 -0
- package/dist/mgmt/action.js +61 -0
- package/dist/mgmt/action.mjs +11 -0
- package/dist/mgmt/index.d.ts +2 -0
- package/dist/mgmt/index.js +37 -0
- package/dist/mgmt/index.mjs +13 -0
- package/dist/mgmt/mutation.d.ts +18 -0
- package/dist/mgmt/mutation.js +83 -0
- package/dist/mgmt/mutation.mjs +13 -0
- package/dist/mgmt/queries.d.ts +17 -0
- package/dist/mgmt/queries.js +148 -0
- package/dist/mgmt/queries.mjs +19 -0
- package/dist/mgmt/types.d.ts +62 -0
- package/dist/mgmt/types.js +18 -0
- package/dist/mgmt/types.mjs +1 -0
- package/dist/model/ModelClient.d.ts +48 -0
- package/dist/model/ModelClient.js +466 -0
- package/dist/model/ModelClient.mjs +16 -0
- package/dist/model/action.d.ts +9 -0
- package/dist/model/action.js +57 -0
- package/dist/model/action.mjs +9 -0
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.js +37 -0
- package/dist/model/index.mjs +13 -0
- package/dist/model/mutation.d.ts +15 -0
- package/dist/model/mutation.js +128 -0
- package/dist/model/mutation.mjs +11 -0
- package/dist/model/queries.d.ts +35 -0
- package/dist/model/queries.js +234 -0
- package/dist/model/queries.mjs +25 -0
- package/dist/model/types.d.ts +141 -0
- package/dist/model/types.js +18 -0
- package/dist/model/types.mjs +1 -0
- package/dist/operation/OperationClient.d.ts +11 -0
- package/dist/operation/OperationClient.js +106 -0
- package/dist/operation/OperationClient.mjs +8 -0
- package/dist/operation/index.d.ts +2 -0
- package/dist/operation/index.js +31 -0
- package/dist/operation/index.mjs +5 -0
- package/dist/operation/queries.d.ts +9 -0
- package/dist/operation/queries.js +67 -0
- package/dist/operation/queries.mjs +9 -0
- package/dist/operation/types.d.ts +9 -0
- package/dist/operation/types.js +18 -0
- package/dist/operation/types.mjs +1 -0
- package/dist/pipeline/PipelineClient.d.ts +80 -0
- package/dist/pipeline/PipelineClient.js +639 -0
- package/dist/pipeline/PipelineClient.mjs +16 -0
- package/dist/pipeline/action.d.ts +34 -0
- package/dist/pipeline/action.js +157 -0
- package/dist/pipeline/action.mjs +17 -0
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +37 -0
- package/dist/pipeline/index.mjs +13 -0
- package/dist/pipeline/mutation.d.ts +33 -0
- package/dist/pipeline/mutation.js +134 -0
- package/dist/pipeline/mutation.mjs +19 -0
- package/dist/pipeline/queries.d.ts +32 -0
- package/dist/pipeline/queries.js +223 -0
- package/dist/pipeline/queries.mjs +23 -0
- package/dist/pipeline/types.d.ts +204 -0
- package/dist/pipeline/types.js +18 -0
- package/dist/pipeline/types.mjs +1 -0
- package/dist/protogen-ts/base/metric/v1alpha/metric.ts +4522 -0
- package/dist/protogen-ts/base/metric/v1alpha/metric_service.ts +314 -0
- package/dist/protogen-ts/base/mgmt/v1alpha/metric.ts +2486 -0
- package/dist/protogen-ts/base/mgmt/v1alpha/mgmt.ts +3787 -0
- package/dist/protogen-ts/base/mgmt/v1alpha/mgmt_private_service.ts +107 -0
- package/dist/protogen-ts/base/mgmt/v1alpha/mgmt_public_service.ts +326 -0
- package/dist/protogen-ts/base/usage/v1alpha/usage.ts +2185 -0
- package/dist/protogen-ts/base/usage/v1alpha/usage_service.ts +81 -0
- package/dist/protogen-ts/common/healthcheck/v1alpha/healthcheck.ts +188 -0
- package/dist/protogen-ts/common/task/v1alpha/task.ts +109 -0
- package/dist/protogen-ts/google/api/annotations.ts +3 -0
- package/dist/protogen-ts/google/api/client.ts +2073 -0
- package/dist/protogen-ts/google/api/field_behavior.ts +119 -0
- package/dist/protogen-ts/google/api/http.ts +745 -0
- package/dist/protogen-ts/google/api/launch_stage.ts +115 -0
- package/dist/protogen-ts/google/api/resource.ts +529 -0
- package/dist/protogen-ts/google/longrunning/operations.ts +890 -0
- package/dist/protogen-ts/google/protobuf/any.ts +259 -0
- package/dist/protogen-ts/google/protobuf/descriptor.ts +4831 -0
- package/dist/protogen-ts/google/protobuf/duration.ts +203 -0
- package/dist/protogen-ts/google/protobuf/empty.ts +70 -0
- package/dist/protogen-ts/google/protobuf/field_mask.ts +289 -0
- package/dist/protogen-ts/google/protobuf/struct.ts +543 -0
- package/dist/protogen-ts/google/protobuf/timestamp.ts +232 -0
- package/dist/protogen-ts/google/rpc/status.ts +138 -0
- package/dist/protogen-ts/model/controller/v1alpha/controller.ts +823 -0
- package/dist/protogen-ts/model/controller/v1alpha/controller_service.ts +95 -0
- package/dist/protogen-ts/model/model/v1alpha/common.ts +135 -0
- package/dist/protogen-ts/model/model/v1alpha/model.ts +5682 -0
- package/dist/protogen-ts/model/model/v1alpha/model_definition.ts +775 -0
- package/dist/protogen-ts/model/model/v1alpha/model_private_service.ts +87 -0
- package/dist/protogen-ts/model/model/v1alpha/model_public_service.ts +383 -0
- package/dist/protogen-ts/model/model/v1alpha/task_classification.ts +326 -0
- package/dist/protogen-ts/model/model/v1alpha/task_detection.ts +411 -0
- package/dist/protogen-ts/model/model/v1alpha/task_instance_segmentation.ts +435 -0
- package/dist/protogen-ts/model/model/v1alpha/task_keypoint.ts +510 -0
- package/dist/protogen-ts/model/model/v1alpha/task_ocr.ts +406 -0
- package/dist/protogen-ts/model/model/v1alpha/task_semantic_segmentation.ts +396 -0
- package/dist/protogen-ts/model/model/v1alpha/task_text_generation.ts +247 -0
- package/dist/protogen-ts/model/model/v1alpha/task_text_to_image.ts +221 -0
- package/dist/protogen-ts/model/model/v1alpha/task_unspecified.ts +142 -0
- package/dist/protogen-ts/protoc-gen-openapiv2/options/annotations.ts +3 -0
- package/dist/protogen-ts/protoc-gen-openapiv2/options/openapiv2.ts +5095 -0
- package/dist/protogen-ts/vdp/connector/v1alpha/connector.ts +3637 -0
- package/dist/protogen-ts/vdp/connector/v1alpha/connector_definition.ts +1043 -0
- package/dist/protogen-ts/vdp/connector/v1alpha/connector_private_service.ts +92 -0
- package/dist/protogen-ts/vdp/connector/v1alpha/connector_public_service.ts +310 -0
- package/dist/protogen-ts/vdp/connector/v1alpha/spec.ts +126 -0
- package/dist/protogen-ts/vdp/controller/v1alpha/controller.ts +853 -0
- package/dist/protogen-ts/vdp/controller/v1alpha/controller_service.ts +95 -0
- package/dist/protogen-ts/vdp/pipeline/v1alpha/common.ts +498 -0
- package/dist/protogen-ts/vdp/pipeline/v1alpha/operator_definition.ts +948 -0
- package/dist/protogen-ts/vdp/pipeline/v1alpha/pipeline.ts +6006 -0
- package/dist/protogen-ts/vdp/pipeline/v1alpha/pipeline_private_service.ts +83 -0
- package/dist/protogen-ts/vdp/pipeline/v1alpha/pipeline_public_service.ts +413 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deployUserModelAction,
|
|
3
|
+
undeployUserModelAction
|
|
4
|
+
} from "./chunk-D5OKZ665.mjs";
|
|
5
|
+
import {
|
|
6
|
+
createUserModelMutation,
|
|
7
|
+
deleteUserModelMutation,
|
|
8
|
+
updateModelMutation
|
|
9
|
+
} from "./chunk-QZOKJQTL.mjs";
|
|
10
|
+
import {
|
|
11
|
+
getModelDefinitionQuery,
|
|
12
|
+
getUserModelQuery,
|
|
13
|
+
getUserModelReadmeQuery,
|
|
14
|
+
listModelDefinitionsQuery,
|
|
15
|
+
listModelsQuery,
|
|
16
|
+
listUserModelsQuery,
|
|
17
|
+
watchUserModel
|
|
18
|
+
} from "./chunk-KHFNAMT4.mjs";
|
|
19
|
+
|
|
20
|
+
// src/model/ModelClient.ts
|
|
21
|
+
import axios from "axios";
|
|
22
|
+
var ModelClient = class {
|
|
23
|
+
axiosInstance;
|
|
24
|
+
constructor(baseUrl, appVersion, apiToken) {
|
|
25
|
+
let URL = `${baseUrl}/model/${appVersion}`;
|
|
26
|
+
this.axiosInstance = axios.create({
|
|
27
|
+
baseURL: URL,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${apiToken}`
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/* -------------------------------------------------------------------------
|
|
34
|
+
* Model Queries
|
|
35
|
+
* -----------------------------------------------------------------------*/
|
|
36
|
+
async getModelDefinitionQuery({
|
|
37
|
+
modelDefinitionName
|
|
38
|
+
}) {
|
|
39
|
+
return getModelDefinitionQuery({
|
|
40
|
+
axiosInstance: this.axiosInstance,
|
|
41
|
+
modelDefinitionName
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async listModelDefinitionsQuery({
|
|
45
|
+
pageSize,
|
|
46
|
+
nextPageToken
|
|
47
|
+
}) {
|
|
48
|
+
return listModelDefinitionsQuery({
|
|
49
|
+
axiosInstance: this.axiosInstance,
|
|
50
|
+
pageSize,
|
|
51
|
+
nextPageToken
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/* -------------------------------------------------------------------------
|
|
55
|
+
* Model
|
|
56
|
+
* -----------------------------------------------------------------------*/
|
|
57
|
+
async getUserModelQuery({ modelName }) {
|
|
58
|
+
return getUserModelQuery({
|
|
59
|
+
axiosInstance: this.axiosInstance,
|
|
60
|
+
modelName
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async listModelsQuery({
|
|
64
|
+
pageSize,
|
|
65
|
+
nextPageToken
|
|
66
|
+
}) {
|
|
67
|
+
return listModelsQuery({
|
|
68
|
+
axiosInstance: this.axiosInstance,
|
|
69
|
+
pageSize,
|
|
70
|
+
nextPageToken
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async listUserModelsQuery({
|
|
74
|
+
userName,
|
|
75
|
+
pageSize,
|
|
76
|
+
nextPageToken
|
|
77
|
+
}) {
|
|
78
|
+
return listUserModelsQuery({
|
|
79
|
+
axiosInstance: this.axiosInstance,
|
|
80
|
+
userName,
|
|
81
|
+
pageSize,
|
|
82
|
+
nextPageToken
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async getUserModelReadmeQuery({ modelName }) {
|
|
86
|
+
return getUserModelReadmeQuery({
|
|
87
|
+
axiosInstance: this.axiosInstance,
|
|
88
|
+
modelName
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/* -------------------------------------------------------------------------
|
|
92
|
+
* Watch Model State
|
|
93
|
+
* -----------------------------------------------------------------------*/
|
|
94
|
+
async watchUserModel({ modelName }) {
|
|
95
|
+
return watchUserModel({
|
|
96
|
+
axiosInstance: this.axiosInstance,
|
|
97
|
+
modelName
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/* -------------------------------------------------------------------------
|
|
101
|
+
* Model Mutation
|
|
102
|
+
* -----------------------------------------------------------------------*/
|
|
103
|
+
async createUserModelMutation({
|
|
104
|
+
userName,
|
|
105
|
+
payload
|
|
106
|
+
}) {
|
|
107
|
+
return createUserModelMutation({
|
|
108
|
+
axiosInstance: this.axiosInstance,
|
|
109
|
+
userName,
|
|
110
|
+
payload
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async updateModelMutation({ payload }) {
|
|
114
|
+
return updateModelMutation({
|
|
115
|
+
axiosInstance: this.axiosInstance,
|
|
116
|
+
payload
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async deleteUserModelMutation({ modelName }) {
|
|
120
|
+
return deleteUserModelMutation({
|
|
121
|
+
axiosInstance: this.axiosInstance,
|
|
122
|
+
modelName
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/* -------------------------------------------------------------------------
|
|
126
|
+
* Model Action
|
|
127
|
+
* -----------------------------------------------------------------------*/
|
|
128
|
+
async deployUserModelAction({ modelName }) {
|
|
129
|
+
return deployUserModelAction({
|
|
130
|
+
axiosInstance: this.axiosInstance,
|
|
131
|
+
modelName
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async undeployUserModelAction({ modelName }) {
|
|
135
|
+
return undeployUserModelAction({
|
|
136
|
+
axiosInstance: this.axiosInstance,
|
|
137
|
+
modelName
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
var ModelClient_default = ModelClient;
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
ModelClient_default
|
|
145
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/connector/mutation.ts
|
|
2
|
+
async function createUserConnectorResourceMutation({
|
|
3
|
+
axiosInstance,
|
|
4
|
+
userName,
|
|
5
|
+
payload
|
|
6
|
+
}) {
|
|
7
|
+
try {
|
|
8
|
+
const res = await axiosInstance.post(
|
|
9
|
+
`${userName}/connector-resources`,
|
|
10
|
+
payload
|
|
11
|
+
);
|
|
12
|
+
return Promise.resolve(res.data.connector_resource);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
return Promise.reject(err);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function deleteUserConnectorResourceMutation({
|
|
18
|
+
axiosInstance,
|
|
19
|
+
connectorResourceName
|
|
20
|
+
}) {
|
|
21
|
+
try {
|
|
22
|
+
await axiosInstance.delete(`/${connectorResourceName}`);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
return Promise.reject(err);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function updateUserConnectorResourceMutation({
|
|
28
|
+
axiosInstance,
|
|
29
|
+
payload
|
|
30
|
+
}) {
|
|
31
|
+
try {
|
|
32
|
+
const res = await axiosInstance.patch(
|
|
33
|
+
`/${payload.connectorResourceName}`,
|
|
34
|
+
{
|
|
35
|
+
...payload,
|
|
36
|
+
connectorResourceName: void 0
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return Promise.resolve(res.data.connector_resource);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
return Promise.reject(err);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function renameUserConnectorResource({
|
|
45
|
+
axiosInstance,
|
|
46
|
+
payload
|
|
47
|
+
}) {
|
|
48
|
+
try {
|
|
49
|
+
const { data } = await axiosInstance.post(
|
|
50
|
+
`/${payload.name}/rename`,
|
|
51
|
+
payload
|
|
52
|
+
);
|
|
53
|
+
return Promise.resolve(data.connector_resource);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
return Promise.reject(err);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
createUserConnectorResourceMutation,
|
|
61
|
+
deleteUserConnectorResourceMutation,
|
|
62
|
+
updateUserConnectorResourceMutation,
|
|
63
|
+
renameUserConnectorResource
|
|
64
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/helper/getInstillApiErrorMessage.tsx
|
|
2
|
+
function getInstillApiErrorMessage(error) {
|
|
3
|
+
if (!error.response) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
if (!error.response.data.details && !error.response.data.message) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (error.response.data.details.length === 0) {
|
|
10
|
+
return error.response.data.message;
|
|
11
|
+
}
|
|
12
|
+
return JSON.stringify(error.response?.data.details, null, " ");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getInstillApiErrorMessage
|
|
17
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/model/action.ts
|
|
2
|
+
async function deployUserModelAction({
|
|
3
|
+
axiosInstance,
|
|
4
|
+
modelName
|
|
5
|
+
}) {
|
|
6
|
+
try {
|
|
7
|
+
const { data } = await axiosInstance.post(
|
|
8
|
+
`/${modelName}/deploy`
|
|
9
|
+
);
|
|
10
|
+
return Promise.resolve(data.model_id);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
return Promise.reject(err);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function undeployUserModelAction({
|
|
16
|
+
axiosInstance,
|
|
17
|
+
modelName
|
|
18
|
+
}) {
|
|
19
|
+
try {
|
|
20
|
+
const { data } = await axiosInstance.post(
|
|
21
|
+
`/${modelName}/undeploy`
|
|
22
|
+
);
|
|
23
|
+
return Promise.resolve(data.model_id);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
return Promise.reject(err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
deployUserModelAction,
|
|
31
|
+
undeployUserModelAction
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
env
|
|
3
|
+
} from "./chunk-RVRM4NPL.mjs";
|
|
4
|
+
|
|
5
|
+
// src/helper/createClient.ts
|
|
6
|
+
import axios from "axios";
|
|
7
|
+
function createClient(apiToken, product, headers) {
|
|
8
|
+
let clientHeaders = {};
|
|
9
|
+
if (headers) {
|
|
10
|
+
clientHeaders = headers;
|
|
11
|
+
} else {
|
|
12
|
+
if (apiToken) {
|
|
13
|
+
clientHeaders = {
|
|
14
|
+
Authorization: `Bearer ${apiToken}`,
|
|
15
|
+
"CF-Access-Client-Id": env("CF_ACCESS_CLIENT_ID") ? env("CF_ACCESS_CLIENT_ID") : void 0,
|
|
16
|
+
"CF-Access-Client-Secret": env("CF_ACCESS_CLIENT_SECRET") ? env("CF_ACCESS_CLIENT_SECRET") : void 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (!process.env.API_GATEWAY_URL && !env("API_GATEWAY_URL")) {
|
|
21
|
+
throw new Error("API_GATEWAY_URL or API_GATEWAY_URL is not defined");
|
|
22
|
+
}
|
|
23
|
+
let baseURL = `${process.env.API_GATEWAY_URL ?? env("API_GATEWAY_URL")}/${product}/${env("API_VERSION")}`;
|
|
24
|
+
return axios.create({
|
|
25
|
+
baseURL,
|
|
26
|
+
headers: clientHeaders
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
createClient
|
|
32
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/helper/getQueryString.ts
|
|
2
|
+
var getQueryString = ({
|
|
3
|
+
baseURL,
|
|
4
|
+
pageSize,
|
|
5
|
+
nextPageToken,
|
|
6
|
+
filter
|
|
7
|
+
}) => {
|
|
8
|
+
let url = baseURL;
|
|
9
|
+
if (pageSize || nextPageToken || filter) {
|
|
10
|
+
if (baseURL.includes("?")) {
|
|
11
|
+
url += "&";
|
|
12
|
+
} else {
|
|
13
|
+
url += "?";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (pageSize) {
|
|
17
|
+
url += `page_size=${pageSize}&`;
|
|
18
|
+
}
|
|
19
|
+
if (nextPageToken) {
|
|
20
|
+
url += `page_token=${nextPageToken}&`;
|
|
21
|
+
}
|
|
22
|
+
if (filter) {
|
|
23
|
+
url += `filter=${filter}&`;
|
|
24
|
+
}
|
|
25
|
+
if (url.endsWith("&")) {
|
|
26
|
+
url = url.slice(0, -1);
|
|
27
|
+
}
|
|
28
|
+
return url;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
getQueryString
|
|
33
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getQueryString
|
|
3
|
+
} from "./chunk-EBWGEVUX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/pipeline/queries.ts
|
|
6
|
+
async function listPipelinesQuery({
|
|
7
|
+
axiosInstance,
|
|
8
|
+
pageSize,
|
|
9
|
+
nextPageToken
|
|
10
|
+
}) {
|
|
11
|
+
try {
|
|
12
|
+
const pipelines = [];
|
|
13
|
+
const queryString = getQueryString({
|
|
14
|
+
baseURL: "/pipelines?view=VIEW_FULL",
|
|
15
|
+
pageSize,
|
|
16
|
+
nextPageToken,
|
|
17
|
+
filter: null
|
|
18
|
+
});
|
|
19
|
+
const { data } = await axiosInstance.get(
|
|
20
|
+
queryString
|
|
21
|
+
);
|
|
22
|
+
pipelines.push(...data.pipelines);
|
|
23
|
+
if (data.next_page_token) {
|
|
24
|
+
pipelines.push(
|
|
25
|
+
...await listPipelinesQuery({
|
|
26
|
+
axiosInstance,
|
|
27
|
+
pageSize,
|
|
28
|
+
nextPageToken: data.next_page_token
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return Promise.resolve(pipelines);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
return Promise.reject(err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function listUserPipelinesQuery({
|
|
38
|
+
axiosInstance,
|
|
39
|
+
pageSize,
|
|
40
|
+
nextPageToken,
|
|
41
|
+
userName
|
|
42
|
+
}) {
|
|
43
|
+
try {
|
|
44
|
+
const pipelines = [];
|
|
45
|
+
const queryString = getQueryString({
|
|
46
|
+
baseURL: `${userName}/pipelines?view=VIEW_FULL`,
|
|
47
|
+
pageSize,
|
|
48
|
+
nextPageToken,
|
|
49
|
+
filter: null
|
|
50
|
+
});
|
|
51
|
+
const { data } = await axiosInstance.get(
|
|
52
|
+
queryString
|
|
53
|
+
);
|
|
54
|
+
pipelines.push(...data.pipelines);
|
|
55
|
+
if (data.next_page_token) {
|
|
56
|
+
pipelines.push(
|
|
57
|
+
...await listUserPipelinesQuery({
|
|
58
|
+
axiosInstance,
|
|
59
|
+
pageSize,
|
|
60
|
+
nextPageToken: data.next_page_token,
|
|
61
|
+
userName
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return Promise.resolve(pipelines);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
return Promise.reject(err);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function getUserPipelineQuery({
|
|
71
|
+
axiosInstance,
|
|
72
|
+
pipelineName
|
|
73
|
+
}) {
|
|
74
|
+
try {
|
|
75
|
+
const { data } = await axiosInstance.get(
|
|
76
|
+
`/${pipelineName}?view=VIEW_FULL`
|
|
77
|
+
);
|
|
78
|
+
return Promise.resolve(data.pipeline);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
return Promise.reject(err);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function ListUserPipelineReleasesQuery({
|
|
84
|
+
axiosInstance,
|
|
85
|
+
pipelineName,
|
|
86
|
+
pageSize,
|
|
87
|
+
nextPageToken
|
|
88
|
+
}) {
|
|
89
|
+
try {
|
|
90
|
+
const releases = [];
|
|
91
|
+
const queryString = getQueryString({
|
|
92
|
+
baseURL: `/${pipelineName}/releases?view=VIEW_FULL`,
|
|
93
|
+
pageSize,
|
|
94
|
+
nextPageToken,
|
|
95
|
+
filter: null
|
|
96
|
+
});
|
|
97
|
+
const { data } = await axiosInstance.get(
|
|
98
|
+
queryString
|
|
99
|
+
);
|
|
100
|
+
releases.push(...data.releases);
|
|
101
|
+
if (data.next_page_token) {
|
|
102
|
+
releases.push(
|
|
103
|
+
...await ListUserPipelineReleasesQuery({
|
|
104
|
+
axiosInstance,
|
|
105
|
+
pipelineName,
|
|
106
|
+
pageSize,
|
|
107
|
+
nextPageToken: data.next_page_token
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return Promise.resolve(releases);
|
|
112
|
+
} catch (err) {
|
|
113
|
+
return Promise.reject(err);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function getUserPipelineReleaseQuery({
|
|
117
|
+
axiosInstance,
|
|
118
|
+
pipelineReleaseName
|
|
119
|
+
}) {
|
|
120
|
+
try {
|
|
121
|
+
const { data } = await axiosInstance.get(
|
|
122
|
+
`/${pipelineReleaseName}?view=VIEW_FULL`
|
|
123
|
+
);
|
|
124
|
+
return Promise.resolve(data.release);
|
|
125
|
+
} catch (err) {
|
|
126
|
+
return Promise.reject(err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function watchUserPipelineReleaseQuery({
|
|
130
|
+
axiosInstance,
|
|
131
|
+
pipelineReleaseName
|
|
132
|
+
}) {
|
|
133
|
+
try {
|
|
134
|
+
const { data } = await axiosInstance.get(
|
|
135
|
+
`/${pipelineReleaseName}/watch`
|
|
136
|
+
);
|
|
137
|
+
return Promise.resolve(data.state);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
return Promise.reject(err);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
listPipelinesQuery,
|
|
145
|
+
listUserPipelinesQuery,
|
|
146
|
+
getUserPipelineQuery,
|
|
147
|
+
ListUserPipelineReleasesQuery,
|
|
148
|
+
getUserPipelineReleaseQuery,
|
|
149
|
+
watchUserPipelineReleaseQuery
|
|
150
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined")
|
|
11
|
+
return require.apply(this, arguments);
|
|
12
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __esm = (fn, res) => function __init() {
|
|
15
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
+
};
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
__require,
|
|
44
|
+
__esm,
|
|
45
|
+
__commonJS,
|
|
46
|
+
__export,
|
|
47
|
+
__toESM,
|
|
48
|
+
__toCommonJS
|
|
49
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getQueryString
|
|
3
|
+
} from "./chunk-EBWGEVUX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/connector/queries.ts
|
|
6
|
+
async function listConnectorResourcesQuery({
|
|
7
|
+
axiosInstance,
|
|
8
|
+
pageSize,
|
|
9
|
+
nextPageToken,
|
|
10
|
+
filter
|
|
11
|
+
}) {
|
|
12
|
+
try {
|
|
13
|
+
const connectors = [];
|
|
14
|
+
const queryString = getQueryString({
|
|
15
|
+
baseURL: `/connector-resources?view=VIEW_FULL`,
|
|
16
|
+
pageSize,
|
|
17
|
+
nextPageToken,
|
|
18
|
+
filter
|
|
19
|
+
});
|
|
20
|
+
const { data } = await axiosInstance.get(
|
|
21
|
+
queryString
|
|
22
|
+
);
|
|
23
|
+
connectors.push(...data.connector_resources);
|
|
24
|
+
if (data.next_page_token) {
|
|
25
|
+
connectors.push(
|
|
26
|
+
...await listConnectorResourcesQuery({
|
|
27
|
+
axiosInstance,
|
|
28
|
+
pageSize,
|
|
29
|
+
nextPageToken: data.next_page_token,
|
|
30
|
+
filter
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return Promise.resolve(connectors);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return Promise.reject(err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function listUserConnectorResourcesQuery({
|
|
40
|
+
axiosInstance,
|
|
41
|
+
userName,
|
|
42
|
+
pageSize,
|
|
43
|
+
nextPageToken,
|
|
44
|
+
filter
|
|
45
|
+
}) {
|
|
46
|
+
try {
|
|
47
|
+
const connectors = [];
|
|
48
|
+
const queryString = getQueryString({
|
|
49
|
+
baseURL: `${userName}/connector-resources?view=VIEW_FULL`,
|
|
50
|
+
pageSize,
|
|
51
|
+
nextPageToken,
|
|
52
|
+
filter
|
|
53
|
+
});
|
|
54
|
+
const { data } = await axiosInstance.get(
|
|
55
|
+
queryString
|
|
56
|
+
);
|
|
57
|
+
connectors.push(...data.connector_resources);
|
|
58
|
+
if (data.next_page_token) {
|
|
59
|
+
connectors.push(
|
|
60
|
+
...await listUserConnectorResourcesQuery({
|
|
61
|
+
axiosInstance,
|
|
62
|
+
userName,
|
|
63
|
+
pageSize,
|
|
64
|
+
nextPageToken: data.next_page_token,
|
|
65
|
+
filter
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return Promise.resolve(connectors);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return Promise.reject(err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function listConnectorDefinitionsQuery({
|
|
75
|
+
axiosInstance,
|
|
76
|
+
pageSize,
|
|
77
|
+
nextPageToken,
|
|
78
|
+
filter
|
|
79
|
+
}) {
|
|
80
|
+
try {
|
|
81
|
+
const connectorDefinitions = [];
|
|
82
|
+
const queryString = getQueryString({
|
|
83
|
+
baseURL: `/connector-definitions?view=VIEW_FULL`,
|
|
84
|
+
pageSize,
|
|
85
|
+
nextPageToken,
|
|
86
|
+
filter
|
|
87
|
+
});
|
|
88
|
+
const { data } = await axiosInstance.get(
|
|
89
|
+
queryString
|
|
90
|
+
);
|
|
91
|
+
connectorDefinitions.push(...data.connector_definitions);
|
|
92
|
+
if (data.next_page_token) {
|
|
93
|
+
connectorDefinitions.push(
|
|
94
|
+
...await listConnectorDefinitionsQuery({
|
|
95
|
+
axiosInstance,
|
|
96
|
+
pageSize,
|
|
97
|
+
nextPageToken: data.next_page_token,
|
|
98
|
+
filter
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return Promise.resolve(connectorDefinitions);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
return Promise.reject(err);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function getConnectorDefinitionQuery({
|
|
108
|
+
axiosInstance,
|
|
109
|
+
connectorDefinitionName
|
|
110
|
+
}) {
|
|
111
|
+
try {
|
|
112
|
+
const { data } = await axiosInstance.get(
|
|
113
|
+
`/${connectorDefinitionName}?view=VIEW_FULL`
|
|
114
|
+
);
|
|
115
|
+
return Promise.resolve(data.connector_definition);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
return Promise.reject(err);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function getUserConnectorResourceQuery({
|
|
121
|
+
axiosInstance,
|
|
122
|
+
connectorResourceName
|
|
123
|
+
}) {
|
|
124
|
+
try {
|
|
125
|
+
const { data } = await axiosInstance.get(
|
|
126
|
+
`/${connectorResourceName}?view=VIEW_FULL`
|
|
127
|
+
);
|
|
128
|
+
return Promise.resolve(data.connector_resource);
|
|
129
|
+
} catch (err) {
|
|
130
|
+
return Promise.reject(err);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function watchUserConnectorResource({
|
|
134
|
+
axiosInstance,
|
|
135
|
+
connectorResourceName
|
|
136
|
+
}) {
|
|
137
|
+
try {
|
|
138
|
+
const { data } = await axiosInstance.get(
|
|
139
|
+
`/${connectorResourceName}/watch`
|
|
140
|
+
);
|
|
141
|
+
return Promise.resolve(data);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
return Promise.reject(err);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
listConnectorResourcesQuery,
|
|
149
|
+
listUserConnectorResourcesQuery,
|
|
150
|
+
listConnectorDefinitionsQuery,
|
|
151
|
+
getConnectorDefinitionQuery,
|
|
152
|
+
getUserConnectorResourceQuery,
|
|
153
|
+
watchUserConnectorResource
|
|
154
|
+
};
|