@constructive-io/errors 0.23.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.
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/errors",
3
- "version": "0.23.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": "a95137c03998f4ef18aaba770bdeb598077e5b51"
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',