chore: server-and-serverless template

This commit is contained in:
e2e
2026-06-26 14:41:47 +02:00
commit facba843e5
202 changed files with 9060 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
// Generated by @pikku/cli — do not edit by hand.
// Run `pikku db migrate` to refresh.
// Use this type in db/classifications.ts:
// import type { DbClassificationMap } from './.pikku/db/classification-map.gen.d.ts'
// export const classifications = { ... } satisfies DbClassificationMap
export type ColumnEntry = {
/** Privacy level. Defaults to 'private' when omitted. */
security?: 'public' | 'private' | 'pii' | 'secret' | 'encrypted'
/** Anonymize strategy used by `pikku db anonymize`. */
classification?: 'fake:email' | 'fake:name' | 'hash' | 'keep'
/** Column kind override for codegen coercion + typing. */
kind?: 'date' | 'bool' | 'json' | 'uuid'
/** TypeScript type override, e.g. `string[]` or `MyJson`. Wins over `kind`. */
tsType?: string
/** Zod string-format validator (keeps the TS type as `string`). */
format?: 'email' | 'url' | 'emoji' | 'e164' | 'jwt' | 'cuid' | 'cuid2' | 'ulid' | 'nanoid' | 'base64' | 'base64url' | 'ipv4' | 'ipv6' | 'cidrv4' | 'cidrv6' | 'isoDate' | 'isoTime' | 'isoDatetime' | 'isoDuration'
description?: string
}
export type DbClassificationMap = {
"account": {
"id": ColumnEntry
"account_id": ColumnEntry
"provider_id": ColumnEntry
"user_id": ColumnEntry
"access_token": ColumnEntry
"refresh_token": ColumnEntry
"id_token": ColumnEntry
"access_token_expires_at": ColumnEntry
"refresh_token_expires_at": ColumnEntry
"scope": ColumnEntry
"password": ColumnEntry
"created_at": ColumnEntry
"updated_at": ColumnEntry
}
"audit": {
"audit_id": ColumnEntry
"occurred_at": ColumnEntry
"type": ColumnEntry
"source": ColumnEntry
"outcome": ColumnEntry
"function_id": ColumnEntry
"wire_type": ColumnEntry
"trace_id": ColumnEntry
"transaction_id": ColumnEntry
"query_id": ColumnEntry
"actor_user_id": ColumnEntry
"actor_org_id": ColumnEntry
"tables": ColumnEntry
"changed_cols": ColumnEntry
"event": ColumnEntry
"old": ColumnEntry
"data": ColumnEntry
}
"message_state": {
"id": ColumnEntry
"message": ColumnEntry
"updated_at": ColumnEntry
"updated_by_user_id": ColumnEntry
}
"session": {
"id": ColumnEntry
"expires_at": ColumnEntry
"token": ColumnEntry
"created_at": ColumnEntry
"updated_at": ColumnEntry
"ip_address": ColumnEntry
"user_agent": ColumnEntry
"user_id": ColumnEntry
}
"user": {
"id": ColumnEntry
"name": ColumnEntry
"email": ColumnEntry
"email_verified": ColumnEntry
"image": ColumnEntry
"created_at": ColumnEntry
"updated_at": ColumnEntry
}
"verification": {
"id": ColumnEntry
"identifier": ColumnEntry
"value": ColumnEntry
"expires_at": ColumnEntry
"created_at": ColumnEntry
"updated_at": ColumnEntry
}
}

View File

