api-console 6.6.63 → 6.6.66
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/AGENTS.md +195 -0
- package/CODE_OF_CONDUCT.md +62 -0
- package/README.md +13 -0
- package/SECURITY.md +3 -0
- package/package.json +3 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# AGENTS.md - api-console v6
|
|
2
|
+
|
|
3
|
+
AI context file for assistants (Claude Code, Cursor, Copilot) working with this open-source Web Components project.
|
|
4
|
+
|
|
5
|
+
> **Full docs**: [README.md](./README.md) | **Team patterns**: [docs/team/](./docs/team/)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Tech Stack
|
|
10
|
+
|
|
11
|
+
- **LitElement 2.x** + Web Components (Shadow DOM)
|
|
12
|
+
- **AMF v4.0+** (API Modeling Framework - RAML/OAS/AsyncAPI/gRPC)
|
|
13
|
+
- **npm workspace** (18+ packages, main: `api-console`, components: `api-navigation`, `api-documentation`, etc.)
|
|
14
|
+
- **@web/test-runner** (testing, **NOT Jest** - poor Shadow DOM support)
|
|
15
|
+
- **Rollup** (builds), **Playwright** (visual regression)
|
|
16
|
+
|
|
17
|
+
### Two Entry Points
|
|
18
|
+
- `src/ApiConsoleApp.js` - Standalone app (routing, layout, OAuth)
|
|
19
|
+
- `src/ApiConsole.js` - Embeddable component (no routing/layout)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## AMF Model Architecture (CRITICAL)
|
|
24
|
+
|
|
25
|
+
**IMPORTANT**: API Console does **NOT** parse API files directly. It requires **pre-generated AMF models**.
|
|
26
|
+
|
|
27
|
+
### What is AMF?
|
|
28
|
+
MuleSoft's unified model for RAML, OAS, AsyncAPI, gRPC. Format: JSON-LD (AMF v4.0+).
|
|
29
|
+
|
|
30
|
+
### Generate Models
|
|
31
|
+
```bash
|
|
32
|
+
# 1. Define APIs in demo/apis.json: { "path/to/api.raml": "RAML 1.0" }
|
|
33
|
+
# 2. Generate models
|
|
34
|
+
npm run build:models
|
|
35
|
+
# 3. Models saved to demo/models/*.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Load Models
|
|
39
|
+
```javascript
|
|
40
|
+
// Direct model
|
|
41
|
+
apiConsole.amf = await generateApiModel();
|
|
42
|
+
|
|
43
|
+
// URL to JSON
|
|
44
|
+
apiConsole.modelLocation = 'models/my-api.json';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Coding Patterns (CRITICAL)
|
|
50
|
+
|
|
51
|
+
### 1. Component Communication
|
|
52
|
+
|
|
53
|
+
**IMPORTANT**: Use custom events, **NOT** direct method calls.
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
// ✅ GOOD: Custom event (bubbles across Shadow DOM)
|
|
57
|
+
this.dispatchEvent(new CustomEvent('api-navigation-selection-changed', {
|
|
58
|
+
bubbles: true,
|
|
59
|
+
composed: true,
|
|
60
|
+
detail: { selected, type }
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
// ❌ BAD: Direct method call (breaks encapsulation)
|
|
64
|
+
this.parentElement.onNavigationChange(selected);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Why**: Shadow DOM isolation requires composed events to bubble across boundaries.
|
|
68
|
+
|
|
69
|
+
### 2. AMF Queries
|
|
70
|
+
|
|
71
|
+
**IMPORTANT**: Use AmfHelperMixin utilities, **NOT** direct JSON access.
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// ✅ GOOD: AmfHelperMixin
|
|
75
|
+
import { AmfHelperMixin } from '@api-components/amf-helper-mixin';
|
|
76
|
+
|
|
77
|
+
class MyComponent extends AmfHelperMixin(LitElement) {
|
|
78
|
+
_computeEndpoints(model) {
|
|
79
|
+
return this._computeWebApi(model); // Helper method
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ❌ BAD: Direct JSON access (structure changes)
|
|
84
|
+
const endpoints = model['@graph'][0]['http://raml.org/vocabularies/http#endpoint'];
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Why**: AMF model structure can change; helpers abstract this.
|
|
88
|
+
|
|
89
|
+
### 3. Shadow DOM Styling
|
|
90
|
+
|
|
91
|
+
Use CSS custom properties for theming:
|
|
92
|
+
```css
|
|
93
|
+
:host {
|
|
94
|
+
--api-console-primary-color: #00A1E0;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
❌ **Never** manipulate DOM styles directly (`document.querySelector('#api-console').style...`).
|
|
99
|
+
|
|
100
|
+
### 4. Lazy Loading
|
|
101
|
+
|
|
102
|
+
For large APIs, lazy load components on demand:
|
|
103
|
+
```javascript
|
|
104
|
+
if (this.selectedShape) {
|
|
105
|
+
import('@api-components/api-documentation')
|
|
106
|
+
.then(() => this._renderDocumentation());
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Testing Strategy
|
|
113
|
+
|
|
114
|
+
### Commands
|
|
115
|
+
```bash
|
|
116
|
+
npm test # All tests (chromium + firefox)
|
|
117
|
+
npm run test:watch # Watch mode
|
|
118
|
+
npm run test:visual # Visual regression
|
|
119
|
+
npm run test:visual:update # Update baselines (after intentional UI changes)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Write Tests with @web/test-runner
|
|
123
|
+
**IMPORTANT**: Use @web/test-runner, **NOT Jest** (poor Shadow DOM support).
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
import { fixture, expect } from '@open-wc/testing';
|
|
127
|
+
it('renders navigation', async () => {
|
|
128
|
+
const el = await fixture('<api-console></api-console>');
|
|
129
|
+
expect(el.shadowRoot.querySelector('api-navigation')).to.exist;
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Anti-Patterns
|
|
136
|
+
|
|
137
|
+
### Code
|
|
138
|
+
- **IMPORTANT: Never parse API files directly** → Use AMF models
|
|
139
|
+
- **IMPORTANT: Never access AMF JSON directly** → Use AmfHelperMixin
|
|
140
|
+
- **IMPORTANT: Never use direct method calls between components** → Use custom events
|
|
141
|
+
- **Never use Jest** → Use @web/test-runner
|
|
142
|
+
- **Never use `any` in TypeScript** → Proper types
|
|
143
|
+
|
|
144
|
+
### Dependencies
|
|
145
|
+
- **Never import CodeMirror/crypto as ES modules** → Use `vendor.js` (non-ES6 dependencies bundled separately)
|
|
146
|
+
- **Never modify AMF model structure** → External standard, use helpers
|
|
147
|
+
|
|
148
|
+
### Git
|
|
149
|
+
- **Never commit directly to master** → Always create branch first (`fix/W-XXXXXXXX-desc` or `build/X.X.X`)
|
|
150
|
+
- **Never skip GPG signing** → Run `mulesoft-git` before committing
|
|
151
|
+
- **Never commit large models** → Generate locally (`npm run build:models`)
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Build & Verification Strategy
|
|
156
|
+
|
|
157
|
+
**Rule**: Don't run build after every small change (saves tokens, avoids error loops).
|
|
158
|
+
|
|
159
|
+
**Workflow**:
|
|
160
|
+
1. Implement feature
|
|
161
|
+
2. Write tests
|
|
162
|
+
3. Run `npm test` (once)
|
|
163
|
+
4. Run `npm run build` only when: user asks explicitly, before PR, or after major type changes
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Quick Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm run prepare # Build vendor.js + generate AMF models (required after clone)
|
|
171
|
+
npm start # Dev server
|
|
172
|
+
npm test # Run all tests
|
|
173
|
+
npm run build # Production build
|
|
174
|
+
npm run build:models # Generate AMF models from demo/apis.json
|
|
175
|
+
npm update @api-components/* # Update workspace components
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Links
|
|
181
|
+
|
|
182
|
+
### Team Documentation
|
|
183
|
+
- **Runbooks**: [docs/team/runbooks/](./docs/team/runbooks/) - Release process, debugging
|
|
184
|
+
- **Patterns**: [docs/team/patterns/](./docs/team/patterns/) - Web Component communication, architecture
|
|
185
|
+
- **Configs**: [docs/team/configs/](./docs/team/configs/) - Git GPG setup, IDE settings
|
|
186
|
+
|
|
187
|
+
### External Resources
|
|
188
|
+
- **Full docs**: https://docs.api-console.io
|
|
189
|
+
- **AMF**: https://github.com/aml-org/amf
|
|
190
|
+
- **LitElement v2**: https://lit.dev/docs/v2/
|
|
191
|
+
- **@web/test-runner**: https://modern-web.dev/docs/test-runner/overview/
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**Last Updated**: 2026-03-20 (Ultra-optimized for AI context efficiency)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Salesforce Open Source Community Code of Conduct
|
|
2
|
+
|
|
3
|
+
## About the Code of Conduct
|
|
4
|
+
|
|
5
|
+
Equality is a core value at Salesforce. We believe a diverse and inclusive community fosters innovation and creativity, and are committed to building a culture where everyone feels included.
|
|
6
|
+
|
|
7
|
+
Salesforce open-source projects are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender identity and expression, sexual orientation, disability, physical appearance, body size, ethnicity, nationality, race, age, religion, level of experience, education, socioeconomic status, or other similar personal characteristics.
|
|
8
|
+
|
|
9
|
+
The goal of this code of conduct is to specify a baseline standard of behavior so that people with different social values and communication styles can work together effectively, productively, and respectfully in our open source community. It also establishes a mechanism for reporting issues and resolving conflicts.
|
|
10
|
+
|
|
11
|
+
All questions and reports of abusive, harassing, or otherwise unacceptable behavior in a Salesforce open-source project may be reported by contacting the Salesforce Open Source Conduct Committee at ossconduct@salesforce.com.
|
|
12
|
+
|
|
13
|
+
## Our Pledge
|
|
14
|
+
|
|
15
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of gender identity and expression, sexual orientation, disability, physical appearance, body size, ethnicity, nationality, race, age, religion, level of experience, education, socioeconomic status, or other similar personal characteristics.
|
|
16
|
+
|
|
17
|
+
## Our Standards
|
|
18
|
+
|
|
19
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
20
|
+
|
|
21
|
+
* Using welcoming and inclusive language
|
|
22
|
+
* Being respectful of differing viewpoints and experiences
|
|
23
|
+
* Gracefully accepting constructive criticism
|
|
24
|
+
* Focusing on what is best for the community
|
|
25
|
+
* Showing empathy toward other community members
|
|
26
|
+
|
|
27
|
+
Examples of unacceptable behavior by participants include:
|
|
28
|
+
|
|
29
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
30
|
+
* Personal attacks, insulting/derogatory comments, or trolling
|
|
31
|
+
* Public or private harassment
|
|
32
|
+
* Publishing, or threatening to publish, others' private information—such as a physical or electronic address—without explicit permission
|
|
33
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
34
|
+
* Advocating for or encouraging any of the above behaviors
|
|
35
|
+
|
|
36
|
+
## Our Responsibilities
|
|
37
|
+
|
|
38
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
41
|
+
|
|
42
|
+
## Scope
|
|
43
|
+
|
|
44
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
45
|
+
|
|
46
|
+
## Enforcement
|
|
47
|
+
|
|
48
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Salesforce Open Source Conduct Committee at ossconduct@salesforce.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The committee is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
49
|
+
|
|
50
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership and the Salesforce Open Source Conduct Committee.
|
|
51
|
+
|
|
52
|
+
## Attribution
|
|
53
|
+
|
|
54
|
+
This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], [CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].
|
|
55
|
+
|
|
56
|
+
This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].
|
|
57
|
+
|
|
58
|
+
[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
|
|
59
|
+
[golang-coc]: https://golang.org/conduct
|
|
60
|
+
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
|
|
61
|
+
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
|
|
62
|
+
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/
|
package/README.md
CHANGED
|
@@ -152,3 +152,16 @@ For the same reasons as for CodeMirror this dependencies are required for OAuth1
|
|
|
152
152
|
<script src="node_modules/cryptojslib/rollups/hmac-sha1.js"></script>
|
|
153
153
|
<script src="node_modules/jsrsasign/lib/jsrsasign-rsa-min.js"></script>
|
|
154
154
|
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## For AI Assistants
|
|
159
|
+
|
|
160
|
+
This repo includes AI context for tools like Claude Code, Cursor, and Copilot:
|
|
161
|
+
|
|
162
|
+
- **[AGENTS.md](./AGENTS.md)**: Tech stack, architecture patterns, AMF model usage, testing strategy
|
|
163
|
+
- **[docs/team/](./docs/team/)**: Runbooks (release process, debugging), patterns (Web Component communication), configs
|
|
164
|
+
|
|
165
|
+
**For contributors**: See [docs/team/README.md](./docs/team/README.md) for how to use and contribute.
|
|
166
|
+
|
|
167
|
+
---
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## Security
|
|
2
|
+
|
|
3
|
+
Please report any security issue to [security@salesforce.com](mailto:security@salesforce.com) as soon as it is discovered. This library limits its runtime dependencies in order to reduce the total cost of ownership as much as can be, but all consumers should remain vigilant and have their security stakeholders review all third-party products (3PP) like this one and their dependencies.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api-console",
|
|
3
3
|
"description": "The API Console to automatically generate API documentation from RAML and OAS files.",
|
|
4
|
-
"version": "6.6.
|
|
4
|
+
"version": "6.6.66",
|
|
5
5
|
"license": "CPAL-1.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.js",
|
|
@@ -155,9 +155,9 @@
|
|
|
155
155
|
"semver": "7.5.4",
|
|
156
156
|
"decode-uri-component": "0.4.1",
|
|
157
157
|
"set-value": "4.1.0",
|
|
158
|
-
"dompurify": "3.
|
|
158
|
+
"dompurify": "3.4.5"
|
|
159
159
|
},
|
|
160
160
|
"resolutions": {
|
|
161
|
-
"dompurify": "3.
|
|
161
|
+
"dompurify": "3.4.5"
|
|
162
162
|
}
|
|
163
163
|
}
|