@flowblade/sqlduck 0.36.0 → 0.36.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +20 -3
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as sqlduckDefaultLogtapeLogger, r as flowbladeLogtapeSqlduckConfig, t as FileSystemUtils } from "./file-system-utils-DT6smf4C.mjs";
2
2
  import { t as duckReservedKeywords } from "./duck-reserved-keywords-BzYA7jvN.mjs";
3
3
  import { c as duckValidatorsZod, r as assertValidAliasName, s as duckConnectionParamsZodSchema } from "./zod-DB5FHzXW.mjs";
4
- import { BIGINT, BOOLEAN, DATE, DECIMAL, DOUBLE, DuckDBDataChunk, DuckDBDateValue, DuckDBDecimalType, DuckDBDecimalValue, DuckDBInstanceCache, DuckDBListType, DuckDBTimestampMillisecondsValue, DuckDBTypeId, ENUM, FLOAT, HUGEINT, INTEGER, LIST, SMALLINT, TIMESTAMP, TIMESTAMP_MS, TINYINT, UBIGINT, UHUGEINT, UINTEGER, USMALLINT, UTINYINT, UUID, VARCHAR } from "@duckdb/node-api";
4
+ import { BIGINT, BOOLEAN, DATE, DECIMAL, DOUBLE, DuckDBDataChunk, DuckDBDateValue, DuckDBDecimalType, DuckDBDecimalValue, DuckDBInstanceCache, DuckDBListType, DuckDBTimestampMillisecondsValue, DuckDBTypeId, ENUM, FLOAT, HUGEINT, INTEGER, LIST, SMALLINT, TIMESTAMP, TIMESTAMP_MS, TINYINT, UBIGINT, UHUGEINT, UINTEGER, USMALLINT, UTINYINT, UUID, VARCHAR, listValue } from "@duckdb/node-api";
5
5
  import * as z from "zod";
6
6
  import { assertNever } from "@httpx/assert";
7
7
  import { isPlainObject } from "@httpx/plain-object";
@@ -191,6 +191,10 @@ var DuckValueConverter = class {
191
191
  value
192
192
  });
193
193
  };
194
+ toList = (arrayValue) => {
195
+ if (arrayValue === void 0 || arrayValue === null) return null;
196
+ return listValue(arrayValue);
197
+ };
194
198
  toTimestampMs = (value) => {
195
199
  if (value instanceof Date) return new DuckDBTimestampMillisecondsValue(BigInt(value.getTime()));
196
200
  if (value === void 0 || value === null) return null;
@@ -258,6 +262,9 @@ const createDuckColumnConverters = (duckTypes) => {
258
262
  case DuckDBTypeId.DATE:
259
263
  conv = converter.toDate;
260
264
  break;
265
+ case DuckDBTypeId.LIST:
266
+ conv = converter.toList;
267
+ break;
261
268
  default: throw new Error(`Unsupported duck type ${duckTypeId} / ${duckType.toString()} for column '${key}'`);
262
269
  }
263
270
  if (conv !== false) convMap[key] = conv;
@@ -651,11 +658,11 @@ const getScale = (value) => {
651
658
  };
652
659
  const getDuckdbNumberColumnType = (params) => {
653
660
  const { minimum, maximum, multipleOf } = params;
654
- if (minimum === void 0 || maximum === void 0) return BIGINT;
655
661
  if (multipleOf !== void 0 && isFloatValue(multipleOf)) {
656
662
  const scale = getScale(multipleOf);
657
663
  return DECIMAL(18, scale);
658
664
  }
665
+ if (minimum === void 0 || maximum === void 0) return BIGINT;
659
666
  if (isFloatValue(minimum) || isFloatValue(maximum)) {
660
667
  if (minimum >= -34028235e31 && maximum <= 34028235e31) return FLOAT;
661
668
  return DOUBLE;
@@ -729,8 +736,18 @@ const getTableCreateFromZod = (params) => {
729
736
  case "string":
730
737
  c.duckdbType = LIST(VARCHAR);
731
738
  break;
739
+ case "integer":
740
+ c.duckdbType = LIST(getDuckdbNumberColumnType({
741
+ minimum: def?.items?.minimum,
742
+ maximum: def?.items?.maximum
743
+ }));
744
+ break;
732
745
  case "number":
733
- c.duckdbType = LIST(INTEGER);
746
+ c.duckdbType = LIST(getDuckdbNumberColumnType({
747
+ minimum: def?.items?.minimum,
748
+ maximum: def?.items?.maximum,
749
+ multipleOf: def?.items?.multipleOf
750
+ }));
734
751
  break;
735
752
  case "boolean":
736
753
  c.duckdbType = LIST(BOOLEAN);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowblade/sqlduck",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -107,8 +107,8 @@
107
107
  "@typescript-eslint/eslint-plugin": "8.67.0",
108
108
  "@typescript-eslint/parser": "8.67.0",
109
109
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
110
- "@vitest/coverage-v8": "4.1.10",
111
- "@vitest/ui": "4.1.10",
110
+ "@vitest/coverage-v8": "4.1.11",
111
+ "@vitest/ui": "4.1.11",
112
112
  "ansis": "4.3.1",
113
113
  "browserslist-to-esbuild": "2.1.1",
114
114
  "core-js": "3.50.0",
@@ -137,7 +137,7 @@
137
137
  "typedoc-plugin-markdown": "4.12.0",
138
138
  "typescript": "6.0.3",
139
139
  "valibot": "1.4.2",
140
- "vitest": "4.1.10"
140
+ "vitest": "4.1.11"
141
141
  },
142
142
  "files": [
143
143
  "dist"