@secondlayer/shared 11.4.2 → 11.5.0

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 (58) hide show
  1. package/README.md +4 -4
  2. package/dist/src/archive/derived-stage-report.d.ts +2 -2
  3. package/dist/src/archive/derived-stage-report.js.map +1 -1
  4. package/dist/src/archive/instance-diagnosis.js +2 -2
  5. package/dist/src/archive/instance-diagnosis.js.map +2 -2
  6. package/dist/src/archive/range-digest.d.ts +25 -25
  7. package/dist/src/archive/semantic-digest-builder.d.ts +25 -25
  8. package/dist/src/archive/status.d.ts +32 -7
  9. package/dist/src/archive/status.js +20 -3
  10. package/dist/src/archive/status.js.map +3 -3
  11. package/dist/src/coverage/index.d.ts +25 -25
  12. package/dist/src/coverage/index.js.map +1 -1
  13. package/dist/src/crypto/secondlayer-webhook.d.ts +2 -2
  14. package/dist/src/crypto/secondlayer-webhook.js.map +1 -1
  15. package/dist/src/crypto/secrets.js.map +1 -1
  16. package/dist/src/db/index.d.ts +37 -37
  17. package/dist/src/db/index.js +4 -4
  18. package/dist/src/db/index.js.map +3 -3
  19. package/dist/src/db/queries/chain-reorgs.d.ts +25 -25
  20. package/dist/src/db/queries/chain-reorgs.js +4 -4
  21. package/dist/src/db/queries/chain-reorgs.js.map +3 -3
  22. package/dist/src/db/queries/contracts.d.ts +25 -25
  23. package/dist/src/db/queries/instance.d.ts +25 -25
  24. package/dist/src/db/queries/integrity.d.ts +25 -25
  25. package/dist/src/db/queries/subgraph-gaps.d.ts +25 -25
  26. package/dist/src/db/queries/subgraph-operations.d.ts +25 -25
  27. package/dist/src/db/queries/subgraphs.d.ts +25 -25
  28. package/dist/src/db/queries/subgraphs.js +4 -4
  29. package/dist/src/db/queries/subgraphs.js.map +3 -3
  30. package/dist/src/db/queries/sync-scope.d.ts +25 -25
  31. package/dist/src/db/queries/{subscriptions.d.ts → webhooks.d.ts} +58 -58
  32. package/dist/src/db/queries/{subscriptions.js → webhooks.js} +38 -38
  33. package/dist/src/db/queries/webhooks.js.map +13 -0
  34. package/dist/src/db/schema.d.ts +34 -34
  35. package/dist/src/index.d.ts +109 -107
  36. package/dist/src/index.js +51 -54
  37. package/dist/src/index.js.map +6 -6
  38. package/dist/src/leader.d.ts +4 -4
  39. package/dist/src/leader.js +3 -3
  40. package/dist/src/leader.js.map +3 -3
  41. package/dist/src/node/local-client.d.ts +25 -25
  42. package/dist/src/queue/listener.d.ts +2 -2
  43. package/dist/src/queue/listener.js.map +1 -1
  44. package/dist/src/runtime/index.js +2 -6
  45. package/dist/src/runtime/index.js.map +4 -4
  46. package/dist/src/schemas/index.d.ts +61 -61
  47. package/dist/src/schemas/index.js +48 -51
  48. package/dist/src/schemas/index.js.map +5 -5
  49. package/dist/src/schemas/subgraphs.d.ts +2 -2
  50. package/dist/src/schemas/subgraphs.js.map +1 -1
  51. package/dist/src/schemas/{subscriptions.d.ts → webhooks.d.ts} +63 -63
  52. package/dist/src/schemas/{subscriptions.js → webhooks.js} +49 -52
  53. package/dist/src/schemas/webhooks.js.map +10 -0
  54. package/migrations/0126_rename_subscriptions_to_webhooks.ts +96 -0
  55. package/migrations/0127_rename_webhook_catalog_names.ts +55 -0
  56. package/package.json +8 -8
  57. package/dist/src/db/queries/subscriptions.js.map +0 -13
  58. package/dist/src/schemas/subscriptions.js.map +0 -10
