@gravito/stream 1.0.0-alpha.5 → 1.0.0-beta.1
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/README.md +8 -3
- package/dist/index.cjs +1016 -31676
- package/dist/index.d.cts +1132 -0
- package/dist/index.d.ts +1123 -36
- package/dist/index.js +1412 -0
- package/package.json +3 -3
- package/dist/Consumer.d.ts +0 -67
- package/dist/Consumer.d.ts.map +0 -1
- package/dist/Job.d.ts +0 -76
- package/dist/Job.d.ts.map +0 -1
- package/dist/OrbitQueue.d.ts +0 -74
- package/dist/OrbitQueue.d.ts.map +0 -1
- package/dist/QueueManager.d.ts +0 -86
- package/dist/QueueManager.d.ts.map +0 -1
- package/dist/Queueable.d.ts +0 -63
- package/dist/Queueable.d.ts.map +0 -1
- package/dist/Worker.d.ts +0 -48
- package/dist/Worker.d.ts.map +0 -1
- package/dist/core/src/ConfigManager.d.ts +0 -26
- package/dist/core/src/ConfigManager.d.ts.map +0 -1
- package/dist/core/src/Container.d.ts +0 -39
- package/dist/core/src/Container.d.ts.map +0 -1
- package/dist/core/src/Event.d.ts +0 -6
- package/dist/core/src/Event.d.ts.map +0 -1
- package/dist/core/src/EventManager.d.ts +0 -124
- package/dist/core/src/EventManager.d.ts.map +0 -1
- package/dist/core/src/GlobalErrorHandlers.d.ts +0 -32
- package/dist/core/src/GlobalErrorHandlers.d.ts.map +0 -1
- package/dist/core/src/HookManager.d.ts +0 -29
- package/dist/core/src/HookManager.d.ts.map +0 -1
- package/dist/core/src/Listener.d.ts +0 -5
- package/dist/core/src/Listener.d.ts.map +0 -1
- package/dist/core/src/Logger.d.ts +0 -21
- package/dist/core/src/Logger.d.ts.map +0 -1
- package/dist/core/src/PlanetCore.d.ts +0 -116
- package/dist/core/src/PlanetCore.d.ts.map +0 -1
- package/dist/core/src/Route.d.ts +0 -13
- package/dist/core/src/Route.d.ts.map +0 -1
- package/dist/core/src/Router.d.ts +0 -168
- package/dist/core/src/Router.d.ts.map +0 -1
- package/dist/core/src/ServiceProvider.d.ts +0 -17
- package/dist/core/src/ServiceProvider.d.ts.map +0 -1
- package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -5
- package/dist/core/src/exceptions/AuthenticationException.d.ts.map +0 -1
- package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -5
- package/dist/core/src/exceptions/AuthorizationException.d.ts.map +0 -1
- package/dist/core/src/exceptions/GravitoException.d.ts +0 -15
- package/dist/core/src/exceptions/GravitoException.d.ts.map +0 -1
- package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -7
- package/dist/core/src/exceptions/ModelNotFoundException.d.ts.map +0 -1
- package/dist/core/src/exceptions/ValidationException.d.ts +0 -15
- package/dist/core/src/exceptions/ValidationException.d.ts.map +0 -1
- package/dist/core/src/exceptions/index.d.ts +0 -6
- package/dist/core/src/exceptions/index.d.ts.map +0 -1
- package/dist/core/src/helpers/Arr.d.ts +0 -15
- package/dist/core/src/helpers/Arr.d.ts.map +0 -1
- package/dist/core/src/helpers/Str.d.ts +0 -19
- package/dist/core/src/helpers/Str.d.ts.map +0 -1
- package/dist/core/src/helpers/data.d.ts +0 -6
- package/dist/core/src/helpers/data.d.ts.map +0 -1
- package/dist/core/src/helpers/errors.d.ts +0 -13
- package/dist/core/src/helpers/errors.d.ts.map +0 -1
- package/dist/core/src/helpers/response.d.ts +0 -19
- package/dist/core/src/helpers/response.d.ts.map +0 -1
- package/dist/core/src/helpers.d.ts +0 -39
- package/dist/core/src/helpers.d.ts.map +0 -1
- package/dist/core/src/http/CookieJar.d.ts +0 -34
- package/dist/core/src/http/CookieJar.d.ts.map +0 -1
- package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -13
- package/dist/core/src/http/middleware/ThrottleRequests.d.ts.map +0 -1
- package/dist/core/src/index.d.ts +0 -32
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/security/Encrypter.d.ts +0 -25
- package/dist/core/src/security/Encrypter.d.ts.map +0 -1
- package/dist/core/src/security/Hasher.d.ts +0 -30
- package/dist/core/src/security/Hasher.d.ts.map +0 -1
- package/dist/core/src/types/events.d.ts +0 -95
- package/dist/core/src/types/events.d.ts.map +0 -1
- package/dist/drivers/DatabaseDriver.d.ts +0 -60
- package/dist/drivers/DatabaseDriver.d.ts.map +0 -1
- package/dist/drivers/KafkaDriver.d.ts +0 -134
- package/dist/drivers/KafkaDriver.d.ts.map +0 -1
- package/dist/drivers/MemoryDriver.d.ts +0 -45
- package/dist/drivers/MemoryDriver.d.ts.map +0 -1
- package/dist/drivers/QueueDriver.d.ts +0 -89
- package/dist/drivers/QueueDriver.d.ts.map +0 -1
- package/dist/drivers/RedisDriver.d.ts +0 -79
- package/dist/drivers/RedisDriver.d.ts.map +0 -1
- package/dist/drivers/SQSDriver.d.ts +0 -100
- package/dist/drivers/SQSDriver.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -422
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -32096
- package/dist/index.mjs.map +0 -422
- package/dist/orbit-db/src/DBService.d.ts +0 -270
- package/dist/orbit-db/src/DBService.d.ts.map +0 -1
- package/dist/orbit-db/src/EventBus.d.ts +0 -53
- package/dist/orbit-db/src/EventBus.d.ts.map +0 -1
- package/dist/orbit-db/src/MigrationDriver.d.ts +0 -55
- package/dist/orbit-db/src/MigrationDriver.d.ts.map +0 -1
- package/dist/orbit-db/src/Model.d.ts +0 -564
- package/dist/orbit-db/src/Model.d.ts.map +0 -1
- package/dist/orbit-db/src/ModelCollection.d.ts +0 -35
- package/dist/orbit-db/src/ModelCollection.d.ts.map +0 -1
- package/dist/orbit-db/src/index.d.ts +0 -34
- package/dist/orbit-db/src/index.d.ts.map +0 -1
- package/dist/orbit-db/src/types.d.ts +0 -146
- package/dist/orbit-db/src/types.d.ts.map +0 -1
- package/dist/orbit-queue/src/Consumer.d.ts +0 -67
- package/dist/orbit-queue/src/Consumer.d.ts.map +0 -1
- package/dist/orbit-queue/src/Job.d.ts +0 -76
- package/dist/orbit-queue/src/Job.d.ts.map +0 -1
- package/dist/orbit-queue/src/OrbitQueue.d.ts +0 -74
- package/dist/orbit-queue/src/OrbitQueue.d.ts.map +0 -1
- package/dist/orbit-queue/src/QueueManager.d.ts +0 -86
- package/dist/orbit-queue/src/QueueManager.d.ts.map +0 -1
- package/dist/orbit-queue/src/Queueable.d.ts +0 -63
- package/dist/orbit-queue/src/Queueable.d.ts.map +0 -1
- package/dist/orbit-queue/src/Worker.d.ts +0 -48
- package/dist/orbit-queue/src/Worker.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/DatabaseDriver.d.ts +0 -60
- package/dist/orbit-queue/src/drivers/DatabaseDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/KafkaDriver.d.ts +0 -134
- package/dist/orbit-queue/src/drivers/KafkaDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/MemoryDriver.d.ts +0 -45
- package/dist/orbit-queue/src/drivers/MemoryDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/QueueDriver.d.ts +0 -89
- package/dist/orbit-queue/src/drivers/QueueDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/RedisDriver.d.ts +0 -79
- package/dist/orbit-queue/src/drivers/RedisDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/drivers/SQSDriver.d.ts +0 -100
- package/dist/orbit-queue/src/drivers/SQSDriver.d.ts.map +0 -1
- package/dist/orbit-queue/src/index.d.ts +0 -45
- package/dist/orbit-queue/src/index.d.ts.map +0 -1
- package/dist/orbit-queue/src/serializers/ClassNameSerializer.d.ts +0 -46
- package/dist/orbit-queue/src/serializers/ClassNameSerializer.d.ts.map +0 -1
- package/dist/orbit-queue/src/serializers/JobSerializer.d.ts +0 -36
- package/dist/orbit-queue/src/serializers/JobSerializer.d.ts.map +0 -1
- package/dist/orbit-queue/src/serializers/JsonSerializer.d.ts +0 -32
- package/dist/orbit-queue/src/serializers/JsonSerializer.d.ts.map +0 -1
- package/dist/orbit-queue/src/types.d.ts +0 -85
- package/dist/orbit-queue/src/types.d.ts.map +0 -1
- package/dist/serializers/ClassNameSerializer.d.ts +0 -46
- package/dist/serializers/ClassNameSerializer.d.ts.map +0 -1
- package/dist/serializers/JobSerializer.d.ts +0 -36
- package/dist/serializers/JobSerializer.d.ts.map +0 -1
- package/dist/serializers/JsonSerializer.d.ts +0 -32
- package/dist/serializers/JsonSerializer.d.ts.map +0 -1
- package/dist/types.d.ts +0 -85
- package/dist/types.d.ts.map +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
3
|
-
export type ApiSuccess<T> = {
|
|
4
|
-
success: true;
|
|
5
|
-
data: T;
|
|
6
|
-
};
|
|
7
|
-
export type ApiFailure = {
|
|
8
|
-
success: false;
|
|
9
|
-
error: {
|
|
10
|
-
message: string;
|
|
11
|
-
code?: string;
|
|
12
|
-
details?: unknown;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function ok<T>(data: T): ApiSuccess<T>;
|
|
16
|
-
export declare function fail(message: string, code?: string, details?: unknown): ApiFailure;
|
|
17
|
-
export declare function jsonSuccess<T>(c: Context, data: T, status?: ContentfulStatusCode): Response;
|
|
18
|
-
export declare function jsonFail(c: Context, message: string, status?: ContentfulStatusCode, code?: string, details?: unknown): Response;
|
|
19
|
-
//# sourceMappingURL=response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../../core/src/helpers/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,OAAO,EAAE,IAAI,CAAA;IACb,IAAI,EAAE,CAAC,CAAA;CACR,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF,CAAA;AAED,wBAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAE5C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,CASlF;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAE,oBAA0B,GAAG,QAAQ,CAEhG;AAED,wBAAgB,QAAQ,CACtB,CAAC,EAAE,OAAO,EACV,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,oBAA0B,EAClC,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,QAAQ,CAEV"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
2
|
-
import type { PlanetCore } from './PlanetCore';
|
|
3
|
-
import type { Router } from './Router';
|
|
4
|
-
export { Arr } from './helpers/Arr';
|
|
5
|
-
export * from './helpers/data';
|
|
6
|
-
export * from './helpers/errors';
|
|
7
|
-
export * from './helpers/response';
|
|
8
|
-
export { Str } from './helpers/Str';
|
|
9
|
-
export declare class DumpDieError extends Error {
|
|
10
|
-
readonly values: unknown[];
|
|
11
|
-
name: string;
|
|
12
|
-
constructor(values: unknown[]);
|
|
13
|
-
}
|
|
14
|
-
export type DumpOptions = {
|
|
15
|
-
depth?: number | null;
|
|
16
|
-
colors?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare function dump(...values: unknown[]): void;
|
|
19
|
-
export declare function dd(...values: unknown[]): never;
|
|
20
|
-
export declare function tap<T>(value: T, callback: (value: T) => unknown): T;
|
|
21
|
-
export declare function value<TArgs extends readonly unknown[], TResult>(value: (...args: TArgs) => TResult, ...args: TArgs): TResult;
|
|
22
|
-
export declare function value<TResult>(value: TResult): TResult;
|
|
23
|
-
export declare function value<TArgs extends readonly unknown[], TResult>(valueOrFactory: TResult | ((...args: TArgs) => TResult), ...args: TArgs): TResult;
|
|
24
|
-
export declare function blank(value: unknown): boolean;
|
|
25
|
-
export declare function filled(value: unknown): boolean;
|
|
26
|
-
export declare function throwIf(condition: unknown, error?: Error | string | (() => Error)): void;
|
|
27
|
-
export declare function throwUnless(condition: unknown, error?: Error | string | (() => Error)): void;
|
|
28
|
-
export declare function env<TDefault = string | undefined>(key: string, defaultValue?: TDefault): string | TDefault;
|
|
29
|
-
export declare function setApp(core: PlanetCore | null): void;
|
|
30
|
-
export declare function hasApp(): boolean;
|
|
31
|
-
export declare function app(): PlanetCore;
|
|
32
|
-
export declare function config<T = unknown>(key: string): T;
|
|
33
|
-
export declare function config<T>(key: string, defaultValue: T): T;
|
|
34
|
-
export declare function logger(): import("./Logger").Logger;
|
|
35
|
-
export declare function router(): Router;
|
|
36
|
-
export declare function abort(status: ContentfulStatusCode, message?: string): never;
|
|
37
|
-
export declare function abortIf(condition: unknown, status: ContentfulStatusCode, message?: string): void;
|
|
38
|
-
export declare function abortUnless(condition: unknown, status: ContentfulStatusCode, message?: string): void;
|
|
39
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../core/src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,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0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Encrypter } from '../security/Encrypter';
|
|
3
|
-
export interface CookieOptions {
|
|
4
|
-
path?: string;
|
|
5
|
-
domain?: string;
|
|
6
|
-
secure?: boolean;
|
|
7
|
-
httpOnly?: boolean;
|
|
8
|
-
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
9
|
-
maxAge?: number;
|
|
10
|
-
expires?: Date;
|
|
11
|
-
encrypt?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class CookieJar {
|
|
14
|
-
private encrypter?;
|
|
15
|
-
private queued;
|
|
16
|
-
constructor(encrypter?: Encrypter | undefined);
|
|
17
|
-
/**
|
|
18
|
-
* Queue a cookie to be sent with the response
|
|
19
|
-
*/
|
|
20
|
-
queue(name: string, value: string, minutes?: number, options?: CookieOptions): void;
|
|
21
|
-
/**
|
|
22
|
-
* Make a cookie that lasts "forever" (5 years)
|
|
23
|
-
*/
|
|
24
|
-
forever(name: string, value: string, options?: CookieOptions): void;
|
|
25
|
-
/**
|
|
26
|
-
* Expire a cookie
|
|
27
|
-
*/
|
|
28
|
-
forget(name: string, options?: CookieOptions): void;
|
|
29
|
-
/**
|
|
30
|
-
* Attach queued cookies to the context
|
|
31
|
-
*/
|
|
32
|
-
attach(c: Context): void;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=CookieJar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CookieJar.d.ts","sourceRoot":"","sources":["../../../../../core/src/http/CookieJar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,qBAAa,SAAS;IAGR,OAAO,CAAC,SAAS,CAAC;IAF9B,OAAO,CAAC,MAAM,CAAoE;gBAE9D,SAAS,CAAC,EAAE,SAAS,YAAA;IAEzC;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,OAAO,GAAE,aAAkB;IAkB5E;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;IAIhE;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;IAIhD;;OAEG;IACH,MAAM,CAAC,CAAC,EAAE,OAAO;CAKlB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { MiddlewareHandler } from 'hono';
|
|
2
|
-
import type { PlanetCore } from '../../PlanetCore';
|
|
3
|
-
export declare class ThrottleRequests {
|
|
4
|
-
private core;
|
|
5
|
-
constructor(core: PlanetCore);
|
|
6
|
-
/**
|
|
7
|
-
* Create the middleware
|
|
8
|
-
* @param maxAttempts - Max requests allowed
|
|
9
|
-
* @param decaySeconds - Time window in seconds
|
|
10
|
-
*/
|
|
11
|
-
handle(maxAttempts?: number, decaySeconds?: number): MiddlewareHandler;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ThrottleRequests.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThrottleRequests.d.ts","sourceRoot":"","sources":["../../../../../../core/src/http/middleware/ThrottleRequests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,iBAAiB,EAAQ,MAAM,MAAM,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAclD,qBAAa,gBAAgB;IACf,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC;;;;OAIG;IACH,MAAM,CAAC,WAAW,SAAK,EAAE,YAAY,SAAK,GAAG,iBAAiB;CAiC/D"}
|
package/dist/core/src/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* gravito-core
|
|
3
|
-
*
|
|
4
|
-
* The core micro-kernel for the Galaxy Architecture.
|
|
5
|
-
*/
|
|
6
|
-
import type { GravitoConfig } from './PlanetCore';
|
|
7
|
-
export declare const VERSION: string;
|
|
8
|
-
export { ConfigManager } from './ConfigManager';
|
|
9
|
-
export { Container, type Factory } from './Container';
|
|
10
|
-
export { EventManager } from './EventManager';
|
|
11
|
-
export * from './exceptions';
|
|
12
|
-
export { type GlobalErrorHandlersMode, type GlobalProcessErrorHandlerContext, type GlobalProcessErrorKind, type RegisterGlobalErrorHandlersOptions, registerGlobalErrorHandlers, } from './GlobalErrorHandlers';
|
|
13
|
-
export type { ActionCallback, FilterCallback } from './HookManager';
|
|
14
|
-
export { HookManager } from './HookManager';
|
|
15
|
-
export * from './helpers';
|
|
16
|
-
export { CookieJar, type CookieOptions } from './http/CookieJar';
|
|
17
|
-
export { ThrottleRequests } from './http/middleware/ThrottleRequests';
|
|
18
|
-
export type { Listener, ShouldQueue } from './Listener';
|
|
19
|
-
export type { Logger } from './Logger';
|
|
20
|
-
export { ConsoleLogger } from './Logger';
|
|
21
|
-
export { type CacheService, type ErrorHandlerContext, type GravitoConfig, type GravitoOrbit, PlanetCore, type ViewService, } from './PlanetCore';
|
|
22
|
-
export { Route } from './Route';
|
|
23
|
-
export { type ControllerClass, type FormRequestClass, type FormRequestLike, type RouteHandler, type RouteOptions, Router, } from './Router';
|
|
24
|
-
export { ServiceProvider } from './ServiceProvider';
|
|
25
|
-
export { Encrypter, type EncrypterOptions } from './security/Encrypter';
|
|
26
|
-
export type { Channel, ShouldBroadcast } from './types/events';
|
|
27
|
-
export { Event } from './types/events';
|
|
28
|
-
/**
|
|
29
|
-
* Configure your Gravito application
|
|
30
|
-
*/
|
|
31
|
-
export declare function defineConfig(config: GravitoConfig): GravitoConfig;
|
|
32
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,eAAO,MAAM,OAAO,QAAsB,CAAA;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,cAAc,cAAc,CAAA;AAC5B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,2BAA2B,GAC5B,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACvD,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,UAAU,EACV,KAAK,WAAW,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,GACP,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAEjE"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface EncrypterOptions {
|
|
2
|
-
key: string;
|
|
3
|
-
cipher?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class Encrypter {
|
|
6
|
-
private algorithm;
|
|
7
|
-
private key;
|
|
8
|
-
constructor(options: EncrypterOptions);
|
|
9
|
-
/**
|
|
10
|
-
* Encrypt a value
|
|
11
|
-
*/
|
|
12
|
-
encrypt(value: unknown, serialize?: boolean): string;
|
|
13
|
-
/**
|
|
14
|
-
* Decrypt a value
|
|
15
|
-
*/
|
|
16
|
-
decrypt(payload: string, deserialize?: boolean): unknown;
|
|
17
|
-
private hash;
|
|
18
|
-
private validPayload;
|
|
19
|
-
private validMac;
|
|
20
|
-
/**
|
|
21
|
-
* Generate a new key
|
|
22
|
-
*/
|
|
23
|
-
static generateKey(cipher?: string): string;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=Encrypter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Encrypter.d.ts","sourceRoot":"","sources":["../../../../../core/src/security/Encrypter.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,GAAG,CAAQ;gBAEP,OAAO,EAAE,gBAAgB;IAkBrC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,UAAO,GAAG,MAAM;IAqBjD;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,OAAO;IAoBrD,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,QAAQ;IAKhB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,SAAgB,GAAG,MAAM;CAInD"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hashing interface
|
|
3
|
-
*/
|
|
4
|
-
export interface Hasher {
|
|
5
|
-
/**
|
|
6
|
-
* Hash the given value
|
|
7
|
-
*/
|
|
8
|
-
make(value: string, options?: Record<string, unknown>): Promise<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Check the given plain value against a hash
|
|
11
|
-
*/
|
|
12
|
-
check(value: string, hashedValue: string): Promise<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Check if the given hash has been hashed using the given options
|
|
15
|
-
*/
|
|
16
|
-
needsRehash(hashedValue: string, options?: Record<string, unknown>): boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Bun Hasher
|
|
20
|
-
* Uses Bun's native password hashing (bcrypt by default)
|
|
21
|
-
*/
|
|
22
|
-
export declare class BunHasher implements Hasher {
|
|
23
|
-
make(value: string, options?: {
|
|
24
|
-
algorithm?: 'bcrypt' | 'argon2id';
|
|
25
|
-
cost?: number;
|
|
26
|
-
}): Promise<string>;
|
|
27
|
-
check(value: string, hashedValue: string): Promise<boolean>;
|
|
28
|
-
needsRehash(_hashedValue: string, _options?: Record<string, unknown>): boolean;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=Hasher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Hasher.d.ts","sourceRoot":"","sources":["../../../../../core/src/security/Hasher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvE;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAE3D;;OAEG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;CAC7E;AAED;;;GAGG;AACH,qBAAa,SAAU,YAAW,MAAM;IAChC,IAAI,CACR,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,MAAM,CAAC;IAMZ,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIjE,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;CAG/E"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event system type definitions.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Listener interface.
|
|
6
|
-
*
|
|
7
|
-
* All event listeners must implement this interface.
|
|
8
|
-
*/
|
|
9
|
-
export interface Listener<TEvent extends Event = Event> {
|
|
10
|
-
/**
|
|
11
|
-
* Handle an event.
|
|
12
|
-
* @param event - Event instance
|
|
13
|
-
*/
|
|
14
|
-
handle(event: TEvent): Promise<void> | void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Marker interface for listeners that should be queued.
|
|
18
|
-
*
|
|
19
|
-
* Listeners implementing this interface can be dispatched asynchronously via a queue.
|
|
20
|
-
*/
|
|
21
|
-
export interface ShouldQueue {
|
|
22
|
-
/**
|
|
23
|
-
* Queue name (optional).
|
|
24
|
-
*/
|
|
25
|
-
queue?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Connection name (optional).
|
|
28
|
-
*/
|
|
29
|
-
connection?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Delay before execution (seconds).
|
|
32
|
-
*/
|
|
33
|
-
delay?: number;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Marker interface for events that should be broadcast.
|
|
37
|
-
*
|
|
38
|
-
* Events implementing this interface can be automatically broadcast to clients.
|
|
39
|
-
*/
|
|
40
|
-
export interface ShouldBroadcast {
|
|
41
|
-
/**
|
|
42
|
-
* Define the broadcast channel.
|
|
43
|
-
* @returns Channel name or channel object
|
|
44
|
-
*/
|
|
45
|
-
broadcastOn(): string | Channel;
|
|
46
|
-
/**
|
|
47
|
-
* Define broadcast payload (optional).
|
|
48
|
-
* If omitted, public event properties will be used.
|
|
49
|
-
* @returns Broadcast payload
|
|
50
|
-
*/
|
|
51
|
-
broadcastWith?(): Record<string, unknown>;
|
|
52
|
-
/**
|
|
53
|
-
* Define the broadcast event name (optional).
|
|
54
|
-
* If omitted, the event class name will be used.
|
|
55
|
-
* @returns Event name
|
|
56
|
-
*/
|
|
57
|
-
broadcastAs?(): string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Channel interface.
|
|
61
|
-
*/
|
|
62
|
-
export interface Channel {
|
|
63
|
-
/**
|
|
64
|
-
* Channel name.
|
|
65
|
-
*/
|
|
66
|
-
name: string;
|
|
67
|
-
/**
|
|
68
|
-
* Channel type.
|
|
69
|
-
*/
|
|
70
|
-
type: 'public' | 'private' | 'presence';
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Base event class.
|
|
74
|
-
*
|
|
75
|
-
* All events should extend this class.
|
|
76
|
-
*/
|
|
77
|
-
export declare abstract class Event {
|
|
78
|
-
/**
|
|
79
|
-
* Whether this event should be broadcast.
|
|
80
|
-
*/
|
|
81
|
-
shouldBroadcast(): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Get broadcast channel.
|
|
84
|
-
*/
|
|
85
|
-
getBroadcastChannel(): string | Channel | null;
|
|
86
|
-
/**
|
|
87
|
-
* Get broadcast payload.
|
|
88
|
-
*/
|
|
89
|
-
getBroadcastData(): Record<string, unknown>;
|
|
90
|
-
/**
|
|
91
|
-
* Get broadcast event name.
|
|
92
|
-
*/
|
|
93
|
-
getBroadcastEventName(): string;
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,MAAM,SAAS,KAAK,GAAG,KAAK;IACpD;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,WAAW,IAAI,MAAM,GAAG,OAAO,CAAA;IAE/B;;;;OAIG;IACH,aAAa,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEzC;;;;OAIG;IACH,WAAW,CAAC,IAAI,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;CACxC;AAED;;;;GAIG;AACH,8BAAsB,KAAK;IACzB;;OAEG;IACH,eAAe,IAAI,OAAO;IAO1B;;OAEG;IACH,mBAAmB,IAAI,MAAM,GAAG,OAAO,GAAG,IAAI;IAO9C;;OAEG;IACH,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAkB3C;;OAEG;IACH,qBAAqB,IAAI,MAAM;CAUhC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { DBService } from '@gravito/orbit-db';
|
|
2
|
-
import type { SerializedJob } from '../types';
|
|
3
|
-
import type { QueueDriver } from './QueueDriver';
|
|
4
|
-
/**
|
|
5
|
-
* Database driver configuration.
|
|
6
|
-
*/
|
|
7
|
-
export interface DatabaseDriverConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Table name (default: `jobs`).
|
|
10
|
-
*/
|
|
11
|
-
table?: string;
|
|
12
|
-
/**
|
|
13
|
-
* DBService instance (from `orbit-db`).
|
|
14
|
-
* If not provided, it can be resolved from Context in OrbitQueue.
|
|
15
|
-
*/
|
|
16
|
-
dbService?: DBService;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Database Driver
|
|
20
|
-
*
|
|
21
|
-
* Uses a database as the queue backend.
|
|
22
|
-
* Reuses the `orbit-db` connection instead of creating a new connection.
|
|
23
|
-
*
|
|
24
|
-
* Requires `@gravito/orbit-db` to be installed and configured.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Get DBService from Context
|
|
29
|
-
* const dbService = c.get('db')
|
|
30
|
-
* const driver = new DatabaseDriver({ dbService, table: 'jobs' })
|
|
31
|
-
*
|
|
32
|
-
* await driver.push('default', serializedJob)
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class DatabaseDriver implements QueueDriver {
|
|
36
|
-
private tableName;
|
|
37
|
-
private dbService;
|
|
38
|
-
constructor(config: DatabaseDriverConfig);
|
|
39
|
-
/**
|
|
40
|
-
* Push a job to a queue.
|
|
41
|
-
*/
|
|
42
|
-
push(queue: string, job: SerializedJob): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Pop a job from the queue (FIFO, with delay support).
|
|
45
|
-
*/
|
|
46
|
-
pop(queue: string): Promise<SerializedJob | null>;
|
|
47
|
-
/**
|
|
48
|
-
* Get queue size.
|
|
49
|
-
*/
|
|
50
|
-
size(queue: string): Promise<number>;
|
|
51
|
-
/**
|
|
52
|
-
* Clear a queue.
|
|
53
|
-
*/
|
|
54
|
-
clear(queue: string): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Push multiple jobs.
|
|
57
|
-
*/
|
|
58
|
-
pushMany(queue: string, jobs: SerializedJob[]): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=DatabaseDriver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseDriver.d.ts","sourceRoot":"","sources":["../../src/drivers/DatabaseDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,SAAS,CAAW;gBAEhB,MAAM,EAAE,oBAAoB;IAWxC;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5D;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAyEvD;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa1C;;OAEG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpE"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type { SerializedJob, TopicOptions } from '../types';
|
|
2
|
-
import type { QueueDriver } from './QueueDriver';
|
|
3
|
-
/**
|
|
4
|
-
* Kafka driver configuration.
|
|
5
|
-
*/
|
|
6
|
-
export interface KafkaDriverConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Kafka client instance (kafkajs).
|
|
9
|
-
*/
|
|
10
|
-
client: {
|
|
11
|
-
producer: () => {
|
|
12
|
-
connect: () => Promise<void>;
|
|
13
|
-
send: (args: {
|
|
14
|
-
topic: string;
|
|
15
|
-
messages: Array<{
|
|
16
|
-
key?: string;
|
|
17
|
-
value: string;
|
|
18
|
-
}>;
|
|
19
|
-
}) => Promise<void>;
|
|
20
|
-
disconnect: () => Promise<void>;
|
|
21
|
-
};
|
|
22
|
-
admin: () => {
|
|
23
|
-
connect: () => Promise<void>;
|
|
24
|
-
createTopics: (args: {
|
|
25
|
-
topics: Array<{
|
|
26
|
-
topic: string;
|
|
27
|
-
numPartitions?: number;
|
|
28
|
-
replicationFactor?: number;
|
|
29
|
-
}>;
|
|
30
|
-
}) => Promise<void>;
|
|
31
|
-
deleteTopics: (args: {
|
|
32
|
-
topics: string[];
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
disconnect: () => Promise<void>;
|
|
35
|
-
};
|
|
36
|
-
consumer: (args: {
|
|
37
|
-
groupId: string;
|
|
38
|
-
}) => {
|
|
39
|
-
connect: () => Promise<void>;
|
|
40
|
-
subscribe: (args: {
|
|
41
|
-
topics: string[];
|
|
42
|
-
}) => Promise<void>;
|
|
43
|
-
run: (args: {
|
|
44
|
-
eachMessage: (args: {
|
|
45
|
-
topic: string;
|
|
46
|
-
partition: number;
|
|
47
|
-
message: {
|
|
48
|
-
key?: Buffer;
|
|
49
|
-
value: Buffer;
|
|
50
|
-
offset: string;
|
|
51
|
-
};
|
|
52
|
-
}) => Promise<void>;
|
|
53
|
-
}) => Promise<void>;
|
|
54
|
-
disconnect: () => Promise<void>;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Consumer group ID (for consuming messages).
|
|
59
|
-
*/
|
|
60
|
-
consumerGroupId?: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Kafka Driver
|
|
64
|
-
*
|
|
65
|
-
* Uses Apache Kafka as the queue backend.
|
|
66
|
-
* Supports topic management, consumer groups, and batch operations.
|
|
67
|
-
*
|
|
68
|
-
* Requires `kafkajs`.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* import { Kafka } from 'kafkajs'
|
|
73
|
-
*
|
|
74
|
-
* const kafka = new Kafka({
|
|
75
|
-
* brokers: ['localhost:9092'],
|
|
76
|
-
* clientId: 'gravito-app'
|
|
77
|
-
* })
|
|
78
|
-
*
|
|
79
|
-
* const driver = new KafkaDriver({ client: kafka, consumerGroupId: 'workers' })
|
|
80
|
-
* await driver.push('default', serializedJob)
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export declare class KafkaDriver implements QueueDriver {
|
|
84
|
-
private client;
|
|
85
|
-
private consumerGroupId;
|
|
86
|
-
private producer?;
|
|
87
|
-
private admin?;
|
|
88
|
-
constructor(config: KafkaDriverConfig);
|
|
89
|
-
/**
|
|
90
|
-
* Ensure the producer is connected.
|
|
91
|
-
*/
|
|
92
|
-
private ensureProducer;
|
|
93
|
-
/**
|
|
94
|
-
* Ensure the admin client is connected.
|
|
95
|
-
*/
|
|
96
|
-
private ensureAdmin;
|
|
97
|
-
/**
|
|
98
|
-
* Push a job to a topic.
|
|
99
|
-
*/
|
|
100
|
-
push(queue: string, job: SerializedJob): Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* Pop is not supported for Kafka.
|
|
103
|
-
*
|
|
104
|
-
* Note: Kafka uses a push-based model, so you should use `subscribe()`.
|
|
105
|
-
*/
|
|
106
|
-
pop(_queue: string): Promise<SerializedJob | null>;
|
|
107
|
-
/**
|
|
108
|
-
* Kafka does not provide a direct queue size.
|
|
109
|
-
*
|
|
110
|
-
* Returns 0; use Kafka tooling/metrics for lag/size insights.
|
|
111
|
-
*/
|
|
112
|
-
size(_queue: string): Promise<number>;
|
|
113
|
-
/**
|
|
114
|
-
* Clear a queue by deleting the topic.
|
|
115
|
-
*/
|
|
116
|
-
clear(queue: string): Promise<void>;
|
|
117
|
-
/**
|
|
118
|
-
* Push multiple jobs.
|
|
119
|
-
*/
|
|
120
|
-
pushMany(queue: string, jobs: SerializedJob[]): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Create a topic.
|
|
123
|
-
*/
|
|
124
|
-
createTopic(topic: string, options?: TopicOptions): Promise<void>;
|
|
125
|
-
/**
|
|
126
|
-
* Delete a topic.
|
|
127
|
-
*/
|
|
128
|
-
deleteTopic(topic: string): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Subscribe to a topic (push-based model).
|
|
131
|
-
*/
|
|
132
|
-
subscribe(queue: string, callback: (job: SerializedJob) => Promise<void>): Promise<void>;
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=KafkaDriver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KafkaDriver.d.ts","sourceRoot":"","sources":["../../src/drivers/KafkaDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM;YACd,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;YAC5B,IAAI,EAAE,CAAC,IAAI,EAAE;gBACX,KAAK,EAAE,MAAM,CAAA;gBACb,QAAQ,EAAE,KAAK,CAAC;oBAAE,GAAG,CAAC,EAAE,MAAM,CAAC;oBAAC,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACjD,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;YACnB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;SAChC,CAAA;QACD,KAAK,EAAE,MAAM;YACX,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;YAC5B,YAAY,EAAE,CAAC,IAAI,EAAE;gBACnB,MAAM,EAAE,KAAK,CAAC;oBAAE,KAAK,EAAE,MAAM,CAAC;oBAAC,aAAa,CAAC,EAAE,MAAM,CAAC;oBAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACrF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AAW;IAQzB;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5D;;;;OAIG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAKxD;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK3C;;OAEG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzC;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BnE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAavE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAiC/F"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { SerializedJob } from '../types';
|
|
2
|
-
import type { QueueDriver } from './QueueDriver';
|
|
3
|
-
/**
|
|
4
|
-
* Memory Driver
|
|
5
|
-
*
|
|
6
|
-
* In-memory driver for development and testing.
|
|
7
|
-
* All data is stored in memory and will be lost when the process restarts.
|
|
8
|
-
*
|
|
9
|
-
* Zero-config: works out of the box.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const driver = new MemoryDriver()
|
|
14
|
-
* await driver.push('default', serializedJob)
|
|
15
|
-
* const job = await driver.pop('default')
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class MemoryDriver implements QueueDriver {
|
|
19
|
-
private queues;
|
|
20
|
-
/**
|
|
21
|
-
* Push a job to a queue.
|
|
22
|
-
*/
|
|
23
|
-
push(queue: string, job: SerializedJob): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Pop a job from a queue (FIFO).
|
|
26
|
-
*/
|
|
27
|
-
pop(queue: string): Promise<SerializedJob | null>;
|
|
28
|
-
/**
|
|
29
|
-
* Get queue size.
|
|
30
|
-
*/
|
|
31
|
-
size(queue: string): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Clear a queue.
|
|
34
|
-
*/
|
|
35
|
-
clear(queue: string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Push multiple jobs.
|
|
38
|
-
*/
|
|
39
|
-
pushMany(queue: string, jobs: SerializedJob[]): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Pop multiple jobs.
|
|
42
|
-
*/
|
|
43
|
-
popMany(queue: string, count: number): Promise<SerializedJob[]>;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=MemoryDriver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryDriver.d.ts","sourceRoot":"","sources":["../../src/drivers/MemoryDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAa,YAAW,WAAW;IAC9C,OAAO,CAAC,MAAM,CAAqC;IAEnD;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5D;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAmBvD;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1C;;OAEG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnE;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAYtE"}
|