aiex-cli 0.0.2-beta.3 → 0.0.2-beta.4

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/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { S as version, T as formatDoctorDiagnosticsJson, _ as createConfig, a as parseJsonSchema, b as name, c as getDefaultAIConfig, d as DEFAULT_MARKITDOWN_CONFIG, f as DEFAULT_MINERU_CONFIG, g as AIConfigSchema, h as PLACEHOLDER_TEXT, i as JsonSchemaDefinitionSchema, l as readAIConfig, m as PLACEHOLDER_SCHEMA, n as createMigrationConfig, o as toSnakeCase, p as DEFAULT_PROMPT_CONFIG, s as generateDrizzleSchema, t as collectDoctorDiagnostics, u as writeAIConfig, v as seedConfig, w as doctorDiagnosticsTableRows, x as package_default, y as description } from "./doctor-collector-CGUF999y.mjs";
1
+ import { S as version, T as formatDoctorDiagnosticsJson, _ as createConfig, a as parseJsonSchema, b as name, c as getDefaultAIConfig, d as DEFAULT_MARKITDOWN_CONFIG, f as DEFAULT_MINERU_CONFIG, g as AIConfigSchema, h as PLACEHOLDER_TEXT, i as JsonSchemaDefinitionSchema, l as readAIConfig, m as PLACEHOLDER_SCHEMA, n as createMigrationConfig, o as toSnakeCase, p as DEFAULT_PROMPT_CONFIG, s as generateDrizzleSchema, t as collectDoctorDiagnostics, u as writeAIConfig, v as seedConfig, w as doctorDiagnosticsTableRows, x as package_default, y as description } from "./doctor-collector-DoJqOYMT.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import fs from "node:fs/promises";
4
4
  import os from "node:os";
@@ -24,9 +24,9 @@ import fs$1 from "node:fs";
24
24
  import Database from "better-sqlite3";
25
25
  import { glob, globSync } from "tinyglobby";
26
26
  import { Client, extractNotionId } from "@notionhq/client";
27
+ import { Buffer } from "node:buffer";
27
28
  import { execa } from "execa";
28
29
  import { extractText, getDocumentProxy, getMeta } from "unpdf";
29
- import { Buffer } from "node:buffer";
30
30
  import { execFile } from "node:child_process";
31
31
  import { promisify } from "node:util";
32
32
  import { serve } from "@hono/node-server";
@@ -13623,11 +13623,6 @@ async function resolveNotionDataSource(notion, inputId) {
13623
13623
  };
13624
13624
  } catch {}
13625
13625
  const database = await notion.databases.retrieve({ database_id: id });
13626
- if (hasProperties(database)) return {
13627
- databaseId: database.id ?? id,
13628
- properties: database.properties,
13629
- parent: { database_id: database.id ?? id }
13630
- };
13631
13626
  const dataSourceId = firstDataSourceId(database);
13632
13627
  if (!dataSourceId) throw new Error("No data source found for this Notion database. Copy the data source link from Notion, or share the source database with the integration.");
13633
13628
  const dataSource = await notion.dataSources.retrieve({ data_source_id: dataSourceId });
@@ -13682,7 +13677,7 @@ async function writeNotionPage(config, schemaName, data) {
13682
13677
  if (propertyValue) properties[notionPropertyName] = propertyValue;
13683
13678
  }
13684
13679
  const titleProperty = findTitleProperty(databaseProperties, schemaConfig.titleProperty);
13685
- if (titleProperty && !properties[titleProperty]) properties[titleProperty] = buildPropertyValue("title", Object.entries(data).find(([, value]) => typeof value === "string" && value.trim())?.[1] ?? schemaName);
13680
+ if (titleProperty && !properties[titleProperty]) properties[titleProperty] = buildPropertyValue("title", schemaName);
13686
13681
  if (Object.keys(properties).length === 0) throw new Error("No extracted fields matched Notion database properties.");
13687
13682
  return {
13688
13683
  pageId: (await notion.pages.create({
@@ -13734,7 +13729,7 @@ function formatCommandError(error, command$1) {
13734
13729
  }
13735
13730
  async function countPdfPages(input) {
13736
13731
  try {
13737
- return (await getDocumentProxy(input)).numPages;
13732
+ return (await getDocumentProxy(Buffer.isBuffer(input) ? new Uint8Array(input) : input)).numPages;
13738
13733
  } catch {
13739
13734
  return 0;
13740
13735
  }
@@ -14176,6 +14171,15 @@ function getIdArg(args) {
14176
14171
  const positional = args._;
14177
14172
  return Array.isArray(positional) && typeof positional[0] === "string" ? positional[0] : "";
14178
14173
  }
14174
+ function isExtractSubCommand(rawArgs) {
14175
+ if (!Array.isArray(rawArgs)) return false;
14176
+ return rawArgs.some((arg) => typeof arg === "string" && [
14177
+ "history",
14178
+ "show",
14179
+ "retry",
14180
+ "rm"
14181
+ ].includes(arg));
14182
+ }
14179
14183
  function formatSource(source) {
14180
14184
  return source.type === "file" ? source.fileName || "file" : "text";
14181
14185
  }
@@ -14423,7 +14427,8 @@ const extractCommand = defineCommand({
14423
14427
  default: false
14424
14428
  }
14425
14429
  },
14426
- async run({ args }) {
14430
+ async run({ args, rawArgs }) {
14431
+ if (isExtractSubCommand(rawArgs)) return;
14427
14432
  intro(pc.inverse(" aiex extract "));
14428
14433
  const config = createMigrationConfig(process.cwd());
14429
14434
  const aiexDir = path.dirname(config.schemaPath);
@@ -65,7 +65,7 @@ function doctorDiagnosticsTableRows(d) {
65
65
  //#endregion
66
66
  //#region package.json
67
67
  var name = "aiex-cli";
68
- var version = "0.0.2-beta.3";
68
+ var version = "0.0.2-beta.4";
69
69
  var description = "JSON Schema → SQLite with AI-powered data extraction";
70
70
  var package_default = {
71
71
  name,
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as buildDoctorDiagnostics, T as formatDoctorDiagnosticsJson, a as parseJsonSchema, i as JsonSchemaDefinitionSchema, n as createMigrationConfig, r as generateDrizzleConfig, s as generateDrizzleSchema, t as collectDoctorDiagnostics, w as doctorDiagnosticsTableRows } from "./doctor-collector-CGUF999y.mjs";
1
+ import { C as buildDoctorDiagnostics, T as formatDoctorDiagnosticsJson, a as parseJsonSchema, i as JsonSchemaDefinitionSchema, n as createMigrationConfig, r as generateDrizzleConfig, s as generateDrizzleSchema, t as collectDoctorDiagnostics, w as doctorDiagnosticsTableRows } from "./doctor-collector-DoJqOYMT.mjs";
2
2
 
3
3
  export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aiex-cli",
3
3
  "type": "module",
4
- "version": "0.0.2-beta.3",
4
+ "version": "0.0.2-beta.4",
5
5
  "description": "JSON Schema → SQLite with AI-powered data extraction",
6
6
  "author": "OSpoon <zxin088@gmail.com>",
7
7
  "license": "MIT",