Skip to content

Commit f08e61d

Browse files
ryanbas21claude
andcommitted
fix(docs-site): remove fabricated API reference, fix all content to match real code
- Delete all ApiDocs Elm modules (Types, TreeshakeCheck, EslintPluginTreeshake, DevtoolsBridge, DevtoolsTypes) and the API route (Route.Api.Package_.ModuleName_) - Remove API link from header nav in Shared.elm - Remove .api-reference, .api-item, .api-signature, .api-example CSS rules - Rewrite devtools-bridge package page with real exports: attachDaVinciBridge, attachJourneyBridge, attachOidcBridge, emitAuthEvent, emitConfigEvent, DEVTOOLS_EVENT_NAME, BridgeHandle, DevtoolsOptions - Rewrite devtools-types package page with real schemas: AuthEventSchema, NetworkDataSchema, SdkDataSchema, SdkConfigDataSchema, DomDataSchema, SessionDataSchema, JourneyDataSchema, OidcDataSchema, FlowStateSchema, FlowSummarySchema, FlowExportSchema, OIDC semantic schemas - Rewrite treeshake-check package page with real CLI options and programmatic API: checkPackage, analyzeTreeshakeability, getEntryFromPackageJson, error classes - Rewrite eslint-plugin-treeshake package page with real single rule (no-treeshake-hazard) and its check categories, configs (recommended/strict) - Rewrite DaVinci integration guide: attachDaVinciBridge with Subscribable interface - Rewrite Journey integration guide: attachJourneyBridge with RTK Query state - Rewrite OIDC integration guide: attachOidcBridge with endpoint-to-phase mapping - Fix stale ApiDocs references in contributing docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bded136 commit f08e61d

17 files changed

Lines changed: 460 additions & 708 deletions

packages/docs-site/app/Route/Api/Package_/ModuleName_.elm

Lines changed: 0 additions & 185 deletions
This file was deleted.

packages/docs-site/app/Shared.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ viewHeader sharedData model toMsg =
228228
, Html.nav [ Attr.class "header-nav" ]
229229
[ Html.a [ Attr.href "/packages/treeshake-check" ] [ Html.text "Packages" ]
230230
, Html.a [ Attr.href "/docs/getting-started" ] [ Html.text "Guides" ]
231-
, Html.a [ Attr.href "/api/treeshake-check/treeshake-check" ] [ Html.text "API" ]
231+
232232
, Html.a [ Attr.href "/architecture" ] [ Html.text "Architecture" ]
233233
, Html.a [ Attr.href "/contributing/development-setup" ] [ Html.text "Contributing" ]
234234
]

packages/docs-site/content/contributing/code-style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Test files live in `packages/<name>/test/` directories, mirroring the source str
121121
The docs site follows standard Elm conventions:
122122

123123
- **elm-format** — All Elm files must be formatted with `elm-format`. The pre-commit hook runs this automatically.
124-
- **Module naming** — Modules use PascalCase and match their file path (e.g. `ApiDocs.TreeshakeCheck` lives at `src/ApiDocs/TreeshakeCheck.elm`).
124+
- **Module naming** — Modules use PascalCase and match their file path (e.g. `Search` lives at `src/Search.elm`).
125125
- **Type annotations** — Every top-level function must have a type annotation.
126126
- **No partial functions** — Never use `List.head`, `Maybe.withDefault` without documenting why, or any function that can crash. Use pattern matching instead.
127127

packages/docs-site/content/contributing/repository-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ The `devtools-types` package is the shared foundation. It defines the `AuthEvent
7777
4. Add a `tsconfig.json` extending the root config
7878
5. Add the package to the sidebar in `packages/docs-site/app/Shared.elm`
7979
6. Create a content page in `packages/docs-site/content/packages/`
80-
7. Create an API docs module in `packages/docs-site/src/ApiDocs/`
80+
7. Create a content page in `packages/docs-site/content/docs/` for integration guides

packages/docs-site/content/docs/davinci-integration.md

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Ping Identity DaVinci is an orchestration platform for identity flows. The wolfc
1313

1414
DaVinci flows consist of a series of nodes that the user progresses through. Each node may involve user interaction (login forms, MFA challenges), server-side decisions (risk evaluation, policy checks), or external service calls (social login providers, identity verification).
1515

16-
The devtools bridge captures every node transition as an `AuthEvent` and the overall flow progress as a `FlowState`, giving you full visibility into what is happening during authentication.
16+
The devtools bridge monitors a DaVinci client's `Subscribable` interface and emits an `AuthEvent` on every node status transition, giving you full visibility into what is happening during authentication.
1717

1818
## Setup
1919

@@ -23,79 +23,68 @@ The devtools bridge captures every node transition as an `AuthEvent` and the ove
2323
npm install @wolfcola/devtools-bridge
2424
```
2525

26-
### Create a DaVinci Bridge
26+
### Attach the DaVinci Bridge
2727

2828
```typescript
29-
import { createBridge } from '@wolfcola/devtools-bridge';
30-
import { davinci } from '@wolfcola/devtools-bridge/adapters/davinci';
29+
import { attachDaVinciBridge } from '@wolfcola/devtools-bridge';
3130

32-
// Pass your DaVinci client instance to the adapter
33-
const bridge = createBridge(davinci(daVinciClient));
34-
```
35-
36-
The `davinci` adapter hooks into the DaVinci SDK's event system and translates its internal events into the standard `AuthEvent` schema that the devtools panel understands.
37-
38-
## What Gets Captured
39-
40-
With the DaVinci adapter active, the bridge emits events for:
31+
// Pass your DaVinci client instance
32+
const handle = attachDaVinciBridge(daVinciClient);
4133

