@nightx.co/pulsar 0.0.0-stage → 1.0.16

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 (163) hide show
  1. package/LICENSE +207 -0
  2. package/README.md +14 -2
  3. package/dist/chunk-3sg08kqp.js +10 -0
  4. package/dist/chunk-3sg08kqp.js.map +9 -0
  5. package/dist/chunk-a9kye38b.js +54 -0
  6. package/dist/chunk-a9kye38b.js.map +12 -0
  7. package/dist/chunk-cpn1qh4e.js +10 -0
  8. package/dist/chunk-cpn1qh4e.js.map +12 -0
  9. package/dist/chunk-rrj8rm04.js +10 -0
  10. package/dist/chunk-rrj8rm04.js.map +11 -0
  11. package/dist/cluster/Nebula.d.ts +30 -0
  12. package/dist/cluster/Nebula.d.ts.map +1 -0
  13. package/dist/helpers/computeConfigDelta.d.ts +18 -0
  14. package/dist/helpers/computeConfigDelta.d.ts.map +1 -0
  15. package/dist/helpers/defineQueue.d.ts +13 -0
  16. package/dist/helpers/defineQueue.d.ts.map +1 -0
  17. package/dist/helpers/generateShaHash.d.ts +2 -0
  18. package/dist/helpers/generateShaHash.d.ts.map +1 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +50 -0
  23. package/dist/integrations/PulsarEventsIntegrations.d.ts +7 -0
  24. package/dist/integrations/PulsarEventsIntegrations.d.ts.map +1 -0
  25. package/dist/integrations/PulsarLoggerIntegrations.d.ts +12 -0
  26. package/dist/integrations/PulsarLoggerIntegrations.d.ts.map +1 -0
  27. package/dist/integrations/index.d.ts +4 -0
  28. package/dist/integrations/index.d.ts.map +1 -0
  29. package/dist/integrations/index.js +8 -0
  30. package/dist/integrations/index.js.map +11 -0
  31. package/dist/modules/Queue.module.d.ts +45 -0
  32. package/dist/modules/Queue.module.d.ts.map +1 -0
  33. package/dist/modules/Scheduler.module.d.ts +42 -0
  34. package/dist/modules/Scheduler.module.d.ts.map +1 -0
  35. package/dist/modules/Tick.module.d.ts +35 -0
  36. package/dist/modules/Tick.module.d.ts.map +1 -0
  37. package/dist/modules/TickController.module.d.ts +36 -0
  38. package/dist/modules/TickController.module.d.ts.map +1 -0
  39. package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts +2 -0
  40. package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts.map +1 -0
  41. package/dist/monitoring/index.d.ts +2 -0
  42. package/dist/monitoring/index.d.ts.map +1 -0
  43. package/dist/monitoring/server/PulsarMonitoringStream.d.ts +2 -0
  44. package/dist/monitoring/server/PulsarMonitoringStream.d.ts.map +1 -0
  45. package/dist/network/NetworkInterface.d.ts +13 -0
  46. package/dist/network/NetworkInterface.d.ts.map +1 -0
  47. package/dist/network/UnifiedTransportManager.d.ts +21 -0
  48. package/dist/network/UnifiedTransportManager.d.ts.map +1 -0
  49. package/dist/network/abstract/BaseNetworkDriver.d.ts +17 -0
  50. package/dist/network/abstract/BaseNetworkDriver.d.ts.map +1 -0
  51. package/dist/network/auth/Authenticator.d.ts +2 -0
  52. package/dist/network/auth/Authenticator.d.ts.map +1 -0
  53. package/dist/network/drivers/HttpNetworkDriver.d.ts +31 -0
  54. package/dist/network/drivers/HttpNetworkDriver.d.ts.map +1 -0
  55. package/dist/network/drivers/WebSocketNetworkDriver.d.ts +23 -0
  56. package/dist/network/drivers/WebSocketNetworkDriver.d.ts.map +1 -0
  57. package/dist/network/helpers/httpQueueOperations.d.ts +2 -0
  58. package/dist/network/helpers/httpQueueOperations.d.ts.map +1 -0
  59. package/dist/network/interfaces/network.types.d.ts +13 -0
  60. package/dist/network/interfaces/network.types.d.ts.map +1 -0
  61. package/dist/run/Queues.d.ts +2 -0
  62. package/dist/run/Queues.d.ts.map +1 -0
  63. package/dist/run/index.d.ts +2 -0
  64. package/dist/run/index.d.ts.map +1 -0
  65. package/dist/run/index2.d.ts +2 -0
  66. package/dist/run/index2.d.ts.map +1 -0
  67. package/dist/runtimes/IsolateRuntime.d.ts +17 -0
  68. package/dist/runtimes/IsolateRuntime.d.ts.map +1 -0
  69. package/dist/runtimes/PersistentRuntime.d.ts +22 -0
  70. package/dist/runtimes/PersistentRuntime.d.ts.map +1 -0
  71. package/dist/runtimes/ServerlessRuntime.d.ts +15 -0
  72. package/dist/runtimes/ServerlessRuntime.d.ts.map +1 -0
  73. package/dist/runtimes/runtimeTypes.d.ts +15 -0
  74. package/dist/runtimes/runtimeTypes.d.ts.map +1 -0
  75. package/dist/server/PulsarRequestHandler.d.ts +41 -0
  76. package/dist/server/PulsarRequestHandler.d.ts.map +1 -0
  77. package/dist/server/helpers/acquireRedisLock.d.ts +14 -0
  78. package/dist/server/helpers/acquireRedisLock.d.ts.map +1 -0
  79. package/dist/server/helpers/checkFencingValidity.d.ts +14 -0
  80. package/dist/server/helpers/checkFencingValidity.d.ts.map +1 -0
  81. package/dist/server/helpers/performIsolateRestart.d.ts +20 -0
  82. package/dist/server/helpers/performIsolateRestart.d.ts.map +1 -0
  83. package/dist/server/index.d.ts +2 -0
  84. package/dist/server/index.d.ts.map +1 -0
  85. package/dist/server/index.js +8 -0
  86. package/dist/server/index.js.map +13 -0
  87. package/dist/server/parser/parseRequest.d.ts +10 -0
  88. package/dist/server/parser/parseRequest.d.ts.map +1 -0
  89. package/dist/server/utility/extract-headers.d.ts +14 -0
  90. package/dist/server/utility/extract-headers.d.ts.map +1 -0
  91. package/dist/service/ConfigurationStore.d.ts +23 -0
  92. package/dist/service/ConfigurationStore.d.ts.map +1 -0
  93. package/dist/service/Isolate.service.d.ts +12 -0
  94. package/dist/service/Isolate.service.d.ts.map +1 -0
  95. package/dist/service/Pulsar.service.d.ts +41 -0
  96. package/dist/service/Pulsar.service.d.ts.map +1 -0
  97. package/dist/service/PulsarBaseService.d.ts +49 -0
  98. package/dist/service/PulsarBaseService.d.ts.map +1 -0
  99. package/dist/service/PulsarEventBus.d.ts +36 -0
  100. package/dist/service/PulsarEventBus.d.ts.map +1 -0
  101. package/dist/service/SwarmBudgetTracker.d.ts +14 -0
  102. package/dist/service/SwarmBudgetTracker.d.ts.map +1 -0
  103. package/dist/service/consumers/PulsarWorker.d.ts +10 -0
  104. package/dist/service/consumers/PulsarWorker.d.ts.map +1 -0
  105. package/dist/shared/PulsarRuntimeCore.d.ts +55 -0
  106. package/dist/shared/PulsarRuntimeCore.d.ts.map +1 -0
  107. package/dist/static/TimingProfile.d.ts +9 -0
  108. package/dist/static/TimingProfile.d.ts.map +1 -0
  109. package/dist/static/static.d.ts +3 -0
  110. package/dist/static/static.d.ts.map +1 -0
  111. package/dist/storage/PulsarStorage.d.ts +42 -0
  112. package/dist/storage/PulsarStorage.d.ts.map +1 -0
  113. package/dist/storage/drivers/PostgresDriver.d.ts +20 -0
  114. package/dist/storage/drivers/PostgresDriver.d.ts.map +1 -0
  115. package/dist/storage/drivers/RedisDriver.d.ts +20 -0
  116. package/dist/storage/drivers/RedisDriver.d.ts.map +1 -0
  117. package/dist/storage/drivers/types.d.ts +27 -0
  118. package/dist/storage/drivers/types.d.ts.map +1 -0
  119. package/dist/storage/index.d.ts +4 -0
  120. package/dist/storage/index.d.ts.map +1 -0
  121. package/dist/storage/index.js +403 -0
  122. package/dist/storage/index.js.map +21 -0
  123. package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts +39 -0
  124. package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts.map +1 -0
  125. package/dist/storage/repositories/PostgresQueueRepository.d.ts +26 -0
  126. package/dist/storage/repositories/PostgresQueueRepository.d.ts.map +1 -0
  127. package/dist/storage/repositories/QueueRepository.d.ts +20 -0
  128. package/dist/storage/repositories/QueueRepository.d.ts.map +1 -0
  129. package/dist/storage/repositories/RedisQueueRepository.d.ts +28 -0
  130. package/dist/storage/repositories/RedisQueueRepository.d.ts.map +1 -0
  131. package/dist/subsys/DeferredTickEvaluator.d.ts +23 -0
  132. package/dist/subsys/DeferredTickEvaluator.d.ts.map +1 -0
  133. package/dist/subsys/EventBus.d.ts +13 -0
  134. package/dist/subsys/EventBus.d.ts.map +1 -0
  135. package/dist/subsys/ExecutionProfileSwitcher.d.ts +10 -0
  136. package/dist/subsys/ExecutionProfileSwitcher.d.ts.map +1 -0
  137. package/dist/subsys/LoggerService.d.ts +15 -0
  138. package/dist/subsys/LoggerService.d.ts.map +1 -0
  139. package/dist/subsys/PulsarClock.d.ts +32 -0
  140. package/dist/subsys/PulsarClock.d.ts.map +1 -0
  141. package/dist/subsys/RuntimeCacheStorage.d.ts +18 -0
  142. package/dist/subsys/RuntimeCacheStorage.d.ts.map +1 -0
  143. package/dist/subsys/RuntimeEventBridge.d.ts +16 -0
  144. package/dist/subsys/RuntimeEventBridge.d.ts.map +1 -0
  145. package/dist/types/base.types.d.ts +65 -0
  146. package/dist/types/base.types.d.ts.map +1 -0
  147. package/dist/types/config.types.d.ts +56 -0
  148. package/dist/types/config.types.d.ts.map +1 -0
  149. package/dist/types/consumer.types.d.ts +72 -0
  150. package/dist/types/consumer.types.d.ts.map +1 -0
  151. package/dist/types/engine.types.d.ts +139 -0
  152. package/dist/types/engine.types.d.ts.map +1 -0
  153. package/dist/types/eventTriggerStrategry.types.d.ts +34 -0
  154. package/dist/types/eventTriggerStrategry.types.d.ts.map +1 -0
  155. package/dist/types/integrations.types.d.ts +16 -0
  156. package/dist/types/integrations.types.d.ts.map +1 -0
  157. package/dist/types/nebula.types.d.ts +65 -0
  158. package/dist/types/nebula.types.d.ts.map +1 -0
  159. package/dist/types/queue.types.d.ts +106 -0
  160. package/dist/types/queue.types.d.ts.map +1 -0
  161. package/dist/types/runtime.types.d.ts +89 -0
  162. package/dist/types/runtime.types.d.ts.map +1 -0
  163. package/package.json +71 -5
