contentful-management 11.55.0-canary.4 → 11.55.0-canary.6

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,6 +5,7 @@ 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';
9
10
  import * as releaseEntry from './release-entry';
10
11
  export const get = (http, params, rawData, headers) => {
@@ -48,6 +49,9 @@ export const patch = (http, params, data, headers) => {
48
49
  };
49
50
  export const update = (http, params, rawData, headers) => {
50
51
  var _rawData$sys$version;
52
+ if (params.releaseId) {
53
+ return releaseEntry.update(http, params, rawData, headers !== null && headers !== void 0 ? headers : {});
54
+ }
51
55
  const data = copy(rawData);
52
56
  delete data.sys;
53
57
  return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
@@ -108,12 +112,16 @@ export const create = (http, params, rawData) => {
108
112
  });
109
113
  };
110
114
  export const createWithId = (http, params, rawData) => {
111
- const data = copy(rawData);
112
- return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
113
- headers: {
114
- 'X-Contentful-Content-Type': params.contentTypeId
115
- }
116
- });
115
+ if (params.releaseId) {
116
+ return createWithIdReleaseEntry(http, params, rawData, {});
117
+ } else {
118
+ const data = copy(rawData);
119
+ return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
120
+ headers: {
121
+ 'X-Contentful-Content-Type': params.contentTypeId
122
+ }
123
+ });
124
+ }
117
125
  };
118
126
  export const references = (http, params) => {
119
127
  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.4"}`, params.application, params.integration, params.feature);
50
+ `${sdkMain}/${"11.55.0-canary.6"}`, params.application, params.integration, params.feature);
51
51
  const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
52
52
  userAgent
53
53
  }));
@@ -1507,9 +1507,7 @@ export type MRActions = {
1507
1507
  return: EntryProps<any>;
1508
1508
  };
1509
1509
  update: {
1510
- params: GetSpaceEnvironmentParams & {
1511
- entryId: string;
1512
- };
1510
+ params: UpdateEntryParams & QueryParams;
1513
1511
  payload: EntryProps<any>;
1514
1512
  headers?: RawAxiosRequestHeaders;
1515
1513
  return: EntryProps<any>;
@@ -1556,9 +1554,10 @@ export type MRActions = {
1556
1554
  params: GetSpaceEnvironmentParams & {
1557
1555
  entryId: string;
1558
1556
  contentTypeId: string;
1557
+ releaseId?: string;
1559
1558
  };
1560
1559
  payload: CreateEntryProps<any>;
1561
- return: EntryProps<any>;
1560
+ return: EntryProps<any, any>;
1562
1561
  };
1563
1562
  references: {
1564
1563
  params: GetSpaceEnvironmentParams & {
@@ -2597,6 +2596,10 @@ export type PatchEntryParams = GetSpaceEnvironmentParams & {
2597
2596
  version: number;
2598
2597
  releaseId?: string;
2599
2598
  };
2599
+ export type UpdateEntryParams = GetSpaceEnvironmentParams & {
2600
+ entryId: string;
2601
+ releaseId?: string;
2602
+ };
2600
2603
  export type GetExtensionParams = GetSpaceEnvironmentParams & {
2601
2604
  extensionId: string;
2602
2605
  };
@@ -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, GetEntryParams, GetEnvironmentTemplateParams, GetManyEntryParams, GetManyReleaseEntryParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseEntryParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, PatchEntryParams, 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, UpdateEntryParams, 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';
@@ -180,9 +180,7 @@ export type PlainClientAPI = {
180
180
  };
181
181
  };
182
182
  }>>;
183
- update<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
184
- entryId: string;
185
- }>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
183
+ update<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<UpdateEntryParams & QueryParams>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
186
184
  patch<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<PatchEntryParams & QueryParams>, rawData: OpPatch[], headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
187
185
  delete(params: OptionalDefaults<GetSpaceEnvironmentParams & {
188
186
  entryId: string;
@@ -207,7 +205,16 @@ export type PlainClientAPI = {
207
205
  createWithId<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
208
206
  entryId: string;
209
207
  contentTypeId: string;
210
- }>, rawData: CreateEntryProps<T>): Promise<EntryProps<T>>;
208
+ releaseId?: string;
209
+ }>, rawData: CreateEntryProps<T>): Promise<EntryProps<T, {
210
+ release: {
211
+ sys: {
212
+ type: 'Link';
213
+ linkType: 'Entry' | 'Asset';
214
+ id: string;
215
+ };
216
+ };
217
+ }>>;
211
218
  references(params: OptionalDefaults<GetSpaceEnvironmentParams & {
212
219
  entryId: string;
213
220
  include?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.55.0-canary.4",
3
+ "version": "11.55.0-canary.6",
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",