File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ Changelog
68
68
69
69
To be released.
70
70
71
+ - Use the explicitly typed binding instead of an implicit one to work
72
+ around the stringification issue.
73
+
71
74
### Version 0.2.1
72
75
73
76
Released on November 3, 2024.
Original file line number Diff line number Diff line change 1
1
import type { KvKey , KvStore , KvStoreSetOptions } from "@fedify/fedify" ;
2
- import type { Sql } from "postgres" ;
2
+ import type { JSONValue , Sql } from "postgres" ;
3
3
4
4
/**
5
5
* Options for the PostgreSQL key-value store.
@@ -84,7 +84,7 @@ export class PostgresKvStore implements KvStore {
84
84
INSERT INTO ${ this . #sql( this . #tableName) } (key, value, ttl)
85
85
VALUES (
86
86
${ key } ,
87
- ( ${ { value } as unknown as string } ::jsonb) -> 'value' ,
87
+ ${ this . #sql . json ( value as JSONValue ) } ,
88
88
${ ttl }
89
89
)
90
90
ON CONFLICT (key)
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export class PostgresMessageQueue implements MessageQueue {
86
86
await this . #sql`
87
87
INSERT INTO ${ this . #sql( this . #tableName) } (message, delay)
88
88
VALUES (
89
- ( ${ { message } as unknown as string } ::jsonb) -> 'message' ,
89
+ ${ this . #sql . json ( message ) } ,
90
90
${ delay . toString ( ) }
91
91
);
92
92
` ;
You can’t perform that action at this time.
0 commit comments