@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.
- package/README.md +9 -12
- package/dist/src/db/index.d.ts +3 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +3 -0
- package/dist/src/db/queries/integrity.d.ts +3 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +3 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +3 -0
- package/dist/src/db/queries/subgraphs.d.ts +3 -0
- package/dist/src/db/queries/subscriptions.d.ts +3 -0
- package/dist/src/db/schema.d.ts +3 -0
- package/dist/src/index.d.ts +32 -42
- package/dist/src/index.js +94 -103
- package/dist/src/index.js.map +3 -4
- package/dist/src/node/local-client.d.ts +3 -0
- package/dist/src/schemas/index.d.ts +29 -42
- package/dist/src/schemas/index.js +94 -103
- package/dist/src/schemas/index.js.map +3 -4
- package/migrations/0079_decoded_events_payload.ts +12 -0
- package/package.json +1 -21
- package/dist/src/db/queries/account-spend-caps.d.ts +0 -729
- package/dist/src/db/queries/account-spend-caps.js +0 -59
- package/dist/src/db/queries/account-spend-caps.js.map +0 -10
- package/dist/src/db/queries/accounts.d.ts +0 -741
- package/dist/src/db/queries/accounts.js +0 -86
- package/dist/src/db/queries/accounts.js.map +0 -10
- package/dist/src/db/queries/projects.d.ts +0 -722
- package/dist/src/db/queries/projects.js +0 -47
- package/dist/src/db/queries/projects.js.map +0 -10
- package/dist/src/db/queries/usage.d.ts +0 -731
- package/dist/src/db/queries/usage.js +0 -109
- package/dist/src/db/queries/usage.js.map +0 -10
- package/dist/src/schemas/accounts.d.ts +0 -14
- package/dist/src/schemas/accounts.js +0 -29
- 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/
|
|
28
|
-
| `@secondlayer/shared/db/
|
|
29
|
-
| `@secondlayer/shared/
|
|
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/
|
|
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
|
|
40
|
+
| `@secondlayer/shared/node/*` | Stacks node clients (hiro-client, local-client, hiro-pg-client, archive-client) |
|
package/dist/src/db/index.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/src/db/schema.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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:
|
|
1016
|
-
declare const StxMintFilterSchema:
|
|
1017
|
-
declare const StxBurnFilterSchema:
|
|
1018
|
-
declare const StxLockFilterSchema:
|
|
1019
|
-
declare const FtTransferFilterSchema:
|
|
1020
|
-
declare const FtMintFilterSchema:
|
|
1021
|
-
declare const FtBurnFilterSchema:
|
|
1022
|
-
declare const NftTransferFilterSchema:
|
|
1023
|
-
declare const NftMintFilterSchema:
|
|
1024
|
-
declare const NftBurnFilterSchema:
|
|
1025
|
-
declare const ContractCallFilterSchema:
|
|
1026
|
-
declare const ContractDeployFilterSchema:
|
|
1027
|
-
declare const PrintEventFilterSchema:
|
|
1028
|
-
declare const EventFilterSchema:
|
|
1029
|
-
import { z as
|
|
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:
|
|
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
|
|
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:
|
|
1186
|
-
declare const SubscriptionFormatSchema:
|
|
1187
|
-
declare const SubscriptionRuntimeSchema:
|
|
1188
|
-
declare const SubscriptionFilterPrimitiveSchema:
|
|
1189
|
-
declare const SubscriptionFilterOperatorSchema:
|
|
1190
|
-
declare const SubscriptionFilterClauseSchema:
|
|
1191
|
-
declare const SubscriptionFilterSchema:
|
|
1192
|
-
declare const CreateSubscriptionRequestSchema:
|
|
1193
|
-
declare const UpdateSubscriptionRequestSchema:
|
|
1194
|
-
declare const ReplaySubscriptionRequestSchema:
|
|
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:
|
|
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,
|
|
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
|
|
341
|
+
import { z as z2 } from "zod/v4";
|
|
350
342
|
var isValidAddress = _isValidAddress;
|
|
351
|
-
var stacksPrincipal =
|
|
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 =
|
|
362
|
-
type:
|
|
353
|
+
var StxTransferFilterSchema = z2.object({
|
|
354
|
+
type: z2.literal("stx_transfer"),
|
|
363
355
|
...baseFilter,
|
|
364
|
-
minAmount:
|
|
365
|
-
maxAmount:
|
|
356
|
+
minAmount: z2.coerce.number().int().positive().optional(),
|
|
357
|
+
maxAmount: z2.coerce.number().int().positive().optional()
|
|
366
358
|
});
|
|
367
|
-
var StxMintFilterSchema =
|
|
368
|
-
type:
|
|
359
|
+
var StxMintFilterSchema = z2.object({
|
|
360
|
+
type: z2.literal("stx_mint"),
|
|
369
361
|
recipient: stacksPrincipal.optional(),
|
|
370
|
-
minAmount:
|
|
362
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
371
363
|
});
|
|
372
|
-
var StxBurnFilterSchema =
|
|
373
|
-
type:
|
|
364
|
+
var StxBurnFilterSchema = z2.object({
|
|
365
|
+
type: z2.literal("stx_burn"),
|
|
374
366
|
sender: stacksPrincipal.optional(),
|
|
375
|
-
minAmount:
|
|
367
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
376
368
|
});
|
|
377
|
-
var StxLockFilterSchema =
|
|
378
|
-
type:
|
|
369
|
+
var StxLockFilterSchema = z2.object({
|
|
370
|
+
type: z2.literal("stx_lock"),
|
|
379
371
|
lockedAddress: stacksPrincipal.optional(),
|
|
380
|
-
minAmount:
|
|
372
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
381
373
|
});
|
|
382
|
-
var FtTransferFilterSchema =
|
|
383
|
-
type:
|
|
374
|
+
var FtTransferFilterSchema = z2.object({
|
|
375
|
+
type: z2.literal("ft_transfer"),
|
|
384
376
|
...baseFilter,
|
|
385
|
-
assetIdentifier:
|
|
386
|
-
minAmount:
|
|
377
|
+
assetIdentifier: z2.string().optional(),
|
|
378
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
387
379
|
});
|
|
388
|
-
var FtMintFilterSchema =
|
|
389
|
-
type:
|
|
380
|
+
var FtMintFilterSchema = z2.object({
|
|
381
|
+
type: z2.literal("ft_mint"),
|
|
390
382
|
recipient: stacksPrincipal.optional(),
|
|
391
|
-
assetIdentifier:
|
|
392
|
-
minAmount:
|
|
383
|
+
assetIdentifier: z2.string().optional(),
|
|
384
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
393
385
|
});
|
|
394
|
-
var FtBurnFilterSchema =
|
|
395
|
-
type:
|
|
386
|
+
var FtBurnFilterSchema = z2.object({
|
|
387
|
+
type: z2.literal("ft_burn"),
|
|
396
388
|
sender: stacksPrincipal.optional(),
|
|
397
|
-
assetIdentifier:
|
|
398
|
-
minAmount:
|
|
389
|
+
assetIdentifier: z2.string().optional(),
|
|
390
|
+
minAmount: z2.coerce.number().int().positive().optional()
|
|
399
391
|
});
|
|
400
|
-
var NftTransferFilterSchema =
|
|
401
|
-
type:
|
|
392
|
+
var NftTransferFilterSchema = z2.object({
|
|
393
|
+
type: z2.literal("nft_transfer"),
|
|
402
394
|
...baseFilter,
|
|
403
|
-
assetIdentifier:
|
|
404
|
-
tokenId:
|
|
395
|
+
assetIdentifier: z2.string().optional(),
|
|
396
|
+
tokenId: z2.string().optional()
|
|
405
397
|
});
|
|
406
|
-
var NftMintFilterSchema =
|
|
407
|
-
type:
|
|
398
|
+
var NftMintFilterSchema = z2.object({
|
|
399
|
+
type: z2.literal("nft_mint"),
|
|
408
400
|
recipient: stacksPrincipal.optional(),
|
|
409
|
-
assetIdentifier:
|
|
410
|
-
tokenId:
|
|
401
|
+
assetIdentifier: z2.string().optional(),
|
|
402
|
+
tokenId: z2.string().optional()
|
|
411
403
|
});
|
|
412
|
-
var NftBurnFilterSchema =
|
|
413
|
-
type:
|
|
404
|
+
var NftBurnFilterSchema = z2.object({
|
|
405
|
+
type: z2.literal("nft_burn"),
|
|
414
406
|
sender: stacksPrincipal.optional(),
|
|
415
|
-
assetIdentifier:
|
|
416
|
-
tokenId:
|
|
407
|
+
assetIdentifier: z2.string().optional(),
|
|
408
|
+
tokenId: z2.string().optional()
|
|
417
409
|
});
|
|
418
|
-
var ContractCallFilterSchema =
|
|
419
|
-
type:
|
|
410
|
+
var ContractCallFilterSchema = z2.object({
|
|
411
|
+
type: z2.literal("contract_call"),
|
|
420
412
|
contractId: stacksPrincipal.optional(),
|
|
421
|
-
functionName:
|
|
413
|
+
functionName: z2.string().optional(),
|
|
422
414
|
caller: stacksPrincipal.optional()
|
|
423
415
|
});
|
|
424
|
-
var ContractDeployFilterSchema =
|
|
425
|
-
type:
|
|
416
|
+
var ContractDeployFilterSchema = z2.object({
|
|
417
|
+
type: z2.literal("contract_deploy"),
|
|
426
418
|
deployer: stacksPrincipal.optional(),
|
|
427
|
-
contractName:
|
|
419
|
+
contractName: z2.string().optional()
|
|
428
420
|
});
|
|
429
|
-
var PrintEventFilterSchema =
|
|
430
|
-
type:
|
|
421
|
+
var PrintEventFilterSchema = z2.object({
|
|
422
|
+
type: z2.literal("print_event"),
|
|
431
423
|
contractId: stacksPrincipal.optional(),
|
|
432
|
-
topic:
|
|
433
|
-
contains:
|
|
424
|
+
topic: z2.string().optional(),
|
|
425
|
+
contains: z2.string().optional()
|
|
434
426
|
});
|
|
435
|
-
var EventFilterSchema =
|
|
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
|
|
453
|
-
var DeploySubgraphRequestSchema =
|
|
454
|
-
name:
|
|
455
|
-
version:
|
|
456
|
-
description:
|
|
457
|
-
sources:
|
|
458
|
-
schema:
|
|
459
|
-
handlerCode:
|
|
460
|
-
startBlock:
|
|
461
|
-
sourceCode:
|
|
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
|
|
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 =
|
|
491
|
-
var name =
|
|
492
|
-
var resourceName =
|
|
493
|
-
var SubscriptionStatusSchema =
|
|
494
|
-
var SubscriptionFormatSchema =
|
|
495
|
-
var SubscriptionRuntimeSchema =
|
|
496
|
-
var SubscriptionFilterPrimitiveSchema =
|
|
497
|
-
var SubscriptionFilterOperatorSchema =
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
in:
|
|
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 =
|
|
500
|
+
var SubscriptionFilterClauseSchema = z4.union([
|
|
509
501
|
SubscriptionFilterPrimitiveSchema,
|
|
510
502
|
SubscriptionFilterOperatorSchema
|
|
511
503
|
]);
|
|
512
|
-
var SubscriptionFilterSchema =
|
|
513
|
-
var CreateSubscriptionRequestSchema =
|
|
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:
|
|
522
|
-
maxRetries:
|
|
523
|
-
timeoutMs:
|
|
524
|
-
concurrency:
|
|
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 =
|
|
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:
|
|
533
|
-
maxRetries:
|
|
534
|
-
timeoutMs:
|
|
535
|
-
concurrency:
|
|
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 =
|
|
540
|
-
fromBlock:
|
|
541
|
-
toBlock:
|
|
542
|
-
force:
|
|
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=
|
|
1050
|
+
//# debugId=2B504DF1F03EDF5C64756E2164756E21
|
|
1060
1051
|
//# sourceMappingURL=index.js.map
|