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

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.
@@ -49,6 +49,9 @@ export const patch = (http, params, data, headers) => {
49
49
  };
50
50
  export const update = (http, params, rawData, headers) => {
51
51
  var _rawData$sys$version;
52
+ if (params.releaseId) {
53
+ return releaseEntry.update(http, params, rawData, headers !== null && headers !== void 0 ? headers : {});
54
+ }
52
55
  const data = copy(rawData);
53
56
  delete data.sys;
54
57
  return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
@@ -39,6 +39,17 @@ export const patch = (http, params, data, headers) => {
39
39
  }, headers)
40
40
  });
41
41
  };
42
+ export const create = (http, params, rawData, headers) => {
43
+ params.query = _objectSpread(_objectSpread({}, params.query), {}, {
44
+ 'sys.schemaVersion': 'Release.V2'
45
+ });
46
+ const data = copy(rawData);
47
+ return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries`, data, {
48
+ headers: _objectSpread({
49
+ 'X-Contentful-Content-Type': params.contentTypeId
50
+ }, headers)
51
+ });
52
+ };
42
53
  export const createWithId = (http, params, rawData, headers) => {
43
54
  params.query = _objectSpread(_objectSpread({}, params.query), {}, {
44
55
  'sys.schemaVersion': 'Release.V2'
@@ -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.5"}`, params.application, params.integration, params.feature);
50
+ `${sdkMain}/${"11.55.0-canary.7"}`, params.application, params.integration, params.feature);
51
51
  const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
52
52
  userAgent
53
53
  }));
@@ -348,6 +348,7 @@ export const createPlainClient = (makeRequest, defaults) => {
348
348
  getMany: wrap(wrapParams, 'ReleaseEntry', 'getMany'),
349
349
  update: wrap(wrapParams, 'ReleaseEntry', 'update'),
350
350
  patch: wrap(wrapParams, 'ReleaseEntry', 'patch'),
351
+ create: wrap(wrapParams, 'ReleaseEntry', 'create'),
351
352
  createWithId: wrap(wrapParams, 'ReleaseEntry', 'createWithId')
352
353
  },
353
354
  archive: wrap(wrapParams, 'Release', 'archive'),
@@ -3,4 +3,5 @@ export declare const get: RestEndpoint<'ReleaseEntry', 'get'>;
3
3
  export declare const getMany: RestEndpoint<'ReleaseEntry', 'getMany'>;
4
4
  export declare const update: RestEndpoint<'ReleaseEntry', 'update'>;
5
5
  export declare const patch: RestEndpoint<'ReleaseEntry', 'patch'>;
6
+ export declare const create: RestEndpoint<'ReleaseEntry', 'create'>;
6
7
  export declare const createWithId: RestEndpoint<'ReleaseEntry', 'createWithId'>;
@@ -455,6 +455,7 @@ type MRInternal<UA extends boolean> = {
455
455
  (opts: MROpts<'ReleaseEntry', 'getMany', UA>): MRReturn<'ReleaseEntry', 'getMany'>;
456
456
  (opts: MROpts<'ReleaseEntry', 'update', UA>): MRReturn<'ReleaseEntry', 'update'>;
457
457
  (opts: MROpts<'ReleaseEntry', 'patch', UA>): MRReturn<'ReleaseEntry', 'patch'>;
458
+ (opts: MROpts<'ReleaseEntry', 'create', UA>): MRReturn<'ReleaseEntry', 'create'>;
458
459
  (opts: MROpts<'ReleaseEntry', 'createWithId', UA>): MRReturn<'ReleaseEntry', 'createWithId'>;
459
460
  (opts: MROpts<'Resource', 'getMany', UA>): MRReturn<'Resource', 'getMany'>;
460
461
  (opts: MROpts<'ResourceProvider', 'get', UA>): MRReturn<'ResourceProvider', 'get'>;
@@ -1507,9 +1508,7 @@ export type MRActions = {
1507
1508
  return: EntryProps<any>;
1508
1509
  };
1509
1510
  update: {
1510
- params: GetSpaceEnvironmentParams & {
1511
- entryId: string;
1512
- };
1511
+ params: UpdateEntryParams & QueryParams;
1513
1512
  payload: EntryProps<any>;
1514
1513
  headers?: RawAxiosRequestHeaders;
1515
1514
  return: EntryProps<any>;
@@ -1896,6 +1895,20 @@ export type MRActions = {
1896
1895
  };
1897
1896
  }>;
1898
1897
  };
1898
+ create: {
1899
+ params: CreateReleaseEntryParams;
1900
+ payload: CreateEntryProps<any>;
1901
+ headers?: RawAxiosRequestHeaders;
1902
+ return: EntryProps<any, {
1903
+ release: {
1904
+ sys: {
1905
+ type: 'Link';
1906
+ linkType: 'Entry' | 'Asset';
1907
+ id: string;
1908
+ };
1909
+ };
1910
+ }>;
1911
+ };
1899
1912
  createWithId: {
1900
1913
  params: GetSpaceEnvironmentParams & {
1901
1914
  releaseId: string;
@@ -2598,6 +2611,10 @@ export type PatchEntryParams = GetSpaceEnvironmentParams & {
2598
2611
  version: number;
2599
2612
  releaseId?: string;
2600
2613
  };
2614
+ export type UpdateEntryParams = GetSpaceEnvironmentParams & {
2615
+ entryId: string;
2616
+ releaseId?: string;
2617
+ };
2601
2618
  export type GetExtensionParams = GetSpaceEnvironmentParams & {
2602
2619
  extensionId: string;
2603
2620
  };
@@ -2639,6 +2656,10 @@ export type PatchReleaseEntryParams = GetSpaceEnvironmentParams & {
2639
2656
  entryId: string;
2640
2657
  version: number;
2641
2658
  };
2659
+ export type CreateReleaseEntryParams = GetSpaceEnvironmentParams & {
2660
+ releaseId: string;
2661
+ contentTypeId: string;
2662
+ };
2642
2663
  export type CreateWithIdReleaseEntryParams = GetSpaceEnvironmentParams & {
2643
2664
  releaseId: string;
2644
2665
  entryId: 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, 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, CreateReleaseEntryParams, 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;
@@ -323,6 +321,15 @@ export type PlainClientAPI = {
323
321
  };
324
322
  };
325
323
  }>>;
324
+ create<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<CreateReleaseEntryParams & QueryParams>, rawData: CreateEntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
325
+ release: {
326
+ sys: {
327
+ type: 'Link';
328
+ linkType: 'Entry' | 'Asset';
329
+ id: string;
330
+ };
331
+ };
332
+ }>>;
326
333
  createWithId<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<CreateWithIdReleaseEntryParams & QueryParams>, rawData: CreateEntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
327
334
  release: {
328
335
  sys: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.55.0-canary.5",
3
+ "version": "11.55.0-canary.7",
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",