@wix/data 1.0.62 → 1.0.63

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.
Files changed (39) hide show
  1. package/build/cjs/src/data-v1-external-database-connection.http.js +54 -14
  2. package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -1
  3. package/build/cjs/src/data-v1-external-database-connection.universal.js +144 -44
  4. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -1
  5. package/build/cjs/src/data-v2-data-collection.http.js +29 -10
  6. package/build/cjs/src/data-v2-data-collection.http.js.map +1 -1
  7. package/build/cjs/src/data-v2-data-collection.universal.js +34 -25
  8. package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -1
  9. package/build/cjs/src/data-v2-data-item.http.js +190 -46
  10. package/build/cjs/src/data-v2-data-item.http.js.map +1 -1
  11. package/build/cjs/src/data-v2-data-item.public.d.ts +13 -13
  12. package/build/cjs/src/data-v2-data-item.public.js.map +1 -1
  13. package/build/cjs/src/data-v2-data-item.universal.d.ts +15 -15
  14. package/build/cjs/src/data-v2-data-item.universal.js +664 -345
  15. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -1
  16. package/build/cjs/src/data-v2-index.http.js +28 -10
  17. package/build/cjs/src/data-v2-index.http.js.map +1 -1
  18. package/build/cjs/src/data-v2-index.universal.js +89 -35
  19. package/build/cjs/src/data-v2-index.universal.js.map +1 -1
  20. package/build/es/src/data-v1-external-database-connection.http.js +54 -14
  21. package/build/es/src/data-v1-external-database-connection.http.js.map +1 -1
  22. package/build/es/src/data-v1-external-database-connection.universal.js +144 -44
  23. package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -1
  24. package/build/es/src/data-v2-data-collection.http.js +29 -10
  25. package/build/es/src/data-v2-data-collection.http.js.map +1 -1
  26. package/build/es/src/data-v2-data-collection.universal.js +34 -25
  27. package/build/es/src/data-v2-data-collection.universal.js.map +1 -1
  28. package/build/es/src/data-v2-data-item.http.js +190 -46
  29. package/build/es/src/data-v2-data-item.http.js.map +1 -1
  30. package/build/es/src/data-v2-data-item.public.d.ts +13 -13
  31. package/build/es/src/data-v2-data-item.public.js.map +1 -1
  32. package/build/es/src/data-v2-data-item.universal.d.ts +15 -15
  33. package/build/es/src/data-v2-data-item.universal.js +665 -346
  34. package/build/es/src/data-v2-data-item.universal.js.map +1 -1
  35. package/build/es/src/data-v2-index.http.js +28 -10
  36. package/build/es/src/data-v2-index.http.js.map +1 -1
  37. package/build/es/src/data-v2-index.universal.js +89 -35
  38. package/build/es/src/data-v2-index.universal.js.map +1 -1
  39. package/package.json +2 -2
@@ -1,5 +1,48 @@
1
1
  import { toURLSearchParams } from '@wix/metro-runtime';
2
+ import { serializer } from '@wix/metro-runtime/ambassador';
2
3
  import { resolveUrl } from '@wix/metro-runtime';
