ibm-cloud-sdk-core 5.1.4 → 5.3.0
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/auth/token-managers/container-token-manager.d.ts +2 -1
- package/auth/token-managers/container-token-manager.js +9 -2
- package/docs/ibm-cloud-sdk-core.api.json +1 -1
- package/es/auth/token-managers/container-token-manager.d.ts +2 -1
- package/es/auth/token-managers/container-token-manager.js +9 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/lib/axios-types.d.ts +16 -0
- package/es/lib/axios-types.js +16 -0
- package/es/lib/request-wrapper.js +3 -10
- package/ibm-cloud-sdk-core.d.ts +4 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/lib/axios-types.d.ts +16 -0
- package/lib/axios-types.js +17 -0
- package/lib/request-wrapper.js +3 -12
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2021,
|
|
2
|
+
* (C) Copyright IBM Corp. 2021, 2025.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -80,6 +80,7 @@ export declare class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
80
80
|
* 1. User-specified filename (if specified)
|
|
81
81
|
* 2. Default file #1 (/var/run/secrets/tokens/vault-token)
|
|
82
82
|
* 3. Default file #2 (/var/run/secrets/tokens/sa-token)
|
|
83
|
+
* 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token)
|
|
83
84
|
* First one found wins.
|
|
84
85
|
*
|
|
85
86
|
* @returns the CR token value as a string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2021,
|
|
3
|
+
* (C) Copyright IBM Corp. 2021, 2025.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -37,6 +37,7 @@ var build_user_agent_1 = require("../../lib/build-user-agent");
|
|
|
37
37
|
var iam_request_based_token_manager_1 = require("./iam-request-based-token-manager");
|
|
38
38
|
var DEFAULT_CR_TOKEN_FILEPATH1 = '/var/run/secrets/tokens/vault-token';
|
|
39
39
|
var DEFAULT_CR_TOKEN_FILEPATH2 = '/var/run/secrets/tokens/sa-token';
|
|
40
|
+
var DEFAULT_CR_TOKEN_FILEPATH3 = '/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token';
|
|
40
41
|
/**
|
|
41
42
|
* The ContainerTokenManager retrieves a compute resource token from a file on the container. This token
|
|
42
43
|
* is used to perform the necessary interactions with the IAM token service to obtain and store a suitable
|
|
@@ -135,6 +136,7 @@ var ContainerTokenManager = /** @class */ (function (_super) {
|
|
|
135
136
|
* 1. User-specified filename (if specified)
|
|
136
137
|
* 2. Default file #1 (/var/run/secrets/tokens/vault-token)
|
|
137
138
|
* 3. Default file #2 (/var/run/secrets/tokens/sa-token)
|
|
139
|
+
* 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token)
|
|
138
140
|
* First one found wins.
|
|
139
141
|
*
|
|
140
142
|
* @returns the CR token value as a string
|
|
@@ -152,7 +154,12 @@ var ContainerTokenManager = /** @class */ (function (_super) {
|
|
|
152
154
|
crToken = (0, file_reading_helpers_1.readCrTokenFile)(DEFAULT_CR_TOKEN_FILEPATH1);
|
|
153
155
|
}
|
|
154
156
|
catch (err) {
|
|
155
|
-
|
|
157
|
+
try {
|
|
158
|
+
crToken = (0, file_reading_helpers_1.readCrTokenFile)(DEFAULT_CR_TOKEN_FILEPATH2);
|
|
159
|
+
}
|
|
160
|
+
catch (err1) {
|
|
161
|
+
crToken = (0, file_reading_helpers_1.readCrTokenFile)(DEFAULT_CR_TOKEN_FILEPATH3);
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
165
|
return crToken;
|
|
@@ -2770,7 +2770,7 @@
|
|
|
2770
2770
|
{
|
|
2771
2771
|
"kind": "Method",
|
|
2772
2772
|
"canonicalReference": "ibm-cloud-sdk-core!ContainerTokenManager#getCrToken:member(1)",
|
|
2773
|
-
"docComment": "/**\n * Retrieves the CR token from a file using this search order: 1. User-specified filename (if specified) 2. Default file #1 (/var/run/secrets/tokens/vault-token) 3. Default file #2 (/var/run/secrets/tokens/sa-token) First one found wins.\n *\n * @returns the CR token value as a string\n */\n",
|
|
2773
|
+
"docComment": "/**\n * Retrieves the CR token from a file using this search order: 1. User-specified filename (if specified) 2. Default file #1 (/var/run/secrets/tokens/vault-token) 3. Default file #2 (/var/run/secrets/tokens/sa-token) 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token) First one found wins.\n *\n * @returns the CR token value as a string\n */\n",
|
|
2774
2774
|
"excerptTokens": [
|
|
2775
2775
|
{
|
|
2776
2776
|
"kind": "Content",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2021,
|
|
2
|
+
* (C) Copyright IBM Corp. 2021, 2025.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -80,6 +80,7 @@ export declare class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
80
80
|
* 1. User-specified filename (if specified)
|
|
81
81
|
* 2. Default file #1 (/var/run/secrets/tokens/vault-token)
|
|
82
82
|
* 3. Default file #2 (/var/run/secrets/tokens/sa-token)
|
|
83
|
+
* 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token)
|
|
83
84
|
* First one found wins.
|
|
84
85
|
*
|
|
85
86
|
* @returns the CR token value as a string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2021,
|
|
2
|
+
* (C) Copyright IBM Corp. 2021, 2025.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -19,6 +19,7 @@ import { buildUserAgent } from '../../lib/build-user-agent';
|
|
|
19
19
|
import { IamRequestBasedTokenManager } from './iam-request-based-token-manager';
|
|
20
20
|
const DEFAULT_CR_TOKEN_FILEPATH1 = '/var/run/secrets/tokens/vault-token';
|
|
21
21
|
const DEFAULT_CR_TOKEN_FILEPATH2 = '/var/run/secrets/tokens/sa-token';
|
|
22
|
+
const DEFAULT_CR_TOKEN_FILEPATH3 = '/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token';
|
|
22
23
|
/**
|
|
23
24
|
* The ContainerTokenManager retrieves a compute resource token from a file on the container. This token
|
|
24
25
|
* is used to perform the necessary interactions with the IAM token service to obtain and store a suitable
|
|
@@ -114,6 +115,7 @@ export class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
114
115
|
* 1. User-specified filename (if specified)
|
|
115
116
|
* 2. Default file #1 (/var/run/secrets/tokens/vault-token)
|
|
116
117
|
* 3. Default file #2 (/var/run/secrets/tokens/sa-token)
|
|
118
|
+
* 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token)
|
|
117
119
|
* First one found wins.
|
|
118
120
|
*
|
|
119
121
|
* @returns the CR token value as a string
|
|
@@ -131,7 +133,12 @@ export class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
131
133
|
crToken = readCrTokenFile(DEFAULT_CR_TOKEN_FILEPATH1);
|
|
132
134
|
}
|
|
133
135
|
catch (err) {
|
|
134
|
-
|
|
136
|
+
try {
|
|
137
|
+
crToken = readCrTokenFile(DEFAULT_CR_TOKEN_FILEPATH2);
|
|
138
|
+
}
|
|
139
|
+
catch (err1) {
|
|
140
|
+
crToken = readCrTokenFile(DEFAULT_CR_TOKEN_FILEPATH3);
|
|
141
|
+
}
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
return crToken;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2025.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { GenericAbortSignal as AbortSignal } from 'axios';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2025.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -192,7 +192,7 @@ export class RequestWrapper {
|
|
|
192
192
|
sendRequest(parameters) {
|
|
193
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
194
|
const options = extend(true, {}, parameters.defaultOptions, parameters.options);
|
|
195
|
-
const { path, body, form, formData, qs, method, serviceUrl } = options;
|
|
195
|
+
const { path, body, form, formData, qs, method, serviceUrl, axiosOptions } = options;
|
|
196
196
|
let { headers, url } = options;
|
|
197
197
|
const multipartForm = new FormData();
|
|
198
198
|
// Form params
|
|
@@ -252,16 +252,9 @@ export class RequestWrapper {
|
|
|
252
252
|
if (this.compressRequestData) {
|
|
253
253
|
data = yield this.gzipRequestBody(data, headers);
|
|
254
254
|
}
|
|
255
|
-
const requestParams = {
|
|
256
|
-
url,
|
|
255
|
+
const requestParams = Object.assign({ url,
|
|
257
256
|
method,
|
|
258
|
-
headers,
|
|
259
|
-
params: qs,
|
|
260
|
-
data,
|
|
261
|
-
raxConfig: this.raxConfig,
|
|
262
|
-
responseType: options.responseType || 'json',
|
|
263
|
-
paramsSerializer: { serialize: (params) => stringify(params) },
|
|
264
|
-
};
|
|
257
|
+
headers, params: qs, data, raxConfig: this.raxConfig, responseType: options.responseType || 'json', paramsSerializer: { serialize: (params) => stringify(params) } }, axiosOptions);
|
|
265
258
|
return this.axiosInstance(requestParams).then((res) => {
|
|
266
259
|
// sometimes error responses will still trigger the `then` block - escape that behavior here
|
|
267
260
|
if (!res) {
|
package/ibm-cloud-sdk-core.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
|
+
import { GenericAbortSignal as AbortSignal_2 } from 'axios';
|
|
3
4
|
import { AxiosInstance } from 'axios';
|
|
4
5
|
import type { CookieJar } from 'tough-cookie';
|
|
5
6
|
import { Debugger } from 'debug';
|
|
6
7
|
import { OutgoingHttpHeaders } from 'http';
|
|
7
8
|
import { Stream } from 'stream';
|
|
8
9
|
|
|
10
|
+
export { AbortSignal_2 as AbortSignal }
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
13
|
* Checks for at least one of the given elements being defined.
|
|
11
14
|
*
|
|
@@ -544,6 +547,7 @@ export declare class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
544
547
|
* 1. User-specified filename (if specified)
|
|
545
548
|
* 2. Default file #1 (/var/run/secrets/tokens/vault-token)
|
|
546
549
|
* 3. Default file #2 (/var/run/secrets/tokens/sa-token)
|
|
550
|
+
* 4. Default file #3 (/var/run/secrets/codeengine.cloud.ibm.com/compute-resource-token/token)
|
|
547
551
|
* First one found wins.
|
|
548
552
|
*
|
|
549
553
|
* @returns the CR token value as a string
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -36,6 +36,7 @@ exports.getNewLogger = exports.contentType = exports.qs = exports.BaseService =
|
|
|
36
36
|
/**
|
|
37
37
|
* @module ibm-cloud-sdk-core
|
|
38
38
|
*/
|
|
39
|
+
__exportStar(require("./lib/axios-types"), exports);
|
|
39
40
|
var base_service_1 = require("./lib/base-service");
|
|
40
41
|
Object.defineProperty(exports, "BaseService", { enumerable: true, get: function () { return base_service_1.BaseService; } });
|
|
41
42
|
__exportStar(require("./auth"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2025.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { GenericAbortSignal as AbortSignal } from 'axios';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* (C) Copyright IBM Corp. 2025.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/request-wrapper.js
CHANGED
|
@@ -259,13 +259,13 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
259
259
|
*/
|
|
260
260
|
RequestWrapper.prototype.sendRequest = function (parameters) {
|
|
261
261
|
return __awaiter(this, void 0, void 0, function () {
|
|
262
|
-
var options, path, body, form, formData, qs, method, serviceUrl, headers, url, multipartForm, _i, _a, key, values, _b, values_1, value, fileObj, data, requestParams;
|
|
262
|
+
var options, path, body, form, formData, qs, method, serviceUrl, axiosOptions, headers, url, multipartForm, _i, _a, key, values, _b, values_1, value, fileObj, data, requestParams;
|
|
263
263
|
var _this = this;
|
|
264
264
|
return __generator(this, function (_c) {
|
|
265
265
|
switch (_c.label) {
|
|
266
266
|
case 0:
|
|
267
267
|
options = (0, extend_1.default)(true, {}, parameters.defaultOptions, parameters.options);
|
|
268
|
-
path = options.path, body = options.body, form = options.form, formData = options.formData, qs = options.qs, method = options.method, serviceUrl = options.serviceUrl;
|
|
268
|
+
path = options.path, body = options.body, form = options.form, formData = options.formData, qs = options.qs, method = options.method, serviceUrl = options.serviceUrl, axiosOptions = options.axiosOptions;
|
|
269
269
|
headers = options.headers, url = options.url;
|
|
270
270
|
multipartForm = new form_data_1.default();
|
|
271
271
|
if (!formData) return [3 /*break*/, 7];
|
|
@@ -338,16 +338,7 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
338
338
|
data = _c.sent();
|
|
339
339
|
_c.label = 9;
|
|
340
340
|
case 9:
|
|
341
|
-
requestParams = {
|
|
342
|
-
url: url,
|
|
343
|
-
method: method,
|
|
344
|
-
headers: headers,
|
|
345
|
-
params: qs,
|
|
346
|
-
data: data,
|
|
347
|
-
raxConfig: this.raxConfig,
|
|
348
|
-
responseType: options.responseType || 'json',
|
|
349
|
-
paramsSerializer: { serialize: function (params) { return (0, querystring_1.stringify)(params); } },
|
|
350
|
-
};
|
|
341
|
+
requestParams = __assign({ url: url, method: method, headers: headers, params: qs, data: data, raxConfig: this.raxConfig, responseType: options.responseType || 'json', paramsSerializer: { serialize: function (params) { return (0, querystring_1.stringify)(params); } } }, axiosOptions);
|
|
351
342
|
return [2 /*return*/, this.axiosInstance(requestParams).then(function (res) {
|
|
352
343
|
// sometimes error responses will still trigger the `then` block - escape that behavior here
|
|
353
344
|
if (!res) {
|