@flowblade/sqlduck 0.36.0 → 0.36.2
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.
|
@@ -208,7 +208,7 @@ declare const duckValidatorsZod: {
|
|
|
208
208
|
};
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/validation/zod/ensure-zod-table-schema.d.ts
|
|
211
|
-
type TObject = Record<string, string | number | null | undefined | boolean | Date>;
|
|
211
|
+
type TObject = Record<string, string | number | null | undefined | boolean | Date | (string | number | null | boolean)[]>;
|
|
212
212
|
declare const EXPLICIT_GENERIC_REQUIRED: unique symbol;
|
|
213
213
|
type RequireExplicitGeneric = TObject & {
|
|
214
214
|
[EXPLICIT_GENERIC_REQUIRED]: never;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as DuckConnectionParams, n as InferZodRelaxedDataSchema, t as TableSchemaZod } from "./index-
|
|
1
|
+
import { l as DuckConnectionParams, n as InferZodRelaxedDataSchema, t as TableSchemaZod } from "./index-C4FVZRX7.mjs";
|
|
2
2
|
import { DuckDBConnection, DuckDBDecimalType, DuckDBListType, DuckDBType } from "@duckdb/node-api";
|
|
3
3
|
import { Logger } from "@logtape/logtape";
|
|
4
4
|
import * as z from "zod";
|
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(
|
|
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);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as duckDsnZodSchema, c as assertValidTableName, d as duckConnectionParamsZodSchema, i as duckValidatorsZod, n as InferZodRelaxedDataSchema, o as assertValidAliasName, r as ensureZodTableSchema, s as assertValidSchemaName, t as TableSchemaZod, u as duckAllConnectionOptionsZodSchema } from "../../index-
|
|
1
|
+
import { a as duckDsnZodSchema, c as assertValidTableName, d as duckConnectionParamsZodSchema, i as duckValidatorsZod, n as InferZodRelaxedDataSchema, o as assertValidAliasName, r as ensureZodTableSchema, s as assertValidSchemaName, t as TableSchemaZod, u as duckAllConnectionOptionsZodSchema } from "../../index-C4FVZRX7.mjs";
|
|
2
2
|
export { type InferZodRelaxedDataSchema, type TableSchemaZod, assertValidAliasName, assertValidSchemaName, assertValidTableName, duckAllConnectionOptionsZodSchema, duckConnectionParamsZodSchema, duckDsnZodSchema, duckValidatorsZod, ensureZodTableSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowblade/sqlduck",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.2",
|
|
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.
|
|
111
|
-
"@vitest/ui": "4.1.
|
|
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.
|
|
140
|
+
"vitest": "4.1.11"
|
|
141
141
|
},
|
|
142
142
|
"files": [
|
|
143
143
|
"dist"
|