4
+ const _aggregateDataItemsRequest = {};
5
+ const _aggregateDataItemsResponse = {};
6
+ const _bulkInsertDataItemReferencesRequest = {};
7
+ const _bulkInsertDataItemReferencesResponse = {};
8
+ const _bulkInsertDataItemsRequest = {};
9
+ const _bulkInsertDataItemsResponse = {};
10
+ const _bulkRemoveDataItemReferencesRequest = {};
11
+ const _bulkRemoveDataItemReferencesResponse = {};
12
+ const _bulkRemoveDataItemsRequest = {};
13
+ const _bulkRemoveDataItemsResponse = {};
14
+ const _bulkSaveDataItemsRequest = {};
15
+ const _bulkSaveDataItemsResponse = {};
16
+ const _bulkUpdateDataItemsRequest = {};
17
+ const _bulkUpdateDataItemsResponse = {};
18
+ const _countDataItemsRequest = {};
19
+ const _countDataItemsResponse = {};
20
+ const _getDataItemRequest = {};
21
+ const _getDataItemResponse = {};
22
+ const _insertDataItemReferenceRequest = {};
23
+ const _insertDataItemReferenceResponse = {};
24
+ const _insertDataItemRequest = {};
25
+ const _insertDataItemResponse = {};
26
+ const _isReferencedDataItemRequest = {};
27
+ const _isReferencedDataItemResponse = {};
28
+ const _queryDataItemsRequest = {};
29
+ const _queryDataItemsResponse = {};
30
+ const _queryDistinctValuesRequest = {};
31
+ const _queryDistinctValuesResponse = {};
32
+ const _queryReferencedDataItemsRequest = {};
33
+ const _queryReferencedDataItemsResponse = {};
34
+ const _removeDataItemReferenceRequest = {};
35
+ const _removeDataItemReferenceResponse = {};
36
+ const _removeDataItemRequest = {};
37
+ const _removeDataItemResponse = {};
38
+ const _replaceDataItemReferencesRequest = {};
39
+ const _replaceDataItemReferencesResponse = {};
40
+ const _saveDataItemRequest = {};
41
+ const _saveDataItemResponse = {};
42
+ const _truncateDataItemsRequest = {};
43
+ const _truncateDataItemsResponse = {};
44
+ const _updateDataItemRequest = {};
45
+ const _updateDataItemResponse = {};
3
46
  function resolveComWixpressCloudDataApiDataDataItemServiceUrl(opts) {
4
47
  const domainToMappings = {
5
48
  'api._api_base_domain_': [
@@ -75,10 +118,6 @@ function resolveComWixpressCloudDataApiDataDataItemServiceUrl(opts) {
75
118
  srcPath: '/_api/cloud-data/v1',
76
119
  destPath: '/v1',
77
120
  },
78
- {
79
- srcPath: '/[a-z0-9-_/]+/_api/cloud-data',
80
- destPath: '',
81
- },
82
121
  {
83
122
  srcPath: '/_api/cloud-data/v2',
84
123
  destPath: '/v2',
@@ -293,20 +332,25 @@ function resolveComWixpressCloudDataApiDataDataItemServiceUrl(opts) {
293
332
  * If `options.dataItem.data` is empty, a new item is created with no data fields.
294
333
  */
295
334
  export function insertDataItem(payload) {
335
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_insertDataItemRequest, {});
336
+ const { fromJSON: fromRes } = serializer(_insertDataItemResponse, {});
296
337
  function __insertDataItem({ host }) {
338
+ const serializedData = toReq(payload);
297
339
  const metadata = {
298
340
  entityFqdn: 'wix.data.v2.data_item',
299
341
  method: 'POST',
300
342
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.InsertDataItem',
301
343
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
302
344
  protoPath: '/v2/items',
303
- data: payload,
345
+ data: serializedData,
304
346
  host,
305
347
  }),
306
- data: payload,
348
+ data: serializedData,
349
+ transformResponse: fromRes,
307
350
  };
308
351
  return metadata;
309
352
  }
353
+ __insertDataItem.fromReq = fromReq;
310
354
  return __insertDataItem;
311
355
  }
312
356
  /**
@@ -326,20 +370,25 @@ export function insertDataItem(payload) {
326
370
  * > If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
327
371
  */
328
372
  export function updateDataItem(payload) {
373
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_updateDataItemRequest, {});
374
+ const { fromJSON: fromRes } = serializer(_updateDataItemResponse, {});
329
375
  function __updateDataItem({ host }) {
376
+ const serializedData = toReq(payload);
330
377
  const metadata = {
331
378
  entityFqdn: 'wix.data.v2.data_item',
332
379
  method: 'PUT',
333
380
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.UpdateDataItem',
334
381
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
335
382
  protoPath: '/v2/items/{dataItem.id}',
336
- data: payload,
383
+ data: serializedData,
337
384
  host,
338
385
  }),
339
- data: payload,
386
+ data: serializedData,
387
+ transformResponse: fromRes,
340
388
  };
341
389
  return metadata;
342
390
  }
391
+ __updateDataItem.fromReq = fromReq;
343
392
  return __updateDataItem;
344
393
  }
345
394
  /**
@@ -358,20 +407,25 @@ export function updateDataItem(payload) {
358
407
  * > This means that the item's previous fields and values are lost.
359
408
  */
