aiex-cli 0.0.2-beta.10 → 0.0.2-beta.12

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-DlG_mJKG.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-CnHdgNay.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import fs from "node:fs/promises";
4
4
  import os from "node:os";
@@ -14964,6 +14964,7 @@ function aiRoutes(config) {
14964
14964
  //#region src/server/routes/data.ts
14965
14965
  const FILE_REGEX = /\.json$/;
14966
14966
  const EXTRACTION_TIMESTAMP_RE = /-\d{4}-\d{2}-\d{2}T/;
14967
+ const INTERNAL_ROWID_COLUMN = "__aiex_rowid";
14967
14968
  const TIMESTAMP_CLEANUP = /(\d{2})-(\d{2})-(\d{2})/;
14968
14969
  const TIMESTAMP_TZ = /(\d{3})Z/;
14969
14970
  const tableParamSchema = z.object({ name: z.string().regex(/^[a-z][a-z0-9_]*$/) });
@@ -14980,6 +14981,31 @@ function invalidParamResponse$1(message) {
14980
14981
  if (!result.success) return c.json({ error: message }, 400);
14981
14982
  };
14982
14983
  }
14984
+ function getAuditNotionStatus(record) {
14985
+ if (record.notionPages?.length) return "synced";
14986
+ if (record.status === "failed") return "failed";
14987
+ return "not_synced";
14988
+ }
14989
+ async function getRowExtractionActions(aiexDir, tableName) {
14990
+ const actions = /* @__PURE__ */ new Map();
14991
+ const auditRecords = await listExtractionAuditRecords(aiexDir);
14992
+ for (const record of auditRecords) {
14993
+ if (!record.outputName) continue;
14994
+ for (const inserted of record.tablesInserted ?? []) {
14995
+ if (inserted.table !== tableName) continue;
14996
+ const key = String(inserted.rowId);
14997
+ if (actions.has(key)) continue;
14998
+ const notionPages = record.notionPages?.length ? record.notionPages : void 0;
14999
+ actions.set(key, {
15000
+ extractionName: record.outputName,
15001
+ notionStatus: getAuditNotionStatus(record),
15002
+ notionPages,
15003
+ notionError: !notionPages && record.status === "failed" ? record.error : void 0
15004
+ });
15005
+ }
15006
+ }
15007
+ return actions;
15008
+ }
14983
15009
  function schemaNameFromExtractionFile(name$1) {
14984
15010
  const stem = name$1.replace(FILE_REGEX, "");
14985
15011
  const match = stem.match(EXTRACTION_TIMESTAMP_RE);
@@ -15104,16 +15130,24 @@ function dataRoutes(config) {
15104
15130
  const offset = (page - 1) * pageSize;
15105
15131
  const totalPages = Math.max(1, Math.ceil(total / pageSize));
15106
15132
  const result = await sql`
15107
- select *
15133
+ select rowid as ${sql.raw(INTERNAL_ROWID_COLUMN)}, *
15108
15134
  from ${sql.table(tableName)}
15109
15135
  ${searchCondition}
15110
15136
  ${orderBy}
15111
15137
  limit ${pageSize}
15112
15138
  offset ${offset}
15113
15139
  `.execute(db);
15140
+ const actionsByRowId = await getRowExtractionActions(aiexDir, tableName);
15141
+ const rowActions = Object.fromEntries(result.rows.map((row, index) => {
15142
+ const rowId = row[INTERNAL_ROWID_COLUMN];
15143
+ const action = rowId === null || rowId === void 0 ? void 0 : actionsByRowId.get(String(rowId));
15144
+ return action ? [String(index), action] : null;
15145
+ }).filter((entry) => !!entry));
15146
+ const rows = result.rows.map(({ [INTERNAL_ROWID_COLUMN]: _rowid, ...row }) => row);
15114
15147
  return c.json({
15115
15148
  columns,
15116
- rows: result.rows,
15149
+ rows,
15150
+ rowActions,
15117
15151
  total,
15118
15152
  page,
15119
15153
  pageSize,
@@ -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.10";
68
+ var version = "0.0.2-beta.12";
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-DlG_mJKG.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-CnHdgNay.mjs";
2
2
 
3
3
  export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };