@constructive-io/errors 0.22.0 → 0.24.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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GENERATED FILE — DO NOT EDIT BY HAND.
3
3
  *
4
- * Source of truth: the constructive-db error audit (841 distinct codes
4
+ * Source of truth: the constructive-db error audit (844 distinct codes
5
5
  * raised via EXCEPTION/THROW across deploy sources + generated output).
6
6
  * Regenerate with `python3 scripts/generate-registry.py` (see README.md).
7
7
  *
@@ -9,7 +9,7 @@
9
9
  * codes carry their raw message (with %-args rendered as {{argN}}). Curated
10
10
  * entries in `registry.ts` override anything here (typed context + refined copy).
11
11
  *
12
- * Counts: 841 total, 611 public, 230 internal.
12
+ * Counts: 844 total, 614 public, 230 internal.
13
13
  */
14
14
  import { type DefinedError } from '../define';
15
15
  import type { ErrorContext } from '../types';
@@ -24,4 +24,4 @@ export declare const generatedRegistry: Record<string, DefinedError<ErrorContext
24
24
  /** Audit metadata for each generated code. */
25
25
  export declare const GENERATED_CODE_META: Record<string, GeneratedCodeMeta>;
26
26
  /** Total number of codes collected from constructive-db. */
27
- export declare const GENERATED_CODE_COUNT = 841;
27
+ export declare const GENERATED_CODE_COUNT = 844;
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * GENERATED FILE — DO NOT EDIT BY HAND.
4
4
  *
5
- * Source of truth: the constructive-db error audit (841 distinct codes
5
+ * Source of truth: the constructive-db error audit (844 distinct codes
6
6
  * raised via EXCEPTION/THROW across deploy sources + generated output).
7
7
  * Regenerate with `python3 scripts/generate-registry.py` (see README.md).
8
8
  *
@@ -10,7 +10,7 @@
10
10
  * codes carry their raw message (with %-args rendered as {{argN}}). Curated
11
11
  * entries in `registry.ts` override anything here (typed context + refined copy).
12
12
  *
13
- * Counts: 841 total, 611 public, 230 internal.
13
+ * Counts: 844 total, 614 public, 230 internal.
14
14
  */
15
15
  import { defineError } from '../define';
16
16
  /** Every constructive-db error code, keyed by code. */
@@ -570,6 +570,7 @@ export const generatedRegistry = {
570
570
  'METER_RATE_LIMIT': defineError({ code: 'METER_RATE_LIMIT', class: 'internal', http: 500, message: 'METER_RATE_LIMIT: unknown event {{arg0}}, expected INSERT or UPDATE', positional: ['arg0'] }),
571
571
  'MFA_CHALLENGE_EXPIRED': defineError({ code: 'MFA_CHALLENGE_EXPIRED', class: 'public', http: 403, message: 'Mfa challenge expired.' }),
572
572
  'MFA_IDENTIFIER_UNVERIFIED': defineError({ code: 'MFA_IDENTIFIER_UNVERIFIED', class: 'public', http: 403, message: 'Mfa identifier unverified.' }),
573
+ 'MFA_METHOD_NOT_ALLOWED': defineError({ code: 'MFA_METHOD_NOT_ALLOWED', class: 'public', http: 403, message: 'Mfa method not allowed.' }),
573
574
  'MFA_METHOD_NOT_ENABLED': defineError({ code: 'MFA_METHOD_NOT_ENABLED', class: 'public', http: 403, message: 'Mfa method not enabled.' }),
574
575
  'MFA_REQUIRED': defineError({ code: 'MFA_REQUIRED', class: 'public', http: 403, message: 'Mfa required.' }),
575
576
  'MISSING_FIXTURE_TYPE': defineError({ code: 'MISSING_FIXTURE_TYPE', class: 'internal', http: 500, message: 'Missing fixture type.' }),
@@ -776,10 +777,12 @@ export const generatedRegistry = {
776
777
  'SSO_STATE_TTL_INVALID': defineError({ code: 'SSO_STATE_TTL_INVALID', class: 'internal', http: 500, message: 'Sso state ttl invalid.' }),
777
778
  'STATIC_SITES_LIMIT': defineError({ code: 'STATIC_SITES_LIMIT', class: 'public', http: 429, message: 'Static sites limit.' }),
778
779
  'STEP_UP_INVALID_TYPE': defineError({ code: 'STEP_UP_INVALID_TYPE', class: 'public', http: 403, message: 'This action requires verification that is not configured correctly. Please contact support.' }),
780
+ 'STEP_UP_METHOD_REQUIRED': defineError({ code: 'STEP_UP_METHOD_REQUIRED', class: 'public', http: 403, message: 'Step up method required.' }),
779
781
  'STEP_UP_REQUIRED_FRESH_AUTH': defineError({ code: 'STEP_UP_REQUIRED_FRESH_AUTH', class: 'public', http: 403, message: 'Please verify your identity to continue.' }),
780
782
  'STEP_UP_REQUIRED_MFA': defineError({ code: 'STEP_UP_REQUIRED_MFA', class: 'public', http: 403, message: 'Please enter a code from your authenticator app to continue.' }),
781
783
  'STEP_UP_REQUIRED_PASSWORD': defineError({ code: 'STEP_UP_REQUIRED_PASSWORD', class: 'public', http: 403, message: 'Please re-enter your password to continue.' }),
782
784
  'STEP_UP_REQUIRED_PASSWORD_OR_MFA': defineError({ code: 'STEP_UP_REQUIRED_PASSWORD_OR_MFA', class: 'public', http: 403, message: 'Please re-enter your password or enter a code from your authenticator app to continue.' }),
785
+ 'STEP_UP_SESSION_INVALID': defineError({ code: 'STEP_UP_SESSION_INVALID', class: 'public', http: 403, message: 'Step up session invalid.' }),
783
786
  'STORAGE_API_NOT_PROVISIONED': defineError({ code: 'STORAGE_API_NOT_PROVISIONED', class: 'public', http: 400, message: 'Storage api not provisioned.' }),
784
787
  'STORAGE_DESTINATION_REQUIRES_TEMP': defineError({ code: 'STORAGE_DESTINATION_REQUIRES_TEMP', class: 'internal', http: 500, message: 'Storage destination requires temp.' }),
785
788
  'STORAGE_FILE_BUCKET_IMMUTABLE': defineError({ code: 'STORAGE_FILE_BUCKET_IMMUTABLE', class: 'internal', http: 500, message: 'Storage file bucket immutable.' }),
@@ -1414,6 +1417,7 @@ export const GENERATED_CODE_META = {
1414
1417
  'METER_RATE_LIMIT': { class: 'internal', dynamic: true, generatedOnly: false },
1415
1418
  'MFA_CHALLENGE_EXPIRED': { class: 'public', dynamic: false, generatedOnly: false },
1416
1419
  'MFA_IDENTIFIER_UNVERIFIED': { class: 'public', dynamic: false, generatedOnly: false },
1420
+ 'MFA_METHOD_NOT_ALLOWED': { class: 'public', dynamic: false, generatedOnly: false },
1417
1421
  'MFA_METHOD_NOT_ENABLED': { class: 'public', dynamic: false, generatedOnly: false },
1418
1422
  'MFA_REQUIRED': { class: 'public', dynamic: false, generatedOnly: false },
1419
1423
  'MISSING_FIXTURE_TYPE': { class: 'internal', dynamic: false, generatedOnly: false },
@@ -1620,10 +1624,12 @@ export const GENERATED_CODE_META = {
1620
1624
  'SSO_STATE_TTL_INVALID': { class: 'internal', dynamic: false, generatedOnly: false },
1621
1625
  'STATIC_SITES_LIMIT': { class: 'public', dynamic: false, generatedOnly: false },
1622
1626
  'STEP_UP_INVALID_TYPE': { class: 'public', dynamic: false, generatedOnly: false },
1627
+ 'STEP_UP_METHOD_REQUIRED': { class: 'public', dynamic: false, generatedOnly: false },
1623
1628
  'STEP_UP_REQUIRED_FRESH_AUTH': { class: 'public', dynamic: false, generatedOnly: false },
1624
1629
  'STEP_UP_REQUIRED_MFA': { class: 'public', dynamic: false, generatedOnly: false },
1625
1630
  'STEP_UP_REQUIRED_PASSWORD': { class: 'public', dynamic: false, generatedOnly: false },
1626
1631
  'STEP_UP_REQUIRED_PASSWORD_OR_MFA': { class: 'public', dynamic: false, generatedOnly: false },
1632
+ 'STEP_UP_SESSION_INVALID': { class: 'public', dynamic: false, generatedOnly: false },
1627
1633
  'STORAGE_API_NOT_PROVISIONED': { class: 'public', dynamic: false, generatedOnly: false },
1628
1634
  'STORAGE_DESTINATION_REQUIRES_TEMP': { class: 'internal', dynamic: false, generatedOnly: false },
1629
1635
  'STORAGE_FILE_BUCKET_IMMUTABLE': { class: 'internal', dynamic: false, generatedOnly: false },
@@ -1702,4 +1708,4 @@ export const GENERATED_CODE_META = {
1702
1708
  'WITH_CHECK_NOT_ALLOWED': { class: 'public', dynamic: false, generatedOnly: false },
1703
1709
  };
1704
1710
  /** Total number of codes collected from constructive-db. */
1705
- export const GENERATED_CODE_COUNT = 841;
1711
+ export const GENERATED_CODE_COUNT = 844;
package/esm/pg.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { PgErrorFields } from './types';
2
2
  /**
3
- * PostgreSQL SQLSTATE codes for the native constraint violations we surface as
4
- * public Constructive codes.
3
+ * PostgreSQL SQLSTATE codes for the native errors we surface as public
4
+ * Constructive codes: constraint violations, and `42501` (a missing grant or an
5
+ * RLS `WITH CHECK` refusal). Postgres cannot tell an anonymous caller from a
6
+ * signed-in one at that point, so `42501` is `FORBIDDEN`.
5
7
  */
6
8
  export declare const SQLSTATE_TO_CODE: Record<string, string>;
7
9
  /** SQLSTATE for a user-raised `RAISE EXCEPTION` without an explicit ERRCODE. */
package/esm/pg.js CHANGED
@@ -1,13 +1,16 @@
1
1
  /**
2
- * PostgreSQL SQLSTATE codes for the native constraint violations we surface as
3
- * public Constructive codes.
2
+ * PostgreSQL SQLSTATE codes for the native errors we surface as public
3
+ * Constructive codes: constraint violations, and `42501` (a missing grant or an
4
+ * RLS `WITH CHECK` refusal). Postgres cannot tell an anonymous caller from a
5
+ * signed-in one at that point, so `42501` is `FORBIDDEN`.
4
6
  */
5
7
  export const SQLSTATE_TO_CODE = {
6
8
  23505: 'UNIQUE_VIOLATION',
7
9
  23503: 'FOREIGN_KEY_VIOLATION',
8
10
  23502: 'NOT_NULL_VIOLATION',
9
11
  23514: 'CHECK_VIOLATION',
10
- '23P01': 'EXCLUSION_VIOLATION'
12
+ '23P01': 'EXCLUSION_VIOLATION',
13
+ 42501: 'FORBIDDEN'
11
14
  };
12
15
  /** SQLSTATE for a user-raised `RAISE EXCEPTION` without an explicit ERRCODE. */
13
16
  export const RAISE_EXCEPTION_SQLSTATE = 'P0001';
package/esm/registry.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const registry: {
35
35
  readonly SIGN_UP_DISABLED: import("./define").DefinedError<import("./types").EmptyContext>;
36
36
  readonly SIGN_UP_REQUIRES_INVITE: import("./define").DefinedError<import("./types").EmptyContext>;
37
37
  readonly USER_NOT_AUTHENTICATED: import("./define").DefinedError<import("./types").EmptyContext>;
38
+ readonly WEBAUTHN_VERIFICATION_FAILED: import("./define").DefinedError<import("./types").EmptyContext>;
38
39
  readonly ACCOUNT_LOCKED: import("./define").DefinedError<import("./types").EmptyContext>;
39
40
  readonly USER_NOT_FOUND: import("./define").DefinedError<import("./types").EmptyContext>;
40
41
  readonly NO_PRIMARY_EMAIL: import("./define").DefinedError<import("./types").EmptyContext>;
package/esm/registry.js CHANGED
@@ -147,6 +147,12 @@ export const registry = {
147
147
  http: 401,
148
148
  message: 'You must be signed in to do that.'
149
149
  }),
150
+ WEBAUTHN_VERIFICATION_FAILED: defineError({
151
+ code: 'WEBAUTHN_VERIFICATION_FAILED',
152
+ class: 'public',
153
+ http: 401,
154
+ message: 'The passkey response could not be verified.'
155
+ }),
150
156
  ACCOUNT_LOCKED: defineError({
151
157
  code: 'ACCOUNT_LOCKED',
152
158
  class: 'public',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GENERATED FILE — DO NOT EDIT BY HAND.
3
3
  *
4
- * Source of truth: the constructive-db error audit (841 distinct codes
4
+ * Source of truth: the constructive-db error audit (844 distinct codes
5
5
  * raised via EXCEPTION/THROW across deploy sources + generated output).
6
6
  * Regenerate with `python3 scripts/generate-registry.py` (see README.md).
7
7
  *
@@ -9,7 +9,7 @@
9
9
  * codes carry their raw message (with %-args rendered as {{argN}}). Curated
10
10
  * entries in `registry.ts` override anything here (typed context + refined copy).
11
11
  *
12
- * Counts: 841 total, 611 public, 230 internal.
12
+ * Counts: 844 total, 614 public, 230 internal.
13
13
  */
14
14
  import { type DefinedError } from '../define';
15
15
  import type { ErrorContext } from '../types';
@@ -24,4 +24,4 @@ export declare const generatedRegistry: Record<string, DefinedError<ErrorContext
24
24
  /** Audit metadata for each generated code. */
25
25
  export declare const GENERATED_CODE_META: Record<string, GeneratedCodeMeta>;
26
26
  /** Total number of codes collected from constructive-db. */
27
- export declare const GENERATED_CODE_COUNT = 841;
27
+ export declare const GENERATED_CODE_COUNT = 844;
@@ -5,7 +5,7 @@ exports.GENERATED_CODE_COUNT = exports.GENERATED_CODE_META = exports.generatedRe
5
5
  /**
6
6
  * GENERATED FILE — DO NOT EDIT BY HAND.
7
7
  *
8
- * Source of truth: the constructive-db error audit (841 distinct codes
8
+ * Source of truth: the constructive-db error audit (844 distinct codes
9
9
  * raised via EXCEPTION/THROW across deploy sources + generated output).
10
10
  * Regenerate with `python3 scripts/generate-registry.py` (see README.md).
11
11
  *
@@ -13,7 +13,7 @@ exports.GENERATED_CODE_COUNT = exports.GENERATED_CODE_META = exports.generatedRe
13
13
  * codes carry their raw message (with %-args rendered as {{argN}}). Curated
14
14
  * entries in `registry.ts` override anything here (typed context + refined copy).
15
15
  *
16
- * Counts: 841 total, 611 public, 230 internal.
16
+ * Counts: 844 total, 614 public, 230 internal.
17
17
  */
18
18
  const define_1 = require("../define");
19
19
  /** Every constructive-db error code, keyed by code. */
@@ -573,6 +573,7 @@ exports.generatedRegistry = {
573
573
  'METER_RATE_LIMIT': (0, define_1.defineError)({ code: 'METER_RATE_LIMIT', class: 'internal', http: 500, message: 'METER_RATE_LIMIT: unknown event {{arg0}}, expected INSERT or UPDATE', positional: ['arg0'] }),
574
574
  'MFA_CHALLENGE_EXPIRED': (0, define_1.defineError)({ code: 'MFA_CHALLENGE_EXPIRED', class: 'public', http: 403, message: 'Mfa challenge expired.' }),
575
575
  'MFA_IDENTIFIER_UNVERIFIED': (0, define_1.defineError)({ code: 'MFA_IDENTIFIER_UNVERIFIED', class: 'public', http: 403, message: 'Mfa identifier unverified.' }),
576
+ 'MFA_METHOD_NOT_ALLOWED': (0, define_1.defineError)({ code: 'MFA_METHOD_NOT_ALLOWED', class: 'public', http: 403, message: 'Mfa method not allowed.' }),
576
577
  'MFA_METHOD_NOT_ENABLED': (0, define_1.defineError)({ code: 'MFA_METHOD_NOT_ENABLED', class: 'public', http: 403, message: 'Mfa method not enabled.' }),
577
578
  'MFA_REQUIRED': (0, define_1.defineError)({ code: 'MFA_REQUIRED', class: 'public', http: 403, message: 'Mfa required.' }),
578
579
  'MISSING_FIXTURE_TYPE': (0, define_1.defineError)({ code: 'MISSING_FIXTURE_TYPE', class: 'internal', http: 500, message: 'Missing fixture type.' }),
@@ -779,10 +780,12 @@ exports.generatedRegistry = {
779
780
  'SSO_STATE_TTL_INVALID': (0, define_1.defineError)({ code: 'SSO_STATE_TTL_INVALID', class: 'internal', http: 500, message: 'Sso state ttl invalid.' }),
780
781
  'STATIC_SITES_LIMIT': (0, define_1.defineError)({ code: 'STATIC_SITES_LIMIT', class: 'public', http: 429, message: 'Static sites limit.' }),
781
782
  'STEP_UP_INVALID_TYPE': (0, define_1.defineError)({ code: 'STEP_UP_INVALID_TYPE', class: 'public', http: 403, message: 'This action requires verification that is not configured correctly. Please contact support.' }),
783
+ 'STEP_UP_METHOD_REQUIRED': (0, define_1.defineError)({ code: 'STEP_UP_METHOD_REQUIRED', class: 'public', http: 403, message: 'Step up method required.' }),
782
784
  'STEP_UP_REQUIRED_FRESH_AUTH': (0, define_1.defineError)({ code: 'STEP_UP_REQUIRED_FRESH_AUTH', class: 'public', http: 403, message: 'Please verify your identity to continue.' }),
783
785
  'STEP_UP_REQUIRED_MFA': (0, define_1.defineError)({ code: 'STEP_UP_REQUIRED_MFA', class: 'public', http: 403, message: 'Please enter a code from your authenticator app to continue.' }),
784
786
  'STEP_UP_REQUIRED_PASSWORD': (0, define_1.defineError)({ code: 'STEP_UP_REQUIRED_PASSWORD', class: 'public', http: 403, message: 'Please re-enter your password to continue.' }),
785
787
  'STEP_UP_REQUIRED_PASSWORD_OR_MFA': (0, define_1.defineError)({ code: 'STEP_UP_REQUIRED_PASSWORD_OR_MFA', class: 'public', http: 403, message: 'Please re-enter your password or enter a code from your authenticator app to continue.' }),
788
+ 'STEP_UP_SESSION_INVALID': (0, define_1.defineError)({ code: 'STEP_UP_SESSION_INVALID', class: 'public', http: 403, message: 'Step up session invalid.' }),
786
789
  'STORAGE_API_NOT_PROVISIONED': (0, define_1.defineError)({ code: 'STORAGE_API_NOT_PROVISIONED', class: 'public', http: 400, message: 'Storage api not provisioned.' }),
787
790
  'STORAGE_DESTINATION_REQUIRES_TEMP': (0, define_1.defineError)({ code: 'STORAGE_DESTINATION_REQUIRES_TEMP', class: 'internal', http: 500, message: 'Storage destination requires temp.' }),
788
791
  'STORAGE_FILE_BUCKET_IMMUTABLE': (0, define_1.defineError)({ code: 'STORAGE_FILE_BUCKET_IMMUTABLE', class: 'internal', http: 500, message: 'Storage file bucket immutable.' }),
@@ -1417,6 +1420,7 @@ exports.GENERATED_CODE_META = {
1417
1420
  'METER_RATE_LIMIT': { class: 'internal', dynamic: true, generatedOnly: false },
1418
1421
  'MFA_CHALLENGE_EXPIRED': { class: 'public', dynamic: false, generatedOnly: false },
1419
1422
  'MFA_IDENTIFIER_UNVERIFIED': { class: 'public', dynamic: false, generatedOnly: false },
1423
+ 'MFA_METHOD_NOT_ALLOWED': { class: 'public', dynamic: false, generatedOnly: false },
1420
1424
  'MFA_METHOD_NOT_ENABLED': { class: 'public', dynamic: false, generatedOnly: false },
1421
1425
  'MFA_REQUIRED': { class: 'public', dynamic: false, generatedOnly: false },
1422
1426
  'MISSING_FIXTURE_TYPE': { class: 'internal', dynamic: false, generatedOnly: false },
@@ -1623,10 +1627,12 @@ exports.GENERATED_CODE_META = {
1623
1627
  'SSO_STATE_TTL_INVALID': { class: 'internal', dynamic: false, generatedOnly: false },
1624
1628
  'STATIC_SITES_LIMIT': { class: 'public', dynamic: false, generatedOnly: false },
1625
1629
  'STEP_UP_INVALID_TYPE': { class: 'public', dynamic: false, generatedOnly: false },
1630
+ 'STEP_UP_METHOD_REQUIRED': { class: 'public', dynamic: false, generatedOnly: false },
1626
1631
  'STEP_UP_REQUIRED_FRESH_AUTH': { class: 'public', dynamic: false, generatedOnly: false },
1627
1632
  'STEP_UP_REQUIRED_MFA': { class: 'public', dynamic: false, generatedOnly: false },
1628
1633
  'STEP_UP_REQUIRED_PASSWORD': { class: 'public', dynamic: false, generatedOnly: false },
1629
1634
  'STEP_UP_REQUIRED_PASSWORD_OR_MFA': { class: 'public', dynamic: false, generatedOnly: false },
1635
+ 'STEP_UP_SESSION_INVALID': { class: 'public', dynamic: false, generatedOnly: false },
1630
1636
  'STORAGE_API_NOT_PROVISIONED': { class: 'public', dynamic: false, generatedOnly: false },
1631
1637
  'STORAGE_DESTINATION_REQUIRES_TEMP': { class: 'internal', dynamic: false, generatedOnly: false },
1632
1638
  'STORAGE_FILE_BUCKET_IMMUTABLE': { class: 'internal', dynamic: false, generatedOnly: false },
@@ -1705,4 +1711,4 @@ exports.GENERATED_CODE_META = {
1705
1711
  'WITH_CHECK_NOT_ALLOWED': { class: 'public', dynamic: false, generatedOnly: false },
1706
1712
  };
1707
1713
  /** Total number of codes collected from constructive-db. */
1708
- exports.GENERATED_CODE_COUNT = 841;
1714
+ exports.GENERATED_CODE_COUNT = 844;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/errors",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Canonical Constructive error system: registry, codes, i18n messages, and cross-source (PostgreSQL/GraphQL/client) parsing. Zero runtime dependencies.",
6
6
  "main": "index.js",
@@ -41,5 +41,5 @@
41
41
  "makage": "^0.8.0",
42
42
  "ts-node": "^10.9.2"
43
43
  },
44
- "gitHead": "1bab719e353dad566819d58ba7912dd335ef51c4"
44
+ "gitHead": "1f3501d518e175803a1a3372cf9249922d82bfe5"
45
45
  }
package/pg.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { PgErrorFields } from './types';
2
2
  /**
3
- * PostgreSQL SQLSTATE codes for the native constraint violations we surface as
4
- * public Constructive codes.
3
+ * PostgreSQL SQLSTATE codes for the native errors we surface as public
4
+ * Constructive codes: constraint violations, and `42501` (a missing grant or an
5
+ * RLS `WITH CHECK` refusal). Postgres cannot tell an anonymous caller from a
6
+ * signed-in one at that point, so `42501` is `FORBIDDEN`.
5
7
  */
6
8
  export declare const SQLSTATE_TO_CODE: Record<string, string>;
7
9
  /** SQLSTATE for a user-raised `RAISE EXCEPTION` without an explicit ERRCODE. */
package/pg.js CHANGED
@@ -3,15 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RAISE_EXCEPTION_SQLSTATE = exports.SQLSTATE_TO_CODE = void 0;
4
4
  exports.extractPgErrorFields = extractPgErrorFields;
5
5
  /**
6
- * PostgreSQL SQLSTATE codes for the native constraint violations we surface as
7
- * public Constructive codes.
6
+ * PostgreSQL SQLSTATE codes for the native errors we surface as public
7
+ * Constructive codes: constraint violations, and `42501` (a missing grant or an
8
+ * RLS `WITH CHECK` refusal). Postgres cannot tell an anonymous caller from a
9
+ * signed-in one at that point, so `42501` is `FORBIDDEN`.
8
10
  */
9
11
  exports.SQLSTATE_TO_CODE = {
10
12
  23505: 'UNIQUE_VIOLATION',
11
13
  23503: 'FOREIGN_KEY_VIOLATION',
12
14
  23502: 'NOT_NULL_VIOLATION',
13
15
  23514: 'CHECK_VIOLATION',
14
- '23P01': 'EXCLUSION_VIOLATION'
16
+ '23P01': 'EXCLUSION_VIOLATION',
17
+ 42501: 'FORBIDDEN'
15
18
  };
16
19
  /** SQLSTATE for a user-raised `RAISE EXCEPTION` without an explicit ERRCODE. */
17
20
  exports.RAISE_EXCEPTION_SQLSTATE = 'P0001';
package/registry.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const registry: {
35
35
  readonly SIGN_UP_DISABLED: import("./define").DefinedError<import("./types").EmptyContext>;
36
36
  readonly SIGN_UP_REQUIRES_INVITE: import("./define").DefinedError<import("./types").EmptyContext>;
37
37
  readonly USER_NOT_AUTHENTICATED: import("./define").DefinedError<import("./types").EmptyContext>;
38
+ readonly WEBAUTHN_VERIFICATION_FAILED: import("./define").DefinedError<import("./types").EmptyContext>;
38
39
  readonly ACCOUNT_LOCKED: import("./define").DefinedError<import("./types").EmptyContext>;
39
40
  readonly USER_NOT_FOUND: import("./define").DefinedError<import("./types").EmptyContext>;
40
41
  readonly NO_PRIMARY_EMAIL: import("./define").DefinedError<import("./types").EmptyContext>;
package/registry.js CHANGED
@@ -153,6 +153,12 @@ exports.registry = {
153
153
  http: 401,
154
154
  message: 'You must be signed in to do that.'
155
155
  }),
156
+ WEBAUTHN_VERIFICATION_FAILED: (0, define_1.defineError)({
157
+ code: 'WEBAUTHN_VERIFICATION_FAILED',
158
+ class: 'public',
159
+ http: 401,
160
+ message: 'The passkey response could not be verified.'
161
+ }),
156
162
  ACCOUNT_LOCKED: (0, define_1.defineError)({
157
163
  code: 'ACCOUNT_LOCKED',
158
164
  class: 'public',