@sidekick-coder/zenith-kit 0.0.8 → 0.0.11
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/server/index.d.mts +686 -1
- package/dist/server/index.mjs +1388 -25
- package/dist/shared/chunk-CfYAbeIz.mjs +13 -0
- package/dist/shared/index.d.mts +275 -4
- package/dist/shared/index.mjs +658 -8
- package/eslint.config.mts +1 -0
- package/package.json +15 -2
- package/tsconfig.server.json +1 -1
- package/tsdown.config.ts +15 -1
package/dist/server/index.d.mts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { ChildProcess } from "node:child_process";
|
|
3
|
+
import { Request as Request$1, Response as Response$1 } from "express";
|
|
4
|
+
import UploadService from "#server/services/upload.service.ts";
|
|
5
|
+
import CookieService from "#shared/services/cookie.service.ts";
|
|
6
|
+
import Acl from "#server/entities/acl.entity.ts";
|
|
7
|
+
import { ColumnType, Generated, Kysely } from "kysely";
|
|
2
8
|
|
|
3
9
|
//#region src/shared/services/LoggerService.d.ts
|
|
4
10
|
declare class LoggerService {
|
|
@@ -9,6 +15,74 @@ declare class LoggerService {
|
|
|
9
15
|
child(options: any): LoggerService;
|
|
10
16
|
}
|
|
11
17
|
//#endregion
|
|
18
|
+
//#region src/shared/services/EmmitterService.d.ts
|
|
19
|
+
interface EmmitterHandler {
|
|
20
|
+
id: string;
|
|
21
|
+
event: string;
|
|
22
|
+
listener: (...args: any[]) => any;
|
|
23
|
+
originalListener?: (...args: any[]) => any;
|
|
24
|
+
}
|
|
25
|
+
interface OnOptions {
|
|
26
|
+
id?: string;
|
|
27
|
+
unique?: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface OnDebounceOptions extends OnOptions {
|
|
30
|
+
debounce?: number;
|
|
31
|
+
}
|
|
32
|
+
interface EmmitterServiceOptions {
|
|
33
|
+
debug?: boolean;
|
|
34
|
+
logger?: LoggerService;
|
|
35
|
+
}
|
|
36
|
+
declare class EmmitterService$1<Events extends Record<string, any> = Record<string, any>> {
|
|
37
|
+
private handlers;
|
|
38
|
+
private debug;
|
|
39
|
+
private logger;
|
|
40
|
+
load(options?: EmmitterServiceOptions): void;
|
|
41
|
+
on<K extends keyof Events>(event: K, listener: (args: Events[K]) => void, options?: OnOptions): EmmitterHandler;
|
|
42
|
+
on(event: string, listener: (args: any) => void, options?: OnOptions): EmmitterHandler;
|
|
43
|
+
once<K extends keyof Events>(event: K, listener: (args: Events[K]) => void, options?: OnOptions): EmmitterHandler;
|
|
44
|
+
once(event: string, listener: (args: any) => void, options?: OnOptions): EmmitterHandler;
|
|
45
|
+
onDebounce<K extends keyof Events>(event: K, listener: (args: Events[K]) => void, options?: OnDebounceOptions): EmmitterHandler;
|
|
46
|
+
onDebounce(event: string, listener: (args: any) => void, options?: OnDebounceOptions): EmmitterHandler;
|
|
47
|
+
onAnyOf<K extends keyof Events>(events: K[], listener: (args: Events[K]) => void, options?: OnOptions): EmmitterHandler[];
|
|
48
|
+
onAnyOf(events: string[], listener: (args: any) => void, options?: OnOptions): EmmitterHandler[];
|
|
49
|
+
off(event: string, listener: Function): void;
|
|
50
|
+
emit<K extends keyof Events>(event: K, args: Events[K]): void;
|
|
51
|
+
emit(event: string, args?: any): void;
|
|
52
|
+
emitAndWait<K extends keyof Events>(event: K, args: Events[K]): Promise<void>;
|
|
53
|
+
emitAndWait(event: string, args?: any): Promise<void>;
|
|
54
|
+
list(): EmmitterHandler[];
|
|
55
|
+
listByEvent(event: string): EmmitterHandler[];
|
|
56
|
+
remove(payload: string | string[]): void;
|
|
57
|
+
clear(): void;
|
|
58
|
+
hasHandlers(): boolean;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/server/contracts/EventContract.d.ts
|
|
62
|
+
interface EventContract {
|
|
63
|
+
'user:before-create': {
|
|
64
|
+
user: any;
|
|
65
|
+
};
|
|
66
|
+
'user:after-create': {
|
|
67
|
+
user: any;
|
|
68
|
+
};
|
|
69
|
+
'user:before-update': {
|
|
70
|
+
user: any;
|
|
71
|
+
};
|
|
72
|
+
'user:after-update': {
|
|
73
|
+
user: any;
|
|
74
|
+
};
|
|
75
|
+
'user:before-delete': {
|
|
76
|
+
user: any;
|
|
77
|
+
};
|
|
78
|
+
'user:after-delete': {
|
|
79
|
+
user: any;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/server/services/EmmitterService.d.ts
|
|
84
|
+
declare class EmmitterService extends EmmitterService$1<EventContract> {}
|
|
85
|
+
//#endregion
|
|
12
86
|
//#region src/server/gateways/GitGateway.d.ts
|
|
13
87
|
interface GitRepoInfo {
|
|
14
88
|
directory: string;
|
|
@@ -159,4 +233,615 @@ declare class PluginRouter {
|
|
|
159
233
|
delete(path: string, handler: RouteHandler): void;
|
|
160
234
|
}
|
|
161
235
|
//#endregion
|
|
162
|
-
|
|
236
|
+
//#region src/shared/utils/compose.d.ts
|
|
237
|
+
type Constructor$1<T = {}> = new (...args: any[]) => T;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/shared/mixins/HooksMixin.d.ts
|
|
240
|
+
interface Listener {
|
|
241
|
+
event: string;
|
|
242
|
+
listener: (...args: any[]) => void;
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/shared/services/ConfigService.d.ts
|
|
246
|
+
interface Entry {
|
|
247
|
+
key: string;
|
|
248
|
+
value: any;
|
|
249
|
+
source: string;
|
|
250
|
+
}
|
|
251
|
+
declare class ConfigService {
|
|
252
|
+
entries: Map<string, Entry>;
|
|
253
|
+
constructor();
|
|
254
|
+
list(): Entry[];
|
|
255
|
+
parseValue(value: any): any;
|
|
256
|
+
loadFromRecord(record: Record<string, any>, source?: string): void;
|
|
257
|
+
loadFromEntries(entries: [string, any][], source?: string): void;
|
|
258
|
+
toRecord(): Record<string, any>;
|
|
259
|
+
has(key: string): boolean;
|
|
260
|
+
get<T = any | undefined>(key: string, defaultValue?: any): T;
|
|
261
|
+
getOne<T = any | undefined>(keys: string[], defaultValue?: any): T;
|
|
262
|
+
set(key: string, value: any, source?: string): void;
|
|
263
|
+
unset(key: string): void;
|
|
264
|
+
clear(): void;
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/shared/services/ContainerService.d.ts
|
|
268
|
+
type Constructor<T = object> = new (...args: any[]) => T;
|
|
269
|
+
type EntryKey = string | symbol | Constructor;
|
|
270
|
+
declare class ContainerService {
|
|
271
|
+
private entries;
|
|
272
|
+
loadFromRecord(record: Record<string, any>): void;
|
|
273
|
+
toRecord(): Record<string, any>;
|
|
274
|
+
set(payload: EntryKey, value: any): void;
|
|
275
|
+
has(payload: EntryKey): boolean;
|
|
276
|
+
get<T>(payload: EntryKey): T;
|
|
277
|
+
singleton<T>(classConstructor: Constructor<T>): T;
|
|
278
|
+
load(entries: Record<any, any>): void;
|
|
279
|
+
proxy<T = unknown>(key: EntryKey): T;
|
|
280
|
+
keys(): EntryKey[];
|
|
281
|
+
}
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/shared/entities/LifecycleHook.d.ts
|
|
284
|
+
declare class LifecycleHook {
|
|
285
|
+
hook_id: string;
|
|
286
|
+
order?: number;
|
|
287
|
+
subhooks?: LifecycleHook[];
|
|
288
|
+
constructor();
|
|
289
|
+
onRegister(): Promise<void>;
|
|
290
|
+
onLoad(): Promise<void>;
|
|
291
|
+
onBoot(): Promise<void>;
|
|
292
|
+
onShutdown(): Promise<void>;
|
|
293
|
+
}
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/shared/schemas/tokenSchema.d.ts
|
|
296
|
+
type Token = v.InferOutput<typeof tokenSchema>;
|
|
297
|
+
declare const tokenSchema: v.ObjectSchema<{
|
|
298
|
+
readonly id: v.NumberSchema<undefined>;
|
|
299
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
300
|
+
readonly type: v.StringSchema<undefined>;
|
|
301
|
+
readonly user_id: v.NumberSchema<undefined>;
|
|
302
|
+
readonly token: v.StringSchema<undefined>;
|
|
303
|
+
readonly created_at: v.StringSchema<undefined>;
|
|
304
|
+
readonly updated_at: v.StringSchema<undefined>;
|
|
305
|
+
readonly expires_at: v.StringSchema<undefined>;
|
|
306
|
+
}, undefined>;
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/shared/entities/ModuleManifestEntity.d.ts
|
|
309
|
+
interface ModuleManifestBuildImport {
|
|
310
|
+
from: string;
|
|
311
|
+
to?: string;
|
|
312
|
+
type: 'global_import';
|
|
313
|
+
}
|
|
314
|
+
interface ModuleManifestBuild {
|
|
315
|
+
imports?: ModuleManifestBuildImport[];
|
|
316
|
+
}
|
|
317
|
+
declare const ModuleManifest_base: {
|
|
318
|
+
new (...args: any[]): {
|
|
319
|
+
merge(data: Partial< /*elided*/any>): /*elided*/any;
|
|
320
|
+
};
|
|
321
|
+
from<T>(this: new () => T, data: Partial<T>): T;
|
|
322
|
+
} & Constructor$1;
|
|
323
|
+
declare class ModuleManifest extends ModuleManifest_base {
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
version: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
enabled: boolean;
|
|
329
|
+
author?: string;
|
|
330
|
+
dependencies?: Record<string, string>;
|
|
331
|
+
build?: ModuleManifestBuild;
|
|
332
|
+
[key: string]: any;
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/shared/entities/ModuleEntity.d.ts
|
|
336
|
+
interface ModuleUpgradeInfo {
|
|
337
|
+
source: 'git' | 'zip';
|
|
338
|
+
[key: string]: any;
|
|
339
|
+
}
|
|
340
|
+
declare const Module_base$1: {
|
|
341
|
+
new (...args: any[]): {
|
|
342
|
+
merge(data: Partial< /*elided*/any>): /*elided*/any;
|
|
343
|
+
};
|
|
344
|
+
from<T>(this: new () => T, data: Partial<T>): T;
|
|
345
|
+
} & Constructor$1 & Constructor$1<{}> & typeof LifecycleHook;
|
|
346
|
+
declare class Module$1 extends Module_base$1 {
|
|
347
|
+
id: string;
|
|
348
|
+
name: string;
|
|
349
|
+
enabled: boolean;
|
|
350
|
+
dependencies: Record<string, any>;
|
|
351
|
+
build: ModuleManifest['build'];
|
|
352
|
+
directory: string;
|
|
353
|
+
upgrade_info?: ModuleUpgradeInfo;
|
|
354
|
+
setData(data: Partial<Module$1 | ModuleManifest>): void;
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/server/contracts/HttpContextContract.d.ts
|
|
358
|
+
interface Request extends Request$1 {}
|
|
359
|
+
interface Response extends Response$1 {}
|
|
360
|
+
interface HttpContext {
|
|
361
|
+
url: string;
|
|
362
|
+
method: string;
|
|
363
|
+
params: Record<string, string>;
|
|
364
|
+
query: Record<string, string | string[]>;
|
|
365
|
+
body: any;
|
|
366
|
+
cookie: CookieService;
|
|
367
|
+
upload: UploadService;
|
|
368
|
+
acl: Acl;
|
|
369
|
+
request: Request;
|
|
370
|
+
response: Response;
|
|
371
|
+
[key: string]: any;
|
|
372
|
+
}
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/server/contracts/RouterContract.d.ts
|
|
375
|
+
interface Redirect {
|
|
376
|
+
redirect: string;
|
|
377
|
+
}
|
|
378
|
+
type HandleResult = Record<string, any> | Redirect | void;
|
|
379
|
+
interface Middleware {
|
|
380
|
+
handle(ctx: any): HandleResult | Promise<HandleResult>;
|
|
381
|
+
}
|
|
382
|
+
type ExtractMiddlewareContext<M extends Middleware> = Awaited<ReturnType<M['handle']>> extends Record<string, any> ? Awaited<ReturnType<M['handle']>> : {};
|
|
383
|
+
type ProcessMiddlewareArray<T extends readonly Middleware[]> = T extends readonly [infer First extends Middleware, ...infer Rest extends readonly Middleware[]] ? ExtractMiddlewareContext<First> & ProcessMiddlewareArray<Rest> : {};
|
|
384
|
+
type MiddlewareHandleResult<T extends readonly Middleware[] = readonly Middleware[]> = ProcessMiddlewareArray<T>;
|
|
385
|
+
interface Handler<T = Record<string, any>> {
|
|
386
|
+
(ctx: HttpContext & T): Promise<any> | any;
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/server/entities/RouteEntity.d.ts
|
|
390
|
+
type RouteMethod = 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'delete' | 'DELETE';
|
|
391
|
+
declare class Route {
|
|
392
|
+
path: string;
|
|
393
|
+
method: RouteMethod;
|
|
394
|
+
handler: Handler<any> | null;
|
|
395
|
+
middlewares: Middleware[];
|
|
396
|
+
metadata: Record<string, any> | null;
|
|
397
|
+
constructor(data?: Partial<Route>);
|
|
398
|
+
static params(routePath: string, requestPath: string): Record<string, string>;
|
|
399
|
+
static query(requestPath: string): Record<string, string>;
|
|
400
|
+
toJSON(): {
|
|
401
|
+
path: string;
|
|
402
|
+
method: RouteMethod;
|
|
403
|
+
middlewares: string[];
|
|
404
|
+
metadata: Record<string, any> | null;
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/server/services/RouterService.d.ts
|
|
409
|
+
type RouteContext = 'global' | 'group' | 'route';
|
|
410
|
+
interface MiddlewareRegister {
|
|
411
|
+
middleware: Middleware;
|
|
412
|
+
context: RouteContext;
|
|
413
|
+
}
|
|
414
|
+
interface LoadOptions {
|
|
415
|
+
debug?: boolean;
|
|
416
|
+
}
|
|
417
|
+
declare const Router_base: {
|
|
418
|
+
new (...args: any[]): {
|
|
419
|
+
listeners: Listener[];
|
|
420
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
421
|
+
off(event: string, listener: (...args: any[]) => void): void;
|
|
422
|
+
emit(event: string, ...args: any[]): void;
|
|
423
|
+
emitAsync(event: string, ...args: any[]): Promise<void>;
|
|
424
|
+
};
|
|
425
|
+
} & Constructor$1;
|
|
426
|
+
declare class Router<C = {}> extends Router_base {
|
|
427
|
+
routes: Route[];
|
|
428
|
+
middlewares: MiddlewareRegister[];
|
|
429
|
+
prefixes: string[];
|
|
430
|
+
groups: Router<any>[];
|
|
431
|
+
groupPrefixes: string[];
|
|
432
|
+
debug: boolean;
|
|
433
|
+
logger: LoggerService;
|
|
434
|
+
metadata: Record<string, any>;
|
|
435
|
+
constructor(data?: Partial<Router<C>>);
|
|
436
|
+
use<T extends Middleware>(middleware: T, context?: RouteContext): Router<C & MiddlewareHandleResult<[typeof middleware]>>;
|
|
437
|
+
prefix(prefix: string): this;
|
|
438
|
+
makePath(args: string): string;
|
|
439
|
+
add(payload: Pick<Route, 'path' | 'method' | 'handler'>): void;
|
|
440
|
+
get(path: string, handler: Handler<C>): void;
|
|
441
|
+
post(path: string, handler: Handler<C>): void;
|
|
442
|
+
put(path: string, handler: Handler<C>): void;
|
|
443
|
+
patch(path: string, handler: Handler<C>): void;
|
|
444
|
+
many(methods: Route['method'][], path: string, handler: Handler<C>): void;
|
|
445
|
+
delete(path: string, handler: Handler<C>): void;
|
|
446
|
+
group(): Router<C>;
|
|
447
|
+
resolve(method: string, path: string): Route | null;
|
|
448
|
+
execute(route: Route, initialCtx: any): Promise<any>;
|
|
449
|
+
matchPath(routePath: string, requestPath: string): boolean;
|
|
450
|
+
clear(): void;
|
|
451
|
+
list(): Route[];
|
|
452
|
+
load(options?: LoadOptions): Promise<void>;
|
|
453
|
+
loadSync(options?: LoadOptions): void;
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/server/services/RouterFileBaseRoutingService.d.ts
|
|
457
|
+
declare class RouterFileBaseRoutingService {
|
|
458
|
+
private directory;
|
|
459
|
+
private prefix;
|
|
460
|
+
private module?;
|
|
461
|
+
private router;
|
|
462
|
+
private logger;
|
|
463
|
+
private routes;
|
|
464
|
+
debug: boolean;
|
|
465
|
+
setDirectory(directory: string): this;
|
|
466
|
+
setPrefix(prefix: string): this;
|
|
467
|
+
setRouter(router: Router): this;
|
|
468
|
+
setModule(module: string): this;
|
|
469
|
+
setLogger(logger: LoggerService): this;
|
|
470
|
+
setDebug(debug: boolean): this;
|
|
471
|
+
static create(directory: string): RouterFileBaseRoutingService;
|
|
472
|
+
loadFiles(): Promise<void>;
|
|
473
|
+
registerRoutes(): Promise<void>;
|
|
474
|
+
load(): Promise<void>;
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/server/services/ShellService.d.ts
|
|
478
|
+
interface CommandOptions {
|
|
479
|
+
cwd?: string;
|
|
480
|
+
env?: NodeJS.ProcessEnv;
|
|
481
|
+
shell?: boolean;
|
|
482
|
+
}
|
|
483
|
+
declare class ShellService {
|
|
484
|
+
debug: boolean;
|
|
485
|
+
logger: LoggerService;
|
|
486
|
+
init(data?: Partial<ShellService>): void;
|
|
487
|
+
/**
|
|
488
|
+
* Execute a shell command and return a promise
|
|
489
|
+
*/
|
|
490
|
+
command(bin: string, args: string[], options?: CommandOptions): Promise<void>;
|
|
491
|
+
/**
|
|
492
|
+
* Execute a shell command and return the output as a string
|
|
493
|
+
*/
|
|
494
|
+
executeCommandWithOutput(bin: string, args: string[], options?: CommandOptions): Promise<string>;
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/server/repositories/DatabaseRepository.d.ts
|
|
498
|
+
interface Pagination<T = any> {
|
|
499
|
+
items: T[];
|
|
500
|
+
page: number;
|
|
501
|
+
per_page: number;
|
|
502
|
+
total: number;
|
|
503
|
+
total_pages: number;
|
|
504
|
+
}
|
|
505
|
+
interface FindManyOptions {
|
|
506
|
+
limit?: number;
|
|
507
|
+
offset?: number;
|
|
508
|
+
orderBy?: string | string[];
|
|
509
|
+
orderDirection?: 'asc' | 'desc' | ('asc' | 'desc')[];
|
|
510
|
+
}
|
|
511
|
+
interface PaginateOptions {
|
|
512
|
+
page?: number;
|
|
513
|
+
limit?: number;
|
|
514
|
+
orderBy?: FindManyOptions['orderBy'];
|
|
515
|
+
orderDirection?: FindManyOptions['orderDirection'];
|
|
516
|
+
}
|
|
517
|
+
interface DeleteManyOptions {
|
|
518
|
+
limit?: number;
|
|
519
|
+
}
|
|
520
|
+
declare class DatabaseRepository {
|
|
521
|
+
protected db: Kysely<any>;
|
|
522
|
+
protected table: string;
|
|
523
|
+
protected primaryKey: string;
|
|
524
|
+
constructor(db: Kysely<any>, table: string, primaryKey: string);
|
|
525
|
+
setDatabase(db: Kysely<any>): this;
|
|
526
|
+
setTable(table: string): this;
|
|
527
|
+
setPrimaryKey(primaryKey: string): this;
|
|
528
|
+
query(options?: {
|
|
529
|
+
qb?: any;
|
|
530
|
+
} & Record<string, any>): any;
|
|
531
|
+
count(options?: Record<string, any>): Promise<number>;
|
|
532
|
+
findMany(options?: FindManyOptions & Record<string, any>): Promise<any>;
|
|
533
|
+
findById(id: any, options?: Record<string, any>): Promise<any>;
|
|
534
|
+
findByIdOrFail(id: any, options?: Record<string, any>): Promise<any>;
|
|
535
|
+
paginate(options?: PaginateOptions & Record<string, any>): Promise<Pagination<any>>;
|
|
536
|
+
create(data: any): Promise<any>;
|
|
537
|
+
createMany(data: any[]): Promise<any[]>;
|
|
538
|
+
updateById(id: any, data: any): Promise<void>;
|
|
539
|
+
deleteById(id: any): Promise<void>;
|
|
540
|
+
deleteMany(options?: DeleteManyOptions & Record<string, any>): Promise<void>;
|
|
541
|
+
}
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/server/mixins/DatabaseRepositoryInferMixin.d.ts
|
|
544
|
+
interface IRepositoryTypes<TEntity = Record<string, any>, TPrimaryKeyType = any, TOptions = Record<string, any>> {
|
|
545
|
+
count(options?: TOptions): Promise<number>;
|
|
546
|
+
findMany(options?: TOptions & FindManyOptions): Promise<TEntity[]>;
|
|
547
|
+
findById(id: TPrimaryKeyType, options?: TOptions): Promise<TEntity | null>;
|
|
548
|
+
findByIdOrFail(id: TPrimaryKeyType, options?: TOptions): Promise<TEntity>;
|
|
549
|
+
paginate(options?: TOptions & PaginateOptions): Promise<Pagination>;
|
|
550
|
+
create(data: Partial<TEntity>, options?: TOptions): Promise<TEntity>;
|
|
551
|
+
createMany(data: Partial<TEntity>[], options?: TOptions): Promise<TEntity[]>;
|
|
552
|
+
deleteById(id: TPrimaryKeyType): Promise<void>;
|
|
553
|
+
destroyMany(options?: TOptions): Promise<void>;
|
|
554
|
+
}
|
|
555
|
+
declare function DatabaseRepositoryInferMixin<TEntity = Record<string, any>, TPrimaryKeyType = any, TOptions = Record<string, any>>(): <TBase extends Constructor$1>(Base: TBase) => TBase & Constructor$1<IRepositoryTypes<TEntity, TPrimaryKeyType, TOptions>>;
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/server/repositories/PermissionAssignmentRepository.d.ts
|
|
558
|
+
interface PermissionAssignmentRepositoryQueryOptions {
|
|
559
|
+
id?: number | number[];
|
|
560
|
+
permissionId?: number | number[];
|
|
561
|
+
assignableId?: number | number[];
|
|
562
|
+
assignableType?: string | string[];
|
|
563
|
+
}
|
|
564
|
+
declare const PermissionAssignmentRepository_base: Constructor$1 & Constructor$1<IRepositoryTypes<{
|
|
565
|
+
id: number;
|
|
566
|
+
permission_id: number;
|
|
567
|
+
assignable_type: string;
|
|
568
|
+
assignable_id: string;
|
|
569
|
+
created_at: string;
|
|
570
|
+
updated_at: string;
|
|
571
|
+
}, number, PermissionAssignmentRepositoryQueryOptions>> & Constructor$1<{}> & typeof DatabaseRepository;
|
|
572
|
+
declare class PermissionAssignmentRepository extends PermissionAssignmentRepository_base {
|
|
573
|
+
constructor(db: DatabaseRepository['db']);
|
|
574
|
+
query(options?: PermissionAssignmentRepositoryQueryOptions): any;
|
|
575
|
+
}
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region src/server/repositories/PermissionRepository.d.ts
|
|
578
|
+
interface PermissionRepositoryQueryOptions {
|
|
579
|
+
id?: number | number[];
|
|
580
|
+
search?: string;
|
|
581
|
+
}
|
|
582
|
+
declare const PermissionRepository_base: Constructor$1<{}> & typeof DatabaseRepository & Constructor$1 & Constructor$1<IRepositoryTypes<{
|
|
583
|
+
id: number;
|
|
584
|
+
name: string | null;
|
|
585
|
+
description: string | null;
|
|
586
|
+
action: string;
|
|
587
|
+
subject: string;
|
|
588
|
+
conditions: string | null;
|
|
589
|
+
created_at: string;
|
|
590
|
+
updated_at: string;
|
|
591
|
+
expires_at: string;
|
|
592
|
+
}, number, PermissionRepositoryQueryOptions>>;
|
|
593
|
+
declare class PermissionRepository extends PermissionRepository_base {
|
|
594
|
+
constructor(db: DatabaseRepository['db']);
|
|
595
|
+
query(options?: PermissionRepositoryQueryOptions): any;
|
|
596
|
+
}
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/server/repositories/TokenRepository.d.ts
|
|
599
|
+
interface TokenRepositoryQueryOptions {
|
|
600
|
+
id?: number | number[];
|
|
601
|
+
search?: string;
|
|
602
|
+
type?: string | string[];
|
|
603
|
+
}
|
|
604
|
+
declare const TokenRepository_base: Constructor$1<{}> & typeof DatabaseRepository & Constructor$1 & Constructor$1<IRepositoryTypes<{
|
|
605
|
+
id: number;
|
|
606
|
+
name: string | null;
|
|
607
|
+
type: string;
|
|
608
|
+
user_id: number;
|
|
609
|
+
token: string;
|
|
610
|
+
created_at: string;
|
|
611
|
+
updated_at: string;
|
|
612
|
+
expires_at: string;
|
|
613
|
+
}, number, TokenRepositoryQueryOptions>>;
|
|
614
|
+
declare class TokenRepository extends TokenRepository_base {
|
|
615
|
+
constructor(db: DatabaseRepository['db']);
|
|
616
|
+
query(options?: TokenRepositoryQueryOptions): any;
|
|
617
|
+
findByToken(token: string): Promise<Token | null>;
|
|
618
|
+
}
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/server/facades/config.d.ts
|
|
621
|
+
declare const config: ConfigService;
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/server/facades/container.d.ts
|
|
624
|
+
declare const _default: ContainerService;
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region src/server/contracts/DatabaseContract.d.ts
|
|
627
|
+
interface SoftDeleteTable {
|
|
628
|
+
deleted_at?: ColumnType<Date, string | undefined, never> | null;
|
|
629
|
+
}
|
|
630
|
+
interface TimestampTable {
|
|
631
|
+
created_at: ColumnType<Date, string | undefined, never>;
|
|
632
|
+
updated_at: ColumnType<Date, string | undefined, never>;
|
|
633
|
+
}
|
|
634
|
+
interface MigrationsTable {
|
|
635
|
+
name: string;
|
|
636
|
+
module: string | null;
|
|
637
|
+
executed_at: ColumnType<Date, string | undefined, never>;
|
|
638
|
+
}
|
|
639
|
+
interface UserTable extends TimestampTable, SoftDeleteTable {
|
|
640
|
+
id: Generated<number>;
|
|
641
|
+
name: string;
|
|
642
|
+
username: string;
|
|
643
|
+
email: string;
|
|
644
|
+
password: string;
|
|
645
|
+
verified_at?: Date | string | null;
|
|
646
|
+
}
|
|
647
|
+
interface UserMetaTable extends TimestampTable, SoftDeleteTable {
|
|
648
|
+
id: Generated<number>;
|
|
649
|
+
user_id: number;
|
|
650
|
+
name: string;
|
|
651
|
+
value: string | null;
|
|
652
|
+
}
|
|
653
|
+
interface TokenTable extends TimestampTable {
|
|
654
|
+
id: Generated<number>;
|
|
655
|
+
user_id: number;
|
|
656
|
+
token: string;
|
|
657
|
+
type: string;
|
|
658
|
+
expires_at: string | null;
|
|
659
|
+
}
|
|
660
|
+
interface RoleTable {
|
|
661
|
+
id: Generated<number>;
|
|
662
|
+
name: string;
|
|
663
|
+
description: string | null;
|
|
664
|
+
}
|
|
665
|
+
interface UserRoleTable {
|
|
666
|
+
user_id: number;
|
|
667
|
+
role_id: number;
|
|
668
|
+
}
|
|
669
|
+
interface PermissionTable extends TimestampTable, SoftDeleteTable {
|
|
670
|
+
id: Generated<number>;
|
|
671
|
+
name: string;
|
|
672
|
+
description: string | null;
|
|
673
|
+
origin: string;
|
|
674
|
+
subject: string;
|
|
675
|
+
action: string;
|
|
676
|
+
conditions: string | null;
|
|
677
|
+
}
|
|
678
|
+
interface PermissionAssignmentTable {
|
|
679
|
+
id: Generated<number>;
|
|
680
|
+
permission_id: number;
|
|
681
|
+
assignable_type: string;
|
|
682
|
+
assignable_id: string;
|
|
683
|
+
}
|
|
684
|
+
interface FileTable extends TimestampTable, SoftDeleteTable {
|
|
685
|
+
id: Generated<number>;
|
|
686
|
+
drive: string;
|
|
687
|
+
mimetype: string;
|
|
688
|
+
client_name: string;
|
|
689
|
+
filename: string;
|
|
690
|
+
purpose: string;
|
|
691
|
+
public: boolean;
|
|
692
|
+
}
|
|
693
|
+
interface FileMetaTable extends TimestampTable, SoftDeleteTable {
|
|
694
|
+
id: Generated<number>;
|
|
695
|
+
file_id: number;
|
|
696
|
+
name: string;
|
|
697
|
+
value: string | null;
|
|
698
|
+
}
|
|
699
|
+
interface UploadSessionTable {
|
|
700
|
+
id: Generated<number>;
|
|
701
|
+
purpose: string;
|
|
702
|
+
mime_types: string;
|
|
703
|
+
max_size: number;
|
|
704
|
+
expires_at: string;
|
|
705
|
+
}
|
|
706
|
+
interface JobTable extends TimestampTable {
|
|
707
|
+
id: string;
|
|
708
|
+
queue_id: string;
|
|
709
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
710
|
+
data: string | null;
|
|
711
|
+
result: string | null;
|
|
712
|
+
error: string | null;
|
|
713
|
+
}
|
|
714
|
+
interface EmailTemplateTable extends TimestampTable, SoftDeleteTable {
|
|
715
|
+
id: Generated<number>;
|
|
716
|
+
name: string;
|
|
717
|
+
subject: string;
|
|
718
|
+
key: string;
|
|
719
|
+
body: string | null;
|
|
720
|
+
engine: string | null;
|
|
721
|
+
}
|
|
722
|
+
interface EmailTemplateMetaTable extends TimestampTable, SoftDeleteTable {
|
|
723
|
+
id: Generated<number>;
|
|
724
|
+
template_id: number;
|
|
725
|
+
name: string;
|
|
726
|
+
value: string;
|
|
727
|
+
}
|
|
728
|
+
interface OauthAccountTable extends TimestampTable, SoftDeleteTable {
|
|
729
|
+
id: Generated<number>;
|
|
730
|
+
user_id: number;
|
|
731
|
+
provider: string;
|
|
732
|
+
provider_user_id: string;
|
|
733
|
+
provider_user_email: string | null;
|
|
734
|
+
}
|
|
735
|
+
interface OauthTokenTable {
|
|
736
|
+
id: Generated<number>;
|
|
737
|
+
user_id: number | null;
|
|
738
|
+
provider: string | null;
|
|
739
|
+
action: string;
|
|
740
|
+
token: string;
|
|
741
|
+
expires_at: string;
|
|
742
|
+
metadata: string;
|
|
743
|
+
}
|
|
744
|
+
interface DatabaseContract {
|
|
745
|
+
users: UserTable;
|
|
746
|
+
user_metas: UserMetaTable;
|
|
747
|
+
tokens: TokenTable;
|
|
748
|
+
migrations: MigrationsTable;
|
|
749
|
+
files: FileTable;
|
|
750
|
+
file_metas: FileMetaTable;
|
|
751
|
+
file_upload_sessions: UploadSessionTable;
|
|
752
|
+
roles: RoleTable;
|
|
753
|
+
user_roles: UserRoleTable;
|
|
754
|
+
permissions: PermissionTable;
|
|
755
|
+
permissions_assignments: PermissionAssignmentTable;
|
|
756
|
+
jobs: JobTable;
|
|
757
|
+
email_templates: EmailTemplateTable;
|
|
758
|
+
email_template_metas: EmailTemplateMetaTable;
|
|
759
|
+
oauth_accounts: OauthAccountTable;
|
|
760
|
+
oauth_tokens: OauthTokenTable;
|
|
761
|
+
}
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/server/facades/database.d.ts
|
|
764
|
+
declare const key = "database";
|
|
765
|
+
declare const database: Kysely<DatabaseContract>;
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/server/facades/logger.d.ts
|
|
768
|
+
declare const logger: LoggerService;
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region src/server/facades/router.d.ts
|
|
771
|
+
declare const router: Router<HttpContext>;
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/server/facades/shell.d.ts
|
|
774
|
+
declare const shell: ShellService;
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/server/utils/defineLoader.d.ts
|
|
777
|
+
interface Loader<T = Record<string, any>> {
|
|
778
|
+
load(entities: T[]): Promise<void>;
|
|
779
|
+
}
|
|
780
|
+
interface LoaderRecord<T = Record<string, any>> {
|
|
781
|
+
[key: string]: Loader<T>;
|
|
782
|
+
}
|
|
783
|
+
declare function defineLoader<T = Record<string, any>>(loader: Loader<T>): Loader<T>;
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/server/loaders/createHasManyThroughLoader.d.ts
|
|
786
|
+
type KeyOrFunction<T> = keyof T | ((entity: T) => any);
|
|
787
|
+
interface HasManyThroughLoaderOptions<TEntity extends Record<string, any> = Record<string, any>, TPivotEntity extends Record<string, any> = Record<string, any>, TTargetEntity extends Record<string, any> = Record<string, any>> {
|
|
788
|
+
key: string;
|
|
789
|
+
pivot: {
|
|
790
|
+
sourceKey: KeyOrFunction<TEntity>;
|
|
791
|
+
targetKey: KeyOrFunction<TPivotEntity>;
|
|
792
|
+
findEntities(ids: (string | number)[]): Promise<TPivotEntity[]>;
|
|
793
|
+
};
|
|
794
|
+
target: {
|
|
795
|
+
sourceKey: KeyOrFunction<TPivotEntity>;
|
|
796
|
+
targetKey: KeyOrFunction<TTargetEntity>;
|
|
797
|
+
findEntities(ids: (string | number)[]): Promise<TTargetEntity[]>;
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
declare function loadHasManyThrough<TEntity extends Record<string, any> = Record<string, any>, TPivotEntity extends Record<string, any> = Record<string, any>, TTargetEntity extends Record<string, any> = Record<string, any>>(payload: any | any[], options: HasManyThroughLoaderOptions<TEntity, TPivotEntity, TTargetEntity>): Promise<void>;
|
|
801
|
+
declare function createHasManyThroughLoader<TEntity extends Record<string, any> = Record<string, any>, TPivotEntity extends Record<string, any> = Record<string, any>, TTargetEntity extends Record<string, any> = Record<string, any>>(options: HasManyThroughLoaderOptions<TEntity, TPivotEntity, TTargetEntity>): Loader<TEntity>;
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/server/entities/ModuleEntity.d.ts
|
|
804
|
+
declare const Module_base: typeof Module$1;
|
|
805
|
+
declare class Module extends Module_base {
|
|
806
|
+
get git(): GitGateway;
|
|
807
|
+
makePath(...parts: string[]): string;
|
|
808
|
+
staticPath(...parts: string[]): string;
|
|
809
|
+
command: typeof shell.command;
|
|
810
|
+
load(): void;
|
|
811
|
+
}
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region src/server/utils/basePath.d.ts
|
|
814
|
+
declare function basePath(...args: string[]): string;
|
|
815
|
+
declare function tmpPath(...args: string[]): string;
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region src/server/utils/createLoaderFactory.d.ts
|
|
818
|
+
declare function createLoaderFactory<E extends Record<string, any> = Record<string, any>, R extends LoaderRecord<E> = LoaderRecord<E>>(loaders: R): {
|
|
819
|
+
keys: (keyof R)[];
|
|
820
|
+
loaders: R;
|
|
821
|
+
load: (entities: E | E[], names: keyof R | (keyof R)[]) => Promise<void>;
|
|
822
|
+
};
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/server/utils/importAll.d.ts
|
|
825
|
+
interface Options {
|
|
826
|
+
cache?: boolean;
|
|
827
|
+
onBeforeImport?: (ctx: {
|
|
828
|
+
filename: string;
|
|
829
|
+
}) => void | Promise<void>;
|
|
830
|
+
onAfterImport?: (ctx: {
|
|
831
|
+
filename: string;
|
|
832
|
+
module: any;
|
|
833
|
+
}) => void | Promise<void>;
|
|
834
|
+
onError?: (ctx: {
|
|
835
|
+
filename: string;
|
|
836
|
+
error: Error;
|
|
837
|
+
}) => void | Promise<void>;
|
|
838
|
+
exclude?: string[];
|
|
839
|
+
}
|
|
840
|
+
declare function importFiles(files: string[], options?: Options): Promise<Record<string, any>>;
|
|
841
|
+
declare function importGlob(pattern: string, options?: Options): Promise<Record<string, any>>;
|
|
842
|
+
declare function importAll(directory: string, options?: Options): Promise<Record<string, any>>;
|
|
843
|
+
//#endregion
|
|
844
|
+
//#region src/server/utils/importOne.d.ts
|
|
845
|
+
declare function importOne(filenames: string[]): Promise<any>;
|
|
846
|
+
//#endregion
|
|
847
|
+
export { DatabaseContract, DatabaseRepository, DatabaseRepositoryInferMixin, DeleteManyOptions, EmailTemplateMetaTable, EmailTemplateTable, EmmitterService, EventContract, FileMetaTable, FileTable, FindManyOptions, GitBranch, GitBranchFetchOptions, GitBranchRepository, GitCommit, GitCommitListOptions, GitCommitRef, GitCommitRepository, GitGateway, GitGatewayOptions, GitRepoInfo, HandleResult, Handler, HasManyThroughLoaderOptions, HttpContext, HttpMethod, IRepositoryTypes, IpcMessage, JobTable, Loader, LoaderRecord, Middleware, MiddlewareHandleResult, MigrationsTable, Module as ModuleEntity, OauthAccountTable, OauthTokenTable, PaginateOptions, PaginatedCommits, Pagination, PermissionAssignmentRepository, PermissionAssignmentRepositoryQueryOptions, PermissionAssignmentTable, PermissionRepository, PermissionRepositoryQueryOptions, PermissionTable, PluginIpcClient, PluginIpcHost, PluginRouter, Redirect, Request, Response, RoleTable, RouteDefinition, Route as RouteEntity, RouteHandler, RouteReply, RouteRequest, RouteResponsePayload, RouterFileBaseRoutingService, Router as RouterService, ShellService, SoftDeleteTable, TimestampTable, TokenRepository, TokenRepositoryQueryOptions, TokenTable, UploadSessionTable, UserMetaTable, UserRoleTable, UserTable, basePath, config, _default as container, createHasManyThroughLoader, createLoaderFactory, database, defineLoader, importAll, importFiles, importGlob, importOne, key, loadHasManyThrough, logger, router, shell, tmpPath };
|