@secondlayer/shared 0.2.3 → 0.3.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 (43) hide show
  1. package/dist/src/db/index.d.ts +3 -1
  2. package/dist/src/db/index.js.map +2 -2
  3. package/dist/src/db/jsonb.d.ts +2 -1
  4. package/dist/src/db/jsonb.js.map +2 -2
  5. package/dist/src/db/queries/accounts.d.ts +2 -1
  6. package/dist/src/db/queries/accounts.js.map +2 -2
  7. package/dist/src/db/queries/integrity.d.ts +1 -0
  8. package/dist/src/db/queries/metrics.d.ts +6 -4
  9. package/dist/src/db/queries/metrics.js.map +2 -2
  10. package/dist/src/db/queries/usage.d.ts +1 -0
  11. package/dist/src/db/queries/views.d.ts +10 -8
  12. package/dist/src/db/queries/views.js.map +3 -3
  13. package/dist/src/db/schema.d.ts +1 -0
  14. package/dist/src/env.d.ts +9 -2
  15. package/dist/src/env.js.map +2 -2
  16. package/dist/src/errors.d.ts +15 -2
  17. package/dist/src/errors.js +7 -2
  18. package/dist/src/errors.js.map +3 -3
  19. package/dist/src/index.d.ts +217 -54
  20. package/dist/src/index.js +12 -6
  21. package/dist/src/index.js.map +10 -10
  22. package/dist/src/logger.d.ts +4 -4
  23. package/dist/src/logger.js.map +3 -3
  24. package/dist/src/node/hiro-client.js +2 -2
  25. package/dist/src/node/hiro-client.js.map +5 -5
  26. package/dist/src/node/local-client.d.ts +212 -0
  27. package/dist/src/node/local-client.js +70 -0
  28. package/dist/src/node/local-client.js.map +10 -0
  29. package/dist/src/queue/index.d.ts +1 -1
  30. package/dist/src/queue/index.js.map +3 -3
  31. package/dist/src/queue/recovery.js.map +2 -2
  32. package/dist/src/schemas/filters.d.ts +92 -28
  33. package/dist/src/schemas/filters.js.map +2 -2
  34. package/dist/src/schemas/index.d.ts +186 -43
  35. package/dist/src/schemas/index.js +6 -5
  36. package/dist/src/schemas/index.js.map +5 -5
  37. package/dist/src/schemas/views.d.ts +14 -3
  38. package/dist/src/schemas/views.js.map +2 -2
  39. package/dist/src/types.d.ts +9 -3
  40. package/dist/src/types.js +12 -1
  41. package/dist/src/types.js.map +1 -1
  42. package/migrations/0006_tx_index.ts +9 -0
  43. package/package.json +6 -3
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/db/jsonb.ts", "../src/db/index.ts", "../src/queue/recovery.ts"],
4
4
  "sourcesContent": [
5
- "import { sql } from \"kysely\";\n\n/**\n * Safely encode a JS value as a JSONB literal for Kysely inserts/updates.\n * Kysely + postgres.js double-encodes JSON when using parameterized queries\n * with ::jsonb casts. This uses sql.raw to inline a properly escaped literal.\n */\nexport function jsonb(value: unknown) {\n const escaped = JSON.stringify(value).replace(/'/g, \"''\");\n return sql`${sql.raw(`'${escaped}'::jsonb`)}`;\n}\n\n/**\n * Safely parse a JSONB value from the database.\n * Handles double-encoded strings where postgres.js returns a JSON string\n * instead of a parsed object.\n */\nexport function parseJsonb<T = unknown>(value: unknown): T {\n if (typeof value === \"string\") {\n try {\n return JSON.parse(value) as T;\n } catch {\n return value as T;\n }\n }\n return (value ?? {}) as T;\n}\n",
5
+ "import { sql, type RawBuilder } from \"kysely\";\n\n/**\n * Safely encode a JS value as a JSONB literal for Kysely inserts/updates.\n * Kysely + postgres.js double-encodes JSON when using parameterized queries\n * with ::jsonb casts. This uses sql.raw to inline a properly escaped literal.\n */\nexport function jsonb(value: unknown): RawBuilder<unknown> {\n const escaped = JSON.stringify(value).replace(/'/g, \"''\");\n return sql`${sql.raw(`'${escaped}'::jsonb`)}`;\n}\n\n/**\n * Safely parse a JSONB value from the database.\n * Handles double-encoded strings where postgres.js returns a JSON string\n * instead of a parsed object.\n */\nexport function parseJsonb<T = unknown>(value: unknown): T {\n if (typeof value === \"string\") {\n try {\n return JSON.parse(value) as T;\n } catch {\n return value as T;\n }\n }\n return (value ?? {}) as T;\n}\n",
6
6
  "import { Kysely } from \"kysely\";\nimport { PostgresJSDialect } from \"kysely-postgres-js\";\nimport postgres from \"postgres\";\nimport type { Database } from \"./types.ts\";\n\nlet db: Kysely<Database> | null = null;\nlet rawClient: ReturnType<typeof postgres> | null = null;\n\nexport function getDb(connectionString?: string): Kysely<Database> {\n if (!db) {\n const url = connectionString || process.env.DATABASE_URL || \"postgres://postgres:postgres@localhost:5432/streams_dev\";\n\n // Always use SSL for remote databases, just disable cert verification if needed\n const isLocal = url.includes(\"localhost\") || url.includes(\"127.0.0.1\") || url.includes(\"@postgres:\");\n rawClient = postgres(url, {\n ssl: isLocal ? undefined : { rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== \"0\" },\n });\n db = new Kysely<Database>({\n dialect: new PostgresJSDialect({ postgres: rawClient }),\n });\n }\n return db;\n}\n\n/** Raw postgres.js client for dynamic schema DDL (CREATE SCHEMA, DROP, etc.) */\nexport function getRawClient(): ReturnType<typeof postgres> {\n if (!rawClient) getDb();\n return rawClient!;\n}\n\n/** Close the DB connection pool. Call in CLI commands to allow process exit. */\nexport async function closeDb(): Promise<void> {\n if (db) {\n await db.destroy();\n db = null;\n }\n if (rawClient) {\n await rawClient.end();\n rawClient = null;\n }\n}\n\nimport { sql } from \"kysely\";\nexport { sql };\nexport * from \"./types.ts\";\nexport { jsonb, parseJsonb } from \"./jsonb.ts\";\n",
7
7
  "import { sql } from \"kysely\";\nimport { getDb } from \"../db/index.ts\";\n\n/**\n * Recover jobs that have been locked for longer than the threshold\n * These are likely from crashed workers\n *\n * @param staleThresholdMinutes - Minutes after which a locked job is considered stale\n * @returns Number of recovered jobs\n */\nexport async function recoverStaleJobs(\n staleThresholdMinutes = 5\n): Promise<number> {\n const { rows } = await sql`\n UPDATE jobs\n SET\n status = 'pending',\n locked_at = NULL,\n locked_by = NULL\n WHERE\n status = 'processing'\n AND locked_at < NOW() - INTERVAL '${sql.raw(staleThresholdMinutes.toString())} minutes'\n RETURNING id\n `.execute(getDb());\n\n return rows.length;\n}\n\n/**\n * Run periodic stale job recovery\n * Returns a cleanup function to stop the interval\n */\nexport function startRecoveryLoop(\n intervalMs = 60000, // 1 minute\n staleThresholdMinutes = 5\n): () => void {\n const intervalId = setInterval(async () => {\n try {\n const recovered = await recoverStaleJobs(staleThresholdMinutes);\n if (recovered > 0) {\n console.log(`Recovered ${recovered} stale jobs`);\n }\n } catch (error) {\n console.error(\"Error recovering stale jobs:\", error);\n }\n }, intervalMs);\n\n return () => clearInterval(intervalId);\n}\n"
8
8
  ],
