Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symbol type being possible in string interpolation #1264

Merged
merged 1 commit into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions packages/node-core/src/indexer/store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ group by
(indexField) =>
upperFirst(camelCase(indexField.entityName)) === entity && camelCase(indexField.fieldName) === field
) > -1;
assert(indexed, `to query by field ${field}, an index must be created on model ${entity}`);
assert(indexed, `to query by field ${String(field)}, an index must be created on model ${entity}`);
const records = await model.findAll({
where: {[field]: value},
transaction: this.tx,
Expand All @@ -579,7 +579,7 @@ group by
});
return records.map((record) => record.toJSON() as T);
} catch (e) {
throw new Error(`Failed to getByField Entity ${entity} with field ${field}: ${e}`);
throw new Error(`Failed to getByField Entity ${String(entity)} with field ${field}: ${e}`);
}
},
getOneByField: async <T extends Entity>(
Expand All @@ -597,14 +597,14 @@ group by
camelCase(indexField.fieldName) === field &&
indexField.isUnique
) > -1;
assert(indexed, `to query by field ${field}, an unique index must be created on model ${entity}`);
assert(indexed, `to query by field ${String(field)}, an unique index must be created on model ${entity}`);
const record = await model.findOne({
where: {[field]: value},
transaction: this.tx,
});
return record?.toJSON() as T;
} catch (e) {
throw new Error(`Failed to getOneByField Entity ${entity} with field ${field}: ${e}`);
throw new Error(`Failed to getOneByField Entity ${String(entity)} with field ${field}: ${e}`);
}
},
set: async (entity: string, _id: string, data: Entity): Promise<void> => {
Expand Down
7 changes: 2 additions & 5 deletions packages/node-core/src/indexer/worker/worker.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ export class Worker<T extends AsyncMethods> {
private worker: workers.Worker;
private logger: Logger;

private responseListeners: Record<
number | string,
(data?: any, error?: SerializableError) => void
> = {};
private responseListeners: Record<number | string, (data?: any, error?: SerializableError) => void> = {};

private _reqCounter = 0;

Expand Down Expand Up @@ -116,7 +113,7 @@ export class Worker<T extends AsyncMethods> {
// Add expected methods to class
fns.map((fn) => {
if ((this as any)[fn]) {
throw new Error(`Method ${fn} is already defined`);
throw new Error(`Method ${String(fn)} is already defined`);
}
Object.assign(this, {[fn]: (...args: any[]) => this.execute(fn, args)});
});
Expand Down