From c23c369ce845beea3c4664632c8d282ced020ee1 Mon Sep 17 00:00:00 2001 From: leotrinh Date: Thu, 5 Mar 2026 17:31:36 +0700 Subject: [PATCH] feat: add handle cache, update docs --- CHANGELOG.md | 40 +++++++++++ MIGRATION_GUIDE.md | 10 +++ README.md | 6 +- RELEASE_NOTES.md | 50 +++++++++++++ doc/Apps.html | 7 +- doc/AppsCopy.html | 5 +- doc/AppsCore.html | 33 ++++++--- doc/AppsDeployment.html | 34 +++++---- doc/BuildPacks.html | 5 +- doc/CfIgnoreHelper.html | 12 +++- doc/CloudController.html | 32 ++++++--- doc/CloudControllerBase.html | 42 ++++++----- doc/Domains.html | 5 +- doc/Events.html | 13 +++- doc/HttpUtils.html | 23 +++--- doc/Jobs.html | 9 ++- doc/Logs.html | 6 +- doc/Organizations.html | 64 ++++++++++++----- doc/OrganizationsQuota.html | 5 +- doc/Routes.html | 29 +++++--- doc/ServiceBindings.html | 25 +++++-- doc/ServiceInstances.html | 53 ++++++++++---- doc/ServicePlans.html | 25 +++++-- doc/Services.html | 23 ++++-- doc/Spaces.html | 70 +++++++++++++------ doc/SpacesQuota.html | 5 +- doc/Stacks.html | 5 +- doc/UserProvidedServices.html | 30 ++++++-- doc/Users.html | 5 +- doc/UsersUAA.html | 6 +- doc/index.html | 2 +- doc/model_cloudcontroller_Apps.js.html | 2 +- doc/model_cloudcontroller_AppsCopy.js.html | 2 +- doc/model_cloudcontroller_AppsCore.js.html | 32 +++++++-- ...del_cloudcontroller_AppsDeployment.js.html | 63 ++++++++++++----- doc/model_cloudcontroller_BuildPacks.js.html | 2 +- ...el_cloudcontroller_CloudController.js.html | 2 +- ...loudcontroller_CloudControllerBase.js.html | 3 +- doc/model_cloudcontroller_Domains.js.html | 2 +- doc/model_cloudcontroller_Events.js.html | 2 +- doc/model_cloudcontroller_Jobs.js.html | 2 +- ...odel_cloudcontroller_Organizations.js.html | 26 ++++--- ...cloudcontroller_OrganizationsQuota.js.html | 2 +- doc/model_cloudcontroller_Routes.js.html | 2 +- ...el_cloudcontroller_ServiceBindings.js.html | 2 +- ...l_cloudcontroller_ServiceInstances.js.html | 2 +- ...model_cloudcontroller_ServicePlans.js.html | 2 +- doc/model_cloudcontroller_Services.js.html | 2 +- doc/model_cloudcontroller_Spaces.js.html | 33 +++++---- doc/model_cloudcontroller_SpacesQuota.js.html | 2 +- doc/model_cloudcontroller_Stacks.js.html | 2 +- ...oudcontroller_UserProvidedServices.js.html | 2 +- doc/model_cloudcontroller_Users.js.html | 2 +- doc/model_metrics_Logs.js.html | 2 +- doc/model_uaa_UsersUAA.js.html | 2 +- doc/utils_CfIgnoreHelper.js.html | 2 +- doc/utils_HttpUtils.js.html | 2 +- index.js | 2 +- lib/model/cloudcontroller/AppsCore.js | 30 ++++++-- lib/model/cloudcontroller/AppsDeployment.js | 61 +++++++++++----- .../cloudcontroller/CloudControllerBase.js | 1 + lib/model/cloudcontroller/Organizations.js | 24 ++++--- lib/model/cloudcontroller/Spaces.js | 31 ++++---- package.json | 3 +- test/lib/ApiMigrationTests.js | 10 +-- 65 files changed, 746 insertions(+), 294 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 481f0e6..ec6c745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,43 @@ +## Version 1.0.5 2026-03-05 + +**PATCH RELEASE — Fix 11 Incorrect v3 API Endpoints** + +### Bug Fixes — AppsDeployment.js (4 fixes) + +- **`getStats()` wrong v3 endpoint**: Was `/v3/apps/:guid/stats` → Fixed to `/v3/apps/:guid/processes/web/stats` (v3 stats are per-process) +- **`associateRoute()` wrong v3 method & endpoint**: Was `PUT /v3/apps/:guid/routes/:routeGuid` → Fixed to `POST /v3/routes/:routeGuid/destinations` with `{ destinations: [{ app: { guid } }] }` body +- **`getServiceBindings()` wrong v3 endpoint**: Was `/v3/apps/:guid/service_credential_bindings` → Fixed to `/v3/service_credential_bindings?app_guids=:guid` (top-level endpoint with filter) +- **`_uploadV3()` wrong single-step upload**: Was single request to `/v3/apps/:guid/bits` → Fixed to 2-step: create package via `POST /v3/packages` then upload bits to `POST /v3/packages/:guid/upload` + +### Bug Fixes — Organizations.js (3 fixes) + +- **`_getUsersV3()` wrong endpoint**: Was `/v3/organizations/:guid/relationships/users` → Fixed to `/v3/roles?organization_guids=:guid&types=organization_user` +- **`_getManagersV3()` wrong endpoint**: Was `/v3/organizations/:guid/relationships/managers` → Fixed to `/v3/roles?organization_guids=:guid&types=organization_manager` +- **`_getAuditorsV3()` wrong endpoint**: Was `/v3/organizations/:guid/relationships/auditors` → Fixed to `/v3/roles?organization_guids=:guid&types=organization_auditor` + +### Bug Fixes — Spaces.js (4 fixes) + +- **`_getUsersV3()` wrong endpoint**: Was `/v3/spaces/:guid/relationships/members` → Fixed to `/v3/roles?space_guids=:guid` +- **`_getManagersV3()` wrong endpoint**: Was `/v3/spaces/:guid/relationships/managers` → Fixed to `/v3/roles?space_guids=:guid&types=space_manager` +- **`_getDevelopersV3()` wrong endpoint**: Was `/v3/spaces/:guid/relationships/developers` → Fixed to `/v3/roles?space_guids=:guid&types=space_developer` +- **`_getAuditorsV3()` wrong endpoint**: Was `/v3/spaces/:guid/relationships/auditors` → Fixed to `/v3/roles?space_guids=:guid&types=space_auditor` + +### Enhancements +- **`Spaces.getSpaceApps()`**: Added backward-compatibility alias for `Spaces.getApps()` — existing consumer code referencing the old method name continues to work + +### Audit Summary +- 27 additional files scanned & confirmed clean — no issues found in Apps.js, AppsCopy.js, Routes.js, Domains.js, ServiceBindings.js, ServiceInstances.js, ServicePlans.js, Services.js, Events.js, Jobs.js, BuildPacks.js, Stacks.js, Users.js, UserProvidedServices.js, OrganizationsQuota.js, SpacesQuota.js, UsersUAA.js, Logs.js, HttpUtils.js, HttpStatus.js, ApiConfig.js, ApiVersionManager.js, ConfigManagerService.js, ErrorService.js, CacheService.js, CloudController.js, CloudControllerBase.js + +### Files Modified +- `lib/model/cloudcontroller/AppsDeployment.js` +- `lib/model/cloudcontroller/Organizations.js` +- `lib/model/cloudcontroller/Spaces.js` + +### Tests +- All **93 passing**, 0 failing + +--- + ## Version 1.0.4 2026-03-05 **HOTFIX RELEASE — Critical: v3 Authentication Flow Broken** diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index bbddf5f..542a397 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -1,5 +1,15 @@ # Migration Guide: cf-nodejs-client → cf-node-client v1.0.0 +## Important: v1.0.5 — 11 Incorrect v3 Endpoints Fixed + +If you are using v1.0.0–v1.0.4 in **v3 mode (default)**, the following methods called wrong endpoints: + +- `AppsDeployment`: `getStats()`, `associateRoute()`, `getServiceBindings()`, `upload()` (v3 path) +- `Organizations`: `getUsers()`, `getManagers()`, `getAuditors()` (v3 path) +- `Spaces`: `getUsers()`, `getManagers()`, `getDevelopers()`, `getAuditors()` (v3 path) + +**Upgrade to v1.0.5** to get correct v3 API endpoints. No consumer code changes needed. + ## Important: v1.0.4 Hotfix — Authentication Flow If you upgraded to v1.0.0–v1.0.3 and hit the error: diff --git a/README.md b/README.md index 81f97c3..9f53f66 100644 --- a/README.md +++ b/README.md @@ -330,7 +330,11 @@ Contributions are welcome! We want to make contributing as easy and transparent 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/my-feature`) 3. Write or improve **tests** — this is the most impactful way to help -4. Ensure all tests pass (`npm test`) +4. Run the precheck before committing: + ```bash + npm run precheck + ``` + This runs TypeScript compilation (`tsc`) and the full test suite (lint + unit tests). **Your PR will not be accepted if precheck fails.** 5. Commit your changes (`git commit -m 'feat: add some feature'`) 6. Push to the branch (`git push origin feature/my-feature`) 7. Open a **Pull Request** diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d24f190..8ace189 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,53 @@ +# cf-node-client v1.0.5 — Fix 11 Incorrect v3 API Endpoints + +**Package**: cf-node-client v1.0.5 +**Release Date**: March 5, 2026 +**Status**: Production Ready +**Severity**: **Important — v3 Endpoint Corrections** + +## What's Fixed in v1.0.5 + +Full audit of all 30 library files found 11 incorrect v3 API endpoints across 3 files. All corrected to match the official [CF API v3 specification](https://v3-apidocs.cloudfoundry.org/). + +### AppsDeployment.js — 4 Fixes + +| Method | Before (broken) | After (correct) | +|--------|-----------------|-----------------| +| `getStats()` | `/v3/apps/:guid/stats` | `/v3/apps/:guid/processes/web/stats` | +| `associateRoute()` | `PUT /v3/apps/:guid/routes/:routeGuid` | `POST /v3/routes/:routeGuid/destinations` with body | +| `getServiceBindings()` | `/v3/apps/:guid/service_credential_bindings` | `/v3/service_credential_bindings?app_guids=:guid` | +| `_uploadV3()` | Single-step upload | 2-step: create package → upload bits | + +### Organizations.js — 3 Fixes + +| Method | Before (broken) | After (correct) | +|--------|-----------------|-----------------| +| `_getUsersV3()` | `/v3/organizations/:guid/relationships/users` | `/v3/roles?organization_guids=:guid&types=organization_user` | +| `_getManagersV3()` | `/v3/organizations/:guid/relationships/managers` | `/v3/roles?organization_guids=:guid&types=organization_manager` | +| `_getAuditorsV3()` | `/v3/organizations/:guid/relationships/auditors` | `/v3/roles?organization_guids=:guid&types=organization_auditor` | + +### Spaces.js — 4 Fixes + +| Method | Before (broken) | After (correct) | +|--------|-----------------|-----------------| +| `_getUsersV3()` | `/v3/spaces/:guid/relationships/members` | `/v3/roles?space_guids=:guid` | +| `_getManagersV3()` | `/v3/spaces/:guid/relationships/managers` | `/v3/roles?space_guids=:guid&types=space_manager` | +| `_getDevelopersV3()` | `/v3/spaces/:guid/relationships/developers` | `/v3/roles?space_guids=:guid&types=space_developer` | +| `_getAuditorsV3()` | `/v3/spaces/:guid/relationships/auditors` | `/v3/roles?space_guids=:guid&types=space_auditor` | + +### Additional Enhancement + +- **`Spaces.getSpaceApps(guid, filter)`**: Added backward-compatibility alias for `Spaces.getApps()` so existing consumer code continues to work. + +### Audit Scope + +27 additional files scanned and confirmed clean — no issues found. + +### Tests +- All **93 tests passing**, 0 failing + +--- + # cf-node-client v1.0.4 — Hotfix: v3 getInfo() Broken Authentication Flow **Package**: cf-node-client v1.0.4 diff --git a/doc/Apps.html b/doc/Apps.html index 3cc1e1c..e2e9236 100644 --- a/doc/Apps.html +++ b/doc/Apps.html @@ -50,7 +50,10 @@

Class: Apps

Apps()

-
Apps — unified facade combining core CRUD, deployment, and copy operations. Extends AppsCore directly; mixes in methods from AppsDeployment and AppsCopy. Backward-compatible: `new Apps(endPoint, options)` works exactly as before.
+
Apps — unified facade combining core CRUD, deployment, and copy operations. +Extends AppsCore directly; mixes in methods from AppsDeployment and AppsCopy. + +Backward-compatible: `new Apps(endPoint, options)` works exactly as before.
@@ -181,7 +184,7 @@

Home

Classes