@wix/auto_sdk_data_collections 1.0.14 → 1.0.16

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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /** A data collection determines the structure of data to be stored in a database. */
2
4
  interface DataCollection {
3
5
  /**
@@ -853,6 +855,8 @@ declare enum Segment {
853
855
  PUBLIC = "PUBLIC",
854
856
  DEV = "DEV"
855
857
  }
858
+ /** @enumType */
859
+ type SegmentWithLiterals = Segment | 'UNKNOWN_SEGMENT' | 'PUBLIC' | 'DEV';
856
860
  interface GetDataCollectionResponse {
857
861
  /** Details of the collection requested. */
858
862
  collection?: DataCollection;
@@ -1429,6 +1433,41 @@ declare enum WebhookIdentityType {
1429
1433
  }
1430
1434
  /** @enumType */
1431
1435
  type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
1436
+ type DataCollectionNonNullablePaths = `_id` | `collectionType` | `defaultDisplayOrder.fieldKey` | `defaultDisplayOrder.direction` | `capabilities.dataOperations` | `capabilities.collectionOperations` | `capabilities.indexLimits.regular` | `capabilities.indexLimits.unique` | `capabilities.indexLimits.total` | `fields` | `fields.${number}.key` | `fields.${number}.type` | `fields.${number}.typeMetadata.reference.referencedCollectionId` | `fields.${number}.typeMetadata.multiReference.referencedCollectionId` | `fields.${number}.typeMetadata.multiReference.referencingFieldKey` | `fields.${number}.typeMetadata.multiReference.referencingDisplayName` | `fields.${number}.typeMetadata.array.elementType` | `fields.${number}.typeMetadata.pageLink.calculator.fieldsPattern.pattern` | `fields.${number}.typeMetadata.pageLink.calculator.fieldsPattern.lowercase` | `fields.${number}.typeMetadata.pageLink.calculator.urlizedOnlyPattern.pattern` | `fields.${number}.systemField` | `fields.${number}.encrypted` | `permissions.insert` | `permissions.update` | `permissions.remove` | `permissions.read` | `plugins` | `plugins.${number}.publishOptions.defaultStatus` | `plugins.${number}.singleItemOptions.singleItemId` | `plugins.${number}.urlizedOptions.format` | `plugins.${number}.editablePageLinkOptions.isPersisted` | `plugins.${number}.editablePageLinkOptions.isMutable` | `plugins.${number}.type` | `pagingModes`;
1437
+ /**
1438
+ * Creates a new data collection.
1439
+ *
1440
+ * 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.
1441
+ * @param collection - Collection details.
1442
+ * @public
1443
+ * @requiredField collection
1444
+ * @requiredField collection._id
1445
+ * @requiredField collection.fields.key
1446
+ * @requiredField collection.fields.type
1447
+ * @requiredField collection.permissions.insert
1448
+ * @requiredField collection.permissions.read
1449
+ * @requiredField collection.permissions.remove
1450
+ * @requiredField collection.permissions.update
1451
+ * @param options - Options for creating a data collection.
1452
+ * @permissionId WIX_DATA.CREATE_COLLECTION
1453
+ * @applicableIdentity APP
1454
+ * @returns Details of collection created.
1455
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.CreateDataCollection
1456
+ */
1457
+ declare function createDataCollection(collection: NonNullablePaths<DataCollection, `_id` | `fields.${number}.key` | `fields.${number}.type` | `permissions.insert` | `permissions.read` | `permissions.remove` | `permissions.update`>): Promise<NonNullablePaths<DataCollection, DataCollectionNonNullablePaths>>;
1458
+ /**
1459
+ * Retrieves a data collection by ID.
1460
+ * @param dataCollectionId - ID of the collection to retrieve.
1461
+ * @public
1462
+ * @requiredField dataCollectionId
1463
+ * @param options - Options for retrieving a data collection.
1464
+ * @permissionId WIX_DATA.GET_COLLECTION
1465
+ * @applicableIdentity APP
1466
+ * @applicableIdentity VISITOR
1467
+ * @returns Details of the collection requested.
1468
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.GetDataCollection
1469
+ */
1470
+ declare function getDataCollection(dataCollectionId: string, options?: GetDataCollectionOptions): Promise<NonNullablePaths<DataCollection, DataCollectionNonNullablePaths>>;
1432
1471
  interface GetDataCollectionOptions {
1433
1472
  /**
1434
1473
  * Whether to retrieve data from the primary database instance.
@@ -1446,6 +1485,19 @@ interface GetDataCollectionOptions {
1446
1485
  */
1447
1486
  fields?: string[];
1448
1487
  }
1488
+ /**
1489
+ * Retrieves a list of all data collections associated with the site or project.
1490
+ *
1491
+ * By default, the list is ordered by ID in ascending order.
1492
+ * @public
1493
+ * @param options - Options for retrieving a list of data collections.
1494
+ * @permissionId WIX_DATA.LIST_COLLECTIONS
1495
+ * @applicableIdentity APP
1496
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.ListDataCollections
1497
+ */
1498
+ declare function listDataCollections(options?: ListDataCollectionsOptions): Promise<NonNullablePaths<ListDataCollectionsResponse, {
1499
+ [P in DataCollectionNonNullablePaths]: `collections.${number}.${P}`;
1500
+ }[DataCollectionNonNullablePaths]>>;
1449
1501
  interface ListDataCollectionsOptions {
1450
1502
  /**
1451
1503
  * Defines how collections in the response are sorted.
@@ -1471,14 +1523,117 @@ interface ListDataCollectionsOptions {
1471
1523
  */
1472
1524
  fields?: string[];
1473
1525
  }
1526
+ /**
1527
+ * Updates a data collection.
1528
+ *
1529
+ * A collection ID, revision number, permissions, and at least 1 field must be provided within the `collection` body parameter.
1530
+ * If a collection with that ID exists, and if its current `revision` number matches the one provided, it is updated.
1531
+ * Otherwise, the request fails.
1532
+ *
1533
+ * When a collection is updated, its `updatedDate` property is changed to the current date and its `revision` property is incremented.
1534
+ *
1535
+ * > **Note:**
1536
+ * > 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
1537
+ * > aren't included in the updated collection details, their values are lost.
1538
+ * @param collection - Updated collection details. The existing collection is replaced with this version.
1539
+ * @public
1540
+ * @requiredField collection
1541
+ * @requiredField collection._id
1542
+ * @requiredField collection.fields.key
1543
+ * @requiredField collection.fields.type
1544
+ * @requiredField collection.permissions.insert
1545
+ * @requiredField collection.permissions.read
1546
+ * @requiredField collection.permissions.remove
1547
+ * @requiredField collection.permissions.update
1548
+ * @requiredField collection.revision
1549
+ * @param options - Options for updating a data collection.
1550
+ * @permissionId WIX_DATA.UPDATE_COLLECTION
1551
+ * @applicableIdentity APP
1552
+ * @returns Updated collection details.
1553
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.UpdateDataCollection
1554
+ */
1555
+ declare function updateDataCollection(collection: NonNullablePaths<DataCollection, `_id` | `fields.${number}.key` | `fields.${number}.type` | `permissions.insert` | `permissions.read` | `permissions.remove` | `permissions.update` | `revision`>): Promise<NonNullablePaths<DataCollection, DataCollectionNonNullablePaths>>;
1556
+ /**
1557
+ * Deletes a data collection.
1558
+ *
1559
+ * > **Note:**
1560
+ * > Once a collection is deleted, it can only be restored for limited amount of time.
1561
+ * @param dataCollectionId - ID of the collection to delete.
1562
+ * @public
1563
+ * @requiredField dataCollectionId
1564
+ * @permissionId WIX_DATA.DELETE_COLLECTION
1565
+ * @applicableIdentity APP
1566
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.DeleteDataCollection
1567
+ */
1568
+ declare function deleteDataCollection(dataCollectionId: string): Promise<void>;
1569
+ /**
1570
+ * Restores recently deleted collection.
1571
+ *
1572
+ * Fails with `WDE0025` if collection was deleted too long ago or has never existed.
1573
+ * @param dataCollectionId - Data Collection ID to restore
1574
+ * @internal
1575
+ * @documentationMaturity preview
1576
+ * @requiredField dataCollectionId
1577
+ * @permissionId WIX_DATA.CREATE_COLLECTION
1578
+ * @applicableIdentity APP
1579
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.RestoreDataCollection
1580
+ */
1581
+ declare function restoreDataCollection(dataCollectionId: string): Promise<NonNullablePaths<RestoreDataCollectionResponse, {
1582
+ [P in DataCollectionNonNullablePaths]: `dataCollection.${P}`;
1583
+ }[DataCollectionNonNullablePaths]>>;
1584
+ /**
1585
+ * Adds new field to data collection schema
1586
+ * @param dataCollectionId - ID of data collection to update
1587
+ * @internal
1588
+ * @documentationMaturity preview
1589
+ * @requiredField dataCollectionId
1590
+ * @requiredField options
1591
+ * @requiredField options.field
1592
+ * @permissionId WIX_DATA.CREATE_COLLECTION_FIELD
1593
+ * @applicableIdentity APP
1594
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.CreateDataCollectionField
1595
+ */
1596
+ declare function createDataCollectionField(dataCollectionId: string, options: NonNullablePaths<CreateDataCollectionFieldOptions, `field`>): Promise<NonNullablePaths<CreateDataCollectionFieldResponse, {
1597
+ [P in DataCollectionNonNullablePaths]: `dataCollection.${P}`;
1598
+ }[DataCollectionNonNullablePaths]>>;
1474
1599
  interface CreateDataCollectionFieldOptions {
1475
1600
  /** field to create */
1476
1601
  field: Field;
1477
1602
  }
1603
+ /**
1604
+ * Updates data collection field
1605
+ * @param dataCollectionId - ID of data collection to update
1606
+ * @internal
1607
+ * @documentationMaturity preview
1608
+ * @requiredField dataCollectionId
1609
+ * @requiredField options
1610
+ * @requiredField options.field
1611
+ * @permissionId WIX_DATA.UPDATE_COLLECTION_FIELD
1612
+ * @applicableIdentity APP
1613
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.UpdateDataCollectionField
1614
+ */
1615
+ declare function updateDataCollectionField(dataCollectionId: string, options: NonNullablePaths<UpdateDataCollectionFieldOptions, `field`>): Promise<NonNullablePaths<UpdateDataCollectionFieldResponse, {
1616
+ [P in DataCollectionNonNullablePaths]: `dataCollection.${P}`;
1617
+ }[DataCollectionNonNullablePaths]>>;
1478
1618
  interface UpdateDataCollectionFieldOptions {
1479
1619
  /** Field to update */
1480
1620
  field: Field;
1481
1621
  }
1622
+ /**
1623
+ * Deletes data collection field
1624
+ * @param dataCollectionId - ID of data collection to update
1625
+ * @internal
1626
+ * @documentationMaturity preview
1627
+ * @requiredField dataCollectionId
1628
+ * @requiredField options
1629
+ * @requiredField options.fieldKey
1630
+ * @permissionId WIX_DATA.DELETE_COLLECTION_FIELD
1631
+ * @applicableIdentity APP
1632
+ * @fqn com.wixpress.cloud.data.api.collectionservice.DataCollectionService.DeleteDataCollectionField
1633
+ */
1634
+ declare function deleteDataCollectionField(dataCollectionId: string, options: NonNullablePaths<DeleteDataCollectionFieldOptions, `fieldKey`>): Promise<NonNullablePaths<DeleteDataCollectionFieldResponse, {
1635
+ [P in DataCollectionNonNullablePaths]: `dataCollection.${P}`;
1636
+ }[DataCollectionNonNullablePaths]>>;
1482
1637
  interface DeleteDataCollectionFieldOptions {
1483
1638
  /**
1484
1639
  * Field ID to delete
@@ -1487,4 +1642,4 @@ interface DeleteDataCollectionFieldOptions {
1487
1642
  fieldKey: string;
1488
1643
  }
1489
1644
 
1490
- export { type FieldPluginOptionsOneOf as $, AccessLevel as A, type UrlizedOnlyPattern as B, type CreateDataCollectionFieldOptions as C, type DataCollection as D, type Calculator as E, FieldPluginType as F, type GetDataCollectionOptions as G, type CalculatorPatternOneOf as H, IndexStatus as I, type Reference as J, type _Array as K, type ListDataCollectionsOptions as L, type MultiReference as M, type PageLink as N, Order as O, PluginType as P, QueryOperator as Q, type RestoreDataCollectionResponse as R, Status as S, Type as T, type UpdateDataCollectionFieldOptions as U, type NumberRange as V, WebhookIdentityType as W, type StringLengthRange as X, type ArraySizeRange as Y, type FieldPlugin as Z, type _Object as _, type ListDataCollectionsResponse as a, type IdentificationDataIdOneOf as a$, type CmsOptions as a0, type Permissions as a1, type Plugin as a2, type PluginOptionsOneOf as a3, type SiteSort as a4, type PublishPluginOptions as a5, type SingleItemPluginOptions as a6, type UrlizedPluginOptions as a7, type MultilingualOptions as a8, type PageLinkPluginOptions as a9, type UpdateDataPermissionsRequest as aA, type UpdateDataPermissionsResponse as aB, type BulkGetDataCollectionsPageBySnapshotsRequest as aC, type BulkGetDataCollectionsPageBySnapshotsResponse as aD, type SnapshotCollection as aE, type Index as aF, type IndexField as aG, type Failure as aH, type CreateDataCollectionsSnapshotRequest as aI, type CreateDataCollectionsSnapshotResponse as aJ, type RestoreDataCollectionsFromSnapshotRequest as aK, type Destination as aL, type RestorationCollection as aM, type RestoreDataCollectionsFromSnapshotResponse as aN, type DeleteDataCollectionsSnapshotRequest as aO, type DeleteDataCollectionsSnapshotResponse as aP, type CreateMigratedCollectionsSnapshotRequest as aQ, type CreateMigratedCollectionsSnapshotResponse as aR, type DomainEvent as aS, type DomainEventBodyOneOf as aT, type EntityCreatedEvent as aU, type RestoreInfo as aV, type EntityUpdatedEvent as aW, type EntityDeletedEvent as aX, type ActionEvent as aY, type MessageEnvelope as aZ, type IdentificationData as a_, type PluginCmsOptions as aa, type DataPermissions as ab, type AllowedDataPermissions as ac, type DataCollectionClonedEvent as ad, type DataCollectionChangedEvent as ae, type FieldUpdate as af, type PluginUpdate as ag, type DataCollectionEvictedEvent as ah, type CreateDataCollectionRequest as ai, type CreateDataCollectionResponse as aj, type GetDataCollectionRequest as ak, type GetDataCollectionResponse as al, type ListDataCollectionsRequest as am, type Sorting as an, type Paging as ao, type PagingMetadataV2 as ap, type BulkGetDataCollectionsRequest as aq, type BulkGetDataCollectionsResponse as ar, type UpdateDataCollectionRequest as as, type UpdateDataCollectionResponse as at, type DeleteDataCollectionRequest as au, type DeleteDataCollectionResponse as av, type RestoreDataCollectionRequest as aw, type CreateDataCollectionFieldRequest as ax, type UpdateDataCollectionFieldRequest as ay, type DeleteDataCollectionFieldRequest as az, type CreateDataCollectionFieldResponse as b, type UpdateDataCollectionFieldResponse as c, type DeleteDataCollectionFieldOptions as d, type DeleteDataCollectionFieldResponse as e, CollectionType as f, Direction as g, DataOperation as h, CollectionOperation as i, Role as j, Format as k, PagingMode as l, Segment as m, SortOrder as n, IndexSource as o, type Sort as p, type CollectionCapabilities as q, type IndexLimits as r, type IndexQuotaLimits as s, type Field as t, type FieldRangeValidationsOneOf as u, type TypeMetadata as v, type TypeMetadataMetadataOneOf as w, type FieldCapabilities as x, type ObjectField as y, type FieldsPattern as z };
1645
+ export { AccessLevel, type AccessLevelWithLiterals, type ActionEvent, type AllowedDataPermissions, type ArraySizeRange, type BulkGetDataCollectionsPageBySnapshotsRequest, type BulkGetDataCollectionsPageBySnapshotsResponse, type BulkGetDataCollectionsRequest, type BulkGetDataCollectionsResponse, type Calculator, type CalculatorPatternOneOf, type CmsOptions, type CollectionCapabilities, CollectionOperation, type CollectionOperationWithLiterals, CollectionType, type CollectionTypeWithLiterals, type CreateDataCollectionFieldOptions, type CreateDataCollectionFieldRequest, type CreateDataCollectionFieldResponse, type CreateDataCollectionRequest, type CreateDataCollectionResponse, type CreateDataCollectionsSnapshotRequest, type CreateDataCollectionsSnapshotResponse, type CreateMigratedCollectionsSnapshotRequest, type CreateMigratedCollectionsSnapshotResponse, type DataCollection, type DataCollectionChangedEvent, type DataCollectionClonedEvent, type DataCollectionEvictedEvent, DataOperation, type DataOperationWithLiterals, type DataPermissions, type DeleteDataCollectionFieldOptions, type DeleteDataCollectionFieldRequest, type DeleteDataCollectionFieldResponse, type DeleteDataCollectionRequest, type DeleteDataCollectionResponse, type DeleteDataCollectionsSnapshotRequest, type DeleteDataCollectionsSnapshotResponse, type Destination, Direction, type DirectionWithLiterals, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type Failure, type Field, type FieldCapabilities, type FieldPlugin, type FieldPluginOptionsOneOf, FieldPluginType, type FieldPluginTypeWithLiterals, type FieldRangeValidationsOneOf, type FieldUpdate, type FieldsPattern, Format, type FormatWithLiterals, type GetDataCollectionOptions, type GetDataCollectionRequest, type GetDataCollectionResponse, type IdentificationData, type IdentificationDataIdOneOf, type Index, type IndexField, type IndexLimits, type IndexQuotaLimits, IndexSource, type IndexSourceWithLiterals, IndexStatus, type IndexStatusWithLiterals, type ListDataCollectionsOptions, type ListDataCollectionsRequest, type ListDataCollectionsResponse, type MessageEnvelope, type MultiReference, type MultilingualOptions, type NumberRange, type ObjectField, Order, type OrderWithLiterals, type PageLink, type PageLinkPluginOptions, type Paging, type PagingMetadataV2, PagingMode, type PagingModeWithLiterals, type Permissions, type Plugin, type PluginCmsOptions, type PluginOptionsOneOf, PluginType, type PluginTypeWithLiterals, type PluginUpdate, type PublishPluginOptions, QueryOperator, type QueryOperatorWithLiterals, type Reference, type RestorationCollection, type RestoreDataCollectionRequest, type RestoreDataCollectionResponse, type RestoreDataCollectionsFromSnapshotRequest, type RestoreDataCollectionsFromSnapshotResponse, type RestoreInfo, Role, type RoleWithLiterals, Segment, type SegmentWithLiterals, type SingleItemPluginOptions, type SiteSort, type SnapshotCollection, type Sort, SortOrder, type SortOrderWithLiterals, type Sorting, Status, type StatusWithLiterals, type StringLengthRange, Type, type TypeMetadata, type TypeMetadataMetadataOneOf, type TypeWithLiterals, type UpdateDataCollectionFieldOptions, type UpdateDataCollectionFieldRequest, type UpdateDataCollectionFieldResponse, type UpdateDataCollectionRequest, type UpdateDataCollectionResponse, type UpdateDataPermissionsRequest, type UpdateDataPermissionsResponse, type UrlizedOnlyPattern, type UrlizedPluginOptions, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, type _Array, type _Object, createDataCollection, createDataCollectionField, deleteDataCollection, deleteDataCollectionField, getDataCollection, listDataCollections, restoreDataCollection, updateDataCollection, updateDataCollectionField };