@secondlayer/subgraphs 3.20.0 → 3.22.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/dist/src/index.d.ts +188 -16
- package/dist/src/index.js +369 -41
- package/dist/src/index.js.map +12 -11
- package/dist/src/runtime/block-processor.d.ts +100 -13
- package/dist/src/runtime/block-processor.js +208 -22
- package/dist/src/runtime/block-processor.js.map +9 -8
- package/dist/src/runtime/catchup.d.ts +100 -13
- package/dist/src/runtime/catchup.js +208 -22
- package/dist/src/runtime/catchup.js.map +9 -8
- package/dist/src/runtime/context.d.ts +34 -8
- package/dist/src/runtime/context.js +25 -12
- package/dist/src/runtime/context.js.map +4 -4
- package/dist/src/runtime/processor.js +213 -22
- package/dist/src/runtime/processor.js.map +10 -9
- package/dist/src/runtime/reindex.d.ts +100 -13
- package/dist/src/runtime/reindex.js +208 -22
- package/dist/src/runtime/reindex.js.map +9 -8
- package/dist/src/runtime/reorg.d.ts +100 -13
- package/dist/src/runtime/reorg.js +213 -22
- package/dist/src/runtime/reorg.js.map +10 -9
- package/dist/src/runtime/replay.js +29 -6
- package/dist/src/runtime/replay.js.map +3 -3
- package/dist/src/runtime/runner.d.ts +125 -17
- package/dist/src/runtime/runner.js +100 -3
- package/dist/src/runtime/runner.js.map +5 -4
- package/dist/src/runtime/source-matcher.d.ts +98 -11
- package/dist/src/runtime/source-matcher.js +30 -6
- package/dist/src/runtime/source-matcher.js.map +3 -3
- package/dist/src/schema/index.d.ts +100 -13
- package/dist/src/schema/index.js +171 -20
- package/dist/src/schema/index.js.map +5 -5
- package/dist/src/service.js +213 -22
- package/dist/src/service.js.map +10 -9
- package/dist/src/testing/index.d.ts +620 -0
- package/dist/src/testing/index.js +1297 -0
- package/dist/src/testing/index.js.map +16 -0
- package/dist/src/triggers/index.d.ts +87 -9
- package/dist/src/types.d.ts +101 -14
- package/dist/src/validate.d.ts +136 -14
- package/dist/src/validate.js +158 -19
- package/dist/src/validate.js.map +3 -3
- package/package.json +7 -5
package/dist/src/validate.d.ts
CHANGED
|
@@ -25,15 +25,24 @@ interface SubgraphRelation {
|
|
|
25
25
|
/** Target column(s) the fields point at (a uniqueKeys entry on the target). */
|
|
26
26
|
referencedColumns: string[];
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Table definition within a subgraph schema.
|
|
30
|
+
*
|
|
31
|
+
* The array fields are `readonly` so a schema literal can be hoisted out of
|
|
32
|
+
* the `defineSubgraph()` call with `as const` (or {@link defineSchema}) and
|
|
33
|
+
* still typecheck — `as const` produces `readonly [readonly ["holder"]]`,
|
|
34
|
+
* which a mutable `string[][]` rejects. Without that, extracting a helper
|
|
35
|
+
* that takes `ctx` meant losing the entire typed surface, which is why the
|
|
36
|
+
* shipped starter reached for `ctx: any`.
|
|
37
|
+
*/
|
|
29
38
|
interface SubgraphTable {
|
|
30
39
|
columns: Record<string, SubgraphColumn>;
|
|
31
40
|
/** Composite indexes (each entry is an array of column names) */
|
|
32
|
-
indexes?: string[][];
|
|
41
|
+
indexes?: readonly (readonly string[])[];
|
|
33
42
|
/** Unique key constraints (each entry is an array of column names). Required for upsert. */
|
|
34
|
-
uniqueKeys?: string[][];
|
|
43
|
+
uniqueKeys?: readonly (readonly string[])[];
|
|
35
44
|
/** Foreign-key relations to other tables (for typed ORM joins). */
|
|
36
|
-
relations?: SubgraphRelation[];
|
|
45
|
+
relations?: readonly SubgraphRelation[];
|
|
37
46
|
}
|
|
38
47
|
/** Subgraph schema — maps table names to table definitions */
|
|
39
48
|
type SubgraphSchema = Record<string, SubgraphTable>;
|
|
@@ -68,6 +77,45 @@ interface StxLockFilter {
|
|
|
68
77
|
type TraitScope = {
|
|
69
78
|
trait?: string
|
|
70
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Scope a source to a DYNAMIC address set discovered from another source's
|
|
82
|
+
* events, instead of a fixed contract list.
|
|
83
|
+
*
|
|
84
|
+
* The standard shape it unlocks: a router plus pools created after you
|
|
85
|
+
* deploy. `contractId` arrays cover a set you know at authoring time; a
|
|
86
|
+
* factory covers the set that grows. It is deliberately NOT tied to contract
|
|
87
|
+
* deployment — the address can come from any field of any event, so it also
|
|
88
|
+
* covers launchpad-minted tokens, DAO extension allowlists, and registry
|
|
89
|
+
* entries.
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* sources: {
|
|
93
|
+
* registry: { type: "print_event", contractId: REGISTRY, topic: "pool-created" },
|
|
94
|
+
* swaps: {
|
|
95
|
+
* type: "print_event",
|
|
96
|
+
* topic: "swap",
|
|
97
|
+
* // every pool the registry has ever announced, including new ones
|
|
98
|
+
* factory: { from: "registry", field: "data.pool" },
|
|
99
|
+
* },
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* Two guarantees the runtime provides:
|
|
104
|
+
* - **Same-block ordering** — a contract discovered in block N receives its
|
|
105
|
+
* own block-N events. Discovery runs before matching, within the block.
|
|
106
|
+
* - **Reorg-scoped** — the discovered set is stamped with the block that
|
|
107
|
+
* revealed it and rolled back with everything else on a fork, so an address
|
|
108
|
+
* announced on an orphaned chain does not linger forever.
|
|
109
|
+
*/
|
|
110
|
+
interface FactoryScope {
|
|
111
|
+
factory?: {
|
|
112
|
+
/** Source name whose events reveal the addresses. */
|
|
113
|
+
from: string
|
|
114
|
+
/** Dotted path to the address on that source's payload
|
|
115
|
+
* (e.g. `"data.pool"`, `"contractId"`, `"data.token.id"`). */
|
|
116
|
+
field: string
|
|
117
|
+
};
|
|
118
|
+
}
|
|
71
119
|
/** FT event filters */
|
|
72
120
|
interface FtTransferFilter extends TraitScope {
|
|
73
121
|
type: "ft_transfer";
|
|
@@ -106,9 +154,19 @@ interface NftBurnFilter extends TraitScope {
|
|
|
106
154
|
sender?: string;
|
|
107
155
|
}
|
|
108
156
|
/** Contract event filters */
|
|
109
|
-
interface ContractCallFilter extends TraitScope {
|
|
157
|
+
interface ContractCallFilter extends TraitScope, FactoryScope {
|
|
110
158
|
type: "contract_call";
|
|
111
|
-
|
|
159
|
+
/**
|
|
160
|
+
* One contract id, or a SET of them (max 20) — the standard DeFi shape is
|
|
161
|
+
* a router plus N pools, which used to cost N near-identical sources and
|
|
162
|
+
* handlers, or the `"*"` catch-all that erases per-source typing. Payload
|
|
163
|
+
* types are identical per `type`, so one handler serves the set and
|
|
164
|
+
* `event.contractId` disambiguates.
|
|
165
|
+
*
|
|
166
|
+
* Supports `*` wildcards (e.g. `"SP1ABC….pool-*"`). Mutually exclusive
|
|
167
|
+
* with `trait`, which resolves its own set per block.
|
|
168
|
+
*/
|
|
169
|
+
contractId?: string | readonly string[];
|
|
112
170
|
functionName?: string;
|
|
113
171
|
caller?: string;
|
|
114
172
|
/**
|
|
@@ -124,18 +182,47 @@ interface ContractDeployFilter {
|
|
|
124
182
|
deployer?: string;
|
|
125
183
|
contractName?: string;
|
|
126
184
|
}
|
|
127
|
-
|
|
185
|
+
/**
|
|
186
|
+
* One declared field of a print payload.
|
|
187
|
+
*
|
|
188
|
+
* A bare {@link ColumnType} is a required scalar (`amount: "uint"`). The
|
|
189
|
+
* composite forms exist because real print payloads are not flat: BNS-V2
|
|
190
|
+
* emits `name` as a NESTED tuple, and a `prints` vocabulary that could only
|
|
191
|
+
* say `"jsonb"` is why a handler reading flat `data.name` type-checked,
|
|
192
|
+
* deployed, and then decoded to null on every event.
|
|
193
|
+
*
|
|
194
|
+
* - `{ type: F, optional: true }` — the KEY becomes optional on `event.data`
|
|
195
|
+
* (mirrors `always_present: false` in the inferred schema).
|
|
196
|
+
* - `{ tuple: { … } }` — a nested tuple, typed all the way down.
|
|
197
|
+
* - `{ list: F }` — a list of `F`.
|
|
198
|
+
*/
|
|
199
|
+
type PrintField = ColumnType | {
|
|
200
|
+
type: PrintField
|
|
201
|
+
optional: true
|
|
202
|
+
} | {
|
|
203
|
+
tuple: Record<string, PrintField>
|
|
204
|
+
} | {
|
|
205
|
+
list: PrintField
|
|
206
|
+
};
|
|
207
|
+
interface PrintEventFilter extends TraitScope, FactoryScope {
|
|
128
208
|
type: "print_event";
|
|
129
|
-
|
|
209
|
+
/** One contract id, or a set of them (max 20). Supports `*` wildcards.
|
|
210
|
+
* Mutually exclusive with `trait`. */
|
|
211
|
+
contractId?: string | readonly string[];
|
|
130
212
|
topic?: string;
|
|
131
213
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
214
|
+
* Per-topic field schema. When declared, the handler's `event` is a
|
|
215
|
+
* discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
134
216
|
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
135
|
-
*
|
|
136
|
-
*
|
|
217
|
+
* Nested tuples, lists, and optional fields are expressible — see
|
|
218
|
+
* {@link PrintField}.
|
|
219
|
+
*
|
|
220
|
+
* Declaring `prints` also opts the source into RUNTIME validation: an
|
|
221
|
+
* event whose decoded payload does not match is skipped and logged rather
|
|
222
|
+
* than written as nulls (and the deploy-time field lint is promoted from
|
|
223
|
+
* a warning to an error).
|
|
137
224
|
*/
|
|
138
|
-
prints?: Record<string, Record<string,
|
|
225
|
+
prints?: Record<string, Record<string, PrintField>>;
|
|
139
226
|
}
|
|
140
227
|
/** All subgraph filter types — discriminated on `type` */
|
|
141
228
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -223,14 +310,49 @@ declare const SubgraphNameSchema: z.ZodType<string>;
|
|
|
223
310
|
*/
|
|
224
311
|
declare const SqlIdentifierSchema: z.ZodType<string>;
|
|
225
312
|
declare const ColumnTypeSchema: z.ZodType<ColumnType>;
|
|
313
|
+
/**
|
|
314
|
+
* One declared print field: a bare column type, or a composite (optional,
|
|
315
|
+
* nested tuple, list). Recursive — real print payloads nest, and a vocabulary
|
|
316
|
+
* that could only say `"jsonb"` is what let a flat-field declaration pass
|
|
317
|
+
* while every event decoded to null.
|
|
318
|
+
*/
|
|
319
|
+
declare const PrintFieldSchema: z.ZodType<unknown>;
|
|
320
|
+
/**
|
|
321
|
+
* The canonical `AbiContract` shape, validated at deploy time.
|
|
322
|
+
*
|
|
323
|
+
* This used to be `z.record(z.string(), z.any())`, which accepted a raw
|
|
324
|
+
* Hiro/Clarinet ABI (`read_only` access, `buffer` types, outputs wrapped as
|
|
325
|
+
* `{ type: … }`) and let it through — the deploy succeeded and `event.input`
|
|
326
|
+
* then mis-decoded at RUNTIME, per event, forever. Reject it here instead,
|
|
327
|
+
* and name the fix: run it through `normalizeAbi` from
|
|
328
|
+
* `@secondlayer/stacks/clarity`.
|
|
329
|
+
*/
|
|
330
|
+
declare const AbiContractSchema: z.ZodType<unknown>;
|
|
226
331
|
declare const SubgraphColumnSchema: z.ZodType<SubgraphColumn>;
|
|
227
332
|
declare const SubgraphTableSchema: z.ZodType<SubgraphTable>;
|
|
228
333
|
declare const SubgraphSchemaSchema: z.ZodType<Record<string, SubgraphTable>>;
|
|
229
334
|
declare const VALID_FILTER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event"];
|
|
335
|
+
/**
|
|
336
|
+
* `trait` and `contractId` compose rather than conflict: the matcher ANDs
|
|
337
|
+
* them, so the pair means "contracts conforming to this trait, narrowed to
|
|
338
|
+
* these ids". (The Index READ API refuses the combination because its query
|
|
339
|
+
* planner picks one index path — that's an API constraint, not a semantic
|
|
340
|
+
* one, and subgraph sources are not bound by it.)
|
|
341
|
+
*/
|
|
230
342
|
declare const SubgraphFilterSchema: z.ZodType<SubgraphFilter>;
|
|
231
343
|
declare const SubgraphDefinitionSchema: z.ZodType<SubgraphDefinition>;
|
|
232
344
|
/**
|
|
233
345
|
* Validates a subgraph definition, returning the parsed result or throwing on failure.
|
|
234
346
|
*/
|
|
235
347
|
declare function validateSubgraphDefinition(def: unknown): SubgraphDefinition;
|
|
236
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Per-source-type field vocabulary, DERIVED from
|
|
350
|
+
* {@link SubgraphFilterSchema}. Agent-facing surfaces (the MCP filters
|
|
351
|
+
* reference) used to hand-maintain a parallel copy of this list; deriving it
|
|
352
|
+
* means adding a field to a filter can never leave the documentation behind.
|
|
353
|
+
*/
|
|
354
|
+
declare function filterFieldsByType(): Array<{
|
|
355
|
+
type: string
|
|
356
|
+
fields: string[]
|
|
357
|
+
}>;
|
|
358
|
+
export { validateSubgraphDefinition, filterFieldsByType, VALID_FILTER_TYPES, SubgraphTableSchema, SubgraphSchemaSchema, SubgraphNameSchema, SubgraphFilterSchema, SubgraphDefinitionSchema, SubgraphColumnSchema, SqlIdentifierSchema, PrintFieldSchema, ColumnTypeSchema, AbiContractSchema };
|
package/dist/src/validate.js
CHANGED
|
@@ -14,6 +14,44 @@ var ColumnTypeSchema = z.enum([
|
|
|
14
14
|
"timestamp",
|
|
15
15
|
"jsonb"
|
|
16
16
|
]);
|
|
17
|
+
var PrintFieldSchema = z.lazy(() => z.union([
|
|
18
|
+
ColumnTypeSchema,
|
|
19
|
+
z.object({ type: PrintFieldSchema, optional: z.literal(true) }),
|
|
20
|
+
z.object({ tuple: z.record(z.string(), PrintFieldSchema) }),
|
|
21
|
+
z.object({ list: PrintFieldSchema })
|
|
22
|
+
]));
|
|
23
|
+
var AbiTypeSchema = z.lazy(() => z.union([
|
|
24
|
+
z.string(),
|
|
25
|
+
z.object({ buff: z.object({ length: z.number() }) }),
|
|
26
|
+
z.object({ "string-ascii": z.object({ length: z.number() }) }),
|
|
27
|
+
z.object({ "string-utf8": z.object({ length: z.number() }) }),
|
|
28
|
+
z.object({ optional: AbiTypeSchema }),
|
|
29
|
+
z.object({
|
|
30
|
+
list: z.object({ type: AbiTypeSchema, length: z.number() })
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
tuple: z.array(z.object({ name: z.string(), type: AbiTypeSchema }))
|
|
34
|
+
}),
|
|
35
|
+
z.object({
|
|
36
|
+
response: z.object({ ok: AbiTypeSchema, error: AbiTypeSchema })
|
|
37
|
+
})
|
|
38
|
+
]));
|
|
39
|
+
var AbiContractSchema = z.object({
|
|
40
|
+
functions: z.array(z.object({
|
|
41
|
+
name: z.string(),
|
|
42
|
+
access: z.enum(["public", "read-only", "private"], {
|
|
43
|
+
message: "ABI access must be public | read-only | private — a raw Hiro/Clarinet ABI uses `read_only`. Normalize it first: normalizeAbi() from @secondlayer/stacks/clarity."
|
|
44
|
+
}),
|
|
45
|
+
args: z.array(z.object({ name: z.string(), type: AbiTypeSchema })),
|
|
46
|
+
outputs: AbiTypeSchema
|
|
47
|
+
})),
|
|
48
|
+
maps: z.array(z.unknown()).optional(),
|
|
49
|
+
variables: z.array(z.unknown()).optional(),
|
|
50
|
+
fungible_tokens: z.array(z.unknown()).optional(),
|
|
51
|
+
non_fungible_tokens: z.array(z.unknown()).optional(),
|
|
52
|
+
implemented_traits: z.array(z.unknown()).optional(),
|
|
53
|
+
defined_traits: z.array(z.unknown()).optional()
|
|
54
|
+
});
|
|
17
55
|
var SubgraphColumnSchema = z.object({
|
|
18
56
|
type: ColumnTypeSchema,
|
|
19
57
|
nullable: z.boolean().optional(),
|
|
@@ -48,24 +86,105 @@ var VALID_FILTER_TYPES = [
|
|
|
48
86
|
"contract_deploy",
|
|
49
87
|
"print_event"
|
|
50
88
|
];
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
89
|
+
var contractIdField = z.union([
|
|
90
|
+
z.string(),
|
|
91
|
+
z.array(z.string()).min(1).max(20)
|
|
92
|
+
]);
|
|
93
|
+
var traitScope = { trait: z.string().optional() };
|
|
94
|
+
var factoryScope = {
|
|
95
|
+
factory: z.object({ from: z.string().min(1), field: z.string().min(1) }).strict().optional()
|
|
96
|
+
};
|
|
97
|
+
var amountRange = {
|
|
55
98
|
minAmount: z.bigint().optional(),
|
|
56
|
-
maxAmount: z.bigint().optional()
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
maxAmount: z.bigint().optional()
|
|
100
|
+
};
|
|
101
|
+
var SubgraphFilterUnion = z.discriminatedUnion("type", [
|
|
102
|
+
z.object({
|
|
103
|
+
type: z.literal("stx_transfer"),
|
|
104
|
+
sender: z.string().optional(),
|
|
105
|
+
recipient: z.string().optional(),
|
|
106
|
+
...amountRange
|
|
107
|
+
}).strict(),
|
|
108
|
+
z.object({
|
|
109
|
+
type: z.literal("stx_mint"),
|
|
110
|
+
recipient: z.string().optional(),
|
|
111
|
+
minAmount: z.bigint().optional()
|
|
112
|
+
}).strict(),
|
|
113
|
+
z.object({
|
|
114
|
+
type: z.literal("stx_burn"),
|
|
115
|
+
sender: z.string().optional(),
|
|
116
|
+
minAmount: z.bigint().optional()
|
|
117
|
+
}).strict(),
|
|
118
|
+
z.object({
|
|
119
|
+
type: z.literal("stx_lock"),
|
|
120
|
+
lockedAddress: z.string().optional(),
|
|
121
|
+
minAmount: z.bigint().optional()
|
|
122
|
+
}).strict(),
|
|
123
|
+
z.object({
|
|
124
|
+
type: z.literal("ft_transfer"),
|
|
125
|
+
assetIdentifier: z.string().optional(),
|
|
126
|
+
sender: z.string().optional(),
|
|
127
|
+
recipient: z.string().optional(),
|
|
128
|
+
minAmount: z.bigint().optional(),
|
|
129
|
+
...traitScope
|
|
130
|
+
}).strict(),
|
|
131
|
+
z.object({
|
|
132
|
+
type: z.literal("ft_mint"),
|
|
133
|
+
assetIdentifier: z.string().optional(),
|
|
134
|
+
recipient: z.string().optional(),
|
|
135
|
+
minAmount: z.bigint().optional(),
|
|
136
|
+
...traitScope
|
|
137
|
+
}).strict(),
|
|
138
|
+
z.object({
|
|
139
|
+
type: z.literal("ft_burn"),
|
|
140
|
+
assetIdentifier: z.string().optional(),
|
|
141
|
+
sender: z.string().optional(),
|
|
142
|
+
minAmount: z.bigint().optional(),
|
|
143
|
+
...traitScope
|
|
144
|
+
}).strict(),
|
|
145
|
+
z.object({
|
|
146
|
+
type: z.literal("nft_transfer"),
|
|
147
|
+
assetIdentifier: z.string().optional(),
|
|
148
|
+
sender: z.string().optional(),
|
|
149
|
+
recipient: z.string().optional(),
|
|
150
|
+
...traitScope
|
|
151
|
+
}).strict(),
|
|
152
|
+
z.object({
|
|
153
|
+
type: z.literal("nft_mint"),
|
|
154
|
+
assetIdentifier: z.string().optional(),
|
|
155
|
+
recipient: z.string().optional(),
|
|
156
|
+
...traitScope
|
|
157
|
+
}).strict(),
|
|
158
|
+
z.object({
|
|
159
|
+
type: z.literal("nft_burn"),
|
|
160
|
+
assetIdentifier: z.string().optional(),
|
|
161
|
+
sender: z.string().optional(),
|
|
162
|
+
...traitScope
|
|
163
|
+
}).strict(),
|
|
164
|
+
z.object({
|
|
165
|
+
type: z.literal("contract_call"),
|
|
166
|
+
contractId: contractIdField.optional(),
|
|
167
|
+
functionName: z.string().optional(),
|
|
168
|
+
caller: z.string().optional(),
|
|
169
|
+
abi: AbiContractSchema.optional(),
|
|
170
|
+
...traitScope,
|
|
171
|
+
...factoryScope
|
|
172
|
+
}).strict(),
|
|
173
|
+
z.object({
|
|
174
|
+
type: z.literal("contract_deploy"),
|
|
175
|
+
deployer: z.string().optional(),
|
|
176
|
+
contractName: z.string().optional()
|
|
177
|
+
}).strict(),
|
|
178
|
+
z.object({
|
|
179
|
+
type: z.literal("print_event"),
|
|
180
|
+
contractId: contractIdField.optional(),
|
|
181
|
+
topic: z.string().optional(),
|
|
182
|
+
prints: z.record(z.string(), z.record(z.string(), PrintFieldSchema)).optional(),
|
|
183
|
+
...traitScope,
|
|
184
|
+
...factoryScope
|
|
185
|
+
}).strict()
|
|
186
|
+
]);
|
|
187
|
+
var SubgraphFilterSchema = SubgraphFilterUnion;
|
|
69
188
|
var SubgraphDefinitionSchema = z.object({
|
|
70
189
|
name: SubgraphNameSchema,
|
|
71
190
|
version: z.string().optional(),
|
|
@@ -79,8 +198,26 @@ var SubgraphDefinitionSchema = z.object({
|
|
|
79
198
|
function validateSubgraphDefinition(def) {
|
|
80
199
|
return SubgraphDefinitionSchema.parse(def);
|
|
81
200
|
}
|
|
201
|
+
function filterFieldsByType() {
|
|
202
|
+
const options = SubgraphFilterUnion?._def?.options ?? [];
|
|
203
|
+
const out = [];
|
|
204
|
+
for (const option of options) {
|
|
205
|
+
const shape = option?.shape ?? option?._def?.shape;
|
|
206
|
+
if (!shape)
|
|
207
|
+
continue;
|
|
208
|
+
const literal = shape.type?._def?.values?.[0] ?? shape.type?._def?.value ?? undefined;
|
|
209
|
+
if (typeof literal !== "string")
|
|
210
|
+
continue;
|
|
211
|
+
out.push({
|
|
212
|
+
type: literal,
|
|
213
|
+
fields: Object.keys(shape).filter((k) => k !== "type")
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
82
218
|
export {
|
|
83
219
|
validateSubgraphDefinition,
|
|
220
|
+
filterFieldsByType,
|
|
84
221
|
VALID_FILTER_TYPES,
|
|
85
222
|
SubgraphTableSchema,
|
|
86
223
|
SubgraphSchemaSchema,
|
|
@@ -89,8 +226,10 @@ export {
|
|
|
89
226
|
SubgraphDefinitionSchema,
|
|
90
227
|
SubgraphColumnSchema,
|
|
91
228
|
SqlIdentifierSchema,
|
|
92
|
-
|
|
229
|
+
PrintFieldSchema,
|
|
230
|
+
ColumnTypeSchema,
|
|
231
|
+
AbiContractSchema
|
|
93
232
|
};
|
|
94
233
|
|
|
95
|
-
//# debugId=
|
|
234
|
+
//# debugId=BAF10EBE9E88C37664756E2164756E21
|
|
96
235
|
//# sourceMappingURL=validate.js.map
|
package/dist/src/validate.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/validate.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod\";\nimport type {\n\tColumnType,\n\tSubgraphColumn,\n\tSubgraphDefinition,\n\tSubgraphFilter,\n\tSubgraphTable,\n} from \"./types.ts\";\n\nexport const SubgraphNameSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63)\n\t.regex(\n\t\t/^[a-z][a-z0-9-]*$/,\n\t\t\"Must start with lowercase letter, contain only lowercase alphanumeric and hyphens\",\n\t);\n\n/**\n * A safe SQL identifier (table or column name). Mirrors the runtime guard in\n * runtime/context.ts (validateColumnName) so the schema validator can never\n * accept a name the runtime would reject — and closes the deploy-time DDL\n * injection path in schema/generator.ts, which interpolates these names raw.\n */\nexport const SqlIdentifierSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63) // Postgres truncates identifiers > 63 bytes; reject rather than collide.\n\t.regex(\n\t\t/^[a-z_][a-z0-9_]*$/i,\n\t\t\"Must be a valid SQL identifier: start with a letter or underscore, then letters/digits/underscores only\",\n\t);\n\nexport const ColumnTypeSchema: z.ZodType<ColumnType> = z.enum([\n\t\"text\",\n\t\"uint\",\n\t\"int\",\n\t\"principal\",\n\t\"boolean\",\n\t\"timestamp\",\n\t\"jsonb\",\n]);\n\nexport const SubgraphColumnSchema: z.ZodType<SubgraphColumn> = z.object({\n\ttype: ColumnTypeSchema,\n\tnullable: z.boolean().optional(),\n\tindexed: z.boolean().optional(),\n\tsearch: z.boolean().optional(),\n\tdefault: z.union([z.string(), z.number(), z.boolean()]).optional(),\n}) as z.ZodType<SubgraphColumn>;\n\nexport const SubgraphTableSchema: z.ZodType<SubgraphTable> = z.object({\n\tcolumns: z\n\t\t.record(SqlIdentifierSchema, SubgraphColumnSchema)\n\t\t.refine(\n\t\t\t(c) => Object.keys(c).length > 0,\n\t\t\t\"Table must have at least one column\",\n\t\t),\n\tindexes: z.array(z.array(SqlIdentifierSchema)).optional(),\n\tuniqueKeys: z.array(z.array(SqlIdentifierSchema)).optional(),\n\trelations: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: SqlIdentifierSchema,\n\t\t\t\treferences: SqlIdentifierSchema,\n\t\t\t\tfields: z.array(SqlIdentifierSchema).min(1),\n\t\t\t\treferencedColumns: z.array(SqlIdentifierSchema).min(1),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n}) as z.ZodType<SubgraphTable>;\n\nexport const SubgraphSchemaSchema: z.ZodType<Record<string, SubgraphTable>> = z\n\t.record(SqlIdentifierSchema, SubgraphTableSchema)\n\t.refine(\n\t\t(s) => Object.keys(s).length > 0,\n\t\t\"Schema must have at least one table\",\n\t) as z.ZodType<Record<string, SubgraphTable>>;\n\nexport const VALID_FILTER_TYPES = [\n\t\"stx_transfer\",\n\t\"stx_mint\",\n\t\"stx_burn\",\n\t\"stx_lock\",\n\t\"ft_transfer\",\n\t\"ft_mint\",\n\t\"ft_burn\",\n\t\"nft_transfer\",\n\t\"nft_mint\",\n\t\"nft_burn\",\n\t\"contract_call\",\n\t\"contract_deploy\",\n\t\"print_event\",\n] as const;\n\nexport const SubgraphFilterSchema: z.ZodType<SubgraphFilter> = z\n\t.object({\n\t\ttype: z.enum(VALID_FILTER_TYPES),\n\t\t// All optional fields across all filter types\n\t\tsender: z.string().optional(),\n\t\trecipient: z.string().optional(),\n\t\tminAmount: z.bigint().optional(),\n\t\tmaxAmount: z.bigint().optional(),\n\t\tassetIdentifier: z.string().optional(),\n\t\tcontractId: z.string().optional(),\n\t\tfunctionName: z.string().optional(),\n\t\tcaller: z.string().optional(),\n\t\tdeployer: z.string().optional(),\n\t\tcontractName: z.string().optional(),\n\t\ttopic: z.string().optional(),\n\t\tlockedAddress: z.string().optional(),\n\t\tabi: z.record(z.string(), z.any()).optional(),\n\t\ttrait: z.string().optional(),\n\t\t// print_event per-topic field schema (type-level hints; not enforced at runtime)\n\t\tprints: z\n\t\t\t.record(z.string(), z.record(z.string(), ColumnTypeSchema))\n\t\t\t.optional(),\n\t})\n\t.strict() as unknown as z.ZodType<SubgraphFilter>;\n\nexport const SubgraphDefinitionSchema: z.ZodType<SubgraphDefinition> = z.object(\n\t{\n\t\tname: SubgraphNameSchema,\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\t// 'concurrent' = tip-first deploy: go live at tip immediately, fill\n\t\t// history via a background backfill. Only safe for order-tolerant\n\t\t// handlers (commutative or insert-only writes).\n\t\tbackfillMode: z.enum([\"blocking\", \"concurrent\"]).optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), SubgraphFilterSchema)\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: SubgraphSchemaSchema,\n\t\thandlers: z.record(z.string(), z.any()),\n\t},\n) as unknown as z.ZodType<SubgraphDefinition>;\n\n/**\n * Validates a subgraph definition, returning the parsed result or throwing on failure.\n */\nexport function validateSubgraphDefinition(def: unknown): SubgraphDefinition {\n\treturn SubgraphDefinitionSchema.parse(def);\n}\n"
|
|
5
|
+
"import { z } from \"zod\";\nimport type {\n\tColumnType,\n\tSubgraphColumn,\n\tSubgraphDefinition,\n\tSubgraphFilter,\n\tSubgraphTable,\n} from \"./types.ts\";\n\nexport const SubgraphNameSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63)\n\t.regex(\n\t\t/^[a-z][a-z0-9-]*$/,\n\t\t\"Must start with lowercase letter, contain only lowercase alphanumeric and hyphens\",\n\t);\n\n/**\n * A safe SQL identifier (table or column name). Mirrors the runtime guard in\n * runtime/context.ts (validateColumnName) so the schema validator can never\n * accept a name the runtime would reject — and closes the deploy-time DDL\n * injection path in schema/generator.ts, which interpolates these names raw.\n */\nexport const SqlIdentifierSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63) // Postgres truncates identifiers > 63 bytes; reject rather than collide.\n\t.regex(\n\t\t/^[a-z_][a-z0-9_]*$/i,\n\t\t\"Must be a valid SQL identifier: start with a letter or underscore, then letters/digits/underscores only\",\n\t);\n\nexport const ColumnTypeSchema: z.ZodType<ColumnType> = z.enum([\n\t\"text\",\n\t\"uint\",\n\t\"int\",\n\t\"principal\",\n\t\"boolean\",\n\t\"timestamp\",\n\t\"jsonb\",\n]);\n\n/**\n * One declared print field: a bare column type, or a composite (optional,\n * nested tuple, list). Recursive — real print payloads nest, and a vocabulary\n * that could only say `\"jsonb\"` is what let a flat-field declaration pass\n * while every event decoded to null.\n */\nexport const PrintFieldSchema: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tColumnTypeSchema,\n\t\tz.object({ type: PrintFieldSchema, optional: z.literal(true) }),\n\t\tz.object({ tuple: z.record(z.string(), PrintFieldSchema) }),\n\t\tz.object({ list: PrintFieldSchema }),\n\t]),\n);\n\n/**\n * A Clarity ABI type: a primitive name, or one of the composite shapes.\n * Recursive, so nested tuples/lists/optionals are checked all the way down.\n */\nconst AbiTypeSchema: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\tz.object({ buff: z.object({ length: z.number() }) }),\n\t\tz.object({ \"string-ascii\": z.object({ length: z.number() }) }),\n\t\tz.object({ \"string-utf8\": z.object({ length: z.number() }) }),\n\t\tz.object({ optional: AbiTypeSchema }),\n\t\tz.object({\n\t\t\tlist: z.object({ type: AbiTypeSchema, length: z.number() }),\n\t\t}),\n\t\tz.object({\n\t\t\ttuple: z.array(z.object({ name: z.string(), type: AbiTypeSchema })),\n\t\t}),\n\t\tz.object({\n\t\t\tresponse: z.object({ ok: AbiTypeSchema, error: AbiTypeSchema }),\n\t\t}),\n\t]),\n);\n\n/**\n * The canonical `AbiContract` shape, validated at deploy time.\n *\n * This used to be `z.record(z.string(), z.any())`, which accepted a raw\n * Hiro/Clarinet ABI (`read_only` access, `buffer` types, outputs wrapped as\n * `{ type: … }`) and let it through — the deploy succeeded and `event.input`\n * then mis-decoded at RUNTIME, per event, forever. Reject it here instead,\n * and name the fix: run it through `normalizeAbi` from\n * `@secondlayer/stacks/clarity`.\n */\nexport const AbiContractSchema: z.ZodType<unknown> = z.object({\n\tfunctions: z.array(\n\t\tz.object({\n\t\t\tname: z.string(),\n\t\t\taccess: z.enum([\"public\", \"read-only\", \"private\"], {\n\t\t\t\tmessage:\n\t\t\t\t\t\"ABI access must be public | read-only | private — a raw Hiro/Clarinet ABI uses `read_only`. Normalize it first: normalizeAbi() from @secondlayer/stacks/clarity.\",\n\t\t\t}),\n\t\t\targs: z.array(z.object({ name: z.string(), type: AbiTypeSchema })),\n\t\t\t// Canonical shape is a bare AbiType; raw ABIs wrap it as `{ type: … }`.\n\t\t\toutputs: AbiTypeSchema,\n\t\t}),\n\t),\n\tmaps: z.array(z.unknown()).optional(),\n\tvariables: z.array(z.unknown()).optional(),\n\tfungible_tokens: z.array(z.unknown()).optional(),\n\tnon_fungible_tokens: z.array(z.unknown()).optional(),\n\timplemented_traits: z.array(z.unknown()).optional(),\n\tdefined_traits: z.array(z.unknown()).optional(),\n});\n\nexport const SubgraphColumnSchema: z.ZodType<SubgraphColumn> = z.object({\n\ttype: ColumnTypeSchema,\n\tnullable: z.boolean().optional(),\n\tindexed: z.boolean().optional(),\n\tsearch: z.boolean().optional(),\n\tdefault: z.union([z.string(), z.number(), z.boolean()]).optional(),\n}) as z.ZodType<SubgraphColumn>;\n\nexport const SubgraphTableSchema: z.ZodType<SubgraphTable> = z.object({\n\tcolumns: z\n\t\t.record(SqlIdentifierSchema, SubgraphColumnSchema)\n\t\t.refine(\n\t\t\t(c) => Object.keys(c).length > 0,\n\t\t\t\"Table must have at least one column\",\n\t\t),\n\tindexes: z.array(z.array(SqlIdentifierSchema)).optional(),\n\tuniqueKeys: z.array(z.array(SqlIdentifierSchema)).optional(),\n\trelations: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: SqlIdentifierSchema,\n\t\t\t\treferences: SqlIdentifierSchema,\n\t\t\t\tfields: z.array(SqlIdentifierSchema).min(1),\n\t\t\t\treferencedColumns: z.array(SqlIdentifierSchema).min(1),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n}) as z.ZodType<SubgraphTable>;\n\nexport const SubgraphSchemaSchema: z.ZodType<Record<string, SubgraphTable>> = z\n\t.record(SqlIdentifierSchema, SubgraphTableSchema)\n\t.refine(\n\t\t(s) => Object.keys(s).length > 0,\n\t\t\"Schema must have at least one table\",\n\t) as z.ZodType<Record<string, SubgraphTable>>;\n\nexport const VALID_FILTER_TYPES = [\n\t\"stx_transfer\",\n\t\"stx_mint\",\n\t\"stx_burn\",\n\t\"stx_lock\",\n\t\"ft_transfer\",\n\t\"ft_mint\",\n\t\"ft_burn\",\n\t\"nft_transfer\",\n\t\"nft_mint\",\n\t\"nft_burn\",\n\t\"contract_call\",\n\t\"contract_deploy\",\n\t\"print_event\",\n] as const;\n\n/** A contract id, or a set of them (max 20, matching the Index API cap). */\nconst contractIdField = z.union([\n\tz.string(),\n\tz.array(z.string()).min(1).max(20),\n]);\n\n/** Fields shared by the trait-scopable filters. */\nconst traitScope = { trait: z.string().optional() };\n/** Dynamic address set discovered from another source's events. */\nconst factoryScope = {\n\tfactory: z\n\t\t.object({ from: z.string().min(1), field: z.string().min(1) })\n\t\t.strict()\n\t\t.optional(),\n};\nconst amountRange = {\n\tminAmount: z.bigint().optional(),\n\tmaxAmount: z.bigint().optional(),\n};\n\n/**\n * A REAL discriminated union — one member per source type, each `.strict()`\n * with only the fields that type actually supports.\n *\n * It used to be one flat object with every field optional, so\n * `{ type: \"contract_deploy\", assetIdentifier: \"SP…\", minAmount: 1n }`\n * validated clean at deploy and then matched nothing, forever. The runtime\n * union already knew better; only the validator didn't.\n */\nconst SubgraphFilterUnion = z.discriminatedUnion(\"type\", [\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_transfer\"),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...amountRange,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_mint\"),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_burn\"),\n\t\t\tsender: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_lock\"),\n\t\t\tlockedAddress: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_transfer\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_mint\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_burn\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_transfer\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_mint\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_burn\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"contract_call\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tfunctionName: z.string().optional(),\n\t\t\tcaller: z.string().optional(),\n\t\t\tabi: AbiContractSchema.optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"contract_deploy\"),\n\t\t\tdeployer: z.string().optional(),\n\t\t\tcontractName: z.string().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"print_event\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\ttopic: z.string().optional(),\n\t\t\tprints: z\n\t\t\t\t.record(z.string(), z.record(z.string(), PrintFieldSchema))\n\t\t\t\t.optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n]);\n\n/**\n * `trait` and `contractId` compose rather than conflict: the matcher ANDs\n * them, so the pair means \"contracts conforming to this trait, narrowed to\n * these ids\". (The Index READ API refuses the combination because its query\n * planner picks one index path — that's an API constraint, not a semantic\n * one, and subgraph sources are not bound by it.)\n */\nexport const SubgraphFilterSchema: z.ZodType<SubgraphFilter> =\n\tSubgraphFilterUnion as unknown as z.ZodType<SubgraphFilter>;\n\nexport const SubgraphDefinitionSchema: z.ZodType<SubgraphDefinition> = z.object(\n\t{\n\t\tname: SubgraphNameSchema,\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\t// 'concurrent' = tip-first deploy: go live at tip immediately, fill\n\t\t// history via a background backfill. Only safe for order-tolerant\n\t\t// handlers (commutative or insert-only writes).\n\t\tbackfillMode: z.enum([\"blocking\", \"concurrent\"]).optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), SubgraphFilterSchema)\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: SubgraphSchemaSchema,\n\t\thandlers: z.record(z.string(), z.any()),\n\t},\n) as unknown as z.ZodType<SubgraphDefinition>;\n\n/**\n * Validates a subgraph definition, returning the parsed result or throwing on failure.\n */\nexport function validateSubgraphDefinition(def: unknown): SubgraphDefinition {\n\treturn SubgraphDefinitionSchema.parse(def);\n}\n\n/**\n * Per-source-type field vocabulary, DERIVED from\n * {@link SubgraphFilterSchema}. Agent-facing surfaces (the MCP filters\n * reference) used to hand-maintain a parallel copy of this list; deriving it\n * means adding a field to a filter can never leave the documentation behind.\n */\nexport function filterFieldsByType(): Array<{\n\ttype: string;\n\tfields: string[];\n}> {\n\t// Read the UNION directly (SubgraphFilterSchema wraps it in superRefine).\n\t// biome-ignore lint/suspicious/noExplicitAny: reading zod's internal option shapes\n\tconst options = (SubgraphFilterUnion as any)?._def?.options ?? [];\n\tconst out: Array<{ type: string; fields: string[] }> = [];\n\tfor (const option of options) {\n\t\t// `.superRefine()` wraps the union, so unwrap one level when present.\n\t\tconst shape = option?.shape ?? option?._def?.shape;\n\t\tif (!shape) continue;\n\t\tconst literal =\n\t\t\tshape.type?._def?.values?.[0] ?? shape.type?._def?.value ?? undefined;\n\t\tif (typeof literal !== \"string\") continue;\n\t\tout.push({\n\t\t\ttype: literal,\n\t\t\tfields: Object.keys(shape).filter((k) => k !== \"type\"),\n\t\t});\n\t}\n\treturn out;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;AAAA;AASO,IAAM,qBAAwC,EACnD,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MACA,qBACA,mFACD;AAQM,IAAM,sBAAyC,EACpD,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MACA,uBACA,yGACD;AAEM,IAAM,m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MAAO;AAAA,IACZ,MAAM,UACL,MAAM,MAAM,MAAM,SAAS,MAAM,MAAM,MAAM,MAAM,SAAS;AAAA,IAC7D,IAAI,OAAO,YAAY;AAAA,MAAU;AAAA,IACjC,IAAI,KAAK;AAAA,MACR,MAAM;AAAA,MACN,QAAQ,OAAO,KAAK,KAAK,EAAE,OAAO,CAAC,MAAM,MAAM,MAAM;AAAA,IACtD,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA;",
|
|
8
|
+
"debugId": "BAF10EBE9E88C37664756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/subgraphs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,11 +43,13 @@
|
|
|
43
43
|
"./runtime/emitter": {
|
|
44
44
|
"types": "./dist/src/runtime/emitter.d.ts",
|
|
45
45
|
"import": "./dist/src/runtime/emitter.js"
|
|
46
|
+
},
|
|
47
|
+
"./testing": {
|
|
48
|
+
"types": "./dist/src/testing/index.d.ts",
|
|
49
|
+
"import": "./dist/src/testing/index.js"
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
|
-
"files": [
|
|
49
|
-
"dist"
|
|
50
|
-
],
|
|
52
|
+
"files": ["dist"],
|
|
51
53
|
"scripts": {
|
|
52
54
|
"build": "bunup",
|
|
53
55
|
"dev": "bunup --watch",
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
59
61
|
"@secondlayer/shared": "^7.0.3",
|
|
60
|
-
"@secondlayer/stacks": "^2.
|
|
62
|
+
"@secondlayer/stacks": "^2.21.1",
|
|
61
63
|
"esbuild": "^0.27.4",
|
|
62
64
|
"kysely": "0.28.17",
|
|
63
65
|
"zod": "^4.3.6"
|