@sfdxy/anypoint-connect 0.8.0 → 0.9.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/README.md +260 -112
- package/dist/api/CloudHub2Api.d.ts +43 -32
- package/dist/api/CloudHub2Api.d.ts.map +1 -1
- package/dist/api/CloudHub2Api.js +17 -0
- package/dist/api/CloudHub2Api.js.map +1 -1
- package/dist/api/DesignCenterApi.d.ts +11 -0
- package/dist/api/DesignCenterApi.d.ts.map +1 -1
- package/dist/api/DesignCenterApi.js +47 -15
- package/dist/api/DesignCenterApi.js.map +1 -1
- package/dist/api/ExchangeApi.d.ts +17 -0
- package/dist/api/ExchangeApi.d.ts.map +1 -1
- package/dist/api/ExchangeApi.js +30 -0
- package/dist/api/ExchangeApi.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/client/HttpClient.d.ts +8 -0
- package/dist/client/HttpClient.d.ts.map +1 -1
- package/dist/client/HttpClient.js +16 -0
- package/dist/client/HttpClient.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +16 -47
- package/dist/commands/deploy.js.map +1 -1
- package/dist/mcp/tools/applications.d.ts.map +1 -1
- package/dist/mcp/tools/applications.js +292 -67
- package/dist/mcp/tools/applications.js.map +1 -1
- package/dist/mcp/tools/exchange.d.ts +2 -1
- package/dist/mcp/tools/exchange.d.ts.map +1 -1
- package/dist/mcp/tools/exchange.js +225 -2
- package/dist/mcp/tools/exchange.js.map +1 -1
- package/dist/mcp/tools/shared.d.ts +18 -0
- package/dist/mcp/tools/shared.d.ts.map +1 -1
- package/dist/mcp/tools/shared.js +17 -0
- package/dist/mcp/tools/shared.js.map +1 -1
- package/dist/safety/deployment.d.ts +77 -0
- package/dist/safety/deployment.d.ts.map +1 -0
- package/dist/safety/deployment.js +132 -0
- package/dist/safety/deployment.js.map +1 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -2
- package/dist/utils/errors.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,216 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/logo.svg" alt="Anypoint Connect Banner" width="
|
|
2
|
+
<img src="assets/logo.svg" alt="Anypoint Connect Banner" width="600" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@sfdxy/anypoint-connect"><img src="https://img.shields.io/npm/v/@sfdxy/anypoint-connect?style=flat-square&color=34d399" alt="npm version" /></a>
|
|
7
|
+
<a href="https://github.com/Avinava/anypoint-connect/actions"><img src="https://img.shields.io/github/actions/workflow/status/Avinava/anypoint-connect/ci.yml?style=flat-square&color=38bdf8" alt="CI" /></a>
|
|
8
|
+
<a href="https://github.com/Avinava/anypoint-connect/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/@sfdxy/anypoint-connect?style=flat-square&color=818cf8" alt="License" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@sfdxy/anypoint-connect"><img src="https://img.shields.io/npm/dm/@sfdxy/anypoint-connect?style=flat-square&color=fbbf24" alt="Downloads" /></a>
|
|
10
|
+
</p>
|
|
6
11
|
|
|
7
|
-
>
|
|
12
|
+
<p align="center">
|
|
13
|
+
<strong>CLI + MCP toolkit for Anypoint Platform — deploy, tail logs, pull metrics, manage API specs, with production safety nets.</strong>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="#architecture">Architecture</a> •
|
|
18
|
+
<a href="#setup">Setup</a> •
|
|
19
|
+
<a href="#cli-reference">CLI Reference</a> •
|
|
20
|
+
<a href="#mcp-server">MCP Server</a> •
|
|
21
|
+
<a href="#programmatic-usage">Library</a>
|
|
22
|
+
</p>
|
|
8
23
|
|
|
9
|
-
|
|
10
|
-
[](https://www.npmjs.com/package/@sfdxy/anypoint-connect)
|
|
24
|
+
## Quick Start
|
|
11
25
|
|
|
12
26
|
```bash
|
|
27
|
+
# 1. Install
|
|
13
28
|
npm install -g @sfdxy/anypoint-connect
|
|
29
|
+
|
|
30
|
+
# 2. Configure (interactive — prompts for Client ID & Secret)
|
|
31
|
+
anc config init
|
|
32
|
+
|
|
33
|
+
# 3. Authenticate (opens browser for OAuth)
|
|
34
|
+
anc auth login
|
|
35
|
+
|
|
36
|
+
# 4. Verify
|
|
37
|
+
anc auth status
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> **Don't have a Client ID yet?** See [Create a Connected App](#2-create-a-connected-app-in-anypoint-platform) below.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Setup
|
|
45
|
+
|
|
46
|
+
### 1. Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Global install from npm (recommended)
|
|
50
|
+
npm install -g @sfdxy/anypoint-connect
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
<details>
|
|
54
|
+
<summary>Install from source</summary>
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/Avinava/anypoint-connect.git
|
|
58
|
+
cd anypoint-connect
|
|
59
|
+
npm install && npm run build
|
|
60
|
+
npm link # makes "anc" available globally
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
</details>
|
|
64
|
+
|
|
65
|
+
Verify the install:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
anc --version
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Create a Connected App in Anypoint Platform
|
|
72
|
+
|
|
73
|
+
You need a **Connected App** in Anypoint to authenticate. Here's how to create one:
|
|
74
|
+
|
|
75
|
+
1. Log in to [Anypoint Platform](https://anypoint.mulesoft.com)
|
|
76
|
+
2. Go to **Access Management → Connected Apps**
|
|
77
|
+
3. Click **Create app**, choose **App that acts on a user's behalf**
|
|
78
|
+
4. Set the **Redirect URI** to:
|
|
79
|
+
```
|
|
80
|
+
http://localhost:3000/api/callback
|
|
81
|
+
```
|
|
82
|
+
5. Grant these scopes:
|
|
83
|
+
|
|
84
|
+
| Scope Category | Permissions |
|
|
85
|
+
|---------------|-------------|
|
|
86
|
+
| **General** | View Organization, View Environment |
|
|
87
|
+
| **Runtime Manager** | Read Applications, Create/Modify Applications |
|
|
88
|
+
| **CloudHub** | Read Applications, Manage Applications |
|
|
89
|
+
| **Monitoring** | Read Metrics |
|
|
90
|
+
| **Design Center** | Read/Write Designer |
|
|
91
|
+
| **Exchange** | Exchange Contributor |
|
|
92
|
+
| **Audit Logs** | View Audit Logs *(optional)* |
|
|
93
|
+
|
|
94
|
+
6. Copy the **Client ID** and **Client Secret** — you'll need them in the next step.
|
|
95
|
+
|
|
96
|
+
### 3. Configure Credentials
|
|
97
|
+
|
|
98
|
+
Run the interactive setup and paste your Client ID and Secret when prompted:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
anc config init
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Anypoint Connect Setup — Profile: default
|
|
106
|
+
Credentials saved to: ~/.anypoint-connect/profiles/default/config.json
|
|
107
|
+
Tokens saved to: ~/.anypoint-connect/profiles/default/tokens.enc (AES-256-GCM)
|
|
108
|
+
|
|
109
|
+
Client ID: <paste your Client ID>
|
|
110
|
+
Client Secret: <paste your Client Secret>
|
|
111
|
+
Callback URL: (http://localhost:3000/api/callback)
|
|
112
|
+
Base URL: (https://anypoint.mulesoft.com)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Verify your config:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
anc config show
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 4. Authenticate
|
|
122
|
+
|
|
123
|
+
This opens your browser for OAuth login and stores encrypted tokens locally:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
anc auth login
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Check your auth status anytime:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
anc auth status
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 5. You're Ready!
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# List apps in an environment
|
|
139
|
+
anc apps list --env Sandbox
|
|
140
|
+
|
|
141
|
+
# Tail logs
|
|
142
|
+
anc logs tail my-api --env Sandbox
|
|
143
|
+
|
|
144
|
+
# Check deployment metrics
|
|
145
|
+
anc monitor view --env Production
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Multi-Org / Multi-Profile Setup
|
|
151
|
+
|
|
152
|
+
If you work across multiple Anypoint organizations, use **named profiles**:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Create separate profiles
|
|
156
|
+
anc config init --profile org-a
|
|
157
|
+
anc config init --profile org-b
|
|
158
|
+
|
|
159
|
+
# Authenticate each
|
|
160
|
+
anc auth login --profile org-a
|
|
161
|
+
anc auth login --profile org-b
|
|
162
|
+
|
|
163
|
+
# Bind a project directory to a profile
|
|
164
|
+
cd ~/projects/org-a-integrations
|
|
165
|
+
anc config use org-a
|
|
166
|
+
# Creates .anypoint-connect.json → { "profile": "org-a" }
|
|
167
|
+
# All commands in this folder now auto-use "org-a"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Managing Config
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
anc config show # Show config (secrets masked)
|
|
174
|
+
anc config show --profile org-a # Show specific profile
|
|
175
|
+
anc config set defaultEnv Production # Update a value
|
|
176
|
+
anc config profiles # List all profiles
|
|
177
|
+
|
|
178
|
+
# Override per-session
|
|
179
|
+
ANYPOINT_PROFILE=org-b anc apps list --env Sandbox
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Config Resolution
|
|
183
|
+
|
|
184
|
+
Config uses **named profiles** for multi-org support. A profile is first resolved, then credentials within that profile:
|
|
185
|
+
|
|
186
|
+
**Profile resolution** (highest priority wins):
|
|
187
|
+
|
|
188
|
+
| Priority | Source | Example |
|
|
189
|
+
|----------|--------|---------|
|
|
190
|
+
| **1** | `--profile` CLI flag | `anc apps list --profile org-a --env Sandbox` |
|
|
191
|
+
| **2** | `ANYPOINT_PROFILE` env var | `export ANYPOINT_PROFILE=org-a` |
|
|
192
|
+
| **3** | `.anypoint-connect.json` in project | `{ "profile": "org-a" }` (walks up from cwd) |
|
|
193
|
+
| **4** | Fallback | `"default"` |
|
|
194
|
+
|
|
195
|
+
**Credential resolution** within a profile (highest priority wins):
|
|
196
|
+
|
|
197
|
+
| Priority | Source | When to use |
|
|
198
|
+
|----------|--------|-------------|
|
|
199
|
+
| **1 (highest)** | Environment variables | CI/CD pipelines, Docker, per-session overrides |
|
|
200
|
+
| **2** | Profile config.json | Day-to-day development — persists per profile |
|
|
201
|
+
| **3 (lowest)** | `.env` in cwd | Legacy/project-local fallback |
|
|
202
|
+
|
|
203
|
+
Storage layout:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
~/.anypoint-connect/
|
|
207
|
+
└── profiles/
|
|
208
|
+
├── default/
|
|
209
|
+
│ ├── config.json OAuth credentials (chmod 600)
|
|
210
|
+
│ └── tokens.enc AES-256-GCM encrypted tokens
|
|
211
|
+
└── org-a/
|
|
212
|
+
├── config.json
|
|
213
|
+
└── tokens.enc
|
|
14
214
|
```
|
|
15
215
|
|
|
16
216
|
---
|
|
@@ -37,6 +237,9 @@ graph LR
|
|
|
37
237
|
AC --> OS["Object Store"]
|
|
38
238
|
```
|
|
39
239
|
|
|
240
|
+
<details>
|
|
241
|
+
<summary>Source tree</summary>
|
|
242
|
+
|
|
40
243
|
```
|
|
41
244
|
src/
|
|
42
245
|
├── auth/ OAuth2 + encrypted token storage
|
|
@@ -88,112 +291,7 @@ src/
|
|
|
88
291
|
└── index.ts Library barrel export
|
|
89
292
|
```
|
|
90
293
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Config uses **named profiles** for multi-org support. A profile is first resolved, then credentials within that profile:
|
|
94
|
-
|
|
95
|
-
**Profile resolution** (highest priority wins):
|
|
96
|
-
|
|
97
|
-
| Priority | Source | Example |
|
|
98
|
-
|----------|--------|---------|
|
|
99
|
-
| **1** | `--profile` CLI flag | `anc apps list --profile client-a --env Sandbox` |
|
|
100
|
-
| **2** | `ANYPOINT_PROFILE` env var | `export ANYPOINT_PROFILE=client-a` |
|
|
101
|
-
| **3** | `.anypoint-connect.json` in project | `{ "profile": "client-a" }` (walks up from cwd) |
|
|
102
|
-
| **4** | Fallback | `"default"` |
|
|
103
|
-
|
|
104
|
-
**Credential resolution** within a profile (highest priority wins):
|
|
105
|
-
|
|
106
|
-
| Priority | Source | When to use |
|
|
107
|
-
|----------|--------|-------------|
|
|
108
|
-
| **1 (highest)** | Environment variables | CI/CD pipelines, Docker, per-session overrides |
|
|
109
|
-
| **2** | Profile config.json | Day-to-day development — persists per profile |
|
|
110
|
-
| **3 (lowest)** | `.env` in cwd | Legacy/project-local fallback |
|
|
111
|
-
|
|
112
|
-
Storage layout:
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
~/.anypoint-connect/
|
|
116
|
-
└── profiles/
|
|
117
|
-
├── default/
|
|
118
|
-
│ ├── config.json OAuth credentials (chmod 600)
|
|
119
|
-
│ └── tokens.enc AES-256-GCM encrypted tokens
|
|
120
|
-
└── client-a/
|
|
121
|
-
├── config.json
|
|
122
|
-
└── tokens.enc
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Setup
|
|
128
|
-
|
|
129
|
-
### 1. Install
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
# Global install (recommended)
|
|
133
|
-
npm install -g @sfdxy/anypoint-connect
|
|
134
|
-
|
|
135
|
-
# Or from source
|
|
136
|
-
git clone https://github.com/Avinava/anypoint-connect.git
|
|
137
|
-
cd anypoint-connect
|
|
138
|
-
npm install && npm run build
|
|
139
|
-
npm link # makes "anc" available globally
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### 2. Create a Connected App in Anypoint Platform
|
|
143
|
-
|
|
144
|
-
1. Log in to [Anypoint Platform](https://anypoint.mulesoft.com)
|
|
145
|
-
2. Go to **Access Management → Connected Apps**
|
|
146
|
-
3. Click **Create app**, choose **App that acts on a user's behalf**
|
|
147
|
-
4. Set the **Redirect URI** to `http://localhost:3000/api/callback`
|
|
148
|
-
5. Grant scopes:
|
|
149
|
-
- `General` → **View Organization**, **View Environment**
|
|
150
|
-
- `Runtime Manager` → **Read Applications**, **Create/Modify Applications**
|
|
151
|
-
- `CloudHub` → **Read Applications**, **Manage Applications**
|
|
152
|
-
- `Monitoring` → **Read Metrics**
|
|
153
|
-
- `Design Center` → **Read/Write Designer**
|
|
154
|
-
- `Exchange` → **Exchange Contributor**
|
|
155
|
-
- `Audit Logs` → **View Audit Logs** (optional, for `get_audit_log`)
|
|
156
|
-
6. Copy the **Client ID** and **Client Secret**
|
|
157
|
-
|
|
158
|
-
### 3. Configure
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Default profile (single-org)
|
|
162
|
-
anc config init
|
|
163
|
-
|
|
164
|
-
# Named profile (multi-org)
|
|
165
|
-
anc config init --profile client-a
|
|
166
|
-
anc config init --profile client-b
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### 4. Authenticate
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
anc auth login # Default profile
|
|
173
|
-
anc auth login --profile client-a # Specific profile
|
|
174
|
-
anc auth status # Check current auth
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### 5. Bind a Project to a Profile
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
cd ~/projects/client-a-integrations
|
|
181
|
-
anc config use client-a
|
|
182
|
-
# Creates .anypoint-connect.json → { "profile": "client-a" }
|
|
183
|
-
# Now all commands & MCP in this folder auto-use "client-a"
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Managing Config
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
anc config show # Show config (secrets masked)
|
|
190
|
-
anc config show --profile client-a # Show specific profile
|
|
191
|
-
anc config set defaultEnv Production # Update a value
|
|
192
|
-
anc config profiles # List all profiles
|
|
193
|
-
|
|
194
|
-
# Override per-session
|
|
195
|
-
ANYPOINT_PROFILE=client-b anc apps list --env Sandbox
|
|
196
|
-
```
|
|
294
|
+
</details>
|
|
197
295
|
|
|
198
296
|
---
|
|
199
297
|
|
|
@@ -364,6 +462,8 @@ The MCP server auto-detects the active profile from the project's `.anypoint-con
|
|
|
364
462
|
|
|
365
463
|
### MCP Tools
|
|
366
464
|
|
|
465
|
+
> **Deploy safety.** The mutating deploy tools (`deploy_app`, `update_app_artifact`, `rollback_app`, `publish_app_jar`, `deploy_jar`) are **dry-run by default**: called without `confirm: true` they return a preview of exactly what would change and modify nothing. Re-call with `confirm: true` to apply. Redeploys of an existing app change **only** the artifact reference — runtime, target/space, replicas, and settings are always preserved.
|
|
466
|
+
|
|
367
467
|
| Tool | Description |
|
|
368
468
|
|------|-------------|
|
|
369
469
|
| **Identity & Org** | |
|
|
@@ -373,9 +473,12 @@ The MCP server auto-detects the active profile from the project's `.anypoint-con
|
|
|
373
473
|
| **Applications** | |
|
|
374
474
|
| `list_apps` | List deployed apps with status, version, vCores, and replica count |
|
|
375
475
|
| `get_app_status` | Detailed deployment status: resources (CPU/memory), autoscaling, JVM, replicas |
|
|
476
|
+
| `get_deployment_spec` | Full deployment spec (ref, runtime, target kind, vCores, replica states) — look before you leap |
|
|
376
477
|
| `get_app_resources` | Consolidated resource allocation view for all apps in an environment |
|
|
377
478
|
| `get_app_settings` | Read application properties and secure property keys |
|
|
378
|
-
| `deploy_app` | ⚠️
|
|
479
|
+
| `deploy_app` | ⚠️ Create a new deployment, or safely redeploy an existing one (artifact ref only). For an existing app, prefer `update_app_artifact` |
|
|
480
|
+
| `update_app_artifact` | ⚠️ Safe production redeploy — change only the artifact version, preserving runtime/target/replicas/settings |
|
|
481
|
+
| `rollback_app` | ⚠️ Roll an app back to a previous version (last successful by default) |
|
|
379
482
|
| `update_app_settings` | ⚠️ Update application properties with merge (triggers rolling restart) |
|
|
380
483
|
| `restart_app` | ⚠️ Rolling restart of an application |
|
|
381
484
|
| `scale_app` | ⚠️ Scale application replicas (1–8) |
|
|
@@ -400,6 +503,8 @@ The MCP server auto-detects the active profile from the project's `.anypoint-con
|
|
|
400
503
|
| `search_exchange` | Search assets in Exchange |
|
|
401
504
|
| `get_exchange_asset` | Get detailed asset info: versions, dependencies, instances, files |
|
|
402
505
|
| `download_api_spec` | Download RAML/OAS spec from Exchange |
|
|
506
|
+
| `publish_app_jar` | ⚠️ Upload a locally built application JAR to Exchange as a deployable asset |
|
|
507
|
+
| `deploy_jar` | ⚠️ Publish a JAR and deploy it in one call (create new app, or safe artifact update) |
|
|
403
508
|
| **API Manager** | |
|
|
404
509
|
| `list_api_instances` | List managed API instances with governance info |
|
|
405
510
|
| `get_api_policies` | Get policies and SLA tiers for an API |
|
|
@@ -466,6 +571,9 @@ The MCP server auto-detects the active profile from the project's `.anypoint-con
|
|
|
466
571
|
- *"What's in the dead-letter queue for order-events?"*
|
|
467
572
|
- *"Search the logs for correlation ID abc-123"*
|
|
468
573
|
- *"Deploy order-api v1.3.0 to Sandbox with 2 replicas"*
|
|
574
|
+
- *"Publish target/example-api-1.0.0-mule-application.jar and deploy it to Sandbox"*
|
|
575
|
+
- *"Bump example-api in Production to v1.4.12 (artifact only)"*
|
|
576
|
+
- *"Roll example-api back to the last good version"*
|
|
469
577
|
- *"Redeploy billing-service to Production with the latest version from Exchange"*
|
|
470
578
|
- *"Update the db.url property for order-api in Sandbox"*
|
|
471
579
|
- *"Stop the test-processor app in Development"*
|
|
@@ -478,6 +586,46 @@ The MCP server auto-detects the active profile from the project's `.anypoint-con
|
|
|
478
586
|
|
|
479
587
|
---
|
|
480
588
|
|
|
589
|
+
## Deploying a JAR (build → publish → deploy → roll back)
|
|
590
|
+
|
|
591
|
+
A locally built Mule application JAR goes to CloudHub 2.0 in two steps — publish the artifact to
|
|
592
|
+
Exchange, then deploy it — or in a single `deploy_jar` call. Every mutating step is **dry-run by
|
|
593
|
+
default**; add `confirm: true` to apply.
|
|
594
|
+
|
|
595
|
+
**One call (recommended).** Publish and deploy together:
|
|
596
|
+
|
|
597
|
+
```jsonc
|
|
598
|
+
// dry run — shows what would happen, changes nothing
|
|
599
|
+
deploy_jar({ "jarPath": "target/example-api-1.0.0-mule-application.jar", "appName": "example-api", "environment": "Sandbox" })
|
|
600
|
+
// apply
|
|
601
|
+
deploy_jar({ "jarPath": "target/example-api-1.0.0-mule-application.jar", "appName": "example-api", "environment": "Sandbox", "confirm": true })
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**Step by step**, for more control:
|
|
605
|
+
|
|
606
|
+
```jsonc
|
|
607
|
+
// 1. publish the built jar to Exchange
|
|
608
|
+
publish_app_jar({ "jarPath": "target/example-api-1.0.0-mule-application.jar", "confirm": true })
|
|
609
|
+
|
|
610
|
+
// 2. see exactly what is running before you touch it
|
|
611
|
+
get_deployment_spec({ "appName": "example-api", "environment": "Production" })
|
|
612
|
+
|
|
613
|
+
// 3. safe production bump — changes only the artifact ref, waits for it to settle
|
|
614
|
+
update_app_artifact({ "appName": "example-api", "environment": "Production", "version": "1.0.0", "wait": true, "confirm": true })
|
|
615
|
+
|
|
616
|
+
// 4. something wrong? roll back to the last good version
|
|
617
|
+
rollback_app({ "appName": "example-api", "environment": "Production", "confirm": true })
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
For an **existing** app, `deploy_jar`, `deploy_app`, and `update_app_artifact` all change **only** the
|
|
621
|
+
artifact reference — the runtime, target/space, replicas, and settings are preserved, so a redeploy
|
|
622
|
+
can never silently downgrade the runtime or relocate the app. Infrastructure changes on an existing
|
|
623
|
+
app are rejected; create a new deployment or use the dedicated settings/scale tools instead.
|
|
624
|
+
|
|
625
|
+
The same flow is available from the CLI: `anc deploy <jarPath> --app <name> --env <env>`.
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
481
629
|
## Programmatic Usage
|
|
482
630
|
|
|
483
631
|
```typescript
|
|
@@ -4,17 +4,37 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { HttpClient } from '../client/HttpClient.js';
|
|
6
6
|
import type { Cache } from '../client/Cache.js';
|
|
7
|
+
/**
|
|
8
|
+
* Maven-style artifact coordinate used both by a live deployment (`CH2Deployment`)
|
|
9
|
+
* and by a create/update payload (`CreateDeploymentPayload`). Defined once so the two
|
|
10
|
+
* cannot drift.
|
|
11
|
+
*/
|
|
12
|
+
export interface ArtifactRef {
|
|
13
|
+
groupId: string;
|
|
14
|
+
artifactId: string;
|
|
15
|
+
version: string;
|
|
16
|
+
packaging: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* CPU/memory allocation for a deployment. All fields optional so this single shape
|
|
20
|
+
* serves both the (partial) read response and the (mapper-populated) create payload.
|
|
21
|
+
*/
|
|
22
|
+
export interface DeploymentResources {
|
|
23
|
+
cpu?: {
|
|
24
|
+
limit?: string;
|
|
25
|
+
reserved?: string;
|
|
26
|
+
};
|
|
27
|
+
memory?: {
|
|
28
|
+
limit?: string;
|
|
29
|
+
reserved?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
7
32
|
export interface CH2Deployment {
|
|
8
33
|
id: string;
|
|
9
34
|
name: string;
|
|
10
35
|
status: string;
|
|
11
36
|
application: {
|
|
12
|
-
ref:
|
|
13
|
-
groupId: string;
|
|
14
|
-
artifactId: string;
|
|
15
|
-
version: string;
|
|
16
|
-
packaging: string;
|
|
17
|
-
};
|
|
37
|
+
ref: ArtifactRef;
|
|
18
38
|
desiredState: string;
|
|
19
39
|
configuration?: Record<string, unknown>;
|
|
20
40
|
integrations?: Record<string, unknown>;
|
|
@@ -39,16 +59,7 @@ export interface CH2Deployment {
|
|
|
39
59
|
maxReplicas?: number;
|
|
40
60
|
};
|
|
41
61
|
updateStrategy?: string;
|
|
42
|
-
resources?:
|
|
43
|
-
cpu?: {
|
|
44
|
-
limit?: string;
|
|
45
|
-
reserved?: string;
|
|
46
|
-
};
|
|
47
|
-
memory?: {
|
|
48
|
-
limit?: string;
|
|
49
|
-
reserved?: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
62
|
+
resources?: DeploymentResources;
|
|
52
63
|
clustered?: boolean;
|
|
53
64
|
enforceDeployingReplicasAcrossNodes?: boolean;
|
|
54
65
|
jvm?: {
|
|
@@ -75,13 +86,10 @@ export interface CH2DeploymentResponse {
|
|
|
75
86
|
export interface CreateDeploymentPayload {
|
|
76
87
|
name: string;
|
|
77
88
|
application: {
|
|
78
|
-
ref:
|
|
79
|
-
groupId: string;
|
|
80
|
-
artifactId: string;
|
|
81
|
-
version: string;
|
|
82
|
-
packaging: string;
|
|
83
|
-
};
|
|
89
|
+
ref: ArtifactRef;
|
|
84
90
|
desiredState: string;
|
|
91
|
+
/** CloudHub 2.0 replica size as a decimal vCore value (0.1, 0.2, 0.5, 1, …). */
|
|
92
|
+
vCores?: number;
|
|
85
93
|
configuration?: {
|
|
86
94
|
'mule.agent.application.properties.service'?: {
|
|
87
95
|
applicationName: string;
|
|
@@ -103,16 +111,7 @@ export interface CreateDeploymentPayload {
|
|
|
103
111
|
publicUrl?: string;
|
|
104
112
|
};
|
|
105
113
|
};
|
|
106
|
-
resources?:
|
|
107
|
-
cpu: {
|
|
108
|
-
limit: string;
|
|
109
|
-
reserved: string;
|
|
110
|
-
};
|
|
111
|
-
memory: {
|
|
112
|
-
limit: string;
|
|
113
|
-
reserved: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
114
|
+
resources?: DeploymentResources;
|
|
116
115
|
clustered?: boolean;
|
|
117
116
|
enforceDeployingReplicasAcrossNodes?: boolean;
|
|
118
117
|
updateStrategy?: string;
|
|
@@ -167,5 +166,17 @@ export declare class CloudHub2Api {
|
|
|
167
166
|
* Scale an application to the specified number of replicas
|
|
168
167
|
*/
|
|
169
168
|
scaleApp(orgId: string, envId: string, deploymentId: string, replicas: number): Promise<CH2Deployment>;
|
|
169
|
+
/**
|
|
170
|
+
* Update ONLY the application artifact reference on an existing deployment.
|
|
171
|
+
* This is the safe redeploy: it PATCHes just `application.ref`, so the live
|
|
172
|
+
* runtime, target/space, replicas, and settings are all preserved.
|
|
173
|
+
*/
|
|
174
|
+
updateArtifactRef(orgId: string, envId: string, deploymentId: string, ref: ArtifactRef): Promise<CH2Deployment>;
|
|
175
|
+
/**
|
|
176
|
+
* Roll an application back to a previous artifact reference. Mechanically identical
|
|
177
|
+
* to `updateArtifactRef` (narrow ref-only PATCH); named separately so callers express
|
|
178
|
+
* rollback intent and so the two can diverge later if needed.
|
|
179
|
+
*/
|
|
180
|
+
rollbackToRef(orgId: string, envId: string, deploymentId: string, ref: ArtifactRef): Promise<CH2Deployment>;
|
|
170
181
|
}
|
|
171
182
|
//# sourceMappingURL=CloudHub2Api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudHub2Api.d.ts","sourceRoot":"","sources":["../../src/api/CloudHub2Api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"CloudHub2Api.d.ts","sourceRoot":"","sources":["../../src/api/CloudHub2Api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,C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|
}
|
|
104
|
+
/**
|
|
105
|
+
* Update ONLY the application artifact reference on an existing deployment.
|
|
106
|
+
* This is the safe redeploy: it PATCHes just `application.ref`, so the live
|
|
107
|
+
* runtime, target/space, replicas, and settings are all preserved.
|
|
108
|
+
*/
|
|
109
|
+
async updateArtifactRef(orgId, envId, deploymentId, ref) {
|
|
110
|
+
this.cache.delete(`ch2:${orgId}:${envId}`);
|
|
111
|
+
return this.http.patch(`${BASE}/organizations/${orgId}/environments/${envId}/deployments/${deploymentId}`, { application: { ref } }, { headers: this.envHeaders(orgId, envId) });
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Roll an application back to a previous artifact reference. Mechanically identical
|
|
115
|
+
* to `updateArtifactRef` (narrow ref-only PATCH); named separately so callers express
|
|
116
|
+
* rollback intent and so the two can diverge later if needed.
|
|
117
|
+
*/
|
|
118
|
+
async rollbackToRef(orgId, envId, deploymentId, ref) {
|
|
119
|
+
return this.updateArtifactRef(orgId, envId, deploymentId, ref);
|
|
120
|
+
}
|
|
104
121
|
}
|
|
105
122
|
//# sourceMappingURL=CloudHub2Api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudHub2Api.js","sourceRoot":"","sources":["../../src/api/CloudHub2Api.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"CloudHub2Api.js","sourceRoot":"","sources":["../../src/api/CloudHub2Api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoGH,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAE/C,MAAM,OAAO,YAAY;IAEA;IACA;IAFrB,YACqB,IAAgB,EAChB,KAAY;QADZ,SAAI,GAAJ,IAAI,CAAY;QAChB,UAAK,GAAL,KAAK,CAAO;IAC9B,CAAC;IAEJ;;OAEG;IACK,UAAU,CAAC,KAAa,EAAE,KAAa;QAC3C,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;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AQ,CAAC,KAAa,EAAE,KAAa,EAAE,YAAoB,EAAE,QAAgB;QAC/E,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAClB,GAAG,IAAI,kBAAkB,KAAK,iBAAiB,KAAK,gBAAgB,YAAY,EAAE,EAClF;YACI,MAAM,EAAE,EAAE,QAAQ,EAAE;SACvB,EACD,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAC7C,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CACnB,KAAa,EACb,KAAa,EACb,YAAoB,EACpB,GAAgB;QAEhB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAClB,GAAG,IAAI,kBAAkB,KAAK,iBAAiB,KAAK,gBAAgB,YAAY,EAAE,EAClF,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,EACxB,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAC7C,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,KAAa,EAAE,YAAoB,EAAE,GAAgB;QACpF,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;IACnE,CAAC;CACJ"}
|
|
@@ -106,8 +106,19 @@ export declare class DesignCenterApi {
|
|
|
106
106
|
* Uses try/finally to always release the lock, even on failure.
|
|
107
107
|
*/
|
|
108
108
|
updateFile(orgId: string, projectId: string, filePath: string, content: string, branch?: string, commitMessage?: string): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Read and parse the exchange.json metadata from a Design Center project.
|
|
111
|
+
* Returns null if the file doesn't exist or can't be parsed.
|
|
112
|
+
*/
|
|
113
|
+
getExchangeJson(orgId: string, projectId: string, branch?: string): Promise<Record<string, unknown> | null>;
|
|
109
114
|
/**
|
|
110
115
|
* Publish a Design Center project to Anypoint Exchange.
|
|
116
|
+
*
|
|
117
|
+
* The DC XP API expects all publish parameters in the JSON body, NOT in the URL path.
|
|
118
|
+
* Endpoint: POST /designcenter/api-designer/projects/{projectId}/branches/{branch}/publish/exchange
|
|
119
|
+
*
|
|
120
|
+
* Requires a branch lock (same as file saves). Uses lock → publish → unlock pattern.
|
|
121
|
+
* If assetId or main file aren't specified, we auto-detect them from exchange.json.
|
|
111
122
|
*/
|
|
112
123
|
publishToExchange(orgId: string, projectId: string, options: PublishToExchangeOptions, branch?: string): Promise<{
|
|
113
124
|
groupId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignCenterApi.d.ts","sourceRoot":"","sources":["../../src/api/DesignCenterApi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAKhD,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,C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