aiex-cli 0.0.5-beta.6 → 0.0.6-beta.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.
- package/README.md +0 -11
- package/dist/cli.mjs +197 -900
- package/dist/{doctor-collector-BpqhXNcO.mjs → doctor-collector-hWEvJ4lw.mjs} +89 -44
- package/dist/index.d.mts +88 -91
- package/dist/index.mjs +1 -1
- package/dist/web/assets/AISettings-BlyTFIIy.js +272 -0
- package/dist/web/assets/{DataBrowser-BGkZb9FV.js → DataBrowser-GAA-pGq0.js} +1 -1
- package/dist/web/assets/ExtractionViewer-DqIrBGNK.js +1 -0
- package/dist/web/assets/{api-client-gQAAOw0v.js → api-client-b4ZBXpNH.js} +1 -1
- package/dist/web/assets/index-CvY9TGny.css +2 -0
- package/dist/web/assets/{index-BQKZKzzP.js → index-Dlze68g1.js} +3 -3
- package/dist/web/index.html +3 -3
- package/dist/{zh-CN-DkillGHx.mjs → zh-CN-Qcn0DHFh.mjs} +22 -16
- package/package.json +1 -3
- package/dist/web/assets/AISettings-sVI4PTNB.js +0 -264
- package/dist/web/assets/ExtractionViewer-DNrkSECj.js +0 -1
- package/dist/web/assets/index-BU58oIRd.css +0 -2
|
@@ -74,7 +74,7 @@ function doctorDiagnosticsTableRows(d) {
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region package.json
|
|
76
76
|
var name = "aiex-cli";
|
|
77
|
-
var version = "0.0.
|
|
77
|
+
var version = "0.0.6-beta.1";
|
|
78
78
|
var description = "JSON Schema → SQLite with AI-powered data extraction";
|
|
79
79
|
var package_default = {
|
|
80
80
|
name,
|
|
@@ -158,11 +158,9 @@ var package_default = {
|
|
|
158
158
|
"hono": "catalog:",
|
|
159
159
|
"i18next": "catalog:",
|
|
160
160
|
"i18next-fs-backend": "catalog:",
|
|
161
|
-
"js-tiktoken": "catalog:",
|
|
162
161
|
"jsonfile": "catalog:",
|
|
163
162
|
"jsonrepair": "catalog:",
|
|
164
163
|
"kysely": "catalog:",
|
|
165
|
-
"marked": "catalog:",
|
|
166
164
|
"mime": "catalog:",
|
|
167
165
|
"open": "catalog:",
|
|
168
166
|
"p-retry": "catalog:",
|
|
@@ -211,6 +209,7 @@ function seedConfig(config = createConfig()) {
|
|
|
211
209
|
//#endregion
|
|
212
210
|
//#region src/core/ai-extraction/schemas.ts
|
|
213
211
|
const ModelCapabilitiesSchema = z.object({
|
|
212
|
+
vision: z.boolean(),
|
|
214
213
|
structuredOutput: z.boolean(),
|
|
215
214
|
maxTokens: z.number().int().positive().optional(),
|
|
216
215
|
maxOutputTokens: z.number().int().positive().optional()
|
|
@@ -229,19 +228,14 @@ const PromptConfigSchema = z.object({
|
|
|
229
228
|
systemTemplate: z.string().min(1),
|
|
230
229
|
userTemplate: z.string().min(1)
|
|
231
230
|
});
|
|
232
|
-
const ExtractionConfigSchema = z.object({
|
|
233
|
-
outputDir: z.string().min(1),
|
|
234
|
-
mode: z.enum(["pipeline"]).default("pipeline").optional(),
|
|
235
|
-
concurrency: z.number().int().min(1).optional(),
|
|
236
|
-
maxTokens: z.number().int().positive().default(8e3).optional(),
|
|
237
|
-
overlapSize: z.number().int().nonnegative().optional()
|
|
238
|
-
});
|
|
231
|
+
const ExtractionConfigSchema = z.object({ outputDir: z.string().min(1) });
|
|
239
232
|
const ImageOcrConfigSchema = z.object({
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
233
|
+
ocrFallback: z.enum([
|
|
234
|
+
"auto",
|
|
235
|
+
"off",
|
|
236
|
+
"local"
|
|
237
|
+
]).default("auto").optional(),
|
|
238
|
+
ocrLanguages: z.string().min(1).optional(),
|
|
245
239
|
ocrMinConfidence: z.number().min(0).max(1).optional()
|
|
246
240
|
});
|
|
247
241
|
const ExternalPdfConverterConfigSchema = z.object({
|
|
@@ -264,10 +258,14 @@ const PdfConfigSchema = z.object({
|
|
|
264
258
|
"unpdf",
|
|
265
259
|
"mineru",
|
|
266
260
|
"mineru_api",
|
|
261
|
+
"markitdown",
|
|
262
|
+
"marker",
|
|
267
263
|
"external"
|
|
268
264
|
]),
|
|
269
265
|
mineru: ExternalPdfConverterConfigSchema.optional(),
|
|
270
266
|
mineruApi: MineruApiPdfConverterConfigSchema.optional(),
|
|
267
|
+
markitdown: ExternalPdfConverterConfigSchema.optional(),
|
|
268
|
+
marker: ExternalPdfConverterConfigSchema.optional(),
|
|
271
269
|
external: ExternalPdfConverterConfigSchema.optional()
|
|
272
270
|
});
|
|
273
271
|
const LangfuseConfigSchema = z.object({
|
|
@@ -307,7 +305,16 @@ const PLACEHOLDER_SCHEMA = "{schema}";
|
|
|
307
305
|
const PLACEHOLDER_TEXT = "{text}";
|
|
308
306
|
const DEFAULT_MODELS = [{
|
|
309
307
|
name: "qwen-plus",
|
|
310
|
-
capabilities: {
|
|
308
|
+
capabilities: {
|
|
309
|
+
vision: false,
|
|
310
|
+
structuredOutput: true
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
313
|
+
name: "qwen-vl-plus",
|
|
314
|
+
capabilities: {
|
|
315
|
+
vision: true,
|
|
316
|
+
structuredOutput: true
|
|
317
|
+
}
|
|
311
318
|
}];
|
|
312
319
|
const DEFAULT_PROVIDER_CONFIG = {
|
|
313
320
|
baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
@@ -324,19 +331,13 @@ Extraction requirements:
|
|
|
324
331
|
1. Extract strictly according to the field names and types defined in the structure
|
|
325
332
|
2. If the text lacks information for a field, set that field to null
|
|
326
333
|
3. Do not add fields that do not exist in the structure definition
|
|
327
|
-
4.
|
|
328
|
-
5. Normalize values to the target type: numbers as JSON numbers, booleans as true/false, dates and formatted strings exactly as requested by the field format
|
|
329
|
-
6. For repeated or conflicting mentions, prefer the most specific final value in the source text and ignore placeholder values such as N/A, unknown, TBD, or empty strings
|
|
330
|
-
7. Maintain data accuracy and completeness`,
|
|
334
|
+
4. Maintain data accuracy and completeness`,
|
|
331
335
|
userTemplate: `Please extract data from the following text:
|
|
332
336
|
{text}`
|
|
333
337
|
};
|
|
334
|
-
const DEFAULT_EXTRACTION_CONFIG = {
|
|
335
|
-
outputDir: ".aiex/extracted",
|
|
336
|
-
mode: "pipeline"
|
|
337
|
-
};
|
|
338
|
+
const DEFAULT_EXTRACTION_CONFIG = { outputDir: ".aiex/extracted" };
|
|
338
339
|
const DEFAULT_IMAGE_OCR_CONFIG = {
|
|
339
|
-
|
|
340
|
+
ocrFallback: "auto",
|
|
340
341
|
ocrLanguages: "en-US, zh-Hans",
|
|
341
342
|
ocrMinConfidence: 0
|
|
342
343
|
};
|
|
@@ -351,6 +352,26 @@ const DEFAULT_MINERU_CONFIG = {
|
|
|
351
352
|
timeout: 600,
|
|
352
353
|
fallbackToUnpdf: true
|
|
353
354
|
};
|
|
355
|
+
const DEFAULT_MARKITDOWN_CONFIG = {
|
|
356
|
+
command: "markitdown",
|
|
357
|
+
args: [
|
|
358
|
+
"{input}",
|
|
359
|
+
"-o",
|
|
360
|
+
"{outputDir}/{basename}.md"
|
|
361
|
+
],
|
|
362
|
+
timeout: 600,
|
|
363
|
+
fallbackToUnpdf: true
|
|
364
|
+
};
|
|
365
|
+
const DEFAULT_MARKER_CONFIG = {
|
|
366
|
+
command: "marker_single",
|
|
367
|
+
args: [
|
|
368
|
+
"{input}",
|
|
369
|
+
"--output_dir",
|
|
370
|
+
"{outputDir}"
|
|
371
|
+
],
|
|
372
|
+
timeout: 600,
|
|
373
|
+
fallbackToUnpdf: true
|
|
374
|
+
};
|
|
354
375
|
const DEFAULT_MINERU_API_CONFIG = {
|
|
355
376
|
token: "",
|
|
356
377
|
baseURL: "https://mineru.net/api/v4",
|
|
@@ -362,7 +383,9 @@ const DEFAULT_MINERU_API_CONFIG = {
|
|
|
362
383
|
const DEFAULT_PDF_CONFIG = {
|
|
363
384
|
converter: "unpdf",
|
|
364
385
|
mineru: DEFAULT_MINERU_CONFIG,
|
|
365
|
-
mineruApi: DEFAULT_MINERU_API_CONFIG
|
|
386
|
+
mineruApi: DEFAULT_MINERU_API_CONFIG,
|
|
387
|
+
markitdown: DEFAULT_MARKITDOWN_CONFIG,
|
|
388
|
+
marker: DEFAULT_MARKER_CONFIG
|
|
366
389
|
};
|
|
367
390
|
const DEFAULT_AI_CONFIG = {
|
|
368
391
|
provider: DEFAULT_PROVIDER_CONFIG,
|
|
@@ -534,8 +557,6 @@ const en = {
|
|
|
534
557
|
file: {
|
|
535
558
|
hashWarning: "Failed to calculate file hash for {{file}}: {{error}}",
|
|
536
559
|
alreadyProcessed: "File {{file}} (hash: {{hash}}) has already been processed successfully. Skipping.",
|
|
537
|
-
visionTranscribed: "Transcribed image text via AI vision model ({{model}})",
|
|
538
|
-
visionTranscribeFailed: "Vision model transcription failed for {{model}}, falling back to local OCR",
|
|
539
560
|
ocrText: "Extracted image text via local OCR (confidence: {{confidence}}%)",
|
|
540
561
|
pdfFallback: "Fell back to unpdf — {{count}} page(s) extracted",
|
|
541
562
|
pdfConverted: "Converted PDF via {{name}}, {{count}} page(s)",
|
|
@@ -546,12 +567,6 @@ const en = {
|
|
|
546
567
|
extractFail: "Extraction failed",
|
|
547
568
|
extractComplete: "Extraction complete",
|
|
548
569
|
extractRetry: "API responded with {{code}}, retrying in {{delay}}s ({{attempt}}/{{max}})",
|
|
549
|
-
chunking: "Input text ({{length}} tokens) exceeds limit ({{limit}} tokens). Splitting into chunks...",
|
|
550
|
-
chunksCount: "Split into {{count}} chunk(s).",
|
|
551
|
-
extractingChunk: "Extracting chunk {{current}}/{{total}}...",
|
|
552
|
-
extractRetryChunk: "Chunk {{current}}/{{total}} API responded with {{code}}, retrying in {{delay}}s ({{attempt}}/{{max}})",
|
|
553
|
-
extractFailChunk: "Extraction failed for chunk {{current}}/{{total}}",
|
|
554
|
-
validationFail: "Merged data validation failed",
|
|
555
570
|
resultSaved: "Result saved: {{path}}",
|
|
556
571
|
tokenUsage: "Token usage: prompt={{prompt}}, completion={{completion}}, total={{total}}",
|
|
557
572
|
insertingDb: "Inserting into database...",
|
|
@@ -659,10 +674,14 @@ const en = {
|
|
|
659
674
|
ai: {
|
|
660
675
|
apiKeyMissing: "API Key not configured. Please configure AI settings in the web UI.",
|
|
661
676
|
extractionNotObject: "Extraction result is not an object and cannot be written to Notion.",
|
|
662
|
-
noModels: "No AI models configured. Please add at least one model in AI Settings."
|
|
677
|
+
noModels: "No AI models configured. Please add at least one model in AI Settings.",
|
|
678
|
+
noVisionModel: "Image input requires a model with vision capability{{hint}}.",
|
|
679
|
+
noVisionModelContext: "No vision-capable model with sufficient context window (≥{{tokens}} tokens) found{{hint}}.",
|
|
680
|
+
addSuitableModel: " Please add a suitable vision-capable model in AI Settings."
|
|
663
681
|
},
|
|
664
682
|
ocr: {
|
|
665
683
|
platformUnsupported: "Local OCR is only available on macOS or Windows. Current platform: {{platform}}.",
|
|
684
|
+
disabled: "Image OCR fallback is disabled in AI settings.",
|
|
666
685
|
unavailable: "Local OCR is unavailable. Install optional dependency @napi-rs/system-ocr and approve its native build scripts. {{error}}",
|
|
667
686
|
noText: "Local OCR did not recognize any text in the image.",
|
|
668
687
|
lowConfidence: "Local OCR confidence {{confidence}}% is below the configured minimum {{min}}%."
|
|
@@ -764,19 +783,26 @@ const en = {
|
|
|
764
783
|
models: "Models",
|
|
765
784
|
addModel: "Add Model",
|
|
766
785
|
modelName: "Model name (e.g. gpt-4o)",
|
|
786
|
+
structuredOutput: "Structured Output",
|
|
787
|
+
textOnlyOutput: "Text-only Output",
|
|
788
|
+
visionSupported: "Vision Supported",
|
|
789
|
+
visionUnsupported: "Vision Unsupported",
|
|
767
790
|
subscribe: "Registry",
|
|
768
791
|
imageInput: "Image Input",
|
|
769
792
|
imageInputSummary: {
|
|
770
|
-
visionModel: "Image
|
|
771
|
-
|
|
772
|
-
ocrLocal: "Image text will
|
|
793
|
+
visionModel: "Image files will use your configured vision model first.",
|
|
794
|
+
ocrFallback: "No vision model is configured, and local OCR fallback is disabled.",
|
|
795
|
+
ocrLocal: "No vision model is configured. Image text will require local OCR on macOS or Windows.",
|
|
796
|
+
ocrAuto: "No vision model is configured. On macOS or Windows, local OCR will be tried automatically for text-heavy images."
|
|
773
797
|
},
|
|
798
|
+
visionModelConfigured: "Vision model configured",
|
|
799
|
+
noVisionModel: "No vision model",
|
|
774
800
|
advancedImageSettings: "Advanced image settings",
|
|
775
801
|
hideAdvancedImageSettings: "Hide advanced image settings",
|
|
776
|
-
ocrFallback: "
|
|
802
|
+
ocrFallback: "OCR fallback",
|
|
777
803
|
ocrLanguages: "Languages",
|
|
778
804
|
ocrMinConfidence: "Minimum confidence",
|
|
779
|
-
ocrHint: "
|
|
805
|
+
ocrHint: "Image extraction always prefers a vision model. OCR fallback is only used when no vision model is available.",
|
|
780
806
|
pdfConversion: "PDF Conversion",
|
|
781
807
|
converter: "Converter",
|
|
782
808
|
command: "Command",
|
|
@@ -851,11 +877,14 @@ const en = {
|
|
|
851
877
|
converterOptions: {
|
|
852
878
|
unpdf: "Built-in text extraction (unpdf)",
|
|
853
879
|
mineru: "MinerU (mineru)",
|
|
880
|
+
markitdown: "MarkItDown (markitdown)",
|
|
881
|
+
marker: "Marker (marker_single)",
|
|
854
882
|
external: "Custom External Command"
|
|
855
883
|
},
|
|
856
884
|
ocrFallbackOptions: {
|
|
857
|
-
|
|
858
|
-
|
|
885
|
+
auto: "Auto on macOS or Windows when no vision model exists",
|
|
886
|
+
off: "Off",
|
|
887
|
+
local: "Require local OCR"
|
|
859
888
|
}
|
|
860
889
|
},
|
|
861
890
|
prompt: {
|
|
@@ -927,7 +956,7 @@ async function initI18n(lng) {
|
|
|
927
956
|
fallbackLng: "en",
|
|
928
957
|
resources: {
|
|
929
958
|
"en": { translation: en },
|
|
930
|
-
"zh-CN": { translation: await import("./zh-CN-
|
|
959
|
+
"zh-CN": { translation: await import("./zh-CN-Qcn0DHFh.mjs").then((m) => m.zhCN) }
|
|
931
960
|
},
|
|
932
961
|
interpolation: { escapeValue: false },
|
|
933
962
|
returnNull: false
|
|
@@ -951,6 +980,20 @@ const defaultRuntime = {
|
|
|
951
980
|
return await import("@napi-rs/system-ocr");
|
|
952
981
|
}
|
|
953
982
|
};
|
|
983
|
+
function imageOcrMode(config) {
|
|
984
|
+
return config?.ocrFallback ?? "auto";
|
|
985
|
+
}
|
|
986
|
+
function hasVisionModel(aiConfig, modelOverride) {
|
|
987
|
+
if (modelOverride) return modelOverride.capabilities.vision;
|
|
988
|
+
return aiConfig?.provider.models.some((model) => model.capabilities.vision) ?? true;
|
|
989
|
+
}
|
|
990
|
+
function shouldUseImageOcrFallback(aiConfig, modelOverride, runtime = defaultRuntime) {
|
|
991
|
+
if (hasVisionModel(aiConfig, modelOverride)) return false;
|
|
992
|
+
const mode = imageOcrMode(aiConfig?.image);
|
|
993
|
+
if (mode === "off") return false;
|
|
994
|
+
if (mode === "local") return true;
|
|
995
|
+
return isLocalOcrPlatform(runtime.platform);
|
|
996
|
+
}
|
|
954
997
|
function isLocalOcrPlatform(platform) {
|
|
955
998
|
return platform === "darwin" || platform === "win32";
|
|
956
999
|
}
|
|
@@ -958,7 +1001,9 @@ function parseOcrLanguages(languages) {
|
|
|
958
1001
|
return (languages ?? DEFAULT_OCR_LANGUAGES).split(",").map((language) => language.trim()).filter(Boolean);
|
|
959
1002
|
}
|
|
960
1003
|
async function recognizeImageText(imagePath, config, runtime = defaultRuntime) {
|
|
1004
|
+
const mode = imageOcrMode(config);
|
|
961
1005
|
if (!isLocalOcrPlatform(runtime.platform)) throw new Error(t("errors.ocr.platformUnsupported", { platform: runtime.platform }));
|
|
1006
|
+
if (mode === "off") throw new Error(t("errors.ocr.disabled"));
|
|
962
1007
|
let localOcr;
|
|
963
1008
|
try {
|
|
964
1009
|
localOcr = await runtime.loadLocalOcr();
|
|
@@ -1491,4 +1536,4 @@ async function collectDoctorDiagnostics(options = {}) {
|
|
|
1491
1536
|
}
|
|
1492
1537
|
|
|
1493
1538
|
//#endregion
|
|
1494
|
-
export {
|
|
1539
|
+
export { doctorDiagnosticsTableRows as A, createConfig as C, package_default as D, name as E, version as O, AIConfigSchema as S, description as T, DEFAULT_MINERU_API_CONFIG as _, parseJsonSchema as a, PLACEHOLDER_SCHEMA as b, recognizeImageText as c, t as d, getDefaultAIConfig as f, DEFAULT_MARKITDOWN_CONFIG as g, DEFAULT_MARKER_CONFIG as h, JsonSchemaDefinitionSchema as i, formatDoctorDiagnosticsJson as j, buildDoctorDiagnostics as k, shouldUseImageOcrFallback as l, writeAIConfig as m, createMigrationConfig as n, toSnakeCase as o, readAIConfig as p, generateDrizzleConfig as r, generateDrizzleSchema as s, collectDoctorDiagnostics as t, initI18n as u, DEFAULT_MINERU_CONFIG as v, seedConfig as w, PLACEHOLDER_TEXT as x, DEFAULT_PROMPT_CONFIG as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import Conf from "conf";
|
|
2
2
|
import { ZodError, z } from "zod";
|
|
3
|
-
import "@napi-rs/system-ocr";
|
|
4
3
|
|
|
5
|
-
//#region src/
|
|
6
|
-
interface AppConfig {
|
|
7
|
-
name?: string;
|
|
8
|
-
version?: string;
|
|
9
|
-
}
|
|
4
|
+
//#region src/core/doctor.d.ts
|
|
10
5
|
interface DoctorDiagnostics {
|
|
11
6
|
cli: {
|
|
12
7
|
name: string;
|
|
@@ -53,6 +48,93 @@ interface DoctorDiagnostics {
|
|
|
53
48
|
errors: string[];
|
|
54
49
|
};
|
|
55
50
|
}
|
|
51
|
+
declare function buildDoctorDiagnostics(input: {
|
|
52
|
+
pkg: {
|
|
53
|
+
name: string;
|
|
54
|
+
version: string;
|
|
55
|
+
};
|
|
56
|
+
executable: string;
|
|
57
|
+
node: string;
|
|
58
|
+
platform: string;
|
|
59
|
+
arch: string;
|
|
60
|
+
shell: string;
|
|
61
|
+
packageManager: string;
|
|
62
|
+
osType: string;
|
|
63
|
+
osRelease: string;
|
|
64
|
+
cwd: string;
|
|
65
|
+
imageOcr: DoctorDiagnostics['imageOcr'];
|
|
66
|
+
configPath: string;
|
|
67
|
+
configStoreKeys: string[];
|
|
68
|
+
project: DoctorDiagnostics['project'];
|
|
69
|
+
}): DoctorDiagnostics;
|
|
70
|
+
declare function formatDoctorDiagnosticsJson(d: DoctorDiagnostics): string;
|
|
71
|
+
declare function doctorDiagnosticsTableRows(d: DoctorDiagnostics): [string, string][];
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/config.d.ts
|
|
74
|
+
interface AppConfig {
|
|
75
|
+
name?: string;
|
|
76
|
+
version?: string;
|
|
77
|
+
}
|
|
78
|
+
declare function createConfig(): Conf<AppConfig>;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/core/doctor-collector.d.ts
|
|
81
|
+
interface CollectDoctorDiagnosticsOptions {
|
|
82
|
+
config?: ReturnType<typeof createConfig>;
|
|
83
|
+
}
|
|
84
|
+
declare function collectDoctorDiagnostics(options?: CollectDoctorDiagnosticsOptions): Promise<DoctorDiagnostics>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/core/schema-sqlite/types.d.ts
|
|
87
|
+
interface ParsedColumn {
|
|
88
|
+
name: string;
|
|
89
|
+
drizzleType: string;
|
|
90
|
+
isPrimary: boolean;
|
|
91
|
+
isAutoIncrement: boolean;
|
|
92
|
+
isNullable: boolean;
|
|
93
|
+
isUnique: boolean;
|
|
94
|
+
defaultValue?: string;
|
|
95
|
+
isForeignKey?: boolean;
|
|
96
|
+
foreignKeyRef?: {
|
|
97
|
+
table: string;
|
|
98
|
+
column: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
interface ParsedTable {
|
|
102
|
+
name: string;
|
|
103
|
+
columns: ParsedColumn[];
|
|
104
|
+
}
|
|
105
|
+
interface ParsedRelation {
|
|
106
|
+
fromTable: string;
|
|
107
|
+
fromColumn: string;
|
|
108
|
+
toTable: string;
|
|
109
|
+
toColumn: string;
|
|
110
|
+
name: string;
|
|
111
|
+
}
|
|
112
|
+
interface ParsedReverseRelation {
|
|
113
|
+
type: 'has-one' | 'has-many';
|
|
114
|
+
fromTable: string;
|
|
115
|
+
toTable: string;
|
|
116
|
+
name: string;
|
|
117
|
+
}
|
|
118
|
+
interface ParseResult {
|
|
119
|
+
tables: ParsedTable[];
|
|
120
|
+
relations: ParsedRelation[];
|
|
121
|
+
reverseRelations: ParsedReverseRelation[];
|
|
122
|
+
warnings: string[];
|
|
123
|
+
}
|
|
124
|
+
interface MigrationConfig {
|
|
125
|
+
schemaPath: string;
|
|
126
|
+
drizzleSchemaPath: string;
|
|
127
|
+
migrationsPath: string;
|
|
128
|
+
databasePath: string;
|
|
129
|
+
drizzleConfigPath: string;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/core/schema-sqlite/generator.d.ts
|
|
133
|
+
declare function generateDrizzleSchema(result: ParseResult): string;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/core/schema-sqlite/migrator.d.ts
|
|
136
|
+
declare function createMigrationConfig(cwd: string): MigrationConfig;
|
|
137
|
+
declare function generateDrizzleConfig(): string;
|
|
56
138
|
//#endregion
|
|
57
139
|
//#region src/core/schema-sqlite/schemas.d.ts
|
|
58
140
|
|
|
@@ -246,91 +328,6 @@ interface JsonSchemaProperty {
|
|
|
246
328
|
}
|
|
247
329
|
type JsonSchemaDefinition = z.infer<typeof JsonSchemaDefinitionSchema>;
|
|
248
330
|
//#endregion
|
|
249
|
-
//#region src/types/database.d.ts
|
|
250
|
-
interface ParsedColumn {
|
|
251
|
-
name: string;
|
|
252
|
-
drizzleType: string;
|
|
253
|
-
isPrimary: boolean;
|
|
254
|
-
isAutoIncrement: boolean;
|
|
255
|
-
isNullable: boolean;
|
|
256
|
-
isUnique: boolean;
|
|
257
|
-
defaultValue?: string;
|
|
258
|
-
isForeignKey?: boolean;
|
|
259
|
-
foreignKeyRef?: {
|
|
260
|
-
table: string;
|
|
261
|
-
column: string;
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
interface ParsedTable {
|
|
265
|
-
name: string;
|
|
266
|
-
columns: ParsedColumn[];
|
|
267
|
-
}
|
|
268
|
-
interface ParsedRelation {
|
|
269
|
-
fromTable: string;
|
|
270
|
-
fromColumn: string;
|
|
271
|
-
toTable: string;
|
|
272
|
-
toColumn: string;
|
|
273
|
-
name: string;
|
|
274
|
-
}
|
|
275
|
-
interface ParsedReverseRelation {
|
|
276
|
-
type: 'has-one' | 'has-many';
|
|
277
|
-
fromTable: string;
|
|
278
|
-
toTable: string;
|
|
279
|
-
name: string;
|
|
280
|
-
}
|
|
281
|
-
interface ParseResult {
|
|
282
|
-
tables: ParsedTable[];
|
|
283
|
-
relations: ParsedRelation[];
|
|
284
|
-
reverseRelations: ParsedReverseRelation[];
|
|
285
|
-
warnings: string[];
|
|
286
|
-
}
|
|
287
|
-
interface MigrationConfig {
|
|
288
|
-
schemaPath: string;
|
|
289
|
-
drizzleSchemaPath: string;
|
|
290
|
-
migrationsPath: string;
|
|
291
|
-
databasePath: string;
|
|
292
|
-
drizzleConfigPath: string;
|
|
293
|
-
}
|
|
294
|
-
//#endregion
|
|
295
|
-
//#region src/core/doctor.d.ts
|
|
296
|
-
declare function buildDoctorDiagnostics(input: {
|
|
297
|
-
pkg: {
|
|
298
|
-
name: string;
|
|
299
|
-
version: string;
|
|
300
|
-
};
|
|
301
|
-
executable: string;
|
|
302
|
-
node: string;
|
|
303
|
-
platform: string;
|
|
304
|
-
arch: string;
|
|
305
|
-
shell: string;
|
|
306
|
-
packageManager: string;
|
|
307
|
-
osType: string;
|
|
308
|
-
osRelease: string;
|
|
309
|
-
cwd: string;
|
|
310
|
-
imageOcr: DoctorDiagnostics['imageOcr'];
|
|
311
|
-
configPath: string;
|
|
312
|
-
configStoreKeys: string[];
|
|
313
|
-
project: DoctorDiagnostics['project'];
|
|
314
|
-
}): DoctorDiagnostics;
|
|
315
|
-
declare function formatDoctorDiagnosticsJson(d: DoctorDiagnostics): string;
|
|
316
|
-
declare function doctorDiagnosticsTableRows(d: DoctorDiagnostics): [string, string][];
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region src/config.d.ts
|
|
319
|
-
declare function createConfig(): Conf<AppConfig>;
|
|
320
|
-
//#endregion
|
|
321
|
-
//#region src/core/doctor-collector.d.ts
|
|
322
|
-
interface CollectDoctorDiagnosticsOptions {
|
|
323
|
-
config?: ReturnType<typeof createConfig>;
|
|
324
|
-
}
|
|
325
|
-
declare function collectDoctorDiagnostics(options?: CollectDoctorDiagnosticsOptions): Promise<DoctorDiagnostics>;
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/core/schema-sqlite/generator.d.ts
|
|
328
|
-
declare function generateDrizzleSchema(result: ParseResult): string;
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region src/core/schema-sqlite/migrator.d.ts
|
|
331
|
-
declare function createMigrationConfig(cwd: string): MigrationConfig;
|
|
332
|
-
declare function generateDrizzleConfig(): string;
|
|
333
|
-
//#endregion
|
|
334
331
|
//#region src/core/schema-sqlite/parser.d.ts
|
|
335
332
|
declare function parseJsonSchema(schema: JsonSchemaDefinition): ParseResult;
|
|
336
333
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as doctorDiagnosticsTableRows, a as parseJsonSchema, i as JsonSchemaDefinitionSchema, j as formatDoctorDiagnosticsJson, k as buildDoctorDiagnostics, n as createMigrationConfig, r as generateDrizzleConfig, s as generateDrizzleSchema, t as collectDoctorDiagnostics } from "./doctor-collector-hWEvJ4lw.mjs";
|
|
2
2
|
|
|
3
3
|
export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };
|