contentful-management 11.33.0 → 11.35.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.
Files changed (33) hide show
  1. package/dist/contentful-management.browser.js +929 -191
  2. package/dist/contentful-management.browser.js.map +1 -1
  3. package/dist/contentful-management.browser.min.js +1 -1
  4. package/dist/contentful-management.node.js +841 -147
  5. package/dist/contentful-management.node.js.map +1 -1
  6. package/dist/contentful-management.node.min.js +1 -1
  7. package/dist/es-modules/adapters/REST/endpoints/index.js +4 -0
  8. package/dist/es-modules/adapters/REST/endpoints/resource-type.js +23 -0
  9. package/dist/es-modules/adapters/REST/endpoints/resource.js +5 -0
  10. package/dist/es-modules/contentful-management.js +1 -1
  11. package/dist/es-modules/create-environment-api.js +78 -0
  12. package/dist/es-modules/entities/index.js +4 -0
  13. package/dist/es-modules/entities/resource-provider.js +41 -0
  14. package/dist/es-modules/entities/resource-type.js +93 -0
  15. package/dist/es-modules/entities/resource.js +7 -0
  16. package/dist/es-modules/plain/entities/resource-type.js +1 -0
  17. package/dist/es-modules/plain/entities/resource.js +1 -0
  18. package/dist/es-modules/plain/plain-client.js +10 -0
  19. package/dist/typings/adapters/REST/endpoints/index.d.ts +4 -0
  20. package/dist/typings/adapters/REST/endpoints/resource-type.d.ts +6 -0
  21. package/dist/typings/adapters/REST/endpoints/resource.d.ts +2 -0
  22. package/dist/typings/common-types.d.ts +49 -0
  23. package/dist/typings/constants/editor-interface-defaults/controls-defaults.d.ts +1 -1
  24. package/dist/typings/create-environment-api.d.ts +50 -0
  25. package/dist/typings/entities/index.d.ts +4 -0
  26. package/dist/typings/entities/resource-provider.d.ts +5 -1
  27. package/dist/typings/entities/resource-type.d.ts +52 -0
  28. package/dist/typings/entities/resource.d.ts +36 -0
  29. package/dist/typings/export-types.d.ts +2 -0
  30. package/dist/typings/plain/common-types.d.ts +5 -1
  31. package/dist/typings/plain/entities/resource-type.d.ts +14 -0
  32. package/dist/typings/plain/entities/resource.d.ts +38 -0
  33. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ import type { BasicCursorPaginationOptions, CursorPaginatedCollectionProp, MakeRequest, SysLink } from '../common-types';
2
+ export type ResourceQueryOptions = LookupQueryOptions | SearchQueryOptions;
3
+ type LookupQueryOptions = {
4
+ 'sys.urn[in]': string;
5
+ } & BasicCursorPaginationOptions;
6
+ type SearchQueryOptions = {
7
+ query: string;
8
+ } & BasicCursorPaginationOptions;
9
+ export type ResourceProps = {
10
+ sys: {
11
+ type: 'Resource';
12
+ urn: string;
13
+ resourceType: SysLink;
14
+ resourceProvider: SysLink;
15
+ appDefinition: SysLink;
16
+ };
17
+ fields: {
18
+ title: string;
19
+ subtitle?: string;
20
+ description?: string;
21
+ externalUrl?: string;
22
+ image?: {
23
+ url: string;
24
+ altText?: string;
25
+ };
26
+ badge?: {
27
+ label: string;
28
+ variant: 'primary' | 'negative' | 'positive' | 'warning' | 'secondary';
29
+ };
30
+ };
31
+ };
32
+ export declare function wrapResource(makeRequest: MakeRequest, data: ResourceProps): ResourceProps & {
33
+ toPlainObject(): ResourceProps;
34
+ };
35
+ export declare const wrapResourceCollection: (makeRequest: MakeRequest, data: CursorPaginatedCollectionProp<ResourceProps>) => CursorPaginatedCollectionProp<ResourceProps>;
36
+ export {};
@@ -62,3 +62,5 @@ export type { WorkflowsChangelogEntry, WorkflowsChangelogEntryProps, WorkflowsCh
62
62
  export type { ConceptProps, CreateConceptProps } from './entities/concept';
63
63
  export type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme';
64
64
  export type { ResourceProvider, ResourceProviderProps, UpsertResourceProviderProps, } from './entities/resource-provider';
65
+ export type { ResourceType, ResourceTypeProps, SpaceEnvResourceTypeProps, UpsertResourceTypeProps, } from './entities/resource-type';
66
+ export type { ResourceProps, ResourceQueryOptions } from './entities/resource';
@@ -60,6 +60,8 @@ import type { AppAccessTokenPlainClientAPI } from './entities/app-access-token';
60
60
  import type { ConceptPlainClientAPI } from './entities/concept';
61
61
  import type { ConceptSchemePlainClientAPI } from './entities/concept-scheme';
62
62
  import type { ResourceProviderPlainClientAPI } from './entities/resource-provider';
63
+ import type { ResourceTypePlainClientAPI } from './entities/resource-type';
64
+ import type { ResourcePlainAPI } from './entities/resource';
63
65
  export type PlainClientAPI = {
64
66
  raw: {
65
67
  getDefaultParams(): DefaultParams | undefined;
@@ -286,6 +288,9 @@ export type PlainClientAPI = {
286
288
  query?: ReleaseActionQueryOptions;
287
289
  }): Promise<CollectionProp<ReleaseActionProps>>;
288
290
  };
291
+ resource: ResourcePlainAPI;
292
+ resourceProvider: ResourceProviderPlainClientAPI;
293
+ resourceType: ResourceTypePlainClientAPI;
289
294
  role: RolePlainClientAPI;
290
295
  scheduledActions: {
291
296
  get(params: OptionalDefaults<GetSpaceParams> & {
@@ -326,7 +331,6 @@ export type PlainClientAPI = {
326
331
  };
327
332
  appDefinition: AppDefinitionPlainClientAPI;
328
333
  appInstallation: AppInstallationPlainClientAPI;
329
- resourceProvider: ResourceProviderPlainClientAPI;
330
334
  extension: ExtensionPlainClientAPI;
331
335
  webhook: WebhookPlainClientAPI;
332
336
  snapshot: {
@@ -0,0 +1,14 @@
1
+ import type { RawAxiosRequestHeaders } from 'axios';
2
+ import type { OptionalDefaults } from '../wrappers/wrap';
3
+ import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, GetResourceTypeParams, GetSpaceEnvironmentParams } from '../../common-types';
4
+ import type { ResourceTypeProps, UpsertResourceTypeProps } from '../../export-types';
5
+ import type { SpaceEnvResourceTypeProps } from '../../entities/resource-type';
6
+ export type ResourceTypePlainClientAPI = {
7
+ get(params: OptionalDefaults<GetResourceTypeParams>): Promise<ResourceTypeProps>;
8
+ upsert(params: OptionalDefaults<GetResourceTypeParams>, rawData: UpsertResourceTypeProps, headers?: RawAxiosRequestHeaders): Promise<ResourceTypeProps>;
9
+ delete(params: OptionalDefaults<GetResourceTypeParams>): Promise<any>;
10
+ getForEnvironment(params: OptionalDefaults<GetSpaceEnvironmentParams> & {
11
+ query?: BasicCursorPaginationOptions;
12
+ }): Promise<CursorPaginatedCollectionProp<SpaceEnvResourceTypeProps>>;
13
+ getMany(params: OptionalDefaults<Omit<GetResourceTypeParams, 'resourceTypeId'>>): Promise<CollectionProp<ResourceTypeProps>>;
14
+ };
@@ -0,0 +1,38 @@
1
+ import type { OptionalDefaults } from '../wrappers/wrap';
2
+ import type { CursorPaginatedCollectionProp, GetResourceParams } from '../../common-types';
3
+ import type { ResourceProps, ResourceQueryOptions } from '../../entities/resource';
4
+ export type ResourcePlainAPI = {
5
+ /**
6
+ * Fetch Resources
7
+ * @param params entity IDs to identify the Resources
8
+ * @returns the App Definition config
9
+ * @throws if the request fails, or the Resource Type is not found
10
+ * @example
11
+ * ```javascript
12
+ * // Lookup example
13
+ * const resourceProvider = await client.resource.getMany({
14
+ * spaceId: '<space_id>',
15
+ * environmentId: '<environment_id>',
16
+ * resourceTypeId: '<resource_type_id>',
17
+ * query: {
18
+ * 'sys.urn[in]': '<resource_urn1>,<resource_urn2>',
19
+ * limit': <number>,
20
+ * }
21
+ * });
22
+ *
23
+ * // Search example
24
+ * const resourceProvider = await client.resource.getMany({
25
+ * spaceId: '<space_id>',
26
+ * environmentId: '<environment_id>',
27
+ * resourceTypeId: '<resource_type_id>',
28
+ * query: {
29
+ * 'query': 'text',
30
+ * 'limit': <number>,
31
+ * }
32
+ * });
33
+ * ```
34
+ */
35
+ getMany(params: OptionalDefaults<GetResourceParams> & {
36
+ query?: ResourceQueryOptions;
37
+ }): Promise<CursorPaginatedCollectionProp<ResourceProps>>;
38
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.33.0",
3
+ "version": "11.35.0",
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",