Skip to content

Commit

Permalink
fix: handle boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
markusahlstrand committed Jul 26, 2024
1 parent bcc8207 commit f50d9d3
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 9 deletions.
6 changes: 6 additions & 0 deletions apps/demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @authhero/demo

## 0.0.5

### Patch Changes

- [email protected]

## 0.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@authhero/demo",
"private": true,
"version": "0.0.4",
"version": "0.0.5",
"scripts": {
"dev": "bun --watch src/bun.ts"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/adapter-interfaces/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @authhero/adapter-interfaces

## 0.10.3

### Patch Changes

- Handle boolean values

## 0.10.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/markusahlstrand/authhero"
},
"version": "0.10.2",
"version": "0.10.3",
"files": [
"dist"
],
Expand Down
7 changes: 7 additions & 0 deletions packages/authhero/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# authhero

## 0.2.7

### Patch Changes

- Updated dependencies
- @authhero/adapter-interfaces@0.10.3

## 0.2.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/authhero/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "authhero",
"version": "0.2.6",
"version": "0.2.7",
"files": [
"dist"
],
Expand Down
7 changes: 7 additions & 0 deletions packages/drizzle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @authhero/drizzle

## 0.1.23

### Patch Changes

- Updated dependencies
- @authhero/adapter-interfaces@0.10.3

## 0.1.22

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/drizzle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/markusahlstrand/authhero"
},
"version": "0.1.22",
"version": "0.1.23",
"files": [
"dist"
],
Expand Down
8 changes: 8 additions & 0 deletions packages/kysely/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @authhero/kysely-adapter

## 0.6.3

### Patch Changes

- Handle boolean values
- Updated dependencies
- @authhero/adapter-interfaces@0.10.3

## 0.6.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/kysely/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/markusahlstrand/authhero"
},
"version": "0.6.2",
"version": "0.6.3",
"files": [
"dist"
],
Expand Down
9 changes: 6 additions & 3 deletions packages/kysely/src/hooks/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Database } from "../db";

export function create(db: Kysely<Database>) {
return async (tenant_id: string, hook: HookInsert): Promise<Hook> => {
const sqlHook = {
const createdHook = {
hook_id: nanoid(),
...hook,
created_at: new Date().toISOString(),
Expand All @@ -14,9 +14,12 @@ export function create(db: Kysely<Database>) {

await db
.insertInto("hooks")
.values({ ...sqlHook, tenant_id })
.values({
...createdHook,
tenant_id,
})
.execute();

return sqlHook;
return createdHook;
};
}
1 change: 1 addition & 0 deletions packages/kysely/src/hooks/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function get(db: Kysely<Database>) {
}

hook.enabled = !!hook.enabled;
hook.synchronous = !!hook.synchronous;

return removeNullProperties(hook);
};
Expand Down
3 changes: 2 additions & 1 deletion packages/kysely/src/hooks/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ export function list(db: Kysely<Database>) {
.executeTakeFirstOrThrow();

const hooks = results.map((hook) => {
const { tenant_id, enabled, ...rest } = hook;
const { tenant_id, enabled, synchronous, ...rest } = hook;

return removeNullProperties({
...rest,
enabled: !!enabled,
synchronous: !!synchronous,
});
});

Expand Down

0 comments on commit f50d9d3

Please sign in to comment.