@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
48 lines • 4.02 kB
TypeScript
import type { UpdateQuery, UpdateWithAggregationPipeline } from "mongoose";
import type { IApiKeyAccount, IApp, IBuild, ICloudDatabase, ICloudDatabaseBackup, ICloudProvider, ICloudStorage, ICluster, IContainerRegistry, ICronjob, IFramework, IGitProvider, INotification, IProject, IRelease, IRole, IRoute, IServiceAccount, ITeam, IUser, IWebhook, IWorkspace } from "../../entities";
import type { IQueryFilter, IQueryOptions, IQueryPagination, KubeNamespace } from "../../interfaces";
import type { Ownership } from "../../interfaces/SystemTypes";
import type { GitRepository } from "../git/git-provider-api";
export declare const dbCollections: readonly ["app", "build", "database", "db_backup", "provider", "cluster", "git", "git_repo", "registry", "framework", "project", "release", "role", "route", "team", "user", "api_key_user", "service_account", "workspace", "cronjob", "webhook", "notification", "storage", "monitor/namespaces"];
export type DBCollection = (typeof dbCollections)[number];
export declare function queryFilterToUrlFilter(filter?: any): string;
export declare function queryOptionsToUrlOptions(options?: IQueryOptions & IQueryPagination): string;
export type TypeByCollection<T extends DBCollection> = T extends "api_key_user" ? IApiKeyAccount : T extends "app" ? IApp : T extends "build" ? IBuild : T extends "cluster" ? ICluster : T extends "cronjob" ? ICronjob : T extends "database" ? ICloudDatabase : T extends "db_backup" ? ICloudDatabaseBackup : T extends "framework" ? IFramework : T extends "git" ? IGitProvider : T extends "git_repo" ? GitRepository : T extends "project" ? IProject : T extends "provider" ? ICloudProvider : T extends "registry" ? IContainerRegistry : T extends "release" ? IRelease : T extends "role" ? IRole : T extends "route" ? IRoute : T extends "service_account" ? IServiceAccount : T extends "team" ? ITeam : T extends "user" ? IUser : T extends "workspace" ? IWorkspace : T extends "webhook" ? IWebhook : T extends "notification" ? INotification : T extends "storage" ? ICloudStorage : T extends "monitor/namespaces" ? KubeNamespace : never;
export interface DBQueryOptions extends IQueryOptions {
filter?: any;
/**
* Subpath of the API
*/
subpath?: string;
/**
* Similar to "subpath" but for service -> function name:
*/
func?: any;
/**
* Debug
* @default false
*/
isDebugging?: boolean;
/**
* If `true`, won't throw any errors
* @default false
*/
ignorable?: boolean;
user?: IUser;
workspace?: IWorkspace;
ownership?: Ownership;
}
export declare class DB {
static getService(collection: DBCollection, ownership?: Ownership): Promise<any>;
static count<T = any>(collection: DBCollection, filter?: IQueryFilter<T>, options?: DBQueryOptions, pagination?: IQueryPagination): Promise<number>;
static find<I extends any, T extends DBCollection>(collection: T, filter?: IQueryFilter<TypeByCollection<T>>, options?: IQueryOptions, pagination?: IQueryPagination): Promise<TypeByCollection<T>[]>;
static findOne<T extends DBCollection>(collection: T, filter?: IQueryFilter<TypeByCollection<T>>, options?: DBQueryOptions): Promise<TypeByCollection<T>>;
static create<T extends DBCollection>(collection: T, data: any, options?: DBQueryOptions): Promise<TypeByCollection<T>>;
static update<T extends DBCollection>(collection: T, filter: IQueryFilter<TypeByCollection<T>>, data: UpdateQuery<TypeByCollection<T>> | UpdateWithAggregationPipeline, options?: DBQueryOptions): Promise<TypeByCollection<T>[]>;
static updateOne<T extends DBCollection>(collection: T, filter: IQueryFilter<TypeByCollection<T>>, data: UpdateQuery<TypeByCollection<T>> | UpdateWithAggregationPipeline, options?: DBQueryOptions): Promise<TypeByCollection<T>>;
static delete<I = any>(collection: DBCollection, filter: IQueryFilter<I>, data?: any, options?: DBQueryOptions): Promise<{
ok: boolean;
affected: number;
}>;
}
//# sourceMappingURL=DB.d.ts.map