contentful-management 11.62.1 → 11.63.0-dx-542-update-to-gha.1

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.
@@ -10,4 +10,16 @@ export const unpublish = (http, params, payload) => {
10
10
  };
11
11
  export const validate = (http, params, payload) => {
12
12
  return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions/validate`, payload);
13
+ };
14
+ export const getV2 = (http, params) => {
15
+ return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions/${params.bulkActionId}`);
16
+ };
17
+ export const publishV2 = (http, params, payload) => {
18
+ return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions`, payload);
19
+ };
20
+ export const unpublishV2 = (http, params, payload) => {
21
+ return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions`, payload);
22
+ };
23
+ export const validateV2 = (http, params, payload) => {
24
+ return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions`, payload);
13
25
  };
@@ -12,6 +12,18 @@ export const wrapCollection = fn => (makeRequest, data, ...rest) => {
12
12
  // @ts-expect-error
13
13
  return collectionData;
14
14
  };
15
+
16
+ /**
17
+ * @private
18
+ * Function for endpoints allowing `?cursor=true` wrapping the call
19
+ * to ensure the correct return type for cursor based pagination
20
+ * when `cursor: true`.
21
+ */
22
+ export const withOptionalCursorApi = fn => {
23
+ return function (args) {
24
+ return fn.call(this, args);
25
+ };
26
+ };
15
27
  export const wrapCursorPaginatedCollection = fn => (makeRequest, data, ...rest) => {
16
28
  const collectionData = toPlainObject(copy(data));
17
29
  // @ts-expect-error
@@ -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.62.1"}`, params.application, params.integration, params.feature);
50
+ `${sdkMain}/${"11.63.0-dx-542-update-to-gha.1"}`, params.application, params.integration, params.feature);
51
51
  const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
52
52
  userAgent
53
53
  }));
@@ -17,6 +17,7 @@ import { wrapEnvironmentTemplateInstallationCollection } from './entities/enviro
17
17
  import { wrapFunctionCollection } from './entities/function';
18
18
  import { wrapFunctionLog, wrapFunctionLogCollection } from './entities/function-log';
19
19
  import { wrapAiActionInvocation } from './entities/ai-action-invocation';
20
+ import { withOptionalCursorApi } from './common-utils';
20
21
 
21
22
  /**
22
23
  * @private
@@ -468,7 +469,7 @@ export default function createEnvironmentApi(makeRequest) {
468
469
  * .catch(console.error)
469
470
  * ```
470
471
  */
471
- getContentTypes(query = {}) {
472
+ getContentTypes: withOptionalCursorApi(function (query = {}) {
472
473
  const raw = this.toPlainObject();
473
474
  return makeRequest({
474
475
  entityType: 'ContentType',
@@ -481,7 +482,7 @@ export default function createEnvironmentApi(makeRequest) {
481
482
  }).params
482
483
  }
483
484
  }).then(data => wrapContentTypeCollection(makeRequest, data));
484
- },
485
+ }),
485
486
  /**
486
487
  * Creates a Content Type
487
488
  * @param data - Object representation of the Content Type to be created
@@ -712,7 +713,7 @@ export default function createEnvironmentApi(makeRequest) {
712
713
  * .catch(console.error)
713
714
  * ```
714
715
  */
715
- getEntries(query = {}) {
716
+ getEntries: withOptionalCursorApi(function (query = {}) {
716
717
  const raw = this.toPlainObject();
717
718
  return makeRequest({
718
719
  entityType: 'Entry',
@@ -725,7 +726,7 @@ export default function createEnvironmentApi(makeRequest) {
725
726
  }).params
726
727
  }
727
728
  }).then(data => wrapEntryCollection(makeRequest, data));
728
- },
729
+ }),
729
730
  /**
730
731
  * Gets a collection of published Entries
731
732
  * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
@@ -744,7 +745,7 @@ export default function createEnvironmentApi(makeRequest) {
744
745
  * .catch(console.error)
745
746
  * ```
746
747
  */
747
- getPublishedEntries(query = {}) {
748
+ getPublishedEntries: withOptionalCursorApi(function (query = {}) {
748
749
  const raw = this.toPlainObject();
749
750
  return makeRequest({
750
751
  entityType: 'Entry',
@@ -757,7 +758,7 @@ export default function createEnvironmentApi(makeRequest) {
757
758
  }).params
758
759
  }
759
760
  }).then(data => wrapEntryCollection(makeRequest, data));
760
- },
761
+ }),
761
762
  /**
762
763
  * Creates a Entry
763
764
  * @param contentTypeId - The Content Type ID of the newly created Entry
@@ -928,7 +929,7 @@ export default function createEnvironmentApi(makeRequest) {
928
929
  * .catch(console.error)
929
930
  * ```
930
931
  */
