@vonage/client-sdk 1.1.0-alpha.1 → 1.1.0-alpha.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/README.md +184 -32
- package/dist/client/VonageClient.d.ts +300 -6
- package/dist/client/index.cjs +21443 -20103
- package/dist/client/index.mjs +21444 -20105
- package/dist/coreExtend.d.ts +81 -6
- package/dist/kotlin/clientsdk-clientcore_js.d.ts +54 -22
- package/dist/lib/HttpClient.d.ts +1 -1
- package/dist/utils/ClientConfig.d.ts +17 -0
- package/dist/utils/ConversationMessageModels.d.ts +2 -0
- package/dist/vonageClientSDK.js +20549 -19320
- package/dist/vonageClientSDK.min.js +2 -2
- package/dist/vonageClientSDK.min.mjs +2 -2
- package/dist/vonageClientSDK.mjs +20549 -19321
- package/package.json +4 -2
- package/snippet.js +98 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonage/client-sdk",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/client/index.mjs",
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
"copy_core_dist": "mkdir dist/kotlin; cp ./src/kotlin/**.d.ts ./dist/kotlin/",
|
|
22
22
|
"build": "npm run copy_core; rollup -c; npm run copy_core_dist",
|
|
23
23
|
"build:rollup": "rollup -c",
|
|
24
|
+
"build:readme": "chmod +x ./docs/generate_readme.sh; ./docs/generate_readme.sh",
|
|
25
|
+
"snippets": "node snippet.js $PWD",
|
|
24
26
|
"start": "node dist/Client.js",
|
|
25
27
|
"build:watch": "tsc -w",
|
|
26
|
-
"check": "tsc ./examples
|
|
28
|
+
"check": "tsc ./examples/*.ts --noEmit --skipLibCheck --strictNullChecks true",
|
|
27
29
|
"lint": "eslint . --ext .ts",
|
|
28
30
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
29
31
|
"clean": "rm -Rf node_modules/*; rm -Rf dist/"
|
package/snippet.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
console.log('============== EXAMPLE SNIPPETS EXTRACTOR ==============');
|
|
2
|
+
|
|
3
|
+
// the project root used for relative IO paths (set by commandline)
|
|
4
|
+
const project_root = process.argv[2];
|
|
5
|
+
const input_dir = process.argv[3] || 'examples';
|
|
6
|
+
const output_dir = process.argv[4] || 'examples/snippets';
|
|
7
|
+
|
|
8
|
+
if (!project_root) {
|
|
9
|
+
console.error('Error: project_root not provided. Exiting...');
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
console.log('args: ', process.argv.slice(2));
|
|
14
|
+
console.log('project_root: ', project_root);
|
|
15
|
+
console.log('input_dir: ', input_dir);
|
|
16
|
+
console.log('output_dir: ', output_dir);
|
|
17
|
+
|
|
18
|
+
//output_file_name_template = '{{name}}.txt' # a mustache template for the output file name
|
|
19
|
+
|
|
20
|
+
// Code block indicators
|
|
21
|
+
const start_flag = 'example:';
|
|
22
|
+
const end_flag = 'endExample';
|
|
23
|
+
|
|
24
|
+
// straightforward replacements
|
|
25
|
+
//[snippet.replacements]
|
|
26
|
+
// "self." = ""
|
|
27
|
+
|
|
28
|
+
const comments_by_format = {
|
|
29
|
+
html: ['<!--', '-->'],
|
|
30
|
+
js: ['//', ''],
|
|
31
|
+
ts: ['//', '']
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
readdirSync,
|
|
36
|
+
readFileSync,
|
|
37
|
+
existsSync,
|
|
38
|
+
mkdirSync,
|
|
39
|
+
writeFileSync
|
|
40
|
+
} from 'fs';
|
|
41
|
+
|
|
42
|
+
const input_path = `${project_root}/${input_dir}`;
|
|
43
|
+
const examples = [];
|
|
44
|
+
let current_example = 0;
|
|
45
|
+
const files = readdirSync(input_path);
|
|
46
|
+
console.log('Input files: ', files);
|
|
47
|
+
|
|
48
|
+
files.forEach((file) => {
|
|
49
|
+
const format = file.split('.').pop();
|
|
50
|
+
const comments = comments_by_format[format];
|
|
51
|
+
if (!comments) return;
|
|
52
|
+
const comment_prefix = comments[0];
|
|
53
|
+
const comment_suffix = comments[1];
|
|
54
|
+
let isExampleCode = false;
|
|
55
|
+
let indentationLevel = 0;
|
|
56
|
+
const allFileContents = readFileSync(`${input_path}/${file}`, 'utf-8');
|
|
57
|
+
allFileContents.split(/\r?\n/).forEach((line) => {
|
|
58
|
+
const lineTrim = line.trim();
|
|
59
|
+
const isComment =
|
|
60
|
+
lineTrim.startsWith(comment_prefix) && lineTrim.endsWith(comment_suffix);
|
|
61
|
+
const isExampleStart = isComment && lineTrim.includes(start_flag);
|
|
62
|
+
const isExampleFinished = isComment && lineTrim.includes(end_flag);
|
|
63
|
+
|
|
64
|
+
if (isExampleStart) {
|
|
65
|
+
isExampleCode = true;
|
|
66
|
+
let title = lineTrim.split(start_flag)[1];
|
|
67
|
+
if (comment_suffix) {
|
|
68
|
+
title = title.split(comment_suffix)[0];
|
|
69
|
+
}
|
|
70
|
+
examples[current_example] = {
|
|
71
|
+
title: title.trim(),
|
|
72
|
+
format: format,
|
|
73
|
+
file_name: title.trim().replace(/ /g, '_').toLowerCase() + `.txt`,
|
|
74
|
+
content: ``
|
|
75
|
+
};
|
|
76
|
+
indentationLevel = line.search(comment_prefix);
|
|
77
|
+
} else if (isExampleFinished) {
|
|
78
|
+
isExampleCode = false;
|
|
79
|
+
current_example = current_example + 1;
|
|
80
|
+
indentationLevel = 0;
|
|
81
|
+
} else if (isExampleCode) {
|
|
82
|
+
const adjustedLine = line.slice(indentationLevel);
|
|
83
|
+
examples[current_example].content += adjustedLine + `\n`;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const output_path = `${project_root}/${output_dir}`;
|
|
89
|
+
if (!existsSync(output_path)) {
|
|
90
|
+
mkdirSync(output_path, { recursive: true });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log(`${examples.length} example snippets found`);
|
|
94
|
+
examples.forEach((res) => {
|
|
95
|
+
const { title, file_name, content, format } = res;
|
|
96
|
+
writeFileSync(`${output_path}/${file_name}`, content.trim(), 'utf-8');
|
|
97
|
+
console.log(`${title} (${format.toUpperCase()})`, ' -> ', file_name);
|
|
98
|
+
});
|