@daocloud-proto/skoala 0.3.3-83 → 0.3.3-89

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.
@@ -89,10 +89,10 @@ export class Book {
89
89
  return fm.fetchReq<ListBookReq, ListBookReply>(`/v1alpha1/books?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
90
90
  }
91
91
  static Create(req: CreateBookReq, initReq?: fm.InitReq): Promise<CreateBookReply> {
92
- return fm.fetchReq<CreateBookReq, CreateBookReply>(`/v1alpha1/books`, {...initReq, method: "POST", body: JSON.stringify(req)})
92
+ return fm.fetchReq<CreateBookReq, CreateBookReply>(`/v1alpha1/books`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
93
93
  }
94
94
  static Update(req: UpdateBookReq, initReq?: fm.InitReq): Promise<UpdateBookRely> {
95
- return fm.fetchReq<UpdateBookReq, UpdateBookRely>(`/v1alpha1/books/${req["uid"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
95
+ return fm.fetchReq<UpdateBookReq, UpdateBookRely>(`/v1alpha1/books/${req["uid"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
96
96
  }
97
97
  static Delete(req: DeleteBookReq, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
98
98
  return fm.fetchReq<DeleteBookReq, GoogleProtobufEmpty.Empty>(`/v1alpha1/books/${req["uid"]}`, {...initReq, method: "DELETE"})
@@ -43,16 +43,16 @@ export class Registry {
43
43
  return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.GetRegistryReq, SkoalaApiIntegratedV1alpha1Registry.GetRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}?${fm.renderURLSearchParams(req, ["workspaceId", "registryId"])}`, {...initReq, method: "GET"})
44
44
  }
45
45
  static Create(req: SkoalaApiIntegratedV1alpha1Registry.CreateRegistryReq, initReq?: fm.InitReq): Promise<SkoalaApiIntegratedV1alpha1Registry.CreateRegistryRes> {
46
- return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.CreateRegistryReq, SkoalaApiIntegratedV1alpha1Registry.CreateRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries`, {...initReq, method: "POST", body: JSON.stringify(req)})
46
+ return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.CreateRegistryReq, SkoalaApiIntegratedV1alpha1Registry.CreateRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
47
47
  }
48
48
  static Update(req: SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryReq, initReq?: fm.InitReq): Promise<SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryRes> {
49
- return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryReq, SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
49
+ return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryReq, SkoalaApiIntegratedV1alpha1Registry.UpdateRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
50
50
  }
51
51
  static Delete(req: SkoalaApiIntegratedV1alpha1Registry.DeleteRegistryReq, initReq?: fm.InitReq): Promise<SkoalaApiIntegratedV1alpha1Registry.DeleteRegistryRes> {
52
52
  return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.DeleteRegistryReq, SkoalaApiIntegratedV1alpha1Registry.DeleteRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}`, {...initReq, method: "DELETE"})
53
53
  }
54
54
  static Ping(req: SkoalaApiIntegratedV1alpha1Registry.PingRegistryReq, initReq?: fm.InitReq): Promise<SkoalaApiIntegratedV1alpha1Registry.PingRegistryRes> {
55
- return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.PingRegistryReq, SkoalaApiIntegratedV1alpha1Registry.PingRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/ping`, {...initReq, method: "POST", body: JSON.stringify(req)})
55
+ return fm.fetchReq<SkoalaApiIntegratedV1alpha1Registry.PingRegistryReq, SkoalaApiIntegratedV1alpha1Registry.PingRegistryRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/ping`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
56
56
  }
57
57
  }
58
58
  export class Service {
@@ -71,7 +71,7 @@ export class Instance {
71
71
  return fm.fetchReq<SkoalaApiIntegratedV1alpha1Instance.GetInstanceReq, SkoalaApiIntegratedV1alpha1Instance.GetInstanceRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}/services/${req["serviceName"]}/instances/${req["instanceId"]}?${fm.renderURLSearchParams(req, ["workspaceId", "registryId", "serviceName", "instanceId"])}`, {...initReq, method: "GET"})
72
72
  }
73
73
  static Update(req: SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceReq, initReq?: fm.InitReq): Promise<SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceRes> {
74
- return fm.fetchReq<SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceReq, SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}/services/${req["serviceName"]}/instances/${req["instanceId"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
74
+ return fm.fetchReq<SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceReq, SkoalaApiIntegratedV1alpha1Instance.UpdateInstanceRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/registries/${req["registryId"]}/services/${req["serviceName"]}/instances/${req["instanceId"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
75
75
  }
76
76
  }
77
77
  export class Nacos {
@@ -82,10 +82,10 @@ export class Nacos {
82
82
  return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.GetNacosReq, SkoalaApiHostedV1alpha1Nacos.GetNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses/${req["nacosName"]}?${fm.renderURLSearchParams(req, ["workspaceId", "nacosName"])}`, {...initReq, method: "GET"})
83
83
  }