931
- getAssets(query = {}) {
932
+ getAssets: withOptionalCursorApi(function (query = {}) {
932
933
  const raw = this.toPlainObject();
933
934
  return makeRequest({
934
935
  entityType: 'Asset',
@@ -941,7 +942,7 @@ export default function createEnvironmentApi(makeRequest) {
941
942
  }).params
942
943
  }
943
944
  }).then(data => wrapAssetCollection(makeRequest, data));
944
- },
945
+ }),
945
946
  /**
946
947
  * Gets a collection of published Assets
947
948
  * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
@@ -960,7 +961,7 @@ export default function createEnvironmentApi(makeRequest) {
960
961
  * .catch(console.error)
961
962
  * ```
962
963
  */
963
- getPublishedAssets(query = {}) {
964
+ getPublishedAssets: withOptionalCursorApi(function (query = {}) {
964
965
  const raw = this.toPlainObject();
965
966
  return makeRequest({
966
967
  entityType: 'Asset',
@@ -973,7 +974,7 @@ export default function createEnvironmentApi(makeRequest) {
973
974
  }).params
974
975
  }
975
976
  }).then(data => wrapAssetCollection(makeRequest, data));
976
- },
977
+ }),
977
978
  /**
978
979
  * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
979
980
  * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
@@ -211,7 +211,11 @@ export const createPlainClient = (makeRequest, defaults) => {
211
211
  get: wrap(wrapParams, 'BulkAction', 'get'),
212
212
  publish: wrap(wrapParams, 'BulkAction', 'publish'),
213
213
  unpublish: wrap(wrapParams, 'BulkAction', 'unpublish'),
214
- validate: wrap(wrapParams, 'BulkAction', 'validate')
214
+ validate: wrap(wrapParams, 'BulkAction', 'validate'),
215
+ getV2: wrap(wrapParams, 'BulkAction', 'getV2'),
216
+ publishV2: wrap(wrapParams, 'BulkAction', 'publishV2'),
217
+ unpublishV2: wrap(wrapParams, 'BulkAction', 'unpublishV2'),
218
+ validateV2: wrap(wrapParams, 'BulkAction', 'validateV2')
215
219
  },
216
220
  comment: {
217
221
  get: wrap(wrapParams, 'Comment', 'get'),
@@ -3,3 +3,7 @@ export declare const get: RestEndpoint<'BulkAction', 'get'>;
3
3
  export declare const publish: RestEndpoint<'BulkAction', 'publish'>;
4
4
  export declare const unpublish: RestEndpoint<'BulkAction', 'unpublish'>;
5
5
  export declare const validate: RestEndpoint<'BulkAction', 'validate'>;
6
+ export declare const getV2: RestEndpoint<'BulkAction', 'getV2'>;
7
+ export declare const publishV2: RestEndpoint<'BulkAction', 'publishV2'>;
8
+ export declare const unpublishV2: RestEndpoint<'BulkAction', 'unpublishV2'>;
9
+ export declare const validateV2: RestEndpoint<'BulkAction', 'validateV2'>;
@@ -14,7 +14,7 @@ import type { AppSigningSecretProps, CreateAppSigningSecretProps } from './entit
14
14
  import type { AppUploadProps } from './entities/app-upload';
15
15
  import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from './entities/asset';
16
16
  import type { AssetKeyProps, CreateAssetKeyProps } from './entities/asset-key';
17
- import type { BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from './entities/bulk-action';
17
+ import type { BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionV2Payload, BulkActionValidatePayload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload } from './entities/bulk-action';
18
18
  import type { CommentProps, CreateCommentParams, CreateCommentProps, DeleteCommentParams, GetCommentParentEntityParams, GetManyCommentsParams, PlainTextBodyFormat, RichTextBodyFormat, RichTextCommentBodyPayload, RichTextCommentProps, UpdateCommentParams, UpdateCommentProps } from './entities/comment';
19
19
  import type { ContentTypeProps, CreateContentTypeProps } from './entities/content-type';
20
20
  import type { EditorInterfaceProps } from './entities/editor-interface';
@@ -213,6 +213,23 @@ export interface BasicCursorPaginationOptions extends Omit<BasicQueryOptions, 's
213
213
  interface CursorPaginationBase {
214
214
  limit?: number;
215
215
  }
216
+ export type OptionalCursorApi<P, T, TPlain> = {
217
+ (query: P & CursorBasedParams['query'] & {
218
+ cursor: true;
219
+ skip?: never;
220
+ }): Promise<CursorPaginatedCollection<T, TPlain>>;
221
+ (query?: P & {
222
+ cursor?: false | undefined | never;
223
+ }): Promise<Collection<T, TPlain>>;
224
+ (query?: P): Promise<Collection<T, TPlain>>;
225
+ };
226
+ type WithCursorPagination<O> = O & {
227
+ params: {
228
+ query: {
229
+ cursor: true;
230
+ };
231
+ };
232
+ };
216
233
  interface CursorPaginationPageNext extends CursorPaginationBase {
217
234
  pageNext: string;
218
235
  pagePrev?: never;
@@ -293,7 +310,9 @@ type MRInternal<UA extends boolean> = {
293
310
  (opts: MROpts<'AppInstallation', 'upsert', UA>): MRReturn<'AppInstallation', 'upsert'>;
294
311
  (opts: MROpts<'AppInstallation', 'delete', UA>): MRReturn<'AppInstallation', 'delete'>;
295
312
  (opts: MROpts<'AppInstallation', 'getForOrganization', UA>): MRReturn<'AppInstallation', 'getForOrganization'>;
313
+ (opts: WithCursorPagination<MROpts<'Asset', 'getMany', UA>>): Promise<CursorPaginatedCollectionProp<AssetProps>>;
296
314
  (opts: MROpts<'Asset', 'getMany', UA>): MRReturn<'Asset', 'getMany'>;
315
+ (opts: WithCursorPagination<MROpts<'Asset', 'getPublished', UA>>): Promise<CursorPaginatedCollectionProp<AssetProps>>;
297
316
  (opts: MROpts<'Asset', 'getPublished', UA>): MRReturn<'Asset', 'getPublished'>;
298
317
  (opts: MROpts<'Asset', 'get', UA>): MRReturn<'Asset', 'get'>;
299
318
  (opts: MROpts<'Asset', 'update', UA>): MRReturn<'Asset', 'update'>;
@@ -330,6 +349,10 @@ type MRInternal<UA extends boolean> = {
330
349
  (opts: MROpts<'BulkAction', 'publish', UA>): MRReturn<'BulkAction', 'publish'>;
331
350
  (opts: MROpts<'BulkAction', 'unpublish', UA>): MRReturn<'BulkAction', 'unpublish'>;
332
351
  (opts: MROpts<'BulkAction', 'validate', UA>): MRReturn<'BulkAction', 'validate'>;
352
+ (opts: MROpts<'BulkAction', 'getV2', UA>): MRReturn<'BulkAction', 'getV2'>;
353
+ (opts: MROpts<'BulkAction', 'publishV2', UA>): MRReturn<'BulkAction', 'publishV2'>;
354
+ (opts: MROpts<'BulkAction', 'unpublishV2', UA>): MRReturn<'BulkAction', 'unpublishV2'>;
355
+ (opts: MROpts<'BulkAction', 'validateV2', UA>): MRReturn<'BulkAction', 'validateV2'>;
333
356
  (opts: MROpts<'Comment', 'get', UA>): MRReturn<'Comment', 'get'>;
334
357
  (opts: MROpts<'Comment', 'getMany', UA>): MRReturn<'Comment', 'getMany'>;
335
358
  (opts: MROpts<'Comment', 'getAll', UA>): MRReturn<'Comment', 'getAll'>;
@@ -356,6 +379,7 @@ type MRInternal<UA extends boolean> = {
356
379
  (opts: MROpts<'ConceptScheme', 'updatePut', UA>): MRReturn<'ConceptScheme', 'updatePut'>;
357
380
  (opts: MROpts<'ConceptScheme', 'delete', UA>): MRReturn<'ConceptScheme', 'delete'>;
358
381
  (opts: MROpts<'ContentType', 'get', UA>): MRReturn<'ContentType', 'get'>;
382
+ (opts: WithCursorPagination<MROpts<'ContentType', 'getMany', UA>>): Promise<CursorPaginatedCollectionProp<ConceptProps>>;
359
383
  (opts: MROpts<'ContentType', 'getMany', UA>): MRReturn<'ContentType', 'getMany'>;
360
384
  (opts: MROpts<'ContentType', 'update', UA>): MRReturn<'ContentType', 'update'>;
361
385
  (opts: MROpts<'ContentType', 'create', UA>): MRReturn<'ContentType', 'create'>;
@@ -364,6 +388,7 @@ type MRInternal<UA extends boolean> = {
364
388
  (opts: MROpts<'ContentType', 'publish', UA>): MRReturn<'ContentType', 'publish'>;
365
389
  (opts: MROpts<'ContentType', 'unpublish', UA>): MRReturn<'ContentType', 'unpublish'>;
366
390
  (opts: MROpts<'EditorInterface', 'get', UA>): MRReturn<'EditorInterface', 'get'>;
391
+ (opts: WithCursorPagination<MROpts<'EditorInterface', 'getMany', UA>>): Promise<CursorPaginatedCollectionProp<EditorInterfaceProps>>;
367
392
  (opts: MROpts<'EditorInterface', 'getMany', UA>): MRReturn<'EditorInterface', 'getMany'>;
368
393
  (opts: MROpts<'EditorInterface', 'update', UA>): MRReturn<'EditorInterface', 'update'>;
369
394
  (opts: MROpts<'Environment', 'get', UA>): MRReturn<'Environment', 'get'>;
@@ -389,7 +414,9 @@ type MRInternal<UA extends boolean> = {
389
414
  (opts: MROpts<'EnvironmentTemplate', 'disconnect', UA>): MRReturn<'EnvironmentTemplate', 'disconnect'>;
390
415
  (opts: MROpts<'EnvironmentTemplateInstallation', 'getMany', UA>): MRReturn<'EnvironmentTemplateInstallation', 'getMany'>;
391
416
  (opts: MROpts<'EnvironmentTemplateInstallation', 'getForEnvironment', UA>): MRReturn<'EnvironmentTemplateInstallation', 'getForEnvironment'>;
417
+ (opts: WithCursorPagination<MROpts<'Entry', 'getMany', UA>>): Promise<CursorPaginatedCollectionProp<EntryProps>>;
392
418
  (opts: MROpts<'Entry', 'getMany', UA>): MRReturn<'Entry', 'getMany'>;
419
+ (opts: WithCursorPagination<MROpts<'Entry', 'getPublished', UA>>): Promise<CursorPaginatedCollectionProp<EntryProps>>;
393
420
  (opts: MROpts<'Entry', 'getPublished', UA>): MRReturn<'Entry', 'getPublished'>;
394
421
  (opts: MROpts<'Entry', 'get', UA>): MRReturn<'Entry', 'get'>;
395
422
  (opts: MROpts<'Entry', 'patch', UA>): MRReturn<'Entry', 'patch'>;
@@ -1176,6 +1203,25 @@ export type MRActions = {
1176
1203
  payload: BulkActionValidatePayload;
1177
1204
  return: BulkActionProps<BulkActionValidatePayload>;
1178
1205
  };
1206
+ getV2: {
1207
+ params: GetBulkActionParams;
1208
+ return: BulkActionProps<BulkActionV2Payload>;
1209
+ };
1210
+ publishV2: {
1211
+ params: GetSpaceEnvironmentParams;
1212
+ payload: PublishBulkActionV2Payload<'add'>;
1213
+ return: BulkActionProps<PublishBulkActionV2Payload<'add'>>;
1214
+ };
1215
+ unpublishV2: {
1216
+ params: GetSpaceEnvironmentParams;
1217
+ payload: PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload;
1218
+ return: BulkActionProps<PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload>;
1219
+ };
1220
+ validateV2: {
1221
+ params: GetSpaceEnvironmentParams;
1222
+ payload: ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>;
1223
+ return: BulkActionProps<ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>>;
1224
+ };
1179
1225
  };
1180
1226
  Comment: {
1181
1227
  get: {
@@ -1,8 +1,15 @@
1
- import type { Collection, CollectionProp, CursorPaginatedCollection, CursorPaginatedCollectionProp, MakeRequest } from './common-types';
1
+ import type { Collection, CollectionProp, CursorPaginatedCollection, CursorPaginatedCollectionProp, MakeRequest, OptionalCursorApi } from './common-types';
2
2
  /**
3
3
  * @private
4
4
  */
