contentful-management 11.55.0-canary.3 → 11.55.0-canary.5

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.
@@ -5,7 +5,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
6
  import copy from 'fast-copy';
7
7
  import * as raw from './raw';
8
+ import { createWithId as createWithIdReleaseEntry } from './release-entry';
8
9
  import { normalizeSelect } from './utils';
10
+ import * as releaseEntry from './release-entry';
9
11
  export const get = (http, params, rawData, headers) => {
10
12
  if (params.releaseId) {
11
13
  params.query = _objectSpread(_objectSpread({}, params.query), {}, {
@@ -35,6 +37,9 @@ export const getMany = (http, params, rawData, headers) => {
35
37
  });
36
38
  };
37
39
  export const patch = (http, params, data, headers) => {
40
+ if (params.releaseId) {
41
+ return releaseEntry.patch(http, params, data, headers !== null && headers !== void 0 ? headers : {});
42
+ }
38
43
  return raw.patch(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
39
44
  headers: _objectSpread({
40
45
  'X-Contentful-Version': params.version,
@@ -104,12 +109,16 @@ export const create = (http, params, rawData) => {
104
109
  });
105
110
  };
106
111
  export const createWithId = (http, params, rawData) => {
107
- const data = copy(rawData);
108
- return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
109
- headers: {
110
- 'X-Contentful-Content-Type': params.contentTypeId
111
- }
112
- });
112
+ if (params.releaseId) {
113
+ return createWithIdReleaseEntry(http, params, rawData, {});
114
+ } else {
115
+ const data = copy(rawData);
116
+ return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
117
+ headers: {
118
+ 'X-Contentful-Content-Type': params.contentTypeId
119
+ }
120
+ });
121
+ }
113
122
  };
114
123
  export const references = (http, params) => {
115
124
  const {
@@ -47,7 +47,7 @@ function createClient(params, opts = {}) {
47
47
  const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
48
48
  const userAgent = getUserAgentHeader(
49
49
  // @ts-expect-error
50
- `${sdkMain}/${"11.55.0-canary.3"}`, params.application, params.integration, params.feature);
50
+ `${sdkMain}/${"11.55.0-canary.5"}`, params.application, params.integration, params.feature);
51
51
  const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
52
52
  userAgent
53
53
  }));
@@ -1493,20 +1493,15 @@ export type MRActions = {
1493
1493
  return: CollectionProp<EntryProps<any>>;
1494
1494
  };
1495
1495
  getMany: {
1496
- params: GetSpaceEnvironmentParams & QueryParams & {
1497
- releaseId?: string;
1498
- };
1496
+ params: GetManyEntryParams & QueryParams;
1499
1497
  return: CollectionProp<EntryProps<any, any>>;
1500
1498
  };
1501
1499
  get: {
1502
- params: GetReleaseEntryParams & QueryParams;
1500
+ params: GetEntryParams & QueryParams;
1503
1501
  return: EntryProps<any, any>;
1504
1502
  };
