@secondlayer/subgraphs 7.0.2 → 7.0.4
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/dist/index.d.ts +19 -4
- package/dist/index.js +5 -5
- package/dist/index.js.map +12 -12
- package/dist/runtime/replay.d.ts +3 -0
- package/dist/runtime/replay.js +5 -5
- package/dist/runtime/replay.js.map +5 -5
- package/dist/schema/index.d.ts +6 -2
- package/dist/schema/index.js +5 -5
- package/dist/schema/index.js.map +5 -5
- package/dist/testing/index.d.ts +9 -2
- package/dist/testing/index.js +5 -5
- package/dist/testing/index.js.map +8 -8
- package/dist/types.d.ts +3 -2
- package/dist/validate.d.ts +3 -2
- package/dist/verification.d.ts +4 -2
- package/dist/verification.js +5 -5
- package/dist/verification.js.map +3 -3
- package/dist/verify/index.d.ts +8 -2
- package/dist/verify/index.js +5 -5
- package/dist/verify/index.js.map +9 -9
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { AbiContract, ExtractFunctionArgs, ExtractFunctionOutput, ExtractReadOnl
|
|
|
17
17
|
* first answer forever, so it is opt-in and never inferred.
|
|
18
18
|
*/
|
|
19
19
|
type ChainReadCacheMode = "per-block" | "contract-constant";
|
|
20
|
+
/** Options for a contract read, such as cache mode. */
|
|
20
21
|
type ChainReadOptions = {
|
|
21
22
|
cache?: ChainReadCacheMode;
|
|
22
23
|
};
|
|
@@ -137,7 +138,7 @@ interface SubgraphTable {
|
|
|
137
138
|
/** Unique key constraints (each entry is an array of column names). Required for upsert. */
|
|
138
139
|
uniqueKeys?: readonly (readonly string[])[];
|
|
139
140
|
}
|
|
140
|
-
/**
|
|
141
|
+
/** Maps table names to table definitions. */
|
|
141
142
|
type SubgraphSchema = Record<string, SubgraphTable>;
|
|
142
143
|
/** STX event filters */
|
|
143
144
|
interface StxTransferFilter {
|
|
@@ -409,7 +410,7 @@ type UnpinnedPrintEventFilter = PrintEventFields & {
|
|
|
409
410
|
* `prints`; trait and unpinned sources may omit it.
|
|
410
411
|
*/
|
|
411
412
|
type PrintEventFilter = PinnedPrintEventFilter | TraitPrintEventFilter | UnpinnedPrintEventFilter;
|
|
412
|
-
/**
|
|
413
|
+
/** A subgraph filter, discriminated on `type`. */
|
|
413
414
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter | NestedContractCallFilter | VarSetFilter | MapWriteFilter;
|
|
414
415
|
/** Transaction metadata available in handlers */
|
|
415
416
|
interface TxMeta {
|
|
@@ -943,8 +944,11 @@ type TypedHandlers<
|
|
|
943
944
|
Sources extends Record<string, SubgraphFilter>,
|
|
944
945
|
S extends SubgraphSchema
|
|
945
946
|
> = { [K in keyof Sources]-? : HandlerFn<Sources[K], S> };
|
|
946
|
-
/**
|
|
947
|
-
*
|
|
947
|
+
/**
|
|
948
|
+
* A subgraph definition that keeps `sources` and `schema` literals typed.
|
|
949
|
+
*
|
|
950
|
+
* Preserved for typed handlers and downstream query-client inference (`getSubgraph`).
|
|
951
|
+
*/
|
|
948
952
|
type TypedSubgraphDefinition<
|
|
949
953
|
Sources extends Record<string, SubgraphFilter>,
|
|
950
954
|
S extends SubgraphSchema
|
|
@@ -1070,6 +1074,7 @@ interface InferredPrintField {
|
|
|
1070
1074
|
/** Only when optional observed: share of present samples that were some */
|
|
1071
1075
|
optional_some_rate?: number;
|
|
1072
1076
|
}
|
|
1077
|
+
/** The fields seen in one `print` topic, with counts and heights. */
|
|
1073
1078
|
interface InferredTopicSchema {
|
|
1074
1079
|
topic: string;
|
|
1075
1080
|
count: number;
|
|
@@ -1132,6 +1137,7 @@ declare function deriveVerification(def: Pick<SubgraphDefinition, "sources" | "b
|
|
|
1132
1137
|
* contract is enforced, and the scan broke it.
|
|
1133
1138
|
*/
|
|
1134
1139
|
declare function isDeterminismViolation(v: SubgraphVerification): boolean;
|
|
1140
|
+
/** What a pin is computed from: schema hash, handler code, network. */
|
|
1135
1141
|
interface PinInput {
|
|
1136
1142
|
/** Existing `schema_hash` (name + schema + sources). */
|
|
1137
1143
|
schemaHash: string;
|
|
@@ -1171,6 +1177,7 @@ declare class HandlerReadError extends Error {
|
|
|
1171
1177
|
* every handler wrapped to receive the {@link deterministicContext} facade.
|
|
1172
1178
|
*/
|
|
1173
1179
|
declare function loadDeterministicDefinition(handlerCode: string): Promise<SubgraphDefinition>;
|
|
1180
|
+
/** The SQL statements for a subgraph's tables and their hash. */
|
|
1174
1181
|
interface GeneratedSQL {
|
|
1175
1182
|
statements: string[];
|
|
1176
1183
|
hash: string;
|
|
@@ -1181,6 +1188,7 @@ interface GeneratedSQL {
|
|
|
1181
1188
|
* each with auto-columns and indexes.
|
|
1182
1189
|
*/
|
|
1183
1190
|
declare function generateSubgraphSQL(def: SubgraphDefinition, schemaNameOverride?: string): GeneratedSQL;
|
|
1191
|
+
/** Options for generating Prisma models. */
|
|
1184
1192
|
interface PrismaGenOptions {
|
|
1185
1193
|
/** Postgres schema the tables live in (account-scoped). */
|
|
1186
1194
|
schemaName?: string;
|
|
@@ -1199,11 +1207,13 @@ interface PrismaGenOptions {
|
|
|
1199
1207
|
* schema.
|
|
1200
1208
|
*/
|
|
1201
1209
|
declare function generatePrismaSchema(def: SubgraphDefinition, opts?: PrismaGenOptions): string;
|
|
1210
|
+
/** Options for generating Drizzle table definitions. */
|
|
1202
1211
|
interface DrizzleGenOptions {
|
|
1203
1212
|
schemaName?: string;
|
|
1204
1213
|
}
|
|
1205
1214
|
/** Generates Drizzle table definitions for a subgraph's tables. */
|
|
1206
1215
|
declare function generateDrizzleSchema(def: SubgraphDefinition, opts?: DrizzleGenOptions): string;
|
|
1216
|
+
/** Options for generating Kysely table interfaces. */
|
|
1207
1217
|
interface KyselyGenOptions {
|
|
1208
1218
|
/** Postgres schema the tables live in (account-scoped). */
|
|
1209
1219
|
schemaName?: string;
|
|
@@ -1222,7 +1232,9 @@ declare function generateKyselySchema(def: SubgraphDefinition, opts?: KyselyGenO
|
|
|
1222
1232
|
* physical PK is a synthetic id excluded from the read contract (chain_reorgs) have
|
|
1223
1233
|
* no read-set key and are omitted from Prisma output (other targets still emit them).
|
|
1224
1234
|
*/
|
|
1235
|
+
/** A portable, typed schema target for the public Index read domain. */
|
|
1225
1236
|
type IndexCodegenTarget = "prisma" | "kysely" | "drizzle" | "json-schema";
|
|
1237
|
+
/** Options for generating the Index schema: tables, schema name. */
|
|
1226
1238
|
interface IndexCodegenOptions {
|
|
1227
1239
|
/** Restrict output to these Index tables (default: all). */
|
|
1228
1240
|
tables?: string[];
|
|
@@ -1242,6 +1254,7 @@ import { pgSchemaName } from "@secondlayer/shared/db/queries/subgraphs";
|
|
|
1242
1254
|
import { Database as Database2 } from "@secondlayer/shared/db";
|
|
1243
1255
|
import { Kysely as Kysely2 } from "kysely";
|
|
1244
1256
|
type AnyDb = Kysely2<Database2>;
|
|
1257
|
+
/** Tables added, removed, or changed between two schemas. */
|
|
1245
1258
|
interface TableDiff {
|
|
1246
1259
|
/** Tables added to the schema */
|
|
1247
1260
|
addedTables: string[];
|
|
@@ -1290,6 +1303,7 @@ declare function hasBreakingChanges(diff: TableDiff): {
|
|
|
1290
1303
|
breaking: boolean;
|
|
1291
1304
|
reasons: string[];
|
|
1292
1305
|
};
|
|
1306
|
+
/** The tables and columns a deploy adds, removes, or breaks. */
|
|
1293
1307
|
interface DeployDiff {
|
|
1294
1308
|
addedTables: string[];
|
|
1295
1309
|
removedTables: string[];
|
|
@@ -1300,6 +1314,7 @@ interface DeployDiff {
|
|
|
1300
1314
|
/** uniqueKeys added in place via ALTER TABLE … ADD CONSTRAINT. */
|
|
1301
1315
|
addedUniqueKeys?: Record<string, string[][]>;
|
|
1302
1316
|
}
|
|
1317
|
+
/** The schema name and SQL a deploy will run. */
|
|
1303
1318
|
interface DeployPlan {
|
|
1304
1319
|
schemaName: string;
|
|
1305
1320
|
/** `DROP SCHEMA … CASCADE` a destructive rebuild would run first. */
|
package/dist/index.js
CHANGED
|
@@ -787,7 +787,7 @@ import { createHash } from "node:crypto";
|
|
|
787
787
|
// package.json
|
|
788
788
|
var package_default = {
|
|
789
789
|
name: "@secondlayer/subgraphs",
|
|
790
|
-
version: "7.0.
|
|
790
|
+
version: "7.0.4",
|
|
791
791
|
description: "Describe the Stacks data you want as one TypeScript file; it fills itself and survives reorgs.",
|
|
792
792
|
license: "MIT",
|
|
793
793
|
repository: {
|
|
@@ -847,9 +847,9 @@ var package_default = {
|
|
|
847
847
|
prepublishOnly: "bun run build"
|
|
848
848
|
},
|
|
849
849
|
dependencies: {
|
|
850
|
-
"@secondlayer/shared": "^
|
|
851
|
-
"@secondlayer/stacks": "^6.2.
|
|
852
|
-
"@secondlayer/verify": "^0.5.
|
|
850
|
+
"@secondlayer/shared": "^13.0.0",
|
|
851
|
+
"@secondlayer/stacks": "^6.2.2",
|
|
852
|
+
"@secondlayer/verify": "^0.5.4",
|
|
853
853
|
esbuild: "^0.28.2",
|
|
854
854
|
kysely: "0.28.17",
|
|
855
855
|
zod: "^4.3.6"
|
|
@@ -2949,5 +2949,5 @@ export {
|
|
|
2949
2949
|
validateSubgraphDefinition
|
|
2950
2950
|
};
|
|
2951
2951
|
|
|
2952
|
-
//# debugId=
|
|
2952
|
+
//# debugId=DCD9274CFF218C3164756E2164756E21
|
|
2953
2953
|
//# sourceMappingURL=index.js.map
|