@happyvertical/smrt-jobs 0.51.21 → 0.51.26

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.
@@ -90,6 +90,12 @@ export interface ClaimForgeDeliveryOptions {
90
90
  workerId: string;
91
91
  leaseMs: number;
92
92
  now?: Date;
93
+ /**
94
+ * Claim only deliveries from these providers. Runtimes that share the inbox
95
+ * with other projections must set it so each claims only its own
96
+ * deliveries; omitted, every provider is claimable.
97
+ */
98
+ providers?: readonly string[];
93
99
  }
94
100
  /**
95
101
  * Durable provider delivery inbox.
@@ -107,6 +113,8 @@ export declare class ForgeDeliveryCollection extends SmrtCollection<ForgeDeliver
107
113
  export interface ForgeProjectionRuntimeOptions {
108
114
  db: DatabaseInterface;
109
115
  workerId: string;
116
+ /** Claim only these providers' deliveries; see {@link ClaimForgeDeliveryOptions}. */
117
+ providers?: readonly string[];
110
118
  leaseMs?: number;
111
119
  retryBaseMs?: number;
112
120
  retryMaxMs?: number;
@@ -123,6 +131,7 @@ export interface ForgeProjectionRuntimeOptions {
123
131
  export declare class ForgeProjectionRuntime {
124
132
  readonly db: DatabaseInterface;
125
133
  readonly workerId: string;
134
+ readonly providers?: readonly string[];
126
135
  readonly leaseMs: number;
127
136
  readonly retryBaseMs: number;
128
137
  readonly retryMaxMs: number;
@@ -1 +1 @@
1
- {"version":3,"file":"forge-projection.d.ts","sourceRoot":"","sources":["../src/forge-projection.ts"],"names":[],"mappings":"AAEA,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAGL,cAAc,EACd,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAe5D,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,QAAQ,GACR,OAAO,GACP,WAAW,GACX,aAAa,CAAC;AAElB;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,UA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AC;IACjB,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,wBAAwB,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAsB;IACjC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,wBAAwB,CAAC;gBAE9B,OAAO,EAAE,6BAA6B;IAa5C,WAAW,CACf,SAAS,EAAE,cAAc,EACzB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,IAAI,CAAA;KAAO,GAC3B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAwBlB,WAAW;YAsGX,SAAS;CAiDxB"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SmrtJobCollection, C as JOB_EVENTS_RETENTION_TASK, D as SmrtJobEvent, E as unregisterJobRetentionTasks, F as backgroundEligible, I as clampRetries, L as getBackgroundEligibleMethods, M as MAX_JOB_RETRIES, N as TenantJobCapExceededError, O as SmrtJobEventCollection, P as assertWithinTenantCreationCap, R as isBackgroundEligibleMethod, S as JOBS_RETENTION_TASK, T as startRetentionSweeper, _ as JobContextLogger, a as isRunnerExecutionContext, b as DEFAULT_JOB_RETENTION, c as SmrtWorkerCollection, d as McpTaskNotFoundError, f as McpTaskStore, g as taskFromJob, h as requestMcpTaskInput, i as getActiveJobExecutionContext, j as DEFAULT_TENANT_JOB_CAP, k as SmrtJob, l as MCP_TASKS_EXTENSION, m as getMcpTaskMarker, n as TaskRunner, o as DEFAULT_TASK_HEARTBEAT_INTERVAL_MS, p as createMcpTaskResult, r as createTaskRunner, s as SmrtWorker, t as JobTimeoutError, u as McpTaskCancelledError, v as redactErrorForPersistence, w as registerJobRetentionTasks, x as DEFAULT_RETENTION_SWEEP_INTERVAL_MS, y as redactErrorMessage, z as markBackgroundEligible } from "./chunks/runner-DDpg2uEY.js";
1
+ import { A as SmrtJobCollection, C as JOB_EVENTS_RETENTION_TASK, D as SmrtJobEvent, E as unregisterJobRetentionTasks, F as backgroundEligible, I as clampRetries, L as getBackgroundEligibleMethods, M as MAX_JOB_RETRIES, N as TenantJobCapExceededError, O as SmrtJobEventCollection, P as assertWithinTenantCreationCap, R as isBackgroundEligibleMethod, S as JOBS_RETENTION_TASK, T as startRetentionSweeper, _ as JobContextLogger, a as isRunnerExecutionContext, b as DEFAULT_JOB_RETENTION, c as SmrtWorkerCollection, d as McpTaskNotFoundError, f as McpTaskStore, g as taskFromJob, h as requestMcpTaskInput, i as getActiveJobExecutionContext, j as DEFAULT_TENANT_JOB_CAP, k as SmrtJob, l as MCP_TASKS_EXTENSION, m as getMcpTaskMarker, n as TaskRunner, o as DEFAULT_TASK_HEARTBEAT_INTERVAL_MS, p as createMcpTaskResult, r as createTaskRunner, s as SmrtWorker, t as JobTimeoutError, u as McpTaskCancelledError, v as redactErrorForPersistence, w as registerJobRetentionTasks, x as DEFAULT_RETENTION_SWEEP_INTERVAL_MS, y as redactErrorMessage, z as markBackgroundEligible } from "./chunks/runner-CSFtRl0Q.js";
2
2
  import { c as unregisterLiveWorker, i as registerLiveWorker, n as isWorkerAlive, t as createWorkerKey } from "./chunks/worker-liveness-C1Gjnhax.js";
3
3
  import { ObjectRegistry, SmrtCollection, SmrtObject, detectEngine, field, smrt } from "@happyvertical/smrt-core";
4
4
  import { createLogger } from "@happyvertical/logger";
@@ -242,13 +242,14 @@ var ForgeDeliveryCollection = class extends SmrtCollection {
242
242
  ) VALUES (?, ?, '', ?, ?, ?, ?, ?, ?, ?, 'pending', 0, ?, ?, ?, 0, ?, ?)
243
243
  ON CONFLICT (tenant_id, provider, delivery_id) DO NOTHING
244
244
  RETURNING id`, id, `${input.provider}-${input.deliveryId}`.slice(0, 255), tenant, input.provider, input.deliveryId, input.installationKey ?? null, input.repositoryKey ?? null, input.eventName, JSON.stringify(input.payload), clampMaxAttempts(input.maxAttempts ?? 5), now.toISOString(), now.toISOString(), now.toISOString(), now.toISOString())).rows.length === 1;
245
- const delivery = (await this.query(`SELECT * FROM _smrt_forge_deliveries
246
- WHERE tenant_id = ? AND provider = ? AND delivery_id = ?
247
- LIMIT 1`, [
248
- tenant,
249
- input.provider,
250
- input.deliveryId
251
- ]))[0];
245
+ const [delivery] = await this.list({
246
+ where: {
247
+ tenantId: tenant,
248
+ provider: input.provider,
249
+ deliveryId: input.deliveryId
250
+ },
251
+ limit: 1
252
+ });
252
253
  if (!delivery) throw new Error("Forge delivery insert could not be read");
253
254
  await audit?.({
254
255
  type: accepted ? "delivery.accepted" : "delivery.duplicate",
@@ -269,6 +270,13 @@ var ForgeDeliveryCollection = class extends SmrtCollection {
269
270
  if (!leaseExpiresAt) throw new Error("leaseMs extends past the supported Date range");
270
271
  const token = randomUUID();
271
272
  const lockClause = getDatabaseEngine(this.db) === "postgres" ? " FOR UPDATE SKIP LOCKED" : "";
273
+ const providers = options.providers;
274
+ if (providers !== void 0) {
275
+ if (providers.length === 0) throw new Error("providers must name at least one provider");
276
+ for (const provider of providers) assertNonEmpty("providers[]", provider);
277
+ }
278
+ const providerClause = providers ? ` AND provider IN (${providers.map(() => "?").join(", ")})` : "";
279
+ const providerParams = providers ? [...providers] : [];
272
280
  await this.query(`UPDATE _smrt_forge_deliveries
273
281
  SET status = 'dead_letter',
274
282
  lease_owner = NULL,
@@ -278,7 +286,11 @@ var ForgeDeliveryCollection = class extends SmrtCollection {
278
286
  updated_at = ?
279
287
  WHERE status = 'leased'
280
288
  AND lease_expires_at < ?
281
- AND attempts >= max_attempts`, [nowIso, nowIso], { allowRawOnTenantScoped: true });
289
+ AND attempts >= max_attempts${providerClause}`, [
290
+ nowIso,
291
+ nowIso,
292
+ ...providerParams
293
+ ], { allowRawOnTenantScoped: true });
282
294
  const delivery = (await this.query(`UPDATE _smrt_forge_deliveries
283
295
  SET status = 'leased',
284
296
  attempts = attempts + 1,
@@ -289,7 +301,7 @@ var ForgeDeliveryCollection = class extends SmrtCollection {
289
301
  WHERE id IN (
290
302
  SELECT id
291
303
  FROM _smrt_forge_deliveries
292
- WHERE attempts < max_attempts
304
+ WHERE attempts < max_attempts${providerClause}
293
305
  AND (
294
306
  (status IN ('pending', 'retry') AND next_attempt_at <= ?)
295
307
  OR (status = 'leased' AND lease_expires_at < ?)
@@ -306,6 +318,7 @@ var ForgeDeliveryCollection = class extends SmrtCollection {
306
318
  token,
307
319
  leaseExpiresAt,
308
320
  nowIso,
321
+ ...providerParams,
309
322
  nowIso,
310
323
  nowIso,
311
324
  nowIso,
@@ -363,6 +376,7 @@ ForgeDeliveryCollection = __decorateClass([smrt({
363
376
  var ForgeProjectionRuntime = class {
364
377
  db;
365
378
  workerId;
379
+ providers;
366
380
  leaseMs;
367
381
  retryBaseMs;
368
382
  retryMaxMs;
@@ -370,6 +384,7 @@ var ForgeProjectionRuntime = class {
370
384
  constructor(options) {
371
385
  this.db = options.db;
372
386
  this.workerId = options.workerId;
387
+ this.providers = options.providers;
373
388
  this.leaseMs = options.leaseMs ?? 3e4;
374
389
  this.retryBaseMs = options.retryBaseMs ?? 1e3;
375
390
  this.retryMaxMs = options.retryMaxMs ?? 3e5;
@@ -382,7 +397,8 @@ var ForgeProjectionRuntime = class {
382
397
  const delivery = await (await ForgeDeliveryCollection.create({ db: this.db })).claimReady({
383
398
  workerId: this.workerId,
384
399
  leaseMs: this.leaseMs,
385
- now: options.now
400
+ now: options.now,
401
+ providers: this.providers
386
402
  }, this.audit);
387
403
  if (!delivery) return null;
388
404
  await withTenant({ tenantId: delivery.tenantId }, async () => {