@forklaunch/implementation-worker-redis 0.3.1 → 0.3.3
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/lib/consumers/index.d.mts +27 -13
- package/lib/consumers/index.d.ts +27 -13
- package/lib/consumers/index.js +24 -15
- package/lib/consumers/index.mjs +13 -11
- package/lib/domain/schemas/index.d.mts +62 -0
- package/lib/domain/schemas/index.d.ts +62 -0
- package/lib/{schemas → domain/schemas}/index.js +872 -501
- package/lib/{schemas → domain/schemas}/index.mjs +847 -507
- package/lib/{types → domain/types}/index.d.mts +3 -3
- package/lib/{types → domain/types}/index.d.ts +3 -3
- package/lib/{types → domain/types}/index.js +9 -5
- package/lib/eject/consumers/redisWorker.consumer.ts +1 -1
- package/lib/eject/producers/redisWorker.producer.ts +1 -1
- package/lib/producers/index.d.mts +12 -8
- package/lib/producers/index.d.ts +12 -8
- package/lib/producers/index.js +13 -8
- package/lib/producers/index.mjs +2 -4
- package/package.json +18 -17
- package/lib/schemas/index.d.mts +0 -18
- package/lib/schemas/index.d.ts +0 -18
- /package/lib/{types → domain/types}/index.mjs +0 -0
- /package/lib/eject/{types → domain/types}/index.ts +0 -0
- /package/lib/eject/{types → domain/types}/redisWorker.types.ts +0 -0
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from ===
|
|
7
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
10
|
+
__defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
return to;
|
|
13
16
|
};
|
|
14
|
-
var __toCommonJS = (mod) =>
|
|
17
|
+
var __toCommonJS = (mod) =>
|
|
18
|
+
__copyProps(__defProp({}, '__esModule', { value: true }), mod);
|
|
15
19
|
|
|
16
|
-
// types/index.ts
|
|
20
|
+
// domain/types/index.ts
|
|
17
21
|
var types_exports = {};
|
|
18
22
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
WorkerFailureHandler,
|
|
6
6
|
WorkerProcessFunction
|
|
7
7
|
} from '@forklaunch/interfaces-worker/types';
|
|
8
|
-
import { RedisWorkerOptions } from '../types/redisWorker.types';
|
|
8
|
+
import { RedisWorkerOptions } from '../domain/types/redisWorker.types';
|
|
9
9
|
|
|
10
10
|
export class RedisWorkerConsumer<
|
|
11
11
|
EventEntity extends WorkerEventEntity,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
2
2
|
import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
|
|
3
3
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
4
|
-
import { RedisWorkerOptions } from '../types/redisWorker.types';
|
|
4
|
+
import { RedisWorkerOptions } from '../domain/types/redisWorker.types';
|
|
5
5
|
|
|
6
6
|
export class RedisWorkerProducer<
|
|
7
7
|
EventEntity extends WorkerEventEntity,
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
2
2
|
import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
|
|
3
3
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
4
|
-
import { RedisWorkerOptions } from '../types/index.mjs';
|
|
4
|
+
import { RedisWorkerOptions } from '../domain/types/index.mjs';
|
|
5
5
|
|
|
6
|
-
declare class RedisWorkerProducer<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
declare class RedisWorkerProducer<
|
|
7
|
+
EventEntity extends WorkerEventEntity,
|
|
8
|
+
Options extends RedisWorkerOptions
|
|
9
|
+
> implements WorkerProducer<EventEntity>
|
|
10
|
+
{
|
|
11
|
+
private readonly queueName;
|
|
12
|
+
private readonly cache;
|
|
13
|
+
private readonly options;
|
|
14
|
+
constructor(queueName: string, cache: TtlCache, options: Options);
|
|
15
|
+
enqueueJob(event: EventEntity): Promise<void>;
|
|
16
|
+
enqueueBatchJobs(events: EventEntity[]): Promise<void>;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export { RedisWorkerProducer };
|
package/lib/producers/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
2
2
|
import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
|
|
3
3
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
4
|
-
import { RedisWorkerOptions } from '../types/index.js';
|
|
4
|
+
import { RedisWorkerOptions } from '../domain/types/index.js';
|
|
5
5
|
|
|
6
|
-
declare class RedisWorkerProducer<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
declare class RedisWorkerProducer<
|
|
7
|
+
EventEntity extends WorkerEventEntity,
|
|
8
|
+
Options extends RedisWorkerOptions
|
|
9
|
+
> implements WorkerProducer<EventEntity>
|
|
10
|
+
{
|
|
11
|
+
private readonly queueName;
|
|
12
|
+
private readonly cache;
|
|
13
|
+
private readonly options;
|
|
14
|
+
constructor(queueName: string, cache: TtlCache, options: Options);
|
|
15
|
+
enqueueJob(event: EventEntity): Promise<void>;
|
|
16
|
+
enqueueBatchJobs(events: EventEntity[]): Promise<void>;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export { RedisWorkerProducer };
|
package/lib/producers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -8,14 +8,18 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from ===
|
|
11
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
15
18
|
}
|
|
16
19
|
return to;
|
|
17
20
|
};
|
|
18
|
-
var __toCommonJS = (mod) =>
|
|
21
|
+
var __toCommonJS = (mod) =>
|
|
22
|
+
__copyProps(__defProp({}, '__esModule', { value: true }), mod);
|
|
19
23
|
|
|
20
24
|
// producers/index.ts
|
|
21
25
|
var producers_exports = {};
|
|
@@ -35,11 +39,12 @@ var RedisWorkerProducer = class {
|
|
|
35
39
|
await this.cache.enqueueRecord(this.queueName, event);
|
|
36
40
|
}
|
|
37
41
|
async enqueueBatchJobs(events) {
|
|
38
|
-
console.log(
|
|
42
|
+
console.log('Enqueuing batch jobs', events);
|
|
39
43
|
await this.cache.enqueueBatchRecords(this.queueName, events);
|
|
40
44
|
}
|
|
41
45
|
};
|
|
42
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 &&
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
0 &&
|
|
48
|
+
(module.exports = {
|
|
49
|
+
RedisWorkerProducer
|
|
50
|
+
});
|
package/lib/producers/index.mjs
CHANGED
|
@@ -9,10 +9,8 @@ var RedisWorkerProducer = class {
|
|
|
9
9
|
await this.cache.enqueueRecord(this.queueName, event);
|
|
10
10
|
}
|
|
11
11
|
async enqueueBatchJobs(events) {
|
|
12
|
-
console.log(
|
|
12
|
+
console.log('Enqueuing batch jobs', events);
|
|
13
13
|
await this.cache.enqueueBatchRecords(this.queueName, events);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
export {
|
|
17
|
-
RedisWorkerProducer
|
|
18
|
-
};
|
|
16
|
+
export { RedisWorkerProducer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-worker-redis",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Redis implementation for forklaunch workers",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -26,37 +26,38 @@
|
|
|
26
26
|
"default": "./lib/producers/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./schemas": {
|
|
29
|
-
"types": "./lib/schemas/index.d.ts",
|
|
30
|
-
"import": "./lib/schemas/index.mjs",
|
|
31
|
-
"require": "./lib/schemas/index.js",
|
|
32
|
-
"default": "./lib/schemas/index.js"
|
|
29
|
+
"types": "./lib/domain/schemas/index.d.ts",
|
|
30
|
+
"import": "./lib/domain/schemas/index.mjs",
|
|
31
|
+
"require": "./lib/domain/schemas/index.js",
|
|
32
|
+
"default": "./lib/domain/schemas/index.js"
|
|
33
33
|
},
|
|
34
34
|
"./types": {
|
|
35
|
-
"types": "./lib/types/index.d.ts",
|
|
36
|
-
"import": "./lib/types/index.mjs",
|
|
37
|
-
"require": "./lib/types/index.js",
|
|
38
|
-
"default": "./lib/types/index.js"
|
|
35
|
+
"types": "./lib/domain/types/index.d.ts",
|
|
36
|
+
"import": "./lib/domain/types/index.mjs",
|
|
37
|
+
"require": "./lib/domain/types/index.js",
|
|
38
|
+
"default": "./lib/domain/types/index.js"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"lib/**"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@forklaunch/core": "^0.9.
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
45
|
+
"@forklaunch/core": "^0.9.21",
|
|
46
|
+
"@forklaunch/internal": "^0.0.7",
|
|
47
|
+
"@sinclair/typebox": "^0.34.35",
|
|
48
|
+
"zod": "^3.25.67",
|
|
49
|
+
"@forklaunch/interfaces-worker": "0.2.2"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
52
|
+
"@typescript/native-preview": "7.0.0-dev.20250619.1",
|
|
52
53
|
"depcheck": "^1.4.7",
|
|
53
|
-
"eslint": "^9.
|
|
54
|
+
"eslint": "^9.29.0",
|
|
54
55
|
"prettier": "^3.5.3",
|
|
55
56
|
"typedoc": "^0.28.5",
|
|
56
|
-
"typescript-eslint": "^8.34.
|
|
57
|
+
"typescript-eslint": "^8.34.1"
|
|
57
58
|
},
|
|
58
59
|
"scripts": {
|
|
59
|
-
"build": "tsc --noEmit && tsup producers/index.ts consumers/index.ts schemas/index.ts types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|
|
60
|
+
"build": "tsc --noEmit && tsup producers/index.ts consumers/index.ts domain/schemas/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|
|
60
61
|
"clean": "rm -rf lib pnpm.lock.yaml node_modules",
|
|
61
62
|
"docs": "typedoc --out docs *",
|
|
62
63
|
"format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
|
package/lib/schemas/index.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as _forklaunch_core_mappers from '@forklaunch/core/mappers';
|
|
2
|
-
import * as zod from 'zod';
|
|
3
|
-
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
-
import * as _forklaunch_validator from '@forklaunch/validator';
|
|
5
|
-
|
|
6
|
-
declare const RedisWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
|
|
7
|
-
validator: SchemaValidator;
|
|
8
|
-
}) => _forklaunch_core_mappers.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
|
|
9
|
-
pageSize: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
10
|
-
retries: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
11
|
-
interval: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
12
|
-
}, (options: Record<string, unknown>) => {
|
|
13
|
-
pageSize: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
14
|
-
retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
15
|
-
interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export { RedisWorkerSchemas };
|
package/lib/schemas/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as _forklaunch_core_mappers from '@forklaunch/core/mappers';
|
|
2
|
-
import * as zod from 'zod';
|
|
3
|
-
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
-
import * as _forklaunch_validator from '@forklaunch/validator';
|
|
5
|
-
|
|
6
|
-
declare const RedisWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
|
|
7
|
-
validator: SchemaValidator;
|
|
8
|
-
}) => _forklaunch_core_mappers.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
|
|
9
|
-
pageSize: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
10
|
-
retries: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
11
|
-
interval: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
|
|
12
|
-
}, (options: Record<string, unknown>) => {
|
|
13
|
-
pageSize: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
14
|
-
retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
15
|
-
interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export { RedisWorkerSchemas };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|