Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 21 additions & 31 deletions UPSTREAM_DIFF.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
# Upstream API Diff

> Old routes: 36 · New routes: 58
> `@photon-ai/dashboard-api` `1.2.0` → `1.3.0` (dashboard `v1.3.0`)

## Added Routes

| Route | Method |
|-------|--------|
| `api.profile.spectrum-updates` | `PATCH` |
| `api.projects.:id.members` | `GET` |
| `api.projects.:id.members` | `POST` |
| `api.projects.:id.members.:memberUserId` | `DELETE` |
| `api.projects.:id.slack` | `DELETE` |
| `api.projects.:id.slack` | `GET` |
| `api.projects.:id.slack` | `PUT` |
| `api.projects.:id.slack.installations` | `GET` |
| `api.projects.:id.slack.installations.:teamId` | `DELETE` |
| `api.projects.:id.spectrum.avatar` | `DELETE` |
| `api.projects.:id.spectrum.avatar.commit` | `POST` |
| `api.projects.:id.spectrum.avatar.upload` | `POST` |
| `api.projects.:id.voice.imessage-enabled` | `PATCH` |
| `api.projects.:id.voice.settings` | `GET` |
| `api.projects.:id.voice.sip-inbound` | `DELETE` |
| `api.projects.:id.voice.sip-inbound` | `PATCH` |
| `api.projects.:id.webhooks` | `GET` |
| `api.projects.:id.webhooks` | `POST` |
| `api.projects.:id.webhooks.:webhookId` | `DELETE` |
| `api.projects.:id.whatsapp.templates` | `GET` |
| `api.projects.:id.whatsapp.templates` | `POST` |
| `api.projects.:id.whatsapp.templates.:templateId` | `DELETE` |
| `api.projects.:id.whatsapp.templates.:templateId` | `PATCH` |
| `api.profile.promotional-status` | `GET` |
| `api.profile.promotional-emails` | `PATCH` |

## Removed Routes

| Route | Method |
|-------|--------|
| `api.projects.:id.spectrum.avatar-upload-url` | `GET` |
_(none)_

## Schema Changes

The 1.3.0 type-contract drop dropped every named response interface
(`SpectrumUser`, `WhatsAppTemplate`, etc.) and degraded most route response
bodies to opaque records (`{ [x: string]: any; ... }`). Two CLI list commands
relied on the previously inferred Eden treaty types and now need explicit
casts at the API boundary:

- `src/commands/projects.ts` — `GET /api/projects` (list)
- `src/commands/spectrum/users.ts` — `GET /api/projects/:id/spectrum/users`

DTOs added in `src/lib/types.ts`: `Project`, `SpectrumUser`, `SpectrumUsersPage`.

## Summary

- **23** added
- **1** removed
- **0** changed
- **35** unchanged
- **2** added
- **0** removed
- **0** otherwise changed
- All other routes unchanged at the route level; response typing degraded across the board (see Schema Changes)
5 changes: 3 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"prepublishOnly": "bun run typecheck && bun run build"
},
"devDependencies": {
"@photon-ai/dashboard-api": "1.2.0",
"@photon-ai/dashboard-api": "1.3.0",
"@types/bun": "latest",
"@types/node": "^25.6.2",
"@types/update-notifier": "^6.0.8",
Expand Down
3 changes: 2 additions & 1 deletion src/commands/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { SessionExpiredError } from "~/lib/errors.ts";
import { confirmDestructive } from "~/lib/interactive.ts";
import { c, die, formatApiError, printJson, printTable } from "~/lib/output.ts";
import { isInteractive } from "~/lib/tty.ts";
import type { Project } from "~/lib/types.ts";

/** Platforms accepted by `projects create` (mirrors the API's create body). */
const PLATFORMS = ["imessage", "whatsapp_business", "voice"] as const;
Expand Down Expand Up @@ -64,7 +65,7 @@ function registerListCommand(projects: Command): void {
die(`Failed to list projects: ${formatApiError(error)}`);
}

const list = data ?? [];
const list = (data as Project[] | null | undefined) ?? [];
if (opts.json) {
printJson(list);
return;
Expand Down
12 changes: 3 additions & 9 deletions src/commands/spectrum/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SessionExpiredError } from "~/lib/errors.ts";
import { confirmDestructive } from "~/lib/interactive.ts";
import { c, die, formatApiError, printJson, printTable } from "~/lib/output.ts";
import { isInteractive } from "~/lib/tty.ts";
import type { SpectrumUser, SpectrumUsersPage } from "~/lib/types.ts";

export function registerSpectrumUsers(spectrum: Command): void {
const users = spectrum
Expand Down Expand Up @@ -37,7 +38,8 @@ export function registerSpectrumUsers(spectrum: Command): void {
if (status === 401) throw new SessionExpiredError(resolved.name);
if (error) die(`Failed to list users: ${formatApiError(error)}`);

const list = data?.users ?? [];
const page = data as SpectrumUsersPage | null | undefined;
const list = page?.users ?? [];
if (opts.json) return printJson(list);
if (list.length === 0) {
console.log(c.dim("No Spectrum users yet."));
Expand Down Expand Up @@ -142,14 +144,6 @@ export function registerSpectrumUsers(spectrum: Command): void {
});
}

interface SpectrumUser {
id: string;
firstName?: string | null;
lastName?: string | null;
email?: string | null;
phoneNumber?: string | null;
}

interface FilledAdd {
firstName: string;
lastName: string;
Expand Down
35 changes: 34 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,37 @@
* in command logic.
*/

export {};
/**
* Subset of fields the CLI reads from a project. Mirrors what the dashboard
* returns from `GET /api/projects` (list) and `GET /api/projects/:id` (show).
* Kept as one shared shape so list/show/delete don't drift apart.
*/
export interface Project {
id: string;
name: string;
status: string;
location: string;
platforms: string[];
template: boolean;
observability: boolean;
slackChannelId: string | null;
slackTeamId: string | null;
isOwner?: boolean;
createdAt: string | Date;
updatedAt: string | Date;
}

/** A Spectrum user as returned by `GET /api/projects/:id/spectrum/users`. */
export interface SpectrumUser {
id: string;
firstName?: string | null;
lastName?: string | null;
email?: string | null;
phoneNumber?: string | null;
}

/** Response envelope for the Spectrum users list route. */
export interface SpectrumUsersPage {
total: number;
users: SpectrumUser[];
}
Loading