@wix/auto_sdk_data_collections 1.0.0

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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/data-v2-data-collection-collections.context.d.ts +9 -0
  11. package/build/cjs/src/data-v2-data-collection-collections.context.js +38 -0
  12. package/build/cjs/src/data-v2-data-collection-collections.context.js.map +1 -0
  13. package/build/cjs/src/data-v2-data-collection-collections.http.d.ts +48 -0
  14. package/build/cjs/src/data-v2-data-collection-collections.http.js +704 -0
  15. package/build/cjs/src/data-v2-data-collection-collections.http.js.map +1 -0
  16. package/build/cjs/src/data-v2-data-collection-collections.meta.d.ts +27 -0
  17. package/build/cjs/src/data-v2-data-collection-collections.meta.js +199 -0
  18. package/build/cjs/src/data-v2-data-collection-collections.meta.js.map +1 -0
  19. package/build/cjs/src/data-v2-data-collection-collections.public.d.ts +69 -0
  20. package/build/cjs/src/data-v2-data-collection-collections.public.js +83 -0
  21. package/build/cjs/src/data-v2-data-collection-collections.public.js.map +1 -0
  22. package/build/cjs/src/data-v2-data-collection-collections.types.d.ts +1238 -0
  23. package/build/cjs/src/data-v2-data-collection-collections.types.js +235 -0
  24. package/build/cjs/src/data-v2-data-collection-collections.types.js.map +1 -0
  25. package/build/cjs/src/data-v2-data-collection-collections.universal.d.ts +1394 -0
  26. package/build/cjs/src/data-v2-data-collection-collections.universal.js +669 -0
  27. package/build/cjs/src/data-v2-data-collection-collections.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/data-v2-data-collection-collections.context.d.ts +9 -0
  39. package/build/es/src/data-v2-data-collection-collections.context.js +17 -0
  40. package/build/es/src/data-v2-data-collection-collections.context.js.map +1 -0
  41. package/build/es/src/data-v2-data-collection-collections.http.d.ts +48 -0
  42. package/build/es/src/data-v2-data-collection-collections.http.js +692 -0
  43. package/build/es/src/data-v2-data-collection-collections.http.js.map +1 -0
  44. package/build/es/src/data-v2-data-collection-collections.meta.d.ts +27 -0
  45. package/build/es/src/data-v2-data-collection-collections.meta.js +164 -0
  46. package/build/es/src/data-v2-data-collection-collections.meta.js.map +1 -0
  47. package/build/es/src/data-v2-data-collection-collections.public.d.ts +69 -0
  48. package/build/es/src/data-v2-data-collection-collections.public.js +53 -0
  49. package/build/es/src/data-v2-data-collection-collections.public.js.map +1 -0
  50. package/build/es/src/data-v2-data-collection-collections.types.d.ts +1238 -0
  51. package/build/es/src/data-v2-data-collection-collections.types.js +232 -0
  52. package/build/es/src/data-v2-data-collection-collections.types.js.map +1 -0
  53. package/build/es/src/data-v2-data-collection-collections.universal.d.ts +1394 -0
  54. package/build/es/src/data-v2-data-collection-collections.universal.js +634 -0
  55. package/build/es/src/data-v2-data-collection-collections.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/data-v2-data-collection-collections.context.d.ts +17 -0
  66. package/build/internal/cjs/src/data-v2-data-collection-collections.context.js +38 -0
  67. package/build/internal/cjs/src/data-v2-data-collection-collections.context.js.map +1 -0
  68. package/build/internal/cjs/src/data-v2-data-collection-collections.http.d.ts +48 -0
  69. package/build/internal/cjs/src/data-v2-data-collection-collections.http.js +704 -0
  70. package/build/internal/cjs/src/data-v2-data-collection-collections.http.js.map +1 -0
  71. package/build/internal/cjs/src/data-v2-data-collection-collections.meta.d.ts +27 -0
  72. package/build/internal/cjs/src/data-v2-data-collection-collections.meta.js +199 -0
  73. package/build/internal/cjs/src/data-v2-data-collection-collections.meta.js.map +1 -0
  74. package/build/internal/cjs/src/data-v2-data-collection-collections.public.d.ts +107 -0
  75. package/build/internal/cjs/src/data-v2-data-collection-collections.public.js +83 -0
  76. package/build/internal/cjs/src/data-v2-data-collection-collections.public.js.map +1 -0
  77. package/build/internal/cjs/src/data-v2-data-collection-collections.types.d.ts +1254 -0
  78. package/build/internal/cjs/src/data-v2-data-collection-collections.types.js +235 -0
  79. package/build/internal/cjs/src/data-v2-data-collection-collections.types.js.map +1 -0
  80. package/build/internal/cjs/src/data-v2-data-collection-collections.universal.d.ts +1504 -0
  81. package/build/internal/cjs/src/data-v2-data-collection-collections.universal.js +669 -0
  82. package/build/internal/cjs/src/data-v2-data-collection-collections.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/data-v2-data-collection-collections.context.d.ts +17 -0
  93. package/build/internal/es/src/data-v2-data-collection-collections.context.js +17 -0
  94. package/build/internal/es/src/data-v2-data-collection-collections.context.js.map +1 -0
  95. package/build/internal/es/src/data-v2-data-collection-collections.http.d.ts +48 -0
  96. package/build/internal/es/src/data-v2-data-collection-collections.http.js +692 -0
  97. package/build/internal/es/src/data-v2-data-collection-collections.http.js.map +1 -0
  98. package/build/internal/es/src/data-v2-data-collection-collections.meta.d.ts +27 -0
  99. package/build/internal/es/src/data-v2-data-collection-collections.meta.js +164 -0
  100. package/build/internal/es/src/data-v2-data-collection-collections.meta.js.map +1 -0
  101. package/build/internal/es/src/data-v2-data-collection-collections.public.d.ts +107 -0
  102. package/build/internal/es/src/data-v2-data-collection-collections.public.js +53 -0
  103. package/build/internal/es/src/data-v2-data-collection-collections.public.js.map +1 -0
  104. package/build/internal/es/src/data-v2-data-collection-collections.types.d.ts +1254 -0
  105. package/build/internal/es/src/data-v2-data-collection-collections.types.js +232 -0
  106. package/build/internal/es/src/data-v2-data-collection-collections.types.js.map +1 -0
  107. package/build/internal/es/src/data-v2-data-collection-collections.universal.d.ts +1504 -0
  108. package/build/internal/es/src/data-v2-data-collection-collections.universal.js +634 -0
  109. package/build/internal/es/src/data-v2-data-collection-collections.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,692 @@
