svelte-reflector 1.0.25 → 1.0.26

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.
@@ -91,13 +91,19 @@ export function getEndpoint(rawEndpoint) {
91
91
  return filteredEntitys.join("/");
92
92
  }
93
93
  export function getFullEndpoint(rawEndpoint) {
94
- const teste = rawEndpoint.split("/");
95
- const a = teste
96
- .filter((t) => t !== "")
94
+ return rawEndpoint
95
+ .split("/")
96
+ .filter(Boolean)
97
97
  .map((str) => {
98
- return str.includes("}") ? `$${str}` : str;
99
- });
100
- return a.join("/");
98
+ // pega somente params no formato "{algumaCoisa}"
99
+ const match = new RegExp(/^\{(.+)\}$/).exec(str);
100
+ if (match) {
101
+ const key = match[1]; // sem { }
102
+ return `\${paths.${key}}`; // gera "${paths.key}" como texto
103
+ }
104
+ return str;
105
+ })
106
+ .join("/");
101
107
  }
102
108
  export function treatenEnum(enums) {
103
109
  const a = enums.map((e) => `"${e}"`);
package/dist/method.js CHANGED
@@ -55,9 +55,9 @@ export class Method {
55
55
  const paths = this.gee(this.paths);
56
56
  const cookies = this.gee(this.cookies);
57
57
  return `
58
- ${querys.length > 0 ? `const {${querys}} = this.querys.bundle()` : ""};
59
- ${paths.length > 0 ? `const {${paths}} = this.paths.bundle()` : ""};
60
- ${cookies.length > 0 ? `const {${cookies}} = this.cookies.bundle()` : ""};
58
+ ${querys.length > 0 ? `const querys = this.querys.bundle()` : ""};
59
+ ${paths.length > 0 ? `const paths = this.paths.bundle()` : ""};
60
+ ${cookies.length > 0 ? `const cookies = this.cookies.bundle()` : ""};
61
61
  `;
62
62
  }
63
63
  buildCallMethod() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-reflector",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Reflects zod types from openAPI schemas",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",