@@ -0,0 +1,39 @@
1
+ import { PostgresDriver } from "../drivers/PostgresDriver.d.ts";
2
+ import type { EngineQueuesConfig } from "../../types/queue.types.d.ts";
3
+ import type { IConfigurationObject, IConfigSyncResult } from "../../types/config.types.d.ts";
4
+ export interface IPulsarPostgresEngineOperationRepository {
5
+ addRestart(queues: EngineQueuesConfig[]): Promise<void>;
6
+ deleteRestart(queue: string): Promise<void>;
7
+ checkFencingTokenValidity(queue: string, token: string | number): Promise<boolean>;
8
+ verifyAndSyncConfiguration(host: string, instanceId: string, url: string, configurations: IConfigurationObject): Promise<IConfigSyncResult>;
9
+ subscribeToDatabaseEvents<T extends unknown>(channel: string, onEvent: (event: T) => Promise<void>, onListen?: () => void): Promise<void>;
10
+ getPollingQueueEntries(queueName: string, limit: number): Promise<Array<IPoolQueueEntry>>;
11
+ deletePollingQueueEntry(id: number): Promise<void>;
12
+ }
13
+ export interface IPoolQueueEntry {
14
+ id: number;
15
+ queue: string;
16
+ payload: {
17
+ queue_name: string;
18
+ fencing_token: number;
19
+ execution_at: string;
20
+ };
21
+ created_at: string;
22
+ }
23
+ export declare class PostgresEngineOperationRepository implements IPulsarPostgresEngineOperationRepository {
24
+ private driver;
25
+ private readonly logger;
26
+ constructor(driver: PostgresDriver);
27
+ private get sql();
28
+ addRestart(queues: EngineQueuesConfig[]): Promise<void>;
29
+ updateRestartOwnership(queue: string | null | undefined, owner: string): Promise<void>;
30
+ deleteRestart(queue: string | '__GLOBAL__'): Promise<void>;
31
+ pingHealthCheck(): Promise<void>;
32
+ checkFencingTokenValidity(queue: string, token: string | number): Promise<boolean>;
33
+ verifyAndSyncConfiguration(host: 'PULSAR_STANDALONE' | 'NEBULA_CLUSTER', instanceId: string, url: string, configurations: IConfigurationObject): Promise<IConfigSyncResult>;
34
+ private synchronizeQueueTriggers;
35
+ subscribeToDatabaseEvents<T extends unknown>(channel: string, onEvent: (event: T) => Promise<void>, onListen?: () => void): Promise<void>;
36
+ getPollingQueueEntries(queueName: string, limit?: number): Promise<Array<IPoolQueueEntry>>;
37
+ deletePollingQueueEntry(id: number): Promise<void>;
38
+ }
39
+ //# sourceMappingURL=PostgresEngineOperationRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgresEngineOperationRepository.d.ts","sourceRoot":"","sources":["../../../src/storage/repositories/PostgresEngineOperationRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAM9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAG3F,MAAM,WAAW,wCAAwC;IACrD,UAAU,CAAC,MAAM,EAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,yBAAyB,CAAC,KAAK,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtF,0BAA0B,CAAC,IAAI,EAAG,MAAM,EAAE,UAAU,EAAG,MAAM,EAAE,GAAG,EAAG,MAAM,EAAE,cAAc,EAAG,oBAAoB,GAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACjJ,yBAAyB,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,CAAC,KAAK,EAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9I,sBAAsB,CAAC,SAAS,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAC7F,uBAAuB,CAAC,EAAE,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAG,MAAM,CAAC;IACZ,KAAK,EAAG,MAAM,CAAC;IACf,OAAO,EAAG;QACN,UAAU,EAAG,MAAM,CAAC;QACpB,aAAa,EAAG,MAAM,CAAC;QACvB,YAAY,EAAG,MAAM,CAAC;KACzB,CAAC;IACF,UAAU,EAAG,MAAM,CAAC;CACvB;AAED,qBAAa,iCAAkC,YAAW,wCAAwC;IAGlF,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEd,MAAM,EAAG,cAAc;IAI3C,OAAO,KAAK,GAAG,GAEd;IAEK,UAAU,CAAC,MAAM,EAAG,kBAAkB,EAAE;IAiCxC,sBAAsB,CAAC,KAAK,EAAG,MAAM,GAAG,IAAI,YAAO,EAAE,KAAK,EAAG,MAAM;IAYnE,aAAa,CAAC,KAAK,EAAG,MAAM,GAAG,YAAY;IAO3C,eAAe;IAUf,yBAAyB,CAAC,KAAK,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAG,MAAM;IAmBjE,0BAA0B,CAAE,IAAI,EAAG,mBAAmB,GAAG,gBAAgB,EAAE,UAAU,EAAG,MAAM,EAAE,GAAG,EAAG,MAAM,EAAE,cAAc,EAAG,oBAAoB,GAAI,OAAO,CAAC,iBAAiB,CAAC;YAkDzK,wBAAwB;IAgDhC,yBAAyB,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,CAAC,KAAK,EAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;IAY5H,sBAAsB,CAAC,SAAS,EAAG,MAAM,EAAE,KAAK,GAAG,MAAW,GAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAajG,uBAAuB,CAAC,EAAE,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;CAM7D"}
@@ -0,0 +1,26 @@
1
+ import type { PostgresDriver } from "../drivers/PostgresDriver.d.ts";
2
+ import type { IBatchCandidate } from "../../modules/Tick.module.d.ts";
3
+ import { BaseQueueRepository } from "./QueueRepository.d.ts";
4
+ export declare class PostgresQueueRepository extends BaseQueueRepository {
5
+ private readonly driver;
6
+ constructor(driver: PostgresDriver);
7
+ private get sql();
8
+ private get prefix();
9
+ registerWorker(queue: string, candidateBatches: IBatchCandidate[], concurrency: number, globalMaxConcurrency?: number): Promise<string[]>;
10
+ deregisterWorker(workerId: string, queue: string): Promise<void>;
11
+ getActiveWorkersCount(queue: string): Promise<number>;
12
+ setFutureSchedule(queue: string, scheduleAt: string): Promise<void>;
13
+ getGlobalActiveWorkersCount(): Promise<number>;
14
+ refundGlobalJobBudget(amount: number, window: string): Promise<void>;
15
+ private budgetKeyPrefix;
16
+ claimGlobalJobBudget(requested: number, maxGlobalJobsPerTick: number): Promise<{
17
+ granted: number;
18
+ window: string;
19
+ }>;
20
+ acquireQueueLock(lockKey: string, ownerId: string, ttlMs: number): Promise<boolean>;
21
+ releaseQueueLock(lockKey: string, ownerId: string): Promise<boolean>;
22
+ evaluateDeadRun(queueName: string, poolerType: "interval-driven-pooler" | "event-driven-pooler", totalJobs: number, continuationOwnerId: string, dispatchTtlMs?: number, idpLockKey?: string, edpLockPrefix?: string): Promise<boolean>;
23
+ clearDispatchPending(lockKey: string): Promise<void>;
24
+ getStopSignal(): Promise<boolean>;
25
+ }
26
+ //# sourceMappingURL=PostgresQueueRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgresQueueRepository.d.ts","sourceRoot":"","sources":["../../../src/storage/repositories/PostgresQueueRepository.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAM3D,qBAAa,uBAAwB,SAAQ,mBAAmB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAG,cAAc;IAKpD,OAAO,KAAK,GAAG,GAEd;IAED,OAAO,KAAK,MAAM,GAKjB;IAEc,cAAc,CAAE,KAAK,EAAG,MAAM,EAAE,gBAAgB,EAAG,eAAe,EAAE,EAAE,WAAW,EAAG,MAAM,EAAE,oBAAoB,GAAG,MAAiB;IAyBpI,gBAAgB,CAAC,QAAQ,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM;IAclD,qBAAqB,CAAC,KAAK,EAAG,MAAM;IAYpC,iBAAiB,CAAC,KAAK,EAAG,MAAM,EAAE,UAAU,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;IAWtE,2BAA2B;IAY3B,qBAAqB,CAAC,MAAM,EAAG,MAAM,EAAE,MAAM,EAAG,MAAM;IAYrE,OAAO,CAAC,eAAe;IAIR,oBAAoB,CAAC,SAAS,EAAG,MAAM,EAAE,oBAAoB,EAAG,MAAM;;;;IAgDtE,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBtF,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAetE,eAAe,CAC1B,SAAS,EAAG,MAAM,EAClB,UAAU,EAAG,wBAAwB,GAAG,qBAAqB,EAC7D,SAAS,EAAG,MAAM,EAClB,mBAAmB,EAAG,MAAM,EAC5B,aAAa,GAAG,MAAc,EAC9B,UAAU,GAAG,MAAmB,EAChC,aAAa,GAAG,MAAoB,GACpC,OAAO,CAAC,OAAO,CAAC;IAuDL,oBAAoB,CAAC,OAAO,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;IAStD,aAAa,IAAK,OAAO,CAAC,OAAO,CAAC;CAGpD"}
@@ -0,0 +1,20 @@
1
+ import type { IBatchCandidate } from "../../modules/Tick.module";
2
+ export declare abstract class BaseQueueRepository {
3
+ abstract getActiveWorkersCount(queue: string): Promise<number>;
4
+ abstract getGlobalActiveWorkersCount(): Promise<number>;
5
+ abstract registerWorker(queue: string, candidateBatches: IBatchCandidate[], concurrency: number, globalMaxConcurrency: number): Promise<string[]>;
6
+ abstract deregisterWorker(workerId: string, queue: string): Promise<void>;
7
+ abstract claimGlobalJobBudget(requested: number, maxGlobalJobsPerTick: number): Promise<{
8
+ granted: number;
9
+ window: string;
10
+ }>;
11
+ abstract refundGlobalJobBudget(amount: number, window: string): Promise<void>;
12
+ abstract acquireQueueLock(lockKey: string, ownerId: string, ttlMs: number): Promise<boolean>;
13
+ abstract releaseQueueLock(lockKey: string, ownerId: string): Promise<boolean>;
14
+ abstract evaluateDeadRun(queueName: string, poolerType: "interval-driven-pooler" | "event-driven-pooler", totalJobs: number, continuationOwnerId: string, dispatchTtlMs: number, idpLockKey?: string, edpLockPrefix?: string): Promise<boolean>;
15
+ abstract clearDispatchPending(lockKey: string): Promise<void>;
16
+ abstract setFutureSchedule(queue: string, scheduleAt: string): Promise<void>;
17
+ abstract getStopSignal(queue: string): Promise<boolean>;
18
+ }
19
+ export type IQueueRepository = BaseQueueRepository;
20
+ //# sourceMappingURL=QueueRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueRepository.d.ts","sourceRoot":"","sources":["../../../src/storage/repositories/QueueRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,8BAAsB,mBAAmB;aACrB,qBAAqB,CAAC,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,MAAM,CAAC;aACvD,2BAA2B,IAAM,OAAO,CAAC,MAAM,CAAC;aAEhD,cAAc,CAAC,KAAK,EAAG,MAAM,EAAE,gBAAgB,EAAG,eAAe,EAAE,EAAE,WAAW,EAAG,MAAM,EAAE,oBAAoB,EAAG,MAAM,GAAI,OAAO,CAAC,MAAM,EAAE,CAAC;aAC7I,gBAAgB,CAAC,QAAQ,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;aAEnE,oBAAoB,CAAC,SAAS,EAAG,MAAM,EAAE,oBAAoB,EAAG,MAAM,GAAI,OAAO,CAAC;QAAE,OAAO,EAAG,MAAM,CAAC;QAAC,MAAM,EAAG,MAAM,CAAA;KAAE,CAAC;aACxH,qBAAqB,CAAC,MAAM,EAAG,MAAM,EAAE,MAAM,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;aAEvE,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;aACvF,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;aAEvE,eAAe,CAC3B,SAAS,EAAG,MAAM,EAClB,UAAU,EAAG,wBAAwB,GAAG,qBAAqB,EAC7D,SAAS,EAAG,MAAM,EAClB,mBAAmB,EAAG,MAAM,EAC5B,aAAa,EAAG,MAAM,EACtB,UAAU,CAAC,EAAG,MAAM,EACpB,aAAa,CAAC,EAAG,MAAM,GACvB,OAAO,CAAC,OAAO,CAAC;aAEJ,oBAAoB,CAAC,OAAO,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;aAEtD,iBAAiB,CAAC,KAAK,EAAG,MAAM,EAAE,UAAU,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;aAEtE,aAAa,CAAC,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;CACnE;AAED,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { RedisDriver } from "../drivers/RedisDriver.d.ts";
2
+ import type { IBatchCandidate } from "../../modules/Tick.module.d.ts";
3
+ import { BaseQueueRepository } from "./QueueRepository.d.ts";
4
+ export declare class RedisQueueRepository extends BaseQueueRepository {
5
+ private readonly driver;
6
+ private protocol;
7
+ constructor(driver: RedisDriver);
8
+ private get redis();
9
+ private get prefix();
10
+ registerWorker(queue: string, candidateBatches: IBatchCandidate[], concurrency: number, globalMaxConcurrency?: number): Promise<string[]>;
11
+ deregisterWorker(workerId: string, queue: string): Promise<void>;
12
+ getActiveWorkersCount(queue: string): Promise<number>;
13
+ getGlobalActiveWorkersCount(): Promise<number>;
14
+ setFutureSchedule(queue: string, scheduleAt: string): Promise<void>;
15
+ private budgetKeyPrefix;
16
+ claimGlobalJobBudget(requested: number, maxGlobalJobsPerTick: number): Promise<{
17
+ granted: number;
18
+ window: string;
19
+ }>;
20
+ refundGlobalJobBudget(amount: number, window: string): Promise<void>;
21
+ acquireQueueLock(lockKey: string, ownerId: string, ttlMs: number): Promise<boolean>;
22
+ releaseQueueLock(lockKey: string, ownerId: string): Promise<boolean>;
23
+ clearDispatchPending(lockKey: string): Promise<void>;
24
+ evaluateDeadRun(queueName: string, poolerType: "interval-driven-pooler" | "event-driven-pooler", totalJobs: number, continuationOwnerId: string, dispatchTtlMs?: number, idpLockKey?: string, edpLockPrefix?: string): Promise<boolean>;
25
+ private evalScript;
26
+ getStopSignal(queue: string): Promise<boolean>;
27
+ }
28
+ //# sourceMappingURL=RedisQueueRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedisQueueRepository.d.ts","sourceRoot":"","sources":["../../../src/storage/repositories/RedisQueueRepository.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAWpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAK3D,qBAAa,oBAAqB,SAAQ,mBAAmB;IAG7C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAkB;gBAEL,MAAM,EAAG,WAAW;IAMjD,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,KAAK,MAAM,GAKjB;IAEc,cAAc,CAAE,KAAK,EAAG,MAAM,EAAE,gBAAgB,EAAG,eAAe,EAAE,EAAE,WAAW,EAAG,MAAM,EAAE,oBAAoB,GAAG,MAAiB;IAoCpI,gBAAgB,CAAC,QAAQ,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM;IAalD,qBAAqB,CAAC,KAAK,EAAG,MAAM;IAMpC,2BAA2B;IAM3B,iBAAiB,CAAC,KAAK,EAAG,MAAM,EAAE,UAAU,EAAG,MAAM;IAKpE,OAAO,CAAC,eAAe;IAIR,oBAAoB,CAAC,SAAS,EAAG,MAAM,EAAE,oBAAoB,EAAG,MAAM;;;;IAetE,qBAAqB,CAAC,MAAM,EAAG,MAAM,EAAE,MAAM,EAAG,MAAM;IAOtD,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;IAKvF,gBAAgB,CAAC,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;IAKvE,oBAAoB,CAAC,OAAO,EAAG,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;IAKtD,eAAe,CAC1B,SAAS,EAAG,MAAM,EAClB,UAAU,EAAG,wBAAwB,GAAG,qBAAqB,EAC7D,SAAS,EAAG,MAAM,EAClB,mBAAmB,EAAG,MAAM,EAC5B,aAAa,GAAG,MAAc,EAC9B,UAAU,GAAG,MAAmB,EAChC,aAAa,GAAG,MAAoB,GACpC,OAAO,CAAC,OAAO,CAAC;YAiBN,UAAU;IAST,aAAa,CAAC,KAAK,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;CAMlE"}
@@ -0,0 +1,23 @@
1
+ import type { PulsarEventBus } from "../service/PulsarEventBus";
2
+ import type { PulsarClock } from "./PulsarClock";
3
+ import type { Scheduler } from "../modules/Scheduler.module";
4
+ import type { ILogger } from "./LoggerService";
5
+ import type { EngineQueuesConfig } from "@package/src/types/queue.types";
6
+ export declare class DeferredTickEvaluator {
7
+ private minBootRequirementSec;
8
+ private scheduler;
9
+ private events;
10
+ private clock;
11
+ private logger;
12
+ constructor(minBootRequirementSec: number, scheduler: Scheduler, events: PulsarEventBus, clock: PulsarClock, logger: ILogger);
13
+ private timers;
14
+ private watchdogTimer;
15
+ private isShutdownTriggered;
16
+ evaluateUpcomingDelayedNext(upcomingTimeMs: number, queue: string): void;
17
+ private startDelayedSleepWatchdog;
18
+ private triggerGracefulShutdown;
19
+ stopRuntimeWatchdog(): void;
20
+ clearTimer(queue: string): void;
21
+ forceExecuteTickLater(queue: EngineQueuesConfig, targetTimestamp: number): void;
22
+ }
23
+ //# sourceMappingURL=DeferredTickEvaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeferredTickEvaluator.d.ts","sourceRoot":"","sources":["../../src/subsys/DeferredTickEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,qBAAqB;IAE1B,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;gBAJN,qBAAqB,EAAG,MAAM,EAC9B,SAAS,EAAG,SAAS,EACrB,MAAM,EAAG,cAAc,EACvB,KAAK,EAAG,WAAW,EACnB,MAAM,EAAG,OAAO;IAG5B,OAAO,CAAC,MAAM,CAAoD;IAClE,OAAO,CAAC,aAAa,CAAgD;IACrE,OAAO,CAAC,mBAAmB,CAAS;IAE7B,2BAA2B,CAAC,cAAc,EAAG,MAAM,EAAE,KAAK,EAAG,MAAM;IAwB1E,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,uBAAuB;IAcxB,mBAAmB;IAOnB,UAAU,CAAC,KAAK,EAAG,MAAM;IASzB,qBAAqB,CAAC,KAAK,EAAG,kBAAkB,EAAE,eAAe,EAAG,MAAM;CAyBpF"}
@@ -0,0 +1,13 @@
1
+ type EventCallback<T = any> = (payload: T) => void;
2
+ export type AppModule = () => void;
3
+ export declare class EventBus {
4
+ private events;
5
+ private globalListeners;
6
+ get listenerCount(): number;
7
+ on(event: string, callback: EventCallback): void;
8
+ off(event: string, callback: EventCallback): void;
9
+ emit<T>(event: string, payload: T): void;
10
+ }
11
+ declare const AppEvents: EventBus;
12
+ export default AppEvents;
13
+ //# sourceMappingURL=EventBus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../../src/subsys/EventBus.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC;AAEnC,qBAAa,QAAQ;IACjB,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,eAAe,CAAuB;IAE9C,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa;IAgBzC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa;IAW1C,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;CAMpC;AAED,QAAA,MAAM,SAAS,UAAiB,CAAC;AAEjC,eAAe,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { EngineQueuesConfig } from "../types/queue.types";
2
+ import type { ILogger } from "./LoggerService";
3
+ export declare class ExecutionProfileSwitcher {
4
+ private logger;
5
+ private transitionItems;
6
+ constructor(logger: ILogger);
7
+ transitionToIdleMode({ queue, stateTransitionPolicy }: EngineQueuesConfig): void;
8
+ transitionToActiveMode({ queue, profile, stateTransitionPolicy }: EngineQueuesConfig): void;
9
+ }
10
+ //# sourceMappingURL=ExecutionProfileSwitcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionProfileSwitcher.d.ts","sourceRoot":"","sources":["../../src/subsys/ExecutionProfileSwitcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI/C,qBAAa,wBAAwB;IAGrB,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,eAAe,CAAqB;gBAExB,MAAM,EAAG,OAAO;IAEpC,oBAAoB,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,EAAG,kBAAkB;IAuB1E,sBAAsB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,EAAG,kBAAkB;CASxF"}
@@ -0,0 +1,15 @@
1
+ export interface ILogger {
2
+ log(message: string, ...args: any[]): void;
3
+ warn(message: string, ...args: any[]): void;
4
+ error(message: string, ...args: any[]): void;
5
+ debug?(message: string, ...args: any[]): void;
6
+ }
7
+ export declare class LoggerService implements ILogger {
8
+ private static provider;
9
+ setProvider(customLogger: ILogger): void;
10
+ log(message: string, ...args: any[]): void;
11
+ warn(message: string, ...args: any[]): void;
12
+ error(message: string, ...args: any[]): void;
13
+ debug(message: string, ...args: any[]): void;
14
+ }
15
+ //# sourceMappingURL=LoggerService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggerService.d.ts","sourceRoot":"","sources":["../../src/subsys/LoggerService.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACpB,GAAG,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE,GAAI,IAAI,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE,GAAI,IAAI,CAAC;IAC/C,KAAK,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE,GAAI,IAAI,CAAC;IAChD,KAAK,CAAC,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE,GAAI,IAAI,CAAC;CACpD;AASD,qBAAa,aAAc,YAAW,OAAO;IACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiC;IAEjD,WAAW,CAAC,YAAY,EAAG,OAAO;IAIlC,GAAG,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE;IAIrC,IAAI,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE;IAItC,KAAK,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE;IAIvC,KAAK,CAAC,OAAO,EAAG,MAAM,EAAE,GAAG,IAAI,EAAG,GAAG,EAAE;CAKjD"}
@@ -0,0 +1,32 @@
1
+ export interface ClockOptions {
2
+ /** Maximum allowed runtime in milliseconds for the entire engine execution (e.g., 25000 for 25s) */
3
+ maxExecutionBudgetMs?: number;
4
+ /** Safety margin in milliseconds reserved for graceful cleanup/shutdown */
5
+ safetyBufferMs?: number;
6
+ /** Maximum number of execution spans to retain in memory */
7
+ maxTrackHistory?: number;
8
+ enabled?: boolean;
9
+ }
10
+ export declare class PulsarClock {
11
+ private tracks;
12
+ private startTime;
13
+ private maxExecutionBudgetMs;
14
+ private safetyBufferMs;
15
+ private maxTrackHistory;
16
+ private enabled;
17
+ cpuExecutionMicroseconds: number;
18
+ constructor(options?: ClockOptions);
19
+ trackExecutionTime<T>({ contextId }: {
20
+ contextId: string;
21
+ }, fn: () => Promise<T>): Promise<T>;
22
+ getElapsedTotalTime(): number;
23
+ getTimeRemaining(): number;
24
+ getAverageTickDuration(lastN?: number): number;
25
+ /**
26
+ * Determines if executing another tick is safe.
27
+ * Uses recent average tick duration to estimate whether another tick will exceed the deadline.
28
+ */
29
+ isSafeToContinue(): boolean;
30
+ clear(contextId: string): void;
31
+ }
32
+ //# sourceMappingURL=PulsarClock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PulsarClock.d.ts","sourceRoot":"","sources":["../../src/subsys/PulsarClock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,oGAAoG;IACpG,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAA8D;IAC5E,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,OAAO,CAAU;IAElB,wBAAwB,SAAK;gBAExB,OAAO,GAAE,YAAiB;IAQzB,kBAAkB,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,EAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmBpG,mBAAmB,IAAK,MAAM;IAI9B,gBAAgB,IAAK,MAAM;IAM3B,sBAAsB,CAAC,KAAK,SAAI,GAAG,MAAM;IAOhD;;;OAGG;IACI,gBAAgB,IAAK,OAAO;IAe5B,KAAK,CAAC,SAAS,EAAG,MAAM;CAGlC"}
@@ -0,0 +1,18 @@
1
+ export declare class RuntimeCacheStorage {
2
+ static store: Map<string, any>;
3
+ kv: {
4
+ set: <V>(key: string, value: V) => void;
5
+ get: <K>(key: string) => K | undefined;
6
+ has: (key: string) => boolean;
7
+ delete: (key: string) => boolean;
8
+ clear: () => void;
9
+ };
10
+ lists: {
11
+ add: (key: string, value: string) => void;
12
+ remove: (key: string, value: string) => boolean;
13
+ get: (key: string) => Set<string> | undefined;
14
+ has: (key: string, value: string) => boolean;
15
+ };
16
+ }
17
+ export declare const createRuntimeCacheStorage: () => RuntimeCacheStorage;
18
+ //# sourceMappingURL=RuntimeCacheStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeCacheStorage.d.ts","sourceRoot":"","sources":["../../src/subsys/RuntimeCacheStorage.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAmB;IAC5B,OAAc,KAAK,EAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAa;IAE5C,EAAE;cACC,CAAC,OAAQ,MAAM,SAAU,CAAC;cAI1B,CAAC,OAAQ,MAAM,KAAI,CAAC,GAAG,SAAS;mBAI1B,MAAM,KAAI,OAAO;sBAId,MAAM,KAAI,OAAO;;MAOnC;IAEM,KAAK;mBACI,MAAM,SAAU,MAAM;sBAUnB,MAAM,SAAU,MAAM;mBAQzB,MAAM,KAAI,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS;mBAKjC,MAAM,SAAU,MAAM,KAAI,OAAO;MAOhD;CACJ;AAED,eAAO,MAAM,yBAAyB,2BAAkC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { PulsarUnifiedStorage } from "../storage/PulsarStorage";
2
+ import type { IRuntimeExecutionContext } from "../runtimes/runtimeTypes";
3
+ import type { ILogger } from "./LoggerService";
4
+ export declare class RuntimeEventBridge {
5
+ protected readonly storage: PulsarUnifiedStorage;
6
+ protected readonly logger: ILogger;
7
+ protected readonly runtimeExecutionId: string;
8
+ private readonly pgNotifyChannel;
9
+ private events;
10
+ constructor(storage: PulsarUnifiedStorage, logger: ILogger, runtimeExecutionId: string);
11
+ registerPgNotifyHandler(ctx: IRuntimeExecutionContext): Promise<void>;
12
+ registerPollingHandler(ctx: IRuntimeExecutionContext): Promise<void>;
13
+ httpEventDrivenQueueTrigger(queueName: string, fencingToken: string, ctx: IRuntimeExecutionContext): Promise<void>;
14
+ private handleTriggerValidity;
15
+ }
16
+ //# sourceMappingURL=RuntimeEventBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeEventBridge.d.ts","sourceRoot":"","sources":["../../src/subsys/RuntimeEventBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI/C,qBAAa,kBAAkB;IAMvB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAG,oBAAoB;IACjD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,OAAO;IACnC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAG,MAAM;IAPlD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgD;IAEhF,OAAO,CAAC,MAAM,CAAkB;gBAGT,OAAO,EAAG,oBAAoB,EAC9B,MAAM,EAAG,OAAO,EAChB,kBAAkB,EAAG,MAAM;IAKrC,uBAAuB,CAAC,GAAG,EAAG,wBAAwB;IAoBtD,sBAAsB,CAAC,GAAG,EAAG,wBAAwB;IAkBrD,2BAA2B,CAAC,SAAS,EAAG,MAAM,EAAE,YAAY,EAAG,MAAM,EAAE,GAAG,EAAG,wBAAwB;YAepG,qBAAqB;CAoCtC"}
@@ -0,0 +1,65 @@
1
+ import type { QueueModule } from "../helpers/defineQueue.d.ts";
2
+ import type { ILogger } from "../subsys/LoggerService.d.ts";
3
+ import type { PulsarUnifiedStorage } from "../storage/PulsarStorage.d.ts";
4
+ import type { IIntegration, IntegrationConstructor } from "./integrations.types.d.ts";
5
+ import type { NebulaClusterConfig } from "./nebula.types.d.ts";
6
+ import type { PersistentConfig, ServerlessVMConfig, V8IsolateConfig } from "./runtime.types.d.ts";
7
+ export interface EngineSwarmConfig {
8
+ maxGlobalConcurrency?: number;
9
+ spawnerAlgorithm?: "LEAST_CONNECTIONS" | "ROUND_ROBIN" | "CBS";
10
+ globalMaxJobsPerTick?: number;
11
+ }
12
+ export type BaseEngineConfig = {
13
+ instanceId: string;
14
+ /**
15
+ * Specifies the shared API key for this instance.
16
+ * The key is generated once and must be identical across
17
+ * all consumer configurations targeting this instance.
18
+ *
19
+ * Generate a secure API key using:
20
+ * @example
21
+ * openssl rand -hex 32
22
+ * @or generate online
23
+ * https://generate-random.org/api-keys
24
+ */
25
+ apiKey: string;
26
+ nebula?: NebulaClusterConfig;
27
+ /**
28
+ * The unified storage layer responsible for state management, queue operations, and distributed locks.
29
+ *
30
+ * The engine requires **PostgreSQL** as its core underlying storage driver to handle fundamental database
31
+ * functions and lock tables. However, adding **Redis** to the unified storage driver unlocks an optimized
32
+ * dual-layer storage architecture.
33
+ *
34
+ * When Redis is configured alongside PostgreSQL, the engine automatically offloads high frequency,
35
+ * heavy throughput read and write operations—such as worker registration, batch dispatches, and job
36
+ * acknowledgments to Redis memory.
37
+ *
38
+ * ### Storage Mode Behavior:
39
+ * * **PostgreSQL Only:** Handles all state persistence, transactional safety, and queue operations directly on the database.
40
+ * * **PostgreSQL + Redis (Recommended):** Offloads runtime operational load from PostgreSQL to Redis memory,
41
+ * significantly reducing database pressure and boosting overall engine processing speeds and throughput by 25% or more.
42
+ */
43
+ storage: PulsarUnifiedStorage;
44
+ queues: QueueModule[];
45
+ /**
46
+ * Consumer configuration for HTTP endpoints.
47
+ * When provided, Pulsar will make POST requests to this URL for each job.
48
+ * The job payload will be sent in the request body.
49
+ */
50
+ swarmConfig?: EngineSwarmConfig;
51
+ integrations?: Array<IntegrationConstructor | IIntegration>;
52
+ logger?: ILogger;
53
+ onEvents?: {
54
+ queueComplete?: (ctx: {
55
+ queue: string;
56
+ at: number;
57
+ }) => Promise<void> | void;
58
+ engineRestart?: () => Promise<void>;
59
+ };
60
+ };
61
+ /**
62
+ * Primary engine configuration union with runtime-level type enforcement.
63
+ */
64
+ export type EngineConfig = V8IsolateConfig | ServerlessVMConfig | PersistentConfig;
65
+ //# sourceMappingURL=base.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.types.d.ts","sourceRoot":"","sources":["../../src/types/base.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhG,MAAM,WAAW,iBAAiB;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,mBAAmB,GAAG,aAAa,GAAG,KAAK,CAAC;IAC/D,oBAAoB,CAAC,EAAG,MAAM,CAAC;CAClC;AAID,MAAM,MAAM,gBAAgB,GAAG;IAC3B,UAAU,EAAG,MAAM,CAAC;IACpB;;;;;;;;;;OAUG;IACH,MAAM,EAAG,MAAM,CAAC;IAEhB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAE7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAG,oBAAoB,CAAC;IAE/B,MAAM,EAAG,WAAW,EAAE,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC,YAAY,CAAC,EAAE,KAAK,CAAC,sBAAsB,GAAG,YAAY,CAAC,CAAC;IAE5D,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,QAAQ,CAAC,EAAG;QACR,aAAa,CAAC,EAAG,CAAC,GAAG,EAAG;YAAE,KAAK,EAAG,MAAM,CAAC;YAAC,EAAE,EAAG,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACjF,aAAa,CAAC,EAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACxC,CAAA;CACJ,CAAA;AAGD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,kBAAkB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { EventTriggerStrategy } from "./eventTriggerStrategry.types";
2
+ import type { PulsarRuntime } from "./runtime.types";
3
+ type RawPathKeys<T> = T extends object ? {
4
+ [K in keyof T & (string | number)]: T[K] extends Array<any> ? `${K}` : T[K] extends object ? `${K}` | `${K}.${RawPathKeys<T[K]>}` : `${K}`;
5
+ }[keyof T & (string | number)] : never;
6
+ /**
7
+ * Define exact paths or prefix patterns that MUST NOT be mutated via set().
8
+ * - 'storage' | 'storage.${string}': Storage instance should not be swapped on the fly.
9
+ * - 'runtime': Prevents switching execution environment at runtime.
10
+ * - 'onEvents' | 'onEvents.${string}': Prevents overwriting event hooks.
11
+ */
12
+ type BlockedPaths = "storage" | `storage.${string}` | "runtime" | "onEvents" | `onEvents.${string}` | "isolate" | `isolate.${string}`;
13
+ /**
14
+ * Filtered paths allowed specifically for `set()` operations.
15
+ */
16
+ export type SettablePathKeys<T> = Exclude<RawPathKeys<T>, BlockedPaths>;
17
+ /**
18
+ * All paths available for `get()` operations (unrestricted read access).
19
+ */
20
+ export type ReadablePathKeys<T> = RawPathKeys<T>;
21
+ /**
22
+ * Type utility to infer the value type corresponding to a dot-notation path string.
23
+ */
24
+ export type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
25
+ export interface IConfigurationObject {
26
+ queues: Array<{
27
+ queue: string;
28
+ pooler: string;
29
+ }>;
30
+ self_url: string;
31
+ runtime: PulsarRuntime;
32
+ event_trigger_strategy: EventTriggerStrategy;
33
+ }
34
+ export interface IConfigSyncResult {
35
+ isChanged: boolean;
36
+ isNew: boolean;
37
+ oldConfigurations?: IConfigurationObject;
38
+ delta?: {
39
+ urlChanged: boolean;
40
+ addedQueues: Array<{
41
+ queue: string;
42
+ pooler: string;
43
+ }>;
44
+ removedQueues: Array<{
45
+ queue: string;
46
+ pooler: string;
47
+ }>;
48
+ modifiedQueues: Array<{
49
+ queue: string;
50
+ oldPooler: string;
51
+ newPooler: string;
52
+ }>;
53
+ };
54
+ }
55
+ export {};
56
+ //# sourceMappingURL=config.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAClC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GACvD,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAC5B,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE;CAClD,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,GAC9B,KAAK,CAAC;AAEV;;;;;GAKG;AACH,KAAK,YAAY,GACb,SAAS,GACT,WAAW,MAAM,EAAE,GACnB,SAAS,GACT,UAAU,GACV,YAAY,MAAM,EAAE,GACpB,SAAS,GACT,WAAW,MAAM,EAAE,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,IAAI,EAAE,GAC7E,CAAC,SAAS,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,KAAK,GACjD,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AAGrC,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAG,KAAK,CAAC;QAAE,KAAK,EAAG,MAAM,CAAC;QAAC,MAAM,EAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,QAAQ,EAAG,MAAM,CAAC;IAClB,OAAO,EAAG,aAAa,CAAC;IACxB,sBAAsB,EAAG,oBAAoB,CAAA;CAChD;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;IACzC,KAAK,CAAC,EAAE;QACJ,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACtD,aAAa,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACxD,cAAc,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClF,CAAA;CACJ"}
@@ -0,0 +1,72 @@
1
+ export type JobContext<T = any> = {
2
+ /**
3
+ * The ID Of Worker Which Picked This Batch
4
+ *
5
+ * When using callback, the consumer must deregister using this worker id for freeing up the slot
6
+ ***/
7
+ workerId: string;
8
+ /***
9
+ * The ID Of The Queue From Which This Batch Was Picked
10
+ ***/
11
+ queue: string;
12
+ /***
13
+ * The Payloads Of The Batch
14
+ ***/
15
+ payload: T;
16
+ /***
17
+ * The Number Of Attempts This Job Has Undergone
18
+ ***/
19
+ attempts: number;
20
+ timestamp: number;
21
+ };
22
+ export type EngineConsumerConfig = {
23
+ type: "http";
24
+ queue: string;
25
+ url: string;
26
+ headers?: Record<string, string>;
27
+ timeoutMs?: number;
28
+ /**
29
+ * Enables MessagePack payload optimization, reducing payload size by up to 30%
30
+ * or more to conserve bandwidth.
31
+ *
32
+ * @remarks
33
+ * This optimization is incompatible with AWS Lambda or other FaaS environments
34
+ * that intercept, read, or modify the raw request bytes before the handler executes.
35
+ *
36
+ * @default
37
+ * true
38
+ */
39
+ optimizePayload?: boolean;
40
+ } | {
41
+ type: "socket";
42
+ queue: string;
43
+ /**
44
+ * Enables MessagePack payload optimization, reducing payload size by up to 30%
45
+ * or more to conserve bandwidth.
46
+ *
47
+ * @remarks
48
+ * This optimization is incompatible with AWS Lambda or other FaaS environments
49
+ * that intercept, read, or modify the raw request bytes before the handler executes.
50
+ *
51
+ * @default
52
+ * true
53
+ */
54
+ optimizePayload?: boolean;
55
+ } | {
56
+ type: "callback";
57
+ queue: string;
58
+ handler(job: JobContext): Promise<void>;
59
+ /**
60
+ * Enables MessagePack payload optimization, reducing payload size by up to 30%
61
+ * or more to conserve bandwidth.
62
+ *
63
+ * @remarks
64
+ * This optimization is incompatible with AWS Lambda or other FaaS environments
65
+ * that intercept, read, or modify the raw request bytes before the handler executes.
66
+ *
67
+ * @default
68
+ * true
69
+ */
70
+ optimizePayload?: boolean;
71
+ };
72
+ //# sourceMappingURL=consumer.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer.types.d.ts","sourceRoot":"","sources":["../../src/types/consumer.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI;IAC9B;;;;QAII;IACJ,QAAQ,EAAG,MAAM,CAAC;IAElB;;QAEI;IACJ,KAAK,EAAG,MAAM,CAAC;IAEf;;QAEI;IACJ,OAAO,EAAG,CAAC,CAAC;IAEZ;;QAEI;IACJ,QAAQ,EAAG,MAAM,CAAC;IAClB,SAAS,EAAG,MAAM,CAAC;CACtB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAC1B;IACM,IAAI,EAAG,MAAM,CAAC;IACd,KAAK,EAAG,MAAM,CAAC;IACf,GAAG,EAAG,MAAM,CAAC;IACb,OAAO,CAAC,EAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAG,MAAM,CAAC;IAEpB;;;;;;;;;;MAUE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,GAED;IACI,IAAI,EAAG,QAAQ,CAAC;IAChB,KAAK,EAAG,MAAM,CAAC;IACf;;;;;;;;;;MAUE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,GAEL;IACI,IAAI,EAAG,UAAU,CAAC;IAClB,KAAK,EAAG,MAAM,CAAC;IACf,OAAO,CAAC,GAAG,EAAG,UAAU,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C;;;;;;;;;;MAUE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC"}