@wix/ditto-codegen-public 1.0.210 → 1.0.212

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 (72) hide show
  1. package/dist/out.js +23714 -23776
  2. package/package.json +2 -2
  3. package/dist/docs-output/api-docs/bookings-bookings-onBookingCanceled-doc.txt +0 -169
  4. package/dist/docs-output/api-docs/bookings-bookings-onBookingCreated-doc.txt +0 -154
  5. package/dist/docs-output/api-docs/crm-contacts-onContactCreated-doc.txt +0 -99
  6. package/dist/docs-output/api-docs/crm-contacts-onContactDeleted-doc.txt +0 -58
  7. package/dist/docs-output/api-docs/crm-contacts-onContactUpdated-doc.txt +0 -99
  8. package/dist/docs-output/api-docs/data-items-get-doc.txt +0 -105
  9. package/dist/docs-output/api-docs/data-items-insert-doc.txt +0 -247
  10. package/dist/docs-output/api-docs/data-items-onDataItemCreated-doc.txt +0 -61
  11. package/dist/docs-output/api-docs/data-items-onDataItemDeleted-doc.txt +0 -58
  12. package/dist/docs-output/api-docs/data-items-onDataItemUpdated-doc.txt +0 -61
  13. package/dist/docs-output/api-docs/data-items-query-doc.txt +0 -514
  14. package/dist/docs-output/api-docs/data-items-remove-doc.txt +0 -130
  15. package/dist/docs-output/api-docs/data-items-update-doc.txt +0 -436
  16. package/dist/docs-output/api-docs/ecom-cart-addToCart-doc.txt +0 -398
  17. package/dist/docs-output/api-docs/ecom-cart-createCart-doc.txt +0 -429
  18. package/dist/docs-output/api-docs/ecom-cart-createCheckout-doc.txt +0 -149
  19. package/dist/docs-output/api-docs/ecom-cart-deleteCart-doc.txt +0 -92
  20. package/dist/docs-output/api-docs/ecom-cart-getCart-doc.txt +0 -284
  21. package/dist/docs-output/api-docs/ecom-cart-onCartCreated-doc.txt +0 -97
  22. package/dist/docs-output/api-docs/ecom-cart-onCartUpdated-doc.txt +0 -97
  23. package/dist/docs-output/api-docs/ecom-cart-removeLineItemsFromCart-doc.txt +0 -292
  24. package/dist/docs-output/api-docs/ecom-cart-updateCart-doc.txt +0 -442
  25. package/dist/docs-output/api-docs/ecom-checkout-addToCheckout-doc.txt +0 -622
  26. package/dist/docs-output/api-docs/ecom-checkout-createCheckout-doc.txt +0 -878
  27. package/dist/docs-output/api-docs/ecom-checkout-getCheckout-doc.txt +0 -494
  28. package/dist/docs-output/api-docs/ecom-checkout-onCheckoutCompleted-doc.txt +0 -151
  29. package/dist/docs-output/api-docs/ecom-checkout-onCheckoutCreated-doc.txt +0 -150
  30. package/dist/docs-output/api-docs/ecom-checkout-onCheckoutUpdated-doc.txt +0 -150
  31. package/dist/docs-output/api-docs/ecom-checkout-removeLineItemsFromCheckout-doc.txt +0 -499
  32. package/dist/docs-output/api-docs/ecom-checkout-updateCheckout-doc.txt +0 -730
  33. package/dist/docs-output/api-docs/ecom-currentCart-getCurrentCart-doc.txt +0 -249
  34. package/dist/docs-output/api-docs/ecom-currentCart-updateCurrentCart-doc.txt +0 -413
  35. package/dist/docs-output/api-docs/ecom-orders-bulkUpdateOrders-doc.txt +0 -988
  36. package/dist/docs-output/api-docs/ecom-orders-cancelOrder-doc.txt +0 -608
  37. package/dist/docs-output/api-docs/ecom-orders-getOrder-doc.txt +0 -625
  38. package/dist/docs-output/api-docs/ecom-orders-onOrderCreated-doc.txt +0 -245
  39. package/dist/docs-output/api-docs/ecom-orders-onOrderUpdated-doc.txt +0 -244
  40. package/dist/docs-output/api-docs/ecom-orders-searchOrders-doc.txt +0 -670
  41. package/dist/docs-output/api-docs/ecom-orders-updateOrder-doc.txt +0 -818
  42. package/dist/docs-output/api-docs/search-wixSiteSearch-search-doc.txt +0 -162
  43. package/dist/docs-output/api-docs/stores-collections-addProductsToCollection-doc.txt +0 -86
  44. package/dist/docs-output/api-docs/stores-collections-createCollection-doc.txt +0 -108
  45. package/dist/docs-output/api-docs/stores-collections-getCollection-doc.txt +0 -102
  46. package/dist/docs-output/api-docs/stores-collections-queryCollections-doc.txt +0 -209
  47. package/dist/docs-output/api-docs/stores-collections-removeProductsFromCollection-doc.txt +0 -86
  48. package/dist/docs-output/api-docs/stores-collections-updateCollection-doc.txt +0 -110
  49. package/dist/docs-output/api-docs/stores-inventory-queryInventory-doc.txt +0 -98
  50. package/dist/docs-output/api-docs/stores-inventory-updateInventoryVariants-doc.txt +0 -249
  51. package/dist/docs-output/api-docs/stores-inventoryItemsV3-queryInventoryItems-doc.txt +0 -236
  52. package/dist/docs-output/api-docs/stores-inventoryItemsV3-updateInventoryItem-doc.txt +0 -139
  53. package/dist/docs-output/api-docs/stores-productsV3-createProduct-doc.txt +0 -1697
  54. package/dist/docs-output/api-docs/stores-productsV3-deleteProduct-doc.txt +0 -73
  55. package/dist/docs-output/api-docs/stores-productsV3-getProduct-doc.txt +0 -933
  56. package/dist/docs-output/api-docs/stores-productsV3-onProductCreated-doc.txt +0 -794
  57. package/dist/docs-output/api-docs/stores-productsV3-onProductDeleted-doc.txt +0 -794
  58. package/dist/docs-output/api-docs/stores-productsV3-onProductUpdated-doc.txt +0 -794
  59. package/dist/docs-output/api-docs/stores-productsV3-queryProducts-doc.txt +0 -1051
  60. package/dist/docs-output/api-docs/stores-productsV3-searchProducts-doc.txt +0 -1144
  61. package/dist/docs-output/api-docs/stores-productsV3-updateProduct-doc.txt +0 -1737
  62. package/dist/docs-output/api-docs/stores-readOnlyVariantsV3-queryVariants-doc.txt +0 -290
  63. package/dist/docs-output/api-docs/stores-readOnlyVariantsV3-searchVariants-doc.txt +0 -353
  64. package/dist/docs-output/service-plugins/ecom-additional-fees-doc.txt +0 -411
  65. package/dist/docs-output/service-plugins/ecom-catalog-doc.txt +0 -460
  66. package/dist/docs-output/service-plugins/ecom-custom-triggers-doc.txt +0 -149
  67. package/dist/docs-output/service-plugins/ecom-gift-vouchers-provider-doc.txt +0 -169
  68. package/dist/docs-output/service-plugins/ecom-payment-settings-doc.txt +0 -2368
  69. package/dist/docs-output/service-plugins/ecom-recommendations-provider-doc.txt +0 -147
  70. package/dist/docs-output/service-plugins/ecom-shipping-rates-doc.txt +0 -352
  71. package/dist/docs-output/service-plugins/ecom-tax-calculation-provider-doc.txt +0 -244
  72. package/dist/docs-output/service-plugins/ecom-validations-doc.txt +0 -579