@@ -60,8 +60,8 @@ interface SubgraphSummary {
60
60
  lastErrorAt?: string | null;
61
61
  /** Last row mutation timestamp; powers per-card freshness. */
62
62
  updatedAt?: string | null;
63
- /** Number of subscriptions attached to this subgraph. */
64
- subscriptionCount?: number;
63
+ /** Number of webhooks attached to this subgraph. */
64
+ webhookCount?: number;
65
65
  createdAt: string;
66
66
  }
67
67
  interface SubgraphGapRange {
@@ -202,17 +202,17 @@ interface SubgraphAggregateResponse {
202
202
  max?: Record<string, string | null>;
203
203
  }
204
204
  import { z as z2 } from "zod";
205
- declare const SUBSCRIPTION_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
206
- declare const SUBSCRIPTION_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
207
- declare const SUBSCRIPTION_STATUSES: readonly ["active", "paused", "error"];
208
- declare const SUBSCRIPTION_FILTER_OPERATORS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "in"];
209
- declare const SubscriptionStatusSchema: z2.ZodType<SubscriptionStatus>;
210
- declare const SubscriptionFormatSchema: z2.ZodType<SubscriptionFormat>;
211
- declare const SubscriptionRuntimeSchema: z2.ZodType<SubscriptionRuntime>;
212
- declare const SubscriptionFilterPrimitiveSchema: z2.ZodType<SubscriptionFilterPrimitive>;
213
- declare const SubscriptionFilterOperatorSchema: z2.ZodType<SubscriptionFilterOperator>;
214
- declare const SubscriptionFilterClauseSchema: z2.ZodType<SubscriptionFilterClause>;
215
- declare const SubscriptionFilterSchema: z2.ZodType<SubscriptionFilter>;
205
+ declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
206
+ declare const WEBHOOK_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
207
+ declare const WEBHOOK_STATUSES: readonly ["active", "paused", "error"];
208
+ declare const WEBHOOK_FILTER_OPERATORS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "in"];
209
+ declare const WebhookStatusSchema: z2.ZodType<WebhookStatus>;
210
+ declare const WebhookFormatSchema: z2.ZodType<WebhookFormat>;
211
+ declare const WebhookRuntimeSchema: z2.ZodType<WebhookRuntime>;
212
+ declare const WebhookFilterPrimitiveSchema: z2.ZodType<WebhookFilterPrimitive>;
213
+ declare const WebhookFilterOperatorSchema: z2.ZodType<WebhookFilterOperator>;
214
+ declare const WebhookFilterClauseSchema: z2.ZodType<WebhookFilterClause>;
215
+ declare const WebhookFilterSchema: z2.ZodType<WebhookFilter>;
216
216
  declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event", "sbtc_deposit", "sbtc_withdrawal_create", "sbtc_withdrawal_accept", "sbtc_withdrawal_reject", "sbtc_withdrawal_swept_confirmed"];
217
217
  /**
218
218
  * Per-type accepted filter fields for chain triggers, DERIVED from
@@ -220,19 +220,19 @@ declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_bu
220
220
  * the validator. `{ stx_transfer: ["sender","recipient","minAmount","maxAmount"], ... }`.
221
221
  */
222
222
  declare const CHAIN_TRIGGER_FIELDS: Record<string, string[]>;