5
5
  export declare const wrapCollection: <R, T, Rest extends any[]>(fn: (makeRequest: MakeRequest, entity: T, ...rest: Rest) => R) => (makeRequest: MakeRequest, data: CollectionProp<T>, ...rest: Rest) => Collection<R, T>;
6
+ /**
7
+ * @private
8
+ * Function for endpoints allowing `?cursor=true` wrapping the call
9
+ * to ensure the correct return type for cursor based pagination
10
+ * when `cursor: true`.
11
+ */
12
+ export declare const withOptionalCursorApi: <P, T, TPlain>(fn: OptionalCursorApi<P, T, TPlain>) => OptionalCursorApi<P, T, TPlain>;
6
13
  export declare const wrapCursorPaginatedCollection: <R, T, Rest extends any[]>(fn: (makeRequest: MakeRequest, entity: T, ...rest: Rest) => R) => (makeRequest: MakeRequest, data: CursorPaginatedCollectionProp<T>, ...rest: Rest) => CursorPaginatedCollection<R, T>;
7
14
  export declare function isSuccessful(statusCode: number): boolean;
8
15
  export declare function shouldRePoll(statusCode: number): boolean;
@@ -326,7 +326,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
326
326
  * .catch(console.error)
327
327
  * ```
328
328
  */
329
- getContentTypes(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/content-type").ContentType, ContentTypeProps>>;
329
+ getContentTypes: import("./common-types").OptionalCursorApi<QueryOptions, import("./entities/content-type").ContentType, ContentTypeProps>;
330
330
  /**
331
331
  * Creates a Content Type
332
332
  * @param data - Object representation of the Content Type to be created
@@ -486,7 +486,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
486
486
  * .catch(console.error)
487
487
  * ```