@@ -1,99 +0,0 @@
1
- <crm_contacts_onContactUpdated>
2
- <description>
3
- # This is a Webhook method
4
-
5
- # Method name:
6
-
7
- crm.contacts.onContactUpdated(handler: OnContactUpdatedHandler)
8
-
9
- # Method Link:
10
-
11
- https://dev.wix.com/docs/sdk/backend-modules/crm/contacts/on-contact-updated
12
-
13
- # Method Description:
14
-
15
- Triggered when a contact is updated.
16
-
17
-
18
- </description>
19
- <usage>
20
- import { contacts } from "@wix/crm";
21
-
22
- contacts.onContactUpdated((event) => {
23
- // handle your event here
24
- });
25
-
26
- </usage>
27
- <type_definition>
28
- ```
29
- Method: crm.contacts.onContactUpdated(handler)
30
- Description: Triggered when a contact is updated.
31
- Method parameters:
32
- param name: handler | type: OnContactUpdatedHandler | description: none
33
- - name: event | type: ContactUpdatedEnvelope | description: none
34
- - name: entity | type: Contact | description: none
35
- - name: info | type: ContactInfo | description: Contact's details.
36
- - name: addresses | type: ContactAddressesWrapper | description: Contact's street addresses.
37
- - name: items | type: Array<ContactAddress> | description: List of up to 50 addresses.
38
- - name: address | type: Address | description: Street address.
39
- - name: addressLine1 | type: string | description: Main address line, usually street and number, as free text.
40
- - name: addressLine2 | type: string | description: Free text providing more detailed address information, such as apartment, suite, or floor.
41
- - name: city | type: string | description: City name.
42
- - name: country | type: string | description: 2-letter country code in an [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
43
- - name: postalCode | type: string | description: Postal or zip code.
44
- - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.
45
- - ONE-OF:
46
- - name: addressLine | type: string | description: Main address line, usually street and number, as free text.
47
- - name: streetAddress | type: StreetAddress | description: Street address object, with number and name in separate fields.
48
- - name: name | type: string | description: Street name.
49
- - name: number | type: string | description: Street number.
50
- - name: tag | type: AddressTag | description: Address type. `UNTAGGED` is shown as "Other" in the Contact List.
51
- enum: BILLING, HOME, SHIPPING, UNTAGGED, WORK
52
- - name: birthdate | type: string | description: Birth date in `YYYY-MM-DD` format. For example, `2020-03-15`.
53
- - name: company | type: string | description: Contact's company name.
54
- - name: emails | type: ContactEmailsWrapper | description: Contact's email addresses.
55
- - name: items | type: Array<ContactEmail> | description: List of up to 50 email addresses.
56
- - name: email | type: string | description: Email address.
57
- - name: primary | type: boolean | description: Indicates whether this is the contact's primary email address. When changing `primary` to `true` for an email, the contact's other emails become `false`. Changing the primary email of a contact also affects the subscription status to marketing emails that are decided based on the primary email.
58
- - name: tag | type: EmailTag | description: Email type. `UNTAGGED` is shown as "Other" in the Contact List.
59
- enum: HOME, MAIN, UNTAGGED, WORK
60
- - name: extendedFields | type: ExtendedFieldsWrapper | description: Additional custom fields. Empty fields are not returned.
61
- - name: items | type: Record<string, any> | description: Contact's extended fields, where each key is the field key, and each value is the field's value for the contact. To view and manage extended fields, use the Extended Fields API.
62
- - name: jobTitle | type: string | description: Contact's job title.
63
- - name: labelKeys | type: LabelsWrapper | description: List of contact's labels. Labels are used to organize contacts. Labels can be added and removed using Label Contact and Unlabel Contact, respectively. To view or manage contact labels, use the Labels API.
64
- - name: items | type: Array<string> | description: List of contact label keys. Contact labels help categorize contacts. Label keys must exist to be added to the contact. Contact labels can be created or retrieved with Find or Create Label or List Labels.
65
- - name: locale | type: string | description: Locale in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. Typically, this is a lowercase 2-letter language code, followed by a hyphen, followed by an uppercase 2-letter country code. For example, `en-US` for U.S. English, and `de-DE` for Germany German.
66
- - name: name | type: ContactName | description: Contact's first and last name.
67
- - name: first | type: string | description: Contact's first name.
68
- - name: last | type: string | description: Contact's last name.
69
- - name: phones | type: ContactPhonesWrapper | description: Contact's phone numbers.
70
- - name: items | type: Array<ContactPhone> | description: List of up to 50 phone numbers.
71
- - name: countryCode | type: string | description: [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code.
72
- - name: phone | type: string | description: Phone number.
73
- - name: primary | type: boolean | description: Indicates whether this is the contact's primary phone number. When changing `primary` to `true` for a phone, the contact's `primary` field for other phones becomes `false`. Changing the primary phone number also affects the subscription status to SMS messages that are decided based on the primary phone.
74
- - name: tag | type: PhoneTag | description: Phone type. `UNTAGGED` is shown as "Other" in the Contact List.
75
- enum: FAX, HOME, MAIN, MOBILE, UNTAGGED, WORK
76
- - name: picture | type: ContactPicture | description: Contact's profile picture.
77
- - name: image | type: string | description: Image. This can contain an image URL or a Wix Media image GUID.
78
- - name: metadata | type: EventMetadata | description: none
79
- - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them.
80
- - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.
81
- - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
82
- - name: entityId | type: string | description: GUID of the entity associated with the event.
83
- - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`.
84
- - name: eventType | type: string | description: Event type.
85
- - name: identity | type: IdentificationData | description: The identification type and identity data.
86
- - ONE-OF:
87
- - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
88
- - name: appId | type: string | description: GUID of an app.
89
- - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
90
- - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
91
- - name: instanceId | type: string | description: App instance GUID.
92
- - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
93
- - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
94
- - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
95
- Return type: PRIMITIVE<void>
96
-
97
- ```
98
- </type_definition>
99
- </crm_contacts_onContactUpdated>
@@ -1,105 +0,0 @@
1
- <data_items_get>
2
- <description>
3
- # Method name:
4
-
5
- data.items.get(dataCollectionId: string, itemId: string, options: WixDataReadWithProjectionOptions)
6
-
7
- # Method Link:
8
-
9
- https://dev.wix.com/docs/sdk/backend-modules/data/items/get
10
-
11
- # Method Description:
12
-
13
- Retrieves an item from a collection.
14
-
15
- The `get()` method returns a Promise that resolves to the item with ID
16
- `itemId` from the specified collection, or `null` if the `itemId` is not
17
- found. The Promise is rejected if the current user does not have read
18
- permissions for the collection.
19
-
20
- If the specified collection contains reference fields, the ID of the
21
- referenced item is returned. To return the values of the referenced items
22
- use `query()` and `include()`.
23
-
24
- If the `get()` method is passed the ID of [a hidden item](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection), it returns null.
25
-
26
- Calling the `get()` method triggers the [`beforeGet()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-get) and [`afterGet()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-get) hooks if they have been defined.
27
-
28
- > **Notes:**
29
- > - When using the `query()` or `get()` methods or another data retrieval method immediately following a change to your database collection, the data retrieved may not contain your most recent changes. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency). To solve this, you can use the `setTimeout()` method to delay retrieving data following any changes to your database collection.
30
- > - To speed up data retrieval, the results of certain data queries are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results).
31
- > - An `itemId` is required to retrieve an item even from a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
32
-
33
- # Method Permissions:
34
-
35
- - Read Data Items
36
-
37
- # Method Permissions Scopes IDs:
38
-
39
- - SCOPE.DC-DATA.READ
40
-
41
-
42
-
43
- # Method Code Examples:
44
-
45
- ## Get an item from a collection
46
-
47
- ```javascript
48
- import { items } from "@wix/data";
49
-
50
- async function getItem() {
51
- const item = await items.get("myCollection", "00001");
52
- console.log(item);
53
- }
54
-
55
- /* item is:
56
- *
57
- * {
58
- * "_id": "00001",
59
- * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
60
- * "_createdDate": "2017-05-24T12:33:18.938Z",
61
- * "_updatedDate": "2017-05-24T12:33:18.938Z",
62
- * "title": "Mr.",
63
- * "first_name": "John",
64
- * "last_name": "Doe"
65
- * }
66
- */
67
- ```
68
-
69
-
70
-
71
- ## default
72
-
73
- ```javascript
74
- try {
75
- const result = await items.get("collection-0.6451284333427125", "6892593d-d57f-428d-bc53-3f0870a1beef", {});
76
- return result;
77
- } catch (error) {
78
- console.error(error);
79
- throw error;
80
- }
81
- ```
82
- </description>
83
- <type_definition>
84
- ```
85
- Method: data.items.get(dataCollectionId, itemId, options)
86
- Description: Retrieves an item from a collection. The `get()` method returns a Promise that resolves to the item with GUID `itemId` from the specified collection, or `null` if the `itemId` is not found. The Promise is rejected if the current user does not have read permissions for the collection. If the specified collection contains reference fields, the GUID of the referenced item is returned. To return the values of the referenced items use `query()` and `include()`. If the `get()` method is passed the GUID of [a hidden item](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection), it returns null. Calling the `get()` method triggers the [`beforeGet()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-get) and [`afterGet()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-get) hooks if they have been defined. > **Notes:** > - When using the `query()` or `get()` methods or another data retrieval method immediately following a change to your database collection, the data retrieved may not contain your most recent changes. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency). To solve this, you can use the `setTimeout()` method to delay retrieving data following any changes to your database collection. > - To speed up data retrieval, the results of certain data queries are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results). > - An `itemId` is required to retrieve an item even from a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
87
- Method parameters:
88
- param name: dataCollectionId | type: string | description: GUID of the collection item belongs to.
89
- param name: itemId | type: string | description: GUID of the data item to retrieve. | required: true
90
- param name: options | type: WixDataReadWithProjectionOptions | description: Options to use when processing this operation.
91
- - name: appOptions | type: Record<string, any> | description: Options for [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections).
92
- - name: consistentRead | type: boolean | description: When `true`, reads data from the primary database instance. This decreases performance but ensures data retrieved is up-to-date even immediately after an update. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency).
93
- - name: fields | type: Array<string> | description: Lists of fields to return in a result.
94
- - name: language | type: string | description: Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. If provided, the result text is returned in the specified language. If not provided, the result text is not translated. > **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
95
- - name: showDrafts | type: boolean | description: When `true`, operations include draft items. Read operations include draft items in their response, and write operations modify draft items. Default: `false`.
96
- - name: suppressHooks | type: boolean | description: Prevents hooks from running for the operation. Can only be used in the [backend code of a Wix site](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/backend-code/about-the-site-backend). Default: `false`.
97
- Return type: PROMISE<WixDataItem>
98
- - name: _createdDate | type: Date | description: Date and time the item was added to the collection.
99
- - name: _id | type: string | description: Data item GUID.
100
- - name: _owner | type: string | description: GUID of the user who created the item. Can be modified with site owner permissions.
101
- - name: _updatedDate | type: Date | description: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
102
-
103
- ```
104
- </type_definition>
105
- </data_items_get>
@@ -1,247 +0,0 @@
1
- <data_items_insert>
2
- <description>
3
- # Method name:
4
-
5
- data.items.insert(dataCollectionId: string, item: Partial, options: WixDataInsertOptions)
6
-
7
- # Method Link:
8
-
9
- https://dev.wix.com/docs/sdk/backend-modules/data/items/insert
10
-
11
- # Method Description:
12
-
13
- Adds an item to a collection.
14
-
15
- An item can only be inserted into an existing collection. You can create a new collection using the
16
- Data Collections API.
17
-
18
- The `insert()` method returns a Promise that resolves to the inserted item
19
- after it has been added to the specified collection. The Promise is rejected
20
- if the current user does not have "create" permissions for the collection or
21
- the specified item includes an `_id` property whose value matches an
22
- existing ID in the collection. Meaning, `insert()` cannot overwrite an
23
- existing item in the collection.
24
-
25
- Calling the `insert()` method triggers the [`beforeInsert()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-insert) and [`afterInsert()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-insert) hooks if they have been defined.
26
-
27
- When inserting an item into a collection that has a reference field, set the
28
- value of the reference field to the referenced item's `_id` value or the entire referenced item object.
29
-
30
- The `insert()` method adds the following properties and values to the item
31
- when it adds it to the collection:
32
- - `_id`: A unique identifier for an item in a collection, if the item
33
- doesn't have one or has one that is `undefined`. You can optionally provide
34
- your own ID. Once an ID is assigned to an item it cannot be changed.
35
- - `_createdDate`: The date the item was added to the collection.
36
- - `_updatedDate`: The date the item was modified. When the item is first
37
- added, the `_createdDate` and `_updatedDate` are the same.
38
-
39
- Any valid JavaScript object can be added as a property value. The `insert()`
40
- method maintains the structure of the specified object. For example, objects that contain nested objects, arrays, or arrays with nested objects are all added to the collection as defined.
41
-
42
-
43
- > **Notes:**
44
- > - The maximum size of an item that you can add to a collection is 500kb.
45
- > - If an item's `_id` property value is set to `null` or an empty string, an error is thrown.
46
- > - When creating a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), an item with the system field `_id` is pre-inserted into the collection. [Single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection) may contain only one item.
47
- > - If there is a pre-existing item in a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), the `insert()` method will not run. To update or change an item in a single-item collection see the `update()` and `save()` methods.
48
- > - The `insert()` method does not support multi-reference fields. For multi-reference fields, use `insertReference()`.
49
- > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `insert()` fails and issues an error.
50
-
51
- # Method Permissions:
52
-
53
- - Write Data Items
54
-
55
- # Method Permissions Scopes IDs:
56
-
57
- - SCOPE.DC-DATA.WRITE
58
-
59
-
60
-
61
- # Method Code Examples:
62
-
63
- ## Insert an item into a collection
64
-
65
- ```javascript
66
- import { items } from "@wix/data";
67
-
68
- async function insertItem() {
69
- const toInsert = {
70
- "title": "Mr.",
71
- "first_name": "John",
72
- "last_name": "Doe"
73
- };
74
- const inserted = await items.insert("myCollection", toInsert);
75
- console.log(inserted); // See below
76
- }
77
-
78
- /* item is:
79
- *
80
- * {
81
- * "_id": "rifk4nrk-dj4o-djhe-oidk-fnoqw4oiglk4i",
82
- * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
83
- * "_createdDate": "2017-05-24T12:33:18.938Z",
84
- * "_updatedDate": "2017-05-24T12:33:18.938Z",
85
- * "title": "Mr.",
86
- * "first_name": "John",
87
- * "last_name": "Doe"
88
- * }
89
- */
90
- ```
91
-
92
-
93
-
94
- ## Insert an item with a specified ID into a collection
95
-
96
- ```javascript
97
- import { items } from "@wix/data";
98
-
99
- async function insertItem() {
100
- const toInsert = {
101
- "_id": "00001",
102
- "title": "Mr.",
103
- "first_name": "John",
104
- "last_name": "Doe"
105
- };
106
-
107
- const inserted = await items.insert("myCollection", toInsert);
108
- console.log(inserted);
109
- }
110
- /* item is:
111
- *
112
- * {
113
- * "_id": "00001",
114
- * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
115
- * "_createdDate": "2017-05-24T12:33:18.938Z",
116
- * "_updatedDate": "2017-05-24T12:33:18.938Z",
117
- * "title": "Mr.",
118
- * "first_name": "John",
119
- * "last_name": "Doe"
120
- * }
121
- */
122
- ```
123
-
124
- ## Insert an item including a reference to another item using the referenced item's ID
125
-
126
- ```javascript
127
- import { items } from "@wix/data";
128
-
129
- async function insertItem() {
130
- const countryId = "id-of-usa-item";
131
-
132
- const toInsert = {
133
- "title": "Mr.",
134
- "first_name": "John",
135
- "last_name": "Doe",
136
- "country": countryId
137
- };
138
-
139
- const inserted = await items.insert("myCollection", toInsert);
140
- console.log(inserted); // See below
141
- }
142
-
143
- /* item is:
144
- *
145
- * {
146
- * "_id": "rifk4nrk-dj4o-djhe-oidk-fnoqw4oiglk4i",
147
- * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
148
- * "_createdDate": "2017-05-24T12:33:18.938Z",
149
- * "_updatedDate": "2017-05-24T12:33:18.938Z",
150
- * "title": "Mr.",
151
- * "first_name": "John",
152
- * "last_name": "Doe",
153
- * "country": "id-of-usa-item"
154
- * }
155
- */
156
- ```
157
-
158
- ## Insert an item including a reference to another item using the reference item
159
-
160
- ```javascript
161
- import { items } from "@wix/data";
162
-
163
- async function insertItem() {
164
- const countryItem = // Get country item
165
-
166
- const toInsert = {
167
- "title": "Mr.",
168
- "first_name": "John",
169
- "last_name": "Doe",
170
- "country": countryItem
171
- };
172
-
173
- const inserted = await items.insert("myCollection", toInsert);
174
- console.log(inserted); // See below
175
- }
176
-
177
- /* item is:
178
- *
179
- * {
180
- * "_id": "rifk4nrk-dj4o-djhe-oidk-fnoqw4oiglk4i",
181
- * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
182
- * "_createdDate": "2017-05-24T12:33:18.938Z",
183
- * "_updatedDate": "2017-05-24T12:33:18.938Z",
184
- * "title": "Mr.",
185
- * "first_name": "John",
186
- * "last_name": "Doe",
187
- * "country": "id-of-usa-item"
188
- * }
189
- */
190
- ```
191
-
192
- ## Insert an item into a collection using a custom function
193
-
194
- ```javascript
195
- import { items } from "@wix/data";
196
-
197
- // Create an operation using insert() //
198
-
199
- function createGreeting(language, greeting) {
200
- const toInsert = {
201
- language,
202
- greeting
203
- };
204
-
205
- return items.insert('Greetings', toInsert);
206
- }
207
-
208
- ```
209
-
210
- ## default
211
-
212
- ```javascript
213
- try {
214
- const result = await items.insert("collection-0.28758841360566656", {
215
- _id: "1ad20d72-f217-4663-b1c1-47fe7b9fcde5",
216
- name: "Sample Item",
217
- phone: "+972501234567",
218
- image: "https://static.wixstatic.com/media/503ea4_ed9a38760ae04aab86b47e82525fdcac~mv2.jpg",
219
- createdDate: Date.now(),
220
- updatedDate: Date.now()
221
- }, {
222
- suppressHooks: false
223
- });
224
- return result;
225
- } catch (error) {
226
- console.error(error);
227
- throw error;
228
- }
229
- ```
230
- </description>
231
- <type_definition>
232
- ```
233
- Method: data.items.insert(dataCollectionId, item, options)
234
- Description: Adds an item to a collection. An item can only be inserted into an existing collection. You can create a new collection using the Data Collections API. The `insert()` method returns a Promise that resolves to the inserted item after it has been added to the specified collection. The Promise is rejected if the current user does not have "create" permissions for the collection or the specified item includes an `_id` property whose value matches an existing GUID in the collection. Meaning, `insert()` cannot overwrite an existing item in the collection. Calling the `insert()` method triggers the [`beforeInsert()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-insert) and [`afterInsert()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-insert) hooks if they have been defined. When inserting an item into a collection that has a reference field, set the value of the reference field to the referenced item's `_id` value or the entire referenced item object. The `insert()` method adds the following properties and values to the item when it adds it to the collection: - `_id`: A unique identifier for an item in a collection, if the item doesn't have one or has one that is `undefined`. You can optionally provide your own GUID. Once an GUID is assigned to an item it cannot be changed. - `_createdDate`: The date the item was added to the collection. - `_updatedDate`: The date the item was modified. When the item is first added, the `_createdDate` and `_updatedDate` are the same. Any valid JavaScript object can be added as a property value. The `insert()` method maintains the structure of the specified object. For example, objects that contain nested objects, arrays, or arrays with nested objects are all added to the collection as defined. > **Notes:** > - The maximum size of an item that you can add to a collection is 500kb. > - If an item's `_id` property value is set to `null` or an empty string, an error is thrown. > - When creating a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), an item with the system field `_id` is pre-inserted into the collection. [Single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection) may contain only one item. > - If there is a pre-existing item in a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), the `insert()` method will not run. To update or change an item in a single-item collection see the `update()` and `save()` methods. > - The `insert()` method does not support multi-reference fields. For multi-reference fields, use `insertReference()`. > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `insert()` fails and issues an error.
235
- Method parameters:
236
- param name: dataCollectionId | type: string | description: GUID of the collection item belongs to. | required: true
237
- param name: item | type: Partial | description: Data item to insert. | required: true
238
- param name: options | type: WixDataInsertOptions | description: Options to use when processing this operation.
239
- Return type: PROMISE<WixDataItem>
240
- - name: _createdDate | type: Date | description: Date and time the item was added to the collection.
241
- - name: _id | type: string | description: Data item GUID.
242
- - name: _owner | type: string | description: GUID of the user who created the item. Can be modified with site owner permissions.
243
- - name: _updatedDate | type: Date | description: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
244
-
245
- ```
246
- </type_definition>
247
- </data_items_insert>
@@ -1,61 +0,0 @@
1
- <data_items_onDataItemCreated>
2
- <description>
3
- # This is a Webhook method
4
-
5
- # Method name:
6
-
7
- data.items.onDataItemCreated(handler: OnDataItemCreatedHandler)
8
-
9
- # Method Link:
10
-
11
- https://dev.wix.com/docs/sdk/backend-modules/data/items/on-data-item-created
12
-
13
- # Method Description:
14
-
15
- Triggered when a data item is inserted.
16
-
17
-
18
- </description>
19
- <usage>
20
- import { items } from "@wix/data";
21
-
22
- items.onDataItemCreated((event) => {
23
- // handle your event here
24
- });
25
-
26
- </usage>
27
- <type_definition>
28
- ```
29
- Method: data.items.onDataItemCreated(handler)
30
- Description: Triggered when a data item is inserted.
31
- Method parameters:
32
- param name: handler | type: OnDataItemCreatedHandler | description: none
33
- - name: event | type: DataItemCreatedEnvelope | description: none
34
- - name: entity | type: DataItemEntity | description: none
35
- - name: _id | type: string | description: Data item GUID.
36
- - name: data | type: WixDataItem | description: Data item contents.
37
- - name: _id | type: string | description: Data item GUID.
38
- - name: _owner | type: string | description: GUID of the user who created the item. Can be modified with site owner permissions.
39
- - name: dataCollectionId | type: string | description: GUID of the collection to which this item belongs.
40
- - name: metadata | type: EventMetadata | description: none
41
- - name: _id | type: string | description: Unique event GUID. Allows clients to ignore duplicate webhooks.
42
- - name: entityEventSequence | type: string | description: A sequence number defining the order of updates to the underlying entity. For example, given that some entity was updated at 16:00 and than again at 16:01, it is guaranteed that the sequence number of the second update is strictly higher than the first. As the consumer, you can use this value to ensure that you handle messages in the correct order. To do so, you will need to persist this number on your end, and compare the sequence number from the message against the one you have stored. Given that the stored number is higher, you should ignore the message.
43
- - name: entityFqdn | type: string | description: Assumes actions are also always typed to an entity_type Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
44
- - name: entityId | type: string | description: GUID of the entity associated with the event.
45
- - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z
46
- - name: eventType | type: string | description: Event type.
47
- - name: identity | type: IdentificationData | description: The identification type and identity data.
48
- - ONE-OF:
49
- - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
50
- - name: appId | type: string | description: GUID of an app.
51
- - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
52
- - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
53
- - name: instanceId | type: string | description: App instance GUID.
54
- - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
55
- - name: slug | type: string | description: This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) This is although the created/updated/deleted notion is duplication of the oneof types Example: created/updated/deleted/started/completed/email_opened
56
- - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
57
- Return type: PRIMITIVE<void>
58
-
59
- ```
60
- </type_definition>
61
- </data_items_onDataItemCreated>
@@ -1,58 +0,0 @@
1
- <data_items_onDataItemDeleted>
2
- <description>
3
- # This is a Webhook method
4
-
5
- # Method name:
6
-
7
- data.items.onDataItemDeleted(handler: OnDataItemDeletedHandler)
8
-
9
- # Method Link:
10
-
11
- https://dev.wix.com/docs/sdk/backend-modules/data/items/on-data-item-deleted
12
-
13
- # Method Description:
14
-
15
- Triggered when a data item is deleted or truncated.
16
-
17
-
18
- </description>
19
- <usage>
20
- import { items } from "@wix/data";
21
-
22
- items.onDataItemDeleted((event) => {
23
- // handle your event here
24
- });
25
-
26
- </usage>
27
- <type_definition>
28
- ```
29
- Method: data.items.onDataItemDeleted(handler)
30
- Description: Triggered when a data item is deleted or truncated.
31
- Method parameters:
32
- param name: handler | type: OnDataItemDeletedHandler | description: none
33
- - name: event | type: DataItemDeletedEnvelope | description: none
34
- - name: entity | type: DataItemDeletedEntity | description: none
35
- - name: _id | type: string | description: Data item GUID.
36
- - name: dataCollectionId | type: string | description: GUID of the collection to which this item belongs.
37
- - name: metadata | type: EventMetadata | description: none
38
- - name: _id | type: string | description: Unique event GUID. Allows clients to ignore duplicate webhooks.
39
- - name: entityEventSequence | type: string | description: A sequence number defining the order of updates to the underlying entity. For example, given that some entity was updated at 16:00 and than again at 16:01, it is guaranteed that the sequence number of the second update is strictly higher than the first. As the consumer, you can use this value to ensure that you handle messages in the correct order. To do so, you will need to persist this number on your end, and compare the sequence number from the message against the one you have stored. Given that the stored number is higher, you should ignore the message.
40
- - name: entityFqdn | type: string | description: Assumes actions are also always typed to an entity_type Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
41
- - name: entityId | type: string | description: GUID of the entity associated with the event.
42
- - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z
43
- - name: eventType | type: string | description: Event type.
44
- - name: identity | type: IdentificationData | description: The identification type and identity data.
45
- - ONE-OF:
46
- - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
47
- - name: appId | type: string | description: GUID of an app.
48
- - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
49
- - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
50
- - name: instanceId | type: string | description: App instance GUID.
51
- - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
52
- - name: slug | type: string | description: This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) This is although the created/updated/deleted notion is duplication of the oneof types Example: created/updated/deleted/started/completed/email_opened
53
- - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
54
- Return type: PRIMITIVE<void>
55
-
56
- ```
57
- </type_definition>
58
- </data_items_onDataItemDeleted>
@@ -1,61 +0,0 @@
1
- <data_items_onDataItemUpdated>
2
- <description>
3
- # This is a Webhook method
4
-
5
- # Method name:
6
-
7
- data.items.onDataItemUpdated(handler: OnDataItemUpdatedHandler)
8
-
9
- # Method Link:
10
-
11
- https://dev.wix.com/docs/sdk/backend-modules/data/items/on-data-item-updated
12
-
13
- # Method Description:
14
-
15
- Triggered when a data item is updated or patched.
16
-
17
-
18
- </description>
19
- <usage>
20
- import { items } from "@wix/data";
21
-
22
- items.onDataItemUpdated((event) => {
23
- // handle your event here
24
- });
25
-
26
- </usage>
27
- <type_definition>
28
- ```
29
- Method: data.items.onDataItemUpdated(handler)
30
- Description: Triggered when a data item is updated or patched.
31
- Method parameters:
32
- param name: handler | type: OnDataItemUpdatedHandler | description: none
33
- - name: event | type: DataItemUpdatedEnvelope | description: none
34
- - name: entity | type: DataItemEntity | description: none
35
- - name: _id | type: string | description: Data item GUID.
36
- - name: data | type: WixDataItem | description: Data item contents.
37
- - name: _id | type: string | description: Data item GUID.
38
- - name: _owner | type: string | description: GUID of the user who created the item. Can be modified with site owner permissions.
39
- - name: dataCollectionId | type: string | description: GUID of the collection to which this item belongs.
40
- - name: metadata | type: EventMetadata | description: none
41
- - name: _id | type: string | description: Unique event GUID. Allows clients to ignore duplicate webhooks.
42
- - name: entityEventSequence | type: string | description: A sequence number defining the order of updates to the underlying entity. For example, given that some entity was updated at 16:00 and than again at 16:01, it is guaranteed that the sequence number of the second update is strictly higher than the first. As the consumer, you can use this value to ensure that you handle messages in the correct order. To do so, you will need to persist this number on your end, and compare the sequence number from the message against the one you have stored. Given that the stored number is higher, you should ignore the message.
43
- - name: entityFqdn | type: string | description: Assumes actions are also always typed to an entity_type Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
44
- - name: entityId | type: string | description: GUID of the entity associated with the event.
45
- - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z
46
- - name: eventType | type: string | description: Event type.
47
- - name: identity | type: IdentificationData | description: The identification type and identity data.
48
- - ONE-OF:
49
- - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
50
- - name: appId | type: string | description: GUID of an app.
51
- - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
52
- - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
53
- - name: instanceId | type: string | description: App instance GUID.
54
- - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
55
- - name: slug | type: string | description: This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) This is although the created/updated/deleted notion is duplication of the oneof types Example: created/updated/deleted/started/completed/email_opened
56
- - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
57
- Return type: PRIMITIVE<void>
58
-
59
- ```
60
- </type_definition>
61
- </data_items_onDataItemUpdated>