@damn-dev/cli 0.13.8 → 0.13.9
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/package.json
CHANGED
|
@@ -7858,6 +7858,7 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
7858
7858
|
exports2.registerInProcessTool = registerInProcessTool;
|
|
7859
7859
|
exports2.assertSafeUrl = assertSafeUrl;
|
|
7860
7860
|
exports2.substituteSecrets = substituteSecrets;
|
|
7861
|
+
exports2.extractPathParamNames = extractPathParamNames;
|
|
7861
7862
|
exports2.substituteParams = substituteParams;
|
|
7862
7863
|
exports2.loadSkillTool = loadSkillTool;
|
|
7863
7864
|
exports2.resolveAllSecrets = resolveAllSecrets;
|
|
@@ -7983,6 +7984,17 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
7983
7984
|
const out = template.replace(/\$\{([A-Z][A-Z0-9_]{0,63})\}/g, (_, key) => secrets.get(key) ?? "");
|
|
7984
7985
|
return { ok: true, value: out };
|
|
7985
7986
|
}
|
|
7987
|
+
function extractPathParamNames(template) {
|
|
7988
|
+
const names = /* @__PURE__ */ new Set();
|
|
7989
|
+
const re = /<([A-Za-z_][A-Za-z0-9_]*)>|\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
7990
|
+
let m;
|
|
7991
|
+
while ((m = re.exec(template)) !== null) {
|
|
7992
|
+
const key = m[1] ?? m[2];
|
|
7993
|
+
if (key)
|
|
7994
|
+
names.add(key);
|
|
7995
|
+
}
|
|
7996
|
+
return names;
|
|
7997
|
+
}
|
|
7986
7998
|
function substituteParams(template, params) {
|
|
7987
7999
|
return template.replace(/<([A-Za-z_][A-Za-z0-9_]*)>|\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, angle, curly) => {
|
|
7988
8000
|
const key = angle ?? curly;
|
|
@@ -8148,6 +8160,7 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8148
8160
|
if (!endpointAfterSecrets.ok) {
|
|
8149
8161
|
return { ok: false, error: `Missing workspace secret: ${endpointAfterSecrets.missing.join(", ")}`, code: "missing_secret" };
|
|
8150
8162
|
}
|
|
8163
|
+
const pathParamNames = extractPathParamNames(endpointAfterSecrets.value);
|
|
8151
8164
|
const endpointAfterParams = substituteParams(endpointAfterSecrets.value, req.params);
|
|
8152
8165
|
const safety = await assertSafeUrl(endpointAfterParams);
|
|
8153
8166
|
if (!safety.ok) {
|
|
@@ -8160,6 +8173,17 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8160
8173
|
return { ok: false, error: safety.reason, code: safety.code };
|
|
8161
8174
|
}
|
|
8162
8175
|
let url = safety.url;
|
|
8176
|
+
if (tool.method === "GET" || tool.method === "DELETE" || tool.method === "HEAD") {
|
|
8177
|
+
for (const [k, v] of Object.entries(req.params)) {
|
|
8178
|
+
if (pathParamNames.has(k))
|
|
8179
|
+
continue;
|
|
8180
|
+
if (v === void 0 || v === null)
|
|
8181
|
+
continue;
|
|
8182
|
+
if (typeof v === "object")
|
|
8183
|
+
continue;
|
|
8184
|
+
url.searchParams.set(k, String(v));
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8163
8187
|
const headers = new Headers({ "user-agent": "damn-dev-skill-dispatcher/1.0" });
|
|
8164
8188
|
if (tool.auth) {
|
|
8165
8189
|
const authValue = substituteSecrets(tool.auth.value, secrets);
|
|
@@ -30913,7 +30937,7 @@ var require_package = __commonJS({
|
|
|
30913
30937
|
module2.exports = {
|
|
30914
30938
|
name: "backend",
|
|
30915
30939
|
private: true,
|
|
30916
|
-
version: "0.13.
|
|
30940
|
+
version: "0.13.9",
|
|
30917
30941
|
scripts: {
|
|
30918
30942
|
dev: "tsx watch src/server.ts",
|
|
30919
30943
|
build: "tsc && rm -rf dist/resources && cp -r resources dist/resources",
|