Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 32 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,21 @@ declare module "@moleculer/database" {
// Adapter interfaces
export interface BaseAdapterOptions {}

export interface SurrealDBAdapterOptions extends BaseAdapterOptions {
/** SurrealDB endpoint (e.g., ws://localhost:8000/rpc) */
url?: string;
/** SurrealDB namespace */
namespace?: string;
/** SurrealDB database */
database?: string;
/** SurrealDB username */
username?: string;
/** SurrealDB password */
password?: string;
/** Table/collection name */
table?: string;
}

export interface MongoDBAdapterOptions extends BaseAdapterOptions {
/** MongoDB connection URI */
uri?: string;
Expand Down Expand Up @@ -332,18 +347,25 @@ declare module "@moleculer/database" {
export type AdapterDefinition =
| string
| {
type?: "NeDB";
options?: NeDBAdapterOptions | string;
}
type?: "NeDB";
options?: NeDBAdapterOptions | string;
}
| {
type?: "MongoDB";
options?: MongoDBAdapterOptions;
}
| {
type?: "MongoDB";
options?: MongoDBAdapterOptions;
}
type?: "Knex";
options?: KnexAdapterOptions;
}
| {
type?: "Knex";
options?: KnexAdapterOptions;
}
type?: "SurrealDB";
options?: SurrealDBAdapterOptions;
}
| BaseAdapter;
export declare class SurrealDBAdapter extends BaseAdapter {
constructor(opts?: SurrealDBAdapterOptions);
}

// Database adapter base class
export abstract class BaseAdapter {
Expand Down Expand Up @@ -452,6 +474,7 @@ declare module "@moleculer/database" {
export const MongoDB: typeof MongoDBAdapter;
export const Knex: typeof KnexAdapter;
export const NeDB: typeof NeDBAdapter;
export const SurrealDB: typeof SurrealDBAdapter;

export function resolve(opt: AdapterDefinition): BaseAdapter;
export function register(name: string, adapter: typeof BaseAdapter): void;
Expand Down
Loading