Item: buildDynamoRecord()

in super-mode-calculator/src/lib/dynamo.ts [35:64]


			Item: buildDynamoRecord(row),
		},
	};
}

function buildDynamoRecord(
	row: QueryRow,
	now: Date = new Date(),
): DynamoRecord {
	const end = addHours(now, SUPER_MODE_DURATION_IN_HOURS);

	return {
		...row,
		id: `${row.region}_${Buffer.from(row.url).toString('base64')}`,
		startTimestamp: toDateHourString(now),
		endDate: toDateString(end),
		endTimestamp: toDateHourString(end),
	};
}

function writeBatchForSuperMode(
	batch: DocumentClient.WriteRequest[],
	stage: string,
	docClient: DocumentClient,
): Promise<PromiseResult<DocumentClient.BatchWriteItemOutput, AWSError>> {
	const table = `super-mode-calculator-${stage.toUpperCase()}`;

	return docClient
		.batchWrite({
			RequestItems: {