@prisma/adapter-neon 7.11.0-dev.1 → 7.11.0-dev.10

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
@@ -294,14 +294,17 @@ function normalize_array(element_normalizer) {
294
294
  function normalize_numeric(numeric) {
295
295
  return numeric;
296
296
  }
297
+ function expandYear(value) {
298
+ return value.replace(/^(\d{5,})(?=-)/, (_, year) => `+${year.padStart(6, "0")}`);
299
+ }
297
300
  function normalize_date(date) {
298
- return date;
301
+ return expandYear(date);
299
302
  }
300
303
  function normalize_timestamp(time) {
301
- return `${time.replace(" ", "T")}+00:00`;
304
+ return expandYear(`${time.replace(" ", "T")}+00:00`);
302
305
  }
303
306
  function normalize_timestamptz(time) {
304
- return time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00");
307
+ return expandYear(time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00"));
305
308
  }
306
309
  function normalize_time(time) {
307
310
  return time;
@@ -316,13 +319,16 @@ function normalize_timez(time) {
316
319
  const pad = (n) => String(n).padStart(2, "0");
317
320
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
318
321
  }
322
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
319
323
  function normalize_money(money) {
320
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
324
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
325
+ if (match === null) {
321
326
  throw new Error(
322
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
327
+ `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
328
  );
324
329
  }
325
- return money.replace(/[^\d.-]/g, "");
330
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
331
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
326
332
  }
327
333
  function normalize_xml(xml) {
328
334
  return xml;
package/dist/index.mjs CHANGED
@@ -257,14 +257,17 @@ function normalize_array(element_normalizer) {
257
257
  function normalize_numeric(numeric) {
258
258
  return numeric;
259
259
  }
260
+ function expandYear(value) {
261
+ return value.replace(/^(\d{5,})(?=-)/, (_, year) => `+${year.padStart(6, "0")}`);
262
+ }
260
263
  function normalize_date(date) {
261
- return date;
264
+ return expandYear(date);
262
265
  }
263
266
  function normalize_timestamp(time) {
264
- return `${time.replace(" ", "T")}+00:00`;
267
+ return expandYear(`${time.replace(" ", "T")}+00:00`);
265
268
  }
266
269
  function normalize_timestamptz(time) {
267
- return time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00");
270
+ return expandYear(time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00"));
268
271
  }
269
272
  function normalize_time(time) {
270
273
  return time;
@@ -279,13 +282,16 @@ function normalize_timez(time) {
279
282
  const pad = (n) => String(n).padStart(2, "0");
280
283
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
281
284
  }
285
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
282
286
  function normalize_money(money) {
283
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
287
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
288
+ if (match === null) {
284
289
  throw new Error(
285
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
290
+ `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
291
  );
287
292
  }
288
- return money.replace(/[^\d.-]/g, "");
293
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
294
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
289
295
  }
290
296
  function normalize_xml(xml) {
291
297
  return xml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-neon",
3
- "version": "7.11.0-dev.1",
3
+ "version": "7.11.0-dev.10",
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.1"
36
+ "@prisma/driver-adapter-utils": "7.11.0-dev.10"
37
37
  },
38
38
  "devDependencies": {
39
- "@prisma/debug": "7.11.0-dev.1"
39
+ "@prisma/debug": "7.11.0-dev.10"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "DEV=true tsx helpers/build.ts",