@nightx.co/pulsar 0.0.0-stage → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/chunk-3sg08kqp.js +10 -0
- package/dist/chunk-3sg08kqp.js.map +9 -0
- package/dist/chunk-a9kye38b.js +54 -0
- package/dist/chunk-a9kye38b.js.map +12 -0
- package/dist/chunk-cpn1qh4e.js +10 -0
- package/dist/chunk-cpn1qh4e.js.map +12 -0
- package/dist/chunk-rrj8rm04.js +10 -0
- package/dist/chunk-rrj8rm04.js.map +11 -0
- package/dist/cluster/Nebula.d.ts +30 -0
- package/dist/cluster/Nebula.d.ts.map +1 -0
- package/dist/helpers/computeConfigDelta.d.ts +18 -0
- package/dist/helpers/computeConfigDelta.d.ts.map +1 -0
- package/dist/helpers/defineQueue.d.ts +13 -0
- package/dist/helpers/defineQueue.d.ts.map +1 -0
- package/dist/helpers/generateShaHash.d.ts +2 -0
- package/dist/helpers/generateShaHash.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +50 -0
- package/dist/integrations/PulsarEventsIntegrations.d.ts +7 -0
- package/dist/integrations/PulsarEventsIntegrations.d.ts.map +1 -0
- package/dist/integrations/PulsarLoggerIntegrations.d.ts +12 -0
- package/dist/integrations/PulsarLoggerIntegrations.d.ts.map +1 -0
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +8 -0
- package/dist/integrations/index.js.map +11 -0
- package/dist/modules/Queue.module.d.ts +45 -0
- package/dist/modules/Queue.module.d.ts.map +1 -0
- package/dist/modules/Scheduler.module.d.ts +42 -0
- package/dist/modules/Scheduler.module.d.ts.map +1 -0
- package/dist/modules/Tick.module.d.ts +35 -0
- package/dist/modules/Tick.module.d.ts.map +1 -0
- package/dist/modules/TickController.module.d.ts +36 -0
- package/dist/modules/TickController.module.d.ts.map +1 -0
- package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts +2 -0
- package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts.map +1 -0
- package/dist/monitoring/index.d.ts +2 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/server/PulsarMonitoringStream.d.ts +2 -0
- package/dist/monitoring/server/PulsarMonitoringStream.d.ts.map +1 -0
- package/dist/network/NetworkInterface.d.ts +13 -0
- package/dist/network/NetworkInterface.d.ts.map +1 -0
- package/dist/network/UnifiedTransportManager.d.ts +21 -0
- package/dist/network/UnifiedTransportManager.d.ts.map +1 -0
- package/dist/network/abstract/BaseNetworkDriver.d.ts +17 -0
- package/dist/network/abstract/BaseNetworkDriver.d.ts.map +1 -0
- package/dist/network/auth/Authenticator.d.ts +2 -0
- package/dist/network/auth/Authenticator.d.ts.map +1 -0
- package/dist/network/drivers/HttpNetworkDriver.d.ts +31 -0
- package/dist/network/drivers/HttpNetworkDriver.d.ts.map +1 -0
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts +23 -0
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts.map +1 -0
- package/dist/network/helpers/httpQueueOperations.d.ts +2 -0
- package/dist/network/helpers/httpQueueOperations.d.ts.map +1 -0
- package/dist/network/interfaces/network.types.d.ts +13 -0
- package/dist/network/interfaces/network.types.d.ts.map +1 -0
- package/dist/run/Queues.d.ts +2 -0
- package/dist/run/Queues.d.ts.map +1 -0
- package/dist/run/index.d.ts +2 -0
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index2.d.ts +2 -0
- package/dist/run/index2.d.ts.map +1 -0
- package/dist/runtimes/IsolateRuntime.d.ts +17 -0
- package/dist/runtimes/IsolateRuntime.d.ts.map +1 -0
- package/dist/runtimes/PersistentRuntime.d.ts +22 -0
- package/dist/runtimes/PersistentRuntime.d.ts.map +1 -0
- package/dist/runtimes/ServerlessRuntime.d.ts +15 -0
- package/dist/runtimes/ServerlessRuntime.d.ts.map +1 -0
- package/dist/runtimes/runtimeTypes.d.ts +15 -0
- package/dist/runtimes/runtimeTypes.d.ts.map +1 -0
- package/dist/server/PulsarRequestHandler.d.ts +41 -0
- package/dist/server/PulsarRequestHandler.d.ts.map +1 -0
- package/dist/server/helpers/acquireRedisLock.d.ts +14 -0
- package/dist/server/helpers/acquireRedisLock.d.ts.map +1 -0
- package/dist/server/helpers/checkFencingValidity.d.ts +14 -0
- package/dist/server/helpers/checkFencingValidity.d.ts.map +1 -0
- package/dist/server/helpers/performIsolateRestart.d.ts +20 -0
- package/dist/server/helpers/performIsolateRestart.d.ts.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +8 -0
- package/dist/server/index.js.map +13 -0
- package/dist/server/parser/parseRequest.d.ts +10 -0
- package/dist/server/parser/parseRequest.d.ts.map +1 -0
- package/dist/server/utility/extract-headers.d.ts +14 -0
- package/dist/server/utility/extract-headers.d.ts.map +1 -0
- package/dist/service/ConfigurationStore.d.ts +23 -0
- package/dist/service/ConfigurationStore.d.ts.map +1 -0
- package/dist/service/Isolate.service.d.ts +12 -0
- package/dist/service/Isolate.service.d.ts.map +1 -0
- package/dist/service/Pulsar.service.d.ts +41 -0
- package/dist/service/Pulsar.service.d.ts.map +1 -0
- package/dist/service/PulsarBaseService.d.ts +49 -0
- package/dist/service/PulsarBaseService.d.ts.map +1 -0
- package/dist/service/PulsarEventBus.d.ts +36 -0
- package/dist/service/PulsarEventBus.d.ts.map +1 -0
- package/dist/service/SwarmBudgetTracker.d.ts +14 -0
- package/dist/service/SwarmBudgetTracker.d.ts.map +1 -0
- package/dist/service/consumers/PulsarWorker.d.ts +10 -0
- package/dist/service/consumers/PulsarWorker.d.ts.map +1 -0
- package/dist/shared/PulsarRuntimeCore.d.ts +55 -0
- package/dist/shared/PulsarRuntimeCore.d.ts.map +1 -0
- package/dist/static/TimingProfile.d.ts +9 -0
- package/dist/static/TimingProfile.d.ts.map +1 -0
- package/dist/static/static.d.ts +3 -0
- package/dist/static/static.d.ts.map +1 -0
- package/dist/storage/PulsarStorage.d.ts +42 -0
- package/dist/storage/PulsarStorage.d.ts.map +1 -0
- package/dist/storage/drivers/PostgresDriver.d.ts +20 -0
- package/dist/storage/drivers/PostgresDriver.d.ts.map +1 -0
- package/dist/storage/drivers/RedisDriver.d.ts +20 -0
- package/dist/storage/drivers/RedisDriver.d.ts.map +1 -0
- package/dist/storage/drivers/types.d.ts +27 -0
- package/dist/storage/drivers/types.d.ts.map +1 -0
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +403 -0
- package/dist/storage/index.js.map +21 -0
- package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts +39 -0
- package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts.map +1 -0
- package/dist/storage/repositories/PostgresQueueRepository.d.ts +26 -0
- package/dist/storage/repositories/PostgresQueueRepository.d.ts.map +1 -0
- package/dist/storage/repositories/QueueRepository.d.ts +20 -0
- package/dist/storage/repositories/QueueRepository.d.ts.map +1 -0
- package/dist/storage/repositories/RedisQueueRepository.d.ts +28 -0
- package/dist/storage/repositories/RedisQueueRepository.d.ts.map +1 -0
- package/dist/subsys/DeferredTickEvaluator.d.ts +23 -0
- package/dist/subsys/DeferredTickEvaluator.d.ts.map +1 -0
- package/dist/subsys/EventBus.d.ts +13 -0
- package/dist/subsys/EventBus.d.ts.map +1 -0
- package/dist/subsys/ExecutionProfileSwitcher.d.ts +10 -0
- package/dist/subsys/ExecutionProfileSwitcher.d.ts.map +1 -0
- package/dist/subsys/LoggerService.d.ts +15 -0
- package/dist/subsys/LoggerService.d.ts.map +1 -0
- package/dist/subsys/PulsarClock.d.ts +32 -0
- package/dist/subsys/PulsarClock.d.ts.map +1 -0
- package/dist/subsys/RuntimeCacheStorage.d.ts +18 -0
- package/dist/subsys/RuntimeCacheStorage.d.ts.map +1 -0
- package/dist/subsys/RuntimeEventBridge.d.ts +16 -0
- package/dist/subsys/RuntimeEventBridge.d.ts.map +1 -0
- package/dist/types/base.types.d.ts +65 -0
- package/dist/types/base.types.d.ts.map +1 -0
- package/dist/types/config.types.d.ts +56 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/consumer.types.d.ts +36 -0
- package/dist/types/consumer.types.d.ts.map +1 -0
- package/dist/types/engine.types.d.ts +139 -0
- package/dist/types/engine.types.d.ts.map +1 -0
- package/dist/types/eventTriggerStrategry.types.d.ts +34 -0
- package/dist/types/eventTriggerStrategry.types.d.ts.map +1 -0
- package/dist/types/integrations.types.d.ts +16 -0
- package/dist/types/integrations.types.d.ts.map +1 -0
- package/dist/types/nebula.types.d.ts +65 -0
- package/dist/types/nebula.types.d.ts.map +1 -0
- package/dist/types/queue.types.d.ts +106 -0
- package/dist/types/queue.types.d.ts.map +1 -0
- package/dist/types/runtime.types.d.ts +89 -0
- package/dist/types/runtime.types.d.ts.map +1 -0
- package/package.json +71 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IQueueRepository } from "../../storage/repositories/QueueRepository";
|
|
2
|
+
interface IAquireInstanceLock {
|
|
3
|
+
repository: IQueueRepository;
|
|
4
|
+
isEventDriven: boolean;
|
|
5
|
+
targetQueue: string;
|
|
6
|
+
lastExecutionId: string;
|
|
7
|
+
instanceId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function aquireInstanceLock({ repository, isEventDriven, lastExecutionId, targetQueue, instanceId }: IAquireInstanceLock): Promise<string | {
|
|
10
|
+
message: string;
|
|
11
|
+
status: number;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=acquireRedisLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acquireRedisLock.d.ts","sourceRoot":"","sources":["../../../src/server/helpers/acquireRedisLock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,UAAU,mBAAmB;IACzB,UAAU,EAAG,gBAAgB,CAAC;IAC9B,aAAa,EAAG,OAAO,CAAC;IACxB,WAAW,EAAG,MAAM,CAAC;IACrB,eAAe,EAAG,MAAM,CAAC;IACzB,UAAU,EAAG,MAAM,CAAC;CACvB;AAED,wBAAsB,kBAAkB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,EAAG,mBAAmB;;;GAsBrI"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IPulsarPostgresEngineOperationRepository } from "../../storage/repositories/PostgresEngineOperationRepository";
|
|
2
|
+
interface ICheckFencingTokenValidity {
|
|
3
|
+
isEventDriven: boolean;
|
|
4
|
+
executionOwner: string;
|
|
5
|
+
fencingToken?: string;
|
|
6
|
+
targetQueue: string;
|
|
7
|
+
ops: IPulsarPostgresEngineOperationRepository;
|
|
8
|
+
}
|
|
9
|
+
export declare function checkFencingTokenValidity({ executionOwner, fencingToken, isEventDriven, targetQueue, ops }: ICheckFencingTokenValidity): Promise<{
|
|
10
|
+
message: string;
|
|
11
|
+
status: number;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=checkFencingValidity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkFencingValidity.d.ts","sourceRoot":"","sources":["../../../src/server/helpers/checkFencingValidity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,8DAA8D,CAAC;AAE7H,UAAU,0BAA0B;IAChC,aAAa,EAAG,OAAO,CAAC;IACxB,cAAc,EAAG,MAAM,CAAC;IACxB,YAAY,CAAC,EAAG,MAAM,CAAC;IACvB,WAAW,EAAG,MAAM,CAAC;IACrB,GAAG,EAAG,wCAAwC,CAAC;CAClD;AAED,wBAAsB,yBAAyB,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,EAAE,EAAG,0BAA0B;;;eA8B7I"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Pulsar } from "../../service/Pulsar.service";
|
|
2
|
+
import type { IsolateInstance } from "../../service/Isolate.service";
|
|
3
|
+
import type { EnginePoolingMode } from "../../types/engine.types";
|
|
4
|
+
interface IEnginePerformRestart {
|
|
5
|
+
isRestarted: boolean;
|
|
6
|
+
isV8Isolate: boolean;
|
|
7
|
+
isolate?: IsolateInstance;
|
|
8
|
+
executionOwner: string;
|
|
9
|
+
lastIsolateId: string;
|
|
10
|
+
lastExecutionId: string;
|
|
11
|
+
poolerMode: EnginePoolingMode;
|
|
12
|
+
targetQueue: string;
|
|
13
|
+
engine: Pulsar;
|
|
14
|
+
}
|
|
15
|
+
export declare function performEngineRestart({ targetQueue, isRestarted, isV8Isolate, isolate, executionOwner, lastExecutionId, lastIsolateId, poolerMode, engine }: IEnginePerformRestart): Promise<{
|
|
16
|
+
message: string;
|
|
17
|
+
status: number;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=performIsolateRestart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performIsolateRestart.d.ts","sourceRoot":"","sources":["../../../src/server/helpers/performIsolateRestart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,UAAU,qBAAqB;IAC3B,WAAW,EAAG,OAAO,CAAC;IACtB,WAAW,EAAG,OAAO,CAAC;IACtB,OAAO,CAAC,EAAG,eAAe,CAAC;IAC3B,cAAc,EAAG,MAAM,CAAC;IACxB,aAAa,EAAG,MAAM,CAAC;IACvB,eAAe,EAAG,MAAM,CAAC;IACzB,UAAU,EAAG,iBAAiB,CAAC;IAC/B,WAAW,EAAG,MAAM,CAAC;IACrB,MAAM,EAAG,MAAM,CAAC;CACnB;AAED,wBAAsB,oBAAoB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,EAAG,qBAAqB;;;eA6CxL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,0BAA0B,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulsar by NightX
|
|
3
|
+
* Copyright (c) 2026 NightX. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
import{a as S,b as x,c as k}from"../chunk-a9kye38b.js";import"../chunk-3sg08kqp.js";async function D({repository:t,isEventDriven:i,lastExecutionId:n,targetQueue:o,instanceId:c}){let r=i?`lock:edp:${o}`:"lock:idp",l=120000;if(await t.acquireQueueLock(r,n,120000))await t.clearDispatchPending(r);else return console.log(`[LOCK REJECTED] : Active execution lock already held for key: ${r}`),{message:"Isolate active, skipping redundant run.",status:200};return r}async function $({executionOwner:t,fencingToken:i,isEventDriven:n,targetQueue:o,ops:c}){if(n&&t=="trigger"){if(!i||i=="NOT_INCLUDED"){let l=`[EventDrivenPoller]-[ExecutionTrigger]-[${o}] : Engine execution rejected: Fencing token is missing.`;return console.error(l),{message:l,status:200}}if(!await c.checkFencingTokenValidity(o,i)){let l=`[EventDrivenPoller]-[ExecutionTrigger]-[${o}] : Engine execution rejected : Invalid fencing token.`;return console.error(l),{message:l,status:200}}else console.log("[EventDrivenPoller] : Engine started via DB trigger",{queue:o,currentToken:i,previousToken:isNaN(parseInt(i,10))?null:parseInt(i,10)-1})}}async function m({targetQueue:t,isRestarted:i,isV8Isolate:n,isolate:o,executionOwner:c,lastExecutionId:r,lastIsolateId:l,poolerMode:a,engine:s}){let f=o?.uptime??0,e=o?.maxTime??1/0,p=n&&f>=e;if(i&&n&&o){if(console.log(`[Pulsar] : Engine Restarted By (${c==="watchdog"?"watchdog":"self"})`),o.isSameIsolate(l))console.log(`[Pulsar] : Engine Restarted in same isolate (${o.id}), Header Isolate (${l})`);if(p){console.log(`[${new Date().toISOString()}]: Engine Restarted With Network Call due to isolate recycling.`);let y={"content-type":"application/json","x-last-execution-id":r,"x-last-execution-at":new Date().toISOString(),"x-execution-owner":c,"x-restart":i?"true":"false","x-pooler":a,...t!==void 0&&{"x-target-queue":t}};return await s.restartForSameIsolate(y),{message:"Engine Restarted Due To Same Isolate with no time to process.",status:200}}await s.deleteScheduledRestart(t??"__GLOBAL__")}if(p&&n)return console.log(`[${new Date().toISOString()}] : Scheduling restart for (${t})`),await s.scheduleRestart(t),{message:"Engine Started Successfully",status:200}}class L{opts;onErrorHook;constructor(t){this.opts=t}onError(t){return this.onErrorHook=t,this}async handle(t){let{url:i,method:n,body:o,headers:c}=await x(t),r=new URL(i),l={headers:c,body:o};if(r.pathname.endsWith("/ack")&&n=="POST")return await this.handleAck(l);if(r.pathname.endsWith("/nack")&&n=="POST")return await this.handleNack(l);if(r.pathname.endsWith("/retry")&&n=="POST")return await this.handleRetry(l);if(r.pathname.endsWith("/validate_config")&&n=="POST")return await this.handleReconcileConfiguration();return await this.handleEngineExecution(t)}async getMessageIds(t){let{headers:i}=t,n=t.body;if(typeof n==="string")try{n=JSON.parse(n)}catch(a){throw Error(a)}let o=i["x-queue"],c=i["x-worker-id"];if(!o)throw Error("[getMessageIds] : Queue Not Found In Headers");if(!c)throw Error("[getMessageIds] : Worker Id Not Found In Headers");let l=(Array.isArray(n?.msg_ids)?n.msg_ids:[]).map((a)=>Number.parseInt(String(a),10)).filter((a)=>Number.isInteger(a)&&a>=0);if(l.length==0)throw Error("[getMessageIds] : No message ids were found");return{queue:o,messageIds:l,workerId:c}}async performBatchAction(t,i,n,o){try{await this.opts.unifiedStorage.connect();let c=new S(this.opts.unifiedStorage);switch(o){case"ACK":await c.ackBatch(t,n);break;case"NACK":await c.ackBatch(t,n);break;case"RETRY":await c.retryBatch(t,n);break}}catch(c){console.log(c)}finally{await this.opts.unifiedStorage.repository.deregisterWorker(i,t)}}async handleAck(t){let{messageIds:i,queue:n,workerId:o}=await this.getMessageIds(t);return await this.performBatchAction(n,o,i,"ACK"),{message:"Jobs Acknowledged",status:200}}async handleNack(t){let{queue:i,workerId:n,messageIds:o}=await this.getMessageIds(t);return console.log(`[NACK] : Queue ${i} : Message IDs ${o}`),await this.performBatchAction(i,n,o,"NACK"),{message:"Jobs Nack Applied",status:200}}async handleRetry(t){let{queue:i,workerId:n,messageIds:o}=await this.getMessageIds(t);return console.log(`[RETRY] : Queue ${i} : Message IDs ${o}`),await this.performBatchAction(i,n,o,"RETRY"),{message:"Jobs Retry Applied",status:200}}async handleReconcileConfiguration(){return await this.opts.getEngine(this.opts.instanceId).validateConfiguration()}async handleEngineExecution(t){let{headers:i}=await x(t),n=k(i),{executionOwner:o,isRestarted:c,lastExecutionId:r,lastIsolateId:l,poolerMode:a,targetQueue:s,fencingToken:f}=n,e=a==="event-driven-pooler";if(e&&!s)return{message:"Target queue is not defined.",status:400};console.log("[PulsarRequestHandlerBuilder] : Executing request for engine startup."),await this.opts.unifiedStorage.connect(),this.opts.unifiedStorage.bindInstanceId(this.opts.instanceId);let p=await $({executionOwner:o,isEventDriven:e,targetQueue:s,fencingToken:f,ops:this.opts.unifiedStorage.ops});if(p)return p;let y=await D({isEventDriven:e,lastExecutionId:r,targetQueue:s,repository:this.opts.unifiedStorage.repository,instanceId:this.opts.instanceId});if(typeof y=="object")return y;if(this.opts.isolate)this.opts.isolate.set("current_execution_id",r),this.opts.isolate.set("lock_key",y);let g=this.opts.getEngine(this.opts.instanceId);g.setCurrentExecutionId(r);let P=g.runtime==="V8_ISOLATE",T=this.opts.isolate;if(P&&!T)throw Error("[Pulsar SDK] : 'isolate' option must be provided when runtime is V8_ISOLATE.");try{let E=await m({engine:g,isolate:T,executionOwner:o,isRestarted:c,isV8Isolate:P,lastExecutionId:r,lastIsolateId:l,poolerMode:a,targetQueue:s});if(E)return E;if(e&&s)await g.triggerQueue(s);else await g.start();return{message:"Engine Started Successfully",status:200}}catch(E){if(this.onErrorHook){if(this.onErrorHook(E))return{message:"Interval Exception Raised",status:200}}throw E}finally{await g.awaitPendingShutdown()}}}function O(t){return new L(t)}export{O as createPulsarRequestHandler};
|
|
6
|
+
/* Powered by NightX - Pulsar Engine */
|
|
7
|
+
|
|
8
|
+
//# debugId=B4777F1937E60F9B64756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["..\\src\\server\\helpers\\acquireRedisLock.ts", "..\\src\\server\\helpers\\checkFencingValidity.ts", "..\\src\\server\\helpers\\performIsolateRestart.ts", "..\\src\\server\\PulsarRequestHandler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { IQueueRepository } from \"../../storage/repositories/QueueRepository\";\r\n\r\ninterface IAquireInstanceLock {\r\n repository : IQueueRepository;\r\n isEventDriven : boolean;\r\n targetQueue : string;\r\n lastExecutionId : string;\r\n instanceId : string;\r\n}\r\n\r\nexport async function aquireInstanceLock({ repository, isEventDriven, lastExecutionId, targetQueue, instanceId } : IAquireInstanceLock) {\r\n const lockKey = isEventDriven ? `lock:edp:${targetQueue}` : `lock:idp`;\r\n const lockTTL = 120_000;\r\n\r\n const lockAcquired = await repository.acquireQueueLock(\r\n lockKey,\r\n lastExecutionId,\r\n lockTTL\r\n )\r\n\r\n if (lockAcquired) {\r\n await repository.clearDispatchPending(lockKey);\r\n }\r\n else {\r\n console.log(`[LOCK REJECTED] : Active execution lock already held for key: ${lockKey}`);\r\n return {\r\n message: \"Isolate active, skipping redundant run.\",\r\n status: 200\r\n }\r\n }\r\n\r\n return lockKey;\r\n}",
|
|
6
|
+
"import type { IPulsarPostgresEngineOperationRepository } from \"../../storage/repositories/PostgresEngineOperationRepository\";\r\n\r\ninterface ICheckFencingTokenValidity {\r\n isEventDriven : boolean;\r\n executionOwner : string;\r\n fencingToken? : string;\r\n targetQueue : string;\r\n ops : IPulsarPostgresEngineOperationRepository;\r\n}\r\n\r\nexport async function checkFencingTokenValidity({ executionOwner, fencingToken, isEventDriven, targetQueue, ops } : ICheckFencingTokenValidity) {\r\n if(isEventDriven && executionOwner == \"trigger\") {\r\n if(!fencingToken || fencingToken == \"NOT_INCLUDED\") {\r\n const errorMsg = `[EventDrivenPoller]-[ExecutionTrigger]-[${targetQueue}] : Engine execution rejected: Fencing token is missing.`;\r\n console.error(errorMsg);\r\n return {\r\n message: errorMsg,\r\n status: 200\r\n }\r\n }\r\n\r\n const isValidToken = await ops.checkFencingTokenValidity(targetQueue, fencingToken);\r\n\r\n if(!isValidToken) {\r\n const errorMsg = `[EventDrivenPoller]-[ExecutionTrigger]-[${targetQueue}] : Engine execution rejected : Invalid fencing token.`;\r\n console.error(errorMsg);\r\n return {\r\n message: errorMsg,\r\n status: 200\r\n }\r\n }\r\n\r\n else {\r\n console.log(\"[EventDrivenPoller] : Engine started via DB trigger\", {\r\n queue: targetQueue,\r\n currentToken: fencingToken,\r\n previousToken: isNaN(parseInt(fencingToken, 10)) ? null : parseInt(fencingToken, 10) - 1\r\n })\r\n }\r\n }\r\n}",
|
|
7
|
+
"import type { Pulsar } from \"../../service/Pulsar.service\";\r\nimport type { IsolateInstance } from \"../../service/Isolate.service\";\r\nimport type { EnginePoolingMode } from \"../../types/engine.types\";\r\n\r\ninterface IEnginePerformRestart {\r\n isRestarted : boolean;\r\n isV8Isolate : boolean;\r\n isolate? : IsolateInstance;\r\n executionOwner : string;\r\n lastIsolateId : string;\r\n lastExecutionId : string;\r\n poolerMode : EnginePoolingMode;\r\n targetQueue : string;\r\n engine : Pulsar;\r\n}\r\n\r\nexport async function performEngineRestart({ targetQueue, isRestarted, isV8Isolate, isolate, executionOwner, lastExecutionId, lastIsolateId, poolerMode, engine } : IEnginePerformRestart) {\r\n const isolateUptime = isolate?.uptime ?? 0;\r\n const isolateMaxTime = isolate?.maxTime ?? Infinity;\r\n const shouldRecycleIsolate = isV8Isolate && isolateUptime >= isolateMaxTime;\r\n\r\n if (isRestarted && isV8Isolate && isolate) {\r\n console.log(`[Pulsar] : Engine Restarted By (${executionOwner === \"watchdog\" ? \"watchdog\" : \"self\"})`);\r\n\r\n if (isolate.isSameIsolate(lastIsolateId)) {\r\n console.log(`[Pulsar] : Engine Restarted in same isolate (${isolate.id}), Header Isolate (${lastIsolateId})`);\r\n }\r\n\r\n if (shouldRecycleIsolate) {\r\n console.log(`[${new Date().toISOString()}]: Engine Restarted With Network Call due to isolate recycling.`);\r\n\r\n const nextHeaders: Record<string, string> = {\r\n \"content-type\": \"application/json\",\r\n \"x-last-execution-id\": lastExecutionId,\r\n \"x-last-execution-at\": new Date().toISOString(),\r\n \"x-execution-owner\": executionOwner,\r\n \"x-restart\": isRestarted ? \"true\" : \"false\",\r\n \"x-pooler\": poolerMode,\r\n ...(targetQueue !== undefined && { \"x-target-queue\": targetQueue })\r\n }\r\n\r\n await engine.restartForSameIsolate(nextHeaders);\r\n\r\n return {\r\n message: \"Engine Restarted Due To Same Isolate with no time to process.\",\r\n status: 200\r\n }\r\n }\r\n\r\n await engine.deleteScheduledRestart(targetQueue ?? \"__GLOBAL__\");\r\n }\r\n\r\n if (shouldRecycleIsolate && isV8Isolate) {\r\n console.log(`[${new Date().toISOString()}] : Scheduling restart for (${targetQueue})`);\r\n await engine.scheduleRestart(targetQueue as string);\r\n\r\n return {\r\n message: \"Engine Started Successfully\",\r\n status: 200\r\n }\r\n }\r\n}",
|
|
8
|
+
"import { QueueService } from \"../modules/Queue.module\";\r\nimport { aquireInstanceLock } from \"./helpers/acquireRedisLock\";\r\nimport { checkFencingTokenValidity } from \"./helpers/checkFencingValidity\";\r\nimport { performEngineRestart } from \"./helpers/performIsolateRestart\";\r\nimport { parseRequest } from \"./parser/parseRequest\";\r\nimport { extractHeaders } from \"./utility/extract-headers\";\r\n\r\nimport type { IsolateInstance } from \"../service/Isolate.service\";\r\nimport type { Pulsar } from \"../service/Pulsar.service\";\r\nimport type { PulsarUnifiedStorage } from \"../storage/PulsarStorage\";\r\n\r\ninterface PulsarHandlerOptions {\r\n unifiedStorage : PulsarUnifiedStorage;\r\n getEngine: (instanceId : string) => Pulsar;\r\n instanceId : string;\r\n /**\r\n * Optional isolate instance. Required only when Pulsar runtime is V8_ISOLATE.\r\n */\r\n isolate? : IsolateInstance;\r\n}\r\n\r\n\r\nexport type GetEngine = {\r\n lockKey : string;\r\n instanceId : string;\r\n}\r\n\r\ntype StandardResponse = {\r\n status : number;\r\n message : string;\r\n}\r\n\r\ntype StandardArgs = {\r\n headers : Record<string, string>;\r\n body: any;\r\n}\r\n\r\nexport type ErrorHook = (error : unknown) => Response | void;\r\n\r\nclass PulsarRequestHandlerBuilder {\r\n private onErrorHook? : ErrorHook;\r\n\r\n constructor(private readonly opts : PulsarHandlerOptions) {}\r\n\r\n public onError(fn : ErrorHook): this {\r\n this.onErrorHook = fn;\r\n return this;\r\n }\r\n\r\n public async handle(req : Request) {\r\n const { url : rawUrl, method, body, headers } = await parseRequest(req);\r\n\r\n const url = new URL(rawUrl);\r\n const args = { headers, body };\r\n\r\n if (url.pathname.endsWith(\"/ack\") && method == \"POST\") {\r\n return await this.handleAck(args);\r\n }\r\n\r\n if (url.pathname.endsWith(\"/nack\") && method == \"POST\") {\r\n return await this.handleNack(args);\r\n }\r\n\r\n if (url.pathname.endsWith(\"/retry\") && method == \"POST\") {\r\n return await this.handleRetry(args);\r\n }\r\n\r\n if (url.pathname.endsWith(\"/validate_config\") && method == \"POST\") {\r\n return await this.handleReconcileConfiguration();\r\n }\r\n\r\n return await this.handleEngineExecution(req);\r\n }\r\n\r\n private async getMessageIds(args : StandardArgs) : Promise<{queue : string, messageIds : number[], workerId : string}> {\r\n const { headers } = args;\r\n\r\n let parsedBody = args.body;\r\n if (typeof parsedBody === \"string\") {\r\n try {\r\n parsedBody = JSON.parse(parsedBody);\r\n }\r\n catch (err : any) {\r\n throw new Error(err);\r\n }\r\n }\r\n\r\n const queue = headers[\"x-queue\"];\r\n const workerId = headers[\"x-worker-id\"];\r\n\r\n if(!queue) throw new Error(\"[getMessageIds] : Queue Not Found In Headers\");\r\n if(!workerId) throw new Error(\"[getMessageIds] : Worker Id Not Found In Headers\");\r\n\r\n const rawMsgIds = (Array.isArray(parsedBody?.msg_ids) ? parsedBody.msg_ids : []) as number[];\r\n const messageIds : number[] = rawMsgIds.map((id) => Number.parseInt(String(id), 10)).filter((id) => Number.isInteger(id) && id >= 0);\r\n\r\n if(messageIds.length == 0) throw new Error(\"[getMessageIds] : No message ids were found\");\r\n\r\n return { queue, messageIds, workerId };\r\n }\r\n\r\n private async performBatchAction(queue : string, workerId : string, messageIds : number[], action : \"ACK\" | \"NACK\" | \"RETRY\") {\r\n try {\r\n await this.opts.unifiedStorage.connect();\r\n\r\n const queueService = new QueueService(this.opts.unifiedStorage);\r\n\r\n switch (action) {\r\n case \"ACK\":\r\n await queueService.ackBatch(queue, messageIds);\r\n break;\r\n case \"NACK\":\r\n await queueService.ackBatch(queue, messageIds);\r\n break;\r\n case \"RETRY\":\r\n await queueService.retryBatch(queue, messageIds);\r\n break;\r\n }\r\n }\r\n catch (error) {\r\n console.log(error);\r\n }\r\n finally {\r\n await this.opts.unifiedStorage.repository.deregisterWorker(workerId, queue);\r\n }\r\n }\r\n\r\n private async handleAck(args : StandardArgs) : Promise<StandardResponse> {\r\n const { messageIds, queue, workerId } = await this.getMessageIds(args);\r\n\r\n //console.log(`[ACK] : Queue ${queue} : Message IDs ${messageIds}`);\r\n\r\n await this.performBatchAction(queue, workerId, messageIds, \"ACK\");\r\n\r\n return { message : \"Jobs Acknowledged\", status : 200 }\r\n }\r\n\r\n private async handleNack(args : StandardArgs) : Promise<StandardResponse> {\r\n const { queue, workerId, messageIds } = await this.getMessageIds(args);\r\n\r\n console.log(`[NACK] : Queue ${queue} : Message IDs ${messageIds}`);\r\n\r\n await this.performBatchAction(queue, workerId, messageIds, \"NACK\");\r\n\r\n return { message : \"Jobs Nack Applied\", status : 200 }\r\n }\r\n\r\n private async handleRetry(args : StandardArgs) : Promise<StandardResponse> {\r\n const { queue, workerId, messageIds } = await this.getMessageIds(args);\r\n\r\n console.log(`[RETRY] : Queue ${queue} : Message IDs ${messageIds}`);\r\n\r\n await this.performBatchAction(queue, workerId, messageIds, \"RETRY\");\r\n\r\n return { message : \"Jobs Retry Applied\", status : 200 }\r\n }\r\n\r\n private async handleReconcileConfiguration () : Promise<StandardResponse> {\r\n const engine = this.opts.getEngine(this.opts.instanceId);\r\n return await engine.validateConfiguration();\r\n }\r\n\r\n /**\r\n * Handles the HTTP request lifecycle for Pulsar Engine.\r\n */\r\n public async handleEngineExecution(req : Request) : Promise<StandardResponse> {\r\n const { headers : rawHeaders } = await parseRequest(req);\r\n const headers = extractHeaders(rawHeaders);\r\n\r\n const {\r\n executionOwner,\r\n isRestarted,\r\n lastExecutionId,\r\n lastIsolateId,\r\n poolerMode,\r\n targetQueue,\r\n fencingToken,\r\n } = headers;\r\n\r\n const isEventDriven = poolerMode === \"event-driven-pooler\";\r\n\r\n if (isEventDriven && !targetQueue) {\r\n return {\r\n message: \"Target queue is not defined.\",\r\n status: 400\r\n }\r\n }\r\n\r\n console.log(`[PulsarRequestHandlerBuilder] : Executing request for engine startup.`);\r\n\r\n await this.opts.unifiedStorage.connect();\r\n this.opts.unifiedStorage.bindInstanceId(this.opts.instanceId);\r\n\r\n const invalidFencingResponse = await checkFencingTokenValidity({\r\n executionOwner,\r\n isEventDriven,\r\n targetQueue : targetQueue as string,\r\n fencingToken,\r\n ops : this.opts.unifiedStorage.ops\r\n })\r\n\r\n if(invalidFencingResponse) return invalidFencingResponse;\r\n\r\n const lockAquiredResponse = await aquireInstanceLock({\r\n isEventDriven,\r\n lastExecutionId,\r\n targetQueue : targetQueue as string,\r\n repository : this.opts.unifiedStorage.repository,\r\n instanceId : this.opts.instanceId\r\n })\r\n\r\n if(typeof lockAquiredResponse == \"object\") {\r\n return lockAquiredResponse;\r\n }\r\n\r\n if(this.opts.isolate) {\r\n this.opts.isolate.set('current_execution_id', lastExecutionId);\r\n this.opts.isolate.set('lock_key', lockAquiredResponse);\r\n }\r\n\r\n const engine = this.opts.getEngine(this.opts.instanceId);\r\n engine.setCurrentExecutionId(lastExecutionId);\r\n const isV8Isolate = engine.runtime === \"V8_ISOLATE\";\r\n\r\n const isolate = this.opts.isolate;\r\n if (isV8Isolate && !isolate) {\r\n throw new Error(\"[Pulsar SDK] : 'isolate' option must be provided when runtime is V8_ISOLATE.\");\r\n }\r\n\r\n try {\r\n const blockResponse = await performEngineRestart({\r\n engine,\r\n isolate,\r\n executionOwner,\r\n isRestarted,\r\n isV8Isolate,\r\n lastExecutionId,\r\n lastIsolateId,\r\n poolerMode,\r\n targetQueue : targetQueue as string \r\n })\r\n\r\n if(blockResponse) {\r\n return blockResponse;\r\n }\r\n\r\n if (isEventDriven && targetQueue) {\r\n await engine.triggerQueue(targetQueue);\r\n }\r\n else {\r\n await engine.start();\r\n }\r\n\r\n return {\r\n message: \"Engine Started Successfully\",\r\n status: 200\r\n }\r\n }\r\n catch (err) {\r\n if (this.onErrorHook) {\r\n const customErrResponse = this.onErrorHook(err);\r\n if (customErrResponse) {\r\n return {\r\n message : \"Interval Exception Raised\",\r\n status : 200\r\n }\r\n }\r\n }\r\n throw err;\r\n }\r\n finally {\r\n await engine.awaitPendingShutdown();\r\n }\r\n }\r\n}\r\n\r\nexport function createPulsarRequestHandler(opts : PulsarHandlerOptions) : PulsarRequestHandlerBuilder {\r\n return new PulsarRequestHandlerBuilder(opts);\r\n}"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";;;;yFAUA,UAAsB,CAAkB,EAAG,aAAY,gBAAe,k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Ae,CAAC,EAChB,MAAU,MAAM,8EAA8E,EAGlG,GAAI,CACA,IAAM,EAAgB,MAAM,EAAqB,CAC7C,SACA,UACA,iBACA,cACA,cACA,kBACA,gBACA,aACA,YAAc,CAClB,CAAC,EAED,GAAG,EACC,OAAO,EAGX,GAAI,GAAiB,EACjB,MAAM,EAAO,aAAa,CAAW,EAGrC,WAAM,EAAO,MAAM,EAGvB,MAAO,CACH,QAAS,8BACT,OAAQ,GACZ,EAEJ,MAAO,EAAK,CACR,GAAI,KAAK,aAEL,GAD0B,KAAK,YAAY,CAAG,EAE1C,MAAO,CACH,QAAU,4BACV,OAAS,GACb,EAGR,MAAM,SAEV,CACI,MAAM,EAAO,qBAAqB,GAG9C,CAEO,SAAS,CAA0B,CAAC,EAA2D,CAClG,OAAO,IAAI,EAA4B,CAAI",
|
|
11
|
+
"debugId": "B4777F1937E60F9B64756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ParsedRequest {
|
|
2
|
+
method: string;
|
|
3
|
+
url: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
query: Record<string, string>;
|
|
6
|
+
body: any;
|
|
7
|
+
rawBody: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseRequest(rawInput: any): Promise<ParsedRequest>;
|
|
10
|
+
//# sourceMappingURL=parseRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseRequest.d.ts","sourceRoot":"","sources":["../../../src/server/parser/parseRequest.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAwID,wBAAsB,YAAY,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,CAsHxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EnginePoolingMode } from "../../types/engine.types";
|
|
2
|
+
export type ResponseHeaders = {
|
|
3
|
+
isRestarted: boolean;
|
|
4
|
+
poolerMode: EnginePoolingMode;
|
|
5
|
+
lastExecutionId: string;
|
|
6
|
+
lastExecutionAt: string;
|
|
7
|
+
lastIsolateId: string;
|
|
8
|
+
executionOwner: "watchdog" | "engine" | "trigger";
|
|
9
|
+
targetQueue?: string;
|
|
10
|
+
fencingToken?: string;
|
|
11
|
+
workerId?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const extractHeaders: (rawHeaders: Record<string, string>) => ResponseHeaders;
|
|
14
|
+
//# sourceMappingURL=extract-headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-headers.d.ts","sourceRoot":"","sources":["../../../src/server/utility/extract-headers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAG,MAAM,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,YAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAI,eAYrE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EngineConfig } from "../types/base.types.d.ts";
|
|
2
|
+
import type { PostgresEngineOperationRepository } from "../storage/repositories/PostgresEngineOperationRepository";
|
|
3
|
+
import type { EngineQueuesConfig } from "../types/queue.types";
|
|
4
|
+
import type { PathValue, SettablePathKeys, ReadablePathKeys } from "../types/config.types";
|
|
5
|
+
export declare class ConfigurationStore {
|
|
6
|
+
private static instance;
|
|
7
|
+
protected _config?: EngineConfig;
|
|
8
|
+
private initialSnapshot?;
|
|
9
|
+
private logger;
|
|
10
|
+
constructor();
|
|
11
|
+
static getInstance(): ConfigurationStore;
|
|
12
|
+
initialize(baseConfig: EngineConfig): void;
|
|
13
|
+
private throwExpectionOnInvalidConfiguration;
|
|
14
|
+
private ensureInitialized;
|
|
15
|
+
get raw(): Readonly<EngineConfig>;
|
|
16
|
+
get<P extends ReadablePathKeys<EngineConfig>>(path: P): PathValue<EngineConfig, P>;
|
|
17
|
+
getInitialSnapshot(): Readonly<EngineConfig>;
|
|
18
|
+
set<P extends SettablePathKeys<EngineConfig>>(path: P, value: PathValue<EngineConfig, P>): void;
|
|
19
|
+
modifyQueue<K extends keyof EngineQueuesConfig, P extends SettablePathKeys<EngineQueuesConfig>>(queue: string, key: K, value: PathValue<EngineQueuesConfig, P>): void;
|
|
20
|
+
reconcileConfiguration(repository: PostgresEngineOperationRepository): Promise<"[Configuration] status : [VALID]." | "[Configuration] status : [INVALID & Reconciled].">;
|
|
21
|
+
}
|
|
22
|
+
export declare const config: ConfigurationStore;
|
|
23
|
+
//# sourceMappingURL=ConfigurationStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationStore.d.ts","sourceRoot":"","sources":["../../src/service/ConfigurationStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,K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FESPAN_MS: number);
|
|
4
|
+
isSameIsolate(id: string): boolean;
|
|
5
|
+
get id(): string;
|
|
6
|
+
get remainingTime(): number;
|
|
7
|
+
get uptime(): number;
|
|
8
|
+
get maxTime(): number;
|
|
9
|
+
set<T = unknown>(key: string, value: T): void;
|
|
10
|
+
get<T = unknown>(key: string): T | undefined;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Isolate.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Isolate.service.d.ts","sourceRoot":"","sources":["../../src/service/Isolate.service.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe;IACZ,OAAO,CAAC,uBAAuB;gBAAvB,uBAAuB,EAAG,MAAM;IAM7C,aAAa,CAAC,EAAE,EAAG,MAAM,GAAI,OAAO;IAI3C,IAAI,EAAE,IAAM,MAAM,CAEjB;IAED,IAAI,aAAa,IAAK,MAAM,CAU3B;IAED,IAAI,MAAM,IAAK,MAAM,CAGpB;IAED,IAAI,OAAO,IAAK,MAAM,CAErB;IAED,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAI,IAAI;IAI9C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC,GAAG,SAAS;CAGhD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PulsarCore } from "./PulsarBaseService.d.ts";
|
|
2
|
+
import type { ConfigForRuntime, PulsarRuntimeType } from "../types/runtime.types.d.ts";
|
|
3
|
+
export type SpawnerAlgorithm = "ROUND_ROBIN" | "LEAST_CONNECTIONS" | "CBS";
|
|
4
|
+
/**
|
|
5
|
+
* Main orchestrator engine for Pulsar responsible for managing queue execution loops,
|
|
6
|
+
* dynamic scheduling, non-blocking worker dispatching, telemetry collection,
|
|
7
|
+
*/
|
|
8
|
+
export declare class Pulsar<R extends PulsarRuntimeType = PulsarRuntimeType> extends PulsarCore {
|
|
9
|
+
private baseConfig;
|
|
10
|
+
private isolateId;
|
|
11
|
+
private currentExecutionId;
|
|
12
|
+
private lockKey;
|
|
13
|
+
private shutdownPromise;
|
|
14
|
+
private eventCleanUps;
|
|
15
|
+
private activeQueues;
|
|
16
|
+
constructor(baseConfig: ConfigForRuntime<R> & {
|
|
17
|
+
runtime: R;
|
|
18
|
+
});
|
|
19
|
+
start(): Promise<void>;
|
|
20
|
+
triggerQueue(queue: string): Promise<void>;
|
|
21
|
+
validateConfiguration(): Promise<{
|
|
22
|
+
status: number;
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
private configureQueueProfiles;
|
|
26
|
+
private runTick;
|
|
27
|
+
shutdown(): Promise<void>;
|
|
28
|
+
private doShutdown;
|
|
29
|
+
scheduleRestart(queue: string): Promise<void>;
|
|
30
|
+
restartForSameIsolate(headers: Record<string, string>): Promise<void>;
|
|
31
|
+
private get executionContext();
|
|
32
|
+
setCurrentExecutionId(id: string): void;
|
|
33
|
+
private generateCurrentExecutionIdFromConfig;
|
|
34
|
+
private registerEvents;
|
|
35
|
+
private removeRegisteredEvents;
|
|
36
|
+
awaitPendingShutdown(): Promise<void>;
|
|
37
|
+
deleteScheduledRestart(queue: string | '__GLOBAL__'): Promise<void>;
|
|
38
|
+
acquireExecutionLock(lockKey: string, ownerId: string, ttlMs: number): Promise<boolean>;
|
|
39
|
+
releaseExecutionLock(lockKey: string, ownerId: string): Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=Pulsar.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pulsar.service.d.ts","sourceRoot":"","sources":["../../src/service/Pulsar.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMrF,MAAM,MAAM,gBAAgB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ulsarClock.d.ts';
|
|
4
|
+
import { QueueService } from '../modules/Queue.module.d.ts';
|
|
5
|
+
import { SwarmManager } from './SwarmBudgetTracker.d.ts';
|
|
6
|
+
import { Scheduler } from "../modules/Scheduler.module.d.ts";
|
|
7
|
+
import { TickService } from '../modules/Tick.module.d.ts';
|
|
8
|
+
import { TickController } from '../modules/TickController.module.d.ts';
|
|
9
|
+
import { PulsarRuntime } from '../types/runtime.types.d.ts';
|
|
10
|
+
import type { EngineQueuesConfig } from '../types/queue.types.d.ts';
|
|
11
|
+
import type { EngineConsumerConfig } from '../types/consumer.types.d.ts';
|
|
12
|
+
import type { IsolateInstance } from './Isolate.service.d.ts';
|
|
13
|
+
import type { EngineConfig } from '../types/base.types.d.ts';
|
|
14
|
+
import type { IIntegration, IntegrationConstructor, IntegrationMap } from '../types/integrations.types.d.ts';
|
|
15
|
+
import type { PulsarRuntimeCore } from '../shared/PulsarRuntimeCore.d.ts';
|
|
16
|
+
import { UnifiedTransportManager } from '../network/UnifiedTransportManager.d.ts';
|
|
17
|
+
import { LoggerService } from '../subsys/LoggerService.d.ts';
|
|
18
|
+
/**
|
|
19
|
+
* Core abstract base class for the Pulsar engine ecosystem.
|
|
20
|
+
*
|
|
21
|
+
* Provides foundational lifecycle management, centralized event emitting, unified storage
|
|
22
|
+
* initialization, queue registration
|
|
23
|
+
*/
|
|
24
|
+
export declare abstract class PulsarCore {
|
|
25
|
+
protected storage: PulsarUnifiedStorage;
|
|
26
|
+
protected tickService: TickService;
|
|
27
|
+
protected tickController: TickController;
|
|
28
|
+
protected unifiedTransportManager: UnifiedTransportManager;
|
|
29
|
+
protected swarmManager: SwarmManager;
|
|
30
|
+
protected scheduler: Scheduler;
|
|
31
|
+
protected queueService: QueueService;
|
|
32
|
+
protected clock: PulsarClock;
|
|
33
|
+
protected events: PulsarEventBus;
|
|
34
|
+
protected queues: EngineQueuesConfig[];
|
|
35
|
+
protected consumers: EngineConsumerConfig[];
|
|
36
|
+
protected runtimeStrategy: PulsarRuntimeCore;
|
|
37
|
+
readonly logger: LoggerService;
|
|
38
|
+
private readonly integrations;
|
|
39
|
+
constructor(baseConfig: EngineConfig);
|
|
40
|
+
private resolveRuntimeStrategy;
|
|
41
|
+
protected runIntegrations(integrations: Array<IntegrationConstructor | IIntegration>): Promise<void>;
|
|
42
|
+
getIntegration<K extends keyof IntegrationMap>(moduleOrClass: K): IntegrationMap[K];
|
|
43
|
+
getIntegration<T extends IIntegration>(moduleOrClass: new (...args: any[]) => T): T;
|
|
44
|
+
get runtime(): keyof typeof PulsarRuntime;
|
|
45
|
+
get isV8Isolate(): boolean;
|
|
46
|
+
get V8Isolate(): IsolateInstance;
|
|
47
|
+
protected exit(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=PulsarBaseService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PulsarBaseService.d.ts","sourceRoot":"","sources":["../../src/service/PulsarBaseService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE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CAAC,SAAS,YAAY,EAAE,aAAa,EAAG,KAAK,GAAG,IAAI,EAAG,GAAG,EAAE,KAAK,CAAC,GAAI,CAAC;IAiB7F,IAAI,OAAO,IAAK,MAAM,OAAO,aAAa,CAEzC;IAED,IAAI,WAAW,YAEd;IAED,IAAI,SAAS,IAAK,eAAe,CAEhC;cAEe,IAAI;CAGvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EngineQueuesConfig } from "../types/queue.types";
|
|
2
|
+
type PulsarEventMap = {
|
|
3
|
+
"tick:time-exceeded": {
|
|
4
|
+
queue: string;
|
|
5
|
+
elapsedMs: number;
|
|
6
|
+
};
|
|
7
|
+
"tick:cycle-completed": {
|
|
8
|
+
queue: string;
|
|
9
|
+
cycles: number;
|
|
10
|
+
};
|
|
11
|
+
"tick:force-run": {
|
|
12
|
+
queue: EngineQueuesConfig;
|
|
13
|
+
reason?: string;
|
|
14
|
+
};
|
|
15
|
+
"tick:end": {
|
|
16
|
+
queue: string;
|
|
17
|
+
reason?: string;
|
|
18
|
+
};
|
|
19
|
+
"engine:shutdown-requested": {
|
|
20
|
+
reason: string;
|
|
21
|
+
};
|
|
22
|
+
"engine:health-check-requested": {
|
|
23
|
+
timestamp: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare class PulsarEventBus {
|
|
27
|
+
private target;
|
|
28
|
+
private pending;
|
|
29
|
+
private track;
|
|
30
|
+
emit<K extends keyof PulsarEventMap>(event: K, payload: PulsarEventMap[K]): void;
|
|
31
|
+
on<K extends keyof PulsarEventMap>(event: K, handler: (payload: PulsarEventMap[K]) => Promise<void> | void): () => void;
|
|
32
|
+
once<K extends keyof PulsarEventMap>(event: K, handler: (payload: PulsarEventMap[K]) => Promise<void> | void): void;
|
|
33
|
+
drain(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=PulsarEventBus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAI,IAAI;IAKhH,KAAK;CAKrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class SwarmManager {
|
|
2
|
+
private maxGlobalJobsPerTick;
|
|
3
|
+
private maxGlobalConcurrency;
|
|
4
|
+
constructor(maxGlobalJobsPerTick: number, maxGlobalConcurrency: number);
|
|
5
|
+
/**
|
|
6
|
+
* Getter for configured maximum global worker concurrency.
|
|
7
|
+
*/
|
|
8
|
+
getMaxGlobalConcurrency(): number;
|
|
9
|
+
/**
|
|
10
|
+
* Getter for configured maximum global jobs per 1s tick window.
|
|
11
|
+
*/
|
|
12
|
+
getMaxGlobalJobsPerTick(): number;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=SwarmBudgetTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwarmBudgetTracker.d.ts","sourceRoot":"","sources":["../../src/service/SwarmBudgetTracker.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IAEjB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,oBAAoB;gBADpB,oBAAoB,EAAE,MAAM,EAC5B,oBAAoB,EAAE,MAAM;IAGxC;;OAEG;IACI,uBAAuB,IAAI,MAAM;IAIxC;;OAEG;IACI,uBAAuB,IAAI,MAAM;CAG3C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ParsedRequest {
|
|
2
|
+
method: string;
|
|
3
|
+
url: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
query: Record<string, string>;
|
|
6
|
+
body: any;
|
|
7
|
+
rawBody: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseAnyPayload(rawInput: any): Promise<ParsedRequest>;
|
|
10
|
+
//# sourceMappingURL=PulsarWorker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PulsarWorker.d.ts","sourceRoot":"","sources":["../../../src/service/consumers/PulsarWorker.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAwID,wBAAsB,eAAe,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,CAsH3E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { QueueService } from "../modules/Queue.module.d.ts";
|
|
2
|
+
import type { PulsarClock } from "../subsys/PulsarClock.d.ts";
|
|
3
|
+
import type { IPulsarRuntime, IRuntimeExecutionContext } from "../runtimes/runtimeTypes.d.ts";
|
|
4
|
+
import type { EngineQueuesConfig } from "../types/queue.types.d.ts";
|
|
5
|
+
import type { IsolateInstance } from "../service/Isolate.service.d.ts";
|
|
6
|
+
import type { PulsarUnifiedStorage } from "../storage/PulsarStorage.d.ts";
|
|
7
|
+
import type { PulsarEventBus } from "../service/PulsarEventBus.d.ts";
|
|
8
|
+
import type { Scheduler } from "../modules/Scheduler.module.d.ts";
|
|
9
|
+
import { type ILogger } from "../subsys/LoggerService.d.ts";
|
|
10
|
+
export interface RuntimeDependencies {
|
|
11
|
+
queueService: QueueService;
|
|
12
|
+
clock: PulsarClock;
|
|
13
|
+
storage: PulsarUnifiedStorage;
|
|
14
|
+
queues: EngineQueuesConfig[];
|
|
15
|
+
events: PulsarEventBus;
|
|
16
|
+
isolate: IsolateInstance;
|
|
17
|
+
scheduler: Scheduler;
|
|
18
|
+
}
|
|
19
|
+
interface ISelfInvocationState {
|
|
20
|
+
idpInvoked: boolean;
|
|
21
|
+
continuationScheduledForCurrentLock: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface ExecuteSelfInvocation {
|
|
24
|
+
queue: string;
|
|
25
|
+
pooler: string;
|
|
26
|
+
delaySec: number;
|
|
27
|
+
continuationOwnerId: string;
|
|
28
|
+
isIdpLock: boolean;
|
|
29
|
+
isEdpLock: boolean;
|
|
30
|
+
targetEdpQueue: string | null;
|
|
31
|
+
}
|
|
32
|
+
export declare abstract class PulsarRuntimeCore implements IPulsarRuntime {
|
|
33
|
+
abstract readonly type: "PERSISTENT" | "SERVERLESS_VM" | "V8_ISOLATE";
|
|
34
|
+
abstract readonly shouldShutdownOnCycleComplete: boolean;
|
|
35
|
+
/** Minimum runtime required to make booting up the engine worth it (in seconds) */
|
|
36
|
+
abstract readonly minBootRequirementSec: number;
|
|
37
|
+
protected queueService: QueueService;
|
|
38
|
+
protected clock: PulsarClock;
|
|
39
|
+
protected queues: EngineQueuesConfig[];
|
|
40
|
+
protected storage: PulsarUnifiedStorage;
|
|
41
|
+
protected isolate: IsolateInstance;
|
|
42
|
+
protected events: PulsarEventBus;
|
|
43
|
+
protected scheduler: Scheduler;
|
|
44
|
+
protected logger: ILogger;
|
|
45
|
+
constructor(deps: RuntimeDependencies);
|
|
46
|
+
abstract onStart(ctx: IRuntimeExecutionContext): Promise<void>;
|
|
47
|
+
abstract handleCycleCompletion(ctx: IRuntimeExecutionContext): Promise<boolean>;
|
|
48
|
+
abstract handleRestart(ctx: IRuntimeExecutionContext): Promise<void>;
|
|
49
|
+
abstract executeTick(queueConfig: EngineQueuesConfig, tickRunner: () => Promise<void>): Promise<void>;
|
|
50
|
+
abstract scheduleTick(queueConfig: EngineQueuesConfig, tickRunner: () => Promise<void>): Promise<void>;
|
|
51
|
+
protected executeQueuesTick(runTick: IRuntimeExecutionContext["runTick"]): Promise<void>;
|
|
52
|
+
protected triggerSelfInvocation(args: ExecuteSelfInvocation): Promise<ISelfInvocationState>;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=PulsarRuntimeCore.d.ts.map
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AAC,IAAI,EAAG,qBAAqB,GAAI,OAAO,CAAC,oBAAoB,CAAC;CA6CtG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TimingProfileType = 'REALTIME' | 'STANDARD' | 'RELAXED' | 'ULTRA_EFFICIENT' | 'BALANCED' | 'CUSTOM';
|
|
2
|
+
export interface TimingProfile {
|
|
3
|
+
activePollMs: number;
|
|
4
|
+
backoffPollMs: number;
|
|
5
|
+
idlePollMs?: number;
|
|
6
|
+
maxTimerMs: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const TIMING_PROFILES: Record<Exclude<TimingProfileType, 'CUSTOM'>, TimingProfile>;
|
|
9
|
+
//# sourceMappingURL=TimingProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimingProfile.d.ts","sourceRoot":"","sources":["../../src/static/TimingProfile.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,UAAU,GAAI,QAAQ,CAAC;AAEjH,MAAM,WAAW,aAAa;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EAAE,aAAa,CAoCvF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/static/static.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAG1D,eAAO,MAAM,aAAa,QAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PostgresDriver } from "./drivers/PostgresDriver.d.ts";
|
|
2
|
+
import type { RedisDriver } from "./drivers/RedisDriver.d.ts";
|
|
3
|
+
import type { IQueueRepository } from "./repositories/QueueRepository.d.ts";
|
|
4
|
+
import { PostgresEngineOperationRepository } from "./repositories/PostgresEngineOperationRepository.d.ts";
|
|
5
|
+
export type StorageStrategy = "AUTO" | "REDIS_CACHE" | "PG_UNLOGGED";
|
|
6
|
+
export interface PulsarStorageOptions {
|
|
7
|
+
cache?: RedisDriver;
|
|
8
|
+
db: PostgresDriver;
|
|
9
|
+
/**
|
|
10
|
+
* Storage Pooling Strategies:
|
|
11
|
+
* - "AUTO" : Uses Redis if `cache` is defined; otherwise falls back to PG_UNLOGGED.
|
|
12
|
+
* - "REDIS_CACHE" : Forces in-memory Redis buffers for maximum speed (Requires Redis).
|
|
13
|
+
* - "PG_UNLOGGED" : Uses Postgres Unlogged tables for fast volatile queueing (No Redis needed).
|
|
14
|
+
*/
|
|
15
|
+
strategy?: StorageStrategy;
|
|
16
|
+
syncIntervalMs?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Unified storage orchestrator for Pulsar queueing mechanics.
|
|
20
|
+
*
|
|
21
|
+
* Manages the initialization, strategy resolution, and connection lifecycles of underlying
|
|
22
|
+
* storage drivers (Postgres and optional Redis). Depending on the selected `StorageStrategy`,
|
|
23
|
+
* it dynamically delegates queue operations to a high-throughput Redis memory store or
|
|
24
|
+
* an optimized PostgreSQL repository (such as unlogged tables) while guaranteeing core
|
|
25
|
+
* database mechanics for engine orchestration.
|
|
26
|
+
*/
|
|
27
|
+
export declare class PulsarUnifiedStorage {
|
|
28
|
+
readonly repository: IQueueRepository;
|
|
29
|
+
readonly cache?: RedisDriver;
|
|
30
|
+
readonly db: PostgresDriver;
|
|
31
|
+
readonly ops: PostgresEngineOperationRepository;
|
|
32
|
+
private readonly logger;
|
|
33
|
+
readonly strategy: StorageStrategy;
|
|
34
|
+
readonly syncIntervalMs: number;
|
|
35
|
+
private isConnected;
|
|
36
|
+
constructor(options: PulsarStorageOptions);
|
|
37
|
+
bindInstanceId(instanceId: string): void;
|
|
38
|
+
connect(): Promise<void>;
|
|
39
|
+
disconnect(): Promise<void>;
|
|
40
|
+
healthCheck(): Promise<Record<string, any>>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=PulsarStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PulsarStorage.d.ts","sourceRoot":"","sources":["../../src/storage/PulsarStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAK1E,OAAO,EAAE,iCAAiC,EAAE,MAAM,qDAAqD,CAAC;AAGxG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,cAAc,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC7B,SAAgB,UAAU,EAAG,gBAAgB,CAAC;IAE9C,SAAgB,KAAK,CAAC,EAAG,WAAW,CAAC;IACrC,SAAgB,EAAE,EAAG,cAAc,CAAC;IACpC,SAAgB,GAAG,EAAG,iCAAiC,CAAC;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC,SAAgB,QAAQ,EAAG,eAAe,CAAC;IAC3C,SAAgB,cAAc,EAAG,MAAM,CAAC;IACxC,OAAO,CAAC,WAAW,CAAmB;gBAE1B,OAAO,EAAG,oBAAoB;IAqCnC,cAAc,CAAC,UAAU,EAAE,MAAM;IAS3B,OAAO;IAYP,UAAU;IAUV,WAAW;CAK3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import postgres from "postgres";
|
|
2
|
+
import type { IPulsarDriver, PostgresDriverOptions, StorageHealth } from "./types.d.ts";
|
|
3
|
+
export declare class PostgresDriver implements IPulsarDriver {
|
|
4
|
+
readonly options: PostgresDriverOptions;
|
|
5
|
+
readonly type = "database";
|
|
6
|
+
readonly name = "PostgresDriver";
|
|
7
|
+
private sql;
|
|
8
|
+
private isConnected;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
constructor(options: PostgresDriverOptions);
|
|
12
|
+
private initClient;
|
|
13
|
+
setKeyPrefix(instanceId: string): void;
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
disconnect(): Promise<void>;
|
|
16
|
+
healthCheck(): Promise<StorageHealth>;
|
|
17
|
+
getNativeClient<T = postgres.Sql>(): T;
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=PostgresDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresDriver.d.ts","sourceRoot":"","sources":["../../../src/storage/drivers/PostgresDriver.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGtF,qBAAa,cAAe,YAAW,aAAa;aASpB,OAAO,EAAE,qBAAqB;IAR1D,SAAgB,IAAI,cAAc;IAClC,SAAgB,IAAI,oBAAoB;IACxC,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,WAAW,CAAS;IAErB,MAAM,CAAC,EAAG,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEN,OAAO,EAAE,qBAAqB;IAI1D,OAAO,CAAC,UAAU;IAMX,YAAY,CAAC,UAAU,EAAG,MAAM;IAI1B,OAAO;IAeP,UAAU;IAQV,WAAW,IAAK,OAAO,CAAC,aAAa,CAAC;IAY5C,eAAe,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,KAAM,CAAC;IAKxC,KAAK;CAGd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Redis as RedisTCP } from "ioredis";
|
|
2
|
+
import { Redis as RedisHTTP } from "@upstash/redis";
|
|
3
|
+
import type { IPulsarDriver, RedisDriverOptions, StorageHealth } from "./types.d.ts";
|
|
4
|
+
export declare class RedisDriver implements IPulsarDriver {
|
|
5
|
+
readonly options: RedisDriverOptions;
|
|
6
|
+
readonly type = "cache";
|
|
7
|
+
readonly name = "RedisDriver";
|
|
8
|
+
private tcpClient?;
|
|
9
|
+
private httpClient?;
|
|
10
|
+
prefix?: string;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(options: RedisDriverOptions);
|
|
13
|
+
private initClients;
|
|
14
|
+
setKeyPrefix(instanceId: string): void;
|
|
15
|
+
connect(): Promise<void>;
|
|
16
|
+
disconnect(): Promise<void>;
|
|
17
|
+
healthCheck(): Promise<StorageHealth>;
|
|
18
|
+
getNativeClient<T = RedisTCP | RedisHTTP>(protocol?: "tcp" | "http"): T;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=RedisDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisDriver.d.ts","sourceRoot":"","sources":["../../../src/storage/drivers/RedisDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAInF,qBAAa,WAAY,YAAW,aAAa;aAUjB,OAAO,EAAG,kBAAkB;IATxD,SAAgB,IAAI,WAAW;IAC/B,SAAgB,IAAI,iBAAiB;IAErC,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAY;IAExB,MAAM,CAAC,EAAG,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEN,OAAO,EAAG,kBAAkB;IAIxD,OAAO,CAAC,WAAW;IAeZ,YAAY,CAAC,UAAU,EAAG,MAAM;IAI1B,OAAO;IAkCP,UAAU;IAeV,WAAW,IAAK,OAAO,CAAC,aAAa,CAAC;IAgB5C,eAAe,CAAC,CAAC,GAAG,QAAQ,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM;CAW7E"}
|