kysely-gen 0.6.0 → 0.6.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/cli.js +32 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -44615,10 +44615,11 @@ function serialize(program2) {
44615
44615
  // src/transform/filter.ts
44616
44616
  var import_micromatch = __toESM(require_micromatch(), 1);
44617
44617
  function filterTables(tables, options) {
44618
+ const nonPartitionTables = tables.filter((t) => !t.isPartition);
44618
44619
  if (!options || !options.includePattern && !options.excludePattern) {
44619
- return tables;
44620
+ return nonPartitionTables;
44620
44621
  }
44621
- return tables.filter((table) => {
44622
+ return nonPartitionTables.filter((table) => {
44622
44623
  const tablePattern = `${table.schema}.${table.name}`;
44623
44624
  if (options.excludePattern && options.excludePattern.length > 0) {
44624
44625
  if (import_micromatch.default.isMatch(tablePattern, options.excludePattern)) {
@@ -45095,10 +45096,13 @@ function mapPostgresType(dataType, options) {
45095
45096
  if (isArray || dataType.endsWith("[]")) {
45096
45097
  const baseTypeName = dataType.endsWith("[]") ? dataType.slice(0, -2) : dataType;
45097
45098
  const elementType = mapPostgresType(baseTypeName, { isNullable: false, isArray: false, unknownTypes });
45098
- const arrayType = {
45099
- kind: "array",
45100
- elementType
45101
- };
45099
+ const isSimple = elementType.kind === "primitive" && ["boolean", "number", "string"].includes(elementType.value);
45100
+ let arrayType;
45101
+ if (isSimple) {
45102
+ arrayType = { kind: "array", elementType };
45103
+ } else {
45104
+ arrayType = { kind: "generic", name: "ArrayType", typeArguments: [elementType] };
45105
+ }
45102
45106
  if (isNullable) {
45103
45107
  return {
45104
45108
  kind: "union",
@@ -45760,6 +45764,28 @@ function transformDatabase(metadata, options) {
45760
45764
  },
45761
45765
  exported: true
45762
45766
  });
45767
+ declarations.push({
45768
+ kind: "typeAlias",
45769
+ name: "ArrayType<T>",
45770
+ type: {
45771
+ kind: "raw",
45772
+ value: `ArrayTypeImpl<T> extends (infer U)[]
45773
+ ? U[]
45774
+ : ArrayTypeImpl<T>`
45775
+ },
45776
+ exported: true
45777
+ });
45778
+ declarations.push({
45779
+ kind: "typeAlias",
45780
+ name: "ArrayTypeImpl<T>",
45781
+ type: {
45782
+ kind: "raw",
45783
+ value: `T extends ColumnType<infer S, infer I, infer U>
45784
+ ? ColumnType<S[], I[], U[]>
45785
+ : T[]`
45786
+ },
45787
+ exported: true
45788
+ });
45763
45789
  declarations.push({
45764
45790
  kind: "typeAlias",
45765
45791
  name: "JsonPrimitive",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely-gen",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Database type generator for Kysely - Supports PostgreSQL, MySQL, and SQLite",
5
5
  "type": "module",
6
6
  "license": "MIT",