@antfly/embedded 0.3.0-rc.8 → 0.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/kysely.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-4KIXT2VQ.js";
3
+ } from "./chunk-MUBX3DSJ.js";
4
4
 
5
5
  // src/kysely.ts
6
6
  import {
7
7
  PostgresAdapter,
8
8
  PostgresQueryCompiler
9
9
  } from "kysely";
10
+ import { DEFAULT_MIGRATION_LOCK_TABLE, DEFAULT_MIGRATION_TABLE } from "kysely/migration";
10
11
  var KyselyConnection = class {
11
12
  constructor(sql) {
12
13
  this.sql = sql;
@@ -129,7 +130,7 @@ var AntflyDialect = class {
129
130
  },
130
131
  async getTables(options) {
131
132
  const names = (await database.listTables()).filter(
132
- (name) => name !== "default" && (options?.withInternalKyselyTables || !name.startsWith("kysely_"))
133
+ (name) => name !== "default" && (options?.withInternalKyselyTables || name !== DEFAULT_MIGRATION_TABLE && name !== DEFAULT_MIGRATION_LOCK_TABLE)
133
134
  );
134
135
  return Promise.all(
135
136
  names.map(async (name) => {
@@ -144,19 +145,30 @@ var AntflyDialect = class {
144
145
  } finally {
145
146
  await handle.close();
146
147
  }
147
- const document = schema.document_schemas?.[schema.default_type ?? "row"]?.schema;
148
+ const documents = Object.values(schema.document_schemas ?? {}).map(
149
+ (document) => document.schema
150
+ );
148
151
  return {
149
152
  name,
150
153
  schema: "public",
151
154
  isView: false,
152
155
  isForeign: false,
153
- columns: described.columns.map((column) => ({
154
- name: column.name,
155
- dataType: column.type,
156
- isNullable: column.name !== "_id" && !document?.required?.includes(column.name) && document?.properties?.[column.name]?.nullable !== false,
157
- isAutoIncrementing: false,
158
- hasDefaultValue: schema.column_defaults?.some((entry) => entry.column === column.name) ?? false
159
- }))
156
+ columns: described.columns.map((column) => {
157
+ return {
158
+ name: column.name,
159
+ // The embedded decoder returns every integer width as bigint.
160
+ // Exact NUMERIC uses decimal text; other structured values
161
+ // retain conservative metadata for schema generation.
162
+ dataType: column.element_type === "numeric" && column.type !== "array" ? "numeric" : column.type,
163
+ isNullable: column.name !== "_id" && (documents.length === 0 || documents.some((document) => {
164
+ const property = document?.properties?.[column.name];
165
+ return !property || !document?.required?.includes(column.name) || property.nullable === true || property.type === "null" || Array.isArray(property.type) && property.type.includes("null");
166
+ })),
167
+ isAutoIncrementing: false,
168
+ hasDefaultValue: schema.column_defaults?.some((entry) => entry.column === column.name) ?? false,
169
+ isGeneratedAlways: schema.generated_columns?.some((entry) => entry.column === column.name) ?? false
170
+ };
171
+ })
160
172
  };
161
173
  })
162
174
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antfly/embedded",
3
- "version": "0.3.0-rc.8",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript/Node binding for local Antfly databases and inference (libantfly C ABI)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -56,6 +56,7 @@
56
56
  },
57
57
  "homepage": "https://github.com/antflydb/antfly/tree/main/ts/packages/embedded#readme",
58
58
  "devDependencies": {
59
+ "@antfly/sdk": "workspace:*",
59
60
  "@types/node": "^25.9.3",
60
61
  "kysely": "^0.29.6",
61
62
  "tsup": "^8.5.1",
@@ -75,9 +76,9 @@
75
76
  "win32"
76
77
  ],
77
78
  "optionalDependencies": {
78
- "@antfly/embedded-darwin-arm64": "0.3.0-rc.8",
79
- "@antfly/embedded-linux-arm64": "0.3.0-rc.8",
80
- "@antfly/embedded-linux-x64": "0.3.0-rc.8"
79
+ "@antfly/embedded-darwin-arm64": "0.3.0",
80
+ "@antfly/embedded-linux-arm64": "0.3.0",
81
+ "@antfly/embedded-linux-x64": "0.3.0"
81
82
  },
82
83
  "peerDependencies": {
83
84
  "kysely": "^0.29.6"