@shipstatic/types 1.1.0 → 2.1.0

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.d.ts CHANGED
@@ -405,7 +405,7 @@ export declare class ShipError extends Error {
405
405
  *
406
406
  * **Telemetry pattern — `details: { internal: '<tag>' }`.** When the
407
407
  * server creates an auth error with an `internal` key in `details`
408
- * (e.g. `{ internal: 'jwt_missing_subject' }`), `toResponse()` strips the
408
+ * (e.g. `{ internal: 'session_invalid' }`), `toResponse()` strips the
409
409
  * entire `details` object before serialization. This keeps the wire
410
410
  * response a clean "Authentication failed" while preserving granular
411
411
  * server-side telemetry (which strategy/check failed) for logs and tests.
@@ -552,13 +552,33 @@ export declare const DEPLOY_TOKEN: {
552
552
  readonly TOTAL_LENGTH: 70;
553
553
  };
554
554
  export declare const AuthMethod: {
555
- readonly JWT: "jwt";
555
+ readonly SESSION: "session";
556
556
  readonly API_KEY: "apiKey";
557
557
  readonly TOKEN: "token";
558
+ readonly OAUTH: "oauth";
558
559
  readonly WEBHOOK: "webhook";
559
560
  readonly SYSTEM: "system";
560
561
  };
561
562
  export type AuthMethodType = typeof AuthMethod[keyof typeof AuthMethod];
563
+ /**
564
+ * OAuth scope vocabulary for delegated third-party access tokens.
565
+ * Single source of truth used by the authorization server (advertised in
566
+ * `scopes_supported`), the API's scope-enforcement middleware, and consent UI
567
+ * copy. The standard `offline_access` scope (refresh tokens) is not platform
568
+ * vocabulary and is deliberately absent — the middleware never checks it.
569
+ *
570
+ * Deliberately absent by design: any `tokens:*` scope, `account:write`, or
571
+ * admin scope — a delegated app must never mint credentials, delete the
572
+ * account, or act as admin.
573
+ */
574
+ export declare const OAuthScope: {
575
+ readonly ACCOUNT_READ: "account:read";
576
+ readonly DEPLOYMENTS_READ: "deployments:read";
577
+ readonly DEPLOYMENTS_WRITE: "deployments:write";
578
+ readonly DOMAINS_READ: "domains:read";
579
+ readonly DOMAINS_WRITE: "domains:write";
580
+ };
581
+ export type OAuthScopeType = typeof OAuthScope[keyof typeof OAuthScope];
562
582
  export declare const DEPLOYMENT_CONFIG_FILENAME = "ship.json";
563
583
  /** Default ship.json config for SPA routing. Single source of truth — used by both API and SDK. */
564
584
  export declare const SPA_DEFAULT_CONFIG: {
package/dist/index.js CHANGED
@@ -130,7 +130,7 @@ export class ShipError extends Error {
130
130
  toResponse() {
131
131
  // Strip authentication details when they carry an `internal` telemetry
132
132
  // tag (see `ShipError.authentication` JSDoc) — these are server-side
133
- // diagnostics like 'jwt_missing_subject' that must not leak to clients.
133
+ // diagnostics like 'session_invalid' that must not leak to clients.
134
134
  const authDetails = this.details;
135
135
  const details = this.type === ErrorType.Authentication && authDetails?.internal
136
136
  ? undefined
@@ -255,7 +255,7 @@ export class ShipError extends Error {
255
255
  *
256
256
  * **Telemetry pattern — `details: { internal: '<tag>' }`.** When the
257
257
  * server creates an auth error with an `internal` key in `details`
258
- * (e.g. `{ internal: 'jwt_missing_subject' }`), `toResponse()` strips the
258
+ * (e.g. `{ internal: 'session_invalid' }`), `toResponse()` strips the
259
259
  * entire `details` object before serialization. This keeps the wire
260
260
  * response a clean "Authentication failed" while preserving granular
261
261
  * server-side telemetry (which strategy/check failed) for logs and tests.
@@ -445,12 +445,31 @@ export const DEPLOY_TOKEN = {
445
445
  };
446
446
  // Authentication Method Constants
447
447
  export const AuthMethod = {
448
- JWT: 'jwt',
448
+ SESSION: 'session',
449
449
  API_KEY: 'apiKey',
450
450
  TOKEN: 'token',
451
+ OAUTH: 'oauth',
451
452
  WEBHOOK: 'webhook',
452
453
  SYSTEM: 'system'
453
454
  };
455
+ /**
456
+ * OAuth scope vocabulary for delegated third-party access tokens.
457
+ * Single source of truth used by the authorization server (advertised in
458
+ * `scopes_supported`), the API's scope-enforcement middleware, and consent UI
459
+ * copy. The standard `offline_access` scope (refresh tokens) is not platform
460
+ * vocabulary and is deliberately absent — the middleware never checks it.
461
+ *
462
+ * Deliberately absent by design: any `tokens:*` scope, `account:write`, or
463
+ * admin scope — a delegated app must never mint credentials, delete the
464
+ * account, or act as admin.
465
+ */
466
+ export const OAuthScope = {
467
+ ACCOUNT_READ: 'account:read',
468
+ DEPLOYMENTS_READ: 'deployments:read',
469
+ DEPLOYMENTS_WRITE: 'deployments:write',
470
+ DOMAINS_READ: 'domains:read',
471
+ DOMAINS_WRITE: 'domains:write',
472
+ };
454
473
  // Deployment Configuration
455
474
  export const DEPLOYMENT_CONFIG_FILENAME = 'ship.json';
456
475
  /** Default ship.json config for SPA routing. Single source of truth — used by both API and SDK. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "1.1.0",
3
+ "version": "2.1.0",
4
4
  "description": "Shared types for ShipStatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -445,7 +445,7 @@ export class ShipError extends Error {
445
445
  toResponse(): ErrorResponse {
446
446
  // Strip authentication details when they carry an `internal` telemetry
447
447
  // tag (see `ShipError.authentication` JSDoc) — these are server-side
448
- // diagnostics like 'jwt_missing_subject' that must not leak to clients.
448
+ // diagnostics like 'session_invalid' that must not leak to clients.
449
449
  const authDetails = this.details as { internal?: unknown } | undefined;
450
450
  const details = this.type === ErrorType.Authentication && authDetails?.internal
451
451
  ? undefined
@@ -585,7 +585,7 @@ export class ShipError extends Error {
585
585
  *
586
586
  * **Telemetry pattern — `details: { internal: '<tag>' }`.** When the
587
587
  * server creates an auth error with an `internal` key in `details`
588
- * (e.g. `{ internal: 'jwt_missing_subject' }`), `toResponse()` strips the
588
+ * (e.g. `{ internal: 'session_invalid' }`), `toResponse()` strips the
589
589
  * entire `details` object before serialization. This keeps the wire
590
590
  * response a clean "Authentication failed" while preserving granular
591
591
  * server-side telemetry (which strategy/check failed) for logs and tests.
@@ -837,15 +837,37 @@ export const DEPLOY_TOKEN = {
837
837
 
838
838
  // Authentication Method Constants
839
839
  export const AuthMethod = {
840
- JWT: 'jwt',
840
+ SESSION: 'session',
841
841
  API_KEY: 'apiKey',
842
842
  TOKEN: 'token',
843
+ OAUTH: 'oauth',
843
844
  WEBHOOK: 'webhook',
844
845
  SYSTEM: 'system'
845
846
  } as const;
846
847
 
847
848
  export type AuthMethodType = typeof AuthMethod[keyof typeof AuthMethod];
848
849
 
850
+ /**
851
+ * OAuth scope vocabulary for delegated third-party access tokens.
852
+ * Single source of truth used by the authorization server (advertised in
853
+ * `scopes_supported`), the API's scope-enforcement middleware, and consent UI
854
+ * copy. The standard `offline_access` scope (refresh tokens) is not platform
855
+ * vocabulary and is deliberately absent — the middleware never checks it.
856
+ *
857
+ * Deliberately absent by design: any `tokens:*` scope, `account:write`, or
858
+ * admin scope — a delegated app must never mint credentials, delete the
859
+ * account, or act as admin.
860
+ */
861
+ export const OAuthScope = {
862
+ ACCOUNT_READ: 'account:read',
863
+ DEPLOYMENTS_READ: 'deployments:read',
864
+ DEPLOYMENTS_WRITE: 'deployments:write',
865
+ DOMAINS_READ: 'domains:read',
866
+ DOMAINS_WRITE: 'domains:write',
867
+ } as const;
868
+
869
+ export type OAuthScopeType = typeof OAuthScope[keyof typeof OAuthScope];
870
+
849
871
  // Deployment Configuration
850
872
  export const DEPLOYMENT_CONFIG_FILENAME = 'ship.json';
851
873