@elysiumjs/core 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +0 -14
- package/dist/index.d.ts +0 -7
- package/dist/index.js +9 -9
- package/dist/redis.d.ts +0 -84
- package/package.json +1 -4
- package/dist/cache.d.ts +0 -113
- package/dist/database.d.ts +0 -112
- package/dist/model.d.ts +0 -2413
- package/dist/repository.d.ts +0 -175
- package/dist/tenancy.d.ts +0 -244
package/dist/database.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { DrizzleConfig } from 'drizzle-orm';
|
|
2
|
-
import type { BunSQLDatabase } from 'drizzle-orm/bun-sql';
|
|
3
|
-
import type { CacheConfig } from 'drizzle-orm/cache/core/types';
|
|
4
|
-
import { Table } from 'drizzle-orm';
|
|
5
|
-
import { Cache as DrizzleCache } from 'drizzle-orm/cache/core';
|
|
6
|
-
/**
|
|
7
|
-
* Properties used to create a new database connection.
|
|
8
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
9
|
-
*/
|
|
10
|
-
export type DatabaseConnectionProps<TSchema extends Record<string, unknown> = Record<string, never>> = Omit<DrizzleConfig<TSchema>, 'cache'> & ({
|
|
11
|
-
connection: string | ({
|
|
12
|
-
url?: string;
|
|
13
|
-
} & Bun.SQLOptions);
|
|
14
|
-
} | {
|
|
15
|
-
client: Bun.SQL;
|
|
16
|
-
}) & {
|
|
17
|
-
/**
|
|
18
|
-
* Configures caching behavior for the database connection.
|
|
19
|
-
* Set it to `true` to enable caching with default configurations.
|
|
20
|
-
*/
|
|
21
|
-
cache?: true | {
|
|
22
|
-
/**
|
|
23
|
-
* Whether to enable caching.
|
|
24
|
-
*/
|
|
25
|
-
enabled?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The default TTL for cached data, in seconds.
|
|
28
|
-
* @default 1
|
|
29
|
-
*/
|
|
30
|
-
ttl?: number;
|
|
31
|
-
/**
|
|
32
|
-
* The caching strategy.
|
|
33
|
-
* Set it to `all` to cache all queries automatically.
|
|
34
|
-
* Set it to `explicit` to cache queries manually.
|
|
35
|
-
* @default 'explicit'
|
|
36
|
-
*/
|
|
37
|
-
strategy?: 'explicit' | 'all';
|
|
38
|
-
/**
|
|
39
|
-
* The storage engine to use.
|
|
40
|
-
* @default 'redis'
|
|
41
|
-
*/
|
|
42
|
-
storage?: 'redis' | 'memory';
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* A database connection.
|
|
47
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
48
|
-
*/
|
|
49
|
-
export type DatabaseConnection = BunSQLDatabase<Record<string, never>> & {
|
|
50
|
-
$client: Bun.SQL;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Database cache implementation for Drizzle.
|
|
54
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
55
|
-
*/
|
|
56
|
-
export declare class DatabaseCache extends DrizzleCache {
|
|
57
|
-
#private;
|
|
58
|
-
private readonly cacheStrategy;
|
|
59
|
-
private readonly globalTtl;
|
|
60
|
-
private usedTablesPerKey;
|
|
61
|
-
constructor(cacheStrategy?: 'explicit' | 'all', globalTtl?: number, storageEngine?: 'redis' | 'memory');
|
|
62
|
-
strategy(): 'explicit' | 'all';
|
|
63
|
-
get(key: string): Promise<any[] | undefined>;
|
|
64
|
-
put(key: string, response: any, tables: string[], _isTag: boolean, config?: CacheConfig): Promise<void>;
|
|
65
|
-
onMutate(params: {
|
|
66
|
-
tags: string | string[];
|
|
67
|
-
tables: string | string[] | Table<any> | Table<any>[];
|
|
68
|
-
}): Promise<void>;
|
|
69
|
-
}
|
|
70
|
-
export declare namespace Database {
|
|
71
|
-
/**
|
|
72
|
-
* Retrieves the connection with the given name.
|
|
73
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
74
|
-
* @param name The connection name.
|
|
75
|
-
* @returns The connection with the given name.
|
|
76
|
-
*/
|
|
77
|
-
const getConnection: (name: string) => DatabaseConnection;
|
|
78
|
-
/**
|
|
79
|
-
* Creates and registers a new connection.
|
|
80
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
81
|
-
*
|
|
82
|
-
* This will make the registered connection available for dependency injection with
|
|
83
|
-
* the key `db.connection.{name}`, where `{name}` is replaced with the given name.
|
|
84
|
-
*
|
|
85
|
-
* @param name The connection name.
|
|
86
|
-
* @param config The connection properties.
|
|
87
|
-
* @returns The newly created and registered connection.
|
|
88
|
-
*/
|
|
89
|
-
const registerConnection: (name: string, config: DatabaseConnectionProps) => BunSQLDatabase<Record<string, never>> & {
|
|
90
|
-
$client: Bun.SQL;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Checks if a connection with the given name exists.
|
|
94
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
95
|
-
* @param name The name of the connection to check.
|
|
96
|
-
* @returns `true` if the connection exists, `false` otherwise.
|
|
97
|
-
*/
|
|
98
|
-
const connectionExists: (name: string) => boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Retrieves the default connection.
|
|
101
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
102
|
-
* @returns The default connection.
|
|
103
|
-
*/
|
|
104
|
-
const getDefaultConnection: () => DatabaseConnection;
|
|
105
|
-
/**
|
|
106
|
-
* Sets the default connection.
|
|
107
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
108
|
-
* @param name The name of the connection to set as default.
|
|
109
|
-
* @returns The default connection.
|
|
110
|
-
*/
|
|
111
|
-
const setDefaultConnection: (name: string) => DatabaseConnection;
|
|
112
|
-
}
|