360
409
  export function saveDataItem(payload) {
410
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_saveDataItemRequest, {});
411
+ const { fromJSON: fromRes } = serializer(_saveDataItemResponse, {});
361
412
  function __saveDataItem({ host }) {
413
+ const serializedData = toReq(payload);
362
414
  const metadata = {
363
415
  entityFqdn: 'wix.data.v2.data_item',
364
416
  method: 'POST',
365
417
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.SaveDataItem',
366
418
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
367
419
  protoPath: '/v2/items/save',
368
- data: payload,
420
+ data: serializedData,
369
421
  host,
370
422
  }),
371
- data: payload,
423
+ data: serializedData,
424
+ transformResponse: fromRes,
372
425
  };
373
426
  return metadata;
374
427
  }
428
+ __saveDataItem.fromReq = fromReq;
375
429
  return __saveDataItem;
376
430
  }
377
431
  /**
@@ -381,20 +435,25 @@ export function saveDataItem(payload) {
381
435
  * > **Note**: When calling `getDataItem()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
382
436
  */
383
437
  export function getDataItem(payload) {
438
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_getDataItemRequest, {});
439
+ const { fromJSON: fromRes } = serializer(_getDataItemResponse, {});
384
440
  function __getDataItem({ host }) {
441
+ const serializedData = toReq(payload);
385
442
  const metadata = {
386
443
  entityFqdn: 'wix.data.v2.data_item',
387
444
  method: 'GET',
388
445
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.GetDataItem',
389
446
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
390
447
  protoPath: '/v2/items/{dataItemId}',
391
- data: payload,
448
+ data: serializedData,
392
449
  host,
393
450
  }),
394
- params: toURLSearchParams(payload),
451
+ params: toURLSearchParams(serializedData),
452
+ transformResponse: fromRes,
395
453
  };
396
454
  return metadata;
397
455
  }
456
+ __getDataItem.fromReq = fromReq;
398
457
  return __getDataItem;
399
458
  }
400
459
  /**
@@ -407,20 +466,25 @@ export function getDataItem(payload) {
407
466
  * > Once an item has been removed from a collection, it can't be restored.
408
467
  */
409
468
  export function removeDataItem(payload) {
469
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeDataItemRequest, {});
470
+ const { fromJSON: fromRes } = serializer(_removeDataItemResponse, {});
410
471
  function __removeDataItem({ host }) {
472
+ const serializedData = toReq(payload);
411
473
  const metadata = {
412
474
  entityFqdn: 'wix.data.v2.data_item',
413
475
  method: 'DELETE',
414
476
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.RemoveDataItem',
415
477
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
416
478
  protoPath: '/v2/items/{dataItemId}',
417
- data: payload,
479
+ data: serializedData,
418
480
  host,
419
481
  }),
420
- params: toURLSearchParams(payload),
482
+ params: toURLSearchParams(serializedData),
483
+ transformResponse: fromRes,
421
484
  };
422
485
  return metadata;
423
486
  }
487
+ __removeDataItem.fromReq = fromReq;
424
488
  return __removeDataItem;
425
489
  }
426
490
  /**
@@ -433,20 +497,25 @@ export function removeDataItem(payload) {
433
497
  * > Once items have been removed from a collection, they can't be restored.
434
498
  */
435
499
  export function truncateDataItems(payload) {
500
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_truncateDataItemsRequest, {});
501
+ const { fromJSON: fromRes } = serializer(_truncateDataItemsResponse, {});
436
502
  function __truncateDataItems({ host }) {
503
+ const serializedData = toReq(payload);
437
504
  const metadata = {
438
505
  entityFqdn: 'wix.data.v2.data_item',
439
506
  method: 'POST',
440
507
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.TruncateDataItems',
441
508
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
442
509
  protoPath: '/v2/items/truncate',
443
- data: payload,
510
+ data: serializedData,
444
511
  host,
445
512
  }),
446
- data: payload,
513
+ data: serializedData,
514
+ transformResponse: fromRes,
447
515
  };
448
516
  return metadata;
449
517
  }
518
+ __truncateDataItems.fromReq = fromReq;
450
519
  return __truncateDataItems;
451
520
  }
