@daocloud-proto/hydra 0.1.0
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/common/common.pb.ts +68 -0
- package/common/error.pb.ts +10 -0
- package/fetch.pb.ts +341 -0
- package/management-api/agent/v1alpha1/event.pb.ts +56 -0
- package/management-api/apikey/v1alpha1/apikey.pb.ts +47 -0
- package/management-api/model/v1alpha1/model.pb.ts +59 -0
- package/management-api/model/v1alpha1/provider.pb.ts +48 -0
- package/management-api/model_serving/v1alpha1/model_serving.pb.ts +87 -0
- package/management-api/product/v1alpha1/product.pb.ts +78 -0
- package/package.json +7 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
export type NoParamsQuery = {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type Pagination = {
|
|
10
|
+
total?: number
|
|
11
|
+
page?: number
|
|
12
|
+
pageSize?: number
|
|
13
|
+
sort?: string
|
|
14
|
+
search?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type I18nName = {
|
|
18
|
+
zhCn?: string
|
|
19
|
+
enUs?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type SearchIndex = {
|
|
23
|
+
searchKey?: string
|
|
24
|
+
objectPath?: string
|
|
25
|
+
customPath?: string
|
|
26
|
+
dbPath?: string
|
|
27
|
+
dbI18N?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type AuthResourceAction = {
|
|
31
|
+
resourceType?: string
|
|
32
|
+
action?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type Auth = {
|
|
36
|
+
skipAuth?: boolean
|
|
37
|
+
devloper?: AuthResourceAction
|
|
38
|
+
operator?: AuthResourceAction
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type AuditObject = {
|
|
42
|
+
nameKey?: string
|
|
43
|
+
namespaceKey?: string
|
|
44
|
+
clusterKey?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type AuditObjectKind = {
|
|
48
|
+
kindName?: string
|
|
49
|
+
kindGroup?: string
|
|
50
|
+
kindVersion?: string
|
|
51
|
+
kindKey?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type Audit = {
|
|
55
|
+
object?: AuditObject
|
|
56
|
+
objectKind?: AuditObjectKind
|
|
57
|
+
action?: string
|
|
58
|
+
actionKey?: string
|
|
59
|
+
customObject?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AuditObject = {
|
|
63
|
+
namespace?: string
|
|
64
|
+
name?: string
|
|
65
|
+
kind?: string
|
|
66
|
+
group?: string
|
|
67
|
+
version?: string
|
|
68
|
+
}
|
package/fetch.pb.ts
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* base64 encoder and decoder
|
|
9
|
+
* Copied and adapted from https://github.com/protobufjs/protobuf.js/blob/master/lib/base64/index.js
|
|
10
|
+
*/
|
|
11
|
+
// Base64 encoding table
|
|
12
|
+
const b64 = new Array(64);
|
|
13
|
+
|
|
14
|
+
// Base64 decoding table
|
|
15
|
+
const s64 = new Array(123);
|
|
16
|
+
|
|
17
|
+
// 65..90, 97..122, 48..57, 43, 47
|
|
18
|
+
for (let i = 0; i < 64;)
|
|
19
|
+
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
|
20
|
+
|
|
21
|
+
export function b64Encode(buffer: Uint8Array, start: number, end: number): string {
|
|
22
|
+
let parts: string[] = null;
|
|
23
|
+
const chunk = [];
|
|
24
|
+
let i = 0, // output index
|
|
25
|
+
j = 0, // goto index
|
|
26
|
+
t; // temporary
|
|
27
|
+
while (start < end) {
|
|
28
|
+
const b = buffer[start++];
|
|
29
|
+
switch (j) {
|
|
30
|
+
case 0:
|
|
31
|
+
chunk[i++] = b64[b >> 2];
|
|
32
|
+
t = (b & 3) << 4;
|
|
33
|
+
j = 1;
|
|
34
|
+
break;
|
|
35
|
+
case 1:
|
|
36
|
+
chunk[i++] = b64[t | b >> 4];
|
|
37
|
+
t = (b & 15) << 2;
|
|
38
|
+
j = 2;
|
|
39
|
+
break;
|
|
40
|
+
case 2:
|
|
41
|
+
chunk[i++] = b64[t | b >> 6];
|
|
42
|
+
chunk[i++] = b64[b & 63];
|
|
43
|
+
j = 0;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
if (i > 8191) {
|
|
47
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
|
48
|
+
i = 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (j) {
|
|
52
|
+
chunk[i++] = b64[t];
|
|
53
|
+
chunk[i++] = 61;
|
|
54
|
+
if (j === 1)
|
|
55
|
+
chunk[i++] = 61;
|
|
56
|
+
}
|
|
57
|
+
if (parts) {
|
|
58
|
+
if (i)
|
|
59
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
60
|
+
return parts.join("");
|
|
61
|
+
}
|
|
62
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const invalidEncoding = "invalid encoding";
|
|
66
|
+
|
|
67
|
+
export function b64Decode(s: string): Uint8Array {
|
|
68
|
+
const buffer = [];
|
|
69
|
+
let offset = 0;
|
|
70
|
+
let j = 0, // goto index
|
|
71
|
+
t; // temporary
|
|
72
|
+
for (let i = 0; i < s.length;) {
|
|
73
|
+
let c = s.charCodeAt(i++);
|
|
74
|
+
if (c === 61 && j > 1)
|
|
75
|
+
break;
|
|
76
|
+
if ((c = s64[c]) === undefined)
|
|
77
|
+
throw Error(invalidEncoding);
|
|
78
|
+
switch (j) {
|
|
79
|
+
case 0:
|
|
80
|
+
t = c;
|
|
81
|
+
j = 1;
|
|
82
|
+
break;
|
|
83
|
+
case 1:
|
|
84
|
+
buffer[offset++] = t << 2 | (c & 48) >> 4;
|
|
85
|
+
t = c;
|
|
86
|
+
j = 2;
|
|
87
|
+
break;
|
|
88
|
+
case 2:
|
|
89
|
+
buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
|
90
|
+
t = c;
|
|
91
|
+
j = 3;
|
|
92
|
+
break;
|
|
93
|
+
case 3:
|
|
94
|
+
buffer[offset++] = (t & 3) << 6 | c;
|
|
95
|
+
j = 0;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (j === 1)
|
|
100
|
+
throw Error(invalidEncoding);
|
|
101
|
+
return new Uint8Array(buffer);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function b64Test(s: string): boolean {
|
|
105
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface InitReq extends RequestInit {
|
|
109
|
+
pathPrefix?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function replacer(key: any, value: any): any {
|
|
113
|
+
if(value && value.constructor === Uint8Array) {
|
|
114
|
+
return b64Encode(value, 0, value.length);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {
|
|
121
|
+
const {pathPrefix, ...req} = init || {}
|
|
122
|
+
|
|
123
|
+
const url = pathPrefix ? `${pathPrefix}${path}` : path
|
|
124
|
+
|
|
125
|
+
return fetch(url, req).then(r => r.json().then((body: O) => {
|
|
126
|
+
if (!r.ok) { throw body; }
|
|
127
|
+
return body;
|
|
128
|
+
})) as Promise<O>
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// NotifyStreamEntityArrival is a callback that will be called on streaming entity arrival
|
|
132
|
+
export type NotifyStreamEntityArrival<T> = (resp: T) => void
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* fetchStreamingRequest is able to handle grpc-gateway server side streaming call
|
|
136
|
+
* it takes NotifyStreamEntityArrival that lets users respond to entity arrival during the call
|
|
137
|
+
* all entities will be returned as an array after the call finishes.
|
|
138
|
+
**/
|
|
139
|
+
export async function fetchStreamingRequest<S, R>(path: string, callback?: NotifyStreamEntityArrival<R>, init?: InitReq) {
|
|
140
|
+
const {pathPrefix, ...req} = init || {}
|
|
141
|
+
const url = pathPrefix ?`${pathPrefix}${path}` : path
|
|
142
|
+
const result = await fetch(url, req)
|
|
143
|
+
// needs to use the .ok to check the status of HTTP status code
|
|
144
|
+
// http other than 200 will not throw an error, instead the .ok will become false.
|
|
145
|
+
// see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#
|
|
146
|
+
if (!result.ok) {
|
|
147
|
+
const resp = await result.json()
|
|
148
|
+
const errMsg = resp.error && resp.error.message ? resp.error.message : ""
|
|
149
|
+
throw new Error(errMsg)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!result.body) {
|
|
153
|
+
throw new Error("response doesnt have a body")
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
await result.body
|
|
157
|
+
.pipeThrough(new TextDecoderStream())
|
|
158
|
+
.pipeThrough<R>(getNewLineDelimitedJSONDecodingStream<R>())
|
|
159
|
+
.pipeTo(getNotifyEntityArrivalSink((e: R) => {
|
|
160
|
+
if (callback) {
|
|
161
|
+
callback(e)
|
|
162
|
+
}
|
|
163
|
+
}))
|
|
164
|
+
|
|
165
|
+
// wait for the streaming to finish and return the success respond
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* JSONStringStreamController represents the transform controller that's able to transform the incoming
|
|
171
|
+
* new line delimited json content stream into entities and able to push the entity to the down stream
|
|
172
|
+
*/
|
|
173
|
+
interface JSONStringStreamController<T> extends TransformStreamDefaultController {
|
|
174
|
+
buf?: string
|
|
175
|
+
pos?: number
|
|
176
|
+
enqueue: (s: T) => void
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* getNewLineDelimitedJSONDecodingStream returns a TransformStream that's able to handle new line delimited json stream content into parsed entities
|
|
181
|
+
*/
|
|
182
|
+
function getNewLineDelimitedJSONDecodingStream<T>(): TransformStream<string, T> {
|
|
183
|
+
return new TransformStream({
|
|
184
|
+
start(controller: JSONStringStreamController<T>) {
|
|
185
|
+
controller.buf = ''
|
|
186
|
+
controller.pos = 0
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
transform(chunk: string, controller: JSONStringStreamController<T>) {
|
|
190
|
+
if (controller.buf === undefined) {
|
|
191
|
+
controller.buf = ''
|
|
192
|
+
}
|
|
193
|
+
if (controller.pos === undefined) {
|
|
194
|
+
controller.pos = 0
|
|
195
|
+
}
|
|
196
|
+
controller.buf += chunk
|
|
197
|
+
while (controller.pos < controller.buf.length) {
|
|
198
|
+
if (controller.buf[controller.pos] === '\n') {
|
|
199
|
+
const line = controller.buf.substring(0, controller.pos)
|
|
200
|
+
const response = JSON.parse(line)
|
|
201
|
+
controller.enqueue(response.result)
|
|
202
|
+
controller.buf = controller.buf.substring(controller.pos + 1)
|
|
203
|
+
controller.pos = 0
|
|
204
|
+
} else {
|
|
205
|
+
++controller.pos
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* getNotifyEntityArrivalSink takes the NotifyStreamEntityArrival callback and return
|
|
215
|
+
* a sink that will call the callback on entity arrival
|
|
216
|
+
* @param notifyCallback
|
|
217
|
+
*/
|
|
218
|
+
function getNotifyEntityArrivalSink<T>(notifyCallback: NotifyStreamEntityArrival<T>) {
|
|
219
|
+
return new WritableStream<T>({
|
|
220
|
+
write(entity: T) {
|
|
221
|
+
notifyCallback(entity)
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type Primitive = string | boolean | number;
|
|
227
|
+
type RequestPayload = Record<string, unknown>;
|
|
228
|
+
type FlattenedRequestPayload = Record<string, Primitive | Array<Primitive>>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Checks if given value is a plain object
|
|
232
|
+
* Logic copied and adapted from below source:
|
|
233
|
+
* https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js
|
|
234
|
+
* @param {unknown} value
|
|
235
|
+
* @return {boolean}
|
|
236
|
+
*/
|
|
237
|
+
function isPlainObject(value: unknown): boolean {
|
|
238
|
+
const isObject =
|
|
239
|
+
Object.prototype.toString.call(value).slice(8, -1) === "Object";
|
|
240
|
+
const isObjLike = value !== null && isObject;
|
|
241
|
+
|
|
242
|
+
if (!isObjLike || !isObject) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const proto = Object.getPrototypeOf(value);
|
|
247
|
+
|
|
248
|
+
const hasObjectConstructor =
|
|
249
|
+
typeof proto === "object" &&
|
|
250
|
+
proto.constructor === Object.prototype.constructor;
|
|
251
|
+
|
|
252
|
+
return hasObjectConstructor;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Checks if given value is of a primitive type
|
|
257
|
+
* @param {unknown} value
|
|
258
|
+
* @return {boolean}
|
|
259
|
+
*/
|
|
260
|
+
function isPrimitive(value: unknown): boolean {
|
|
261
|
+
return ["string", "number", "boolean"].some(t => typeof value === t);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Checks if given primitive is zero-value
|
|
266
|
+
* @param {Primitive} value
|
|
267
|
+
* @return {boolean}
|
|
268
|
+
*/
|
|
269
|
+
function isZeroValuePrimitive(value: Primitive): boolean {
|
|
270
|
+
return value === false || value === 0 || value === "";
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Flattens a deeply nested request payload and returns an object
|
|
275
|
+
* with only primitive values and non-empty array of primitive values
|
|
276
|
+
* as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
|
|
277
|
+
* @param {RequestPayload} requestPayload
|
|
278
|
+
* @param {String} path
|
|
279
|
+
* @return {FlattenedRequestPayload>}
|
|
280
|
+
*/
|
|
281
|
+
function flattenRequestPayload<T extends RequestPayload>(
|
|
282
|
+
requestPayload: T,
|
|
283
|
+
path: string = ""
|
|
284
|
+
): FlattenedRequestPayload {
|
|
285
|
+
return Object.keys(requestPayload).reduce(
|
|
286
|
+
(acc: T, key: string): T => {
|
|
287
|
+
const value = requestPayload[key];
|
|
288
|
+
const newPath = path ? [path, key].join(".") : key;
|
|
289
|
+
|
|
290
|
+
const isNonEmptyPrimitiveArray =
|
|
291
|
+
Array.isArray(value) &&
|
|
292
|
+
value.every(v => isPrimitive(v)) &&
|
|
293
|
+
value.length > 0;
|
|
294
|
+
|
|
295
|
+
const isNonZeroValuePrimitive =
|
|
296
|
+
isPrimitive(value) && !isZeroValuePrimitive(value as Primitive);
|
|
297
|
+
|
|
298
|
+
let objectToMerge = {};
|
|
299
|
+
|
|
300
|
+
if (isPlainObject(value)) {
|
|
301
|
+
objectToMerge = flattenRequestPayload(value as RequestPayload, newPath);
|
|
302
|
+
} else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) {
|
|
303
|
+
objectToMerge = { [newPath]: value };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return { ...acc, ...objectToMerge };
|
|
307
|
+
},
|
|
308
|
+
{} as T
|
|
309
|
+
) as FlattenedRequestPayload;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Renders a deeply nested request payload into a string of URL search
|
|
314
|
+
* parameters by first flattening the request payload and then removing keys
|
|
315
|
+
* which are already present in the URL path.
|
|
316
|
+
* @param {RequestPayload} requestPayload
|
|
317
|
+
* @param {string[]} urlPathParams
|
|
318
|
+
* @return {string}
|
|
319
|
+
*/
|
|
320
|
+
export function renderURLSearchParams<T extends RequestPayload>(
|
|
321
|
+
requestPayload: T,
|
|
322
|
+
urlPathParams: string[] = []
|
|
323
|
+
): string {
|
|
324
|
+
const flattenedRequestPayload = flattenRequestPayload(requestPayload);
|
|
325
|
+
|
|
326
|
+
const urlSearchParams = Object.keys(flattenedRequestPayload).reduce(
|
|
327
|
+
(acc: string[][], key: string): string[][] => {
|
|
328
|
+
// key should not be present in the url path as a parameter
|
|
329
|
+
const value = flattenedRequestPayload[key];
|
|
330
|
+
if (urlPathParams.find(f => f === key)) {
|
|
331
|
+
return acc;
|
|
332
|
+
}
|
|
333
|
+
return Array.isArray(value)
|
|
334
|
+
? [...acc, ...value.map(m => [key, m.toString()])]
|
|
335
|
+
: (acc = [...acc, [key, value.toString()]]);
|
|
336
|
+
},
|
|
337
|
+
[] as string[][]
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
return new URLSearchParams(urlSearchParams).toString();
|
|
341
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fm from "../../../fetch.pb"
|
|
8
|
+
import * as GoogleProtobufEmpty from "../../../google/protobuf/empty.pb"
|
|
9
|
+
import * as HydraManagement_apiApikeyV1alpha1Apikey from "../../apikey/v1alpha1/apikey.pb"
|
|
10
|
+
|
|
11
|
+
export enum APIKeyEventType {
|
|
12
|
+
UNKNOWN = "UNKNOWN",
|
|
13
|
+
DELETE = "DELETE",
|
|
14
|
+
OUT_OF_QUOTA = "OUT_OF_QUOTA",
|
|
15
|
+
RECOVERY = "RECOVERY",
|
|
16
|
+
UPDATE = "UPDATE",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type FetchAPIKeyRequest = {
|
|
20
|
+
key?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type APIKeyEvent = {
|
|
24
|
+
id?: string
|
|
25
|
+
key?: string
|
|
26
|
+
type?: APIKeyEventType
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type UsageReportRequestUsage = {
|
|
30
|
+
inputTokens?: number
|
|
31
|
+
outputTokens?: number
|
|
32
|
+
requests?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type UsageReportRequest = {
|
|
36
|
+
apiKeyId?: string
|
|
37
|
+
requestModelName?: string
|
|
38
|
+
upstreamModelName?: string
|
|
39
|
+
usage?: UsageReportRequestUsage
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type UsageReportResponse = {
|
|
43
|
+
accepted?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class AgentCommunicationService {
|
|
47
|
+
static FetchAPIKeyByKey(req: FetchAPIKeyRequest, initReq?: fm.InitReq): Promise<HydraManagement_apiApikeyV1alpha1Apikey.APIKey> {
|
|
48
|
+
return fm.fetchReq<FetchAPIKeyRequest, HydraManagement_apiApikeyV1alpha1Apikey.APIKey>(`/hydra.management_api.agent.v1alpha1.AgentCommunicationService/FetchAPIKeyByKey`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
49
|
+
}
|
|
50
|
+
static SubscribeAPIKeyEvent(req: GoogleProtobufEmpty.Empty, entityNotifier?: fm.NotifyStreamEntityArrival<APIKeyEvent>, initReq?: fm.InitReq): Promise<void> {
|
|
51
|
+
return fm.fetchStreamingRequest<GoogleProtobufEmpty.Empty, APIKeyEvent>(`/hydra.management_api.agent.v1alpha1.AgentCommunicationService/SubscribeAPIKeyEvent`, entityNotifier, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
52
|
+
}
|
|
53
|
+
static UsageReport(req: UsageReportRequest, initReq?: fm.InitReq): Promise<UsageReportResponse> {
|
|
54
|
+
return fm.fetchReq<UsageReportRequest, UsageReportResponse>(`/hydra.management_api.agent.v1alpha1.AgentCommunicationService/UsageReport`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
export type CreateAPIKeyRequest = {
|
|
11
|
+
allowModels?: string[]
|
|
12
|
+
name?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type APIKey = {
|
|
16
|
+
id?: string
|
|
17
|
+
key?: string
|
|
18
|
+
userId?: string
|
|
19
|
+
allowModels?: string[]
|
|
20
|
+
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
21
|
+
name?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ListAPIKeyRequest = {
|
|
25
|
+
page?: HydraCommonCommon.Pagination
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type ListAPIKeyResponse = {
|
|
29
|
+
items?: APIKey[]
|
|
30
|
+
page?: HydraCommonCommon.Pagination
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type DeleteAPIKeyRequest = {
|
|
34
|
+
id?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class APIKeyManagement {
|
|
38
|
+
static CreateAPIKey(req: CreateAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
39
|
+
return fm.fetchReq<CreateAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/apikeys`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
40
|
+
}
|
|
41
|
+
static ListAPIKey(req: ListAPIKeyRequest, initReq?: fm.InitReq): Promise<ListAPIKeyResponse> {
|
|
42
|
+
return fm.fetchReq<ListAPIKeyRequest, ListAPIKeyResponse>(`/apis/hydra.io/v1alpha1/apikeys?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
43
|
+
}
|
|
44
|
+
static DeleteAPIKey(req: DeleteAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
45
|
+
return fm.fetchReq<DeleteAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
|
|
11
|
+
export enum ModelSupportFeature {
|
|
12
|
+
MODEL_SUPPORT_TYPE_UNSPECIFIED = "MODEL_SUPPORT_TYPE_UNSPECIFIED",
|
|
13
|
+
TEXT_GENERATION = "TEXT_GENERATION",
|
|
14
|
+
VIDEO_TO_TEXT = "VIDEO_TO_TEXT",
|
|
15
|
+
TEXT_TO_VIDEO = "TEXT_TO_VIDEO",
|
|
16
|
+
IMAGE_TO_IMAGE = "IMAGE_TO_IMAGE",
|
|
17
|
+
IMAGE_TO_TEXT = "IMAGE_TO_TEXT",
|
|
18
|
+
TEXT_TO_IMAGE = "TEXT_TO_IMAGE",
|
|
19
|
+
EMBEDDING = "EMBEDDING",
|
|
20
|
+
RERANK_MODEL = "RERANK_MODEL",
|
|
21
|
+
AUDIO_TO_AUDIO = "AUDIO_TO_AUDIO",
|
|
22
|
+
AUDIO_TO_TEXT = "AUDIO_TO_TEXT",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type Model = {
|
|
26
|
+
modelId?: string
|
|
27
|
+
modelAvatar?: string
|
|
28
|
+
modelName?: string
|
|
29
|
+
providerId?: string
|
|
30
|
+
providerName?: HydraCommonCommon.I18nName
|
|
31
|
+
gpuSupport?: string[]
|
|
32
|
+
modelDescription?: HydraCommonCommon.I18nName
|
|
33
|
+
finetune?: boolean
|
|
34
|
+
modelSupportFeature?: ModelSupportFeature[]
|
|
35
|
+
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
36
|
+
updateTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type ListModelRequest = {
|
|
40
|
+
page?: HydraCommonCommon.Pagination
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ListModelResponse = {
|
|
44
|
+
items?: Model[]
|
|
45
|
+
page?: HydraCommonCommon.Pagination
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type SingleModelRequest = {
|
|
49
|
+
modelId?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class ModelManagement {
|
|
53
|
+
static GetModel(req: SingleModelRequest, initReq?: fm.InitReq): Promise<Model> {
|
|
54
|
+
return fm.fetchReq<SingleModelRequest, Model>(`/apis/hydra.io/v1alpha1/models/${req["modelId"]}?${fm.renderURLSearchParams(req, ["modelId"])}`, {...initReq, method: "GET"})
|
|
55
|
+
}
|
|
56
|
+
static ListModels(req: ListModelRequest, initReq?: fm.InitReq): Promise<ListModelResponse> {
|
|
57
|
+
return fm.fetchReq<ListModelRequest, ListModelResponse>(`/apis/hydra.io/v1alpha1/models?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
export type CreateProviderRequest = {
|
|
11
|
+
providerName?: string
|
|
12
|
+
providerAvatar?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Provider = {
|
|
16
|
+
providerId?: string
|
|
17
|
+
providerName?: HydraCommonCommon.I18nName
|
|
18
|
+
providerAvatar?: string
|
|
19
|
+
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type ListProviderRequest = {
|
|
23
|
+
page?: HydraCommonCommon.Pagination
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ListProviderResponse = {
|
|
27
|
+
items?: Provider[]
|
|
28
|
+
page?: HydraCommonCommon.Pagination
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SingleProviderRequest = {
|
|
32
|
+
id?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class ProviderManagement {
|
|
36
|
+
static CreateProvider(req: CreateProviderRequest, initReq?: fm.InitReq): Promise<Provider> {
|
|
37
|
+
return fm.fetchReq<CreateProviderRequest, Provider>(`/apis/hydra.io/v1alpha1/providers`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
38
|
+
}
|
|
39
|
+
static GetProvider(req: SingleProviderRequest, initReq?: fm.InitReq): Promise<Provider> {
|
|
40
|
+
return fm.fetchReq<SingleProviderRequest, Provider>(`/apis/hydra.io/v1alpha1/providers/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
|
|
41
|
+
}
|
|
42
|
+
static ListProvider(req: ListProviderRequest, initReq?: fm.InitReq): Promise<ListProviderResponse> {
|
|
43
|
+
return fm.fetchReq<ListProviderRequest, ListProviderResponse>(`/apis/hydra.io/v1alpha1/providers?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
44
|
+
}
|
|
45
|
+
static DeleteProvider(req: SingleProviderRequest, initReq?: fm.InitReq): Promise<Provider> {
|
|
46
|
+
return fm.fetchReq<SingleProviderRequest, Provider>(`/apis/hydra.io/v1alpha1/providers/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
|
|
11
|
+
export enum PaymentMethod {
|
|
12
|
+
PAYMENT_METHOD_UNSPECIFIED = "PAYMENT_METHOD_UNSPECIFIED",
|
|
13
|
+
PAY_AS_YOU_GO = "PAY_AS_YOU_GO",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum ModelServingStatus {
|
|
17
|
+
STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
|
|
18
|
+
DEPLOYING = "DEPLOYING",
|
|
19
|
+
DEPLOY_FAILED = "DEPLOY_FAILED",
|
|
20
|
+
RUNNING = "RUNNING",
|
|
21
|
+
UPDATING = "UPDATING",
|
|
22
|
+
DELETING = "DELETING",
|
|
23
|
+
STOPPED = "STOPPED",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type CreateModelServingRequest = {
|
|
27
|
+
name?: string
|
|
28
|
+
modelId?: string
|
|
29
|
+
region?: string
|
|
30
|
+
replicas?: number
|
|
31
|
+
skuId?: string
|
|
32
|
+
paymentMethods?: PaymentMethod
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type ModelServing = {
|
|
36
|
+
id?: string
|
|
37
|
+
name?: string
|
|
38
|
+
modelId?: string
|
|
39
|
+
modelName?: string
|
|
40
|
+
region?: string
|
|
41
|
+
replicas?: number
|
|
42
|
+
skuId?: string
|
|
43
|
+
paymentMethods?: PaymentMethod
|
|
44
|
+
status?: ModelServingStatus
|
|
45
|
+
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
46
|
+
accessModelName?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type ListModelServingRequest = {
|
|
50
|
+
page?: HydraCommonCommon.Pagination
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ListModelServingResponse = {
|
|
54
|
+
page?: HydraCommonCommon.Pagination
|
|
55
|
+
items?: ModelServing[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type GetModelServingRequest = {
|
|
59
|
+
id?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type DeleteModelServingRequest = {
|
|
63
|
+
id?: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type UpdateModelServingReplicasRequest = {
|
|
67
|
+
id?: string
|
|
68
|
+
replicas?: number
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class ModelServingManagement {
|
|
72
|
+
static CreateModelServing(req: CreateModelServingRequest, initReq?: fm.InitReq): Promise<ModelServing> {
|
|
73
|
+
return fm.fetchReq<CreateModelServingRequest, ModelServing>(`/apis/hydra.io/v1alpha1/model-serving`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
74
|
+
}
|
|
75
|
+
static ListModelServing(req: ListModelServingRequest, initReq?: fm.InitReq): Promise<ListModelServingResponse> {
|
|
76
|
+
return fm.fetchReq<ListModelServingRequest, ListModelServingResponse>(`/apis/hydra.io/v1alpha1/model-serving?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
77
|
+
}
|
|
78
|
+
static GetModelServing(req: GetModelServingRequest, initReq?: fm.InitReq): Promise<ModelServing> {
|
|
79
|
+
return fm.fetchReq<GetModelServingRequest, ModelServing>(`/apis/hydra.io/v1alpha1/model-serving/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
|
|
80
|
+
}
|
|
81
|
+
static DeleteModelServing(req: DeleteModelServingRequest, initReq?: fm.InitReq): Promise<ModelServing> {
|
|
82
|
+
return fm.fetchReq<DeleteModelServingRequest, ModelServing>(`/apis/hydra.io/v1alpha1/model-serving/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
83
|
+
}
|
|
84
|
+
static UpdateModelServingReplicas(req: UpdateModelServingReplicasRequest, initReq?: fm.InitReq): Promise<ModelServing> {
|
|
85
|
+
return fm.fetchReq<UpdateModelServingReplicasRequest, ModelServing>(`/apis/hydra.io/v1alpha1/model-serving/${req["id"]}`, {...initReq, method: "PATCH", body: JSON.stringify(req, fm.replacer)})
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
|
|
10
|
+
export enum SKUPaymentMethod {
|
|
11
|
+
PAYMENT_METHOD_UNSPECIFIED = "PAYMENT_METHOD_UNSPECIFIED",
|
|
12
|
+
POSTPAID = "POSTPAID",
|
|
13
|
+
PREPAID = "PREPAID",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum SKUPriceCurrency {
|
|
17
|
+
PRICE_UNIT_UNSPECIFIED = "PRICE_UNIT_UNSPECIFIED",
|
|
18
|
+
CNY = "CNY",
|
|
19
|
+
USD = "USD",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum ListSKURequestResourceType {
|
|
23
|
+
RESOURCE_TYPE_UNSPECIFIED = "RESOURCE_TYPE_UNSPECIFIED",
|
|
24
|
+
MODEL_SERVING = "MODEL_SERVING",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type Region = {
|
|
28
|
+
region?: string
|
|
29
|
+
name?: HydraCommonCommon.I18nName
|
|
30
|
+
baseUrl?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ListRegionRequest = {
|
|
34
|
+
page?: HydraCommonCommon.Pagination
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ListRegionResponse = {
|
|
38
|
+
items?: Region[]
|
|
39
|
+
page?: HydraCommonCommon.Pagination
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type GetRegionRequest = {
|
|
43
|
+
name?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type SKU = {
|
|
47
|
+
id?: string
|
|
48
|
+
description?: string
|
|
49
|
+
region?: string
|
|
50
|
+
paymentMethod?: SKUPaymentMethod
|
|
51
|
+
pricePerUnit?: string
|
|
52
|
+
priceCurrency?: SKUPriceCurrency
|
|
53
|
+
available?: boolean
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type ListSKURequest = {
|
|
57
|
+
region?: string
|
|
58
|
+
resourceType?: ListSKURequestResourceType
|
|
59
|
+
resourceId?: string
|
|
60
|
+
page?: HydraCommonCommon.Pagination
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type ListSKUResponse = {
|
|
64
|
+
items?: SKU[]
|
|
65
|
+
page?: HydraCommonCommon.Pagination
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class SKUManagement {
|
|
69
|
+
static ListRegions(req: ListRegionRequest, initReq?: fm.InitReq): Promise<ListRegionResponse> {
|
|
70
|
+
return fm.fetchReq<ListRegionRequest, ListRegionResponse>(`/apis/hydra.io/v1alpha1/regions?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
71
|
+
}
|
|
72
|
+
static GetRegion(req: GetRegionRequest, initReq?: fm.InitReq): Promise<Region> {
|
|
73
|
+
return fm.fetchReq<GetRegionRequest, Region>(`/apis/hydra.io/v1alpha1/regions/${req["name"]}?${fm.renderURLSearchParams(req, ["name"])}`, {...initReq, method: "GET"})
|
|
74
|
+
}
|
|
75
|
+
static ListSKUs(req: ListSKURequest, initReq?: fm.InitReq): Promise<ListSKUResponse> {
|
|
76
|
+
return fm.fetchReq<ListSKURequest, ListSKUResponse>(`/apis/hydra.io/v1alpha1/skus?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
77
|
+
}
|
|
78
|
+
}
|