@aloma.io/integration-sdk 3.3.10 → 3.3.17
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.
@@ -30,31 +30,32 @@ const transform = (meta) => {
|
|
30
30
|
if (example) {
|
31
31
|
const parts = example.split(/```/);
|
32
32
|
const backticks = '```';
|
33
|
-
eg = `@example ${parts[0]}\n${backticks}${parts[1]}${backticks}`;
|
33
|
+
eg = `@example ${parts[0] || 'usage'}\n${backticks}${parts[1]}${backticks}`;
|
34
34
|
}
|
35
35
|
const paramDocs = docs
|
36
|
-
.filter((what) => what.kind === "param")
|
37
|
-
.map((what) => {
|
38
|
-
return ` * @param {${what.value.type}} ${what.value.name} - ${what.value.description || ""}`;
|
39
|
-
})
|
40
|
-
.join("\n") || " *";
|
36
|
+
.filter((what) => what.kind === "param");
|
41
37
|
const params = sig
|
42
38
|
.getParameters()
|
39
|
+
.filter((param) => param.isNamed())
|
43
40
|
.map((param) => {
|
44
41
|
const serialized = param.serialize();
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
42
|
+
const prefix = param
|
43
|
+
.getNamedElements()
|
44
|
+
.map((p) => {
|
45
|
+
const defaultVal = p.getDefault() != null ? " = " + p.getDefault() : "";
|
46
|
+
return `${p.getName()}${defaultVal}`;
|
47
|
+
})
|
48
|
+
.join("; ");
|
49
|
+
const suffix = serialized
|
50
|
+
.type
|
51
|
+
.properties
|
52
|
+
.map((p) => {
|
53
|
+
const comment = paramDocs.find((what) => what.value.name === p.name);
|
54
|
+
const desc = (comment?.value.description || '').replace(/\\@/gi, '@');
|
55
|
+
return `\n/**\n${desc}\n */\n ${p.name}: ${p.type.text}`;
|
56
|
+
})
|
57
|
+
.join("; ");
|
58
|
+
return `{${prefix}}: {${suffix}}`;
|
58
59
|
})
|
59
60
|
.join(", ");
|
60
61
|
const retVal = sig
|
@@ -65,8 +66,6 @@ const transform = (meta) => {
|
|
65
66
|
/**
|
66
67
|
* ${desc || ""}
|
67
68
|
*
|
68
|
-
${paramDocs}
|
69
|
-
*
|
70
69
|
* ${eg || ''}
|
71
70
|
**/
|
72
71
|
declare function ${member.getName()}(${params}): ${retVal};
|
@@ -79,5 +78,5 @@ declare function ${member.getName()}(${params}): ${retVal};
|
|
79
78
|
};
|
80
79
|
export default async (path) => {
|
81
80
|
const parsed = await parseFromFiles([path]);
|
82
|
-
return transform(parsed?.
|
81
|
+
return transform(parsed.project?.getModules() || []);
|
83
82
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aloma.io/integration-sdk",
|
3
|
-
"version": "3.3.
|
3
|
+
"version": "3.3.17",
|
4
4
|
"description": "",
|
5
5
|
"author": "aloma.io",
|
6
6
|
"license": "Apache-2.0",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
28
|
"@paralleldrive/cuid2": "^2",
|
29
|
-
"@ts-ast-parser/core": "^0.
|
29
|
+
"@ts-ast-parser/core": "^0.5",
|
30
30
|
"@types/node": "^16",
|
31
31
|
"commander": "^11",
|
32
32
|
"dotenv": "*",
|
@@ -40,41 +40,44 @@ const transform = (meta: any) => {
|
|
40
40
|
{
|
41
41
|
const parts = example.split(/```/);
|
42
42
|
const backticks = '```';
|
43
|
-
eg = `@example ${parts[0]}\n${backticks}${parts[1]}${backticks}`;
|
43
|
+
eg = `@example ${parts[0] || 'usage'}\n${backticks}${parts[1]}${backticks}`;
|
44
44
|
}
|
45
45
|
|
46
46
|
const paramDocs =
|
47
47
|
docs
|
48
48
|
.filter((what: any) => what.kind === "param")
|
49
|
-
.map((what: any) => {
|
50
|
-
return ` * @param {${what.value.type}} ${what.value.name} - ${
|
51
|
-
what.value.description || ""
|
52
|
-
}`;
|
53
|
-
})
|
54
|
-
.join("\n") || " *";
|
55
49
|
|
56
50
|
const params = sig
|
57
51
|
.getParameters()
|
52
|
+
.filter((param) => param.isNamed())
|
58
53
|
.map((param: any) => {
|
59
54
|
const serialized = param.serialize();
|
60
|
-
|
61
|
-
switch (!!param.isNamed()) {
|
62
|
-
case true:
|
63
|
-
const tmp = param
|
64
|
-
.getNamedElements()
|
65
|
-
.map((p) => {
|
66
|
-
const defaultVal =
|
67
|
-
p.default != null ? " = " + p.default : "";
|
68
55
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
56
|
+
const prefix = param
|
57
|
+
.getNamedElements()
|
58
|
+
.map((p) => {
|
59
|
+
const defaultVal =
|
60
|
+
p.getDefault() != null ? " = " + p.getDefault() : "";
|
61
|
+
|
62
|
+
return `${p.getName()}${defaultVal}`;
|
63
|
+
})
|
64
|
+
.join("; ");
|
65
|
+
|
66
|
+
const suffix = serialized
|
67
|
+
.type
|
68
|
+
.properties
|
69
|
+
.map((p) => {
|
70
|
+
const comment = paramDocs.find((what) => what.value.name === p.name);
|
71
|
+
const desc = (comment?.value.description || '').replace(/\\@/gi, '@');
|
72
|
+
|
73
|
+
return `\n/**\n${desc}\n */\n ${p.name}: ${p.type.text}`;
|
74
|
+
})
|
75
|
+
.join("; ");
|
76
|
+
|
77
|
+
return `{${prefix}}: {${suffix}}`;
|
76
78
|
})
|
77
79
|
.join(", ");
|
80
|
+
|
78
81
|
const retVal = sig
|
79
82
|
.serialize()
|
80
83
|
.return.type.text.replace(/^Promise</, "")
|
@@ -84,8 +87,6 @@ const transform = (meta: any) => {
|
|
84
87
|
/**
|
85
88
|
* ${desc || ""}
|
86
89
|
*
|
87
|
-
${paramDocs}
|
88
|
-
*
|
89
90
|
* ${eg || ''}
|
90
91
|
**/
|
91
92
|
declare function ${member.getName()}(${params}): ${retVal};
|
@@ -100,5 +101,5 @@ declare function ${member.getName()}(${params}): ${retVal};
|
|
100
101
|
|
101
102
|
export default async (path: string) => {
|
102
103
|
const parsed = await parseFromFiles([path]);
|
103
|
-
return transform(parsed?.
|
104
|
+
return transform(parsed.project?.getModules() || []);
|
104
105
|
};
|