import type pgPromise from "pg-promise"; import type pg from "pg-promise/typescript/pg-subset"; import type { SQLHandler, TableSchema } from "prostgles-types"; import type { AuthClientRequest, SessionUser } from "./Auth/AuthTypes"; import type { DboBuilder } from "./DboBuilder/DboBuilder"; import type { DBOFullyTyped } from "./DBSchemaBuilder/DBSchemaBuilder"; import type { DBHandlerServer, Prostgles } from "./Prostgles"; import type { ProstglesInitOptions } from "./ProstglesTypes"; import { type PermissionScope } from "./PublishParser/PublishParser"; import { type clientOnlyUpdateKeys } from "./updateConfiguration"; import { getClientHandlers } from "./WebsocketAPI/getClientHandlers"; /** * Database connection details */ export type DbConnection = /** * Connection URI */ string | pg.IConnectionParameters; export type DbConnectionOpts = pg.IDefaults; export type PGP = pgPromise.IMain<{}, pg.IClient>; export type DB = pgPromise.IDatabase<{}, pg.IClient>; export type UpdateableOptions = Pick, "io" | "fileTable" | "restApi" | "tableConfig" | "schemaFilter" | "auth" | "publish" | "functions" | "publishRawSQL" | "tsGeneratedTypesDir" | "tsGeneratedTypesFunctionsPath">; export type OnInitReason = { type: "schema change"; query: string; command: string | undefined; } | { type: "prgl.update"; newOpts: Omit; } | { type: "init" | "prgl.restart" | "TableConfig"; }; type OnReadyParamsCommon = { db: DB; sql: SQLHandler; tables: TableSchema[]; reason: OnInitReason; }; export type OnReadyParamsBasic = OnReadyParamsCommon & { dbo: DBHandlerServer; }; export type OnReadyParams = OnReadyParamsCommon & { dbo: DBOFullyTyped; }; export type OnReadyCallback = (params: OnReadyParams, update: (newOpts: UpdateableOptions, force?: true) => Promise) => void | Promise; export type OnReadyCallbackBasic = (params: OnReadyParamsBasic, update: (newOpts: UpdateableOptions, force?: true) => Promise) => void | Promise; export type InitResult = { db: DBOFullyTyped; sql: SQLHandler; _db: DB; pgp: PGP; io: ProstglesInitOptions["io"]; destroy: () => Promise; /** * Generated database public schema TS types for all tables and views */ getTSSchema: typeof DboBuilder.prototype.getTsDefinitions; getSchema: typeof DboBuilder.prototype.getSchema; reWriteDBSchema: () => void; update: (newOpts: UpdateableOptions, force?: true) => Promise; restart: () => Promise>; options: ProstglesInitOptions; getClientDBHandlers: (clientReq: AuthClientRequest, scope: PermissionScope | undefined) => ReturnType>; getFieldsWithTypes: typeof DboBuilder.prototype.getDetailedFieldInfo; }; export declare const initProstgles: (this: Prostgles, onReady: OnReadyCallbackBasic, reason: OnInitReason) => Promise; export {}; //# sourceMappingURL=initProstgles.d.ts.map