223
- declare const CreateSubscriptionRequestSchema: z2.ZodType<ParsedCreateSubscriptionRequest>;
224
- declare const UpdateSubscriptionRequestSchema: z2.ZodType<UpdateSubscriptionRequest>;
225
- declare const ReplaySubscriptionRequestSchema: z2.ZodType<ReplaySubscriptionRequest>;
226
- type SubscriptionStatus = (typeof SUBSCRIPTION_STATUSES)[number];
227
- /** Polymorphic subscription mode (mirrors db/types `SubscriptionKind`). */
228
- type SubscriptionKind = "subgraph" | "chain";
229
- type SubscriptionFormat = (typeof SUBSCRIPTION_FORMATS)[number];
230
- type SubscriptionRuntime = (typeof SUBSCRIPTION_RUNTIMES)[number];
231
- type SubscriptionFilterPrimitive = string | number | boolean;
232
- type SubscriptionFilterOperator = {
233
- eq: SubscriptionFilterPrimitive
223
+ declare const CreateWebhookRequestSchema: z2.ZodType<ParsedCreateWebhookRequest>;
224
+ declare const UpdateWebhookRequestSchema: z2.ZodType<UpdateWebhookRequest>;
225
+ declare const ReplayWebhookRequestSchema: z2.ZodType<ReplayWebhookRequest>;
226
+ type WebhookStatus = (typeof WEBHOOK_STATUSES)[number];
227
+ /** Polymorphic webhook mode (mirrors db/types `WebhookKind`). */
228
+ type WebhookKind = "subgraph" | "chain";
229
+ type WebhookFormat = (typeof WEBHOOK_FORMATS)[number];
230
+ type WebhookRuntime = (typeof WEBHOOK_RUNTIMES)[number];
231
+ type WebhookFilterPrimitive = string | number | boolean;
232
+ type WebhookFilterOperator = {
233
+ eq: WebhookFilterPrimitive
234
234
  } | {
235
- neq: SubscriptionFilterPrimitive
235
+ neq: WebhookFilterPrimitive
236
236
  } | {
237
237
  gt: string | number
238
238
  } | {
@@ -242,10 +242,10 @@ type SubscriptionFilterOperator = {
242
242
  } | {
243
243
  lte: string | number
244
244
  } | {
245
- in: SubscriptionFilterPrimitive[]
245
+ in: WebhookFilterPrimitive[]
246
246
  };
247
- type SubscriptionFilterClause = SubscriptionFilterPrimitive | SubscriptionFilterOperator;
248
- type SubscriptionFilter = Record<string, SubscriptionFilterClause>;
247
+ type WebhookFilterClause = WebhookFilterPrimitive | WebhookFilterOperator;
248
+ type WebhookFilter = Record<string, WebhookFilterClause>;
249
249
  /** Non-negative integer amount over JSON (string for uint128 safety, or number). */
250
250
  type ChainTriggerAmount = string | number;
251
251
  interface TraitScoped {
@@ -337,63 +337,63 @@ type ChainTrigger = {
337
337
  requestId?: number
338
338
  sweepTxid?: string
339
339
  };
340
- interface CreateSubscriptionRequest {
340
+ interface CreateWebhookRequest {
341
341
  name: string;
342
342
  /** Subgraph mode. */
343
343
  subgraphName?: string;
344
344
  tableName?: string;
345
- filter?: SubscriptionFilter;
345
+ filter?: WebhookFilter;
346
346
  /** Chain mode. */
347
347
  triggers?: ChainTrigger[];
348
348
  url: string;
349
- format?: SubscriptionFormat;
350
- runtime?: SubscriptionRuntime | null;
349
+ format?: WebhookFormat;
350
+ runtime?: WebhookRuntime | null;
351
351
  authConfig?: Record<string, unknown>;
352
352
  maxRetries?: number;
353
353
  timeoutMs?: number;
354
354
  concurrency?: number;
355
355
  }
356
- interface ParsedCreateSubscriptionRequest extends Omit<CreateSubscriptionRequest, "format"> {
357
- format: SubscriptionFormat;
356
+ interface ParsedCreateWebhookRequest extends Omit<CreateWebhookRequest, "format"> {
357
+ format: WebhookFormat;
358
358
  }
359
- interface UpdateSubscriptionRequest {
359
+ interface UpdateWebhookRequest {
360
360
  name?: string;
361
361
  url?: string;
362
- filter?: SubscriptionFilter;
363
- format?: SubscriptionFormat;
364
- runtime?: SubscriptionRuntime | null;
362
+ filter?: WebhookFilter;
363
+ format?: WebhookFormat;
364
+ runtime?: WebhookRuntime | null;
365
365
  authConfig?: Record<string, unknown>;
366
366
  maxRetries?: number;
367
367
  timeoutMs?: number;
368
368
  concurrency?: number;
369
369
  }
370
- type ParsedUpdateSubscriptionRequest = UpdateSubscriptionRequest;
371
- interface ReplaySubscriptionRequest {
370
+ type ParsedUpdateWebhookRequest = UpdateWebhookRequest;
371
+ interface ReplayWebhookRequest {
372
372
  fromBlock: number;
373
373
  toBlock: number;
374
374
  force?: string;
375
375
  }
376
- type ParsedReplaySubscriptionRequest = ReplaySubscriptionRequest;
377
- interface SubscriptionSummary {
376
+ type ParsedReplayWebhookRequest = ReplayWebhookRequest;
377
+ interface WebhookSummary {
378
378
  id: string;
379
379
  name: string;
380
- status: SubscriptionStatus;
381
- kind: SubscriptionKind;
382
- /** Null for chain subscriptions. */
380
+ status: WebhookStatus;
381
+ kind: WebhookKind;
382
+ /** Null for chain webhooks. */
383
383
  subgraphName: string | null;
384
- /** Null for chain subscriptions. */
384
+ /** Null for chain webhooks. */
385
385
  tableName: string | null;
386
- format: SubscriptionFormat;
387
- runtime: SubscriptionRuntime | null;
386
+ format: WebhookFormat;
387
+ runtime: WebhookRuntime | null;
388
388
  url: string;
389
389
  lastDeliveryAt: string | null;
390
390
  lastSuccessAt: string | null;
391
391
  createdAt: string;
392
392
  updatedAt: string;
393
393
  }
394
- interface SubscriptionDetail extends SubscriptionSummary {
394
+ interface WebhookDetail extends WebhookSummary {
395
395
  filter: Record<string, unknown>;
396
- /** Chain-trigger filters (chain subscriptions only). */
396
+ /** Chain-trigger filters (chain webhooks only). */
397
397
  triggers: ChainTrigger[] | null;
398
398
  authConfig: Record<string, unknown>;
399
399
  maxRetries: number;
@@ -403,13 +403,13 @@ interface SubscriptionDetail extends SubscriptionSummary {
403
403
  circuitOpenedAt: string | null;
404
404
  lastError: string | null;
405
405
  }
406
- interface CreateSubscriptionResponse {
407
- subscription: SubscriptionDetail;
406
+ interface CreateWebhookResponse {
407
+ webhook: WebhookDetail;
408
408
  /** Plaintext signing secret — surfaced ONCE. Store it server-side. */
409
409
  signingSecret: string;
410
410
  }
411
411
  interface RotateSecretResponse {
412
- subscription: SubscriptionDetail;
412
+ webhook: WebhookDetail;
413
413
  signingSecret: string;
414
414
  }
415
415
  interface DeliveryRow {
@@ -436,18 +436,18 @@ interface DeadRow {
436
436
  failedAt: string | null;
437
437
  createdAt: string;
438
438
  }
439
- interface SubscriptionSchemaColumn {
439
+ interface WebhookSchemaColumn {
440
440
  type?: unknown;
441
441
  }
442
- interface SubscriptionSchemaTable {
443
- columns: Record<string, SubscriptionSchemaColumn>;
442
+ interface WebhookSchemaTable {
443
+ columns: Record<string, WebhookSchemaColumn>;
444
444
  }
445
- type SubscriptionSchemaTables = Record<string, SubscriptionSchemaTable>;
446
- declare function formatSubscriptionSchemaErrors(error: z2.ZodError): string[];
447
- declare function validateSubscriptionFilterForTable(input: {
445
+ type WebhookSchemaTables = Record<string, WebhookSchemaTable>;
446
+ declare function formatWebhookSchemaErrors(error: z2.ZodError): string[];
447
+ declare function validateWebhookFilterForTable(input: {
448
448
  subgraphName?: string
449
449
  tableName: string
450
450
  filter?: unknown
451
- tables: SubscriptionSchemaTables
451
+ tables: WebhookSchemaTables
452
452
  }): string[];
453
- export { validateSubscriptionFilterForTable, formatSubscriptionSchemaErrors, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionFormatSchema, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubgraphSyncInfo, SubgraphSummary, SubgraphQueryParams, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DeadRow, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, CHAIN_TRIGGER_TYPES, CHAIN_TRIGGER_FIELDS };
453
+ export { validateWebhookFilterForTable, formatWebhookSchemaErrors, WebhookSummary, WebhookStatusSchema, WebhookSchemaTables, WebhookSchemaTable, WebhookSchemaColumn, WebhookRuntimeSchema, WebhookFormatSchema, WebhookFilterSchema, WebhookFilterPrimitiveSchema, WebhookFilterPrimitive, WebhookFilterOperatorSchema, WebhookFilterOperator, WebhookFilterClauseSchema, WebhookFilterClause, WebhookFilter, WebhookDetail, WEBHOOK_STATUSES, WEBHOOK_RUNTIMES, WEBHOOK_FORMATS, WEBHOOK_FILTER_OPERATORS, UpdateWebhookRequestSchema, UpdateWebhookRequest, SubgraphSyncInfo, SubgraphSummary, SubgraphQueryParams, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, RotateSecretResponse, ReplayWebhookRequestSchema, ReplayWebhookRequest, ReplayResult, ReindexResponse, ParsedUpdateWebhookRequest, ParsedReplayWebhookRequest, ParsedCreateWebhookRequest, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DeadRow, CreateWebhookResponse, CreateWebhookRequestSchema, CreateWebhookRequest, CHAIN_TRIGGER_TYPES, CHAIN_TRIGGER_FIELDS };
@@ -28,9 +28,9 @@ var DeploySubgraphRequestSchema = z.object({
28
28
  dryRun: z.boolean().optional()
29
29
  });
30
30
 
31
- // src/schemas/subscriptions.ts
31
+ // src/schemas/webhooks.ts
32
32
  import { z as z2 } from "zod";
33
- var SUBSCRIPTION_FORMATS = [
33
+ var WEBHOOK_FORMATS = [
34
34
  "standard-webhooks",
35
35
  "inngest",
36
36
  "trigger",
@@ -38,14 +38,14 @@ var SUBSCRIPTION_FORMATS = [
38
38
  "cloudevents",
39
39
  "raw"
40
40
  ];
41
- var SUBSCRIPTION_RUNTIMES = [
41
+ var WEBHOOK_RUNTIMES = [
42
42
  "inngest",
43
43
  "trigger",
44
44
  "cloudflare",
45
45
  "node"
46
46
  ];
47
- var SUBSCRIPTION_STATUSES = ["active", "paused", "error"];
48
- var SUBSCRIPTION_FILTER_OPERATORS = [
47
+ var WEBHOOK_STATUSES = ["active", "paused", "error"];
48
+ var WEBHOOK_FILTER_OPERATORS = [
49
49
  "eq",
50
50
  "neq",
51
51
  "gt",
@@ -57,26 +57,23 @@ var SUBSCRIPTION_FILTER_OPERATORS = [
57
57
  var webhookUrl = z2.string().trim().min(1).refine((value) => value.startsWith("http://") || value.startsWith("https://"), "must be an http(s) URL");
58
58
  var name = z2.string().trim().min(1).max(128);
59
59
  var resourceName = z2.string().trim().min(1).max(128);
60
- var SubscriptionStatusSchema = z2.enum(SUBSCRIPTION_STATUSES);
61
- var SubscriptionFormatSchema = z2.enum(SUBSCRIPTION_FORMATS);
62
- var SubscriptionRuntimeSchema = z2.enum(SUBSCRIPTION_RUNTIMES);
63
- var SubscriptionFilterPrimitiveSchema = z2.union([z2.string(), z2.number().finite(), z2.boolean()]);
64
- var SubscriptionFilterOperatorSchema = z2.union([
65
- z2.object({ eq: SubscriptionFilterPrimitiveSchema }).strict(),
66
- z2.object({ neq: SubscriptionFilterPrimitiveSchema }).strict(),
60
+ var WebhookStatusSchema = z2.enum(WEBHOOK_STATUSES);
61
+ var WebhookFormatSchema = z2.enum(WEBHOOK_FORMATS);
62
+ var WebhookRuntimeSchema = z2.enum(WEBHOOK_RUNTIMES);
63
+ var WebhookFilterPrimitiveSchema = z2.union([z2.string(), z2.number().finite(), z2.boolean()]);
64
+ var WebhookFilterOperatorSchema = z2.union([
65
+ z2.object({ eq: WebhookFilterPrimitiveSchema }).strict(),
66
+ z2.object({ neq: WebhookFilterPrimitiveSchema }).strict(),
67
67
  z2.object({ gt: z2.union([z2.string(), z2.number().finite()]) }).strict(),
68
68
  z2.object({ gte: z2.union([z2.string(), z2.number().finite()]) }).strict(),
69
69
  z2.object({ lt: z2.union([z2.string(), z2.number().finite()]) }).strict(),
70
70
  z2.object({ lte: z2.union([z2.string(), z2.number().finite()]) }).strict(),
71
71
  z2.object({
72
- in: z2.array(SubscriptionFilterPrimitiveSchema).min(1)
72
+ in: z2.array(WebhookFilterPrimitiveSchema).min(1)
73
73
  }).strict()
74
74
  ]);
75
- var SubscriptionFilterClauseSchema = z2.union([
76
- SubscriptionFilterPrimitiveSchema,
77
- SubscriptionFilterOperatorSchema
78
- ]);
79
- var SubscriptionFilterSchema = z2.record(z2.string().min(1), SubscriptionFilterClauseSchema);
75
+ var WebhookFilterClauseSchema = z2.union([WebhookFilterPrimitiveSchema, WebhookFilterOperatorSchema]);
76
+ var WebhookFilterSchema = z2.record(z2.string().min(1), WebhookFilterClauseSchema);
80
77
  var CHAIN_TRIGGER_TYPES = [
81
78
  "stx_transfer",
82
79
  "stx_mint",
@@ -221,15 +218,15 @@ var CHAIN_TRIGGER_FIELDS = Object.fromEntries(ChainTriggerSchema._zod.def.option
221
218
  const type = shape.type._zod.def.values[0];
222
219
  return [type, Object.keys(shape).filter((k) => k !== "type")];
223
220
  }));
224
- var CreateSubscriptionRequestSchema = z2.object({
221
+ var CreateWebhookRequestSchema = z2.object({
225
222
  name,
226
223
  subgraphName: resourceName.optional(),
227
224
  tableName: resourceName.optional(),
228
- filter: SubscriptionFilterSchema.optional(),
225
+ filter: WebhookFilterSchema.optional(),
229
226
  triggers: ChainTriggersSchema.optional(),
230
227
  url: webhookUrl,
231
- format: SubscriptionFormatSchema.default("standard-webhooks"),
232
- runtime: SubscriptionRuntimeSchema.nullable().optional(),
228
+ format: WebhookFormatSchema.default("standard-webhooks"),
229
+ runtime: WebhookRuntimeSchema.nullable().optional(),
233
230
  authConfig: z2.record(z2.string(), z2.unknown()).optional(),
234
231
  maxRetries: z2.number().int().min(0).max(100).optional(),
235
232
  timeoutMs: z2.number().int().min(100).max(300000).optional(),
@@ -243,17 +240,17 @@ var CreateSubscriptionRequestSchema = z2.object({
243
240
  return true;
244
241
  return v.subgraphName !== undefined && v.tableName !== undefined;
245
242
  }, {
246
- message: "provide either { subgraphName, tableName } for a subgraph subscription OR { triggers } for a chain subscription — not both"
243
+ message: "provide either { subgraphName, tableName } for a subgraph webhook OR { triggers } for a chain webhook — not both"
247
244
  }).refine((v) => v.filter === undefined || v.triggers === undefined, {
248
- message: "`filter` applies to subgraph subscriptions; chain subscriptions use `triggers`",
245
+ message: "`filter` applies to subgraph webhooks; chain webhooks use `triggers`",
249
246
  path: ["filter"]
250
247
  });
251
- var UpdateSubscriptionRequestSchema = z2.object({
248
+ var UpdateWebhookRequestSchema = z2.object({
252
249
  name: name.optional(),
253
250
  url: webhookUrl.optional(),
254
- filter: SubscriptionFilterSchema.optional(),
255
- format: SubscriptionFormatSchema.optional(),
256
- runtime: SubscriptionRuntimeSchema.nullable().optional(),
251
+ filter: WebhookFilterSchema.optional(),
252
+ format: WebhookFormatSchema.optional(),
253
+ runtime: WebhookRuntimeSchema.nullable().optional(),
257
254
  authConfig: z2.record(z2.string(), z2.unknown()).optional(),
258
255
  maxRetries: z2.number().int().min(0).max(100).optional(),
259
256
  timeoutMs: z2.number().int().min(100).max(300000).optional(),
@@ -261,7 +258,7 @@ var UpdateSubscriptionRequestSchema = z2.object({
261
258
  }).refine((value) => Object.keys(value).length > 0, {
262
259
  message: "At least one field must be provided"
263
260
  });
264
- var ReplaySubscriptionRequestSchema = z2.object({
261
+ var ReplayWebhookRequestSchema = z2.object({
265
262
  fromBlock: z2.number().int().nonnegative(),
266
263
  toBlock: z2.number().int().nonnegative(),
267
264
  force: z2.string().trim().min(1).max(64).optional()
@@ -355,7 +352,7 @@ var COMPARISON_COLUMN_TYPES = new Set(["uint", "int", "timestamp"]);
355
352
  function formatIssuePath(path) {
356
353
  return path.length > 0 ? `${path.map(String).join(".")}: ` : "";
357
354
  }
358
- function formatSubscriptionSchemaErrors(error) {
355
+ function formatWebhookSchemaErrors(error) {
359
356
  return error.issues.map((issue) => `${formatIssuePath(issue.path)}${issue.message}`);
360
357
  }
361
358
  function operatorForClause(clause) {
@@ -364,7 +361,7 @@ function operatorForClause(clause) {
364
361
  }
365
362
  return Object.keys(clause)[0] ?? "eq";
366
363
  }
367
- function validateSubscriptionFilterForTable(input) {
364
+ function validateWebhookFilterForTable(input) {
368
365
  const errors = [];
369
366
  const table = input.tables[input.tableName];
370
367
  if (!table) {
@@ -374,9 +371,9 @@ function validateSubscriptionFilterForTable(input) {
374
371
  }
375
372
  if (input.filter === undefined)
376
373
  return errors;
377
- const parsed = SubscriptionFilterSchema.safeParse(input.filter);
374
+ const parsed = WebhookFilterSchema.safeParse(input.filter);
378
375
  if (!parsed.success) {
379
- return formatSubscriptionSchemaErrors(parsed.error);
376
+ return formatWebhookSchemaErrors(parsed.error);
380
377
  }
381
378
  for (const [field, clause] of Object.entries(parsed.data)) {
382
379
  const column = table.columns[field];
@@ -386,7 +383,7 @@ function validateSubscriptionFilterForTable(input) {
386
383
  }
387
384
  const columnType = typeof column.type === "string" ? column.type.toLowerCase() : "";
388
385
  if (!SCALAR_COLUMN_TYPES.has(columnType)) {
389
- errors.push(`Filter field "${field}" has unsupported type "${columnType || "unknown"}"; subscription filters require scalar columns.`);
386
+ errors.push(`Filter field "${field}" has unsupported type "${columnType || "unknown"}"; webhook filters require scalar columns.`);
390
387
  continue;
391
388
  }
392
389
  const operator = operatorForClause(clause);
@@ -397,26 +394,26 @@ function validateSubscriptionFilterForTable(input) {
397
394
  return errors;
398
395
  }
399
396
  export {
400
- validateSubscriptionFilterForTable,
401
- formatSubscriptionSchemaErrors,
402
- UpdateSubscriptionRequestSchema,
403
- SubscriptionStatusSchema,
404
- SubscriptionRuntimeSchema,
405
- SubscriptionFormatSchema,
406
- SubscriptionFilterSchema,
407
- SubscriptionFilterPrimitiveSchema,
408
- SubscriptionFilterOperatorSchema,
409
- SubscriptionFilterClauseSchema,
410
- SUBSCRIPTION_STATUSES,
411
- SUBSCRIPTION_RUNTIMES,
412
- SUBSCRIPTION_FORMATS,
413
- SUBSCRIPTION_FILTER_OPERATORS,
414
- ReplaySubscriptionRequestSchema,
397
+ validateWebhookFilterForTable,
398
+ formatWebhookSchemaErrors,
399
+ WebhookStatusSchema,
400
+ WebhookRuntimeSchema,
401
+ WebhookFormatSchema,
402
+ WebhookFilterSchema,
403
+ WebhookFilterPrimitiveSchema,
404
+ WebhookFilterOperatorSchema,
405
+ WebhookFilterClauseSchema,
406
+ WEBHOOK_STATUSES,
407
+ WEBHOOK_RUNTIMES,
408
+ WEBHOOK_FORMATS,
409
+ WEBHOOK_FILTER_OPERATORS,
410
+ UpdateWebhookRequestSchema,
411
+ ReplayWebhookRequestSchema,
415
412
  DeploySubgraphRequestSchema,
416
- CreateSubscriptionRequestSchema,
413
+ CreateWebhookRequestSchema,
417
414
  CHAIN_TRIGGER_TYPES,
418
415
  CHAIN_TRIGGER_FIELDS
419
416
  };
420
417
 
421
- //# debugId=7B1B5B4BE50333EE64756E2164756E21
418
+ //# debugId=6EDFF4FE6F27581C64756E2164756E21
422
419
  //# sourceMappingURL=index.js.map