@@ -0,0 +1,75 @@
// Generated by @pikku/cli — do not edit by hand.
// Run `pikku db migrate` to refresh.
export const classificationManifest = {
version: 1 as const,
tables: {
"account": {
"id": { classification: 'private', anonymize_strategy: null },
"account_id": { classification: 'private', anonymize_strategy: null },
"provider_id": { classification: 'private', anonymize_strategy: null },
"user_id": { classification: 'private', anonymize_strategy: null },
"access_token": { classification: 'private', anonymize_strategy: null },
"refresh_token": { classification: 'private', anonymize_strategy: null },
"id_token": { classification: 'private', anonymize_strategy: null },
"access_token_expires_at": { classification: 'private', anonymize_strategy: null },
"refresh_token_expires_at": { classification: 'private', anonymize_strategy: null },
"scope": { classification: 'private', anonymize_strategy: null },
"password": { classification: 'private', anonymize_strategy: null },
"created_at": { classification: 'private', anonymize_strategy: null },
"updated_at": { classification: 'private', anonymize_strategy: null }
},
"audit": {
"audit_id": { classification: 'private', anonymize_strategy: null },
"occurred_at": { classification: 'private', anonymize_strategy: null },
"type": { classification: 'private', anonymize_strategy: null },
"source": { classification: 'private', anonymize_strategy: null },
"outcome": { classification: 'private', anonymize_strategy: null },
"function_id": { classification: 'private', anonymize_strategy: null },
"wire_type": { classification: 'private', anonymize_strategy: null },
"trace_id": { classification: 'private', anonymize_strategy: null },
"transaction_id": { classification: 'private', anonymize_strategy: null },
"query_id": { classification: 'private', anonymize_strategy: null },
"actor_user_id": { classification: 'private', anonymize_strategy: null },
"actor_org_id": { classification: 'private', anonymize_strategy: null },
"tables": { classification: 'private', anonymize_strategy: null },
"changed_cols": { classification: 'private', anonymize_strategy: null },
"event": { classification: 'private', anonymize_strategy: null },
"old": { classification: 'private', anonymize_strategy: null },
"data": { classification: 'private', anonymize_strategy: null }
},
"message_state": {
"id": { classification: 'private', anonymize_strategy: null },
"message": { classification: 'private', anonymize_strategy: null },
"updated_at": { classification: 'private', anonymize_strategy: null },
"updated_by_user_id": { classification: 'private', anonymize_strategy: null }
},
"session": {
"id": { classification: 'private', anonymize_strategy: null },
"expires_at": { classification: 'private', anonymize_strategy: null },
"token": { classification: 'private', anonymize_strategy: null },
"created_at": { classification: 'private', anonymize_strategy: null },
"updated_at": { classification: 'private', anonymize_strategy: null },
"ip_address": { classification: 'private', anonymize_strategy: null },
"user_agent": { classification: 'private', anonymize_strategy: null },
"user_id": { classification: 'private', anonymize_strategy: null }
},
"user": {
"id": { classification: 'private', anonymize_strategy: null },
"name": { classification: 'private', anonymize_strategy: null },
"email": { classification: 'private', anonymize_strategy: null },
"email_verified": { classification: 'private', anonymize_strategy: null },
"image": { classification: 'private', anonymize_strategy: null },
"created_at": { classification: 'private', anonymize_strategy: null },
"updated_at": { classification: 'private', anonymize_strategy: null }
},
"verification": {
"id": { classification: 'private', anonymize_strategy: null },
"identifier": { classification: 'private', anonymize_strategy: null },
"value": { classification: 'private', anonymize_strategy: null },
"expires_at": { classification: 'private', anonymize_strategy: null },
"created_at": { classification: 'private', anonymize_strategy: null },
"updated_at": { classification: 'private', anonymize_strategy: null }
}
},
} as const

View File

@@ -0,0 +1,6 @@
// Generated by @pikku/cli — do not edit by hand.
// Run `pikku db migrate` to refresh.
export const coercionMap = {
} as const

View File

@@ -0,0 +1,377 @@
{
"tables": [
{
"name": "account",
"columns": [
{
"name": "id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "account_id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "provider_id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "user_id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false,
"foreignKey": {
"table": "user",
"column": "id"
}
},
{
"name": "access_token",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "refresh_token",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "id_token",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "access_token_expires_at",
"type": "date",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "refresh_token_expires_at",
"type": "date",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "scope",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "password",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "created_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
}
]
},
{
"name": "audit",
"columns": [
{
"name": "audit_id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "occurred_at",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "type",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "source",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "outcome",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "function_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "wire_type",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "trace_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "transaction_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "query_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "actor_user_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "actor_org_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "tables",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "changed_cols",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "event",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "old",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "data",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
}
]
},
{
"name": "message_state",
"columns": [
{
"name": "id",
"type": "INTEGER",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "message",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_at",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_by_user_id",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false,
"foreignKey": {
"table": "user",
"column": "id"
}
}
]
},
{
"name": "session",
"columns": [
{
"name": "id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "expires_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "token",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "created_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "ip_address",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "user_agent",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "user_id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false,
"foreignKey": {
"table": "user",
"column": "id"
}
}
]
},
{
"name": "user",
"columns": [
{
"name": "id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "name",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "email",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "email_verified",
"type": "INTEGER",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "image",
"type": "TEXT",
"nullable": true,
"isPrimaryKey": false
},
{
"name": "created_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
}
]
},
{
"name": "verification",
"columns": [
{
"name": "id",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": true
},
{
"name": "identifier",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "value",
"type": "TEXT",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "expires_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "created_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
},
{
"name": "updated_at",
"type": "date",
"nullable": false,
"isPrimaryKey": false
}
]
}
],
"enums": []
}

