Skip to content

Commit

Permalink
fix: generic type parameter for matchesGenerator()
Browse files Browse the repository at this point in the history
  • Loading branch information
kilted-andres committed Aug 6, 2024
1 parent bef1bdb commit 1379038
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/utilities/indexer/queryCTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function queryCTypes() {
};
definition: string; // stringified JSON of cType Schema
}
const entitiesGenerator = matchesGenerator(queryParams);
const entitiesGenerator = matchesGenerator<QueriedCType>(queryParams);

for await (const entity of entitiesGenerator) {
const {
Expand All @@ -93,7 +93,7 @@ export async function queryCTypes() {
registrationBlock,
definition,
attestationsCreated,
} = entity as unknown as QueriedCType;
} = entity;

const { id: creator } = author;
const { $schema, ...rest } = JSON.parse(definition) as Omit<ICType, '$id'>;
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/indexer/queryFromIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function queryFromIndexer(query: string = queryBlocks) {
return { totalCount, matches };
}

export async function* matchesGenerator<T extends Record<string, unknown>>(
export async function* matchesGenerator<T>(
queryParams: Parameters<typeof writeQuery>[0],
): AsyncGenerator<T, void> {
if (indexer.graphqlEndpoint === 'NONE') {
Expand Down
6 changes: 3 additions & 3 deletions src/utilities/indexer/updateAttestationCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export async function updateAttestationsCount() {
attestationsCreated: number;
registrationBlockId: string; // Block Ordinal Number, without punctuation
}
const entitiesGenerator = matchesGenerator(queryParams);
const entitiesGenerator =
matchesGenerator<QueriedAttestationCount>(queryParams);

for await (const entity of entitiesGenerator) {
const { cTypeId, attestationsCreated } =
entity as unknown as QueriedAttestationCount;
const { cTypeId, attestationsCreated } = entity;

const cTypeToUpdate = await CTypeModel.findOne({
where: {
Expand Down

0 comments on commit 1379038

Please sign in to comment.