@wix/auto_sdk_crm_notes 1.0.7 → 1.0.8

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 +1 @@
1
- {"version":3,"sources":["../../../index.typings.ts","../../../src/crm-notes-v2-note-notes.universal.ts","../../../src/crm-notes-v2-note-notes.http.ts"],"sourcesContent":["export * from './src/crm-notes-v2-note-notes.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { queryBuilder } from '@wix/sdk-runtime/query-builder';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, HttpResponse, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixCrmNotesV2Note from './crm-notes-v2-note-notes.http.js';\n// @ts-ignore\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\n/** A note contains textual information associated with a contact. */\nexport interface Note {\n /**\n * Note ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Revision number, which increments by 1 each time the note is updated.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the note was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the note was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Contact ID associated with the note.\n * @format GUID\n * @immutable\n */\n contactId?: string | null;\n /**\n * Note text.\n * @maxLength 2048\n */\n text?: string | null;\n /**\n * Note type for organizing notes by their purpose.\n *\n * Default: `NOT_SET`\n */\n type?: NoteTypeWithLiterals;\n /**\n * Information about who created the note.\n * @readonly\n */\n source?: NoteSource;\n}\n\nexport enum NoteType {\n /** Unknown note type. */\n UNKNOWN_TYPE = 'UNKNOWN_TYPE',\n /** Note doesn't have a specific classification. */\n NOT_SET = 'NOT_SET',\n /** Note is a summary of a meeting related to the contact. */\n MEETING_SUMMARY = 'MEETING_SUMMARY',\n /** Note is a summary of a call related to the contact. */\n CALL_SUMMARY = 'CALL_SUMMARY',\n}\n\n/** @enumType */\nexport type NoteTypeWithLiterals =\n | NoteType\n | 'UNKNOWN_TYPE'\n | 'NOT_SET'\n | 'MEETING_SUMMARY'\n | 'CALL_SUMMARY';\n\nexport interface NoteSource {\n /**\n * Note creator.\n * @readonly\n */\n sourceType?: SourceTypeWithLiterals;\n /**\n * App ID, if the note was created by an app.\n * @format GUID\n * @readonly\n */\n appId?: string | null;\n /**\n * User ID, if the note was created by a Wix user.\n * @format GUID\n * @readonly\n */\n userId?: string | null;\n}\n\n/** Note creator. */\nexport enum SourceType {\n UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE',\n APP = 'APP',\n USER = 'USER',\n}\n\n/** @enumType */\nexport type SourceTypeWithLiterals =\n | SourceType\n | 'UNKNOWN_SOURCE_TYPE'\n | 'APP'\n | 'USER';\n\nexport interface CreateNoteRequest {\n /** Note to create. */\n note: Note;\n}\n\nexport interface CreateNoteResponse {\n /** Created note. */\n note?: Note;\n}\n\nexport interface GetNoteRequest {\n /**\n * Note ID.\n * @format GUID\n */\n noteId: string;\n}\n\nexport interface GetNoteResponse {\n /** Retrieved note. */\n note?: Note;\n}\n\nexport interface UpdateNoteRequest {\n /** Note to update. */\n note: Note;\n}\n\nexport interface UpdateNoteResponse {\n /** Updated note. */\n note?: Note;\n}\n\nexport interface DeleteNoteRequest {\n /**\n * Note ID.\n * @format GUID\n */\n noteId: string;\n}\n\nexport interface DeleteNoteResponse {}\n\nexport interface QueryNotesRequest {\n /**\n * WQL query object.\n *\n * For more information, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language).\n */\n query?: CursorQuery;\n /**\n * Contact ID to retrieve notes for. Required when not using cursor pagination.\n * @format GUID\n */\n contactId?: string | null;\n}\n\nexport interface CursorQuery extends CursorQueryPagingMethodOneOf {\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging;\n /**\n * Filter object in the following format:\n * `\"filter\" : {\n * \"fieldName1\": \"value1\",\n * \"fieldName2\":{\"$operator\":\"value2\"}\n * }`\n * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`\n */\n filter?: Record<string, any> | null;\n /**\n * Sort object in the following format:\n * `[{\"fieldName\":\"sortField1\",\"order\":\"ASC\"},{\"fieldName\":\"sortField2\",\"order\":\"DESC\"}]`\n */\n sort?: Sorting[];\n}\n\n/** @oneof */\nexport interface CursorQueryPagingMethodOneOf {\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface Sorting {\n /** Name of the field to sort by. */\n fieldName?: string;\n /** Sort order. */\n order?: SortOrderWithLiterals;\n}\n\nexport enum SortOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/** @enumType */\nexport type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';\n\nexport interface CursorPaging {\n /**\n * Number of items to load.\n * @max 1000\n */\n limit?: number | null;\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * You can get the relevant cursor token\n * from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n */\n cursor?: string | null;\n}\n\nexport interface QueryNotesResponse {\n /** Retrieved notes. */\n notes?: Note[];\n /** Paging information. */\n pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n /** Number of items returned in the response. */\n count?: number | null;\n /** Offset that was requested. */\n cursors?: Cursors;\n /**\n * Indicates if there are more results after the current page.\n * If `true`, another page of results can be retrieved.\n * If `false`, this is the last page.\n */\n hasNext?: boolean | null;\n}\n\nexport interface Cursors {\n /** Cursor pointing to next page in the list of results. */\n next?: string | null;\n /** Cursor pointing to previous page in the list of results. */\n prev?: string | null;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * 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.\n * 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.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n/** @docsIgnore */\nexport type QueryNotesApplicationErrors = {\n code?: 'MISSING_CONTACT_ID';\n description?: string;\n data?: Record<string, any>;\n};\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface EventMetadata extends BaseEventMetadata {\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * 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.\n * 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.\n */\n entityEventSequence?: string | null;\n}\n\nexport interface NoteCreatedEnvelope {\n entity: Note;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is created.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_created\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug created\n */\nexport declare function onNoteCreated(\n handler: (event: NoteCreatedEnvelope) => void | Promise<void>\n): void;\n\nexport interface NoteDeletedEnvelope {\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is deleted.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_deleted\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug deleted\n */\nexport declare function onNoteDeleted(\n handler: (event: NoteDeletedEnvelope) => void | Promise<void>\n): void;\n\nexport interface NoteUpdatedEnvelope {\n entity: Note;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is updated.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_updated\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug updated\n */\nexport declare function onNoteUpdated(\n handler: (event: NoteUpdatedEnvelope) => void | Promise<void>\n): void;\n\n/**\n * Creates a new note associated with a specific contact.\n * @param note - Note to create.\n * @public\n * @requiredField note\n * @requiredField note.contactId\n * @permissionId CRM_NOTES.NOTE_CREATE\n * @applicableIdentity APP\n * @returns Created note.\n * @fqn wix.crm.notes.v2.Notes.CreateNote\n */\nexport async function createNote(\n note: NonNullablePaths<Note, `contactId`, 2>\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ note: note });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.createNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { note: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['note']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a note by ID.\n * @param noteId - Note ID.\n * @public\n * @requiredField noteId\n * @permissionId CRM_NOTES.NOTE_READ\n * @applicableIdentity APP\n * @returns Retrieved note.\n * @fqn wix.crm.notes.v2.Notes.GetNote\n */\nexport async function getNote(\n noteId: string\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ noteId: noteId });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.getNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { noteId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['noteId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Updates a note.\n *\n * This method supports partial updates.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @param _id - Note ID.\n * @public\n * @requiredField _id\n * @requiredField note\n * @requiredField note.revision\n * @permissionId CRM_NOTES.NOTE_UPDATE\n * @applicableIdentity APP\n * @returns Updated note.\n * @fqn wix.crm.notes.v2.Notes.UpdateNote\n */\nexport async function updateNote(\n _id: string,\n note: NonNullablePaths<UpdateNote, `revision`, 2>\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n note: { ...note, id: _id },\n });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.updateNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: { note: '$[1]' },\n explicitPathsToArguments: { 'note.id': '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'note']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface UpdateNote {\n /**\n * Note ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Revision number, which increments by 1 each time the note is updated.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the note was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the note was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Contact ID associated with the note.\n * @format GUID\n * @immutable\n */\n contactId?: string | null;\n /**\n * Note text.\n * @maxLength 2048\n */\n text?: string | null;\n /**\n * Note type for organizing notes by their purpose.\n *\n * Default: `NOT_SET`\n */\n type?: NoteTypeWithLiterals;\n /**\n * Information about who created the note.\n * @readonly\n */\n source?: NoteSource;\n}\n\n/**\n * Deletes a note.\n * @param noteId - Note ID.\n * @public\n * @requiredField noteId\n * @permissionId CRM_NOTES.NOTE_DELETE\n * @applicableIdentity APP\n * @fqn wix.crm.notes.v2.Notes.DeleteNote\n */\nexport async function deleteNote(noteId: string): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ noteId: noteId });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.deleteNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { noteId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['noteId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of up to 1,000 notes given the provided filtering, paging, and sorting.\n *\n * <blockquote class=\"important\">\n *\n * __Important:__\n * When making the first query request without a cursor, the `contactId` field is required. For subsequent requests using cursor pagination, `contactId` becomes optional as the cursor contains the context from the previous query.\n *\n * </blockquote>\n *\n * By default, notes are sorted by created date in descending order.\n *\n * Refer to [*Notes: Supported Filters and Sorting*](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/notes/notes-v2/supported-filters-and-sorting) for a complete list of supported filters and sorting options.\n *\n * To learn about working with *Query* endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging).\n * @public\n * @permissionId CRM_NOTES.NOTE_READ\n * @applicableIdentity APP\n * @fqn wix.crm.notes.v2.Notes.QueryNotes\n */\nexport function queryNotes(options?: QueryNotesOptions): NotesQueryBuilder {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n return queryBuilder<Note, 'CURSOR', QueryNotesRequest, QueryNotesResponse>({\n func: async (payload: QueryNotesRequest) => {\n const reqOpts = ambassadorWixCrmNotesV2Note.queryNotes({\n ...payload,\n ...(options ?? {}),\n });\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n return result;\n } catch (err) {\n sideEffects?.onError?.(err);\n throw err;\n }\n },\n requestTransformer: (query: QueryNotesRequest['query']) => {\n const args = [query, options] as [\n QueryNotesRequest['query'],\n QueryNotesOptions\n ];\n return renameKeysFromSDKRequestToRESTRequest({\n ...args?.[1],\n query: args?.[0],\n });\n },\n responseTransformer: ({ data }: HttpResponse<QueryNotesResponse>) => {\n const transformedData = renameKeysFromRESTResponseToSDKResponse(\n transformPaths(data, [])\n );\n\n return {\n items: transformedData?.notes,\n pagingMetadata: transformedData?.pagingMetadata,\n };\n },\n errorTransformer: (err: unknown) => {\n const transformedError = sdkTransformError(err, {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { query: '$[0]' },\n singleArgumentUnchanged: false,\n });\n\n throw transformedError;\n },\n pagingMethod: 'CURSOR',\n transformationPaths: {},\n });\n}\n\nexport interface QueryNotesOptions {\n /**\n * Contact ID to retrieve notes for. Required when not using cursor pagination.\n * @format GUID\n */\n contactId?: string | null | undefined;\n}\n\ninterface QueryCursorResult {\n cursors: Cursors;\n hasNext: () => boolean;\n hasPrev: () => boolean;\n length: number;\n pageSize: number;\n}\n\nexport interface NotesQueryResult extends QueryCursorResult {\n items: Note[];\n query: NotesQueryBuilder;\n next: () => Promise<NotesQueryResult>;\n prev: () => Promise<NotesQueryResult>;\n}\n\nexport interface NotesQueryBuilder {\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n eq: (\n propertyName:\n | '_id'\n | '_createdDate'\n | '_updatedDate'\n | 'contactId'\n | 'type',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n ne: (\n propertyName: '_createdDate' | '_updatedDate' | 'type',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n ge: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n gt: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n le: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n lt: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `values`.\n * @param values - List of values to compare against.\n */\n hasSome: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any[]\n ) => NotesQueryBuilder;\n in: (\n propertyName:\n | '_id'\n | '_createdDate'\n | '_updatedDate'\n | 'contactId'\n | 'type',\n value: any\n ) => NotesQueryBuilder;\n exists: (\n propertyName: '_createdDate' | '_updatedDate',\n value: boolean\n ) => NotesQueryBuilder;\n /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n ascending: (\n ...propertyNames: Array<'_createdDate' | '_updatedDate'>\n ) => NotesQueryBuilder;\n /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n descending: (\n ...propertyNames: Array<'_createdDate' | '_updatedDate'>\n ) => NotesQueryBuilder;\n /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */\n limit: (limit: number) => NotesQueryBuilder;\n /** @param cursor - A pointer to specific record */\n skipTo: (cursor: string) => NotesQueryBuilder;\n find: () => Promise<NotesQueryResult>;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformSDKFieldMaskToRESTFieldMask } from '@wix/sdk-runtime/transformations/field-mask';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixCrmNotesV2NotesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/crm/notes/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n _: [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_crm_notes';\n\n/** Creates a new note associated with a specific contact. */\nexport function createNote(payload: object): RequestOptionsFactory<any> {\n function __createNote({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'POST' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.CreateNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __createNote;\n}\n\n/** Retrieves a note by ID. */\nexport function getNote(payload: object): RequestOptionsFactory<any> {\n function __getNote({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'GET' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.GetNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{noteId}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getNote;\n}\n\n/**\n * Updates a note.\n *\n * This method supports partial updates.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n */\nexport function updateNote(payload: object): RequestOptionsFactory<any> {\n function __updateNote({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFieldMaskToRESTFieldMask,\n paths: [{ path: 'mask' }],\n },\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'PATCH' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.UpdateNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{note.id}',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __updateNote;\n}\n\n/** Deletes a note. */\nexport function deleteNote(payload: object): RequestOptionsFactory<any> {\n function __deleteNote({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'DELETE' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.DeleteNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{noteId}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __deleteNote;\n}\n\n/**\n * Retrieves a list of up to 1,000 notes given the provided filtering, paging, and sorting.\n *\n * <blockquote class=\"important\">\n *\n * __Important:__\n * When making the first query request without a cursor, the `contactId` field is required. For subsequent requests using cursor pagination, `contactId` becomes optional as the cursor contains the context from the previous query.\n *\n * </blockquote>\n *\n * By default, notes are sorted by created date in descending order.\n *\n * Refer to [*Notes: Supported Filters and Sorting*](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/notes/notes-v2/supported-filters-and-sorting) for a complete list of supported filters and sorting options.\n *\n * To learn about working with *Query* endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging).\n */\nexport function queryNotes(payload: object): RequestOptionsFactory<any> {\n function __queryNotes({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'POST' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.QueryNotes',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/query',\n data: payload,\n host,\n }),\n data: payload,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'notes.createdDate' },\n { path: 'notes.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __queryNotes;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA,kBAAAC;AAAA,EAAA,eAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA,kBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,2BAA6B;AAC7B,oCAGO;;;ACLP,0BAAkC;AAClC,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,wBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,6BACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,WAAW,SAA6C;AACtE,WAAS,aAAa,EAAE,KAAK,GAAQ;AACnC,UAAM,qBAAiB,uCAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO,CAAC,EAAE,MAAM,mBAAmB,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAAA,MACpE;AAAA,IACF,CAAC;AACD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAA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AA,MACjB,CAAC;AAAA,IACH;AAAA,IACA,qBAAqB,CAAC,EAAE,KAAK,MAAwC;AACnE,YAAM,sBAAkB;AAAA,YACtB,wCAAe,MAAM,CAAC,CAAC;AAAA,MACzB;AAEA,aAAO;AAAA,QACL,OAAO,iBAAiB;AAAA,QACxB,gBAAgB,iBAAiB;AAAA,MACnC;AAAA,IACF;AAAA,IACA,kBAAkB,CAAC,QAAiB;AAClC,YAAM,uBAAmB,uBAAAJ,gBAAkB,KAAK;AAAA,QAC9C,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,OAAO,OAAO;AAAA,QAC1C,yBAAyB;AAAA,MAC3B,CAAC;AAED,YAAM;AAAA,IACR;AAAA,IACA,cAAc;AAAA,IACd,qBAAqB,CAAC;AAAA,EACxB,CAAC;AACH;","names":["createNote","deleteNote","getNote","queryNotes","updateNote","import_timestamp","import_rest_modules","payload","import_transform_paths","NoteType","SourceType","SortOrder","WebhookIdentityType","createNote","sdkTransformError","getNote","updateNote","deleteNote","queryNotes"]}
1
+ {"version":3,"sources":["../../../index.typings.ts","../../../src/crm-notes-v2-note-notes.universal.ts","../../../src/crm-notes-v2-note-notes.http.ts"],"sourcesContent":["export * from './src/crm-notes-v2-note-notes.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { queryBuilder } from '@wix/sdk-runtime/query-builder';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, HttpResponse, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixCrmNotesV2Note from './crm-notes-v2-note-notes.http.js';\n// @ts-ignore\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\n/** A note contains textual information associated with a contact. */\nexport interface Note {\n /**\n * Note ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Revision number, which increments by 1 each time the note is updated.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the note was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the note was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Contact ID associated with the note.\n * @format GUID\n * @immutable\n */\n contactId?: string | null;\n /**\n * Note text.\n * @maxLength 2048\n */\n text?: string | null;\n /**\n * Note type for organizing notes by their purpose.\n *\n * Default: `NOT_SET`\n */\n type?: NoteTypeWithLiterals;\n /**\n * Information about who created the note.\n * @readonly\n */\n source?: NoteSource;\n}\n\nexport enum NoteType {\n /** Unknown note type. */\n UNKNOWN_TYPE = 'UNKNOWN_TYPE',\n /** Note doesn't have a specific classification. */\n NOT_SET = 'NOT_SET',\n /** Note is a summary of a meeting related to the contact. */\n MEETING_SUMMARY = 'MEETING_SUMMARY',\n /** Note is a summary of a call related to the contact. */\n CALL_SUMMARY = 'CALL_SUMMARY',\n}\n\n/** @enumType */\nexport type NoteTypeWithLiterals =\n | NoteType\n | 'UNKNOWN_TYPE'\n | 'NOT_SET'\n | 'MEETING_SUMMARY'\n | 'CALL_SUMMARY';\n\nexport interface NoteSource {\n /**\n * Note creator.\n * @readonly\n */\n sourceType?: SourceTypeWithLiterals;\n /**\n * App ID, if the note was created by an app.\n * @format GUID\n * @readonly\n */\n appId?: string | null;\n /**\n * User ID, if the note was created by a Wix user.\n * @format GUID\n * @readonly\n */\n userId?: string | null;\n}\n\n/** Note creator. */\nexport enum SourceType {\n UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE',\n APP = 'APP',\n USER = 'USER',\n}\n\n/** @enumType */\nexport type SourceTypeWithLiterals =\n | SourceType\n | 'UNKNOWN_SOURCE_TYPE'\n | 'APP'\n | 'USER';\n\nexport interface CreateNoteRequest {\n /** Note to create. */\n note: Note;\n}\n\nexport interface CreateNoteResponse {\n /** Created note. */\n note?: Note;\n}\n\nexport interface GetNoteRequest {\n /**\n * Note ID.\n * @format GUID\n */\n noteId: string;\n}\n\nexport interface GetNoteResponse {\n /** Retrieved note. */\n note?: Note;\n}\n\nexport interface UpdateNoteRequest {\n /** Note to update. */\n note: Note;\n}\n\nexport interface UpdateNoteResponse {\n /** Updated note. */\n note?: Note;\n}\n\nexport interface DeleteNoteRequest {\n /**\n * Note ID.\n * @format GUID\n */\n noteId: string;\n}\n\nexport interface DeleteNoteResponse {}\n\nexport interface QueryNotesRequest {\n /**\n * WQL query object.\n *\n * For more information, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language).\n */\n query?: CursorQuery;\n /**\n * Contact ID to retrieve notes for. Required when not using cursor pagination.\n * @format GUID\n */\n contactId?: string | null;\n}\n\nexport interface CursorQuery extends CursorQueryPagingMethodOneOf {\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging;\n /**\n * Filter object in the following format:\n * `\"filter\" : {\n * \"fieldName1\": \"value1\",\n * \"fieldName2\":{\"$operator\":\"value2\"}\n * }`\n * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`\n */\n filter?: Record<string, any> | null;\n /**\n * Sort object in the following format:\n * `[{\"fieldName\":\"sortField1\",\"order\":\"ASC\"},{\"fieldName\":\"sortField2\",\"order\":\"DESC\"}]`\n */\n sort?: Sorting[];\n}\n\n/** @oneof */\nexport interface CursorQueryPagingMethodOneOf {\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface Sorting {\n /** Name of the field to sort by. */\n fieldName?: string;\n /** Sort order. */\n order?: SortOrderWithLiterals;\n}\n\nexport enum SortOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/** @enumType */\nexport type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';\n\nexport interface CursorPaging {\n /**\n * Number of items to load.\n * @max 1000\n */\n limit?: number | null;\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * You can get the relevant cursor token\n * from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n */\n cursor?: string | null;\n}\n\nexport interface QueryNotesResponse {\n /** Retrieved notes. */\n notes?: Note[];\n /** Paging information. */\n pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n /** Number of items returned in the response. */\n count?: number | null;\n /** Offset that was requested. */\n cursors?: Cursors;\n /**\n * Indicates if there are more results after the current page.\n * If `true`, another page of results can be retrieved.\n * If `false`, this is the last page.\n */\n hasNext?: boolean | null;\n}\n\nexport interface Cursors {\n /** Cursor pointing to next page in the list of results. */\n next?: string | null;\n /** Cursor pointing to previous page in the list of results. */\n prev?: string | null;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * 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.\n * 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.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n/** @docsIgnore */\nexport type QueryNotesApplicationErrors = {\n code?: 'MISSING_CONTACT_ID';\n description?: string;\n data?: Record<string, any>;\n};\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface EventMetadata extends BaseEventMetadata {\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * 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.\n * 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.\n */\n entityEventSequence?: string | null;\n}\n\nexport interface NoteCreatedEnvelope {\n entity: Note;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is created.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_created\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug created\n */\nexport declare function onNoteCreated(\n handler: (event: NoteCreatedEnvelope) => void | Promise<void>\n): void;\n\nexport interface NoteDeletedEnvelope {\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is deleted.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_deleted\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug deleted\n */\nexport declare function onNoteDeleted(\n handler: (event: NoteDeletedEnvelope) => void | Promise<void>\n): void;\n\nexport interface NoteUpdatedEnvelope {\n entity: Note;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a note is updated.\n * @permissionScope Read Members and Contacts - all read permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS\n * @permissionScope Manage Notes\n * @permissionScopeId SCOPE.DC-CRM.MANAGE-NOTES\n * @permissionScope Manage Members and Contacts - all permissions\n * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS\n * @permissionScope Read Notes\n * @permissionScopeId SCOPE.DC-CRM.READ-NOTES\n * @permissionId CRM_NOTES.NOTE_READ\n * @webhook\n * @eventType wix.crm.notes.v2.note_updated\n * @serviceIdentifier wix.crm.notes.v2.Notes\n * @slug updated\n */\nexport declare function onNoteUpdated(\n handler: (event: NoteUpdatedEnvelope) => void | Promise<void>\n): void;\n\n/**\n * Creates a new note associated with a specific contact.\n * @param note - Note to create.\n * @public\n * @requiredField note\n * @requiredField note.contactId\n * @permissionId CRM_NOTES.NOTE_CREATE\n * @applicableIdentity APP\n * @returns Created note.\n * @fqn wix.crm.notes.v2.Notes.CreateNote\n */\nexport async function createNote(\n note: NonNullablePaths<Note, `contactId`, 2>\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ note: note });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.createNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { note: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['note']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a note by ID.\n * @param noteId - Note ID.\n * @public\n * @requiredField noteId\n * @permissionId CRM_NOTES.NOTE_READ\n * @applicableIdentity APP\n * @returns Retrieved note.\n * @fqn wix.crm.notes.v2.Notes.GetNote\n */\nexport async function getNote(\n noteId: string\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ noteId: noteId });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.getNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { noteId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['noteId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Updates a note.\n *\n * This method supports partial updates.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @param _id - Note ID.\n * @public\n * @requiredField _id\n * @requiredField note\n * @requiredField note.revision\n * @permissionId CRM_NOTES.NOTE_UPDATE\n * @applicableIdentity APP\n * @returns Updated note.\n * @fqn wix.crm.notes.v2.Notes.UpdateNote\n */\nexport async function updateNote(\n _id: string,\n note: NonNullablePaths<UpdateNote, `revision`, 2>\n): Promise<NonNullablePaths<Note, `type` | `source.sourceType`, 3>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n note: { ...note, id: _id },\n });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.updateNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.note!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: { note: '$[1]' },\n explicitPathsToArguments: { 'note.id': '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'note']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface UpdateNote {\n /**\n * Note ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Revision number, which increments by 1 each time the note is updated.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the note was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the note was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Contact ID associated with the note.\n * @format GUID\n * @immutable\n */\n contactId?: string | null;\n /**\n * Note text.\n * @maxLength 2048\n */\n text?: string | null;\n /**\n * Note type for organizing notes by their purpose.\n *\n * Default: `NOT_SET`\n */\n type?: NoteTypeWithLiterals;\n /**\n * Information about who created the note.\n * @readonly\n */\n source?: NoteSource;\n}\n\n/**\n * Deletes a note.\n * @param noteId - Note ID.\n * @public\n * @requiredField noteId\n * @permissionId CRM_NOTES.NOTE_DELETE\n * @applicableIdentity APP\n * @fqn wix.crm.notes.v2.Notes.DeleteNote\n */\nexport async function deleteNote(noteId: string): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ noteId: noteId });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.deleteNote(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { noteId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['noteId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of up to 1,000 notes given the provided filtering, paging, and sorting.\n *\n * <blockquote class=\"important\">\n *\n * __Important:__\n * When making the first query request without a cursor, the `contactId` field is required. For subsequent requests using cursor pagination, `contactId` becomes optional as the cursor contains the context from the previous query.\n *\n * </blockquote>\n *\n * By default, notes are sorted by created date in descending order.\n *\n * Refer to [*Notes: Supported Filters and Sorting*](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/notes/notes-v2/supported-filters-and-sorting) for a complete list of supported filters and sorting options.\n *\n * To learn about working with *Query* endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging).\n * @public\n * @permissionId CRM_NOTES.NOTE_READ\n * @applicableIdentity APP\n * @fqn wix.crm.notes.v2.Notes.QueryNotes\n */\nexport function queryNotes(options?: QueryNotesOptions): NotesQueryBuilder {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n return queryBuilder<Note, 'CURSOR', QueryNotesRequest, QueryNotesResponse>({\n func: async (payload: QueryNotesRequest) => {\n const reqOpts = ambassadorWixCrmNotesV2Note.queryNotes({\n ...payload,\n ...(options ?? {}),\n });\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n return result;\n } catch (err) {\n sideEffects?.onError?.(err);\n throw err;\n }\n },\n requestTransformer: (query: QueryNotesRequest['query']) => {\n const args = [query, options] as [\n QueryNotesRequest['query'],\n QueryNotesOptions\n ];\n return renameKeysFromSDKRequestToRESTRequest({\n ...args?.[1],\n query: args?.[0],\n });\n },\n responseTransformer: ({ data }: HttpResponse<QueryNotesResponse>) => {\n const transformedData = renameKeysFromRESTResponseToSDKResponse(\n transformPaths(data, [])\n );\n\n return {\n items: transformedData?.notes,\n pagingMetadata: transformedData?.pagingMetadata,\n };\n },\n errorTransformer: (err: unknown) => {\n const transformedError = sdkTransformError(err, {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { query: '$[0]' },\n singleArgumentUnchanged: false,\n });\n\n throw transformedError;\n },\n pagingMethod: 'CURSOR',\n transformationPaths: {},\n });\n}\n\nexport interface QueryNotesOptions {\n /**\n * Contact ID to retrieve notes for. Required when not using cursor pagination.\n * @format GUID\n */\n contactId?: string | null | undefined;\n}\n\ninterface QueryCursorResult {\n cursors: Cursors;\n hasNext: () => boolean;\n hasPrev: () => boolean;\n length: number;\n pageSize: number;\n}\n\nexport interface NotesQueryResult extends QueryCursorResult {\n items: Note[];\n query: NotesQueryBuilder;\n next: () => Promise<NotesQueryResult>;\n prev: () => Promise<NotesQueryResult>;\n}\n\nexport interface NotesQueryBuilder {\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n eq: (\n propertyName:\n | '_id'\n | '_createdDate'\n | '_updatedDate'\n | 'contactId'\n | 'type',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n ne: (\n propertyName: '_createdDate' | '_updatedDate' | 'type',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n ge: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n gt: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n le: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `value`.\n * @param value - Value to compare against.\n */\n lt: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any\n ) => NotesQueryBuilder;\n /** @param propertyName - Property whose value is compared with `values`.\n * @param values - List of values to compare against.\n */\n hasSome: (\n propertyName: '_createdDate' | '_updatedDate',\n value: any[]\n ) => NotesQueryBuilder;\n in: (\n propertyName:\n | '_id'\n | '_createdDate'\n | '_updatedDate'\n | 'contactId'\n | 'type',\n value: any\n ) => NotesQueryBuilder;\n exists: (\n propertyName: '_createdDate' | '_updatedDate',\n value: boolean\n ) => NotesQueryBuilder;\n /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n ascending: (\n ...propertyNames: Array<'_createdDate' | '_updatedDate'>\n ) => NotesQueryBuilder;\n /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n descending: (\n ...propertyNames: Array<'_createdDate' | '_updatedDate'>\n ) => NotesQueryBuilder;\n /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */\n limit: (limit: number) => NotesQueryBuilder;\n /** @param cursor - A pointer to specific record */\n skipTo: (cursor: string) => NotesQueryBuilder;\n find: () => Promise<NotesQueryResult>;\n}\n\n/**\n * @hidden\n * @fqn wix.crm.notes.v2.Notes.QueryNotes\n * @requiredField query\n */\nexport async function typedQueryNotes(\n query: CursorQuery,\n options?: QueryNotesOptions\n): Promise<\n NonNullablePaths<\n QueryNotesResponse,\n `notes` | `notes.${number}.type` | `notes.${number}.source.sourceType`,\n 5\n > & {\n __applicationErrorsType?: QueryNotesApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: query,\n ...options,\n });\n\n const reqOpts = ambassadorWixCrmNotesV2Note.queryNotes(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { query: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['query', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformSDKFieldMaskToRESTFieldMask } from '@wix/sdk-runtime/transformations/field-mask';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixCrmNotesV2NotesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/crm/notes/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n _: [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/_api/notes-app/v2/notes',\n destPath: '/v2/notes',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_crm_notes';\n\n/** Creates a new note associated with a specific contact. */\nexport function createNote(payload: object): RequestOptionsFactory<any> {\n function __createNote({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'POST' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.CreateNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __createNote;\n}\n\n/** Retrieves a note by ID. */\nexport function getNote(payload: object): RequestOptionsFactory<any> {\n function __getNote({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'GET' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.GetNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{noteId}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getNote;\n}\n\n/**\n * Updates a note.\n *\n * This method supports partial updates.\n * To prevent conflicting changes, the current revision must be passed when updating the note.\n */\nexport function updateNote(payload: object): RequestOptionsFactory<any> {\n function __updateNote({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFieldMaskToRESTFieldMask,\n paths: [{ path: 'mask' }],\n },\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'PATCH' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.UpdateNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{note.id}',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'note.createdDate' }, { path: 'note.updatedDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __updateNote;\n}\n\n/** Deletes a note. */\nexport function deleteNote(payload: object): RequestOptionsFactory<any> {\n function __deleteNote({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'DELETE' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.DeleteNote',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/{noteId}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __deleteNote;\n}\n\n/**\n * Retrieves a list of up to 1,000 notes given the provided filtering, paging, and sorting.\n *\n * <blockquote class=\"important\">\n *\n * __Important:__\n * When making the first query request without a cursor, the `contactId` field is required. For subsequent requests using cursor pagination, `contactId` becomes optional as the cursor contains the context from the previous query.\n *\n * </blockquote>\n *\n * By default, notes are sorted by created date in descending order.\n *\n * Refer to [*Notes: Supported Filters and Sorting*](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/notes/notes-v2/supported-filters-and-sorting) for a complete list of supported filters and sorting options.\n *\n * To learn about working with *Query* endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging).\n */\nexport function queryNotes(payload: object): RequestOptionsFactory<any> {\n function __queryNotes({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.crm.notes.v2.note',\n method: 'POST' as any,\n methodFqn: 'wix.crm.notes.v2.Notes.QueryNotes',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixCrmNotesV2NotesUrl({\n protoPath: '/v2/notes/query',\n data: payload,\n host,\n }),\n data: payload,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'notes.createdDate' },\n { path: 'notes.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __queryNotes;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA,kBAAAC;AAAA,EAAA,eAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA;AAAA,oBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,2BAA6B;AAC7B,oCAGO;;;ACLP,0BAAkC;AAClC,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,wBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,6BACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,WAAW,SAA6C;AACtE,WAAS,aAAa,EAAE,KAAK,GAAQ;AACnC,UAAM,qBAAiB,uCAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO,CAAC,EAAE,MAAM,mBAAmB,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAAA,MACpE;AAAA,IACF,CAAC;AACD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aA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AAAA,IACA,qBAAqB,CAAC,EAAE,KAAK,MAAwC;AACnE,YAAM,sBAAkB;AAAA,YACtB,wCAAe,MAAM,CAAC,CAAC;AAAA,MACzB;AAEA,aAAO;AAAA,QACL,OAAO,iBAAiB;AAAA,QACxB,gBAAgB,iBAAiB;AAAA,MACnC;AAAA,IACF;AAAA,IACA,kBAAkB,CAAC,QAAiB;AAClC,YAAM,uBAAmB,uBAAAJ,gBAAkB,KAAK;AAAA,QAC9C,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,OAAO,OAAO;AAAA,QAC1C,yBAAyB;AAAA,MAC3B,CAAC;AAED,YAAM;AAAA,IACR;AAAA,IACA,cAAc;AAAA,IACd,qBAAqB,CAAC;AAAA,EACxB,CAAC;AACH;AAiHA,eAAsB,gBACpB,OACA,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AAED,QAAM,UAAsC,WAAW,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAA;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,OAAO,OAAO;AAAA,QAC1C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS,SAAS;AAAA,IACrB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["createNote","deleteNote","getNote","queryNotes","updateNote","import_timestamp","import_rest_modules","payload","import_transform_paths","NoteType","SourceType","SortOrder","WebhookIdentityType","createNote","sdkTransformError","getNote","updateNote","deleteNote","queryNotes"]}
@@ -1,6 +1,6 @@
1
1
  import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { Note, UpdateNote, QueryNotesOptions, NotesQueryBuilder, NoteCreatedEnvelope, NoteDeletedEnvelope, NoteUpdatedEnvelope } from './index.typings.mjs';
3
- export { ActionEvent, BaseEventMetadata, CreateNoteRequest, CreateNoteResponse, CursorPaging, CursorPagingMetadata, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, DeleteNoteRequest, DeleteNoteResponse, DomainEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetNoteRequest, GetNoteResponse, IdentificationData, IdentificationDataIdOneOf, MessageEnvelope, NoteSource, NoteType, NoteTypeWithLiterals, NotesQueryResult, QueryNotesApplicationErrors, QueryNotesRequest, QueryNotesResponse, RestoreInfo, SortOrder, SortOrderWithLiterals, Sorting, SourceType, SourceTypeWithLiterals, UpdateNoteRequest, UpdateNoteResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.mjs';
2
+ import { Note, UpdateNote, NoteCreatedEnvelope, NoteDeletedEnvelope, NoteUpdatedEnvelope, CursorQuery, typedQueryNotes, QueryNotesOptions, NotesQueryBuilder } from './index.typings.mjs';
3
+ export { ActionEvent, BaseEventMetadata, CreateNoteRequest, CreateNoteResponse, CursorPaging, CursorPagingMetadata, CursorQueryPagingMethodOneOf, Cursors, DeleteNoteRequest, DeleteNoteResponse, DomainEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetNoteRequest, GetNoteResponse, IdentificationData, IdentificationDataIdOneOf, MessageEnvelope, NoteSource, NoteType, NoteTypeWithLiterals, NotesQueryResult, QueryNotesApplicationErrors, QueryNotesRequest, QueryNotesResponse, RestoreInfo, SortOrder, SortOrderWithLiterals, Sorting, SourceType, SourceTypeWithLiterals, UpdateNoteRequest, UpdateNoteResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.mjs';
4
4
 
5
5
  declare function createNote$1(httpClient: HttpClient): CreateNoteSignature;
6
6
  interface CreateNoteSignature {
@@ -40,35 +40,21 @@ interface DeleteNoteSignature {
40
40
  */
41
41
  (noteId: string): Promise<void>;
42
42
  }
43
- declare function queryNotes$1(httpClient: HttpClient): QueryNotesSignature;
44
- interface QueryNotesSignature {
45
- /**
46
- * Retrieves a list of up to 1,000 notes given the provided filtering, paging, and sorting.
47
- *
48
- * <blockquote class="important">
49
- *
50
- * __Important:__
51
- * When making the first query request without a cursor, the `contactId` field is required. For subsequent requests using cursor pagination, `contactId` becomes optional as the cursor contains the context from the previous query.
52
- *
53
- * </blockquote>
54
- *
55
- * By default, notes are sorted by created date in descending order.
56
- *
57
- * Refer to [*Notes: Supported Filters and Sorting*](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/notes/notes-v2/supported-filters-and-sorting) for a complete list of supported filters and sorting options.
58
- *
59
- * To learn about working with *Query* endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging).
60
- */
61
- (options?: QueryNotesOptions): NotesQueryBuilder;
62
- }
63
43
  declare const onNoteCreated$1: EventDefinition<NoteCreatedEnvelope, "wix.crm.notes.v2.note_created">;
64
44
  declare const onNoteDeleted$1: EventDefinition<NoteDeletedEnvelope, "wix.crm.notes.v2.note_deleted">;
65
45
  declare const onNoteUpdated$1: EventDefinition<NoteUpdatedEnvelope, "wix.crm.notes.v2.note_updated">;
66
46
 
47
+ declare function customQueryNotes(httpClient: HttpClient): {
48
+ (query: CursorQuery): ReturnType<typeof typedQueryNotes>;
49
+ (query: CursorQuery, options: QueryNotesOptions): ReturnType<typeof typedQueryNotes>;
50
+ (): NotesQueryBuilder;
51
+ (options: QueryNotesOptions): NotesQueryBuilder;
52
+ };
67
53
  declare const createNote: MaybeContext<BuildRESTFunction<typeof createNote$1> & typeof createNote$1>;
68
54
  declare const getNote: MaybeContext<BuildRESTFunction<typeof getNote$1> & typeof getNote$1>;
69
55
  declare const updateNote: MaybeContext<BuildRESTFunction<typeof updateNote$1> & typeof updateNote$1>;
70
56
  declare const deleteNote: MaybeContext<BuildRESTFunction<typeof deleteNote$1> & typeof deleteNote$1>;
71
- declare const queryNotes: MaybeContext<BuildRESTFunction<typeof queryNotes$1> & typeof queryNotes$1>;
57
+ declare const queryNotes: MaybeContext<BuildRESTFunction<typeof customQueryNotes> & typeof customQueryNotes>;
72
58
  /**
73
59
  * Triggered when a note is created.
74
60
  */
@@ -82,4 +68,4 @@ declare const onNoteDeleted: BuildEventDefinition<typeof onNoteDeleted$1> & type
82
68
  */
83
69
  declare const onNoteUpdated: BuildEventDefinition<typeof onNoteUpdated$1> & typeof onNoteUpdated$1;
84
70
 
85
- export { Note, NoteCreatedEnvelope, NoteDeletedEnvelope, NoteUpdatedEnvelope, NotesQueryBuilder, QueryNotesOptions, UpdateNote, createNote, deleteNote, getNote, onNoteCreated, onNoteDeleted, onNoteUpdated, queryNotes, updateNote };
71
+ export { CursorQuery, Note, NoteCreatedEnvelope, NoteDeletedEnvelope, NoteUpdatedEnvelope, NotesQueryBuilder, QueryNotesOptions, UpdateNote, createNote, deleteNote, getNote, onNoteCreated, onNoteDeleted, onNoteUpdated, queryNotes, updateNote };
@@ -365,6 +365,32 @@ function queryNotes2(options) {
365
365
  transformationPaths: {}
366
366
  });
367
367
  }
368
+ async function typedQueryNotes(query, options) {
369
+ const { httpClient, sideEffects } = arguments[2];
370
+ const payload = renameKeysFromSDKRequestToRESTRequest({
371
+ query,
372
+ ...options
373
+ });
374
+ const reqOpts = queryNotes(payload);
375
+ sideEffects?.onSiteCall?.();
376
+ try {
377
+ const result = await httpClient.request(reqOpts);
378
+ sideEffects?.onSuccess?.(result);
379
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
380
+ } catch (err) {
381
+ const transformedError = sdkTransformError(
382
+ err,
383
+ {
384
+ spreadPathsToArguments: {},
385
+ explicitPathsToArguments: { query: "$[0]" },
386
+ singleArgumentUnchanged: false
387
+ },
388
+ ["query", "options"]
389
+ );
390
+ sideEffects?.onError?.(err);
391
+ throw transformedError;
392
+ }
393
+ }
368
394
 
369
395
  // src/crm-notes-v2-note-notes.public.ts
370
396
  function createNote3(httpClient) {
@@ -403,6 +429,14 @@ function queryNotes3(httpClient) {
403
429
  { httpClient }
404
430
  );
405
431
  }
432
+ function typedQueryNotes2(httpClient) {
433
+ return (query, options) => typedQueryNotes(
434
+ query,
435
+ options,
436
+ // @ts-ignore
437
+ { httpClient }
438
+ );
439
+ }
406
440
  var onNoteCreated = EventDefinition(
407
441
  "wix.crm.notes.v2.note_created",
408
442
  true,
@@ -455,11 +489,23 @@ var onNoteUpdated = EventDefinition(
455
489
  // src/crm-notes-v2-note-notes.context.ts
456
490
  import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
457
491
  import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
492
+ import { createQueryOverloadRouter } from "@wix/sdk-runtime/query-method-router";
493
+ function customQueryNotes(httpClient) {
494
+ const router = createQueryOverloadRouter({
495
+ builderQueryFunction: (options) => queryNotes3(httpClient)(options),
496
+ typedQueryFunction: (query, options) => typedQueryNotes2(httpClient)(query, options),
497
+ hasOptionsParameter: true
498
+ });
499
+ function overloadedQuery(queryOrOptions, options) {
500
+ return router(...arguments);
501
+ }
502
+ return overloadedQuery;
503
+ }
458
504
  var createNote4 = /* @__PURE__ */ createRESTModule(createNote3);
459
505
  var getNote4 = /* @__PURE__ */ createRESTModule(getNote3);
460
506
  var updateNote4 = /* @__PURE__ */ createRESTModule(updateNote3);
461
507
  var deleteNote4 = /* @__PURE__ */ createRESTModule(deleteNote3);
462
- var queryNotes4 = /* @__PURE__ */ createRESTModule(queryNotes3);
508
+ var queryNotes4 = /* @__PURE__ */ createRESTModule(customQueryNotes);
463
509
  var onNoteCreated2 = createEventModule(onNoteCreated);
464
510
  var onNoteDeleted2 = createEventModule(onNoteDeleted);
465
511
  var onNoteUpdated2 = createEventModule(onNoteUpdated);