@damn-dev/cli 0.13.7 → 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,8 +7984,20 @@ 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
|
-
return template.replace(/<([A-Za-z_][A-Za-z0-9_]*)
|
|
7999
|
+
return template.replace(/<([A-Za-z_][A-Za-z0-9_]*)>|\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, angle, curly) => {
|
|
8000
|
+
const key = angle ?? curly;
|
|
7988
8001
|
const v = params[key];
|
|
7989
8002
|
if (v === void 0 || v === null)
|
|
7990
8003
|
return "";
|
|
@@ -8147,6 +8160,7 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8147
8160
|
if (!endpointAfterSecrets.ok) {
|
|
8148
8161
|
return { ok: false, error: `Missing workspace secret: ${endpointAfterSecrets.missing.join(", ")}`, code: "missing_secret" };
|
|
8149
8162
|
}
|
|
8163
|
+
const pathParamNames = extractPathParamNames(endpointAfterSecrets.value);
|
|
8150
8164
|
const endpointAfterParams = substituteParams(endpointAfterSecrets.value, req.params);
|
|
8151
8165
|
const safety = await assertSafeUrl(endpointAfterParams);
|
|
8152
8166
|
if (!safety.ok) {
|
|
@@ -8159,6 +8173,17 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8159
8173
|
return { ok: false, error: safety.reason, code: safety.code };
|
|
8160
8174
|
}
|
|
8161
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
|
+
}
|
|
8162
8187
|
const headers = new Headers({ "user-agent": "damn-dev-skill-dispatcher/1.0" });
|
|
8163
8188
|
if (tool.auth) {
|
|
8164
8189
|
const authValue = substituteSecrets(tool.auth.value, secrets);
|
|
@@ -30912,7 +30937,7 @@ var require_package = __commonJS({
|
|
|
30912
30937
|
module2.exports = {
|
|
30913
30938
|
name: "backend",
|
|
30914
30939
|
private: true,
|
|
30915
|
-
version: "0.13.
|
|
30940
|
+
version: "0.13.9",
|
|
30916
30941
|
scripts: {
|
|
30917
30942
|
dev: "tsx watch src/server.ts",
|
|
30918
30943
|
build: "tsc && rm -rf dist/resources && cp -r resources dist/resources",
|