@clickraft/cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -923,7 +923,7 @@ var DeviceAuthorizationRequestSchema = z4.object({
923
923
  });
924
924
  var DeviceAuthorizationResponseSchema = z4.object({
925
925
  device_code: z4.string(),
926
- user_code: z4.string().regex(/^[A-Z0-9]{4}-[A-Z0-9]{4}$/),
926
+ user_code: z4.string().min(1),
927
927
  verification_uri: z4.string().url(),
928
928
  verification_uri_complete: z4.string().url().optional(),
929
929
  expires_in: z4.number().int().positive(),
@@ -1740,9 +1740,14 @@ async function requestDeviceAuthorization(opts) {
1740
1740
  const parsed = parseJson(text, "authorization");
1741
1741
  const validated = DeviceAuthorizationResponseSchema.safeParse(parsed);
1742
1742
  if (!validated.success) {
1743
- throw new AuthError(
1744
- "AUTH_TOKEN_INVALID",
1745
- "Authorization endpoint response failed schema validation.",
1743
+ throw new ApiError(
1744
+ "SCHEMA_MISMATCH",
1745
+ "Authorization endpoint response did not match the expected schema.",
1746
+ {
1747
+ status: resp.statusCode,
1748
+ retryable: false,
1749
+ redactedBody: redactTokenLikeFields(truncate(text))
1750
+ },
1746
1751
  validated.error
1747
1752
  );
1748
1753
  }
@@ -2143,16 +2148,19 @@ function inspectTelemetry(options = {}) {
2143
2148
  // src/commands/tokens/list.ts
2144
2149
  import { z as z6 } from "zod";
2145
2150
  var TokenRowSchema = z6.object({
2146
- id: z6.string(),
2147
- prefix: z6.string(),
2151
+ id: z6.string().uuid(),
2152
+ organizationId: z6.string().uuid(),
2153
+ userId: z6.string().uuid(),
2154
+ clientId: z6.string(),
2155
+ tokenPrefix: z6.string(),
2148
2156
  name: z6.string().nullable(),
2149
2157
  scopes: z6.array(z6.string()),
2150
- last_used_at: z6.string().nullable(),
2151
- expires_at: z6.string(),
2152
- created_at: z6.string()
2158
+ lastUsedAt: z6.string().nullable(),
2159
+ expiresAt: z6.string(),
2160
+ createdAt: z6.string()
2153
2161
  }).strict();
2154
2162
  var TokensListResponseSchema = z6.object({
2155
- items: z6.array(TokenRowSchema)
2163
+ tokens: z6.array(TokenRowSchema)
2156
2164
  }).strict();
2157
2165
  async function listTokens(options) {
2158
2166
  const config = await loadConfig({
@@ -2170,7 +2178,7 @@ async function listTokens(options) {
2170
2178
  responseSchema: TokensListResponseSchema,
2171
2179
  signal: options.signal
2172
2180
  });
2173
- return data.items;
2181
+ return data.tokens;
2174
2182
  }
2175
2183
 
2176
2184
  // src/errors/format.ts
@@ -2474,11 +2482,11 @@ function renderTokensList(rows, out) {
2474
2482
  }
2475
2483
  const headers = ["PREFIX", "NAME", "SCOPES", "LAST USED", "EXPIRES"];
2476
2484
  const data = rows.map((row) => [
2477
- row.prefix,
2485
+ row.tokenPrefix,
2478
2486
  row.name ?? "\u2014",
2479
2487
  row.scopes.join(",") || "\u2014",
2480
- row.last_used_at ?? "never",
2481
- row.expires_at
2488
+ row.lastUsedAt ?? "never",
2489
+ row.expiresAt
2482
2490
  ]);
2483
2491
  const widths = headers.map(
2484
2492
  (header, i) => Math.max(header.length, ...data.map((cells) => cells[i].length))