Skip to content

Commit 0285fd4

Browse files
authored
W-18562616 Enhance Documentation Panel with Agent Metadata (#93)
* Add .npmrc configuration and update package dependencies * fix: Update GitHub Actions workflows to latest versions - Update all actions to latest stable versions (v4 for checkout, setup-node) - Upgrade Node.js version from 14 to 18 (LTS) - Replace deprecated microsoft/playwright-github-action with direct install - Use built-in npm caching instead of separate cache actions - Add PR types specification for better workflow triggering - Add engines field to package.json for Node.js version requirements - Update CodeQL actions to v3 These changes resolve workflow execution issues in PRs and improve security by using maintained action versions. * chore: Update GitHub Actions workflow to use Ubuntu 22.04 - Change the operating system in the deployment matrix from Ubuntu 20.04 to 22.04 - Update the runner for the job to use Ubuntu 22.04 This update ensures compatibility with the latest features and improvements in the Ubuntu environment. * chore: Update GitHub Actions workflow to use Ubuntu 22.04 - Change the runner for the analysis job to Ubuntu 22.04 This update aligns the workflow with the latest Ubuntu version for improved compatibility and performance. * feat: Add agent parameters section to API method documentation - Introduced new properties for agent parameters and their visibility toggle. - Implemented logic to compute agent parameters based on the method. - Added rendering functionality for the agent parameters section in the documentation. - Created unit tests to validate the agent parameters behavior and rendering. * chore: Update amf-helper-mixin dependency and add agents-api documentation - Upgraded @api-components/amf-helper-mixin from version 4.5.22 to 4.5.30 in package.json and package-lock.json. - Added new agents-api.yaml file for the Hotel Reservations API, including paths for creating and retrieving reservations. - Updated apis.json to include the new agents-api. - Modified index.js to include the agents-api in the demo API list. * empty * chore: Upgrade @api-components/amf-helper-mixin to version 4.5.31 - Updated the version of @api-components/amf-helper-mixin in package.json and package-lock.json from 4.5.30 to 4.5.31 for improved functionality and compatibility.
1 parent bd29bfe commit 0285fd4

File tree

10 files changed

+5026
-1559
lines changed

10 files changed

+5026
-1559
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ubuntu-22.04
2727

2828
strategy:
2929
fail-fast: false
@@ -35,11 +35,11 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
42+
uses: github/codeql-action/init@v3
4343
with:
4444
languages: ${{ matrix.language }}
4545
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,7 +50,7 @@ jobs:
5050
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5151
# If this step fails, then you should remove it and run the build manually (see below)
5252
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
53+
uses: github/codeql-action/autobuild@v3
5454

5555
# ℹ️ Command-line programs to run using the OS shell.
5656
# 📚 https://git.io/JvXDl
@@ -64,4 +64,4 @@ jobs:
6464
# make release
6565

6666
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
67+
uses: github/codeql-action/analyze@v3

.github/workflows/deployment.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,24 @@ on:
1111
branches:
1212
- master
1313
- main
14+
types: [opened, synchronize, reopened]
1415
jobs:
1516
test_linux:
1617
name: ${{ matrix.os }}
1718
strategy:
1819
fail-fast: false
1920
matrix:
20-
os: [ubuntu-20.04]
21-
# os: [ubuntu-18.04, ubuntu-20.04]
21+
os: [ubuntu-22.04]
22+
# os: [ubuntu-20.04, ubuntu-22.04]
2223
runs-on: ${{ matrix.os }}
2324
steps:
24-
- uses: actions/checkout@v2
25-
- uses: actions/setup-node@v1
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-node@v4
2627
with:
27-
node-version: 14
28-
- uses: microsoft/playwright-github-action@v1
29-
- uses: actions/cache@v1
30-
with:
31-
path: ~/.npm
32-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
33-
restore-keys: |
34-
${{ runner.os }}-node-
28+
node-version: 18
29+
cache: 'npm'
30+
- name: Install Playwright Browsers
31+
run: npx playwright install --with-deps
3532
- name: Install dependencies
3633
run: npm ci
3734
- name: Run tests
@@ -61,22 +58,17 @@ jobs:
6158
needs:
6259
- test_linux
6360
# - test_win
64-
runs-on: ubuntu-latest
61+
runs-on: ubuntu-22.04
6562
steps:
6663
- name: Checkout code
67-
uses: actions/checkout@v2
64+
uses: actions/checkout@v4
6865
with:
6966
fetch-depth: 0
70-
- uses: actions/setup-node@v2
67+
- uses: actions/setup-node@v4
7168
with:
72-
node-version: '14.x'
69+
node-version: '18.x'
7370
registry-url: 'https://registry.npmjs.org'
74-
- uses: actions/cache@v1
75-
with:
76-
path: ~/.npm
77-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
78-
restore-keys: |
79-
${{ runner.os }}-node-
71+
cache: 'npm'
8072
- run: npm install
8173
- name: Read version from package.json
8274
uses: culshaw/read-package-node-version-actions@v1

.npmrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
registry=https://registry.npmjs.org/
2+
@advanced-rest-client:registry=https://registry.npmjs.org/
3+
@mulesoft:registry=https://registry.npmjs.org/
4+
@salesforce:registry=https://registry.npmjs.org/
5+
always-auth=false
6+
strict-ssl=true

demo/agents-api/agents-api.yaml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: Hotel Reservations API
5+
description: API to manage hotel room bookings, check availability, and apply loyalty benefits.
6+
x-sfdc:
7+
agent:
8+
topic:
9+
name: Hotel_Room_Reservation
10+
classificationDescription: This API allows agents to book, modify, and cancel hotel reservations, as well as apply loyalty upgrades.
11+
scope: Your job is to assist customers in booking hotel rooms based on their preferences, loyalty status, and availability. You should also be able to recommend upgrades if the customer qualifies.
12+
instructions:
13+
- Always check the customer's loyalty status before finalizing the booking.
14+
- If the preferred room type is unavailable, suggest alternative options with similar amenities.
15+
- Never confirm a reservation without validating payment information.
16+
- If the customer qualifies for an upgrade, apply it automatically and notify them.
17+
paths:
18+
/reservations:
19+
post:
20+
summary: Create a new hotel reservation
21+
description: Book a hotel room with specified preferences and apply loyalty upgrades if eligible.
22+
operationId: reservationCreate
23+
x-sfdc:
24+
agent:
25+
action:
26+
publishAsAgentAction: true
27+
requestBody:
28+
required: true
29+
description: customer-reservation
30+
content:
31+
application/json:
32+
schema:
33+
additionalProperties: false
34+
type: object
35+
x-sfdc:
36+
agent:
37+
action:
38+
isUserInput: true
39+
properties:
40+
customerId:
41+
type: string
42+
description: Unique identifier of the customer.
43+
checkInDate:
44+
type: string
45+
format: date
46+
description: Date of check-in.
47+
checkOutDate:
48+
type: string
49+
format: date
50+
description: Date of check-out.
51+
roomType:
52+
type: string
53+
enum: [Standard, Deluxe, Suite]
54+
description: Preferred room type.
55+
specialRequests:
56+
type: string
57+
description: Additional requests like pillow type or air freshener choice.
58+
responses:
59+
'201':
60+
description: Reservation successfully created
61+
content:
62+
application/json:
63+
schema:
64+
additionalProperties: false
65+
type: object
66+
x-sfdc:
67+
agent:
68+
action:
69+
isDisplayable: true
70+
privacy:
71+
isPii: true
72+
properties:
73+
reservationId:
74+
type: string
75+
description: Unique ID of the created reservation.
76+
upgradeApplied:
77+
type: boolean
78+
description: Indicates if a loyalty-based upgrade was applied.
79+
totalPrice:
80+
type: number
81+
format: float
82+
description: Final price after applying any discounts or upgrades.
83+
'400':
84+
description: Invalid input provided
85+
/reservations/reservationlookup:
86+
get:
87+
summary: Retrieve reservation details
88+
description: Get details of a specific reservation by ID.
89+
x-sfdc:
90+
agent:
91+
action:
92+
publishAsAgentAction: true
93+
operationId: reservationRetrieve
94+
requestBody:
95+
required: true
96+
description: customer-reservation
97+
content:
98+
application/json:
99+
schema:
100+
additionalProperties: false
101+
type: object
102+
x-sfdc:
103+
agent:
104+
action:
105+
isUserInput: true
106+
properties:
107+
reservationID:
108+
type: string
109+
description: Unique identifier of the reservation.
110+
responses:
111+
'200':
112+
description: Reservation details retrieved successfully
113+
content:
114+
application/json:
115+
schema:
116+
additionalProperties: false
117+
x-sfdc:
118+
agent:
119+
action:
120+
isDisplayable: true
121+
privacy:
122+
isPii: true
123+
type: object
124+
properties:
125+
reservationId:
126+
type: string
127+
customerId:
128+
type: string
129+
roomType:
130+
type: string
131+
checkInDate:
132+
type: string
133+
format: date
134+
checkOutDate:
135+
type: string
136+
format: date
137+
upgradeApplied:
138+
type: boolean
139+
'404':
140+
description: Reservation not found

demo/apis.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
"APIC-650/APIC-650.yaml": "OAS 3.0",
1919
"APIC-758/APIC-758.yaml": "OAS 3.0",
2020
"streetlights/streetlights.yaml": "ASYNC 2.0",
21-
"W-11383870/W-11383870.json": { "type": "OAS 3.0", "mime": "application/json" }
21+
"W-11383870/W-11383870.json": { "type": "OAS 3.0", "mime": "application/json" },
22+
"agents-api/agents-api.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }
2223
}

demo/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class ComponentDemo extends ApiDemoPage {
152152
_apiListTemplate() {
153153
return [
154154
['demo-api', 'Demo API'],
155+
['agents-api', 'Agents API'],
155156
['jldAsync26', 'Async API 2.6'],
156157
['multi-server', 'Multiple servers'],
157158
['google-drive-api', 'Google Drive'],

0 commit comments

Comments
 (0)