@secondlayer/shared 6.6.0 → 6.8.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 (33) hide show
  1. package/README.md +9 -12
  2. package/dist/src/db/index.d.ts +3 -0
  3. package/dist/src/db/queries/chain-reorgs.d.ts +3 -0
  4. package/dist/src/db/queries/integrity.d.ts +3 -0
  5. package/dist/src/db/queries/subgraph-gaps.d.ts +3 -0
  6. package/dist/src/db/queries/subgraph-operations.d.ts +3 -0
  7. package/dist/src/db/queries/subgraphs.d.ts +3 -0
  8. package/dist/src/db/queries/subscriptions.d.ts +3 -0
  9. package/dist/src/db/schema.d.ts +3 -0
  10. package/dist/src/index.d.ts +32 -42
  11. package/dist/src/index.js +94 -103
  12. package/dist/src/index.js.map +3 -4
  13. package/dist/src/node/local-client.d.ts +3 -0
  14. package/dist/src/schemas/index.d.ts +29 -42
  15. package/dist/src/schemas/index.js +94 -103
  16. package/dist/src/schemas/index.js.map +3 -4
  17. package/migrations/0079_decoded_events_payload.ts +12 -0
  18. package/package.json +1 -21
  19. package/dist/src/db/queries/account-spend-caps.d.ts +0 -729
  20. package/dist/src/db/queries/account-spend-caps.js +0 -59
  21. package/dist/src/db/queries/account-spend-caps.js.map +0 -10
  22. package/dist/src/db/queries/accounts.d.ts +0 -741
  23. package/dist/src/db/queries/accounts.js +0 -86
  24. package/dist/src/db/queries/accounts.js.map +0 -10
  25. package/dist/src/db/queries/projects.d.ts +0 -722
  26. package/dist/src/db/queries/projects.js +0 -47
  27. package/dist/src/db/queries/projects.js.map +0 -10
  28. package/dist/src/db/queries/usage.d.ts +0 -731
  29. package/dist/src/db/queries/usage.js +0 -109
  30. package/dist/src/db/queries/usage.js.map +0 -10
  31. package/dist/src/schemas/accounts.d.ts +0 -14
  32. package/dist/src/schemas/accounts.js +0 -29
  33. package/dist/src/schemas/accounts.js.map +0 -10
package/README.md CHANGED
@@ -22,22 +22,19 @@ DATABASE_URL=... bun run migrate
22
22
 
23
23
  | Path | Description |
24
24
  |------|-------------|
25
- | `@secondlayer/shared` | Core utilities |
25
+ | `@secondlayer/shared` | Core utilities (errors, logger, env, db layer, subgraph/subscription schemas) |
26
26
  | `@secondlayer/shared/db` | Kysely database layer |
27
- | `@secondlayer/shared/db/queries/*` | Query helpers (integrity, accounts, usage, subgraphs, projects, subgraph-gaps, tenants, provisioning-audit) |
28
- | `@secondlayer/shared/db/schema` | Database schema |
29
- | `@secondlayer/shared/db/jsonb` | JSONB helpers |
30
- | `@secondlayer/shared/schemas` | Zod schemas |
31
- | `@secondlayer/shared/schemas/accounts` | Account profile schemas |
32
- | `@secondlayer/shared/schemas/filters` | Event filter schemas |
27
+ | `@secondlayer/shared/db/schema` | Database schema + row types |
28
+ | `@secondlayer/shared/db/queries/*` | Query helpers (integrity, chain-reorgs, subgraphs, subgraph-gaps, subgraph-operations, subscriptions) |
29
+ | `@secondlayer/shared/schemas` | Zod schemas (subgraphs, subscriptions) |
33
30
  | `@secondlayer/shared/schemas/subgraphs` | Subgraph schemas |
34
- | `@secondlayer/shared/types` | Shared TypeScript types |
31
+ | `@secondlayer/shared/schemas/subscriptions` | Subscription schemas |
32
+ | `@secondlayer/shared/subgraphs/spec` | Subgraph spec generation |
35
33
  | `@secondlayer/shared/queue/listener` | Postgres LISTEN/NOTIFY helper (used for block notifications) |
36
- | `@secondlayer/shared/env` | Environment config |
37
34
  | `@secondlayer/shared/logger` | Logger |
38
35
  | `@secondlayer/shared/errors` | Error types |
