@digipair/skill-markitdown 0.123.0 → 0.124.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/index.cjs.js
CHANGED
|
@@ -30,44 +30,7 @@ let MaikitdownService = class MaikitdownService {
|
|
|
30
30
|
markitdown.stdin.end();
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
async json(params, _pinsSettingsList, context) {
|
|
34
|
-
const { file, path = context.privates?.MARKITDOWN_PATH ?? process.env['MARKITDOWN_PATH'] ?? 'markitdown' } = params;
|
|
35
|
-
return new Promise((resolve, reject)=>{
|
|
36
|
-
// Spawn the markitdown process with JSON format
|
|
37
|
-
const markitdown = child_process.spawn(path, [
|
|
38
|
-
'--output-format',
|
|
39
|
-
'json'
|
|
40
|
-
]);
|
|
41
|
-
let jsonOutput = '';
|
|
42
|
-
let errorOutput = '';
|
|
43
|
-
// Listen for data from the stdout stream
|
|
44
|
-
markitdown.stdout.on('data', (data)=>{
|
|
45
|
-
jsonOutput += data.toString();
|
|
46
|
-
});
|
|
47
|
-
// Listen for data from the stderr stream
|
|
48
|
-
markitdown.stderr.on('data', (data)=>{
|
|
49
|
-
errorOutput += data.toString();
|
|
50
|
-
});
|
|
51
|
-
// Handle the close event
|
|
52
|
-
markitdown.on('close', (code)=>{
|
|
53
|
-
if (code !== 0) {
|
|
54
|
-
return reject(new Error(`markitdown process exited with code ${code}: ${errorOutput}`));
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
const parsedJson = JSON.parse(jsonOutput);
|
|
58
|
-
resolve(parsedJson);
|
|
59
|
-
} catch (parseError) {
|
|
60
|
-
reject(new Error(`Failed to parse JSON output: ${parseError.message}`));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
// Write the decoded PDF content to stdin
|
|
64
|
-
markitdown.stdin.write(Buffer.from(file.replace(/^data:.*;base64,/, ''), 'base64'));
|
|
65
|
-
markitdown.stdin.end();
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
33
|
};
|
|
69
34
|
const convert = (params, pinsSettingsList, context)=>new MaikitdownService().convert(params, pinsSettingsList, context);
|
|
70
|
-
const json = (params, pinsSettingsList, context)=>new MaikitdownService().json(params, pinsSettingsList, context);
|
|
71
35
|
|
|
72
36
|
exports.convert = convert;
|
|
73
|
-
exports.json = json;
|
package/dist/index.esm.js
CHANGED
|
@@ -28,43 +28,7 @@ let MaikitdownService = class MaikitdownService {
|
|
|
28
28
|
markitdown.stdin.end();
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
async json(params, _pinsSettingsList, context) {
|
|
32
|
-
const { file, path = context.privates?.MARKITDOWN_PATH ?? process.env['MARKITDOWN_PATH'] ?? 'markitdown' } = params;
|
|
33
|
-
return new Promise((resolve, reject)=>{
|
|
34
|
-
// Spawn the markitdown process with JSON format
|
|
35
|
-
const markitdown = spawn(path, [
|
|
36
|
-
'--output-format',
|
|
37
|
-
'json'
|
|
38
|
-
]);
|
|
39
|
-
let jsonOutput = '';
|
|
40
|
-
let errorOutput = '';
|
|
41
|
-
// Listen for data from the stdout stream
|
|
42
|
-
markitdown.stdout.on('data', (data)=>{
|
|
43
|
-
jsonOutput += data.toString();
|
|
44
|
-
});
|
|
45
|
-
// Listen for data from the stderr stream
|
|
46
|
-
markitdown.stderr.on('data', (data)=>{
|
|
47
|
-
errorOutput += data.toString();
|
|
48
|
-
});
|
|
49
|
-
// Handle the close event
|
|
50
|
-
markitdown.on('close', (code)=>{
|
|
51
|
-
if (code !== 0) {
|
|
52
|
-
return reject(new Error(`markitdown process exited with code ${code}: ${errorOutput}`));
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const parsedJson = JSON.parse(jsonOutput);
|
|
56
|
-
resolve(parsedJson);
|
|
57
|
-
} catch (parseError) {
|
|
58
|
-
reject(new Error(`Failed to parse JSON output: ${parseError.message}`));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
// Write the decoded PDF content to stdin
|
|
62
|
-
markitdown.stdin.write(Buffer.from(file.replace(/^data:.*;base64,/, ''), 'base64'));
|
|
63
|
-
markitdown.stdin.end();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
31
|
};
|
|
67
32
|
const convert = (params, pinsSettingsList, context)=>new MaikitdownService().convert(params, pinsSettingsList, context);
|
|
68
|
-
const json = (params, pinsSettingsList, context)=>new MaikitdownService().json(params, pinsSettingsList, context);
|
|
69
33
|
|
|
70
|
-
export { convert
|
|
34
|
+
export { convert };
|
package/dist/schema.fr.json
CHANGED
|
@@ -49,48 +49,6 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
"/json": {
|
|
54
|
-
"post": {
|
|
55
|
-
"tags": [
|
|
56
|
-
"service"
|
|
57
|
-
],
|
|
58
|
-
"summary": "Convertit en JSON",
|
|
59
|
-
"parameters": [
|
|
60
|
-
{
|
|
61
|
-
"name": "file",
|
|
62
|
-
"summary": "Fichier",
|
|
63
|
-
"required": true,
|
|
64
|
-
"description": "Fichier à convertir",
|
|
65
|
-
"schema": {
|
|
66
|
-
"type": "string"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"name": "path",
|
|
71
|
-
"summary": "Chemin de l'executable",
|
|
72
|
-
"required": false,
|
|
73
|
-
"description": "Chemin vers l'executable markitdown",
|
|
74
|
-
"schema": {
|
|
75
|
-
"type": "string"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"x-events": [],
|
|
80
|
-
"responses": {
|
|
81
|
-
"200": {
|
|
82
|
-
"description": "Réponse réussie",
|
|
83
|
-
"content": {
|
|
84
|
-
"application/json": {
|
|
85
|
-
"schema": {
|
|
86
|
-
"type": "object",
|
|
87
|
-
"description": "Contenu converti au format JSON"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
52
|
}
|
|
95
53
|
},
|
|
96
54
|
"components": {
|
package/dist/schema.json
CHANGED
|
@@ -49,48 +49,6 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
"/json": {
|
|
54
|
-
"post": {
|
|
55
|
-
"tags": [
|
|
56
|
-
"service"
|
|
57
|
-
],
|
|
58
|
-
"summary": "Convert to JSON",
|
|
59
|
-
"parameters": [
|
|
60
|
-
{
|
|
61
|
-
"name": "file",
|
|
62
|
-
"summary": "File",
|
|
63
|
-
"required": true,
|
|
64
|
-
"description": "File to convert",
|
|
65
|
-
"schema": {
|
|
66
|
-
"type": "string"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"name": "path",
|
|
71
|
-
"summary": "Path to the executable",
|
|
72
|
-
"required": false,
|
|
73
|
-
"description": "Path to the markitdown executable",
|
|
74
|
-
"schema": {
|
|
75
|
-
"type": "string"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"x-events": [],
|
|
80
|
-
"responses": {
|
|
81
|
-
"200": {
|
|
82
|
-
"description": "Successful response",
|
|
83
|
-
"content": {
|
|
84
|
-
"application/json": {
|
|
85
|
-
"schema": {
|
|
86
|
-
"type": "object",
|
|
87
|
-
"description": "Converted content in JSON format"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
52
|
}
|
|
95
53
|
},
|
|
96
54
|
"components": {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PinsSettings } from '@digipair/engine';
|
|
2
2
|
export declare const convert: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
3
|
-
export declare const json: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
4
3
|
//# sourceMappingURL=skill-markitdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-markitdown.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-markitdown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-markitdown.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-markitdown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0ChD,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACf,CAAC"}
|