@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":["_utils","require","_errors","_errors2","SUPPORTS_GET_METHOD","apiRequestInterceptor","allowGet","request","preferGet","methodFqn","data","serializeDates","url","base64url","length","method","undefined","ApiClient","constructor","clientFactory","_defineProperty2","default","httpApiClient","getDataItem","r","withErrorHandling","response","parseDates","insertDataItem","saveDataItem","updateDataItem","patchDataItem","bulkPatchDataItems","removeDataItem","countDataItems","queryDistinctValues","queryDataItems","aggregateDataItems","bulkInsertDataItems","bulkUpdateDataItems","bulkSaveDataItems","bulkRemoveDataItems","queryReferencedDataItems","bulkInsertDataItemReferences","replaceDataItemReferences","bulkRemoveDataItemReferences","isReferencedDataItem","truncateDataItems","call","error","isHttpError","_error$response","_error$response2","status","wixDataError","messages","payloadIsTooLarge","parsedError","parseError","internalError","codes","UnknownError","exports"],"sources":["../../../src/api/ApiClient.ts"],"sourcesContent":["import type {\n HttpApiClient,\n RequestInterceptor,\n Request,\n HttpApiClientFactory,\n} from '../types/api'\nimport {\n decode as parseDates,\n encode as serializeDates,\n base64url,\n} from '../utils'\nimport { messages, wixDataError, codes } from '../errors'\n\nimport { isHttpError, parseError } from './errors'\nimport {\n AggregateDataItemsRequest,\n AggregateDataItemsResponse,\n BulkInsertDataItemReferencesRequest,\n BulkInsertDataItemReferencesResponse,\n BulkInsertDataItemsRequest,\n BulkInsertDataItemsResponse,\n BulkPatchDataItemsRequest,\n BulkPatchDataItemsResponse,\n BulkRemoveDataItemReferencesRequest,\n BulkRemoveDataItemReferencesResponse,\n BulkRemoveDataItemsRequest,\n BulkRemoveDataItemsResponse,\n BulkSaveDataItemsRequest,\n BulkSaveDataItemsResponse,\n BulkUpdateDataItemsRequest,\n BulkUpdateDataItemsResponse,\n CountDataItemsRequest,\n CountDataItemsResponse,\n GetDataItemRequest,\n GetDataItemResponse,\n InsertDataItemRequest,\n InsertDataItemResponse,\n IsReferencedDataItemRequest,\n IsReferencedDataItemResponse,\n PatchDataItemRequest,\n PatchDataItemResponse,\n QueryDataItemsRequest,\n QueryDataItemsResponse,\n QueryDistinctValuesRequest,\n QueryDistinctValuesResponse,\n QueryReferencedDataItemsRequest,\n QueryReferencedDataItemsResponse,\n RemoveDataItemRequest,\n RemoveDataItemResponse,\n ReplaceDataItemReferencesRequest,\n ReplaceDataItemReferencesResponse,\n SaveDataItemRequest,\n SaveDataItemResponse,\n TruncateDataItemsRequest,\n TruncateDataItemsResponse,\n UpdateDataItemRequest,\n UpdateDataItemResponse,\n} from '../types/data-item-types'\n\nconst SUPPORTS_GET_METHOD: Record<string, boolean> = {\n 'com.wixpress.cloud.data.api.data.DataItemService.QueryDataItems': true,\n}\n\nexport function apiRequestInterceptor<R extends Request>(\n allowGet: boolean\n): RequestInterceptor<R> {\n return (request) => {\n const preferGet = allowGet && SUPPORTS_GET_METHOD[request.methodFqn ?? '']\n const data = serializeDates(request.data)\n if (preferGet) {\n // https://github.com/wix-private/server-infra/tree/master/framework/grpc/rest#complex-requests-messages-with-get-mappings\n const url = `${request.url}?.r=${base64url(data)}`\n if (url.length <= 2048) {\n return {\n ...request,\n method: 'GET',\n url,\n data: undefined,\n }\n }\n }\n return { ...request, data }\n }\n}\n\nexport class ApiClient {\n private httpApiClient: HttpApiClient\n\n constructor(clientFactory: HttpApiClientFactory<any>, allowGet: boolean) {\n this.httpApiClient = clientFactory(apiRequestInterceptor(allowGet))\n }\n\n async getDataItem(r: GetDataItemRequest): Promise<GetDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.getDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async insertDataItem(\n r: InsertDataItemRequest\n ): Promise<InsertDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.insertDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async saveDataItem(r: SaveDataItemRequest): Promise<SaveDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.saveDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async updateDataItem(\n r: UpdateDataItemRequest\n ): Promise<UpdateDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.updateDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async patchDataItem(r: PatchDataItemRequest): Promise<PatchDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.patchDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async bulkPatchDataItems(\n r: BulkPatchDataItemsRequest\n ): Promise<BulkPatchDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkPatchDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async removeDataItem(\n r: RemoveDataItemRequest\n ): Promise<RemoveDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.removeDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async countDataItems(\n r: CountDataItemsRequest\n ): Promise<CountDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.countDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async queryDistinctValues(\n r: QueryDistinctValuesRequest\n ): Promise<QueryDistinctValuesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryDistinctValues(r)\n return parseDates(response.data)\n })\n }\n\n async queryDataItems(\n r: QueryDataItemsRequest\n ): Promise<QueryDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async aggregateDataItems(\n r: AggregateDataItemsRequest\n ): Promise<AggregateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.aggregateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkInsertDataItems(\n r: BulkInsertDataItemsRequest\n ): Promise<BulkInsertDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkInsertDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkUpdateDataItems(\n r: BulkUpdateDataItemsRequest\n ): Promise<BulkUpdateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkUpdateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkSaveDataItems(\n r: BulkSaveDataItemsRequest\n ): Promise<BulkSaveDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkSaveDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkRemoveDataItems(\n r: BulkRemoveDataItemsRequest\n ): Promise<BulkRemoveDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkRemoveDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async queryReferencedDataItems(\n r: QueryReferencedDataItemsRequest\n ): Promise<QueryReferencedDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryReferencedDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkInsertDataItemReferences(\n r: BulkInsertDataItemReferencesRequest\n ): Promise<BulkInsertDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkInsertDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async replaceDataItemReferences(\n r: ReplaceDataItemReferencesRequest\n ): Promise<ReplaceDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.replaceDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async bulkRemoveDataItemReferences(\n r: BulkRemoveDataItemReferencesRequest\n ): Promise<BulkRemoveDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkRemoveDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async isReferencedDataItem(\n r: IsReferencedDataItemRequest\n ): Promise<IsReferencedDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.isReferencedDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async truncateDataItems(\n r: TruncateDataItemsRequest\n ): Promise<TruncateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.truncateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n private async withErrorHandling<T>(call: () => T): Promise<T> {\n try {\n return await call()\n } catch (error: unknown) {\n if (isHttpError(error)) {\n if (error.response?.status === 413) {\n throw wixDataError(messages.payloadIsTooLarge(), 'WDE0109')\n }\n const parsedError = parseError(error.response?.data)\n if (parsedError) {\n throw parsedError\n }\n }\n throw wixDataError(\n messages.internalError('Unknown error.'),\n codes.UnknownError\n )\n }\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AA8CA,MAAMG,mBAA4C,GAAG;EACnD,iEAAiE,EAAE;AACrE,CAAC;AAEM,SAASC,qBAAqBA,CACnCC,QAAiB,EACM;EACvB,OAAQC,OAAO,IAAK;IAClB,MAAMC,SAAS,GAAGF,QAAQ,IAAIF,mBAAmB,CAACG,OAAO,CAACE,SAAS,IAAI,EAAE,CAAC;IAC1E,MAAMC,IAAI,GAAG,IAAAC,aAAc,EAACJ,OAAO,CAACG,IAAI,CAAC;IACzC,IAAIF,SAAS,EAAE;MACb;MACA,MAAMI,GAAG,GAAI,GAAEL,OAAO,CAACK,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EAACC,gBAAQ,CAACC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC;QAC7D;QACA,MAAMC,WAAW,GAAG,IAAAC,mBAAU,GAAAN,gBAAA,GAACH,KAAK,CAACvB,QAAQ,qBAAd0B,gBAAA,CAAgB1C,IAAI,CAAC;QACpD,IAAI+C,WAAW,EAAE;UACf,MAAMA,WAAW;QACnB;MACF;MACA,MAAM,IAAAH,oBAAY,EAChBC,gBAAQ,CAACI,aAAa,CAAC,gBAAgB,CAAC,EACxCC,aAAK,CAACC,YACR,CAAC;IACH;EACF;AACF;AAACC,OAAA,CAAA7C,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_utils","require","_errors","_errors2","SUPPORTS_GET_METHOD","apiRequestInterceptor","allowGet","request","preferGet","methodFqn","data","serializeDates","url","base64url","length","method","undefined","ApiClient","constructor","clientFactory","_defineProperty2","default","httpApiClient","getDataItem","r","withErrorHandling","response","parseDates","insertDataItem","saveDataItem","updateDataItem","patchDataItem","bulkPatchDataItems","removeDataItem","countDataItems","queryDistinctValues","queryDataItems","aggregateDataItems","bulkInsertDataItems","bulkUpdateDataItems","bulkSaveDataItems","bulkRemoveDataItems","queryReferencedDataItems","bulkInsertDataItemReferences","replaceDataItemReferences","bulkRemoveDataItemReferences","isReferencedDataItem","truncateDataItems","call","error","isHttpError","_error$response","_error$response2","status","wixDataError","messages","payloadIsTooLarge","parsedError","parseError","internalError","codes","UnknownError","exports"],"sources":["../../../src/api/ApiClient.ts"],"sourcesContent":["import type {\n HttpApiClient,\n RequestInterceptor,\n Request,\n HttpApiClientFactory,\n} from '../types/api'\nimport {\n decode as parseDates,\n encode as serializeDates,\n base64url,\n} from '../utils'\nimport { messages, wixDataError, codes } from '../errors'\n\nimport { isHttpError, parseError } from './errors'\nimport {\n AggregateDataItemsRequest,\n AggregateDataItemsResponse,\n BulkInsertDataItemReferencesRequest,\n BulkInsertDataItemReferencesResponse,\n BulkInsertDataItemsRequest,\n BulkInsertDataItemsResponse,\n BulkPatchDataItemsRequest,\n BulkPatchDataItemsResponse,\n BulkRemoveDataItemReferencesRequest,\n BulkRemoveDataItemReferencesResponse,\n BulkRemoveDataItemsRequest,\n BulkRemoveDataItemsResponse,\n BulkSaveDataItemsRequest,\n BulkSaveDataItemsResponse,\n BulkUpdateDataItemsRequest,\n BulkUpdateDataItemsResponse,\n CountDataItemsRequest,\n CountDataItemsResponse,\n GetDataItemRequest,\n GetDataItemResponse,\n InsertDataItemRequest,\n InsertDataItemResponse,\n IsReferencedDataItemRequest,\n IsReferencedDataItemResponse,\n PatchDataItemRequest,\n PatchDataItemResponse,\n QueryDataItemsRequest,\n QueryDataItemsResponse,\n QueryDistinctValuesRequest,\n QueryDistinctValuesResponse,\n QueryReferencedDataItemsRequest,\n QueryReferencedDataItemsResponse,\n RemoveDataItemRequest,\n RemoveDataItemResponse,\n ReplaceDataItemReferencesRequest,\n ReplaceDataItemReferencesResponse,\n SaveDataItemRequest,\n SaveDataItemResponse,\n TruncateDataItemsRequest,\n TruncateDataItemsResponse,\n UpdateDataItemRequest,\n UpdateDataItemResponse,\n} from '../types/data-item-types'\n\nconst SUPPORTS_GET_METHOD: Record<string, boolean> = {\n 'com.wixpress.cloud.data.api.data.DataItemService.QueryDataItems': true,\n}\n\nexport function apiRequestInterceptor<R extends Request>(\n allowGet: boolean\n): RequestInterceptor<R> {\n return (request) => {\n const preferGet = allowGet && SUPPORTS_GET_METHOD[request.methodFqn ?? '']\n const data = serializeDates(request.data)\n if (preferGet) {\n // https://github.com/wix-private/server-infra/tree/master/framework/grpc/rest#complex-requests-messages-with-get-mappings\n const url = `${request.url}?.r=${base64url(data)}`\n if (url.length <= 2048) {\n return {\n ...request,\n method: 'GET',\n url,\n data: undefined,\n }\n }\n }\n return { ...request, data }\n }\n}\n\nexport class ApiClient {\n private httpApiClient: HttpApiClient\n\n constructor(clientFactory: HttpApiClientFactory<any>, allowGet: boolean) {\n this.httpApiClient = clientFactory(apiRequestInterceptor(allowGet))\n }\n\n async getDataItem(r: GetDataItemRequest): Promise<GetDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.getDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async insertDataItem(\n r: InsertDataItemRequest\n ): Promise<InsertDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.insertDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async saveDataItem(r: SaveDataItemRequest): Promise<SaveDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.saveDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async updateDataItem(\n r: UpdateDataItemRequest\n ): Promise<UpdateDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.updateDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async patchDataItem(r: PatchDataItemRequest): Promise<PatchDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.patchDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async bulkPatchDataItems(\n r: BulkPatchDataItemsRequest\n ): Promise<BulkPatchDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkPatchDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async removeDataItem(\n r: RemoveDataItemRequest\n ): Promise<RemoveDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.removeDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async countDataItems(\n r: CountDataItemsRequest\n ): Promise<CountDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.countDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async queryDistinctValues(\n r: QueryDistinctValuesRequest\n ): Promise<QueryDistinctValuesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryDistinctValues(r)\n return parseDates(response.data)\n })\n }\n\n async queryDataItems(\n r: QueryDataItemsRequest\n ): Promise<QueryDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async aggregateDataItems(\n r: AggregateDataItemsRequest\n ): Promise<AggregateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.aggregateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkInsertDataItems(\n r: BulkInsertDataItemsRequest\n ): Promise<BulkInsertDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkInsertDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkUpdateDataItems(\n r: BulkUpdateDataItemsRequest\n ): Promise<BulkUpdateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkUpdateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkSaveDataItems(\n r: BulkSaveDataItemsRequest\n ): Promise<BulkSaveDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkSaveDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkRemoveDataItems(\n r: BulkRemoveDataItemsRequest\n ): Promise<BulkRemoveDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkRemoveDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async queryReferencedDataItems(\n r: QueryReferencedDataItemsRequest\n ): Promise<QueryReferencedDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.queryReferencedDataItems(r)\n return parseDates(response.data)\n })\n }\n\n async bulkInsertDataItemReferences(\n r: BulkInsertDataItemReferencesRequest\n ): Promise<BulkInsertDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkInsertDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async replaceDataItemReferences(\n r: ReplaceDataItemReferencesRequest\n ): Promise<ReplaceDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.replaceDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async bulkRemoveDataItemReferences(\n r: BulkRemoveDataItemReferencesRequest\n ): Promise<BulkRemoveDataItemReferencesResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.bulkRemoveDataItemReferences(r)\n return parseDates(response.data)\n })\n }\n\n async isReferencedDataItem(\n r: IsReferencedDataItemRequest\n ): Promise<IsReferencedDataItemResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.isReferencedDataItem(r)\n return parseDates(response.data)\n })\n }\n\n async truncateDataItems(\n r: TruncateDataItemsRequest\n ): Promise<TruncateDataItemsResponse> {\n return this.withErrorHandling(async () => {\n const response = await this.httpApiClient.truncateDataItems(r)\n return parseDates(response.data)\n })\n }\n\n private async withErrorHandling<T>(call: () => T): Promise<T> {\n try {\n return await call()\n } catch (error: unknown) {\n if (isHttpError(error)) {\n if (error.response?.status === 413) {\n throw wixDataError(messages.payloadIsTooLarge(), 'WDE0109')\n }\n const parsedError = parseError(error.response?.data)\n if (parsedError) {\n throw parsedError\n }\n }\n throw wixDataError(\n messages.internalError('Unknown error.'),\n codes.UnknownError\n )\n }\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AA8CA,MAAMG,mBAA4C,GAAG;EACnD,iEAAiE,EAAE;AACrE,CAAC;AAEM,SAASC,qBAAqBA,CACnCC,QAAiB,EACM;EACvB,OAAQC,OAAO,IAAK;IAClB,MAAMC,SAAS,GAAGF,QAAQ,IAAIF,mBAAmB,CAACG,OAAO,CAACE,SAAS,IAAI,EAAE,CAAC;IAC1E,MAAMC,IAAI,GAAG,IAAAC,aAAc,EAACJ,OAAO,CAACG,IAAI,CAAC;IACzC,IAAIF,SAAS,EAAE;MACb;MACA,MAAMI,GAAG,GAAG,GAAGL,OAAO,CAACK,GAAG,OAAO,IAAAC,gBAAS,EAACH,IAAI,CAAC,EAAE;MAClD,IAAIE,GA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QACA,MAAMC,WAAW,GAAG,IAAAC,mBAAU,GAAAN,gBAAA,GAACH,KAAK,CAACvB,QAAQ,qBAAd0B,gBAAA,CAAgB1C,IAAI,CAAC;QACpD,IAAI+C,WAAW,EAAE;UACf,MAAMA,WAAW;QACnB;MACF;MACA,MAAM,IAAAH,oBAAY,EAChBC,gBAAQ,CAACI,aAAa,CAAC,gBAAgB,CAAC,EACxCC,aAAK,CAACC,YACR,CAAC;IACH;EACF;AACF;AAACC,OAAA,CAAA7C,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_filter","require","_sortMixin","_common","QueryBase","constructor","origin","_defineProperty2","default","args","withFilter","map","extractFilter","collectionName","filterBuilder","filterTree","sort","Sort","setFilterModel","filter","invalidArguments","validateFilterTree","copy","getFilterModel","build","apply","value","orderBy","ascending","fields","descending","exports"],"sources":["../../../src/api/QueryBase.ts"],"sourcesContent":["import {\n WithFilter,\n PlatformizedFilterBuilder,\n validateFilterTree,\n FilterTree,\n} from '../filter'\nimport { Sort } from '../sort/sortMixin'\nimport { filterBuilder } from './common'\n\nexport abstract class QueryBase<Self extends WithFilter<Self>>\n implements WithFilter<Self>\n{\n /**\n * @internal\n */\n protected readonly filterBuilder: PlatformizedFilterBuilder\n\n /**\n * @internal\n */\n protected readonly sort: Sort\n\n /**\n * @internal\n */\n readonly collectionName: string\n\n protected constructor(origin: {\n collectionName: string\n filterBuilder?: PlatformizedFilterBuilder\n sort?: Sort\n }) {\n this.collectionName = origin.collectionName\n this.filterBuilder =\n origin?.filterBuilder ?? filterBuilder({ filterTree: {} })\n this.sort = origin?.sort ?? new Sort()\n }\n\n /**\n * @internal\n */\n protected abstract copy(params: {\n filterBuilder?: PlatformizedFilterBuilder\n sort?: Sort\n }): Self\n\n // --- filter ---\n\n abstract get invalidArguments(): string[]\n\n get filterTree(): Record<string, any> {\n return this.filterBuilder.filterTree\n }\n\n /**\n * @internal\n */\n setFilterModel(filterTree: Record<string, any>): Self {\n const filter = filterBuilder({\n filterTree,\n invalidArguments: validateFilterTree(filterTree),\n })\n return this.copy({ filterBuilder: filter })\n }\n\n /**\n * @internal\n */\n getFilterModel(): FilterTree {\n return this.filterBuilder.build()\n }\n\n private withFilter<F extends keyof PlatformizedFilterBuilder>(\n filter: F,\n args: Parameters<PlatformizedFilterBuilder[F]>\n ): Self {\n return this.copy({\n filterBuilder: this.filterBuilder[filter].apply(this.filterBuilder, args),\n })\n }\n\n // filterMethod: WithFilter<Self>['filterMethod'] allows keeping type signature while capturing\n // all args as an array\n\n eq: WithFilter<Self>['eq'] = (...args) => {\n return this.withFilter('eq', args)\n }\n ne: WithFilter<Self>['ne'] = (...args) => {\n return this.withFilter('ne', args)\n }\n ge: WithFilter<Self>['ge'] = (...args) => {\n return this.withFilter('ge', args)\n }\n gt: WithFilter<Self>['gt'] = (...args) => {\n return this.withFilter('gt', args)\n }\n gte: WithFilter<Self>['gte'] = (...args) => {\n return this.withFilter('gte', args)\n }\n le: WithFilter<Self>['le'] = (...args) => {\n return this.withFilter('le', args)\n }\n lt: WithFilter<Self>['lt'] = (...args) => {\n return this.withFilter('lt', args)\n }\n lte: WithFilter<Self>['lte'] = (...args) => {\n return this.withFilter('lte', args)\n }\n isNotEmpty: WithFilter<Self>['isNotEmpty'] = (...args) => {\n return this.withFilter('isNotEmpty', args)\n }\n isEmpty: WithFilter<Self>['isEmpty'] = (...args) => {\n return this.withFilter('isEmpty', args)\n }\n startsWith: WithFilter<Self>['startsWith'] = (...args) => {\n return this.withFilter('startsWith', args)\n }\n endsWith: WithFilter<Self>['endsWith'] = (...args) => {\n return this.withFilter('endsWith', args)\n }\n contains: WithFilter<Self>['contains'] = (...args) => {\n return this.withFilter('contains', args)\n }\n hasSome: WithFilter<Self>['hasSome'] = (...args) => {\n return this.withFilter('hasSome', args)\n };\n in: WithFilter<Self>['in'] = (...args) => {\n return this.withFilter('in', args)\n }\n hasAll: WithFilter<Self>['hasAll'] = (...args) => {\n return this.withFilter('hasAll', args)\n }\n exists: WithFilter<Self>['exists'] = (...args) => {\n return this.withFilter('exists', args)\n }\n or: WithFilter<Self>['or'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('or', args.map(this.extractFilter))\n }\n and: WithFilter<Self>['and'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('and', args.map(this.extractFilter))\n }\n not: WithFilter<Self>['not'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('not', args.map(this.extractFilter))\n }\n between: WithFilter<Self>['between'] = (...args) => {\n return this.withFilter('between', args)\n }\n\n private extractFilter(value: any): any {\n return value?.filterBuilder ? value.filterBuilder : value\n }\n\n // --- sort ---\n\n get orderBy(): { [field: string]: 'asc' | 'desc' }[] {\n return this.sort.orderBy\n }\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in ascending order.\n *\n * The `ascending()` function refines this query in ascending order of the specified properties. If you specify more\n * than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value will be sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the refined query.\n */\n ascending(...fields: string[]): Self\n ascending(fields: string[]): Self\n\n ascending(...fields: any) {\n return this.copy({ sort: this.sort.ascending(...fields) })\n }\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in descending order.\n *\n * The `descending()` function refines this query to sort in descending order of the specified properties. If you\n * specify more than one property, descending() sorts the results in descending order by each property in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the refined query.\n */\n descending(...fields: string[]): Self\n descending(fields: string[]): Self\n\n descending(...fields: any) {\n return this.copy({ sort: this.sort.descending(...fields) })\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAeG,SAAS,CAE/B;EAgBYC,WAAWA,CAACC,MAIrB,EAAE;IAnBH;AACF;AACA;IAFE,IAAAC,gBAAA,CAAAC,OAAA;IAKA;AACF;AACA;IAFE,IAAAD,gBAAA,CAAAC,OAAA;IAKA;AACF;AACA;IAFE,IAAAD,gBAAA,CAAAC,OAAA;IA2DA;IACA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,cAE6B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,eAC8B,CAAC,GAAGC,IAAI,KAAK;MAC1C,OAAO,IAAI,CAACC,UAAU,CAAC,KAAK,EAAED,IA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ASA,CAAC,GAAGC,MAAW,EAAE;IACxB,OAAO,IAAI,CAACP,IAAI,CAAC;MAAEN,IAAI,EAAE,IAAI,CAACA,IAAI,CAACY,SAAS,CAAC,GAAGC,MAAM;IAAE,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAIEC,UAAUA,CAAC,GAAGD,MAAW,EAAE;IACzB,OAAO,IAAI,CAACP,IAAI,CAAC;MAAEN,IAAI,EAAE,IAAI,CAACA,IAAI,CAACc,UAAU,CAAC,GAAGD,MAAM;IAAE,CAAC,CAAC;EAC7D;AACF;AAACE,OAAA,CAAA3B,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_filter","require","_sortMixin","_common","QueryBase","constructor","origin","_defineProperty2","default","args","withFilter","map","extractFilter","collectionName","filterBuilder","filterTree","sort","Sort","setFilterModel","filter","invalidArguments","validateFilterTree","copy","getFilterModel","build","apply","value","orderBy","ascending","fields","descending","exports"],"sources":["../../../src/api/QueryBase.ts"],"sourcesContent":["import {\n WithFilter,\n PlatformizedFilterBuilder,\n validateFilterTree,\n FilterTree,\n} from '../filter'\nimport { Sort } from '../sort/sortMixin'\nimport { filterBuilder } from './common'\n\nexport abstract class QueryBase<Self extends WithFilter<Self>>\n implements WithFilter<Self>\n{\n /**\n * @internal\n */\n protected readonly filterBuilder: PlatformizedFilterBuilder\n\n /**\n * @internal\n */\n protected readonly sort: Sort\n\n /**\n * @internal\n */\n readonly collectionName: string\n\n protected constructor(origin: {\n collectionName: string\n filterBuilder?: PlatformizedFilterBuilder\n sort?: Sort\n }) {\n this.collectionName = origin.collectionName\n this.filterBuilder =\n origin?.filterBuilder ?? filterBuilder({ filterTree: {} })\n this.sort = origin?.sort ?? new Sort()\n }\n\n /**\n * @internal\n */\n protected abstract copy(params: {\n filterBuilder?: PlatformizedFilterBuilder\n sort?: Sort\n }): Self\n\n // --- filter ---\n\n abstract get invalidArguments(): string[]\n\n get filterTree(): Record<string, any> {\n return this.filterBuilder.filterTree\n }\n\n /**\n * @internal\n */\n setFilterModel(filterTree: Record<string, any>): Self {\n const filter = filterBuilder({\n filterTree,\n invalidArguments: validateFilterTree(filterTree),\n })\n return this.copy({ filterBuilder: filter })\n }\n\n /**\n * @internal\n */\n getFilterModel(): FilterTree {\n return this.filterBuilder.build()\n }\n\n private withFilter<F extends keyof PlatformizedFilterBuilder>(\n filter: F,\n args: Parameters<PlatformizedFilterBuilder[F]>\n ): Self {\n return this.copy({\n filterBuilder: this.filterBuilder[filter].apply(this.filterBuilder, args),\n })\n }\n\n // filterMethod: WithFilter<Self>['filterMethod'] allows keeping type signature while capturing\n // all args as an array\n\n eq: WithFilter<Self>['eq'] = (...args) => {\n return this.withFilter('eq', args)\n }\n ne: WithFilter<Self>['ne'] = (...args) => {\n return this.withFilter('ne', args)\n }\n ge: WithFilter<Self>['ge'] = (...args) => {\n return this.withFilter('ge', args)\n }\n gt: WithFilter<Self>['gt'] = (...args) => {\n return this.withFilter('gt', args)\n }\n gte: WithFilter<Self>['gte'] = (...args) => {\n return this.withFilter('gte', args)\n }\n le: WithFilter<Self>['le'] = (...args) => {\n return this.withFilter('le', args)\n }\n lt: WithFilter<Self>['lt'] = (...args) => {\n return this.withFilter('lt', args)\n }\n lte: WithFilter<Self>['lte'] = (...args) => {\n return this.withFilter('lte', args)\n }\n isNotEmpty: WithFilter<Self>['isNotEmpty'] = (...args) => {\n return this.withFilter('isNotEmpty', args)\n }\n isEmpty: WithFilter<Self>['isEmpty'] = (...args) => {\n return this.withFilter('isEmpty', args)\n }\n startsWith: WithFilter<Self>['startsWith'] = (...args) => {\n return this.withFilter('startsWith', args)\n }\n endsWith: WithFilter<Self>['endsWith'] = (...args) => {\n return this.withFilter('endsWith', args)\n }\n contains: WithFilter<Self>['contains'] = (...args) => {\n return this.withFilter('contains', args)\n }\n hasSome: WithFilter<Self>['hasSome'] = (...args) => {\n return this.withFilter('hasSome', args)\n };\n in: WithFilter<Self>['in'] = (...args) => {\n return this.withFilter('in', args)\n }\n hasAll: WithFilter<Self>['hasAll'] = (...args) => {\n return this.withFilter('hasAll', args)\n }\n exists: WithFilter<Self>['exists'] = (...args) => {\n return this.withFilter('exists', args)\n }\n or: WithFilter<Self>['or'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('or', args.map(this.extractFilter))\n }\n and: WithFilter<Self>['and'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('and', args.map(this.extractFilter))\n }\n not: WithFilter<Self>['not'] = (...args) => {\n // @ts-expect-error\n return this.withFilter('not', args.map(this.extractFilter))\n }\n between: WithFilter<Self>['between'] = (...args) => {\n return this.withFilter('between', args)\n }\n\n private extractFilter(value: any): any {\n return value?.filterBuilder ? value.filterBuilder : value\n }\n\n // --- sort ---\n\n get orderBy(): { [field: string]: 'asc' | 'desc' }[] {\n return this.sort.orderBy\n }\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in ascending order.\n *\n * The `ascending()` function refines this query in ascending order of the specified properties. If you specify more\n * than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value will be sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the refined query.\n */\n ascending(...fields: string[]): Self\n ascending(fields: string[]): Self\n\n ascending(...fields: any) {\n return this.copy({ sort: this.sort.ascending(...fields) })\n }\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in descending order.\n *\n * The `descending()` function refines this query to sort in descending order of the specified properties. If you\n * specify more than one property, descending() sorts the results in descending order by each property in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the refined query.\n */\n descending(...fields: string[]): Self\n descending(fields: string[]): Self\n\n descending(...fields: any) {\n return this.copy({ sort: this.sort.descending(...fields) })\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAeG,SAAS,CAE/B;EAgBYC,WAAWA,CAACC,MAIrB,EAAE;IAnBH;AACF;AACA;IAFE,IAAAC,gBAAA,CAAAC,OAAA;IAKA;AACF;AACA;IAFE,IAAAD,gBAAA,CAAAC,OAAA;IAKA;AACF;AACA;IAFE,IAAAD,gBAAA,CAAAC,OAAA;IA2DA;IACA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,cAE6B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;IACpC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,cAC4B,CAAC,GAAGC,IAAI,KAAK;MACxC,OAAO,IAAI,CAACC,UAAU,CAAC,IAAI,EAAED,IAAI,CAAC;I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CAACW,OAAO;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAIEC,SAASA,CAAC,GAAGC,MAAW,EAAE;IACxB,OAAO,IAAI,CAACP,IAAI,CAAC;MAAEN,IAAI,EAAE,IAAI,CAACA,IAAI,CAACY,SAAS,CAAC,GAAGC,MAAM;IAAE,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAIEC,UAAUA,CAAC,GAAGD,MAAW,EAAE;IACzB,OAAO,IAAI,CAACP,IAAI,CAAC;MAAEN,IAAI,EAAE,IAAI,CAACA,IAAI,CAACc,UAAU,CAAC,GAAGD,MAAM;IAAE,CAAC,CAAC;EAC7D;AACF;AAACE,OAAA,CAAA3B,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_errors","MAX_SAFE_INTEGER","QueryValidator","AggregatingValidator","constructor","operatorName","previousInvalidArguments","_defineProperty2","default","_isNumber","specifier","operand","addValidation","isNumber","messages","queryValidations","isPositiveNumber","Number","isNaN","isNonNegativeNumber","isInteger","isFinite","notGreaterThan","value","nonEmptyString","length","isNonEmptyString","exports"],"sources":["../../../src/api/QueryValidator.ts"],"sourcesContent":["import { isNumber } from '../utils'\nimport { AggregatingValidator, messages } from '../errors'\n\nconst MAX_SAFE_INTEGER = 9007199254740991\n\nexport class QueryValidator extends AggregatingValidator {\n operatorName: any\n\n constructor(operatorName: string, previousInvalidArguments: string[]) {\n super(previousInvalidArguments)\n this.operatorName = operatorName\n }\n\n _isNumber(specifier: string, operand: any) {\n return this.addValidation(\n () => isNumber(operand),\n () =>\n messages.queryValidations.isNumber(\n this.operatorName,\n specifier,\n operand\n )\n )\n }\n\n isPositiveNumber(operand: number) {\n return this._isNumber('positive', operand).addValidation(\n () => !Number.isNaN(operand) && operand > 0,\n () =>\n messages.queryValidations.isPositiveNumber(this.operatorName, operand)\n )\n }\n\n isNonNegativeNumber(operand: number) {\n return this._isNumber('non-negative', operand).addValidation(\n () => !Number.isNaN(operand) && operand >= 0,\n () =>\n messages.queryValidations.isNonNegativeNumber(\n this.operatorName,\n operand\n )\n )\n }\n\n isInteger(operand: number) {\n return this.addValidation(\n () =>\n !Number.isNaN(operand) &&\n Number.isFinite(operand) &&\n Number.isInteger(operand) &&\n operand < MAX_SAFE_INTEGER &&\n operand > -MAX_SAFE_INTEGER,\n () => messages.queryValidations.isInteger(this.operatorName, operand)\n )\n }\n\n notGreaterThan(operand: number, value: number) {\n return this.addValidation(\n () => operand <= value,\n () =>\n messages.queryValidations.notGreaterThan(\n this.operatorName,\n operand,\n value\n )\n )\n }\n\n nonEmptyString(operand: any) {\n return this.addValidation(\n () => typeof operand === 'string' && operand.length > 0,\n () => messages.queryValidations.isNonEmptyString(this.operatorName)\n )\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,gBAAgB,GAAG,gBAAgB;AAElC,MAAMC,cAAc,SAASC,4BAAoB,CAAC;EAGvDC,WAAWA,CAACC,YAAoB,EAAEC,wBAAkC,EAAE;IACpE,KAAK,CAACA,wBAAwB,CAAC;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAC/B,IAAI,CAACH,YAAY,GAAGA,YAAY;EAClC;EAEAI,SAASA,CAACC,SAAiB,EAAEC,OAAY,EAAE;IACzC,OAAO,IAAI,CAACC,aAAa,CACvB,MAAM,IAAAC,eAAQ,EAACF,OAAO,CAAC,EACvB,MACEG,gBAAQ,CAACC,gBAAgB,CAACF,QAAQ,CAChC,IAAI,CAACR,YAAY,EACjBK,SAAS,EACTC,OACF,CACJ,CAAC;EACH;EAEAK,gBAAgBA,CAACL,OAAe,EAAE;IAChC,OAAO,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,IAAIA,OAAO,CAACc,MAAM,GAAG,CAAC,EACvD,MAAMX,gBAAQ,CAACC,gBAAgB,CAACW,gBAAgB,CAAC,IAAI,CAACrB,YAAY,CACpE,CAAC;EACH;AACF;AAACsB,OAAA,CAAAzB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_utils","require","_errors","MAX_SAFE_INTEGER","QueryValidator","AggregatingValidator","constructor","operatorName","previousInvalidArguments","_defineProperty2","default","_isNumber","specifier","operand","addValidation","isNumber","messages","queryValidations","isPositiveNumber","Number","isNaN","isNonNegativeNumber","isInteger","isFinite","notGreaterThan","value","nonEmptyString","length","isNonEmptyString","exports"],"sources":["../../../src/api/QueryValidator.ts"],"sourcesContent":["import { isNumber } from '../utils'\nimport { AggregatingValidator, messages } from '../errors'\n\nconst MAX_SAFE_INTEGER = 9007199254740991\n\nexport class QueryValidator extends AggregatingValidator {\n operatorName: any\n\n constructor(operatorName: string, previousInvalidArguments: string[]) {\n super(previousInvalidArguments)\n this.operatorName = operatorName\n }\n\n _isNumber(specifier: string, operand: any) {\n return this.addValidation(\n () => isNumber(operand),\n () =>\n messages.queryValidations.isNumber(\n this.operatorName,\n specifier,\n operand\n )\n )\n }\n\n isPositiveNumber(operand: number) {\n return this._isNumber('positive', operand).addValidation(\n () => !Number.isNaN(operand) && operand > 0,\n () =>\n messages.queryValidations.isPositiveNumber(this.operatorName, operand)\n )\n }\n\n isNonNegativeNumber(operand: number) {\n return this._isNumber('non-negative', operand).addValidation(\n () => !Number.isNaN(operand) && operand >= 0,\n () =>\n messages.queryValidations.isNonNegativeNumber(\n this.operatorName,\n operand\n )\n )\n }\n\n isInteger(operand: number) {\n return this.addValidation(\n () =>\n !Number.isNaN(operand) &&\n Number.isFinite(operand) &&\n Number.isInteger(operand) &&\n operand < MAX_SAFE_INTEGER &&\n operand > -MAX_SAFE_INTEGER,\n () => messages.queryValidations.isInteger(this.operatorName, operand)\n )\n }\n\n notGreaterThan(operand: number, value: number) {\n return this.addValidation(\n () => operand <= value,\n () =>\n messages.queryValidations.notGreaterThan(\n this.operatorName,\n operand,\n value\n )\n )\n }\n\n nonEmptyString(operand: any) {\n return this.addValidation(\n () => typeof operand === 'string' && operand.length > 0,\n () => messages.queryValidations.isNonEmptyString(this.operatorName)\n )\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,gBAAgB,GAAG,gBAAgB;AAElC,MAAMC,cAAc,SAASC,4BAAoB,CAAC;EAGvDC,WAAWA,CAACC,YAAoB,EAAEC,wBAAkC,EAAE;IACpE,KAAK,CAACA,wBAAwB,CAAC;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAC/B,IAAI,CAACH,YAAY,GAAGA,YAAY;EAClC;EAEAI,SAASA,CAACC,SAAiB,EAAEC,OAAY,EAAE;IACzC,OAAO,IAAI,CAACC,aAAa,CACvB,MAAM,IAAAC,eAAQ,EAACF,OAAO,CAAC,EACvB,MACEG,gBAAQ,CAACC,gBAAgB,CAACF,QAAQ,CAChC,IAAI,CAACR,YAAY,EACjBK,SAAS,EACTC,OACF,CACJ,CAAC;EACH;EAEAK,gBAAgBA,CAACL,OAAe,EAAE;IAChC,OAAO,IAAI,CAACF,SAAS,CAAC,UAAU,EAAEE,OAAO,CAAC,CAACC,aAAa,CACtD,MAAM,CAACK,MAAM,CAACC,KAAK,CAACP,OAAO,CAAC,IAAIA,OAAO,GAAG,CAAC,EAC3C,MACEG,gBAAQ,CAACC,gBAAgB,CAACC,gBAAgB,CAAC,IAAI,CAACX,YAAY,EAAEM,OAAO,CACzE,CAAC;EACH;EAEAQ,mBAAmBA,CAACR,OAAe,EAAE;IACnC,OAAO,IAAI,CAACF,SAAS,CAAC,cAAc,EAAEE,OAAO,CAAC,CAACC,aAAa,CAC1D,MAAM,CAACK,MAAM,CAACC,KAAK,CAACP,OAAO,CAAC,IAAIA,OAAO,IAAI,CAAC,EAC5C,MACEG,gBAAQ,CAACC,gBAAgB,CAACI,mBAAmB,CAC3C,IAAI,CAACd,YAAY,EACjBM,OACF,CACJ,CAAC;EACH;EAEAS,SAASA,CAACT,OAAe,EAAE;IACzB,OAAO,IAAI,CAACC,aAAa,CACvB,MACE,CAACK,MAAM,CAACC,KAAK,CAACP,OAAO,CAAC,IACtBM,MAAM,CAACI,QAAQ,CAACV,OAAO,CAAC,IACxBM,MAAM,CAACG,SAAS,CAACT,OAAO,CAAC,IACzBA,OAAO,GAAGV,gBAAgB,IAC1BU,OAAO,GAAG,CAACV,gBAAgB,EAC7B,MAAMa,gBAAQ,CAACC,gBAAgB,CAACK,SAAS,CAAC,IAAI,CAACf,YAAY,EAAEM,OAAO,CACtE,CAAC;EACH;EAEAW,cAAcA,CAACX,OAAe,EAAEY,KAAa,EAAE;IAC7C,OAAO,IAAI,CAACX,aAAa,CACvB,MAAMD,OAAO,IAAIY,KAAK,EACtB,MACET,gBAAQ,CAACC,gBAAgB,CAACO,cAAc,CACtC,IAAI,CAACjB,YAAY,EACjBM,OAAO,EACPY,KACF,CACJ,CAAC;EACH;EAEAC,cAAcA,CAACb,OAAY,EAAE;IAC3B,OAAO,IAAI,CAACC,aAAa,CACvB,MAAM,OAAOD,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACc,MAAM,GAAG,CAAC,EACvD,MAAMX,gBAAQ,CAACC,gBAAgB,CAACW,gBAAgB,CAAC,IAAI,CAACrB,YAAY,CACpE,CAAC;EACH;AACF;AAACsB,OAAA,CAAAzB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataAggregateOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\n\n/**\n * @builder\n */\nexport interface WixDataAggregate {\n /**\n * Refines a `WixDataAggregate` to contain the sum from each aggregation group.\n *\n * The `sum()` method refines a `WixDataAggregate` to contain the sum of the\n * values from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldSum\"`, where `field` is the name of the specified field.\n * - The value is the sum of the values found in the specified field.\n *\n * Sums can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the sum.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the sum.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n sum(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.\n *\n * The `avg()` method refines a `WixDataAggregate` to contain the average\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldAvg\"`, where `field` is the name of the specified field.\n * - The value is the average of the values found in the specified field.\n *\n * Averages can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the average value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results containing the average value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n avg(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.\n *\n * The `min()` method refines a `WixDataAggregate` to contain the minimum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMin\"`, where `field` is the name of the specified field.\n * - The value is the minimum value found in the specified field.\n *\n * The following types of fields can be compared to determine a minimum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the minimum value.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the minimum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n min(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.\n *\n * The `max()` method refines a `WixDataAggregate` to contain the maximum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMax\"`, where `field` is the name of the specified field.\n * - The value is the maximum value found in the specified field.\n *\n * The following types of fields can be compared to determine a maximum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the maximum value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results that contains the maximum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n max(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.\n *\n * The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains items with the following additional key:value pair:\n * - The key is named `count`. You can set a custom key using the `projectedField` parameter.\n * - The value is the count of items aggregated in the group.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param projectedField - Field in the aggregation results that contains the count value. Default: `count`.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n count(projectedField?: string): WixDataAggregate\n\n /**\n * Filters out items from being used in an aggregation.\n *\n * The `filter()` method refines a `WixDataAggregate` so that it only\n * includes items from the aggregate's collection which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `filter()` takes place before grouping is performed on the\n * aggregation. To filter grouped results, use the `having()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out items from being used in the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n filter(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Groups items together in an aggregation.\n *\n * The `group()` method refines a `WixDataAggregate` so that its items are\n * grouped by the specified field or fields.\n *\n * You can perform aggregations on the groups using the following methods:\n * - `avg()`\n * - `count()`\n * - `max()`\n * - `min()`\n * - `sum()`\n *\n * To filter grouped results, use the `having()` method.\n *\n * > **Notes:**\n * > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * > - You can only call the `group()` method once per aggregate query.\n * @public\n * @documentationMaturity preview\n * @param field - Field or fields to group on.\n * @requiredField field\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n group(...field: string[]): WixDataAggregate\n\n /**\n * Filters out groups from being returned from an aggregation.\n *\n * The `having()` method refines a `WixDataAggregate` so that it only\n * includes groups from the aggregate's grouping which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `having()` takes place after grouping is performed on the\n * aggregation. To filter items before grouping, use the `filter()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out groups from being returned from the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n having(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Limits the number of items or groups the aggregation returns.\n *\n * The `limit()` method defines the number of results an aggregation returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * method is used to navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param limit - Number of items or groups to return.\n * @requiredField limit\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n limit(limit: number): WixDataAggregate\n\n /**\n * Sets the number of items or groups to skip before returning aggregation results.\n *\n * The `skip()` method defines the number of results to skip in the aggregation\n * results before returning new aggregation results.\n *\n * For example, if you perform an aggregation on a collection and 10 groups match\n * your aggregation, but you set `skip` to 3, the results returned will skip\n * the first 3 groups that match and return the 4th through 10th items.\n *\n * By default, `skip` is set to 0.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param skip - Number of items or groups to skip in the aggregation results before returning the results.\n * @requiredField skip\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n skip(skip: number): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified fields. If you\n * specify more than one field, descending() sorts the results in descending order by each field in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataAggregate\n\n descending(fields: string[]): WixDataAggregate\n\n descending(...fields: any): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified fields. If you specify more\n * than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataAggregate\n\n ascending(fields: string[]): WixDataAggregate\n\n ascending(...fields: any): WixDataAggregate\n\n /**\n * Runs the aggregation and returns the results.\n *\n * The `run()` method returns a Promise that resolves to the results found\n * by the aggregation and some information about the results.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when running an aggregation.\n * @returns Promise that resolves to the results of the aggregation.\n */\n run(\n options?: WixDataAggregateOptions\n ): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataAggregateOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\n\n/**\n * @builder\n */\nexport interface WixDataAggregate {\n /**\n * Refines a `WixDataAggregate` to contain the sum from each aggregation group.\n *\n * The `sum()` method refines a `WixDataAggregate` to contain the sum of the\n * values from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldSum\"`, where `field` is the name of the specified field.\n * - The value is the sum of the values found in the specified field.\n *\n * Sums can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the sum.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the sum.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n sum(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.\n *\n * The `avg()` method refines a `WixDataAggregate` to contain the average\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldAvg\"`, where `field` is the name of the specified field.\n * - The value is the average of the values found in the specified field.\n *\n * Averages can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the average value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results containing the average value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n avg(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.\n *\n * The `min()` method refines a `WixDataAggregate` to contain the minimum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMin\"`, where `field` is the name of the specified field.\n * - The value is the minimum value found in the specified field.\n *\n * The following types of fields can be compared to determine a minimum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the minimum value.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the minimum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n min(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.\n *\n * The `max()` method refines a `WixDataAggregate` to contain the maximum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMax\"`, where `field` is the name of the specified field.\n * - The value is the maximum value found in the specified field.\n *\n * The following types of fields can be compared to determine a maximum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the maximum value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results that contains the maximum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n max(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.\n *\n * The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains items with the following additional key:value pair:\n * - The key is named `count`. You can set a custom key using the `projectedField` parameter.\n * - The value is the count of items aggregated in the group.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param projectedField - Field in the aggregation results that contains the count value. Default: `count`.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n count(projectedField?: string): WixDataAggregate\n\n /**\n * Filters out items from being used in an aggregation.\n *\n * The `filter()` method refines a `WixDataAggregate` so that it only\n * includes items from the aggregate's collection which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `filter()` takes place before grouping is performed on the\n * aggregation. To filter grouped results, use the `having()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out items from being used in the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n filter(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Groups items together in an aggregation.\n *\n * The `group()` method refines a `WixDataAggregate` so that its items are\n * grouped by the specified field or fields.\n *\n * You can perform aggregations on the groups using the following methods:\n * - `avg()`\n * - `count()`\n * - `max()`\n * - `min()`\n * - `sum()`\n *\n * To filter grouped results, use the `having()` method.\n *\n * > **Notes:**\n * > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * > - You can only call the `group()` method once per aggregate query.\n * @public\n * @documentationMaturity preview\n * @param field - Field or fields to group on.\n * @requiredField field\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n group(...field: string[]): WixDataAggregate\n\n /**\n * Filters out groups from being returned from an aggregation.\n *\n * The `having()` method refines a `WixDataAggregate` so that it only\n * includes groups from the aggregate's grouping which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `having()` takes place after grouping is performed on the\n * aggregation. To filter items before grouping, use the `filter()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out groups from being returned from the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n having(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Limits the number of items or groups the aggregation returns.\n *\n * The `limit()` method defines the number of results an aggregation returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * method is used to navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param limit - Number of items or groups to return.\n * @requiredField limit\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n limit(limit: number): WixDataAggregate\n\n /**\n * Sets the number of items or groups to skip before returning aggregation results.\n *\n * The `skip()` method defines the number of results to skip in the aggregation\n * results before returning new aggregation results.\n *\n * For example, if you perform an aggregation on a collection and 10 groups match\n * your aggregation, but you set `skip` to 3, the results returned will skip\n * the first 3 groups that match and return the 4th through 10th items.\n *\n * By default, `skip` is set to 0.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param skip - Number of items or groups to skip in the aggregation results before returning the results.\n * @requiredField skip\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n skip(skip: number): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified fields. If you\n * specify more than one field, descending() sorts the results in descending order by each field in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataAggregate\n\n descending(fields: string[]): WixDataAggregate\n\n descending(...fields: any): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified fields. If you specify more\n * than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataAggregate\n\n ascending(fields: string[]): WixDataAggregate\n\n ascending(...fields: any): WixDataAggregate\n\n /**\n * Runs the aggregation and returns the results.\n *\n * The `run()` method returns a Promise that resolves to the results found\n * by the aggregation and some information about the results.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when running an aggregation.\n * @returns Promise that resolves to the results of the aggregation.\n */\n run(\n options?: WixDataAggregateOptions\n ): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":"","ignoreList":[]}