Nxia618
Nxia618
Explore posts from servers
HHono
Created by Nxia618 on 6/20/2024 in #help
Losing type information on Client for AppType
nvm, solved by fixing package.json to do "core": "workspace:" on internal dep
7 replies
HHono
Created by Damian on 5/21/2024 in #help
Importing AppType to client defaults output to any types
nvm, solved by fixing package.json to do "core": "workspace:" on internal dep
7 replies
HHono
Created by Nxia618 on 6/20/2024 in #help
Losing type information on Client for AppType
hmm, seems to work if I switch out to basic example, so either an issue with @hono/zod-openapi or the rpc routes model
import { zValidator } from '@hono/zod-validator'
import { Hono } from 'hono'
import { z } from 'zod'

const app = new Hono()

const route = app.post(
'/posts',
zValidator(
'form',
z.object({
title: z.string(),
body: z.string(),
}),
),
(c) => {
return c.json(
{
ok: true,
message: 'Created!',
},
201,
)
},
)

export type AppType = typeof route
import { zValidator } from '@hono/zod-validator'
import { Hono } from 'hono'
import { z } from 'zod'

const app = new Hono()

const route = app.post(
'/posts',
zValidator(
'form',
z.object({
title: z.string(),
body: z.string(),
}),
),
(c) => {
return c.json(
{
ok: true,
message: 'Created!',
},
201,
)
},
)

export type AppType = typeof route
7 replies
HHono
Created by Nxia618 on 6/20/2024 in #help
Losing type information on Client for AppType
types.ts
import { routes } from '.'

export type AppType = typeof routes
import { routes } from '.'

export type AppType = typeof routes
7 replies
HHono
Created by Nxia618 on 6/20/2024 in #help
Losing type information on Client for AppType
The client library is angular generated via nx with tsconfig (all I've done is add paths)
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@functions/*": ["packages/functions/src/*"]
}
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@functions/*": ["packages/functions/src/*"]
}
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
with one line import type { AppType } from '@functions/api/types'
7 replies
HHono
Created by Nxia618 on 6/20/2024 in #help
Losing type information on Client for AppType
server api is in packages/functions/api with functions tsconfig
{
"compilerOptions": {
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
}
{
"compilerOptions": {
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
}
example packages/functions/api/index.ts:
import { swaggerUI } from '@hono/swagger-ui'
import { OpenAPIHono } from '@hono/zod-openapi'
import { handle } from 'hono/aws-lambda'
import { compress } from 'hono/compress'
import { logger } from 'hono/logger'
import { appRoute } from './app'
import { concreteRecord } from './concrete-record'
import { mould } from './mould'
import { project } from './project'
import { vehicle } from './vehicle'

const app = new OpenAPIHono()

app.use('*', logger())
app.use('*', compress())
app.use('*', async (c, next) => {
await next()
if (!c.res.headers.get('cache-control')) {
c.header('cache-control', 'no-store, max-age=0, must-revalidate, no-cache')
}
})

app.openAPIRegistry.registerComponent('securitySchemes', 'Bearer', {
type: 'http',
scheme: 'bearer',
})

app.get('/', async (c) => {
return c.json({
message: 'Hello, world!',
})
})

/** Swagger Documentation */
app.doc('/doc', () => ({
openapi: '3.0.0',
info: {
title: 'Extrudakerb API',
version: '0.0.1',
},
}))

// Use the middleware to serve Swagger UI at /ui
app.get(
'/ui',
swaggerUI({
url: '/doc',
}),
)
/** End Swagger Documentation */

export const routes = app
.route('/app', appRoute)
.route('/mould', mould)
.route('/project', project)
.route('/vehicle', vehicle)
.route('/concreteRecord', concreteRecord)

export const handler = handle(app)
import { swaggerUI } from '@hono/swagger-ui'
import { OpenAPIHono } from '@hono/zod-openapi'
import { handle } from 'hono/aws-lambda'
import { compress } from 'hono/compress'
import { logger } from 'hono/logger'
import { appRoute } from './app'
import { concreteRecord } from './concrete-record'
import { mould } from './mould'
import { project } from './project'
import { vehicle } from './vehicle'

const app = new OpenAPIHono()

app.use('*', logger())
app.use('*', compress())
app.use('*', async (c, next) => {
await next()
if (!c.res.headers.get('cache-control')) {
c.header('cache-control', 'no-store, max-age=0, must-revalidate, no-cache')
}
})

app.openAPIRegistry.registerComponent('securitySchemes', 'Bearer', {
type: 'http',
scheme: 'bearer',
})

app.get('/', async (c) => {
return c.json({
message: 'Hello, world!',
})
})

/** Swagger Documentation */
app.doc('/doc', () => ({
openapi: '3.0.0',
info: {
title: 'Extrudakerb API',
version: '0.0.1',
},
}))

// Use the middleware to serve Swagger UI at /ui
app.get(
'/ui',
swaggerUI({
url: '/doc',
}),
)
/** End Swagger Documentation */

export const routes = app
.route('/app', appRoute)
.route('/mould', mould)
.route('/project', project)
.route('/vehicle', vehicle)
.route('/concreteRecord', concreteRecord)

export const handler = handle(app)
7 replies
HHono
Created by Damian on 5/21/2024 in #help
Importing AppType to client defaults output to any types
did you ever fix this?
7 replies
DTDrizzle Team
Created by Chaimba on 2/6/2024 in #help
Help with a request
db.update(Users).set({ favorite: user.favorite.filter((anime: string) => anime !== name) }).where(eq(Users.email, email)) don't think there's a push, so this would be a get and then update, prob best as a transaction, db.transaction(async (tx) => { /** await tx.select...then await tx.update... */ })
4 replies
DTDrizzle Team
Created by Chaimba on 2/6/2024 in #help
Help with a request
db.select().from(Anime).where(inArray(Anime.name, user?.favorite))
4 replies
DTDrizzle Team
Created by Nxia618 on 11/7/2023 in #help
Nested where filter, how to not include empty
thanks, I'll take a look
9 replies
DTDrizzle Team
Created by Nxia618 on 11/7/2023 in #help
Nested where filter, how to not include empty
Not following what " use a subquery in the where " means?
9 replies
DTDrizzle Team
Created by Prøxïmïty on 9/21/2023 in #help
Cannot read properties of undefined (reading \'columns\')
I forgot to include the relevant table (I'm splitting my model into files) when doing const db = drizzle(pool, { schema }); resulted in the error "Cannot read properties of undefined (reading 'columns')"@d4mr perhaps similar issue?
4 replies