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
66 changes: 35 additions & 31 deletions UPSTREAM_DIFF.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
# Upstream API Diff

> Old routes: 36 · New routes: 58
Comparing `@photon-ai/dashboard-api` **1.2.0 → 1.6.1** (packaged for
`photon-hq/dashboard@v1.6.4`, sha `44c3931589ed3c77bb553016706c9334d1a8bd27`).

Note: dashboard `v1.6.4` did not publish a new `@photon-ai/dashboard-api`
version. The API type contract is unchanged from `v1.6.3`; the release only
tightens SMS OTP send handling to require an authenticated session
([dashboard#233](https://github.com/photon-hq/dashboard/pull/233)). The
`1.2.0 → 1.6.1` bump below therefore catches this CLI up to the current
published contract.

> Old routes: 80 · New routes: 87

## 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-emails` | `PATCH` |
| `api.profile.promotional-status` | `GET` |
| `api.projects.:id.call-registry.profile` | `GET` |
| `api.projects.:id.call-registry.profile` | `PATCH` |
| `api.projects.:id.call-registry.profile` | `PUT` |
| `api.projects.:id.call-registry.registrations` | `GET` |
| `api.projects.:id.call-registry.registrations` | `POST` |

## Removed Routes

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

## Response-shape Changes

All route response bodies in the 1.6.x bundled `.d.ts` are exposed as
`Record<string, any>` (index-signature only) rather than the concrete
per-status objects that shipped in 1.2.0. Commands that previously read
strongly-typed fields off `data` still compile (index access is permitted),
but `Array.prototype.map` callbacks lose their inferred element type, which
is the concrete typecheck fallout addressed in this PR (see
`src/commands/projects.ts` list command and `src/commands/spectrum/users.ts`
list command — both now cast `data` to a `Project[]` / `SpectrumUser[]` DTO
at the API boundary).

## Summary

- **23** added
- **1** removed
- **0** changed
- **35** unchanged
- **7** added
- **0** removed
- **0** route paths changed
- **80** unchanged paths (all with degraded response typing)
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.6.1",
"@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 @@ -65,7 +66,7 @@ function registerListCommand(projects: Command): void {
die(`Failed to list projects: ${formatApiError(error)}`);
}

const list = data ?? [];
const list = (data ?? []) as Project[];
if (opts.json) {
printJson(list);
return;
Expand Down
11 changes: 2 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 } from "~/lib/types.ts";

export function registerSpectrumUsers(spectrum: Command): void {
const users = spectrum
Expand Down Expand Up @@ -37,7 +38,7 @@ 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 list = (data?.users ?? []) as SpectrumUser[];
if (opts.json) return printJson(list);
if (list.length === 0) {
console.log(c.dim("No Spectrum users yet."));
Expand Down Expand Up @@ -142,14 +143,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
24 changes: 23 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,26 @@
* in command logic.
*/

export {};
export interface Project {
id: string;
name: string;
location: string;
status: string;
platforms: string[];
createdAt: string;
updatedAt: string;
isOwner?: boolean;
template?: boolean;
observability?: boolean;
slackChannelId?: string | null;
slackTeamId?: string | null;
projectSecret?: string | null;
}

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