452
521
  /**
@@ -473,20 +542,25 @@ export function truncateDataItems(payload) {
473
542
  *
474
543
  */
475
544
  export function queryDataItems(payload) {
545
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_queryDataItemsRequest, {});
546
+ const { fromJSON: fromRes } = serializer(_queryDataItemsResponse, {});
476
547
  function __queryDataItems({ host }) {
548
+ const serializedData = toReq(payload);
477
549
  const metadata = {
478
550
  entityFqdn: 'wix.data.v2.data_item',
479
551
  method: 'POST',
480
552
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.QueryDataItems',
481
553
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
482
554
  protoPath: '/v2/items/query',
483
- data: payload,
555
+ data: serializedData,
484
556
  host,
485
557
  }),
486
- data: payload,
558
+ data: serializedData,
559
+ transformResponse: fromRes,
487
560
  };
488
561
  return metadata;
489
562
  }
563
+ __queryDataItems.fromReq = fromReq;
490
564
  return __queryDataItems;
491
565
  }
492
566
  /**
@@ -497,20 +571,25 @@ export function queryDataItems(payload) {
497
571
  * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
498
572
  */
499
573
  export function aggregateDataItems(payload) {
574
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_aggregateDataItemsRequest, {});
575
+ const { fromJSON: fromRes } = serializer(_aggregateDataItemsResponse, {});
500
576
  function __aggregateDataItems({ host }) {
577
+ const serializedData = toReq(payload);
501
578
  const metadata = {
502
579
  entityFqdn: 'wix.data.v2.data_item',
503
580
  method: 'POST',
504
581
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.AggregateDataItems',
505
582
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
506
583
  protoPath: '/v2/items/aggregate',
507
- data: payload,
584
+ data: serializedData,
508
585
  host,
509
586
  }),
510
- data: payload,
587
+ data: serializedData,
588
+ transformResponse: fromRes,
511
589
  };
512
590
  return metadata;
513
591
  }
592
+ __aggregateDataItems.fromReq = fromReq;
514
593
  return __aggregateDataItems;
515
594
  }
516
595
  /**
@@ -519,20 +598,25 @@ export function aggregateDataItems(payload) {
519
598
  * > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
520
599
  */
521
600
  export function countDataItems(payload) {
601
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_countDataItemsRequest, {});
602
+ const { fromJSON: fromRes } = serializer(_countDataItemsResponse, {});
522
603
  function __countDataItems({ host }) {
604
+ const serializedData = toReq(payload);
523
605
  const metadata = {
524
606
  entityFqdn: 'wix.data.v2.data_item',
525
607
  method: 'POST',
526
608
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.CountDataItems',
527
609
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
528
610
  protoPath: '/v2/items/count',
529
- data: payload,
611
+ data: serializedData,
530
612
  host,
531
613
  }),
532
- data: payload,
614
+ data: serializedData,
615
+ transformResponse: fromRes,
533
616
  };
534
617
  return metadata;
535
618
  }
619
+ __countDataItems.fromReq = fromReq;
536
620
  return __countDataItems;
537
621
  }
538
622
  /**
@@ -549,20 +633,25 @@ export function countDataItems(payload) {
549
633
  * > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
550
634
  */
551
635
  export function queryDistinctValues(payload) {
636
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_queryDistinctValuesRequest, {});
637
+ const { fromJSON: fromRes } = serializer(_queryDistinctValuesResponse, {});
552
638
  function __queryDistinctValues({ host }) {
639
+ const serializedData = toReq(payload);
553
640
  const metadata = {
554
641
  entityFqdn: 'wix.data.v2.data_item',
555
642
  method: 'POST',
556
643
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.QueryDistinctValues',
557
644
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
558
645
  protoPath: '/v2/items/query-distinct-values',
559
- data: payload,
646
+ data: serializedData,
560
647
  host,
561
648
  }),
562
- data: payload,
649
+ data: serializedData,
650
+ transformResponse: fromRes,
563
651
  };
564
652
  return metadata;
565
653
  }
654
+ __queryDistinctValues.fromReq = fromReq;
566
655
  return __queryDistinctValues;
567
656
  }
