@forklaunch/implementation-worker-redis 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/lib/consumers/index.d.mts +19 -0
  2. package/lib/consumers/index.d.ts +19 -2
  3. package/lib/consumers/index.js +71 -1
  4. package/lib/consumers/{redisWorker.consumer.js → index.mjs} +14 -19
  5. package/lib/producers/index.d.mts +15 -0
  6. package/lib/producers/index.d.ts +15 -2
  7. package/lib/producers/index.js +45 -1
  8. package/lib/producers/{redisWorker.producer.js → index.mjs} +7 -6
  9. package/lib/schemas/index.d.mts +18 -0
  10. package/lib/schemas/index.d.ts +18 -2
  11. package/lib/schemas/index.js +1371 -1
  12. package/lib/schemas/index.mjs +1375 -0
  13. package/lib/types/index.d.mts +7 -0
  14. package/lib/types/index.d.ts +7 -2
  15. package/lib/types/index.js +18 -1
  16. package/lib/types/index.mjs +0 -0
  17. package/package.json +5 -4
  18. package/lib/__test__/schemaEquality.test.d.ts +0 -2
  19. package/lib/__test__/schemaEquality.test.d.ts.map +0 -1
  20. package/lib/__test__/schemaEquality.test.js +0 -21
  21. package/lib/consumers/index.d.ts.map +0 -1
  22. package/lib/consumers/redisWorker.consumer.d.ts +0 -31
  23. package/lib/consumers/redisWorker.consumer.d.ts.map +0 -1
  24. package/lib/jest.config.d.ts +0 -4
  25. package/lib/jest.config.d.ts.map +0 -1
  26. package/lib/jest.config.js +0 -19
  27. package/lib/producers/index.d.ts.map +0 -1
  28. package/lib/producers/redisWorker.producer.d.ts +0 -17
  29. package/lib/producers/redisWorker.producer.d.ts.map +0 -1
  30. package/lib/schemas/index.d.ts.map +0 -1
  31. package/lib/schemas/redisWorker.schema.d.ts +0 -64
  32. package/lib/schemas/redisWorker.schema.d.ts.map +0 -1
  33. package/lib/schemas/redisWorker.schema.js +0 -7
  34. package/lib/schemas/typebox/redisWorker.schema.d.ts +0 -42
  35. package/lib/schemas/typebox/redisWorker.schema.d.ts.map +0 -1
  36. package/lib/schemas/typebox/redisWorker.schema.js +0 -6
  37. package/lib/schemas/zod/redisWorker.schema.d.ts +0 -6
  38. package/lib/schemas/zod/redisWorker.schema.d.ts.map +0 -1
  39. package/lib/schemas/zod/redisWorker.schema.js +0 -6
  40. package/lib/tsconfig.tsbuildinfo +0 -1
  41. package/lib/types/index.d.ts.map +0 -1
  42. package/lib/types/redisWorker.types.d.ts +0 -6
  43. package/lib/types/redisWorker.types.d.ts.map +0 -1
  44. package/lib/types/redisWorker.types.js +0 -1
  45. package/lib/vitest.config.d.ts +0 -3
  46. package/lib/vitest.config.d.ts.map +0 -1
  47. package/lib/vitest.config.js +0 -7
@@ -0,0 +1,7 @@
1
+ type RedisWorkerOptions = {
2
+ pageSize: number;
3
+ retries: number;
4
+ interval: number;
5
+ };
6
+
7
+ export type { RedisWorkerOptions };
@@ -1,2 +1,7 @@
1
- export * from './redisWorker.types';
2
- //# sourceMappingURL=index.d.ts.map
1
+ type RedisWorkerOptions = {
2
+ pageSize: number;
3
+ retries: number;
4
+ interval: number;
5
+ };
6
+
7
+ export type { RedisWorkerOptions };
@@ -1 +1,18 @@
1
- export * from './redisWorker.types';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // types/index.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-redis",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Redis implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -38,12 +38,13 @@
38
38
  "lib/**"
