@privateaim/server-kit 0.8.21 → 0.8.22
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/CHANGELOG.md +29 -0
- package/dist/core/component/caller/compound/index.d.ts +2 -0
- package/dist/core/component/caller/compound/index.d.ts.map +1 -0
- package/dist/core/component/caller/compound/module.d.ts +9 -0
- package/dist/core/component/caller/compound/module.d.ts.map +1 -0
- package/dist/core/component/caller/direct/index.d.ts +3 -0
- package/dist/core/component/caller/direct/index.d.ts.map +1 -0
- package/dist/core/component/caller/direct/module.d.ts +23 -0
- package/dist/core/component/caller/direct/module.d.ts.map +1 -0
- package/dist/core/component/caller/direct/types.d.ts +5 -0
- package/dist/core/component/caller/direct/types.d.ts.map +1 -0
- package/dist/core/component/caller/index.d.ts +6 -0
- package/dist/core/component/caller/index.d.ts.map +1 -0
- package/dist/core/component/caller/queue-dispatch/index.d.ts +2 -0
- package/dist/core/component/caller/queue-dispatch/index.d.ts.map +1 -0
- package/dist/core/component/caller/queue-dispatch/module.d.ts +9 -0
- package/dist/core/component/caller/queue-dispatch/module.d.ts.map +1 -0
- package/dist/core/component/caller/queue-dispatch/types.d.ts +6 -0
- package/dist/core/component/caller/queue-dispatch/types.d.ts.map +1 -0
- package/dist/core/component/caller/queue-worker/index.d.ts +2 -0
- package/dist/core/component/caller/queue-worker/index.d.ts.map +1 -0
- package/dist/core/component/caller/queue-worker/module.d.ts +17 -0
- package/dist/core/component/caller/queue-worker/module.d.ts.map +1 -0
- package/dist/core/component/caller/queue-worker/types.d.ts +6 -0
- package/dist/core/component/caller/queue-worker/types.d.ts.map +1 -0
- package/dist/core/component/caller/types.d.ts +13 -0
- package/dist/core/component/caller/types.d.ts.map +1 -0
- package/dist/core/component/error.d.ts +1 -1
- package/dist/core/component/error.d.ts.map +1 -1
- package/dist/core/component/handler/index.d.ts +1 -1
- package/dist/core/component/handler/index.d.ts.map +1 -1
- package/dist/core/component/handler/types.d.ts +8 -7
- package/dist/core/component/handler/types.d.ts.map +1 -1
- package/dist/core/component/index.d.ts +2 -0
- package/dist/core/component/index.d.ts.map +1 -1
- package/dist/core/component/module.d.ts +23 -0
- package/dist/core/component/module.d.ts.map +1 -0
- package/dist/core/component/type.d.ts +26 -9
- package/dist/core/component/type.d.ts.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/queue-router/types.d.ts +2 -1
- package/dist/core/queue-router/types.d.ts.map +1 -1
- package/dist/index.mjs +390 -290
- package/dist/index.mjs.map +1 -1
- package/dist/services/cache/adapters/memory.d.ts +3 -3
- package/dist/services/cache/adapters/memory.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/redis/module.d.ts +4 -2
- package/dist/services/redis/module.d.ts.map +1 -1
- package/dist/services/task-manager/helpers.d.ts +3 -0
- package/dist/services/task-manager/helpers.d.ts.map +1 -0
- package/dist/services/task-manager/index.d.ts +3 -0
- package/dist/services/task-manager/index.d.ts.map +1 -0
- package/dist/services/task-manager/module.d.ts +33 -0
- package/dist/services/task-manager/module.d.ts.map +1 -0
- package/dist/services/task-manager/types.d.ts +16 -0
- package/dist/services/task-manager/types.d.ts.map +1 -0
- package/package.json +16 -15
- package/src/core/{queue → component/caller/compound}/index.ts +2 -3
- package/src/core/component/caller/compound/module.ts +42 -0
- package/src/core/component/caller/direct/index.ts +9 -0
- package/src/core/component/caller/direct/module.ts +84 -0
- package/src/core/component/caller/direct/types.ts +13 -0
- package/src/core/component/caller/index.ts +13 -0
- package/src/core/component/caller/queue-dispatch/index.ts +8 -0
- package/src/core/component/caller/queue-dispatch/module.ts +49 -0
- package/src/core/component/caller/queue-dispatch/types.ts +13 -0
- package/src/core/component/caller/queue-worker/index.ts +8 -0
- package/src/core/component/caller/queue-worker/module.ts +91 -0
- package/src/core/component/caller/queue-worker/types.ts +13 -0
- package/src/core/component/caller/types.ts +33 -0
- package/src/core/component/error.ts +1 -1
- package/src/core/component/handler/index.ts +1 -1
- package/src/core/component/handler/types.ts +12 -10
- package/src/core/component/index.ts +2 -0
- package/src/core/component/module.ts +158 -0
- package/src/core/component/type.ts +45 -19
- package/src/core/index.ts +0 -1
- package/src/core/queue-router/types.ts +4 -2
- package/src/services/cache/adapters/memory.ts +7 -4
- package/src/services/index.ts +1 -0
- package/src/services/redis/module.ts +4 -1
- package/src/services/task-manager/helpers.ts +15 -0
- package/src/services/task-manager/index.ts +9 -0
- package/src/services/task-manager/module.ts +131 -0
- package/src/services/task-manager/types.ts +32 -0
- package/test/unit/logger.spec.ts +1 -0
- package/test/unit/memory-cache.spec.ts +1 -0
- package/test/vitest.config.ts +17 -0
- package/dist/core/component/handler/module.d.ts +0 -13
- package/dist/core/component/handler/module.d.ts.map +0 -1
- package/dist/core/queue/index.d.ts +0 -3
- package/dist/core/queue/index.d.ts.map +0 -1
- package/dist/core/queue/type.d.ts +0 -12
- package/dist/core/queue/type.d.ts.map +0 -1
- package/dist/core/queue/utils.d.ts +0 -3
- package/dist/core/queue/utils.d.ts.map +0 -1
- package/dist/index.cjs +0 -970
- package/dist/index.cjs.map +0 -1
- package/src/core/component/handler/module.ts +0 -74
- package/src/core/queue/type.ts +0 -23
- package/src/core/queue/utils.ts +0 -17
- package/test/jest.config.js +0 -33
|
@@ -6,32 +6,58 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ObjectLiteral } from '../../type';
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
value?: ObjectLiteral,
|
|
16
|
-
metadata?: ObjectLiteral
|
|
17
|
-
) => void
|
|
9
|
+
import type { ComponentHandler, ComponentHandlerFn } from './handler';
|
|
10
|
+
|
|
11
|
+
export type ComponentData = ObjectLiteral;
|
|
12
|
+
export type ComponentMetadata = {
|
|
13
|
+
correlationId?: string,
|
|
14
|
+
[key: string]: any
|
|
18
15
|
};
|
|
19
16
|
|
|
17
|
+
export type ComponentStartFn = () => Promise<void> | void;
|
|
18
|
+
|
|
20
19
|
export type ComponentErrorOptions = {
|
|
21
20
|
code?: string | null,
|
|
22
21
|
message?: string
|
|
23
22
|
cause?: unknown
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
export type
|
|
27
|
-
|
|
28
|
-
> = T & {
|
|
29
|
-
error: ComponentError | Error
|
|
30
|
-
};
|
|
25
|
+
export type ComponentEventMapValue = [ComponentData, ComponentMetadata];
|
|
26
|
+
export type ComponentEventMap = Record<string, ComponentEventMapValue>;
|
|
31
27
|
|
|
32
|
-
export type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
command: C
|
|
28
|
+
export type ComponentHandleOptions<
|
|
29
|
+
EventMap extends ComponentEventMap = ComponentEventMap,
|
|
30
|
+
> = {
|
|
31
|
+
handle?: ComponentHandlerFn<EventMap>
|
|
37
32
|
};
|
|
33
|
+
|
|
34
|
+
export type ComponentHandleFnArgsForMap<
|
|
35
|
+
EventMap extends ComponentEventMap = ComponentEventMap,
|
|
36
|
+
> = {
|
|
37
|
+
[K in keyof EventMap]: [
|
|
38
|
+
key: K & string,
|
|
39
|
+
data: EventMap[K][0],
|
|
40
|
+
metadata?: EventMap[K][1] | undefined,
|
|
41
|
+
options?: ComponentHandleOptions<EventMap>,
|
|
42
|
+
]
|
|
43
|
+
}[keyof EventMap];
|
|
44
|
+
|
|
45
|
+
export type ComponentHandlerCallFnForMap<
|
|
46
|
+
EventMap extends ComponentEventMap = ComponentEventMap,
|
|
47
|
+
> = (
|
|
48
|
+
...input: ComponentHandleFnArgsForMap<EventMap>
|
|
49
|
+
) => Promise<void> | void;
|
|
50
|
+
|
|
51
|
+
export type ComponentHandlers<EventMap extends ComponentEventMap> = Map<
|
|
52
|
+
keyof EventMap | '*',
|
|
53
|
+
{
|
|
54
|
+
[Key in keyof EventMap]?: ComponentHandler<EventMap, Key> | ComponentHandlerFn<EventMap, Key>
|
|
55
|
+
}[keyof EventMap]
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
export interface Component<
|
|
59
|
+
EventMap extends ComponentEventMap = ComponentEventMap,
|
|
60
|
+
> {
|
|
61
|
+
start: ComponentStartFn,
|
|
62
|
+
handle?: ComponentHandlerCallFnForMap<EventMap>
|
|
63
|
+
}
|
package/src/core/index.ts
CHANGED
|
@@ -40,6 +40,9 @@ export type QueueRouterPayload<
|
|
|
40
40
|
metadata: QueueRouterPayloadMetadata
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
export type QueueRouterPayloadMetadataInput = Partial<Pick<QueueRouterPayloadMetadata, 'timestamp'>> &
|
|
44
|
+
Omit<QueueRouterPayloadMetadata, 'timestamp'>;
|
|
45
|
+
|
|
43
46
|
export type QueueRouterPayloadInput<
|
|
44
47
|
KEY = string,
|
|
45
48
|
VALUE = Record<string, any>,
|
|
@@ -47,8 +50,7 @@ export type QueueRouterPayloadInput<
|
|
|
47
50
|
id?: string,
|
|
48
51
|
type: KEY,
|
|
49
52
|
data?: VALUE,
|
|
50
|
-
metadata:
|
|
51
|
-
Omit<QueueRouterPayloadMetadata, 'timestamp'>
|
|
53
|
+
metadata: QueueRouterPayloadMetadataInput
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
export type QueueRouterHandler<
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* view the LICENSE file that was distributed with this source code.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
9
|
-
import TTLCache from '@isaacs/ttlcache';
|
|
8
|
+
import type { TTLCacheOptions } from '@isaacs/ttlcache';
|
|
9
|
+
import { TTLCache } from '@isaacs/ttlcache';
|
|
10
10
|
import type { CacheClearOptions, CacheSetOptions } from '../types';
|
|
11
11
|
import type { CacheAdapter } from './types';
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ export class MemoryCacheAdapter<
|
|
|
15
15
|
> implements CacheAdapter {
|
|
16
16
|
protected instance : TTLCache<string, VALUE>;
|
|
17
17
|
|
|
18
|
-
constructor(options:
|
|
18
|
+
constructor(options: TTLCacheOptions<string, VALUE> = {}) {
|
|
19
19
|
this.instance = new TTLCache<string, VALUE>({
|
|
20
20
|
checkAgeOnGet: true,
|
|
21
21
|
ttl: Infinity,
|
|
@@ -52,7 +52,10 @@ export class MemoryCacheAdapter<
|
|
|
52
52
|
const keys = this.instance.keys();
|
|
53
53
|
let iterator = keys.next();
|
|
54
54
|
while (!iterator.done) {
|
|
55
|
-
if (
|
|
55
|
+
if (
|
|
56
|
+
typeof iterator.value === 'string' &&
|
|
57
|
+
iterator.value.startsWith(options.prefix)
|
|
58
|
+
) {
|
|
56
59
|
this.instance.delete(iterator.value);
|
|
57
60
|
}
|
|
58
61
|
|
package/src/services/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './authup';
|
|
|
10
10
|
export * from './authup-client-authentication-hook';
|
|
11
11
|
export * from './cache';
|
|
12
12
|
export * from './entity-event';
|
|
13
|
+
export * from './task-manager';
|
|
13
14
|
export * from './logger';
|
|
14
15
|
export * from './redis';
|
|
15
16
|
export * from './vault';
|
|
@@ -5,14 +5,17 @@
|
|
|
5
5
|
* view the LICENSE file that was distributed with this source code.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { ClientOptions as RedisClientOptions } from 'redis-extension';
|
|
8
9
|
import {
|
|
9
10
|
Client as RedisClient,
|
|
10
|
-
ClientOptions as RedisClientOptions,
|
|
11
11
|
createClient as createRedisClient,
|
|
12
12
|
} from 'redis-extension';
|
|
13
13
|
|
|
14
14
|
export {
|
|
15
15
|
createRedisClient,
|
|
16
16
|
RedisClient,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type {
|
|
17
20
|
RedisClientOptions,
|
|
18
21
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025.
|
|
3
|
+
* Author Peter Placzek (tada5hi)
|
|
4
|
+
* For the full copyright and license information,
|
|
5
|
+
* view the LICENSE file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { isObject } from '@privateaim/kit';
|
|
9
|
+
import type { TaskEntry } from './types';
|
|
10
|
+
|
|
11
|
+
export function isTaskEntry(input: unknown) : input is TaskEntry {
|
|
12
|
+
return isObject(input) &&
|
|
13
|
+
typeof (input as TaskEntry).type === 'string' &&
|
|
14
|
+
isObject((input as TaskEntry).data);
|
|
15
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025.
|
|
3
|
+
* Author Peter Placzek (tada5hi)
|
|
4
|
+
* For the full copyright and license information,
|
|
5
|
+
* view the LICENSE file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { HOUR_IN_MS, WEEK_IN_MS, createNanoID } from '@privateaim/kit';
|
|
9
|
+
import type { Cache } from '../cache';
|
|
10
|
+
import type {
|
|
11
|
+
TaskEntry, TaskEntryResolved, TaskManagerCreateOptions, TaskTypeMap,
|
|
12
|
+
} from './types';
|
|
13
|
+
import { isTaskEntry } from './helpers';
|
|
14
|
+
|
|
15
|
+
export class TaskManager<
|
|
16
|
+
EntityMap extends TaskTypeMap = TaskTypeMap,
|
|
17
|
+
> {
|
|
18
|
+
protected driver : Cache;
|
|
19
|
+
|
|
20
|
+
constructor(driver: Cache) {
|
|
21
|
+
this.driver = driver;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Store a specific job by type.
|
|
26
|
+
*
|
|
27
|
+
* @param type
|
|
28
|
+
* @param data
|
|
29
|
+
* @param options
|
|
30
|
+
*/
|
|
31
|
+
async create<Key extends keyof EntityMap>(
|
|
32
|
+
type: Key & string,
|
|
33
|
+
data: EntityMap[Key],
|
|
34
|
+
options: TaskManagerCreateOptions<EntityMap, Key> = {},
|
|
35
|
+
) : Promise<string> {
|
|
36
|
+
let id : string;
|
|
37
|
+
if (options.key) {
|
|
38
|
+
id = `task:${options.key(type, data)}`;
|
|
39
|
+
} else {
|
|
40
|
+
id = `task:${createNanoID()}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (options.lock) {
|
|
44
|
+
const isLocked = await this.isLocked(id);
|
|
45
|
+
if (isLocked) {
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const entity : TaskEntry = {
|
|
51
|
+
data,
|
|
52
|
+
type,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
await this.driver.set(id, entity, {
|
|
56
|
+
ttl: WEEK_IN_MS,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (options.lock) {
|
|
60
|
+
await this.createLock(id);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return id;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get a job by id and type
|
|
68
|
+
*
|
|
69
|
+
* @param type
|
|
70
|
+
* @param id
|
|
71
|
+
* @param autoDelete
|
|
72
|
+
*/
|
|
73
|
+
async get<Key extends keyof EntityMap>(
|
|
74
|
+
type: Key & string,
|
|
75
|
+
id: string,
|
|
76
|
+
autoDelete: boolean = true,
|
|
77
|
+
) : Promise<EntityMap[Key]> {
|
|
78
|
+
const entity = await this.resolve(id, autoDelete);
|
|
79
|
+
if (!entity) {
|
|
80
|
+
throw new Error(`Job with id ${id} could not be found.`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (type && entity.type !== type) {
|
|
84
|
+
throw new Error(`Job type ${entity.type} does not not match with ${type}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return entity.data as EntityMap[Key];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Find a random job.
|
|
92
|
+
*
|
|
93
|
+
* @param id
|
|
94
|
+
* @param autoDelete
|
|
95
|
+
*/
|
|
96
|
+
async resolve(
|
|
97
|
+
id: string,
|
|
98
|
+
autoDelete: boolean = true,
|
|
99
|
+
) : Promise<TaskEntryResolved<EntityMap> | undefined> {
|
|
100
|
+
const entity : TaskEntry | undefined = await this.driver.get(id);
|
|
101
|
+
if (!entity || !isTaskEntry(entity)) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await this.clearLock(id);
|
|
106
|
+
|
|
107
|
+
if (autoDelete) {
|
|
108
|
+
await this.driver.drop(id);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return entity as TaskEntryResolved<EntityMap>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// -------------------------------------------------
|
|
115
|
+
|
|
116
|
+
protected async createLock(id: string) {
|
|
117
|
+
await this.driver.set(`taskLock:${id}`, true, {
|
|
118
|
+
ttl: HOUR_IN_MS,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
protected async clearLock(id: string) {
|
|
123
|
+
await this.driver.drop(`taskLock:${id}`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
protected async isLocked(id: string) : Promise<boolean> {
|
|
127
|
+
const isActive = await this.driver.get(`taskLock:${id}`);
|
|
128
|
+
|
|
129
|
+
return !!isActive;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025.
|
|
3
|
+
* Author Peter Placzek (tada5hi)
|
|
4
|
+
* For the full copyright and license information,
|
|
5
|
+
* view the LICENSE file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ObjectLiteral } from '../../type';
|
|
9
|
+
|
|
10
|
+
export type TaskEntry<
|
|
11
|
+
Data extends ObjectLiteral = ObjectLiteral,
|
|
12
|
+
Key extends string = string,
|
|
13
|
+
> = {
|
|
14
|
+
data: Data,
|
|
15
|
+
type: Key,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type TaskTypeMap = {
|
|
19
|
+
[key: string]: ObjectLiteral
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type TaskEntryResolved<EntityMap extends TaskTypeMap = TaskTypeMap> = {
|
|
23
|
+
[Key in keyof EntityMap]?: TaskEntry<EntityMap[Key], Key & string>;
|
|
24
|
+
}[keyof EntityMap];
|
|
25
|
+
|
|
26
|
+
export type TaskManagerCreateOptions<
|
|
27
|
+
EntityMap extends ObjectLiteral = ObjectLiteral,
|
|
28
|
+
Key extends keyof EntityMap = keyof EntityMap,
|
|
29
|
+
> = {
|
|
30
|
+
lock?: boolean;
|
|
31
|
+
key?: (type: Key & string, data: EntityMap[Key]) => string
|
|
32
|
+
};
|
package/test/unit/logger.spec.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* view the LICENSE file that was distributed with this source code.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
8
9
|
import { createLogger } from 'winston';
|
|
9
10
|
import { LoggerMemoryTransport } from '../../src';
|
|
10
11
|
import { CustomError } from '../data/error';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025.
|
|
3
|
+
* Author Peter Placzek (tada5hi)
|
|
4
|
+
* For the full copyright and license information,
|
|
5
|
+
* view the LICENSE file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
9
|
+
import swc from 'unplugin-swc';
|
|
10
|
+
import { defineConfig } from 'vitest/config';
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
test: {
|
|
14
|
+
include: ['test/unit/**/*.spec.ts'],
|
|
15
|
+
},
|
|
16
|
+
plugins: [swc.vite()],
|
|
17
|
+
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ObjectLiteral } from '../../../type';
|
|
2
|
-
import type { ComponentHandler, ComponentHandlerFn } from './types';
|
|
3
|
-
export declare class ComponentHandlers {
|
|
4
|
-
protected initializing: boolean;
|
|
5
|
-
protected initialized: boolean;
|
|
6
|
-
protected handlers: Record<string, ComponentHandlerFn | ComponentHandler>;
|
|
7
|
-
constructor();
|
|
8
|
-
mount<K extends string>(key: K, fn: ComponentHandler<K, any> | ComponentHandlerFn<K, any>): void;
|
|
9
|
-
unmount(key: string): void;
|
|
10
|
-
initialize(): Promise<void>;
|
|
11
|
-
execute(key: string, value?: ObjectLiteral, metadata?: ObjectLiteral): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/component/handler/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEpE,qBAAa,iBAAiB;IAC1B,SAAS,CAAC,YAAY,EAAG,OAAO,CAAC;IAEjC,SAAS,CAAC,WAAW,EAAG,OAAO,CAAC;IAEhC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;;IAQ1E,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC;IAIzF,OAAO,CAAC,GAAG,EAAE,MAAM;IAIb,UAAU,IAAK,OAAO,CAAC,IAAI,CAAC;IAuB5B,OAAO,CACT,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,aAAkB,EACzB,QAAQ,GAAE,aAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;CAcpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/queue/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ObjectLiteral } from '../../type';
|
|
2
|
-
export type QueuePayloadError = {
|
|
3
|
-
code: string;
|
|
4
|
-
message: string;
|
|
5
|
-
step?: string | number;
|
|
6
|
-
};
|
|
7
|
-
export type QueuePayload<T extends ObjectLiteral = ObjectLiteral, M extends ObjectLiteral = ObjectLiteral> = {
|
|
8
|
-
data: T;
|
|
9
|
-
metadata: M;
|
|
10
|
-
error?: QueuePayloadError;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/core/queue/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,CACpB,CAAC,SAAS,aAAa,GAAG,aAAa,EACvC,CAAC,SAAS,aAAa,GAAG,aAAa,IACvC;IACA,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/queue/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,YAAY,CAMrE"}
|