View File

@@ -0,0 +1,95 @@
// Generated by @pikku/cli — do not edit by hand.
// Run `pikku db migrate` to refresh.
import type { ColumnType } from 'kysely'
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>
export type Private<T> = T & { readonly __classification__?: 'private' }
export type Pii<T> = T & { readonly __classification__?: 'pii' }
export type Secret<T> = T & { readonly __classification__?: 'secret' }
export type Uuid = string
export interface Account {
id: ColumnType<Private<string>, string, string>
accountId: ColumnType<Private<string>, string, string>
providerId: ColumnType<Private<string>, string, string>
userId: ColumnType<Private<string>, string, string>
accessToken: ColumnType<Private<string> | null, string | null, string | null>
refreshToken: ColumnType<Private<string> | null, string | null, string | null>
idToken: ColumnType<Private<string> | null, string | null, string | null>
accessTokenExpiresAt: ColumnType<Private<string> | null, string | null, string | null>
refreshTokenExpiresAt: ColumnType<Private<string> | null, string | null, string | null>
scope: ColumnType<Private<string> | null, string | null, string | null>
password: ColumnType<Private<string> | null, string | null, string | null>
createdAt: ColumnType<Private<string>, string, string>
updatedAt: ColumnType<Private<string>, string, string>
}
export interface Audit {
auditId: ColumnType<Private<string>, string | undefined, string>
occurredAt: ColumnType<Private<string>, string | undefined, string>
type: ColumnType<Private<string>, string, string>
source: ColumnType<Private<string>, string | undefined, string>
outcome: ColumnType<Private<string> | null, string | null, string | null>
functionId: ColumnType<Private<string> | null, string | null, string | null>
wireType: ColumnType<Private<string> | null, string | null, string | null>
traceId: ColumnType<Private<string> | null, string | null, string | null>
transactionId: ColumnType<Private<string> | null, string | null, string | null>
queryId: ColumnType<Private<string> | null, string | null, string | null>
actorUserId: ColumnType<Private<string> | null, string | null, string | null>
actorOrgId: ColumnType<Private<string> | null, string | null, string | null>
tables: ColumnType<Private<string> | null, string | null, string | null>
changedCols: ColumnType<Private<string> | null, string | null, string | null>
event: ColumnType<Private<string> | null, string | null, string | null>
old: ColumnType<Private<string> | null, string | null, string | null>
data: ColumnType<Private<string> | null, string | null, string | null>
}
export interface MessageState {
id: ColumnType<Private<number>, number | undefined, number>
message: ColumnType<Private<string>, string, string>
updatedAt: ColumnType<Private<string>, string | undefined, string>
updatedByUserId: ColumnType<Private<string> | null, string | null, string | null>
}
export interface Session {
id: ColumnType<Private<string>, string, string>
expiresAt: ColumnType<Private<string>, string, string>
token: ColumnType<Private<string>, string, string>
createdAt: ColumnType<Private<string>, string, string>
updatedAt: ColumnType<Private<string>, string, string>
ipAddress: ColumnType<Private<string> | null, string | null, string | null>
userAgent: ColumnType<Private<string> | null, string | null, string | null>
userId: ColumnType<Private<string>, string, string>
}
export interface User {
id: ColumnType<Private<string>, string, string>
name: ColumnType<Private<string>, string, string>
email: ColumnType<Private<string>, string, string>
emailVerified: ColumnType<Private<number>, number, number>
image: ColumnType<Private<string> | null, string | null, string | null>
createdAt: ColumnType<Private<string>, string, string>
updatedAt: ColumnType<Private<string>, string, string>
}
export interface Verification {
id: ColumnType<Private<string>, string, string>
identifier: ColumnType<Private<string>, string, string>
value: ColumnType<Private<string>, string, string>
expiresAt: ColumnType<Private<string>, string, string>
createdAt: ColumnType<Private<string>, string, string>
updatedAt: ColumnType<Private<string>, string, string>
}
export interface DB {
account: Account
audit: Audit
messageState: MessageState
session: Session
user: User
verification: Verification
}