568
657
  /**
@@ -573,20 +662,25 @@ export function queryDistinctValues(payload) {
573
662
  * You can optionally provide your own ID when inserting the item. If you specify an ID that already exists in the collection, the insertion will fail.
574
663
  */
575
664
  export function bulkInsertDataItems(payload) {
665
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkInsertDataItemsRequest, {});
666
+ const { fromJSON: fromRes } = serializer(_bulkInsertDataItemsResponse, {});
576
667
  function __bulkInsertDataItems({ host }) {
668
+ const serializedData = toReq(payload);
577
669
  const metadata = {
578
670
  entityFqdn: 'wix.data.v2.data_item',
579
671
  method: 'POST',
580
672
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkInsertDataItems',
581
673
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
582
674
  protoPath: '/v2/bulk/items/insert',
583
- data: payload,
675
+ data: serializedData,
584
676
  host,
585
677
  }),
586
- data: payload,
678
+ data: serializedData,
679
+ transformResponse: fromRes,
587
680
  };
588
681
  return metadata;
589
682
  }
683
+ __bulkInsertDataItems.fromReq = fromReq;
590
684
  return __bulkInsertDataItems;
591
685
  }
592
686
  /**
@@ -605,20 +699,25 @@ export function bulkInsertDataItems(payload) {
605
699
  * > aren't included in the updated item, their values are lost.
606
700
  */
607
701
  export function bulkUpdateDataItems(payload) {
702
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkUpdateDataItemsRequest, {});
703
+ const { fromJSON: fromRes } = serializer(_bulkUpdateDataItemsResponse, {});
608
704
  function __bulkUpdateDataItems({ host }) {
705
+ const serializedData = toReq(payload);
609
706
  const metadata = {
610
707
  entityFqdn: 'wix.data.v2.data_item',
611
708
  method: 'POST',
612
709
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkUpdateDataItems',
613
710
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
614
711
  protoPath: '/v2/bulk/items/update',
615
- data: payload,
712
+ data: serializedData,
616
713
  host,
617
714
  }),
618
- data: payload,
715
+ data: serializedData,
716
+ transformResponse: fromRes,
619
717
  };
620
718
  return metadata;
621
719
  }
720
+ __bulkUpdateDataItems.fromReq = fromReq;
622
721
  return __bulkUpdateDataItems;
623
722
  }
624
723
  /**
@@ -637,20 +736,25 @@ export function bulkUpdateDataItems(payload) {
637
736
  * > This means that all of the item's previous fields and values are lost.
638
737
  */
639
738
  export function bulkSaveDataItems(payload) {
739
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkSaveDataItemsRequest, {});
740
+ const { fromJSON: fromRes } = serializer(_bulkSaveDataItemsResponse, {});
640
741
  function __bulkSaveDataItems({ host }) {
742
+ const serializedData = toReq(payload);
641
743
  const metadata = {
642
744
  entityFqdn: 'wix.data.v2.data_item',
643
745
  method: 'POST',
644
746
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkSaveDataItems',
645
747
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
646
748
  protoPath: '/v2/bulk/items/save',
647
- data: payload,
749
+ data: serializedData,
648
750
  host,
649
751
  }),
650
- data: payload,
752
+ data: serializedData,
753
+ transformResponse: fromRes,
651
754
  };
652
755
  return metadata;
653
756
  }
757
+ __bulkSaveDataItems.fromReq = fromReq;
654
758
  return __bulkSaveDataItems;
655
759
  }
656
760
  /**
@@ -662,20 +766,25 @@ export function bulkSaveDataItems(payload) {
662
766
  * > **Note:** Once an item has been removed from a collection, it can't be restored.
663
767
  */
664
768
  export function bulkRemoveDataItems(payload) {
769
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkRemoveDataItemsRequest, {});
770
+ const { fromJSON: fromRes } = serializer(_bulkRemoveDataItemsResponse, {});
665
771
  function __bulkRemoveDataItems({ host }) {
772
+ const serializedData = toReq(payload);
666
773
  const metadata = {
667
774
  entityFqdn: 'wix.data.v2.data_item',
668
775
  method: 'POST',
669
776
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkRemoveDataItems',
670
777
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
671
778
  protoPath: '/v2/bulk/items/remove',
672
- data: payload,
779
+ data: serializedData,
673
780
  host,
674
781
  }),
