@vrplatform/kysely 1.3.45-stage.42223200412 → 1.3.45-stage.42235609047
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/build/main/postgres-error.d.ts +1 -0
- package/build/main/postgres-error.js +12 -6
- package/build/main/postgres-error.js.map +1 -1
- package/build/module/postgres-error.d.ts +1 -0
- package/build/module/postgres-error.js +11 -6
- package/build/module/postgres-error.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPostgresError = isPostgresError;
|
|
4
|
+
exports.postgresErrorConstraint = postgresErrorConstraint;
|
|
4
5
|
/**
|
|
5
6
|
* Matches PostgreSQL errors by code and, when requested, constraint. Production
|
|
6
7
|
* postgres.js and PGlite expose constraint names under different properties.
|
|
@@ -11,12 +12,17 @@ function isPostgresError(error, expected) {
|
|
|
11
12
|
typeof error.code !== 'string') {
|
|
12
13
|
return false;
|
|
13
14
|
}
|
|
14
|
-
const constraint = 'constraint' in error && typeof error.constraint === 'string'
|
|
15
|
-
? error.constraint
|
|
16
|
-
: 'constraint_name' in error && typeof error.constraint_name === 'string'
|
|
17
|
-
? error.constraint_name
|
|
18
|
-
: undefined;
|
|
19
15
|
return (error.code === expected.code &&
|
|
20
|
-
(expected.constraint === undefined ||
|
|
16
|
+
(expected.constraint === undefined ||
|
|
17
|
+
postgresErrorConstraint(error) === expected.constraint));
|
|
18
|
+
}
|
|
19
|
+
function postgresErrorConstraint(error) {
|
|
20
|
+
if ('constraint' in error && typeof error.constraint === 'string') {
|
|
21
|
+
return error.constraint;
|
|
22
|
+
}
|
|
23
|
+
if ('constraint_name' in error && typeof error.constraint_name === 'string') {
|
|
24
|
+
return error.constraint_name;
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
21
27
|
}
|
|
22
28
|
//# sourceMappingURL=postgres-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-error.js","sourceRoot":"src/","sources":["postgres-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postgres-error.js","sourceRoot":"src/","sources":["postgres-error.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,yBACE,KAAc,EACd,QAA+C;IAE/C,IACE,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QACzB,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC9B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;QAC5B,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS;YAChC,uBAAuB,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,UAAU,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,iCAAwC,KAAY;IAClD,IAAI,YAAY,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC,UAAU,CAAC;IAC1B,CAAC;IACD,IAAI,iBAAiB,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAC,eAAe,CAAC;IAC/B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Matches PostgreSQL errors by code and, when requested, constraint. Production\n * postgres.js and PGlite expose constraint names under different properties.\n */\nexport function isPostgresError(\n error: unknown,\n expected: { code: string; constraint?: string }\n): boolean {\n if (\n !(error instanceof Error) ||\n !('code' in error) ||\n typeof error.code !== 'string'\n ) {\n return false;\n }\n\n return (\n error.code === expected.code &&\n (expected.constraint === undefined ||\n postgresErrorConstraint(error) === expected.constraint)\n );\n}\n\nexport function postgresErrorConstraint(error: Error): string | undefined {\n if ('constraint' in error && typeof error.constraint === 'string') {\n return error.constraint;\n }\n if ('constraint_name' in error && typeof error.constraint_name === 'string') {\n return error.constraint_name;\n }\n return undefined;\n}\n"]}
|
|
@@ -8,12 +8,17 @@ export function isPostgresError(error, expected) {
|
|
|
8
8
|
typeof error.code !== 'string') {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
-
const constraint = 'constraint' in error && typeof error.constraint === 'string'
|
|
12
|
-
? error.constraint
|
|
13
|
-
: 'constraint_name' in error && typeof error.constraint_name === 'string'
|
|
14
|
-
? error.constraint_name
|
|
15
|
-
: undefined;
|
|
16
11
|
return (error.code === expected.code &&
|
|
17
|
-
(expected.constraint === undefined ||
|
|
12
|
+
(expected.constraint === undefined ||
|
|
13
|
+
postgresErrorConstraint(error) === expected.constraint));
|
|
14
|
+
}
|
|
15
|
+
export function postgresErrorConstraint(error) {
|
|
16
|
+
if ('constraint' in error && typeof error.constraint === 'string') {
|
|
17
|
+
return error.constraint;
|
|
18
|
+
}
|
|
19
|
+
if ('constraint_name' in error && typeof error.constraint_name === 'string') {
|
|
20
|
+
return error.constraint_name;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=postgres-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-error.js","sourceRoot":"src/","sources":["postgres-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAc,EACd,QAA+C;IAE/C,IACE,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QACzB,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC9B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"postgres-error.js","sourceRoot":"src/","sources":["postgres-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAc,EACd,QAA+C;IAE/C,IACE,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QACzB,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC9B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;QAC5B,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS;YAChC,uBAAuB,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,UAAU,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAY;IAClD,IAAI,YAAY,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC,UAAU,CAAC;IAC1B,CAAC;IACD,IAAI,iBAAiB,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAC,eAAe,CAAC;IAC/B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Matches PostgreSQL errors by code and, when requested, constraint. Production\n * postgres.js and PGlite expose constraint names under different properties.\n */\nexport function isPostgresError(\n error: unknown,\n expected: { code: string; constraint?: string }\n): boolean {\n if (\n !(error instanceof Error) ||\n !('code' in error) ||\n typeof error.code !== 'string'\n ) {\n return false;\n }\n\n return (\n error.code === expected.code &&\n (expected.constraint === undefined ||\n postgresErrorConstraint(error) === expected.constraint)\n );\n}\n\nexport function postgresErrorConstraint(error: Error): string | undefined {\n if ('constraint' in error && typeof error.constraint === 'string') {\n return error.constraint;\n }\n if ('constraint_name' in error && typeof error.constraint_name === 'string') {\n return error.constraint_name;\n }\n return undefined;\n}\n"]}
|