@sealcode/sealgen 0.14.11 → 0.14.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.
@@ -25,10 +25,10 @@ function generateURL(actionName, url) {
25
25
  const parts = url.split("/");
26
26
  const params = parts.filter((part) => part.startsWith(":")).map((part) => part.slice(1));
27
27
  if (params.length === 0) {
28
- return `export const ${actionName}URL = "${url}";`;
28
+ return `export const ${actionName}URL = "${encodeURI(url)}";`;
29
29
  }
30
30
  return `export const ${actionName}URL = (${params.map((s) => s + ": string").join(", ")})=>\`${parts.map(
31
- (part) => part.startsWith(":") ? "${" + part.slice(1) + "}" : part
31
+ (part) => part.startsWith(":") ? "${" + part.slice(1) + "}" : encodeURIComponent(part)
32
32
  ).join("/")}\`;
33
33
  ${actionName}URL.params = [${params.map((param) => `"${param}"`).join(",")}];
34
34
  ${actionName}URL.rawURL = "${url}";`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.14.11",
3
+ "version": "0.14.12",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -30,13 +30,15 @@ function generateURL(actionName: string, url: string) {
30
30
  .filter((part) => part.startsWith(":"))
31
31
  .map((part) => part.slice(1));
32
32
  if (params.length === 0) {
33
- return `export const ${actionName}URL = "${url}";`;
33
+ return `export const ${actionName}URL = "${encodeURI(url)}";`;
34
34
  }
35
35
  return `export const ${actionName}URL = (${params
36
36
  .map((s) => s + ": string")
37
37
  .join(", ")})=>\`${parts
38
38
  .map((part) =>
39
- part.startsWith(":") ? "${" + part.slice(1) + "}" : part
39
+ part.startsWith(":")
40
+ ? "${" + part.slice(1) + "}"
41
+ : encodeURIComponent(part)
40
42
  )
41
43
  .join("/")}\`;
42
44
  ${actionName}URL.params = [${params