View File

@@ -0,0 +1,163 @@
// Generated by @pikku/cli — do not edit by hand.
// Run `pikku db migrate` to refresh.
import { z } from 'zod'
export const AccountZ = z.object({
id: z.string(),
accountId: z.string(),
providerId: z.string(),
userId: z.string(),
accessToken: z.string().nullable(),
refreshToken: z.string().nullable(),
idToken: z.string().nullable(),
accessTokenExpiresAt: z.string().nullable(),
refreshTokenExpiresAt: z.string().nullable(),
scope: z.string().nullable(),
password: z.string().nullable(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const AccountInsertZ = z.object({
id: z.string(),
accountId: z.string(),
providerId: z.string(),
userId: z.string(),
accessToken: z.string().nullable(),
refreshToken: z.string().nullable(),
idToken: z.string().nullable(),
accessTokenExpiresAt: z.string().nullable(),
refreshTokenExpiresAt: z.string().nullable(),
scope: z.string().nullable(),
password: z.string().nullable(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const AccountPatchZ = AccountZ.partial()
export const AuditZ = z.object({
auditId: z.string(),
occurredAt: z.string(),
type: z.string(),
source: z.string(),
outcome: z.string().nullable(),
functionId: z.string().nullable(),
wireType: z.string().nullable(),
traceId: z.string().nullable(),
transactionId: z.string().nullable(),
queryId: z.string().nullable(),
actorUserId: z.string().nullable(),
actorOrgId: z.string().nullable(),
tables: z.string().nullable(),
changedCols: z.string().nullable(),
event: z.string().nullable(),
old: z.string().nullable(),
data: z.string().nullable(),
})
export const AuditInsertZ = z.object({
auditId: z.string().optional(),
occurredAt: z.string().optional(),
type: z.string(),
source: z.string().optional(),
outcome: z.string().nullable(),
functionId: z.string().nullable(),
wireType: z.string().nullable(),
traceId: z.string().nullable(),
transactionId: z.string().nullable(),
queryId: z.string().nullable(),
actorUserId: z.string().nullable(),
actorOrgId: z.string().nullable(),
tables: z.string().nullable(),
changedCols: z.string().nullable(),
event: z.string().nullable(),
old: z.string().nullable(),
data: z.string().nullable(),
})
export const AuditPatchZ = AuditZ.partial()
export const MessageStateZ = z.object({
id: z.number(),
message: z.string(),
updatedAt: z.string(),
updatedByUserId: z.string().nullable(),
})
export const MessageStateInsertZ = z.object({
id: z.number().optional(),
message: z.string(),
updatedAt: z.string().optional(),
updatedByUserId: z.string().nullable(),
})
export const MessageStatePatchZ = MessageStateZ.partial()
export const SessionZ = z.object({
id: z.string(),
expiresAt: z.string(),
token: z.string(),
createdAt: z.string(),
updatedAt: z.string(),
ipAddress: z.string().nullable(),
userAgent: z.string().nullable(),
userId: z.string(),
})
export const SessionInsertZ = z.object({
id: z.string(),
expiresAt: z.string(),
token: z.string(),
createdAt: z.string(),
updatedAt: z.string(),
ipAddress: z.string().nullable(),
userAgent: z.string().nullable(),
userId: z.string(),
})
export const SessionPatchZ = SessionZ.partial()
export const UserZ = z.object({
id: z.string(),
name: z.string(),
email: z.string(),
emailVerified: z.number(),
image: z.string().nullable(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const UserInsertZ = z.object({
id: z.string(),
name: z.string(),
email: z.string(),
emailVerified: z.number(),
image: z.string().nullable(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const UserPatchZ = UserZ.partial()
export const VerificationZ = z.object({
id: z.string(),
identifier: z.string(),
value: z.string(),
expiresAt: z.string(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const VerificationInsertZ = z.object({
id: z.string(),
identifier: z.string(),
value: z.string(),
expiresAt: z.string(),
createdAt: z.string(),
updatedAt: z.string(),
})
export const VerificationPatchZ = VerificationZ.partial()