@ebay-dt/bonfire-next 0.1.0-alpha.0 → 0.1.0-alpha.1
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/README.md +239 -34
- package/dist/client/lifecycle-provider.d.ts +2 -1
- package/dist/client/lifecycle-provider.d.ts.map +1 -1
- package/dist/client/lifecycle-provider.js +5 -7
- package/dist/client/lifecycle-provider.js.map +1 -1
- package/dist/server/agent-actions.d.ts +13 -0
- package/dist/server/agent-actions.d.ts.map +1 -0
- package/dist/server/agent-actions.js +80 -0
- package/dist/server/agent-actions.js.map +1 -0
- package/dist/server/auth-boundary.d.ts +1 -0
- package/dist/server/auth-boundary.d.ts.map +1 -1
- package/dist/server/auth-boundary.js +10 -3
- package/dist/server/auth-boundary.js.map +1 -1
- package/dist/server/create-bonfire-next.d.ts +12 -1
- package/dist/server/create-bonfire-next.d.ts.map +1 -1
- package/dist/server/create-bonfire-next.js +41 -1
- package/dist/server/create-bonfire-next.js.map +1 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/prototype-actions.d.ts +7 -3
- package/dist/server/prototype-actions.d.ts.map +1 -1
- package/dist/server/prototype-actions.js +84 -5
- package/dist/server/prototype-actions.js.map +1 -1
- package/dist/server/prototype-dashboard.d.ts +2 -1
- package/dist/server/prototype-dashboard.d.ts.map +1 -1
- package/dist/server/prototype-dashboard.js +3 -0
- package/dist/server/prototype-dashboard.js.map +1 -1
- package/dist/server/prototype-environment.d.ts +18 -0
- package/dist/server/prototype-environment.d.ts.map +1 -0
- package/dist/server/prototype-environment.js +67 -0
- package/dist/server/prototype-environment.js.map +1 -0
- package/dist/server/prototype-routes.d.ts.map +1 -1
- package/dist/server/prototype-routes.js +9 -4
- package/dist/server/prototype-routes.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -38,15 +38,70 @@ Create `src/bonfire.ts`:
|
|
|
38
38
|
import { createBonfireNext } from "@ebay-dt/bonfire-next/server";
|
|
39
39
|
import config from "../bonfire.config";
|
|
40
40
|
|
|
41
|
+
import { createDeploymentProvider } from "@ebay-dt/bonfire-next/server";
|
|
42
|
+
|
|
43
|
+
const deploymentProvider =
|
|
44
|
+
process.env.NODE_ENV !== "production" &&
|
|
45
|
+
process.env.BONFIRE_DEPLOYMENT_ENDPOINT !== undefined
|
|
46
|
+
? createDeploymentProvider({
|
|
47
|
+
endpoint: process.env.BONFIRE_DEPLOYMENT_ENDPOINT,
|
|
48
|
+
})
|
|
49
|
+
: undefined;
|
|
50
|
+
|
|
41
51
|
export const bonfire = createBonfireNext({
|
|
42
52
|
config,
|
|
43
53
|
repositoryRoot: process.cwd(),
|
|
44
54
|
primaryBranch: process.env.BF_PROTOTYPE_BASE_BRANCH,
|
|
55
|
+
deploymentProvider,
|
|
45
56
|
sessionSecret: process.env.BF_SESSION_SECRET,
|
|
46
57
|
disableAutoBranchSwitch: process.env.BF_DISABLE_AUTO_BRANCH_SWITCH,
|
|
47
58
|
});
|
|
48
59
|
```
|
|
49
60
|
|
|
61
|
+
### Theme registry configuration
|
|
62
|
+
|
|
63
|
+
Theme configuration is optional. When present, the registry is validated by
|
|
64
|
+
`@ebay-dt/bonfire-core` and is included in prototype route models:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const config = {
|
|
68
|
+
appId: "my-app",
|
|
69
|
+
name: "My App",
|
|
70
|
+
themes: {
|
|
71
|
+
definitions: [
|
|
72
|
+
{
|
|
73
|
+
id: "alpha",
|
|
74
|
+
label: "Alpha",
|
|
75
|
+
allowedColorSchemes: ["system", "light", "dark"],
|
|
76
|
+
},
|
|
77
|
+
{ id: "beta", label: "Beta", allowedColorSchemes: ["dark"] },
|
|
78
|
+
],
|
|
79
|
+
defaultTheme: "alpha",
|
|
80
|
+
defaultColorScheme: "system",
|
|
81
|
+
},
|
|
82
|
+
} satisfies BonfireConfigInput;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Prototype metadata can provide a validated `theme` policy. If it is omitted,
|
|
86
|
+
Bonfire applies the instance defaults and registered capabilities. The server
|
|
87
|
+
integration passes the normalized policy and registry to the host; it does not
|
|
88
|
+
scan metadata or construct a theme map in the application.
|
|
89
|
+
|
|
90
|
+
The host owns theme CSS. Use the provider's `data-theme` and
|
|
91
|
+
`data-color-scheme` attributes in an instance stylesheet. Keep a `system`
|
|
92
|
+
selector and a `prefers-color-scheme` media rule when a theme supports System;
|
|
93
|
+
Bonfire retains `system` as the attribute value and exposes the resolved Light
|
|
94
|
+
or Dark value separately through React.
|
|
95
|
+
|
|
96
|
+
The deployment endpoint is complete, has no embedded default, and must remain in
|
|
97
|
+
server-only configuration. When configured, the provider sends only
|
|
98
|
+
`{ applicationId, login }`; it does not send owner or branch values. The
|
|
99
|
+
service resolves the repository, project, deployment target, and credentials
|
|
100
|
+
from the application ID and login. HTTP 201 confirms deployment creation, while
|
|
101
|
+
`readyState` reports the provider's current state; Bonfire preserves the
|
|
102
|
+
`deploymentId` but does not poll it. `deploymentAvailable` exposes configured
|
|
103
|
+
development capability to the lifecycle provider, not authorization.
|
|
104
|
+
|
|
50
105
|
Run `bonfire prepare` before development so the secret exists in
|
|
51
106
|
`.env.local`. An externally supplied `BF_SESSION_SECRET` takes precedence.
|
|
52
107
|
The explicit repository root enables request-time discovery under
|
|
@@ -67,44 +122,96 @@ this callback together with a `prototypeLifecycle` override.
|
|
|
67
122
|
Next.js cannot install filesystem routes for a package, so each application
|
|
68
123
|
adds these small bindings. Keep authentication logic in the package.
|
|
69
124
|
|
|
70
|
-
`src/app/layout.tsx
|
|
125
|
+
`src/app/layout.tsx` should own the document and long-lived providers, but not
|
|
126
|
+
route-specific application chrome:
|
|
71
127
|
|
|
72
128
|
```tsx
|
|
73
|
-
import type { Metadata } from "next";
|
|
74
|
-
import { AppHeader } from "@ebay-dt/bonfire-react";
|
|
75
|
-
import { bonfire } from "@/bonfire";
|
|
76
129
|
import "@ebay-dt/bonfire-react/styles/defaults.css";
|
|
77
130
|
|
|
78
|
-
export default
|
|
79
|
-
const { htmlProps, headerProps } = await bonfire.auth.getAppLayoutModel();
|
|
80
|
-
|
|
131
|
+
export default function RootLayout({ children }: LayoutProps<"/">) {
|
|
81
132
|
return (
|
|
82
|
-
<html lang="en"
|
|
83
|
-
<body>
|
|
84
|
-
<AppHeader {...headerProps} />
|
|
85
|
-
{children}
|
|
86
|
-
</body>
|
|
133
|
+
<html lang="en">
|
|
134
|
+
<body>{children}</body>
|
|
87
135
|
</html>
|
|
88
136
|
);
|
|
89
137
|
}
|
|
90
138
|
```
|
|
91
139
|
|
|
92
|
-
`getAppLayoutModel()` returns opaque document props
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
140
|
+
`getAppLayoutModel()` returns opaque document props and serializable header
|
|
141
|
+
props. Render `AppHeader` in the route layout that owns it. Keep the dashboard
|
|
142
|
+
header in a system layout and the prototype header inside the prototype
|
|
143
|
+
environment, so the header can consume the environment context:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
// src/app/(system)/layout.tsx
|
|
147
|
+
const { headerProps } = await bonfire.auth.getAppLayoutModel();
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<AppHeader {...headerProps} />
|
|
151
|
+
{children}
|
|
152
|
+
</>
|
|
153
|
+
);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Prototype environment composition
|
|
157
|
+
|
|
158
|
+
Use `getCurrentRouteModel()` from a shared prototype route-group layout when the
|
|
159
|
+
application enters prototypes from the dashboard and does not support soft
|
|
160
|
+
navigation between prototypes. The model includes the configured registry when
|
|
161
|
+
themes are enabled, so the host does not scan metadata or rebuild a
|
|
162
|
+
`themesByPath` map:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
// src/app/(prototypes)/layout.tsx
|
|
166
|
+
import { notFound } from "next/navigation";
|
|
167
|
+
import { AppHeader, PrototypeEnvironment } from "@ebay-dt/bonfire-react";
|
|
168
|
+
import { openInClaudeCode, openInCursor } from "@/actions/agents";
|
|
169
|
+
import { bonfire } from "@/bonfire";
|
|
170
|
+
|
|
171
|
+
export default async function PrototypeLayout({ children }: LayoutProps<"/">) {
|
|
172
|
+
const [{ headerProps }, prototype] = await Promise.all([
|
|
173
|
+
bonfire.auth.getAppLayoutModel(),
|
|
174
|
+
bonfire.prototypes.getCurrentRouteModel(),
|
|
175
|
+
]);
|
|
176
|
+
if (prototype === null) notFound();
|
|
177
|
+
|
|
178
|
+
const agentActions = { openInClaudeCode, openInCursor };
|
|
179
|
+
const header = <AppHeader {...headerProps} agentActions={agentActions} />;
|
|
180
|
+
if (prototype.theme === undefined)
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
{header}
|
|
184
|
+
{children}
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
return (
|
|
188
|
+
<PrototypeEnvironment
|
|
189
|
+
prototypeUrl={prototype.url}
|
|
190
|
+
theme={prototype.theme}
|
|
191
|
+
themeRegistry={prototype.themeRegistry}
|
|
192
|
+
agentActions={agentActions}
|
|
193
|
+
>
|
|
194
|
+
{header}
|
|
195
|
+
{children}
|
|
196
|
+
</PrototypeEnvironment>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Keep this layout scoped to prototype routes. Dashboard, login, and other
|
|
202
|
+
application-level pages should remain outside it. If the application later
|
|
203
|
+
adds soft navigation between prototypes, move the boundary to the route
|
|
204
|
+
segment that identifies one prototype (for example `[login]/[slug]/layout.tsx`)
|
|
205
|
+
and use `getRouteModel({ login, slug })` there. That is what allows navigation
|
|
206
|
+
within one prototype to preserve state while navigation to another remounts it.
|
|
100
207
|
|
|
101
208
|
## Prototype lifecycle composition
|
|
102
209
|
|
|
103
210
|
The lifecycle-aware dashboard uses the framework-neutral controller and React
|
|
104
|
-
components from `@ebay-dt/bonfire-react/lifecycle`. The Next-specific provider
|
|
105
|
-
router integration, dirty-state observation, and
|
|
106
|
-
|
|
107
|
-
thin dirty route binding as well:
|
|
211
|
+
components from `@ebay-dt/bonfire-react/lifecycle`. The Next-specific provider
|
|
212
|
+
supplies router integration, dirty-state observation, and Server Action
|
|
213
|
+
bindings, while `LifecycleProvider` owns the React controller lifecycle. Add
|
|
214
|
+
the thin dirty route binding as well:
|
|
108
215
|
|
|
109
216
|
```ts
|
|
110
217
|
// src/app/api/prototype-dirty/route.ts
|
|
@@ -118,11 +225,14 @@ Then mount the provider and lifecycle-aware header from the root layout:
|
|
|
118
225
|
|
|
119
226
|
```tsx
|
|
120
227
|
import { NextLifecycleProvider } from "@ebay-dt/bonfire-next/client";
|
|
121
|
-
import {
|
|
228
|
+
import { AppHeader } from "@ebay-dt/bonfire-react";
|
|
122
229
|
import {
|
|
123
230
|
createPrototype,
|
|
231
|
+
deletePrototype,
|
|
124
232
|
discardPrototype,
|
|
125
233
|
duplicatePrototype,
|
|
234
|
+
editPrototype,
|
|
235
|
+
deployPrototype,
|
|
126
236
|
savePrototype,
|
|
127
237
|
} from "@/actions/prototypes";
|
|
128
238
|
import { bonfire } from "@/bonfire";
|
|
@@ -132,22 +242,111 @@ const { headerProps } = await bonfire.auth.getAppLayoutModel();
|
|
|
132
242
|
<NextLifecycleProvider
|
|
133
243
|
enabled={process.env.NODE_ENV !== "production"}
|
|
134
244
|
user={headerProps.user}
|
|
245
|
+
deploymentAvailable={bonfire.prototypes.capabilities.deployment}
|
|
135
246
|
dirtyEndpoint="/api/prototype-dirty"
|
|
136
247
|
actions={{
|
|
137
248
|
create: createPrototype,
|
|
138
249
|
duplicate: duplicatePrototype,
|
|
250
|
+
edit: editPrototype,
|
|
251
|
+
delete: deletePrototype,
|
|
139
252
|
save: savePrototype,
|
|
140
253
|
discard: discardPrototype,
|
|
254
|
+
...(process.env.NODE_ENV !== "production"
|
|
255
|
+
? { deploy: deployPrototype }
|
|
256
|
+
: {}),
|
|
141
257
|
}}
|
|
142
258
|
>
|
|
143
|
-
<
|
|
259
|
+
<AppHeader {...headerProps} />
|
|
144
260
|
{children}
|
|
145
261
|
</NextLifecycleProvider>;
|
|
146
262
|
```
|
|
147
263
|
|
|
148
264
|
Mount it from the root layout so the controller survives dashboard/prototype
|
|
149
|
-
navigation.
|
|
150
|
-
|
|
265
|
+
navigation. Render the regular `PrototypeDashboard` from the page and pass the
|
|
266
|
+
resolved user; it consumes lifecycle context directly. Production can leave
|
|
267
|
+
the provider disabled, in which case the dashboard renders its public
|
|
268
|
+
read-only view. The action bindings must include `create`, `duplicate`, `edit`, `delete`,
|
|
269
|
+
`save`, `discard`, and `deploy` when deployment is enabled. Edit/delete/deploy
|
|
270
|
+
are authorized by the server-side lifecycle adapter; UI visibility is not an
|
|
271
|
+
authorization boundary.
|
|
272
|
+
The provider performs one host refresh after a successful edit or delete.
|
|
273
|
+
|
|
274
|
+
Agent launch bindings follow the same thin host-action pattern. Add a
|
|
275
|
+
server-only wrapper module; it must delegate to `bonfire.prototypes.agents` and
|
|
276
|
+
must not reproduce authentication, ownership, process, or filesystem logic:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
// src/actions/agents.ts
|
|
280
|
+
"use server";
|
|
281
|
+
|
|
282
|
+
import { bonfire } from "@/bonfire";
|
|
283
|
+
import type {
|
|
284
|
+
OpenInAgentInput,
|
|
285
|
+
OpenInClaudeCodeInput,
|
|
286
|
+
} from "@ebay-dt/bonfire-core";
|
|
287
|
+
|
|
288
|
+
export async function openInCursor(input: OpenInAgentInput) {
|
|
289
|
+
return bonfire.prototypes.agents.openInCursor(input);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export async function openInClaudeCode(input: OpenInClaudeCodeInput) {
|
|
293
|
+
return bonfire.prototypes.agents.openInClaudeCode(input);
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Pass these Server Action references to both packaged surfaces. The dashboard
|
|
298
|
+
page can provide them to owner cards:
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
<PrototypeDashboard
|
|
302
|
+
{...model}
|
|
303
|
+
agentActions={{ openInClaudeCode, openInCursor }}
|
|
304
|
+
user={user}
|
|
305
|
+
/>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
The root header accepts the same bindings:
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
<AppHeader {...headerProps} agentActions={{ openInClaudeCode, openInCursor }} />
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
The card controls are owner-only icon buttons with tooltips. A successful card
|
|
315
|
+
launch navigates into the selected prototype; preflight and launch failures
|
|
316
|
+
remain on the current page so their dialogs can be shown. The header controls
|
|
317
|
+
are text menu rows and close the account popover when clicked. Both surfaces
|
|
318
|
+
use the validated prototype reference on the server; browser props contain no
|
|
319
|
+
absolute filesystem path or shell command.
|
|
320
|
+
|
|
321
|
+
Cursor requires `cursor` and Claude Code requires `claude` on the `PATH` inherited
|
|
322
|
+
by the Bonfire server process. On macOS, Claude Code also requires
|
|
323
|
+
`osascript`. A GUI-launched Node process may have a different `PATH` from an
|
|
324
|
+
interactive shell, so restart Bonfire after changing a shell profile. Claude
|
|
325
|
+
Code terminal preferences support Terminal.app, iTerm2, and Warp. The first
|
|
326
|
+
launch without a preference presents the packaged terminal-selection dialog;
|
|
327
|
+
the selected value is written server-side and then used for the launch.
|
|
328
|
+
|
|
329
|
+
Preferences are stored at `<prototypeRoot>/<login>/preferences.json`. This is a
|
|
330
|
+
local preference file, not prototype source, and hosts must ignore it in Git.
|
|
331
|
+
For the conventional integration prototype root, use:
|
|
332
|
+
|
|
333
|
+
```gitignore
|
|
334
|
+
/src/app/(prototypes)/*/preferences.json
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
No Claude Code skill, clipboard fallback, copy/paste setup command, or
|
|
338
|
+
unauthenticated preferences route is required. Production remains public and
|
|
339
|
+
read-only: it does not construct the local agent service, launch a process, or
|
|
340
|
+
read or write preferences.
|
|
341
|
+
|
|
342
|
+
### Migration from the Sandbox reference
|
|
343
|
+
|
|
344
|
+
This flow adapts the Sandbox reference's direct Cursor/Claude Code launching,
|
|
345
|
+
owner checks, terminal selection, and actionable failure UI. Bonfire keeps those
|
|
346
|
+
responsibilities in Core, Node, Next adapters, and packaged React controls; it
|
|
347
|
+
does not copy the reference application's absolute paths, local Next actions,
|
|
348
|
+
client setup hook, skills, clipboard behavior, or unauthenticated preferences
|
|
349
|
+
API.
|
|
151
350
|
|
|
152
351
|
`src/app/login/page.tsx`:
|
|
153
352
|
|
|
@@ -238,8 +437,11 @@ type HomeProps = {
|
|
|
238
437
|
};
|
|
239
438
|
|
|
240
439
|
export default async function Home({ searchParams }: HomeProps) {
|
|
241
|
-
const model = await
|
|
242
|
-
|
|
440
|
+
const [model, user] = await Promise.all([
|
|
441
|
+
bonfire.prototypes.getDashboardModel(searchParams),
|
|
442
|
+
bonfire.auth.getCurrentUser(),
|
|
443
|
+
]);
|
|
444
|
+
return <PrototypeDashboard {...model} user={user} />;
|
|
243
445
|
}
|
|
244
446
|
```
|
|
245
447
|
|
|
@@ -260,9 +462,8 @@ and discard accept only a validated target reference and never push changes:
|
|
|
260
462
|
|
|
261
463
|
import type {
|
|
262
464
|
CreatePrototypeInput,
|
|
263
|
-
DiscardPrototypeInput,
|
|
264
465
|
DuplicatePrototypeInput,
|
|
265
|
-
|
|
466
|
+
PrototypeCommandInput,
|
|
266
467
|
} from "@ebay-dt/bonfire-core";
|
|
267
468
|
import { bonfire } from "@/bonfire";
|
|
268
469
|
|
|
@@ -274,13 +475,17 @@ export async function duplicatePrototype(input: DuplicatePrototypeInput) {
|
|
|
274
475
|
return bonfire.prototypes.actions.duplicate(input);
|
|
275
476
|
}
|
|
276
477
|
|
|
277
|
-
export async function savePrototype(input:
|
|
478
|
+
export async function savePrototype(input: PrototypeCommandInput) {
|
|
278
479
|
return bonfire.prototypes.actions.save(input);
|
|
279
480
|
}
|
|
280
481
|
|
|
281
|
-
export async function discardPrototype(input:
|
|
482
|
+
export async function discardPrototype(input: PrototypeCommandInput) {
|
|
282
483
|
return bonfire.prototypes.actions.discard(input);
|
|
283
484
|
}
|
|
485
|
+
|
|
486
|
+
export async function deployPrototype(input: PrototypeCommandInput) {
|
|
487
|
+
return bonfire.prototypes.actions.deploy(input);
|
|
488
|
+
}
|
|
284
489
|
```
|
|
285
490
|
|
|
286
491
|
Keep these wrappers thin: form validation, session lookup, lifecycle errors,
|
|
@@ -7,6 +7,7 @@ export type NextLifecycleProviderProps = {
|
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
user?: BonfireIdentity | null;
|
|
9
9
|
dirtyEndpoint?: string;
|
|
10
|
+
deploymentAvailable?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare function NextLifecycleProvider({ actions, children, enabled, user, dirtyEndpoint, }: NextLifecycleProviderProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
12
|
+
export declare function NextLifecycleProvider({ actions, children, enabled, user, dirtyEndpoint, deploymentAvailable, }: NextLifecycleProviderProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
12
13
|
//# sourceMappingURL=lifecycle-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-provider.d.ts","sourceRoot":"","sources":["../../src/client/lifecycle-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,uBAAuB,EAG7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,uBAAuB,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle-provider.d.ts","sourceRoot":"","sources":["../../src/client/lifecycle-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,uBAAuB,EAG7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,uBAAuB,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,EACR,OAAc,EACd,IAAW,EACX,aAAa,EACb,mBAAmB,GACpB,EAAE,0BAA0B,+TAY5B"}
|
|
@@ -3,12 +3,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createDirtyObservationAdapter, createLifecycleController, LifecycleProvider, } from "@ebay-dt/bonfire-react/lifecycle";
|
|
4
4
|
import { usePathname, useRouter } from "next/navigation.js";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
-
export function NextLifecycleProvider({ actions, children, enabled = true, user = null, dirtyEndpoint, }) {
|
|
6
|
+
export function NextLifecycleProvider({ actions, children, enabled = true, user = null, dirtyEndpoint, deploymentAvailable, }) {
|
|
7
7
|
if (!enabled)
|
|
8
8
|
return children;
|
|
9
|
-
return (_jsx(EnabledNextLifecycleProvider, { actions: actions, dirtyEndpoint: dirtyEndpoint, user: user, children: children }));
|
|
9
|
+
return (_jsx(EnabledNextLifecycleProvider, { actions: actions, dirtyEndpoint: dirtyEndpoint, deploymentAvailable: deploymentAvailable, user: user, children: children }));
|
|
10
10
|
}
|
|
11
|
-
function EnabledNextLifecycleProvider({ actions, children, user, dirtyEndpoint, }) {
|
|
11
|
+
function EnabledNextLifecycleProvider({ actions, children, user, dirtyEndpoint, deploymentAvailable, }) {
|
|
12
12
|
const pathname = usePathname() ?? "/";
|
|
13
13
|
const router = useRouter();
|
|
14
14
|
const [route] = useState(() => {
|
|
@@ -37,6 +37,7 @@ function EnabledNextLifecycleProvider({ actions, children, user, dirtyEndpoint,
|
|
|
37
37
|
push: (href) => router.push(href),
|
|
38
38
|
replace: (href) => router.replace(href),
|
|
39
39
|
back: () => router.back(),
|
|
40
|
+
refresh: () => router.refresh(),
|
|
40
41
|
}));
|
|
41
42
|
const [dirtyObservation] = useState(() => createDirtyObservationAdapter({ endpoint: dirtyEndpoint }));
|
|
42
43
|
const [controller] = useState(() => createLifecycleController({
|
|
@@ -45,14 +46,11 @@ function EnabledNextLifecycleProvider({ actions, children, user, dirtyEndpoint,
|
|
|
45
46
|
route: route.adapter,
|
|
46
47
|
user,
|
|
47
48
|
dirtyObservation,
|
|
49
|
+
deploymentAvailable,
|
|
48
50
|
}));
|
|
49
51
|
useEffect(() => {
|
|
50
52
|
route.setPathname(pathname);
|
|
51
53
|
}, [pathname, route]);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
controller.start();
|
|
54
|
-
return () => controller.stop();
|
|
55
|
-
}, [controller]);
|
|
56
54
|
return (_jsx(LifecycleProvider, { controller: controller, children: children }));
|
|
57
55
|
}
|
|
58
56
|
//# sourceMappingURL=lifecycle-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-provider.js","sourceRoot":"","sources":["../../src/client/lifecycle-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,iBAAiB,GAIlB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle-provider.js","sourceRoot":"","sources":["../../src/client/lifecycle-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,iBAAiB,GAIlB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAW5D,MAAM,UAAU,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,IAAI,GAAG,IAAI,EACX,aAAa,EACb,mBAAmB,GACQ;IAC3B,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAC9B,OAAO,CACL,KAAC,4BAA4B,IAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,EAAE,IAAI,YAET,QAAQ,GACoB,CAChC,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B,CAAC,EACpC,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,mBAAmB,GAIpB;IACC,MAAM,QAAQ,GAAG,WAAW,EAAE,IAAI,GAAG,CAAC;IACtC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CA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,yBAAyB,CAAC;QACxB,OAAO;QACP,UAAU;QACV,KAAK,EAAE,KAAK,CAAC,OAAO;QACpB,IAAI;QACJ,gBAAgB;QAChB,mBAAmB;KACpB,CAAC,CACH,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtB,OAAO,CACL,KAAC,iBAAiB,IAAC,UAAU,EAAE,UAAU,YAAG,QAAQ,GAAqB,CAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AgentActionResult, type BonfireIdentity, type OpenInAgentInput, type OpenInClaudeCodeInput } from "@ebay-dt/bonfire-core";
|
|
2
|
+
import type { PrototypeAgentServiceLike } from "@ebay-dt/bonfire-node";
|
|
3
|
+
export type PrototypeAgentActions = {
|
|
4
|
+
openInCursor(input: OpenInAgentInput): Promise<AgentActionResult>;
|
|
5
|
+
openInClaudeCode(input: OpenInClaudeCodeInput): Promise<AgentActionResult>;
|
|
6
|
+
};
|
|
7
|
+
export type PrototypeAgentActionsOptions = {
|
|
8
|
+
production: boolean;
|
|
9
|
+
getCurrentUser: () => Promise<BonfireIdentity | null>;
|
|
10
|
+
agents: PrototypeAgentServiceLike | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function createPrototypeAgentActions(options: PrototypeAgentActionsOptions): PrototypeAgentActions;
|
|
13
|
+
//# sourceMappingURL=agent-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-actions.d.ts","sourceRoot":"","sources":["../../src/server/agent-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClE,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACtD,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAAC;CAC1C,CAAC;AAkCF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CA8CvB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AgentInputError, parseOpenInAgentInput, parseOpenInClaudeCodeInput, } from "@ebay-dt/bonfire-core";
|
|
2
|
+
function forbidden() {
|
|
3
|
+
return {
|
|
4
|
+
ok: false,
|
|
5
|
+
error: { code: "forbidden" },
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function unauthenticated() {
|
|
9
|
+
return {
|
|
10
|
+
ok: false,
|
|
11
|
+
error: { code: "unauthenticated" },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function invalidInput() {
|
|
15
|
+
return {
|
|
16
|
+
ok: false,
|
|
17
|
+
error: { code: "invalid-input" },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function unexpectedFailure() {
|
|
21
|
+
return {
|
|
22
|
+
ok: false,
|
|
23
|
+
error: { code: "launch-failed" },
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function logUnexpectedFailure(operation) {
|
|
27
|
+
console.error(`Bonfire ${operation} agent action failed unexpectedly.`);
|
|
28
|
+
}
|
|
29
|
+
export function createPrototypeAgentActions(options) {
|
|
30
|
+
async function openInCursor(input) {
|
|
31
|
+
if (options.production || options.agents === null)
|
|
32
|
+
return forbidden();
|
|
33
|
+
let parsedInput;
|
|
34
|
+
try {
|
|
35
|
+
parsedInput = parseOpenInAgentInput(input);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error instanceof AgentInputError)
|
|
39
|
+
return invalidInput();
|
|
40
|
+
logUnexpectedFailure("cursor");
|
|
41
|
+
return unexpectedFailure();
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const identity = await options.getCurrentUser();
|
|
45
|
+
if (identity === null)
|
|
46
|
+
return unauthenticated();
|
|
47
|
+
return await options.agents.openInCursor(identity, parsedInput);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
logUnexpectedFailure("cursor");
|
|
51
|
+
return unexpectedFailure();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function openInClaudeCode(input) {
|
|
55
|
+
if (options.production || options.agents === null)
|
|
56
|
+
return forbidden();
|
|
57
|
+
let parsedInput;
|
|
58
|
+
try {
|
|
59
|
+
parsedInput = parseOpenInClaudeCodeInput(input);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error instanceof AgentInputError)
|
|
63
|
+
return invalidInput();
|
|
64
|
+
logUnexpectedFailure("claude-code");
|
|
65
|
+
return unexpectedFailure();
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const identity = await options.getCurrentUser();
|
|
69
|
+
if (identity === null)
|
|
70
|
+
return unauthenticated();
|
|
71
|
+
return await options.agents.openInClaudeCode(identity, parsedInput);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
logUnexpectedFailure("claude-code");
|
|
75
|
+
return unexpectedFailure();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return { openInCursor, openInClaudeCode };
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=agent-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-actions.js","sourceRoot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|
};
|
|
8
|
+
export declare const BONFIRE_PATHNAME_HEADER = "x-bonfire-pathname";
|
|
8
9
|
export declare function createAuthProxy(options: AuthProxyOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
|
|
9
10
|
//# sourceMappingURL=auth-boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-boundary.d.ts","sourceRoot":"","sources":["../../src/server/auth-boundary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAUF,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,aAGd,WAAW,
|
|
1
|
+
{"version":3,"file":"auth-boundary.d.ts","sourceRoot":"","sources":["../../src/server/auth-boundary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAUF,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,aAGd,WAAW,oCAqBrD"}
|
|
@@ -6,19 +6,26 @@ function isAuthPath(pathname) {
|
|
|
6
6
|
pathname === "/auth" ||
|
|
7
7
|
pathname.startsWith("/auth/"));
|
|
8
8
|
}
|
|
9
|
+
export const BONFIRE_PATHNAME_HEADER = "x-bonfire-pathname";
|
|
9
10
|
export function createAuthProxy(options) {
|
|
10
11
|
const cookieName = getSessionCookieName(options.appId);
|
|
11
12
|
return async function authProxy(request) {
|
|
13
|
+
// Forwarded so the shared prototype route-group layout can resolve the
|
|
14
|
+
// active prototype's theme policy server-side without duplicating catalog
|
|
15
|
+
// lookup in the host.
|
|
16
|
+
const forwardedHeaders = new Headers(request.headers);
|
|
17
|
+
forwardedHeaders.set(BONFIRE_PATHNAME_HEADER, request.nextUrl.pathname);
|
|
18
|
+
const next = () => NextResponse.next({ request: { headers: forwardedHeaders } });
|
|
12
19
|
if (options.production)
|
|
13
|
-
return
|
|
20
|
+
return next();
|
|
14
21
|
if (isAuthPath(request.nextUrl.pathname))
|
|
15
|
-
return
|
|
22
|
+
return next();
|
|
16
23
|
const token = request.cookies.get(cookieName)?.value;
|
|
17
24
|
const identity = token && options.sessionSecret
|
|
18
25
|
? await verifySession(token, options.sessionSecret)
|
|
19
26
|
: null;
|
|
20
27
|
if (identity)
|
|
21
|
-
return
|
|
28
|
+
return next();
|
|
22
29
|
return NextResponse.redirect(new URL("/login", request.url));
|
|
23
30
|
};
|
|
24
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-boundary.js","sourceRoot":"","sources":["../../src/server/auth-boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,SAAS,UAAU,CAAC,QAAgB;IAClC,OAAO,CACL,QAAQ,KAAK,QAAQ;QACrB,QAAQ,KAAK,OAAO;QACpB,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAyB;IACvD,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE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AAU,CAAC,EAAE,KAAK,CAAC;QACrD,MAAM,QAAQ,GACZ,KAAK,IAAI,OAAO,CAAC,aAAa;YAC5B,CAAC,CAAC,MAAM,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC;YACnD,CAAC,CAAC,IAAI,CAAC;QACX,IAAI,QAAQ;YAAE,OAAO,IAAI,EAAE,CAAC;QAE5B,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BonfireConfigInput, type BonfireIdentity } from "@ebay-dt/bonfire-core";
|
|
2
|
-
import { type GitHubCliClientLike, type PreparePrototypeFiles, type PrototypeCatalogLike, type PrototypeLifecycle } from "@ebay-dt/bonfire-node";
|
|
2
|
+
import { type DeploymentProvider, type GitHubCliClientLike, type PreparePrototypeFiles, type PrototypeAgentServiceLike, type PrototypeCatalogLike, type PrototypeLifecycle } from "@ebay-dt/bonfire-node";
|
|
3
3
|
import type { PrototypeWatcher } from "@ebay-dt/bonfire-node/watcher";
|
|
4
4
|
import { type CSSProperties } from "react";
|
|
5
5
|
import { type LoginSearchParams } from "./login-page-model.js";
|
|
@@ -11,11 +11,16 @@ export type CreateBonfireNextOptions = {
|
|
|
11
11
|
sessionSecret?: string;
|
|
12
12
|
githubCli?: GitHubCliClientLike;
|
|
13
13
|
prototypeCatalog?: PrototypeCatalogLike;
|
|
14
|
+
prototypeAgents?: PrototypeAgentServiceLike;
|
|
14
15
|
prototypeLifecycle?: PrototypeLifecycle;
|
|
16
|
+
deploymentProvider?: DeploymentProvider;
|
|
15
17
|
prototypeWatcher?: PrototypeWatcher;
|
|
16
18
|
preparePrototypeFiles?: PreparePrototypeFiles;
|
|
17
19
|
disableAutoBranchSwitch?: string;
|
|
18
20
|
};
|
|
21
|
+
export type PrototypeCapabilities = {
|
|
22
|
+
deployment: boolean;
|
|
23
|
+
};
|
|
19
24
|
type AppLayoutModel = {
|
|
20
25
|
htmlProps: {
|
|
21
26
|
style: CSSProperties;
|
|
@@ -28,9 +33,15 @@ type AppLayoutModel = {
|
|
|
28
33
|
export declare function createBonfireNext(options: CreateBonfireNextOptions): {
|
|
29
34
|
prototypes: {
|
|
30
35
|
getDashboardModel: (searchParams?: Promise<import("./prototype-dashboard.js").PrototypeDashboardSearchParams> | import("./prototype-dashboard.js").PrototypeDashboardSearchParams | undefined) => Promise<import("@ebay-dt/bonfire-core").PrototypeDashboardModel>;
|
|
36
|
+
getRouteModel: (input: import("@ebay-dt/bonfire-core").PrototypeRef) => Promise<import("./prototype-environment.js").PrototypeRouteModel | null>;
|
|
37
|
+
getCurrentRouteModel: () => Promise<import("./prototype-environment.js").PrototypeRouteModel | null>;
|
|
31
38
|
getSummary: (ref: import("@ebay-dt/bonfire-core").PrototypeRef) => Promise<import("@ebay-dt/bonfire-core").PrototypeSummary | null>;
|
|
39
|
+
capabilities: {
|
|
40
|
+
deployment: boolean;
|
|
41
|
+
};
|
|
32
42
|
lifecycle: PrototypeLifecycle | null;
|
|
33
43
|
actions: import("./prototype-actions.js").PrototypeActions;
|
|
44
|
+
agents: import("./agent-actions.js").PrototypeAgentActions;
|
|
34
45
|
routes: import("./prototype-routes.js").PrototypeRoutes;
|
|
35
46
|
};
|
|
36
47
|
auth: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-bonfire-next.d.ts","sourceRoot":"","sources":["../../src/server/create-bonfire-next.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"create-bonfire-next.d.ts","sourceRoot":"","sources":["../../src/server/create-bonfire-next.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM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;;;;;;;;;iCAoHvB,OAAO,CAAC,cAAc,CAAC;2CAgBhD,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;EA8ChE"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
2
|
import { defineConfig, lifecycleSuccess, parseAutomaticBranchSwitchSetting, } from "@ebay-dt/bonfire-core";
|
|
3
|
-
import { GitHubCliClient, LocalPrototypeLifecycle, PrototypeCatalog, } from "@ebay-dt/bonfire-node";
|
|
3
|
+
import { GitHubCliClient, LocalPrototypeLifecycle, PrototypeAgentService, PrototypeCatalog, resolvePrototypeCatalogPaths, } from "@ebay-dt/bonfire-node";
|
|
4
4
|
import { cache } from "react";
|
|
5
5
|
import { createAuthProxy } from "./auth-boundary.js";
|
|
6
6
|
import { createAuthRoutes } from "./auth-routes.js";
|
|
7
7
|
import { createLoginPageModel, getLoginPageSearchParams, } from "./login-page-model.js";
|
|
8
8
|
import { createSessionAdapter } from "./session.js";
|
|
9
9
|
import { createPrototypeActions } from "./prototype-actions.js";
|
|
10
|
+
import { createPrototypeAgentActions } from "./agent-actions.js";
|
|
10
11
|
import { createPrototypeDashboardModelLoader } from "./prototype-dashboard.js";
|
|
12
|
+
import { createPrototypeEnvironmentModelLoader } from "./prototype-environment.js";
|
|
11
13
|
import { createPrototypeRoutes } from "./prototype-routes.js";
|
|
12
14
|
const APP_HEADER_BLOCK_SIZE_PROPERTY = "--app-header-block-size";
|
|
13
15
|
const APP_HEADER_PRESENT_BLOCK_SIZE = "2.5rem";
|
|
14
16
|
export function createBonfireNext(options) {
|
|
15
17
|
const config = defineConfig(options.config);
|
|
16
18
|
const production = process.env.NODE_ENV === "production";
|
|
19
|
+
if (options.prototypeLifecycle && options.deploymentProvider) {
|
|
20
|
+
throw new Error("prototypeLifecycle and deploymentProvider cannot be supplied together");
|
|
21
|
+
}
|
|
17
22
|
if (options.prototypeLifecycle && options.preparePrototypeFiles) {
|
|
18
23
|
throw new Error("prototypeLifecycle and preparePrototypeFiles cannot be supplied together");
|
|
19
24
|
}
|
|
@@ -30,6 +35,7 @@ export function createBonfireNext(options) {
|
|
|
30
35
|
new PrototypeCatalog({
|
|
31
36
|
repositoryRoot: options.repositoryRoot,
|
|
32
37
|
prototypeRoot: options.prototypeRoot,
|
|
38
|
+
themeRegistry: config.themes,
|
|
33
39
|
});
|
|
34
40
|
const lifecycle = options.prototypeLifecycle ??
|
|
35
41
|
(production
|
|
@@ -39,9 +45,15 @@ export function createBonfireNext(options) {
|
|
|
39
45
|
prototypeRoot: options.prototypeRoot,
|
|
40
46
|
primaryBranch: options.primaryBranch,
|
|
41
47
|
automaticBranchSwitch,
|
|
48
|
+
applicationId: config.appId,
|
|
42
49
|
catalog: prototypeCatalog,
|
|
50
|
+
deploymentProvider: options.deploymentProvider,
|
|
43
51
|
preparePrototypeFiles: options.preparePrototypeFiles,
|
|
52
|
+
themeRegistry: config.themes,
|
|
44
53
|
}));
|
|
54
|
+
const deploymentAvailable = !production &&
|
|
55
|
+
(options.deploymentProvider !== undefined ||
|
|
56
|
+
options.prototypeLifecycle?.deploy !== undefined);
|
|
45
57
|
const getCurrentUser = cache(() => getSession());
|
|
46
58
|
const prepareIdentity = production
|
|
47
59
|
? undefined
|
|
@@ -54,6 +66,22 @@ export function createBonfireNext(options) {
|
|
|
54
66
|
production,
|
|
55
67
|
getCurrentUser: getSession,
|
|
56
68
|
lifecycle,
|
|
69
|
+
themeRegistry: config.themes,
|
|
70
|
+
});
|
|
71
|
+
const prototypeAgents = production
|
|
72
|
+
? null
|
|
73
|
+
: (options.prototypeAgents ??
|
|
74
|
+
new PrototypeAgentService({
|
|
75
|
+
runtime: resolvePrototypeCatalogPaths({
|
|
76
|
+
repositoryRoot: options.repositoryRoot,
|
|
77
|
+
prototypeRoot: options.prototypeRoot,
|
|
78
|
+
}),
|
|
79
|
+
catalog: prototypeCatalog,
|
|
80
|
+
}));
|
|
81
|
+
const prototypeAgentActions = createPrototypeAgentActions({
|
|
82
|
+
production,
|
|
83
|
+
getCurrentUser: getSession,
|
|
84
|
+
agents: prototypeAgents,
|
|
57
85
|
});
|
|
58
86
|
let prototypeWatcher = options.prototypeWatcher;
|
|
59
87
|
const getWatcher = async () => {
|
|
@@ -79,7 +107,13 @@ export function createBonfireNext(options) {
|
|
|
79
107
|
production,
|
|
80
108
|
catalog: prototypeCatalog,
|
|
81
109
|
getCurrentUser,
|
|
110
|
+
themeRegistry: config.themes,
|
|
111
|
+
});
|
|
112
|
+
const { getRouteModel, getCurrentRouteModel: getCurrentRouteModelUncached } = createPrototypeEnvironmentModelLoader({
|
|
113
|
+
catalog: prototypeCatalog,
|
|
114
|
+
themeRegistry: config.themes,
|
|
82
115
|
});
|
|
116
|
+
const getCurrentRouteModel = cache(getCurrentRouteModelUncached);
|
|
83
117
|
const getAppLayoutModel = cache(async () => {
|
|
84
118
|
const user = production ? null : await getCurrentUser();
|
|
85
119
|
const style = {
|
|
@@ -119,9 +153,15 @@ export function createBonfireNext(options) {
|
|
|
119
153
|
return {
|
|
120
154
|
prototypes: {
|
|
121
155
|
getDashboardModel,
|
|
156
|
+
getRouteModel,
|
|
157
|
+
getCurrentRouteModel,
|
|
122
158
|
getSummary: prototypeCatalog.getSummary.bind(prototypeCatalog),
|
|
159
|
+
capabilities: {
|
|
160
|
+
deployment: deploymentAvailable,
|
|
161
|
+
},
|
|
123
162
|
lifecycle,
|
|
124
163
|
actions: prototypeActions,
|
|
164
|
+
agents: prototypeAgentActions,
|
|
125
165
|
routes: prototypeRoutes,
|
|
126
166
|
},
|
|
127
167
|
auth: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-bonfire-next.js","sourceRoot":"","sources":["../../src/server/create-bonfire-next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iCAAiC,GAIl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ACL,MAAM;SACP;KACF,CAAC;AACJ,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { createBonfireNext, type CreateBonfireNextOptions, } from "./create-bonfire-next.js";
|
|
1
|
+
export { createBonfireNext, type CreateBonfireNextOptions, type PrototypeCapabilities, } from "./create-bonfire-next.js";
|
|
2
|
+
export { createDeploymentProvider, DeploymentProviderError, type CreateDeploymentProviderOptions, type DeploymentProvider, type DeploymentProviderErrorKind, type DeploymentProviderResult, } from "@ebay-dt/bonfire-node";
|
|
2
3
|
export type { PrototypeActions } from "./prototype-actions.js";
|
|
4
|
+
export type { PrototypeAgentActions } from "./agent-actions.js";
|
|
3
5
|
export type { PrototypeRoutes } from "./prototype-routes.js";
|
|
6
|
+
export type { PrototypeRouteModel } from "./prototype-environment.js";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/server/index.js
CHANGED
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAKxB,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { type CreatePrototypeInput, type CreatePrototypeValue, type
|
|
1
|
+
import { type CreatePrototypeInput, type CreatePrototypeValue, type DeletePrototypeValue, type DeploymentValue, type DiscardPrototypeValue, type DuplicatePrototypeInput, type DuplicatePrototypeValue, type EditPrototypeInput, type EditPrototypeValue, type LifecycleResult, type PrototypeCommandInput, type SavePrototypeValue, type BonfireIdentity, type ThemeRegistry } from "@ebay-dt/bonfire-core";
|
|
2
2
|
import type { PrototypeLifecycle } from "@ebay-dt/bonfire-node";
|
|
3
3
|
export type PrototypeActions = {
|
|
4
4
|
create(input: CreatePrototypeInput): Promise<LifecycleResult<CreatePrototypeValue>>;
|
|
5
5
|
duplicate(input: DuplicatePrototypeInput): Promise<LifecycleResult<DuplicatePrototypeValue>>;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
edit(input: EditPrototypeInput): Promise<LifecycleResult<EditPrototypeValue>>;
|
|
7
|
+
delete(input: PrototypeCommandInput): Promise<LifecycleResult<DeletePrototypeValue>>;
|
|
8
|
+
save(input: PrototypeCommandInput): Promise<LifecycleResult<SavePrototypeValue>>;
|
|
9
|
+
discard(input: PrototypeCommandInput): Promise<LifecycleResult<DiscardPrototypeValue>>;
|
|
10
|
+
deploy(input: PrototypeCommandInput): Promise<LifecycleResult<DeploymentValue>>;
|
|
8
11
|
};
|
|
9
12
|
export type PrototypeActionsOptions = {
|
|
10
13
|
production: boolean;
|
|
11
14
|
getCurrentUser: () => Promise<BonfireIdentity | null>;
|
|
12
15
|
lifecycle: PrototypeLifecycle | null;
|
|
16
|
+
themeRegistry?: ThemeRegistry;
|
|
13
17
|
};
|
|
14
18
|
export declare function createPrototypeActions(options: PrototypeActionsOptions): PrototypeActions;
|
|
15
19
|
//# sourceMappingURL=prototype-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-actions.d.ts","sourceRoot":"","sources":["../../src/server/prototype-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,
|
|
1
|
+
{"version":3,"file":"prototype-actions.d.ts","sourceRoot":"","sources":["../../src/server/prototype-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CACJ,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClD,SAAS,CACP,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC9E,MAAM,CACJ,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClD,IAAI,CACF,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChD,OAAO,CACL,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACnD,MAAM,CACJ,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACtD,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AASF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CAwLlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lifecycleFailure, parseCreatePrototypeInput,
|
|
1
|
+
import { lifecycleFailure, parseCreatePrototypeInput, parseDuplicatePrototypeInput, parseEditPrototypeInput, parsePrototypeCommandInput, LifecycleInputError, } from "@ebay-dt/bonfire-core";
|
|
2
2
|
function logUnexpectedFailure(operation) {
|
|
3
3
|
console.error(`Bonfire prototype ${operation} failed unexpectedly.`);
|
|
4
4
|
}
|
|
@@ -11,7 +11,7 @@ export function createPrototypeActions(options) {
|
|
|
11
11
|
const identity = await options.getCurrentUser();
|
|
12
12
|
if (identity === null)
|
|
13
13
|
return lifecycleFailure("unauthenticated");
|
|
14
|
-
return await options.lifecycle.create(identity, parseCreatePrototypeInput(input));
|
|
14
|
+
return await options.lifecycle.create(identity, parseCreatePrototypeInput(input, options.themeRegistry));
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
17
|
if (error instanceof LifecycleInputError) {
|
|
@@ -39,6 +39,42 @@ export function createPrototypeActions(options) {
|
|
|
39
39
|
return lifecycleFailure("unexpected-failure");
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
async function edit(input) {
|
|
43
|
+
if (options.production || options.lifecycle === null) {
|
|
44
|
+
return lifecycleFailure("forbidden");
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const identity = await options.getCurrentUser();
|
|
48
|
+
if (identity === null)
|
|
49
|
+
return lifecycleFailure("unauthenticated");
|
|
50
|
+
return await options.lifecycle.edit(identity, parseEditPrototypeInput(input, options.themeRegistry));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error instanceof LifecycleInputError) {
|
|
54
|
+
return lifecycleFailure("invalid-input");
|
|
55
|
+
}
|
|
56
|
+
logUnexpectedFailure("edit");
|
|
57
|
+
return lifecycleFailure("unexpected-failure");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function deletePrototype(input) {
|
|
61
|
+
if (options.production || options.lifecycle === null) {
|
|
62
|
+
return lifecycleFailure("forbidden");
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const identity = await options.getCurrentUser();
|
|
66
|
+
if (identity === null)
|
|
67
|
+
return lifecycleFailure("unauthenticated");
|
|
68
|
+
return await options.lifecycle.delete(identity, parsePrototypeCommandInput(input));
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof LifecycleInputError) {
|
|
72
|
+
return lifecycleFailure("invalid-input");
|
|
73
|
+
}
|
|
74
|
+
logUnexpectedFailure("delete");
|
|
75
|
+
return lifecycleFailure("unexpected-failure");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
42
78
|
async function save(input) {
|
|
43
79
|
if (options.production || options.lifecycle === null) {
|
|
44
80
|
return lifecycleFailure("forbidden");
|
|
@@ -47,7 +83,7 @@ export function createPrototypeActions(options) {
|
|
|
47
83
|
const identity = await options.getCurrentUser();
|
|
48
84
|
if (identity === null)
|
|
49
85
|
return lifecycleFailure("unauthenticated");
|
|
50
|
-
return await options.lifecycle.save(identity,
|
|
86
|
+
return await options.lifecycle.save(identity, parsePrototypeCommandInput(input));
|
|
51
87
|
}
|
|
52
88
|
catch (error) {
|
|
53
89
|
if (error instanceof LifecycleInputError) {
|
|
@@ -65,7 +101,7 @@ export function createPrototypeActions(options) {
|
|
|
65
101
|
const identity = await options.getCurrentUser();
|
|
66
102
|
if (identity === null)
|
|
67
103
|
return lifecycleFailure("unauthenticated");
|
|
68
|
-
return await options.lifecycle.discard(identity,
|
|
104
|
+
return await options.lifecycle.discard(identity, parsePrototypeCommandInput(input));
|
|
69
105
|
}
|
|
70
106
|
catch (error) {
|
|
71
107
|
if (error instanceof LifecycleInputError) {
|
|
@@ -75,6 +111,49 @@ export function createPrototypeActions(options) {
|
|
|
75
111
|
return lifecycleFailure("unexpected-failure");
|
|
76
112
|
}
|
|
77
113
|
}
|
|
78
|
-
|
|
114
|
+
async function deploy(input) {
|
|
115
|
+
if (options.production)
|
|
116
|
+
return lifecycleFailure("forbidden");
|
|
117
|
+
let parsedInput;
|
|
118
|
+
try {
|
|
119
|
+
parsedInput = parsePrototypeCommandInput(input);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (error instanceof LifecycleInputError) {
|
|
123
|
+
return lifecycleFailure("invalid-input");
|
|
124
|
+
}
|
|
125
|
+
logUnexpectedFailure("deploy");
|
|
126
|
+
return lifecycleFailure("deployment-failure");
|
|
127
|
+
}
|
|
128
|
+
if (options.lifecycle === null) {
|
|
129
|
+
return lifecycleFailure("deployment-unavailable");
|
|
130
|
+
}
|
|
131
|
+
let identity;
|
|
132
|
+
try {
|
|
133
|
+
identity = await options.getCurrentUser();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
logUnexpectedFailure("deploy");
|
|
137
|
+
return lifecycleFailure("unexpected-failure");
|
|
138
|
+
}
|
|
139
|
+
if (identity === null)
|
|
140
|
+
return lifecycleFailure("unauthenticated");
|
|
141
|
+
try {
|
|
142
|
+
return await options.lifecycle.deploy(identity, parsedInput);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
logUnexpectedFailure("deploy");
|
|
146
|
+
return lifecycleFailure("deployment-failure");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
create,
|
|
151
|
+
duplicate,
|
|
152
|
+
edit,
|
|
153
|
+
delete: deletePrototype,
|
|
154
|
+
save,
|
|
155
|
+
discard,
|
|
156
|
+
deploy,
|
|
157
|
+
};
|
|
79
158
|
}
|
|
80
159
|
//# sourceMappingURL=prototype-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-actions.js","sourceRoot":"","sources":["../../src/server/prototype-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,
|
|
1
|
+
{"version":3,"file":"prototype-actions.js","sourceRoot":"","sources":["../../src/server/prototype-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,GAepB,MAAM,uBAAuB,CAAC;AAgC/B,SAAS,oBAAoB,CAC3B,SAC4E;IAE5E,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,uBAAuB,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAgC;IAEhC,KAAK,UAAU,MAAM,CACnB,KAA2B;QAE3B,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YACrD,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;YACh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,QAAQ,CAAC,CAAC;YAC/B,OAAO,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM;QACN,SAAS;QACT,IAAI;QACJ,MAAM,EAAE,eAAe;QACvB,IAAI;QACJ,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PrototypeDashboardModel, type BonfireIdentity } from "@ebay-dt/bonfire-core";
|
|
1
|
+
import { type PrototypeDashboardModel, type BonfireIdentity, type ThemeRegistry } from "@ebay-dt/bonfire-core";
|
|
2
2
|
import type { PrototypeCatalogLike } from "@ebay-dt/bonfire-node";
|
|
3
3
|
export type PrototypeDashboardSearchParams = Record<string, string | string[] | undefined>;
|
|
4
4
|
type DashboardSearchParamsInput = PrototypeDashboardSearchParams | Promise<PrototypeDashboardSearchParams> | undefined;
|
|
@@ -7,6 +7,7 @@ type PrototypeDashboardLoaderOptions = {
|
|
|
7
7
|
production: boolean;
|
|
8
8
|
catalog: PrototypeCatalogLike;
|
|
9
9
|
getCurrentUser: () => Promise<BonfireIdentity | null>;
|
|
10
|
+
themeRegistry?: ThemeRegistry;
|
|
10
11
|
};
|
|
11
12
|
export declare function createPrototypeDashboardModelLoader(options: PrototypeDashboardLoaderOptions): (searchParams?: DashboardSearchParamsInput) => Promise<PrototypeDashboardModel>;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-dashboard.d.ts","sourceRoot":"","sources":["../../src/server/prototype-dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"prototype-dashboard.d.ts","sourceRoot":"","sources":["../../src/server/prototype-dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,MAAM,8BAA8B,GAAG,MAAM,CACjD,MAAM,EACN,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAC9B,CAAC;AAEF,KAAK,0BAA0B,GAC3B,8BAA8B,GAC9B,OAAO,CAAC,8BAA8B,CAAC,GACvC,SAAS,CAAC;AAEd,KAAK,+BAA+B,GAAG;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,cAAc,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACtD,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAkDF,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,+BAA+B,mBAGvB,0BAA0B,KACxC,OAAO,CAAC,uBAAuB,CAAC,CAuBpC"}
|
|
@@ -59,6 +59,9 @@ export function createPrototypeDashboardModelLoader(options) {
|
|
|
59
59
|
authorOptions: getPrototypeAuthorOptions(summaries, currentLogin),
|
|
60
60
|
showMine: currentUser !== null,
|
|
61
61
|
summaries: visibleSummaries,
|
|
62
|
+
...(options.themeRegistry === undefined
|
|
63
|
+
? {}
|
|
64
|
+
: { themeRegistry: options.themeRegistry }),
|
|
62
65
|
};
|
|
63
66
|
};
|
|
64
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-dashboard.js","sourceRoot":"","sources":["../../src/server/prototype-dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"prototype-dashboard.js","sourceRoot":"","sources":["../../src/server/prototype-dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,E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AAa,EAAE,CAAC;SAC9C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PrototypeRef, type PrototypeTheme, type ThemeRegistry } from "@ebay-dt/bonfire-core";
|
|
2
|
+
import type { PrototypeCatalogLike } from "@ebay-dt/bonfire-node";
|
|
3
|
+
export type PrototypeRouteModel = {
|
|
4
|
+
ref: PrototypeRef;
|
|
5
|
+
url: string;
|
|
6
|
+
theme?: PrototypeTheme;
|
|
7
|
+
themeRegistry?: ThemeRegistry;
|
|
8
|
+
};
|
|
9
|
+
type PrototypeEnvironmentModelLoaderOptions = {
|
|
10
|
+
catalog: PrototypeCatalogLike;
|
|
11
|
+
themeRegistry?: ThemeRegistry;
|
|
12
|
+
};
|
|
13
|
+
declare function createPrototypeEnvironmentModelLoader(options: PrototypeEnvironmentModelLoaderOptions): {
|
|
14
|
+
getRouteModel: (input: PrototypeRef) => Promise<PrototypeRouteModel | null>;
|
|
15
|
+
getCurrentRouteModel: () => Promise<PrototypeRouteModel | null>;
|
|
16
|
+
};
|
|
17
|
+
export { createPrototypeEnvironmentModelLoader };
|
|
18
|
+
//# sourceMappingURL=prototype-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-environment.d.ts","sourceRoot":"","sources":["../../src/server/prototype-environment.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,OAAO,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAeF,iBAAS,qCAAqC,CAC5C,OAAO,EAAE,sCAAsC;2BAGtC,YAAY,KAClB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;gCAyCC,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;EAU3E;AAED,OAAO,EAAE,qCAAqC,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { headers } from "next/headers.js";
|
|
2
|
+
import { createDefaultPrototypeTheme, definePrototypeRef, parsePrototypeTheme, parsePrototypePath, } from "@ebay-dt/bonfire-core";
|
|
3
|
+
import { BONFIRE_PATHNAME_HEADER } from "./auth-boundary.js";
|
|
4
|
+
function normalizeRouteTheme(theme, themeRegistry) {
|
|
5
|
+
if (theme !== undefined) {
|
|
6
|
+
return parsePrototypeTheme(theme, "theme", themeRegistry);
|
|
7
|
+
}
|
|
8
|
+
if (themeRegistry !== undefined) {
|
|
9
|
+
return createDefaultPrototypeTheme(themeRegistry);
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
function createPrototypeEnvironmentModelLoader(options) {
|
|
14
|
+
async function getRouteModel(input) {
|
|
15
|
+
let ref;
|
|
16
|
+
try {
|
|
17
|
+
ref = definePrototypeRef(input);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const summary = await options.catalog.getSummary(ref);
|
|
23
|
+
if (summary === null)
|
|
24
|
+
return null;
|
|
25
|
+
let theme;
|
|
26
|
+
try {
|
|
27
|
+
theme = normalizeRouteTheme(summary.theme, options.themeRegistry);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ref: summary.ref,
|
|
34
|
+
url: summary.url,
|
|
35
|
+
...(theme === undefined ? {} : { theme }),
|
|
36
|
+
...(options.themeRegistry === undefined
|
|
37
|
+
? {}
|
|
38
|
+
: { themeRegistry: options.themeRegistry }),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolves the route model for the request currently being rendered,
|
|
43
|
+
* using the pathname forwarded by `createAuthProxy` (see
|
|
44
|
+
* `BONFIRE_PATHNAME_HEADER`). Intended for a shared prototype route-group
|
|
45
|
+
* layout that mounts `PrototypeEnvironment` around both `AppHeader` and
|
|
46
|
+
* `{children}`. The layout is entered from the dashboard and intentionally
|
|
47
|
+
* remains stable while navigating within the prototype route group.
|
|
48
|
+
*
|
|
49
|
+
* Returns `null` when the current request is not a prototype route, or
|
|
50
|
+
* when the pathname header is unavailable (for example, a request that
|
|
51
|
+
* bypassed the proxy). Hosts that support soft navigation between
|
|
52
|
+
* prototypes should resolve by prototype-specific route params instead.
|
|
53
|
+
*/
|
|
54
|
+
async function getCurrentRouteModel() {
|
|
55
|
+
const requestHeaders = await headers();
|
|
56
|
+
const pathname = requestHeaders.get(BONFIRE_PATHNAME_HEADER);
|
|
57
|
+
if (pathname === null)
|
|
58
|
+
return null;
|
|
59
|
+
const ref = parsePrototypePath(pathname);
|
|
60
|
+
if (ref === null)
|
|
61
|
+
return null;
|
|
62
|
+
return getRouteModel(ref);
|
|
63
|
+
}
|
|
64
|
+
return { getRouteModel, getCurrentRouteModel };
|
|
65
|
+
}
|
|
66
|
+
export { createPrototypeEnvironmentModelLoader };
|
|
67
|
+
//# sourceMappingURL=prototype-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-environment.js","sourceRoot":"","sources":["../../src/server/prototype-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GAInB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBA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AC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,UAAU,oBAAoB;QACjC,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAC7D,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,GAAG,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;AACjD,CAAC;AAED,OAAO,EAAE,qCAAqC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-routes.d.ts","sourceRoot":"","sources":["../../src/server/prototype-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAEL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"prototype-routes.d.ts","sourceRoot":"","sources":["../../src/server/prototype-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACtD,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrC,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAChD,CAAC;AAyBF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,qBAAqB,GAC7B,eAAe,CA2GjB"}
|
|
@@ -6,8 +6,13 @@ function errorResponse(status) {
|
|
|
6
6
|
headers: { "Cache-Control": "no-store" },
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
function dirtyMessage(
|
|
10
|
-
return encoder.encode(`data: ${JSON.stringify({
|
|
9
|
+
function dirtyMessage(value) {
|
|
10
|
+
return encoder.encode(`data: ${JSON.stringify({
|
|
11
|
+
dirty: value.status === "dirty",
|
|
12
|
+
...(value.previewUrl !== undefined
|
|
13
|
+
? { previewUrl: value.previewUrl }
|
|
14
|
+
: {}),
|
|
15
|
+
})}\n\n`);
|
|
11
16
|
}
|
|
12
17
|
function queryValue(request, name) {
|
|
13
18
|
const values = request.nextUrl.searchParams.getAll(name);
|
|
@@ -90,7 +95,7 @@ export function createPrototypeRoutes(options) {
|
|
|
90
95
|
return;
|
|
91
96
|
}
|
|
92
97
|
try {
|
|
93
|
-
controller.enqueue(dirtyMessage(initial.value
|
|
98
|
+
controller.enqueue(dirtyMessage(initial.value));
|
|
94
99
|
unsubscribe = watcher.subscribe({
|
|
95
100
|
ref,
|
|
96
101
|
initial: initial.value,
|
|
@@ -98,7 +103,7 @@ export function createPrototypeRoutes(options) {
|
|
|
98
103
|
if (closed)
|
|
99
104
|
return;
|
|
100
105
|
try {
|
|
101
|
-
controller.enqueue(dirtyMessage(value
|
|
106
|
+
controller.enqueue(dirtyMessage(value));
|
|
102
107
|
}
|
|
103
108
|
catch {
|
|
104
109
|
close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-routes.js","sourceRoot":"","sources":["../../src/server/prototype-routes.ts"],"names":[],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C,SAAS,CAAC;wBAC9B,GAAG;wBACH,OAAO,EAAE,OAAO,CAAC,KAAK;wBACtB,QAAQ,CAAC,KAAK;4BACZ,IAAI,MAAM;gCAAE,OAAO;4BACnB,IAAI,CAAC;gCACH,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC1C,CAAC;4BAAC,MAAM,CAAC;gCACP,KAAK,EAAE,CAAC;4BACV,CAAC;wBACH,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;gBAAC,MAAM,CAAC;oBACP,KAAK,EAAE,CAAC;gBACV,CAAC;YACH,CAAC;YACD,MAAM;gBACJ,WAAW,EAAE,CAAC;YAChB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE;YAC1B,OAAO,EAAE;gBACP,eAAe,EAAE,oBAAoB;gBACrC,UAAU,EAAE,YAAY;gBACxB,cAAc,EAAE,mBAAmB;aACpC;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebay-dt/bonfire-next",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"description": "Next.js server integration for Bonfire.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ebay-dt/bonfire-core": "0.1.0-alpha.
|
|
35
|
-
"@ebay-dt/bonfire-node": "0.1.0-alpha.
|
|
34
|
+
"@ebay-dt/bonfire-core": "0.1.0-alpha.1",
|
|
35
|
+
"@ebay-dt/bonfire-node": "0.1.0-alpha.1",
|
|
36
36
|
"jose": "^6.1.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@ebay-dt/bonfire-react": "0.1.0-alpha.
|
|
39
|
+
"@ebay-dt/bonfire-react": "0.1.0-alpha.1",
|
|
40
40
|
"next": ">=16.2 <17",
|
|
41
41
|
"react": ">=19.2 <20",
|
|
42
42
|
"react-dom": ">=19.2 <20"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@ebay-dt/bonfire-react": "0.1.0-alpha.
|
|
45
|
+
"@ebay-dt/bonfire-react": "0.1.0-alpha.1",
|
|
46
46
|
"@repo/eslint-config": "0.0.0",
|
|
47
47
|
"@repo/typescript-config": "0.0.0",
|
|
48
48
|
"@types/node": "20.19.43",
|