9
- "mappings": ";;;;;;;;;;;;;AAAA;AAOO,SAAS,KAAK,CAAC,OAAgB;AAAA,EACpC,MAAM,UAAU,KAAK,UAAU,KAAK,EAAE,QAAQ,MAAM,IAAI;AAAA,EACxD,OAAO,MAAM,IAAI,IAAI,IAAI,iBAAiB;AAAA;AAQrC,SAAS,UAAuB,CAAC,OAAmB;AAAA,EACzD,IAAI,OAAO,UAAU,UAAU;AAAA,IAC7B,IAAI;AAAA,MACF,OAAO,KAAK,MAAM,KAAK;AAAA,MACvB,MAAM;AAAA,MACN,OAAO;AAAA;AAAA,EAEX;AAAA,EACA,OAAQ,SAAS,CAAC;AAAA;;;ACzBpB;AACA;AACA;AAwCA,gBAAS;AArCT,IAAI,KAA8B;AAClC,IAAI,YAAgD;AAE7C,SAAS,KAAK,CAAC,kBAA6C;AAAA,EACjE,IAAI,CAAC,IAAI;AAAA,IACP,MAAM,MAAM,oBAAoB,QAAQ,IAAI,gBAAgB;AAAA,IAG5D,MAAM,UAAU,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,YAAY;AAAA,IACnG,YAAY,SAAS,KAAK;AAAA,MACxB,KAAK,UAAU,YAAY,EAAE,oBAAoB,QAAQ,IAAI,iCAAiC,IAAI;AAAA,IACpG,CAAC;AAAA,IACD,KAAK,IAAI,OAAiB;AAAA,MACxB,SAAS,IAAI,kBAAkB,EAAE,UAAU,UAAU,CAAC;AAAA,IACxD,CAAC;AAAA,EACH;AAAA,EACA,OAAO;AAAA;AAIF,SAAS,YAAY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C,IAAI;AAAA,MACF,MAAM,YAAY,MAAM,iBAAiB,qBAAqB;AAAA,MAC9D,IAAI,YAAY,GAAG;AAAA,QACjB,QAAQ,IAAI,aAAa,sBAAsB;AAAA,MACjD;AAAA,MACA,OAAO,OAAO;AAAA,MACd,QAAQ,MAAM,gCAAgC,KAAK;AAAA;AAAA,KAEpD,UAAU;AAAA,EAEb,OAAO,MAAM,cAAc,UAAU;AAAA;",
10
10
  "debugId": "87547F4988908A4464756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,30 +1,94 @@
1
1
  import { z } from "zod";
