MCPcopy Create free account
hub / github.com/benwinding/react-admin-import-csv / update

Function update

src/uploader.ts:36–63  ·  view source on GitHub ↗
(
  logging: boolean,
  disableUpdateMany: boolean | undefined,
  dataProvider: DataProvider,
  resource: string,
  values: any[],
  preCommitCallback?: PrecommitCallback,
  postCommitCallback?: ErrorCallback
)

Source from the content-addressed store, hash-verified

34}
35
36export async function update(
37 logging: boolean,
38 disableUpdateMany: boolean | undefined,
39 dataProvider: DataProvider,
40 resource: string,
41 values: any[],
42 preCommitCallback?: PrecommitCallback,
43 postCommitCallback?: ErrorCallback
44) {
45 const parsedValues = preCommitCallback
46 ? await preCommitCallback("overwrite", values)
47 : values;
48 const reportItems = await updateInDataProvider(
49 logging,
50 !!disableUpdateMany,
51 dataProvider,
52 resource,
53 parsedValues
54 );
55 if (postCommitCallback) {
56 postCommitCallback(reportItems);
57 }
58 const shouldReject =
59 !postCommitCallback && reportItems.some((r) => !r.success);
60 if (shouldReject) {
61 return Promise.reject(reportItems.map((r) => r.response));
62 }
63}
64
65interface ReportItem {
66 value: any;

Callers 1

updateRowsFunction · 0.90

Calls 1

updateInDataProviderFunction · 0.85

Tested by

no test coverage detected