@refinedev/core 4.44.2 → 4.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +120 -0
- package/dist/contexts/live/ILiveContext.d.ts +9 -0
- package/dist/contexts/live/ILiveContext.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/live/useResourceSubscription/index.d.ts +10 -1
- package/dist/hooks/live/useResourceSubscription/index.d.ts.map +1 -1
- package/dist/hooks/live/useSubscription/index.d.ts +8 -3
- package/dist/hooks/live/useSubscription/index.d.ts.map +1 -1
- package/dist/iife/index.js +5 -5
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces/live/LiveEvent.d.ts +4 -1
- package/dist/interfaces/live/LiveEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contexts/live/ILiveContext.ts +7 -0
- package/src/hooks/data/useCreate.ts +24 -20
- package/src/hooks/data/useCreateMany.ts +24 -21
- package/src/hooks/data/useDelete.ts +23 -15
- package/src/hooks/data/useDeleteMany.ts +23 -14
- package/src/hooks/data/useInfiniteList.ts +4 -0
- package/src/hooks/data/useList.ts +4 -0
- package/src/hooks/data/useMany.ts +4 -0
- package/src/hooks/data/useOne.ts +4 -0
- package/src/hooks/data/useUpdate.ts +23 -10
- package/src/hooks/data/useUpdateMany.ts +23 -15
- package/src/hooks/live/useResourceSubscription/index.ts +19 -2
- package/src/hooks/live/useSubscription/index.ts +10 -2
- package/src/interfaces/live/LiveEvent.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseKey } from "..";
|
|
1
|
+
import { BaseKey, MetaQuery } from "..";
|
|
2
2
|
export declare type LiveEvent = {
|
|
3
3
|
channel: string;
|
|
4
4
|
type: "deleted" | "updated" | "created" | "*" | string;
|
|
@@ -7,5 +7,8 @@ export declare type LiveEvent = {
|
|
|
7
7
|
[x: string]: any;
|
|
8
8
|
};
|
|
9
9
|
date: Date;
|
|
10
|
+
meta?: MetaQuery & {
|
|
11
|
+
dataProviderName?: string;
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
14
|
//# sourceMappingURL=LiveEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveEvent.d.ts","sourceRoot":"","sources":["../../../src/interfaces/live/LiveEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"LiveEvent.d.ts","sourceRoot":"","sources":["../../../src/interfaces/live/LiveEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAExC,oBAAY,SAAS,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC;IACvD,OAAO,EAAE;QACL,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,SAAS,GAAG;QACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinedev/core",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.4",
|
|
4
4
|
"description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,6 +15,9 @@ export type ILiveContext =
|
|
|
15
15
|
params?: {
|
|
16
16
|
ids?: BaseKey[];
|
|
17
17
|
id?: BaseKey;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated `params.meta` is depcerated. Use `meta` directly from the root level instead.
|
|
20
|
+
*/
|
|
18
21
|
meta?: MetaQuery;
|
|
19
22
|
/**
|
|
20
23
|
* @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
|
|
@@ -36,7 +39,11 @@ export type ILiveContext =
|
|
|
36
39
|
[key: string]: any;
|
|
37
40
|
};
|
|
38
41
|
types: LiveEvent["type"][];
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated use `meta.dataProviderName` instead.
|
|
44
|
+
*/
|
|
39
45
|
dataProviderName?: string;
|
|
46
|
+
meta?: MetaQuery & { dataProviderName?: string };
|
|
40
47
|
callback: (event: LiveEvent) => void;
|
|
41
48
|
}) => any;
|
|
42
49
|
unsubscribe: (subscription: any) => void;
|
|
@@ -170,7 +170,7 @@ export const useCreate = <
|
|
|
170
170
|
{
|
|
171
171
|
resource: resourceName,
|
|
172
172
|
successNotification: successNotificationFromProp,
|
|
173
|
-
dataProviderName,
|
|
173
|
+
dataProviderName: dataProviderNameFromProp,
|
|
174
174
|
invalidates = ["list", "many"],
|
|
175
175
|
values,
|
|
176
176
|
meta,
|
|
@@ -178,9 +178,19 @@ export const useCreate = <
|
|
|
178
178
|
},
|
|
179
179
|
) => {
|
|
180
180
|
const { resource, identifier } = select(resourceName);
|
|
181
|
-
|
|
182
181
|
const resourceSingular = textTransformers.singular(identifier);
|
|
183
182
|
|
|
183
|
+
const dataProviderName = pickDataProvider(
|
|
184
|
+
identifier,
|
|
185
|
+
dataProviderNameFromProp,
|
|
186
|
+
resources,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const combinedMeta = getMeta({
|
|
190
|
+
resource,
|
|
191
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
192
|
+
});
|
|
193
|
+
|
|
184
194
|
const notificationConfig =
|
|
185
195
|
typeof successNotificationFromProp === "function"
|
|
186
196
|
? successNotificationFromProp(data, values, identifier)
|
|
@@ -204,11 +214,7 @@ export const useCreate = <
|
|
|
204
214
|
|
|
205
215
|
invalidateStore({
|
|
206
216
|
resource: identifier,
|
|
207
|
-
dataProviderName
|
|
208
|
-
identifier,
|
|
209
|
-
dataProviderName,
|
|
210
|
-
resources,
|
|
211
|
-
),
|
|
217
|
+
dataProviderName,
|
|
212
218
|
invalidates,
|
|
213
219
|
});
|
|
214
220
|
|
|
@@ -219,26 +225,24 @@ export const useCreate = <
|
|
|
219
225
|
ids: data?.data?.id ? [data.data.id] : undefined,
|
|
220
226
|
},
|
|
221
227
|
date: new Date(),
|
|
228
|
+
meta: {
|
|
229
|
+
...combinedMeta,
|
|
230
|
+
dataProviderName,
|
|
231
|
+
},
|
|
222
232
|
});
|
|
223
233
|
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
combinedMeta || {};
|
|
231
|
-
|
|
234
|
+
const {
|
|
235
|
+
fields: _fields,
|
|
236
|
+
operation: _operation,
|
|
237
|
+
variables: _variables,
|
|
238
|
+
...rest
|
|
239
|
+
} = combinedMeta || {};
|
|
232
240
|
log?.mutate({
|
|
233
241
|
action: "create",
|
|
234
242
|
resource: resource.name,
|
|
235
243
|
data: values,
|
|
236
244
|
meta: {
|
|
237
|
-
dataProviderName
|
|
238
|
-
identifier,
|
|
239
|
-
dataProviderName,
|
|
240
|
-
resources,
|
|
241
|
-
),
|
|
245
|
+
dataProviderName,
|
|
242
246
|
id: data?.data?.id ?? undefined,
|
|
243
247
|
...rest,
|
|
244
248
|
},
|
|
@@ -158,7 +158,7 @@ export const useCreateMany = <
|
|
|
158
158
|
{
|
|
159
159
|
resource: resourceName,
|
|
160
160
|
successNotification,
|
|
161
|
-
dataProviderName,
|
|
161
|
+
dataProviderName: dataProviderNameFromProp,
|
|
162
162
|
invalidates = ["list", "many"],
|
|
163
163
|
values,
|
|
164
164
|
meta,
|
|
@@ -166,9 +166,19 @@ export const useCreateMany = <
|
|
|
166
166
|
},
|
|
167
167
|
) => {
|
|
168
168
|
const { resource, identifier } = select(resourceName);
|
|
169
|
-
|
|
170
169
|
const resourcePlural = textTransformers.plural(identifier);
|
|
171
170
|
|
|
171
|
+
const dataProviderName = pickDataProvider(
|
|
172
|
+
identifier,
|
|
173
|
+
dataProviderNameFromProp,
|
|
174
|
+
resources,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const combinedMeta = getMeta({
|
|
178
|
+
resource,
|
|
179
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
180
|
+
});
|
|
181
|
+
|
|
172
182
|
const notificationConfig =
|
|
173
183
|
typeof successNotification === "function"
|
|
174
184
|
? successNotification(response, values, identifier)
|
|
@@ -192,18 +202,13 @@ export const useCreateMany = <
|
|
|
192
202
|
|
|
193
203
|
invalidateStore({
|
|
194
204
|
resource: identifier,
|
|
195
|
-
dataProviderName
|
|
196
|
-
identifier,
|
|
197
|
-
dataProviderName,
|
|
198
|
-
resources,
|
|
199
|
-
),
|
|
205
|
+
dataProviderName,
|
|
200
206
|
invalidates,
|
|
201
207
|
});
|
|
202
208
|
|
|
203
209
|
const ids = response?.data
|
|
204
210
|
.filter((item) => item?.id !== undefined)
|
|
205
211
|
.map((item) => item.id!);
|
|
206
|
-
|
|
207
212
|
publish?.({
|
|
208
213
|
channel: `resources/${resource.name}`,
|
|
209
214
|
type: "created",
|
|
@@ -211,26 +216,24 @@ export const useCreateMany = <
|
|
|
211
216
|
ids,
|
|
212
217
|
},
|
|
213
218
|
date: new Date(),
|
|
219
|
+
meta: {
|
|
220
|
+
...combinedMeta,
|
|
221
|
+
dataProviderName,
|
|
222
|
+
},
|
|
214
223
|
});
|
|
215
224
|
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
combinedMeta || {};
|
|
223
|
-
|
|
225
|
+
const {
|
|
226
|
+
fields: _fields,
|
|
227
|
+
operation: _operation,
|
|
228
|
+
variables: _variables,
|
|
229
|
+
...rest
|
|
230
|
+
} = combinedMeta || {};
|
|
224
231
|
log?.mutate({
|
|
225
232
|
action: "createMany",
|
|
226
233
|
resource: resource.name,
|
|
227
234
|
data: values,
|
|
228
235
|
meta: {
|
|
229
|
-
dataProviderName
|
|
230
|
-
identifier,
|
|
231
|
-
dataProviderName,
|
|
232
|
-
resources,
|
|
233
|
-
),
|
|
236
|
+
dataProviderName,
|
|
234
237
|
ids,
|
|
235
238
|
...rest,
|
|
236
239
|
},
|
|
@@ -384,16 +384,26 @@ export const useDelete = <
|
|
|
384
384
|
id,
|
|
385
385
|
resource: resourceName,
|
|
386
386
|
successNotification,
|
|
387
|
-
dataProviderName,
|
|
387
|
+
dataProviderName: dataProviderNameFromProp,
|
|
388
388
|
meta,
|
|
389
389
|
metaData,
|
|
390
390
|
},
|
|
391
391
|
context,
|
|
392
392
|
) => {
|
|
393
393
|
const { resource, identifier } = select(resourceName);
|
|
394
|
-
|
|
395
394
|
const resourceSingular = textTransformers.singular(identifier);
|
|
396
395
|
|
|
396
|
+
const dataProviderName = pickDataProvider(
|
|
397
|
+
identifier,
|
|
398
|
+
dataProviderNameFromProp,
|
|
399
|
+
resources,
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
const combinedMeta = getMeta({
|
|
403
|
+
resource,
|
|
404
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
405
|
+
});
|
|
406
|
+
|
|
397
407
|
// Remove the queries from the cache:
|
|
398
408
|
queryClient.removeQueries(context?.queryKey.detail(id));
|
|
399
409
|
|
|
@@ -425,26 +435,24 @@ export const useDelete = <
|
|
|
425
435
|
ids: [id],
|
|
426
436
|
},
|
|
427
437
|
date: new Date(),
|
|
438
|
+
meta: {
|
|
439
|
+
...combinedMeta,
|
|
440
|
+
dataProviderName,
|
|
441
|
+
},
|
|
428
442
|
});
|
|
429
443
|
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
combinedMeta || {};
|
|
437
|
-
|
|
444
|
+
const {
|
|
445
|
+
fields: _fields,
|
|
446
|
+
operation: _operation,
|
|
447
|
+
variables: _variables,
|
|
448
|
+
...rest
|
|
449
|
+
} = combinedMeta || {};
|
|
438
450
|
log?.mutate({
|
|
439
451
|
action: "delete",
|
|
440
452
|
resource: resource.name,
|
|
441
453
|
meta: {
|
|
442
454
|
id,
|
|
443
|
-
dataProviderName
|
|
444
|
-
identifier,
|
|
445
|
-
dataProviderName,
|
|
446
|
-
resources,
|
|
447
|
-
),
|
|
455
|
+
dataProviderName,
|
|
448
456
|
...rest,
|
|
449
457
|
},
|
|
450
458
|
});
|
|
@@ -418,13 +418,24 @@ export const useDeleteMany = <
|
|
|
418
418
|
resource: resourceName,
|
|
419
419
|
meta,
|
|
420
420
|
metaData,
|
|
421
|
-
dataProviderName,
|
|
421
|
+
dataProviderName: dataProviderNameFromProp,
|
|
422
422
|
successNotification,
|
|
423
423
|
},
|
|
424
424
|
context,
|
|
425
425
|
) => {
|
|
426
426
|
const { resource, identifier } = select(resourceName);
|
|
427
427
|
|
|
428
|
+
const dataProviderName = pickDataProvider(
|
|
429
|
+
identifier,
|
|
430
|
+
dataProviderNameFromProp,
|
|
431
|
+
resources,
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
const combinedMeta = getMeta({
|
|
435
|
+
resource,
|
|
436
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
437
|
+
});
|
|
438
|
+
|
|
428
439
|
// Remove the queries from the cache:
|
|
429
440
|
ids.forEach((id) =>
|
|
430
441
|
queryClient.removeQueries(context?.queryKey.detail(id)),
|
|
@@ -456,26 +467,24 @@ export const useDeleteMany = <
|
|
|
456
467
|
type: "deleted",
|
|
457
468
|
payload: { ids },
|
|
458
469
|
date: new Date(),
|
|
470
|
+
meta: {
|
|
471
|
+
...combinedMeta,
|
|
472
|
+
dataProviderName,
|
|
473
|
+
},
|
|
459
474
|
});
|
|
460
475
|
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
combinedMeta || {};
|
|
468
|
-
|
|
476
|
+
const {
|
|
477
|
+
fields: _fields,
|
|
478
|
+
operation: _operation,
|
|
479
|
+
variables: _variables,
|
|
480
|
+
...rest
|
|
481
|
+
} = combinedMeta || {};
|
|
469
482
|
log?.mutate({
|
|
470
483
|
action: "deleteMany",
|
|
471
484
|
resource: resource.name,
|
|
472
485
|
meta: {
|
|
473
486
|
ids,
|
|
474
|
-
dataProviderName
|
|
475
|
-
identifier,
|
|
476
|
-
dataProviderName,
|
|
477
|
-
resources,
|
|
478
|
-
),
|
|
487
|
+
dataProviderName,
|
|
479
488
|
...rest,
|
|
480
489
|
},
|
|
481
490
|
});
|
package/src/hooks/data/useOne.ts
CHANGED
|
@@ -480,7 +480,7 @@ export const useUpdate = <
|
|
|
480
480
|
id,
|
|
481
481
|
resource: resourceName,
|
|
482
482
|
successNotification,
|
|
483
|
-
dataProviderName,
|
|
483
|
+
dataProviderName: dataProviderNameFromProp,
|
|
484
484
|
values,
|
|
485
485
|
meta,
|
|
486
486
|
metaData,
|
|
@@ -488,9 +488,19 @@ export const useUpdate = <
|
|
|
488
488
|
context,
|
|
489
489
|
) => {
|
|
490
490
|
const { resource, identifier } = select(resourceName);
|
|
491
|
-
|
|
492
491
|
const resourceSingular = textTransformers.singular(identifier);
|
|
493
492
|
|
|
493
|
+
const dataProviderName = pickDataProvider(
|
|
494
|
+
identifier,
|
|
495
|
+
dataProviderNameFromProp,
|
|
496
|
+
resources,
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const combinedMeta = getMeta({
|
|
500
|
+
resource,
|
|
501
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
502
|
+
});
|
|
503
|
+
|
|
494
504
|
const notificationConfig =
|
|
495
505
|
typeof successNotification === "function"
|
|
496
506
|
? successNotification(data, { id, values }, identifier)
|
|
@@ -522,6 +532,10 @@ export const useUpdate = <
|
|
|
522
532
|
ids: data.data?.id ? [data.data.id] : undefined,
|
|
523
533
|
},
|
|
524
534
|
date: new Date(),
|
|
535
|
+
meta: {
|
|
536
|
+
...combinedMeta,
|
|
537
|
+
dataProviderName,
|
|
538
|
+
},
|
|
525
539
|
});
|
|
526
540
|
|
|
527
541
|
let previousData: any;
|
|
@@ -539,9 +553,12 @@ export const useUpdate = <
|
|
|
539
553
|
);
|
|
540
554
|
}
|
|
541
555
|
|
|
542
|
-
const {
|
|
543
|
-
|
|
544
|
-
|
|
556
|
+
const {
|
|
557
|
+
fields: _fields,
|
|
558
|
+
operation: _operation,
|
|
559
|
+
variables: _variables,
|
|
560
|
+
...rest
|
|
561
|
+
} = combinedMeta || {};
|
|
545
562
|
log?.mutate({
|
|
546
563
|
action: "update",
|
|
547
564
|
resource: resource.name,
|
|
@@ -549,11 +566,7 @@ export const useUpdate = <
|
|
|
549
566
|
previousData,
|
|
550
567
|
meta: {
|
|
551
568
|
id,
|
|
552
|
-
dataProviderName
|
|
553
|
-
identifier,
|
|
554
|
-
dataProviderName,
|
|
555
|
-
resources,
|
|
556
|
-
),
|
|
569
|
+
dataProviderName,
|
|
557
570
|
...rest,
|
|
558
571
|
},
|
|
559
572
|
});
|
|
@@ -508,16 +508,26 @@ export const useUpdateMany = <
|
|
|
508
508
|
resource: resourceName,
|
|
509
509
|
meta,
|
|
510
510
|
metaData,
|
|
511
|
-
dataProviderName,
|
|
511
|
+
dataProviderName: dataProviderNameFromProp,
|
|
512
512
|
successNotification,
|
|
513
513
|
values,
|
|
514
514
|
},
|
|
515
515
|
context,
|
|
516
516
|
) => {
|
|
517
517
|
const { resource, identifier } = select(resourceName);
|
|
518
|
-
|
|
519
518
|
const resourceSingular = textTransformers.singular(identifier);
|
|
520
519
|
|
|
520
|
+
const dataProviderName = pickDataProvider(
|
|
521
|
+
identifier,
|
|
522
|
+
dataProviderNameFromProp,
|
|
523
|
+
resources,
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
const combinedMeta = getMeta({
|
|
527
|
+
resource,
|
|
528
|
+
meta: pickNotDeprecated(meta, metaData),
|
|
529
|
+
});
|
|
530
|
+
|
|
521
531
|
const notificationConfig =
|
|
522
532
|
typeof successNotification === "function"
|
|
523
533
|
? successNotification(data, { ids, values }, identifier)
|
|
@@ -549,6 +559,10 @@ export const useUpdateMany = <
|
|
|
549
559
|
ids: ids.map(String),
|
|
550
560
|
},
|
|
551
561
|
date: new Date(),
|
|
562
|
+
meta: {
|
|
563
|
+
...combinedMeta,
|
|
564
|
+
dataProviderName,
|
|
565
|
+
},
|
|
552
566
|
});
|
|
553
567
|
|
|
554
568
|
const previousData: any[] = [];
|
|
@@ -570,14 +584,12 @@ export const useUpdateMany = <
|
|
|
570
584
|
});
|
|
571
585
|
}
|
|
572
586
|
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
combinedMeta || {};
|
|
580
|
-
|
|
587
|
+
const {
|
|
588
|
+
fields: _fields,
|
|
589
|
+
operation: _operation,
|
|
590
|
+
variables: _variables,
|
|
591
|
+
...rest
|
|
592
|
+
} = combinedMeta || {};
|
|
581
593
|
log?.mutate({
|
|
582
594
|
action: "updateMany",
|
|
583
595
|
resource: resource.name,
|
|
@@ -585,11 +597,7 @@ export const useUpdateMany = <
|
|
|
585
597
|
previousData,
|
|
586
598
|
meta: {
|
|
587
599
|
ids,
|
|
588
|
-
dataProviderName
|
|
589
|
-
identifier,
|
|
590
|
-
dataProviderName,
|
|
591
|
-
resources,
|
|
592
|
-
),
|
|
600
|
+
dataProviderName,
|
|
593
601
|
...rest,
|
|
594
602
|
},
|
|
595
603
|
});
|
|
@@ -20,6 +20,9 @@ export type UseResourceSubscriptionProps = {
|
|
|
20
20
|
params?: {
|
|
21
21
|
ids?: BaseKey[];
|
|
22
22
|
id?: BaseKey;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated `params.meta` is depcerated. Use `meta` directly from the root level instead.
|
|
25
|
+
*/
|
|
23
26
|
meta?: MetaQuery;
|
|
24
27
|
/**
|
|
25
28
|
* @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
|
|
@@ -42,7 +45,11 @@ export type UseResourceSubscriptionProps = {
|
|
|
42
45
|
types: LiveEvent["type"][];
|
|
43
46
|
resource?: string;
|
|
44
47
|
enabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated use `meta.dataProviderName` instead.
|
|
50
|
+
*/
|
|
45
51
|
dataProviderName?: string;
|
|
52
|
+
meta?: MetaQuery & { dataProviderName?: string };
|
|
46
53
|
} & LiveModeProps;
|
|
47
54
|
|
|
48
55
|
export type PublishType = {
|
|
@@ -57,7 +64,8 @@ export const useResourceSubscription = ({
|
|
|
57
64
|
enabled = true,
|
|
58
65
|
liveMode: liveModeFromProp,
|
|
59
66
|
onLiveEvent,
|
|
60
|
-
dataProviderName,
|
|
67
|
+
dataProviderName: dataProviderNameFromProps,
|
|
68
|
+
meta,
|
|
61
69
|
}: UseResourceSubscriptionProps): void => {
|
|
62
70
|
const { resource, identifier } = useResource(resourceFromProp);
|
|
63
71
|
|
|
@@ -71,6 +79,11 @@ export const useResourceSubscription = ({
|
|
|
71
79
|
|
|
72
80
|
const invalidate = useInvalidate();
|
|
73
81
|
|
|
82
|
+
const dataProviderName =
|
|
83
|
+
dataProviderNameFromProps ??
|
|
84
|
+
meta?.dataProviderName ??
|
|
85
|
+
resource?.meta?.dataProviderName;
|
|
86
|
+
|
|
74
87
|
useEffect(() => {
|
|
75
88
|
let subscription: any;
|
|
76
89
|
|
|
@@ -78,7 +91,7 @@ export const useResourceSubscription = ({
|
|
|
78
91
|
if (liveMode === "auto") {
|
|
79
92
|
invalidate({
|
|
80
93
|
resource: identifier,
|
|
81
|
-
dataProviderName
|
|
94
|
+
dataProviderName,
|
|
82
95
|
invalidates: ["resourceAll"],
|
|
83
96
|
invalidationFilters: {
|
|
84
97
|
type: "active",
|
|
@@ -102,6 +115,10 @@ export const useResourceSubscription = ({
|
|
|
102
115
|
types,
|
|
103
116
|
callback,
|
|
104
117
|
dataProviderName,
|
|
118
|
+
meta: {
|
|
119
|
+
...meta,
|
|
120
|
+
dataProviderName,
|
|
121
|
+
},
|
|
105
122
|
});
|
|
106
123
|
}
|
|
107
124
|
|
|
@@ -33,6 +33,9 @@ export type UseSubscriptionProps = {
|
|
|
33
33
|
params?: {
|
|
34
34
|
ids?: BaseKey[];
|
|
35
35
|
id?: BaseKey;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated `params.meta` is depcerated. Use `meta` directly from the root level instead.
|
|
38
|
+
*/
|
|
36
39
|
meta?: MetaQuery;
|
|
37
40
|
/**
|
|
38
41
|
* @deprecated `metaData` is deprecated with refine@4, refine will pass `meta` instead, however, we still support `metaData` for backward compatibility.
|
|
@@ -54,10 +57,10 @@ export type UseSubscriptionProps = {
|
|
|
54
57
|
[key: string]: any;
|
|
55
58
|
};
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @default "default"
|
|
60
|
+
* @deprecated use `meta.dataProviderName` instead.
|
|
59
61
|
*/
|
|
60
62
|
dataProviderName?: string;
|
|
63
|
+
meta?: MetaQuery & { dataProviderName?: string };
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
export const useSubscription = ({
|
|
@@ -67,6 +70,7 @@ export const useSubscription = ({
|
|
|
67
70
|
enabled = true,
|
|
68
71
|
onLiveEvent,
|
|
69
72
|
dataProviderName = "default",
|
|
73
|
+
meta,
|
|
70
74
|
}: UseSubscriptionProps): void => {
|
|
71
75
|
const liveDataContext = useContext<ILiveContext>(LiveContext);
|
|
72
76
|
|
|
@@ -80,6 +84,10 @@ export const useSubscription = ({
|
|
|
80
84
|
types,
|
|
81
85
|
callback: onLiveEvent,
|
|
82
86
|
dataProviderName,
|
|
87
|
+
meta: {
|
|
88
|
+
...meta,
|
|
89
|
+
dataProviderName,
|
|
90
|
+
},
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
93
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseKey } from "..";
|
|
1
|
+
import { BaseKey, MetaQuery } from "..";
|
|
2
2
|
|
|
3
3
|
export type LiveEvent = {
|
|
4
4
|
channel: string;
|
|
@@ -8,4 +8,7 @@ export type LiveEvent = {
|
|
|
8
8
|
[x: string]: any;
|
|
9
9
|
};
|
|
10
10
|
date: Date;
|
|
11
|
+
meta?: MetaQuery & {
|
|
12
|
+
dataProviderName?: string;
|
|
13
|
+
};
|
|
11
14
|
};
|