2
- declare const StxTransferFilterSchema: unknown;
3
- declare const StxMintFilterSchema: unknown;
4
- declare const StxBurnFilterSchema: unknown;
5
- declare const StxLockFilterSchema: unknown;
6
- declare const FtTransferFilterSchema: unknown;
7
- declare const FtMintFilterSchema: unknown;
8
- declare const FtBurnFilterSchema: unknown;
9
- declare const NftTransferFilterSchema: unknown;
10
- declare const NftMintFilterSchema: unknown;
11
- declare const NftBurnFilterSchema: unknown;
12
- declare const ContractCallFilterSchema: unknown;
13
- declare const ContractDeployFilterSchema: unknown;
14
- declare const PrintEventFilterSchema: unknown;
15
- declare const StreamFilterSchema: unknown;
16
- type StxTransferFilter = z.infer<typeof StxTransferFilterSchema>;
17
- type StxMintFilter = z.infer<typeof StxMintFilterSchema>;
18
- type StxBurnFilter = z.infer<typeof StxBurnFilterSchema>;
19
- type StxLockFilter = z.infer<typeof StxLockFilterSchema>;
20
- type FtTransferFilter = z.infer<typeof FtTransferFilterSchema>;
21
- type FtMintFilter = z.infer<typeof FtMintFilterSchema>;
22
- type FtBurnFilter = z.infer<typeof FtBurnFilterSchema>;
23
- type NftTransferFilter = z.infer<typeof NftTransferFilterSchema>;
24
- type NftMintFilter = z.infer<typeof NftMintFilterSchema>;
25
- type NftBurnFilter = z.infer<typeof NftBurnFilterSchema>;
26
- type ContractCallFilter = z.infer<typeof ContractCallFilterSchema>;
27
- type ContractDeployFilter = z.infer<typeof ContractDeployFilterSchema>;
28
- type PrintEventFilter = z.infer<typeof PrintEventFilterSchema>;
29
- type StreamFilter = z.infer<typeof StreamFilterSchema>;
2
+ interface StxTransferFilter {
3
+ type: "stx_transfer";
4
+ sender?: string;
5
+ recipient?: string;
6
+ minAmount?: number;
7
+ maxAmount?: number;
8
+ }
9
+ interface StxMintFilter {
10
+ type: "stx_mint";
11
+ recipient?: string;
12
+ minAmount?: number;
13
+ }
14
+ interface StxBurnFilter {
15
+ type: "stx_burn";
16
+ sender?: string;
17
+ minAmount?: number;
18
+ }
19
+ interface StxLockFilter {
20
+ type: "stx_lock";
21
+ lockedAddress?: string;
22
+ minAmount?: number;
23
+ }
24
+ interface FtTransferFilter {
25
+ type: "ft_transfer";
26
+ sender?: string;
27
+ recipient?: string;
28
+ assetIdentifier?: string;
29
+ minAmount?: number;
30
+ }
31
+ interface FtMintFilter {
32
+ type: "ft_mint";
33
+ recipient?: string;
34
+ assetIdentifier?: string;
35
+ minAmount?: number;
36
+ }
37
+ interface FtBurnFilter {
38
+ type: "ft_burn";
39
+ sender?: string;
40
+ assetIdentifier?: string;
41
+ minAmount?: number;
42
+ }
43
+ interface NftTransferFilter {
44
+ type: "nft_transfer";
45
+ sender?: string;
46
+ recipient?: string;
47
+ assetIdentifier?: string;
48
+ tokenId?: string;
49
+ }
50
+ interface NftMintFilter {
51
+ type: "nft_mint";
52
+ recipient?: string;
53
+ assetIdentifier?: string;
54
+ tokenId?: string;
55
+ }
56
+ interface NftBurnFilter {
57
+ type: "nft_burn";
58
+ sender?: string;
59
+ assetIdentifier?: string;
60
+ tokenId?: string;
61
+ }
62
+ interface ContractCallFilter {
63
+ type: "contract_call";
64
+ contractId?: string;
65
+ functionName?: string;
66
+ caller?: string;
67
+ }
68
+ interface ContractDeployFilter {
69
+ type: "contract_deploy";
70
+ deployer?: string;
71
+ contractName?: string;
72
+ }
73
+ interface PrintEventFilter {
74
+ type: "print_event";
75
+ contractId?: string;
76
+ topic?: string;
77
+ contains?: string;
78
+ }
79
+ type StreamFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
80
+ declare const StxTransferFilterSchema: z.ZodType<StxTransferFilter>;
81
+ declare const StxMintFilterSchema: z.ZodType<StxMintFilter>;
82
+ declare const StxBurnFilterSchema: z.ZodType<StxBurnFilter>;
83
+ declare const StxLockFilterSchema: z.ZodType<StxLockFilter>;
84
+ declare const FtTransferFilterSchema: z.ZodType<FtTransferFilter>;
85
+ declare const FtMintFilterSchema: z.ZodType<FtMintFilter>;
86
+ declare const FtBurnFilterSchema: z.ZodType<FtBurnFilter>;
87
+ declare const NftTransferFilterSchema: z.ZodType<NftTransferFilter>;
88
+ declare const NftMintFilterSchema: z.ZodType<NftMintFilter>;
89
+ declare const NftBurnFilterSchema: z.ZodType<NftBurnFilter>;
90
+ declare const ContractCallFilterSchema: z.ZodType<ContractCallFilter>;
91
+ declare const ContractDeployFilterSchema: z.ZodType<ContractDeployFilter>;
92
+ declare const PrintEventFilterSchema: z.ZodType<PrintEventFilter>;
93
+ declare const StreamFilterSchema: z.ZodType<StreamFilter>;
30
94
  export { StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, StreamFilterSchema, StreamFilter, PrintEventFilterSchema, PrintEventFilter, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter };
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/schemas/filters.ts"],
4
4
  "sourcesContent": [
5
- "import { z } from \"zod\";\nimport { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\n\nconst isValidAddress = _isValidAddress as (addr: string) => boolean;\n\n/** Validate a Stacks principal (standard or contract, e.g. SP2J...ABC or SP2J...ABC.contract-name) */\nconst stacksPrincipal = z.string().refine((val) => {\n const parts = val.split(\".\");\n if (parts.length > 2) return false;\n return isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n // Optional: filter by sender\n sender: stacksPrincipal.optional(),\n // Optional: filter by recipient\n recipient: stacksPrincipal.optional(),\n};\n\n// STX Transfer Filter\nexport const StxTransferFilterSchema = z.object({\n type: z.literal(\"stx_transfer\"),\n ...baseFilter,\n // Optional: minimum amount in microSTX\n minAmount: z.coerce.number().int().positive().optional(),\n // Optional: maximum amount in microSTX\n maxAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Mint Filter\nexport const StxMintFilterSchema = z.object({\n type: z.literal(\"stx_mint\"),\n recipient: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Burn Filter\nexport const StxBurnFilterSchema = z.object({\n type: z.literal(\"stx_burn\"),\n sender: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Lock Filter\nexport const StxLockFilterSchema = z.object({\n type: z.literal(\"stx_lock\"),\n lockedAddress: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Transfer Filter\nexport const FtTransferFilterSchema = z.object({\n type: z.literal(\"ft_transfer\"),\n ...baseFilter,\n // Contract that defines the token (e.g., SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx)\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Mint Filter\nexport const FtMintFilterSchema = z.object({\n type: z.literal(\"ft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Burn Filter\nexport const FtBurnFilterSchema = z.object({\n type: z.literal(\"ft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// NFT Transfer Filter\nexport const NftTransferFilterSchema = z.object({\n type: z.literal(\"nft_transfer\"),\n ...baseFilter,\n assetIdentifier: z.string().optional(),\n // Optional: filter by specific token ID (Clarity value as hex)\n tokenId: z.string().optional(),\n});\n\n// NFT Mint Filter\nexport const NftMintFilterSchema = z.object({\n type: z.literal(\"nft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// NFT Burn Filter\nexport const NftBurnFilterSchema = z.object({\n type: z.literal(\"nft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// Contract Call Filter\nexport const ContractCallFilterSchema = z.object({\n type: z.literal(\"contract_call\"),\n // Contract being called\n contractId: stacksPrincipal.optional(),\n // Function name (supports wildcards with *)\n functionName: z.string().optional(),\n // Caller address\n caller: stacksPrincipal.optional(),\n});\n\n// Contract Deploy Filter\nexport const ContractDeployFilterSchema = z.object({\n type: z.literal(\"contract_deploy\"),\n // Deployer address\n deployer: stacksPrincipal.optional(),\n // Contract name pattern (supports wildcards)\n contractName: z.string().optional(),\n});\n\n// Print Event Filter (smart contract events)\nexport const PrintEventFilterSchema = z.object({\n type: z.literal(\"print_event\"),\n // Contract emitting the event\n contractId: stacksPrincipal.optional(),\n // Topic/name of the event\n topic: z.string().optional(),\n // Search for substring in event data\n contains: z.string().optional(),\n});\n\n// Union of all filter types\nexport const StreamFilterSchema = z.discriminatedUnion(\"type\", [\n StxTransferFilterSchema,\n StxMintFilterSchema,\n StxBurnFilterSchema,\n StxLockFilterSchema,\n FtTransferFilterSchema,\n FtMintFilterSchema,\n FtBurnFilterSchema,\n NftTransferFilterSchema,\n NftMintFilterSchema,\n NftBurnFilterSchema,\n ContractCallFilterSchema,\n ContractDeployFilterSchema,\n PrintEventFilterSchema,\n]);\n\n// Type exports\nexport type StxTransferFilter = z.infer<typeof StxTransferFilterSchema>;\nexport type StxMintFilter = z.infer<typeof StxMintFilterSchema>;\nexport type StxBurnFilter = z.infer<typeof StxBurnFilterSchema>;\nexport type StxLockFilter = z.infer<typeof StxLockFilterSchema>;\nexport type FtTransferFilter = z.infer<typeof FtTransferFilterSchema>;\nexport type FtMintFilter = z.infer<typeof FtMintFilterSchema>;\nexport type FtBurnFilter = z.infer<typeof FtBurnFilterSchema>;\nexport type NftTransferFilter = z.infer<typeof NftTransferFilterSchema>;\nexport type NftMintFilter = z.infer<typeof NftMintFilterSchema>;\nexport type NftBurnFilter = z.infer<typeof NftBurnFilterSchema>;\nexport type ContractCallFilter = z.infer<typeof ContractCallFilterSchema>;\nexport type ContractDeployFilter = z.infer<typeof ContractDeployFilterSchema>;\nexport type PrintEventFilter = z.infer<typeof PrintEventFilterSchema>;\nexport type StreamFilter = z.infer<typeof StreamFilterSchema>;\n"
5
+ "import { z } from \"zod\";\nimport { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\n\nconst isValidAddress = _isValidAddress as (addr: string) => boolean;\n\n/** Validate a Stacks principal (standard or contract, e.g. SP2J...ABC or SP2J...ABC.contract-name) */\nconst stacksPrincipal = z.string().refine((val) => {\n const parts = val.split(\".\");\n if (parts.length > 2) return false;\n return isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n // Optional: filter by sender\n sender: stacksPrincipal.optional(),\n // Optional: filter by recipient\n recipient: stacksPrincipal.optional(),\n};\n\n// Type exports — defined first so they can annotate schemas\nexport interface StxTransferFilter {\n type: \"stx_transfer\";\n sender?: string;\n recipient?: string;\n minAmount?: number;\n maxAmount?: number;\n}\n\nexport interface StxMintFilter {\n type: \"stx_mint\";\n recipient?: string;\n minAmount?: number;\n}\n\nexport interface StxBurnFilter {\n type: \"stx_burn\";\n sender?: string;\n minAmount?: number;\n}\n\nexport interface StxLockFilter {\n type: \"stx_lock\";\n lockedAddress?: string;\n minAmount?: number;\n}\n\nexport interface FtTransferFilter {\n type: \"ft_transfer\";\n sender?: string;\n recipient?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface FtMintFilter {\n type: \"ft_mint\";\n recipient?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface FtBurnFilter {\n type: \"ft_burn\";\n sender?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface NftTransferFilter {\n type: \"nft_transfer\";\n sender?: string;\n recipient?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface NftMintFilter {\n type: \"nft_mint\";\n recipient?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface NftBurnFilter {\n type: \"nft_burn\";\n sender?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface ContractCallFilter {\n type: \"contract_call\";\n contractId?: string;\n functionName?: string;\n caller?: string;\n}\n\nexport interface ContractDeployFilter {\n type: \"contract_deploy\";\n deployer?: string;\n contractName?: string;\n}\n\nexport interface PrintEventFilter {\n type: \"print_event\";\n contractId?: string;\n topic?: string;\n contains?: string;\n}\n\nexport type StreamFilter =\n | StxTransferFilter\n | StxMintFilter\n | StxBurnFilter\n | StxLockFilter\n | FtTransferFilter\n | FtMintFilter\n | FtBurnFilter\n | NftTransferFilter\n | NftMintFilter\n | NftBurnFilter\n | ContractCallFilter\n | ContractDeployFilter\n | PrintEventFilter;\n\n// STX Transfer Filter\nexport const StxTransferFilterSchema: z.ZodType<StxTransferFilter> = z.object({\n type: z.literal(\"stx_transfer\"),\n ...baseFilter,\n // Optional: minimum amount in microSTX\n minAmount: z.coerce.number().int().positive().optional(),\n // Optional: maximum amount in microSTX\n maxAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Mint Filter\nexport const StxMintFilterSchema: z.ZodType<StxMintFilter> = z.object({\n type: z.literal(\"stx_mint\"),\n recipient: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Burn Filter\nexport const StxBurnFilterSchema: z.ZodType<StxBurnFilter> = z.object({\n type: z.literal(\"stx_burn\"),\n sender: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Lock Filter\nexport const StxLockFilterSchema: z.ZodType<StxLockFilter> = z.object({\n type: z.literal(\"stx_lock\"),\n lockedAddress: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Transfer Filter\nexport const FtTransferFilterSchema: z.ZodType<FtTransferFilter> = z.object({\n type: z.literal(\"ft_transfer\"),\n ...baseFilter,\n // Contract that defines the token (e.g., SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx)\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Mint Filter\nexport const FtMintFilterSchema: z.ZodType<FtMintFilter> = z.object({\n type: z.literal(\"ft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Burn Filter\nexport const FtBurnFilterSchema: z.ZodType<FtBurnFilter> = z.object({\n type: z.literal(\"ft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// NFT Transfer Filter\nexport const NftTransferFilterSchema: z.ZodType<NftTransferFilter> = z.object({\n type: z.literal(\"nft_transfer\"),\n ...baseFilter,\n assetIdentifier: z.string().optional(),\n // Optional: filter by specific token ID (Clarity value as hex)\n tokenId: z.string().optional(),\n});\n\n// NFT Mint Filter\nexport const NftMintFilterSchema: z.ZodType<NftMintFilter> = z.object({\n type: z.literal(\"nft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// NFT Burn Filter\nexport const NftBurnFilterSchema: z.ZodType<NftBurnFilter> = z.object({\n type: z.literal(\"nft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// Contract Call Filter\nexport const ContractCallFilterSchema: z.ZodType<ContractCallFilter> = z.object({\n type: z.literal(\"contract_call\"),\n // Contract being called\n contractId: stacksPrincipal.optional(),\n // Function name (supports wildcards with *)\n functionName: z.string().optional(),\n // Caller address\n caller: stacksPrincipal.optional(),\n});\n\n// Contract Deploy Filter\nexport const ContractDeployFilterSchema: z.ZodType<ContractDeployFilter> = z.object({\n type: z.literal(\"contract_deploy\"),\n // Deployer address\n deployer: stacksPrincipal.optional(),\n // Contract name pattern (supports wildcards)\n contractName: z.string().optional(),\n});\n\n// Print Event Filter (smart contract events)\nexport const PrintEventFilterSchema: z.ZodType<PrintEventFilter> = z.object({\n type: z.literal(\"print_event\"),\n // Contract emitting the event\n contractId: stacksPrincipal.optional(),\n // Topic/name of the event\n topic: z.string().optional(),\n // Search for substring in event data\n contains: z.string().optional(),\n});\n\n// Union of all filter types\nexport const StreamFilterSchema: z.ZodType<StreamFilter> = z.discriminatedUnion(\"type\", [\n StxTransferFilterSchema as z.ZodType<StxTransferFilter> & z.ZodTypeDef as any,\n StxMintFilterSchema as any,\n StxBurnFilterSchema as any,\n StxLockFilterSchema as any,\n FtTransferFilterSchema as any,\n FtMintFilterSchema as any,\n FtBurnFilterSchema as any,\n NftTransferFilterSchema as any,\n NftMintFilterSchema as any,\n NftBurnFilterSchema as any,\n ContractCallFilterSchema as any,\n ContractDeployFilterSchema as any,\n PrintEventFilterSchema as any,\n]);\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;AAAA;AACA,2BAAS;AAET,IAAM,iBAAiB;AAGvB,IAAM,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ;AAAA,EACjD,MAAM,QAAQ,IAAI,MAAM,GAAG;AAAA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AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
8
8
  "debugId": "2E0E90434B6F6C7564756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,35 +1,107 @@
1
1
  import { z } from "zod";
2
- declare const StxTransferFilterSchema: unknown;
3
- declare const StxMintFilterSchema: unknown;
4
- declare const StxBurnFilterSchema: unknown;
5
- declare const StxLockFilterSchema: unknown;
6
- declare const FtTransferFilterSchema: unknown;
7
- declare const FtMintFilterSchema: unknown;
8
- declare const FtBurnFilterSchema: unknown;
9
- declare const NftTransferFilterSchema: unknown;
10
- declare const NftMintFilterSchema: unknown;
11
- declare const NftBurnFilterSchema: unknown;
12
- declare const ContractCallFilterSchema: unknown;
13
- declare const ContractDeployFilterSchema: unknown;
14
- declare const PrintEventFilterSchema: unknown;
15
- declare const StreamFilterSchema: unknown;
16
- type StxTransferFilter = z.infer<typeof StxTransferFilterSchema>;
17
- type StxMintFilter = z.infer<typeof StxMintFilterSchema>;
18
- type StxBurnFilter = z.infer<typeof StxBurnFilterSchema>;
19
- type StxLockFilter = z.infer<typeof StxLockFilterSchema>;
20
- type FtTransferFilter = z.infer<typeof FtTransferFilterSchema>;
21
- type FtMintFilter = z.infer<typeof FtMintFilterSchema>;
22
- type FtBurnFilter = z.infer<typeof FtBurnFilterSchema>;
23
- type NftTransferFilter = z.infer<typeof NftTransferFilterSchema>;
24
- type NftMintFilter = z.infer<typeof NftMintFilterSchema>;
25
- type NftBurnFilter = z.infer<typeof NftBurnFilterSchema>;
26
- type ContractCallFilter = z.infer<typeof ContractCallFilterSchema>;
27
- type ContractDeployFilter = z.infer<typeof ContractDeployFilterSchema>;
28
- type PrintEventFilter = z.infer<typeof PrintEventFilterSchema>;
29
- type StreamFilter = z.infer<typeof StreamFilterSchema>;
2
+ interface StxTransferFilter {
3
+ type: "stx_transfer";
4
+ sender?: string;
5
+ recipient?: string;
6
+ minAmount?: number;
7
+ maxAmount?: number;
8
+ }
9
+ interface StxMintFilter {
10
+ type: "stx_mint";
11
+ recipient?: string;
12
+ minAmount?: number;
13
+ }
14
+ interface StxBurnFilter {
15
+ type: "stx_burn";
16
+ sender?: string;
17
+ minAmount?: number;
18
+ }
19
+ interface StxLockFilter {
20
+ type: "stx_lock";
21
+ lockedAddress?: string;
22
+ minAmount?: number;
23
+ }
24
+ interface FtTransferFilter {
25
+ type: "ft_transfer";
26
+ sender?: string;
27
+ recipient?: string;
28
+ assetIdentifier?: string;
29
+ minAmount?: number;
30
+ }
31
+ interface FtMintFilter {
32
+ type: "ft_mint";
33
+ recipient?: string;
34
+ assetIdentifier?: string;
35
+ minAmount?: number;
36
+ }
37
+ interface FtBurnFilter {
38
+ type: "ft_burn";
39
+ sender?: string;
40
+ assetIdentifier?: string;
41
+ minAmount?: number;
42
+ }
43
+ interface NftTransferFilter {
44
+ type: "nft_transfer";
45
+ sender?: string;
46
+ recipient?: string;
47
+ assetIdentifier?: string;
48
+ tokenId?: string;
49
+ }
50
+ interface NftMintFilter {
51
+ type: "nft_mint";
52
+ recipient?: string;
53
+ assetIdentifier?: string;
54
+ tokenId?: string;
55
+ }
56
+ interface NftBurnFilter {
57
+ type: "nft_burn";
58
+ sender?: string;
59
+ assetIdentifier?: string;
60
+ tokenId?: string;
61
+ }
62
+ interface ContractCallFilter {
63
+ type: "contract_call";
64
+ contractId?: string;
65
+ functionName?: string;
66
+ caller?: string;
67
+ }
68
+ interface ContractDeployFilter {
69
+ type: "contract_deploy";
70
+ deployer?: string;
71
+ contractName?: string;
72
+ }
73
+ interface PrintEventFilter {
74
+ type: "print_event";
75
+ contractId?: string;
76
+ topic?: string;
77
+ contains?: string;
78
+ }
79
+ type StreamFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
80
+ declare const StxTransferFilterSchema: z.ZodType<StxTransferFilter>;
81
+ declare const StxMintFilterSchema: z.ZodType<StxMintFilter>;
82
+ declare const StxBurnFilterSchema: z.ZodType<StxBurnFilter>;
83
+ declare const StxLockFilterSchema: z.ZodType<StxLockFilter>;
84
+ declare const FtTransferFilterSchema: z.ZodType<FtTransferFilter>;
85
+ declare const FtMintFilterSchema: z.ZodType<FtMintFilter>;
86
+ declare const FtBurnFilterSchema: z.ZodType<FtBurnFilter>;
87
+ declare const NftTransferFilterSchema: z.ZodType<NftTransferFilter>;
88
+ declare const NftMintFilterSchema: z.ZodType<NftMintFilter>;
89
+ declare const NftBurnFilterSchema: z.ZodType<NftBurnFilter>;
90
+ declare const ContractCallFilterSchema: z.ZodType<ContractCallFilter>;
91
+ declare const ContractDeployFilterSchema: z.ZodType<ContractDeployFilter>;
92
+ declare const PrintEventFilterSchema: z.ZodType<PrintEventFilter>;
93
+ declare const StreamFilterSchema: z.ZodType<StreamFilter>;
30
94
  import { z as z2 } from "zod";
31
- declare const DeployViewRequestSchema: unknown;
32
- type DeployViewRequest = z2.infer<typeof DeployViewRequestSchema>;
95
+ interface DeployViewRequest {
96
+ name: string;
97
+ version?: string;
98
+ description?: string;
99
+ sources: string[];
100
+ schema: Record<string, unknown>;
101
+ handlerCode: string;
102
+ reindex?: boolean;
103
+ }
104
+ declare const DeployViewRequestSchema: z2.ZodType<DeployViewRequest>;
33
105
  interface DeployViewResponse {
34
106
  action: "created" | "unchanged" | "updated" | "reindexed";
35
107
  viewId: string;
@@ -57,7 +129,10 @@ interface ViewDetail {
57
129
  };
58
130
  tables: Record<string, {
59
131
  endpoint: string
60
- columns: Record<string, string>
132
+ columns: Record<string, {
133
+ type: string
134
+ nullable?: boolean
135
+ }>
61
136
  rowCount: number
62
137
  example: string
63
138
  }>;
@@ -78,18 +153,86 @@ interface ViewQueryParams {
78
153
  filters?: Record<string, string>;
79
154
  }
80
155
  import { z as z3 } from "zod";
81
- declare const StreamOptionsSchema: unknown;
82
- declare const CreateStreamSchema: unknown;
83
- declare const UpdateStreamSchema: unknown;
84
- declare const WebhookPayloadSchema: unknown;
85
- declare const StreamMetricsSchema: unknown;
86
- declare const StreamResponseSchema: unknown;
87
- type StreamOptions = z3.infer<typeof StreamOptionsSchema>;
88
- type CreateStream = z3.infer<typeof CreateStreamSchema>;
89
- type UpdateStream = z3.infer<typeof UpdateStreamSchema>;
90
- type WebhookPayload = z3.infer<typeof WebhookPayloadSchema>;
91
- type StreamResponse = z3.infer<typeof StreamResponseSchema>;
92
- type StreamMetricsResponse = z3.infer<typeof StreamMetricsSchema>;
156
+ interface StreamOptions {
157
+ decodeClarityValues: boolean;
158
+ includeRawTx: boolean;
159
+ includeBlockMetadata: boolean;
160
+ rateLimit: number;
161
+ timeoutMs: number;
162
+ maxRetries: number;
163
+ }
164
+ interface CreateStream {
165
+ name: string;
166
+ webhookUrl: string;
167
+ filters: StreamFilter[];
168
+ options?: StreamOptions;
169
+ startBlock?: number;
170
+ endBlock?: number;
171
+ }
172
+ interface UpdateStream {
173
+ name?: string;
174
+ webhookUrl?: string;
175
+ filters?: StreamFilter[];
176
+ options?: Partial<StreamOptions>;
177
+ }
178
+ interface WebhookPayload {
179
+ streamId: string;
180
+ streamName: string;
181
+ block: {
182
+ height: number
183
+ hash: string
184
+ parentHash: string
185
+ burnBlockHeight: number
186
+ timestamp: number
187
+ };
188
+ matches: {
189
+ transactions: Array<{
190
+ txId: string
191
+ type: string
192
+ sender: string
193
+ status: string
194
+ contractId: string | null
195
+ functionName: string | null
196
+ rawTx?: string
197
+ }>
198
+ events: Array<{
199
+ txId: string
200
+ eventIndex: number
201
+ type: string
202
+ data?: any
203
+ }>
204
+ };
205
+ isBackfill: boolean;
206
+ deliveredAt: string;
207
+ }
208
+ interface StreamMetricsResponse {
209
+ totalDeliveries: number;
210
+ failedDeliveries: number;
211
+ lastTriggeredAt: string | null;
212
+ lastTriggeredBlock: number | null;
213
+ errorMessage: string | null;
214
+ }
215
+ interface StreamResponse {
216
+ id: string;
217
+ name: string;
218
+ status: "inactive" | "active" | "paused" | "failed";
219
+ webhookUrl: string;
220
+ filters: StreamFilter[];
221
+ options: StreamOptions;
222
+ totalDeliveries: number;
223
+ failedDeliveries: number;
224
+ lastTriggeredAt?: string | null;
225
+ lastTriggeredBlock?: number | null;
226
+ errorMessage?: string | null;
227
+ createdAt: string;
228
+ updatedAt: string;
229
+ }
230
+ declare const StreamOptionsSchema: z3.ZodType<StreamOptions>;
231
+ declare const CreateStreamSchema: z3.ZodType<CreateStream>;
232
+ declare const UpdateStreamSchema: z3.ZodType<UpdateStream>;
233
+ declare const WebhookPayloadSchema: z3.ZodType<WebhookPayload>;
234
+ declare const StreamMetricsSchema: z3.ZodType<StreamMetricsResponse>;
235
+ declare const StreamResponseSchema: z3.ZodType<StreamResponse>;
93
236
  interface CreateStreamResponse {
94
237
  stream: StreamResponse;
95
238
  webhookSecret: string;
@@ -127,7 +127,7 @@ var DeployViewRequestSchema = z2.object({
127
127
  });
128
128
  // src/schemas/stream.ts
129
129
  import { z as z3 } from "zod";
130
- var StreamOptionsSchema = z3.object({
130
+ var streamOptionsShape = z3.object({
131
131
  decodeClarityValues: z3.boolean().default(true),
132
132
  includeRawTx: z3.boolean().default(false),
133
133
  includeBlockMetadata: z3.boolean().default(true),
@@ -135,11 +135,12 @@ var StreamOptionsSchema = z3.object({
135
135
  timeoutMs: z3.number().int().positive().max(30000).default(1e4),
136
136
  maxRetries: z3.number().int().min(0).max(10).default(3)
137
137
  });
138
+ var StreamOptionsSchema = streamOptionsShape;
138
139
  var CreateStreamSchema = z3.object({
139
140
  name: z3.string().min(1).max(255),
140
141
  webhookUrl: z3.string().url(),
141
142
  filters: z3.array(StreamFilterSchema).min(1),
142
- options: StreamOptionsSchema.optional().default({}),
143
+ options: streamOptionsShape.optional().default({}),
143
144
  startBlock: z3.number().int().positive().optional(),
144
145
  endBlock: z3.number().int().positive().optional()
145
146
  });
@@ -147,7 +148,7 @@ var UpdateStreamSchema = z3.object({
147
148
  name: z3.string().min(1).max(255).optional(),
148
149
  webhookUrl: z3.string().url().optional(),
149
150
  filters: z3.array(StreamFilterSchema).min(1).optional(),
150
- options: StreamOptionsSchema.partial().optional()
151
+ options: streamOptionsShape.partial().optional()
151
152
  }).refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided for update" });
152
153
  var WebhookPayloadSchema = z3.object({
153
154
  streamId: z3.string().uuid(),
@@ -192,7 +193,7 @@ var StreamResponseSchema = z3.object({
192
193
  status: z3.enum(["inactive", "active", "paused", "failed"]),
193
194
  webhookUrl: z3.string().url(),
194
195
  filters: z3.array(StreamFilterSchema),
195
- options: StreamOptionsSchema,
196
+ options: streamOptionsShape,
196
197
  totalDeliveries: z3.number().int().default(0),
197
198
  failedDeliveries: z3.number().int().default(0),
198
199
  lastTriggeredAt: z3.string().datetime().nullable().optional(),
@@ -225,5 +226,5 @@ export {
225
226
  ContractCallFilterSchema
226
227
  };
227
228
 
228
- //# debugId=4A6B5823F45BAB8564756E2164756E21
229
+ //# debugId=24326D7C3E89147164756E2164756E21
229
230
  //# sourceMappingURL=index.js.map
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/schemas/filters.ts", "../src/schemas/views.ts", "../src/schemas/stream.ts"],
4
4
  "sourcesContent": [
5
- "import { z } from \"zod\";\nimport { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\n\nconst isValidAddress = _isValidAddress as (addr: string) => boolean;\n\n/** Validate a Stacks principal (standard or contract, e.g. SP2J...ABC or SP2J...ABC.contract-name) */\nconst stacksPrincipal = z.string().refine((val) => {\n const parts = val.split(\".\");\n if (parts.length > 2) return false;\n return isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n // Optional: filter by sender\n sender: stacksPrincipal.optional(),\n // Optional: filter by recipient\n recipient: stacksPrincipal.optional(),\n};\n\n// STX Transfer Filter\nexport const StxTransferFilterSchema = z.object({\n type: z.literal(\"stx_transfer\"),\n ...baseFilter,\n // Optional: minimum amount in microSTX\n minAmount: z.coerce.number().int().positive().optional(),\n // Optional: maximum amount in microSTX\n maxAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Mint Filter\nexport const StxMintFilterSchema = z.object({\n type: z.literal(\"stx_mint\"),\n recipient: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Burn Filter\nexport const StxBurnFilterSchema = z.object({\n type: z.literal(\"stx_burn\"),\n sender: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Lock Filter\nexport const StxLockFilterSchema = z.object({\n type: z.literal(\"stx_lock\"),\n lockedAddress: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Transfer Filter\nexport const FtTransferFilterSchema = z.object({\n type: z.literal(\"ft_transfer\"),\n ...baseFilter,\n // Contract that defines the token (e.g., SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx)\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Mint Filter\nexport const FtMintFilterSchema = z.object({\n type: z.literal(\"ft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Burn Filter\nexport const FtBurnFilterSchema = z.object({\n type: z.literal(\"ft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// NFT Transfer Filter\nexport const NftTransferFilterSchema = z.object({\n type: z.literal(\"nft_transfer\"),\n ...baseFilter,\n assetIdentifier: z.string().optional(),\n // Optional: filter by specific token ID (Clarity value as hex)\n tokenId: z.string().optional(),\n});\n\n// NFT Mint Filter\nexport const NftMintFilterSchema = z.object({\n type: z.literal(\"nft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// NFT Burn Filter\nexport const NftBurnFilterSchema = z.object({\n type: z.literal(\"nft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// Contract Call Filter\nexport const ContractCallFilterSchema = z.object({\n type: z.literal(\"contract_call\"),\n // Contract being called\n contractId: stacksPrincipal.optional(),\n // Function name (supports wildcards with *)\n functionName: z.string().optional(),\n // Caller address\n caller: stacksPrincipal.optional(),\n});\n\n// Contract Deploy Filter\nexport const ContractDeployFilterSchema = z.object({\n type: z.literal(\"contract_deploy\"),\n // Deployer address\n deployer: stacksPrincipal.optional(),\n // Contract name pattern (supports wildcards)\n contractName: z.string().optional(),\n});\n\n// Print Event Filter (smart contract events)\nexport const PrintEventFilterSchema = z.object({\n type: z.literal(\"print_event\"),\n // Contract emitting the event\n contractId: stacksPrincipal.optional(),\n // Topic/name of the event\n topic: z.string().optional(),\n // Search for substring in event data\n contains: z.string().optional(),\n});\n\n// Union of all filter types\nexport const StreamFilterSchema = z.discriminatedUnion(\"type\", [\n StxTransferFilterSchema,\n StxMintFilterSchema,\n StxBurnFilterSchema,\n StxLockFilterSchema,\n FtTransferFilterSchema,\n FtMintFilterSchema,\n FtBurnFilterSchema,\n NftTransferFilterSchema,\n NftMintFilterSchema,\n NftBurnFilterSchema,\n ContractCallFilterSchema,\n ContractDeployFilterSchema,\n PrintEventFilterSchema,\n]);\n\n// Type exports\nexport type StxTransferFilter = z.infer<typeof StxTransferFilterSchema>;\nexport type StxMintFilter = z.infer<typeof StxMintFilterSchema>;\nexport type StxBurnFilter = z.infer<typeof StxBurnFilterSchema>;\nexport type StxLockFilter = z.infer<typeof StxLockFilterSchema>;\nexport type FtTransferFilter = z.infer<typeof FtTransferFilterSchema>;\nexport type FtMintFilter = z.infer<typeof FtMintFilterSchema>;\nexport type FtBurnFilter = z.infer<typeof FtBurnFilterSchema>;\nexport type NftTransferFilter = z.infer<typeof NftTransferFilterSchema>;\nexport type NftMintFilter = z.infer<typeof NftMintFilterSchema>;\nexport type NftBurnFilter = z.infer<typeof NftBurnFilterSchema>;\nexport type ContractCallFilter = z.infer<typeof ContractCallFilterSchema>;\nexport type ContractDeployFilter = z.infer<typeof ContractDeployFilterSchema>;\nexport type PrintEventFilter = z.infer<typeof PrintEventFilterSchema>;\nexport type StreamFilter = z.infer<typeof StreamFilterSchema>;\n",
6
- "import { z } from \"zod\";\n\n// ── Deploy View Request ─────────────────────────────────────────────────\n\nexport const DeployViewRequestSchema = z.object({\n name: z.string().regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\").max(63),\n version: z.string().optional(),\n description: z.string().optional(),\n sources: z.array(z.string()).min(1),\n schema: z.record(z.unknown()),\n handlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n reindex: z.boolean().optional(),\n});\n\nexport type DeployViewRequest = z.infer<typeof DeployViewRequestSchema>;\n\nexport interface DeployViewResponse {\n action: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n viewId: string;\n message: string;\n}\n\n// View API response types\n\nexport interface ViewSummary {\n name: string;\n version: string;\n status: string;\n lastProcessedBlock: number;\n tables: string[];\n createdAt: string;\n}\n\nexport interface ViewDetail {\n name: string;\n version: string;\n status: string;\n lastProcessedBlock: number;\n health: {\n totalProcessed: number;\n totalErrors: number;\n errorRate: number;\n lastError: string | null;\n lastErrorAt: string | null;\n };\n tables: Record<string, {\n endpoint: string;\n columns: Record<string, string>;\n rowCount: number;\n example: string;\n }>;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ReindexResponse {\n message: string;\n fromBlock: number;\n toBlock: number | string;\n}\n\nexport interface ViewQueryParams {\n sort?: string;\n order?: string;\n limit?: number;\n offset?: number;\n fields?: string;\n filters?: Record<string, string>;\n}\n",
7
- "import { z } from \"zod\";\nimport { StreamFilterSchema } from \"./filters.ts\";\n\n// Stream options schema\nexport const StreamOptionsSchema = z.object({\n // Include decoded Clarity values in webhook payload\n decodeClarityValues: z.boolean().default(true),\n // Include raw transaction hex in payload\n includeRawTx: z.boolean().default(false),\n // Include full block metadata\n includeBlockMetadata: z.boolean().default(true),\n // Rate limit: max webhooks per second\n rateLimit: z.number().int().positive().max(100).default(10),\n // Timeout for webhook delivery in ms\n timeoutMs: z.number().int().positive().max(30000).default(10000),\n // Max retry attempts for failed webhooks\n maxRetries: z.number().int().min(0).max(10).default(3),\n});\n\n// Create stream schema\nexport const CreateStreamSchema = z.object({\n name: z.string().min(1).max(255),\n webhookUrl: z.string().url(),\n // At least one filter required\n filters: z.array(StreamFilterSchema).min(1),\n // Optional settings\n options: StreamOptionsSchema.optional().default({}),\n // Optional: start processing from specific block (for backfill)\n startBlock: z.number().int().positive().optional(),\n // Optional: stop processing at specific block\n endBlock: z.number().int().positive().optional(),\n});\n\n// Update stream schema (all fields optional)\nexport const UpdateStreamSchema = z.object({\n name: z.string().min(1).max(255).optional(),\n webhookUrl: z.string().url().optional(),\n filters: z.array(StreamFilterSchema).min(1).optional(),\n options: StreamOptionsSchema.partial().optional(),\n}).refine(\n (data) => Object.keys(data).length > 0,\n { message: \"At least one field must be provided for update\" }\n);\n\n// Webhook payload schema (what gets sent to the user's endpoint)\nexport const WebhookPayloadSchema = z.object({\n // Stream metadata\n streamId: z.string().uuid(),\n streamName: z.string(),\n\n // Block metadata\n block: z.object({\n height: z.number(),\n hash: z.string(),\n parentHash: z.string(),\n burnBlockHeight: z.number(),\n timestamp: z.number(),\n }),\n\n // Matched data\n matches: z.object({\n transactions: z.array(z.object({\n txId: z.string(),\n type: z.string(),\n sender: z.string(),\n status: z.string(),\n contractId: z.string().nullable(),\n functionName: z.string().nullable(),\n rawTx: z.string().optional(),\n })),\n events: z.array(z.object({\n txId: z.string(),\n eventIndex: z.number(),\n type: z.string(),\n data: z.any(),\n })),\n }),\n\n // Metadata\n isBackfill: z.boolean(),\n deliveredAt: z.string().datetime(),\n});\n\n// Stream response schema (what API returns)\n// Stream metrics schema\nexport const StreamMetricsSchema = z.object({\n totalDeliveries: z.number(),\n failedDeliveries: z.number(),\n lastTriggeredAt: z.string().datetime().nullable(),\n lastTriggeredBlock: z.number().nullable(),\n errorMessage: z.string().nullable(),\n});\n\n// Stream response schema (what API returns)\nexport const StreamResponseSchema = z.object({\n id: z.string().uuid(),\n name: z.string(),\n status: z.enum([\"inactive\", \"active\", \"paused\", \"failed\"]),\n webhookUrl: z.string().url(),\n filters: z.array(StreamFilterSchema),\n options: StreamOptionsSchema,\n\n // Metrics (joined from stream_metrics)\n totalDeliveries: z.number().int().default(0),\n failedDeliveries: z.number().int().default(0),\n lastTriggeredAt: z.string().datetime().nullable().optional(),\n lastTriggeredBlock: z.number().int().nullable().optional(),\n errorMessage: z.string().nullable().optional(),\n\n createdAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n});\n\n// Type exports\nexport type StreamOptions = z.infer<typeof StreamOptionsSchema>;\nexport type CreateStream = z.infer<typeof CreateStreamSchema>;\nexport type UpdateStream = z.infer<typeof UpdateStreamSchema>;\nexport type WebhookPayload = z.infer<typeof WebhookPayloadSchema>;\nexport type StreamResponse = z.infer<typeof StreamResponseSchema>;\nexport type StreamMetricsResponse = z.infer<typeof StreamMetricsSchema>;\n\n// API response types\nexport interface CreateStreamResponse {\n stream: StreamResponse;\n webhookSecret: string;\n}\n\nexport interface ListStreamsResponse {\n streams: StreamResponse[];\n total: number;\n}\n\nexport interface BulkPauseResponse {\n paused: number;\n streams: StreamResponse[];\n}\n\nexport interface BulkResumeResponse {\n resumed: number;\n streams: StreamResponse[];\n}\n"
5
+ "import { z } from \"zod\";\nimport { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\n\nconst isValidAddress = _isValidAddress as (addr: string) => boolean;\n\n/** Validate a Stacks principal (standard or contract, e.g. SP2J...ABC or SP2J...ABC.contract-name) */\nconst stacksPrincipal = z.string().refine((val) => {\n const parts = val.split(\".\");\n if (parts.length > 2) return false;\n return isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n // Optional: filter by sender\n sender: stacksPrincipal.optional(),\n // Optional: filter by recipient\n recipient: stacksPrincipal.optional(),\n};\n\n// Type exports — defined first so they can annotate schemas\nexport interface StxTransferFilter {\n type: \"stx_transfer\";\n sender?: string;\n recipient?: string;\n minAmount?: number;\n maxAmount?: number;\n}\n\nexport interface StxMintFilter {\n type: \"stx_mint\";\n recipient?: string;\n minAmount?: number;\n}\n\nexport interface StxBurnFilter {\n type: \"stx_burn\";\n sender?: string;\n minAmount?: number;\n}\n\nexport interface StxLockFilter {\n type: \"stx_lock\";\n lockedAddress?: string;\n minAmount?: number;\n}\n\nexport interface FtTransferFilter {\n type: \"ft_transfer\";\n sender?: string;\n recipient?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface FtMintFilter {\n type: \"ft_mint\";\n recipient?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface FtBurnFilter {\n type: \"ft_burn\";\n sender?: string;\n assetIdentifier?: string;\n minAmount?: number;\n}\n\nexport interface NftTransferFilter {\n type: \"nft_transfer\";\n sender?: string;\n recipient?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface NftMintFilter {\n type: \"nft_mint\";\n recipient?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface NftBurnFilter {\n type: \"nft_burn\";\n sender?: string;\n assetIdentifier?: string;\n tokenId?: string;\n}\n\nexport interface ContractCallFilter {\n type: \"contract_call\";\n contractId?: string;\n functionName?: string;\n caller?: string;\n}\n\nexport interface ContractDeployFilter {\n type: \"contract_deploy\";\n deployer?: string;\n contractName?: string;\n}\n\nexport interface PrintEventFilter {\n type: \"print_event\";\n contractId?: string;\n topic?: string;\n contains?: string;\n}\n\nexport type StreamFilter =\n | StxTransferFilter\n | StxMintFilter\n | StxBurnFilter\n | StxLockFilter\n | FtTransferFilter\n | FtMintFilter\n | FtBurnFilter\n | NftTransferFilter\n | NftMintFilter\n | NftBurnFilter\n | ContractCallFilter\n | ContractDeployFilter\n | PrintEventFilter;\n\n// STX Transfer Filter\nexport const StxTransferFilterSchema: z.ZodType<StxTransferFilter> = z.object({\n type: z.literal(\"stx_transfer\"),\n ...baseFilter,\n // Optional: minimum amount in microSTX\n minAmount: z.coerce.number().int().positive().optional(),\n // Optional: maximum amount in microSTX\n maxAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Mint Filter\nexport const StxMintFilterSchema: z.ZodType<StxMintFilter> = z.object({\n type: z.literal(\"stx_mint\"),\n recipient: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Burn Filter\nexport const StxBurnFilterSchema: z.ZodType<StxBurnFilter> = z.object({\n type: z.literal(\"stx_burn\"),\n sender: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Lock Filter\nexport const StxLockFilterSchema: z.ZodType<StxLockFilter> = z.object({\n type: z.literal(\"stx_lock\"),\n lockedAddress: stacksPrincipal.optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Transfer Filter\nexport const FtTransferFilterSchema: z.ZodType<FtTransferFilter> = z.object({\n type: z.literal(\"ft_transfer\"),\n ...baseFilter,\n // Contract that defines the token (e.g., SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx)\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Mint Filter\nexport const FtMintFilterSchema: z.ZodType<FtMintFilter> = z.object({\n type: z.literal(\"ft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Burn Filter\nexport const FtBurnFilterSchema: z.ZodType<FtBurnFilter> = z.object({\n type: z.literal(\"ft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n minAmount: z.coerce.number().int().positive().optional(),\n});\n\n// NFT Transfer Filter\nexport const NftTransferFilterSchema: z.ZodType<NftTransferFilter> = z.object({\n type: z.literal(\"nft_transfer\"),\n ...baseFilter,\n assetIdentifier: z.string().optional(),\n // Optional: filter by specific token ID (Clarity value as hex)\n tokenId: z.string().optional(),\n});\n\n// NFT Mint Filter\nexport const NftMintFilterSchema: z.ZodType<NftMintFilter> = z.object({\n type: z.literal(\"nft_mint\"),\n recipient: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// NFT Burn Filter\nexport const NftBurnFilterSchema: z.ZodType<NftBurnFilter> = z.object({\n type: z.literal(\"nft_burn\"),\n sender: stacksPrincipal.optional(),\n assetIdentifier: z.string().optional(),\n tokenId: z.string().optional(),\n});\n\n// Contract Call Filter\nexport const ContractCallFilterSchema: z.ZodType<ContractCallFilter> = z.object({\n type: z.literal(\"contract_call\"),\n // Contract being called\n contractId: stacksPrincipal.optional(),\n // Function name (supports wildcards with *)\n functionName: z.string().optional(),\n // Caller address\n caller: stacksPrincipal.optional(),\n});\n\n// Contract Deploy Filter\nexport const ContractDeployFilterSchema: z.ZodType<ContractDeployFilter> = z.object({\n type: z.literal(\"contract_deploy\"),\n // Deployer address\n deployer: stacksPrincipal.optional(),\n // Contract name pattern (supports wildcards)\n contractName: z.string().optional(),\n});\n\n// Print Event Filter (smart contract events)\nexport const PrintEventFilterSchema: z.ZodType<PrintEventFilter> = z.object({\n type: z.literal(\"print_event\"),\n // Contract emitting the event\n contractId: stacksPrincipal.optional(),\n // Topic/name of the event\n topic: z.string().optional(),\n // Search for substring in event data\n contains: z.string().optional(),\n});\n\n// Union of all filter types\nexport const StreamFilterSchema: z.ZodType<StreamFilter> = z.discriminatedUnion(\"type\", [\n StxTransferFilterSchema as z.ZodType<StxTransferFilter> & z.ZodTypeDef as any,\n StxMintFilterSchema as any,\n StxBurnFilterSchema as any,\n StxLockFilterSchema as any,\n FtTransferFilterSchema as any,\n FtMintFilterSchema as any,\n FtBurnFilterSchema as any,\n NftTransferFilterSchema as any,\n NftMintFilterSchema as any,\n NftBurnFilterSchema as any,\n ContractCallFilterSchema as any,\n ContractDeployFilterSchema as any,\n PrintEventFilterSchema as any,\n]);\n",
6
+ "import { z } from \"zod\";\n\n// ── Deploy View Request ─────────────────────────────────────────────────\n\nexport interface DeployViewRequest {\n name: string;\n version?: string;\n description?: string;\n sources: string[];\n schema: Record<string, unknown>;\n handlerCode: string;\n reindex?: boolean;\n}\n\nexport const DeployViewRequestSchema: z.ZodType<DeployViewRequest> = z.object({\n name: z.string().regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\").max(63),\n version: z.string().optional(),\n description: z.string().optional(),\n sources: z.array(z.string()).min(1),\n schema: z.record(z.unknown()),\n handlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n reindex: z.boolean().optional(),\n});\n\nexport interface DeployViewResponse {\n action: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n viewId: string;\n message: string;\n}\n\n// View API response types\n\nexport interface ViewSummary {\n name: string;\n version: string;\n status: string;\n lastProcessedBlock: number;\n tables: string[];\n createdAt: string;\n}\n\nexport interface ViewDetail {\n name: string;\n version: string;\n status: string;\n lastProcessedBlock: number;\n health: {\n totalProcessed: number;\n totalErrors: number;\n errorRate: number;\n lastError: string | null;\n lastErrorAt: string | null;\n };\n tables: Record<string, {\n endpoint: string;\n columns: Record<string, { type: string; nullable?: boolean }>;\n rowCount: number;\n example: string;\n }>;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ReindexResponse {\n message: string;\n fromBlock: number;\n toBlock: number | string;\n}\n\nexport interface ViewQueryParams {\n sort?: string;\n order?: string;\n limit?: number;\n offset?: number;\n fields?: string;\n filters?: Record<string, string>;\n}\n",
7
+ "import { z } from \"zod\";\nimport { StreamFilterSchema, type StreamFilter } from \"./filters.ts\";\n\n// ── Type interfaces ──────────────────────────────────────────────────\n\nexport interface StreamOptions {\n decodeClarityValues: boolean;\n includeRawTx: boolean;\n includeBlockMetadata: boolean;\n rateLimit: number;\n timeoutMs: number;\n maxRetries: number;\n}\n\nexport interface CreateStream {\n name: string;\n webhookUrl: string;\n filters: StreamFilter[];\n options?: StreamOptions;\n startBlock?: number;\n endBlock?: number;\n}\n\nexport interface UpdateStream {\n name?: string;\n webhookUrl?: string;\n filters?: StreamFilter[];\n options?: Partial<StreamOptions>;\n}\n\nexport interface WebhookPayload {\n streamId: string;\n streamName: string;\n block: {\n height: number;\n hash: string;\n parentHash: string;\n burnBlockHeight: number;\n timestamp: number;\n };\n matches: {\n transactions: Array<{\n txId: string;\n type: string;\n sender: string;\n status: string;\n contractId: string | null;\n functionName: string | null;\n rawTx?: string;\n }>;\n events: Array<{\n txId: string;\n eventIndex: number;\n type: string;\n data?: any;\n }>;\n };\n isBackfill: boolean;\n deliveredAt: string;\n}\n\nexport interface StreamMetricsResponse {\n totalDeliveries: number;\n failedDeliveries: number;\n lastTriggeredAt: string | null;\n lastTriggeredBlock: number | null;\n errorMessage: string | null;\n}\n\nexport interface StreamResponse {\n id: string;\n name: string;\n status: \"inactive\" | \"active\" | \"paused\" | \"failed\";\n webhookUrl: string;\n filters: StreamFilter[];\n options: StreamOptions;\n totalDeliveries: number;\n failedDeliveries: number;\n lastTriggeredAt?: string | null;\n lastTriggeredBlock?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ── Zod schemas ──────────────────────────────────────────────────────\n\n// Stream options schema (internal, keeps ZodObject methods like .partial())\nconst streamOptionsShape = z.object({\n decodeClarityValues: z.boolean().default(true),\n includeRawTx: z.boolean().default(false),\n includeBlockMetadata: z.boolean().default(true),\n rateLimit: z.number().int().positive().max(100).default(10),\n timeoutMs: z.number().int().positive().max(30000).default(10000),\n maxRetries: z.number().int().min(0).max(10).default(3),\n});\n\n// Cast: .default() makes _input fields optional, but output type matches StreamOptions\nexport const StreamOptionsSchema: z.ZodType<StreamOptions> =\n streamOptionsShape as unknown as z.ZodType<StreamOptions>;\n\nexport const CreateStreamSchema: z.ZodType<CreateStream> = z.object({\n name: z.string().min(1).max(255),\n webhookUrl: z.string().url(),\n filters: z.array(StreamFilterSchema).min(1),\n options: streamOptionsShape.optional().default({}),\n startBlock: z.number().int().positive().optional(),\n endBlock: z.number().int().positive().optional(),\n}) as unknown as z.ZodType<CreateStream>;\n\nexport const UpdateStreamSchema: z.ZodType<UpdateStream> = z.object({\n name: z.string().min(1).max(255).optional(),\n webhookUrl: z.string().url().optional(),\n filters: z.array(StreamFilterSchema).min(1).optional(),\n options: streamOptionsShape.partial().optional(),\n}).refine(\n (data) => Object.keys(data).length > 0,\n { message: \"At least one field must be provided for update\" }\n) as unknown as z.ZodType<UpdateStream>;\n\nexport const WebhookPayloadSchema: z.ZodType<WebhookPayload> = z.object({\n streamId: z.string().uuid(),\n streamName: z.string(),\n block: z.object({\n height: z.number(),\n hash: z.string(),\n parentHash: z.string(),\n burnBlockHeight: z.number(),\n timestamp: z.number(),\n }),\n matches: z.object({\n transactions: z.array(z.object({\n txId: z.string(),\n type: z.string(),\n sender: z.string(),\n status: z.string(),\n contractId: z.string().nullable(),\n functionName: z.string().nullable(),\n rawTx: z.string().optional(),\n })),\n events: z.array(z.object({\n txId: z.string(),\n eventIndex: z.number(),\n type: z.string(),\n data: z.any(),\n })),\n }),\n isBackfill: z.boolean(),\n deliveredAt: z.string().datetime(),\n}) as unknown as z.ZodType<WebhookPayload>;\n\nexport const StreamMetricsSchema: z.ZodType<StreamMetricsResponse> = z.object({\n totalDeliveries: z.number(),\n failedDeliveries: z.number(),\n lastTriggeredAt: z.string().datetime().nullable(),\n lastTriggeredBlock: z.number().nullable(),\n errorMessage: z.string().nullable(),\n});\n\nexport const StreamResponseSchema: z.ZodType<StreamResponse> = z.object({\n id: z.string().uuid(),\n name: z.string(),\n status: z.enum([\"inactive\", \"active\", \"paused\", \"failed\"]),\n webhookUrl: z.string().url(),\n filters: z.array(StreamFilterSchema),\n options: streamOptionsShape,\n totalDeliveries: z.number().int().default(0),\n failedDeliveries: z.number().int().default(0),\n lastTriggeredAt: z.string().datetime().nullable().optional(),\n lastTriggeredBlock: z.number().int().nullable().optional(),\n errorMessage: z.string().nullable().optional(),\n createdAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n}) as unknown as z.ZodType<StreamResponse>;\n\n// API response types\nexport interface CreateStreamResponse {\n stream: StreamResponse;\n webhookSecret: string;\n}\n\nexport interface ListStreamsResponse {\n streams: StreamResponse[];\n total: number;\n}\n\nexport interface BulkPauseResponse {\n paused: number;\n streams: StreamResponse[];\n}\n\nexport interface BulkResumeResponse {\n resumed: number;\n streams: StreamResponse[];\n}\n"
8
8
  ],
9
- "mappings": ";;;;;;;;;;;;;AAAA;AACA,2BAAS;AAET,IAAM,iBAAiB;AAGvB,IAAM,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ;AAAA,EACjD,MAAM,QAAQ,IAAI,MAAM,GAAG;AAAA,EAC3B,IAAI,MAAM,SAAS;AAAA,IAAG,OAAO;AAAA,EAC7B,OAAO,eAAe,MAAM,EAAG;AAAA,GAC9B,kCAAkC;AAGrC,IAAM,aAAa;AAAA,EAEjB,QAAQ,gBAAgB,SAAS;AAAA,EAEjC,WAAW,gBAAgB,SAAS;AACtC;AAGO,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,MAAM,EAAE,QAAQ,cAAc;AAAA,KAC3B;AAAA,EAEH,WAAW,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAEvD,WAAW,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AACzD,CAAC;AAGM,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,MAAM,EAAE,QAAQ,UAAU;AAAA,EAC1B,WAAW,gBAAgB,SAAS;AAAA,EACpC,WAAW,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AACzD,CAAC;AAGM,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,MAAM,EAA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