@newhomestar/sdk 0.7.10 → 0.7.11
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/dist/events.js +7 -7
- package/package.json +1 -1
package/dist/events.js
CHANGED
|
@@ -54,7 +54,7 @@ async function _relayRow(db, row, eventsUrl, serviceToken) {
|
|
|
54
54
|
...row.payload,
|
|
55
55
|
idempotency_key: row.idempotencyKey,
|
|
56
56
|
};
|
|
57
|
-
const res = await fetch(`${eventsUrl}/
|
|
57
|
+
const res = await fetch(`${eventsUrl}/queue`, {
|
|
58
58
|
method: 'POST',
|
|
59
59
|
headers: {
|
|
60
60
|
'Authorization': `Bearer ${serviceToken}`,
|
|
@@ -317,7 +317,7 @@ export async function logEvent(payload) {
|
|
|
317
317
|
const eventsUrl = _getEnvOrThrow('NOVA_EVENTS_SERVICE_URL', 'logEvent');
|
|
318
318
|
const serviceToken = _getEnvOrThrow('NOVA_SERVICE_TOKEN', 'logEvent');
|
|
319
319
|
const serviceSlug = process.env.NOVA_SERVICE_SLUG;
|
|
320
|
-
const res = await fetch(`${eventsUrl}
|
|
320
|
+
const res = await fetch(`${eventsUrl}`, {
|
|
321
321
|
method: 'POST',
|
|
322
322
|
headers: {
|
|
323
323
|
'Authorization': `Bearer ${serviceToken}`,
|
|
@@ -349,7 +349,7 @@ export async function queueEvent(payload) {
|
|
|
349
349
|
const eventsUrl = _getEnvOrThrow('NOVA_EVENTS_SERVICE_URL', 'queueEvent');
|
|
350
350
|
const serviceToken = _getEnvOrThrow('NOVA_SERVICE_TOKEN', 'queueEvent');
|
|
351
351
|
const serviceSlug = process.env.NOVA_SERVICE_SLUG;
|
|
352
|
-
const res = await fetch(`${eventsUrl}/
|
|
352
|
+
const res = await fetch(`${eventsUrl}/queue`, {
|
|
353
353
|
method: 'POST',
|
|
354
354
|
headers: {
|
|
355
355
|
'Authorization': `Bearer ${serviceToken}`,
|
|
@@ -565,7 +565,7 @@ export async function withInboundEvent(db, msg, handler) {
|
|
|
565
565
|
// Safe because: if ACK fails, PGMQ re-delivers, UNIQUE(msg_id) blocks
|
|
566
566
|
// re-processing, and we just ACK again on the duplicate delivery.
|
|
567
567
|
try {
|
|
568
|
-
const ackRes = await fetch(`${eventsUrl}/
|
|
568
|
+
const ackRes = await fetch(`${eventsUrl}/queue/ack`, {
|
|
569
569
|
method: 'POST',
|
|
570
570
|
headers: {
|
|
571
571
|
'Authorization': `Bearer ${serviceToken}`,
|
|
@@ -676,7 +676,7 @@ export function startInboundConsumer(db, options) {
|
|
|
676
676
|
/** Send a NACK to extend the visibility timeout with exponential backoff */
|
|
677
677
|
async function _nack(msgId, readCt) {
|
|
678
678
|
try {
|
|
679
|
-
await fetch(`${eventsUrl}/
|
|
679
|
+
await fetch(`${eventsUrl}/queue/nack`, {
|
|
680
680
|
method: 'POST',
|
|
681
681
|
headers: {
|
|
682
682
|
'Authorization': `Bearer ${serviceToken}`,
|
|
@@ -710,7 +710,7 @@ export function startInboundConsumer(db, options) {
|
|
|
710
710
|
// No handler registered and no default — skip + ACK to unblock queue
|
|
711
711
|
console.log(`[nova/events] No handler for event type "${eventType}" (msg_id=${msgId}) — ACK and skip`);
|
|
712
712
|
try {
|
|
713
|
-
await fetch(`${eventsUrl}/
|
|
713
|
+
await fetch(`${eventsUrl}/queue/ack`, {
|
|
714
714
|
method: 'POST',
|
|
715
715
|
headers: { 'Authorization': `Bearer ${serviceToken}`, 'Content-Type': 'application/json' },
|
|
716
716
|
body: JSON.stringify({ queue_name: queueName, msg_id: msgId }),
|
|
@@ -802,7 +802,7 @@ export function startInboundConsumer(db, options) {
|
|
|
802
802
|
console.log(`[nova/events] SSE consumer starting — url=${eventsUrl} ` +
|
|
803
803
|
`token=${tokenSuffix} queue=${queueName} vt=${vt}s headersTimeout=120s`);
|
|
804
804
|
while (!abort.signal.aborted) {
|
|
805
|
-
const streamUrl = `${eventsUrl}/
|
|
805
|
+
const streamUrl = `${eventsUrl}/queue/stream?queue=${encodeURIComponent(queueName)}&vt=${vt}`;
|
|
806
806
|
const connectStart = Date.now();
|
|
807
807
|
try {
|
|
808
808
|
console.log(`[nova/events] Connecting to SSE stream (attempt ${reconnectAttempt + 1}): ${streamUrl}`);
|
package/package.json
CHANGED