ponder 0.16.9 → 0.17.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/CHANGELOG.md +29 -0
- package/dist/esm/bin/commands/codegen.js +3 -12
- package/dist/esm/bin/commands/codegen.js.map +1 -1
- package/dist/esm/bin/commands/createViews.js +2 -5
- package/dist/esm/bin/commands/createViews.js.map +1 -1
- package/dist/esm/bin/commands/dev.js +4 -22
- package/dist/esm/bin/commands/dev.js.map +1 -1
- package/dist/esm/bin/commands/list.js +4 -8
- package/dist/esm/bin/commands/list.js.map +1 -1
- package/dist/esm/bin/commands/prune.js +4 -8
- package/dist/esm/bin/commands/prune.js.map +1 -1
- package/dist/esm/bin/commands/serve.js +5 -20
- package/dist/esm/bin/commands/serve.js.map +1 -1
- package/dist/esm/bin/commands/start.js +4 -20
- package/dist/esm/bin/commands/start.js.map +1 -1
- package/dist/esm/bin/isolatedController.js +3 -3
- package/dist/esm/bin/isolatedController.js.map +1 -1
- package/dist/esm/bin/isolatedWorker.js +0 -5
- package/dist/esm/bin/isolatedWorker.js.map +1 -1
- package/dist/esm/bin/ponder.js.map +1 -1
- package/dist/esm/bin/utils/exit.js +1 -5
- package/dist/esm/bin/utils/exit.js.map +1 -1
- package/dist/esm/build/config.js +2 -2
- package/dist/esm/build/config.js.map +1 -1
- package/dist/esm/build/factory.js +1 -1
- package/dist/esm/build/factory.js.map +1 -1
- package/dist/esm/build/index.js +17 -14
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/pre.js +2 -2
- package/dist/esm/build/pre.js.map +1 -1
- package/dist/esm/build/schema.js +2 -2
- package/dist/esm/build/schema.js.map +1 -1
- package/dist/esm/build/stacktrace.js +5 -5
- package/dist/esm/build/stacktrace.js.map +1 -1
- package/dist/esm/client/index.js +8 -9
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/database/actions.js +7 -9
- package/dist/esm/database/actions.js.map +1 -1
- package/dist/esm/database/index.js +7 -7
- package/dist/esm/database/index.js.map +1 -1
- package/dist/esm/database/queryBuilder.js +4 -7
- package/dist/esm/database/queryBuilder.js.map +1 -1
- package/dist/esm/drizzle/bigint.js +3 -5
- package/dist/esm/drizzle/bigint.js.map +1 -1
- package/dist/esm/drizzle/bytes.js +3 -5
- package/dist/esm/drizzle/bytes.js.map +1 -1
- package/dist/esm/drizzle/hex.js +3 -5
- package/dist/esm/drizzle/hex.js.map +1 -1
- package/dist/esm/drizzle/index.js.map +1 -1
- package/dist/esm/drizzle/json.js +8 -12
- package/dist/esm/drizzle/json.js.map +1 -1
- package/dist/esm/drizzle/kit/index.js +24 -38
- package/dist/esm/drizzle/kit/index.js.map +1 -1
- package/dist/esm/drizzle/onchain.js +15 -17
- package/dist/esm/drizzle/onchain.js.map +1 -1
- package/dist/esm/drizzle/text.js +3 -5
- package/dist/esm/drizzle/text.js.map +1 -1
- package/dist/esm/graphql/index.js +6 -6
- package/dist/esm/graphql/index.js.map +1 -1
- package/dist/esm/graphql/json.js.map +1 -1
- package/dist/esm/graphql/middleware.js +2 -2
- package/dist/esm/graphql/middleware.js.map +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/indexing/addStackTrace.js +1 -1
- package/dist/esm/indexing/addStackTrace.js.map +1 -1
- package/dist/esm/indexing/client.js +11 -12
- package/dist/esm/indexing/client.js.map +1 -1
- package/dist/esm/indexing/index.js +6 -4
- package/dist/esm/indexing/index.js.map +1 -1
- package/dist/esm/indexing/profile.js +2 -2
- package/dist/esm/indexing/profile.js.map +1 -1
- package/dist/esm/indexing-store/cache.js +4 -4
- package/dist/esm/indexing-store/cache.js.map +1 -1
- package/dist/esm/indexing-store/index.js +10 -13
- package/dist/esm/indexing-store/index.js.map +1 -1
- package/dist/esm/indexing-store/profile.js +3 -3
- package/dist/esm/indexing-store/profile.js.map +1 -1
- package/dist/esm/indexing-store/utils.js +3 -3
- package/dist/esm/indexing-store/utils.js.map +1 -1
- package/dist/esm/internal/logger.js +7 -7
- package/dist/esm/internal/logger.js.map +1 -1
- package/dist/esm/internal/metrics.js +15 -15
- package/dist/esm/internal/metrics.js.map +1 -1
- package/dist/esm/internal/options.js +6 -9
- package/dist/esm/internal/options.js.map +1 -1
- package/dist/esm/internal/shutdown.js.map +1 -1
- package/dist/esm/rpc/actions.js +7 -8
- package/dist/esm/rpc/actions.js.map +1 -1
- package/dist/esm/rpc/http.js +8 -4
- package/dist/esm/rpc/http.js.map +1 -1
- package/dist/esm/rpc/index.js +19 -19
- package/dist/esm/rpc/index.js.map +1 -1
- package/dist/esm/runtime/events.js +7 -9
- package/dist/esm/runtime/events.js.map +1 -1
- package/dist/esm/runtime/filter.js +1 -1
- package/dist/esm/runtime/filter.js.map +1 -1
- package/dist/esm/runtime/fragments.js.map +1 -1
- package/dist/esm/runtime/historical.js +7 -7
- package/dist/esm/runtime/historical.js.map +1 -1
- package/dist/esm/runtime/index.js +2 -2
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/isolated.js +18 -11
- package/dist/esm/runtime/isolated.js.map +1 -1
- package/dist/esm/runtime/multichain.js +19 -12
- package/dist/esm/runtime/multichain.js.map +1 -1
- package/dist/esm/runtime/omnichain.js +19 -12
- package/dist/esm/runtime/omnichain.js.map +1 -1
- package/dist/esm/runtime/realtime.js +12 -12
- package/dist/esm/runtime/realtime.js.map +1 -1
- package/dist/esm/server/error.js +1 -1
- package/dist/esm/server/error.js.map +1 -1
- package/dist/esm/server/index.js +4 -4
- package/dist/esm/server/index.js.map +1 -1
- package/dist/esm/sync-historical/index.js +2 -2
- package/dist/esm/sync-historical/index.js.map +1 -1
- package/dist/esm/sync-realtime/bloom.js +1 -1
- package/dist/esm/sync-realtime/bloom.js.map +1 -1
- package/dist/esm/sync-realtime/index.js +1 -1
- package/dist/esm/sync-realtime/index.js.map +1 -1
- package/dist/esm/sync-store/encode.js +1 -1
- package/dist/esm/sync-store/encode.js.map +1 -1
- package/dist/esm/sync-store/index.js +12 -31
- package/dist/esm/sync-store/index.js.map +1 -1
- package/dist/esm/sync-store/migrations.js +1 -1
- package/dist/esm/sync-store/migrations.js.map +1 -1
- package/dist/esm/sync-store/schema.js +2 -2
- package/dist/esm/sync-store/schema.js.map +1 -1
- package/dist/esm/types/db.js.map +1 -1
- package/dist/esm/ui/app.js +2 -2
- package/dist/esm/ui/app.js.map +1 -1
- package/dist/esm/ui/patch.js +1 -2
- package/dist/esm/ui/patch.js.map +1 -1
- package/dist/esm/utils/abi.js +1 -1
- package/dist/esm/utils/abi.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/checkpoint.js.map +1 -1
- package/dist/esm/utils/chunk.js.map +1 -1
- package/dist/esm/utils/copy.js +1 -1
- package/dist/esm/utils/copy.js.map +1 -1
- package/dist/esm/utils/decodeAbiParameters.js +2 -3
- package/dist/esm/utils/decodeAbiParameters.js.map +1 -1
- package/dist/esm/utils/decodeEventLog.js.map +1 -1
- package/dist/esm/utils/duplicates.js.map +1 -1
- package/dist/esm/utils/finality.js.map +1 -1
- package/dist/esm/utils/generators.js.map +1 -1
- package/dist/esm/utils/interval.js.map +1 -1
- package/dist/esm/utils/mutex.js.map +1 -1
- package/dist/esm/utils/offset.js.map +1 -1
- package/dist/esm/utils/order.js.map +1 -1
- package/dist/esm/utils/partition.js.map +1 -1
- package/dist/esm/utils/pg.js +2 -2
- package/dist/esm/utils/pg.js.map +1 -1
- package/dist/esm/utils/pglite.js +4 -6
- package/dist/esm/utils/pglite.js.map +1 -1
- package/dist/esm/utils/port.js.map +1 -1
- package/dist/esm/utils/promiseAllSettledWithThrow.js.map +1 -1
- package/dist/esm/utils/queue.js +7 -7
- package/dist/esm/utils/queue.js.map +1 -1
- package/dist/esm/utils/result.js +1 -1
- package/dist/esm/utils/result.js.map +1 -1
- package/dist/esm/utils/sql-parse.js +10 -10
- package/dist/esm/utils/sql-parse.js.map +1 -1
- package/dist/esm/utils/zipper.js.map +1 -1
- package/dist/types/bin/commands/codegen.d.ts.map +1 -1
- package/dist/types/bin/commands/createViews.d.ts.map +1 -1
- package/dist/types/bin/commands/dev.d.ts.map +1 -1
- package/dist/types/bin/commands/list.d.ts.map +1 -1
- package/dist/types/bin/commands/prune.d.ts.map +1 -1
- package/dist/types/bin/commands/serve.d.ts.map +1 -1
- package/dist/types/bin/commands/start.d.ts.map +1 -1
- package/dist/types/bin/isolatedController.d.ts.map +1 -1
- package/dist/types/bin/isolatedWorker.d.ts.map +1 -1
- package/dist/types/bin/ponder.d.ts +1 -1
- package/dist/types/bin/ponder.d.ts.map +1 -1
- package/dist/types/bin/utils/exit.d.ts +1 -1
- package/dist/types/bin/utils/exit.d.ts.map +1 -1
- package/dist/types/build/config.d.ts +1 -1
- package/dist/types/build/config.d.ts.map +1 -1
- package/dist/types/build/factory.d.ts.map +1 -1
- package/dist/types/build/index.d.ts +1 -1
- package/dist/types/build/index.d.ts.map +1 -1
- package/dist/types/build/plugin.d.ts +1 -1
- package/dist/types/build/plugin.d.ts.map +1 -1
- package/dist/types/build/schema.d.ts.map +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/config/address.d.ts +1 -1
- package/dist/types/config/address.d.ts.map +1 -1
- package/dist/types/config/index.d.ts +6 -6
- package/dist/types/config/index.d.ts.map +1 -1
- package/dist/types/database/actions.d.ts +5 -5
- package/dist/types/database/actions.d.ts.map +1 -1
- package/dist/types/database/index.d.ts +2 -2
- package/dist/types/database/index.d.ts.map +1 -1
- package/dist/types/database/queryBuilder.d.ts +4 -4
- package/dist/types/database/queryBuilder.d.ts.map +1 -1
- package/dist/types/drizzle/bigint.d.ts +1 -1
- package/dist/types/drizzle/bigint.d.ts.map +1 -1
- package/dist/types/drizzle/bytes.d.ts +2 -1
- package/dist/types/drizzle/bytes.d.ts.map +1 -1
- package/dist/types/drizzle/hex.d.ts +1 -1
- package/dist/types/drizzle/hex.d.ts.map +1 -1
- package/dist/types/drizzle/index.d.ts.map +1 -1
- package/dist/types/drizzle/json.d.ts.map +1 -1
- package/dist/types/drizzle/kit/index.d.ts.map +1 -1
- package/dist/types/drizzle/onchain.d.ts +1 -1
- package/dist/types/drizzle/onchain.d.ts.map +1 -1
- package/dist/types/drizzle/text.d.ts +1 -1
- package/dist/types/drizzle/text.d.ts.map +1 -1
- package/dist/types/graphql/index.d.ts +2 -2
- package/dist/types/graphql/index.d.ts.map +1 -1
- package/dist/types/graphql/middleware.d.ts +3 -3
- package/dist/types/graphql/middleware.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/indexing/addStackTrace.d.ts.map +1 -1
- package/dist/types/indexing/client.d.ts +2 -3
- package/dist/types/indexing/client.d.ts.map +1 -1
- package/dist/types/indexing/index.d.ts +2 -2
- package/dist/types/indexing/index.d.ts.map +1 -1
- package/dist/types/indexing/profile.d.ts.map +1 -1
- package/dist/types/indexing-store/cache.d.ts +2 -2
- package/dist/types/indexing-store/cache.d.ts.map +1 -1
- package/dist/types/indexing-store/index.d.ts +3 -4
- package/dist/types/indexing-store/index.d.ts.map +1 -1
- package/dist/types/indexing-store/profile.d.ts +1 -1
- package/dist/types/indexing-store/profile.d.ts.map +1 -1
- package/dist/types/indexing-store/utils.d.ts.map +1 -1
- package/dist/types/internal/common.d.ts +0 -2
- package/dist/types/internal/common.d.ts.map +1 -1
- package/dist/types/internal/logger.d.ts +1 -1
- package/dist/types/internal/logger.d.ts.map +1 -1
- package/dist/types/internal/metrics.d.ts +1 -1
- package/dist/types/internal/metrics.d.ts.map +1 -1
- package/dist/types/internal/options.d.ts +1 -7
- package/dist/types/internal/options.d.ts.map +1 -1
- package/dist/types/internal/types.d.ts +4 -4
- package/dist/types/internal/types.d.ts.map +1 -1
- package/dist/types/rpc/actions.d.ts.map +1 -1
- package/dist/types/rpc/http.d.ts +1 -1
- package/dist/types/rpc/http.d.ts.map +1 -1
- package/dist/types/rpc/index.d.ts +2 -2
- package/dist/types/rpc/index.d.ts.map +1 -1
- package/dist/types/runtime/events.d.ts +1 -1
- package/dist/types/runtime/events.d.ts.map +1 -1
- package/dist/types/runtime/filter.d.ts +1 -1
- package/dist/types/runtime/filter.d.ts.map +1 -1
- package/dist/types/runtime/fragments.d.ts +1 -1
- package/dist/types/runtime/fragments.d.ts.map +1 -1
- package/dist/types/runtime/historical.d.ts.map +1 -1
- package/dist/types/runtime/index.d.ts +2 -3
- package/dist/types/runtime/index.d.ts.map +1 -1
- package/dist/types/runtime/isolated.d.ts.map +1 -1
- package/dist/types/runtime/multichain.d.ts.map +1 -1
- package/dist/types/runtime/omnichain.d.ts.map +1 -1
- package/dist/types/runtime/realtime.d.ts.map +1 -1
- package/dist/types/server/error.d.ts +1 -1
- package/dist/types/server/error.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/sync-historical/index.d.ts +1 -1
- package/dist/types/sync-historical/index.d.ts.map +1 -1
- package/dist/types/sync-realtime/bloom.d.ts +1 -1
- package/dist/types/sync-realtime/bloom.d.ts.map +1 -1
- package/dist/types/sync-realtime/index.d.ts +1 -1
- package/dist/types/sync-realtime/index.d.ts.map +1 -1
- package/dist/types/sync-store/encode.d.ts.map +1 -1
- package/dist/types/sync-store/index.d.ts +2 -2
- package/dist/types/sync-store/index.d.ts.map +1 -1
- package/dist/types/sync-store/migrations.d.ts +1 -1
- package/dist/types/sync-store/migrations.d.ts.map +1 -1
- package/dist/types/sync-store/schema.d.ts +2 -2
- package/dist/types/sync-store/schema.d.ts.map +1 -1
- package/dist/types/types/db.d.ts +3 -3
- package/dist/types/types/db.d.ts.map +1 -1
- package/dist/types/ui/app.d.ts +3 -3
- package/dist/types/ui/app.d.ts.map +1 -1
- package/dist/types/ui/patch.d.ts.map +1 -1
- package/dist/types/utils/abi.d.ts.map +1 -1
- package/dist/types/utils/chains.d.ts +2 -0
- package/dist/types/utils/chains.d.ts.map +1 -1
- package/dist/types/utils/checkpoint.d.ts.map +1 -1
- package/dist/types/utils/chunk.d.ts.map +1 -1
- package/dist/types/utils/copy.d.ts.map +1 -1
- package/dist/types/utils/decodeAbiParameters.d.ts.map +1 -1
- package/dist/types/utils/estimate.d.ts.map +1 -1
- package/dist/types/utils/partition.d.ts.map +1 -1
- package/dist/types/utils/pg.d.ts +1 -1
- package/dist/types/utils/pg.d.ts.map +1 -1
- package/dist/types/utils/pglite.d.ts +1 -1
- package/dist/types/utils/pglite.d.ts.map +1 -1
- package/dist/types/utils/port.d.ts.map +1 -1
- package/dist/types/utils/promiseWithResolvers.d.ts.map +1 -1
- package/dist/types/utils/queue.d.ts.map +1 -1
- package/dist/types/utils/result.d.ts.map +1 -1
- package/dist/types/utils/zipper.d.ts +2 -2
- package/dist/types/utils/zipper.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/bin/commands/codegen.ts +3 -13
- package/src/bin/commands/createViews.ts +3 -6
- package/src/bin/commands/dev.ts +5 -25
- package/src/bin/commands/list.ts +6 -9
- package/src/bin/commands/prune.ts +6 -9
- package/src/bin/commands/serve.ts +5 -21
- package/src/bin/commands/start.ts +5 -22
- package/src/bin/isolatedController.ts +1 -1
- package/src/bin/isolatedWorker.ts +0 -6
- package/src/bin/ponder.ts +1 -1
- package/src/bin/utils/exit.ts +1 -9
- package/src/build/config.ts +22 -16
- package/src/build/factory.ts +2 -2
- package/src/build/index.ts +29 -19
- package/src/build/plugin.ts +1 -1
- package/src/build/pre.ts +2 -2
- package/src/build/schema.ts +20 -14
- package/src/build/stacktrace.ts +5 -5
- package/src/client/index.ts +23 -21
- package/src/config/address.ts +1 -1
- package/src/config/index.ts +1 -1
- package/src/database/actions.ts +18 -20
- package/src/database/index.ts +17 -17
- package/src/database/queryBuilder.ts +12 -14
- package/src/drizzle/bigint.ts +4 -4
- package/src/drizzle/bytes.ts +4 -4
- package/src/drizzle/hex.ts +4 -4
- package/src/drizzle/index.ts +1 -1
- package/src/drizzle/json.ts +6 -6
- package/src/drizzle/kit/index.ts +30 -44
- package/src/drizzle/onchain.ts +27 -23
- package/src/drizzle/text.ts +2 -2
- package/src/graphql/index.ts +16 -14
- package/src/graphql/json.ts +1 -1
- package/src/graphql/middleware.ts +6 -4
- package/src/index.ts +75 -83
- package/src/indexing/addStackTrace.ts +3 -3
- package/src/indexing/client.ts +40 -37
- package/src/indexing/index.ts +8 -6
- package/src/indexing/profile.ts +3 -3
- package/src/indexing-store/cache.ts +15 -15
- package/src/indexing-store/index.ts +26 -25
- package/src/indexing-store/profile.ts +4 -4
- package/src/indexing-store/utils.ts +11 -11
- package/src/internal/common.ts +0 -2
- package/src/internal/logger.ts +12 -9
- package/src/internal/metrics.ts +4 -4
- package/src/internal/options.ts +2 -10
- package/src/internal/types.ts +13 -13
- package/src/rpc/actions.ts +16 -17
- package/src/rpc/http.ts +9 -5
- package/src/rpc/index.ts +20 -16
- package/src/runtime/events.ts +22 -21
- package/src/runtime/filter.ts +9 -3
- package/src/runtime/fragments.ts +1 -1
- package/src/runtime/historical.ts +9 -6
- package/src/runtime/index.ts +6 -4
- package/src/runtime/isolated.ts +26 -20
- package/src/runtime/multichain.ts +24 -18
- package/src/runtime/omnichain.ts +24 -18
- package/src/runtime/realtime.ts +9 -11
- package/src/server/error.ts +2 -2
- package/src/server/index.ts +5 -5
- package/src/sync-historical/index.ts +13 -13
- package/src/sync-realtime/bloom.ts +1 -1
- package/src/sync-realtime/index.ts +7 -7
- package/src/sync-store/encode.ts +2 -2
- package/src/sync-store/index.ts +33 -58
- package/src/sync-store/migrations.ts +1 -1
- package/src/sync-store/schema.ts +1 -1
- package/src/types/db.ts +3 -3
- package/src/types.d.ts +2 -0
- package/src/ui/app.ts +1 -1
- package/src/ui/patch.ts +2 -3
- package/src/utils/abi.ts +7 -4
- package/src/utils/checkpoint.ts +1 -1
- package/src/utils/copy.ts +1 -1
- package/src/utils/decodeAbiParameters.ts +5 -7
- package/src/utils/pg.ts +1 -1
- package/src/utils/pglite.ts +5 -6
- package/src/utils/queue.ts +4 -4
- package/src/utils/result.ts +1 -1
- package/src/utils/sql-parse.ts +6 -6
- package/dist/esm/internal/telemetry.js +0 -200
- package/dist/esm/internal/telemetry.js.map +0 -1
- package/dist/types/internal/telemetry.d.ts +0 -43
- package/dist/types/internal/telemetry.d.ts.map +0 -1
- package/src/internal/telemetry.ts +0 -303
package/src/index.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
loadBalance,
|
|
3
|
+
type MergeAbis,
|
|
4
|
+
mergeAbis,
|
|
5
|
+
type ReplaceBigInts,
|
|
6
|
+
rateLimit,
|
|
7
|
+
replaceBigInts,
|
|
8
|
+
} from "@ponder/utils";
|
|
2
9
|
export { factory } from "@/config/address.js";
|
|
10
|
+
export { createConfig } from "@/config/index.js";
|
|
3
11
|
export type {
|
|
4
12
|
Block,
|
|
5
13
|
Log,
|
|
@@ -7,14 +15,6 @@ export type {
|
|
|
7
15
|
TransactionReceipt,
|
|
8
16
|
} from "@/types/eth.js";
|
|
9
17
|
export type { Virtual } from "@/types/virtual.js";
|
|
10
|
-
export {
|
|
11
|
-
type MergeAbis,
|
|
12
|
-
type ReplaceBigInts,
|
|
13
|
-
mergeAbis,
|
|
14
|
-
loadBalance,
|
|
15
|
-
rateLimit,
|
|
16
|
-
replaceBigInts,
|
|
17
|
-
} from "@ponder/utils";
|
|
18
18
|
|
|
19
19
|
import type { Config } from "@/config/index.js";
|
|
20
20
|
import type { Prettify } from "./types/utils.js";
|
|
@@ -24,23 +24,45 @@ export type ChainConfig = Prettify<Config["chains"][string]>;
|
|
|
24
24
|
export type BlockConfig = Prettify<Config["blocks"][string]>;
|
|
25
25
|
export type DatabaseConfig = Prettify<Config["database"]>;
|
|
26
26
|
|
|
27
|
-
export type { CreateConfigReturnType } from "@/config/index.js";
|
|
28
|
-
export type { GetEventFilter } from "@/config/eventFilter.js";
|
|
29
|
-
export type { AddressConfig, Factory } from "@/config/address.js";
|
|
30
|
-
|
|
31
27
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
and,
|
|
29
|
+
asc,
|
|
30
|
+
avg,
|
|
31
|
+
avgDistinct,
|
|
32
|
+
between,
|
|
33
|
+
count,
|
|
34
|
+
countDistinct,
|
|
35
|
+
desc,
|
|
36
|
+
eq,
|
|
37
|
+
exists,
|
|
38
|
+
gt,
|
|
39
|
+
gte,
|
|
40
|
+
ilike,
|
|
41
|
+
inArray,
|
|
42
|
+
isNotNull,
|
|
43
|
+
isNull,
|
|
44
|
+
like,
|
|
45
|
+
lt,
|
|
46
|
+
lte,
|
|
47
|
+
max,
|
|
48
|
+
min,
|
|
49
|
+
ne,
|
|
50
|
+
not,
|
|
51
|
+
notBetween,
|
|
52
|
+
notExists,
|
|
53
|
+
notIlike,
|
|
54
|
+
notInArray,
|
|
55
|
+
notLike,
|
|
56
|
+
or,
|
|
57
|
+
relations,
|
|
58
|
+
sql,
|
|
59
|
+
sum,
|
|
60
|
+
sumDistinct,
|
|
61
|
+
} from "drizzle-orm";
|
|
40
62
|
export type {
|
|
41
63
|
AnyPgColumn,
|
|
42
|
-
PgColumn,
|
|
43
64
|
ExtraConfigColumn,
|
|
65
|
+
PgColumn,
|
|
44
66
|
PgColumnBuilder,
|
|
45
67
|
PgColumnBuilderBase,
|
|
46
68
|
PgEnumColumnBuilder,
|
|
@@ -51,66 +73,22 @@ export type {
|
|
|
51
73
|
PgTextConfig,
|
|
52
74
|
TableConfig,
|
|
53
75
|
} from "drizzle-orm/pg-core";
|
|
54
|
-
|
|
55
|
-
export type {
|
|
56
|
-
OnchainTable,
|
|
57
|
-
BuildExtraConfigColumns,
|
|
58
|
-
PgColumnsBuilders,
|
|
59
|
-
PrimaryKeyBuilder,
|
|
60
|
-
OnchainEnum,
|
|
61
|
-
} from "@/drizzle/onchain.js";
|
|
62
|
-
|
|
63
|
-
export type { ReadonlyDrizzle } from "@/types/db.js";
|
|
64
|
-
|
|
65
|
-
export { client } from "@/client/index.js";
|
|
66
|
-
|
|
67
|
-
export { graphql } from "@/graphql/middleware.js";
|
|
68
|
-
|
|
69
|
-
export {
|
|
70
|
-
sql,
|
|
71
|
-
eq,
|
|
72
|
-
gt,
|
|
73
|
-
gte,
|
|
74
|
-
lt,
|
|
75
|
-
lte,
|
|
76
|
-
ne,
|
|
77
|
-
isNull,
|
|
78
|
-
isNotNull,
|
|
79
|
-
inArray,
|
|
80
|
-
notInArray,
|
|
81
|
-
exists,
|
|
82
|
-
notExists,
|
|
83
|
-
between,
|
|
84
|
-
notBetween,
|
|
85
|
-
like,
|
|
86
|
-
notLike,
|
|
87
|
-
ilike,
|
|
88
|
-
notIlike,
|
|
89
|
-
not,
|
|
90
|
-
asc,
|
|
91
|
-
desc,
|
|
92
|
-
and,
|
|
93
|
-
or,
|
|
94
|
-
count,
|
|
95
|
-
countDistinct,
|
|
96
|
-
avg,
|
|
97
|
-
avgDistinct,
|
|
98
|
-
sum,
|
|
99
|
-
sumDistinct,
|
|
100
|
-
max,
|
|
101
|
-
min,
|
|
102
|
-
relations,
|
|
103
|
-
} from "drizzle-orm";
|
|
104
|
-
|
|
105
76
|
export {
|
|
77
|
+
alias,
|
|
106
78
|
bigint as int8,
|
|
107
79
|
boolean,
|
|
108
80
|
char,
|
|
109
81
|
cidr,
|
|
110
82
|
date,
|
|
111
83
|
doublePrecision,
|
|
84
|
+
except,
|
|
85
|
+
exceptAll,
|
|
86
|
+
foreignKey,
|
|
87
|
+
index,
|
|
112
88
|
inet,
|
|
113
89
|
integer,
|
|
90
|
+
intersect,
|
|
91
|
+
intersectAll,
|
|
114
92
|
interval,
|
|
115
93
|
json,
|
|
116
94
|
jsonb,
|
|
@@ -124,16 +102,30 @@ export {
|
|
|
124
102
|
text,
|
|
125
103
|
time,
|
|
126
104
|
timestamp,
|
|
127
|
-
uuid,
|
|
128
|
-
varchar,
|
|
129
|
-
index,
|
|
130
|
-
uniqueIndex,
|
|
131
|
-
alias,
|
|
132
|
-
foreignKey,
|
|
133
105
|
union,
|
|
134
106
|
unionAll,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
exceptAll,
|
|
107
|
+
uniqueIndex,
|
|
108
|
+
uuid,
|
|
109
|
+
varchar,
|
|
139
110
|
} from "drizzle-orm/pg-core";
|
|
111
|
+
export { client } from "@/client/index.js";
|
|
112
|
+
export type { AddressConfig, Factory } from "@/config/address.js";
|
|
113
|
+
export type { GetEventFilter } from "@/config/eventFilter.js";
|
|
114
|
+
export type { CreateConfigReturnType } from "@/config/index.js";
|
|
115
|
+
export type {
|
|
116
|
+
BuildExtraConfigColumns,
|
|
117
|
+
OnchainEnum,
|
|
118
|
+
OnchainTable,
|
|
119
|
+
PgColumnsBuilders,
|
|
120
|
+
PrimaryKeyBuilder,
|
|
121
|
+
} from "@/drizzle/onchain.js";
|
|
122
|
+
export {
|
|
123
|
+
bigint,
|
|
124
|
+
hex,
|
|
125
|
+
onchainEnum,
|
|
126
|
+
onchainTable,
|
|
127
|
+
onchainView,
|
|
128
|
+
primaryKey,
|
|
129
|
+
} from "@/drizzle/onchain.js";
|
|
130
|
+
export { graphql } from "@/graphql/middleware.js";
|
|
131
|
+
export type { ReadonlyDrizzle } from "@/types/db.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import type { Options } from "@/internal/options.js";
|
|
3
2
|
import { codeFrameColumns } from "@babel/code-frame";
|
|
4
|
-
import {
|
|
3
|
+
import { parse as parseStackTrace, type StackFrame } from "stacktrace-parser";
|
|
4
|
+
import type { Options } from "@/internal/options.js";
|
|
5
5
|
|
|
6
6
|
// Note: this currently works for both indexing functions and api
|
|
7
7
|
// routes only because the api route dir is a subdir of the indexing function
|
|
@@ -41,7 +41,7 @@ export const addStackTrace = (error: Error, options: Options) => {
|
|
|
41
41
|
},
|
|
42
42
|
{ highlightCode: true },
|
|
43
43
|
);
|
|
44
|
-
} catch (
|
|
44
|
+
} catch (_err) {
|
|
45
45
|
// Ignore errors here.
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/indexing/client.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import type { Common } from "@/internal/common.js";
|
|
2
|
-
import type { Chain, IndexingBuild, SetupEvent } from "@/internal/types.js";
|
|
3
|
-
import type { Event } from "@/internal/types.js";
|
|
4
|
-
import type { RequestParameters, Rpc } from "@/rpc/index.js";
|
|
5
|
-
import type { SyncStore } from "@/sync-store/index.js";
|
|
6
|
-
import { dedupe } from "@/utils/dedupe.js";
|
|
7
|
-
import { toLowerCase } from "@/utils/lowercase.js";
|
|
8
|
-
import { orderObject } from "@/utils/order.js";
|
|
9
|
-
import { startClock } from "@/utils/timer.js";
|
|
10
|
-
import { wait } from "@/utils/wait.js";
|
|
11
1
|
import {
|
|
12
2
|
type Abi,
|
|
13
3
|
type Account,
|
|
@@ -16,6 +6,12 @@ import {
|
|
|
16
6
|
type ContractFunctionArgs,
|
|
17
7
|
type ContractFunctionName,
|
|
18
8
|
type ContractFunctionParameters,
|
|
9
|
+
createClient,
|
|
10
|
+
custom,
|
|
11
|
+
decodeFunctionData,
|
|
12
|
+
decodeFunctionResult,
|
|
13
|
+
encodeFunctionData,
|
|
14
|
+
encodeFunctionResult,
|
|
19
15
|
type GetBlockReturnType,
|
|
20
16
|
type GetTransactionConfirmationsParameters,
|
|
21
17
|
type GetTransactionConfirmationsReturnType,
|
|
@@ -23,13 +19,17 @@ import {
|
|
|
23
19
|
type GetTransactionReceiptParameters,
|
|
24
20
|
type GetTransactionReceiptReturnType,
|
|
25
21
|
type GetTransactionReturnType,
|
|
22
|
+
getAbiItem,
|
|
26
23
|
type Hash,
|
|
27
24
|
type Hex,
|
|
25
|
+
hexToNumber,
|
|
28
26
|
type MulticallParameters,
|
|
29
27
|
type MulticallReturnType,
|
|
28
|
+
multicall3Abi,
|
|
30
29
|
type Prettify,
|
|
31
30
|
type PublicActions,
|
|
32
31
|
type PublicRpcSchema,
|
|
32
|
+
publicActions,
|
|
33
33
|
type ReadContractParameters,
|
|
34
34
|
type ReadContractReturnType,
|
|
35
35
|
type SimulateContractParameters,
|
|
@@ -37,20 +37,24 @@ import {
|
|
|
37
37
|
TransactionNotFoundError,
|
|
38
38
|
TransactionReceiptNotFoundError,
|
|
39
39
|
type Transport,
|
|
40
|
-
type Chain as ViemChain,
|
|
41
|
-
createClient,
|
|
42
|
-
custom,
|
|
43
|
-
decodeFunctionData,
|
|
44
|
-
decodeFunctionResult,
|
|
45
|
-
encodeFunctionData,
|
|
46
|
-
encodeFunctionResult,
|
|
47
|
-
getAbiItem,
|
|
48
|
-
hexToNumber,
|
|
49
|
-
multicall3Abi,
|
|
50
|
-
publicActions,
|
|
51
40
|
toFunctionSelector,
|
|
52
41
|
toHex,
|
|
42
|
+
type Chain as ViemChain,
|
|
53
43
|
} from "viem";
|
|
44
|
+
import type { Common } from "@/internal/common.js";
|
|
45
|
+
import type {
|
|
46
|
+
Chain,
|
|
47
|
+
Event,
|
|
48
|
+
IndexingBuild,
|
|
49
|
+
SetupEvent,
|
|
50
|
+
} from "@/internal/types.js";
|
|
51
|
+
import type { RequestParameters, Rpc } from "@/rpc/index.js";
|
|
52
|
+
import type { SyncStore } from "@/sync-store/index.js";
|
|
53
|
+
import { dedupe } from "@/utils/dedupe.js";
|
|
54
|
+
import { toLowerCase } from "@/utils/lowercase.js";
|
|
55
|
+
import { orderObject } from "@/utils/order.js";
|
|
56
|
+
import { startClock } from "@/utils/timer.js";
|
|
57
|
+
import { wait } from "@/utils/wait.js";
|
|
54
58
|
import {
|
|
55
59
|
getProfilePatternKey,
|
|
56
60
|
recordProfilePattern,
|
|
@@ -59,9 +63,7 @@ import {
|
|
|
59
63
|
|
|
60
64
|
export type CachedViemClient = {
|
|
61
65
|
getClient: (chain: Chain) => ReadonlyClient;
|
|
62
|
-
prefetch: (params: {
|
|
63
|
-
events: Event[];
|
|
64
|
-
}) => Promise<void>;
|
|
66
|
+
prefetch: (params: { events: Event[] }) => Promise<void>;
|
|
65
67
|
clear: () => void;
|
|
66
68
|
event: Event | SetupEvent | undefined;
|
|
67
69
|
};
|
|
@@ -413,7 +415,7 @@ export const decodeResponse = (response: Response) => {
|
|
|
413
415
|
// Note: I don't actually remember why we had to add the try catch.
|
|
414
416
|
try {
|
|
415
417
|
return JSON.parse(response);
|
|
416
|
-
} catch (
|
|
418
|
+
} catch (_error) {
|
|
417
419
|
return response;
|
|
418
420
|
}
|
|
419
421
|
};
|
|
@@ -451,7 +453,10 @@ export const createCachedViemClient = ({
|
|
|
451
453
|
const addProfilePattern = ({
|
|
452
454
|
pattern,
|
|
453
455
|
hasConstant,
|
|
454
|
-
}: {
|
|
456
|
+
}: {
|
|
457
|
+
pattern: ProfilePattern;
|
|
458
|
+
hasConstant: boolean;
|
|
459
|
+
}) => {
|
|
455
460
|
const profilePatternKey = getProfilePatternKey(pattern);
|
|
456
461
|
const eventName = (event as Event).eventCallback.name;
|
|
457
462
|
|
|
@@ -563,7 +568,7 @@ export const createCachedViemClient = ({
|
|
|
563
568
|
const BASE_DURATION = 125;
|
|
564
569
|
for (let i = 0; i <= RETRY_COUNT; i++) {
|
|
565
570
|
try {
|
|
566
|
-
// @ts-
|
|
571
|
+
// @ts-expect-error
|
|
567
572
|
return await action(...args);
|
|
568
573
|
} catch (error) {
|
|
569
574
|
const eventName =
|
|
@@ -622,30 +627,29 @@ export const createCachedViemClient = ({
|
|
|
622
627
|
}
|
|
623
628
|
|
|
624
629
|
for (const action of nonBlockDependentActions) {
|
|
625
|
-
// @ts-
|
|
630
|
+
// @ts-expect-error
|
|
626
631
|
actions[action] = _publicActions[action];
|
|
627
632
|
}
|
|
628
633
|
|
|
629
634
|
for (const action of blockRequiredActions) {
|
|
630
|
-
// @ts-
|
|
635
|
+
// @ts-expect-error
|
|
631
636
|
actions[action] = _publicActions[action];
|
|
632
637
|
}
|
|
633
638
|
|
|
634
639
|
for (const action of retryableActions) {
|
|
635
|
-
// @ts-ignore
|
|
636
640
|
actions[action] = getRetryAction(actions[action], action);
|
|
637
641
|
}
|
|
638
642
|
|
|
639
643
|
const actionsWithMetrics = {} as PonderActions;
|
|
640
644
|
|
|
641
645
|
for (const [action, actionFn] of Object.entries(actions)) {
|
|
642
|
-
// @ts-
|
|
646
|
+
// @ts-expect-error
|
|
643
647
|
actionsWithMetrics[action] = async (
|
|
644
648
|
...args: Parameters<PonderActions[keyof PonderActions]>
|
|
645
649
|
) => {
|
|
646
650
|
const endClock = startClock();
|
|
647
651
|
try {
|
|
648
|
-
// @ts-
|
|
652
|
+
// @ts-expect-error
|
|
649
653
|
return await actionFn(...args);
|
|
650
654
|
} finally {
|
|
651
655
|
common.metrics.ponder_indexing_rpc_action_duration.observe(
|
|
@@ -661,8 +665,7 @@ export const createCachedViemClient = ({
|
|
|
661
665
|
|
|
662
666
|
return {
|
|
663
667
|
getClient(chain) {
|
|
664
|
-
const rpc =
|
|
665
|
-
indexingBuild.rpcs[indexingBuild.chains.findIndex((n) => n === chain)]!;
|
|
668
|
+
const rpc = indexingBuild.rpcs[indexingBuild.chains.indexOf(chain)]!;
|
|
666
669
|
|
|
667
670
|
return createClient({
|
|
668
671
|
transport: cachedTransport({
|
|
@@ -834,7 +837,7 @@ export const cachedTransport =
|
|
|
834
837
|
method === "eth_call" &&
|
|
835
838
|
params[0]?.data?.startsWith(MULTICALL_SELECTOR)
|
|
836
839
|
) {
|
|
837
|
-
let blockNumber: Hex | "latest" | undefined
|
|
840
|
+
let blockNumber: Hex | "latest" | undefined;
|
|
838
841
|
[, blockNumber] = params;
|
|
839
842
|
|
|
840
843
|
const multicallRequests = decodeFunctionData({
|
|
@@ -1032,7 +1035,7 @@ export const cachedTransport =
|
|
|
1032
1035
|
functionName: "aggregate3",
|
|
1033
1036
|
result: resultsToEncode,
|
|
1034
1037
|
});
|
|
1035
|
-
} catch (
|
|
1038
|
+
} catch (_e) {
|
|
1036
1039
|
return encodeFunctionResult({
|
|
1037
1040
|
abi: multicall3Abi,
|
|
1038
1041
|
functionName: "aggregate3",
|
|
@@ -1152,7 +1155,7 @@ export const cachedTransport =
|
|
|
1152
1155
|
})({ chain: viemChain, retryCount: 0 });
|
|
1153
1156
|
|
|
1154
1157
|
export const extractBlockNumberParam = (request: RequestParameters) => {
|
|
1155
|
-
let blockNumber: Hex | "latest" | undefined
|
|
1158
|
+
let blockNumber: Hex | "latest" | undefined;
|
|
1156
1159
|
|
|
1157
1160
|
switch (request.method) {
|
|
1158
1161
|
case "eth_getBlockByNumber":
|
package/src/indexing/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import util from "node:util";
|
|
2
|
+
import type { Abi, Address } from "viem";
|
|
3
|
+
import type { CachedViemClient } from "@/indexing/client.js";
|
|
2
4
|
import type { IndexingCache } from "@/indexing-store/cache.js";
|
|
3
5
|
import type { IndexingStore } from "@/indexing-store/index.js";
|
|
4
|
-
import type { CachedViemClient } from "@/indexing/client.js";
|
|
5
6
|
import type { Common } from "@/internal/common.js";
|
|
6
7
|
import {
|
|
7
8
|
BaseError,
|
|
@@ -49,14 +50,13 @@ import type {
|
|
|
49
50
|
} from "@/types/eth.js";
|
|
50
51
|
import type { DeepPartial } from "@/types/utils.js";
|
|
51
52
|
import {
|
|
52
|
-
ZERO_CHECKPOINT,
|
|
53
53
|
decodeCheckpoint,
|
|
54
54
|
encodeCheckpoint,
|
|
55
|
+
ZERO_CHECKPOINT,
|
|
55
56
|
} from "@/utils/checkpoint.js";
|
|
56
57
|
import { dedupe } from "@/utils/dedupe.js";
|
|
57
58
|
import { prettyPrint } from "@/utils/print.js";
|
|
58
59
|
import { startClock } from "@/utils/timer.js";
|
|
59
|
-
import type { Abi, Address } from "viem";
|
|
60
60
|
import { addStackTrace } from "./addStackTrace.js";
|
|
61
61
|
import type { ReadonlyClient } from "./client.js";
|
|
62
62
|
|
|
@@ -276,7 +276,7 @@ export const createIndexing = ({
|
|
|
276
276
|
|
|
277
277
|
lastChainId = event.chain.id;
|
|
278
278
|
}
|
|
279
|
-
// @ts-
|
|
279
|
+
// @ts-expect-error
|
|
280
280
|
indexingFunctionArg.event = event.event;
|
|
281
281
|
|
|
282
282
|
const endClock = startClock();
|
|
@@ -554,7 +554,8 @@ export const createIndexing = ({
|
|
|
554
554
|
1,
|
|
555
555
|
);
|
|
556
556
|
columnAccessPattern.get(event.eventCallback.name)!.count++;
|
|
557
|
-
eventCount[event.eventCallback.name]
|
|
557
|
+
eventCount[event.eventCallback.name] =
|
|
558
|
+
eventCount[event.eventCallback.name]! + 1;
|
|
558
559
|
|
|
559
560
|
const now = performance.now();
|
|
560
561
|
|
|
@@ -719,7 +720,8 @@ export const createIndexing = ({
|
|
|
719
720
|
{ event: event.eventCallback.name },
|
|
720
721
|
1,
|
|
721
722
|
);
|
|
722
|
-
eventCount[event.eventCallback.name]
|
|
723
|
+
eventCount[event.eventCallback.name] =
|
|
724
|
+
eventCount[event.eventCallback.name]! + 1;
|
|
723
725
|
}
|
|
724
726
|
},
|
|
725
727
|
};
|
package/src/indexing/profile.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Abi } from "viem";
|
|
1
2
|
import type { Event } from "@/internal/types.js";
|
|
2
3
|
import { orderObject } from "@/utils/order.js";
|
|
3
|
-
import type { Abi } from "viem";
|
|
4
4
|
import type { PonderActions, ProfilePattern, Request } from "./client.js";
|
|
5
5
|
|
|
6
6
|
export const getProfilePatternKey = (pattern: ProfilePattern): string => {
|
|
@@ -736,7 +736,7 @@ export const recoverProfilePattern = (
|
|
|
736
736
|
} else {
|
|
737
737
|
let _result: unknown = event.event;
|
|
738
738
|
for (const prop of pattern.address.value) {
|
|
739
|
-
// @ts-
|
|
739
|
+
// @ts-expect-error
|
|
740
740
|
_result = _result[prop];
|
|
741
741
|
}
|
|
742
742
|
address = _result as `0x${string}`;
|
|
@@ -751,7 +751,7 @@ export const recoverProfilePattern = (
|
|
|
751
751
|
} else {
|
|
752
752
|
let _result: unknown = event.event;
|
|
753
753
|
for (const prop of arg.value) {
|
|
754
|
-
// @ts-
|
|
754
|
+
// @ts-expect-error
|
|
755
755
|
_result = _result[prop];
|
|
756
756
|
}
|
|
757
757
|
args.push(_result);
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTableColumns,
|
|
3
|
+
getTableName,
|
|
4
|
+
isTable,
|
|
5
|
+
or,
|
|
6
|
+
sql,
|
|
7
|
+
type Table,
|
|
8
|
+
} from "drizzle-orm";
|
|
9
|
+
import { getTableConfig } from "drizzle-orm/pg-core";
|
|
10
|
+
import copy from "pg-copy-streams";
|
|
1
11
|
import type { QB } from "@/database/queryBuilder.js";
|
|
2
12
|
import { getPrimaryKeyColumns } from "@/drizzle/index.js";
|
|
3
13
|
import { getColumnCasing } from "@/drizzle/kit/index.js";
|
|
@@ -18,16 +28,6 @@ import { dedupe } from "@/utils/dedupe.js";
|
|
|
18
28
|
import { prettyPrint } from "@/utils/print.js";
|
|
19
29
|
import { promiseAllSettledWithThrow } from "@/utils/promiseAllSettledWithThrow.js";
|
|
20
30
|
import { startClock } from "@/utils/timer.js";
|
|
21
|
-
import {
|
|
22
|
-
type Table,
|
|
23
|
-
getTableColumns,
|
|
24
|
-
getTableName,
|
|
25
|
-
isTable,
|
|
26
|
-
or,
|
|
27
|
-
sql,
|
|
28
|
-
} from "drizzle-orm";
|
|
29
|
-
import { getTableConfig } from "drizzle-orm/pg-core";
|
|
30
|
-
import copy from "pg-copy-streams";
|
|
31
31
|
import {
|
|
32
32
|
getProfilePatternKey,
|
|
33
33
|
recordProfilePattern,
|
|
@@ -48,10 +48,10 @@ export type IndexingCache = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Returns the entry for `table` with `key`.
|
|
50
50
|
*/
|
|
51
|
-
get: (params: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
get: (params: {
|
|
52
|
+
table: Table;
|
|
53
|
+
key: object;
|
|
54
|
+
}) => Row | null | Promise<Row | null>;
|
|
55
55
|
/**
|
|
56
56
|
* Sets the entry for `table` with `key` to `row`.
|
|
57
57
|
*/
|
|
@@ -650,7 +650,7 @@ export const createIndexingCache = ({
|
|
|
650
650
|
.insert(table)
|
|
651
651
|
.values(updateValues.map(({ row }) => row))
|
|
652
652
|
.onConflictDoUpdate({
|
|
653
|
-
// @ts-
|
|
653
|
+
// @ts-expect-error
|
|
654
654
|
target: primaryKeys.map(({ js }) => table[js]!),
|
|
655
655
|
set: Object.fromEntries(
|
|
656
656
|
Object.entries(getTableColumns(table)).map(
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Column,
|
|
3
|
+
getTableName,
|
|
4
|
+
getViewName,
|
|
5
|
+
isTable,
|
|
6
|
+
isView,
|
|
7
|
+
type QueryWithTypings,
|
|
8
|
+
type Table,
|
|
9
|
+
} from "drizzle-orm";
|
|
10
|
+
import { getTableConfig } from "drizzle-orm/pg-core";
|
|
11
|
+
import { drizzle } from "drizzle-orm/pg-proxy";
|
|
1
12
|
import type { QB } from "@/database/queryBuilder.js";
|
|
2
13
|
import { onchain } from "@/drizzle/onchain.js";
|
|
3
14
|
import type { Common } from "@/internal/common.js";
|
|
@@ -12,25 +23,17 @@ import {
|
|
|
12
23
|
UndefinedTableError,
|
|
13
24
|
UniqueConstraintError,
|
|
14
25
|
} from "@/internal/errors.js";
|
|
15
|
-
import type {
|
|
16
|
-
|
|
26
|
+
import type {
|
|
27
|
+
IndexingErrorHandler,
|
|
28
|
+
Schema,
|
|
29
|
+
SchemaBuild,
|
|
30
|
+
} from "@/internal/types.js";
|
|
17
31
|
import type { Db } from "@/types/db.js";
|
|
18
32
|
import { copy, copyOnWrite } from "@/utils/copy.js";
|
|
19
33
|
import { createLock } from "@/utils/mutex.js";
|
|
20
34
|
import { prettyPrint } from "@/utils/print.js";
|
|
21
35
|
import { getSQLQueryRelations, isReadonlySQLQuery } from "@/utils/sql-parse.js";
|
|
22
36
|
import { startClock } from "@/utils/timer.js";
|
|
23
|
-
import {
|
|
24
|
-
type Column,
|
|
25
|
-
type QueryWithTypings,
|
|
26
|
-
type Table,
|
|
27
|
-
getTableName,
|
|
28
|
-
getViewName,
|
|
29
|
-
isTable,
|
|
30
|
-
isView,
|
|
31
|
-
} from "drizzle-orm";
|
|
32
|
-
import { getTableConfig } from "drizzle-orm/pg-core";
|
|
33
|
-
import { drizzle } from "drizzle-orm/pg-proxy";
|
|
34
37
|
import type { IndexingCache, Row } from "./cache.js";
|
|
35
38
|
import { getPrimaryKeyCache } from "./utils.js";
|
|
36
39
|
|
|
@@ -157,7 +160,6 @@ export const createIndexingStore = ({
|
|
|
157
160
|
|
|
158
161
|
return {
|
|
159
162
|
db: {
|
|
160
|
-
// @ts-ignore
|
|
161
163
|
find: storeMethodWrapper(async (table: Table, key) => {
|
|
162
164
|
common.metrics.ponder_indexing_store_queries_total.inc({
|
|
163
165
|
table: getTableName(table),
|
|
@@ -169,11 +171,10 @@ export const createIndexingStore = ({
|
|
|
169
171
|
const userRow = ponderRow === null ? null : copyOnWrite(ponderRow);
|
|
170
172
|
return userRow;
|
|
171
173
|
}),
|
|
172
|
-
// @ts-
|
|
174
|
+
// @ts-expect-error
|
|
173
175
|
insert(table: Table) {
|
|
174
176
|
return {
|
|
175
177
|
values: (userValues: any) => {
|
|
176
|
-
// @ts-ignore
|
|
177
178
|
const inner = {
|
|
178
179
|
onConflictDoNothing: storeMethodWrapper(async () => {
|
|
179
180
|
common.metrics.ponder_indexing_store_queries_total.inc({
|
|
@@ -363,7 +364,7 @@ export const createIndexingStore = ({
|
|
|
363
364
|
}
|
|
364
365
|
},
|
|
365
366
|
),
|
|
366
|
-
// biome-ignore lint/suspicious/noThenProperty:
|
|
367
|
+
// biome-ignore lint/suspicious/noThenProperty: The returned object is intentionally thenable for the query API.
|
|
367
368
|
then: (onFulfilled, onRejected) =>
|
|
368
369
|
storeMethodWrapper(async () => {
|
|
369
370
|
common.metrics.ponder_indexing_store_queries_total.inc({
|
|
@@ -459,8 +460,9 @@ export const createIndexingStore = ({
|
|
|
459
460
|
);
|
|
460
461
|
}
|
|
461
462
|
})().then(onFulfilled, onRejected),
|
|
462
|
-
catch: (onRejected) =>
|
|
463
|
-
|
|
463
|
+
catch: (onRejected): Promise<any> =>
|
|
464
|
+
inner.then(undefined, onRejected),
|
|
465
|
+
finally: (onFinally): Promise<any> =>
|
|
464
466
|
inner.then(
|
|
465
467
|
(value: any) => {
|
|
466
468
|
onFinally?.();
|
|
@@ -471,7 +473,7 @@ export const createIndexingStore = ({
|
|
|
471
473
|
throw reason;
|
|
472
474
|
},
|
|
473
475
|
),
|
|
474
|
-
// @ts-
|
|
476
|
+
// @ts-expect-error
|
|
475
477
|
} satisfies ReturnType<
|
|
476
478
|
ReturnType<IndexingStore["db"]["insert"]>["values"]
|
|
477
479
|
>;
|
|
@@ -480,7 +482,7 @@ export const createIndexingStore = ({
|
|
|
480
482
|
},
|
|
481
483
|
};
|
|
482
484
|
},
|
|
483
|
-
// @ts-
|
|
485
|
+
// @ts-expect-error
|
|
484
486
|
update(table: Table, key) {
|
|
485
487
|
return {
|
|
486
488
|
set: storeMethodWrapper(async (userValues: any) => {
|
|
@@ -543,7 +545,6 @@ export const createIndexingStore = ({
|
|
|
543
545
|
}),
|
|
544
546
|
};
|
|
545
547
|
},
|
|
546
|
-
// @ts-ignore
|
|
547
548
|
delete: storeMethodWrapper(async (table: Table, key) => {
|
|
548
549
|
common.metrics.ponder_indexing_store_queries_total.inc({
|
|
549
550
|
table: getTableName(table),
|
|
@@ -553,7 +554,7 @@ export const createIndexingStore = ({
|
|
|
553
554
|
checkTableAccess(table, "delete", key, chainId);
|
|
554
555
|
return indexingCache.delete({ table, key });
|
|
555
556
|
}),
|
|
556
|
-
// @ts-
|
|
557
|
+
// @ts-expect-error
|
|
557
558
|
sql: drizzle(
|
|
558
559
|
storeMethodWrapper(async (_sql, params, method, typings) => {
|
|
559
560
|
const isSelectOnly = await isReadonlySQLQuery(_sql);
|
|
@@ -596,9 +597,9 @@ export const createIndexingStore = ({
|
|
|
596
597
|
|
|
597
598
|
if (method === "all") {
|
|
598
599
|
return {
|
|
599
|
-
// @ts-
|
|
600
|
+
// @ts-expect-error
|
|
600
601
|
...result,
|
|
601
|
-
// @ts-
|
|
602
|
+
// @ts-expect-error
|
|
602
603
|
rows: result.rows.map((row) => Object.values(row)),
|
|
603
604
|
};
|
|
604
605
|
}
|