MCPcopy Index your code
hub / github.com/fontsource/fontsource / updateArrayMetadata

Function updateArrayMetadata

api/metadata/src/fonts/update.ts:6–33  ·  view source on GitHub ↗
(env: Env, ctx: ExecutionContext)

Source from the content-addressed store, hash-verified

4
5// This updates the main array of fonts dataset
6const updateArrayMetadata = async (env: Env, ctx: ExecutionContext) => {
7 const data = await getMetadata(env, ctx);
8
9 // v1 Response
10 const list: ArrayMetadata = [];
11
12 for (const value of Object.values(data)) {
13 list.push({
14 id: value.id,
15 family: value.family,
16 subsets: value.subsets,
17 weights: value.weights,
18 styles: value.styles,
19 defSubset: value.defSubset,
20 variable: value.variable,
21 lastModified: value.lastModified,
22 category: value.category,
23 license: value.license,
24 type: value.type,
25 });
26 }
27
28 // Store the list in KV
29 ctx.waitUntil(
30 env.METADATA.put(METADATA_KEYS.fonts_arr, JSON.stringify(list)),
31 );
32 return list;
33};
34
35export { updateArrayMetadata };

Callers 2

scheduledFunction · 0.90
getArrayMetadataFunction · 0.90

Calls 4

getMetadataFunction · 0.90
valuesMethod · 0.80
waitUntilMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected