Skip to content

Commit c5041c2

Browse files
committed
chore: enforce sys
1 parent 6b43cf8 commit c5041c2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/create-contentful-api.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,13 @@ export default function createContentfulApi<OptionType extends ChainOptions>(
109109
if (areAllowed) {
110110
query.includeContentSourceMaps = true
111111

112-
// Ensure that content source maps related attributes are selected
112+
// Ensure that content source maps and required attributes are selected
113113
if (query.select) {
114114
const selection = getQuerySelectionSet(query)
115115

116-
if (!selection.has('sys')) {
117-
selection.add('sys.contentSourceMaps')
118-
selection.add('sys.contentSourceMapsLookup')
119-
}
116+
selection.add('sys')
120117

121-
query.select = [...selection].join(',')
118+
query.select = Array.from(selection).join(',')
122119
}
123120
}
124121

test/integration/getAssets.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('getAssets', () => {
6262
expect(response.sys?.contentSourceMapsLookup).toBeDefined()
6363
})
6464

65-
it('enforces selection of sys.contentSourceMaps*', async () => {
65+
it('enforces selection of sys if query.select is present', async () => {
6666
const response = await previewClient.getAssets({
6767
select: ['fields.title', 'sys.id', 'sys.type'],
6868
})

0 commit comments

Comments
 (0)