@buildinternet/uploads 0.13.0 → 0.13.1

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/client.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { UploadsClientConfig } from "./config.js";
2
+ /** Scoped-operator-token permission scope. */
3
+ export type TokenScope = "files:read" | "files:write" | "files:delete" | "operator:read" | "operator:write" | "workspace:invite" | "workspace:manage";
2
4
  /** Allowlisted object provenance (maps to X-Uploads-Meta-* on put). */
3
5
  export type ProvenanceInput = {
4
6
  client?: string;
@@ -212,7 +214,7 @@ export interface EnrollmentExchangeResult {
212
214
  apiUrl?: string;
213
215
  workspace: string;
214
216
  token: string;
215
- scopes?: Array<"files:read" | "files:write" | "files:delete">;
217
+ scopes?: Array<TokenScope>;
216
218
  expiresAt?: string;
217
219
  }
218
220
  export interface EnrollmentCreateResult {
@@ -229,9 +231,16 @@ export declare function createEnrollment(apiUrl: string, adminToken: string, inp
229
231
  email?: string;
230
232
  enrollmentSeconds?: number;
231
233
  tokenExpiresInSeconds?: number;
232
- scopes?: Array<"files:read" | "files:write" | "files:delete">;
234
+ scopes?: Array<TokenScope>;
233
235
  }): Promise<EnrollmentCreateResult>;
234
- /** Static OAuth client id allowlisted by the auth worker's `validateClient`. */
236
+ /**
237
+ * OAuth client id for the device flow. Registered server-side as a managed
238
+ * official `oauth_client` row (seeded by apps/auth migration
239
+ * 20260719000000_seed_cli_oauth_client.sql — issue #251): public PKCE client,
240
+ * no secret, device-code grant only. The auth worker's device endpoints
241
+ * validate this id against that table, so operators can disable it from
242
+ * /admin/oauth. The literal must match the seeded row's client_id.
243
+ */
235
244
  export declare const DEVICE_CLIENT_ID = "uploads-cli";
236
245
  /**
237
246
  * User-Agent for device-flow requests. Stored on the Better Auth session row
@@ -302,7 +311,7 @@ export declare function createWorkspaceRequest(apiUrl: string, accessToken: stri
302
311
  export interface MintTokenResult {
303
312
  token: string;
304
313
  workspace: string;
305
- scopes: Array<"files:read" | "files:write" | "files:delete">;
314
+ scopes: Array<TokenScope>;
306
315
  label: string | null;
307
316
  expiresAt: string | null;
308
317
  }
@@ -332,7 +341,7 @@ export declare function createWorkspaceInvite(apiUrl: string, accessToken: strin
332
341
  */
333
342
  export declare function mintWorkspaceToken(apiUrl: string, accessToken: string, input: {
334
343
  workspace: string;
335
- scopes?: Array<"files:read" | "files:write" | "files:delete">;
344
+ scopes?: Array<TokenScope>;
336
345
  label?: string;
337
346
  ttlSeconds?: number;
338
347
  }): Promise<MintTokenResult>;
package/dist/client.js CHANGED
@@ -37,7 +37,14 @@ export function createEnrollment(apiUrl, adminToken, input) {
37
37
  // D5). Better Auth's `device.code`/`device.token` endpoints take
38
38
  // `application/json` bodies, NOT the RFC's form-encoding — the JSON shapes
39
39
  // below are what the worker expects.
40
- /** Static OAuth client id allowlisted by the auth worker's `validateClient`. */
40
+ /**
41
+ * OAuth client id for the device flow. Registered server-side as a managed
42
+ * official `oauth_client` row (seeded by apps/auth migration
43
+ * 20260719000000_seed_cli_oauth_client.sql — issue #251): public PKCE client,
44
+ * no secret, device-code grant only. The auth worker's device endpoints
45
+ * validate this id against that table, so operators can disable it from
46
+ * /admin/oauth. The literal must match the seeded row's client_id.
47
+ */
41
48
  export const DEVICE_CLIENT_ID = "uploads-cli";
42
49
  /**
43
50
  * User-Agent for device-flow requests. Stored on the Better Auth session row
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/uploads",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "CLI and client for uploads.sh — workspace-scoped image hosting for GitHub embeds",
5
5
  "type": "module",
6
6
  "sideEffects": false,