@sfdxy/anypoint-connect 0.12.0 → 0.14.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.
Files changed (37) hide show
  1. package/README.md +101 -114
  2. package/dist/api/ExchangeApi.d.ts +1 -1
  3. package/dist/api/ExchangeApi.d.ts.map +1 -1
  4. package/dist/api/ExchangeApi.js +3 -1
  5. package/dist/api/ExchangeApi.js.map +1 -1
  6. package/dist/auth/OAuthCallbackPage.d.ts +23 -0
  7. package/dist/auth/OAuthCallbackPage.d.ts.map +1 -0
  8. package/dist/auth/OAuthCallbackPage.js +155 -0
  9. package/dist/auth/OAuthCallbackPage.js.map +1 -0
  10. package/dist/auth/OAuthFlow.d.ts +7 -1
  11. package/dist/auth/OAuthFlow.d.ts.map +1 -1
  12. package/dist/auth/OAuthFlow.js +42 -32
  13. package/dist/auth/OAuthFlow.js.map +1 -1
  14. package/dist/auth/TokenManager.d.ts +2 -0
  15. package/dist/auth/TokenManager.d.ts.map +1 -1
  16. package/dist/auth/TokenManager.js +34 -9
  17. package/dist/auth/TokenManager.js.map +1 -1
  18. package/dist/auth/index.d.ts +1 -1
  19. package/dist/auth/index.d.ts.map +1 -1
  20. package/dist/auth/index.js.map +1 -1
  21. package/dist/commands/auth.js +1 -1
  22. package/dist/commands/auth.js.map +1 -1
  23. package/dist/commands/config.d.ts +1 -0
  24. package/dist/commands/config.d.ts.map +1 -1
  25. package/dist/commands/config.js +13 -3
  26. package/dist/commands/config.js.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/mcp/tools/exchange.d.ts.map +1 -1
  31. package/dist/mcp/tools/exchange.js +43 -13
  32. package/dist/mcp/tools/exchange.js.map +1 -1
  33. package/dist/safety/artifact.d.ts +13 -0
  34. package/dist/safety/artifact.d.ts.map +1 -0
  35. package/dist/safety/artifact.js +58 -0
  36. package/dist/safety/artifact.js.map +1 -0
  37. package/package.json +7 -4
package/README.md CHANGED
@@ -1,196 +1,183 @@
1
1
  <p align="center">
2
- <img src="docs/assets/logo.svg" alt="Anypoint Connect Banner" width="600" />
2
+ <img src="docs/assets/logo.svg" alt="Anypoint Connect — CLI and MCP toolkit for Anypoint Platform" width="640" />
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/main/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>
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=087ea4" 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" alt="CI status" /></a>
8
+ <a href="https://github.com/Avinava/anypoint-connect/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@sfdxy/anypoint-connect?style=flat-square" alt="MIT license" /></a>
10
9
  </p>
11
10
 
12
11
  <p align="center">
13
- <strong>CLI + MCP toolkit for Anypoint Platform — deploy, tail logs, pull metrics, manage API specs, with production safety nets.</strong>
12
+ <strong>Operate Anypoint Platform from a CLI, an MCP client, or JavaScript—with guarded mutations and one shared authentication layer.</strong>
14
13
  </p>
15
14
 
16
15
  <p align="center">
17
- <a href="https://avinava.github.io/anypoint-connect/">Documentation</a> •
18
- <a href="#quick-start">Quick Start</a> •
19
- <a href="#what-it-does">Capabilities</a> •
20
- <a href="#mcp-server">MCP</a> •
21
- <a href="#safety">Safety</a> •
22
- <a href="#ecosystem">Ecosystem</a>
16
+ <a href="https://avinava.github.io/anypoint-connect/">Documentation</a> ·
17
+ <a href="https://avinava.github.io/anypoint-connect/getting-started/">Getting started</a> ·
18
+ <a href="https://avinava.github.io/anypoint-connect/credentials/">Credentials</a> ·
19
+ <a href="https://avinava.github.io/anypoint-connect/recipes/">Recipes</a>
23
20
  </p>
