@wix/wix-data-items-common 1.0.103 → 1.0.105

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 (45) hide show
  1. package/dist/cjs/api/ApiClient.js.map +1 -1
  2. package/dist/cjs/api/QueryBase.js.map +1 -1
  3. package/dist/cjs/api/QueryValidator.js.map +1 -1
  4. package/dist/cjs/api/WixDataAggregate.js.map +1 -1
  5. package/dist/cjs/api/WixDataApi.js.map +1 -1
  6. package/dist/cjs/api/WixDataFilter.js.map +1 -1
  7. package/dist/cjs/api/WixDataPatch.js.map +1 -1
  8. package/dist/cjs/api/WixDataQuery.js.map +1 -1
  9. package/dist/cjs/api/WixDataResult.js.map +1 -1
  10. package/dist/cjs/api/common.js.map +1 -1
  11. package/dist/cjs/api/errors.js.map +1 -1
  12. package/dist/cjs/api/impl/WixDataAggregateImpl.js.map +1 -1
  13. package/dist/cjs/api/impl/WixDataPatchImpl.js.map +1 -1
  14. package/dist/cjs/api/impl/WixDataQueryImpl.js.map +1 -1
  15. package/dist/cjs/api/impl/WixDataResultImpl.js +1 -3
  16. package/dist/cjs/api/impl/WixDataResultImpl.js.map +1 -1
  17. package/dist/cjs/api/index.js.map +1 -1
  18. package/dist/cjs/api/types.js.map +1 -1
  19. package/dist/cjs/errors/base-validator.js.map +1 -1
  20. package/dist/cjs/errors/errors.js.map +1 -1
  21. package/dist/cjs/errors/index.js.map +1 -1
  22. package/dist/cjs/errors/validations.js.map +1 -1
  23. package/dist/cjs/external-types.d.js.map +1 -1
  24. package/dist/cjs/filter/FilterTree.js.map +1 -1
  25. package/dist/cjs/filter/WithFilter.js.map +1 -1
  26. package/dist/cjs/filter/filterBuilder.js.map +1 -1
  27. package/dist/cjs/filter/filterMixin.js.map +1 -1
  28. package/dist/cjs/filter/index.js.map +1 -1
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/sort/sortMixin.js.map +1 -1
  31. package/dist/cjs/test-types.d.js.map +1 -1
  32. package/dist/cjs/types/api.js.map +1 -1
  33. package/dist/cjs/types/data-item-types.js.map +1 -1
  34. package/dist/cjs/types/error.js.map +1 -1
  35. package/dist/cjs/types/index.js.map +1 -1
  36. package/dist/cjs/utils/base64url.js.map +1 -1
  37. package/dist/cjs/utils/clone.js.map +1 -1
  38. package/dist/cjs/utils/codec.js.map +1 -1
  39. package/dist/cjs/utils/field-key-utils.js.map +1 -1
  40. package/dist/cjs/utils/index.js.map +1 -1
  41. package/dist/cjs/utils/type-utils.js.map +1 -1
  42. package/dist/types/api/WixDataPatch.d.ts +12 -12
  43. package/dist/types/types/data-item-types.d.ts +2 -2
  44. package/dist/types/types/data-item-types.d.ts.map +1 -1
  45. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","apiTypes","_interopRequireWildcard","_utils","_common","_WixDataQueryImpl","_WixDataResultImpl","_WixDataAggregateImpl","_ApiClient","_WixDataPatchImpl","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","WixDataApi","constructor","clientFactory","allowGet","environment","gridAppId","tracer","_defineProperty2","withArgs","args","collectionName","options","apiValidator","arity","validateAndReject","trace","env","client","truncateDataItems","dataCollectionId","toOptions","itemId","dataItem","getDataItem","dataItemId","toReadOptions","fields","catch","recover","ItemDoesNotExistCode","toDataItem","item","warnAboutBrokenFields","insertDataItem","id","_id","data","toUpdateOptions","saveDataItem","updateDataItem","removeDataItem","fieldModification","action","ACTION","SET_FIELD","fieldPath","setFieldOptions","value","actionOptions","REMOVE_FIELD","INCREMENT_FIELD","incrementFieldOptions","APPEND_TO_ARRAY","appendToArrayOptions","REMOVE_FROM_ARRAY","removeFromArrayOptions","Error","WixDataPatchImpl","onRun","_args","patchParams","fieldModifications","map","toFieldModificationApi","result","patchDataItem","patch","toPatchOptions","itemIds","WixDataBulkPatchImpl","results","bulkPatchDataItems","patches","toBulkResult","ensureValidQuery","invalidArgs","length","wdeValidationError","messages","queryValidations","queryInvalid","WixDataQueryImpl","onCount","params","invalidArguments","validateAndReturn","totalCount","countDataItems","filter","filterTree","onDistinct","field","_toSort$find","fieldName","order","toSort","orderBy","find","o","fetch","cursorOrOffset","returnTotalCount","distinctValues","pagingMetadata","queryDistinctValues","toPaging","limitNumber","isOffset","items","paging","skipNumber","WixDataResultImpl","onFind","dataItems","queryDataItems","query","projectedFields","sort","referencedItemOptions","included","cursor","limit","isNonEmptyString","WixDataAggregateImpl","validationErrors","aggregateValidations","aggregateInvalid","toOperation","itemFieldName","undefined","aggregateDataItems","initialFilter","aggregation","groupingFields","groupBy","operations","aggregates","resultFieldName","name","average","avg","min","max","sum","itemCount","count","finalFilter","havingTree","unwrapAggregationId","bulkRemoveOptions","bulkRemoveDataItems","dataItemIds","bulkInsertOptions","appId","runBulkSave","overrideExisting","bulkUpdateOptions","bulkUpdateDataItems","current","queryReferencedDataItems","onlyReferencedItems","holdingItem","relationshipAttribute","referenceParameter","referringItemId","referringItemFieldName","SortOrder","ASC","DESC","skip","refsOrAttr","leftOrOpts","right","refs","opts","argc","rights","asArray","relationshipName","left","references","bulkInsertDataItemReferences","dataItemReferences","referencedItemId","referenceParameters","replaceDataItemReferences","newReferencedItemIds","referenceRemoveParameters","bulkRemoveDataItemReferences","isReferenced","isReferencedDataItem","consistentRead","ApiClient","wixData","filterBuilder","request","bulkSaveDataItems","bulkInsertDataItems","ignoreCodes","fn","exports","arguments","suppressHooks","draftsOptions","showDrafts","includeReferencedItems","includeReferences","res","appOptions","entries","every","kv","language","publishPluginOptions","includeDraftItems","cursorPaging","offset","fieldOrder","providerOrValue","code","error","_details","details","applicationError","Promise","resolve","reject","hasFieldWithDollar","hasField","key","startsWith","hasFieldWithDot","includes","console","warn","errors","flatMap","_r$itemMetadata","_r$itemMetadata2","itemMetadata","success","BulkError","description","originalIndex","_r$itemMetadata3","inserted","BulkActionType","INSERT","updated","UPDATE","PATCH","removed","DELETE","skipped","insertedItemIds","_r$itemMetadata4","updatedItemIds","_r$itemMetadata5","removedItemIds","_r$itemMetadata6","isObject","rest","keys","notEmpty","xOrXs","isArray","commonApiValidator"],"sources":["../../../src/api/WixDataApi.ts"],"sourcesContent":["import {\n apiValidator as commonApiValidator,\n messages,\n BulkError,\n wdeValidationError,\n} from '../errors'\nimport { HttpApiClientFactory } from '../types'\nimport * as apiTypes from '../types/data-item-types'\n\nimport { hasField, isObject, isArray } from '../utils'\nimport { filterBuilder } from './common'\nimport {\n Provider,\n WixDataBulkResult,\n WixDataItem,\n WixDataItemOrId,\n WixDataOptions,\n WixDataPatchOptions,\n WixDataQueryReferencedOptions,\n WixDataReadOptions,\n WixDataReadWithProjectionOptions,\n WixDataReference,\n WixDataUpdateOptions,\n} from './types'\nimport { QueryParams, WixDataQueryImpl } from './impl/WixDataQueryImpl'\nimport { WixDataQuery } from './WixDataQuery'\nimport { WixDataResultImpl, PageFetcher } from './impl/WixDataResultImpl'\nimport { WixDataAggregateImpl } from './impl/WixDataAggregateImpl'\nimport { ApiClient } from './ApiClient'\nimport {\n WixDataPatch,\n FieldModification,\n WixDataBulkPatch,\n} from './WixDataPatch'\nimport { WixDataAggregate } from './WixDataAggregate'\nimport { WixDataFilter } from './WixDataFilter'\nimport { WixDataResult } from './WixDataResult'\nimport { WixDataBulkPatchImpl, WixDataPatchImpl } from './impl/WixDataPatchImpl'\n\ntype ProvidedOpt<T> = T | undefined | Provider<T | undefined>\ntype TraceWith = (\n label: string,\n opts?: object\n) => <T>(fn: () => Promise<T>) => Promise<T>\n\nexport class WixDataApi {\n private client: ApiClient\n\n constructor(\n clientFactory: HttpApiClientFactory<any>,\n allowGet: boolean,\n private readonly environment?: apiTypes.Environment,\n private readonly gridAppId?: ProvidedOpt<string>,\n private readonly tracer?: TraceWith\n ) {\n this.client = new ApiClient(clientFactory, allowGet)\n }\n\n get wixData(): WixDataApi {\n return this\n }\n\n get filter(): WixDataFilter {\n return filterBuilder()\n }\n\n // NOTE sort method for builder is not implemented\n\n truncate = withArgs(\n async (\n args,\n collectionName: string,\n options?: WixDataOptions\n ): Promise<void> => {\n await apiValidator()\n .arity('truncate', args, 1, 2)\n .collectionName(collectionName)\n .options(options)\n .validateAndReject()\n\n return this.trace('truncate', { collectionName })(async (env) => {\n await this.client.truncateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toOptions(options),\n })\n })\n }\n )\n\n // --- single-item methods ---\n\n get = withArgs(\n async (\n args,\n collectionName: string,\n itemId: string,\n options?: WixDataReadWithProjectionOptions\n ): Promise<WixDataItem | null> => {\n await apiValidator()\n .arity('get', args, 2, 3)\n .collectionName(collectionName)\n .itemId(itemId)\n .options(options)\n .validateAndReject()\n\n return this.trace('get', { collectionName, itemId })(async (env) => {\n const { dataItem } = await this.client\n .getDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItemId: itemId,\n ...toReadOptions(options),\n fields: options?.fields,\n })\n .catch(\n recover(ItemDoesNotExistCode, {} as apiTypes.GetDataItemResponse)\n )\n\n return dataItem ? toDataItem(dataItem) : null\n })\n }\n )\n\n insert = withArgs(\n async (\n args,\n collectionName: string,\n item: Partial<WixDataItem>,\n options?: WixDataUpdateOptions\n ): Promise<WixDataItem> => {\n await apiValidator()\n .arity('insert', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n warnAboutBrokenFields(item)\n\n return this.trace('insert', { collectionName })(async (env) => {\n const { dataItem } = await this.client.insertDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n\n return toDataItem(dataItem!)\n })\n }\n )\n\n save = withArgs(\n async (\n args,\n collectionName: string,\n item: Partial<WixDataItem>,\n options?: WixDataUpdateOptions\n ): Promise<WixDataItem> => {\n await apiValidator()\n .arity('save', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n return this.trace('save', { collectionName })(async (env) => {\n const { dataItem } = await this.client.saveDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n return toDataItem(dataItem!)\n })\n }\n )\n\n update = withArgs(\n async (\n args,\n collectionName: string,\n item: WixDataItem,\n options?: WixDataUpdateOptions\n ) => {\n await apiValidator()\n .arity('update', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n return this.trace('update', { collectionName })(async (env) => {\n const { dataItem } = await this.client.updateDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n return toDataItem(dataItem!)\n })\n }\n )\n\n remove = withArgs(\n async (\n args,\n collectionName: string,\n itemId: string,\n options?: WixDataOptions\n ): Promise<WixDataItem | null> => {\n await apiValidator()\n .arity('remove', args, 2, 3)\n .collectionName(collectionName)\n .itemId(itemId)\n .options(options)\n .validateAndReject()\n\n return this.trace('remove', { collectionName, itemId })(async (env) => {\n const { dataItem } = await this.client\n .removeDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItemId: itemId,\n ...toOptions(options),\n })\n .catch(\n recover(ItemDoesNotExistCode, {} as apiTypes.GetDataItemResponse)\n )\n return dataItem ? toDataItem(dataItem) : null\n })\n }\n )\n\n private toFieldModificationApi = (fieldModification: FieldModification) => {\n switch (fieldModification.action) {\n case 'SET_FIELD':\n return {\n action: apiTypes.ACTION.SET_FIELD,\n fieldPath: fieldModification.fieldPath,\n setFieldOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'REMOVE_FIELD':\n return {\n action: apiTypes.ACTION.REMOVE_FIELD,\n fieldPath: fieldModification.fieldPath,\n }\n case 'INCREMENT_FIELD':\n return {\n action: apiTypes.ACTION.INCREMENT_FIELD,\n fieldPath: fieldModification.fieldPath,\n incrementFieldOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'APPEND_TO_ARRAY':\n return {\n action: apiTypes.ACTION.APPEND_TO_ARRAY,\n fieldPath: fieldModification.fieldPath,\n appendToArrayOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'REMOVE_FROM_ARRAY':\n return {\n action: apiTypes.ACTION.REMOVE_FROM_ARRAY,\n fieldPath: fieldModification.fieldPath,\n removeFromArrayOptions: {\n value: fieldModification.actionOptions,\n },\n }\n default:\n throw new Error('Invalid patch action')\n }\n }\n\n patch = (collectionName: string, itemId: string): WixDataPatch => {\n return new WixDataPatchImpl({\n collectionName,\n itemId,\n onRun: async (_args, patchParams, options) => {\n const fieldModifications = patchParams.fieldModifications.map(\n this.toFieldModificationApi\n )\n\n return this.trace('patch', { collectionName })(async (env) => {\n const result = await this.client.patchDataItem({\n ...env,\n dataCollectionId: patchParams.collectionName,\n patch: {\n dataItemId: patchParams.itemId,\n fieldModifications,\n },\n ...toPatchOptions(options),\n })\n\n return result.dataItem ? toDataItem(result.dataItem) : null\n })\n },\n })\n }\n\n bulkPatch = (collectionName: string, itemIds: string[]): WixDataBulkPatch => {\n return new WixDataBulkPatchImpl({\n collectionName,\n itemIds,\n onRun: async (_args, patchParams, options) => {\n const fieldModifications = patchParams.fieldModifications.map(\n this.toFieldModificationApi\n )\n\n return this.trace('bulkPatch', { collectionName })(async (env) => {\n const { results } = await this.client.bulkPatchDataItems({\n ...env,\n dataCollectionId: patchParams.collectionName,\n patches: patchParams.itemIds.map((itemId) => ({\n dataItemId: itemId,\n fieldModifications,\n })),\n ...toPatchOptions(options),\n })\n\n return toBulkResult(itemIds, results!, ['WDE0073'])\n })\n },\n })\n }\n\n // --- query, count, distinct ---\n\n query = (collectionName: string): WixDataQuery => {\n const ensureValidQuery = (invalidArgs: string[]) => {\n if (invalidArgs.length > 0) {\n throw wdeValidationError(\n messages.queryValidations.queryInvalid(collectionName, invalidArgs)\n )\n }\n }\n\n return new WixDataQueryImpl({\n collectionName,\n onCount: async (args, params, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('count', args, 0, 1)\n .options(options)\n .validateAndReturn(),\n ])\n\n return this.trace('count', { collectionName })(async (env) => {\n const { totalCount } = await this.client.countDataItems({\n ...env,\n dataCollectionId: collectionName,\n filter: params.filterTree,\n ...toReadOptions(options),\n })\n return totalCount!\n })\n },\n onDistinct: async (args, params, field, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('distinct', args, 1, 2)\n .fieldName(field)\n .options(options)\n .validateAndReturn(),\n ])\n\n const order = toSort(params.orderBy).find(\n (o) => o.fieldName === field\n )?.order\n\n const fetch: PageFetcher<any> = (cursorOrOffset, returnTotalCount) =>\n this.trace('distinct', { collectionName, field })(async (env) => {\n const { distinctValues, pagingMetadata } =\n await this.client.queryDistinctValues({\n ...env,\n dataCollectionId: collectionName,\n ...toReadOptions(options),\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...(isOffset(cursorOrOffset)\n ? {\n fieldName: field,\n filter: params.filterTree,\n order,\n returnTotalCount,\n }\n : {}),\n })\n return [distinctValues!, pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n onFind: async (args, params, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('find', args, 0, 1)\n .options(options)\n .validateAndReturn(),\n ])\n\n const fetch: PageFetcher = (cursorOrOffset, returnTotalCount) =>\n this.trace('query', { collectionName })(async (env) => {\n const { dataItems, pagingMetadata } =\n await this.client.queryDataItems({\n ...env,\n dataCollectionId: collectionName,\n query: {\n fields: params.projectedFields,\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...(isOffset(cursorOrOffset)\n ? {\n filter: params.filterTree,\n sort: toSort(params.orderBy),\n }\n : {}),\n },\n referencedItemOptions: params.included,\n ...toReadOptions(options),\n ...(isOffset(cursorOrOffset) ? { returnTotalCount } : {}),\n })\n return [dataItems!.map(toDataItem), pagingMetadata!]\n })\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n })\n }\n\n // NOTE find method is not implemented\n\n fetch = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadOptions\n ): Promise<WixDataResult> => {\n await apiValidator()\n .arity('fetch', args, 2, 4)\n .collectionName(collectionName)\n .isNonEmptyString(cursor, 'cursor')\n .validateAndReject()\n\n const fetch: PageFetcher = (cursorOrOffset) =>\n this.trace('query', { collectionName })(async (env) => {\n const { dataItems, pagingMetadata } =\n await this.client.queryDataItems({\n ...env,\n dataCollectionId: collectionName,\n query: {\n ...toPaging(limit, cursorOrOffset),\n },\n ...toReadOptions(options),\n })\n return [dataItems!.map(toDataItem), pagingMetadata!]\n })\n const [items, paging] = await fetch(cursor)\n\n return new WixDataResultImpl(items, paging, fetch, {\n limitNumber: limit,\n collectionName,\n skipNumber: 0,\n })\n }\n )\n\n // --- aggregate ---\n\n aggregate = (collectionName: string): WixDataAggregate => {\n return new WixDataAggregateImpl({\n collectionName,\n onRun: async (args, params, options) => {\n const validationErrors = [\n ...params.invalidArguments,\n ...apiValidator()\n .arity('run', args, 0, 1)\n .collectionName(collectionName)\n .options(options)\n .validateAndReturn(),\n ]\n\n if (validationErrors.length > 0) {\n throw wdeValidationError(\n messages.aggregateValidations.aggregateInvalid(\n collectionName,\n validationErrors\n )\n )\n }\n\n const fetch: PageFetcher<Record<string, any>> = (\n cursorOrOffset,\n returnTotalCount\n ) =>\n this.trace('aggregate', { collectionName })(async (env) => {\n const toOperation = (field?: string) =>\n field ? { itemFieldName: field } : undefined\n\n const { results, pagingMetadata } =\n await this.client.aggregateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...toReadOptions(options),\n ...(isOffset(cursorOrOffset)\n ? {\n initialFilter: params.filterTree,\n aggregation: {\n groupingFields: params.groupBy,\n operations: params.aggregates.map((a) => ({\n resultFieldName: a.name,\n average: toOperation(a.avg),\n min: toOperation(a.min),\n max: toOperation(a.max),\n sum: toOperation(a.sum),\n itemCount: a.count ? {} : undefined,\n })),\n },\n finalFilter: params.havingTree,\n sort: toSort(params.orderBy),\n returnTotalCount,\n }\n : {}),\n })\n return [unwrapAggregationId(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n })\n }\n\n fetchAggregate = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadOptions\n ) => {\n await apiValidator()\n .arity('fetchAggregate', args, 2, 4)\n .collectionName(collectionName)\n .isNonEmptyString(cursor, 'cursor')\n .validateAndReject()\n\n const fetch: PageFetcher<Record<string, any>> = (cursorOrOffset) =>\n this.trace('aggregate', { collectionName })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.aggregateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toPaging(limit, cursorOrOffset),\n ...toReadOptions(options),\n })\n return [unwrapAggregationId(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(cursor, true)\n\n return new WixDataResultImpl(items, paging, fetch, {\n limitNumber: limit,\n skipNumber: 0,\n collectionName,\n })\n }\n )\n\n // --- bulk methods ---\n\n bulkRemove = withArgs(\n async (\n args,\n collectionName: string,\n itemIds: string[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkRemove', args, 2, 3)\n .collectionName(collectionName)\n .itemIds(itemIds, collectionName)\n .bulkRemoveOptions(options)\n .validateAndReject()\n\n return this.trace('bulkRemove', { collectionName })(async (env) => {\n const { results } = await this.client.bulkRemoveDataItems({\n ...env,\n dataCollectionId: collectionName,\n dataItemIds: itemIds,\n ...toOptions(options),\n })\n // Non-existing items are skipped and not reported as errors.\n return toBulkResult(itemIds, results!, ['WDE0073'])\n })\n }\n )\n\n private async runBulkSave(\n env: { environment?: apiTypes.Environment; appId?: string },\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions,\n overrideExisting: boolean = true\n ): Promise<WixDataBulkResult> {\n const request: apiTypes.BulkInsertDataItemsRequest = {\n ...env,\n dataCollectionId: collectionName,\n dataItems: items.map((data) => ({\n id: data._id,\n data,\n })),\n ...toOptions(options),\n }\n const { results } = await (overrideExisting\n ? this.client.bulkSaveDataItems(request)\n : this.client.bulkInsertDataItems(request))\n const ignoreCodes = overrideExisting ? [] : ['WDE0074']\n return toBulkResult(items, results!, ignoreCodes)\n }\n\n bulkInsert = withArgs(\n async (\n args,\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions & { overrideExisting?: boolean }\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkInsert', args, 2, 3)\n .items(items, collectionName)\n .bulkInsertOptions(options)\n .collectionName(collectionName)\n .validateAndReject()\n\n return this.trace('bulkInsert', { collectionName, options })(\n async (appId) =>\n this.runBulkSave(\n appId,\n collectionName,\n items,\n options,\n options?.overrideExisting ?? false\n )\n )\n }\n )\n\n bulkSave = withArgs(\n async (\n args,\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkSave', args, 2, 3)\n .bulkInsertOptions(options)\n .collectionName(collectionName)\n .items(items, collectionName)\n .validateAndReject()\n\n return this.trace('bulkSave', { collectionName })(async (env) =>\n this.runBulkSave(env, collectionName, items, options)\n )\n }\n )\n\n bulkUpdate = withArgs(\n async (\n args,\n collectionName: string,\n items: WixDataItem[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkUpdate', args, 2, 3)\n .bulkUpdateOptions(options)\n .collectionName(collectionName)\n .items(items, collectionName)\n .validateAndReject()\n\n return this.trace('bulkUpdate', { collectionName })(async (env) => {\n const { results } = await this.client.bulkUpdateDataItems({\n ...env,\n dataCollectionId: collectionName,\n dataItems: items.map((data) => ({\n id: data._id,\n data,\n })),\n ...toOptions(options),\n })\n // Non-existing items are skipped and not reported as errors.\n return toBulkResult(items, results!, ['WDE0073'])\n })\n }\n )\n\n // --- references ---\n\n fetchReferenced = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadWithProjectionOptions\n ): Promise<WixDataResult<WixDataItem | string>> => {\n await apiValidator()\n .arity('fetchReferenced', args, 2, 4)\n .isNonEmptyString(cursor, 'cursor')\n .collectionName(collectionName)\n .validateAndReject()\n\n const fetch: PageFetcher<WixDataItem | string> = (current) =>\n this.trace('fetchReferenced', { collectionName })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.queryReferencedDataItems({\n ...env,\n ...toPaging(limit, current),\n ...toReadOptions(options),\n dataCollectionId: collectionName,\n fields: options?.fields,\n })\n return [onlyReferencedItems(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(cursor)\n return new WixDataResultImpl(items, paging, fetch, {\n collectionName,\n limitNumber: limit,\n skipNumber: 0,\n })\n }\n )\n\n queryReferenced = withArgs(\n async (\n args,\n collectionName: string,\n holdingItem: WixDataItemOrId,\n relationshipAttribute: string,\n options?: WixDataQueryReferencedOptions\n ): Promise<WixDataResult> => {\n await apiValidator()\n .arity('queryReferenced', args, 3, 4)\n .collectionName(collectionName)\n .referenceParameter(holdingItem)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .options(options)\n .validateAndReject()\n\n const id = itemId(holdingItem)\n const fetch: PageFetcher = (cursorOrOffset, returnTotalCount) =>\n this.trace('queryReferenced', {\n collectionName,\n itemId: id,\n options,\n relationshipAttribute,\n })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.queryReferencedDataItems({\n ...env,\n ...toPaging(options?.limit ?? 50, cursorOrOffset),\n ...toReadOptions(options),\n dataCollectionId: collectionName,\n fields: options?.fields,\n ...(isOffset(cursorOrOffset)\n ? {\n referringItemId: id,\n referringItemFieldName: relationshipAttribute,\n order:\n options?.order === 'asc'\n ? apiTypes.SortOrder.ASC\n : options?.order === 'desc'\n ? apiTypes.SortOrder.DESC\n : undefined,\n returnTotalCount,\n }\n : {}),\n })\n return [onlyReferencedItems(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n options?.skip ?? 0,\n options?.returnTotalCount\n )\n return new WixDataResultImpl(items, paging, fetch, {\n collectionName,\n limitNumber: options?.limit ?? 50,\n skipNumber: options?.skip ?? 0,\n })\n }\n )\n\n insertReference: {\n // overload with array of references\n (\n collectionName: string,\n refs: WixDataReference[],\n options?: WixDataOptions\n ): Promise<void>\n // overload with separate left and right(s)\n (\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ): Promise<void>\n } = withArgs(\n async (\n args,\n collectionName: string,\n refsOrAttr: any,\n leftOrOpts?: any,\n right?: any,\n options?: any\n ) => {\n let refs: WixDataReference[]\n let opts: WixDataOptions\n let argc: [number, number]\n\n if (typeof refsOrAttr === 'string') {\n const rights: WixDataItemOrId[] = asArray(right)\n refs = rights.map((r) => ({\n relationshipName: refsOrAttr,\n left: leftOrOpts as WixDataItemOrId,\n right: r,\n }))\n opts = options\n argc = [4, 5]\n } else {\n refs = refsOrAttr\n opts = leftOrOpts\n argc = [2, 3]\n }\n await apiValidator()\n .arity('insertReference', args, ...argc)\n .collectionName(collectionName)\n .references(refs)\n .options(opts)\n .validateAndReject()\n\n await this.trace('insertReference', { collectionName })(async (env) =>\n this.client.bulkInsertDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n dataItemReferences: refs.map((r) => ({\n referringItemFieldName: r.relationshipName,\n referringItemId: itemId(r.left),\n referencedItemId: itemId(r.right),\n })),\n ...toOptions(opts),\n })\n )\n }\n )\n\n replaceReferences = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ): Promise<void> => {\n const rights = asArray(right)\n await apiValidator()\n .arity('replaceReferences', args, 4, 5)\n .collectionName(collectionName)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .referenceParameter(left)\n .referenceParameters(rights)\n .options(options)\n .validateAndReject()\n\n await this.trace('replaceReferences', {\n collectionName,\n relationshipAttribute,\n })(async (env) =>\n this.client.replaceDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n newReferencedItemIds: rights.map(itemId),\n ...toOptions(options),\n })\n )\n }\n )\n\n removeReference = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ) => {\n const rights = asArray(right)\n await apiValidator()\n .arity('removeReference', args, 4, 5)\n .collectionName(collectionName)\n .referenceParameter(left)\n .referenceRemoveParameters(rights)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .options(options)\n .validateAndReject()\n\n await this.trace('removeReference', {\n collectionName,\n relationshipAttribute,\n })(async (env) =>\n this.client.bulkRemoveDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n dataItemReferences: rights.map((r) => ({\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n referencedItemId: itemId(r),\n })),\n ...toOptions(options),\n })\n )\n }\n )\n\n isReferenced = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId,\n options?: WixDataReadOptions\n ): Promise<boolean> => {\n await apiValidator()\n .arity('isReferenced', args, 4, 5)\n .collectionName(collectionName)\n .referenceParameter(left)\n .referenceParameter(right)\n .options(options)\n .validateAndReject()\n\n return this.trace('isReferenced', {\n collectionName,\n relationshipAttribute,\n })(async (env) => {\n const { isReferenced } = await this.client.isReferencedDataItem({\n ...env,\n dataCollectionId: collectionName,\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n referencedItemId: itemId(right),\n ...toReadOptions(options),\n consistentRead: options?.consistentRead,\n })\n return isReferenced!\n })\n }\n )\n\n private trace(\n action: string,\n opts: object\n ): <R>(\n fn: (env: {\n environment?: apiTypes.Environment\n appId?: string\n }) => Promise<R>\n ) => Promise<R> {\n return async (fn) => {\n const gridAppId = await get(this.gridAppId)\n const env = { appId: gridAppId, environment: this.environment }\n if (this.tracer) {\n return this.tracer(`WixDataApi.${action}`, {\n ...opts,\n gridAppId,\n environment: this.environment,\n })(() => fn(env))\n }\n return fn(env)\n }\n }\n}\n\nfunction withArgs<Args extends any[], R>(\n fn: (all: IArguments, ...args: Args) => R\n): (...args: Args) => R {\n return function (...args) {\n return fn(arguments, ...args)\n }\n}\n\nfunction toPatchOptions(options?: WixDataPatchOptions) {\n return {\n suppressHooks: options?.suppressHooks,\n ...draftsOptions(options?.showDrafts),\n }\n}\n\nfunction toUpdateOptions(options?: WixDataUpdateOptions) {\n return {\n ...toOptions(options),\n includeReferencedItems: options?.includeReferences,\n }\n}\n\nfunction toOptions(opts?: WixDataOptions) {\n if (!opts) {\n return undefined\n }\n const res = {\n suppressHooks: opts.suppressHooks,\n appOptions: opts.appOptions,\n ...draftsOptions(opts?.showDrafts),\n }\n if (Object.entries(res).every((kv) => kv[1] === undefined)) {\n return undefined\n }\n return res\n}\n\nfunction toReadOptions(options?: WixDataReadOptions) {\n return {\n suppressHooks: options?.suppressHooks,\n appOptions: options?.appOptions,\n ...draftsOptions(options?.showDrafts),\n consistentRead: options?.consistentRead,\n language: options?.language,\n }\n}\n\nfunction draftsOptions(showDrafts?: boolean) {\n return showDrafts !== undefined\n ? { publishPluginOptions: { includeDraftItems: showDrafts } }\n : {}\n}\n\nfunction toDataItem(item: apiTypes.DataItem): WixDataItem {\n return item.data as WixDataItem\n}\n\nfunction toPaging(limit: number | undefined, cursorOrOffset: string | number) {\n return typeof cursorOrOffset === 'string'\n ? {\n cursorPaging: {\n limit,\n cursor: cursorOrOffset,\n },\n }\n : limit !== undefined || cursorOrOffset > 0\n ? {\n paging: {\n limit,\n offset: cursorOrOffset,\n },\n }\n : {}\n}\n\nfunction toSort(orderBy: QueryParams['orderBy']): apiTypes.Sorting[] {\n return orderBy.map((fieldOrder) => {\n const [[fieldName, sort]] = Object.entries(fieldOrder)\n const order =\n sort === 'asc'\n ? apiTypes.SortOrder.ASC\n : sort === 'desc'\n ? apiTypes.SortOrder.DESC\n : undefined\n return { fieldName, order }\n })\n}\n\nasync function get<T>(providerOrValue: T | Provider<T>): Promise<T> {\n if (typeof (providerOrValue as any)?.get === 'function') {\n return (providerOrValue as Provider<T>).get()\n }\n return providerOrValue as T\n}\n\nfunction recover<T>(code: string, value: T): (error: unknown) => Promise<T> {\n return (error) => {\n if (\n error instanceof Error &&\n (error as any)?.details?.applicationError?.code === code\n ) {\n return Promise.resolve(value)\n }\n return Promise.reject(error)\n }\n}\n\nfunction warnAboutBrokenFields(item: Partial<WixDataItem>) {\n const hasFieldWithDollar = hasField(item, (key) => key.startsWith('$'))\n const hasFieldWithDot = hasField(item, (key) => key.includes('.'))\n if (hasFieldWithDollar) {\n console.error(\n \"Data inserted contains field name prefixed with symbol '$'. It is not recommended to use such field names as it will not work with some data operations.\"\n )\n }\n if (hasFieldWithDot) {\n console.warn(\n \"Data inserted contains field name containing symbol '.'. It is not recommended to use such field names as it will not work with some data operations.\"\n )\n }\n}\n\nfunction toBulkResult(\n request: any[],\n results: apiTypes.BulkDataItemResult[],\n ignoreCodes: string[] = []\n): WixDataBulkResult {\n const errors = results.flatMap((r) => {\n if (r.itemMetadata?.success || !r.itemMetadata?.error) {\n return []\n }\n if (ignoreCodes.includes(r.itemMetadata.error.code ?? '')) {\n return []\n }\n return [\n new BulkError(\n r.itemMetadata.error.description!,\n r.itemMetadata.error.code!,\n request[r.itemMetadata.originalIndex!],\n 'BulkError',\n r.itemMetadata.originalIndex!\n ),\n ]\n })\n const success = results.filter((r) => r.itemMetadata?.success)\n const inserted = success.filter(\n (r) => r.action === apiTypes.BulkActionType.INSERT\n )\n const updated = success.filter(\n (r) =>\n r.action === apiTypes.BulkActionType.UPDATE ||\n r.action === apiTypes.BulkActionType.PATCH\n )\n const removed = success.filter(\n (r) => r.action === apiTypes.BulkActionType.DELETE\n )\n return {\n inserted: inserted.length,\n updated: updated.length,\n removed: removed.length,\n skipped: request.length - errors.length - success.length,\n errors,\n insertedItemIds: inserted.map((r) => r.itemMetadata?.id!),\n updatedItemIds: updated.map((r) => r.itemMetadata?.id!),\n removedItemIds: removed.map((r) => r.itemMetadata?.id!),\n }\n}\n\nfunction unwrapAggregationId(\n items: Record<string, any>[]\n): Record<string, any>[] {\n // When grouping by one field WixDataService returns value on _id field directly, DataItemService wraps it in an object, i.e.\n // grouping by surname returns {_id: 'Simpson'} in WixDataService vs {_id: {surname: 'Simpson'}} in DataItemService\n // When grouping by more fields, values are kept wrapped.\n return items.map((item) => {\n const id = item._id\n if (isObject(id)) {\n const [key, ...rest] = Object.keys(id)\n if (rest.length === 0) {\n item._id = id[key]\n return item\n }\n }\n return item\n })\n}\n\nfunction onlyReferencedItems(\n results: apiTypes.ReferencedResult[]\n): WixDataItem[] {\n return results\n .map((result) => result.dataItem)\n .filter(notEmpty)\n .map(toDataItem)\n}\n\nfunction notEmpty<T>(value: T | null | undefined): value is T {\n return value != null\n}\n\nfunction itemId(item: WixDataItemOrId): string {\n return typeof item === 'string' ? item : item._id\n}\n\nfunction asArray<T>(xOrXs: T | T[]): T[] {\n return isArray(xOrXs) ? (xOrXs as T[]) : [xOrXs as T]\n}\n\nfunction isOffset(cursorOrOffset: string | number) {\n return typeof cursorOrOffset === 'number'\n}\n\nconst ItemDoesNotExistCode = 'WDE0073'\n\nfunction apiValidator() {\n return commonApiValidator(wdeValidationError)\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAC,uBAAA,CAAAF,OAAA;A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,CAAC1C,QAAQ,CAAC,CAChCkE,MAAM,CAAC+K,QAAQ,CAAC,CAChBzM,GAAG,CAAChC,UAAU,CAAC;AACpB;AAEA,SAASyO,QAAQA,CAAIxN,KAA2B,EAAc;EAC5D,OAAOA,KAAK,IAAI,IAAI;AACtB;AAEA,SAAS1B,MAAMA,CAACU,IAAqB,EAAU;EAC7C,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACI,GAAG;AACnD;AAEA,SAAS8I,OAAOA,CAAIuF,KAAc,EAAO;EACvC,OAAO,IAAAC,cAAO,EAACD,KAAK,CAAC,GAAIA,KAAK,GAAW,CAACA,KAAK,CAAM;AACvD;AAEA,SAAS7J,QAAQA,CAACP,cAA+B,EAAE;EACjD,OAAO,OAAOA,cAAc,KAAK,QAAQ;AAC3C;AAEA,MAAMvE,oBAAoB,GAAG,SAAS;AAEtC,SAASjB,YAAYA,CAAA,EAAG;EACtB,OAAO,IAAA8P,oBAAkB,EAAC7L,0BAAkB,CAAC;AAC/C"}
1
+ {"version":3,"names":["_errors","require","apiTypes","_interopRequireWildcard","_utils","_common","_WixDataQueryImpl","_WixDataResultImpl","_WixDataAggregateImpl","_ApiClient","_WixDataPatchImpl","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","WixDataApi","constructor","clientFactory","allowGet","environment","gridAppId","tracer","_defineProperty2","withArgs","args","collectionName","options","apiValidator","arity","validateAndReject","trace","env","client","truncateDataItems","dataCollectionId","toOptions","itemId","dataItem","getDataItem","dataItemId","toReadOptions","fields","catch","recover","ItemDoesNotExistCode","toDataItem","item","warnAboutBrokenFields","insertDataItem","id","_id","data","toUpdateOptions","saveDataItem","updateDataItem","removeDataItem","fieldModification","action","ACTION","SET_FIELD","fieldPath","setFieldOptions","value","actionOptions","REMOVE_FIELD","INCREMENT_FIELD","incrementFieldOptions","APPEND_TO_ARRAY","appendToArrayOptions","REMOVE_FROM_ARRAY","removeFromArrayOptions","Error","WixDataPatchImpl","onRun","_args","patchParams","fieldModifications","map","toFieldModificationApi","result","patchDataItem","patch","toPatchOptions","itemIds","WixDataBulkPatchImpl","results","bulkPatchDataItems","patches","toBulkResult","ensureValidQuery","invalidArgs","length","wdeValidationError","messages","queryValidations","queryInvalid","WixDataQueryImpl","onCount","params","invalidArguments","validateAndReturn","totalCount","countDataItems","filter","filterTree","onDistinct","field","_toSort$find","fieldName","order","toSort","orderBy","find","o","fetch","cursorOrOffset","returnTotalCount","distinctValues","pagingMetadata","queryDistinctValues","toPaging","limitNumber","isOffset","items","paging","skipNumber","WixDataResultImpl","onFind","dataItems","queryDataItems","query","projectedFields","sort","referencedItemOptions","included","cursor","limit","isNonEmptyString","WixDataAggregateImpl","validationErrors","aggregateValidations","aggregateInvalid","toOperation","itemFieldName","undefined","aggregateDataItems","initialFilter","aggregation","groupingFields","groupBy","operations","aggregates","resultFieldName","name","average","avg","min","max","sum","itemCount","count","finalFilter","havingTree","unwrapAggregationId","bulkRemoveOptions","bulkRemoveDataItems","dataItemIds","bulkInsertOptions","appId","runBulkSave","overrideExisting","bulkUpdateOptions","bulkUpdateDataItems","current","queryReferencedDataItems","onlyReferencedItems","holdingItem","relationshipAttribute","referenceParameter","referringItemId","referringItemFieldName","SortOrder","ASC","DESC","skip","refsOrAttr","leftOrOpts","right","refs","opts","argc","rights","asArray","relationshipName","left","references","bulkInsertDataItemReferences","dataItemReferences","referencedItemId","referenceParameters","replaceDataItemReferences","newReferencedItemIds","referenceRemoveParameters","bulkRemoveDataItemReferences","isReferenced","isReferencedDataItem","consistentRead","ApiClient","wixData","filterBuilder","request","bulkSaveDataItems","bulkInsertDataItems","ignoreCodes","fn","exports","arguments","suppressHooks","draftsOptions","showDrafts","includeReferencedItems","includeReferences","res","appOptions","entries","every","kv","language","publishPluginOptions","includeDraftItems","cursorPaging","offset","fieldOrder","providerOrValue","code","error","_details","details","applicationError","Promise","resolve","reject","hasFieldWithDollar","hasField","key","startsWith","hasFieldWithDot","includes","console","warn","errors","flatMap","_r$itemMetadata","_r$itemMetadata2","itemMetadata","success","BulkError","description","originalIndex","_r$itemMetadata3","inserted","BulkActionType","INSERT","updated","UPDATE","PATCH","removed","DELETE","skipped","insertedItemIds","_r$itemMetadata4","updatedItemIds","_r$itemMetadata5","removedItemIds","_r$itemMetadata6","isObject","rest","keys","notEmpty","xOrXs","isArray","commonApiValidator"],"sources":["../../../src/api/WixDataApi.ts"],"sourcesContent":["import {\n apiValidator as commonApiValidator,\n messages,\n BulkError,\n wdeValidationError,\n} from '../errors'\nimport { HttpApiClientFactory } from '../types'\nimport * as apiTypes from '../types/data-item-types'\n\nimport { hasField, isObject, isArray } from '../utils'\nimport { filterBuilder } from './common'\nimport {\n Provider,\n WixDataBulkResult,\n WixDataItem,\n WixDataItemOrId,\n WixDataOptions,\n WixDataPatchOptions,\n WixDataQueryReferencedOptions,\n WixDataReadOptions,\n WixDataReadWithProjectionOptions,\n WixDataReference,\n WixDataUpdateOptions,\n} from './types'\nimport { QueryParams, WixDataQueryImpl } from './impl/WixDataQueryImpl'\nimport { WixDataQuery } from './WixDataQuery'\nimport { WixDataResultImpl, PageFetcher } from './impl/WixDataResultImpl'\nimport { WixDataAggregateImpl } from './impl/WixDataAggregateImpl'\nimport { ApiClient } from './ApiClient'\nimport {\n WixDataPatch,\n FieldModification,\n WixDataBulkPatch,\n} from './WixDataPatch'\nimport { WixDataAggregate } from './WixDataAggregate'\nimport { WixDataFilter } from './WixDataFilter'\nimport { WixDataResult } from './WixDataResult'\nimport { WixDataBulkPatchImpl, WixDataPatchImpl } from './impl/WixDataPatchImpl'\n\ntype ProvidedOpt<T> = T | undefined | Provider<T | undefined>\ntype TraceWith = (\n label: string,\n opts?: object\n) => <T>(fn: () => Promise<T>) => Promise<T>\n\nexport class WixDataApi {\n private client: ApiClient\n\n constructor(\n clientFactory: HttpApiClientFactory<any>,\n allowGet: boolean,\n private readonly environment?: apiTypes.Environment,\n private readonly gridAppId?: ProvidedOpt<string>,\n private readonly tracer?: TraceWith\n ) {\n this.client = new ApiClient(clientFactory, allowGet)\n }\n\n get wixData(): WixDataApi {\n return this\n }\n\n get filter(): WixDataFilter {\n return filterBuilder()\n }\n\n // NOTE sort method for builder is not implemented\n\n truncate = withArgs(\n async (\n args,\n collectionName: string,\n options?: WixDataOptions\n ): Promise<void> => {\n await apiValidator()\n .arity('truncate', args, 1, 2)\n .collectionName(collectionName)\n .options(options)\n .validateAndReject()\n\n return this.trace('truncate', { collectionName })(async (env) => {\n await this.client.truncateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toOptions(options),\n })\n })\n }\n )\n\n // --- single-item methods ---\n\n get = withArgs(\n async (\n args,\n collectionName: string,\n itemId: string,\n options?: WixDataReadWithProjectionOptions\n ): Promise<WixDataItem | null> => {\n await apiValidator()\n .arity('get', args, 2, 3)\n .collectionName(collectionName)\n .itemId(itemId)\n .options(options)\n .validateAndReject()\n\n return this.trace('get', { collectionName, itemId })(async (env) => {\n const { dataItem } = await this.client\n .getDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItemId: itemId,\n ...toReadOptions(options),\n fields: options?.fields,\n })\n .catch(\n recover(ItemDoesNotExistCode, {} as apiTypes.GetDataItemResponse)\n )\n\n return dataItem ? toDataItem(dataItem) : null\n })\n }\n )\n\n insert = withArgs(\n async (\n args,\n collectionName: string,\n item: Partial<WixDataItem>,\n options?: WixDataUpdateOptions\n ): Promise<WixDataItem> => {\n await apiValidator()\n .arity('insert', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n warnAboutBrokenFields(item)\n\n return this.trace('insert', { collectionName })(async (env) => {\n const { dataItem } = await this.client.insertDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n\n return toDataItem(dataItem!)\n })\n }\n )\n\n save = withArgs(\n async (\n args,\n collectionName: string,\n item: Partial<WixDataItem>,\n options?: WixDataUpdateOptions\n ): Promise<WixDataItem> => {\n await apiValidator()\n .arity('save', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n return this.trace('save', { collectionName })(async (env) => {\n const { dataItem } = await this.client.saveDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n return toDataItem(dataItem!)\n })\n }\n )\n\n update = withArgs(\n async (\n args,\n collectionName: string,\n item: WixDataItem,\n options?: WixDataUpdateOptions\n ) => {\n await apiValidator()\n .arity('update', args, 2, 3)\n .collectionName(collectionName)\n .item(item, collectionName, false)\n .options(options)\n .validateAndReject()\n\n return this.trace('update', { collectionName })(async (env) => {\n const { dataItem } = await this.client.updateDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItem: {\n id: item._id,\n data: item,\n },\n ...toUpdateOptions(options),\n })\n return toDataItem(dataItem!)\n })\n }\n )\n\n remove = withArgs(\n async (\n args,\n collectionName: string,\n itemId: string,\n options?: WixDataOptions\n ): Promise<WixDataItem | null> => {\n await apiValidator()\n .arity('remove', args, 2, 3)\n .collectionName(collectionName)\n .itemId(itemId)\n .options(options)\n .validateAndReject()\n\n return this.trace('remove', { collectionName, itemId })(async (env) => {\n const { dataItem } = await this.client\n .removeDataItem({\n ...env,\n dataCollectionId: collectionName,\n dataItemId: itemId,\n ...toOptions(options),\n })\n .catch(\n recover(ItemDoesNotExistCode, {} as apiTypes.GetDataItemResponse)\n )\n return dataItem ? toDataItem(dataItem) : null\n })\n }\n )\n\n private toFieldModificationApi = (fieldModification: FieldModification) => {\n switch (fieldModification.action) {\n case 'SET_FIELD':\n return {\n action: apiTypes.ACTION.SET_FIELD,\n fieldPath: fieldModification.fieldPath,\n setFieldOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'REMOVE_FIELD':\n return {\n action: apiTypes.ACTION.REMOVE_FIELD,\n fieldPath: fieldModification.fieldPath,\n }\n case 'INCREMENT_FIELD':\n return {\n action: apiTypes.ACTION.INCREMENT_FIELD,\n fieldPath: fieldModification.fieldPath,\n incrementFieldOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'APPEND_TO_ARRAY':\n return {\n action: apiTypes.ACTION.APPEND_TO_ARRAY,\n fieldPath: fieldModification.fieldPath,\n appendToArrayOptions: {\n value: fieldModification.actionOptions,\n },\n }\n case 'REMOVE_FROM_ARRAY':\n return {\n action: apiTypes.ACTION.REMOVE_FROM_ARRAY,\n fieldPath: fieldModification.fieldPath,\n removeFromArrayOptions: {\n value: fieldModification.actionOptions,\n },\n }\n default:\n throw new Error('Invalid patch action')\n }\n }\n\n patch = (collectionName: string, itemId: string): WixDataPatch => {\n return new WixDataPatchImpl({\n collectionName,\n itemId,\n onRun: async (_args, patchParams, options) => {\n const fieldModifications = patchParams.fieldModifications.map(\n this.toFieldModificationApi\n )\n\n return this.trace('patch', { collectionName })(async (env) => {\n const result = await this.client.patchDataItem({\n ...env,\n dataCollectionId: patchParams.collectionName,\n patch: {\n dataItemId: patchParams.itemId,\n fieldModifications,\n },\n ...toPatchOptions(options),\n })\n\n return result.dataItem ? toDataItem(result.dataItem) : null\n })\n },\n })\n }\n\n bulkPatch = (collectionName: string, itemIds: string[]): WixDataBulkPatch => {\n return new WixDataBulkPatchImpl({\n collectionName,\n itemIds,\n onRun: async (_args, patchParams, options) => {\n const fieldModifications = patchParams.fieldModifications.map(\n this.toFieldModificationApi\n )\n\n return this.trace('bulkPatch', { collectionName })(async (env) => {\n const { results } = await this.client.bulkPatchDataItems({\n ...env,\n dataCollectionId: patchParams.collectionName,\n patches: patchParams.itemIds.map((itemId) => ({\n dataItemId: itemId,\n fieldModifications,\n })),\n ...toPatchOptions(options),\n })\n\n return toBulkResult(itemIds, results!, ['WDE0073'])\n })\n },\n })\n }\n\n // --- query, count, distinct ---\n\n query = (collectionName: string): WixDataQuery => {\n const ensureValidQuery = (invalidArgs: string[]) => {\n if (invalidArgs.length > 0) {\n throw wdeValidationError(\n messages.queryValidations.queryInvalid(collectionName, invalidArgs)\n )\n }\n }\n\n return new WixDataQueryImpl({\n collectionName,\n onCount: async (args, params, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('count', args, 0, 1)\n .options(options)\n .validateAndReturn(),\n ])\n\n return this.trace('count', { collectionName })(async (env) => {\n const { totalCount } = await this.client.countDataItems({\n ...env,\n dataCollectionId: collectionName,\n filter: params.filterTree,\n ...toReadOptions(options),\n })\n return totalCount!\n })\n },\n onDistinct: async (args, params, field, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('distinct', args, 1, 2)\n .fieldName(field)\n .options(options)\n .validateAndReturn(),\n ])\n\n const order = toSort(params.orderBy).find(\n (o) => o.fieldName === field\n )?.order\n\n const fetch: PageFetcher<any> = (cursorOrOffset, returnTotalCount) =>\n this.trace('distinct', { collectionName, field })(async (env) => {\n const { distinctValues, pagingMetadata } =\n await this.client.queryDistinctValues({\n ...env,\n dataCollectionId: collectionName,\n ...toReadOptions(options),\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...(isOffset(cursorOrOffset)\n ? {\n fieldName: field,\n filter: params.filterTree,\n order,\n returnTotalCount,\n }\n : {}),\n })\n return [distinctValues!, pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n onFind: async (args, params, options) => {\n ensureValidQuery([\n ...params.invalidArguments,\n ...apiValidator()\n .collectionName(collectionName)\n .arity('find', args, 0, 1)\n .options(options)\n .validateAndReturn(),\n ])\n\n const fetch: PageFetcher = (cursorOrOffset, returnTotalCount) =>\n this.trace('query', { collectionName })(async (env) => {\n const { dataItems, pagingMetadata } =\n await this.client.queryDataItems({\n ...env,\n dataCollectionId: collectionName,\n query: {\n fields: params.projectedFields,\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...(isOffset(cursorOrOffset)\n ? {\n filter: params.filterTree,\n sort: toSort(params.orderBy),\n }\n : {}),\n },\n referencedItemOptions: params.included,\n ...toReadOptions(options),\n ...(isOffset(cursorOrOffset) ? { returnTotalCount } : {}),\n })\n return [dataItems!.map(toDataItem), pagingMetadata!]\n })\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n })\n }\n\n // NOTE find method is not implemented\n\n fetch = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadOptions\n ): Promise<WixDataResult> => {\n await apiValidator()\n .arity('fetch', args, 2, 4)\n .collectionName(collectionName)\n .isNonEmptyString(cursor, 'cursor')\n .validateAndReject()\n\n const fetch: PageFetcher = (cursorOrOffset) =>\n this.trace('query', { collectionName })(async (env) => {\n const { dataItems, pagingMetadata } =\n await this.client.queryDataItems({\n ...env,\n dataCollectionId: collectionName,\n query: {\n ...toPaging(limit, cursorOrOffset),\n },\n ...toReadOptions(options),\n })\n return [dataItems!.map(toDataItem), pagingMetadata!]\n })\n const [items, paging] = await fetch(cursor)\n\n return new WixDataResultImpl(items, paging, fetch, {\n limitNumber: limit,\n collectionName,\n skipNumber: 0,\n })\n }\n )\n\n // --- aggregate ---\n\n aggregate = (collectionName: string): WixDataAggregate => {\n return new WixDataAggregateImpl({\n collectionName,\n onRun: async (args, params, options) => {\n const validationErrors = [\n ...params.invalidArguments,\n ...apiValidator()\n .arity('run', args, 0, 1)\n .collectionName(collectionName)\n .options(options)\n .validateAndReturn(),\n ]\n\n if (validationErrors.length > 0) {\n throw wdeValidationError(\n messages.aggregateValidations.aggregateInvalid(\n collectionName,\n validationErrors\n )\n )\n }\n\n const fetch: PageFetcher<Record<string, any>> = (\n cursorOrOffset,\n returnTotalCount\n ) =>\n this.trace('aggregate', { collectionName })(async (env) => {\n const toOperation = (field?: string) =>\n field ? { itemFieldName: field } : undefined\n\n const { results, pagingMetadata } =\n await this.client.aggregateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toPaging(params.limitNumber, cursorOrOffset),\n ...toReadOptions(options),\n ...(isOffset(cursorOrOffset)\n ? {\n initialFilter: params.filterTree,\n aggregation: {\n groupingFields: params.groupBy,\n operations: params.aggregates.map((a) => ({\n resultFieldName: a.name,\n average: toOperation(a.avg),\n min: toOperation(a.min),\n max: toOperation(a.max),\n sum: toOperation(a.sum),\n itemCount: a.count ? {} : undefined,\n })),\n },\n finalFilter: params.havingTree,\n sort: toSort(params.orderBy),\n returnTotalCount,\n }\n : {}),\n })\n return [unwrapAggregationId(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n params.skipNumber,\n options?.returnTotalCount\n )\n\n return new WixDataResultImpl(items, paging, fetch, params)\n },\n })\n }\n\n fetchAggregate = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadOptions\n ) => {\n await apiValidator()\n .arity('fetchAggregate', args, 2, 4)\n .collectionName(collectionName)\n .isNonEmptyString(cursor, 'cursor')\n .validateAndReject()\n\n const fetch: PageFetcher<Record<string, any>> = (cursorOrOffset) =>\n this.trace('aggregate', { collectionName })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.aggregateDataItems({\n ...env,\n dataCollectionId: collectionName,\n ...toPaging(limit, cursorOrOffset),\n ...toReadOptions(options),\n })\n return [unwrapAggregationId(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(cursor, true)\n\n return new WixDataResultImpl(items, paging, fetch, {\n limitNumber: limit,\n skipNumber: 0,\n collectionName,\n })\n }\n )\n\n // --- bulk methods ---\n\n bulkRemove = withArgs(\n async (\n args,\n collectionName: string,\n itemIds: string[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkRemove', args, 2, 3)\n .collectionName(collectionName)\n .itemIds(itemIds, collectionName)\n .bulkRemoveOptions(options)\n .validateAndReject()\n\n return this.trace('bulkRemove', { collectionName })(async (env) => {\n const { results } = await this.client.bulkRemoveDataItems({\n ...env,\n dataCollectionId: collectionName,\n dataItemIds: itemIds,\n ...toOptions(options),\n })\n // Non-existing items are skipped and not reported as errors.\n return toBulkResult(itemIds, results!, ['WDE0073'])\n })\n }\n )\n\n private async runBulkSave(\n env: { environment?: apiTypes.Environment; appId?: string },\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions,\n overrideExisting: boolean = true\n ): Promise<WixDataBulkResult> {\n const request: apiTypes.BulkInsertDataItemsRequest = {\n ...env,\n dataCollectionId: collectionName,\n dataItems: items.map((data) => ({\n id: data._id,\n data,\n })),\n ...toOptions(options),\n }\n const { results } = await (overrideExisting\n ? this.client.bulkSaveDataItems(request)\n : this.client.bulkInsertDataItems(request))\n const ignoreCodes = overrideExisting ? [] : ['WDE0074']\n return toBulkResult(items, results!, ignoreCodes)\n }\n\n bulkInsert = withArgs(\n async (\n args,\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions & { overrideExisting?: boolean }\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkInsert', args, 2, 3)\n .items(items, collectionName)\n .bulkInsertOptions(options)\n .collectionName(collectionName)\n .validateAndReject()\n\n return this.trace('bulkInsert', { collectionName, options })(\n async (appId) =>\n this.runBulkSave(\n appId,\n collectionName,\n items,\n options,\n options?.overrideExisting ?? false\n )\n )\n }\n )\n\n bulkSave = withArgs(\n async (\n args,\n collectionName: string,\n items: Partial<WixDataItem>[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkSave', args, 2, 3)\n .bulkInsertOptions(options)\n .collectionName(collectionName)\n .items(items, collectionName)\n .validateAndReject()\n\n return this.trace('bulkSave', { collectionName })(async (env) =>\n this.runBulkSave(env, collectionName, items, options)\n )\n }\n )\n\n bulkUpdate = withArgs(\n async (\n args,\n collectionName: string,\n items: WixDataItem[],\n options?: WixDataOptions\n ): Promise<WixDataBulkResult> => {\n await apiValidator()\n .arity('bulkUpdate', args, 2, 3)\n .bulkUpdateOptions(options)\n .collectionName(collectionName)\n .items(items, collectionName)\n .validateAndReject()\n\n return this.trace('bulkUpdate', { collectionName })(async (env) => {\n const { results } = await this.client.bulkUpdateDataItems({\n ...env,\n dataCollectionId: collectionName,\n dataItems: items.map((data) => ({\n id: data._id,\n data,\n })),\n ...toOptions(options),\n })\n // Non-existing items are skipped and not reported as errors.\n return toBulkResult(items, results!, ['WDE0073'])\n })\n }\n )\n\n // --- references ---\n\n fetchReferenced = withArgs(\n async (\n args,\n collectionName: string,\n cursor: string,\n limit?: number,\n options?: WixDataReadWithProjectionOptions\n ): Promise<WixDataResult<WixDataItem | string>> => {\n await apiValidator()\n .arity('fetchReferenced', args, 2, 4)\n .isNonEmptyString(cursor, 'cursor')\n .collectionName(collectionName)\n .validateAndReject()\n\n const fetch: PageFetcher<WixDataItem | string> = (current) =>\n this.trace('fetchReferenced', { collectionName })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.queryReferencedDataItems({\n ...env,\n ...toPaging(limit, current),\n ...toReadOptions(options),\n dataCollectionId: collectionName,\n fields: options?.fields,\n })\n return [onlyReferencedItems(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(cursor)\n return new WixDataResultImpl(items, paging, fetch, {\n collectionName,\n limitNumber: limit,\n skipNumber: 0,\n })\n }\n )\n\n queryReferenced = withArgs(\n async (\n args,\n collectionName: string,\n holdingItem: WixDataItemOrId,\n relationshipAttribute: string,\n options?: WixDataQueryReferencedOptions\n ): Promise<WixDataResult> => {\n await apiValidator()\n .arity('queryReferenced', args, 3, 4)\n .collectionName(collectionName)\n .referenceParameter(holdingItem)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .options(options)\n .validateAndReject()\n\n const id = itemId(holdingItem)\n const fetch: PageFetcher = (cursorOrOffset, returnTotalCount) =>\n this.trace('queryReferenced', {\n collectionName,\n itemId: id,\n options,\n relationshipAttribute,\n })(async (env) => {\n const { results, pagingMetadata } =\n await this.client.queryReferencedDataItems({\n ...env,\n ...toPaging(options?.limit ?? 50, cursorOrOffset),\n ...toReadOptions(options),\n dataCollectionId: collectionName,\n fields: options?.fields,\n ...(isOffset(cursorOrOffset)\n ? {\n referringItemId: id,\n referringItemFieldName: relationshipAttribute,\n order:\n options?.order === 'asc'\n ? apiTypes.SortOrder.ASC\n : options?.order === 'desc'\n ? apiTypes.SortOrder.DESC\n : undefined,\n returnTotalCount,\n }\n : {}),\n })\n return [onlyReferencedItems(results!), pagingMetadata!]\n })\n\n const [items, paging] = await fetch(\n options?.skip ?? 0,\n options?.returnTotalCount\n )\n return new WixDataResultImpl(items, paging, fetch, {\n collectionName,\n limitNumber: options?.limit ?? 50,\n skipNumber: options?.skip ?? 0,\n })\n }\n )\n\n insertReference: {\n // overload with array of references\n (\n collectionName: string,\n refs: WixDataReference[],\n options?: WixDataOptions\n ): Promise<void>\n // overload with separate left and right(s)\n (\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ): Promise<void>\n } = withArgs(\n async (\n args,\n collectionName: string,\n refsOrAttr: any,\n leftOrOpts?: any,\n right?: any,\n options?: any\n ) => {\n let refs: WixDataReference[]\n let opts: WixDataOptions\n let argc: [number, number]\n\n if (typeof refsOrAttr === 'string') {\n const rights: WixDataItemOrId[] = asArray(right)\n refs = rights.map((r) => ({\n relationshipName: refsOrAttr,\n left: leftOrOpts as WixDataItemOrId,\n right: r,\n }))\n opts = options\n argc = [4, 5]\n } else {\n refs = refsOrAttr\n opts = leftOrOpts\n argc = [2, 3]\n }\n await apiValidator()\n .arity('insertReference', args, ...argc)\n .collectionName(collectionName)\n .references(refs)\n .options(opts)\n .validateAndReject()\n\n await this.trace('insertReference', { collectionName })(async (env) =>\n this.client.bulkInsertDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n dataItemReferences: refs.map((r) => ({\n referringItemFieldName: r.relationshipName,\n referringItemId: itemId(r.left),\n referencedItemId: itemId(r.right),\n })),\n ...toOptions(opts),\n })\n )\n }\n )\n\n replaceReferences = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ): Promise<void> => {\n const rights = asArray(right)\n await apiValidator()\n .arity('replaceReferences', args, 4, 5)\n .collectionName(collectionName)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .referenceParameter(left)\n .referenceParameters(rights)\n .options(options)\n .validateAndReject()\n\n await this.trace('replaceReferences', {\n collectionName,\n relationshipAttribute,\n })(async (env) =>\n this.client.replaceDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n newReferencedItemIds: rights.map(itemId),\n ...toOptions(options),\n })\n )\n }\n )\n\n removeReference = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId | WixDataItemOrId[],\n options?: WixDataOptions\n ) => {\n const rights = asArray(right)\n await apiValidator()\n .arity('removeReference', args, 4, 5)\n .collectionName(collectionName)\n .referenceParameter(left)\n .referenceRemoveParameters(rights)\n .isNonEmptyString(relationshipAttribute, 'relationshipAttribute')\n .options(options)\n .validateAndReject()\n\n await this.trace('removeReference', {\n collectionName,\n relationshipAttribute,\n })(async (env) =>\n this.client.bulkRemoveDataItemReferences({\n ...env,\n dataCollectionId: collectionName,\n dataItemReferences: rights.map((r) => ({\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n referencedItemId: itemId(r),\n })),\n ...toOptions(options),\n })\n )\n }\n )\n\n isReferenced = withArgs(\n async (\n args,\n collectionName: string,\n relationshipAttribute: string,\n left: WixDataItemOrId,\n right: WixDataItemOrId,\n options?: WixDataReadOptions\n ): Promise<boolean> => {\n await apiValidator()\n .arity('isReferenced', args, 4, 5)\n .collectionName(collectionName)\n .referenceParameter(left)\n .referenceParameter(right)\n .options(options)\n .validateAndReject()\n\n return this.trace('isReferenced', {\n collectionName,\n relationshipAttribute,\n })(async (env) => {\n const { isReferenced } = await this.client.isReferencedDataItem({\n ...env,\n dataCollectionId: collectionName,\n referringItemFieldName: relationshipAttribute,\n referringItemId: itemId(left),\n referencedItemId: itemId(right),\n ...toReadOptions(options),\n consistentRead: options?.consistentRead,\n })\n return isReferenced!\n })\n }\n )\n\n private trace(\n action: string,\n opts: object\n ): <R>(\n fn: (env: {\n environment?: apiTypes.Environment\n appId?: string\n }) => Promise<R>\n ) => Promise<R> {\n return async (fn) => {\n const gridAppId = await get(this.gridAppId)\n const env = { appId: gridAppId, environment: this.environment }\n if (this.tracer) {\n return this.tracer(`WixDataApi.${action}`, {\n ...opts,\n gridAppId,\n environment: this.environment,\n })(() => fn(env))\n }\n return fn(env)\n }\n }\n}\n\nfunction withArgs<Args extends any[], R>(\n fn: (all: IArguments, ...args: Args) => R\n): (...args: Args) => R {\n return function (...args) {\n return fn(arguments, ...args)\n }\n}\n\nfunction toPatchOptions(options?: WixDataPatchOptions) {\n return {\n suppressHooks: options?.suppressHooks,\n ...draftsOptions(options?.showDrafts),\n }\n}\n\nfunction toUpdateOptions(options?: WixDataUpdateOptions) {\n return {\n ...toOptions(options),\n includeReferencedItems: options?.includeReferences,\n }\n}\n\nfunction toOptions(opts?: WixDataOptions) {\n if (!opts) {\n return undefined\n }\n const res = {\n suppressHooks: opts.suppressHooks,\n appOptions: opts.appOptions,\n ...draftsOptions(opts?.showDrafts),\n }\n if (Object.entries(res).every((kv) => kv[1] === undefined)) {\n return undefined\n }\n return res\n}\n\nfunction toReadOptions(options?: WixDataReadOptions) {\n return {\n suppressHooks: options?.suppressHooks,\n appOptions: options?.appOptions,\n ...draftsOptions(options?.showDrafts),\n consistentRead: options?.consistentRead,\n language: options?.language,\n }\n}\n\nfunction draftsOptions(showDrafts?: boolean) {\n return showDrafts !== undefined\n ? { publishPluginOptions: { includeDraftItems: showDrafts } }\n : {}\n}\n\nfunction toDataItem(item: apiTypes.DataItem): WixDataItem {\n return item.data as WixDataItem\n}\n\nfunction toPaging(limit: number | undefined, cursorOrOffset: string | number) {\n return typeof cursorOrOffset === 'string'\n ? {\n cursorPaging: {\n limit,\n cursor: cursorOrOffset,\n },\n }\n : limit !== undefined || cursorOrOffset > 0\n ? {\n paging: {\n limit,\n offset: cursorOrOffset,\n },\n }\n : {}\n}\n\nfunction toSort(orderBy: QueryParams['orderBy']): apiTypes.Sorting[] {\n return orderBy.map((fieldOrder) => {\n const [[fieldName, sort]] = Object.entries(fieldOrder)\n const order =\n sort === 'asc'\n ? apiTypes.SortOrder.ASC\n : sort === 'desc'\n ? apiTypes.SortOrder.DESC\n : undefined\n return { fieldName, order }\n })\n}\n\nasync function get<T>(providerOrValue: T | Provider<T>): Promise<T> {\n if (typeof (providerOrValue as any)?.get === 'function') {\n return (providerOrValue as Provider<T>).get()\n }\n return providerOrValue as T\n}\n\nfunction recover<T>(code: string, value: T): (error: unknown) => Promise<T> {\n return (error) => {\n if (\n error instanceof Error &&\n (error as any)?.details?.applicationError?.code === code\n ) {\n return Promise.resolve(value)\n }\n return Promise.reject(error)\n }\n}\n\nfunction warnAboutBrokenFields(item: Partial<WixDataItem>) {\n const hasFieldWithDollar = hasField(item, (key) => key.startsWith('$'))\n const hasFieldWithDot = hasField(item, (key) => key.includes('.'))\n if (hasFieldWithDollar) {\n console.error(\n \"Data inserted contains field name prefixed with symbol '$'. It is not recommended to use such field names as it will not work with some data operations.\"\n )\n }\n if (hasFieldWithDot) {\n console.warn(\n \"Data inserted contains field name containing symbol '.'. It is not recommended to use such field names as it will not work with some data operations.\"\n )\n }\n}\n\nfunction toBulkResult(\n request: any[],\n results: apiTypes.BulkDataItemResult[],\n ignoreCodes: string[] = []\n): WixDataBulkResult {\n const errors = results.flatMap((r) => {\n if (r.itemMetadata?.success || !r.itemMetadata?.error) {\n return []\n }\n if (ignoreCodes.includes(r.itemMetadata.error.code ?? '')) {\n return []\n }\n return [\n new BulkError(\n r.itemMetadata.error.description!,\n r.itemMetadata.error.code!,\n request[r.itemMetadata.originalIndex!],\n 'BulkError',\n r.itemMetadata.originalIndex!\n ),\n ]\n })\n const success = results.filter((r) => r.itemMetadata?.success)\n const inserted = success.filter(\n (r) => r.action === apiTypes.BulkActionType.INSERT\n )\n const updated = success.filter(\n (r) =>\n r.action === apiTypes.BulkActionType.UPDATE ||\n r.action === apiTypes.BulkActionType.PATCH\n )\n const removed = success.filter(\n (r) => r.action === apiTypes.BulkActionType.DELETE\n )\n return {\n inserted: inserted.length,\n updated: updated.length,\n removed: removed.length,\n skipped: request.length - errors.length - success.length,\n errors,\n insertedItemIds: inserted.map((r) => r.itemMetadata?.id!),\n updatedItemIds: updated.map((r) => r.itemMetadata?.id!),\n removedItemIds: removed.map((r) => r.itemMetadata?.id!),\n }\n}\n\nfunction unwrapAggregationId(\n items: Record<string, any>[]\n): Record<string, any>[] {\n // When grouping by one field WixDataService returns value on _id field directly, DataItemService wraps it in an object, i.e.\n // grouping by surname returns {_id: 'Simpson'} in WixDataService vs {_id: {surname: 'Simpson'}} in DataItemService\n // When grouping by more fields, values are kept wrapped.\n return items.map((item) => {\n const id = item._id\n if (isObject(id)) {\n const [key, ...rest] = Object.keys(id)\n if (rest.length === 0) {\n item._id = id[key]\n return item\n }\n }\n return item\n })\n}\n\nfunction onlyReferencedItems(\n results: apiTypes.ReferencedResult[]\n): WixDataItem[] {\n return results\n .map((result) => result.dataItem)\n .filter(notEmpty)\n .map(toDataItem)\n}\n\nfunction notEmpty<T>(value: T | null | undefined): value is T {\n return value != null\n}\n\nfunction itemId(item: WixDataItemOrId): string {\n return typeof item === 'string' ? item : item._id\n}\n\nfunction asArray<T>(xOrXs: T | T[]): T[] {\n return isArray(xOrXs) ? (xOrXs as T[]) : [xOrXs as T]\n}\n\nfunction isOffset(cursorOrOffset: string | number) {\n return typeof cursorOrOffset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GAAG,CAAC;QAClB,OAAOtM,IAAI;MACb;IACF;IACA,OAAOA,IAAI;EACb,CAAC,CAAC;AACJ;AAEA,SAASiI,mBAAmBA,CAC1B1F,OAAoC,EACrB;EACf,OAAOA,OAAO,CACXR,GAAG,CAAEE,MAAM,IAAKA,MAAM,CAAC1C,QAAQ,CAAC,CAChCkE,MAAM,CAAC+K,QAAQ,CAAC,CAChBzM,GAAG,CAAChC,UAAU,CAAC;AACpB;AAEA,SAASyO,QAAQA,CAAIxN,KAA2B,EAAc;EAC5D,OAAOA,KAAK,IAAI,IAAI;AACtB;AAEA,SAAS1B,MAAMA,CAACU,IAAqB,EAAU;EAC7C,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACI,GAAG;AACnD;AAEA,SAAS8I,OAAOA,CAAIuF,KAAc,EAAO;EACvC,OAAO,IAAAC,cAAO,EAACD,KAAK,CAAC,GAAIA,KAAK,GAAW,CAACA,KAAK,CAAM;AACvD;AAEA,SAAS7J,QAAQA,CAACP,cAA+B,EAAE;EACjD,OAAO,OAAOA,cAAc,KAAK,QAAQ;AAC3C;AAEA,MAAMvE,oBAAoB,GAAG,SAAS;AAEtC,SAASjB,YAAYA,CAAA,EAAG;EACtB,OAAO,IAAA8P,oBAAkB,EAAC7L,0BAAkB,CAAC;AAC/C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["/**\n * @builder\n */\nexport interface WixDataFilter {\n /**\n * Refines a filter to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines this filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines this filter to only\n * match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items\n * in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ne(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this filter to only\n * match items where the value of the specified field is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines this filter to only match\n * items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this filter to only match\n * items where the value of the specified field is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines this filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field has any value.\n *\n * The `isNotEmpty()` method refines this filter to only match items where the\n * value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns Refined filter.\n */\n isNotEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this filter to only match items where the\n * value of the specified field is `null` or `undefined` or the field does\n * not exist.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns An object representing the refined filter.\n */\n isEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines this filter to\n * only match items where the value of the specified field starts with the\n * defined `string`. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` starts\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - Value to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n startsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value ends with a specified string.\n *\n * The `endsWith()` method refines this filter to only\n * match items where the value of the specified field ends with the specified\n * `string`. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` ends\n * with `\"ext\"`.\n *\n * You can only use `endsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the string.\n * @requiredField field\n * @param value - Value to look for at the end of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n endsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value contains the specified value.\n *\n * The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`.\n *\n * You can use `contains()` with a field whose type is a string or a reference. However, for fields whose type is reference, `contains()` matches by the ID of the referenced item as a string. Instead, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq) method.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided value.\n * @requiredField field\n * @param value - Value to locate in the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n contains(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` method refines this filter to\n * only match items where the value of the specified field equals any of\n * the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasSome()` will match\n * if any of the elements of that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs in the\n * `value` field. In such a case, `hasSome()` will match if any of the\n * multiple references match any of the specified ID values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this filter to\n * only match items where the value of the specified field equals all of\n * the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds an `and` condition to the filter.\n *\n * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.\n *\n * Use the `and()` method when performing compound queries. For example, the final filter in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n *\n * ```js\n * let statusFilter = items.filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * > **Notes**:\n * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.\n * > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:\n *\n * ```js\n * items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `WixDataFilter` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` method adds a `not` condition to this filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: WixDataFilter): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is within the defined range.\n *\n * The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only matches values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).\n *\n * The following types can be compared:\n * - Number: Compared numerically.\n * - Date: Compared as JavaScript Date objects.\n * - String: Compared lexicographically:\n * - `\"A\"` and `\"M\"` are considered between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are considered between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n *\n * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataFilter\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["/**\n * @builder\n */\nexport interface WixDataFilter {\n /**\n * Refines a filter to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines this filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines this filter to only\n * match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items\n * in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ne(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this filter to only\n * match items where the value of the specified field is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines this filter to only match\n * items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this filter to only match\n * items where the value of the specified field is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines this filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field has any value.\n *\n * The `isNotEmpty()` method refines this filter to only match items where the\n * value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns Refined filter.\n */\n isNotEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this filter to only match items where the\n * value of the specified field is `null` or `undefined` or the field does\n * not exist.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns An object representing the refined filter.\n */\n isEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines this filter to\n * only match items where the value of the specified field starts with the\n * defined `string`. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` starts\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - Value to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n startsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value ends with a specified string.\n *\n * The `endsWith()` method refines this filter to only\n * match items where the value of the specified field ends with the specified\n * `string`. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` ends\n * with `\"ext\"`.\n *\n * You can only use `endsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the string.\n * @requiredField field\n * @param value - Value to look for at the end of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n endsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value contains the specified value.\n *\n * The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`.\n *\n * You can use `contains()` with a field whose type is a string or a reference. However, for fields whose type is reference, `contains()` matches by the ID of the referenced item as a string. Instead, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq) method.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided value.\n * @requiredField field\n * @param value - Value to locate in the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n contains(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` method refines this filter to\n * only match items where the value of the specified field equals any of\n * the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasSome()` will match\n * if any of the elements of that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs in the\n * `value` field. In such a case, `hasSome()` will match if any of the\n * multiple references match any of the specified ID values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this filter to\n * only match items where the value of the specified field equals all of\n * the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds an `and` condition to the filter.\n *\n * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.\n *\n * Use the `and()` method when performing compound queries. For example, the final filter in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n *\n * ```js\n * let statusFilter = items.filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * > **Notes**:\n * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.\n * > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:\n *\n * ```js\n * items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `WixDataFilter` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` method adds a `not` condition to this filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: WixDataFilter): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is within the defined range.\n *\n * The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only matches values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).\n *\n * The following types can be compared:\n * - Number: Compared numerically.\n * - Date: Compared as JavaScript Date objects.\n * - String: Compared lexicographically:\n * - `\"A\"` and `\"M\"` are considered between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are considered between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n *\n * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataFilter\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataPatch.ts"],"sourcesContent":["import { WixDataItem, WixDataBulkResult, WixDataPatchOptions } from './types'\n\nexport interface FieldModification {\n fieldPath: string\n action:\n | 'SET_FIELD'\n | 'REMOVE_FIELD'\n | 'INCREMENT_FIELD'\n | 'APPEND_TO_ARRAY'\n | 'REMOVE_FROM_ARRAY'\n actionOptions?: any\n}\n\n/**\n * @builder\n */\nexport interface WixDataBulkPatch {\n /**\n * Refines a patch operation to increment or decrement the specified field by the specified value. A positive value increases the field, while a negative value decreases it.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is incremented or decremented.\n * @requiredField field\n * @param by - Value by which to increment or decrement the specified field. You can specify positive or negative values.\n * @requiredField by\n * @returns Updated patch object.\n */\n incrementField(field: string, by: number): WixDataBulkPatch\n\n /**\n * Refines a patch operation to set the specified field to the specified value.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is set.\n * @requiredField field\n * @param value - Value to set for the specified field.\n * @requiredField value\n * @returns Updated patch object.\n */\n setField(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to append the specified value to the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to append the specified value to.\n * @requiredField field\n * @param value - Value to append to the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n appendToArray(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to remove the first instance of the specified value from the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to remove the specified value from.\n * @requiredField field\n * @param value - Value whose first instance is removed from the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n removeFromArray(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to clear the specified field.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is cleared.\n * @requiredField field\n * @returns Updated patch object.\n */\n removeField(field: string): WixDataBulkPatch\n\n /**\n * Runs the bulk patch operation and returns a Promise that resolves to information about the results.\n *\n * @public\n * @documentationMaturity preview\n * @returns Bulk operation results.\n */\n run(options?: WixDataPatchOptions): Promise<WixDataBulkResult>\n}\n\n/**\n * @builder\n */\nexport interface WixDataPatch {\n /**\n * Refines a patch operation to increment or decrement the specified field by the specified value. A positive value increases the field, while a negative value decreases it.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is incremented or decremented.\n * @requiredField field\n * @param by - Value by which to increase or decrease the specified field. You can specify positive or negative values.\n * @requiredField by\n * @returns Updated patch object.\n */\n incrementField(field: string, by: number): WixDataPatch\n\n /**\n * Refines a patch operation to set the specified field to the specified value.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is set.\n * @requiredField field\n * @param value - Value to set for the specified field.\n * @requiredField value\n * @returns Updated patch object.\n */\n setField(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to append the specified value to the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to append the specified value to.\n * @requiredField field\n * @param value - Value to append to the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n appendToArray(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to remove the first instance of the specified value from the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to remove the specified value from.\n * @requiredField field\n * @param value - Value whose first instance is removed from the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n removeFromArray(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to clear the specified field.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is cleared.\n * @requiredField field\n * @returns Updated patch object.\n */\n removeField(field: string): WixDataPatch\n\n /**\n * Runs the patch operation and returns a Promise that resolves to the patched item and operation metadata.\n *\n * @public\n * @documentationMaturity preview\n * @returns Modified data item.\n */\n\n run(options?: WixDataPatchOptions): Promise<WixDataItem | null>\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataPatch.ts"],"sourcesContent":["import { WixDataItem, WixDataBulkResult, WixDataPatchOptions } from './types'\n\nexport interface FieldModification {\n fieldPath: string\n action:\n | 'SET_FIELD'\n | 'REMOVE_FIELD'\n | 'INCREMENT_FIELD'\n | 'APPEND_TO_ARRAY'\n | 'REMOVE_FROM_ARRAY'\n actionOptions?: any\n}\n\n/**\n * @builder\n */\nexport interface WixDataBulkPatch {\n /**\n * Refines a patch operation to increment or decrement the specified field value by the specified parameter. A positive number increases it, while a negative number decreases it.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is incremented or decremented. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param by - Value by which to increment or decrement the specified field. You can specify positive or negative values.\n * @requiredField by\n * @returns Updated patch object.\n */\n incrementField(field: string, by: number): WixDataBulkPatch\n\n /**\n * Refines a patch operation to set the specified field to the specified value.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is set. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value to set for the specified field.\n * @requiredField value\n * @returns Updated patch object.\n */\n setField(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to append the specified value to the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to append the specified value to. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value to append to the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n appendToArray(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to remove the first instance of the specified value from the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to remove the specified value from. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value whose first instance is removed from the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n removeFromArray(field: string, value: any): WixDataBulkPatch\n\n /**\n * Refines a patch operation to clear the specified field.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is cleared. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @returns Updated patch object.\n */\n removeField(field: string): WixDataBulkPatch\n\n /**\n * Runs the bulk patch operation and returns a Promise that resolves to information about the results.\n *\n * @public\n * @documentationMaturity preview\n * @returns Bulk operation results.\n */\n run(options?: WixDataPatchOptions): Promise<WixDataBulkResult>\n}\n\n/**\n * @builder\n */\nexport interface WixDataPatch {\n /**\n * Refines a patch operation to increment or decrement the specified field value by the specified parameter. A positive number increases it, while a negative number decreases it.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is incremented or decremented. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param by - Value by which to increase or decrease the specified field. You can specify positive or negative values.\n * @requiredField by\n * @returns Updated patch object.\n */\n incrementField(field: string, by: number): WixDataPatch\n\n /**\n * Refines a patch operation to set the specified field to the specified value.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is set. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value to set for the specified field.\n * @requiredField value\n * @returns Updated patch object.\n */\n setField(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to append the specified value to the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to append the specified value to. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value to append to the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n appendToArray(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to remove the first instance of the specified value from the specified array field.\n * @public\n * @documentationMaturity preview\n * @param field - Array field to remove the specified value from. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @param value - Value whose first instance is removed from the specified array field.\n * @requiredField value\n * @returns Updated patch object.\n */\n removeFromArray(field: string, value: any): WixDataPatch\n\n /**\n * Refines a patch operation to clear the specified field.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is cleared. Nested fields can be specified using dot notation. For example: \"address.street\".\n * @requiredField field\n * @returns Updated patch object.\n */\n removeField(field: string): WixDataPatch\n\n /**\n * Runs the patch operation and returns a Promise that resolves to the patched item and operation metadata.\n *\n * @public\n * @documentationMaturity preview\n * @returns Modified data item.\n */\n\n run(options?: WixDataPatchOptions): Promise<WixDataItem | null>\n}\n"],"mappings":"","ignoreList":[]}