@intrig/plugin-sdk 0.0.15-21 → 0.0.15-22

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 CHANGED
@@ -46,13 +46,18 @@ function jsonLiteral(path) {
46
46
  }
47
47
 
48
48
  function getVariableName(ref) {
49
+ if (!ref) return undefined;
49
50
  return ref.split('/').pop();
50
51
  }
51
52
  function getVariableImports(variables, source, prefix) {
52
- return variables.map((a)=>getVariableName(a.ref)).map((ref)=>`import { ${ref} } from "${prefix}/${source}/components/schemas/${ref}.js"`).join("\n");
53
+ return variables.filter((a)=>a.ref) // Skip variables without schema refs
54
+ .map((a)=>getVariableName(a.ref)).filter((ref)=>!!ref).map((ref)=>`import { ${ref} } from "${prefix}/${source}/components/schemas/${ref}.js"`).join("\n");
53
55
  }
54
56
  function getVariableTypes(variables) {
55
- return variables.map((p)=>`${p.name}${p.in === "path" ? "" : "?"}: ${getVariableName(p.ref)}`).join("\n");
57
+ return variables.map((p)=>{
58
+ const typeName = getVariableName(p.ref) ?? 'any'; // Use 'any' for inline schemas
59
+ return `${p.name}${p.in === "path" ? "" : "?"}: ${typeName}`;
60
+ }).join("\n");
56
61
  }
57
62
  function isParamMandatory(variables) {
58
63
  return variables.some((a)=>a.in === 'path');
package/dist/index.js CHANGED
@@ -25,13 +25,18 @@ function jsonLiteral(path) {
25
25
  }
26
26
 
27
27
  function getVariableName(ref) {
28
+ if (!ref) return undefined;
28
29
  return ref.split('/').pop();
29
30
  }
30
31
  function getVariableImports(variables, source, prefix) {
31
- return variables.map((a)=>getVariableName(a.ref)).map((ref)=>`import { ${ref} } from "${prefix}/${source}/components/schemas/${ref}.js"`).join("\n");
32
+ return variables.filter((a)=>a.ref) // Skip variables without schema refs
33
+ .map((a)=>getVariableName(a.ref)).filter((ref)=>!!ref).map((ref)=>`import { ${ref} } from "${prefix}/${source}/components/schemas/${ref}.js"`).join("\n");
32
34
  }
33
35
  function getVariableTypes(variables) {
34
- return variables.map((p)=>`${p.name}${p.in === "path" ? "" : "?"}: ${getVariableName(p.ref)}`).join("\n");
36
+ return variables.map((p)=>{
37
+ const typeName = getVariableName(p.ref) ?? 'any'; // Use 'any' for inline schemas
38
+ return `${p.name}${p.in === "path" ? "" : "?"}: ${typeName}`;
39
+ }).join("\n");
35
40
  }
36
41
  function isParamMandatory(variables) {
37
42
  return variables.some((a)=>a.in === 'path');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intrig/plugin-sdk",
3
- "version": "0.0.15-21",
3
+ "version": "0.0.15-22",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",