@solongate/proxy 0.5.7 → 0.5.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/dist/index.js +25 -0
- package/dist/pull-push.js +25 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1900,8 +1900,33 @@ function parseCliArgs() {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
return { command, apiKey, file: resolve5(file), policyId };
|
|
1902
1902
|
}
|
|
1903
|
+
async function listPolicies(apiKey) {
|
|
1904
|
+
const res = await fetch("https://api.solongate.com/api/v1/policies", {
|
|
1905
|
+
headers: { "Authorization": `Bearer ${apiKey}` }
|
|
1906
|
+
});
|
|
1907
|
+
if (!res.ok) throw new Error(`Failed to list policies (${res.status})`);
|
|
1908
|
+
const data = await res.json();
|
|
1909
|
+
return data.policies ?? [];
|
|
1910
|
+
}
|
|
1903
1911
|
async function pull(apiKey, file, policyId) {
|
|
1904
1912
|
const apiUrl = "https://api.solongate.com";
|
|
1913
|
+
if (!policyId) {
|
|
1914
|
+
const policies = await listPolicies(apiKey);
|
|
1915
|
+
if (policies.length === 0) {
|
|
1916
|
+
log5("No policies found. Create one in the dashboard first.");
|
|
1917
|
+
process.exit(1);
|
|
1918
|
+
}
|
|
1919
|
+
if (policies.length > 1) {
|
|
1920
|
+
log5(`Found ${policies.length} policies:
|
|
1921
|
+
`);
|
|
1922
|
+
for (const p of policies) {
|
|
1923
|
+
log5(` ${p.id} ${p.name} (${(p.rules || []).length} rules)`);
|
|
1924
|
+
}
|
|
1925
|
+
log5("");
|
|
1926
|
+
log5("Use --policy-id <ID> to specify which one to pull.");
|
|
1927
|
+
process.exit(1);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1905
1930
|
log5(`Pulling policy from dashboard...`);
|
|
1906
1931
|
const policy = await fetchCloudPolicy(apiKey, apiUrl, policyId);
|
|
1907
1932
|
const json = JSON.stringify(policy, null, 2) + "\n";
|
package/dist/pull-push.js
CHANGED
|
@@ -108,8 +108,33 @@ function parseCliArgs() {
|
|
|
108
108
|
}
|
|
109
109
|
return { command, apiKey, file: resolve2(file), policyId };
|
|
110
110
|
}
|
|
111
|
+
async function listPolicies(apiKey) {
|
|
112
|
+
const res = await fetch("https://api.solongate.com/api/v1/policies", {
|
|
113
|
+
headers: { "Authorization": `Bearer ${apiKey}` }
|
|
114
|
+
});
|
|
115
|
+
if (!res.ok) throw new Error(`Failed to list policies (${res.status})`);
|
|
116
|
+
const data = await res.json();
|
|
117
|
+
return data.policies ?? [];
|
|
118
|
+
}
|
|
111
119
|
async function pull(apiKey, file, policyId) {
|
|
112
120
|
const apiUrl = "https://api.solongate.com";
|
|
121
|
+
if (!policyId) {
|
|
122
|
+
const policies = await listPolicies(apiKey);
|
|
123
|
+
if (policies.length === 0) {
|
|
124
|
+
log("No policies found. Create one in the dashboard first.");
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
if (policies.length > 1) {
|
|
128
|
+
log(`Found ${policies.length} policies:
|
|
129
|
+
`);
|
|
130
|
+
for (const p of policies) {
|
|
131
|
+
log(` ${p.id} ${p.name} (${(p.rules || []).length} rules)`);
|
|
132
|
+
}
|
|
133
|
+
log("");
|
|
134
|
+
log("Use --policy-id <ID> to specify which one to pull.");
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
113
138
|
log(`Pulling policy from dashboard...`);
|
|
114
139
|
const policy = await fetchCloudPolicy(apiKey, apiUrl, policyId);
|
|
115
140
|
const json = JSON.stringify(policy, null, 2) + "\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "MCP security proxy — protect any MCP server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|