42-
- **Flow start** — when `daVinciClient.start()` is called
43-
- **Node transitions** — each time the flow advances to a new node
44-
- **User submissions** — form data submitted at each node (passwords are redacted)
45-
- **Collector callbacks** — interactions with individual collectors within a node
46-
- **Errors** — authentication failures, network errors, timeout errors
47-
- **Flow completion** — successful authentication with token issuance
34+
// Optionally pass SDK config and devtools options
35+
const handle = attachDaVinciBridge(
36+
daVinciClient,
37+
{
38+
clientId: 'my-app',
39+
redirectUri: 'https://example.com/callback',
40+
},
41+
{ consoleLog: true },
42+
);
43+
```
4844

49-
## Flow State Tracking
45+
The bridge subscribes to the client via `client.subscribe()` and reads node state via `client.getNode()`. It decodes each node using an internal schema and only emits events when the node status actually changes.
5046

51-
The bridge also maintains a `FlowState` object that represents the current position in the DaVinci flow:
47+
### Cleanup
5248

5349
```typescript
54-
// FlowState is updated automatically
55-
// Access it from the DevTools panel or programmatically:
56-
bridge.getFlowState();
57-
// => { step: "username-password", tokens: null, error: null }
50+
handle.detach();
5851
```
5952

60-
The DevTools extension visualizes this as a node graph in the Flow view, where each step is a node and transitions are edges.
61-
62-
## Advanced Configuration
53+
<callout type="warning">Always call `handle.detach()` when you are done. Failing to do so may cause memory leaks from lingering event listeners.</callout>
6354

64-
### Filtering Events
55+
## What Gets Captured
6556

66-
You can filter which events are emitted to the devtools panel:
57+
With the DaVinci bridge attached, the following events are emitted:
6758

68-
```typescript
69-
const bridge = createBridge(davinci(daVinciClient), {
70-
filter: (event) => event.type !== 'collector_callback',
71-
});
72-
```
59+
- **`sdk:config`** -- Emitted once on the first node transition (when `config` is provided). Contains the SDK configuration object.
60+
- **`sdk:node-change`** -- Emitted on every node status transition. Contains `SdkData` with `nodeStatus`, `previousStatus`, `interactionId`, `interactionToken`, `nodeId`, `nodeName`, `nodeDescription`, `eventName`, `httpStatus`, `collectors`, `error`, `authorization`, `session`, and `responseBody`.
61+
- **`session:cookie`** -- Emitted when `document.cookie` changes between node transitions.
62+
- **`session:storage`** -- Emitted when `localStorage` values change between node transitions.
7363

74-
### Custom Metadata
64+
## How It Works
7565

76-
Attach custom metadata to every event for debugging:
66+
The bridge uses the `Subscribable` interface expected by the DaVinci SDK:
7767

7868
```typescript
79-
const bridge = createBridge(davinci(daVinciClient), {
80-
metadata: {
81-
environment: 'staging',
82-
flowId: 'login-v2',
83-
},
84-
});
69+
interface Subscribable {
70+
subscribe: (listener: () => void) => () => void;
71+
getNode: () => unknown;
72+
cache?: {
73+
getCache: (requestId: string) => unknown;
74+
};
75+
}
8576
```
8677

87-
### Cleanup
88-
89-
When the component unmounts or the flow completes, destroy the bridge to stop event capture and release resources:
90-
91-
```typescript
92-
bridge.destroy();
93-
```
78+
On each subscription callback:
9479

95-
<callout type="warning">Always call `bridge.destroy()` when you are done. Failing to do so may cause memory leaks from lingering event listeners.</callout>
80+
1. The bridge calls `client.getNode()` and decodes the result with `Schema.decodeUnknownOption`
81+
2. If the node status matches the previous status, the event is skipped (deduplication)
82+
3. If `window.__PING_DEVTOOLS_EXTENSION__` is not present, the event is dropped (no extension installed)
83+
4. The node data is mapped to `SdkData` via the pure `nodeToSdkData` function
84+
5. Session snapshots (cookies + localStorage) are taken before and after, with diffs emitted as separate events
9685

9786
## Troubleshooting
9887

99-
- **No events appearing** Verify that the DaVinci SDK version is compatible. The adapter supports `@ping-identity/davinci-client`.
100-
- **Missing node transitions** — Some custom DaVinci nodes may not emit standard events. Contact the node author to ensure compatibility.
101-
- **Redacted fields showing as empty** The bridge redacts sensitive fields by default. To see raw values during development, pass `redact: false` in the bridge options (never do this in production).
88+
- **No events appearing** -- Verify that `window.__PING_DEVTOOLS_EXTENSION__` exists. The bridge only emits events when the Ping DevTools extension is detected.
89+
- **Missing node transitions** -- The bridge deduplicates by `nodeStatus`. If two consecutive nodes have the same status string, only the first is emitted.
90+
- **Optional peer dependency** -- The bridge has `@forgerock/davinci-client` as an optional peer dependency. You do not need to install it separately if you are already using the DaVinci SDK.

0 commit comments

Comments
 (0)