@cloudoperators/juno-k8s-client 1.0.6 → 1.0.8
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 +9 -1
- package/build/index.cjs.js +1 -1
- package/build/index.es.js +122 -128
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# JavaScript client for Kubernetes API
|
|
2
2
|
|
|
3
|
-
This client is designed for use in the browser (not tested in Node.js). It utilizes the fetch API and is compatible with all modern browsers. For older browsers, the fetch polyfill (github/fetch) should be used.
|
|
3
|
+
This `Kubernetes client` is designed for use in the browser (not tested in Node.js). It utilizes the fetch API and is compatible with all modern browsers. For older browsers, the fetch polyfill (github/fetch) should be used.
|
|
4
4
|
|
|
5
5
|
The k8sclient facilitates communication with the Kubernetes API. It minimizes data interpretation and adds only essential logic. In addition to standard HTTP methods like GET or POST, it implements the WATCH method, which establishes a stream to the server and reacts to events.
|
|
6
6
|
|
|
@@ -145,3 +145,11 @@ pnpm install
|
|
|
145
145
|
pnpm test
|
|
146
146
|
pnpm build
|
|
147
147
|
```
|
|
148
|
+
|
|
149
|
+
## Contributing
|
|
150
|
+
|
|
151
|
+
We welcome contributions from the community. Please follow our [contribution guidelines](https://github.com/cloudoperators/juno/blob/main/CONTRIBUTING.md) to contribute to this project.
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
Licensed under the [Apache License](LICENSE).
|
package/build/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function j(t){return typeof t=="string"||t instanceof String}function V(t){return typeof t=="number"&&t.constructor===Number}function L(t){return t!==null&&typeof t=="object"&&t.constructor===Object}const B=t=>{if(!t)return;const s=[];for(const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function j(t){return typeof t=="string"||t instanceof String}function V(t){return typeof t=="number"&&t.constructor===Number}function L(t){return t!==null&&typeof t=="object"&&t.constructor===Object}const B=t=>{if(!t)return;const s=[];for(const n in t)if(Object.keys(t).includes(n)){const h=t[n];s.push(encodeURIComponent(n)+"="+encodeURIComponent(h))}return s.join("&")};function d(...t){if(t.length<2)throw new Error("Bad parameters: buildUrl needs at least two non-empty parameters.");const s=L(t[t.length-1])?t.pop():null;t.forEach(r=>{if(!r||!(j(r)||V(r)))throw new Error("Bad parameters: buildUrl accepts only strings and numbers, with a hash map as the last parameter");if(j(r)&&r.indexOf("?")>=0)throw new Error('Bad parameters: buildUrl does not accept strings with "?" character. Please use a hashmap as the last parameter instead!')});let n=t.join("/");const[h,e]=n.split("://");if(!h||!e)throw new Error(`Bad URL: ${n}`);return n=`${h}://${e.replace(/\/\/+/g,"/")}`,s&&(n+=`?${B(s)}`),n}const I="k8sClient:",P=t=>function(...s){try{const n=[`${I}`,...s];console[t](...n)}catch(n){console.error(I,"Logging error:",n)}},k=P("error"),l=P("debug"),X=t=>{if(t.status>=200&&t.status<300)return t;{const s=new Error(t.statusText||`${t.status}`);throw s.response=t,s}};function f(t,s,n={}){n.params&&(s=d(s,n.params));const e=["signal","headers","body","mode","cache","credentials"].reduce((r,o)=>n[o]?{...r,[o]:n[o]}:r,{credentials:"same-origin",method:t});return e.body&&typeof e.body!="string"&&(e.body=JSON.stringify(e.body)),l("fetch >",s,e),fetch(s,e).then(X)}const R="ADDED",w="MODIFIED",O="DELETED",y="ERROR",$="BOOKMARK";class C{constructor(s,n={},h){this.listeners={[R]:[],[w]:[],[O]:[],[y]:[]},this.controller=new AbortController,this.signal=this.controller.signal,this.resourceVersion=null,this.PREFIX="watch >",this.decoder=new TextDecoder,this.refreshToken=e=>{this.options.headers&&(this.options.headers.Authorization=`Bearer ${e}`)},this.checkType=e=>{if(![R,w,O,y].includes(e))throw new Error(`Bad type: ${e}`)},this.addListener=(e,r)=>{this.checkType(e),this.listeners[e].push(r)},this.informListeners=(e,r)=>{const o=this.listeners[e];o&&o.forEach(i=>{try{i(r)}catch(p){k(p)}})},this.handleEvents=e=>{Array.isArray(e)||(e=[e]);const r=this;setTimeout(()=>{const o={};e.forEach(i=>{i.type===$?r.resourceVersion=i?.object?.metadata?.resourceVersion??null:(o[i.type]||(o[i.type]=[]),o[i.type].push(i.object))}),Object.keys(o).forEach(i=>r.informListeners(i,o[i]))})},this.getResourceVersion=async()=>{if(this.resourceVersion)return this.resourceVersion;l(this.PREFIX,"get resource version from API");const{metadata:e,items:r}=await f("GET",this.url,this.options).then(o=>o.json());return this.resourceVersion=e.resourceVersion,r&&this.informListeners(R,r),this.resourceVersion},this.start=()=>{const e=this;return e.getCurrentToken&&e.refreshToken(e.getCurrentToken()),e.getResourceVersion().then(r=>(l(e.PREFIX,"current resource version",r),f("GET",e.url,{...e.options,params:{...e.options.params,watch:1,allowWatchBookmarks:!0,resourceVersion:r},signal:e.signal}))).then(async r=>{const o=r.body?.getReader();let i=!1,p="";for(;!i;){l(e.PREFIX,"read stream chunk");const D=await o?.read();i=D?.done??!0,p+=e.decoder.decode(D?.value||new Uint8Array);const T=p.split(/\n|\r|\r\n/);p=T.pop()??"";const g=[];T.forEach(A=>{const b=JSON.parse(A);if(b.type===y&&b?.object?.code===410){e.cancel(),setTimeout(()=>{l(e.PREFIX,"resource is gone 410","recreate watch request!"),e.start()});return}g.push(b)}),l(e.PREFIX,"inform listeners",T),e.handleEvents(g)}}).catch(r=>{if(r.name==="AbortError")return;const o=r.code??r?.response?.status;if(o===410){l(e.PREFIX,"resource is gone 410"),e.resourceVersion=null,setTimeout(()=>e.start(),0);return}if(o===404){e.handleEvents({type:y,object:r}),e.cancel();return}k("WATCH ERROR",r,r.code,o,r.response),console.dir(r),setTimeout(()=>{l(e.PREFIX,"recover connection","restart!"),e.start()},3e4)}),e.cancel},this.on=(e,r)=>(this.addListener(e,r),this),this.cancel=()=>{l(this.PREFIX,"cancel connection"),this.controller.abort()},this.url=s,this.options=n,this.getCurrentToken=h,n?.params?.resourceVersion&&(this.resourceVersion=n.params.resourceVersion,delete n.params.resourceVersion)}}const m=async t=>{const s=t.response?.data?new Error(t.response.data.message??t.message):t;return Promise.reject(s)};function H(t){const{apiEndpoint:s}=t;let n=t.token;if(!s||!n)throw new Error(`Bad options: ${JSON.stringify(t,null,4)}. Please provide apiEndpoint and token`);const h=()=>({Authorization:`Bearer ${n}`,"Content-Type":"application/json"});function e(c,a={}){const u={...h(),...a.headers,...c.headers};return{...a,...c,headers:u}}function r(c,a={}){return f("HEAD",d(s,c),e(a)).catch(m)}function o(c,a={}){return f("GET",d(s,c),e(a)).then(u=>u.json()).catch(m)}function i(c,a,u={}){return f("POST",d(s,c),e(u,{body:a})).then(F=>F.json()).catch(m)}function p(c,a,u={}){return f("PUT",d(s,c),e(u,{body:a})).then(E=>E.json()).catch(m)}function D(c,a,u={}){return f("PATCH",d(s,c),e(u,{headers:{"Content-Type":"application/merge-patch+json"},body:a})).then(E=>E.json()).catch(m)}function T(c,a,u={}){return f("DELETE",d(s,c),e(u,{body:a})).then(E=>E.json()).catch(m)}function g(c,a={}){return new C(d(s,c),e(a),()=>n)}function A(c){n=c}function b(){return n}return{WATCH_ERROR:y,WATCH_ADDED:R,WATCH_DELETED:O,WATCH_MODIFIED:w,head:r,get:o,post:i,put:p,patch:D,delete:T,watch:g,refreshToken:A,currentToken:b}}exports.ADDED=R;exports.DELETED=O;exports.ERROR=y;exports.MODIFIED=w;exports.Watch=C;exports.createClient=H;
|
package/build/index.es.js
CHANGED
|
@@ -10,41 +10,41 @@ function V(t) {
|
|
|
10
10
|
const B = (t) => {
|
|
11
11
|
if (!t) return;
|
|
12
12
|
const s = [];
|
|
13
|
-
for (const
|
|
14
|
-
if (Object.keys(t).includes(
|
|
15
|
-
const
|
|
16
|
-
s.push(encodeURIComponent(
|
|
13
|
+
for (const n in t)
|
|
14
|
+
if (Object.keys(t).includes(n)) {
|
|
15
|
+
const h = t[n];
|
|
16
|
+
s.push(encodeURIComponent(n) + "=" + encodeURIComponent(h));
|
|
17
17
|
}
|
|
18
18
|
return s.join("&");
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function d(...t) {
|
|
21
21
|
if (t.length < 2)
|
|
22
22
|
throw new Error("Bad parameters: buildUrl needs at least two non-empty parameters.");
|
|
23
23
|
const s = V(t[t.length - 1]) ? t.pop() : null;
|
|
24
|
-
t.forEach((
|
|
25
|
-
if (!
|
|
24
|
+
t.forEach((r) => {
|
|
25
|
+
if (!r || !(j(r) || F(r)))
|
|
26
26
|
throw new Error(
|
|
27
27
|
"Bad parameters: buildUrl accepts only strings and numbers, with a hash map as the last parameter"
|
|
28
28
|
);
|
|
29
|
-
if (j(
|
|
29
|
+
if (j(r) && r.indexOf("?") >= 0)
|
|
30
30
|
throw new Error(
|
|
31
31
|
'Bad parameters: buildUrl does not accept strings with "?" character. Please use a hashmap as the last parameter instead!'
|
|
32
32
|
);
|
|
33
33
|
});
|
|
34
|
-
let
|
|
35
|
-
const [
|
|
36
|
-
if (!
|
|
37
|
-
throw new Error(`Bad URL: ${
|
|
38
|
-
return
|
|
34
|
+
let n = t.join("/");
|
|
35
|
+
const [h, e] = n.split("://");
|
|
36
|
+
if (!h || !e)
|
|
37
|
+
throw new Error(`Bad URL: ${n}`);
|
|
38
|
+
return n = `${h}://${e.replace(/\/\/+/g, "/")}`, s && (n += `?${B(s)}`), n;
|
|
39
39
|
}
|
|
40
40
|
const I = "k8sClient:", P = (t) => function(...s) {
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
43
|
-
console[t](...
|
|
44
|
-
} catch (
|
|
45
|
-
console.error(I, "Logging error:",
|
|
42
|
+
const n = [`${I}`, ...s];
|
|
43
|
+
console[t](...n);
|
|
44
|
+
} catch (n) {
|
|
45
|
+
console.error(I, "Logging error:", n);
|
|
46
46
|
}
|
|
47
|
-
}, k = P("error"),
|
|
47
|
+
}, k = P("error"), l = P("debug"), L = (t) => {
|
|
48
48
|
if (t.status >= 200 && t.status < 300)
|
|
49
49
|
return t;
|
|
50
50
|
{
|
|
@@ -52,194 +52,188 @@ const I = "k8sClient:", P = (t) => function(...s) {
|
|
|
52
52
|
throw s.response = t, s;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
(
|
|
55
|
+
function f(t, s, n = {}) {
|
|
56
|
+
n.params && (s = d(s, n.params));
|
|
57
|
+
const e = ["signal", "headers", "body", "mode", "cache", "credentials"].reduce(
|
|
58
|
+
(r, o) => n[o] ? { ...r, [o]: n[o] } : r,
|
|
59
59
|
{ credentials: "same-origin", method: t }
|
|
60
60
|
);
|
|
61
|
-
return
|
|
61
|
+
return e.body && typeof e.body != "string" && (e.body = JSON.stringify(e.body)), l("fetch >", s, e), fetch(s, e).then(L);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const g = "ADDED", A = "MODIFIED", O = "DELETED", b = "ERROR", X = "BOOKMARK";
|
|
64
64
|
class $ {
|
|
65
|
-
constructor(s,
|
|
66
|
-
var i;
|
|
65
|
+
constructor(s, n = {}, h) {
|
|
67
66
|
this.listeners = {
|
|
68
|
-
[
|
|
67
|
+
[g]: [],
|
|
69
68
|
[A]: [],
|
|
70
69
|
[O]: [],
|
|
71
|
-
[
|
|
70
|
+
[b]: []
|
|
72
71
|
}, this.controller = new AbortController(), this.signal = this.controller.signal, this.resourceVersion = null, this.PREFIX = "watch >", this.decoder = new TextDecoder(), this.refreshToken = (e) => {
|
|
73
72
|
this.options.headers && (this.options.headers.Authorization = `Bearer ${e}`);
|
|
74
73
|
}, this.checkType = (e) => {
|
|
75
|
-
if (![
|
|
74
|
+
if (![g, A, O, b].includes(e))
|
|
76
75
|
throw new Error(`Bad type: ${e}`);
|
|
77
|
-
}, this.addListener = (e,
|
|
78
|
-
this.checkType(e), this.listeners[e].push(
|
|
79
|
-
}, this.informListeners = (e,
|
|
80
|
-
const
|
|
81
|
-
|
|
76
|
+
}, this.addListener = (e, r) => {
|
|
77
|
+
this.checkType(e), this.listeners[e].push(r);
|
|
78
|
+
}, this.informListeners = (e, r) => {
|
|
79
|
+
const o = this.listeners[e];
|
|
80
|
+
o && o.forEach((i) => {
|
|
82
81
|
try {
|
|
83
|
-
|
|
84
|
-
} catch (
|
|
85
|
-
k(
|
|
82
|
+
i(r);
|
|
83
|
+
} catch (p) {
|
|
84
|
+
k(p);
|
|
86
85
|
}
|
|
87
86
|
});
|
|
88
87
|
}, this.handleEvents = (e) => {
|
|
89
88
|
Array.isArray(e) || (e = [e]);
|
|
90
|
-
const
|
|
89
|
+
const r = this;
|
|
91
90
|
setTimeout(() => {
|
|
92
|
-
const
|
|
93
|
-
e.forEach((
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}), Object.keys(a).forEach((c) => n.informListeners(c, a[c]));
|
|
91
|
+
const o = {};
|
|
92
|
+
e.forEach((i) => {
|
|
93
|
+
i.type === X ? r.resourceVersion = i?.object?.metadata?.resourceVersion ?? null : (o[i.type] || (o[i.type] = []), o[i.type].push(i.object));
|
|
94
|
+
}), Object.keys(o).forEach((i) => r.informListeners(i, o[i]));
|
|
97
95
|
});
|
|
98
96
|
}, this.getResourceVersion = async () => {
|
|
99
97
|
if (this.resourceVersion) return this.resourceVersion;
|
|
100
|
-
|
|
101
|
-
const { metadata: e, items:
|
|
102
|
-
(
|
|
98
|
+
l(this.PREFIX, "get resource version from API");
|
|
99
|
+
const { metadata: e, items: r } = await f("GET", this.url, this.options).then(
|
|
100
|
+
(o) => (
|
|
103
101
|
// 'Body.json()' type definition expects 'any' as a return value
|
|
104
|
-
|
|
102
|
+
o.json()
|
|
105
103
|
)
|
|
106
104
|
);
|
|
107
|
-
return this.resourceVersion = e.resourceVersion,
|
|
105
|
+
return this.resourceVersion = e.resourceVersion, r && this.informListeners(g, r), this.resourceVersion;
|
|
108
106
|
}, this.start = () => {
|
|
109
107
|
const e = this;
|
|
110
|
-
return e.getCurrentToken && e.refreshToken(e.getCurrentToken()), e.getResourceVersion().then((
|
|
108
|
+
return e.getCurrentToken && e.refreshToken(e.getCurrentToken()), e.getResourceVersion().then((r) => (l(e.PREFIX, "current resource version", r), f("GET", e.url, {
|
|
111
109
|
...e.options,
|
|
112
110
|
params: {
|
|
113
111
|
...e.options.params,
|
|
114
112
|
watch: 1,
|
|
115
113
|
allowWatchBookmarks: !0,
|
|
116
|
-
resourceVersion:
|
|
114
|
+
resourceVersion: r
|
|
117
115
|
},
|
|
118
116
|
signal: e.signal
|
|
119
|
-
}))).then(async (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const o = JSON.parse(h);
|
|
133
|
-
if (o.type === R && ((u = o == null ? void 0 : o.object) == null ? void 0 : u.code) === 410) {
|
|
117
|
+
}))).then(async (r) => {
|
|
118
|
+
const o = r.body?.getReader();
|
|
119
|
+
let i = !1, p = "";
|
|
120
|
+
for (; !i; ) {
|
|
121
|
+
l(e.PREFIX, "read stream chunk");
|
|
122
|
+
const w = await o?.read();
|
|
123
|
+
i = w?.done ?? !0, p += e.decoder.decode(w?.value || new Uint8Array());
|
|
124
|
+
const y = p.split(/\n|\r|\r\n/);
|
|
125
|
+
p = y.pop() ?? "";
|
|
126
|
+
const R = [];
|
|
127
|
+
y.forEach((D) => {
|
|
128
|
+
const T = JSON.parse(D);
|
|
129
|
+
if (T.type === b && T?.object?.code === 410) {
|
|
134
130
|
e.cancel(), setTimeout(() => {
|
|
135
|
-
|
|
131
|
+
l(e.PREFIX, "resource is gone 410", "recreate watch request!"), e.start();
|
|
136
132
|
});
|
|
137
133
|
return;
|
|
138
134
|
}
|
|
139
|
-
|
|
140
|
-
}),
|
|
135
|
+
R.push(T);
|
|
136
|
+
}), l(e.PREFIX, "inform listeners", y), e.handleEvents(R);
|
|
141
137
|
}
|
|
142
|
-
}).catch((
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
f(e.PREFIX, "resource is gone 410"), e.resourceVersion = null, setTimeout(() => e.start(), 0);
|
|
138
|
+
}).catch((r) => {
|
|
139
|
+
if (r.name === "AbortError") return;
|
|
140
|
+
const o = r.code ?? r?.response?.status;
|
|
141
|
+
if (o === 410) {
|
|
142
|
+
l(e.PREFIX, "resource is gone 410"), e.resourceVersion = null, setTimeout(() => e.start(), 0);
|
|
148
143
|
return;
|
|
149
144
|
}
|
|
150
|
-
if (
|
|
151
|
-
e.handleEvents({ type:
|
|
145
|
+
if (o === 404) {
|
|
146
|
+
e.handleEvents({ type: b, object: r }), e.cancel();
|
|
152
147
|
return;
|
|
153
148
|
}
|
|
154
|
-
k("WATCH ERROR",
|
|
155
|
-
|
|
149
|
+
k("WATCH ERROR", r, r.code, o, r.response), console.dir(r), setTimeout(() => {
|
|
150
|
+
l(e.PREFIX, "recover connection", "restart!"), e.start();
|
|
156
151
|
}, 3e4);
|
|
157
152
|
}), e.cancel;
|
|
158
|
-
}, this.on = (e,
|
|
159
|
-
|
|
160
|
-
}, this.url = s, this.options =
|
|
153
|
+
}, this.on = (e, r) => (this.addListener(e, r), this), this.cancel = () => {
|
|
154
|
+
l(this.PREFIX, "cancel connection"), this.controller.abort();
|
|
155
|
+
}, this.url = s, this.options = n, this.getCurrentToken = h, n?.params?.resourceVersion && (this.resourceVersion = n.params.resourceVersion, delete n.params.resourceVersion);
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
const s = (r = t.response) != null && r.data ? new Error(t.response.data.message ?? t.message) : t;
|
|
158
|
+
const m = async (t) => {
|
|
159
|
+
const s = t.response?.data ? new Error(t.response.data.message ?? t.message) : t;
|
|
166
160
|
return Promise.reject(s);
|
|
167
161
|
};
|
|
168
162
|
function H(t) {
|
|
169
163
|
const { apiEndpoint: s } = t;
|
|
170
|
-
let
|
|
171
|
-
if (!s || !
|
|
164
|
+
let n = t.token;
|
|
165
|
+
if (!s || !n)
|
|
172
166
|
throw new Error(`Bad options: ${JSON.stringify(t, null, 4)}. Please provide apiEndpoint and token`);
|
|
173
|
-
const
|
|
174
|
-
Authorization: `Bearer ${
|
|
167
|
+
const h = () => ({
|
|
168
|
+
Authorization: `Bearer ${n}`,
|
|
175
169
|
"Content-Type": "application/json"
|
|
176
170
|
});
|
|
177
|
-
function
|
|
171
|
+
function e(c, a = {}) {
|
|
178
172
|
const u = {
|
|
179
|
-
...
|
|
180
|
-
...
|
|
181
|
-
...
|
|
173
|
+
...h(),
|
|
174
|
+
...a.headers,
|
|
175
|
+
...c.headers
|
|
182
176
|
};
|
|
183
177
|
return {
|
|
184
|
-
...
|
|
185
|
-
...
|
|
178
|
+
...a,
|
|
179
|
+
...c,
|
|
186
180
|
headers: u
|
|
187
181
|
};
|
|
188
182
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
183
|
+
function r(c, a = {}) {
|
|
184
|
+
return f("HEAD", d(s, c), e(a)).catch(m);
|
|
191
185
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
186
|
+
function o(c, a = {}) {
|
|
187
|
+
return f("GET", d(s, c), e(a)).then((u) => u.json()).catch(m);
|
|
194
188
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
189
|
+
function i(c, a, u = {}) {
|
|
190
|
+
return f("POST", d(s, c), e(u, { body: a })).then((C) => C.json()).catch(m);
|
|
197
191
|
}
|
|
198
|
-
function c
|
|
199
|
-
return
|
|
192
|
+
function p(c, a, u = {}) {
|
|
193
|
+
return f("PUT", d(s, c), e(u, { body: a })).then((E) => E.json()).catch(m);
|
|
200
194
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
195
|
+
function w(c, a, u = {}) {
|
|
196
|
+
return f(
|
|
203
197
|
"PATCH",
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
d(s, c),
|
|
199
|
+
e(u, {
|
|
206
200
|
headers: { "Content-Type": "application/merge-patch+json" },
|
|
207
|
-
body:
|
|
201
|
+
body: a
|
|
208
202
|
})
|
|
209
|
-
).then((
|
|
203
|
+
).then((E) => E.json()).catch(m);
|
|
210
204
|
}
|
|
211
|
-
function y(
|
|
212
|
-
return
|
|
205
|
+
function y(c, a, u = {}) {
|
|
206
|
+
return f("DELETE", d(s, c), e(u, { body: a })).then((E) => E.json()).catch(m);
|
|
213
207
|
}
|
|
214
|
-
function
|
|
215
|
-
return new $(
|
|
208
|
+
function R(c, a = {}) {
|
|
209
|
+
return new $(d(s, c), e(a), () => n);
|
|
216
210
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
211
|
+
function D(c) {
|
|
212
|
+
n = c;
|
|
219
213
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
214
|
+
function T() {
|
|
215
|
+
return n;
|
|
222
216
|
}
|
|
223
217
|
return {
|
|
224
|
-
WATCH_ERROR:
|
|
225
|
-
WATCH_ADDED:
|
|
218
|
+
WATCH_ERROR: b,
|
|
219
|
+
WATCH_ADDED: g,
|
|
226
220
|
WATCH_DELETED: O,
|
|
227
221
|
WATCH_MODIFIED: A,
|
|
228
|
-
head:
|
|
229
|
-
get:
|
|
230
|
-
post:
|
|
231
|
-
put:
|
|
232
|
-
patch:
|
|
222
|
+
head: r,
|
|
223
|
+
get: o,
|
|
224
|
+
post: i,
|
|
225
|
+
put: p,
|
|
226
|
+
patch: w,
|
|
233
227
|
delete: y,
|
|
234
|
-
watch:
|
|
235
|
-
refreshToken:
|
|
236
|
-
currentToken:
|
|
228
|
+
watch: R,
|
|
229
|
+
refreshToken: D,
|
|
230
|
+
currentToken: T
|
|
237
231
|
};
|
|
238
232
|
}
|
|
239
233
|
export {
|
|
240
|
-
|
|
234
|
+
g as ADDED,
|
|
241
235
|
O as DELETED,
|
|
242
|
-
|
|
236
|
+
b as ERROR,
|
|
243
237
|
A as MODIFIED,
|
|
244
238
|
$ as Watch,
|
|
245
239
|
H as createClient
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudoperators/juno-k8s-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"author": "UI-Team",
|
|
5
5
|
"description": "JavaScript client for Kubernetes API",
|
|
6
6
|
"main": "build/index.cjs.js",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"client"
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"vite": "^
|
|
28
|
-
"vitest": "^3.
|
|
29
|
-
"@testing-library/jest-dom": "^
|
|
30
|
-
"vite-plugin-dts": "^4.
|
|
31
|
-
"@cloudoperators/juno-config": "0.0.
|
|
27
|
+
"vite": "^7.0.3",
|
|
28
|
+
"vitest": "^3.2.4",
|
|
29
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
+
"vite-plugin-dts": "^4.5.4",
|
|
31
|
+
"@cloudoperators/juno-config": "0.0.4"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "vitest run",
|