@ductape/mcp 0.1.0 → 0.1.2
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.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +274 -79
- package/dist/proxy-client.d.ts +2 -3
- package/dist/proxy-client.d.ts.map +1 -1
- package/dist/proxy-client.js +14 -1
- package/package.json +1 -1
- package/src/index.ts +297 -78
- package/src/proxy-client.ts +16 -4
package/src/proxy-client.ts
CHANGED
|
@@ -68,9 +68,7 @@ export async function executeViaProxy<T = unknown>(
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export interface IGenerateExecutablePayloadRequest {
|
|
71
|
-
|
|
72
|
-
user_id: string;
|
|
73
|
-
public_key: string;
|
|
71
|
+
publishable_key: string;
|
|
74
72
|
product_tag: string;
|
|
75
73
|
env_slug: string;
|
|
76
74
|
operation_family: string;
|
|
@@ -93,6 +91,20 @@ interface GenericResponse<T = unknown> {
|
|
|
93
91
|
message?: string;
|
|
94
92
|
}
|
|
95
93
|
|
|
94
|
+
export async function getAssetSchemas(module?: string): Promise<unknown> {
|
|
95
|
+
const path = module ? `/proxy/v1/schema/${encodeURIComponent(module)}` : '/proxy/v1/schema';
|
|
96
|
+
const url = `${API_BASE_URL.replace(/\/$/, '')}${path}`;
|
|
97
|
+
const res = await fetch(url);
|
|
98
|
+
const body = (await res.json()) as GenericResponse<unknown>;
|
|
99
|
+
if (!res.ok) {
|
|
100
|
+
throw new Error(body.message ?? `Schema request failed: ${res.status}`);
|
|
101
|
+
}
|
|
102
|
+
if (typeof body.status === 'boolean' && !body.status) {
|
|
103
|
+
throw new Error(body.message ?? 'Schema fetch failed');
|
|
104
|
+
}
|
|
105
|
+
return body.data;
|
|
106
|
+
}
|
|
107
|
+
|
|
96
108
|
export async function generateExecutablePayload<T = IGenerateExecutablePayloadResponse>(
|
|
97
109
|
request: IGenerateExecutablePayloadRequest,
|
|
98
110
|
): Promise<T> {
|
|
@@ -101,7 +113,7 @@ export async function generateExecutablePayload<T = IGenerateExecutablePayloadRe
|
|
|
101
113
|
method: 'POST',
|
|
102
114
|
headers: {
|
|
103
115
|
'Content-Type': 'application/json',
|
|
104
|
-
'x-access-key': request.
|
|
116
|
+
'x-access-key': request.publishable_key,
|
|
105
117
|
},
|
|
106
118
|
body: JSON.stringify(request),
|
|
107
119
|
});
|