diff --git a/package-lock.json b/package-lock.json index b514396..d9b28a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/delivery-sdk", - "version": "4.4.0", + "version": "4.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/delivery-sdk", - "version": "4.4.0", + "version": "4.4.1", "dependencies": { "@contentstack/core": "^1.1.0", "@contentstack/utils": "^1.3.8", diff --git a/src/lib/base-query.ts b/src/lib/base-query.ts index 91b77ce..3e88255 100644 --- a/src/lib/base-query.ts +++ b/src/lib/base-query.ts @@ -209,7 +209,7 @@ export class BaseQuery extends Pagination { requestParams = { ...this._queryParams, query: { ...this._parameters } }; } - const getRequestOptions: any = { params: requestParams }; + const getRequestOptions: any = requestParams; if (this._variants) { getRequestOptions.headers = { @@ -217,7 +217,6 @@ export class BaseQuery extends Pagination { 'x-cs-variant-uid': this._variants }; } - const response = await getData(this._client, this._urlPath, getRequestOptions); return response as FindResponse; diff --git a/src/lib/entry-queryable.ts b/src/lib/entry-queryable.ts index c3f4fa8..57c1edd 100644 --- a/src/lib/entry-queryable.ts +++ b/src/lib/entry-queryable.ts @@ -25,7 +25,6 @@ export class EntryQueryable extends BaseQuery { } else { this._queryParams["only[BASE][]"] = fieldUid; } - return this; } diff --git a/test/api/entry-queryables.spec.ts b/test/api/entry-queryables.spec.ts index 8763f14..a57c6f1 100644 --- a/test/api/entry-queryables.spec.ts +++ b/test/api/entry-queryables.spec.ts @@ -258,6 +258,28 @@ describe('Query Operators API test cases', () => { } }); + + it('should check for projected fields after only filter is applied', async () => { + const query = makeEntries('contenttype_uid2').only(['title', 'reference']) + const result = await query.find(); + if (result.entries) { + expect(result.entries.length).toBeGreaterThan(0); + expect(result.entries[0].reference).toBeDefined(); + expect(result.entries[0].title).toBeDefined(); + expect(result.entries[0]._version).toBeUndefined(); + } + }); + + it('should ignore fields after except filter is applied', async () => { + const query = makeEntries('contenttype_uid2').except(['title', 'reference']) + const result = await query.find(); + if (result.entries) { + expect(result.entries.length).toBeGreaterThan(0); + expect(result.entries[0].reference).toBeUndefined(); + expect(result.entries[0].title).toBeUndefined(); + expect(result.entries[0]._version).toBeDefined(); + } + }); }); function makeEntries(contentTypeUid = ''): Entries {