@hotmeshio/hotmesh 0.21.0 → 0.21.1
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/build/package.json
CHANGED
|
@@ -118,6 +118,7 @@ export declare class ClientService {
|
|
|
118
118
|
offset?: number;
|
|
119
119
|
}) => Promise<any>;
|
|
120
120
|
get: (id: string, namespace?: string) => Promise<any>;
|
|
121
|
+
getBySignalKey: (signalKey: string, namespace?: string) => Promise<any>;
|
|
121
122
|
claim: (params: {
|
|
122
123
|
id: string;
|
|
123
124
|
namespace?: string;
|
|
@@ -335,6 +335,14 @@ class ClientService {
|
|
|
335
335
|
const ns = namespace ?? factory_1.APP_ID;
|
|
336
336
|
return store.getSignal({ namespace: ns, appId: store.appId, id });
|
|
337
337
|
},
|
|
338
|
+
getBySignalKey: async (signalKey, namespace) => {
|
|
339
|
+
const hotMesh = await this.getHotMeshClient(null, namespace);
|
|
340
|
+
const store = hotMesh.engine.store;
|
|
341
|
+
if (typeof store.getSignalBySignalKey !== 'function')
|
|
342
|
+
return null;
|
|
343
|
+
const ns = namespace ?? factory_1.APP_ID;
|
|
344
|
+
return store.getSignalBySignalKey({ namespace: ns, appId: store.appId, signalKey });
|
|
345
|
+
},
|
|
338
346
|
claim: async (params) => {
|
|
339
347
|
const hotMesh = await this.getHotMeshClient(null, params.namespace);
|
|
340
348
|
const store = hotMesh.engine.store;
|
|
@@ -380,6 +380,37 @@ declare class PostgresStoreService extends StoreService<ProviderClient, Provider
|
|
|
380
380
|
createdAt: Date;
|
|
381
381
|
updatedAt: Date;
|
|
382
382
|
}>;
|
|
383
|
+
getSignalBySignalKey(params: {
|
|
384
|
+
namespace: string;
|
|
385
|
+
appId: string;
|
|
386
|
+
signalKey: string;
|
|
387
|
+
}): Promise<{
|
|
388
|
+
id: string;
|
|
389
|
+
namespace: string;
|
|
390
|
+
appId: string;
|
|
391
|
+
signalKey: string;
|
|
392
|
+
workflowId: string;
|
|
393
|
+
jobId: string;
|
|
394
|
+
topic: string;
|
|
395
|
+
status: "pending" | "claimed" | "resolved" | "expired" | "released";
|
|
396
|
+
role: string;
|
|
397
|
+
type: string;
|
|
398
|
+
subtype: string;
|
|
399
|
+
priority: number;
|
|
400
|
+
description: string;
|
|
401
|
+
taskQueue: string;
|
|
402
|
+
workflowType: string;
|
|
403
|
+
assignedTo: string;
|
|
404
|
+
claimedAt: Date;
|
|
405
|
+
claimExpiresAt: Date;
|
|
406
|
+
resolvedAt: Date;
|
|
407
|
+
resolverPayload: Record<string, unknown>;
|
|
408
|
+
envelope: Record<string, unknown>;
|
|
409
|
+
metadata: Record<string, unknown>;
|
|
410
|
+
expiresAt: Date;
|
|
411
|
+
createdAt: Date;
|
|
412
|
+
updatedAt: Date;
|
|
413
|
+
}>;
|
|
383
414
|
/**
|
|
384
415
|
* Parse a HotMesh-encoded value string.
|
|
385
416
|
* Values may be prefixed with `/s` (JSON), `/d` (number), `/t` or `/f` (boolean), `/n` (null).
|
|
@@ -1643,6 +1643,13 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
1643
1643
|
return null;
|
|
1644
1644
|
return this.rowToSignalEntry(result.rows[0]);
|
|
1645
1645
|
}
|
|
1646
|
+
async getSignalBySignalKey(params) {
|
|
1647
|
+
const tbl = this.signalQueueTable();
|
|
1648
|
+
const result = await this.pgClient.query(`SELECT * FROM ${tbl} WHERE namespace = $1 AND app_id = $2 AND signal_key = $3 LIMIT 1`, [params.namespace, params.appId, params.signalKey]);
|
|
1649
|
+
if (result.rows.length === 0)
|
|
1650
|
+
return null;
|
|
1651
|
+
return this.rowToSignalEntry(result.rows[0]);
|
|
1652
|
+
}
|
|
1646
1653
|
// ─────────────────────────────────────────────────────────────────────────
|
|
1647
1654
|
/**
|
|
1648
1655
|
* Parse a HotMesh-encoded value string.
|