39
- | `@secondlayer/shared/crypto` | HMAC helpers, Standard Webhooks signing, AES-GCM secret envelope |
40
- | `@secondlayer/shared/pricing` | Plan definitions + billing helpers |
41
36
  | `@secondlayer/shared/mode` | INSTANCE_MODE dispatch (platform / dedicated / oss) |
37
+ | `@secondlayer/shared/crypto/secrets` | AES-GCM secret envelope |
38
+ | `@secondlayer/shared/crypto/standard-webhooks` | Standard Webhooks signing |
42
39
  | `@secondlayer/shared/node` | Stacks node client |
43
- | `@secondlayer/shared/node/hiro-pg-client` | Direct PG queries against Hiro DB |
40
+ | `@secondlayer/shared/node/*` | Stacks node clients (hiro-client, local-client, hiro-pg-client, archive-client) |
@@ -305,6 +305,9 @@ interface DecodedEventsTable {
305
305
  asset_identifier: string | null;
306
306
  value: string | null;
307
307
  memo: string | null;
308
+ /** Decoded payload for event types that don't fit the flat columns
309
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
310
+ payload: unknown | null;
308
311
  source_cursor: string;
309
312
  created_at: Generated<Date>;
310
313
  }
@@ -286,6 +286,9 @@ interface DecodedEventsTable {
286
286
  asset_identifier: string | null;
287
287
  value: string | null;
288
288
  memo: string | null;
289
+ /** Decoded payload for event types that don't fit the flat columns
290
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
291
+ payload: unknown | null;
289
292
  source_cursor: string;
290
293
  created_at: Generated<Date>;
291
294
  }
@@ -287,6 +287,9 @@ interface DecodedEventsTable {
287
287
  asset_identifier: string | null;
288
288
  value: string | null;
289
289
  memo: string | null;
290
+ /** Decoded payload for event types that don't fit the flat columns
291
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
292
+ payload: unknown | null;
290
293
  source_cursor: string;
291
294
  created_at: Generated<Date>;
292
295
  }
@@ -287,6 +287,9 @@ interface DecodedEventsTable {
287
287
  asset_identifier: string | null;
288
288
  value: string | null;
289
289
  memo: string | null;
290
+ /** Decoded payload for event types that don't fit the flat columns
291
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
292
+ payload: unknown | null;
290
293
  source_cursor: string;
291
294
  created_at: Generated<Date>;
292
295
  }
@@ -287,6 +287,9 @@ interface DecodedEventsTable {
287
287
  asset_identifier: string | null;
288
288
  value: string | null;
289
289
  memo: string | null;
290
+ /** Decoded payload for event types that don't fit the flat columns
291
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
292
+ payload: unknown | null;
290
293
  source_cursor: string;
291
294
  created_at: Generated<Date>;
292
295
  }
@@ -287,6 +287,9 @@ interface DecodedEventsTable {
287
287
  asset_identifier: string | null;
288
288
  value: string | null;
289
289
  memo: string | null;
290
+ /** Decoded payload for event types that don't fit the flat columns
291
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
292
+ payload: unknown | null;
290
293
  source_cursor: string;
291
294
  created_at: Generated<Date>;
292
295
  }
@@ -287,6 +287,9 @@ interface DecodedEventsTable {
287
287
  asset_identifier: string | null;
288
288
  value: string | null;
289
289
  memo: string | null;
290
+ /** Decoded payload for event types that don't fit the flat columns
291
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
292
+ payload: unknown | null;
290
293
  source_cursor: string;
291
294
  created_at: Generated<Date>;
292
295
  }
@@ -286,6 +286,9 @@ interface DecodedEventsTable {
286
286
  asset_identifier: string | null;
287
287
  value: string | null;
288
288
  memo: string | null;
289
+ /** Decoded payload for event types that don't fit the flat columns
290
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
291
+ payload: unknown | null;
289
292
  source_cursor: string;
290
293
  created_at: Generated<Date>;
291
294
  }
@@ -286,6 +286,9 @@ interface DecodedEventsTable {
286
286
  asset_identifier: string | null;
287
287
  value: string | null;
288
288
  memo: string | null;
289
+ /** Decoded payload for event types that don't fit the flat columns
290
+ * (e.g. `print`: { topic, value, raw_value }). Null for transfer types. */
291
+ payload: unknown | null;
289
292
  source_cursor: string;
290
293
  created_at: Generated<Date>;
291
294
  }
