@nightx.co/pulsar 0.0.0-stage → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/LICENSE +207 -0
  2. package/README.md +14 -2
  3. package/dist/chunk-3sg08kqp.js +10 -0
  4. package/dist/chunk-3sg08kqp.js.map +9 -0
  5. package/dist/chunk-a9kye38b.js +54 -0
  6. package/dist/chunk-a9kye38b.js.map +12 -0
  7. package/dist/chunk-cpn1qh4e.js +10 -0
  8. package/dist/chunk-cpn1qh4e.js.map +12 -0
  9. package/dist/chunk-rrj8rm04.js +10 -0
  10. package/dist/chunk-rrj8rm04.js.map +11 -0
  11. package/dist/cluster/Nebula.d.ts +30 -0
  12. package/dist/cluster/Nebula.d.ts.map +1 -0
  13. package/dist/helpers/computeConfigDelta.d.ts +18 -0
  14. package/dist/helpers/computeConfigDelta.d.ts.map +1 -0
  15. package/dist/helpers/defineQueue.d.ts +13 -0
  16. package/dist/helpers/defineQueue.d.ts.map +1 -0
  17. package/dist/helpers/generateShaHash.d.ts +2 -0
  18. package/dist/helpers/generateShaHash.d.ts.map +1 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +50 -0
  23. package/dist/integrations/PulsarEventsIntegrations.d.ts +7 -0
  24. package/dist/integrations/PulsarEventsIntegrations.d.ts.map +1 -0
  25. package/dist/integrations/PulsarLoggerIntegrations.d.ts +12 -0
  26. package/dist/integrations/PulsarLoggerIntegrations.d.ts.map +1 -0
  27. package/dist/integrations/index.d.ts +4 -0
  28. package/dist/integrations/index.d.ts.map +1 -0
  29. package/dist/integrations/index.js +8 -0
  30. package/dist/integrations/index.js.map +11 -0
  31. package/dist/modules/Queue.module.d.ts +45 -0
  32. package/dist/modules/Queue.module.d.ts.map +1 -0
  33. package/dist/modules/Scheduler.module.d.ts +42 -0
  34. package/dist/modules/Scheduler.module.d.ts.map +1 -0
  35. package/dist/modules/Tick.module.d.ts +35 -0
  36. package/dist/modules/Tick.module.d.ts.map +1 -0
  37. package/dist/modules/TickController.module.d.ts +36 -0
  38. package/dist/modules/TickController.module.d.ts.map +1 -0
  39. package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts +2 -0
  40. package/dist/monitoring/PulsarMonitoringStreamProducer.d.ts.map +1 -0
  41. package/dist/monitoring/index.d.ts +2 -0
  42. package/dist/monitoring/index.d.ts.map +1 -0
  43. package/dist/monitoring/server/PulsarMonitoringStream.d.ts +2 -0
  44. package/dist/monitoring/server/PulsarMonitoringStream.d.ts.map +1 -0
  45. package/dist/network/NetworkInterface.d.ts +13 -0
  46. package/dist/network/NetworkInterface.d.ts.map +1 -0
  47. package/dist/network/UnifiedTransportManager.d.ts +21 -0
  48. package/dist/network/UnifiedTransportManager.d.ts.map +1 -0
  49. package/dist/network/abstract/BaseNetworkDriver.d.ts +17 -0
  50. package/dist/network/abstract/BaseNetworkDriver.d.ts.map +1 -0
  51. package/dist/network/auth/Authenticator.d.ts +2 -0
  52. package/dist/network/auth/Authenticator.d.ts.map +1 -0
  53. package/dist/network/drivers/HttpNetworkDriver.d.ts +31 -0
  54. package/dist/network/drivers/HttpNetworkDriver.d.ts.map +1 -0
  55. package/dist/network/drivers/WebSocketNetworkDriver.d.ts +23 -0
  56. package/dist/network/drivers/WebSocketNetworkDriver.d.ts.map +1 -0
  57. package/dist/network/helpers/httpQueueOperations.d.ts +2 -0
  58. package/dist/network/helpers/httpQueueOperations.d.ts.map +1 -0
  59. package/dist/network/interfaces/network.types.d.ts +13 -0
  60. package/dist/network/interfaces/network.types.d.ts.map +1 -0
  61. package/dist/run/Queues.d.ts +2 -0
  62. package/dist/run/Queues.d.ts.map +1 -0
  63. package/dist/run/index.d.ts +2 -0
  64. package/dist/run/index.d.ts.map +1 -0
  65. package/dist/run/index2.d.ts +2 -0
  66. package/dist/run/index2.d.ts.map +1 -0
  67. package/dist/runtimes/IsolateRuntime.d.ts +17 -0
  68. package/dist/runtimes/IsolateRuntime.d.ts.map +1 -0
  69. package/dist/runtimes/PersistentRuntime.d.ts +22 -0
  70. package/dist/runtimes/PersistentRuntime.d.ts.map +1 -0
  71. package/dist/runtimes/ServerlessRuntime.d.ts +15 -0
  72. package/dist/runtimes/ServerlessRuntime.d.ts.map +1 -0
  73. package/dist/runtimes/runtimeTypes.d.ts +15 -0
  74. package/dist/runtimes/runtimeTypes.d.ts.map +1 -0
  75. package/dist/server/PulsarRequestHandler.d.ts +41 -0
  76. package/dist/server/PulsarRequestHandler.d.ts.map +1 -0
  77. package/dist/server/helpers/acquireRedisLock.d.ts +14 -0
  78. package/dist/server/helpers/acquireRedisLock.d.ts.map +1 -0
  79. package/dist/server/helpers/checkFencingValidity.d.ts +14 -0
  80. package/dist/server/helpers/checkFencingValidity.d.ts.map +1 -0
  81. package/dist/server/helpers/performIsolateRestart.d.ts +20 -0
  82. package/dist/server/helpers/performIsolateRestart.d.ts.map +1 -0
  83. package/dist/server/index.d.ts +2 -0
  84. package/dist/server/index.d.ts.map +1 -0
  85. package/dist/server/index.js +8 -0
  86. package/dist/server/index.js.map +13 -0
  87. package/dist/server/parser/parseRequest.d.ts +10 -0
  88. package/dist/server/parser/parseRequest.d.ts.map +1 -0
  89. package/dist/server/utility/extract-headers.d.ts +14 -0
  90. package/dist/server/utility/extract-headers.d.ts.map +1 -0
  91. package/dist/service/ConfigurationStore.d.ts +23 -0
  92. package/dist/service/ConfigurationStore.d.ts.map +1 -0
  93. package/dist/service/Isolate.service.d.ts +12 -0
  94. package/dist/service/Isolate.service.d.ts.map +1 -0
  95. package/dist/service/Pulsar.service.d.ts +41 -0
  96. package/dist/service/Pulsar.service.d.ts.map +1 -0
  97. package/dist/service/PulsarBaseService.d.ts +49 -0
  98. package/dist/service/PulsarBaseService.d.ts.map +1 -0
  99. package/dist/service/PulsarEventBus.d.ts +36 -0
  100. package/dist/service/PulsarEventBus.d.ts.map +1 -0
  101. package/dist/service/SwarmBudgetTracker.d.ts +14 -0
  102. package/dist/service/SwarmBudgetTracker.d.ts.map +1 -0
  103. package/dist/service/consumers/PulsarWorker.d.ts +10 -0
  104. package/dist/service/consumers/PulsarWorker.d.ts.map +1 -0
  105. package/dist/shared/PulsarRuntimeCore.d.ts +55 -0
  106. package/dist/shared/PulsarRuntimeCore.d.ts.map +1 -0
  107. package/dist/static/TimingProfile.d.ts +9 -0
  108. package/dist/static/TimingProfile.d.ts.map +1 -0
  109. package/dist/static/static.d.ts +3 -0
  110. package/dist/static/static.d.ts.map +1 -0
  111. package/dist/storage/PulsarStorage.d.ts +42 -0
  112. package/dist/storage/PulsarStorage.d.ts.map +1 -0
  113. package/dist/storage/drivers/PostgresDriver.d.ts +20 -0
  114. package/dist/storage/drivers/PostgresDriver.d.ts.map +1 -0
  115. package/dist/storage/drivers/RedisDriver.d.ts +20 -0
  116. package/dist/storage/drivers/RedisDriver.d.ts.map +1 -0
  117. package/dist/storage/drivers/types.d.ts +27 -0
  118. package/dist/storage/drivers/types.d.ts.map +1 -0
  119. package/dist/storage/index.d.ts +4 -0
  120. package/dist/storage/index.d.ts.map +1 -0
  121. package/dist/storage/index.js +403 -0
  122. package/dist/storage/index.js.map +21 -0
  123. package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts +39 -0
  124. package/dist/storage/repositories/PostgresEngineOperationRepository.d.ts.map +1 -0
  125. package/dist/storage/repositories/PostgresQueueRepository.d.ts +26 -0
  126. package/dist/storage/repositories/PostgresQueueRepository.d.ts.map +1 -0
  127. package/dist/storage/repositories/QueueRepository.d.ts +20 -0
  128. package/dist/storage/repositories/QueueRepository.d.ts.map +1 -0
  129. package/dist/storage/repositories/RedisQueueRepository.d.ts +28 -0
  130. package/dist/storage/repositories/RedisQueueRepository.d.ts.map +1 -0
  131. package/dist/subsys/DeferredTickEvaluator.d.ts +23 -0
  132. package/dist/subsys/DeferredTickEvaluator.d.ts.map +1 -0
  133. package/dist/subsys/EventBus.d.ts +13 -0
  134. package/dist/subsys/EventBus.d.ts.map +1 -0
  135. package/dist/subsys/ExecutionProfileSwitcher.d.ts +10 -0
  136. package/dist/subsys/ExecutionProfileSwitcher.d.ts.map +1 -0
  137. package/dist/subsys/LoggerService.d.ts +15 -0
  138. package/dist/subsys/LoggerService.d.ts.map +1 -0
  139. package/dist/subsys/PulsarClock.d.ts +32 -0
  140. package/dist/subsys/PulsarClock.d.ts.map +1 -0
  141. package/dist/subsys/RuntimeCacheStorage.d.ts +18 -0
  142. package/dist/subsys/RuntimeCacheStorage.d.ts.map +1 -0
  143. package/dist/subsys/RuntimeEventBridge.d.ts +16 -0
  144. package/dist/subsys/RuntimeEventBridge.d.ts.map +1 -0
  145. package/dist/types/base.types.d.ts +65 -0
  146. package/dist/types/base.types.d.ts.map +1 -0
  147. package/dist/types/config.types.d.ts +56 -0
  148. package/dist/types/config.types.d.ts.map +1 -0
  149. package/dist/types/consumer.types.d.ts +72 -0
  150. package/dist/types/consumer.types.d.ts.map +1 -0
  151. package/dist/types/engine.types.d.ts +139 -0
  152. package/dist/types/engine.types.d.ts.map +1 -0
  153. package/dist/types/eventTriggerStrategry.types.d.ts +34 -0
  154. package/dist/types/eventTriggerStrategry.types.d.ts.map +1 -0
  155. package/dist/types/integrations.types.d.ts +16 -0
  156. package/dist/types/integrations.types.d.ts.map +1 -0
  157. package/dist/types/nebula.types.d.ts +65 -0
  158. package/dist/types/nebula.types.d.ts.map +1 -0
  159. package/dist/types/queue.types.d.ts +106 -0
  160. package/dist/types/queue.types.d.ts.map +1 -0
  161. package/dist/types/runtime.types.d.ts +89 -0
  162. package/dist/types/runtime.types.d.ts.map +1 -0
  163. package/package.json +71 -5
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,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # package
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.14. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pulsar by NightX
3
+ * Copyright (c) 2026 NightX. All rights reserved.
4
+ */
5
+ var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,q=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?j(k(a)):{};let c=b||!a||!a.__esModule?i(d,"default",{value:a,enumerable:!0}):d;for(let e of l(a))if(!m.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0});if(f)g.set(a,c);return c};var r=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);
6
+ export{q as i,r as j};
7
+
8
+ /* Powered by NightX - Pulsar Engine */
9
+
10
+ //# debugId=1F42B7946FF1B51E64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "1F42B7946FF1B51E64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Pulsar by NightX
3
+ * Copyright (c) 2026 NightX. All rights reserved.
4
+ */
5
+ class Y{sql;constructor(A){this.sql=A.db.getNativeClient()}async triggerUrl({body:A={},delaySeconds:E=0,headers:P={"Content-Type":"application/json"},url:U}){return await this.sql`
6
+ select pulsar.schedule_http_request(
7
+ ${U},
8
+ ${E},
9
+ 'POST',
10
+ ${this.sql.json(A)},
11
+ ${this.sql.json(P)}
12
+ ) as job_id;
13
+ `,!0}async send(A,E,P=0){let U=JSON.stringify(E);return(await this.sql`SELECT pgmq.send( ${A}, ${U}::jsonb, ${P} ) AS msg_id `)[0]?.msg_id}async readFifo(A,E,P,U="grouped"){let M="pgmq.read_grouped";if(U==="rr")M="pgmq.read_grouped_rr";if(U==="head")M="pgmq.read_grouped_head";return[]}async read(A,E=30,P=1){return await this.sql`
14
+ SELECT *
15
+ FROM pgmq.read(
16
+ ${A},
17
+ ${E},
18
+ ${P}
19
+ )
20
+ `}async ack(A,E){let P=await this.sql`
21
+ SELECT pgmq.delete(
22
+ ${A}::text,
23
+ ${E.toString()}::bigint
24
+ ) AS deleted
25
+ `;return Boolean(P[0]?.deleted)}async ackBatch(A,E){if(!E||E.length===0)return!0;let P=E.map((M)=>M.toString());return(await this.sql`
26
+ SELECT pgmq.delete(
27
+ ${A}::text,
28
+ ${P}::bigint[]
29
+ ) AS deleted
30
+ `).length>0}async retryBatch(A,E){if(E.length===0)return 0;let P=E.map((M)=>M.toString());return(await this.sql`
31
+ SELECT pgmq.set_vt(
32
+ ${A},
33
+ id::bigint,
34
+ 0
35
+ ) AS set_vt
36
+ FROM unnest(${P}::bigint[]) AS id
37
+ `).filter((M)=>Boolean(M.set_vt)).length}async retry(A,E){let P=await this.sql`
38
+ SELECT pgmq.set_vt(
39
+ ${A},
40
+ ${E.toString()},
41
+ 0
42
+ ) AS set_vt
43
+ `;return Boolean(P[0]?.set_vt)}async delayRetry(A,E,P){let U=await this.sql`
44
+ SELECT pgmq.set_vt(
45
+ ${A},
46
+ ${E.toString()},
47
+ ${P}
48
+ ) AS set_vt
49
+ `;return Boolean(U[0]?.set_vt)}async getSingleQueueMetrics(A){try{let E=await this.sql`SELECT * FROM pulsar.get_single_queue_metrics(${A})`,P=Array.from(E);if(!P.length)return null;let U=P[0];return{queueName:U.queue_name,readyJobs:Number(U.ready_jobs??0),delayedJobs:Number(U.delayed_jobs??0),total:Number(U.total_jobs??0),nextVisibleAt:U.next_visible_at?new Date(U.next_visible_at).getTime():null}}catch(E){return console.error(`Failed to fetch metrics for queue: ${A}`,E),null}}async getAllQueueMetrics(){let A=await this.sql`SELECT * FROM pgmq.get_queue_metrics()`;return Array.from(A).map((E)=>({queue_name:E.queue_name,ready_jobs:Number(E.ready_jobs),delayed_jobs:Number(E.delayed_jobs),total:Number(E.total_jobs),next_visible_at:Number(E.next_visible_at)}))}async closeQueue(){await this.sql.end()}}function D(A){return!!A&&typeof A.clone==="function"&&typeof A.text==="function"&&typeof A.url==="string"&&typeof A.headers?.get==="function"}function G(A){let E={};if(!A)return E;if(typeof A.forEach==="function"&&typeof A.get==="function")return A.forEach((P,U)=>{E[String(U).toLowerCase()]=String(P)}),E;for(let[P,U]of Object.entries(A)){if(U==null)continue;E[P.toLowerCase()]=Array.isArray(U)?U.join(", "):String(U)}return E}function X(A){let E={};if(!A)return E;let P=(U,M)=>{if(M==null)return;E[U]=U in E?`${E[U]},${M}`:String(M)};if(typeof A.forEach==="function")A.forEach((U,M)=>P(M,U));else for(let[U,M]of Object.entries(A))P(U,Array.isArray(M)?M.join(","):M);return E}function R(A){let E=A.indexOf("?");return E===-1?{}:X(new URLSearchParams(A.slice(E+1)))}function _(A){let E=atob(A),P=Uint8Array.from(E,(U)=>U.charCodeAt(0));return new TextDecoder().decode(P)}function j(A){return new TextDecoder().decode(A)}async function f(A){let E=new TextEncoder,P=[];for await(let C of A)P.push(typeof C==="string"?E.encode(C):C);let U=P.reduce((C,L)=>C+L.length,0),M=new Uint8Array(U),K=0;for(let C of P)M.set(C,K),K+=C.length;return new TextDecoder().decode(M)}function O(A,E){let P=E.toLowerCase();if(P.includes("json"))try{return JSON.parse(A)}catch{return A}if(P.includes("application/x-www-form-urlencoded"))return X(new URLSearchParams(A));if(!P){let U=A.trimStart();if(U.startsWith("{")||U.startsWith("["))try{return JSON.parse(A)}catch{}}return A}function J(A,E,P=!1){if(A==null||A==="")return{body:null,rawBody:null};let U;if(typeof A==="string")U=P?_(A):A;else if(A instanceof ArrayBuffer||ArrayBuffer.isView(A))U=j(A);else return{body:A,rawBody:null};return{body:O(U,E),rawBody:U}}var g=new Set(["GET","HEAD"]);async function F(A){if(!A)throw Error("[YourSDK] No request object/event provided.");let E=A;if(!D(E)&&D(E.request))E=E.request;else if(E.req&&E.req.headers&&!E.headers)E=E.req;if(D(E)){let P=E.clone(),U=String(P.method||"GET").toUpperCase(),M=G(P.headers),K=null;if(!g.has(U))try{K=await P.text()}catch{K=null}let{body:C,rawBody:L}=J(K,M["content-type"]||"");return{method:U,url:P.url,headers:M,query:X(new URL(P.url).searchParams),body:C,rawBody:L}}if(E.requestContext||E.httpMethod||E.rawPath){let P=G(E.headers),U=String(E.requestContext?.http?.method||E.httpMethod||"POST").toUpperCase(),M=E.rawPath||E.path||"/",K=E.rawQueryString?`?${E.rawQueryString}`:"",C=P["x-forwarded-proto"]||"https",L=P.host||"lambda.local",W=E.rawUrl||`${C}://${L}${M}${K}`,V=E.queryStringParameters&&Object.keys(E.queryStringParameters).length?X(E.queryStringParameters):E.rawQueryString?R(`?${E.rawQueryString}`):{},{body:Z,rawBody:$}=J(E.body,P["content-type"]||"",!!E.isBase64Encoded);return{method:U,url:W,headers:P,query:V,body:Z,rawBody:$}}if(E.headers&&E.method){let P=G(E.headers),U=String(E.method).toUpperCase(),M=E.originalUrl||E.url||"/",K=M;if(!/^https?:\/\//i.test(M)){let Z=P["x-forwarded-proto"]?.split(",")[0]?.trim()||E.protocol||(E.socket?.encrypted?"https":"http"),$=P["x-forwarded-host"]||P.host||"localhost";K=`${Z}://${$}${M}`}let L=E.query&&Object.keys(E.query).length>0?X(E.query):R(K),W=E.body!==void 0?E.body:E.rawBody;if(W===void 0&&!g.has(U)&&typeof E[Symbol.asyncIterator]==="function")W=await f(E);let V=J(W,P["content-type"]||"");if(V.rawBody===null&&E.rawBody!=null)V.rawBody=typeof E.rawBody==="string"?E.rawBody:j(E.rawBody);return{method:U,url:K,headers:P,query:L,body:V.body,rawBody:V.rawBody}}throw Error("[YourSDK] Could not identify runtime payload type.")}var N=(A)=>{return{isRestarted:(A["x-restart"]??"false")==="true",poolerMode:A["x-pooler"]??"interval-driven-pooler",lastExecutionId:A["x-last-execution-id"]??crypto.randomUUID(),lastExecutionAt:A["x-last-execution-at"]??new Date().toISOString(),lastIsolateId:A["x-last-isolate-id"]??crypto.randomUUID(),executionOwner:A["x-execution-owner"]??"engine",targetQueue:A["x-target-queue"]??void 0,fencingToken:A["x-fencing-token"]??void 0,workerId:A["x-worker-id"]??void 0}};
50
+ export{Y as a,F as b,N as c};
51
+
52
+ /* Powered by NightX - Pulsar Engine */
53
+
54
+ //# debugId=4F4B3F5128032D5664756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["..\\src\\modules\\Queue.module.ts", "..\\src\\server\\parser\\parseRequest.ts", "..\\src\\server\\utility\\extract-headers.tsx"],
4
+ "sourcesContent": [
5
+ "import type { JSONValue, Sql } from \"postgres\";\r\nimport type { QUEUE } from \"../static/static.ts\";\r\nimport type { PulsarUnifiedStorage } from \"../storage/PulsarStorage.ts\";\r\nimport type { QueueMessage } from \"../types/queue.types.ts\";\r\n\r\ninterface ITriggerURL {\r\n url: string;\r\n body?: JSONValue;\r\n headers?: Record<string, string>;\r\n delaySeconds? : number;\r\n}\r\n\r\ninterface ISingleQueueMetrics {\r\n queueName: string;\r\n readyJobs: number;\r\n delayedJobs: number;\r\n total: number;\r\n nextVisibleAt: number | null;\r\n}\r\n\r\nexport class QueueService {\r\n protected sql : Sql;\r\n\r\n constructor (storage : PulsarUnifiedStorage) {\r\n this.sql = storage.db.getNativeClient();\r\n }\r\n\r\n public async triggerUrl({ body={}, delaySeconds=0, headers={'Content-Type': 'application/json'}, url } : ITriggerURL) {\r\n await this.sql`\r\n select pulsar.schedule_http_request(\r\n ${url},\r\n ${delaySeconds},\r\n 'POST',\r\n ${this.sql.json(body)},\r\n ${this.sql.json(headers)}\r\n ) as job_id;\r\n `;\r\n return true;\r\n }\r\n\r\n public async send<T = unknown>(queue: string, message: T, delaySeconds = 0) : Promise<bigint> {\r\n const messageJson = JSON.stringify(message);\r\n const result = await this.sql`SELECT pgmq.send( ${queue}, ${messageJson}::jsonb, ${delaySeconds} ) AS msg_id `;\r\n return result[0]?.msg_id as bigint;\r\n }\r\n\r\n /**\r\n * Read jobs using PGMQ's native FIFO strategies.\r\n * @param strategy 'rr' (Round Robin), 'grouped' (SQS-style), or 'head' (One per group)\r\n */\r\n public async readFifo(queue: string, vt: number, qty: number, strategy: 'rr' | 'grouped' | 'head' = 'grouped'): Promise<any[]> {\r\n let functionName = 'pgmq.read_grouped';\r\n if (strategy === 'rr') functionName = 'pgmq.read_grouped_rr';\r\n if (strategy === 'head') functionName = 'pgmq.read_grouped_head'; \r\n return []\r\n }\r\n\r\n public async read<T = unknown>(queue: string, visibilityTimeout = 30, quantity = 1): Promise<QueueMessage<T>[]> {\r\n const result = await this.sql`\r\n SELECT *\r\n FROM pgmq.read(\r\n ${queue},\r\n ${visibilityTimeout},\r\n ${quantity}\r\n )\r\n `;\r\n return result as unknown as QueueMessage<T>[];\r\n }\r\n\r\n public async ack(queue: string, messageId: bigint): Promise<boolean> {\r\n const result = await this.sql`\r\n SELECT pgmq.delete(\r\n ${queue}::text,\r\n ${messageId.toString()}::bigint\r\n ) AS deleted\r\n `;\r\n return Boolean(result[0]?.deleted);\r\n }\r\n\r\n \r\n public async ackBatch(queue: string, messageIds: number[]): Promise<boolean> {\r\n if (!messageIds || messageIds.length === 0) {\r\n return true;\r\n }\r\n\r\n const ids = messageIds.map((id) => id.toString());\r\n\r\n const result = await this.sql`\r\n SELECT pgmq.delete(\r\n ${queue}::text,\r\n ${ids}::bigint[]\r\n ) AS deleted\r\n `;\r\n\r\n return result.length > 0;\r\n }\r\n\r\n public async retryBatch(queue: string, messageIds: number[]): Promise<number> {\r\n if (messageIds.length === 0) return 0;\r\n\r\n const ids = messageIds.map((id) => id.toString());\r\n\r\n const result = await this.sql`\r\n SELECT pgmq.set_vt(\r\n ${queue},\r\n id::bigint,\r\n 0\r\n ) AS set_vt\r\n FROM unnest(${ids}::bigint[]) AS id\r\n `;\r\n\r\n return result.filter((row) => Boolean(row.set_vt)).length;\r\n }\r\n\r\n public async retry( queue: string, messageId: bigint): Promise<boolean> {\r\n const result = await this.sql`\r\n SELECT pgmq.set_vt(\r\n ${queue},\r\n ${messageId.toString()},\r\n 0\r\n ) AS set_vt\r\n `;\r\n\r\n return Boolean(result[0]?.set_vt);\r\n }\r\n\r\n public async delayRetry(queue: string,messageId: bigint,seconds: number): Promise<boolean> {\r\n const result = await this.sql`\r\n SELECT pgmq.set_vt(\r\n ${queue},\r\n ${messageId.toString()},\r\n ${seconds}\r\n ) AS set_vt\r\n `;\r\n\r\n return Boolean(result[0]?.set_vt);\r\n }\r\n\r\n public async getSingleQueueMetrics(queueName : string) : Promise<ISingleQueueMetrics | null> {\r\n try {\r\n const result = await this.sql`SELECT * FROM pulsar.get_single_queue_metrics(${queueName})`;\r\n\r\n const rows = Array.from(result);\r\n if (!rows.length) return null;\r\n\r\n const row: any = rows[0];\r\n\r\n return {\r\n queueName: row.queue_name as QUEUE,\r\n readyJobs: Number(row.ready_jobs ?? 0),\r\n delayedJobs: Number(row.delayed_jobs ?? 0),\r\n total: Number(row.total_jobs ?? 0),\r\n nextVisibleAt: row.next_visible_at ? new Date(row.next_visible_at).getTime() : null,\r\n };\r\n }\r\n catch (err) {\r\n console.error(`Failed to fetch metrics for queue: ${queueName}`, err);\r\n return null;\r\n }\r\n }\r\n\r\n public async getAllQueueMetrics() : Promise<{ queue_name : QUEUE, ready_jobs : number, delayed_jobs : number, total : number, next_visible_at : number }[]> {\r\n const allQueueMetrics = await this.sql`SELECT * FROM pgmq.get_queue_metrics()`;\r\n \r\n return Array.from(allQueueMetrics).map((row : any) => ({\r\n queue_name: row.queue_name as QUEUE,\r\n ready_jobs: Number(row.ready_jobs),\r\n delayed_jobs: Number(row.delayed_jobs),\r\n total: Number(row.total_jobs),\r\n next_visible_at : Number(row.next_visible_at),\r\n }))\r\n }\r\n\r\n public async closeQueue(): Promise<void> {\r\n await this.sql.end();\r\n }\r\n}",
6
+ "export interface ParsedRequest {\r\n method: string;\r\n url: string;\r\n headers: Record<string, string>; // always lowercase keys\r\n query: Record<string, string>;\r\n body: any; // parsed (JSON / form) or string, null if empty\r\n rawBody: string | null; // exact text, needed for webhook signature checks\r\n}\r\n\r\ntype AnyObj = Record<string, any>;\r\n\r\n// ---------------------------------------------------------------------------\r\n// Helpers (no Node-only globals: no Buffer, no `instanceof Request`)\r\n// ---------------------------------------------------------------------------\r\n\r\n// Duck-typing works across realms/polyfills (Deno, undici, Workers, Azure v4...)\r\nfunction isFetchRequest(x: any): boolean {\r\n return (\r\n !!x &&\r\n typeof x.clone === \"function\" &&\r\n typeof x.text === \"function\" &&\r\n typeof x.url === \"string\" &&\r\n typeof x.headers?.get === \"function\"\r\n );\r\n}\r\n\r\nfunction normalizeHeaders(input: any): Record<string, string> {\r\n const out: Record<string, string> = {};\r\n if (!input) return out;\r\n\r\n // Headers / Map-like (Fetch, Azure v4)\r\n if (typeof input.forEach === \"function\" && typeof input.get === \"function\") {\r\n input.forEach((v: string, k: string) => {\r\n out[String(k).toLowerCase()] = String(v);\r\n });\r\n return out;\r\n }\r\n\r\n // Plain objects (Lambda, Node, Express). Node can give string[] values.\r\n for (const [k, v] of Object.entries(input)) {\r\n if (v == null) continue;\r\n out[k.toLowerCase()] = Array.isArray(v) ? v.join(\", \") : String(v);\r\n }\r\n return out;\r\n}\r\n\r\nfunction normalizeQuery(input: any): Record<string, string> {\r\n const out: Record<string, string> = {};\r\n if (!input) return out;\r\n\r\n const add = (k: string, v: any) => {\r\n if (v == null) return;\r\n out[k] = k in out ? `${out[k]},${v}` : String(v); // repeated keys -> \"a,b\"\r\n };\r\n\r\n if (typeof input.forEach === \"function\") {\r\n input.forEach((v: string, k: string) => add(k, v)); // URLSearchParams\r\n } else {\r\n for (const [k, v] of Object.entries(input)) {\r\n add(k, Array.isArray(v) ? v.join(\",\") : v);\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction queryFromUrl(url: string): Record<string, string> {\r\n const i = url.indexOf(\"?\");\r\n return i === -1 ? {} : normalizeQuery(new URLSearchParams(url.slice(i + 1)));\r\n}\r\n\r\nfunction base64ToText(b64: string): string {\r\n // atob exists in Node 16+, Deno, Bun, Workers, browsers\r\n const bin = atob(b64);\r\n const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0));\r\n return new TextDecoder().decode(bytes);\r\n}\r\n\r\nfunction bytesToText(b: ArrayBuffer | ArrayBufferView): string {\r\n return new TextDecoder().decode(b as any);\r\n}\r\n\r\nasync function readStream(stream: any): Promise<string> {\r\n const enc = new TextEncoder();\r\n const chunks: Uint8Array[] = [];\r\n for await (const c of stream) {\r\n chunks.push(typeof c === \"string\" ? enc.encode(c) : c);\r\n }\r\n const total = chunks.reduce((n, c) => n + c.length, 0);\r\n const all = new Uint8Array(total);\r\n let off = 0;\r\n for (const c of chunks) {\r\n all.set(c, off);\r\n off += c.length;\r\n }\r\n return new TextDecoder().decode(all);\r\n}\r\n\r\nfunction parseText(text: string, contentType: string): any {\r\n const ct = contentType.toLowerCase();\r\n\r\n if (ct.includes(\"json\")) {\r\n try { return JSON.parse(text); } catch { return text; }\r\n }\r\n if (ct.includes(\"application/x-www-form-urlencoded\")) {\r\n return normalizeQuery(new URLSearchParams(text));\r\n }\r\n // No content-type (some proxies strip it): sniff for JSON\r\n if (!ct) {\r\n const t = text.trimStart();\r\n if (t.startsWith(\"{\") || t.startsWith(\"[\")) {\r\n try { return JSON.parse(text); } catch { /* fall through */ }\r\n }\r\n }\r\n return text;\r\n}\r\n\r\n/** Turns whatever a runtime hands us as \"body\" into { body, rawBody }. */\r\nfunction finalizeBody(\r\n raw: unknown,\r\n contentType: string,\r\n isBase64 = false\r\n): { body: any; rawBody: string | null } {\r\n if (raw == null || raw === \"\") return { body: null, rawBody: null };\r\n\r\n let text: string;\r\n if (typeof raw === \"string\") {\r\n text = isBase64 ? base64ToText(raw) : raw;\r\n } else if (raw instanceof ArrayBuffer || ArrayBuffer.isView(raw)) {\r\n text = bytesToText(raw as any); // includes Node Buffer\r\n } else {\r\n // Already parsed by the framework (Express json(), Azure v3, GCF)\r\n return { body: raw, rawBody: null };\r\n }\r\n\r\n return { body: parseText(text, contentType), rawBody: text };\r\n}\r\n\r\nconst NO_BODY_METHODS = new Set([\"GET\", \"HEAD\"]);\r\n\r\n// ---------------------------------------------------------------------------\r\n// Main\r\n// ---------------------------------------------------------------------------\r\n\r\nexport async function parseRequest(rawInput: any): Promise<ParsedRequest> {\r\n if (!rawInput) {\r\n throw new Error(\"[YourSDK] No request object/event provided.\");\r\n }\r\n\r\n // Unwrap handler \"context\" wrappers:\r\n // - Cloudflare Pages Functions / SvelteKit / Remix: { request }\r\n // - Azure Functions v3: context.req\r\n let input: AnyObj = rawInput;\r\n if (!isFetchRequest(input) && isFetchRequest(input.request)) {\r\n input = input.request;\r\n } else if (input.req && input.req.headers && !input.headers) {\r\n input = input.req;\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // 1. Fetch-style Request\r\n // Cloudflare Workers, Deno, Bun, Supabase Edge, Vercel Edge, Netlify v2,\r\n // Next.js route handlers, Azure Functions v4\r\n // -------------------------------------------------------------------------\r\n if (isFetchRequest(input)) {\r\n const clone = input.clone(); // leave the original body readable for the caller\r\n const method = String(clone.method || \"GET\").toUpperCase();\r\n const headers = normalizeHeaders(clone.headers);\r\n\r\n let text: string | null = null;\r\n if (!NO_BODY_METHODS.has(method)) {\r\n try { text = await clone.text(); } catch { text = null; }\r\n }\r\n const { body, rawBody } = finalizeBody(text, headers[\"content-type\"] || \"\");\r\n\r\n return {\r\n method,\r\n url: clone.url,\r\n headers,\r\n query: normalizeQuery(new URL(clone.url).searchParams),\r\n body,\r\n rawBody,\r\n };\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // 2. AWS Lambda-style events\r\n // API Gateway REST v1 / HTTP v2, Function URLs, ALB, Netlify v1 functions\r\n // -------------------------------------------------------------------------\r\n if (input.requestContext || input.httpMethod || input.rawPath) {\r\n const headers = normalizeHeaders(input.headers);\r\n const method = String(\r\n input.requestContext?.http?.method || input.httpMethod || \"POST\"\r\n ).toUpperCase();\r\n\r\n const path = input.rawPath || input.path || \"/\";\r\n const qs = input.rawQueryString ? `?${input.rawQueryString}` : \"\";\r\n const proto = headers[\"x-forwarded-proto\"] || \"https\";\r\n const host = headers[\"host\"] || \"lambda.local\";\r\n const url = input.rawUrl || `${proto}://${host}${path}${qs}`;\r\n\r\n const query =\r\n input.queryStringParameters && Object.keys(input.queryStringParameters).length\r\n ? normalizeQuery(input.queryStringParameters)\r\n : input.rawQueryString\r\n ? queryFromUrl(`?${input.rawQueryString}`)\r\n : {};\r\n\r\n const { body, rawBody } = finalizeBody(\r\n input.body,\r\n headers[\"content-type\"] || \"\",\r\n !!input.isBase64Encoded\r\n );\r\n\r\n return { method, url, headers, query, body, rawBody };\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // 3. Node-style req\r\n // Express, Vercel Node, Google Cloud Functions, Azure Functions v3,\r\n // raw http.IncomingMessage\r\n // -------------------------------------------------------------------------\r\n if (input.headers && input.method) {\r\n const headers = normalizeHeaders(input.headers);\r\n const method = String(input.method).toUpperCase();\r\n\r\n const path: string = input.originalUrl || input.url || \"/\";\r\n let url = path;\r\n if (!/^https?:\\/\\//i.test(path)) {\r\n const proto =\r\n headers[\"x-forwarded-proto\"]?.split(\",\")[0]?.trim() ||\r\n input.protocol ||\r\n (input.socket?.encrypted ? \"https\" : \"http\");\r\n const host = headers[\"x-forwarded-host\"] || headers[\"host\"] || \"localhost\";\r\n url = `${proto}://${host}${path}`;\r\n }\r\n\r\n const hasQueryObj = input.query && Object.keys(input.query).length > 0;\r\n const query = hasQueryObj ? normalizeQuery(input.query) : queryFromUrl(url);\r\n\r\n // Prefer pre-parsed body, then rawBody (GCF/Azure), then read the stream.\r\n let rawBody: unknown = input.body !== undefined ? input.body : input.rawBody;\r\n if (\r\n rawBody === undefined &&\r\n !NO_BODY_METHODS.has(method) &&\r\n typeof (input as any)[Symbol.asyncIterator] === \"function\"\r\n ) {\r\n rawBody = await readStream(input);\r\n }\r\n\r\n const out = finalizeBody(rawBody, headers[\"content-type\"] || \"\");\r\n\r\n // If framework gave us an object but a raw buffer exists, expose the raw text too\r\n if (out.rawBody === null && input.rawBody != null) {\r\n out.rawBody =\r\n typeof input.rawBody === \"string\" ? input.rawBody : bytesToText(input.rawBody);\r\n }\r\n\r\n return { method, url, headers, query, body: out.body, rawBody: out.rawBody };\r\n }\r\n\r\n throw new Error(\"[YourSDK] Could not identify runtime payload type.\");\r\n}",
7
+ "import type { EnginePoolingMode } from \"../../types/engine.types\";\r\n\r\nexport type ResponseHeaders = {\r\n isRestarted: boolean;\r\n poolerMode: EnginePoolingMode;\r\n lastExecutionId: string;\r\n lastExecutionAt: string;\r\n lastIsolateId: string;\r\n executionOwner: \"watchdog\" | \"engine\" | \"trigger\";\r\n targetQueue?: string;\r\n fencingToken?: string;\r\n workerId? : string;\r\n}\r\n\r\nexport const extractHeaders = (rawHeaders : Record<string, string>) : ResponseHeaders => {\r\n return {\r\n isRestarted: (rawHeaders[\"x-restart\"] ?? \"false\") === \"true\",\r\n poolerMode: (rawHeaders[\"x-pooler\"] ?? \"interval-driven-pooler\") as EnginePoolingMode,\r\n lastExecutionId: rawHeaders[\"x-last-execution-id\"] ?? crypto.randomUUID(),\r\n lastExecutionAt: rawHeaders[\"x-last-execution-at\"] ?? new Date().toISOString(),\r\n lastIsolateId: rawHeaders[\"x-last-isolate-id\"] ?? crypto.randomUUID(),\r\n executionOwner: (rawHeaders[\"x-execution-owner\"] ?? \"engine\") as \"watchdog\" | \"engine\",\r\n targetQueue: rawHeaders[\"x-target-queue\"] ?? undefined,\r\n fencingToken: rawHeaders[\"x-fencing-token\"] ?? undefined,\r\n workerId: rawHeaders[\"x-worker-id\"] ?? undefined,\r\n }\r\n}\r\n"
8
+ ],
9
+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AO,KAAM,EAAI,KAAM,QAAS,EAAI,OAAQ,EAG7E,MAAU,MAAM,oDAAoD,ECtP/D,IAAM,EAAiB,CAAC,IAA0D,CACrF,MAAO,CACH,aAAc,EAAW,cAAgB,WAAa,OACtD,WAAa,EAAW,aAAe,yBACvC,gBAAiB,EAAW,wBAA0B,OAAO,WAAW,EACxE,gBAAiB,EAAW,wBAA0B,IAAI,KAAK,EAAE,YAAY,EAC7E,cAAe,EAAW,sBAAwB,OAAO,WAAW,EACpE,eAAiB,EAAW,sBAAwB,SACpD,YAAa,EAAW,mBAAqB,OAC7C,aAAc,EAAW,oBAAsB,OAC/C,SAAU,EAAW,gBAAkB,MAC3C",
10
+ "debugId": "4F4B3F5128032D5664756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pulsar by NightX
3
+ * Copyright (c) 2026 NightX. All rights reserved.
4
+ */
5
+ var y;((o)=>{o.POSTGRES_NOTIFY="POSTGRES_NOTIFY";o.WEBHOOK="WEBHOOK";o.POLLING="POLLING"})(y||={});var d;((o)=>{o.V8_ISOLATE="v8-isolate";o.SERVERLESS_VM="serverless-vm";o.PERSISTENT="persistent"})(d||={});class b{log(g,...r){console.log(g,...r)}warn(g,...r){console.warn(g,...r)}error(g,...r){console.error(g,...r)}debug(g,...r){console.debug(g,...r)}}class p{static provider=new b;setProvider(g){p.provider=g}log(g,...r){p.provider.log(g,...r)}warn(g,...r){p.provider.warn(g,...r)}error(g,...r){p.provider.error(g,...r)}debug(g,...r){if(p.provider.debug)p.provider.debug(g,...r)}}
6
+ export{y as f,d as g,p as h};
7
+
8
+ /* Powered by NightX - Pulsar Engine */
9
+
10
+ //# debugId=90BBA63A042C7D4764756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["..\\src\\types\\eventTriggerStrategry.types.ts", "..\\src\\types\\runtime.types.ts", "..\\src\\subsys\\LoggerService.ts"],
4
+ "sourcesContent": [
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
+ "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}"
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,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
+ "debugId": "90BBA63A042C7D4764756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pulsar by NightX
3
+ * Copyright (c) 2026 NightX. All rights reserved.
4
+ */
5
+ import{h as X}from"./chunk-cpn1qh4e.js";class G{static store=new Map;kv={set:(d,V)=>{G.store.set(d,V)},get:(d)=>{return G.store.get(d)},has:(d)=>{return G.store.has(d)},delete:(d)=>{return G.store.delete(d)},clear:()=>{G.store.clear()}};lists={add:(d,V)=>{if(!G.store.has(d))G.store.set(d,new Set);let w=G.store.get(d);if(w instanceof Set)w.add(V)},remove:(d,V)=>{let w=G.store.get(d);if(w instanceof Set)return w.delete(V);return!1},get:(d)=>{let V=G.store.get(d);return V instanceof Set?V:void 0},has:(d,V)=>{let w=G.store.get(d);if(w instanceof Set)return w.has(V);return!1}}}var W=()=>new G;var Z=new Set(["storage","runtime","onEvents","isolate","queue"]),$=new Set(["queue","deadLetterQueue"]);class H{static instance;_config;initialSnapshot;logger;constructor(){this.logger=new X}static getInstance(){if(!H.instance)H.instance=new H;return H.instance}initialize(d){let V=d.engine?.interventionPolicy??"disabled";this._config={swarmConfig:{globalMaxJobsPerTick:1e5,maxGlobalConcurrency:1e4,spawnerAlgorithm:"ROUND_ROBIN",...d.swarmConfig},...d,engine:{...d.runtime=="persistent"?{poolingIntervalSec:5}:{},...d.runtime=="serverless-vm"||d.runtime=="v8-isolate"?{selfInvocationMethod:"auto_using_pgnet",selfInvocationIntervalSec:1,healthCheckIntervalSec:15,selfRestartIntervalSec:60}:{},tickConcurrency:"sequential",cycleTickLimit:1000,interventionPolicy:V,...d.engine},queues:d.queues.map((w)=>({stateTransitionPolicy:{enabled:!0,idleThresholdTicks:10,idleTimingProfile:"RELAXED"},interventionPolicy:V,...w}))},this.throwExpectionOnInvalidConfiguration(this._config),this.initialSnapshot=Object.freeze(JSON.parse(JSON.stringify(this._config)))}throwExpectionOnInvalidConfiguration(d){if(d.apiKey.trim().length==0)throw Error("[Pulsar] Invalid runtime configuration : An API key must be provided to initialize the client.");let V=d.queues;if(V.length==0)throw this.logger.error('[Pulsar] Runtime configuration error: "queues" atleast 1 queue is required to operate.'),Error('[Pulsar] Runtime configuration error: "queues" atleast 1 queue is required to operate.');if(d.runtime==="v8-isolate"&&!d.isolate)throw this.logger.error(`[Pulsar] Runtime configuration error: "isolate" instance is required when running in "${"v8-isolate"}" mode.`),Error(`[Pulsar] Runtime configuration error: "isolate" instance is required when running in "${"v8-isolate"}" mode.`);let w=V.reduce((x,z)=>{return x[z.queue]=(x[z.queue]||0)+1,x},{}),F=Object.keys(w).filter((x)=>w[x]>1);if(F.length>0)throw this.logger.error("[ConfigurationStore]: Duplicate queues found -> ",F),Error("Duplicate queue names detected in the configuration.");let A=V.map((x)=>x.consumer);if(d.runtime!=="persistent"){let x=A.find((z)=>z.type=="socket");if(x)throw this.logger.error(`${JSON.stringify(x)}`),Error("Consumers do not support non-persistent socket types. Please either remove the 'socket' type from the consumer or update the runtime to PERSISTENT.")}for(let x of A)if(x.type=="http")try{let z=new URL(x.url);if(z.protocol!=="http:"&&z.protocol!=="https:")throw this.logger.error(`${x.queue} - ${x.url}`),Error(`Invalid protocol '${z.protocol}' for consumer URL. Only HTTP and HTTPS are supported.`)}catch(z){this.logger.error(`${x.queue} - ${x.url}`);let J=z instanceof Error?z.message:"An unknown error occurred while parsing the consumer URL.";throw Error(`Failed to validate consumer URL: ${J}`)}else if(x.type=="callback"){if(!x.handler)throw Error("Consumer handler is required. Please provide a valid handler function.")}if(d.runtime==="persistent"){let x=d.networkInterface;if(x.mode==="websocket"){if(A.some((J)=>J.type==="http"))throw this.logger.error("Invalid network configuration : websocket-only mode cannot contain HTTP consumers as this causes orphan consumers and slot blocking."),Error("Invalid network configuration : websocket-only mode cannot contain HTTP consumers as this causes orphan consumers and slot blocking.")}else if(x.mode==="http"){if(A.some((J)=>J.type==="socket"))throw this.logger.error("Invalid network configuration : HTTP mode cannot contain socket consumers."),Error("Invalid network configuration : HTTP mode cannot contain socket consumers.")}}}ensureInitialized(){if(!this._config)throw Error("[ConfigurationStore]: Engine configuration store is not initialized. Call initialize() first.");if(!this.initialSnapshot)throw Error("[ConfigurationStore]: Engine initial snapshot is not initialized")}get raw(){return this.ensureInitialized(),this._config}get(d){this.ensureInitialized();let V=d.split("."),w=this._config;for(let F of V){if(w===void 0||w===null)return;w=w[F]}return w}getInitialSnapshot(){return this.ensureInitialized(),Object.freeze({...this.initialSnapshot})}set(d,V){this.ensureInitialized();let w=d.split("."),F=w[0];if(Z.has(F))throw Error(`[ConfigurationStore]: Modifying path '${d}' via set() is forbidden.`);let A=this._config;for(let x=0;x<w.length-1;x++){let z=w[x];if(!(z in A)||typeof A[z]!=="object")A[z]={};A=A[z]}A[w[w.length-1]]=V}modifyQueue(d,V,w){if(this.ensureInitialized(),$.has(V))throw Error(`[ConfigurationStore]: Property '${String(V)}' on queue '${d}' cannot be modified at runtime.`);let F=this._config.queues.findIndex((A)=>A.queue==d);if(!this._config.queues[F])throw Error(`[ConfigurationStore]: Modifying queue '${d}' not found.`);this._config.queues[F][V]=w}async reconcileConfiguration(d){let V=this.getInitialSnapshot(),w=W(),F="NOT_REQUIRED";if(V.runtime==="serverless-vm"||V.runtime==="v8-isolate")F=V.engine.selfURL;else if(V.runtime==="persistent"&&V.eventTriggerStrategy==="WEBHOOK"){let z=w.kv.get("self_url");if(!z)throw Error("Runtime cache URL not found. The URL parameter is required when operating in PERSISTENT mode and when eventTriggerStrategy is set to WEBHOOK. Please verify your system configuration and ensure the HTTP server has successfully started and is running.");F=z}let A={queues:V.queues.map((z)=>({queue:z.queue,pooler:z.pooler})),runtime:V.runtime,event_trigger_strategy:V.runtime=="persistent"?V.eventTriggerStrategy:"WEBHOOK",self_url:F},x=await d.verifyAndSyncConfiguration("PULSAR_STANDALONE",V.instanceId,F,A);if(!x.isChanged&&!x.isNew)return this.logger.log("[Configuration] status : [VALID]."),"[Configuration] status : [VALID].";else return this.logger.log("[Configuration] status : [INVALID & Reconciled]."),"[Configuration] status : [INVALID & Reconciled]."}}var O=H.getInstance();
6
+ export{W as d,O as e};
7
+
8
+ /* Powered by NightX - Pulsar Engine */
9
+
10
+ //# debugId=4B313CF47726553E64756E2164756E21
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["..\\src\\subsys\\RuntimeCacheStorage.ts", "..\\src\\service\\ConfigurationStore.ts"],
4
+ "sourcesContent": [
5
+ "export class RuntimeCacheStorage {\r\n public static store : Map<string, any> = new Map();\r\n\r\n public kv = {\r\n set: <V>(key : string, value : V) => {\r\n RuntimeCacheStorage.store.set(key, value);\r\n },\r\n \r\n get: <K>(key : string) : K | undefined => {\r\n return RuntimeCacheStorage.store.get(key) as K;\r\n },\r\n \r\n has: (key : string) : boolean => {\r\n return RuntimeCacheStorage.store.has(key);\r\n },\r\n \r\n delete: (key : string) : boolean => {\r\n return RuntimeCacheStorage.store.delete(key);\r\n },\r\n \r\n clear: () => {\r\n RuntimeCacheStorage.store.clear();\r\n }\r\n }\r\n\r\n public lists = {\r\n add: (key : string, value : string) => {\r\n if (!RuntimeCacheStorage.store.has(key)) {\r\n RuntimeCacheStorage.store.set(key, new Set<string>());\r\n }\r\n const targetSet = RuntimeCacheStorage.store.get(key);\r\n if (targetSet instanceof Set) {\r\n targetSet.add(value);\r\n }\r\n },\r\n \r\n remove: (key : string, value : string) => {\r\n const targetSet = RuntimeCacheStorage.store.get(key);\r\n if (targetSet instanceof Set) {\r\n return targetSet.delete(value);\r\n }\r\n return false;\r\n },\r\n \r\n get: (key : string) : Set<string> | undefined => {\r\n const targetSet = RuntimeCacheStorage.store.get(key);\r\n return targetSet instanceof Set ? targetSet : undefined;\r\n },\r\n \r\n has: (key : string, value : string) : boolean => {\r\n const targetSet = RuntimeCacheStorage.store.get(key);\r\n if (targetSet instanceof Set) {\r\n return targetSet.has(value);\r\n }\r\n return false;\r\n }\r\n }\r\n}\r\n\r\nexport const createRuntimeCacheStorage = () => new RuntimeCacheStorage();",
6
+ "import type { EngineConfig } from \"../types/base.types.ts\";\r\nimport type { QueueModule } from \"../helpers/defineQueue\";\r\nimport type { PostgresEngineOperationRepository } from \"../storage/repositories/PostgresEngineOperationRepository\";\r\nimport type { EngineQueuesConfig } from \"../types/queue.types\";\r\nimport type { PathValue, SettablePathKeys, ReadablePathKeys, IConfigurationObject } from \"../types/config.types\";\r\n\r\nimport { LoggerService, type ILogger } from \"../subsys/LoggerService.ts\";\r\nimport { PulsarRuntime } from \"../types/runtime.types.ts\";\r\nimport { EventTriggerStrategy } from \"../types/eventTriggerStrategry.types.ts\";\r\nimport { createRuntimeCacheStorage } from \"../subsys/RuntimeCacheStorage.ts\";\r\n\r\nconst RUNTIME_BLOCKED_KEYS = new Set([\"storage\", \"runtime\", \"onEvents\", \"isolate\", \"queue\"]);\r\n\r\nconst RUNTIME_BLOCKED_QUEUE_KEYS = new Set<string>([\"queue\", \"deadLetterQueue\"]);\r\n\r\nexport class ConfigurationStore {\r\n private static instance : ConfigurationStore;\r\n protected _config? : EngineConfig;\r\n private initialSnapshot? : EngineConfig;\r\n private logger : ILogger;\r\n\r\n constructor() {\r\n this.logger = new LoggerService();\r\n }\r\n\r\n public static getInstance() : ConfigurationStore {\r\n if (!ConfigurationStore.instance) {\r\n ConfigurationStore.instance = new ConfigurationStore();\r\n }\r\n return ConfigurationStore.instance;\r\n }\r\n\r\n public initialize(baseConfig : EngineConfig) {\r\n const engineInterventionPolicy = baseConfig.engine?.interventionPolicy ?? 'disabled';\r\n\r\n this._config = {\r\n swarmConfig : {\r\n globalMaxJobsPerTick : 100_000,\r\n maxGlobalConcurrency : 10_000,\r\n spawnerAlgorithm : \"ROUND_ROBIN\",\r\n ...baseConfig.swarmConfig, \r\n },\r\n ...baseConfig,\r\n engine: {\r\n ...(baseConfig.runtime == PulsarRuntime.PERSISTENT ? {\r\n poolingIntervalSec : 5\r\n } : {}),\r\n\r\n ...(baseConfig.runtime == PulsarRuntime.SERVERLESS_VM || baseConfig.runtime == PulsarRuntime.V8_ISOLATE ? {\r\n selfInvocationMethod : \"auto_using_pgnet\",\r\n selfInvocationIntervalSec : 1,\r\n healthCheckIntervalSec : 15,\r\n selfRestartIntervalSec : 60,\r\n } : {}),\r\n\r\n tickConcurrency : \"sequential\",\r\n cycleTickLimit : 1000,\r\n\r\n interventionPolicy : engineInterventionPolicy,\r\n \r\n ...baseConfig.engine,\r\n },\r\n queues : baseConfig.queues.map(q => ({\r\n stateTransitionPolicy : {\r\n enabled : true,\r\n idleThresholdTicks : 10,\r\n idleTimingProfile : 'RELAXED'\r\n },\r\n interventionPolicy : engineInterventionPolicy,\r\n ...q\r\n }))\r\n } as EngineConfig;\r\n\r\n this.throwExpectionOnInvalidConfiguration(this._config);\r\n\r\n this.initialSnapshot = Object.freeze(JSON.parse(JSON.stringify(this._config)));\r\n }\r\n\r\n private throwExpectionOnInvalidConfiguration(config : EngineConfig) {\r\n\r\n if(config.apiKey.trim().length == 0) {\r\n throw new Error('[Pulsar] Invalid runtime configuration : An API key must be provided to initialize the client.');\r\n }\r\n\r\n const queues : Array<QueueModule> = config.queues;\r\n\r\n if(queues.length == 0) {\r\n this.logger.error(`[Pulsar] Runtime configuration error: \"queues\" atleast 1 queue is required to operate.`);\r\n throw new Error(`[Pulsar] Runtime configuration error: \"queues\" atleast 1 queue is required to operate.`);\r\n }\r\n\r\n if (config.runtime === PulsarRuntime.V8_ISOLATE && !config.isolate) {\r\n this.logger.error(`[Pulsar] Runtime configuration error: \"isolate\" instance is required when running in \"${PulsarRuntime.V8_ISOLATE}\" mode.`);\r\n throw new Error(`[Pulsar] Runtime configuration error: \"isolate\" instance is required when running in \"${PulsarRuntime.V8_ISOLATE}\" mode.`);\r\n }\r\n\r\n const queueCounts = queues.reduce<Record<string, number>>((acc, q) => {\r\n acc[q.queue] = (acc[q.queue] || 0) + 1;\r\n return acc;\r\n }, {})\r\n\r\n const duplicateQueueNames = Object.keys(queueCounts).filter(queueName => queueCounts[queueName]! > 1);\r\n\r\n if(duplicateQueueNames.length > 0) {\r\n this.logger.error(\"[ConfigurationStore]: Duplicate queues found -> \", duplicateQueueNames);\r\n throw new Error(\"Duplicate queue names detected in the configuration.\");\r\n }\r\n\r\n const consumers = queues.map(q => q.consumer);\r\n\r\n if(config.runtime !== PulsarRuntime.PERSISTENT) {\r\n const hasSocketConsumer = consumers.find(c => c.type == \"socket\");\r\n \r\n if(hasSocketConsumer) {\r\n this.logger.error(`${JSON.stringify(hasSocketConsumer)}`);\r\n throw new Error(`Consumers do not support non-persistent socket types. Please either remove the 'socket' type from the consumer or update the runtime to PERSISTENT.`);\r\n }\r\n }\r\n\r\n for(const consumer of consumers) {\r\n if(consumer.type == \"http\") {\r\n try {\r\n const parsedUrl = new URL(consumer.url);\r\n if (parsedUrl.protocol !== \"http:\" && parsedUrl.protocol !== \"https:\") {\r\n this.logger.error(`${consumer.queue} - ${consumer.url}`);\r\n throw new Error(`Invalid protocol '${parsedUrl.protocol}' for consumer URL. Only HTTP and HTTPS are supported.`);\r\n }\r\n }\r\n catch (error) {\r\n this.logger.error(`${consumer.queue} - ${consumer.url}`);\r\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred while parsing the consumer URL.\";\r\n throw new Error(`Failed to validate consumer URL: ${errorMessage}`);\r\n }\r\n }\r\n else if (consumer.type == \"callback\") {\r\n if(!consumer.handler) {\r\n throw new Error(`Consumer handler is required. Please provide a valid handler function.`);\r\n }\r\n }\r\n }\r\n\r\n if(config.runtime === PulsarRuntime.PERSISTENT) {\r\n const networkConfig = config.networkInterface;\r\n\r\n if (networkConfig.mode === \"websocket\") {\r\n const hasHttpConsumers = consumers.some(c => c.type === \"http\");\r\n if (hasHttpConsumers) {\r\n this.logger.error(\"Invalid network configuration : websocket-only mode cannot contain HTTP consumers as this causes orphan consumers and slot blocking.\");\r\n throw new Error(\"Invalid network configuration : websocket-only mode cannot contain HTTP consumers as this causes orphan consumers and slot blocking.\");\r\n }\r\n }\r\n else if (networkConfig.mode === \"http\") {\r\n const hasSocketConsumers = consumers.some(c => c.type === \"socket\");\r\n if (hasSocketConsumers) {\r\n this.logger.error(\"Invalid network configuration : HTTP mode cannot contain socket consumers.\");\r\n throw new Error(\"Invalid network configuration : HTTP mode cannot contain socket consumers.\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n private ensureInitialized() : asserts this is { _config: EngineConfig } {\r\n if (!this._config) {\r\n throw new Error(\"[ConfigurationStore]: Engine configuration store is not initialized. Call initialize() first.\");\r\n }\r\n if (!this.initialSnapshot) {\r\n throw new Error(\"[ConfigurationStore]: Engine initial snapshot is not initialized\");\r\n }\r\n }\r\n\r\n public get raw() : Readonly<EngineConfig> {\r\n this.ensureInitialized();\r\n return this._config;\r\n }\r\n\r\n public get<P extends ReadablePathKeys<EngineConfig>>(path : P) : PathValue<EngineConfig, P> {\r\n this.ensureInitialized();\r\n\r\n const keys = path.split(\".\");\r\n let current: any = this._config;\r\n\r\n for (const key of keys) {\r\n if (current === undefined || current === null) {\r\n return undefined as PathValue<EngineConfig, P>;\r\n }\r\n current = current[key];\r\n }\r\n\r\n return current as PathValue<EngineConfig, P>;\r\n }\r\n\r\n public getInitialSnapshot() : Readonly<EngineConfig> {\r\n this.ensureInitialized();\r\n return Object.freeze({ ...this.initialSnapshot! });\r\n }\r\n\r\n public set<P extends SettablePathKeys<EngineConfig>>(path: P, value: PathValue<EngineConfig, P>): void {\r\n this.ensureInitialized();\r\n\r\n const keys = path.split(\".\");\r\n const rootKey = keys[0]!;\r\n\r\n if (RUNTIME_BLOCKED_KEYS.has(rootKey)) {\r\n throw new Error(`[ConfigurationStore]: Modifying path '${path}' via set() is forbidden.`);\r\n }\r\n\r\n let current: any = this._config!;\r\n\r\n for (let i = 0; i < keys.length - 1; i++) {\r\n const key = keys[i]!;\r\n if (!(key in current) || typeof current[key] !== \"object\") {\r\n current[key] = {};\r\n }\r\n current = current[key];\r\n }\r\n\r\n current[keys[keys.length - 1]!] = value;\r\n }\r\n\r\n public modifyQueue<K extends keyof EngineQueuesConfig, P extends SettablePathKeys<EngineQueuesConfig>>(\r\n queue : string,\r\n key : K,\r\n value : PathValue<EngineQueuesConfig, P>\r\n ) {\r\n this.ensureInitialized();\r\n\r\n if (RUNTIME_BLOCKED_QUEUE_KEYS.has(key as string)) {\r\n throw new Error(`[ConfigurationStore]: Property '${String(key)}' on queue '${queue}' cannot be modified at runtime.`);\r\n }\r\n\r\n const targetQueueIndex = this._config.queues.findIndex(q => q.queue == queue);\r\n\r\n if(!this._config['queues'][targetQueueIndex]) {\r\n throw new Error(`[ConfigurationStore]: Modifying queue '${queue}' not found.`);\r\n }\r\n\r\n this._config['queues'][targetQueueIndex]![key] = value as unknown as QueueModule[K];\r\n }\r\n\r\n public async reconcileConfiguration(repository : PostgresEngineOperationRepository) {\r\n const initialSnapshot = this.getInitialSnapshot();\r\n const store = createRuntimeCacheStorage();\r\n \r\n let selfUrl : string = 'NOT_REQUIRED';\r\n\r\n if(initialSnapshot.runtime === PulsarRuntime.SERVERLESS_VM || initialSnapshot.runtime === PulsarRuntime.V8_ISOLATE) {\r\n selfUrl = initialSnapshot.engine.selfURL;\r\n }\r\n else if(initialSnapshot.runtime === PulsarRuntime.PERSISTENT && initialSnapshot.eventTriggerStrategy === EventTriggerStrategy.WEBHOOK) {\r\n const cacheUrl = store.kv.get<string>('self_url');\r\n \r\n if(!cacheUrl) {\r\n throw new Error(`Runtime cache URL not found. The URL parameter is required when operating in PERSISTENT mode and when eventTriggerStrategy is set to WEBHOOK. Please verify your system configuration and ensure the HTTP server has successfully started and is running.`);\r\n }\r\n \r\n selfUrl = cacheUrl;\r\n }\r\n\r\n /*\r\n const selfUrl = (\r\n initialSnapshot.runtime === PulsarRuntime.SERVERLESS_VM ||\r\n initialSnapshot.runtime === PulsarRuntime.V8_ISOLATE\r\n ) ? initialSnapshot.engine.selfURL : 'NOT_REQUIRED';\r\n */\r\n\r\n const ConfigurationObject : IConfigurationObject = {\r\n queues : initialSnapshot.queues.map(q => ({\r\n queue : q.queue,\r\n pooler : q.pooler\r\n })),\r\n runtime : initialSnapshot.runtime,\r\n event_trigger_strategy : initialSnapshot.runtime == PulsarRuntime['PERSISTENT'] ? initialSnapshot.eventTriggerStrategy : EventTriggerStrategy.WEBHOOK,\r\n self_url : selfUrl\r\n }\r\n\r\n const configurationSyncStatus = await repository.verifyAndSyncConfiguration(\r\n 'PULSAR_STANDALONE',\r\n initialSnapshot.instanceId as string,\r\n selfUrl,\r\n ConfigurationObject\r\n )\r\n\r\n if(!configurationSyncStatus.isChanged && !configurationSyncStatus.isNew) {\r\n this.logger.log(`[Configuration] status : [VALID].`);\r\n return `[Configuration] status : [VALID].`;\r\n }\r\n else {\r\n this.logger.log(`[Configuration] status : [INVALID & Reconciled].`);\r\n return `[Configuration] status : [INVALID & Reconciled].`;\r\n }\r\n }\r\n}\r\n\r\nexport const config = ConfigurationStore.getInstance();"
7
+ ],
8
+ "mappings": ";;;;wCAAO,MAAM,CAAoB,OACf,OAA2B,IAAI,IAEtC,GAAK,CACR,IAAK,CAAI,EAAc,IAAc,CACjC,EAAoB,MAAM,IAAI,EAAK,CAAK,GAG5C,IAAK,CAAI,IAAiC,CACtC,OAAO,EAAoB,MAAM,IAAI,CAAG,GAG5C,IAAK,CAAC,IAA2B,CAC7B,OAAO,EAAoB,MAAM,IAAI,CAAG,GAG5C,OAAQ,CAAC,IAA2B,CAChC,OAAO,EAAoB,MAAM,OAAO,CAAG,GAG/C,MAAO,IAAM,CACT,EAAoB,MAAM,MAAM,EAExC,EAEO,MAAQ,CACX,IAAK,CAAC,EAAc,IAAmB,CACnC,GAAI,CAAC,EAAoB,MAAM,IAAI,CAAG,EAClC,EAAoB,MAAM,IAAI,EAAK,IAAI,GAAa,EAExD,IAAM,EAAY,EAAoB,MAAM,IAAI,CAAG,EACnD,GAAI,aAAqB,IACrB,EAAU,IAAI,CAAK,GAI3B,OAAQ,CAAC,EAAc,IAAmB,CACtC,IAAM,EAAY,EAAoB,MAAM,IAAI,CAAG,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import type { EngineSwarmConfig } from "../types/base.types.d.ts";
2
+ import type { QueueModule } from "../helpers/defineQueue";
3
+ import type { Pulsar } from "../service/Pulsar.service";
4
+ interface ICallback {
5
+ status: 'OK' | 'ERR';
6
+ initialized_at: string;
7
+ configurations: {
8
+ queues: QueueModule[];
9
+ swarmConfig?: EngineSwarmConfig;
10
+ clusterMeta?: {
11
+ id: string;
12
+ idempotency?: string;
13
+ session_id: string;
14
+ dispose_at: number;
15
+ };
16
+ };
17
+ }
18
+ declare class NebulaClient {
19
+ private connectionState;
20
+ constructor();
21
+ connect(instanceId: string, connectionMethod: "HTTPS" | "SOCKET" | undefined, url: string): Promise<void>;
22
+ private initiateHandshake;
23
+ wrap(callback: (args: ICallback["configurations"]) => Pulsar): {
24
+ start: () => Promise<void>;
25
+ destory: () => Promise<void>;
26
+ };
27
+ }
28
+ export declare const Nebula: NebulaClient;
29
+ export {};
30
+ //# sourceMappingURL=Nebula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Nebula.d.ts","sourceRoot":"","sources":["../../src/cluster/Nebula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,UAAU,SAAS;IACf,MAAM,EAAG,IAAI,GAAG,KAAK,CAAC;IACtB,cAAc,EAAG,MAAM,CAAC;IACxB,cAAc,EAAG;QACb,MAAM,EAAG,WAAW,EAAE,CAAC;QACvB,WAAW,CAAC,EAAE,iBAAiB,CAAC;QAChC,WAAW,CAAC,EAAG;YAAE,EAAE,EAAG,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,UAAU,EAAG,MAAM,CAAC;YAAC,UAAU,EAAG,MAAM,CAAA;SAAE,CAAA;KACjG,CAAA;CACJ;AAED,cAAM,YAAY;IACd,OAAO,CAAC,eAAe,CAImD;;IAI7D,OAAO,CAAE,UAAU,EAAG,MAAM,EAAE,gBAAgB,EAAG,OAAO,GAAG,QAAQ,YAAU,EAAE,GAAG,EAAG,MAAM;YAM1F,iBAAiB;IAyBxB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,gBAAgB,CAAC,KAAK,MAAM;;;;CAmBtE;AAED,eAAO,MAAM,MAAM,cAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { IConfigurationObject } from "../types/config.types";
2
+ export declare function computeConfigDelta(oldCfg: IConfigurationObject, newCfg: IConfigurationObject): {
3
+ urlChanged: boolean;
4
+ addedQueues: {
5
+ queue: string;
6
+ pooler: string;
7
+ }[];
8
+ removedQueues: {
9
+ queue: string;
10
+ pooler: string;
11
+ }[];
12
+ modifiedQueues: {
13
+ queue: string;
14
+ oldPooler: string;
15
+ newPooler: string;
16
+ }[];
17
+ };
18
+ //# sourceMappingURL=computeConfigDelta.d.ts.map
@@ -0,0 +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;;;eAMvD,MAAM;gBAAW,MAAM;;;eACrB,MAAM;gBAAW,MAAM;;;eACtB,MAAM;mBAAc,MAAM;mBAAc,MAAM;;EA4BxF"}
@@ -0,0 +1,13 @@
1
+ import type { EngineConsumerConfig } from "../types/consumer.types.d.ts";
2
+ import type { EngineQueuesConfig } from "../types/queue.types.d.ts";
3
+ export type QueueModule = EngineQueuesConfig & {
4
+ consumer: EngineConsumerConfig;
5
+ };
6
+ type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
7
+ type EngineConsumerConfigWithoutQueue = DistributiveOmit<EngineConsumerConfig, "queue">;
8
+ type CreateQueueConfig = EngineQueuesConfig & {
9
+ consumer: EngineConsumerConfigWithoutQueue;
10
+ };
11
+ export declare function createQueue(config: CreateQueueConfig): QueueModule;
12
+ export {};
13
+ //# sourceMappingURL=defineQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineQueue.d.ts","sourceRoot":"","sources":["../../src/helpers/defineQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG;IAC3C,QAAQ,EAAG,oBAAoB,CAAC;CACnC,CAAA;AAED,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AACnF,KAAK,gCAAgC,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;AAExF,KAAK,iBAAiB,GAAG,kBAAkB,GAAG;IAAE,QAAQ,EAAG,gCAAgC,CAAA;CAAC,CAAC;AAE7F,wBAAgB,WAAW,CAAC,MAAM,EAAG,iBAAiB,GAAI,WAAW,CAQpE"}
@@ -0,0 +1,2 @@
1
+ export declare function generateSHA256(message: string): Promise<string>;
2
+ //# sourceMappingURL=generateShaHash.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,6 @@
1
+ export { EventTriggerStrategy } from "./types/eventTriggerStrategry.types.d.ts";
2
+ export { createQueue } from "./helpers/defineQueue.d.ts";
3
+ export { IsolateInstance } from "./service/Isolate.service.d.ts";
4
+ export { PulsarRuntime } from "./types/runtime.types.d.ts";
5
+ export { Pulsar } from "./service/Pulsar.service.d.ts";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC"}