Hello from MCP server
/**
* This file was @generated using pocketbase-typegen
*/
import type PocketBase from 'pocketbase'
import type { RecordService } from 'pocketbase'
export enum Collections {
Authorigins = "_authOrigins",
Externalauths = "_externalAuths",
Mfas = "_mfas",
Otps = "_otps",
Superusers = "_superusers",
Books = "books",
ContentItems = "contentItems",
CostsMaterial = "costsMaterial",
CostsTime = "costsTime",
Currencies = "currencies",
CurrencyRateFixed = "currencyRateFixed",
CurrencyRates = "currencyRates",
MenuCopy = "menuCopy",
MenuTiers = "menuTiers",
Menus = "menus",
Offers = "offers",
Organizations = "organizations",
PermissionActions = "permissionActions",
PermissionTypes = "permissionTypes",
Permissions = "permissions",
PricebookChanges = "pricebookChanges",
ProblemTags = "problemTags",
Problems = "problems",
Profiles = "profiles",
Resources = "resources",
Roles = "roles",
ServiceCalls = "serviceCalls",
Tiers = "tiers",
Users = "users",
WarrantyCopy = "warrantyCopy",
}
// Alias types for improved usability
export type IsoDateString = string
export type IsoAutoDateString = string & { readonly autodate: unique symbol }
export type RecordIdString = string
export type FileNameString = string & { readonly filename: unique symbol }
export type HTMLString = string
type ExpandType<T> = unknown extends T
? T extends unknown
? { expand?: unknown }
: { expand: T }
: { expand: T }
// System fields
export type BaseSystemFields<T = unknown> = {
id: RecordIdString
collectionId: string
collectionName: Collections
} & ExpandType<T>
export type AuthSystemFields<T = unknown> = {
email: string
emailVisibility: boolean
username: string
verified: boolean
} & BaseSystemFields<T>
// Record types for each collection
export type AuthoriginsRecord = {
collectionRef: string
created: IsoAutoDateString
fingerprint: string
id: string
recordRef: string
updated: IsoAutoDateString
}
export type ExternalauthsRecord = {
collectionRef: string
created: IsoAutoDateString
id: string
provider: string
providerId: string
recordRef: string
updated: IsoAutoDateString
}
export type MfasRecord = {
collectionRef: string
created: IsoAutoDateString
id: string
method: string
recordRef: string
updated: IsoAutoDateString
}
export type OtpsRecord = {
collectionRef: string
created: IsoAutoDateString
id: string
password: string
recordRef: string
sentTo?: string
updated: IsoAutoDateString
}
export type SuperusersRecord = {
created: IsoAutoDateString
email: string
emailVisibility?: boolean
id: string
password: string
tokenKey: string
updated: IsoAutoDateString
verified?: boolean
}
export type BooksRecord = {
created: IsoAutoDateString
dependencies?: RecordIdString[]
id: string
name?: string
org?: RecordIdString
parent?: RecordIdString
refId?: string
subscribers?: RecordIdString[]
updated: IsoAutoDateString
}
export type ContentItemsRecord = {
book?: RecordIdString
content?: string
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
refId?: string
updated: IsoAutoDateString
}
export type CostsMaterialRecord = {
book?: RecordIdString
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
quantity?: string
refId?: string
updated: IsoAutoDateString
}
export type CostsTimeRecord = {
book?: RecordIdString
created: IsoAutoDateString
hours?: number
id: string
name?: string
org?: RecordIdString
refId?: string
updated: IsoAutoDateString
}
export type CurrenciesRecord = {
created: IsoAutoDateString
id: string
name?: string
refId?: string
symbol?: string
updated: IsoAutoDateString
}
export type CurrencyRateFixedRecord = {
created: IsoAutoDateString
id: string
name?: string
updated: IsoAutoDateString
}
export type CurrencyRatesRecord = {
baseCurrency?: RecordIdString
created: IsoAutoDateString
currencyRateFixed?: RecordIdString
id: string
quoteCurrency?: RecordIdString
rate?: string
updated: IsoAutoDateString
}
export type MenuCopyRecord = {
book?: RecordIdString
contentItems?: RecordIdString[]
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
refId?: string
updated: IsoAutoDateString
}
export type MenuTiersRecord = {
book?: RecordIdString
contentItems?: RecordIdString[]
created: IsoAutoDateString
id: string
menuCopy?: RecordIdString[]
menus?: RecordIdString
offers?: RecordIdString
org?: RecordIdString
refId?: string
tiers?: RecordIdString
updated: IsoAutoDateString
}
export type MenusRecord = {
book?: RecordIdString
books?: RecordIdString[]
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
refId?: string
updated: IsoAutoDateString
}
export type OffersRecord = {
book?: RecordIdString
costsMaterial?: RecordIdString[]
costsTime?: RecordIdString[]
created: IsoAutoDateString
id: string
menus?: RecordIdString[]
multiplier?: string
name?: string
org?: RecordIdString
refId?: string
techHandbook?: RecordIdString[]
updated: IsoAutoDateString
}
export type OrganizationsRecord<Tvariables = unknown> = {
created: IsoAutoDateString
currency?: RecordIdString
id: string
name?: string
org?: string
owner?: RecordIdString
updated: IsoAutoDateString
variables?: null | Tvariables
}
export type PermissionActionsRecord = {
created: IsoAutoDateString
id: string
name?: string
updated: IsoAutoDateString
}
export type PermissionTypesRecord = {
created: IsoAutoDateString
id: string
name?: string
updated: IsoAutoDateString
}
export type PermissionsRecord = {
action?: RecordIdString
created: IsoAutoDateString
id: string
org?: RecordIdString
resource?: RecordIdString
role?: RecordIdString
type?: RecordIdString
updated: IsoAutoDateString
}
export type PricebookChangesRecord<Tchangeset = unknown> = {
book?: RecordIdString
changeset?: null | Tchangeset
created: IsoAutoDateString
id: string
org?: RecordIdString
updated: IsoAutoDateString
}
export type ProblemTagsRecord = {
book?: RecordIdString
created: IsoAutoDateString
id: string
name?: string
org?: string
refId?: string
updated: IsoAutoDateString
}
export type ProblemsRecord = {
book?: RecordIdString
created: IsoAutoDateString
description?: string
id: string
menus?: RecordIdString[]
name?: string
org?: RecordIdString
problemTags?: RecordIdString[]
refId?: string
updated: IsoAutoDateString
}
export type ProfilesRecord = {
created: IsoAutoDateString
id: string
org?: RecordIdString
roles?: RecordIdString[]
updated: IsoAutoDateString
user?: RecordIdString
}
export type ResourcesRecord = {
created: IsoAutoDateString
description?: string
id: string
name?: string
route?: string
updated: IsoAutoDateString
}
export type RolesRecord = {
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
updated: IsoAutoDateString
}
export type ServiceCallsRecord<Tdetails = unknown> = {
created: IsoAutoDateString
details?: null | Tdetails
id: string
org?: RecordIdString
updated: IsoAutoDateString
user?: RecordIdString
}
export type TiersRecord = {
book?: RecordIdString
created: IsoAutoDateString
id: string
name?: string
org?: RecordIdString
rank?: number
refId?: string
updated: IsoAutoDateString
warrantyCopy?: RecordIdString[]
}
export type UsersRecord = {
activeOrg?: RecordIdString
avatar?: FileNameString
created: IsoAutoDateString
email: string
emailVisibility: boolean
id: string
name?: string
password: string
profiles?: RecordIdString[]
tokenKey: string
updated: IsoAutoDateString
verified?: boolean
}
export type WarrantyCopyRecord = {
contentItems?: RecordIdString[]
created: IsoAutoDateString
id: string
org?: RecordIdString
refId?: string
updated: IsoAutoDateString
}
// Response types include system fields and match responses from the PocketBase API
export type AuthoriginsResponse<Texpand = unknown> = Required<AuthoriginsRecord> & BaseSystemFields<Texpand>
export type ExternalauthsResponse<Texpand = unknown> = Required<ExternalauthsRecord> & BaseSystemFields<Texpand>
export type MfasResponse<Texpand = unknown> = Required<MfasRecord> & BaseSystemFields<Texpand>
export type OtpsResponse<Texpand = unknown> = Required<OtpsRecord> & BaseSystemFields<Texpand>
export type SuperusersResponse<Texpand = unknown> = Required<SuperusersRecord> & AuthSystemFields<Texpand>
export type BooksResponse<Texpand = unknown> = Required<BooksRecord> & BaseSystemFields<Texpand>
export type ContentItemsResponse<Texpand = unknown> = Required<ContentItemsRecord> & BaseSystemFields<Texpand>
export type CostsMaterialResponse<Texpand = unknown> = Required<CostsMaterialRecord> & BaseSystemFields<Texpand>
export type CostsTimeResponse<Texpand = unknown> = Required<CostsTimeRecord> & BaseSystemFields<Texpand>
export type CurrenciesResponse<Texpand = unknown> = Required<CurrenciesRecord> & BaseSystemFields<Texpand>
export type CurrencyRateFixedResponse<Texpand = unknown> = Required<CurrencyRateFixedRecord> & BaseSystemFields<Texpand>
export type CurrencyRatesResponse<Texpand = unknown> = Required<CurrencyRatesRecord> & BaseSystemFields<Texpand>
export type MenuCopyResponse<Texpand = unknown> = Required<MenuCopyRecord> & BaseSystemFields<Texpand>
export type MenuTiersResponse<Texpand = unknown> = Required<MenuTiersRecord> & BaseSystemFields<Texpand>
export type MenusResponse<Texpand = unknown> = Required<MenusRecord> & BaseSystemFields<Texpand>
export type OffersResponse<Texpand = unknown> = Required<OffersRecord> & BaseSystemFields<Texpand>
export type OrganizationsResponse<Tvariables = unknown, Texpand = unknown> = Required<OrganizationsRecord<Tvariables>> & BaseSystemFields<Texpand>
export type PermissionActionsResponse<Texpand = unknown> = Required<PermissionActionsRecord> & BaseSystemFields<Texpand>
export type PermissionTypesResponse<Texpand = unknown> = Required<PermissionTypesRecord> & BaseSystemFields<Texpand>
export type PermissionsResponse<Texpand = unknown> = Required<PermissionsRecord> & BaseSystemFields<Texpand>
export type PricebookChangesResponse<Tchangeset = unknown, Texpand = unknown> = Required<PricebookChangesRecord<Tchangeset>> & BaseSystemFields<Texpand>
export type ProblemTagsResponse<Texpand = unknown> = Required<ProblemTagsRecord> & BaseSystemFields<Texpand>
export type ProblemsResponse<Texpand = unknown> = Required<ProblemsRecord> & BaseSystemFields<Texpand>
export type ProfilesResponse<Texpand = unknown> = Required<ProfilesRecord> & BaseSystemFields<Texpand>
export type ResourcesResponse<Texpand = unknown> = Required<ResourcesRecord> & BaseSystemFields<Texpand>
export type RolesResponse<Texpand = unknown> = Required<RolesRecord> & BaseSystemFields<Texpand>
export type ServiceCallsResponse<Tdetails = unknown, Texpand = unknown> = Required<ServiceCallsRecord<Tdetails>> & BaseSystemFields<Texpand>
export type TiersResponse<Texpand = unknown> = Required<TiersRecord> & BaseSystemFields<Texpand>
export type UsersResponse<Texpand = unknown> = Required<UsersRecord> & AuthSystemFields<Texpand>
export type WarrantyCopyResponse<Texpand = unknown> = Required<WarrantyCopyRecord> & BaseSystemFields<Texpand>
// Types containing all Records and Responses, useful for creating typing helper functions
export type CollectionRecords = {
_authOrigins: AuthoriginsRecord
_externalAuths: ExternalauthsRecord
_mfas: MfasRecord
_otps: OtpsRecord
_superusers: SuperusersRecord
books: BooksRecord
contentItems: ContentItemsRecord
costsMaterial: CostsMaterialRecord
costsTime: CostsTimeRecord
currencies: CurrenciesRecord
currencyRateFixed: CurrencyRateFixedRecord
currencyRates: CurrencyRatesRecord
menuCopy: MenuCopyRecord
menuTiers: MenuTiersRecord
menus: MenusRecord
offers: OffersRecord
organizations: OrganizationsRecord
permissionActions: PermissionActionsRecord
permissionTypes: PermissionTypesRecord
permissions: PermissionsRecord
pricebookChanges: PricebookChangesRecord
problemTags: ProblemTagsRecord
problems: ProblemsRecord
profiles: ProfilesRecord
resources: ResourcesRecord
roles: RolesRecord
serviceCalls: ServiceCallsRecord
tiers: TiersRecord
users: UsersRecord
warrantyCopy: WarrantyCopyRecord
}
export type CollectionResponses = {
_authOrigins: AuthoriginsResponse
_externalAuths: ExternalauthsResponse
_mfas: MfasResponse
_otps: OtpsResponse
_superusers: SuperusersResponse
books: BooksResponse
contentItems: ContentItemsResponse
costsMaterial: CostsMaterialResponse
costsTime: CostsTimeResponse
currencies: CurrenciesResponse
currencyRateFixed: CurrencyRateFixedResponse
currencyRates: CurrencyRatesResponse
menuCopy: MenuCopyResponse
menuTiers: MenuTiersResponse
menus: MenusResponse
offers: OffersResponse
organizations: OrganizationsResponse
permissionActions: PermissionActionsResponse
permissionTypes: PermissionTypesResponse
permissions: PermissionsResponse
pricebookChanges: PricebookChangesResponse
problemTags: ProblemTagsResponse
problems: ProblemsResponse
profiles: ProfilesResponse
resources: ResourcesResponse
roles: RolesResponse
serviceCalls: ServiceCallsResponse
tiers: TiersResponse
users: UsersResponse
warrantyCopy: WarrantyCopyResponse
}
// Utility types for create/update operations
type ProcessCreateAndUpdateFields<T> = Omit<{
// Omit AutoDate fields
[K in keyof T as Extract<T[K], IsoAutoDateString> extends never ? K : never]:
// Convert FileNameString to File
T[K] extends infer U ?
U extends (FileNameString | FileNameString[]) ?
U extends any[] ? File[] : File
: U
: never
}, 'id'>
// Create type for Auth collections
export type CreateAuth<T> = {
id?: RecordIdString
email: string
emailVisibility?: boolean
password: string
passwordConfirm: string
verified?: boolean
} & ProcessCreateAndUpdateFields<T>
// Create type for Base collections
export type CreateBase<T> = {
id?: RecordIdString
} & ProcessCreateAndUpdateFields<T>
// Update type for Auth collections
export type UpdateAuth<T> = Partial<
Omit<ProcessCreateAndUpdateFields<T>, keyof AuthSystemFields>
> & {
email?: string
emailVisibility?: boolean
oldPassword?: string
password?: string
passwordConfirm?: string
verified?: boolean
}
// Update type for Base collections
export type UpdateBase<T> = Partial<
Omit<ProcessCreateAndUpdateFields<T>, keyof BaseSystemFields>
>
// Get the correct create type for any collection
export type Create<T extends keyof CollectionResponses> =
CollectionResponses[T] extends AuthSystemFields
? CreateAuth<CollectionRecords[T]>
: CreateBase<CollectionRecords[T]>
// Get the correct update type for any collection
export type Update<T extends keyof CollectionResponses> =
CollectionResponses[T] extends AuthSystemFields
? UpdateAuth<CollectionRecords[T]>
: UpdateBase<CollectionRecords[T]>
// Type for usage with type asserted PocketBase instance
// https://github.com/pocketbase/js-sdk#specify-typescript-definitions
export type TypedPocketBase = {
collection<T extends keyof CollectionResponses>(
idOrName: T
): RecordService<CollectionResponses[T]>
} & PocketBase