Mark entities as removed on store remove host API call (#484)

This commit is contained in:
prathamesh0
2023-11-21 16:00:26 +05:30
committed by GitHub
parent 8c44fbbe6d
commit e6b957e921
5 changed files with 56 additions and 27 deletions
+27 -13
View File
@@ -282,19 +282,33 @@ export class Entity {
// Add subgraph entity specific columns.
entityObject = this._addSubgraphColumns(subgraphTypeDefs, entityObject, def);
// Add is_pruned column.
entityObject.columns.push({
name: 'isPruned',
pgType: 'boolean',
tsType: 'boolean',
columnType: 'Column',
columnOptions: [
{
option: 'default',
value: false
}
]
});
// Add is_pruned, is_removed columns.
entityObject.columns.push(
{
name: 'isPruned',
pgType: 'boolean',
tsType: 'boolean',
columnType: 'Column',
columnOptions: [
{
option: 'default',
value: false
}
]
},
{
name: 'isRemoved',
pgType: 'boolean',
tsType: 'boolean',
columnType: 'Column',
columnOptions: [
{
option: 'default',
value: false
}
]
}
);
// Add decimalTransformer column option if required.
this._addDecimalTransformerOption(entityObject);
@@ -142,8 +142,6 @@ export class Indexer implements IndexerInterface {
this._storageLayoutMap = new Map();
this._contractMap = new Map();
this.eventSignaturesMap = new Map();
let contractInterface: ethers.utils.Interface;
let eventSignatures: string[];
{{#each contracts as | contract |}}
const { abi: {{contract.contractName}}ABI{{#if contract.contractStorageLayout}}, storageLayout: {{contract.contractName}}StorageLayout{{/if}} } = {{contract.contractName}}Artifacts;
@@ -153,15 +151,13 @@ export class Indexer implements IndexerInterface {
assert({{contract.contractName}}ABI);
this._abiMap.set(KIND_{{capitalize contract.contractName}}, {{contract.contractName}}ABI);
// eslint-disable-next-line prefer-const
contractInterface = new ethers.utils.Interface({{contract.contractName}}ABI);
this._contractMap.set(KIND_{{capitalize contract.contractName}}, contractInterface);
const {{contract.contractName}}ContractInterface = new ethers.utils.Interface({{contract.contractName}}ABI);
this._contractMap.set(KIND_{{capitalize contract.contractName}}, {{contract.contractName}}ContractInterface);
// eslint-disable-next-line prefer-const
eventSignatures = Object.values(contractInterface.events).map(value => {
return contractInterface.getEventTopic(value);
const {{contract.contractName}}EventSignatures = Object.values({{contract.contractName}}ContractInterface.events).map(value => {
return {{contract.contractName}}ContractInterface.getEventTopic(value);
});
this.eventSignaturesMap.set(KIND_{{capitalize contract.contractName}}, eventSignatures);
this.eventSignaturesMap.set(KIND_{{capitalize contract.contractName}}, {{contract.contractName}}EventSignatures);
{{#if contract.contractStorageLayout}}
assert({{contract.contractName}}StorageLayout);