@decocms/bindings 1.0.1-alpha.13 → 1.0.1-alpha.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/bindings",
3
- "version": "1.0.1-alpha.13",
3
+ "version": "1.0.1-alpha.15",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "vitest run",
@@ -83,7 +83,12 @@ export const createServerClient = async (
83
83
  headers.set(key, value);
84
84
  }
85
85
 
86
- return fetch(mcpServer.connection.url + `/call-tool/${tool}`, {
86
+ const url = new URL(mcpServer.connection.url);
87
+ // Trim trailing slashes from pathname, ensuring it starts with '/'
88
+ const trimmedPath = url.pathname.replace(/\/+$/, "") || "/";
89
+ url.pathname = `${trimmedPath}/call-tool/${encodeURIComponent(tool)}`;
90
+
91
+ return fetch(url.href, {
87
92
  method: "POST",
88
93
  redirect: "manual",
89
94
  body: JSON.stringify(args),
@@ -140,12 +140,14 @@ export function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(
140
140
  /**
141
141
  * Factory function to create insert input schema
142
142
  */
143
- export function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(
143
+ export function createCollectionInsertInputSchema<
144
+ T extends z.ZodObject<z.ZodRawShape>,
145
+ >(
144
146
  entitySchema: T,
145
147
  ) {
146
148
  // Remove id field since it may be auto-generated by the server
147
149
  return z.object({
148
- data: entitySchema.describe(
150
+ data: entitySchema.partial().describe(
149
151
  "Data for the new entity (id may be auto-generated)",
150
152
  ),
151
153
  });