Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ type Market @storage(postgres: true, clickhouse: true) {

# ── Trading ─────────────────────────────────────────────────────────

type OrderFill @storage(postgres: true, clickhouse: true) {
type OrderFill
@index(fields: ["tokenId", "timestamp", "id"])
@storage(postgres: true, clickhouse: true) {
Comment on lines +24 to +26

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Envio HyperIndex @index directive syntax documentation

💡 Result:

In Envio HyperIndex, the @index directive is used in your GraphQL schema to tell HyperIndex to create database indices for fields (and optionally composite indices) to improve query performance. Syntax (individual field index): type Transaction { userAddress: String! @index } Syntax (composite / multi-field index): // You put @index on a type and specify fields=[...] // Example from the docs: type Transfer @index(fields: ["from", "to", "tokenId"]) { from: String! @index to: String! @index tokenId: BigInt!... } Key behavior notes from the docs: - HyperIndex supports “the simplest form of indexing” by marking individual fields with @index.[1] - For “frequently query using multiple fields together”, HyperIndex recommends “composite indices” via the type-level form @index(fields: [...]).[1] - HyperIndex also creates indices automatically for all ID fields and for fields marked with @derivedFrom.[1] - The most common cause of slow queries is missing indices; if you filter or sort by a field without @index, add it.[1] If you share the exact schema snippet you’re trying to optimize (or which query is slow), I can suggest the minimal set of @index / composite @index(fields:...) directives to match your query patterns.

Citations:


Ensure composite @index is valid + regenerate after schema change

  • schema.graphql: @index(fields: ["tokenId", "timestamp", "id"]) on type OrderFill matches Envio HyperIndex’s documented type-level composite index syntax.
  • Run pnpm codegen after this schema.graphql change so generated types stay in sync.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@schema.graphql` around lines 24 - 26, The composite `@index` declaration on
type OrderFill uses fields: ["tokenId", "timestamp", "id"]—verify this matches
Envio HyperIndex's required type-level composite index syntax for composite
indexes and adjust the fields/order or annotation format if needed; after
updating schema.graphql, run pnpm codegen to regenerate TypeScript types and
other generated artifacts so OrderFill and its index are kept in sync with the
schema.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if there are uncommitted codegen artifacts that suggest codegen was not run

# Check git status for generated files (common patterns for codegen output)
git status --short | rg -i 'generated|codegen|\.gen\.|types.*\.ts'

Repository: enviodev/polymarket-v2-indexer

Length of output: 56


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Check full working tree status (not just filtered patterns)
echo "=== git status --short ==="
git status --short

# 2) Inspect schema.graphql around the referenced lines
echo
echo "=== schema.graphql (lines 1-80) ==="
nl -ba schema.graphql | sed -n '1,80p'

Repository: enviodev/polymarket-v2-indexer

Length of output: 200


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== git status --short (porcelain) ==="
git status --short --porcelain=v1 || true

echo
echo "=== git status for schema.graphql ==="
git status --short --porcelain=v1 -- schema.graphql || true

echo
echo "=== schema.graphql lines 20-35 ==="
awk 'NR>=20 && NR<=35 { printf "%d:%s\n", NR, $0 }' schema.graphql

echo
echo "=== locate pnpm codegen script ==="
ls -la package.json pnpm-workspace.yaml pnpm-lock.yaml 2>/dev/null || true
rg -n '"codegen"' package.json pnpm-workspace.yaml 2>/dev/null || true
rg -n 'codegen' package.json pnpm-workspace.yaml 2>/dev/null || true

Repository: enviodev/polymarket-v2-indexer

Length of output: 985


Run pnpm codegen after this schema.graphql change (type OrderFill).
Generated types are derived from schema.graphql, so regenerating avoids stale code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@schema.graphql` around lines 24 - 26, The GraphQL type OrderFill was changed
in schema.graphql but generated TypeScript types are stale; run the code
generator to update derived types. Execute the project codegen command (pnpm
codegen) to regenerate the TypeScript definitions that reference OrderFill so
consumers (generated types/usages) stay in sync with schema.graphql.

id: ID!
orderHash: String!
maker: String!
Expand Down