Files
stuffbox-sdk/tests/connection-input-types.ts
T
cyph3rasi bb04d47a29 Release automatic callback setup in SDK 0.2.0
Hop-State: A_06FPARPGMNVEAN3XBVH0QD8
Hop-Proposal: R_06FPARNXMP3DGP5VQGGX4Z8
Hop-Task: T_06FPAR9KH2V5ED7V65JEN00
Hop-Attempt: AT_06FPAR9KH3NZ1CV8RGPJDSG
2026-07-15 03:46:42 -07:00

25 lines
1011 B
TypeScript

import type { CreateConnectionRequestInput } from "../src/index.js";
const fields = {
callbackUrl: "https://app.example/stuffbox/callback",
codeChallenge: "c".repeat(43),
scopes: ["assets:read"] as const,
state: "state-with-enough-entropy",
};
const automatic: CreateConnectionRequestInput = fields;
const returning: CreateConnectionRequestInput = { ...fields, clientId: "app_public" };
const legacyAutomatic: CreateConnectionRequestInput = { ...fields, selfHosted: true };
const legacyReturning: CreateConnectionRequestInput = {
...fields,
clientId: "app_public",
selfHosted: false,
};
// @ts-expect-error An automatic request cannot also send a client ID.
const mixed: CreateConnectionRequestInput = { ...fields, clientId: "app_public", selfHosted: true };
// @ts-expect-error The old false marker requires a client ID.
const missingClient: CreateConnectionRequestInput = { ...fields, selfHosted: false };
void [automatic, returning, legacyAutomatic, legacyReturning, mixed, missingClient];