Skip to content

Commit 59a1b74

Browse files
feat(api): Updated node-sdk to adopt Code Engine API specification changes
1 parent ef7476f commit 59a1b74

6 files changed

Lines changed: 42 additions & 21 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!--
2-
[![Build Status](https://travis-ci.com/IBM/code-engine-node-sdk.svg?token=eW5FVD71iyte6tTby8gr&branch=master)](https://travis.ibm.com/IBM/code-engine-node-sdk)
32
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
4-
[![npm-version](https://img.shields.io/npm/v/IBM/code-engine-node-sdk.svg)](https://www.npmjs.com/package/code-engine-sdk)
3+
[![npm-version](https://img.shields.io/npm/v/@ibm-cloud/ibm-code-engine-sdk.svg)](https://www.npmjs.com/package/@ibm-cloud/ibm-code-engine-sdk)
54
[![codecov](https://codecov.io/gh/IBM/code-engine-node-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/IBM/code-engine-node-sdk)
65
-->
76

‎code-engine/v2.ts‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CodeEngineV2 extends BaseService {
7676
}
7777

7878
/** The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
79-
* `2021-03-31` and `2026-03-27`.
79+
* `2021-03-31` and `2026-05-14`.
8080
*/
8181
version?: string;
8282

@@ -85,7 +85,7 @@ class CodeEngineV2 extends BaseService {
8585
*
8686
* @param {Object} options - Options for the service.
8787
* @param {string} [options.version] - The API version, in format `YYYY-MM-DD`. For the API behavior documented here,
88-
* specify any date between `2021-03-31` and `2026-03-27`.
88+
* specify any date between `2021-03-31` and `2026-05-14`.
8989
* @param {string} [options.serviceUrl] - The base URL for the service
9090
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
9191
* @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
@@ -5117,7 +5117,7 @@ namespace CodeEngineV2 {
51175117
/** Options for the `CodeEngineV2` constructor. */
51185118
export interface Options extends UserOptions {
51195119
/** The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between
5120-
* `2021-03-31` and `2026-03-27`.
5120+
* `2021-03-31` and `2026-05-14`.
51215121
*/
51225122
version?: string;
51235123
}
@@ -7697,7 +7697,7 @@ namespace CodeEngineV2 {
76977697
* Status of the Context-based-restriction configuration applicable for this project.
76987698
*/
76997699
export interface CbrStatus {
7700-
/** Describes the model of the enforcement status of a CBR status. */
7700+
/** Describes the model of the CBR enforcement status. */
77017701
data_plane: EnforcementStatus;
77027702
}
77037703

@@ -7909,11 +7909,15 @@ namespace CodeEngineV2 {
79097909
}
79107910

79117911
/**
7912-
* Describes the model of the enforcement status of a CBR status.
7912+
* Describes the model of the CBR enforcement status.
79137913
*/
79147914
export interface EnforcementStatus {
79157915
/** Detailed information on the condition of the CBR enforcement. */
79167916
enforcement: EnforcementStatus.Constants.Enforcement | string;
7917+
/** Indicates whether the private dataplane access to the project is blocked, partially_restricted, or allowed. */
7918+
inbound_private: EnforcementStatus.Constants.InboundPrivate | string;
7919+
/** Indicates whether the public dataplane access to the project is blocked or allowed. */
7920+
inbound_public: EnforcementStatus.Constants.InboundPublic | string;
79177921
/** Date time information specifying when the last synchronization happened. */
79187922
last_synced_at?: string;
79197923
}
@@ -7926,6 +7930,19 @@ namespace CodeEngineV2 {
79267930
NONE = 'none',
79277931
UNKNOWN = 'unknown',
79287932
}
7933+
/** Indicates whether the private dataplane access to the project is blocked, partially_restricted, or allowed. */
7934+
export enum InboundPrivate {
7935+
BLOCKED = 'blocked',
7936+
PARTIALLY_RESTRICTED = 'partially_restricted',
7937+
ALLOWED = 'allowed',
7938+
UNKNOWN = 'unknown',
7939+
}
7940+
/** Indicates whether the public dataplane access to the project is blocked or allowed. */
7941+
export enum InboundPublic {
7942+
BLOCKED = 'blocked',
7943+
ALLOWED = 'allowed',
7944+
UNKNOWN = 'unknown',
7945+
}
79297946
}
79307947
}
79317948

@@ -8558,6 +8575,8 @@ namespace CodeEngineV2 {
85588575
data: StorageData;
85598576
/** The version of the persistent data store, which is used to achieve optimistic locking. */
85608577
entity_tag: string;
8578+
/** When you provision a new persistent data store, a URL is created identifying the location of the instance. */
8579+
href?: string;
85618580
/** The identifier of the resource. */
85628581
id?: string;
85638582
/** The name of the persistent data store. */

‎examples/code-engine.v2.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('CodeEngineV2', () => {
6262
// begin-common
6363

6464
codeEngineService = CodeEngineV2.newInstance({
65-
version: '2026-03-27',
65+
version: '2026-05-14',
6666
});
6767

6868
// end-common
@@ -863,7 +863,7 @@ describe('CodeEngineV2', () => {
863863
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
864864
codeReference: 'data:text/plain;base64,<base64encoded-source-code>',
865865
name: 'my-function',
866-
runtime: 'nodejs-20',
866+
runtime: 'nodejs-24',
867867
};
868868

869869
let res;

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ibm-cloud/ibm-code-engine-sdk",
3-
"version": "6.0.0",
3+
"version": "6.0.2",
44
"description": "IBM Cloud Code Engine NodeJS SDK",
55
"repository": {
66
"type": "git",
@@ -36,7 +36,7 @@
3636
},
3737
"dependencies": {
3838
"@types/node": "^22.0.0",
39-
"axios": "^1.15.0",
39+
"axios": "^1.15.1",
4040
"extend": "^3.0.2",
4141
"ibm-cloud-sdk-core": "^5.4.11"
4242
},
@@ -52,7 +52,7 @@
5252
"eslint-config-prettier": "^10.0.0",
5353
"eslint-plugin-import": "^2.23.2",
5454
"eslint-plugin-jest": "^28.0.0",
55-
"eslint-plugin-jsdoc": "^62.0.0",
55+
"eslint-plugin-jsdoc": "^63.0.0",
5656
"eslint-plugin-node": "^11.0.0",
5757
"eslint-plugin-prettier": "^3.0.1",
5858
"installed-check": "^10.0.0",
@@ -69,5 +69,8 @@
6969
"<rootDir>/examples/"
7070
],
7171
"testEnvironment": "node"
72+
},
73+
"overrides": {
74+
"follow-redirects": "^1.16.0"
7275
}
7376
}

‎test/integration/v2.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ describe('CodeEngineV2_integration', () => {
15541554
codeReference:
15551555
'data:text/plain;base64,YXN5bmMgZnVuY3Rpb24gbWFpbihwYXJhbXMpIHsKICByZXR1cm4gewogICAgICBzdGF0dXNDb2RlOiAyMDAsCiAgICAgIGhlYWRlcnM6IHsgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJyB9LAogICAgICBib2R5OiBwYXJhbXMgfTsKfQptb2R1bGUuZXhwb3J0cy5tYWluID0gbWFpbjs=',
15561556
name: 'my-function',
1557-
runtime: 'nodejs-20',
1557+
runtime: 'nodejs-24',
15581558
};
15591559

15601560
const res = await codeEngineService.createFunction(params);

‎test/unit/code-engine.v2.test.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const CodeEngineV2 = require('../../dist/code-engine/v2');
3535
const codeEngineServiceOptions = {
3636
authenticator: new NoAuthAuthenticator(),
3737
url: 'https://api.au-syd.codeengine.cloud.ibm.com/v2',
38-
version: '2026-03-27',
38+
version: '2026-05-14',
3939
};
4040

4141
const codeEngineService = new CodeEngineV2(codeEngineServiceOptions);
@@ -3771,9 +3771,9 @@ describe('CodeEngineV2', () => {
37713771
const serviceUrl = codeEngineServiceOptions.url;
37723772
const path = '/projects/15314cc3-85b4-4338-903f-c28cdee6d005/functions';
37733773
const mockPagerResponse1 =
3774-
'{"next":{"start":"1"},"functions":[{"code_binary":false,"code_main":"main","code_reference":"data:text/plain;base64,<base64encoded-source-code>","code_secret":"my-secret","computed_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"created_at":"2022-09-13T11:41:35+02:00","endpoint":"https://my-function.vg67hzldruk.eu-de.codeengine.appdomain.cloud","endpoint_internal":"http://my-function.vg67hzldruk.svc.cluster.local","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/functions/my-function","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","managed_domain_mappings":"local_public","name":"my-function","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"function_v2","run_compute_resource_token_enabled":true,"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"runtime":"nodejs-20","scale_concurrency":1,"scale_cpu_limit":"1","scale_down_delay":300,"scale_max_execution_time":60,"scale_memory_limit":"1G","status":"offline","status_details":{"reason":"offline"}}],"total_count":2,"limit":1}';
3774+
'{"next":{"start":"1"},"functions":[{"code_binary":false,"code_main":"main","code_reference":"data:text/plain;base64,<base64encoded-source-code>","code_secret":"my-secret","computed_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"created_at":"2022-09-13T11:41:35+02:00","endpoint":"https://my-function.vg67hzldruk.eu-de.codeengine.appdomain.cloud","endpoint_internal":"http://my-function.vg67hzldruk.svc.cluster.local","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/functions/my-function","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","managed_domain_mappings":"local_public","name":"my-function","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"function_v2","run_compute_resource_token_enabled":true,"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"runtime":"nodejs-24","scale_concurrency":1,"scale_cpu_limit":"1","scale_down_delay":300,"scale_max_execution_time":60,"scale_memory_limit":"1G","status":"offline","status_details":{"reason":"offline"}}],"total_count":2,"limit":1}';
37753775
const mockPagerResponse2 =
3776-
'{"functions":[{"code_binary":false,"code_main":"main","code_reference":"data:text/plain;base64,<base64encoded-source-code>","code_secret":"my-secret","computed_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"created_at":"2022-09-13T11:41:35+02:00","endpoint":"https://my-function.vg67hzldruk.eu-de.codeengine.appdomain.cloud","endpoint_internal":"http://my-function.vg67hzldruk.svc.cluster.local","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/functions/my-function","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","managed_domain_mappings":"local_public","name":"my-function","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"function_v2","run_compute_resource_token_enabled":true,"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"runtime":"nodejs-20","scale_concurrency":1,"scale_cpu_limit":"1","scale_down_delay":300,"scale_max_execution_time":60,"scale_memory_limit":"1G","status":"offline","status_details":{"reason":"offline"}}],"total_count":2,"limit":1}';
3776+
'{"functions":[{"code_binary":false,"code_main":"main","code_reference":"data:text/plain;base64,<base64encoded-source-code>","code_secret":"my-secret","computed_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"created_at":"2022-09-13T11:41:35+02:00","endpoint":"https://my-function.vg67hzldruk.eu-de.codeengine.appdomain.cloud","endpoint_internal":"http://my-function.vg67hzldruk.svc.cluster.local","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/functions/my-function","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","managed_domain_mappings":"local_public","name":"my-function","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"function_v2","run_compute_resource_token_enabled":true,"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"runtime":"nodejs-24","scale_concurrency":1,"scale_cpu_limit":"1","scale_down_delay":300,"scale_max_execution_time":60,"scale_memory_limit":"1G","status":"offline","status_details":{"reason":"offline"}}],"total_count":2,"limit":1}';
37773777

37783778
beforeEach(() => {
37793779
unmock_createRequest();
@@ -3837,7 +3837,7 @@ describe('CodeEngineV2', () => {
38373837
const projectId = '15314cc3-85b4-4338-903f-c28cdee6d005';
38383838
const codeReference = 'data:text/plain;base64,<base64encoded-source-code>';
38393839
const name = 'my-function';
3840-
const runtime = 'nodejs-20';
3840+
const runtime = 'nodejs-24';
38413841
const codeBinary = false;
38423842
const codeMain = 'main';
38433843
const codeSecret = 'my-secret';
@@ -3921,7 +3921,7 @@ describe('CodeEngineV2', () => {
39213921
const projectId = '15314cc3-85b4-4338-903f-c28cdee6d005';
39223922
const codeReference = 'data:text/plain;base64,<base64encoded-source-code>';
39233923
const name = 'my-function';
3924-
const runtime = 'nodejs-20';
3924+
const runtime = 'nodejs-24';
39253925
const userAccept = 'fake/accept';
39263926
const userContentType = 'fake/contentType';
39273927
const createFunctionParams = {
@@ -4174,7 +4174,7 @@ describe('CodeEngineV2', () => {
41744174
const managedDomainMappings = 'local_public';
41754175
const runComputeResourceTokenEnabled = true;
41764176
const runEnvVariables = [envVarPrototypeModel];
4177-
const runtime = 'nodejs-20';
4177+
const runtime = 'nodejs-24';
41784178
const scaleConcurrency = 1;
41794179
const scaleCpuLimit = '1';
41804180
const scaleDownDelay = 300;
@@ -7555,9 +7555,9 @@ describe('CodeEngineV2', () => {
75557555
const serviceUrl = codeEngineServiceOptions.url;
75567556
const path = '/projects/15314cc3-85b4-4338-903f-c28cdee6d005/persistent_data_stores';
75577557
const mockPagerResponse1 =
7558-
'{"next":{"start":"1"},"persistent_data_stores":[{"created_at":"2022-09-13T11:41:35+02:00","data":{"bucket_location":"bucket_location","bucket_name":"bucket_name","secret_name":"secret_name"},"entity_tag":"2385407409","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","name":"my-persistent-data-store","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"persistent_data_store_v2","storage_type":"object_storage"}],"total_count":2,"limit":1}';
7558+
'{"next":{"start":"1"},"persistent_data_stores":[{"created_at":"2022-09-13T11:41:35+02:00","data":{"bucket_location":"bucket_location","bucket_name":"bucket_name","secret_name":"secret_name"},"entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/persistent_data_stores/my-persistent-data-store","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","name":"my-persistent-data-store","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"persistent_data_store_v2","storage_type":"object_storage"}],"total_count":2,"limit":1}';
75597559
const mockPagerResponse2 =
7560-
'{"persistent_data_stores":[{"created_at":"2022-09-13T11:41:35+02:00","data":{"bucket_location":"bucket_location","bucket_name":"bucket_name","secret_name":"secret_name"},"entity_tag":"2385407409","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","name":"my-persistent-data-store","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"persistent_data_store_v2","storage_type":"object_storage"}],"total_count":2,"limit":1}';
7560+
'{"persistent_data_stores":[{"created_at":"2022-09-13T11:41:35+02:00","data":{"bucket_location":"bucket_location","bucket_name":"bucket_name","secret_name":"secret_name"},"entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/persistent_data_stores/my-persistent-data-store","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","name":"my-persistent-data-store","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","region":"us-east","resource_type":"persistent_data_store_v2","storage_type":"object_storage"}],"total_count":2,"limit":1}';
75617561

75627562
beforeEach(() => {
75637563
unmock_createRequest();

0 commit comments

Comments
 (0)