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
package/README.md
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
Typescript SDK for Instill AI products
|
|
4
|
+
|
|
5
|
+
[](https://github.com/instill-ai/typescript-sdk/actions)
|
|
6
|
+
[](https://www.npmjs.com/package/@instill-ai/typescript-sdk)
|
|
7
|
+
[](https://www.npmjs.com/package/@instill-ai/typescript-sdk)
|
|
8
|
+
[](https://www.npmjs.com/package/@instill-ai/typescript-sdk)
|
|
9
|
+
|
|
10
|
+
> [!IMPORTANT]
|
|
11
|
+
> **This SDK tool is under heavy development!!**
|
|
12
|
+
> Currently there has yet to be a stable version release, please feel free to open any issue regarding this SDK in our [community](https://github.com/instill-ai/community/issues) repo
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
### Requirements
|
|
17
|
+
|
|
18
|
+
- Node 16+
|
|
19
|
+
- npm 7+ | pnpm 6+ | yarn 1+
|
|
20
|
+
|
|
21
|
+
### installation
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
npm i @instill-ai/typescript-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
yarn add @instill-ai/typescript-sdk
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
pnpm add @instill-ai/typescript-sdk
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
// node.js
|
|
39
|
+
const InstillClient = require("@instill-ai/typescript-sdk").default;
|
|
40
|
+
|
|
41
|
+
// next.js
|
|
42
|
+
import InstillClient from "@instill-ai/typescript-sdk";
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### config
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
baseUrl: string
|
|
50
|
+
appVersion: string
|
|
51
|
+
apiToken: string
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Example app templetes
|
|
55
|
+
|
|
56
|
+
### local
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
import { useEffect, useState } from "react";
|
|
60
|
+
import InstillClient, {
|
|
61
|
+
Nullable,
|
|
62
|
+
User,
|
|
63
|
+
} from "@instill-ai/typescript-sdk";
|
|
64
|
+
|
|
65
|
+
export default function TypescriptSdkDemo() {
|
|
66
|
+
const [user, setUser] = useState<User[]>([]);
|
|
67
|
+
|
|
68
|
+
const client = new InstillClient(
|
|
69
|
+
"http://localhost:8080",
|
|
70
|
+
"v1alpha",
|
|
71
|
+
"<your_api_token>" // get console API token from `http://localhost:3000/settings`
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
client.Auth.getUserQuery()
|
|
76
|
+
.then((data: any) => {
|
|
77
|
+
console.log("data", data);
|
|
78
|
+
setUser(data);
|
|
79
|
+
})
|
|
80
|
+
.catch((error: any) => {
|
|
81
|
+
console.log("error", error);
|
|
82
|
+
});
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<h1>User Data</h1>
|
|
88
|
+
<pre style={{ backgroundColor: "white" }}>
|
|
89
|
+
{JSON.stringify(user, null, 4)}
|
|
90
|
+
</pre>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### With Token
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
import { useEffect, useState } from "react";
|
|
100
|
+
import InstillClient, {
|
|
101
|
+
Nullable,
|
|
102
|
+
Pipeline,
|
|
103
|
+
User,
|
|
104
|
+
} from "@instill-ai/typescript-sdk";
|
|
105
|
+
|
|
106
|
+
export default function TypescriptSdkDemo() {
|
|
107
|
+
const [pipelines, setPipelines] = useState<Pipeline[]>([]);
|
|
108
|
+
const [user, setUser] = useState<User[]>([]);
|
|
109
|
+
|
|
110
|
+
const client = new InstillClient(
|
|
111
|
+
"https://api.instill.tech",
|
|
112
|
+
"v1alpha",
|
|
113
|
+
"<your_api_token>" // console API token
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
client.Auth.getUserQuery()
|
|
118
|
+
.then((data: any) => {
|
|
119
|
+
console.log("data", data);
|
|
120
|
+
setUser(data);
|
|
121
|
+
})
|
|
122
|
+
.catch((error: any) => {
|
|
123
|
+
console.log("error", error);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
client.Pipeline.listPipelinesQuery({
|
|
127
|
+
pageSize: null,
|
|
128
|
+
nextPageToken: null,
|
|
129
|
+
})
|
|
130
|
+
.then((data: any) => {
|
|
131
|
+
console.log("data", data);
|
|
132
|
+
setPipelines(data);
|
|
133
|
+
})
|
|
134
|
+
.catch((error: any) => {
|
|
135
|
+
console.log("error", error);
|
|
136
|
+
});
|
|
137
|
+
}, []);
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<>
|
|
141
|
+
<h1>User Data</h1>
|
|
142
|
+
<pre style={{ backgroundColor: "white" }}>
|
|
143
|
+
{JSON.stringify(user, null, 4)}
|
|
144
|
+
</pre>
|
|
145
|
+
|
|
146
|
+
<h1>Pipelines List</h1>
|
|
147
|
+
<pre style={{ backgroundColor: "white" }}>
|
|
148
|
+
{JSON.stringify(pipelines, null, 4)}
|
|
149
|
+
</pre>
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Next APP
|
|
156
|
+
|
|
157
|
+
- [next-app](./examples/next-app/)
|
|
158
|
+
|
|
159
|
+
### Node APP
|
|
160
|
+
|
|
161
|
+
- [node-app](./examples/node-app/)
|
|
162
|
+
|
|
163
|
+
## API Reference
|
|
164
|
+
|
|
165
|
+
### Pipelines
|
|
166
|
+
|
|
167
|
+
### create Pipeline
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
userName : check your userName: https://console.instill.tech/settings
|
|
172
|
+
|
|
173
|
+
client.PipelineClient.createUserPipelineMutation("<userName>",
|
|
174
|
+
{
|
|
175
|
+
"id": "overseas-blue-lobster",
|
|
176
|
+
"recipe": {
|
|
177
|
+
"version": "v1alpha",
|
|
178
|
+
"components": [
|
|
179
|
+
{
|
|
180
|
+
"id": "start",
|
|
181
|
+
"resource_name": "",
|
|
182
|
+
"configuration": {
|
|
183
|
+
"metadata": {
|
|
184
|
+
"text": {
|
|
185
|
+
"instillFormat": "string",
|
|
186
|
+
"type": "string",
|
|
187
|
+
"title": "text"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"definition_name": "operator-definitions/op-start"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"id": "end",
|
|
195
|
+
"resource_name": "",
|
|
196
|
+
"configuration": {
|
|
197
|
+
"metadata": {
|
|
198
|
+
"output": {
|
|
199
|
+
"title": "output"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"input": {
|
|
203
|
+
"output": "{ai_1.output.texts}"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"definition_name": "operator-definitions/op-end"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"id": "ai_1",
|
|
210
|
+
"resource_name": "users/namananand-instill-ai/connector-resources/ai2",
|
|
211
|
+
"configuration": {
|
|
212
|
+
"task": "TASK_TEXT_GENERATION",
|
|
213
|
+
"input": {
|
|
214
|
+
"prompt": "{start.text}",
|
|
215
|
+
"model": "gpt-3.5-turbo"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"definition_name": "connector-definitions/ai-openai"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
).then((response) => {
|
|
224
|
+
console.log(response.data)
|
|
225
|
+
})
|
|
226
|
+
.catch(error => {
|
|
227
|
+
console.log(error)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
| function | params |
|
|
233
|
+
| :------------------------------------ | :---------------------------------------------: |
|
|
234
|
+
| listPipelinesQuery | pageSize, nextPageToken |
|
|
235
|
+
| listUserPipelinesQuery | pageSize, nextPageToken, userName |
|
|
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 |
|
|
248
|
+
| triggerAsyncUserPipelineAction | pipelineName, payload, returnTraces |
|
|
249
|
+
| setDefaultUserPipelineReleaseMutation | pipelineReleaseName |
|
|
250
|
+
| restoreUserPipelineReleaseMutation | pipelineReleaseName |
|
|
251
|
+
| triggerUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces |
|
|
252
|
+
| triggerAsyncUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces |
|
|
253
|
+
|
|
254
|
+
### Connector
|
|
255
|
+
|
|
256
|
+
### Create new connector
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
userName : check your userName: https://console.instill.tech/settings
|
|
260
|
+
|
|
261
|
+
query.ConnectorClient.createUserConnectorResourceMutation("<userName>",
|
|
262
|
+
{
|
|
263
|
+
"id": "open-ai-model-1",
|
|
264
|
+
"connector_definition_name": "connector-definitions/ai-openai",
|
|
265
|
+
"configuration": {
|
|
266
|
+
"organization": "my-org",
|
|
267
|
+
"api_key": "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"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
).then((response) => {
|
|
271
|
+
console.log(response.data)
|
|
272
|
+
})
|
|
273
|
+
.catch(error => {
|
|
274
|
+
console.log(error)
|
|
275
|
+
})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
| function | params |
|
|
279
|
+
| :---------------------------------------- | :---------------------------------------: |
|
|
280
|
+
| listConnectorResourcesQuery | userName, pageSize, nextPageToken, filter |
|
|
281
|
+
| listUserConnectorResourcesQuery | pageSize, nextPageToken, filter |
|
|
282
|
+
| listConnectorDefinitionsQuery | connectorDefinitionName |
|
|
283
|
+
| getConnectorDefinitionQuery | connectorDefinitionName |
|
|
284
|
+
| getUserConnectorResourceQuery | connectorDefinitionName |
|
|
285
|
+
| watchUserConnectorResource | connectorResourceName |
|
|
286
|
+
| createUserConnectorResourceMutation | userName, payload |
|
|
287
|
+
| deleteUserConnectorResourceMutation | payload |
|
|
288
|
+
| updateUserConnectorResourceMutation | payload |
|
|
289
|
+
| renameUserConnectorResource | payload |
|
|
290
|
+
| testUserConnectorResourceConnectionAction | connectorDefinitionName |
|
|
291
|
+
| connectUserConnectorResourceAction | connectorDefinitionName |
|
|
292
|
+
| disconnectUserConnectorResourceAction | connectorDefinitionName |
|
|
293
|
+
|
|
294
|
+
### Metric
|
|
295
|
+
|
|
296
|
+
| function | params |
|
|
297
|
+
| :------------------------------ | :-----------------------------: |
|
|
298
|
+
| listPipelineTriggerRecordsQuery | pageSize, nextPageToken, filter |
|
|
299
|
+
| listTriggeredPipelineQuery | pageSize, nextPageToken, filter |
|
|
300
|
+
| listTriggeredPipelineChartQuery | pageSize, nextPageToken, filter |
|
|
301
|
+
|
|
302
|
+
### Model
|
|
303
|
+
|
|
304
|
+
| function | params |
|
|
305
|
+
| :------------------------ | :-------------------------------: |
|
|
306
|
+
| getModelDefinitionQuery | modelDefinitionName |
|
|
307
|
+
| listModelDefinitionsQuery | pageSize, nextPageToken |
|
|
308
|
+
| getUserModelQuery | modelName |
|
|
309
|
+
| listModelsQuery | pageSize, nextPageToken |
|
|
310
|
+
| listUserModelsQuery | userName, pageSize, nextPageToken |
|
|
311
|
+
| getUserModelReadmeQuery | modelName |
|
|
312
|
+
| watchUserModel | modelName |
|
|
313
|
+
| createUserModelMutation | userName, payload |
|
|
314
|
+
| updateModelMutation | payload |
|
|
315
|
+
| deleteUserModelMutation | modelName |
|
|
316
|
+
| deployUserModelAction | modelName |
|
|
317
|
+
| undeployUserModeleAction | modelName |
|
|
318
|
+
|
|
319
|
+
### Operation
|
|
320
|
+
|
|
321
|
+
| function | params |
|
|
322
|
+
| :------------------------ | :-----------: |
|
|
323
|
+
| getOperationQuery | operationName |
|
|
324
|
+
| checkUntilOperationIsDoen | operationName |
|
|
325
|
+
|
|
326
|
+
### Mgmt
|
|
327
|
+
|
|
328
|
+
### create API token
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
client.AuthClient.createApiTokenMutation({
|
|
333
|
+
"id": "aa",
|
|
334
|
+
"ttl": -1
|
|
335
|
+
}).then((response) => {
|
|
336
|
+
console.log(response.data)
|
|
337
|
+
})
|
|
338
|
+
.catch(error => {
|
|
339
|
+
console.log(error)
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
| function | params |
|
|
345
|
+
| :--------------------- | :---------------------: |
|
|
346
|
+
| getUserQuery | |
|
|
347
|
+
| checkUserIdExist | id |
|
|
348
|
+
| getApiTokenQuery | tokenName |
|
|
349
|
+
| listApiTokensQuery | pageSize, nextPageToken |
|
|
350
|
+
| updateUserMutation | payload |
|
|
351
|
+
| createApiTokenMutation | payload |
|
|
352
|
+
| deleteApiTokenMutation | tokenName |
|
|
353
|
+
|
|
354
|
+
## Contribution Guidelines:
|
|
355
|
+
|
|
356
|
+
Please refer to the [Contributing Guidelines](./.github/CONTRIBUTING.md) for more details.
|
|
357
|
+
|
|
358
|
+
## Release Notes:
|
|
359
|
+
|
|
360
|
+
[Release](./CHANGELOG.md)
|
|
361
|
+
|
|
362
|
+
## Genrate proto-ts
|
|
363
|
+
|
|
364
|
+
- run `./generate_proto.sh`
|
|
365
|
+
- it will genrate protobuf into `dist/protogen-ts`
|
|
366
|
+
|
|
367
|
+
## Support:
|
|
368
|
+
|
|
369
|
+
Contact details for help and support resources. This list isn't exhaustive but covers major aspects usually included in most SDK design documents.
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/mgmt/mutation.ts
|
|
2
|
+
async function updateUserMutation({
|
|
3
|
+
axiosInstance,
|
|
4
|
+
payload
|
|
5
|
+
}) {
|
|
6
|
+
try {
|
|
7
|
+
const { data } = await axiosInstance.patch(
|
|
8
|
+
"/users/me",
|
|
9
|
+
payload
|
|
10
|
+
);
|
|
11
|
+
return Promise.resolve(data.user);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
return Promise.reject(err);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function createApiTokenMutation({
|
|
17
|
+
axiosInstance,
|
|
18
|
+
payload
|
|
19
|
+
}) {
|
|
20
|
+
try {
|
|
21
|
+
const { data } = await axiosInstance.post(
|
|
22
|
+
"/tokens",
|
|
23
|
+
payload
|
|
24
|
+
);
|
|
25
|
+
return Promise.resolve(data.token);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
return Promise.reject(err);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function deleteApiTokenMutation({
|
|
31
|
+
axiosInstance,
|
|
32
|
+
tokenName
|
|
33
|
+
}) {
|
|
34
|
+
try {
|
|
35
|
+
await axiosInstance.delete(`/${tokenName}`);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
return Promise.reject(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function changePasswordMutation({
|
|
41
|
+
axiosInstance,
|
|
42
|
+
payload
|
|
43
|
+
}) {
|
|
44
|
+
try {
|
|
45
|
+
await axiosInstance.post("/auth/change_password", payload);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
return Promise.reject(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
updateUserMutation,
|
|
53
|
+
createApiTokenMutation,
|
|
54
|
+
deleteApiTokenMutation,
|
|
55
|
+
changePasswordMutation
|
|
56
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import {
|
|
2
|
+
restoreUserPipelineReleaseMutation,
|
|
3
|
+
setDefaultUserPipelineReleaseMutation,
|
|
4
|
+
triggerAsyncUserPipelineAction,
|
|
5
|
+
triggerAsyncUserPipelineReleaseAction,
|
|
6
|
+
triggerUserPipelineAction,
|
|
7
|
+
triggerUserPipelineReleaseAction
|
|
8
|
+
} from "./chunk-NRP5M7FG.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createUserPipelineMutation,
|
|
11
|
+
createUserPipelineReleaseMutation,
|
|
12
|
+
deleteUserPipelineMutation,
|
|
13
|
+
deleteUserPipelineReleaseMutation,
|
|
14
|
+
renameUserPipelineMutation,
|
|
15
|
+
updateUserPipelineMutation,
|
|
16
|
+
updateUserPipelineReleaseMutation
|
|
17
|
+
} from "./chunk-QLWRKSUE.mjs";
|
|
18
|
+
import {
|
|
19
|
+
ListUserPipelineReleasesQuery,
|
|
20
|
+
getUserPipelineQuery,
|
|
21
|
+
getUserPipelineReleaseQuery,
|
|
22
|
+
listPipelinesQuery,
|
|
23
|
+
listUserPipelinesQuery,
|
|
24
|
+
watchUserPipelineReleaseQuery
|
|
25
|
+
} from "./chunk-ECC5KF6S.mjs";
|
|
26
|
+
|
|
27
|
+
// src/pipeline/PipelineClient.ts
|
|
28
|
+
import axios from "axios";
|
|
29
|
+
var PipelineClient = class {
|
|
30
|
+
// Define your specific API methods here
|
|
31
|
+
axiosInstance;
|
|
32
|
+
constructor(baseUrl, appVersion, apiToken) {
|
|
33
|
+
let URL = `${baseUrl}/vdp/${appVersion}`;
|
|
34
|
+
this.axiosInstance = axios.create({
|
|
35
|
+
baseURL: URL,
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${apiToken}`
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/* -------------------------------------------------------------------------
|
|
42
|
+
* Pipeline Queries
|
|
43
|
+
* -----------------------------------------------------------------------*/
|
|
44
|
+
async listPipelinesQuery({
|
|
45
|
+
pageSize,
|
|
46
|
+
nextPageToken
|
|
47
|
+
}) {
|
|
48
|
+
return listPipelinesQuery({
|
|
49
|
+
axiosInstance: this.axiosInstance,
|
|
50
|
+
pageSize,
|
|
51
|
+
nextPageToken
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async listUserPipelinesQuery({
|
|
55
|
+
pageSize,
|
|
56
|
+
nextPageToken,
|
|
57
|
+
userName
|
|
58
|
+
}) {
|
|
59
|
+
return listUserPipelinesQuery({
|
|
60
|
+
axiosInstance: this.axiosInstance,
|
|
61
|
+
pageSize,
|
|
62
|
+
nextPageToken,
|
|
63
|
+
userName
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async getUserPipelineQuery({ pipelineName }) {
|
|
67
|
+
return getUserPipelineQuery({
|
|
68
|
+
axiosInstance: this.axiosInstance,
|
|
69
|
+
pipelineName
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/* -------------------------------------------------------------------------
|
|
73
|
+
* Pipeline Release
|
|
74
|
+
* -----------------------------------------------------------------------*/
|
|
75
|
+
async ListUserPipelineReleasesQuery({
|
|
76
|
+
pipelineName,
|
|
77
|
+
pageSize,
|
|
78
|
+
nextPageToken
|
|
79
|
+
}) {
|
|
80
|
+
return ListUserPipelineReleasesQuery({
|
|
81
|
+
axiosInstance: this.axiosInstance,
|
|
82
|
+
pipelineName,
|
|
83
|
+
pageSize,
|
|
84
|
+
nextPageToken
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async getUserPipelineReleaseQuery({
|
|
88
|
+
pipelineReleaseName
|
|
89
|
+
}) {
|
|
90
|
+
return getUserPipelineReleaseQuery({
|
|
91
|
+
axiosInstance: this.axiosInstance,
|
|
92
|
+
pipelineReleaseName
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async watchUserPipelineReleaseQuery({
|
|
96
|
+
pipelineReleaseName
|
|
97
|
+
}) {
|
|
98
|
+
return watchUserPipelineReleaseQuery({
|
|
99
|
+
axiosInstance: this.axiosInstance,
|
|
100
|
+
pipelineReleaseName
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/* -------------------------------------------------------------------------
|
|
104
|
+
* Pipeline Mutation
|
|
105
|
+
* -----------------------------------------------------------------------*/
|
|
106
|
+
async createUserPipelineMutation({
|
|
107
|
+
userName,
|
|
108
|
+
payload
|
|
109
|
+
}) {
|
|
110
|
+
return createUserPipelineMutation({
|
|
111
|
+
axiosInstance: this.axiosInstance,
|
|
112
|
+
userName,
|
|
113
|
+
payload
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async updateUserPipelineMutation({
|
|
117
|
+
payload
|
|
118
|
+
}) {
|
|
119
|
+
return updateUserPipelineMutation({
|
|
120
|
+
axiosInstance: this.axiosInstance,
|
|
121
|
+
payload
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async deleteUserPipelineMutation({ pipelineName }) {
|
|
125
|
+
return deleteUserPipelineMutation({
|
|
126
|
+
axiosInstance: this.axiosInstance,
|
|
127
|
+
pipelineName
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async renameUserPipelineMutation({
|
|
131
|
+
payload
|
|
132
|
+
}) {
|
|
133
|
+
return renameUserPipelineMutation({
|
|
134
|
+
axiosInstance: this.axiosInstance,
|
|
135
|
+
payload
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/* -------------------------------------------------------------------------
|
|
139
|
+
* Pipeline Release
|
|
140
|
+
* -----------------------------------------------------------------------*/
|
|
141
|
+
async createUserPipelineReleaseMutation({
|
|
142
|
+
pipelineName,
|
|
143
|
+
payload
|
|
144
|
+
}) {
|
|
145
|
+
return createUserPipelineReleaseMutation({
|
|
146
|
+
axiosInstance: this.axiosInstance,
|
|
147
|
+
pipelineName,
|
|
148
|
+
payload
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
async updateUserPipelineReleaseMutation({
|
|
152
|
+
payload,
|
|
153
|
+
pipelineReleaseName
|
|
154
|
+
}) {
|
|
155
|
+
return updateUserPipelineReleaseMutation({
|
|
156
|
+
axiosInstance: this.axiosInstance,
|
|
157
|
+
payload,
|
|
158
|
+
pipelineReleaseName
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async deleteUserPipelineReleaseMutation({
|
|
162
|
+
pipelineReleaseName
|
|
163
|
+
}) {
|
|
164
|
+
return deleteUserPipelineReleaseMutation({
|
|
165
|
+
axiosInstance: this.axiosInstance,
|
|
166
|
+
pipelineReleaseName
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/* -------------------------------------------------------------------------
|
|
170
|
+
* Pipeline Actions
|
|
171
|
+
* -----------------------------------------------------------------------*/
|
|
172
|
+
async triggerUserPipelineAction({
|
|
173
|
+
pipelineName,
|
|
174
|
+
payload,
|
|
175
|
+
returnTraces
|
|
176
|
+
}) {
|
|
177
|
+
return triggerUserPipelineAction({
|
|
178
|
+
axiosInstance: this.axiosInstance,
|
|
179
|
+
pipelineName,
|
|
180
|
+
payload,
|
|
181
|
+
returnTraces
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
async triggerAsyncUserPipelineAction({
|
|
185
|
+
pipelineName,
|
|
186
|
+
payload,
|
|
187
|
+
returnTraces
|
|
188
|
+
}) {
|
|
189
|
+
return triggerAsyncUserPipelineAction({
|
|
190
|
+
axiosInstance: this.axiosInstance,
|
|
191
|
+
pipelineName,
|
|
192
|
+
payload,
|
|
193
|
+
returnTraces
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/* -------------------------------------------------------------------------
|
|
197
|
+
* Pipeline Release
|
|
198
|
+
* -----------------------------------------------------------------------*/
|
|
199
|
+
async setDefaultUserPipelineReleaseMutation({
|
|
200
|
+
pipelineReleaseName
|
|
201
|
+
}) {
|
|
202
|
+
return setDefaultUserPipelineReleaseMutation({
|
|
203
|
+
axiosInstance: this.axiosInstance,
|
|
204
|
+
pipelineReleaseName
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
async restoreUserPipelineReleaseMutation({
|
|
208
|
+
pipelineReleaseName
|
|
209
|
+
}) {
|
|
210
|
+
return restoreUserPipelineReleaseMutation({
|
|
211
|
+
axiosInstance: this.axiosInstance,
|
|
212
|
+
pipelineReleaseName
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
async triggerUserPipelineReleaseAction({
|
|
216
|
+
pipelineReleaseName,
|
|
217
|
+
payload,
|
|
218
|
+
returnTraces
|
|
219
|
+
}) {
|
|
220
|
+
return triggerUserPipelineReleaseAction({
|
|
221
|
+
axiosInstance: this.axiosInstance,
|
|
222
|
+
pipelineReleaseName,
|
|
223
|
+
payload,
|
|
224
|
+
returnTraces
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
async triggerAsyncUserPipelineReleaseAction({
|
|
228
|
+
pipelineReleaseName,
|
|
229
|
+
payload,
|
|
230
|
+
returnTraces
|
|
231
|
+
}) {
|
|
232
|
+
return triggerAsyncUserPipelineReleaseAction({
|
|
233
|
+
axiosInstance: this.axiosInstance,
|
|
234
|
+
pipelineReleaseName,
|
|
235
|
+
payload,
|
|
236
|
+
returnTraces
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var PipelineClient_default = PipelineClient;
|
|
241
|
+
|
|
242
|
+
export {
|
|
243
|
+
PipelineClient_default
|
|
244
|
+
};
|