init: initial commit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giuliano Silvestro
2026-04-30 08:26:34 +10:00
commit 262a56c2e5
10 changed files with 2914 additions and 0 deletions

47
src/types.ts Normal file
View File

@@ -0,0 +1,47 @@
// Hand-written shared types.
//
// Per-endpoint request/response types come from the generated OpenAPI types
// (see ./generated/openapi.d.ts after running `sync-spec`). The shapes here
// are the ones that exist *around* every request — wrappers, pagination,
// auth payloads — and don't belong to any one endpoint.
/** Successful response envelope used by most v1 endpoints. */
export interface ArcadiaEnvelope<T> {
data: T;
meta?: ArcadiaMeta;
}
/** Optional metadata block on list responses (pagination, totals, etc). */
export interface ArcadiaMeta {
page?: number;
per_page?: number;
total?: number;
total_pages?: number;
request_id?: string;
[key: string]: unknown;
}
/** Auth-token pair returned by /auth/login, /auth/refresh, OAuth callbacks.
* `expires_in` is seconds-from-now (Phoenix Guardian default); compute the
* absolute expiry on the client if needed. */
export interface ArcadiaAuthTokens {
access_token: string;
refresh_token?: string;
expires_in?: number;
token_type?: "Bearer";
}
/** Minimal user shape used by useArcadia / auth-ui until generated types
* cover the whole User schema. Apps should prefer generated types when
* available. */
export interface ArcadiaUser {
id: string;
email: string;
name?: string;
tenant_id?: string;
roles?: string[];
}
/** Tenant identifier — either a UUID string, or a slug if the deployment
* uses friendly tenant slugs. The client doesn't enforce a format. */
export type ArcadiaTenantId = string;