@daocloud-proto/hydra 0.5.0-dev-7 → 0.5.0-dev-9

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.
@@ -8,6 +8,15 @@ import * as HydraCommonCommon from "../../../common/common.pb"
8
8
  import * as fm from "../../../fetch.pb"
9
9
  import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
10
10
  import * as HydraManagement_apiModelV1alpha1Model from "../../../management-api/model/v1alpha1/model.pb"
11
+
12
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
13
+ type OneOf<T> =
14
+ | { [k in keyof T]?: undefined }
15
+ | (
16
+ keyof T extends infer K ?
17
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
18
+ : never)
19
+ : never);
11
20
  export type CreateModelRequest = {
12
21
  modelId?: string
13
22
  modelAvatar?: string
@@ -73,13 +82,20 @@ export type SingleModelRequest = {
73
82
  modelId?: string
74
83
  }
75
84
 
76
- export type ImportModelRequest = {
77
- yAML?: string
78
- uRL?: string
85
+
86
+ type BaseParseModelSpecsRequest = {
79
87
  }
80
88
 
81
- export type ImportModelResponse = {
82
- items?: Model[]
89
+ export type ParseModelSpecsRequest = BaseParseModelSpecsRequest
90
+ & OneOf<{ yAML: string; uRL: string }>
91
+
92
+ export type ParsedModel = {
93
+ model?: Model
94
+ exist?: boolean
95
+ }
96
+
97
+ export type ParseModelSpecsResponse = {
98
+ items?: ParsedModel[]
83
99
  }
84
100
 
85
101
  export type BatchCreateModelsRequest = {
@@ -106,8 +122,8 @@ export class AdminModelManagement {
106
122
  static DeleteModel(req: SingleModelRequest, initReq?: fm.InitReq): Promise<Model> {
107
123
  return fm.fetchReq<SingleModelRequest, Model>(`/apis/admin.hydra.io/v1alpha1/models/${req["modelId"]}`, {...initReq, method: "DELETE"})
108
124
  }
109
- static ImportModel(req: ImportModelRequest, initReq?: fm.InitReq): Promise<ImportModelResponse> {
110
- return fm.fetchReq<ImportModelRequest, ImportModelResponse>(`/apis/admin.hydra.io/v1alpha1/models:import`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
125
+ static ParseModelSpecs(req: ParseModelSpecsRequest, initReq?: fm.InitReq): Promise<ParseModelSpecsResponse> {
126
+ return fm.fetchReq<ParseModelSpecsRequest, ParseModelSpecsResponse>(`/apis/admin.hydra.io/v1alpha1/models:parse`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
111
127
  }
112
128
  static BatchCreateModels(req: BatchCreateModelsRequest, initReq?: fm.InitReq): Promise<BatchCreateModelsResponse> {
113
129
  return fm.fetchReq<BatchCreateModelsRequest, BatchCreateModelsResponse>(`/apis/admin.hydra.io/v1alpha1/models:batch_create`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/hydra",
3
- "version": "v0.5.0-dev-7",
3
+ "version": "v0.5.0-dev-9",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"