public async getLastCheckpoint()

in lib/poller/checkpoint.ts [36:51]


  public async getLastCheckpoint(): Promise<undefined | number> {
    const req: DynamoDB.GetItemInput = {
      TableName: this.tableName,
      Key: {
        [this.keyName]: { S: 'max_id' },
      },
    };

    const response = await this.dynamodb.getItem(req).promise();
    if (!response.Item) {
      console.error('no max_id stored in database yet');
      return undefined; // not found
    }

    return Number.parseInt(response.Item.max_id.N!);
  }