39
39
  ],
40
40
  "dependencies": {
41
- "@forklaunch/core": "^0.9.12",
41
+ "@forklaunch/core": "^0.9.13",
42
42
  "@sinclair/typebox": "^0.34.33",
43
43
  "zod": "^3.25.62",
44
- "@forklaunch/interfaces-worker": "0.1.11"
44
+ "@forklaunch/interfaces-worker": "0.2.0"
45
45
  },
46
46
  "devDependencies": {
47
+ "@typescript/native-preview": "7.0.0-dev.20250611.1",
47
48
  "depcheck": "^1.4.7",
48
49
  "eslint": "^9.28.0",
49
50
  "prettier": "^3.5.3",
@@ -51,7 +52,7 @@
51
52
  "typescript-eslint": "^8.34.0"
52
53
  },
53
54
  "scripts": {
54
- "build": "tsc && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
55
+ "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",
55
56
  "clean": "rm -rf lib pnpm.lock.yaml node_modules",
56
57
  "docs": "typedoc --out docs *",
57
58
  "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=schemaEquality.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaEquality.test.d.ts","sourceRoot":"","sources":["../../__test__/schemaEquality.test.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import { isTrue } from '@forklaunch/common';
2
- import { testSchemaEquality } from '@forklaunch/core/test';
3
- import { RedisWorkerOptionsSchema as TypeboxRedisWorkerOptionsSchema } from '../schemas/typebox/redisWorker.schema';
4
- import { RedisWorkerOptionsSchema as ZodRedisWorkerOptionsSchema } from '../schemas/zod/redisWorker.schema';
5
- describe('schema equality', () => {
6
- it('should be equal for bullmq worker', () => {
7
- expect(
8
- isTrue(
9
- testSchemaEquality(
10
- ZodRedisWorkerOptionsSchema,
11
- TypeboxRedisWorkerOptionsSchema,
12
- {
13
- pageSize: 10,
14
- retries: 1,
15
- interval: 1000
16
- }
17
- )
18
- )
19
- ).toBeTruthy();
20
- });
21
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../consumers/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -1,31 +0,0 @@
1
- import { TtlCache } from '@forklaunch/core/cache';
2
- import { WorkerConsumer } from '@forklaunch/interfaces-worker/interfaces';
3
- import {
4
- WorkerEventEntity,
5
- WorkerFailureHandler,
6
- WorkerProcessFunction
7
- } from '@forklaunch/interfaces-worker/types';
8
- import { RedisWorkerOptions } from '../types/redisWorker.types';
9
- export declare class RedisWorkerConsumer<
10
- EventEntity extends WorkerEventEntity,
11
- Options extends RedisWorkerOptions
12
- > implements WorkerConsumer<EventEntity>
13
- {
14
- protected readonly queueName: string;
15
- protected readonly cache: TtlCache;
16
- protected readonly options: Options;
17
- protected readonly processEvents: WorkerProcessFunction<EventEntity>;
18
- protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
19
- constructor(
20
- queueName: string,
21
- cache: TtlCache,
22
- options: Options,
23
- processEvents: WorkerProcessFunction<EventEntity>,
24
- failureHandler: WorkerFailureHandler<EventEntity>
25
- );
26
- private retrieveEvents;
27
- private updateEvents;
28
- peekEvents(): Promise<EventEntity[]>;
29
- start(): Promise<void>;
30
- }
31
- //# sourceMappingURL=redisWorker.consumer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redisWorker.consumer.d.ts","sourceRoot":"","sources":["../../consumers/redisWorker.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAa,mBAAmB,CAC9B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,kBAAkB,CAClC,YAAW,cAAc,CAAC,WAAW,CAAC;IAGpC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM;IACpC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAClC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACnC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC,WAAW,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC;gBAJjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,qBAAqB,CAAC,WAAW,CAAC,EACjD,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC;YAGxD,cAAc;YAUd,YAAY;IAYpB,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAQpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ7B"}
@@ -1,4 +0,0 @@
1
- import type { JestConfigWithTsJest } from 'ts-jest';
2
- declare const jestConfig: JestConfigWithTsJest;
3
- export default jestConfig;
4
- //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAiBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,19 +0,0 @@
1
- const jestConfig = {
2
- preset: 'ts-jest/presets/default-esm', // or other ESM presets
3
- moduleNameMapper: {
4
- '^(\\.{1,2}/.*)\\.js$': '$1'
5
- },
6
- transform: {
7
- // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
8
- // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
9
- '^.+\\.[tj]sx?$': [
10
- 'ts-jest',
11
- {
12
- useESM: true
13
- }
14
- ],
15
- '^.+\\.js$': 'babel-jest'
16
- },
17
- testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
18
- };
19
- export default jestConfig;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../producers/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { TtlCache } from '@forklaunch/core/cache';
2
- import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
3
- import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
4
- import { RedisWorkerOptions } from '../types/redisWorker.types';
5
- export declare class RedisWorkerProducer<
6
- EventEntity extends WorkerEventEntity,
7
- Options extends RedisWorkerOptions
8
- > implements WorkerProducer<EventEntity>
9
- {
10
- private readonly queueName;
11
- private readonly cache;
12
- private readonly options;
13
- constructor(queueName: string, cache: TtlCache, options: Options);
14
- enqueueJob(event: EventEntity): Promise<void>;
15
- enqueueBatchJobs(events: EventEntity[]): Promise<void>;
16
- }
17
- //# sourceMappingURL=redisWorker.producer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redisWorker.producer.d.ts","sourceRoot":"","sources":["../../producers/redisWorker.producer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAa,mBAAmB,CAC9B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,kBAAkB,CAClC,YAAW,cAAc,CAAC,WAAW,CAAC;IAGpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,OAAO;IAG7B,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1,64 +0,0 @@
1
- export declare const RedisWorkerSchemas: <
2
- SchemaValidator extends import('@forklaunch/validator').AnySchemaValidator
3
- >(
4
- options: Record<string, unknown> & {
5
- validator: SchemaValidator;
6
- }
7
- ) => import('@forklaunch/core/mappers').SchemasByValidator<
8
- SchemaValidator,
9
- (options: Record<string, unknown>) => {
10
- pageSize: import('@sinclair/typebox').TTransform<
11
- import('@sinclair/typebox').TUnion<
12
- [
13
- import('@sinclair/typebox').TNumber,
14
- import('@sinclair/typebox').TString,
15
- import('@sinclair/typebox').TBoolean,
16
- import('@sinclair/typebox').TNull,
17
- import('@sinclair/typebox').TBigInt,
18
- import('@sinclair/typebox').TDate
19
- ]
20
- >,
21
- number
22
- >;
23
- retries: import('@sinclair/typebox').TTransform<
24
- import('@sinclair/typebox').TUnion<
25
- [
26
- import('@sinclair/typebox').TNumber,
27
- import('@sinclair/typebox').TString,
28
- import('@sinclair/typebox').TBoolean,
29
- import('@sinclair/typebox').TNull,
30
- import('@sinclair/typebox').TBigInt,
31
- import('@sinclair/typebox').TDate
32
- ]
33
- >,
34
- number
35
- >;
36
- interval: import('@sinclair/typebox').TTransform<
37
- import('@sinclair/typebox').TUnion<
38
- [
39
- import('@sinclair/typebox').TNumber,
40
- import('@sinclair/typebox').TString,
41
- import('@sinclair/typebox').TBoolean,
42
- import('@sinclair/typebox').TNull,
43
- import('@sinclair/typebox').TBigInt,
44
- import('@sinclair/typebox').TDate
45
- ]
46
- >,
47
- number
48
- >;
49
- },
50
- (options: Record<string, unknown>) => {
51
- pageSize: import('zod').ZodEffects<
52
- import('zod').ZodNumber,
53
- number,
54
- unknown
55
- >;
56
- retries: import('zod').ZodEffects<import('zod').ZodNumber, number, unknown>;
57
- interval: import('zod').ZodEffects<
58
- import('zod').ZodNumber,
59
- number,
60
- unknown
61
- >;
62
- }
63
- >;
64
- //# sourceMappingURL=redisWorker.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redisWorker.schema.d.ts","sourceRoot":"","sources":["../../schemas/redisWorker.schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;EAG9B,CAAC"}
@@ -1,7 +0,0 @@
1
- import { serviceSchemaResolver } from '@forklaunch/core/mappers';
2
- import { RedisWorkerOptionsSchema as TypeBoxSchemas } from './typebox/redisWorker.schema';
3
- import { RedisWorkerOptionsSchema as ZodSchemas } from './zod/redisWorker.schema';
4
- export const RedisWorkerSchemas = serviceSchemaResolver(
5
- () => TypeBoxSchemas,
6
- () => ZodSchemas
7
- );
@@ -1,42 +0,0 @@
1
- export declare const RedisWorkerOptionsSchema: {
2
- pageSize: import('@sinclair/typebox').TTransform<
3
- import('@sinclair/typebox').TUnion<
4
- [
5
- import('@sinclair/typebox').TNumber,
6
- import('@sinclair/typebox').TString,
7
- import('@sinclair/typebox').TBoolean,
8
- import('@sinclair/typebox').TNull,
9
- import('@sinclair/typebox').TBigInt,
10
- import('@sinclair/typebox').TDate
11
- ]
12
- >,
13
- number
14
- >;
15
- retries: import('@sinclair/typebox').TTransform<
16
- import('@sinclair/typebox').TUnion<
17
- [
18
- import('@sinclair/typebox').TNumber,
19
- import('@sinclair/typebox').TString,
20
- import('@sinclair/typebox').TBoolean,
21
- import('@sinclair/typebox').TNull,
22
- import('@sinclair/typebox').TBigInt,
23
- import('@sinclair/typebox').TDate
24
- ]
25
- >,
26
- number
27
- >;
28
- interval: import('@sinclair/typebox').TTransform<
29
- import('@sinclair/typebox').TUnion<
30
- [
31
- import('@sinclair/typebox').TNumber,
32
- import('@sinclair/typebox').TString,
33
- import('@sinclair/typebox').TBoolean,
34
- import('@sinclair/typebox').TNull,
35
- import('@sinclair/typebox').TBigInt,
36
- import('@sinclair/typebox').TDate
37
- ]
38
- >,
39
- number
40
- >;
41
- };
42
- //# sourceMappingURL=redisWorker.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redisWorker.schema.d.ts","sourceRoot":"","sources":["../../../schemas/typebox/redisWorker.schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;CAIpC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { number } from '@forklaunch/validator/typebox';
2
- export const RedisWorkerOptionsSchema = {
3
- pageSize: number,
4
- retries: number,
5
- interval: number
6
- };
@@ -1,6 +0,0 @@
1
- export declare const RedisWorkerOptionsSchema: {
2
- pageSize: import('zod').ZodEffects<import('zod').ZodNumber, number, unknown>;
3
- retries: import('zod').ZodEffects<import('zod').ZodNumber, number, unknown>;
4
- interval: import('zod').ZodEffects<import('zod').ZodNumber, number, unknown>;
5
- };
6
- //# sourceMappingURL=redisWorker.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redisWorker.schema.d.ts","sourceRoot":"","sources":["../../../schemas/zod/redisWorker.schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;CAIpC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { number } from '@forklaunch/validator/zod';
2
- export const RedisWorkerOptionsSchema = {
3
- pageSize: number,
4
- retries: number,
5
- interval: number
6
- };