@nightx.co/pulsar 1.0.15 → 1.0.17
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/LICENSE +207 -0
- package/README.md +83 -10
- package/dist/chunk-cpn1qh4e.js.map +2 -2
- package/dist/helpers/computeConfigDelta.d.ts.map +1 -1
- package/dist/helpers/generateShaHash.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +8 -8
- package/dist/network/abstract/BaseNetworkDriver.d.ts +1 -1
- package/dist/network/abstract/BaseNetworkDriver.d.ts.map +1 -1
- package/dist/network/drivers/HttpNetworkDriver.d.ts +1 -1
- package/dist/network/drivers/HttpNetworkDriver.d.ts.map +1 -1
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts +1 -1
- package/dist/network/drivers/WebSocketNetworkDriver.d.ts.map +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/index.js.map +4 -4
- package/dist/subsys/LoggerService.d.ts.map +1 -1
- package/dist/types/consumer.types.d.ts +36 -0
- package/dist/types/consumer.types.d.ts.map +1 -1
- package/package.json +4 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the
|
|
13
|
+
copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other
|
|
16
|
+
entities that control, are controlled by, or are under common control with
|
|
17
|
+
that entity. For the purposes of this definition, "control" means (i) the
|
|
18
|
+
power, direct or indirect, to cause the direction or management of such
|
|
19
|
+
entity, whether by contract or otherwise, or (ii) ownership of
|
|
20
|
+
fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
|
|
21
|
+
ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
24
|
+
permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation source,
|
|
28
|
+
and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical transformation
|
|
31
|
+
or translation of a Source form, including but not limited to compiled
|
|
32
|
+
object code, generated documentation, and conversions to
|
|
33
|
+
other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or Object
|
|
36
|
+
form, made available under the License, as indicated by a copyright notice
|
|
37
|
+
that is included in or attached to the work (an example is provided in the
|
|
38
|
+
Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object form,
|
|
41
|
+
that is based on (or derived from) the Work and for which the editorial
|
|
42
|
+
revisions, annotations, elaborations, or other modifications represent,
|
|
43
|
+
as a whole, an original work of authorship. For the purposes of this
|
|
44
|
+
License, Derivative Works shall not include works that remain separable
|
|
45
|
+
from, or merely link (or bind by name) to the interfaces of, the Work and
|
|
46
|
+
Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including the original
|
|
49
|
+
version of the Work and any modifications or additions to that Work or
|
|
50
|
+
Derivative Works thereof, that is intentionally submitted to Licensor for
|
|
51
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
52
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
53
|
+
For the purposes of this definition, "submitted" means any form of
|
|
54
|
+
electronic, verbal, or written communication sent to the Licensor or its
|
|
55
|
+
representatives, including but not limited to communication on electronic
|
|
56
|
+
mailing lists, source code control systems, and issue tracking systems
|
|
57
|
+
that are managed by, or on behalf of, the Licensor for the purpose of
|
|
58
|
+
discussing and improving the Work, but excluding communication that is
|
|
59
|
+
conspicuously marked or otherwise designated in writing by the copyright
|
|
60
|
+
owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on
|
|
63
|
+
behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License.
|
|
67
|
+
|
|
68
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
69
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
70
|
+
royalty-free, irrevocable copyright license to reproduce, prepare
|
|
71
|
+
Derivative Works of, publicly display, publicly perform, sublicense,
|
|
72
|
+
and distribute the Work and such Derivative Works in
|
|
73
|
+
Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License.
|
|
76
|
+
|
|
77
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
78
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
79
|
+
royalty-free, irrevocable (except as stated in this section) patent
|
|
80
|
+
license to make, have made, use, offer to sell, sell, import, and
|
|
81
|
+
otherwise transfer the Work, where such license applies only to those
|
|
82
|
+
patent claims licensable by such Contributor that are necessarily
|
|
83
|
+
infringed by their Contribution(s) alone or by combination of their
|
|
84
|
+
Contribution(s) with the Work to which such Contribution(s) was submitted.
|
|
85
|
+
If You institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
87
|
+
Contribution incorporated within the Work constitutes direct or
|
|
88
|
+
contributory patent infringement, then any patent licenses granted to
|
|
89
|
+
You under this License for that Work shall terminate as of the date such
|
|
90
|
+
litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution.
|
|
93
|
+
|
|
94
|
+
You may reproduce and distribute copies of the Work or Derivative Works
|
|
95
|
+
thereof in any medium, with or without modifications, and in Source or
|
|
96
|
+
Object form, provided that You meet the following conditions:
|
|
97
|
+
|
|
98
|
+
1. You must give any other recipients of the Work or Derivative Works a
|
|
99
|
+
copy of this License; and
|
|
100
|
+
|
|
101
|
+
2. You must cause any modified files to carry prominent notices stating
|
|
102
|
+
that You changed the files; and
|
|
103
|
+
|
|
104
|
+
3. You must retain, in the Source form of any Derivative Works that You
|
|
105
|
+
distribute, all copyright, patent, trademark, and attribution notices from
|
|
106
|
+
the Source form of the Work, excluding those notices that do not pertain
|
|
107
|
+
to any part of the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution,
|
|
110
|
+
then any Derivative Works that You distribute must include a readable copy
|
|
111
|
+
of the attribution notices contained within such NOTICE file, excluding
|
|
112
|
+
those notices that do not pertain to any part of the Derivative Works,
|
|
113
|
+
in at least one of the following places: within a NOTICE text file
|
|
114
|
+
distributed as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or, within a
|
|
116
|
+
display generated by the Derivative Works, if and wherever such
|
|
117
|
+
third-party notices normally appear. The contents of the NOTICE file are
|
|
118
|
+
for informational purposes only and do not modify the License.
|
|
119
|
+
You may add Your own attribution notices within Derivative Works that You
|
|
120
|
+
distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
121
|
+
provided that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and may
|
|
125
|
+
provide additional or different license terms and conditions for use,
|
|
126
|
+
reproduction, or distribution of Your modifications, or for any such
|
|
127
|
+
Derivative Works as a whole, provided Your use, reproduction, and
|
|
128
|
+
distribution of the Work otherwise complies with the conditions
|
|
129
|
+
stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions.
|
|
132
|
+
|
|
133
|
+
Unless You explicitly state otherwise, any Contribution intentionally
|
|
134
|
+
submitted for inclusion in the Work by You to the Licensor shall be under
|
|
135
|
+
the terms and conditions of this License, without any additional
|
|
136
|
+
terms or conditions. Notwithstanding the above, nothing herein shall
|
|
137
|
+
supersede or modify the terms of any separate license agreement you may
|
|
138
|
+
have executed with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks.
|
|
141
|
+
|
|
142
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
143
|
+
service marks, or product names of the Licensor, except as required for
|
|
144
|
+
reasonable and customary use in describing the origin of the Work and
|
|
145
|
+
reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty.
|
|
148
|
+
|
|
149
|
+
Unless required by applicable law or agreed to in writing, Licensor
|
|
150
|
+
provides the Work (and each Contributor provides its Contributions)
|
|
151
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
152
|
+
either express or implied, including, without limitation, any warranties
|
|
153
|
+
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
|
|
154
|
+
FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any risks
|
|
156
|
+
associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability.
|
|
159
|
+
|
|
160
|
+
In no event and under no legal theory, whether in tort
|
|
161
|
+
(including negligence), contract, or otherwise, unless required by
|
|
162
|
+
applicable law (such as deliberate and grossly negligent acts) or agreed
|
|
163
|
+
to in writing, shall any Contributor be liable to You for damages,
|
|
164
|
+
including any direct, indirect, special, incidental, or consequential
|
|
165
|
+
damages of any character arising as a result of this License or out of
|
|
166
|
+
the use or inability to use the Work (including but not limited to damages
|
|
167
|
+
for loss of goodwill, work stoppage, computer failure or malfunction,
|
|
168
|
+
or any and all other commercial damages or losses), even if such
|
|
169
|
+
Contributor has been advised of the possibility of such damages.
|
|
170
|
+
|
|
171
|
+
9. Accepting Warranty or Additional Liability.
|
|
172
|
+
|
|
173
|
+
While redistributing the Work or Derivative Works thereof, You may choose
|
|
174
|
+
to offer, and charge a fee for, acceptance of support, warranty,
|
|
175
|
+
indemnity, or other liability obligations and/or rights consistent with
|
|
176
|
+
this License. However, in accepting such obligations, You may act only
|
|
177
|
+
on Your own behalf and on Your sole responsibility, not on behalf of any
|
|
178
|
+
other Contributor, and only if You agree to indemnify, defend, and hold
|
|
179
|
+
each Contributor harmless for any liability incurred by, or claims
|
|
180
|
+
asserted against, such Contributor by reason of your accepting any such
|
|
181
|
+
warranty or additional liability.
|
|
182
|
+
|
|
183
|
+
END OF TERMS AND CONDITIONS
|
|
184
|
+
|
|
185
|
+
APPENDIX: How to apply the Apache License to your work
|
|
186
|
+
|
|
187
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
188
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
189
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
190
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
191
|
+
recommend that a file or class name and description of purpose be included
|
|
192
|
+
on the same "printed page" as the copyright notice for easier
|
|
193
|
+
identification within third-party archives.
|
|
194
|
+
|
|
195
|
+
Copyright {{ year }} {{ organization }}
|
|
196
|
+
|
|
197
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
|
+
you may not use this file except in compliance with the License.
|
|
199
|
+
You may obtain a copy of the License at
|
|
200
|
+
|
|
201
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
+
|
|
203
|
+
Unless required by applicable law or agreed to in writing, software
|
|
204
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
205
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
206
|
+
or implied. See the License for the specific language governing
|
|
207
|
+
permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,15 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pulsar Runtime-Flexible Messaging Poller and Orchestration Engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pulsar is an open-source, runtime-flexible messaging poller and orchestration engine built on PostgreSQL and PGMQ. It provides the execution layer required to reliably pull, coordinate, and dispatch queued jobs across serverless functions, edge runtimes, and persistent servers.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
bun install
|
|
7
|
-
```
|
|
5
|
+
Pulsar is not a message queue or broker. It operates on top of an existing PGMQ and PostgreSQL infrastructure, managing the execution lifecycle around the messages stored there. Rather than requiring developers to build their own polling loops, concurrency controls, worker coordination, and runtime-specific execution logic, Pulsar provides a configurable engine that handles these responsibilities while allowing developers to retain control over their database, queue infrastructure, and business logic.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
## Execution Engine and Tick-Based Processing
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
bun run index.ts
|
|
13
|
-
```
|
|
9
|
+
At the core of Pulsar is a tick-based execution model. A tick represents one complete execution cycle in which the engine evaluates queue configurations and execution limits, determines how much work can be processed, pulls a batch of jobs from PGMQ, dispatches those jobs to their configured consumers, updates operational state, and determines whether another cycle should run.
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
The engine coordinates work according to per-queue concurrency settings, batch sizes, maximum jobs per tick, and global concurrency limits. When the requested workload exceeds the available execution budget, Pulsar adjusts the amount of work processed rather than blindly attempting to execute everything at once. It also supports sequential and parallel tick execution, allowing developers to choose between more controlled resource consumption and greater throughput.
|
|
12
|
+
|
|
13
|
+
Pulsar's internal clock tracks the execution time available to the current runtime. This is particularly important in serverless environments, where each invocation has a finite execution window. Instead of depending on a long-running process, the engine can stop a cycle before reaching the host's execution limit and hand off further work to a fresh invocation. This allows execution to continue across multiple runtime invocations without requiring a permanently running server.
|
|
14
|
+
|
|
15
|
+
## Interval-Driven and Event-Driven Polling
|
|
16
|
+
|
|
17
|
+
Pulsar supports two approaches to activating queue processing.
|
|
18
|
+
|
|
19
|
+
**Interval-driven polling** checks queues according to a configured polling cadence. Developers can choose a timing profile based on their latency and resource-consumption requirements, ranging from frequent polling for latency-sensitive workloads to longer intervals for background jobs where minimizing database activity is more important. Polling is coordinated through shared locking to prevent multiple workers from independently processing the same scheduled queue work.
|
|
20
|
+
|
|
21
|
+
**Event-driven activation** allows a queue to remain idle until a database event triggers processing. When new work arrives, the engine can activate and drain the queue rather than continuously polling an empty queue. A burst of inserted messages can therefore be handled as a coordinated processing cycle instead of requiring a separate engine invocation for every message.
|
|
22
|
+
|
|
23
|
+
These approaches let developers balance responsiveness, database load, and execution cost according to the nature of each workload.
|
|
24
|
+
|
|
25
|
+
## Runtime-Aware Execution
|
|
26
|
+
|
|
27
|
+
Pulsar is designed to adapt its execution lifecycle to different hosting environments rather than requiring one runtime model for every deployment.
|
|
28
|
+
|
|
29
|
+
- **V8 isolates and edge runtimes:** The engine accounts for invocation limits and isolate lifecycle constraints. It can pause and trigger a fresh invocation when required, using a configured self-invocation mechanism.
|
|
30
|
+
- **Serverless virtual machines and containers:** Each invocation processes work within its execution budget and can initiate a subsequent run when more work remains.
|
|
31
|
+
- **Persistent runtimes:** The engine can remain active in a long-running process, continuously coordinating ticks without requiring serverless-style self-invocation.
|
|
32
|
+
|
|
33
|
+
Runtime configuration determines how Pulsar manages execution budgets, tick limits, restarts, and continuation. This allows the same orchestration model to support both short-lived serverless execution and long-running worker deployments.
|
|
34
|
+
|
|
35
|
+
## Queue-Level Configuration and Resource Management
|
|
36
|
+
|
|
37
|
+
Each queue can be configured independently with its own consumer, polling profile, concurrency, batch size, and execution limits. This makes it possible to run queues with different workload characteristics through the same engine without forcing them to share identical processing policies.
|
|
38
|
+
|
|
39
|
+
Pulsar also coordinates concurrency at the engine level. Per-queue settings determine how much work an individual queue can request, while a global concurrency limit caps the total workload across queues. When multiple queues compete for execution capacity, the engine adjusts their available concurrency according to the configured limits.
|
|
40
|
+
|
|
41
|
+
This provides a common resource-management layer for workloads that differ in throughput, latency sensitivity, and processing cost.
|
|
42
|
+
|
|
43
|
+
## Worker Coordination, Locking, and Recovery
|
|
44
|
+
|
|
45
|
+
Coordinating job execution requires more than pulling messages. Pulsar manages operational state associated with workers, execution slots, distributed locks, and job processing. These mechanisms help coordinate concurrent workers, reduce conflicting execution, and support retry and failure-recovery workflows.
|
|
46
|
+
|
|
47
|
+
The engine also manages worker registration and deregistration, allowing execution capacity to be tracked as workers begin and finish processing. Correct lifecycle management is important for preventing occupied worker slots from accumulating and eventually blocking queue progress.
|
|
48
|
+
|
|
49
|
+
Pulsar's coordination mechanisms operate alongside PGMQ's message-management capabilities. They provide the orchestration required to execute jobs across different runtime environments without turning Pulsar itself into another message-storage system.
|
|
50
|
+
|
|
51
|
+
## Unified Storage Architecture
|
|
52
|
+
|
|
53
|
+
Pulsar separates durable message storage from the operational state needed to coordinate execution.
|
|
54
|
+
|
|
55
|
+
PostgreSQL remains the underlying persistent database, with PGMQ responsible for queue and message management. Pulsar's unified storage layer handles operational coordination such as worker registration, deregistration, execution state, and locking.
|
|
56
|
+
|
|
57
|
+
Redis is an optional acceleration layer for frequently accessed operational state. Depending on the deployment, Pulsar can communicate with Redis through a standard TCP driver or an HTTP-based driver suitable for serverless and edge environments.
|
|
58
|
+
|
|
59
|
+
When Redis is not configured, Pulsar can use an unlogged PostgreSQL table for relevant operational operations. This provides a database-backed alternative without requiring an additional cache service. Because PostgreSQL unlogged tables are not crash-durable, their operational contents can be cleared after a database crash; this does not mean the underlying PGMQ messages are stored in those tables.
|
|
60
|
+
|
|
61
|
+
This architecture allows deployments to choose between a simpler PostgreSQL-only setup and a configuration that uses Redis to accelerate hot operational paths.
|
|
62
|
+
|
|
63
|
+
## Flexible Consumer and Dispatch Architecture
|
|
64
|
+
|
|
65
|
+
Pulsar separates job orchestration from the code that performs the actual work. Once jobs are pulled from PGMQ, they can be dispatched to consumers through different execution mechanisms.
|
|
66
|
+
|
|
67
|
+
- **HTTP consumers:** Pulsar sends jobs to an HTTP endpoint, allowing the handler to run in a separate service, another runtime, or a different programming language.
|
|
68
|
+
- **Asynchronous callback consumers:** Jobs can be executed by a callback function within the same process, avoiding an additional network hop where in-process execution is appropriate.
|
|
69
|
+
- **Persistent network consumers:** In persistent deployments, WebSocket-based dispatch can provide a long-lived communication channel between Pulsar and connected consumers. Pulsar manages the transport integration so developers do not need to implement runtime-specific HTTP server and WebSocket upgrade boilerplate themselves.
|
|
70
|
+
- **External integrations:** Consumer logic can forward or transform work for systems such as Kafka, NATS, or other messaging infrastructure.
|
|
71
|
+
|
|
72
|
+
Transport selection depends on the deployment topology. Persistent engine and consumer deployments can use WebSockets for ongoing communication, while serverless consumers commonly use HTTP endpoints. This allows Pulsar to support different networking requirements without forcing every consumer to run in the same environment.
|
|
73
|
+
|
|
74
|
+
Consumer execution and job-storage lifecycle operations are separate concerns. Where consumers need to acknowledge, retry, or otherwise update job and worker state, Pulsar's storage abstractions allow those operations to be handled without requiring every consumer to initialize the complete orchestration engine or duplicate its scheduling responsibilities.
|
|
75
|
+
|
|
76
|
+
## Extensibility and Customization
|
|
77
|
+
|
|
78
|
+
Pulsar is designed to provide an orchestration foundation rather than dictate application-level business logic. Developers can configure queue behavior, consumer implementations, execution limits, dispatch mechanisms, and storage options to match their applications.
|
|
79
|
+
|
|
80
|
+
Its extensibility supports custom hooks, payload transformations, queue routing, and event-driven activation. Consumers remain responsible for the application-specific work performed by each job, while Pulsar coordinates when that work is pulled, how execution capacity is allocated, and how processing continues across runtime boundaries.
|
|
81
|
+
|
|
82
|
+
## The Role of Pulsar
|
|
83
|
+
|
|
84
|
+
Pulsar bridges the gap between a PostgreSQL-backed message queue and the runtime environments responsible for executing its jobs. PGMQ provides message management; PostgreSQL provides the underlying database; consumers provide business logic; and Pulsar coordinates the execution lifecycle connecting them.
|
|
85
|
+
|
|
86
|
+
By combining tick-based processing, runtime-aware scheduling, interval-driven and event-driven polling, concurrency management, worker coordination, flexible dispatch, and optional Redis acceleration, Pulsar provides a unified orchestration engine for applications that need to process queued work across serverless functions, edge runtimes, and persistent infrastructure.
|
|
87
|
+
|
|
88
|
+
Its central goal is to let developers use PostgreSQL and PGMQ as their messaging foundation without having to build and maintain a separate, runtime-specific polling and orchestration system themselves.
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export enum EventTriggerStrategy {\r\n /**\r\n * Uses PostgreSQL LISTEN/NOTIFY (PG Notify) for real-time event-driven queue triggering.\r\n * \r\n * **How it works:** The engine establishes a persistent subscription to a database channel. \r\n * When an event occurs, Postgres broadcasts an instant notification, triggering the queues \r\n * immediately with minimal latency and zero polling overhead.\r\n * \r\n * **Crucial Infrastructure Requirement:** This strategy **requires a direct, persistent TCP \r\n * connection URL** provided to the Postgres driver. If your database infrastructure uses serverless \r\n * proxies, restricted connection pools, or environments that do not support long-lived TCP socket \r\n * listeners (LISTEN/NOTIFY state), this strategy will fail to receive events.\r\n */\r\n POSTGRES_NOTIFY = \"POSTGRES_NOTIFY\",\r\n\r\n /**\r\n * Uses an external HTTP webhook driven directly by the database (`pg_net`).\r\n * \r\n * **How it works:** This strategy requires an accessible HTTP endpoint to be exposed on the \r\n * running container or machine. When an event occurs, Postgres utilizes the built-in `pg_net` \r\n * extension to fire an outbound HTTP request directly to this endpoint, which in turn invokes \r\n * and executes the event-driven queues.\r\n */\r\n WEBHOOK = \"WEBHOOK\",\r\n\r\n /**\r\n * Uses a database-backed table polling mechanism.\r\n * \r\n * **How it works:** Completely independent of persistent TCP notification sockets or HTTP \r\n * endpoints. Instead, event producers insert new task rows directly into a designated \r\n * subscription table. The engine periodically polls this table at a configured interval \r\n * (e.g., every 500ms) to scan for new rows, process them, and trigger the respective queues.\r\n */\r\n POLLING = \"POLLING\"\r\n}",
|
|
6
6
|
"import { IsolateInstance } from \"../service/Isolate.service.ts\";\r\nimport type { NetworkConfig } from \"../network/interfaces/network.types.ts\";\r\nimport type { BaseEngineConfig } from \"./base.types.ts\";\r\nimport type { PersistentEngine, SelfInvokingEngine } from \"./engine.types.ts\";\r\nimport type { EventTriggerStrategy } from \"./eventTriggerStrategry.types.ts\";\r\n\r\n/**\r\n * Supported runtime execution environments for Pulsar.\r\n */\r\nexport enum PulsarRuntime {\r\n /**\r\n * Configuration for ephemeral V8 isolate environments (Cloudflare Workers, Supabase Edge, Deno Deploy).\r\n * \r\n * In V8 isolate platforms, incoming requests share the same warm memory space until the isolate shuts down.\r\n * The engine relies on the required `isolate` instance to monitor remaining isolate lifespan, handle dynamic global \r\n * state, and sync tick schedules before the V8 isolate gets terminated by the cloud provider.\r\n */\r\n V8_ISOLATE = \"v8-isolate\",\r\n \r\n /**\r\n * Configuration for containerized or persistent runtime environments (AWS Lambda, GCP Cloud Run, Docker, Node.js VMs).\r\n * \r\n * Unlike V8 isolates, these environments operate in dedicated process/container sandboxes with predictable execution limits\r\n * or persistent process lifetimes. Tracking V8 isolate memory and remaining uptime across HTTP invocations is not strictly required.\r\n */\r\n SERVERLESS_VM = \"serverless-vm\",\r\n\r\n /**\r\n * Configuration for traditional, long-running persistent environments (AWS EC2, VPS, Dedicated Servers, local Node.js processes).\r\n * \r\n * Unlike ephemeral isolates or serverless containers that spin down between invocations, persistent runtimes maintain an uninterrupted \r\n * execution context and continuous process lifespan. The engine can rely on background event loops, stateful in-memory caching, \r\n * and non-ephemeral scheduling without relying on cloud provider lifecycle hooks.\r\n */\r\n PERSISTENT = \"persistent\"\r\n}\r\n\r\nexport type PulsarRuntimeType = typeof PulsarRuntime[keyof typeof PulsarRuntime];\r\n\r\nexport type ConfigForRuntime<T extends PulsarRuntimeType> = \r\n T extends typeof PulsarRuntime.V8_ISOLATE ? V8IsolateConfig :\r\n T extends typeof PulsarRuntime.SERVERLESS_VM ? ServerlessVMConfig :\r\n PersistentConfig;\r\n\r\nexport type V8IsolateConfig = BaseEngineConfig & {\r\n runtime : typeof PulsarRuntime.V8_ISOLATE;\r\n engine: SelfInvokingEngine;\r\n /**\r\n * Active isolate tracking instance.\r\n */\r\n isolate : IsolateInstance;\r\n}\r\n\r\nexport type ServerlessVMConfig = BaseEngineConfig & {\r\n runtime : typeof PulsarRuntime.SERVERLESS_VM;\r\n engine: SelfInvokingEngine;\r\n /**\r\n * Optional isolate tracking instance if custom lifecycle tracking is desired inside Lambda or containerized workers.\r\n */\r\n isolate? : IsolateInstance;\r\n}\r\n\r\nexport type PersistentConfig = BaseEngineConfig & {\r\n runtime : typeof PulsarRuntime.PERSISTENT;\r\n \r\n /**\r\n * Optional isolate tracking instance if custom lifecycle tracking is desired inside Lambda or containerized workers.\r\n */\r\n isolate? : IsolateInstance;\r\n\r\n networkInterface : {\r\n /**\r\n * Determines the operational network mode of the server.\r\n * \r\n * - `http`: Opens an HTTP server. Crucial for consumers running dependent workers \r\n * (e.g., when a consumer cannot initialize local storage configuration directly). \r\n * Dependent workers use this HTTP server for acks, retries, etc. \r\n * *(Note: This mode introduces latency and throughput limitations).*\r\n * \r\n * - `socket`: Opens a WebSocket server. Both the pulsar and consumers connect to \r\n * this socket to transport and dispatch jobs. Provides near-realtime job dispatch \r\n * performance for workers.\r\n * \r\n * - `hybrid`: Opens both HTTP and WebSocket servers simultaneously. Ideal for \r\n * multi-runtime deployed consumers where some instances operate in serverless \r\n * functions and others on a VPS, allowing each consumer to select its optimal \r\n * server option based on its specific configuration.\r\n */\r\n mode : Exclude<NetworkConfig[\"mode\"], \"client\">;\r\n /**\r\n * The port number on which the server instance will listen for incoming traffic.\r\n */\r\n port : NetworkConfig[\"port\"];\r\n /**\r\n * Optional hostname or IP address to bind the server to.\r\n */\r\n host? : NetworkConfig[\"host\"];\r\n }\r\n \r\n eventTriggerStrategy : typeof EventTriggerStrategy[keyof typeof EventTriggerStrategy];\r\n engine : PersistentEngine;\r\n}",
|
|
7
|
-
"export interface ILogger {\r\n log(message : string, ...args : any[]) : void;\r\n warn(message : string, ...args : any[]) : void;\r\n error(message : string, ...args : any[]) : void;\r\n debug?(message : string, ...args : any[]) : void;\r\n}\r\n\r\nclass ConsoleLogger implements ILogger {\r\n log(message : string, ...args : any[]) { console.log(message, ...args); }\r\n warn(message : string, ...args : any[]) { console.warn(message, ...args); }\r\n error(message : string, ...args : any[]) { console.error(message, ...args); }\r\n debug(message : string, ...args : any[]) { console.debug(message, ...args); }\r\n}\r\n\r\nexport class LoggerService implements ILogger {\r\n private static provider : ILogger = new ConsoleLogger();\r\n\r\n public setProvider(customLogger: ILogger) {\r\n LoggerService.provider = customLogger;\r\n }\r\n\r\n public log(message : string, ...args : any[]) {\r\n LoggerService.provider.log(message, ...args);\r\n }\r\n\r\n public warn(message : string, ...args : any[]) {\r\n LoggerService.provider.warn(message, ...args);\r\n }\r\n\r\n public error(message : string, ...args : any[]) {\r\n LoggerService.provider.error(message, ...args);\r\n }\r\n\r\n public debug(message : string, ...args : any[]) {\r\n if (LoggerService.provider.debug) {\r\n LoggerService.provider.debug(message, ...args);\r\n }\r\n }\r\n}"
|
|
7
|
+
"export interface ILogger {\r\n log(message : string, ...args : any[]) : void;\r\n warn(message : string, ...args : any[]) : void;\r\n error(message : string, ...args : any[]) : void;\r\n debug?(message : string, ...args : any[]) : void;\r\n}\r\n\r\nclass ConsoleLogger implements ILogger {\r\n log(message : string, ...args : any[]) { console.log(message, ...args); }\r\n warn(message : string, ...args : any[]) { console.warn(message, ...args); }\r\n error(message : string, ...args : any[]) { console.error(message, ...args); }\r\n debug(message : string, ...args : any[]) { console.debug(message, ...args); }\r\n}\r\n\r\nexport class LoggerService implements ILogger {\r\n private static provider : ILogger = new ConsoleLogger();\r\n\r\n public setProvider(customLogger : ILogger) {\r\n LoggerService.provider = customLogger;\r\n }\r\n\r\n public log(message : string, ...args : any[]) {\r\n LoggerService.provider.log(message, ...args);\r\n }\r\n\r\n public warn(message : string, ...args : any[]) {\r\n LoggerService.provider.warn(message, ...args);\r\n }\r\n\r\n public error(message : string, ...args : any[]) {\r\n LoggerService.provider.error(message, ...args);\r\n }\r\n\r\n public debug(message : string, ...args : any[]) {\r\n if (LoggerService.provider.debug) {\r\n LoggerService.provider.debug(message, ...args);\r\n }\r\n }\r\n}"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;AAAO,IAAK,GAAL,CAAK,IAAL,CAaH,kBAAkB,kBAUlB,UAAU,UAUV,UAAU,YAjCF,QCSL,IAAK,GAAL,CAAK,IAAL,CAQH,aAAa,aAQb,gBAAgB,gBAShB,aAAa,eAzBL,QCFZ,MAAM,CAAiC,CACnC,GAAG,CAAC,KAAqB,EAAc,CAAE,QAAQ,IAAI,EAAS,GAAG,CAAI,EACrE,IAAI,CAAC,KAAqB,EAAc,CAAE,QAAQ,KAAK,EAAS,GAAG,CAAI,EACvE,KAAK,CAAC,KAAqB,EAAc,CAAE,QAAQ,MAAM,EAAS,GAAG,CAAI,EACzE,KAAK,CAAC,KAAqB,EAAc,CAAE,QAAQ,MAAM,EAAS,GAAG,CAAI,EAC7E,CAEO,MAAM,CAAiC,OAC3B,UAAqB,IAAI,EAEjC,WAAW,CAAC,
|
|
9
|
+
"mappings": ";;;;AAAO,IAAK,GAAL,CAAK,IAAL,CAaH,kBAAkB,kBAUlB,UAAU,UAUV,UAAU,YAjCF,QCSL,IAAK,GAAL,CAAK,IAAL,CAQH,aAAa,aAQb,gBAAgB,gBAShB,aAAa,eAzBL,QCFZ,MAAM,CAAiC,CACnC,GAAG,CAAC,KAAqB,EAAc,CAAE,QAAQ,IAAI,EAAS,GAAG,CAAI,EACrE,IAAI,CAAC,KAAqB,EAAc,CAAE,QAAQ,KAAK,EAAS,GAAG,CAAI,EACvE,KAAK,CAAC,KAAqB,EAAc,CAAE,QAAQ,MAAM,EAAS,GAAG,CAAI,EACzE,KAAK,CAAC,KAAqB,EAAc,CAAE,QAAQ,MAAM,EAAS,GAAG,CAAI,EAC7E,CAEO,MAAM,CAAiC,OAC3B,UAAqB,IAAI,EAEjC,WAAW,CAAC,EAAwB,CACvC,EAAc,SAAW,EAGtB,GAAG,CAAC,KAAqB,EAAc,CAC1C,EAAc,SAAS,IAAI,EAAS,GAAG,CAAI,EAGxC,IAAI,CAAC,KAAqB,EAAc,CAC3C,EAAc,SAAS,KAAK,EAAS,GAAG,CAAI,EAGzC,KAAK,CAAC,KAAqB,EAAc,CAC5C,EAAc,SAAS,MAAM,EAAS,GAAG,CAAI,EAG1C,KAAK,CAAC,KAAqB,EAAc,CAC5C,GAAI,EAAc,SAAS,MACvB,EAAc,SAAS,MAAM,EAAS,GAAG,CAAI,EAGzD",
|
|
10
10
|
"debugId": "90BBA63A042C7D4764756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeConfigDelta.d.ts","sourceRoot":"","sources":["../../src/helpers/computeConfigDelta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,MAAM,EAAG,oBAAoB,EAAE,MAAM,EAAG,oBAAoB;;;
|
|
1
|
+
{"version":3,"file":"computeConfigDelta.d.ts","sourceRoot":"","sources":["../../src/helpers/computeConfigDelta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,MAAM,EAAG,oBAAoB,EAAE,MAAM,EAAG,oBAAoB;;;eAMvD,MAAM;gBAAW,MAAM;;;eACrB,MAAM;gBAAW,MAAM;;;eACtB,MAAM;mBAAc,MAAM;mBAAc,MAAM;;EA4BxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateShaHash.d.ts","sourceRoot":"","sources":["../../src/helpers/generateShaHash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateShaHash.d.ts","sourceRoot":"","sources":["../../src/helpers/generateShaHash.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAI,OAAO,CAAC,MAAM,CAAC,CAOhE"}
|