contentful-management 12.3.2 → 12.4.0

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.
@@ -12661,6 +12661,9 @@ var contentfulManagement = (function (exports) {
12661
12661
  const get$c = (http, params) => get$14(http, `/spaces/${params.spaceId}`);
12662
12662
  const getMany$b = (http, params) => get$14(http, `/spaces`, {
12663
12663
  params: params.query,
12664
+ headers: params.organizationId
12665
+ ? { 'X-Contentful-Organization': params.organizationId }
12666
+ : undefined,
12664
12667
  });
12665
12668
  const getManyForOrganization$5 = (http, params) => get$14(http, `/organizations/${params.organizationId}/spaces`, {
12666
12669
  params: params.query,
@@ -20584,6 +20587,7 @@ var contentfulManagement = (function (exports) {
20584
20587
  * @internal
20585
20588
  */
20586
20589
  const wrapSpaceCollection = wrapCollection(wrapSpace);
20590
+ const wrapSpaceCursorPaginatedCollection = wrapCursorPaginatedCollection(wrapSpace);
20587
20591
 
20588
20592
  /**
20589
20593
  * @internal
@@ -23099,12 +23103,20 @@ var contentfulManagement = (function (exports) {
23099
23103
  * .catch(console.error)
23100
23104
  * ```
23101
23105
  */
23102
- getSpaces: function getSpaces(query = {}) {
23106
+ getSpaces: function getSpaces(query = {}, organizationId) {
23107
+ const { cursor, ...rest } = query;
23108
+ const normalizedQuery = cursor
23109
+ ? normalizeCursorPaginationParameters(rest)
23110
+ : rest;
23103
23111
  return makeRequest({
23104
23112
  entityType: 'Space',
23105
23113
  action: 'getMany',
23106
- params: { query: createRequestConfig({ query: query }).params },
23107
- }).then((data) => wrapSpaceCollection(makeRequest, data));
23114
+ params: { query: createRequestConfig({ query: normalizedQuery }).params, organizationId },
23115
+ }).then((data) =>
23116
+ // makeRequest returns the union type; cursor determines which branch is present at runtime so the casts are required
23117
+ cursor
23118
+ ? wrapSpaceCursorPaginatedCollection(makeRequest, normalizeCursorPaginationResponse(data))
23119
+ : wrapSpaceCollection(makeRequest, data));
23108
23120
  },
23109
23121
  /**
23110
23122
  * Gets a space