WGW ☂ calldata.space
WGW ☂ calldata.space
Explore posts from servers
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
I'm not doing anything for the graphql, it's drizzle-graphql and it should handle sqlite json fields properly.
8 replies
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
Yeah, on orm query it works, but not on the graphql frontend. That's the thing if it was returning it like stringified json array it would still be okay, like it does for royalties which it returns like stringified object. But instead it throws errors for that links case.
8 replies
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
oh wait, that last thing worked, okay. I was setting created_at: Date.now() when inserting. The OP is still valid problem tho.
8 replies
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
I'm also having similar error when read timestamps
created_at: sq.integer().notNull().default(sql`(unixepoch())`),
created_at: sq.integer().notNull().default(sql`(unixepoch())`),
neither integer({ mode: timestamp }), nor with .defaultNow It works when it's passed as orderBy: { created_at: {direction: asc } }, but know when i ask for the field
8 replies
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
Oh, just seen i've got errors on the terminal:
^
GraphQLError: String cannot represent value: ["https://tall-loyalty.name/", "https://warm-permafrost.org", "https://lavish-mentor.net/", "https://productive-cleaner.org", "https://wasteful-wallaby.biz"]
at completeLeafValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:612:23)
at executeField (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:387:15)
at executeFields (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:285:16)
at collectAndExecuteSubfields (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:996:32)
at completeValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:572:29)
at completeListItemValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:832:33)
at completeListValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:808:14)
at completeValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:572:29)
at processTicksAndRejections (native:7:39)
^
GraphQLError: String cannot represent value: ["https://tall-loyalty.name/", "https://warm-permafrost.org", "https://lavish-mentor.net/", "https://productive-cleaner.org", "https://wasteful-wallaby.biz"]
at completeLeafValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:612:23)
at executeField (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:387:15)
at executeFields (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:285:16)
at collectAndExecuteSubfields (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:996:32)
at completeValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:572:29)
at completeListItemValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:832:33)
at completeListValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:808:14)
at completeValue (/home/charlike/code/next15-rsc-drizzle-turso-app/node_modules/@graphql-tools/executor/esm/execution/execute.js:572:29)
at processTicksAndRejections (native:7:39)
I'm guessing that's the value from the database but it cannot read it properly from text(mode: json)
8 replies
DTDrizzle Team
Created by WGW ☂ calldata.space on 12/8/2024 in #help
Drizzle GraphQL bug with SQLite JSON (Turso)
The royalties field is "json type" in the schema. Here's the full schema:
export const collections = sq.sqliteTable('collections', {
id: sq.text().primaryKey().$defaultFn(createCuidV2),
supply: sq.integer().notNull(),
slug: sq.text().notNull(),
name: sq.text().notNull(),
description: sq.text().notNull(),
logo: sq.text().default('https://example.com/logo.png'),
banner: sq.text().default('https://example.com/banner.png'),
links: sq.text({ mode: 'json' }).$type<`https://${string}`[]>().default([]),
team: sq.text({ mode: 'json' }).$type<(`0x${string}` | string)[]>().default([]),
royalties: sq.text({ mode: 'json' }).$type<{ [key: `0x${string}`]: number }>().default({}),
verified: sq.integer({ mode: 'boolean' }).default(false),
});
export const collections = sq.sqliteTable('collections', {
id: sq.text().primaryKey().$defaultFn(createCuidV2),
supply: sq.integer().notNull(),
slug: sq.text().notNull(),
name: sq.text().notNull(),
description: sq.text().notNull(),
logo: sq.text().default('https://example.com/logo.png'),
banner: sq.text().default('https://example.com/banner.png'),
links: sq.text({ mode: 'json' }).$type<`https://${string}`[]>().default([]),
team: sq.text({ mode: 'json' }).$type<(`0x${string}` | string)[]>().default([]),
royalties: sq.text({ mode: 'json' }).$type<{ [key: `0x${string}`]: number }>().default({}),
verified: sq.integer({ mode: 'boolean' }).default(false),
});
When i try to read team or links it throws error too.
8 replies
DTDrizzle Team
Created by BBuubbaa on 12/5/2024 in #help
Inferring schema with drizzle-zod in sveltekit app
i would probably extract them outside on a different place, then import it in the lib/server and in the client side the same.
2 replies