Formatting
This commit is contained in:
+21
-19
@@ -1,26 +1,28 @@
|
||||
import type { BaseSyncClient, ResourcesRecord } from "../source/shared/base-client.js";
|
||||
import type { BaseSyncClient, ResourcesRecord } from '../source/shared/base-client.js';
|
||||
|
||||
export const writeMany = async (client: BaseSyncClient<{ message: string }>): Promise<ResourcesRecord<{ message: string }>> => {
|
||||
// Create a group of resources with changes
|
||||
const resources = Object.fromEntries(Array.from({ length: 10 }, (_, index) => [
|
||||
`resource-${index}`,
|
||||
{
|
||||
message: `Hello, world! this is the minimal sync client using ${client.constructor.name} ${index}`,
|
||||
},
|
||||
]));
|
||||
// Create a group of resources with changes
|
||||
const resources = Object.fromEntries(
|
||||
Array.from({ length: 10 }, (_, index) => [
|
||||
`resource-${index}`,
|
||||
{
|
||||
message: `Hello, world! this is the minimal sync client using ${client.constructor.name} ${index}`,
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
// Write the resources to the server
|
||||
const res = await client.writeMany(resources);
|
||||
// Write the resources to the server
|
||||
const res = await client.writeMany(resources);
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
export const readMany = async (client: BaseSyncClient<{ message: string }>,): Promise<ResourcesRecord<{ message: string }>> => {
|
||||
// Create a list of resource IDs
|
||||
const resources = Array.from({ length: 10 }, (_, index) => `resource-${index}`);
|
||||
export const readMany = async (client: BaseSyncClient<{ message: string }>): Promise<ResourcesRecord<{ message: string }>> => {
|
||||
// Create a list of resource IDs
|
||||
const resources = Array.from({ length: 10 }, (_, index) => `resource-${index}`);
|
||||
|
||||
// Read the resources from the server
|
||||
const res = await client.readMany(resources);
|
||||
// Read the resources from the server
|
||||
const res = await client.readMany(resources);
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user