@compforge/harness-toolbox 0.3.6 → 0.3.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/dist/{chunk-2m0mh09h.js → chunk-fhtbvj0s.js} +1 -1
- package/dist/{chunk-y3dx8jh6.js → chunk-p6k59m3q.js} +1 -1
- package/dist/{chunk-1e3arqz3.js → chunk-y94xq8b4.js} +3 -3
- package/dist/chunk-zhkrydeg.js +41 -0
- package/dist/datasource.js +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +3 -1
- package/dist/kubernetes/client.js +4 -4
- package/dist/kubernetes/environment.js +4 -4
- package/dist/kubernetes/pod-log-datasource.js +1 -1
- package/dist/kubernetes/resources.js +2 -2
- package/dist/kubernetes/workload.js +2 -2
- package/dist/s3/datasource.js +1 -1
- package/dist/s3/index.js +1 -1
- package/dist/s3/types.d.ts +6 -0
- package/package.json +4 -1
- package/dist/chunk-ntfm5e85.js +0 -27
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-2171tajs.js";
|
|
4
4
|
import {
|
|
5
5
|
resourceAccess
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-fhtbvj0s.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveWorkload
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-p6k59m3q.js";
|
|
10
10
|
import {
|
|
11
11
|
KubernetesError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-zhkrydeg.js";
|
|
13
13
|
import {
|
|
14
14
|
KubectlExecutor
|
|
15
15
|
} from "./chunk-hmah9t8e.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
class ToolboxError extends Error {
|
|
3
|
+
kind;
|
|
4
|
+
code;
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message, { cause: options.cause });
|
|
7
|
+
this.name = new.target.name;
|
|
8
|
+
this.kind = options.kind;
|
|
9
|
+
this.code = options.code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class KubernetesError extends ToolboxError {
|
|
14
|
+
}
|
|
15
|
+
function kubernetesHttpError(status) {
|
|
16
|
+
const kind = {
|
|
17
|
+
401: "authentication_failed",
|
|
18
|
+
403: "permission_denied",
|
|
19
|
+
404: "resource_not_found",
|
|
20
|
+
408: "timeout",
|
|
21
|
+
429: "limit_exceeded",
|
|
22
|
+
504: "timeout"
|
|
23
|
+
}[status] ?? "operation_failed";
|
|
24
|
+
return new KubernetesError("Kubernetes resource request failed", { kind, code: status });
|
|
25
|
+
}
|
|
26
|
+
function kubernetesCommandError(result) {
|
|
27
|
+
if (result.timedOut)
|
|
28
|
+
return new KubernetesError("Kubernetes resource request timed out", { kind: "timeout" });
|
|
29
|
+
const reason = /^Error from server \(([^)]+)\):/m.exec(result.stderr)?.[1];
|
|
30
|
+
const status = reason ? {
|
|
31
|
+
Unauthorized: 401,
|
|
32
|
+
Forbidden: 403,
|
|
33
|
+
NotFound: 404,
|
|
34
|
+
Timeout: 408,
|
|
35
|
+
TooManyRequests: 429,
|
|
36
|
+
ServerTimeout: 504
|
|
37
|
+
}[reason] : undefined;
|
|
38
|
+
return status ? kubernetesHttpError(status) : new KubernetesError("Kubernetes resource request failed", { kind: "operation_failed" });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { ToolboxError, KubernetesError, kubernetesHttpError, kubernetesCommandError };
|
package/dist/datasource.js
CHANGED
package/dist/errors.d.ts
CHANGED
|
@@ -12,3 +12,13 @@ export declare class ToolboxError extends Error {
|
|
|
12
12
|
export declare class KubernetesError extends ToolboxError {
|
|
13
13
|
}
|
|
14
14
|
export declare function kubernetesHttpError(status: number): KubernetesError;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize a failed kubectl resource request at the transport boundary.
|
|
17
|
+
* Only the server's Status reason is authoritative; arbitrary stderr containing
|
|
18
|
+
* "not found" (including a missing kubectl binary) does not prove resource absence.
|
|
19
|
+
* Do not apply this to a command executed inside a container.
|
|
20
|
+
*/
|
|
21
|
+
export declare function kubernetesCommandError(result: {
|
|
22
|
+
stderr: string;
|
|
23
|
+
timedOut: boolean;
|
|
24
|
+
}): KubernetesError;
|
package/dist/errors.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KubernetesError,
|
|
3
3
|
ToolboxError,
|
|
4
|
+
kubernetesCommandError,
|
|
4
5
|
kubernetesHttpError
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-zhkrydeg.js";
|
|
6
7
|
export {
|
|
7
8
|
kubernetesHttpError,
|
|
9
|
+
kubernetesCommandError,
|
|
8
10
|
ToolboxError,
|
|
9
11
|
KubernetesError
|
|
10
12
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KubernetesClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-y94xq8b4.js";
|
|
4
4
|
import"../chunk-2171tajs.js";
|
|
5
5
|
import"../chunk-j46x7j7c.js";
|
|
6
6
|
import"../chunk-6fnhzhdb.js";
|
|
7
|
-
import"../chunk-
|
|
8
|
-
import"../chunk-
|
|
9
|
-
import"../chunk-
|
|
7
|
+
import"../chunk-fhtbvj0s.js";
|
|
8
|
+
import"../chunk-p6k59m3q.js";
|
|
9
|
+
import"../chunk-zhkrydeg.js";
|
|
10
10
|
import"../chunk-v3hxvnrc.js";
|
|
11
11
|
import"../chunk-631vce5z.js";
|
|
12
12
|
import"../chunk-hmah9t8e.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KubernetesClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-y94xq8b4.js";
|
|
4
4
|
import"../chunk-2171tajs.js";
|
|
5
5
|
import"../chunk-j46x7j7c.js";
|
|
6
6
|
import"../chunk-6fnhzhdb.js";
|
|
7
|
-
import"../chunk-
|
|
8
|
-
import"../chunk-
|
|
7
|
+
import"../chunk-fhtbvj0s.js";
|
|
8
|
+
import"../chunk-p6k59m3q.js";
|
|
9
9
|
import {
|
|
10
10
|
clientKey
|
|
11
11
|
} from "../chunk-a9htb6cr.js";
|
|
12
|
-
import"../chunk-
|
|
12
|
+
import"../chunk-zhkrydeg.js";
|
|
13
13
|
import"../chunk-v3hxvnrc.js";
|
|
14
14
|
import"../chunk-631vce5z.js";
|
|
15
15
|
import"../chunk-hmah9t8e.js";
|
package/dist/s3/datasource.js
CHANGED
package/dist/s3/index.js
CHANGED
package/dist/s3/types.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export interface S3Target {
|
|
2
|
+
/**
|
|
3
|
+
* Complete endpoint URL, including the scheme, host and any non-default port.
|
|
4
|
+
* A Kubernetes Service host includes its namespace (for example, http://s3.storage:9000).
|
|
5
|
+
* The source resolves the full address; downstream clients and transports use it as-is,
|
|
6
|
+
* without appending host suffixes or inferring a namespace from the consuming Service.
|
|
7
|
+
*/
|
|
2
8
|
endpoint: string;
|
|
3
9
|
region: string;
|
|
4
10
|
credentials: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compforge/harness-toolbox",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "Shared infrastructure clients, transports and bounded data capture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
"@types/node-fetch": "2.6.13",
|
|
111
111
|
"@types/node": "^22"
|
|
112
112
|
},
|
|
113
|
+
"overrides": {
|
|
114
|
+
"@compforge/harness-common": "file:../common"
|
|
115
|
+
},
|
|
113
116
|
"publishConfig": {
|
|
114
117
|
"access": "public"
|
|
115
118
|
},
|
package/dist/chunk-ntfm5e85.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/errors.ts
|
|
2
|
-
class ToolboxError extends Error {
|
|
3
|
-
kind;
|
|
4
|
-
code;
|
|
5
|
-
constructor(message, options) {
|
|
6
|
-
super(message, { cause: options.cause });
|
|
7
|
-
this.name = new.target.name;
|
|
8
|
-
this.kind = options.kind;
|
|
9
|
-
this.code = options.code;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
class KubernetesError extends ToolboxError {
|
|
14
|
-
}
|
|
15
|
-
function kubernetesHttpError(status) {
|
|
16
|
-
const kind = {
|
|
17
|
-
401: "authentication_failed",
|
|
18
|
-
403: "permission_denied",
|
|
19
|
-
404: "resource_not_found",
|
|
20
|
-
408: "timeout",
|
|
21
|
-
429: "limit_exceeded",
|
|
22
|
-
504: "timeout"
|
|
23
|
-
}[status] ?? "operation_failed";
|
|
24
|
-
return new KubernetesError("Kubernetes resource request failed", { kind, code: status });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { ToolboxError, KubernetesError, kubernetesHttpError };
|