Skip to content

Commit

Permalink
v
Browse files Browse the repository at this point in the history
  • Loading branch information
julianbenegas committed Jun 14, 2024
1 parent fd855ec commit 21831a7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/basehub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# basehub

## 6.0.7

### Patch Changes

- improve transaction typings

## 6.0.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/basehub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "basehub",
"description": "The first AI-native content hub.",
"author": "JB <[email protected]>",
"version": "6.0.6",
"version": "6.0.7",
"license": "MIT",
"repository": "basehub-ai/basehub",
"bugs": "https://github.com/basehub-ai/basehub/issues",
Expand Down
27 changes: 25 additions & 2 deletions packages/basehub/src/bin/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -126,6 +126,29 @@ export const main = async (
})}}`
);

if (
schemaFileContents.includes("mutation<R extends MutationGenqlSelection>")
) {
// edit `MutationGenqlSelection` to receive the Transaction directly instead of a string
schemaFileContents = schemaFileContents.replace(
"mutation<R extends MutationGenqlSelection>",
`mutation<
R extends Omit<MutationGenqlSelection, "transaction"> & {
transaction?: Omit<MutationGenqlSelection["transaction"], "__args"> & {
__args: Omit<
NonNullable<MutationGenqlSelection["transaction"]>["__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)) {
Expand Down
7 changes: 7 additions & 0 deletions playground/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# playground

## 0.0.106

### Patch Changes

- Updated dependencies
- [email protected]

## 0.0.105

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 21831a7

Please sign in to comment.