84
84
  static Create(req: SkoalaApiHostedV1alpha1Nacos.CreateNacosReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Nacos.CreateNacosRes> {
85
- return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.CreateNacosReq, SkoalaApiHostedV1alpha1Nacos.CreateNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses`, {...initReq, method: "POST", body: JSON.stringify(req)})
85
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.CreateNacosReq, SkoalaApiHostedV1alpha1Nacos.CreateNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
86
86
  }
87
87
  static Update(req: SkoalaApiHostedV1alpha1Nacos.UpdateNacosReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Nacos.UpdateNacosRes> {
88
- return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.UpdateNacosReq, SkoalaApiHostedV1alpha1Nacos.UpdateNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses/${req["nacosName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
88
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.UpdateNacosReq, SkoalaApiHostedV1alpha1Nacos.UpdateNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses/${req["nacosName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
89
89
  }
90
90
  static Delete(req: SkoalaApiHostedV1alpha1Nacos.DeleteNacosReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Nacos.DeleteNacosRes> {
91
91
  return fm.fetchReq<SkoalaApiHostedV1alpha1Nacos.DeleteNacosReq, SkoalaApiHostedV1alpha1Nacos.DeleteNacosRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/nacoses/${req["nacosName"]}`, {...initReq, method: "DELETE"})
@@ -99,10 +99,10 @@ export class Sentinel {
99
99
  return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.GetSentinelReq, SkoalaApiHostedV1alpha1Sentinel.GetSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels/${req["sentinelName"]}?${fm.renderURLSearchParams(req, ["workspaceId", "sentinelName"])}`, {...initReq, method: "GET"})
100
100
  }
101
101
  static Create(req: SkoalaApiHostedV1alpha1Sentinel.CreateSentinelReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Sentinel.CreateSentinelRes> {
102
- return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.CreateSentinelReq, SkoalaApiHostedV1alpha1Sentinel.CreateSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels`, {...initReq, method: "POST", body: JSON.stringify(req)})
102
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.CreateSentinelReq, SkoalaApiHostedV1alpha1Sentinel.CreateSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
103
103
  }
104
104
  static Update(req: SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelRes> {
105
- return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelReq, SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels/${req["sentinelName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
105
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelReq, SkoalaApiHostedV1alpha1Sentinel.UpdateSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels/${req["sentinelName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
106
106
  }
107
107
  static Delete(req: SkoalaApiHostedV1alpha1Sentinel.DeleteSentinelReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Sentinel.DeleteSentinelRes> {
108
108
  return fm.fetchReq<SkoalaApiHostedV1alpha1Sentinel.DeleteSentinelReq, SkoalaApiHostedV1alpha1Sentinel.DeleteSentinelRes>(`/apis/hive.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/sentinels/${req["sentinelName"]}`, {...initReq, method: "DELETE"})
@@ -122,10 +122,10 @@ export class Gateway {
122
122
  return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.GetGatewayReq, SkoalaApiHostedV1alpha1Gateway.GetGatewayRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}?${fm.renderURLSearchParams(req, ["workspaceId", "clusterName", "namespaceName", "gatewayName"])}`, {...initReq, method: "GET"})
123
123
  }
124
124
  static Create(req: SkoalaApiHostedV1alpha1Gateway.CreateGatewayReq, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
125
- return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.CreateGatewayReq, GoogleProtobufEmpty.Empty>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways`, {...initReq, method: "POST", body: JSON.stringify(req)})
125
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.CreateGatewayReq, GoogleProtobufEmpty.Empty>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
126
126
  }
127
127
  static Update(req: SkoalaApiHostedV1alpha1Gateway.UpdateGatewayReq, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
128
- return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.UpdateGatewayReq, GoogleProtobufEmpty.Empty>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
128
+ return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.UpdateGatewayReq, GoogleProtobufEmpty.Empty>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
129
129
  }
130
130
  static Delete(req: SkoalaApiHostedV1alpha1Gateway.DeleteGatewayReq, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
131
131
  return fm.fetchReq<SkoalaApiHostedV1alpha1Gateway.DeleteGatewayReq, GoogleProtobufEmpty.Empty>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}`, {...initReq, method: "DELETE"})
package/fetch.pb.ts CHANGED
@@ -4,10 +4,119 @@
4
4
  * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
5
  */
6
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
+
7
108
  export interface InitReq extends RequestInit {
8
109
  pathPrefix?: string
9
110
  }
10
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
+
11
120
  export function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {
12
121
  const {pathPrefix, ...req} = init || {}
13
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/skoala",
3
- "version": "0.3.3-83",
3
+ "version": "0.3.3-89",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {