prisma-client-php 2.2.0 → 2.3.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/dist/init.js CHANGED
@@ -189,12 +189,12 @@ const readJsonFile = (filePath) => {
189
189
  return JSON.parse(jsonData);
190
190
  };
191
191
  const npmPinnedVersions = {
192
- prisma: "^6.8.2",
193
- "@prisma/client": "^6.8.2",
194
- "@prisma/internals": "^6.8.2",
195
- tsx: "^4.19.4",
196
- typescript: "^5.8.3",
197
- "@types/node": "^22.15.18",
192
+ prisma: "^6.14.0",
193
+ "@prisma/client": "^6.14.0",
194
+ "@prisma/internals": "^6.14.0",
195
+ tsx: "^4.20.5",
196
+ typescript: "^5.9.2",
197
+ "@types/node": "^24.3.0",
198
198
  };
199
199
  function npmPkg(name) {
200
200
  return npmPinnedVersions[name] ? `${name}@${npmPinnedVersions[name]}` : name;
@@ -1543,4 +1543,68 @@ final class PPHPUtility
1543
1543
 
1544
1544
  return $clauses ? ' HAVING ' . implode(' AND ', $clauses) : '';
1545
1545
  }
1546
+
1547
+ public static function normalizeRowTypes(array $row, array $fieldsByName): array
1548
+ {
1549
+ foreach ($fieldsByName as $name => $meta) {
1550
+ if (!array_key_exists($name, $row)) {
1551
+ continue;
1552
+ }
1553
+ if (($meta['kind'] ?? null) !== 'scalar') {
1554
+ continue;
1555
+ }
1556
+
1557
+ $type = $meta['type'] ?? null;
1558
+ $row[$name] = self::normalizeValueByType($row[$name], $type);
1559
+ }
1560
+ return $row;
1561
+ }
1562
+
1563
+ public static function normalizeListTypes(array $rows, array $fieldsByName): array
1564
+ {
1565
+ foreach ($rows as $i => $row) {
1566
+ if (is_array($row)) {
1567
+ $rows[$i] = self::normalizeRowTypes($row, $fieldsByName);
1568
+ } elseif (is_object($row)) {
1569
+ $rows[$i] = (object) self::normalizeRowTypes((array) $row, $fieldsByName);
1570
+ }
1571
+ }
1572
+ return $rows;
1573
+ }
1574
+
1575
+ private static function normalizeValueByType(mixed $value, ?string $type): mixed
1576
+ {
1577
+ if ($value === null) return null;
1578
+
1579
+ switch ($type) {
1580
+ case 'Boolean':
1581
+ return self::toBool($value);
1582
+ case 'Int':
1583
+ return (int) $value;
1584
+ case 'BigInt':
1585
+ return (string) $value;
1586
+ case 'Decimal':
1587
+ return (string) $value;
1588
+ case 'DateTime':
1589
+ return Validator::dateTime($value);
1590
+ default:
1591
+ return $value;
1592
+ }
1593
+ }
1594
+
1595
+ public static function toBool(mixed $v): bool
1596
+ {
1597
+ $b = Validator::boolean($v);
1598
+ if ($b !== null) return $b;
1599
+
1600
+ if (is_numeric($v)) return ((int) $v) === 1;
1601
+
1602
+ if (is_string($v)) {
1603
+ $s = strtolower(trim($v));
1604
+ if (in_array($s, ['t', 'y', 'yes'], true)) return true;
1605
+ if (in_array($s, ['f', 'n', 'no'], true)) return false;
1606
+ }
1607
+
1608
+ return (bool) $v;
1609
+ }
1546
1610
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prisma-client-php",
3
3
  "description": "Prisma Client PHP is an auto-generated query builder that enables type-safe database access in PHP.",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  "prisma-client-php"
26
26
  ],
27
27
  "dependencies": {
28
- "chalk": "^5.4.1",
28
+ "chalk": "^5.6.0",
29
29
  "crypto-js": "^4.2.0"
30
30
  }
31
31
  }