@secondlayer/subgraphs 3.3.0 → 3.5.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 +29 -2
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -308,6 +308,12 @@ type ComparisonFilter<T> = {
|
|
|
308
308
|
gte?: T
|
|
309
309
|
lt?: T
|
|
310
310
|
lte?: T
|
|
311
|
+
/** Match any value in the set. */
|
|
312
|
+
in?: T[]
|
|
313
|
+
/** Match none of the values in the set. */
|
|
314
|
+
notIn?: T[]
|
|
315
|
+
/** SQL ILIKE pattern (case-insensitive); `%`/`_` wildcards. Strings only. */
|
|
316
|
+
like?: string
|
|
311
317
|
};
|
|
312
318
|
/** Where clause — each column accepts a scalar (eq) or comparison object */
|
|
313
319
|
type WhereInput<TRow> = { [K in keyof TRow]? : TRow[K] | ComparisonFilter<TRow[K]> };
|
|
@@ -327,16 +333,37 @@ type SystemOrderByAliases = {
|
|
|
327
333
|
createdAt?: "asc" | "desc"
|
|
328
334
|
id?: "asc" | "desc"
|
|
329
335
|
};
|
|
336
|
+
/** Ordered list form for deterministic multi-column sort. */
|
|
337
|
+
type OrderByList<TRow> = Array<[keyof (TRow & SystemOrderByAliases) & string, "asc" | "desc"]>;
|
|
330
338
|
interface FindManyOptions<TRow> {
|
|
331
339
|
where?: WhereInput<TRow> & SystemWhereAliases;
|
|
332
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Single-key object (common case) OR an ordered `[column, direction][]` list
|
|
342
|
+
* for deterministic multi-column sort (object key order isn't guaranteed).
|
|
343
|
+
*/
|
|
344
|
+
orderBy?: ({ [K in keyof TRow]? : "asc" | "desc" } & SystemOrderByAliases) | OrderByList<TRow>;
|
|
333
345
|
limit?: number;
|
|
334
346
|
offset?: number;
|
|
335
347
|
fields?: (keyof TRow & string)[];
|
|
336
348
|
}
|
|
349
|
+
/** Options for the realtime row stream (SSE). */
|
|
350
|
+
interface SubscribeOptions<TRow> {
|
|
351
|
+
/** Same column filters as `findMany`, applied server-side per row. */
|
|
352
|
+
where?: WhereInput<TRow> & SystemWhereAliases;
|
|
353
|
+
/** Replay rows from this block height, then tail live. Omit for go-forward only. */
|
|
354
|
+
since?: number;
|
|
355
|
+
/** Called on stream/connection errors. */
|
|
356
|
+
onError?: (err: unknown) => void;
|
|
357
|
+
}
|
|
337
358
|
interface SubgraphTableClient<TRow> {
|
|
338
359
|
findMany(options?: FindManyOptions<TRow>): Promise<TRow[]>;
|
|
339
360
|
count(where?: WhereInput<TRow> & SystemWhereAliases): Promise<number>;
|
|
361
|
+
/**
|
|
362
|
+
* Stream rows as they're indexed over Server-Sent Events. `onRow` fires for
|
|
363
|
+
* each new row (block-cadence). Returns an unsubscribe function that closes
|
|
364
|
+
* the connection. Requires a global `EventSource` (browsers, Node >= 22).
|
|
365
|
+
*/
|
|
366
|
+
subscribe(onRow: (row: TRow) => void, options?: SubscribeOptions<TRow>): () => void;
|
|
340
367
|
}
|
|
341
368
|
/** A column is optional on insert when it's nullable or has a SQL default. */
|
|
342
369
|
type IsOptionalColumn<C> = C extends {
|
|
@@ -669,4 +696,4 @@ declare function deploySchema(db: AnyDb, def: SubgraphDefinition, handlerPath: s
|
|
|
669
696
|
version: string
|
|
670
697
|
diff?: DeployDiff
|
|
671
698
|
}>;
|
|
672
|
-
export { validateSubgraphDefinition, resumeReindex, renderDeployPlan, reindexSubgraph, pgSchemaName, generateSubgraphSQL, generatePrismaSchema, generateDrizzleSchema, diffSchema, deploySchema, defineSubgraph, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, RowValue, ReindexOptions, PrismaGenOptions, PrintEventPayload, PrintEventFor, PrintEventFilter, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, InferTableRow, InferSubgraphClient, InferColumnType, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, EventForFilter, DrizzleGenOptions, DeployPlan, ContractDeployPayload, ContractDeployFilter, ContractCallPayload, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, AnyEvent };
|
|
699
|
+
export { validateSubgraphDefinition, resumeReindex, renderDeployPlan, reindexSubgraph, pgSchemaName, generateSubgraphSQL, generatePrismaSchema, generateDrizzleSchema, diffSchema, deploySchema, defineSubgraph, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubscribeOptions, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, RowValue, ReindexOptions, PrismaGenOptions, PrintEventPayload, PrintEventFor, PrintEventFilter, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, InferTableRow, InferSubgraphClient, InferColumnType, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, EventForFilter, DrizzleGenOptions, DeployPlan, ContractDeployPayload, ContractDeployFilter, ContractCallPayload, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, AnyEvent };
|