diff --git a/packages/basehub/CHANGELOG.md b/packages/basehub/CHANGELOG.md index d85eff7..31aee5a 100644 --- a/packages/basehub/CHANGELOG.md +++ b/packages/basehub/CHANGELOG.md @@ -1,5 +1,11 @@ # basehub +## 6.0.7 + +### Patch Changes + +- improve transaction typings + ## 6.0.6 ### Patch Changes diff --git a/packages/basehub/package.json b/packages/basehub/package.json index a114f71..bdd7b2b 100644 --- a/packages/basehub/package.json +++ b/packages/basehub/package.json @@ -2,7 +2,7 @@ "name": "basehub", "description": "The first AI-native content hub.", "author": "JB ", - "version": "6.0.6", + "version": "6.0.7", "license": "MIT", "repository": "basehub-ai/basehub", "bugs": "https://github.com/basehub-ai/basehub/issues", diff --git a/packages/basehub/src/bin/main.ts b/packages/basehub/src/bin/main.ts index 96ff92b..55b4f52 100644 --- a/packages/basehub/src/bin/main.ts +++ b/packages/basehub/src/bin/main.ts @@ -107,8 +107,8 @@ export const main = async ( ); schemaFileContents = schemaFileContents.replace( - "...options", - "...options,\n headers: { ...options?.headers, ...headers }" + "\n ...options", + " ...options,\n headers: { ...options?.headers, ...headers }" ); // 2. remove export for `createClient`, as it holds options that we don't want to expose. @@ -126,6 +126,29 @@ export const main = async ( })}}` ); + if ( + schemaFileContents.includes("mutation") + ) { + // edit `MutationGenqlSelection` to receive the Transaction directly instead of a string + schemaFileContents = schemaFileContents.replace( + "mutation", + `mutation< +R extends Omit & { + transaction?: Omit & { + __args: Omit< + NonNullable["__args"], + "data" + > & { data: Transaction | string }; + }; +}, +>` + ); + + // add import for Transaction at the start of the file + schemaFileContents += + "\nimport type { Transaction } from './api-transaction';\n"; + } + // 3. append our basehub function to the end of the file. const basehubExport = getBaseHubExport(draft); if (!schemaFileContents.includes(basehubExport)) { diff --git a/playground/CHANGELOG.md b/playground/CHANGELOG.md index b6a4c07..a08b63b 100644 --- a/playground/CHANGELOG.md +++ b/playground/CHANGELOG.md @@ -1,5 +1,12 @@ # playground +## 0.0.106 + +### Patch Changes + +- Updated dependencies + - basehub@6.0.7 + ## 0.0.105 ### Patch Changes diff --git a/playground/package.json b/playground/package.json index cc5bb7a..6552d14 100644 --- a/playground/package.json +++ b/playground/package.json @@ -1,7 +1,7 @@ { "name": "playground", "private": true, - "version": "0.0.105", + "version": "0.0.106", "scripts": { "dev": "basehub dev & next dev", "build": "basehub && next build",