1505
1503
  patch: {
1506
- params: GetSpaceEnvironmentParams & {
1507
- entryId: string;
1508
- version: number;
1509
- };
1504
+ params: PatchEntryParams & QueryParams;
1510
1505
  payload: OpPatch[];
1511
1506
  headers?: RawAxiosRequestHeaders;
1512
1507
  return: EntryProps<any>;
@@ -1561,9 +1556,10 @@ export type MRActions = {
1561
1556
  params: GetSpaceEnvironmentParams & {
1562
1557
  entryId: string;
1563
1558
  contentTypeId: string;
1559
+ releaseId?: string;
1564
1560
  };
1565
1561
  payload: CreateEntryProps<any>;
1566
- return: EntryProps<any>;
1562
+ return: EntryProps<any, any>;
1567
1563
  };
1568
1564
  references: {
1569
1565
  params: GetSpaceEnvironmentParams & {
@@ -2592,6 +2588,15 @@ export type GetEditorInterfaceParams = GetSpaceEnvironmentParams & {
2592
2588
  };
2593
2589
  export type GetEntryParams = GetSpaceEnvironmentParams & {
2594
2590
  entryId: string;
2591
+ releaseId?: string;
2592
+ };
2593
+ export type GetManyEntryParams = GetSpaceEnvironmentParams & {
2594
+ releaseId?: string;
2595
+ };
2596
+ export type PatchEntryParams = GetSpaceEnvironmentParams & {
2597
+ entryId: string;
2598
+ version: number;
2599
+ releaseId?: string;
2595
2600
  };
2596
2601
  export type GetExtensionParams = GetSpaceEnvironmentParams & {
2597
2602
  extensionId: string;
@@ -1,6 +1,6 @@
1
1
  import type { RawAxiosRequestConfig, RawAxiosRequestHeaders } from 'axios';
2
2
  import type { OpPatch } from 'json-patch';
3
- import type { BasicCursorPaginationOptions, CollectionProp, CreateWithIdReleaseEntryParams, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetManyReleaseEntryParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseEntryParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, PatchReleaseEntryParams, QueryParams, ReleaseEnvironmentParams, UpdateReleaseEntryParams } from '../common-types';
3
+ import type { BasicCursorPaginationOptions, CollectionProp, CreateWithIdReleaseEntryParams, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEntryParams, GetEnvironmentTemplateParams, GetManyEntryParams, GetManyReleaseEntryParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseEntryParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, PatchEntryParams, PatchReleaseEntryParams, QueryParams, ReleaseEnvironmentParams, UpdateReleaseEntryParams } from '../common-types';
4
4
  import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps } from '../entities/access-token';
5
5
  import type { ApiKeyProps, CreateApiKeyProps } from '../entities/api-key';
6
6
  import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from '../entities/asset';
@@ -162,9 +162,7 @@ export type PlainClientAPI = {
162
162
  user: UserPlainClientAPI;
163
163
  entry: {
164
164
  getPublished<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T>>>;
165
- getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
166
- releaseId?: string;
167
- }>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T, {
165
+ getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetManyEntryParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T, {
168
166
  release: {
169
167
  sys: {
170
168
  type: 'Link';
@@ -173,7 +171,7 @@ export type PlainClientAPI = {
173
171
  };
174
172
  };
175
173
  }>>>;
176
- get<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetReleaseEntryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
174
+ get<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetEntryParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
177
175
  release: {
178
176
  sys: {
179
177
  type: 'Link';
@@ -185,10 +183,7 @@ export type PlainClientAPI = {
185
183
  update<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
186
184
  entryId: string;
187
185
  }>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
188
- patch<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
189
- entryId: string;
190
- version?: number;
191
- }>, rawData: OpPatch[], headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
186
+ patch<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<PatchEntryParams & QueryParams>, rawData: OpPatch[], headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
192
187
  delete(params: OptionalDefaults<GetSpaceEnvironmentParams & {
193
188
  entryId: string;
194
189
  }>): Promise<any>;
@@ -212,7 +207,16 @@ export type PlainClientAPI = {
212
207
  createWithId<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
213
208
  entryId: string;
214
209
  contentTypeId: string;
215
- }>, rawData: CreateEntryProps<T>): Promise<EntryProps<T>>;
210
+ releaseId?: string;
211
+ }>, rawData: CreateEntryProps<T>): Promise<EntryProps<T, {
212
+ release: {
213
+ sys: {
214
+ type: 'Link';
215
+ linkType: 'Entry' | 'Asset';
216
+ id: string;
217
+ };
218
+ };
219
+ }>>;
216
220
  references(params: OptionalDefaults<GetSpaceEnvironmentParams & {
217
221
  entryId: string;
218
222
  include?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.55.0-canary.3",
3
+ "version": "11.55.0-canary.5",
4
4
  "description": "Client for Contentful's Content Management API",
5
5
  "homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
6
6
  "main": "./dist/contentful-management.node.js",