24
21
 
25
22
  ---
26
23
 
27
- ## Quick Start
24
+ ## Start here
25
+
26
+ You need Node.js `>=22`; Node.js 24 LTS is recommended. If Node and npm are unfamiliar, follow the
27
+ [15-minute setup](https://avinava.github.io/anypoint-connect/getting-started/) instead of guessing through
28
+ the commands below.
28
29
 
29
30
  ```bash
30
- # 1. Install
31
- npm install -g @sfdxy/anypoint-connect
31
+ # Install
32
+ npm install --global @sfdxy/anypoint-connect
32
33
 
33
- # 2. Configure (interactive — prompts for Client ID & Secret)
34
+ # Save a Connected App Client ID and Secret
34
35
  anc config init
35
36
 
36
- # 3. Authenticate (opens browser for OAuth)
37
+ # Authorize your Anypoint user in the browser
37
38
  anc auth login
38
39
 
39
- # 4. Verify
40
+ # Verify the local session and one visible environment
40
41
  anc auth status
42
+ anc apps list --env Sandbox
41
43
  ```
42
44
 
43
- No Connected App yet? The four-step setup, including the exact scopes to grant, is in
44
- [Getting started](https://avinava.github.io/anypoint-connect/getting-started/). Requires Node.js
45
- `>=20.0.0`.
45
+ The Connected App must be **App acts on behalf of a user**, use Authorization Code, redirect to
46
+ `http://localhost:3000/api/callback`, and include **Full Access** plus **Background Access**. The
47
+ [credential guide](https://avinava.github.io/anypoint-connect/credentials/) gives the exact UI fields,
48
+ administrator handoff, storage model, rotation steps, and troubleshooting.
46
49
 
47
- ```bash
48
- anc apps list --env Sandbox
49
- anc logs tail my-api --env Sandbox
50
- anc monitor view --env Production
51
- ```
50
+ ## Credential model
51
+
52
+ | Item | Purpose | Storage |
53
+ | --- | --- | --- |
54
+ | Client ID | Identifies the Connected App | Profile `config.json` |
55
+ | Client Secret | Authenticates the local client | Profile `config.json`, restricted to the current OS user |
56
+ | OAuth tokens | Represent the user-authorized session | AES-256-GCM encrypted `tokens.enc` |
52
57
 
53
- Working across several organizations? Use named profiles —
54
- [Profiles and multiple orgs](https://avinava.github.io/anypoint-connect/profiles/).
58
+ The ID and Secret do not provide access without a browser-authorized user session. Environment variables
59
+ can override where app credentials come from, but they do not implement headless CI authentication. This
60
+ release does not support the `client_credentials` grant, and its encrypted token file is machine-bound.
55
61
 
56
62
  ## What it does
57
63
 
58
64
  | Area | Examples |
59
65
  | --- | --- |
60
66
  | Applications | Status, deployment spec, resources, settings, deploy, redeploy, rollback, restart, scale, stop, start, delete |
61
- | Logs | Tail, download, error clustering with context windows, recurring patterns, statistical health |
62
- | Monitoring | Request metrics, percentiles, time series, per-replica, JVM memory and GC, freeform AMQL |
63
- | Exchange | Search, asset detail, spec download, JAR publication, environment comparison |
67
+ | Logs | Tail, download, error clustering with context, recurring patterns, statistical health |
68
+ | Monitoring | Request metrics, percentiles, time series, per-replica metrics, JVM memory and GC, freeform AMQL |
69
+ | Exchange | Search, asset details, spec download, JAR publication, environment comparison |
64
70
  | API Manager | Instances, policies, SLA tiers, alerts |
65
- | Design Center | Projects, branches, safe file sync, governed publication |
66
- | Platform | Environments, entitlements, audit log |
67
- | Anypoint MQ | Queues, depth and throughput, dead-letter browsing, test publishing |
68
- | Object Store v2 | Stores, keys, values |
71
+ | Design Center | Projects, branches, conflict-safe file synchronization, governed publication |
72
+ | Platform services | Environments, entitlements, audit log, Anypoint MQ, Object Store v2 |
69
73
 
70
- Every command is documented in the
71
- [CLI reference](https://avinava.github.io/anypoint-connect/cli-reference/).
74
+ Copyable task flows are in [Common recipes](https://avinava.github.io/anypoint-connect/recipes/); every CLI
75
+ command is in the [CLI reference](https://avinava.github.io/anypoint-connect/cli-reference/).
72
76
 
73
77
  ## MCP server
74
78
 
75
- 65 tools for AI agents. Set up credentials first — the server has nothing to offer an unauthenticated
76
- session.
77
-
78
- ```bash
79
- anc config init
80
- anc auth login
81
- ```
82
-
83
- Every host runs the same command; only the file and the wrapping key differ.
84
-
85
- | Host | Where it goes | Wrapping key |
86
- | --- | --- | --- |
87
- | Claude Code | `.mcp.json`, or `claude mcp add` | `mcpServers` |
88
- | Claude Desktop | `claude_desktop_config.json` | `mcpServers` |
89
- | Codex | `.codex/config.toml`, or `codex mcp add` | `[mcp_servers.anypoint-connect]` |
90
- | VS Code, Copilot Chat | `.vscode/mcp.json` | `servers`, plus `"type": "stdio"` |
91
- | Copilot CLI, Gemini, other MCP clients | `.mcp.json` | `mcpServers` |
79
+ Authenticate in a terminal before starting the server. The MCP host never receives the Client Secret or
80
+ OAuth tokens; it sends tool calls to the local server that owns the session.
92
81
 
93
82
  ```json
94
83
  {
95
84
  "mcpServers": {
96
85
  "anypoint-connect": {
97
86
  "command": "npx",
98
- "args": ["-y", "@sfdxy/anypoint-connect@0.11.0", "mcp"]
87
+ "args": ["-y", "@sfdxy/anypoint-connect@0.14.0", "mcp"]
99
88
  }
100
89
  }
101
90
  }
102
91
  ```
103
92
 
104
- Installed globally, use `"command": "anc", "args": ["mcp"]` and skip the download. No `env` block is
105
- needed: the active profile resolves from the project's `.anypoint-connect.json`, falling back to
106
- `default`. Credentials never pass through the protocol — the server holds the session, the agent calls
107
- tools.
93
+ VS Code uses a `servers` wrapper and Codex uses TOML. See the
94
+ [MCP guide](https://avinava.github.io/anypoint-connect/mcp/) or copy a checked-in configuration from
95
+ [`examples/mcp`](examples/mcp).
108
96
 
109
- Per-host examples, prompts, and resources are in the
110
- [MCP guide](https://avinava.github.io/anypoint-connect/mcp/); the full tool table is in the
111
- [catalog](https://avinava.github.io/anypoint-connect/tools/).
97
+ Example requests use synthetic names:
98
+
99
+ ```text
100
+ What applications are visible in Sandbox? Read only.
101
+ Analyze errors for sample-orders-api in Sandbox over the last two hours.
102
+ Preview a deployment of target/sample-orders-api-1.3.0-mule-application.jar to Sandbox; do not apply it.
103
+ ```
112
104
 
113
105
  ## Safety
114
106
 
115
- Every mutating operation is **dry-run by default**: without `confirm: true` it returns a preview and
116
- changes nothing. Redeploying an existing app changes **only** the artifact reference, so runtime, target,
117
- replicas, and settings are preserved and a version bump cannot silently downgrade a runtime or halve
118
- capacity. `update_app_settings` PATCHes only application properties, merging protected values rather than
119
- blanking them. Deletion requires a deployment-ID-bound confirmation — plus a separate acknowledgement in
120
- production — so it fails closed if the deployment changed since you looked.
107
+ Mutating MCP tools are previews until `confirm: true` is supplied. Artifact updates preserve runtime,
108
+ target, replicas, and settings. Deletion requires the deployment ID returned by the preview, and
109
+ production operations require an additional acknowledgement.
121
110
 
122
111
  ```jsonc
123
- // preview
124
- deploy_jar({ "jarPath": "target/example-api-1.0.0-mule-application.jar", "appName": "example-api", "environment": "Sandbox" })
125
- // apply
126
- deploy_jar({ "jarPath": "target/example-api-1.0.0-mule-application.jar", "appName": "example-api", "environment": "Sandbox", "confirm": true })
112
+ // Preview only
113
+ update_app_artifact({
114
+ "appName": "sample-orders-api",
115
+ "environment": "Sandbox",
116
+ "version": "1.3.0"
117
+ })
118
+
119
+ // Apply the reviewed change
120
+ update_app_artifact({
121
+ "appName": "sample-orders-api",
122
+ "environment": "Sandbox",
123
+ "version": "1.3.0",
124
+ "confirm": true
125
+ })
127
126
  ```
128
127
 
129
- Full model in [Safety](https://avinava.github.io/anypoint-connect/safety/); the build, publish, deploy,
130
- and rollback path in [Deploying a JAR](https://avinava.github.io/anypoint-connect/deployment-tools/).
131
-
132
- ## When something fails
133
-
134
- Access problems come in six distinct states — not configured, not authenticated, environment not visible,
135
- not permitted, transient, and ready — and they have different fixes. The error text names which one you
136
- are in. See [Access readiness](https://avinava.github.io/anypoint-connect/readiness/) and
137
- [Troubleshooting](https://avinava.github.io/anypoint-connect/troubleshooting/).
128
+ The complete contract is in the [safety model](https://avinava.github.io/anypoint-connect/safety/).
138
129
 
139
130
  ## Library
140
131
 
141
- ```typescript
132
+ The library reuses a profile authenticated with `anc auth login`. The Client ID and Secret construct the
133
+ client; the profile selects the encrypted token store.
134
+
135
+ ```javascript
142
136
  import { AnypointClient } from '@sfdxy/anypoint-connect';
143
137
 
144
138
  const client = new AnypointClient({
145
- clientId: process.env.ANYPOINT_CLIENT_ID!,
146
- clientSecret: process.env.ANYPOINT_CLIENT_SECRET!,
139
+ clientId: process.env.ANYPOINT_CLIENT_ID,
140
+ clientSecret: process.env.ANYPOINT_CLIENT_SECRET,
141
+ profileName: process.env.ANYPOINT_PROFILE || 'default',
147
142
  });
148
143
 
149
- const me = await client.whoami();
150
- const envs = await client.accessManagement.getEnvironments(me.organization.id);
144
+ const identity = await client.whoami();
145
+ const environments = await client.accessManagement.getEnvironments(identity.organization.id);
146
+ console.log(`Authenticated; ${environments.length} environment(s) visible.`);
151
147
  ```
152
148
 
153
- The API clients give you token refresh, rate limiting, and caching, but not the confirmation gates — those
154
- live in the CLI and MCP layers. More in the
155
- [library guide](https://avinava.github.io/anypoint-connect/library/).
149
+ Direct API clients include bearer injection, refresh, rate limiting, and caching. They do not include the
150
+ CLI/MCP confirmation gates. Start with the runnable JavaScript example in
151
+ [`examples/library`](examples/library) and read the [library guide](https://avinava.github.io/anypoint-connect/library/).
156
152
 
157
- ## Documentation
153
+ ## Profiles and multiple organizations
158
154
 
159
- Published at **<https://avinava.github.io/anypoint-connect/>** with search.
155
+ Use neutral profile names rather than customer names:
160
156
 
161
- | Page | Contents |
162
- | --- | --- |
163
- | [Getting started](docs/getting-started.md) | Install, Connected App, scopes, credentials, authenticate |
164
- | [Profiles](docs/profiles.md) | Multiple organizations, resolution order, storage layout |
165
- | [Access readiness](docs/readiness.md) | The six access states and their fixes |
166
- | [CLI reference](docs/cli-reference.md) | Every command group |
167
- | [MCP server](docs/mcp.md) | Host setup, prompts, resources |
168
- | [Tool catalog](docs/tools.md) | All 65 tools, and how to choose between overlapping ones |
169
- | [Safety model](docs/safety.md) | Dry runs, narrow updates, bound deletion |
170
- | [Deploying a JAR](docs/deployment-tools.md) | Build, publish, deploy, roll back |
171
- | [Library API](docs/library.md) | Programmatic use |
172
- | [Troubleshooting](docs/troubleshooting.md) | Symptoms and causes |
173
- | [Architecture](docs/architecture.md) | Layers and design notes |
174
-
175
- ## Ecosystem
176
-
177
- The canonical package matrix and supported combination live in the
178
- [`mule-skills` ecosystem hub](https://avinava.github.io/mule-skills/ecosystem/). This is the only tool
179
- in the set that needs Anypoint credentials. A complete release crosses two boundaries: `mule-build`
180
- produces and versions the artifact, while this package puts it in an environment. More detail is on
181
- the local [ecosystem page](docs/ecosystem.md).
157
+ ```bash
158
+ anc config init --profile team-a
159
+ anc auth login --profile team-a
160
+ anc config use team-a
161
+ ```
162
+
163
+ The directory binding contains only a local profile label, but it can still reveal internal context. Add
164
+ `.anypoint-connect.json` to the project's `.gitignore`. Resolution rules and storage layout are in
165
+ [Profiles](https://avinava.github.io/anypoint-connect/profiles/).
182
166
 
183
167
  ## Development
184
168
 
185
169
  ```bash
170
+ nvm use
186
171
  npm install
187
172
  npm run build
188
173
  npm test
189
174
  npm run lint
175
+ npm run docs:check
176
+ mkdocs build --strict
190
177
  ```
191
178
 
192
- Releases are tag-triggered: bump the version, push the tag with `git push --follow-tags`, and GitHub
193
- Actions runs CI, publishes to npm with provenance, and creates the release.
179
+ CI tests Node 22, 24, and 26. Documentation is built with MkDocs Material and published through GitHub
180
+ Pages. Releases are tag-triggered and published to npm with provenance.
194
181
 
195
182
  ## License
196
183
 
@@ -95,7 +95,7 @@ export declare class ExchangeApi {
95
95
  * `files.mule-application.jar`) with the `x-sync-publication` header so the call
96
96
  * returns only once the asset is fully published.
97
97
  */
98
- publishAppAsset(orgId: string, groupId: string, assetId: string, version: string, jarPath: string): Promise<PublishAppAssetResult>;
98
+ publishAppAsset(orgId: string, groupId: string, assetId: string, version: string, jarPath: string, expectedSha256?: string): Promise<PublishAppAssetResult>;
99
99
  /**
100
100
  * Download an API spec file (RAML / OAS) for an asset version.
101
101
  * Returns the spec content as a string.
@@ -1 +1 @@
1
- {"version":3,"file":"ExchangeApi.d.ts","sourceRoot":"","sources":["../../src/api/ExchangeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL;AAED,MAAM,WA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O,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAuBjC;;;OAGG;IACG,YAAY,CACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAiCrE,8FAA8F;IACxF,oBAAoB,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC;QACP,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB,EAAE,OAAO,CAAC;KAChC,CAAC;CAgBL"}
@@ -5,6 +5,7 @@
5
5
  import * as fs from 'fs';
6
6
  import * as path from 'path';
7
7
  import { createHash } from 'node:crypto';
8
+ import { verifyArtifactDigest } from '../safety/artifact.js';
8
9
  const BASE = '/exchange/api/v2';
9
10
  /** Upload timeout for artifact publish — jars are far larger than API calls (30–80 MB). */
10
11
  const PUBLISH_TIMEOUT_MS = 300000;
@@ -58,8 +59,9 @@ export class ExchangeApi {
58
59
  * `files.mule-application.jar`) with the `x-sync-publication` header so the call
59
60
  * returns only once the asset is fully published.
60
61
  */
61
- async publishAppAsset(orgId, groupId, assetId, version, jarPath) {
62
+ async publishAppAsset(orgId, groupId, assetId, version, jarPath, expectedSha256) {
62
63
  const buffer = await fs.promises.readFile(jarPath);
64
+ verifyArtifactDigest(buffer, expectedSha256);
63
65
  const fileName = path.basename(jarPath);
64
66
  const form = new FormData();
65
67
  form.append('name', assetId);
@@ -1 +1 @@
1
- {"version":3,"file":"ExchangeApi.js","sourceRoot":"","sources":["../../src/api/ExchangeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB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CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACzC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAC3E,CAAC;QACF,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,IAAI,OAAO,IAAI,OAAO,GAAG,CAAC,CAAC;QAC5G,MAAM,WAAW,GACb,QAAQ,CAAC,WAAW,IAAI,GAAG,IAAI,WAAW,OAAO,IAAI,OAAO,IAAI,OAAO,UAAU,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC3G,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3D,OAAO;YACH,MAAM;YACN,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACzD,mBAAmB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI;SAClE,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Self-contained HTML shown by the local OAuth callback server.
3
+ *
4
+ * The page intentionally has no external assets or JavaScript: it must render
5
+ * reliably while authentication is in progress and must never leak callback
6
+ * parameters to another origin.
7
+ */
8
+ export type OAuthCallbackPageStatus = 'success' | 'error';
9
+ export interface OAuthCallbackPageOptions {
10
+ status: OAuthCallbackPageStatus;
11
+ title: string;
12
+ message: string;
13
+ detail?: string;
14
+ }
15
+ export declare const OAUTH_CALLBACK_HEADERS: {
16
+ readonly 'Content-Type': "text/html; charset=utf-8";
17
+ readonly 'Cache-Control': "no-store";
18
+ readonly 'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
19
+ readonly 'Referrer-Policy': "no-referrer";
20
+ readonly 'X-Content-Type-Options': "nosniff";
21
+ };
22
+ export declare function renderOAuthCallbackPage(options: OAuthCallbackPageOptions): string;
23
+ //# sourceMappingURL=OAuthCallbackPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OAuthCallbackPage.d.ts","sourceRoot":"","sources":["../../src/auth/OAuthCallbackPage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,uBAAuB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,sBAAsB;;;;;;CAOzB,CAAC;AAeX,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAgIjF"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Self-contained HTML shown by the local OAuth callback server.
3
+ *
4
+ * The page intentionally has no external assets or JavaScript: it must render
5
+ * reliably while authentication is in progress and must never leak callback
6
+ * parameters to another origin.
7
+ */
8
+ export const OAUTH_CALLBACK_HEADERS = {
9
+ 'Content-Type': 'text/html; charset=utf-8',
10
+ 'Cache-Control': 'no-store',
11
+ 'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
12
+ 'Referrer-Policy': 'no-referrer',
13
+ 'X-Content-Type-Options': 'nosniff',
14
+ };
15
+ function escapeHtml(value) {
16
+ return value.replace(/[&<>'"]/g, (character) => {
17
+ const entities = {
18
+ '&': '&amp;',
19
+ '<': '&lt;',
20
+ '>': '&gt;',
21
+ "'": '&#39;',
22
+ '"': '&quot;',
23
+ };
24
+ return entities[character];
25
+ });
26
+ }
27
+ export function renderOAuthCallbackPage(options) {
28
+ const isSuccess = options.status === 'success';
29
+ const statusLabel = isSuccess ? 'Connected' : 'Authentication interrupted';
30
+ const safeTitle = escapeHtml(options.title);
31
+ const safeMessage = escapeHtml(options.message);
32
+ const safeDetail = options.detail ? escapeHtml(options.detail) : '';
33
+ return `<!doctype html>
34
+ <html lang="en">
35
+ <head>
36
+ <meta charset="utf-8">
37
+ <meta name="viewport" content="width=device-width, initial-scale=1">
38
+ <meta name="color-scheme" content="light dark">
39
+ <title>${safeTitle} · Anypoint Connect</title>
40
+ <style>
41
+ :root {
42
+ color-scheme: light dark;
43
+ --paper: #f5f7fa;
44
+ --surface: #ffffff;
45
+ --ink: #172033;
46
+ --muted: #536078;
47
+ --rule: rgba(23, 32, 51, 0.14);
48
+ --accent: #087ea4;
49
+ --accent-soft: rgba(8, 126, 164, 0.10);
50
+ --danger: #a63d4b;
51
+ --danger-soft: rgba(166, 61, 75, 0.10);
52
+ }
53
+
54
+ @media (prefers-color-scheme: dark) {
55
+ :root {
56
+ --paper: #111621;
57
+ --surface: #192131;
58
+ --ink: #f2f5fa;
59
+ --muted: #a9b4c7;
60
+ --rule: rgba(242, 245, 250, 0.14);
61
+ --accent: #57c7e8;
62
+ --accent-soft: rgba(87, 199, 232, 0.12);
63
+ --danger: #ff929f;
64
+ --danger-soft: rgba(255, 146, 159, 0.12);
65
+ }
66
+ }
67
+
68
+ * { box-sizing: border-box; }
69
+
70
+ body {
71
+ min-height: 100vh;
72
+ margin: 0;
73
+ display: grid;
74
+ place-items: center;
75
+ padding: 24px;
76
+ background: var(--paper);
77
+ color: var(--ink);
78
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
79
+ line-height: 1.55;
80
+ -webkit-font-smoothing: antialiased;
81
+ }
82
+
83
+ main {
84
+ width: min(100%, 560px);
85
+ padding: clamp(28px, 7vw, 48px);
86
+ background: var(--surface);
87
+ border: 1px solid var(--rule);
88
+ border-radius: 16px;
89
+ }
90
+
91
+ .mark {
92
+ width: 52px;
93
+ height: 52px;
94
+ display: grid;
95
+ place-items: center;
96
+ margin-bottom: 24px;
97
+ border-radius: 12px;
98
+ background: ${isSuccess ? 'var(--accent-soft)' : 'var(--danger-soft)'};
99
+ color: ${isSuccess ? 'var(--accent)' : 'var(--danger)'};
100
+ font-size: 28px;
101
+ font-weight: 700;
102
+ }
103
+
104
+ .eyebrow {
105
+ margin: 0 0 10px;
106
+ color: ${isSuccess ? 'var(--accent)' : 'var(--danger)'};
107
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
108
+ font-size: 12px;
109
+ font-weight: 700;
110
+ letter-spacing: 0.08em;
111
+ text-transform: uppercase;
112
+ }
113
+
114
+ h1 {
115
+ margin: 0 0 14px;
116
+ font-size: clamp(28px, 7vw, 40px);
117
+ line-height: 1.12;
118
+ letter-spacing: -0.025em;
119
+ }
120
+
121
+ p { margin: 0; color: var(--muted); }
122
+
123
+ .detail {
124
+ margin-top: 22px;
125
+ padding: 14px 16px;
126
+ overflow-wrap: anywhere;
127
+ background: ${isSuccess ? 'var(--accent-soft)' : 'var(--danger-soft)'};
128
+ border-left: 3px solid ${isSuccess ? 'var(--accent)' : 'var(--danger)'};
129
+ border-radius: 6px;
130
+ color: var(--ink);
131
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
132
+ font-size: 13px;
133
+ }
134
+
135
+ .next {
136
+ margin-top: 28px;
137
+ padding-top: 20px;
138
+ border-top: 1px solid var(--rule);
139
+ font-size: 14px;
140
+ }
141
+ </style>
142
+ </head>
143
+ <body>
144
+ <main aria-labelledby="page-title">
145
+ <div class="mark" aria-hidden="true">${isSuccess ? '✓' : '!'}</div>
146
+ <p class="eyebrow">${statusLabel}</p>
147
+ <h1 id="page-title">${safeTitle}</h1>
148
+ <p>${safeMessage}</p>
149
+ ${safeDetail ? `<div class="detail" role="alert">${safeDetail}</div>` : ''}
150
+ <p class="next">You can close this tab and return to the terminal.</p>
151
+ </main>
152
+ </body>
153
+ </html>`;
154
+ }
155
+ //# sourceMappingURL=OAuthCallbackPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OAuthCallbackPage.js","sourceRoot":"","sources":["../../src/auth/OAuthCallbackPage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,cAAc,EAAE,0BAA0B;IAC1C,eAAe,EAAE,UAAU;IAC3B,yBAAyB,EACrB,4GAA4G;IAChH,iBAAiB,EAAE,aAAa;IAChC,wBAAwB,EAAE,SAAS;CAC7B,CAAC;AAEX,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAA2B;YACrC,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,QAAQ;SAChB,CAAC;QACF,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAiC;IACrE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC;IAC/C,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,4BAA4B,CAAC;IAC3E,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpE,OAAO;;;;;;aAME,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA2DI,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB;qBAC5D,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe;;;;;;;qBAO7C,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe;;;;;;;;;;;;;;;;;;;;;0BAqBxC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB;qCAC5C,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe;;;;;;;;;;;;;;;;;+CAiBnC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;6BACvC,WAAW;8BACV,SAAS;aAC1B,WAAW;UACd,UAAU,CAAC,CAAC,CAAC,oCAAoC,UAAU,QAAQ,CAAC,CAAC,CAAC,EAAE;;;;QAI1E,CAAC;AACT,CAAC"}
@@ -9,6 +9,12 @@ export interface OAuthConfig {
9
9
  redirectUri: string;
10
10
  baseUrl?: string;
11
11
  }
12
+ export interface OAuthCallbackOptions {
13
+ /** OAuth state generated with the authorization URL. */
14
+ expectedState?: string;
15
+ /** Loopback host to bind. Defaults to localhost for compatibility. */
16
+ hostname?: string;
17
+ }
12
18
  export declare class OAuthFlow {
13
19
  private readonly config;
14
20
  private readonly baseUrl;
@@ -20,7 +26,7 @@ export declare class OAuthFlow {
20
26
  /**
21
27
  * Start local callback server and wait for authorization code
22
28
  */
23
- waitForCallback(port?: number, callbackPath?: string, timeoutMs?: number): Promise<{
29
+ waitForCallback(port?: number, callbackPath?: string, timeoutMs?: number, options?: OAuthCallbackOptions): Promise<{
24
30
  code: string;
25
31
  state: string;
26
32
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthFlow.d.ts","sourceRoot":"","sources":["../../src/auth/OAuthFlow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAYtD,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,WAAW;IAK/B;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAYtC;;OAEG;IACG,eAAe,CACjB,IAAI,GAAE,MAAa,EACnB,YAAY,GAAE,MAAwB,EACtC,SAAS,GAAE,MAAe,GAC3B,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAqE3C;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA2BzD;;OAEG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA0BjE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CAU3B"}
1
+ {"version":3,"file":"OAuthFlow.d.ts","sourceRoot":"","sources":["../../src/auth/OAuthFlow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAatD,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,W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