@wix/motion-edm-autogen-query-wrapper
Advanced tools
Comparing version 1.0.65 to 1.0.66
@@ -25,7 +25,9 @@ import { CursorBasedIterator } from './CursorBasedIterator'; | ||
async find(options = {}) { | ||
var _a, _b, _c, _d; | ||
try { | ||
const query = this._buildQuery(); | ||
const request = this.requestTransformer(query, options); | ||
const response = await this.func(request, Object.assign(Object.assign({}, options), this.builderOptions)); | ||
const response = await this.func(request, { | ||
...options, | ||
...this.builderOptions, | ||
}); | ||
const { [ITEMS_RESULT_PROPERTY_NAME]: items, [PAGING_METADATA_RESULT_PROPERTY_NAME]: pagingMetadata, } = this.responseTransformer(response); | ||
@@ -39,4 +41,4 @@ if (this.pagingMethod === PagingMethods.Offset) { | ||
limit: this._pagingLimit, | ||
totalCount: pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.total, | ||
tooManyToCount: pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.tooManyToCount, | ||
totalCount: pagingMetadata?.total, | ||
tooManyToCount: pagingMetadata?.tooManyToCount, | ||
originQuery: this, | ||
@@ -49,12 +51,6 @@ }); | ||
originQuery: this, | ||
fetchNextPage: () => { | ||
var _a, _b; | ||
return this._copyWithCursor((_b = (_a = pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.cursors) === null || _a === void 0 ? void 0 : _a.next) !== null && _b !== void 0 ? _b : '').find(options); | ||
}, | ||
fetchPrevPage: () => { | ||
var _a, _b; | ||
return this._copyWithCursor((_b = (_a = pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.cursors) === null || _a === void 0 ? void 0 : _a.prev) !== null && _b !== void 0 ? _b : '').find(options); | ||
}, | ||
prevCursor: (_b = (_a = pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.cursors) === null || _a === void 0 ? void 0 : _a.prev) !== null && _b !== void 0 ? _b : '', | ||
nextCursor: (_d = (_c = pagingMetadata === null || pagingMetadata === void 0 ? void 0 : pagingMetadata.cursors) === null || _c === void 0 ? void 0 : _c.next) !== null && _d !== void 0 ? _d : '', | ||
fetchNextPage: () => this._copyWithCursor(pagingMetadata?.cursors?.next ?? '').find(options), | ||
fetchPrevPage: () => this._copyWithCursor(pagingMetadata?.cursors?.prev ?? '').find(options), | ||
prevCursor: pagingMetadata?.cursors?.prev ?? '', | ||
nextCursor: pagingMetadata?.cursors?.next ?? '', | ||
}); | ||
@@ -70,9 +66,8 @@ } | ||
_copyWithCursor(cursor) { | ||
return new PlatformizedQueryMethodWrapper(Object.assign(Object.assign({}, this), { cursor })); | ||
return new PlatformizedQueryMethodWrapper({ ...this, cursor }); | ||
} | ||
_buildQuery() { | ||
var _a; | ||
const queryObject = this.build(); | ||
if (this.pagingMethod === PagingMethods.Cursor) { | ||
if (((_a = this.builderOptions) === null || _a === void 0 ? void 0 : _a.cursorWithEmptyFilterAndSort) && this.cursor) { | ||
if (this.builderOptions?.cursorWithEmptyFilterAndSort && this.cursor) { | ||
return { | ||
@@ -105,3 +100,3 @@ cursorPaging: { cursor: this.cursor, limit: this._pagingLimit }, | ||
}; | ||
return new PlatformizedQueryMethodWrapper(Object.assign(Object.assign({}, this), { paging: nextPage })); | ||
return new PlatformizedQueryMethodWrapper({ ...this, paging: nextPage }); | ||
} | ||
@@ -108,0 +103,0 @@ _copyWithNextPage() { |
{ | ||
"name": "@wix/motion-edm-autogen-query-wrapper", | ||
"version": "1.0.65", | ||
"version": "1.0.66", | ||
"main": "dist/cjs/index.js", | ||
@@ -39,4 +39,4 @@ "module": "dist/esm/index.js", | ||
"@wix/filter-builder": "^1.0.39", | ||
"@wix/motion-edm-autogen-common": "1.38.0", | ||
"@wix/motion-edm-autogen-transformations-core": "1.42.0", | ||
"@wix/motion-edm-autogen-common": "1.39.0", | ||
"@wix/motion-edm-autogen-transformations-core": "1.43.0", | ||
"lodash": "~4.17.0", | ||
@@ -50,3 +50,3 @@ "long": "~4.0.0", | ||
"@wix/com.wixpress.p13n.protos-common-proto": "^1.8.0", | ||
"@wix/jest-yoshi-preset": "^6.88.1", | ||
"@wix/jest-yoshi-preset": "^6.89.0", | ||
"@wix/motion-runtime-test-context": "~1.0.0", | ||
@@ -56,3 +56,3 @@ "@wix/wix-bootstrap-ng": "^1.0.6021", | ||
"@wix/wix-test-env": "^1.0.923", | ||
"@wix/yoshi-flow-library": "^6.88.1", | ||
"@wix/yoshi-flow-library": "^6.89.0", | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
@@ -74,3 +74,3 @@ "jest-environment-node": "^27.5.1", | ||
}, | ||
"falconPackageHash": "bc0650c130e14ad1d02d806bec044f1e5cf3bfccc68e04a586ca00f2" | ||
"falconPackageHash": "92004aedce6128ab13a80ca6f48434dc67d4ee4a60cc56628b90b7f1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3162889
77941
+ Added@wix/motion-edm-autogen-common@1.39.0(transitive)
+ Added@wix/motion-edm-autogen-transformations-core@1.43.0(transitive)
+ Added@wix/motion-edm-autogen-types@1.0.27(transitive)
- Removed@wix/motion-edm-autogen-common@1.38.0(transitive)
- Removed@wix/motion-edm-autogen-transformations-core@1.42.0(transitive)
- Removed@wix/motion-edm-autogen-types@1.0.26(transitive)