@thru/indexer 0.2.21 → 0.2.23
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 +3 -3
- package/dist/index.cjs +6 -308
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -206
- package/dist/index.d.ts +2 -206
- package/dist/index.mjs +16 -309
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -14
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { PgTableWithColumns, PgColumn } from 'drizzle-orm/pg-core';
|
|
|
3
3
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Filter, Event, AccountState, ChainClientFactory } from '@thru/replay';
|
|
6
|
-
import { OpenAPIHono, z as z$1 } from '@hono/zod-openapi';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Schema type definitions with improved type safety.
|
|
@@ -493,7 +492,7 @@ interface AccountStream<TSchema extends SchemaDefinition = SchemaDefinition> {
|
|
|
493
492
|
* @example
|
|
494
493
|
* ```ts
|
|
495
494
|
* import { defineAccountStream, t } from "@thru/indexer";
|
|
496
|
-
* import { decodeAddress } from "@thru/helpers";
|
|
495
|
+
* import { decodeAddress } from "@thru/sdk/helpers";
|
|
497
496
|
* import type { AccountState } from "@thru/replay";
|
|
498
497
|
*
|
|
499
498
|
* export const tokenAccounts = defineAccountStream({
|
|
@@ -742,209 +741,6 @@ declare function getSchemaExports(config: {
|
|
|
742
741
|
tableNames?: Record<string, string>;
|
|
743
742
|
}): Record<string, PgTableWithColumns<any>>;
|
|
744
743
|
|
|
745
|
-
/**
|
|
746
|
-
* Route generation for event and account streams.
|
|
747
|
-
*
|
|
748
|
-
* Auto-generates list and get routes with filtering and pagination.
|
|
749
|
-
*/
|
|
750
|
-
|
|
751
|
-
interface MountRoutesOptions {
|
|
752
|
-
/** Database client */
|
|
753
|
-
db: DatabaseClient;
|
|
754
|
-
/** Event streams to create routes for */
|
|
755
|
-
eventStreams?: EventStream[];
|
|
756
|
-
/** Account streams to create routes for */
|
|
757
|
-
accountStreams?: AccountStream[];
|
|
758
|
-
/** Path prefix (default: "/api/v1") */
|
|
759
|
-
pathPrefix?: string;
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Mount auto-generated routes for event and account streams.
|
|
763
|
-
*
|
|
764
|
-
* @param app - Hono app to mount routes on
|
|
765
|
-
* @param options - Configuration options
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* ```ts
|
|
769
|
-
* import { OpenAPIHono } from "@hono/zod-openapi";
|
|
770
|
-
* import { mountStreamRoutes } from "@thru/indexer";
|
|
771
|
-
* import { transfers } from "./streams/transfers";
|
|
772
|
-
* import { tokenAccounts } from "./account-streams/token-accounts";
|
|
773
|
-
*
|
|
774
|
-
* const app = new OpenAPIHono();
|
|
775
|
-
*
|
|
776
|
-
* mountStreamRoutes(app, {
|
|
777
|
-
* db,
|
|
778
|
-
* eventStreams: [transfers],
|
|
779
|
-
* accountStreams: [tokenAccounts],
|
|
780
|
-
* });
|
|
781
|
-
*
|
|
782
|
-
* // Routes generated:
|
|
783
|
-
* // GET /api/v1/transfers
|
|
784
|
-
* // GET /api/v1/transfers/:id
|
|
785
|
-
* // GET /api/v1/token-accounts
|
|
786
|
-
* // GET /api/v1/token-accounts/:address
|
|
787
|
-
* ```
|
|
788
|
-
*/
|
|
789
|
-
declare function mountStreamRoutes(app: OpenAPIHono, options: MountRoutesOptions): void;
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* Schema generation utilities.
|
|
793
|
-
*
|
|
794
|
-
* Generates Zod schemas and serializers from Drizzle tables.
|
|
795
|
-
*/
|
|
796
|
-
|
|
797
|
-
interface GeneratedSchemas {
|
|
798
|
-
/** Row schema (database types) */
|
|
799
|
-
row: z$1.ZodTypeAny;
|
|
800
|
-
/** Insert schema (validation for inserts) */
|
|
801
|
-
insert: z$1.ZodTypeAny;
|
|
802
|
-
/** API output schema (serialized for JSON) */
|
|
803
|
-
api: z$1.ZodTypeAny;
|
|
804
|
-
/** Serialize a database row for API output */
|
|
805
|
-
serialize: (row: Record<string, unknown>) => Record<string, unknown>;
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Generate Zod schemas from a Drizzle table.
|
|
809
|
-
*
|
|
810
|
-
* Handles bigint → string and Date → ISO string serialization
|
|
811
|
-
* for JSON-safe API responses.
|
|
812
|
-
*
|
|
813
|
-
* @param table - Drizzle table
|
|
814
|
-
* @param name - Schema name for OpenAPI
|
|
815
|
-
* @param suffix - Suffix for OpenAPI schema name (e.g., "Event", "Account")
|
|
816
|
-
* @returns Generated schemas and serializer
|
|
817
|
-
*/
|
|
818
|
-
declare function generateSchemas(table: PgTableWithColumns<any>, name: string, suffix?: string): GeneratedSchemas;
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* Pagination utilities for API routes.
|
|
822
|
-
*/
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Query parameters for paginated list endpoints.
|
|
826
|
-
*/
|
|
827
|
-
declare const paginationQuerySchema: z$1.ZodObject<{
|
|
828
|
-
limit: z$1.ZodDefault<z$1.ZodNumber>;
|
|
829
|
-
offset: z$1.ZodDefault<z$1.ZodNumber>;
|
|
830
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
831
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
832
|
-
limit: number;
|
|
833
|
-
offset: number;
|
|
834
|
-
cursor?: string | undefined;
|
|
835
|
-
}, {
|
|
836
|
-
limit?: number | undefined;
|
|
837
|
-
offset?: number | undefined;
|
|
838
|
-
cursor?: string | undefined;
|
|
839
|
-
}>;
|
|
840
|
-
type PaginationQuery = z$1.infer<typeof paginationQuerySchema>;
|
|
841
|
-
/**
|
|
842
|
-
* Pagination metadata in responses.
|
|
843
|
-
*/
|
|
844
|
-
declare const paginationResponseSchema: z$1.ZodObject<{
|
|
845
|
-
limit: z$1.ZodNumber;
|
|
846
|
-
offset: z$1.ZodNumber;
|
|
847
|
-
hasMore: z$1.ZodBoolean;
|
|
848
|
-
nextCursor: z$1.ZodNullable<z$1.ZodString>;
|
|
849
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
850
|
-
limit: number;
|
|
851
|
-
offset: number;
|
|
852
|
-
hasMore: boolean;
|
|
853
|
-
nextCursor: string | null;
|
|
854
|
-
}, {
|
|
855
|
-
limit: number;
|
|
856
|
-
offset: number;
|
|
857
|
-
hasMore: boolean;
|
|
858
|
-
nextCursor: string | null;
|
|
859
|
-
}>;
|
|
860
|
-
type PaginationResponse = z$1.infer<typeof paginationResponseSchema>;
|
|
861
|
-
/**
|
|
862
|
-
* Wrap a schema in a data response.
|
|
863
|
-
*/
|
|
864
|
-
declare function dataResponse<T extends z$1.ZodTypeAny>(schema: T): z$1.ZodObject<{
|
|
865
|
-
data: T;
|
|
866
|
-
}, "strip", z$1.ZodTypeAny, z$1.objectUtil.addQuestionMarks<z$1.baseObjectOutputType<{
|
|
867
|
-
data: T;
|
|
868
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z$1.baseObjectInputType<{
|
|
869
|
-
data: T;
|
|
870
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
871
|
-
/**
|
|
872
|
-
* Wrap a schema in a list response with pagination.
|
|
873
|
-
*/
|
|
874
|
-
declare function listResponse<T extends z$1.ZodTypeAny>(schema: T): z$1.ZodObject<{
|
|
875
|
-
data: z$1.ZodArray<T, "many">;
|
|
876
|
-
pagination: z$1.ZodObject<{
|
|
877
|
-
limit: z$1.ZodNumber;
|
|
878
|
-
offset: z$1.ZodNumber;
|
|
879
|
-
hasMore: z$1.ZodBoolean;
|
|
880
|
-
nextCursor: z$1.ZodNullable<z$1.ZodString>;
|
|
881
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
882
|
-
limit: number;
|
|
883
|
-
offset: number;
|
|
884
|
-
hasMore: boolean;
|
|
885
|
-
nextCursor: string | null;
|
|
886
|
-
}, {
|
|
887
|
-
limit: number;
|
|
888
|
-
offset: number;
|
|
889
|
-
hasMore: boolean;
|
|
890
|
-
nextCursor: string | null;
|
|
891
|
-
}>;
|
|
892
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
893
|
-
data: T["_output"][];
|
|
894
|
-
pagination: {
|
|
895
|
-
limit: number;
|
|
896
|
-
offset: number;
|
|
897
|
-
hasMore: boolean;
|
|
898
|
-
nextCursor: string | null;
|
|
899
|
-
};
|
|
900
|
-
}, {
|
|
901
|
-
data: T["_input"][];
|
|
902
|
-
pagination: {
|
|
903
|
-
limit: number;
|
|
904
|
-
offset: number;
|
|
905
|
-
hasMore: boolean;
|
|
906
|
-
nextCursor: string | null;
|
|
907
|
-
};
|
|
908
|
-
}>;
|
|
909
|
-
/**
|
|
910
|
-
* Standard error response schema.
|
|
911
|
-
*/
|
|
912
|
-
declare const errorSchema: z$1.ZodObject<{
|
|
913
|
-
error: z$1.ZodString;
|
|
914
|
-
code: z$1.ZodOptional<z$1.ZodString>;
|
|
915
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
916
|
-
error: string;
|
|
917
|
-
code?: string | undefined;
|
|
918
|
-
}, {
|
|
919
|
-
error: string;
|
|
920
|
-
code?: string | undefined;
|
|
921
|
-
}>;
|
|
922
|
-
type ErrorResponse = z$1.infer<typeof errorSchema>;
|
|
923
|
-
interface PaginationResult<T> {
|
|
924
|
-
data: T[];
|
|
925
|
-
pagination: PaginationResponse;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Process raw results into paginated response.
|
|
929
|
-
* Expects `limit + 1` rows to determine hasMore.
|
|
930
|
-
*
|
|
931
|
-
* @param rows - Query results (should have limit + 1 rows)
|
|
932
|
-
* @param query - The pagination query parameters
|
|
933
|
-
* @param getCursor - Optional function to get cursor from last item
|
|
934
|
-
* @returns Paginated result with data and pagination metadata
|
|
935
|
-
*/
|
|
936
|
-
declare function paginate<T>(rows: T[], query: PaginationQuery, getCursor?: (item: T) => string | null): PaginationResult<T>;
|
|
937
|
-
/**
|
|
938
|
-
* Parse a cursor string into slot and id components.
|
|
939
|
-
*
|
|
940
|
-
* @param cursor - Cursor string in format "slot:id"
|
|
941
|
-
* @returns Parsed cursor or null if invalid
|
|
942
|
-
*/
|
|
943
|
-
declare function parseCursor(cursor: string): {
|
|
944
|
-
slot: bigint;
|
|
945
|
-
id: string;
|
|
946
|
-
} | null;
|
|
947
|
-
|
|
948
744
|
/**
|
|
949
745
|
* Indexer configuration types.
|
|
950
746
|
*/
|
|
@@ -1061,4 +857,4 @@ declare class Indexer {
|
|
|
1061
857
|
isRunning(): boolean;
|
|
1062
858
|
}
|
|
1063
859
|
|
|
1064
|
-
export { type AccountStream, type AccountStreamDefinition, type AnyColumnDef, type ApiConfig, type Checkpoint, type ColumnBuilder, type ColumnDef, type Columns, type DatabaseClient, type
|
|
860
|
+
export { type AccountStream, type AccountStreamDefinition, type AnyColumnDef, type ApiConfig, type Checkpoint, type ColumnBuilder, type ColumnDef, type Columns, type DatabaseClient, type EventStream, type EventStreamDefinition, type HookContext, Indexer, type IndexerConfig, type IndexerResult, type InferInsert, type InferRow, type SchemaDefinition, type StreamBatch, checkpointTable, columnBuilder, defineAccountStream, defineEventStream, deleteCheckpoint, generateZodSchema, getAllCheckpoints, getCheckpoint, getSchemaExports, t, updateCheckpoint, validateParsedData };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { PgTableWithColumns, PgColumn } from 'drizzle-orm/pg-core';
|
|
|
3
3
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Filter, Event, AccountState, ChainClientFactory } from '@thru/replay';
|
|
6
|
-
import { OpenAPIHono, z as z$1 } from '@hono/zod-openapi';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Schema type definitions with improved type safety.
|
|
@@ -493,7 +492,7 @@ interface AccountStream<TSchema extends SchemaDefinition = SchemaDefinition> {
|
|
|
493
492
|
* @example
|
|
494
493
|
* ```ts
|
|
495
494
|
* import { defineAccountStream, t } from "@thru/indexer";
|
|
496
|
-
* import { decodeAddress } from "@thru/helpers";
|
|
495
|
+
* import { decodeAddress } from "@thru/sdk/helpers";
|
|
497
496
|
* import type { AccountState } from "@thru/replay";
|
|
498
497
|
*
|
|
499
498
|
* export const tokenAccounts = defineAccountStream({
|
|
@@ -742,209 +741,6 @@ declare function getSchemaExports(config: {
|
|
|
742
741
|
tableNames?: Record<string, string>;
|
|
743
742
|
}): Record<string, PgTableWithColumns<any>>;
|
|
744
743
|
|
|
745
|
-
/**
|
|
746
|
-
* Route generation for event and account streams.
|
|
747
|
-
*
|
|
748
|
-
* Auto-generates list and get routes with filtering and pagination.
|
|
749
|
-
*/
|
|
750
|
-
|
|
751
|
-
interface MountRoutesOptions {
|
|
752
|
-
/** Database client */
|
|
753
|
-
db: DatabaseClient;
|
|
754
|
-
/** Event streams to create routes for */
|
|
755
|
-
eventStreams?: EventStream[];
|
|
756
|
-
/** Account streams to create routes for */
|
|
757
|
-
accountStreams?: AccountStream[];
|
|
758
|
-
/** Path prefix (default: "/api/v1") */
|
|
759
|
-
pathPrefix?: string;
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Mount auto-generated routes for event and account streams.
|
|
763
|
-
*
|
|
764
|
-
* @param app - Hono app to mount routes on
|
|
765
|
-
* @param options - Configuration options
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* ```ts
|
|
769
|
-
* import { OpenAPIHono } from "@hono/zod-openapi";
|
|
770
|
-
* import { mountStreamRoutes } from "@thru/indexer";
|
|
771
|
-
* import { transfers } from "./streams/transfers";
|
|
772
|
-
* import { tokenAccounts } from "./account-streams/token-accounts";
|
|
773
|
-
*
|
|
774
|
-
* const app = new OpenAPIHono();
|
|
775
|
-
*
|
|
776
|
-
* mountStreamRoutes(app, {
|
|
777
|
-
* db,
|
|
778
|
-
* eventStreams: [transfers],
|
|
779
|
-
* accountStreams: [tokenAccounts],
|
|
780
|
-
* });
|
|
781
|
-
*
|
|
782
|
-
* // Routes generated:
|
|
783
|
-
* // GET /api/v1/transfers
|
|
784
|
-
* // GET /api/v1/transfers/:id
|
|
785
|
-
* // GET /api/v1/token-accounts
|
|
786
|
-
* // GET /api/v1/token-accounts/:address
|
|
787
|
-
* ```
|
|
788
|
-
*/
|
|
789
|
-
declare function mountStreamRoutes(app: OpenAPIHono, options: MountRoutesOptions): void;
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* Schema generation utilities.
|
|
793
|
-
*
|
|
794
|
-
* Generates Zod schemas and serializers from Drizzle tables.
|
|
795
|
-
*/
|
|
796
|
-
|
|
797
|
-
interface GeneratedSchemas {
|
|
798
|
-
/** Row schema (database types) */
|
|
799
|
-
row: z$1.ZodTypeAny;
|
|
800
|
-
/** Insert schema (validation for inserts) */
|
|
801
|
-
insert: z$1.ZodTypeAny;
|
|
802
|
-
/** API output schema (serialized for JSON) */
|
|
803
|
-
api: z$1.ZodTypeAny;
|
|
804
|
-
/** Serialize a database row for API output */
|
|
805
|
-
serialize: (row: Record<string, unknown>) => Record<string, unknown>;
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Generate Zod schemas from a Drizzle table.
|
|
809
|
-
*
|
|
810
|
-
* Handles bigint → string and Date → ISO string serialization
|
|
811
|
-
* for JSON-safe API responses.
|
|
812
|
-
*
|
|
813
|
-
* @param table - Drizzle table
|
|
814
|
-
* @param name - Schema name for OpenAPI
|
|
815
|
-
* @param suffix - Suffix for OpenAPI schema name (e.g., "Event", "Account")
|
|
816
|
-
* @returns Generated schemas and serializer
|
|
817
|
-
*/
|
|
818
|
-
declare function generateSchemas(table: PgTableWithColumns<any>, name: string, suffix?: string): GeneratedSchemas;
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* Pagination utilities for API routes.
|
|
822
|
-
*/
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Query parameters for paginated list endpoints.
|
|
826
|
-
*/
|
|
827
|
-
declare const paginationQuerySchema: z$1.ZodObject<{
|
|
828
|
-
limit: z$1.ZodDefault<z$1.ZodNumber>;
|
|
829
|
-
offset: z$1.ZodDefault<z$1.ZodNumber>;
|
|
830
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
831
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
832
|
-
limit: number;
|
|
833
|
-
offset: number;
|
|
834
|
-
cursor?: string | undefined;
|
|
835
|
-
}, {
|
|
836
|
-
limit?: number | undefined;
|
|
837
|
-
offset?: number | undefined;
|
|
838
|
-
cursor?: string | undefined;
|
|
839
|
-
}>;
|
|
840
|
-
type PaginationQuery = z$1.infer<typeof paginationQuerySchema>;
|
|
841
|
-
/**
|
|
842
|
-
* Pagination metadata in responses.
|
|
843
|
-
*/
|
|
844
|
-
declare const paginationResponseSchema: z$1.ZodObject<{
|
|
845
|
-
limit: z$1.ZodNumber;
|
|
846
|
-
offset: z$1.ZodNumber;
|
|
847
|
-
hasMore: z$1.ZodBoolean;
|
|
848
|
-
nextCursor: z$1.ZodNullable<z$1.ZodString>;
|
|
849
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
850
|
-
limit: number;
|
|
851
|
-
offset: number;
|
|
852
|
-
hasMore: boolean;
|
|
853
|
-
nextCursor: string | null;
|
|
854
|
-
}, {
|
|
855
|
-
limit: number;
|
|
856
|
-
offset: number;
|
|
857
|
-
hasMore: boolean;
|
|
858
|
-
nextCursor: string | null;
|
|
859
|
-
}>;
|
|
860
|
-
type PaginationResponse = z$1.infer<typeof paginationResponseSchema>;
|
|
861
|
-
/**
|
|
862
|
-
* Wrap a schema in a data response.
|
|
863
|
-
*/
|
|
864
|
-
declare function dataResponse<T extends z$1.ZodTypeAny>(schema: T): z$1.ZodObject<{
|
|
865
|
-
data: T;
|
|
866
|
-
}, "strip", z$1.ZodTypeAny, z$1.objectUtil.addQuestionMarks<z$1.baseObjectOutputType<{
|
|
867
|
-
data: T;
|
|
868
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z$1.baseObjectInputType<{
|
|
869
|
-
data: T;
|
|
870
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
871
|
-
/**
|
|
872
|
-
* Wrap a schema in a list response with pagination.
|
|
873
|
-
*/
|
|
874
|
-
declare function listResponse<T extends z$1.ZodTypeAny>(schema: T): z$1.ZodObject<{
|
|
875
|
-
data: z$1.ZodArray<T, "many">;
|
|
876
|
-
pagination: z$1.ZodObject<{
|
|
877
|
-
limit: z$1.ZodNumber;
|
|
878
|
-
offset: z$1.ZodNumber;
|
|
879
|
-
hasMore: z$1.ZodBoolean;
|
|
880
|
-
nextCursor: z$1.ZodNullable<z$1.ZodString>;
|
|
881
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
882
|
-
limit: number;
|
|
883
|
-
offset: number;
|
|
884
|
-
hasMore: boolean;
|
|
885
|
-
nextCursor: string | null;
|
|
886
|
-
}, {
|
|
887
|
-
limit: number;
|
|
888
|
-
offset: number;
|
|
889
|
-
hasMore: boolean;
|
|
890
|
-
nextCursor: string | null;
|
|
891
|
-
}>;
|
|
892
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
893
|
-
data: T["_output"][];
|
|
894
|
-
pagination: {
|
|
895
|
-
limit: number;
|
|
896
|
-
offset: number;
|
|
897
|
-
hasMore: boolean;
|
|
898
|
-
nextCursor: string | null;
|
|
899
|
-
};
|
|
900
|
-
}, {
|
|
901
|
-
data: T["_input"][];
|
|
902
|
-
pagination: {
|
|
903
|
-
limit: number;
|
|
904
|
-
offset: number;
|
|
905
|
-
hasMore: boolean;
|
|
906
|
-
nextCursor: string | null;
|
|
907
|
-
};
|
|
908
|
-
}>;
|
|
909
|
-
/**
|
|
910
|
-
* Standard error response schema.
|
|
911
|
-
*/
|
|
912
|
-
declare const errorSchema: z$1.ZodObject<{
|
|
913
|
-
error: z$1.ZodString;
|
|
914
|
-
code: z$1.ZodOptional<z$1.ZodString>;
|
|
915
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
916
|
-
error: string;
|
|
917
|
-
code?: string | undefined;
|
|
918
|
-
}, {
|
|
919
|
-
error: string;
|
|
920
|
-
code?: string | undefined;
|
|
921
|
-
}>;
|
|
922
|
-
type ErrorResponse = z$1.infer<typeof errorSchema>;
|
|
923
|
-
interface PaginationResult<T> {
|
|
924
|
-
data: T[];
|
|
925
|
-
pagination: PaginationResponse;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Process raw results into paginated response.
|
|
929
|
-
* Expects `limit + 1` rows to determine hasMore.
|
|
930
|
-
*
|
|
931
|
-
* @param rows - Query results (should have limit + 1 rows)
|
|
932
|
-
* @param query - The pagination query parameters
|
|
933
|
-
* @param getCursor - Optional function to get cursor from last item
|
|
934
|
-
* @returns Paginated result with data and pagination metadata
|
|
935
|
-
*/
|
|
936
|
-
declare function paginate<T>(rows: T[], query: PaginationQuery, getCursor?: (item: T) => string | null): PaginationResult<T>;
|
|
937
|
-
/**
|
|
938
|
-
* Parse a cursor string into slot and id components.
|
|
939
|
-
*
|
|
940
|
-
* @param cursor - Cursor string in format "slot:id"
|
|
941
|
-
* @returns Parsed cursor or null if invalid
|
|
942
|
-
*/
|
|
943
|
-
declare function parseCursor(cursor: string): {
|
|
944
|
-
slot: bigint;
|
|
945
|
-
id: string;
|
|
946
|
-
} | null;
|
|
947
|
-
|
|
948
744
|
/**
|
|
949
745
|
* Indexer configuration types.
|
|
950
746
|
*/
|
|
@@ -1061,4 +857,4 @@ declare class Indexer {
|
|
|
1061
857
|
isRunning(): boolean;
|
|
1062
858
|
}
|
|
1063
859
|
|
|
1064
|
-
export { type AccountStream, type AccountStreamDefinition, type AnyColumnDef, type ApiConfig, type Checkpoint, type ColumnBuilder, type ColumnDef, type Columns, type DatabaseClient, type
|
|
860
|
+
export { type AccountStream, type AccountStreamDefinition, type AnyColumnDef, type ApiConfig, type Checkpoint, type ColumnBuilder, type ColumnDef, type Columns, type DatabaseClient, type EventStream, type EventStreamDefinition, type HookContext, Indexer, type IndexerConfig, type IndexerResult, type InferInsert, type InferRow, type SchemaDefinition, type StreamBatch, checkpointTable, columnBuilder, defineAccountStream, defineEventStream, deleteCheckpoint, generateZodSchema, getAllCheckpoints, getCheckpoint, getSchemaExports, t, updateCheckpoint, validateParsedData };
|