675
- data: payload,
782
+ data: serializedData,
783
+ transformResponse: fromRes,
676
784
  };
677
785
  return metadata;
678
786
  }
787
+ __bulkRemoveDataItems.fromReq = fromReq;
679
788
  return __bulkRemoveDataItems;
680
789
  }
681
790
  /**
@@ -692,20 +801,25 @@ export function bulkRemoveDataItems(payload) {
692
801
  * > **Note**: When calling `queryReferencedDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
693
802
  */
694
803
  export function queryReferencedDataItems(payload) {
804
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_queryReferencedDataItemsRequest, {});
805
+ const { fromJSON: fromRes } = serializer(_queryReferencedDataItemsResponse, {});
695
806
  function __queryReferencedDataItems({ host }) {
807
+ const serializedData = toReq(payload);
696
808
  const metadata = {
697
809
  entityFqdn: 'wix.data.v2.data_item',
698
810
  method: 'POST',
699
811
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.QueryReferencedDataItems',
700
812
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
701
813
  protoPath: '/v2/items/query-referenced',
702
- data: payload,
814
+ data: serializedData,
703
815
  host,
704
816
  }),
705
- data: payload,
817
+ data: serializedData,
818
+ transformResponse: fromRes,
706
819
  };
707
820
  return metadata;
708
821
  }
822
+ __queryReferencedDataItems.fromReq = fromReq;
709
823
  return __queryReferencedDataItems;
710
824
  }
711
825
  /**
@@ -714,20 +828,25 @@ export function queryReferencedDataItems(payload) {
714
828
  * > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
715
829
  */
716
830
  export function isReferencedDataItem(payload) {
831
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_isReferencedDataItemRequest, {});
832
+ const { fromJSON: fromRes } = serializer(_isReferencedDataItemResponse, {});
717
833
  function __isReferencedDataItem({ host }) {
834
+ const serializedData = toReq(payload);
718
835
  const metadata = {
719
836
  entityFqdn: 'wix.data.v2.data_item',
720
837
  method: 'POST',
721
838
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.IsReferencedDataItem',
722
839
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
723
840
  protoPath: '/v2/items/is-referenced',
724
- data: payload,
841
+ data: serializedData,
725
842
  host,
726
843
  }),
727
- data: payload,
844
+ data: serializedData,
845
+ transformResponse: fromRes,
728
846
  };
729
847
  return metadata;
730
848
  }
849
+ __isReferencedDataItem.fromReq = fromReq;
731
850
  return __isReferencedDataItem;
732
851
  }
733
852
  /**
@@ -737,38 +856,48 @@ export function isReferencedDataItem(payload) {
737
856
  * A reference in `options.dataItemReference` specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
738
857
  */
739
858
  export function insertDataItemReference(payload) {
859
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_insertDataItemReferenceRequest, {});
860
+ const { fromJSON: fromRes } = serializer(_insertDataItemReferenceResponse, {});
740
861
  function __insertDataItemReference({ host }) {
862
+ const serializedData = toReq(payload);
741
863
  const metadata = {
742
864
  entityFqdn: 'wix.data.v2.data_item',
743
865
  method: 'POST',
744
866
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.InsertDataItemReference',
745
867
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
746
868
  protoPath: '/v2/items/insert-reference',
747
- data: payload,
869
+ data: serializedData,
748
870
  host,
749
871
  }),
750
- data: payload,
872
+ data: serializedData,
873
+ transformResponse: fromRes,
751
874
  };
752
875
  return metadata;
753
876
  }
877
+ __insertDataItemReference.fromReq = fromReq;
754
878
  return __insertDataItemReference;
755
879
  }
756
880
  /** Removes the specified reference from the specified field. */
757
881
  export function removeDataItemReference(payload) {
882
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeDataItemReferenceRequest, {});
883
+ const { fromJSON: fromRes } = serializer(_removeDataItemReferenceResponse, {});
758
884
  function __removeDataItemReference({ host }) {
885
+ const serializedData = toReq(payload);
759
886
  const metadata = {
760
887
  entityFqdn: 'wix.data.v2.data_item',
761
888
  method: 'POST',
762
889
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.RemoveDataItemReference',
763
890
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
764
891
  protoPath: '/v2/items/remove-reference',
765
- data: payload,
892
+ data: serializedData,
766
893
  host,
767
894
  }),