1
+ import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';
2
+ import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';
3
+ import { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';
4
+ import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
5
+ import { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
6
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
7
+ import { resolveUrl } from '@wix/sdk-runtime/rest-modules';
8
+ function resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl(opts) {
9
+ const domainToMappings = {
10
+ 'api._api_base_domain_': [
11
+ {
12
+ srcPath: '/cloud-data',
13
+ destPath: '',
14
+ },
15
+ ],
16
+ 'code._base_domain_': [
17
+ {
18
+ srcPath: '/_api/cloud-data/v1/data-settings',
19
+ destPath: '/v1/data-settings',
20
+ },
21
+ {
22
+ srcPath: '/_api/cloud-data/v1/schemas',
23
+ destPath: '/v1/schemas',
24
+ },
25
+ {
26
+ srcPath: '/_api/cloud-data/v1/connector',
27
+ destPath: '/v1/connector',
28
+ },
29
+ {
30
+ srcPath: '/_api/data/v1/data-settings',
31
+ destPath: '/v1/data-settings',
32
+ },
33
+ {
34
+ srcPath: '/_api/data/v1/schemas',
35
+ destPath: '/v1/schemas',
36
+ },
37
+ {
38
+ srcPath: '/_api/data/v1/connector',
39
+ destPath: '/v1/connector',
40
+ },
41
+ {
42
+ srcPath: '/_api/cloud-data/v1/wix-data',
43
+ destPath: '/v1/wix-data',
44
+ },
45
+ ],
46
+ 'cloud-data.wix-code.com': [
47
+ {
48
+ srcPath: '',
49
+ destPath: '',
50
+ },
51
+ ],
52
+ _: [
53
+ {
54
+ srcPath: '/_api/cloud-data',
55
+ destPath: '',
56
+ },
57
+ ],
58
+ 'www._base_domain_': [
59
+ {
60
+ srcPath: '/_api/cloud-data',
61
+ destPath: '',
62
+ },
63
+ {
64
+ srcPath: '/_api/data',
65
+ destPath: '',
66
+ },
67
+ {
68
+ srcPath: '/_api/cloud-data',
69
+ destPath: '',
70
+ },
71
+ ],
72
+ 'dev._base_domain_': [
73
+ {
74
+ srcPath: '/_api/cloud-data',
75
+ destPath: '',
76
+ },
77
+ ],
78
+ 'bo._base_domain_': [
79
+ {
80
+ srcPath: '/_api/cloud-data/v1',
81
+ destPath: '/v1',
82
+ },
83
+ {
84
+ srcPath: '/_api/cloud-data/v2',
85
+ destPath: '/v2',
86
+ },
87
+ ],
88
+ 'wixbo.ai': [
89
+ {
90
+ srcPath: '/_api/cloud-data/v1',
91
+ destPath: '/v1',
92
+ },
93
+ {
94
+ srcPath: '/_api/cloud-data/v2',
95
+ destPath: '/v2',
96
+ },
97
+ ],
98
+ 'wix-bo.com': [
99
+ {
100
+ srcPath: '/_api/cloud-data/v1',
101
+ destPath: '/v1',
102
+ },
103
+ {
104
+ srcPath: '/_api/cloud-data/v2',
105
+ destPath: '/v2',
106
+ },
107
+ ],
108
+ 'manage._base_domain_': [
109
+ {
110
+ srcPath: '/_api/cloud-data',
111
+ destPath: '',
112
+ },
113
+ {
114
+ srcPath: '/_api/data',
115
+ destPath: '',
116
+ },
117
+ {
118
+ srcPath: '/_api/cloud-data',
119
+ destPath: '',
120
+ },
121
+ ],
122
+ 'editor._base_domain_': [
123
+ {
124
+ srcPath: '/_api/cloud-data/v1/schemas',
125
+ destPath: '/v1/schemas',
126
+ },
127
+ {
128
+ srcPath: '/_api/cloud-data/dbs/tasks',
129
+ destPath: '/dbs/tasks',
130
+ },
131
+ {
132
+ srcPath: '/_api/data/v1/schemas',
133
+ destPath: '/v1/schemas',
134
+ },
135
+ {
136
+ srcPath: '/_api/data/dbs/tasks',
137
+ destPath: '/dbs/tasks',
138
+ },
139
+ {
140
+ srcPath: '/_api/cloud-data/v1/wix-data',
141
+ destPath: '/v1/wix-data',
142
+ },
143
+ {
144
+ srcPath: '/_api/cloud-data/v1/data-settings',
145
+ destPath: '/v1/data-settings',
146
+ },
147
+ {
148
+ srcPath: '/_api/data/v2/indexes',
149
+ destPath: '/v2/indexes',
150
+ },
151
+ {
152
+ srcPath: '/_api/cloud-data/v1/external-database-connections',
153
+ destPath: '/v1/external-database-connections',
154
+ },
155
+ {
156
+ srcPath: '/_api/data/v1/data-collection-sharing',
157
+ destPath: '/v1/data-collection-sharing',
158
+ },
159
+ {
160
+ srcPath: '/_api/cloud-data/v2/collections',
161
+ destPath: '/v2/collections',
162
+ },
163
+ {
164
+ srcPath: '/_api/cloud-data/v2/bulk',
165
+ destPath: '/v2/bulk',
166
+ },
167
+ {
168
+ srcPath: '/_api/cloud-data/v2/items',
169
+ destPath: '/v2/items',
170
+ },
171
+ {
172
+ srcPath: '/_api/cloud-data/v2/dbs/tasks',
173
+ destPath: '/v2/dbs/tasks',
174
+ },
175
+ ],
176
+ 'blocks._base_domain_': [
177
+ {
178
+ srcPath: '/_api/cloud-data/v1/schemas',
179
+ destPath: '/v1/schemas',
180
+ },
181
+ {
182
+ srcPath: '/_api/cloud-data/dbs/tasks',
183
+ destPath: '/dbs/tasks',
184
+ },
185
+ {
186
+ srcPath: '/_api/data/v1/schemas',
187
+ destPath: '/v1/schemas',
188
+ },
189
+ {
190
+ srcPath: '/_api/data/dbs/tasks',
191
+ destPath: '/dbs/tasks',
192
+ },
193
+ {
194
+ srcPath: '/_api/cloud-data/v1/wix-data',
195
+ destPath: '/v1/wix-data',
196
+ },
197
+ {
198
+ srcPath: '/_api/cloud-data/v1/data-settings',
199
+ destPath: '/v1/data-settings',
200
+ },
201
+ {
202
+ srcPath: '/_api/data/v2/indexes',
203
+ destPath: '/v2/indexes',
204
+ },
205
+ {
206
+ srcPath: '/_api/cloud-data/v1/external-database-connections',
207
+ destPath: '/v1/external-database-connections',
208
+ },
209
+ {
210
+ srcPath: '/_api/data/v1/data-collection-sharing',
211
+ destPath: '/v1/data-collection-sharing',
212
+ },
213
+ {
214
+ srcPath: '/_api/cloud-data/v2/collections',
215
+ destPath: '/v2/collections',
216
+ },
217
+ {
218
+ srcPath: '/_api/cloud-data/v2/bulk',
219
+ destPath: '/v2/bulk',
220
+ },
221
+ {
222
+ srcPath: '/_api/cloud-data/v2/items',
223
+ destPath: '/v2/items',
224
+ },
225
+ {
226
+ srcPath: '/_api/cloud-data/v2/dbs/tasks',
227
+ destPath: '/v2/dbs/tasks',
228
+ },
229
+ ],
230
+ 'create.editorx': [
231
+ {
232
+ srcPath: '/_api/cloud-data/v1/schemas',
233
+ destPath: '/v1/schemas',
234
+ },
235
+ {
236
+ srcPath: '/_api/cloud-data/dbs/tasks',
237
+ destPath: '/dbs/tasks',
238
+ },
239
+ {
240
+ srcPath: '/_api/data/v1/schemas',
241
+ destPath: '/v1/schemas',
242
+ },
243
+ {
244
+ srcPath: '/_api/data/dbs/tasks',
245
+ destPath: '/dbs/tasks',
246
+ },
247
+ {
248
+ srcPath: '/_api/cloud-data/v1/wix-data',
249
+ destPath: '/v1/wix-data',
250
+ },
251
+ {
252
+ srcPath: '/_api/cloud-data/v1/data-settings',
253
+ destPath: '/v1/data-settings',
254
+ },
255
+ {
256
+ srcPath: '/_api/data/v2/indexes',
257
+ destPath: '/v2/indexes',
258
+ },
259
+ {
260
+ srcPath: '/_api/cloud-data/v1/external-database-connections',
261
+ destPath: '/v1/external-database-connections',
262
+ },
263
+ {
264
+ srcPath: '/_api/data/v1/data-collection-sharing',
265
+ destPath: '/v1/data-collection-sharing',
266
+ },
267
+ {
268
+ srcPath: '/_api/cloud-data/v2/collections',
269
+ destPath: '/v2/collections',
270
+ },
271
+ {
272
+ srcPath: '/_api/cloud-data/v2/bulk',
273
+ destPath: '/v2/bulk',
274
+ },
275
+ {
276
+ srcPath: '/_api/cloud-data/v2/items',
277
+ destPath: '/v2/items',
278
+ },
279
+ {
280
+ srcPath: '/_api/cloud-data/v2/dbs/tasks',
281
+ destPath: '/v2/dbs/tasks',
282
+ },
283
+ ],
284
+ 'www.wixapis.com': [
285
+ {
286
+ srcPath: '/wix-data/v1/collections',
287
+ destPath: '/v1/wix-data/collections',
288
+ },
289
+ {
290
+ srcPath: '/wix-data/v1/external-database-connections',
291
+ destPath: '/v1/external-database-connections',
292
+ },
293
+ {
294
+ srcPath: '/wix-data/v2/indexes',
295
+ destPath: '/v2/indexes',
296
+ },
297
+ {
298
+ srcPath: '/wix-data/v1/items',
299
+ destPath: '/v1/items',
300
+ },
301
+ {
302
+ srcPath: '/wix-data/v1/bulk',
303
+ destPath: '/v1/bulk',
304
+ },
305
+ {
306
+ srcPath: '/wix-data/v1/external-databases',
307
+ destPath: '/v1/external-databases',
308
+ },
309
+ {
310
+ srcPath: '/wix-data/v2',
311
+ destPath: '/v2',
312
+ },
313
+ ],
314
+ 'www.wixgateway.com': [
315
+ {
316
+ srcPath: '/wix-data/v1/items',
317
+ destPath: '/v1/items',
318
+ },
319
+ {
320
+ srcPath: '/wix-data/v1/bulk',
321
+ destPath: '/v1/bulk',
322
+ },
323
+ ],
324
+ '*.dev.wix-code.com': [
325
+ {
326
+ srcPath: '/_api/cloud-data/v2',
327
+ destPath: '/v2',
328
+ },
329
+ ],
330
+ };
331
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
332
+ }
333
+ const PACKAGE_NAME = '@wix/auto_sdk_data_collections';
334
+ /**
335
+ * Creates a new data collection.
336
+ *
337
+ * The request body must include an ID, details for at least 1 field, and a permissions object. If any of these are missing, the collection isn't created.
338
+ */
339
+ export function createDataCollection(payload) {
340
+ function __createDataCollection({ host }) {
341
+ const serializedData = transformPaths(payload, [
342
+ {
343
+ transformFn: transformSDKTimestampToRESTTimestamp,
344
+ paths: [
345
+ { path: 'collection.createdDate' },
346
+ { path: 'collection.updatedDate' },
347
+ ],
348
+ },
349
+ {
350
+ transformFn: transformSDKFloatToRESTFloat,
351
+ paths: [
352
+ { path: 'collection.fields.numberRange.min' },
353
+ { path: 'collection.fields.numberRange.max' },
354
+ ],
355
+ },
356
+ ]);
357
+ const metadata = {
358
+ entityFqdn: 'wix.data.v2.data_collection',
359
+ method: 'POST',
360
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.CreateDataCollection',
361
+ packageName: PACKAGE_NAME,
362
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections', data: serializedData, host }),
363
+ data: serializedData,
364
+ transformResponse: (payload) => transformPaths(payload, [
365
+ {
366
+ transformFn: transformRESTTimestampToSDKTimestamp,
367
+ paths: [
368
+ { path: 'collection.createdDate' },
369
+ { path: 'collection.updatedDate' },
370
+ ],
371
+ },
372
+ {
373
+ transformFn: transformRESTFloatToSDKFloat,
374
+ paths: [
375
+ { path: 'collection.fields.numberRange.min' },
376
+ { path: 'collection.fields.numberRange.max' },
377
+ ],
378
+ },
379
+ ]),
380
+ };
381
+ return metadata;
382
+ }
383
+ return __createDataCollection;
384
+ }
385
+ /** Retrieves a data collection by ID. */
386
+ export function getDataCollection(payload) {
387
+ function __getDataCollection({ host }) {
388
+ const metadata = {
389
+ entityFqdn: 'wix.data.v2.data_collection',
390
+ method: 'GET',
391
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.GetDataCollection',
392
+ packageName: PACKAGE_NAME,
393
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections/{dataCollectionId}', data: payload, host }),
394
+ params: toURLSearchParams(payload),
395
+ transformResponse: (payload) => transformPaths(payload, [
396
+ {
397
+ transformFn: transformRESTTimestampToSDKTimestamp,
398
+ paths: [
399
+ { path: 'collection.createdDate' },
400
+ { path: 'collection.updatedDate' },
401
+ { path: 'referencedCollections.createdDate' },
402
+ { path: 'referencedCollections.updatedDate' },
403
+ ],
404
+ },
405
+ {
406
+ transformFn: transformRESTFloatToSDKFloat,
407
+ paths: [
408
+ { path: 'collection.fields.numberRange.min' },
409
+ { path: 'collection.fields.numberRange.max' },
410
+ { path: 'referencedCollections.fields.numberRange.min' },
411
+ { path: 'referencedCollections.fields.numberRange.max' },
412
+ ],
413
+ },
414
+ ]),
415
+ };
416
+ return metadata;
417
+ }
418
+ return __getDataCollection;
419
+ }
420
+ /**
421
+ * Retrieves a list of all data collections associated with the site or project.
422
+ *
423
+ * By default, the list is ordered by ID in ascending order.
424
+ */
425
+ export function listDataCollections(payload) {
426
+ function __listDataCollections({ host }) {
427
+ const metadata = {
428
+ entityFqdn: 'wix.data.v2.data_collection',
429
+ method: 'GET',
430
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.ListDataCollections',
431
+ packageName: PACKAGE_NAME,
432
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections', data: payload, host }),
433
+ params: toURLSearchParams(payload),
434
+ transformResponse: (payload) => transformPaths(payload, [
435
+ {
436
+ transformFn: transformRESTTimestampToSDKTimestamp,
437
+ paths: [
438
+ { path: 'collections.createdDate' },
439
+ { path: 'collections.updatedDate' },
440
+ ],
441
+ },
442
+ {
443
+ transformFn: transformRESTFloatToSDKFloat,
444
+ paths: [
445
+ { path: 'collections.fields.numberRange.min' },
446
+ { path: 'collections.fields.numberRange.max' },
447
+ ],
448
+ },
449
+ ]),
450
+ };
451
+ return metadata;
452
+ }
453
+ return __listDataCollections;
454
+ }
455
+ /**
456
+ * Updates a data collection.
457
+ *
458
+ * A collection ID, revision number, permissions, and at least 1 field must be provided within the `collection` body parameter.
459
+ * If a collection with that ID exists, and if its current `revision` number matches the one provided, it is updated.
460
+ * Otherwise, the request fails.
461
+ *
462
+ * When a collection is updated, its `updatedDate` property is changed to the current date and its `revision` property is incremented.
463
+ *
464
+ * > **Note:**
465
+ * > After a collection is updated, it only contains the properties included in the Update Data Collection request. If the existing collection has properties with values and those properties
466
+ * > aren't included in the updated collection details, their values are lost.
467
+ */
468
+ export function updateDataCollection(payload) {
469
+ function __updateDataCollection({ host }) {
470
+ const serializedData = transformPaths(payload, [
471
+ {
472
+ transformFn: transformSDKTimestampToRESTTimestamp,
473
+ paths: [
474
+ { path: 'collection.createdDate' },
475
+ { path: 'collection.updatedDate' },
476
+ ],
477
+ },
478
+ {
479
+ transformFn: transformSDKFloatToRESTFloat,
480
+ paths: [
481
+ { path: 'collection.fields.numberRange.min' },
482
+ { path: 'collection.fields.numberRange.max' },
483
+ ],
484
+ },
485
+ ]);
486
+ const metadata = {
487
+ entityFqdn: 'wix.data.v2.data_collection',
488
+ method: 'PUT',
489
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.UpdateDataCollection',
490
+ packageName: PACKAGE_NAME,
491
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections', data: serializedData, host }),
492
+ data: serializedData,
493
+ transformResponse: (payload) => transformPaths(payload, [
494
+ {
495
+ transformFn: transformRESTTimestampToSDKTimestamp,
496
+ paths: [
497
+ { path: 'collection.createdDate' },
498
+ { path: 'collection.updatedDate' },
499
+ ],
500
+ },
501
+ {
502
+ transformFn: transformRESTFloatToSDKFloat,
503
+ paths: [
504
+ { path: 'collection.fields.numberRange.min' },
505
+ { path: 'collection.fields.numberRange.max' },
506
+ ],
507
+ },
508
+ ]),
509
+ };
510
+ return metadata;
511
+ }
512
+ return __updateDataCollection;
513
+ }
514
+ /**
515
+ * Deletes a data collection.
516
+ *
517
+ * > **Note:**
518
+ * > Once a collection is deleted, it can only be restored for limited amount of time.
519
+ */
520
+ export function deleteDataCollection(payload) {
521
+ function __deleteDataCollection({ host }) {
522
+ const metadata = {
523
+ entityFqdn: 'wix.data.v2.data_collection',
524
+ method: 'DELETE',
525
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.DeleteDataCollection',
526
+ packageName: PACKAGE_NAME,
527
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections/{dataCollectionId}', data: payload, host }),
528
+ params: toURLSearchParams(payload),
529
+ };
530
+ return metadata;
531
+ }
532
+ return __deleteDataCollection;
533
+ }
534
+ /**
535
+ * Restores recently deleted collection.
536
+ *
537
+ * Fails with `WDE0025` if collection was deleted too long ago or has never existed.
538
+ */
539
+ export function restoreDataCollection(payload) {
540
+ function __restoreDataCollection({ host }) {
541
+ const metadata = {
542
+ entityFqdn: 'wix.data.v2.data_collection',
543
+ method: 'POST',
544
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.RestoreDataCollection',
545
+ packageName: PACKAGE_NAME,
546
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({
547
+ protoPath: '/v2/collections/restore/{dataCollectionId}',
548
+ data: payload,
549
+ host,
550
+ }),
551
+ data: payload,
552
+ transformResponse: (payload) => transformPaths(payload, [
553
+ {
554
+ transformFn: transformRESTTimestampToSDKTimestamp,
555
+ paths: [
556
+ { path: 'dataCollection.createdDate' },
557
+ { path: 'dataCollection.updatedDate' },
558
+ ],
559
+ },
560
+ {
561
+ transformFn: transformRESTFloatToSDKFloat,
562
+ paths: [
563
+ { path: 'dataCollection.fields.numberRange.min' },
564
+ { path: 'dataCollection.fields.numberRange.max' },
565
+ ],
566
+ },
567
+ ]),
568
+ };
569
+ return metadata;
570
+ }
571
+ return __restoreDataCollection;
572
+ }
573
+ /** Adds new field to data collection schema */
574
+ export function createDataCollectionField(payload) {
575
+ function __createDataCollectionField({ host }) {
576
+ const serializedData = transformPaths(payload, [
577
+ {
578
+ transformFn: transformSDKFloatToRESTFloat,
579
+ paths: [
580
+ { path: 'field.numberRange.min' },
581
+ { path: 'field.numberRange.max' },
582
+ ],
583
+ },
584
+ ]);
585
+ const metadata = {
586
+ entityFqdn: 'wix.data.v2.data_collection',
587
+ method: 'POST',
588
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.CreateDataCollectionField',
589
+ packageName: PACKAGE_NAME,
590
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({
591
+ protoPath: '/v2/collections/create-field',
592
+ data: serializedData,
593
+ host,
594
+ }),
595
+ data: serializedData,
596
+ transformResponse: (payload) => transformPaths(payload, [
597
+ {
598
+ transformFn: transformRESTTimestampToSDKTimestamp,
599
+ paths: [
600
+ { path: 'dataCollection.createdDate' },
601
+ { path: 'dataCollection.updatedDate' },
602
+ ],
603
+ },
604
+ {
605
+ transformFn: transformRESTFloatToSDKFloat,
606
+ paths: [
607
+ { path: 'dataCollection.fields.numberRange.min' },
608
+ { path: 'dataCollection.fields.numberRange.max' },
609
+ ],
610
+ },
611
+ ]),
612
+ };
613
+ return metadata;
614
+ }
615
+ return __createDataCollectionField;
616
+ }
617
+ /** Updates data collection field */
618
+ export function updateDataCollectionField(payload) {
619
+ function __updateDataCollectionField({ host }) {
620
+ const serializedData = transformPaths(payload, [
621
+ {
622
+ transformFn: transformSDKFloatToRESTFloat,
623
+ paths: [
624
+ { path: 'field.numberRange.min' },
625
+ { path: 'field.numberRange.max' },
626
+ ],
627
+ },
628
+ ]);
629
+ const metadata = {
630
+ entityFqdn: 'wix.data.v2.data_collection',
631
+ method: 'POST',
632
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.UpdateDataCollectionField',
633
+ packageName: PACKAGE_NAME,
634
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({
635
+ protoPath: '/v2/collections/update-field',
636
+ data: serializedData,
637
+ host,
638
+ }),
639
+ data: serializedData,
640
+ transformResponse: (payload) => transformPaths(payload, [
641
+ {
642
+ transformFn: transformRESTTimestampToSDKTimestamp,
643
+ paths: [
644
+ { path: 'dataCollection.createdDate' },
645
+ { path: 'dataCollection.updatedDate' },
646
+ ],
647
+ },
648
+ {
649
+ transformFn: transformRESTFloatToSDKFloat,
650
+ paths: [
651
+ { path: 'dataCollection.fields.numberRange.min' },
652
+ { path: 'dataCollection.fields.numberRange.max' },
653
+ ],
654
+ },
655
+ ]),
656
+ };
657
+ return metadata;
658
+ }
659
+ return __updateDataCollectionField;
660
+ }
661
+ /** Deletes data collection field */
662
+ export function deleteDataCollectionField(payload) {
663
+ function __deleteDataCollectionField({ host }) {
664
+ const metadata = {
665
+ entityFqdn: 'wix.data.v2.data_collection',
666
+ method: 'POST',
667
+ methodFqn: 'com.wixpress.cloud.data.api.collectionservice.DataCollectionService.DeleteDataCollectionField',
668
+ packageName: PACKAGE_NAME,
669
+ url: resolveComWixpressCloudDataApiCollectionserviceDataCollectionServiceUrl({ protoPath: '/v2/collections/delete-field', data: payload, host }),
670
+ data: payload,
671
+ transformResponse: (payload) => transformPaths(payload, [
672
+ {
673
+ transformFn: transformRESTTimestampToSDKTimestamp,
674
+ paths: [
675
+ { path: 'dataCollection.createdDate' },
676
+ { path: 'dataCollection.updatedDate' },
677
+ ],
678
+ },
679
+ {
680
+ transformFn: transformRESTFloatToSDKFloat,
681
+ paths: [
682
+ { path: 'dataCollection.fields.numberRange.min' },
683
+ { path: 'dataCollection.fields.numberRange.max' },
684
+ ],
685
+ },
686
+ ]),
687
+ };
688
+ return metadata;
689
+ }
690
+ return __deleteDataCollectionField;
691
+ }
692
+ //# sourceMappingURL=data-v2-data-collection-collections.http.js.map