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
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
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 {};
/**
* Project row as returned by `GET /api/projects` and `GET /api/projects/:id`.
* The upstream `.d.ts` for 1.6.x publishes these bodies as `Record<string, any>`
* (index-signature only), so we cast to this shape at the boundary to get typed
* field access in list/show/delete commands.
*/
export interface Project {
id: string;
name: string;
location: string;
status: string;
platforms: string[];
isOwner: boolean;
template: boolean;
observability: boolean;
slackChannelId?: string | null;
slackTeamId?: string | null;
projectSecret?: string | null;
createdAt: string;
updatedAt: string;
}

/**
* Spectrum user row as returned by `GET /api/projects/:id/spectrum/users`
* and echoed back by `POST` on the same route. Same rationale as `Project`:
* the 1.6.x published response type is a bare index signature.
*/
export interface SpectrumUser {
id: string;
firstName?: string | null;
lastName?: string | null;
email?: string | null;
phoneNumber?: string | null;
}
Loading