768
- data: payload,
895
+ data: serializedData,
896
+ transformResponse: fromRes,
769
897
  };
770
898
  return metadata;
771
899
  }
900
+ __removeDataItemReference.fromReq = fromReq;
772
901
  return __removeDataItemReference;
773
902
  }
774
903
  /**
@@ -779,38 +908,48 @@ export function removeDataItemReference(payload) {
779
908
  * Each new reference in `options.dataItemReferences` specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
780
909
  */
781
910
  export function bulkInsertDataItemReferences(payload) {
911
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkInsertDataItemReferencesRequest, {});
912
+ const { fromJSON: fromRes } = serializer(_bulkInsertDataItemReferencesResponse, {});
782
913
  function __bulkInsertDataItemReferences({ host }) {
914
+ const serializedData = toReq(payload);
783
915
  const metadata = {
784
916
  entityFqdn: 'wix.data.v2.data_item',
785
917
  method: 'POST',
786
918
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkInsertDataItemReferences',
787
919
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
788
920
  protoPath: '/v2/bulk/items/insert-references',
789
- data: payload,
921
+ data: serializedData,
790
922
  host,
791
923
  }),
792
- data: payload,
924
+ data: serializedData,
925
+ transformResponse: fromRes,
793
926
  };
794
927
  return metadata;
795
928
  }
929
+ __bulkInsertDataItemReferences.fromReq = fromReq;
796
930
  return __bulkInsertDataItemReferences;
797
931
  }
798
932
  /** Removes one or more references. */
799
933
  export function bulkRemoveDataItemReferences(payload) {
934
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkRemoveDataItemReferencesRequest, {});
935
+ const { fromJSON: fromRes } = serializer(_bulkRemoveDataItemReferencesResponse, {});
800
936
  function __bulkRemoveDataItemReferences({ host }) {
937
+ const serializedData = toReq(payload);
801
938
  const metadata = {
802
939
  entityFqdn: 'wix.data.v2.data_item',
803
940
  method: 'POST',
804
941
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.BulkRemoveDataItemReferences',
805
942
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
806
943
  protoPath: '/v2/bulk/items/remove-references',
807
- data: payload,
944
+ data: serializedData,
808
945
  host,
809
946
  }),
810
- data: payload,
947
+ data: serializedData,
948
+ transformResponse: fromRes,
811
949
  };
812
950
  return metadata;
813
951
  }
952
+ __bulkRemoveDataItemReferences.fromReq = fromReq;
814
953
  return __bulkRemoveDataItemReferences;
815
954
  }
816
955
  /**
@@ -823,20 +962,25 @@ export function bulkRemoveDataItemReferences(payload) {
823
962
  * > **Note:** If you pass an empty array in `options.newReferencedItemIds`, all existing references are removed.
824
963
  */
825
964
  export function replaceDataItemReferences(payload) {
965
+ const { toJSON: toReq, fromJSON: fromReq } = serializer(_replaceDataItemReferencesRequest, {});
966
+ const { fromJSON: fromRes } = serializer(_replaceDataItemReferencesResponse, {});
826
967
  function __replaceDataItemReferences({ host }) {
968
+ const serializedData = toReq(payload);
827
969
  const metadata = {
828
970
  entityFqdn: 'wix.data.v2.data_item',
829
971
  method: 'POST',
830
972
  methodFqn: 'com.wixpress.cloud.data.api.data.DataItemService.ReplaceDataItemReferences',
831
973
  url: resolveComWixpressCloudDataApiDataDataItemServiceUrl({
832
974
  protoPath: '/v2/items/replace-references',
833
- data: payload,
975
+ data: serializedData,
834
976
  host,
835
977
  }),
836
- data: payload,
978
+ data: serializedData,
979
+ transformResponse: fromRes,
837
980
  };
838
981
  return metadata;
839
982
  }
983
+ __replaceDataItemReferences.fromReq = fromReq;
840
984
  return __replaceDataItemReferences;
841
985
  }
842
986
  //# sourceMappingURL=data-v2-data-item.http.js.map