@@ -921,19 +924,6 @@ declare class Logger {
921
924
  }
922
925
  declare const logger: Logger;
923
926
  import { z as z2 } from "zod/v4";
924
- /**
925
- * Account profile shapes. Unrelated to marketplace — previously lived in
926
- * schemas/marketplace.ts alongside public-directory types. Kept here now
927
- * that marketplace is gone so the profile fields (display_name, bio, slug)
928
- * have a stable home.
929
- */
930
- interface UpdateProfileRequest {
931
- display_name?: string;
932
- bio?: string;
933
- slug?: string;
934
- }
935
- declare const UpdateProfileRequestSchema: z2.ZodType<UpdateProfileRequest>;
936
- import { z as z3 } from "zod/v4";
937
927
  interface StxTransferFilter {
938
928
  type: "stx_transfer";
939
929
  sender?: string;
@@ -1012,21 +1002,21 @@ interface PrintEventFilter {
1012
1002
  contains?: string;
1013
1003
  }
1014
1004
  type EventFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
1015
- declare const StxTransferFilterSchema: z3.ZodType<StxTransferFilter>;
1016
- declare const StxMintFilterSchema: z3.ZodType<StxMintFilter>;
1017
- declare const StxBurnFilterSchema: z3.ZodType<StxBurnFilter>;
1018
- declare const StxLockFilterSchema: z3.ZodType<StxLockFilter>;
1019
- declare const FtTransferFilterSchema: z3.ZodType<FtTransferFilter>;
1020
- declare const FtMintFilterSchema: z3.ZodType<FtMintFilter>;
1021
- declare const FtBurnFilterSchema: z3.ZodType<FtBurnFilter>;
1022
- declare const NftTransferFilterSchema: z3.ZodType<NftTransferFilter>;
1023
- declare const NftMintFilterSchema: z3.ZodType<NftMintFilter>;
1024
- declare const NftBurnFilterSchema: z3.ZodType<NftBurnFilter>;
1025
- declare const ContractCallFilterSchema: z3.ZodType<ContractCallFilter>;
1026
- declare const ContractDeployFilterSchema: z3.ZodType<ContractDeployFilter>;
1027
- declare const PrintEventFilterSchema: z3.ZodType<PrintEventFilter>;
1028
- declare const EventFilterSchema: z3.ZodType<EventFilter>;
1029
- import { z as z4 } from "zod/v4";
1005
+ declare const StxTransferFilterSchema: z2.ZodType<StxTransferFilter>;
1006
+ declare const StxMintFilterSchema: z2.ZodType<StxMintFilter>;
1007
+ declare const StxBurnFilterSchema: z2.ZodType<StxBurnFilter>;
1008
+ declare const StxLockFilterSchema: z2.ZodType<StxLockFilter>;
1009
+ declare const FtTransferFilterSchema: z2.ZodType<FtTransferFilter>;
1010
+ declare const FtMintFilterSchema: z2.ZodType<FtMintFilter>;
1011
+ declare const FtBurnFilterSchema: z2.ZodType<FtBurnFilter>;
1012
+ declare const NftTransferFilterSchema: z2.ZodType<NftTransferFilter>;
1013
+ declare const NftMintFilterSchema: z2.ZodType<NftMintFilter>;
1014
+ declare const NftBurnFilterSchema: z2.ZodType<NftBurnFilter>;
1015
+ declare const ContractCallFilterSchema: z2.ZodType<ContractCallFilter>;
1016
+ declare const ContractDeployFilterSchema: z2.ZodType<ContractDeployFilter>;
1017
+ declare const PrintEventFilterSchema: z2.ZodType<PrintEventFilter>;
1018
+ declare const EventFilterSchema: z2.ZodType<EventFilter>;
1019
+ import { z as z3 } from "zod/v4";
1030
1020
  interface DeploySubgraphRequest {
1031
1021
  name: string;
1032
1022
  version?: string;
@@ -1039,7 +1029,7 @@ interface DeploySubgraphRequest {
1039
1029
  /** Original TypeScript source, persisted so chat can read/diff/edit later. */
1040
1030
  sourceCode?: string;
1041
1031
  }
1042
- declare const DeploySubgraphRequestSchema: z4.ZodType<DeploySubgraphRequest>;
1032
+ declare const DeploySubgraphRequestSchema: z3.ZodType<DeploySubgraphRequest>;
1043
1033
  interface DeploySubgraphResponse {
1044
1034
  action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
1045
1035
  subgraphId: string;
@@ -1177,21 +1167,21 @@ interface SubgraphQueryParams {
1177
1167
  fields?: string;
1178
1168
  filters?: Record<string, string>;
1179
1169
  }
1180
- import { z as z5 } from "zod/v4";
1170
+ import { z as z4 } from "zod/v4";
1181
1171
  declare const SUBSCRIPTION_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
1182
1172
  declare const SUBSCRIPTION_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
1183
1173
  declare const SUBSCRIPTION_STATUSES: readonly ["active", "paused", "error"];
1184
1174
  declare const SUBSCRIPTION_FILTER_OPERATORS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "in"];
1185
- declare const SubscriptionStatusSchema: z5.ZodType<SubscriptionStatus2>;
1186
- declare const SubscriptionFormatSchema: z5.ZodType<SubscriptionFormat2>;
1187
- declare const SubscriptionRuntimeSchema: z5.ZodType<SubscriptionRuntime2>;
1188
- declare const SubscriptionFilterPrimitiveSchema: z5.ZodType<SubscriptionFilterPrimitive>;
1189
- declare const SubscriptionFilterOperatorSchema: z5.ZodType<SubscriptionFilterOperator>;
1190
- declare const SubscriptionFilterClauseSchema: z5.ZodType<SubscriptionFilterClause>;
1191
- declare const SubscriptionFilterSchema: z5.ZodType<SubscriptionFilter>;
1192
- declare const CreateSubscriptionRequestSchema: z5.ZodType<ParsedCreateSubscriptionRequest>;
1193
- declare const UpdateSubscriptionRequestSchema: z5.ZodType<UpdateSubscriptionRequest>;
1194
- declare const ReplaySubscriptionRequestSchema: z5.ZodType<ReplaySubscriptionRequest>;
1175
+ declare const SubscriptionStatusSchema: z4.ZodType<SubscriptionStatus2>;
1176
+ declare const SubscriptionFormatSchema: z4.ZodType<SubscriptionFormat2>;
1177
+ declare const SubscriptionRuntimeSchema: z4.ZodType<SubscriptionRuntime2>;
1178
+ declare const SubscriptionFilterPrimitiveSchema: z4.ZodType<SubscriptionFilterPrimitive>;
1179
+ declare const SubscriptionFilterOperatorSchema: z4.ZodType<SubscriptionFilterOperator>;
1180
+ declare const SubscriptionFilterClauseSchema: z4.ZodType<SubscriptionFilterClause>;
1181
+ declare const SubscriptionFilterSchema: z4.ZodType<SubscriptionFilter>;
1182
+ declare const CreateSubscriptionRequestSchema: z4.ZodType<ParsedCreateSubscriptionRequest>;
1183
+ declare const UpdateSubscriptionRequestSchema: z4.ZodType<UpdateSubscriptionRequest>;
1184
+ declare const ReplaySubscriptionRequestSchema: z4.ZodType<ReplaySubscriptionRequest>;
1195
1185
  type SubscriptionStatus2 = (typeof SUBSCRIPTION_STATUSES)[number];
1196
1186
  type SubscriptionFormat2 = (typeof SUBSCRIPTION_FORMATS)[number];
1197
1187
  type SubscriptionRuntime2 = (typeof SUBSCRIPTION_RUNTIMES)[number];
@@ -1311,7 +1301,7 @@ interface SubscriptionSchemaTable {
1311
1301
  columns: Record<string, SubscriptionSchemaColumn>;
1312
1302
  }
1313
1303
  type SubscriptionSchemaTables = Record<string, SubscriptionSchemaTable>;
1314
- declare function formatSubscriptionSchemaErrors(error: z5.ZodError): string[];
1304
+ declare function formatSubscriptionSchemaErrors(error: z4.ZodError): string[];
1315
1305
  declare function validateSubscriptionFilterForTable(input: {
1316
1306
  subgraphName?: string
1317
1307
  tableName: string
@@ -1386,4 +1376,4 @@ declare function createSignatureHeader(payload: string, secret: string, timestam
1386
1376
  * Returns true if valid, false otherwise
1387
1377
  */
1388
1378
  declare function verifySignatureHeader(payload: string, header: string, secret: string, toleranceSeconds?: number): boolean;
1389
- export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, exports_hmac as crypto, closeDb, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateProfileRequestSchema, UpdateProfileRequest, UpdateIndexProgress, UpdateEvent, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DatabaseError, Database, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, CODE_TO_STATUS, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
1379
+ export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, exports_hmac as crypto, closeDb, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DatabaseError, Database, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, CODE_TO_STATUS, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
package/dist/src/index.js CHANGED
@@ -336,19 +336,11 @@ function getErrorMessage(err) {
336
336
  return err instanceof Error ? err.message : String(err);
337
337
  }
338
338
 
339
- // src/schemas/accounts.ts
340
- import { z as z2 } from "zod/v4";
341
- var UpdateProfileRequestSchema = z2.object({
342
- display_name: z2.string().max(50).optional(),
343
- bio: z2.string().max(300).optional(),
344
- slug: z2.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").min(3).max(30).optional()
345
- });
346
-
347
339
  // src/schemas/filters.ts
348
340
  import { isValidAddress as _isValidAddress } from "@secondlayer/stacks";
349
- import { z as z3 } from "zod/v4";
341
+ import { z as z2 } from "zod/v4";
350
342
  var isValidAddress = _isValidAddress;
351
- var stacksPrincipal = z3.string().refine((val) => {
343
+ var stacksPrincipal = z2.string().refine((val) => {
352
344
  const parts = val.split(".");
353
345
  if (parts.length > 2)
354
346
  return false;
@@ -358,81 +350,81 @@ var baseFilter = {
358
350
  sender: stacksPrincipal.optional(),
359
351
  recipient: stacksPrincipal.optional()
360
352
  };
361
- var StxTransferFilterSchema = z3.object({
362
- type: z3.literal("stx_transfer"),
353
+ var StxTransferFilterSchema = z2.object({
354
+ type: z2.literal("stx_transfer"),
363
355
  ...baseFilter,
364
- minAmount: z3.coerce.number().int().positive().optional(),
365
- maxAmount: z3.coerce.number().int().positive().optional()
356
+ minAmount: z2.coerce.number().int().positive().optional(),
357
+ maxAmount: z2.coerce.number().int().positive().optional()
366
358
  });
367
- var StxMintFilterSchema = z3.object({
368
- type: z3.literal("stx_mint"),
359
+ var StxMintFilterSchema = z2.object({
360
+ type: z2.literal("stx_mint"),
369
361
  recipient: stacksPrincipal.optional(),
370
- minAmount: z3.coerce.number().int().positive().optional()
362
+ minAmount: z2.coerce.number().int().positive().optional()
371
363
  });
372
- var StxBurnFilterSchema = z3.object({
373
- type: z3.literal("stx_burn"),
364
+ var StxBurnFilterSchema = z2.object({
365
+ type: z2.literal("stx_burn"),
374
366
  sender: stacksPrincipal.optional(),
375
- minAmount: z3.coerce.number().int().positive().optional()
367
+ minAmount: z2.coerce.number().int().positive().optional()
376
368
  });
377
- var StxLockFilterSchema = z3.object({
378
- type: z3.literal("stx_lock"),
369
+ var StxLockFilterSchema = z2.object({
370
+ type: z2.literal("stx_lock"),
379
371
  lockedAddress: stacksPrincipal.optional(),
380
- minAmount: z3.coerce.number().int().positive().optional()
372
+ minAmount: z2.coerce.number().int().positive().optional()
381
373
  });
382
- var FtTransferFilterSchema = z3.object({
383
- type: z3.literal("ft_transfer"),
374
+ var FtTransferFilterSchema = z2.object({
375
+ type: z2.literal("ft_transfer"),
384
376
  ...baseFilter,
385
- assetIdentifier: z3.string().optional(),
386
- minAmount: z3.coerce.number().int().positive().optional()
377
+ assetIdentifier: z2.string().optional(),
378
+ minAmount: z2.coerce.number().int().positive().optional()
387
379
  });
388
- var FtMintFilterSchema = z3.object({
389
- type: z3.literal("ft_mint"),
380
+ var FtMintFilterSchema = z2.object({
381
+ type: z2.literal("ft_mint"),
390
382
  recipient: stacksPrincipal.optional(),
391
- assetIdentifier: z3.string().optional(),
392
- minAmount: z3.coerce.number().int().positive().optional()
383
+ assetIdentifier: z2.string().optional(),
384
+ minAmount: z2.coerce.number().int().positive().optional()
393
385
  });
394
- var FtBurnFilterSchema = z3.object({
395
- type: z3.literal("ft_burn"),
386
+ var FtBurnFilterSchema = z2.object({
387
+ type: z2.literal("ft_burn"),
396
388
  sender: stacksPrincipal.optional(),
397
- assetIdentifier: z3.string().optional(),
398
- minAmount: z3.coerce.number().int().positive().optional()
389
+ assetIdentifier: z2.string().optional(),
390
+ minAmount: z2.coerce.number().int().positive().optional()
399
391
  });
400
- var NftTransferFilterSchema = z3.object({
401
- type: z3.literal("nft_transfer"),
392
+ var NftTransferFilterSchema = z2.object({
393
+ type: z2.literal("nft_transfer"),
402
394
  ...baseFilter,
403
- assetIdentifier: z3.string().optional(),
404
- tokenId: z3.string().optional()
395
+ assetIdentifier: z2.string().optional(),
396
+ tokenId: z2.string().optional()
405
397
  });
406
- var NftMintFilterSchema = z3.object({
407
- type: z3.literal("nft_mint"),
398
+ var NftMintFilterSchema = z2.object({
399
+ type: z2.literal("nft_mint"),
408
400
  recipient: stacksPrincipal.optional(),
409
- assetIdentifier: z3.string().optional(),
410
- tokenId: z3.string().optional()
401
+ assetIdentifier: z2.string().optional(),
402
+ tokenId: z2.string().optional()
411
403
  });
412
- var NftBurnFilterSchema = z3.object({
413
- type: z3.literal("nft_burn"),
404
+ var NftBurnFilterSchema = z2.object({
405
+ type: z2.literal("nft_burn"),
414
406
  sender: stacksPrincipal.optional(),
415
- assetIdentifier: z3.string().optional(),
416
- tokenId: z3.string().optional()
407
+ assetIdentifier: z2.string().optional(),
408
+ tokenId: z2.string().optional()
417
409
  });
418
- var ContractCallFilterSchema = z3.object({
419
- type: z3.literal("contract_call"),
410
+ var ContractCallFilterSchema = z2.object({
411
+ type: z2.literal("contract_call"),
420
412
  contractId: stacksPrincipal.optional(),
421
- functionName: z3.string().optional(),
413
+ functionName: z2.string().optional(),
422
414
  caller: stacksPrincipal.optional()
423
415
  });
424
- var ContractDeployFilterSchema = z3.object({
425
- type: z3.literal("contract_deploy"),
416
+ var ContractDeployFilterSchema = z2.object({
417
+ type: z2.literal("contract_deploy"),
426
418
  deployer: stacksPrincipal.optional(),
427
- contractName: z3.string().optional()
419
+ contractName: z2.string().optional()
428
420
  });
429
- var PrintEventFilterSchema = z3.object({
430
- type: z3.literal("print_event"),
421
+ var PrintEventFilterSchema = z2.object({
422
+ type: z2.literal("print_event"),
431
423
  contractId: stacksPrincipal.optional(),
432
- topic: z3.string().optional(),
433
- contains: z3.string().optional()
424
+ topic: z2.string().optional(),
425
+ contains: z2.string().optional()
434
426
  });
435
- var EventFilterSchema = z3.discriminatedUnion("type", [
427
+ var EventFilterSchema = z2.discriminatedUnion("type", [
436
428
  StxTransferFilterSchema,
437
429
  StxMintFilterSchema,
438
430
  StxBurnFilterSchema,
@@ -449,20 +441,20 @@ var EventFilterSchema = z3.discriminatedUnion("type", [
449
441
  ]);
450
442
 
451
443
  // src/schemas/subgraphs.ts
452
- import { z as z4 } from "zod/v4";
453
- var DeploySubgraphRequestSchema = z4.object({
454
- name: z4.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").max(63),
455
- version: z4.string().optional(),
456
- description: z4.string().optional(),
457
- sources: z4.record(z4.string(), z4.record(z4.string(), z4.unknown())).refine((s) => Object.keys(s).length > 0, "Must have at least one source"),
458
- schema: z4.record(z4.string(), z4.unknown()),
459
- handlerCode: z4.string().max(1048576, "handler code exceeds 1MB limit"),
460
- startBlock: z4.number().int().nonnegative().optional(),
461
- sourceCode: z4.string().max(1048576, "source code exceeds 1MB limit").optional()
444
+ import { z as z3 } from "zod/v4";
445
+ var DeploySubgraphRequestSchema = z3.object({
446
+ name: z3.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").max(63),
447
+ version: z3.string().optional(),
448
+ description: z3.string().optional(),
449
+ sources: z3.record(z3.string(), z3.record(z3.string(), z3.unknown())).refine((s) => Object.keys(s).length > 0, "Must have at least one source"),
450
+ schema: z3.record(z3.string(), z3.unknown()),
451
+ handlerCode: z3.string().max(1048576, "handler code exceeds 1MB limit"),
452
+ startBlock: z3.number().int().nonnegative().optional(),
453
+ sourceCode: z3.string().max(1048576, "source code exceeds 1MB limit").optional()
462
454
  });
463
455
 
464
456
  // src/schemas/subscriptions.ts
465
- import { z as z5 } from "zod/v4";
457
+ import { z as z4 } from "zod/v4";
466
458
  var SUBSCRIPTION_FORMATS = [
467
459
  "standard-webhooks",
468
460
  "inngest",
@@ -487,30 +479,30 @@ var SUBSCRIPTION_FILTER_OPERATORS = [
487
479
  "lte",
488
480
  "in"
489
481
  ];
490
- var webhookUrl = z5.string().trim().min(1).refine((value) => value.startsWith("http://") || value.startsWith("https://"), "must be an http(s) URL");
491
- var name = z5.string().trim().min(1).max(128);
492
- var resourceName = z5.string().trim().min(1).max(128);
493
- var SubscriptionStatusSchema = z5.enum(SUBSCRIPTION_STATUSES);
494
- var SubscriptionFormatSchema = z5.enum(SUBSCRIPTION_FORMATS);
495
- var SubscriptionRuntimeSchema = z5.enum(SUBSCRIPTION_RUNTIMES);
496
- var SubscriptionFilterPrimitiveSchema = z5.union([z5.string(), z5.number().finite(), z5.boolean()]);
497
- var SubscriptionFilterOperatorSchema = z5.union([
498
- z5.object({ eq: SubscriptionFilterPrimitiveSchema }).strict(),
499
- z5.object({ neq: SubscriptionFilterPrimitiveSchema }).strict(),
500
- z5.object({ gt: z5.union([z5.string(), z5.number().finite()]) }).strict(),
501
- z5.object({ gte: z5.union([z5.string(), z5.number().finite()]) }).strict(),
502
- z5.object({ lt: z5.union([z5.string(), z5.number().finite()]) }).strict(),
503
- z5.object({ lte: z5.union([z5.string(), z5.number().finite()]) }).strict(),
504
- z5.object({
505
- in: z5.array(SubscriptionFilterPrimitiveSchema).min(1)
482
+ var webhookUrl = z4.string().trim().min(1).refine((value) => value.startsWith("http://") || value.startsWith("https://"), "must be an http(s) URL");
483
+ var name = z4.string().trim().min(1).max(128);
484
+ var resourceName = z4.string().trim().min(1).max(128);
485
+ var SubscriptionStatusSchema = z4.enum(SUBSCRIPTION_STATUSES);
486
+ var SubscriptionFormatSchema = z4.enum(SUBSCRIPTION_FORMATS);
487
+ var SubscriptionRuntimeSchema = z4.enum(SUBSCRIPTION_RUNTIMES);
488
+ var SubscriptionFilterPrimitiveSchema = z4.union([z4.string(), z4.number().finite(), z4.boolean()]);
489
+ var SubscriptionFilterOperatorSchema = z4.union([
490
+ z4.object({ eq: SubscriptionFilterPrimitiveSchema }).strict(),
491
+ z4.object({ neq: SubscriptionFilterPrimitiveSchema }).strict(),
492
+ z4.object({ gt: z4.union([z4.string(), z4.number().finite()]) }).strict(),
493
+ z4.object({ gte: z4.union([z4.string(), z4.number().finite()]) }).strict(),
494
+ z4.object({ lt: z4.union([z4.string(), z4.number().finite()]) }).strict(),
495
+ z4.object({ lte: z4.union([z4.string(), z4.number().finite()]) }).strict(),
496
+ z4.object({
497
+ in: z4.array(SubscriptionFilterPrimitiveSchema).min(1)
506
498
  }).strict()
507
499
  ]);
508
- var SubscriptionFilterClauseSchema = z5.union([
500
+ var SubscriptionFilterClauseSchema = z4.union([
509
501
  SubscriptionFilterPrimitiveSchema,
510
502
  SubscriptionFilterOperatorSchema
511
503
  ]);
512
- var SubscriptionFilterSchema = z5.record(z5.string().min(1), SubscriptionFilterClauseSchema);
513
- var CreateSubscriptionRequestSchema = z5.object({
504
+ var SubscriptionFilterSchema = z4.record(z4.string().min(1), SubscriptionFilterClauseSchema);
505
+ var CreateSubscriptionRequestSchema = z4.object({
514
506
  name,
515
507
  subgraphName: resourceName,
516
508
  tableName: resourceName,
@@ -518,28 +510,28 @@ var CreateSubscriptionRequestSchema = z5.object({
518
510
  filter: SubscriptionFilterSchema.optional(),
519
511
  format: SubscriptionFormatSchema.default("standard-webhooks"),
520
512
  runtime: SubscriptionRuntimeSchema.nullable().optional(),
521
- authConfig: z5.record(z5.string(), z5.unknown()).optional(),
522
- maxRetries: z5.number().int().min(0).max(100).optional(),
523
- timeoutMs: z5.number().int().min(100).max(300000).optional(),
524
- concurrency: z5.number().int().min(1).max(100).optional()
513
+ authConfig: z4.record(z4.string(), z4.unknown()).optional(),
514
+ maxRetries: z4.number().int().min(0).max(100).optional(),
515
+ timeoutMs: z4.number().int().min(100).max(300000).optional(),
516
+ concurrency: z4.number().int().min(1).max(100).optional()
525
517
  });
526
- var UpdateSubscriptionRequestSchema = z5.object({
518
+ var UpdateSubscriptionRequestSchema = z4.object({
527
519
  name: name.optional(),
528
520
  url: webhookUrl.optional(),
529
521
  filter: SubscriptionFilterSchema.optional(),
530
522
  format: SubscriptionFormatSchema.optional(),
531
523
  runtime: SubscriptionRuntimeSchema.nullable().optional(),
532
- authConfig: z5.record(z5.string(), z5.unknown()).optional(),
533
- maxRetries: z5.number().int().min(0).max(100).optional(),
534
- timeoutMs: z5.number().int().min(100).max(300000).optional(),
535
- concurrency: z5.number().int().min(1).max(100).optional()
524
+ authConfig: z4.record(z4.string(), z4.unknown()).optional(),
525
+ maxRetries: z4.number().int().min(0).max(100).optional(),
526
+ timeoutMs: z4.number().int().min(100).max(300000).optional(),
527
+ concurrency: z4.number().int().min(1).max(100).optional()
536
528
  }).refine((value) => Object.keys(value).length > 0, {
537
529
  message: "At least one field must be provided"
538
530
  });
539
- var ReplaySubscriptionRequestSchema = z5.object({
540
- fromBlock: z5.number().int().nonnegative(),
541
- toBlock: z5.number().int().nonnegative(),
542
- force: z5.string().trim().min(1).max(64).optional()
531
+ var ReplaySubscriptionRequestSchema = z4.object({
532
+ fromBlock: z4.number().int().nonnegative(),
533
+ toBlock: z4.number().int().nonnegative(),
534
+ force: z4.string().trim().min(1).max(64).optional()
543
535
  }).refine((value) => value.fromBlock <= value.toBlock, {
544
536
  message: "fromBlock must be less than or equal to toBlock",
545
537
  path: ["toBlock"]
@@ -1014,7 +1006,6 @@ export {
1014
1006
  VersionConflictError,
1015
1007
  ValidationError,
1016
1008
  UpdateSubscriptionRequestSchema,
1017
- UpdateProfileRequestSchema,
1018
1009
  TenantSuspendedError,
1019
1010
  SubscriptionStatusSchema,
1020
1011
  SubscriptionRuntimeSchema,
@@ -1056,5 +1047,5 @@ export {
1056
1047
  AuthenticationError
1057
1048
  };
1058
1049
 
1059
- //# debugId=B69B5B4AFAFF189E64756E2164756E21
1050
+ //# debugId=2B504DF1F03EDF5C64756E2164756E21
1060
1051
  //# sourceMappingURL=index.js.map