@secondlayer/shared 0.12.3 → 1.0.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.
- package/README.md +5 -7
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.js.map +2 -2
- package/dist/src/db/index.d.ts +3 -64
- package/dist/src/db/index.js +2 -2
- package/dist/src/db/index.js.map +2 -2
- package/dist/src/db/queries/accounts.d.ts +2 -51
- package/dist/src/db/queries/integrity.d.ts +2 -51
- package/dist/src/db/queries/marketplace.d.ts +2 -51
- package/dist/src/db/queries/projects.d.ts +2 -51
- package/dist/src/db/queries/subgraph-gaps.d.ts +2 -51
- package/dist/src/db/queries/subgraphs.d.ts +3 -51
- package/dist/src/db/queries/subgraphs.js +3 -1
- package/dist/src/db/queries/subgraphs.js.map +3 -3
- package/dist/src/db/queries/usage.d.ts +3 -56
- package/dist/src/db/queries/usage.js +1 -19
- package/dist/src/db/queries/usage.js.map +4 -4
- package/dist/src/db/queries/workflows.d.ts +7 -53
- package/dist/src/db/queries/workflows.js +130 -13
- package/dist/src/db/queries/workflows.js.map +5 -4
- package/dist/src/db/schema.d.ts +3 -64
- package/dist/src/errors.d.ts +19 -50
- package/dist/src/errors.js +28 -45
- package/dist/src/errors.js.map +3 -3
- package/dist/src/index.d.ts +25 -256
- package/dist/src/index.js +32 -234
- package/dist/src/index.js.map +7 -9
- package/dist/src/lib/plans.d.ts +0 -1
- package/dist/src/lib/plans.js +1 -2
- package/dist/src/lib/plans.js.map +3 -3
- package/dist/src/node/local-client.d.ts +2 -51
- package/dist/src/queue/listener.d.ts +1 -18
- package/dist/src/queue/listener.js +2 -12
- package/dist/src/queue/listener.js.map +3 -3
- package/dist/src/schemas/filters.d.ts +3 -3
- package/dist/src/schemas/filters.js +3 -3
- package/dist/src/schemas/filters.js.map +3 -3
- package/dist/src/schemas/index.d.ts +5 -100
- package/dist/src/schemas/index.js +4 -88
- package/dist/src/schemas/index.js.map +5 -6
- package/dist/src/schemas/subgraphs.d.ts +2 -0
- package/dist/src/schemas/subgraphs.js +2 -1
- package/dist/src/schemas/subgraphs.js.map +3 -3
- package/dist/src/schemas/workflows.d.ts +4 -0
- package/dist/src/schemas/workflows.js +5 -1
- package/dist/src/schemas/workflows.js.map +3 -3
- package/dist/src/types.d.ts +1 -53
- package/migrations/0030_workflow_source_code.ts +21 -0
- package/migrations/0031_subgraph_source_code.ts +18 -0
- package/migrations/0032_drop_streams_tables.ts +43 -0
- package/package.json +2 -14
- package/dist/src/db/queries/metrics.d.ts +0 -419
- package/dist/src/db/queries/metrics.js +0 -55
- package/dist/src/db/queries/metrics.js.map +0 -10
- package/dist/src/queue/index.d.ts +0 -50
- package/dist/src/queue/index.js +0 -184
- package/dist/src/queue/index.js.map +0 -12
- package/dist/src/queue/recovery.d.ts +0 -14
- package/dist/src/queue/recovery.js +0 -108
- package/dist/src/queue/recovery.js.map +0 -12
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/schemas/filters.ts", "../src/schemas/marketplace.ts", "../src/schemas/subgraphs.ts"
|
|
3
|
+
"sources": ["../src/schemas/filters.ts", "../src/schemas/marketplace.ts", "../src/schemas/subgraphs.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\nimport { z } from \"zod/v4\";\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\tconst parts = val.split(\".\");\n\tif (parts.length > 2) return false;\n\treturn isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n\t// Optional: filter by sender\n\tsender: stacksPrincipal.optional(),\n\t// Optional: filter by recipient\n\trecipient: stacksPrincipal.optional(),\n};\n\n// Type exports — defined first so they can annotate schemas\nexport interface StxTransferFilter {\n\ttype: \"stx_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tminAmount?: number;\n\tmaxAmount?: number;\n}\n\nexport interface StxMintFilter {\n\ttype: \"stx_mint\";\n\trecipient?: string;\n\tminAmount?: number;\n}\n\nexport interface StxBurnFilter {\n\ttype: \"stx_burn\";\n\tsender?: string;\n\tminAmount?: number;\n}\n\nexport interface StxLockFilter {\n\ttype: \"stx_lock\";\n\tlockedAddress?: string;\n\tminAmount?: number;\n}\n\nexport interface FtTransferFilter {\n\ttype: \"ft_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface FtMintFilter {\n\ttype: \"ft_mint\";\n\trecipient?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface FtBurnFilter {\n\ttype: \"ft_burn\";\n\tsender?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface NftTransferFilter {\n\ttype: \"nft_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface NftMintFilter {\n\ttype: \"nft_mint\";\n\trecipient?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface NftBurnFilter {\n\ttype: \"nft_burn\";\n\tsender?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface ContractCallFilter {\n\ttype: \"contract_call\";\n\tcontractId?: string;\n\tfunctionName?: string;\n\tcaller?: string;\n}\n\nexport interface ContractDeployFilter {\n\ttype: \"contract_deploy\";\n\tdeployer?: string;\n\tcontractName?: string;\n}\n\nexport interface PrintEventFilter {\n\ttype: \"print_event\";\n\tcontractId?: string;\n\ttopic?: string;\n\tcontains?: string;\n}\n\nexport type
|
|
5
|
+
"import { isValidAddress as _isValidAddress } from \"@secondlayer/stacks\";\nimport { z } from \"zod/v4\";\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\tconst parts = val.split(\".\");\n\tif (parts.length > 2) return false;\n\treturn isValidAddress(parts[0]!);\n}, \"Invalid Stacks principal address\");\n\n// Base filter with common fields\nconst baseFilter = {\n\t// Optional: filter by sender\n\tsender: stacksPrincipal.optional(),\n\t// Optional: filter by recipient\n\trecipient: stacksPrincipal.optional(),\n};\n\n// Type exports — defined first so they can annotate schemas\nexport interface StxTransferFilter {\n\ttype: \"stx_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tminAmount?: number;\n\tmaxAmount?: number;\n}\n\nexport interface StxMintFilter {\n\ttype: \"stx_mint\";\n\trecipient?: string;\n\tminAmount?: number;\n}\n\nexport interface StxBurnFilter {\n\ttype: \"stx_burn\";\n\tsender?: string;\n\tminAmount?: number;\n}\n\nexport interface StxLockFilter {\n\ttype: \"stx_lock\";\n\tlockedAddress?: string;\n\tminAmount?: number;\n}\n\nexport interface FtTransferFilter {\n\ttype: \"ft_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface FtMintFilter {\n\ttype: \"ft_mint\";\n\trecipient?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface FtBurnFilter {\n\ttype: \"ft_burn\";\n\tsender?: string;\n\tassetIdentifier?: string;\n\tminAmount?: number;\n}\n\nexport interface NftTransferFilter {\n\ttype: \"nft_transfer\";\n\tsender?: string;\n\trecipient?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface NftMintFilter {\n\ttype: \"nft_mint\";\n\trecipient?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface NftBurnFilter {\n\ttype: \"nft_burn\";\n\tsender?: string;\n\tassetIdentifier?: string;\n\ttokenId?: string;\n}\n\nexport interface ContractCallFilter {\n\ttype: \"contract_call\";\n\tcontractId?: string;\n\tfunctionName?: string;\n\tcaller?: string;\n}\n\nexport interface ContractDeployFilter {\n\ttype: \"contract_deploy\";\n\tdeployer?: string;\n\tcontractName?: string;\n}\n\nexport interface PrintEventFilter {\n\ttype: \"print_event\";\n\tcontractId?: string;\n\ttopic?: string;\n\tcontains?: string;\n}\n\nexport type EventFilter =\n\t| StxTransferFilter\n\t| StxMintFilter\n\t| StxBurnFilter\n\t| StxLockFilter\n\t| FtTransferFilter\n\t| FtMintFilter\n\t| FtBurnFilter\n\t| NftTransferFilter\n\t| NftMintFilter\n\t| NftBurnFilter\n\t| ContractCallFilter\n\t| ContractDeployFilter\n\t| PrintEventFilter;\n\n// STX Transfer Filter\nexport const StxTransferFilterSchema: z.ZodType<StxTransferFilter> = z.object({\n\ttype: z.literal(\"stx_transfer\"),\n\t...baseFilter,\n\t// Optional: minimum amount in microSTX\n\tminAmount: z.coerce.number().int().positive().optional(),\n\t// Optional: maximum amount in microSTX\n\tmaxAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Mint Filter\nexport const StxMintFilterSchema: z.ZodType<StxMintFilter> = z.object({\n\ttype: z.literal(\"stx_mint\"),\n\trecipient: stacksPrincipal.optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Burn Filter\nexport const StxBurnFilterSchema: z.ZodType<StxBurnFilter> = z.object({\n\ttype: z.literal(\"stx_burn\"),\n\tsender: stacksPrincipal.optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// STX Lock Filter\nexport const StxLockFilterSchema: z.ZodType<StxLockFilter> = z.object({\n\ttype: z.literal(\"stx_lock\"),\n\tlockedAddress: stacksPrincipal.optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Transfer Filter\nexport const FtTransferFilterSchema: z.ZodType<FtTransferFilter> = z.object({\n\ttype: z.literal(\"ft_transfer\"),\n\t...baseFilter,\n\t// Contract that defines the token (e.g., SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx)\n\tassetIdentifier: z.string().optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Mint Filter\nexport const FtMintFilterSchema: z.ZodType<FtMintFilter> = z.object({\n\ttype: z.literal(\"ft_mint\"),\n\trecipient: stacksPrincipal.optional(),\n\tassetIdentifier: z.string().optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// FT Burn Filter\nexport const FtBurnFilterSchema: z.ZodType<FtBurnFilter> = z.object({\n\ttype: z.literal(\"ft_burn\"),\n\tsender: stacksPrincipal.optional(),\n\tassetIdentifier: z.string().optional(),\n\tminAmount: z.coerce.number().int().positive().optional(),\n});\n\n// NFT Transfer Filter\nexport const NftTransferFilterSchema: z.ZodType<NftTransferFilter> = z.object({\n\ttype: z.literal(\"nft_transfer\"),\n\t...baseFilter,\n\tassetIdentifier: z.string().optional(),\n\t// Optional: filter by specific token ID (Clarity value as hex)\n\ttokenId: z.string().optional(),\n});\n\n// NFT Mint Filter\nexport const NftMintFilterSchema: z.ZodType<NftMintFilter> = z.object({\n\ttype: z.literal(\"nft_mint\"),\n\trecipient: stacksPrincipal.optional(),\n\tassetIdentifier: z.string().optional(),\n\ttokenId: z.string().optional(),\n});\n\n// NFT Burn Filter\nexport const NftBurnFilterSchema: z.ZodType<NftBurnFilter> = z.object({\n\ttype: z.literal(\"nft_burn\"),\n\tsender: stacksPrincipal.optional(),\n\tassetIdentifier: z.string().optional(),\n\ttokenId: z.string().optional(),\n});\n\n// Contract Call Filter\nexport const ContractCallFilterSchema: z.ZodType<ContractCallFilter> = z.object(\n\t{\n\t\ttype: z.literal(\"contract_call\"),\n\t\t// Contract being called\n\t\tcontractId: stacksPrincipal.optional(),\n\t\t// Function name (supports wildcards with *)\n\t\tfunctionName: z.string().optional(),\n\t\t// Caller address\n\t\tcaller: stacksPrincipal.optional(),\n\t},\n);\n\n// Contract Deploy Filter\nexport const ContractDeployFilterSchema: z.ZodType<ContractDeployFilter> =\n\tz.object({\n\t\ttype: z.literal(\"contract_deploy\"),\n\t\t// Deployer address\n\t\tdeployer: stacksPrincipal.optional(),\n\t\t// Contract name pattern (supports wildcards)\n\t\tcontractName: z.string().optional(),\n\t});\n\n// Print Event Filter (smart contract events)\nexport const PrintEventFilterSchema: z.ZodType<PrintEventFilter> = z.object({\n\ttype: z.literal(\"print_event\"),\n\t// Contract emitting the event\n\tcontractId: stacksPrincipal.optional(),\n\t// Topic/name of the event\n\ttopic: z.string().optional(),\n\t// Search for substring in event data\n\tcontains: z.string().optional(),\n});\n\n// Union of all filter types\nexport const EventFilterSchema: z.ZodType<EventFilter> = z.discriminatedUnion(\n\t\"type\",\n\t[\n\t\tStxTransferFilterSchema as any,\n\t\tStxMintFilterSchema as any,\n\t\tStxBurnFilterSchema as any,\n\t\tStxLockFilterSchema as any,\n\t\tFtTransferFilterSchema as any,\n\t\tFtMintFilterSchema as any,\n\t\tFtBurnFilterSchema as any,\n\t\tNftTransferFilterSchema as any,\n\t\tNftMintFilterSchema as any,\n\t\tNftBurnFilterSchema as any,\n\t\tContractCallFilterSchema as any,\n\t\tContractDeployFilterSchema as any,\n\t\tPrintEventFilterSchema as any,\n\t],\n);\n",
|
|
6
6
|
"import { z } from \"zod/v4\";\n\n// ── Request Types ────────────────────────────────────────────────────\n\nexport interface PublishSubgraphRequest {\n\ttags?: string[];\n\tdescription?: string;\n}\n\nexport interface UpdateProfileRequest {\n\tdisplay_name?: string;\n\tbio?: string;\n\tslug?: string;\n}\n\nexport interface ForkSubgraphRequest {\n\tsourceSubgraphName: string;\n\tnewName?: string;\n}\n\n// ── Request Schemas ───────────────────────────────────────────────────\n\nexport const PublishSubgraphRequestSchema: z.ZodType<PublishSubgraphRequest> =\n\tz.object({\n\t\ttags: z.array(z.string().max(30)).max(5).optional(),\n\t\tdescription: z.string().max(500).optional(),\n\t});\n\nexport const UpdateProfileRequestSchema: z.ZodType<UpdateProfileRequest> =\n\tz.object({\n\t\tdisplay_name: z.string().max(50).optional(),\n\t\tbio: z.string().max(300).optional(),\n\t\tslug: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.min(3)\n\t\t\t.max(30)\n\t\t\t.optional(),\n\t});\n\nexport const ForkSubgraphRequestSchema: z.ZodType<ForkSubgraphRequest> =\n\tz.object({\n\t\tsourceSubgraphName: z.string(),\n\t\tnewName: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63)\n\t\t\t.optional(),\n\t});\n\n// ── Response Types ────────────────────────────────────────────────────\n\nexport interface MarketplaceCreator {\n\tdisplayName: string | null;\n\tslug: string | null;\n}\n\nexport interface MarketplaceSubgraphSummary {\n\tname: string;\n\tdescription: string | null;\n\ttags: string[];\n\tcreator: MarketplaceCreator;\n\tstatus: string;\n\tversion: string;\n\ttables: string[];\n\ttotalQueries7d: number;\n\tprogress: number;\n\tcreatedAt: string;\n}\n\nexport interface MarketplaceSubgraphDetail extends MarketplaceSubgraphSummary {\n\ttableSchemas: Record<\n\t\tstring,\n\t\t{\n\t\t\tcolumns: Record<string, { type: string; nullable?: boolean }>;\n\t\t\trowCount: number;\n\t\t\tendpoint: string;\n\t\t}\n\t>;\n\tsources: Record<string, unknown>;\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\tforkedFrom: string | null;\n\tusage: {\n\t\ttotalQueries7d: number;\n\t\ttotalQueries30d: number;\n\t\tdaily: Array<{ date: string; count: number }>;\n\t};\n}\n\nexport interface CreatorProfile {\n\tdisplayName: string | null;\n\tbio: string | null;\n\tavatarUrl: string | null;\n\tslug: string | null;\n\tsubgraphs: MarketplaceSubgraphSummary[];\n}\n",
|
|
7
|
-
"import { z } from \"zod/v4\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** @deprecated Use server auto-reindex on breaking changes instead */\n\treindex?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z.record(z.string(), z.record(z.string(), z.unknown())).refine(\n\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\"Must have at least one source\",\n\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\treindex: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tprogress: number;\n\tgapCount: number;\n\tintegrity: \"complete\" | \"gaps_detected\";\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\tchainTip: number;\n\tblocksRemaining: number;\n\tprogress: number;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\tintegrity: \"complete\" | \"gaps_detected\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<string, { type: string; nullable?: boolean }>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n"
|
|
8
|
-
"import { z } from \"zod/v4\";\nimport { type StreamFilter, StreamFilterSchema } from \"./filters.ts\";\n\n// ── Type interfaces ──────────────────────────────────────────────────\n\nexport interface StreamOptions {\n\tdecodeClarityValues: boolean;\n\tincludeRawTx: boolean;\n\tincludeBlockMetadata: boolean;\n\trateLimit: number;\n\ttimeoutMs: number;\n\tmaxRetries: number;\n}\n\nexport interface CreateStream {\n\tname: string;\n\tendpointUrl: string;\n\tfilters: StreamFilter[];\n\toptions?: StreamOptions;\n\tstartBlock?: number;\n\tendBlock?: number;\n}\n\nexport interface UpdateStream {\n\tname?: string;\n\tendpointUrl?: string;\n\tfilters?: StreamFilter[];\n\toptions?: Partial<StreamOptions>;\n}\n\nexport interface DeliveryPayload {\n\tstreamId: string;\n\tstreamName: string;\n\tblock: {\n\t\theight: number;\n\t\thash: string;\n\t\tparentHash: string;\n\t\tburnBlockHeight: number;\n\t\ttimestamp: number;\n\t};\n\tmatches: {\n\t\ttransactions: Array<{\n\t\t\ttxId: string;\n\t\t\ttype: string;\n\t\t\tsender: string;\n\t\t\tstatus: string;\n\t\t\tcontractId: string | null;\n\t\t\tfunctionName: string | null;\n\t\t\trawTx?: string;\n\t\t}>;\n\t\tevents: Array<{\n\t\t\ttxId: string;\n\t\t\teventIndex: number;\n\t\t\ttype: string;\n\t\t\tdata?: any;\n\t\t}>;\n\t};\n\tisBackfill: boolean;\n\tdeliveredAt: string;\n}\n\nexport interface StreamMetricsResponse {\n\ttotalDeliveries: number;\n\tfailedDeliveries: number;\n\tlastTriggeredAt: string | null;\n\tlastTriggeredBlock: number | null;\n\terrorMessage: string | null;\n}\n\nexport interface StreamResponse {\n\tid: string;\n\tname: string;\n\tstatus: \"inactive\" | \"active\" | \"paused\" | \"failed\";\n\tendpointUrl: string;\n\tfilters: StreamFilter[];\n\toptions: StreamOptions;\n\ttotalDeliveries: number;\n\tfailedDeliveries: number;\n\tlastTriggeredAt?: string | null;\n\tlastTriggeredBlock?: number | null;\n\terrorMessage?: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\n// ── Zod schemas ──────────────────────────────────────────────────────\n\n// Stream options schema (internal, keeps ZodObject methods like .partial())\nconst streamOptionsShape = z.object({\n\tdecodeClarityValues: z.boolean().default(true),\n\tincludeRawTx: z.boolean().default(false),\n\tincludeBlockMetadata: z.boolean().default(true),\n\trateLimit: z.number().int().positive().max(100).default(10),\n\ttimeoutMs: z.number().int().positive().max(30000).default(10000),\n\tmaxRetries: 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\tstreamOptionsShape as unknown as z.ZodType<StreamOptions>;\n\nexport const CreateStreamSchema: z.ZodType<CreateStream> = z.object({\n\tname: z.string().min(1).max(255),\n\tendpointUrl: z.string().url(),\n\tfilters: z.array(StreamFilterSchema).min(1),\n\toptions: streamOptionsShape.optional(),\n\tstartBlock: z.number().int().positive().optional(),\n\tendBlock: z.number().int().positive().optional(),\n}) as unknown as z.ZodType<CreateStream>;\n\nexport const UpdateStreamSchema: z.ZodType<UpdateStream> = z\n\t.object({\n\t\tname: z.string().min(1).max(255).optional(),\n\t\tendpointUrl: z.string().url().optional(),\n\t\tfilters: z.array(StreamFilterSchema).min(1).optional(),\n\t\toptions: streamOptionsShape.partial().optional(),\n\t})\n\t.refine((data) => Object.keys(data).length > 0, {\n\t\tmessage: \"At least one field must be provided for update\",\n\t}) as unknown as z.ZodType<UpdateStream>;\n\nexport const DeliveryPayloadSchema: z.ZodType<DeliveryPayload> = z.object({\n\tstreamId: z.string().uuid(),\n\tstreamName: z.string(),\n\tblock: z.object({\n\t\theight: z.number(),\n\t\thash: z.string(),\n\t\tparentHash: z.string(),\n\t\tburnBlockHeight: z.number(),\n\t\ttimestamp: z.number(),\n\t}),\n\tmatches: z.object({\n\t\ttransactions: z.array(\n\t\t\tz.object({\n\t\t\t\ttxId: z.string(),\n\t\t\t\ttype: z.string(),\n\t\t\t\tsender: z.string(),\n\t\t\t\tstatus: z.string(),\n\t\t\t\tcontractId: z.string().nullable(),\n\t\t\t\tfunctionName: z.string().nullable(),\n\t\t\t\trawTx: z.string().optional(),\n\t\t\t}),\n\t\t),\n\t\tevents: z.array(\n\t\t\tz.object({\n\t\t\t\ttxId: z.string(),\n\t\t\t\teventIndex: z.number(),\n\t\t\t\ttype: z.string(),\n\t\t\t\tdata: z.any(),\n\t\t\t}),\n\t\t),\n\t}),\n\tisBackfill: z.boolean(),\n\tdeliveredAt: z.string().datetime(),\n}) as unknown as z.ZodType<DeliveryPayload>;\n\nexport const StreamMetricsSchema: z.ZodType<StreamMetricsResponse> = z.object({\n\ttotalDeliveries: z.number(),\n\tfailedDeliveries: z.number(),\n\tlastTriggeredAt: z.string().datetime().nullable(),\n\tlastTriggeredBlock: z.number().nullable(),\n\terrorMessage: z.string().nullable(),\n});\n\nexport const StreamResponseSchema: z.ZodType<StreamResponse> = z.object({\n\tid: z.string().uuid(),\n\tname: z.string(),\n\tstatus: z.enum([\"inactive\", \"active\", \"paused\", \"failed\"]),\n\tendpointUrl: z.string().url(),\n\tfilters: z.array(StreamFilterSchema),\n\toptions: streamOptionsShape,\n\ttotalDeliveries: z.number().int().default(0),\n\tfailedDeliveries: z.number().int().default(0),\n\tlastTriggeredAt: z.string().datetime().nullable().optional(),\n\tlastTriggeredBlock: z.number().int().nullable().optional(),\n\terrorMessage: z.string().nullable().optional(),\n\tcreatedAt: z.string().datetime(),\n\tupdatedAt: z.string().datetime(),\n}) as unknown as z.ZodType<StreamResponse>;\n\n// API response types\nexport interface CreateStreamResponse {\n\tstream: StreamResponse;\n\tsigningSecret: string;\n}\n\nexport interface ListStreamsResponse {\n\tstreams: StreamResponse[];\n\ttotal: number;\n}\n\nexport interface BulkPauseResponse {\n\tpaused: number;\n\tstreams: StreamResponse[];\n}\n\nexport interface BulkResumeResponse {\n\tresumed: number;\n\tstreams: StreamResponse[];\n}\n"
|
|
7
|
+
"import { z } from \"zod/v4\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** @deprecated Use server auto-reindex on breaking changes instead */\n\treindex?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\treindex: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tprogress: number;\n\tgapCount: number;\n\tintegrity: \"complete\" | \"gaps_detected\";\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\tchainTip: number;\n\tblocksRemaining: number;\n\tprogress: number;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\tintegrity: \"complete\" | \"gaps_detected\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<string, { type: string; nullable?: boolean }>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n"
|
|
9
8
|
],
|
|
10
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA,2BAAS;AACT;AAEA,IAAM,iBAAiB;AAGvB,IAAM,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ;AAAA,EAClD,MAAM,QAAQ,IAAI,MAAM,GAAG;AAAA,EAC3B,IAAI,MAAM,SAAS;AAAA,IAAG,OAAO;AAAA,EAC7B,OAAO,eAAe,MAAM,EAAG;AAAA,GAC7B,kCAAkC;AAGrC,IAAM,aAAa;AAAA,EAElB,QAAQ,gBAAgB,SAAS;AAAA,EAEjC,WAAW,gBAAgB,SAAS;AACrC;AA6GO,IAAM,0BAAwD,EAAE,OAAO;AAAA,EAC7E,MAAM,EAAE,QAAQ,cAAc;AAAA,KAC3B;AAAA,EAEH,WAAW,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE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C,EACL,IAAI,EAAE,EACN,SAAS;AACZ,CAAC;AAEK,IAAM,4BACZ,GAAE,OAAO;AAAA,EACR,oBAAoB,GAAE,OAAO;AAAA,EAC7B,SAAS,GACP,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE,EACN,SAAS;AACZ,CAAC;;;AChDF,cAAS;AAiBF,IAAM,8BACZ,GAAE,OAAO;AAAA,EACR,MAAM,GACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE;AAAA,EACR,SAAS,GAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,GAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,GACP,OAAO,GAAE,OAAO,GAAG,GAAE,OAAO,GAAE,OAAO,GAAG,GAAE,QAAQ,CAAC,CAAC,EACpD,OACA,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,SAAS,GAC/B,+BACD;AAAA,EACD,QAAQ,GAAE,OAAO,GAAE,OAAO,GAAG,GAAE,QAAQ,CAAC;AAAA,EACxC,aAAa,GAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,GACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,SAAS,GAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;",
|
|
10
|
+
"debugId": "5D7DE4BF80FFC83364756E2164756E21",
|
|
12
11
|
"names": []
|
|
13
12
|
}
|
|
@@ -6,6 +6,8 @@ interface DeploySubgraphRequest {
|
|
|
6
6
|
sources: Record<string, Record<string, unknown>>;
|
|
7
7
|
schema: Record<string, unknown>;
|
|
8
8
|
handlerCode: string;
|
|
9
|
+
/** Original TypeScript source, persisted so chat can read/diff/edit later. */
|
|
10
|
+
sourceCode?: string;
|
|
9
11
|
/** @deprecated Use server auto-reindex on breaking changes instead */
|
|
10
12
|
reindex?: boolean;
|
|
11
13
|
}
|
|
@@ -23,11 +23,12 @@ var DeploySubgraphRequestSchema = z.object({
|
|
|
23
23
|
sources: z.record(z.string(), z.record(z.string(), z.unknown())).refine((s) => Object.keys(s).length > 0, "Must have at least one source"),
|
|
24
24
|
schema: z.record(z.string(), z.unknown()),
|
|
25
25
|
handlerCode: z.string().max(1048576, "handler code exceeds 1MB limit"),
|
|
26
|
+
sourceCode: z.string().max(1048576, "source code exceeds 1MB limit").optional(),
|
|
26
27
|
reindex: z.boolean().optional()
|
|
27
28
|
});
|
|
28
29
|
export {
|
|
29
30
|
DeploySubgraphRequestSchema
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
//# debugId=
|
|
33
|
+
//# debugId=11DD6347CDD5FD4D64756E2164756E21
|
|
33
34
|
//# sourceMappingURL=subgraphs.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/schemas/subgraphs.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod/v4\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** @deprecated Use server auto-reindex on breaking changes instead */\n\treindex?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z.record(z.string(), z.record(z.string(), z.unknown())).refine(\n\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\"Must have at least one source\",\n\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\treindex: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tprogress: number;\n\tgapCount: number;\n\tintegrity: \"complete\" | \"gaps_detected\";\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\tchainTip: number;\n\tblocksRemaining: number;\n\tprogress: number;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\tintegrity: \"complete\" | \"gaps_detected\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<string, { type: string; nullable?: boolean }>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n"
|
|
5
|
+
"import { z } from \"zod/v4\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** @deprecated Use server auto-reindex on breaking changes instead */\n\treindex?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\treindex: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tprogress: number;\n\tgapCount: number;\n\tintegrity: \"complete\" | \"gaps_detected\";\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\tchainTip: number;\n\tblocksRemaining: number;\n\tprogress: number;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\tintegrity: \"complete\" | \"gaps_detected\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<string, { type: string; nullable?: boolean }>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAiBO,IAAM,8BACZ,EAAE,OAAO;AAAA,EACR,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE;AAAA,EACR,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,EACP,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACpD,OACA,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,SAAS,GAC/B,+BACD;AAAA,EACD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,EACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,SAAS,EAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;",
|
|
8
|
+
"debugId": "11DD6347CDD5FD4D64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -3,6 +3,10 @@ interface DeployWorkflowRequest {
|
|
|
3
3
|
name: string;
|
|
4
4
|
trigger: Record<string, unknown>;
|
|
5
5
|
handlerCode: string;
|
|
6
|
+
sourceCode?: string;
|
|
7
|
+
expectedVersion?: string;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
clientRequestId?: string;
|
|
6
10
|
retries?: {
|
|
7
11
|
maxAttempts?: number
|
|
8
12
|
backoffMs?: number
|
|
@@ -20,6 +20,10 @@ var DeployWorkflowRequestSchema = z.object({
|
|
|
20
20
|
name: z.string().regex(/^[a-z][a-z0-9-]*$/, "lowercase alphanumeric + hyphens, must start with letter").max(63),
|
|
21
21
|
trigger: z.record(z.string(), z.unknown()),
|
|
22
22
|
handlerCode: z.string().max(1048576, "handler code exceeds 1MB limit"),
|
|
23
|
+
sourceCode: z.string().max(1048576, "source code exceeds 1MB limit").optional(),
|
|
24
|
+
expectedVersion: z.string().regex(/^\d+\.\d+\.\d+$/, "expectedVersion must be semver major.minor.patch").optional(),
|
|
25
|
+
dryRun: z.boolean().optional(),
|
|
26
|
+
clientRequestId: z.string().min(1).max(128).optional(),
|
|
23
27
|
retries: z.object({
|
|
24
28
|
maxAttempts: z.number().int().positive().optional(),
|
|
25
29
|
backoffMs: z.number().int().nonnegative().optional(),
|
|
@@ -35,5 +39,5 @@ export {
|
|
|
35
39
|
DeployWorkflowRequestSchema
|
|
36
40
|
};
|
|
37
41
|
|
|
38
|
-
//# debugId=
|
|
42
|
+
//# debugId=A794F86EA1C2BE6464756E2164756E21
|
|
39
43
|
//# sourceMappingURL=workflows.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/schemas/workflows.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod/v4\";\n\n// ── Deploy Workflow Request ──────────────────────────────────────────\n\nexport interface DeployWorkflowRequest {\n\tname: string;\n\ttrigger: Record<string, unknown>;\n\thandlerCode: string;\n\tretries?: {
|
|
5
|
+
"import { z } from \"zod/v4\";\n\n// ── Deploy Workflow Request ──────────────────────────────────────────\n\nexport interface DeployWorkflowRequest {\n\tname: string;\n\ttrigger: Record<string, unknown>;\n\thandlerCode: string;\n\tsourceCode?: string;\n\texpectedVersion?: string;\n\tdryRun?: boolean;\n\tclientRequestId?: string;\n\tretries?: {\n\t\tmaxAttempts?: number;\n\t\tbackoffMs?: number;\n\t\tbackoffMultiplier?: number;\n\t};\n\ttimeout?: number;\n}\n\nexport const DeployWorkflowRequestSchema: z.ZodType<DeployWorkflowRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(\n\t\t\t\t/^[a-z][a-z0-9-]*$/,\n\t\t\t\t\"lowercase alphanumeric + hyphens, must start with letter\",\n\t\t\t)\n\t\t\t.max(63),\n\t\ttrigger: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\texpectedVersion: z\n\t\t\t.string()\n\t\t\t.regex(\n\t\t\t\t/^\\d+\\.\\d+\\.\\d+$/,\n\t\t\t\t\"expectedVersion must be semver major.minor.patch\",\n\t\t\t)\n\t\t\t.optional(),\n\t\tdryRun: z.boolean().optional(),\n\t\tclientRequestId: z.string().min(1).max(128).optional(),\n\t\tretries: z\n\t\t\t.object({\n\t\t\t\tmaxAttempts: z.number().int().positive().optional(),\n\t\t\t\tbackoffMs: z.number().int().nonnegative().optional(),\n\t\t\t\tbackoffMultiplier: z.number().positive().optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\ttimeout: z.number().int().positive().optional(),\n\t});\n\nexport interface DeployWorkflowResponse {\n\taction: \"created\" | \"updated\";\n\tworkflowId: string;\n\tmessage: string;\n}\n\n// ── API Response Types ───────────────────────────────────────────────\n\nexport interface WorkflowSummaryResponse {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\ttriggerType: string;\n\ttotalRuns: number;\n\tlastRunAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface WorkflowDetailResponse extends WorkflowSummaryResponse {\n\ttriggerConfig: Record<string, unknown>;\n\tretriesConfig: Record<string, unknown> | null;\n\ttimeoutMs: number | null;\n}\n\nexport interface WorkflowRunResponse {\n\tid: string;\n\tworkflowName: string;\n\tstatus: string;\n\ttriggerType: string;\n\ttriggerData: Record<string, unknown> | null;\n\terror: string | null;\n\tstartedAt: string | null;\n\tcompletedAt: string | null;\n\tdurationMs: number | null;\n\ttotalAiTokens: number;\n\tcreatedAt: string;\n\tsteps: WorkflowStepResponse[];\n}\n\nexport interface WorkflowStepResponse {\n\tid: string;\n\tstepIndex: number;\n\tstepId: string;\n\tstepType: string;\n\tstatus: string;\n\toutput: unknown | null;\n\terror: string | null;\n\tretryCount: number;\n\taiTokensUsed: number;\n\tstartedAt: string | null;\n\tcompletedAt: string | null;\n\tdurationMs: number | null;\n}\n\nexport interface TriggerWorkflowRequest {\n\tinput?: Record<string, unknown>;\n}\n\nexport const TriggerWorkflowRequestSchema: z.ZodType<TriggerWorkflowRequest> =\n\tz.object({\n\t\tinput: z.record(z.string(), z.unknown()).optional(),\n\t});\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAoBO,IAAM,8BACZ,EAAE,OAAO;AAAA,EACR,MAAM,EACJ,OAAO,EACP,MACA,qBACA,0DACD,EACC,IAAI,EAAE;AAAA,EACR,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAAA,EACzC,aAAa,EAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,EACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,iBAAiB,EACf,OAAO,EACP,MACA,mBACA,kDACD,EACC,SAAS;AAAA,EACX,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EACrD,SAAS,EACP,OAAO;AAAA,IACP,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,IAClD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,IACnD,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,CAAC,EACA,SAAS;AAAA,EACX,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAC/C,CAAC;AA6DK,IAAM,+BACZ,EAAE,OAAO;AAAA,EACR,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS;AACnD,CAAC;",
|
|
8
|
+
"debugId": "A794F86EA1C2BE6464756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -31,32 +31,6 @@ interface EventsTable {
|
|
|
31
31
|
data: unknown;
|
|
32
32
|
created_at: Generated<Date>;
|
|
33
33
|
}
|
|
34
|
-
interface StreamsTable {
|
|
35
|
-
id: Generated<string>;
|
|
36
|
-
name: string;
|
|
37
|
-
status: Generated<string>;
|
|
38
|
-
filters: unknown;
|
|
39
|
-
options: Generated<unknown>;
|
|
40
|
-
endpoint_url: string;
|
|
41
|
-
signing_secret: string | null;
|
|
42
|
-
api_key_id: string;
|
|
43
|
-
project_id: string | null;
|
|
44
|
-
created_at: Generated<Date>;
|
|
45
|
-
updated_at: Generated<Date>;
|
|
46
|
-
}
|
|
47
|
-
interface JobsTable {
|
|
48
|
-
id: Generated<string>;
|
|
49
|
-
stream_id: string;
|
|
50
|
-
block_height: number;
|
|
51
|
-
status: Generated<string>;
|
|
52
|
-
attempts: Generated<number>;
|
|
53
|
-
locked_at: Date | null;
|
|
54
|
-
locked_by: string | null;
|
|
55
|
-
error: string | null;
|
|
56
|
-
backfill: Generated<boolean>;
|
|
57
|
-
created_at: Generated<Date>;
|
|
58
|
-
completed_at: Date | null;
|
|
59
|
-
}
|
|
60
34
|
interface IndexProgressTable {
|
|
61
35
|
network: string;
|
|
62
36
|
last_indexed_block: Generated<number>;
|
|
@@ -64,33 +38,14 @@ interface IndexProgressTable {
|
|
|
64
38
|
highest_seen_block: Generated<number>;
|
|
65
39
|
updated_at: Generated<Date>;
|
|
66
40
|
}
|
|
67
|
-
interface DeliveriesTable {
|
|
68
|
-
id: Generated<string>;
|
|
69
|
-
stream_id: string;
|
|
70
|
-
job_id: string | null;
|
|
71
|
-
block_height: number;
|
|
72
|
-
status: string;
|
|
73
|
-
status_code: number | null;
|
|
74
|
-
response_time_ms: number | null;
|
|
75
|
-
attempts: Generated<number>;
|
|
76
|
-
error: string | null;
|
|
77
|
-
payload: unknown;
|
|
78
|
-
created_at: Generated<Date>;
|
|
79
|
-
}
|
|
80
41
|
type Block = Selectable<BlocksTable>;
|
|
81
42
|
type InsertBlock = Insertable<BlocksTable>;
|
|
82
43
|
type Transaction = Selectable<TransactionsTable>;
|
|
83
44
|
type InsertTransaction = Insertable<TransactionsTable>;
|
|
84
45
|
type Event = Selectable<EventsTable>;
|
|
85
46
|
type InsertEvent = Insertable<EventsTable>;
|
|
86
|
-
type Stream = Selectable<StreamsTable>;
|
|
87
|
-
type InsertStream = Insertable<StreamsTable>;
|
|
88
|
-
type Job = Selectable<JobsTable>;
|
|
89
|
-
type InsertJob = Insertable<JobsTable>;
|
|
90
47
|
type IndexProgress = Selectable<IndexProgressTable>;
|
|
91
48
|
type InsertIndexProgress = Insertable<IndexProgressTable>;
|
|
92
|
-
type Delivery = Selectable<DeliveriesTable>;
|
|
93
|
-
type InsertDelivery = Insertable<DeliveriesTable>;
|
|
94
49
|
interface EnvSchemaOutput {
|
|
95
50
|
DATABASE_URL?: string;
|
|
96
51
|
NETWORK?: "mainnet" | "testnet";
|
|
@@ -101,11 +56,4 @@ interface EnvSchemaOutput {
|
|
|
101
56
|
type Env = EnvSchemaOutput & {
|
|
102
57
|
enabledNetworks: ("mainnet" | "testnet")[]
|
|
103
58
|
};
|
|
104
|
-
|
|
105
|
-
pending: number;
|
|
106
|
-
processing: number;
|
|
107
|
-
completed: number;
|
|
108
|
-
failed: number;
|
|
109
|
-
total: number;
|
|
110
|
-
}
|
|
111
|
-
export { Transaction, Stream, QueueStats, Job, InsertTransaction, InsertStream, InsertJob, InsertIndexProgress, InsertEvent, InsertDelivery, InsertBlock, IndexProgress, Event, Env, Delivery, Block };
|
|
59
|
+
export { Transaction, InsertTransaction, InsertIndexProgress, InsertEvent, InsertBlock, IndexProgress, Event, Env, Block };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Store the original TypeScript source of a workflow definition alongside
|
|
5
|
+
* the bundled handler so agents can read, diff, and edit workflows in chat
|
|
6
|
+
* without re-hydrating from a file. Nullable: rows deployed before this
|
|
7
|
+
* migration remain read-only until their next redeploy.
|
|
8
|
+
*/
|
|
9
|
+
export async function up(db: Kysely<any>): Promise<void> {
|
|
10
|
+
await db.schema
|
|
11
|
+
.alterTable("workflow_definitions")
|
|
12
|
+
.addColumn("source_code", "text")
|
|
13
|
+
.execute();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function down(db: Kysely<any>): Promise<void> {
|
|
17
|
+
await db.schema
|
|
18
|
+
.alterTable("workflow_definitions")
|
|
19
|
+
.dropColumn("source_code")
|
|
20
|
+
.execute();
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Store the original TypeScript source of a subgraph alongside the bundled
|
|
5
|
+
* handler so agents can read, diff, and edit subgraphs in chat without
|
|
6
|
+
* re-hydrating from a file. Nullable: rows deployed before this migration
|
|
7
|
+
* remain read-only until their next redeploy.
|
|
8
|
+
*/
|
|
9
|
+
export async function up(db: Kysely<any>): Promise<void> {
|
|
10
|
+
await db.schema
|
|
11
|
+
.alterTable("subgraphs")
|
|
12
|
+
.addColumn("source_code", "text")
|
|
13
|
+
.execute();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function down(db: Kysely<any>): Promise<void> {
|
|
17
|
+
await db.schema.alterTable("subgraphs").dropColumn("source_code").execute();
|
|
18
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Kysely, Sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Migration: Drop streams feature tables
|
|
5
|
+
*
|
|
6
|
+
* This migration removes the entire streams feature from the database.
|
|
7
|
+
* Tables are dropped in dependency order (child tables first):
|
|
8
|
+
* 1. deliveries (references jobs and streams)
|
|
9
|
+
* 2. jobs (references streams)
|
|
10
|
+
* 3. stream_metrics (references streams)
|
|
11
|
+
* 4. streams (main table)
|
|
12
|
+
*
|
|
13
|
+
* Note: This is a destructive migration. All stream data will be lost.
|
|
14
|
+
* Ensure you have a backup if you need to preserve historical data.
|
|
15
|
+
*
|
|
16
|
+
* Associated code changes:
|
|
17
|
+
* - PG NOTIFY channel renamed from "streams:new_job" to "indexer:new_block"
|
|
18
|
+
* (used by workflow-runner and subgraph processor for block notifications)
|
|
19
|
+
*/
|
|
20
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
21
|
+
// Drop child tables first (in dependency order)
|
|
22
|
+
|
|
23
|
+
// Drop deliveries table
|
|
24
|
+
await db.schema.dropTable("deliveries").ifExists().execute();
|
|
25
|
+
|
|
26
|
+
// Drop jobs table
|
|
27
|
+
await db.schema.dropTable("jobs").ifExists().execute();
|
|
28
|
+
|
|
29
|
+
// Drop stream_metrics table
|
|
30
|
+
await db.schema.dropTable("stream_metrics").ifExists().execute();
|
|
31
|
+
|
|
32
|
+
// Drop main streams table
|
|
33
|
+
await db.schema.dropTable("streams").ifExists().execute();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function down(_db: Kysely<Sql>): Promise<void> {
|
|
37
|
+
// Restoration not supported - this is a destructive migration
|
|
38
|
+
// To restore, you'd need to re-run the initial migration that created these tables
|
|
39
|
+
throw new Error(
|
|
40
|
+
"Down migration not supported for streams table removal. " +
|
|
41
|
+
"To restore, restore from a backup or recreate the streams feature."
|
|
42
|
+
);
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -17,10 +17,6 @@
|
|
|
17
17
|
"types": "./dist/src/db/queries/integrity.d.ts",
|
|
18
18
|
"import": "./dist/src/db/queries/integrity.js"
|
|
19
19
|
},
|
|
20
|
-
"./db/queries/metrics": {
|
|
21
|
-
"types": "./dist/src/db/queries/metrics.d.ts",
|
|
22
|
-
"import": "./dist/src/db/queries/metrics.js"
|
|
23
|
-
},
|
|
24
20
|
"./db/queries/accounts": {
|
|
25
21
|
"types": "./dist/src/db/queries/accounts.d.ts",
|
|
26
22
|
"import": "./dist/src/db/queries/accounts.js"
|
|
@@ -49,18 +45,10 @@
|
|
|
49
45
|
"types": "./dist/src/lib/plans.d.ts",
|
|
50
46
|
"import": "./dist/src/lib/plans.js"
|
|
51
47
|
},
|
|
52
|
-
"./queue": {
|
|
53
|
-
"types": "./dist/src/queue/index.d.ts",
|
|
54
|
-
"import": "./dist/src/queue/index.js"
|
|
55
|
-
},
|
|
56
48
|
"./queue/listener": {
|
|
57
49
|
"types": "./dist/src/queue/listener.d.ts",
|
|
58
50
|
"import": "./dist/src/queue/listener.js"
|
|
59
51
|
},
|
|
60
|
-
"./queue/recovery": {
|
|
61
|
-
"types": "./dist/src/queue/recovery.d.ts",
|
|
62
|
-
"import": "./dist/src/queue/recovery.js"
|
|
63
|
-
},
|
|
64
52
|
"./schemas": {
|
|
65
53
|
"types": "./dist/src/schemas/index.d.ts",
|
|
66
54
|
"import": "./dist/src/schemas/index.js"
|
|
@@ -156,7 +144,7 @@
|
|
|
156
144
|
"test": "bun test",
|
|
157
145
|
"typecheck": "tsc --noEmit",
|
|
158
146
|
"migrate": "bun run src/db/migrate.ts",
|
|
159
|
-
"seed": "DATABASE_URL=${DATABASE_URL:-postgresql://ryanwaits@127.0.0.1:5432/
|
|
147
|
+
"seed": "DATABASE_URL=${DATABASE_URL:-postgresql://ryanwaits@127.0.0.1:5432/secondlayer_dev} bun run src/db/seed.ts",
|
|
160
148
|
"prepublishOnly": "bun run build"
|
|
161
149
|
},
|
|
162
150
|
"dependencies": {
|