kubernetes-fluent-client 1.2.0 → 1.3.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/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +7 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/package.json +2 -2
- package/src/fetch.ts +6 -8
- package/src/index.ts +3 -0
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":";AAIA,OAAiB,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,GAAG,EAAE,GAAG,GAAG,WAAW,EACtB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":";AAIA,OAAiB,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,GAAG,EAAE,GAAG,GAAG,WAAW,EACtB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAwC3B"}
|
package/dist/fetch.js
CHANGED
|
@@ -46,15 +46,13 @@ async function fetch(url, init) {
|
|
|
46
46
|
try {
|
|
47
47
|
const resp = await (0, node_fetch_1.default)(url, init);
|
|
48
48
|
const contentType = resp.headers.get("content-type") || "";
|
|
49
|
-
if
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data = (await resp.text());
|
|
57
|
-
}
|
|
49
|
+
// Parse the response as JSON if the content type is JSON
|
|
50
|
+
if (contentType.includes("application/json")) {
|
|
51
|
+
data = await resp.json();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Otherwise, return however the response was read
|
|
55
|
+
data = (await resp.text());
|
|
58
56
|
}
|
|
59
57
|
return {
|
|
60
58
|
data,
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as kind from "./upstream";
|
|
|
2
2
|
/** kind is a collection of K8s types to be used within a K8s call: `K8s(kind.Secret).Apply({})`. */
|
|
3
3
|
export { kind };
|
|
4
4
|
export { fetch } from "./fetch";
|
|
5
|
+
export { StatusCodes as fetchStatus } from "http-status-codes";
|
|
5
6
|
export { K8s } from "./fluent";
|
|
6
7
|
export { RegisterKind, modelToGroupVersionKind } from "./kinds";
|
|
7
8
|
export * from "./types";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,oGAAoG;AACpG,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEhE,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,oGAAoG;AACpG,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEhE,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,13 +28,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
28
28
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.modelToGroupVersionKind = exports.RegisterKind = exports.K8s = exports.fetch = exports.kind = void 0;
|
|
31
|
+
exports.modelToGroupVersionKind = exports.RegisterKind = exports.K8s = exports.fetchStatus = exports.fetch = exports.kind = void 0;
|
|
32
32
|
// Export kinds as a single object
|
|
33
33
|
const kind = __importStar(require("./upstream"));
|
|
34
34
|
exports.kind = kind;
|
|
35
35
|
// Export the node-fetch wrapper
|
|
36
36
|
var fetch_1 = require("./fetch");
|
|
37
37
|
Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return fetch_1.fetch; } });
|
|
38
|
+
// Export the HTTP status codes
|
|
39
|
+
var http_status_codes_1 = require("http-status-codes");
|
|
40
|
+
Object.defineProperty(exports, "fetchStatus", { enumerable: true, get: function () { return http_status_codes_1.StatusCodes; } });
|
|
38
41
|
// Export the fluent API entrypoint
|
|
39
42
|
var fluent_1 = require("./fluent");
|
|
40
43
|
Object.defineProperty(exports, "K8s", { enumerable: true, get: function () { return fluent_1.K8s; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kubernetes-fluent-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "A @kubernetes/client-node fluent API wrapper that leverages K8s Server Side Apply",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"jest": "29.7.0",
|
|
49
49
|
"nock": "13.3.3",
|
|
50
50
|
"prettier": "3.0.3",
|
|
51
|
-
"semantic-release": "22.0.
|
|
51
|
+
"semantic-release": "22.0.5",
|
|
52
52
|
"ts-jest": "29.1.1",
|
|
53
53
|
"typescript": "5.2.2"
|
|
54
54
|
},
|
package/src/fetch.ts
CHANGED
|
@@ -33,14 +33,12 @@ export async function fetch<T>(
|
|
|
33
33
|
const resp = await fetchRaw(url, init);
|
|
34
34
|
const contentType = resp.headers.get("content-type") || "";
|
|
35
35
|
|
|
36
|
-
if
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
data = (await resp.text()) as unknown as T;
|
|
43
|
-
}
|
|
36
|
+
// Parse the response as JSON if the content type is JSON
|
|
37
|
+
if (contentType.includes("application/json")) {
|
|
38
|
+
data = await resp.json();
|
|
39
|
+
} else {
|
|
40
|
+
// Otherwise, return however the response was read
|
|
41
|
+
data = (await resp.text()) as unknown as T;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
return {
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,9 @@ export { kind };
|
|
|
10
10
|
// Export the node-fetch wrapper
|
|
11
11
|
export { fetch } from "./fetch";
|
|
12
12
|
|
|
13
|
+
// Export the HTTP status codes
|
|
14
|
+
export { StatusCodes as fetchStatus } from "http-status-codes";
|
|
15
|
+
|
|
13
16
|
// Export the fluent API entrypoint
|
|
14
17
|
export { K8s } from "./fluent";
|
|
15
18
|
|