syllable-sdk 0.1.0-alpha.61 → 0.1.0-alpha.63
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/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/dialogtoolcall.d.ts +2 -2
- package/models/components/dialogtoolcall.js +4 -4
- package/openapi.json +7 -7
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/dialogtoolcall.ts +6 -6
- package/mintlify/mint-backup.json +0 -290
- package/mintlify/mint.json +0 -623
- package/mintlify/scripts/create-md-script.js +0 -46
- package/mintlify/scripts/generate-mintlify-sdk-docs.js +0 -117
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function updateMarkdownFiles(dir) {
|
|
5
|
-
fs.readdir(dir, (err, files) => {
|
|
6
|
-
if (err) {
|
|
7
|
-
console.error(`Error reading directory: ${err}`);
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
files.forEach(file => {
|
|
12
|
-
const filePath = path.join(dir, file);
|
|
13
|
-
if (path.extname(file) === '.md') {
|
|
14
|
-
fs.readFile(filePath, 'utf8', (err, data) => {
|
|
15
|
-
if (err) {
|
|
16
|
-
console.error(`Error reading file: ${err}`);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const lines = data.split('\n');
|
|
21
|
-
if (lines[0].startsWith('#')) {
|
|
22
|
-
const title = lines[0].substring(1).trim();
|
|
23
|
-
lines[0] = `---\ntitle: '${title}'\n---`;
|
|
24
|
-
const updatedData = lines.join('\n');
|
|
25
|
-
|
|
26
|
-
fs.writeFile(filePath, updatedData, 'utf8', err => {
|
|
27
|
-
if (err) {
|
|
28
|
-
console.error(`Error writing file: ${err}`);
|
|
29
|
-
} else {
|
|
30
|
-
console.log(`Updated file: ${filePath}`);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Example usage: node script.js /path/to/directory
|
|
41
|
-
const directory = process.argv[2];
|
|
42
|
-
if (directory) {
|
|
43
|
-
updateMarkdownFiles(directory);
|
|
44
|
-
} else {
|
|
45
|
-
console.error('Please provide a directory as an argument.');
|
|
46
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { readdirSync, statSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { extname, basename, join, dirname } from 'path';
|
|
3
|
-
|
|
4
|
-
function getMarkdownFilesSync(dir) {
|
|
5
|
-
try {
|
|
6
|
-
const files = readdirSync('mintlify/' + dir);
|
|
7
|
-
const markdownFiles = files
|
|
8
|
-
.filter(file => extname(file) === '.md')
|
|
9
|
-
.map(file => dir + '/' + basename(file, '.md'));
|
|
10
|
-
return markdownFiles;
|
|
11
|
-
} catch (err) {
|
|
12
|
-
console.error(`Error reading directory: ${err}`);
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function moveAndUpdateFilesSync(srcDir, destDir) {
|
|
18
|
-
const files = readdirSync(srcDir);
|
|
19
|
-
|
|
20
|
-
files.forEach(file => {
|
|
21
|
-
const srcPath = join(srcDir, file);
|
|
22
|
-
const stats = statSync(srcPath);
|
|
23
|
-
|
|
24
|
-
if (stats.isDirectory()) {
|
|
25
|
-
moveAndUpdateFilesSync(srcPath, destDir); // Recursively move files in subdirectories
|
|
26
|
-
} else if (stats.isFile() && file !== 'Overview.mdx') {
|
|
27
|
-
let destPath;
|
|
28
|
-
if (srcPath.includes('docs/sdks/') && file === 'README.md') {
|
|
29
|
-
const type = srcPath.split('/').slice(-2, -1)[0];
|
|
30
|
-
destPath = join(destDir, 'sdk-docs', `${type}.mdx`);
|
|
31
|
-
} else if (srcPath.includes('docs/models/components/')) {
|
|
32
|
-
const model = basename(file, '.md');
|
|
33
|
-
destPath = join(destDir, 'sdk-docs', 'models', 'components', `${model}.md`);
|
|
34
|
-
} else if (srcPath.includes('docs/models/operations/')) {
|
|
35
|
-
const model = basename(file, '.md');
|
|
36
|
-
destPath = join(destDir, 'sdk-docs', 'models', 'operations', `${model}.md`);
|
|
37
|
-
} else if (srcPath.includes('docs/models/errors/')) {
|
|
38
|
-
const model = basename(file, '.md');
|
|
39
|
-
destPath = join(destDir, 'sdk-docs', 'models', 'errors', `${model}.md`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (destPath) {
|
|
43
|
-
mkdirSync(dirname(destPath), { recursive: true });
|
|
44
|
-
|
|
45
|
-
const data = readFileSync(srcPath, 'utf8');
|
|
46
|
-
|
|
47
|
-
const lines = data.split('\n');
|
|
48
|
-
if (lines[0].startsWith('#')) {
|
|
49
|
-
const title = lines[0].substring(1).trim();
|
|
50
|
-
lines[0] = `---\ntitle: '${title}'\n---`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let updatedData = lines.join('\n');
|
|
54
|
-
updatedData = updatedData.replace(/<!--[\s\S]*?-->/g, ''); // Remove HTML comments
|
|
55
|
-
updatedData = updatedData.replace(/<Uint8Array>/g, ''); // Remove HTML conflicts
|
|
56
|
-
updatedData = updatedData.replace(/<string, \*string\*>/g, ''); // Remove HTML conflicts
|
|
57
|
-
updatedData = updatedData.replace(/:heavy_check_mark:/g, 'TRUE'); // Replace :heavy-check-mark: with TRUE
|
|
58
|
-
updatedData = updatedData.replace(/:heavy_minus_sign:/g, 'FALSE'); // Replace :heavy-minus-sign: with FALSE
|
|
59
|
-
updatedData = updatedData.replace(/\[([^\]]+)\]\(\.\.\/\.\.\/models\/components\/([^\)]+)\.md\)/g, '[$1](/sdk-docs/models/components/$2)'); // Update links
|
|
60
|
-
updatedData = updatedData.replace(/\[([^\]]+)\]\(\.\.\/\.\.\/models\/operations\/([^\)]+)\.md\)/g, '[$1](/sdk-docs/models/operations/$2)'); // Update links
|
|
61
|
-
updatedData = updatedData.replace(/\[([^\]]+)\]\(\.\.\/\.\.\/models\/errors\/([^\)]+)\.md\)/g, '[$1](/sdk-docs/models/errors/$2)'); // Update links
|
|
62
|
-
updatedData = updatedData.replace(/\[([^\]]+)\]\(\.\.\/\.\.\/models\/errors\/([^\)]+)\.md\)/g, '[$1](/sdk-docs/models/errors/$2)'); // Update links
|
|
63
|
-
updatedData = updatedData.replace(/\[([^\]]+)\]\(\.\.\/\.\.\/lib\/utils\/([^\)]+)\.md\)/g, '[$1](/sdk-docs/lib/utils/$2)'); // Update links
|
|
64
|
-
updatedData = updatedData.replace(/<\[any\]\(\.\.\/\.\.\/models\/.*\.md\)/g, 'ANY');// Replace <[any](../../models/.md)> with ANY
|
|
65
|
-
|
|
66
|
-
// Special fixes for specific files
|
|
67
|
-
updatedData = updatedData.replace("**Promise\\<[ReadableStream](../../models/.md)\\>**", "Promise\\<ReadableStream\\>"); // Fix for ReadableStream
|
|
68
|
-
updatedData = updatedData.replace("**Promise\\<[components.AgentVoice[]](../../models/.md)\\>**",
|
|
69
|
-
"Promise\\<[components.AgentVoice[]](/sdk-docs/models/components/agentvoice)\\>"); // Fix for AgentVoice
|
|
70
|
-
updatedData = updatedData.replace("**Promise\\<[components.PromptHistory[]](../../models/.md)\\>**",
|
|
71
|
-
"**Promise\\<[components.PromptHistory[]](/sdk-docs/models/components/prompthistory)\\>**"); // Fix for PromptHistory
|
|
72
|
-
|
|
73
|
-
writeFileSync(destPath, updatedData, 'utf8');
|
|
74
|
-
console.log(`Moved and updated ${srcPath} to ${destPath}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function updateMintJsonSync() {
|
|
81
|
-
const mintJsonPath = 'mintlify/mint.json';
|
|
82
|
-
const mintJson = JSON.parse(readFileSync(mintJsonPath, 'utf8'));
|
|
83
|
-
|
|
84
|
-
const componentsDir = 'sdk-docs/models/components';
|
|
85
|
-
const operationsDir = 'sdk-docs/models/operations';
|
|
86
|
-
const errorsDir = 'sdk-docs/models/errors';
|
|
87
|
-
|
|
88
|
-
const componentsPages = getMarkdownFilesSync(componentsDir);
|
|
89
|
-
const operationsPages = getMarkdownFilesSync(operationsDir);
|
|
90
|
-
const errorsPages = getMarkdownFilesSync(errorsDir);
|
|
91
|
-
|
|
92
|
-
const navigation = mintJson.navigation;
|
|
93
|
-
|
|
94
|
-
for (let i = 0; i < navigation.length; i++) {
|
|
95
|
-
if (navigation[i].group === 'Models') {
|
|
96
|
-
const modelsGroup = navigation[i].pages;
|
|
97
|
-
|
|
98
|
-
for (let j = 0; j < modelsGroup.length; j++) {
|
|
99
|
-
if (modelsGroup[j].group === 'Components') {
|
|
100
|
-
modelsGroup[j].pages = componentsPages;
|
|
101
|
-
} else if (modelsGroup[j].group === 'Operations') {
|
|
102
|
-
modelsGroup[j].pages = operationsPages;
|
|
103
|
-
} else if (modelsGroup[j].group === 'Errors') {
|
|
104
|
-
modelsGroup[j].pages = errorsPages;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
writeFileSync(mintJsonPath, JSON.stringify(mintJson, null, 2), 'utf8');
|
|
111
|
-
console.log('Updated mint.json');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Example usage
|
|
115
|
-
moveAndUpdateFilesSync('docs/sdks/', 'mintlify');
|
|
116
|
-
moveAndUpdateFilesSync('docs/models/', 'mintlify');
|
|
117
|
-
updateMintJsonSync();
|