@devopness/sdk-js 3.4.1 → 3.5.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/api/generated/models/action-pipeline-create.d.ts +6 -0
- package/dist/api/generated/models/action-relation.d.ts +6 -0
- package/dist/api/generated/models/action-retry-response.d.ts +6 -0
- package/dist/api/generated/models/action.d.ts +6 -0
- package/dist/api/generated/models/cloud-os-version-code.d.ts +2 -1
- package/dist/api/generated/models/cloud-os-version-code.js +1 -0
- package/dist/api/generated/models/daemon-deploy.d.ts +6 -0
- package/dist/api/generated/models/daemon-get-status.d.ts +6 -0
- package/dist/api/generated/models/daemon-restart.d.ts +6 -0
- package/dist/api/generated/models/daemon-start.d.ts +6 -0
- package/dist/api/generated/models/daemon-stop.d.ts +6 -0
- package/dist/api/generated/models/pipeline-settings.d.ts +6 -0
- package/dist/services/ApiBaseService.d.ts +5 -0
- package/dist/services/ApiBaseService.js +33 -2
- package/package.json +19 -9
|
@@ -22,6 +22,12 @@ export interface ActionPipelineCreate {
|
|
|
22
22
|
* @memberof ActionPipelineCreate
|
|
23
23
|
*/
|
|
24
24
|
servers?: Array<number>;
|
|
25
|
+
/**
|
|
26
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters. Must not be greater than 255 characters.
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof ActionPipelineCreate
|
|
29
|
+
*/
|
|
30
|
+
trigger_comment?: string;
|
|
25
31
|
/**
|
|
26
32
|
*
|
|
27
33
|
* @type {SourceType}
|
|
@@ -71,6 +71,12 @@ export interface ActionRelation {
|
|
|
71
71
|
* @memberof ActionRelation
|
|
72
72
|
*/
|
|
73
73
|
url_web_permalink: string;
|
|
74
|
+
/**
|
|
75
|
+
* Optional comment attached to this action
|
|
76
|
+
* @type {string}
|
|
77
|
+
* @memberof ActionRelation
|
|
78
|
+
*/
|
|
79
|
+
trigger_comment: string | null;
|
|
74
80
|
/**
|
|
75
81
|
*
|
|
76
82
|
* @type {ActionData}
|
|
@@ -89,6 +89,12 @@ export interface ActionRetryResponse {
|
|
|
89
89
|
* @memberof ActionRetryResponse
|
|
90
90
|
*/
|
|
91
91
|
url_web_permalink: string;
|
|
92
|
+
/**
|
|
93
|
+
* Optional comment attached to this action
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @memberof ActionRetryResponse
|
|
96
|
+
*/
|
|
97
|
+
trigger_comment: string | null;
|
|
92
98
|
/**
|
|
93
99
|
*
|
|
94
100
|
* @type {ActionData}
|
|
@@ -89,6 +89,12 @@ export interface Action {
|
|
|
89
89
|
* @memberof Action
|
|
90
90
|
*/
|
|
91
91
|
url_web_permalink: string;
|
|
92
|
+
/**
|
|
93
|
+
* Optional comment attached to this action
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @memberof Action
|
|
96
|
+
*/
|
|
97
|
+
trigger_comment: string | null;
|
|
92
98
|
/**
|
|
93
99
|
*
|
|
94
100
|
* @type {ActionData}
|
|
@@ -25,4 +25,5 @@ var CloudOsVersionCode;
|
|
|
25
25
|
CloudOsVersionCode["Ubuntu2004"] = "ubuntu_20_04";
|
|
26
26
|
CloudOsVersionCode["Ubuntu2204"] = "ubuntu_22_04";
|
|
27
27
|
CloudOsVersionCode["Ubuntu2404"] = "ubuntu_24_04";
|
|
28
|
+
CloudOsVersionCode["Ubuntu2604"] = "ubuntu_26_04";
|
|
28
29
|
})(CloudOsVersionCode || (exports.CloudOsVersionCode = CloudOsVersionCode = {}));
|
|
@@ -21,4 +21,10 @@ export interface DaemonDeploy {
|
|
|
21
21
|
* @memberof DaemonDeploy
|
|
22
22
|
*/
|
|
23
23
|
servers?: Array<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof DaemonDeploy
|
|
28
|
+
*/
|
|
29
|
+
trigger_comment?: string;
|
|
24
30
|
}
|
|
@@ -21,4 +21,10 @@ export interface DaemonGetStatus {
|
|
|
21
21
|
* @memberof DaemonGetStatus
|
|
22
22
|
*/
|
|
23
23
|
servers?: Array<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof DaemonGetStatus
|
|
28
|
+
*/
|
|
29
|
+
trigger_comment?: string;
|
|
24
30
|
}
|
|
@@ -21,4 +21,10 @@ export interface DaemonRestart {
|
|
|
21
21
|
* @memberof DaemonRestart
|
|
22
22
|
*/
|
|
23
23
|
servers?: Array<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof DaemonRestart
|
|
28
|
+
*/
|
|
29
|
+
trigger_comment?: string;
|
|
24
30
|
}
|
|
@@ -21,4 +21,10 @@ export interface DaemonStart {
|
|
|
21
21
|
* @memberof DaemonStart
|
|
22
22
|
*/
|
|
23
23
|
servers?: Array<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof DaemonStart
|
|
28
|
+
*/
|
|
29
|
+
trigger_comment?: string;
|
|
24
30
|
}
|
|
@@ -21,4 +21,10 @@ export interface DaemonStop {
|
|
|
21
21
|
* @memberof DaemonStop
|
|
22
22
|
*/
|
|
23
23
|
servers?: Array<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional comment provided when triggering this action. Must not be greater than 255 characters.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof DaemonStop
|
|
28
|
+
*/
|
|
29
|
+
trigger_comment?: string;
|
|
24
30
|
}
|
|
@@ -29,6 +29,12 @@ export interface PipelineSettings {
|
|
|
29
29
|
* @memberof PipelineSettings
|
|
30
30
|
*/
|
|
31
31
|
is_user_managed?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether this resource operation supports an optional trigger comment
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @memberof PipelineSettings
|
|
36
|
+
*/
|
|
37
|
+
supports_trigger_comment?: boolean;
|
|
32
38
|
/**
|
|
33
39
|
* The list of pipeline setting stage
|
|
34
40
|
* @type {Array<PipelineSettingsStage>}
|
|
@@ -27,6 +27,11 @@ export declare class ApiBaseService {
|
|
|
27
27
|
static set accessToken(value: string);
|
|
28
28
|
static set onTokenExpired(callback: (accessToken: string) => void);
|
|
29
29
|
protected isTokenExpired(response: AxiosResponse | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Decode the JWT payload so we can inspect the `exp` claim in both browser and Node runtimes.
|
|
32
|
+
* This avoids relying on a Node-only JWT helper while still tolerating malformed tokens safely.
|
|
33
|
+
*/
|
|
34
|
+
private static decodeJwtPayload;
|
|
30
35
|
baseURL(): string;
|
|
31
36
|
protected post<T, B = undefined, R = AxiosResponse<T>>(endpoint: string, data?: B): Promise<R>;
|
|
32
37
|
protected put<T, B = undefined, R = AxiosResponse<T>>(endpoint: string, data?: B): Promise<R>;
|
|
@@ -121,13 +121,44 @@ class ApiBaseService {
|
|
|
121
121
|
ApiBaseService._onTokenExpired = callback;
|
|
122
122
|
}
|
|
123
123
|
isTokenExpired(response) {
|
|
124
|
-
var _a, _b;
|
|
125
124
|
if (!ApiBaseService.accessToken) {
|
|
126
125
|
return false;
|
|
127
126
|
}
|
|
128
|
-
|
|
127
|
+
let decodedToken;
|
|
128
|
+
try {
|
|
129
|
+
decodedToken = JSON.parse(ApiBaseService.decodeJwtPayload(ApiBaseService.accessToken));
|
|
130
|
+
}
|
|
131
|
+
catch (_a) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
129
134
|
return (response === null || response === void 0 ? void 0 : response.status) === 401 && decodedToken.exp < (new Date().getTime() / 1000);
|
|
130
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Decode the JWT payload so we can inspect the `exp` claim in both browser and Node runtimes.
|
|
138
|
+
* This avoids relying on a Node-only JWT helper while still tolerating malformed tokens safely.
|
|
139
|
+
*/
|
|
140
|
+
static decodeJwtPayload(token) {
|
|
141
|
+
var _a;
|
|
142
|
+
try {
|
|
143
|
+
const payload = (_a = token.split(".")) === null || _a === void 0 ? void 0 : _a[1];
|
|
144
|
+
if (!payload) {
|
|
145
|
+
return "{}";
|
|
146
|
+
}
|
|
147
|
+
const base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
|
|
148
|
+
const paddingLength = (4 - (base64.length % 4)) % 4;
|
|
149
|
+
const paddedBase64 = base64 + "=".repeat(paddingLength);
|
|
150
|
+
const binary = atob(paddedBase64);
|
|
151
|
+
return decodeURIComponent(Array.from(binary, (character) => {
|
|
152
|
+
const hex = character.charCodeAt(0).toString(16);
|
|
153
|
+
return `%${hex.length === 1 ? `0${hex}` : hex}`;
|
|
154
|
+
}).join(""));
|
|
155
|
+
}
|
|
156
|
+
catch (_b) {
|
|
157
|
+
// Malformed or legacy token payloads should not break the axios error path.
|
|
158
|
+
// Treat undecodable tokens as empty payloads and let the 401 handling continue.
|
|
159
|
+
return "{}";
|
|
160
|
+
}
|
|
161
|
+
}
|
|
131
162
|
baseURL() {
|
|
132
163
|
return this.api.defaults.baseURL ? this.api.defaults.baseURL : "";
|
|
133
164
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@devopness/sdk-js",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"description": "Devopness API JS/TS SDK - Painless essential DevOps to everyone",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
11
17
|
"files": [
|
|
12
18
|
"dist"
|
|
13
19
|
],
|
|
@@ -19,6 +25,7 @@
|
|
|
19
25
|
"docs-update-service-index": "npm run docs-remove-service-index && npm run docs-export-service-index",
|
|
20
26
|
"docs": "npm run docs-update-service-index && typedoc",
|
|
21
27
|
"lint": "eslint .",
|
|
28
|
+
"lint:fix": "eslint . --fix",
|
|
22
29
|
"prepublishOnly": "npm run lint && npm test && npm run build",
|
|
23
30
|
"test": "jest"
|
|
24
31
|
},
|
|
@@ -50,27 +57,30 @@
|
|
|
50
57
|
"url": "https://github.com/devopness/devopness/issues"
|
|
51
58
|
},
|
|
52
59
|
"homepage": "https://github.com/devopness/devopness#readme",
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=16"
|
|
62
|
+
},
|
|
53
63
|
"devDependencies": {
|
|
54
64
|
"@eslint/js": "^10.0.1",
|
|
55
|
-
"@openapitools/openapi-generator-cli": "^2.
|
|
65
|
+
"@openapitools/openapi-generator-cli": "^2.39.1",
|
|
56
66
|
"@types/jest": "^30.0.0",
|
|
57
|
-
"@typescript-eslint/parser": "^8.
|
|
67
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
58
68
|
"axios-mock-adapter": "^2.1.0",
|
|
59
|
-
"eslint": "^10.
|
|
60
|
-
"eslint-import-resolver-typescript": "^4.4.
|
|
69
|
+
"eslint": "^10.6.0",
|
|
70
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
61
71
|
"eslint-plugin-import": "^2.32.0",
|
|
62
|
-
"eslint-plugin-n": "^18.
|
|
72
|
+
"eslint-plugin-n": "^18.2.1",
|
|
63
73
|
"eslint-plugin-promise": "^7.3.0",
|
|
64
74
|
"husky": "9.1.7",
|
|
65
75
|
"jest": "^30.4.2",
|
|
66
76
|
"ts-jest": "^29.4.11",
|
|
67
77
|
"typedoc": "^0.28.19",
|
|
68
|
-
"typescript": "^
|
|
69
|
-
"typescript-eslint": "^8.
|
|
78
|
+
"typescript": "^6.0.3",
|
|
79
|
+
"typescript-eslint": "^8.62.1"
|
|
70
80
|
},
|
|
71
81
|
"dependencies": {
|
|
72
82
|
"@types/parse-link-header": "^2.0.3",
|
|
73
|
-
"axios": "^1.
|
|
83
|
+
"axios": "^1.18.1",
|
|
74
84
|
"parse-link-header": "^2.0.0"
|
|
75
85
|
}
|
|
76
86
|
}
|