@prisma/adapter-neon 7.11.0-dev.3 → 7.11.0-dev.5

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.js CHANGED
@@ -316,13 +316,16 @@ function normalize_timez(time) {
316
316
  const pad = (n) => String(n).padStart(2, "0");
317
317
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
318
318
  }
319
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
319
320
  function normalize_money(money) {
320
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
321
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
322
+ if (match === null) {
321
323
  throw new Error(
322
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
324
+ `Unsupported money format "${money}": expected a currency symbol directly followed by an amount with "," thousands separators and a "." decimal point, such as -\xA31,234.50`
323
325
  );
324
326
  }
325
- return money.replace(/[^\d.-]/g, "");
327
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
328
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
326
329
  }
327
330
  function normalize_xml(xml) {
328
331
  return xml;
package/dist/index.mjs CHANGED
@@ -279,13 +279,16 @@ function normalize_timez(time) {
279
279
  const pad = (n) => String(n).padStart(2, "0");
280
280
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
281
281
  }
282
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
282
283
  function normalize_money(money) {
283
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
284
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
285
+ if (match === null) {
284
286
  throw new Error(
285
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
287
+ `Unsupported money format "${money}": expected a currency symbol directly followed by an amount with "," thousands separators and a "." decimal point, such as -\xA31,234.50`
286
288
  );
287
289
  }
288
- return money.replace(/[^\d.-]/g, "");
290
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
291
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
289
292
  }
290
293
  function normalize_xml(xml) {
291
294
  return xml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-neon",
3
- "version": "7.11.0-dev.3",
3
+ "version": "7.11.0-dev.5",
4
4
  "description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,10 +33,10 @@
33
33
  "dependencies": {
34
34
  "postgres-array": "3.0.4",
35
35
  "@neondatabase/serverless": ">0.6.0 <2",
36
- "@prisma/driver-adapter-utils": "7.11.0-dev.3"
36
+ "@prisma/driver-adapter-utils": "7.11.0-dev.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@prisma/debug": "7.11.0-dev.3"
39
+ "@prisma/debug": "7.11.0-dev.5"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "DEV=true tsx helpers/build.ts",