async function getAllFunctions()

in packages/app/src/lambda.ts [9:28]


async function getAllFunctions(
	lambda: Lambda,
): Promise<FunctionConfiguration[]> {
	async function rec(
		acc: FunctionConfiguration[],
		marker?: string,
	): Promise<FunctionConfiguration[]> {
		const command = new ListFunctionsCommand({
			Marker: marker,
		});
		const result = await lambda.send(command);
		const newAcc = acc.concat(result.Functions ?? []);
		if (result.NextMarker) {
			return rec(newAcc, result.NextMarker);
		} else {
			return newAcc;
		}
	}
	return rec([]);
}