488
488
  */
489
- getEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>>;
489
+ getEntries: import("./common-types").OptionalCursorApi<QueryOptions, import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>;
490
490
  /**
491
491
  * Gets a collection of published Entries
492
492
  * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
@@ -505,7 +505,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
505
505
  * .catch(console.error)
506
506
  * ```
507
507
  */
508
- getPublishedEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>>;
508
+ getPublishedEntries: import("./common-types").OptionalCursorApi<QueryOptions, import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>;
509
509
  /**
510
510
  * Creates a Entry
511
511
  * @param contentTypeId - The Content Type ID of the newly created Entry
@@ -625,7 +625,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
625
625
  * .catch(console.error)
626
626
  * ```
627
627
  */
628
- getAssets(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/asset").Asset, AssetProps<{}>>>;
628
+ getAssets: import("./common-types").OptionalCursorApi<QueryOptions, import("./entities/asset").Asset, AssetProps<{}>>;
629
629
  /**
630
630
  * Gets a collection of published Assets
631
631
  * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
@@ -644,7 +644,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
644
644
  * .catch(console.error)
645
645
  * ```
646
646
  */
647
- getPublishedAssets(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/asset").Asset, AssetProps<{}>>>;
647
+ getPublishedAssets: import("./common-types").OptionalCursorApi<QueryOptions, import("./entities/asset").Asset, AssetProps<{}>>;
648
648
  /**
649
649
  * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
650
650
  * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
@@ -57,6 +57,34 @@ export interface BulkActionPublishPayload extends MakeRequestPayload {
57
57
  items: Collection<VersionedLink<Entity>>;
58
58
  };
59
59
  }
60
+ interface AddFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {
61
+ entity: L;
62
+ add?: {
63
+ fields: Record<'*', string[]>;
64
+ };
65
+ }
66
+ interface RemoveFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {
67
+ entity: L;
68
+ remove?: {
69
+ fields: Record<'*', string[]>;
70
+ };
71
+ }
72
+ type BulkActionEntity<L extends Link<Entity> | VersionedLink<Entity>> = {
73
+ entity: L;
74
+ };
75
+ export interface PublishBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {
76
+ action: 'publish';
77
+ entities: PublishActionType extends 'remove' ? RemoveFieldsEntity<VersionedLink<Entity>>[] : AddFieldsEntity<VersionedLink<Entity>>[];
78
+ }
79
+ export interface ValidateBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {
80
+ action: 'validate';
81
+ entities: PublishActionType extends 'remove' ? RemoveFieldsEntity<Link<Entity>>[] : AddFieldsEntity<Link<Entity>>[];
82
+ }
83
+ export interface UnpublishBulkActionV2Payload {
84
+ action: 'unpublish';
85
+ entities: BulkActionEntity<Link<Entity>>[];
86
+ }
87
+ export type BulkActionV2Payload = PublishBulkActionV2Payload<'add'> | PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload | ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>;
60
88
  export type BulkActionSysProps = {
61
89
  id: string;
62
90
  type: 'BulkAction';
@@ -68,7 +96,7 @@ export type BulkActionSysProps = {
68
96
  updatedAt: ISO8601Timestamp;
69
97
  };
70
98
  /** The object returned by the BulkActions API */
71
- export interface BulkActionProps<TPayload extends BulkActionPayload = any> {
99
+ export interface BulkActionProps<TPayload extends BulkActionPayload | BulkActionV2Payload = any> {
72
100
  sys: BulkActionSysProps;
73
101
  action: BulkActionType;
74
102
  /** original payload when BulkAction was created */
@@ -82,7 +110,7 @@ export interface BulkActionApiMethods {
82
110
  /** Waits until the BulkAction is in one of the final states (`succeeded` or `failed`) and returns it. */
83
111
  waitProcessing(options?: AsyncActionProcessingOptions): Promise<BulkAction>;
84
112
  }
85
- export interface BulkAction<T extends BulkActionPayload = any> extends BulkActionProps<T>, BulkActionApiMethods, DefaultElements<BulkActionProps<T>> {
113
+ export interface BulkAction<T extends BulkActionPayload | BulkActionV2Payload = any> extends BulkActionProps<T>, BulkActionApiMethods, DefaultElements<BulkActionProps<T>> {
86
114
  }
87
115
  /**
88
116
  * @private
@@ -90,5 +118,5 @@ export interface BulkAction<T extends BulkActionPayload = any> extends BulkActio
90
118
  * @param data - Raw BulkAction data
91
119
  * @return Wrapped BulkAction data
92
120
  */
93
- export declare function wrapBulkAction<TPayload extends BulkActionPayload = any>(makeRequest: MakeRequest, data: BulkActionProps<BulkActionPayload>): BulkAction<TPayload>;
121
+ export declare function wrapBulkAction<TPayload extends BulkActionPayload | BulkActionV2Payload = any>(makeRequest: MakeRequest, data: BulkActionProps<BulkActionPayload | BulkActionV2Payload>): BulkAction<TPayload>;
94
122
  export {};
@@ -17,7 +17,7 @@ export type { AppSigningSecret, AppSigningSecretProps, CreateAppSigningSecretPro
17
17
  export type { AppUpload, AppUploadProps } from './entities/app-upload';
18
18
  export type { Asset, AssetFileProp, AssetProps, CreateAssetProps } from './entities/asset';
19
19
  export type { AssetKey, AssetKeyProps, CreateAssetKeyProps } from './entities/asset-key';
20
- export type { BulkAction, BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionStatus, BulkActionType, BulkActionUnpublishPayload, BulkActionValidatePayload, } from './entities/bulk-action';
20
+ export type { BulkAction, BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionStatus, BulkActionType, BulkActionUnpublishPayload, BulkActionValidatePayload, BulkActionV2Payload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload, } from './entities/bulk-action';
21
21
  export type { Comment, CommentProps, CreateCommentProps, DeleteCommentParams, GetCommentParentEntityParams, GetManyCommentsParams, RichTextCommentDocument, RichTextCommentProps, UpdateCommentProps, } from './entities/comment';
22
22
  export type { AnnotationAssignment, ContentType, ContentTypeMetadata, ContentTypeProps, CreateContentTypeProps, } from './entities/content-type';
23
23
  export type { ContentFields, ContentTypeFieldValidation, ContentfulEntryResource, ExternalResource, } from './entities/content-type-fields';
@@ -5,7 +5,7 @@ import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps
5
5
  import type { ApiKeyProps, CreateApiKeyProps } from '../entities/api-key';
6
6
  import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from '../entities/asset';
7
7
  import type { AssetKeyProps, CreateAssetKeyProps } from '../entities/asset-key';
8
- import type { BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from '../entities/bulk-action';
8
+ import type { BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionV2Payload, BulkActionValidatePayload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload } from '../entities/bulk-action';
9
9
  import type { ContentTypeProps, CreateContentTypeProps } from '../entities/content-type';
10
10
  import type { CreateEntryProps, EntryProps, EntryReferenceProps } from '../entities/entry';
11
11
  import type { CreateEnvironmentTemplateProps, EnvironmentTemplateProps } from '../entities/environment-template';
@@ -67,6 +67,11 @@ import type { OAuthApplicationPlainClientAPI } from './entities/oauth-applicatio
67
67
  import type { FunctionLogPlainClientAPI } from './entities/function-log';
68
68
  import type { AiActionPlainClientAPI } from './entities/ai-action';
69
69
  import type { AiActionInvocationPlainClientAPI } from './entities/ai-action-invocation';
70
+ type WithCursorBasedPagination<T> = T & {
71
+ query: {
72
+ cursor: true;
73
+ };
74
+ };
70
75
  export type PlainClientAPI = {
71
76
  raw: {
72
77
  getDefaultParams(): DefaultParams | undefined;
@@ -134,7 +139,6 @@ export type PlainClientAPI = {
134
139
  environmentTemplateId: string;
135
140
  organizationId: string;
136
141
  spaceId?: string;
137
- latestOnly?: boolean;
138
142
  }, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<EnvironmentTemplateInstallationProps>>;
139
143
  getForEnvironment(params: BasicCursorPaginationOptions & EnvironmentTemplateParams & {
140
144
  installationId?: string;
@@ -145,12 +149,17 @@ export type PlainClientAPI = {
145
149
  publish(params: GetSpaceEnvironmentParams, payload: BulkActionPublishPayload): Promise<BulkActionProps<BulkActionPublishPayload>>;
146
150
  unpublish(params: GetSpaceEnvironmentParams, payload: BulkActionUnpublishPayload): Promise<BulkActionProps<BulkActionUnpublishPayload>>;
147
151
  validate(params: GetSpaceEnvironmentParams, payload: BulkActionValidatePayload): Promise<BulkActionProps<BulkActionValidatePayload>>;
152
+ getV2(params: GetBulkActionParams): Promise<BulkActionProps<BulkActionV2Payload>>;
153
+ publishV2(params: GetSpaceEnvironmentParams, payload: PublishBulkActionV2Payload<'add'>): Promise<BulkActionProps<PublishBulkActionV2Payload<'add'>>>;
154
+ unpublishV2(params: GetSpaceEnvironmentParams, payload: PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload): Promise<BulkActionProps<PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload>>;
155
+ validateV2(params: GetSpaceEnvironmentParams, payload: ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>): Promise<BulkActionProps<ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>>>;
148
156
  };
149
157
  comment: CommentPlainClientAPI;
150
158
  concept: ConceptPlainClientAPI;
151
159
  conceptScheme: ConceptSchemePlainClientAPI;
152
160
  contentType: {
153
161
  get(params: OptionalDefaults<GetContentTypeParams & QueryParams>): Promise<ContentTypeProps>;
162
+ getMany(params: WithCursorBasedPagination<OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>>): Promise<CursorPaginatedCollectionProp<ContentTypeProps>>;
154
163
  getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>): Promise<CollectionProp<ContentTypeProps>>;
155
164
  update(params: OptionalDefaults<GetContentTypeParams>, rawData: ContentTypeProps, headers?: RawAxiosRequestHeaders): Promise<ContentTypeProps>;
156
165
  delete(params: OptionalDefaults<GetContentTypeParams>): Promise<any>;
@@ -164,7 +173,11 @@ export type PlainClientAPI = {
164
173
  };
165
174
  user: UserPlainClientAPI;
166
175
  entry: {
176
+ getPublished<T extends KeyValueMap = KeyValueMap>(params: WithCursorBasedPagination<OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<EntryProps<T>>>;
167
177
  getPublished<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T>>>;
178
+ getMany<T extends KeyValueMap = KeyValueMap>(params: WithCursorBasedPagination<OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
179
+ releaseId?: string;
180
+ }>>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<EntryProps<T>>>;
168
181
  getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
169
182
  releaseId?: string;
170
183
  }>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T>>>;
@@ -213,7 +226,11 @@ export type PlainClientAPI = {
213
226
  }>): Promise<EntryReferenceProps>;
214
227
  };
215
228
  asset: {
229
+ getPublished(params: WithCursorBasedPagination<OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<AssetProps>>;
216
230
  getPublished(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<AssetProps>>;
231
+ getMany(params: WithCursorBasedPagination<OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
232
+ releaseId?: string;
233
+ }>>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<AssetProps>>;
217
234
  getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
218
235
  releaseId?: string;
219
236
  }>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<AssetProps>>;
@@ -458,3 +475,4 @@ export type PlainClientAPI = {
458
475
  workflowsChangelog: WorkflowsChangelogPlainClientAPI;
459
476
  oauthApplication: OAuthApplicationPlainClientAPI;
460
477
  };
478
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.62.1",
3
+ "version": "11.63.0-dx-542-update-to-gha.1",
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",
@@ -26,25 +26,23 @@
26
26
  "scripts": {
27
27
  "clean": "rimraf dist",
28
28
  "build": "npm run clean && npm run build:modules && npm run build:standalone && npm run build:types",
29
- "postbuild": "npm run test:demo-projects",
30
29
  "build:modules": "BABEL_ENV=modules babel --extensions \".ts\" --extensions \".js\" lib -d dist/es-modules/",
31
30
  "build:standalone": "webpack && NODE_ENV=production webpack",
32
31
  "build:standalone:log": "NODE_ENV=production WEBPACK_MODE=log webpack --json --profile --progress > webpack-build-log.json && webpack-bundle-analyzer webpack-build-log.json",
33
32
  "build:types": "rimraf dist/typings && tsc --declaration --noEmit false --emitDeclarationOnly true --allowJs false",
34
33
  "build:docs": "typedoc",
35
- "docs:dev": "npm run build && npm run build:docs",
34
+ "docs:dev": "npm run build:docs",
36
35
  "docs:watch": "nodemon --exec npm run docs:dev -w lib typings",
37
36
  "docs:publish": "npm run build:docs && ./node_modules/contentful-sdk-jsdoc/bin/publish-docs.sh contentful-management.js contentful-management",
38
- "check-types": "tsc",
39
37
  "lint": "eslint lib test",
40
38
  "pretest": "rimraf coverage && npm run lint",
41
- "test": "npm run test:cover-unit && npm run test:types && npm run test:cover-integration && npm run test:size",
42
- "test:cover-unit": "npm run test:unit -- --coverage",
43
- "test:cover-integration": "npm run test:integration -- --coverage",
39
+ "test": "npm run test:unit:cover && npm run test:types && npm run test:integration:cover && npm run test:size",
40
+ "test:unit:cover": "npm run test:unit -- --coverage",
44
41
  "test:unit": "npx vitest --project unit --run",
45
42
  "test:types": "npx vitest --project types --run",
46
43
  "test:unit-watch": "npx vitest --project unit",
47
44
  "test:integration": "npx vitest --project integration --run --no-file-parallelism",
45
+ "test:integration:cover": "npm run test:integration -- --coverage",
48
46
  "test:integration-watch": "npx vitest --project integration --no-file-parallelism",
49
47
  "test:browser": "npx playwright install && npx vitest --project browser-unit --run && npx vitest --project browser-integration --run",
50
48
  "test:version": "grep -r \"0.0.0-determined-by-semantic-release\" ./dist > /dev/null && echo \"version 0.0.0-determined-by-semantic-release found in output\" && exit 1 || exit 0",
@@ -53,8 +51,8 @@
53
51
  "test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && vitest --run ./test/output-integration/node",
54
52
  "test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run test",
55
53
  "test:prepush": "npm run build && npm run test:unit && npm run test:size",
56
- "prettier": "prettier --write '**/*.{jsx,js,ts,tsx}'",
57
- "prettier:check": "prettier --check '**/*.{jsx,js,ts,tsx}'",
54
+ "format:fix": "prettier --write '**/*.{jsx,js,ts,tsx}'",
55
+ "format:check": "prettier --check '**/*.{jsx,js,ts,tsx}'",
58
56
  "semantic-release": "semantic-release",
59
57
  "precommit": "npm run lint",
60
58
  "postpublish": "if [ \"$(git rev-parse --abbrev-ref HEAD)\" = master ] ; then npm run docs:publish && npm run clean ; else exit 0 ; fi",
@@ -110,7 +108,7 @@
110
108
  "playwright": "^1.49.0",
111
109
  "prettier": "^3.6.2",
112
110
  "rimraf": "^5.0.0",
113
- "semantic-release": "^22.0.12",
111
+ "semantic-release": "^25.0.2",
114
112
  "size-limit": "^11.1.6",
115
113
  "type-fest": "^4.18.3",
116
114
  "typedoc": "^0.26.2",
@@ -146,6 +144,11 @@
146
144
  {
147
145
  "name": "canary",
148
146
  "prerelease": true
147
+ },
148
+ {
149
+ "name": "dx-542-update-to-gha",
150
+ "channel": "dev",
151
+ "prerelease": true
149
152
  }
150
153
  ],
151
154
  "plugins": [
@@ -1,15 +0,0 @@
1
- import { pollAsyncActionStatus } from './action';
2
- /** Waits for a BulkAction status to be either succeeded or failed.
3
- * Used by the Plain client */
4
- export async function waitForBulkActionProcessing({
5
- plainClient,
6
- spaceId,
7
- environmentId,
8
- bulkActionId
9
- }, options) {
10
- return pollAsyncActionStatus(async () => plainClient.bulkAction.get({
11
- bulkActionId,
12
- spaceId,
13
- environmentId
14
- }), options);
15
- }
@@ -1,14 +0,0 @@
1
- import type { BulkActionPayload, BulkActionProps } from '../entities/bulk-action';
2
- import type { PlainClientAPI } from '../plain/common-types';
3
- import type { AsyncActionProcessingOptions } from './action';
4
- type PlainOptions = {
5
- /** Used by the PlainClient to perform a poll for the BulkAction status */
6
- plainClient: PlainClientAPI;
7
- spaceId: string;
8
- environmentId: string;
9
- bulkActionId: string;
10
- };
11
- /** Waits for a BulkAction status to be either succeeded or failed.
12
- * Used by the Plain client */
13
- export declare function waitForBulkActionProcessing<T extends BulkActionPayload = any>({ plainClient, spaceId, environmentId, bulkActionId }: PlainOptions, options?: AsyncActionProcessingOptions): Promise<BulkActionProps<T>>;
14
- export {};