@redocly/framework-plugin-apigee 0.0.0-stage → 0.1.0-next.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/CHANGELOG.md +18 -0
- package/README.md +102 -2
- package/lib/.tsbuildinfo +1 -0
- package/lib/client/ApigeeTemplate.d.ts +24 -0
- package/lib/client/ApigeeTemplate.js +1 -0
- package/lib/client/Primitives.d.ts +84 -0
- package/lib/client/Primitives.js +372 -0
- package/lib/client/api.d.ts +28 -0
- package/lib/client/api.js +1 -0
- package/lib/client/context.d.ts +12 -0
- package/lib/client/context.js +1 -0
- package/lib/client/hooks.d.ts +21 -0
- package/lib/client/hooks.js +1 -0
- package/lib/client/views/AdminView.d.ts +2 -0
- package/lib/client/views/AdminView.js +21 -0
- package/lib/client/views/AppsView.d.ts +11 -0
- package/lib/client/views/AppsView.js +1 -0
- package/lib/client/views/Dialogs.d.ts +49 -0
- package/lib/client/views/Dialogs.js +1 -0
- package/lib/client/views/TeamsView.d.ts +10 -0
- package/lib/client/views/TeamsView.js +1 -0
- package/lib/config.d.ts +31 -0
- package/lib/config.js +1 -0
- package/lib/constants.d.ts +37 -0
- package/lib/constants.js +1 -0
- package/lib/contract.d.ts +182 -0
- package/lib/contract.js +1 -0
- package/lib/plugin.d.ts +10 -0
- package/lib/plugin.js +1 -0
- package/lib/server/apigee-types.d.ts +72 -0
- package/lib/server/apigee-types.js +0 -0
- package/lib/server/client.d.ts +60 -0
- package/lib/server/client.js +1 -0
- package/lib/server/mappers.d.ts +10 -0
- package/lib/server/mappers.js +1 -0
- package/lib/server/routes.d.ts +25 -0
- package/lib/server/routes.js +1 -0
- package/lib/server/service.d.ts +93 -0
- package/lib/server/service.js +1 -0
- package/lib/server/store.d.ts +38 -0
- package/lib/server/store.js +1 -0
- package/lib/server/token.d.ts +13 -0
- package/lib/server/token.js +2 -0
- package/package.json +56 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @redocly/framework-plugin-apigee
|
|
2
|
+
|
|
3
|
+
## 0.1.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2a9ab269e4d: Added an experimental plugin that lets developers register apps, get Apigee API keys, share them in teams, and request access to API products from the developer portal, with reviewer approvals.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [4fe1a869003]
|
|
12
|
+
- Updated dependencies [2a9ab269e4d]
|
|
13
|
+
- Updated dependencies [f8b773439ad]
|
|
14
|
+
- Updated dependencies [79920583248]
|
|
15
|
+
- Updated dependencies [949b1891049]
|
|
16
|
+
- Updated dependencies [4fe1a869003]
|
|
17
|
+
- Updated dependencies [0959df9eb79]
|
|
18
|
+
- @redocly/framework@1.0.0-next.7
|
package/README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apigee developer onboarding
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@redocly/framework-plugin-apigee` is an experimental Realm Plus project plugin. With one Apigee
|
|
4
|
+
organization in the `redocly.apigee` key of `redocly.yaml` (the plugin id), it gives a site a
|
|
5
|
+
developer self-service page, team sharing, reviewer approvals, and Try it credentials, all
|
|
6
|
+
against the Apigee management API. `APIGEE_CONFIG_SCHEMA`, the plugin's `configSchema`, declares
|
|
7
|
+
the key: the connection (`organizationName`, `auth`, `apiUrl`, `stage`, from the classic Apigee
|
|
8
|
+
adapter schema) and the options `title`, `basePath`, `approvals`, `apiProducts` and `teams`.
|
|
9
|
+
Framework moves the first Apigee adapter of a classic `developerOnboarding` section to
|
|
10
|
+
`redocly.apigee`, so the plugin reads only its own key. The user-facing options are in
|
|
11
|
+
`docs/platform/config/redocly-apigee.md` of the repository; the setup guide is
|
|
12
|
+
`docs/platform/content/api-docs/apigee-onboarding.md`.
|
|
13
|
+
|
|
14
|
+
A project loads it with `plugins: ['@redocly/framework-plugin-apigee/plugin.js']`, like any
|
|
15
|
+
project plugin, so the plan needs `customPlugins`. The plugin checks the `devOnboarding` plan
|
|
16
|
+
claim itself with `isPlanClaimGranted`: without it, the plugin adds nothing and `finalize`
|
|
17
|
+
returns one `configuration/ignored` warning. Only the Node CLI loads project plugins: the
|
|
18
|
+
browser engine never runs it, so a branch preview in the Redocly editor has no apps page.
|
|
19
|
+
|
|
20
|
+
## Framework seams
|
|
21
|
+
|
|
22
|
+
The plugin imports only `@redocly/framework/plugin`, `@redocly/theme`, `@redocly/config` and
|
|
23
|
+
`react-router`. Realm Plus keeps the gateway-agnostic parts, which any onboarding plugin can use:
|
|
24
|
+
|
|
25
|
+
| Seam | Where in Realm Plus | What the plugin does with it |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `ctx.roleForSlug(slug)` on `ServerRouteContext` | `server/content.ts` | Reads the viewer's rbac role on a page to find reviewers. |
|
|
28
|
+
| `accountLinks` in the app-data namespace | `client/app.tsx`, theme `userMenu.accountLinks` | Puts the page link next to the avatar for signed-in viewers. |
|
|
29
|
+
| `configSchema` and `isPlanClaimGranted` | `content-layer/config.ts`, `shared/plan-gates.ts` | Checks `redocly.apigee` with the rest of the config, and the plan claim. |
|
|
30
|
+
| `apiAccessRoute` in the app-data namespace | `client/ApiAccess.tsx` | Gives API reference pages the Request access button and the Try it prefill. |
|
|
31
|
+
| The template's `page` prop and `useThemeHooks().useUserMenu()` | `client/app.tsx` | The route slug, its title metadata, and whether the viewer is signed in. |
|
|
32
|
+
|
|
33
|
+
## Where the data lives
|
|
34
|
+
|
|
35
|
+
| Data | Store | Why |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Developers, apps, keys, API products, app groups | Apigee | Apigee is the gateway's source of truth; the plugin never caches them. |
|
|
38
|
+
| Team members and roles | Apigee, the app group's `__apigee_reserved__developer_details` attribute | Apigee's integrated portal keeps members there too, so every membership check reads it and a change on either side applies at once. |
|
|
39
|
+
| The date each member joined, and the teams of each developer | KV, `['apigee', 'teams', <id>]` and the `['apigee', 'memberships', <email>, <id>]` index | The attribute has no dates; the index lets the Try it check skip reading every app group, and it still checks the attribute. |
|
|
40
|
+
| The reason a developer gave for a manually approved product | KV, `['apigee', 'requests', <owner>, <app>, <key>, <product>]` | Apigee keeps only the `pending` status. |
|
|
41
|
+
| The reviewer's decision and comment on a product of a key | KV, `['apigee', 'decisions', <owner>, <app>, <key>, <product>]` | The developer reads it on the key. |
|
|
42
|
+
| Approval decisions | KV, `['apigee', 'audit', <time>-<random>]` | The approvals page lists them newest first. |
|
|
43
|
+
|
|
44
|
+
Management API access tokens are cached per credential in the process (`server/token.ts`): a Google
|
|
45
|
+
service account signs an RS256 assertion, an OAuth 2.0 proxy exchanges client credentials.
|
|
46
|
+
|
|
47
|
+
## Content
|
|
48
|
+
|
|
49
|
+
`extractAll` registers one wildcard route at `redocly.apigee.basePath` (`/apps`), titled
|
|
50
|
+
`redocly.apigee.title` (`API keys`), which follows the site's `access.rbac` rules like any
|
|
51
|
+
other page; the client template routes `/apps/<app>`, `/apps/teams[/<team>]` and `/apps/admin` itself. `finalize` stores
|
|
52
|
+
an inline entity mapping each Apigee product name to the OpenAPI page whose `apiId` metadata
|
|
53
|
+
(`info.x-metadata.apiId` or `apis.<name>.metadata.apiId`) names it, leaving out translations. The index names pages the
|
|
54
|
+
viewer may not open, so it sits under the `__serverOnly` key that entity delivery removes;
|
|
55
|
+
`/entity-data` serves an empty object. Its `metadata.routeSlug` ties its visibility to the apps
|
|
56
|
+
page. The server offers a
|
|
57
|
+
product only when its page is visible to the viewer, unless `apiProducts.allowOutsideCatalog`
|
|
58
|
+
is on.
|
|
59
|
+
|
|
60
|
+
## Routes
|
|
61
|
+
|
|
62
|
+
Every route is under `/_apigee`, declared with `auth: 'manual'` so an anonymous call gets a JSON
|
|
63
|
+
`401` instead of the login redirect. Handlers (`server/routes.ts`) resolve the settings, require a
|
|
64
|
+
signed-in viewer with an email who can open the apps page, refuse a write that the browser marks
|
|
65
|
+
as cross-site, and hand an `ApigeeService` (`server/service.ts`) to the use case. The service talks to Apigee through `ApigeeClient` (`server/client.ts`), which addresses
|
|
66
|
+
developer apps and app-group apps with the same sub-resources.
|
|
67
|
+
|
|
68
|
+
## Reviewers
|
|
69
|
+
|
|
70
|
+
The review routes (`/_apigee/admin/*`) exist only with `redocly.apigee.approvals.enabled` (404 otherwise)
|
|
71
|
+
and answer viewers who review at least one product. A viewer's role for a product is the higher
|
|
72
|
+
of `ctx.roleForSlug(<page of the product>)` and `ctx.roleForSlug(<apps page>)`: `triage` and
|
|
73
|
+
above see the product's requests, audit entries and apps, `maintain` and above decide. So the
|
|
74
|
+
product reviewers are the teams with `maintain` or `admin` on the API page, and a content rule
|
|
75
|
+
for the apps page names the reviewers of everything.
|
|
76
|
+
|
|
77
|
+
Products map to pages by the `apiId` route metadata; with `apiProducts.matchByTitle`, a product
|
|
78
|
+
without one falls back to the OpenAPI page whose title equals the product's display name
|
|
79
|
+
(`collectProductPages` stores both indexes in the entity).
|
|
80
|
+
|
|
81
|
+
## App data
|
|
82
|
+
|
|
83
|
+
`finalize` publishes the `apigee` app-data namespace with the two generic parts of the Realm Plus
|
|
84
|
+
protocol and nothing else; the page itself reads its slug and title from the route:
|
|
85
|
+
|
|
86
|
+
- `accountLinks`: `[{ label: <title>, link: <basePath> }]`.
|
|
87
|
+
- `apiAccessRoute`: `/_apigee/access`.
|
|
88
|
+
On a page whose metadata has `apiId`, Realm Plus calls the route with `?apiId=<value>` and reads
|
|
89
|
+
`{ status, link, requestValues }`. The sidebar button leads to `link`, which is
|
|
90
|
+
`<basePath>?createApp&apiProduct=<value>` until the developer has access, and `requestValues`
|
|
91
|
+
prefills the Try it security schemes.
|
|
92
|
+
|
|
93
|
+
## Tests
|
|
94
|
+
|
|
95
|
+
`tests/mock-apigee.ts` is an in-memory Apigee management API: a `fetch` for the unit tests and a
|
|
96
|
+
real HTTP server for the Realm Plus dev e2e suite (`packages/realm-plus/e2e/dev/apigee.spec.ts`),
|
|
97
|
+
which installs the built package into its fixture project and runs the developer, reviewer and
|
|
98
|
+
team flows through the browser. Build the package before that suite.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm --filter @redocly/framework-plugin-apigee run build
|
|
102
|
+
pnpm --filter @redocly/framework-plugin-apigee exec vitest run
|
|
103
|
+
```
|