contentful-management 11.42.0 → 11.43.0-beta.2

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 (31) hide show
  1. package/dist/contentful-management.browser.js +564 -132
  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 +548 -132
  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/function-log.js +21 -0
  8. package/dist/es-modules/adapters/REST/endpoints/function.js +16 -0
  9. package/dist/es-modules/adapters/REST/endpoints/index.js +4 -0
  10. package/dist/es-modules/contentful-management.js +1 -1
  11. package/dist/es-modules/create-function-api.js +115 -0
  12. package/dist/es-modules/create-function-log-api.js +94 -0
  13. package/dist/es-modules/entities/function-log.js +24 -0
  14. package/dist/es-modules/entities/function.js +24 -1
  15. package/dist/es-modules/entities/index.js +4 -0
  16. package/dist/es-modules/plain/entities/function-log.js +1 -0
  17. package/dist/es-modules/plain/entities/function.js +1 -0
  18. package/dist/es-modules/plain/plain-client.js +7 -1
  19. package/dist/typings/adapters/REST/endpoints/function-log.d.ts +3 -0
  20. package/dist/typings/adapters/REST/endpoints/function.d.ts +4 -0
  21. package/dist/typings/adapters/REST/endpoints/index.d.ts +4 -0
  22. package/dist/typings/common-types.d.ts +45 -6
  23. package/dist/typings/create-function-api.d.ts +78 -0
  24. package/dist/typings/create-function-log-api.d.ts +63 -0
  25. package/dist/typings/entities/function-log.d.ts +50 -0
  26. package/dist/typings/entities/function.d.ts +23 -1
  27. package/dist/typings/entities/index.d.ts +4 -0
  28. package/dist/typings/plain/common-types.d.ts +5 -5
  29. package/dist/typings/plain/entities/function-log.d.ts +38 -0
  30. package/dist/typings/plain/entities/function.d.ts +49 -0
  31. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ import type { Link, DefaultElements } from '../common-types';
2
+ import type { MakeRequest } from '../common-types';
3
+ import createFunctionLogApi from '../create-function-log-api';
4
+ export type FunctionLogProps = {
5
+ sys: {
6
+ id: string;
7
+ type: 'FunctionLog';
8
+ createdBy: Link<'User'>;
9
+ createdAt: string;
10
+ space: Link<'Space'>;
11
+ environment: Link<'Environment'>;
12
+ appDefinition: Link<'AppDefinition'>;
13
+ };
14
+ severity: {
15
+ info: number;
16
+ warn: number;
17
+ error: number;
18
+ };
19
+ requestId: string;
20
+ event: {
21
+ type: string;
22
+ query: string;
23
+ isIntrospectionQuery: boolean;
24
+ variables: Record<string, any>;
25
+ };
26
+ messages: Array<{
27
+ timestamp: number;
28
+ type: 'INFO' | 'ERROR' | 'WARN';
29
+ message: string;
30
+ }>;
31
+ };
32
+ export interface FunctionLog extends FunctionLogProps, DefaultElements<FunctionLogProps> {
33
+ }
34
+ /**
35
+ * @private
36
+ * @param makeRequest - function to make requests via an adapter
37
+ * @param data - raw contentful-Function data
38
+ * @return Wrapped Function data
39
+ */
40
+ export declare function wrapFunctionLog(makeRequest: MakeRequest, data: FunctionLogProps): FunctionLogProps & ReturnType<typeof createFunctionLogApi>;
41
+ /**
42
+ * @private
43
+ * @param makeRequest - function to make requests via an adapter
44
+ * @param data - raw contentful-function data
45
+ * @return Wrapped App Function collection data
46
+ */
47
+ export declare const wrapFunctionLogCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionLogProps>) => import("../common-types").Collection<FunctionLogProps & {
48
+ get(logId: string): Promise<FunctionLogProps & any>;
49
+ getAll(): Promise<import("../common-types").Collection<FunctionLogProps & any, FunctionLogProps>>;
50
+ }, FunctionLogProps>;
@@ -1,4 +1,6 @@
1
- import type { Link } from '../common-types';
1
+ import type { Link, DefaultElements } from '../common-types';
2
+ import type { MakeRequest } from '../common-types';
3
+ import createFunctionApi from '../create-function-api';
2
4
  export type FunctionProps = {
3
5
  sys: {
4
6
  id: string;
@@ -16,3 +18,23 @@ export type FunctionProps = {
16
18
  accepts: string[];
17
19
  allowNetworks?: string[];
18
20
  };
21
+ export interface Function extends FunctionProps, DefaultElements<FunctionProps> {
22
+ }
23
+ /**
24
+ * @private
25
+ * @param makeRequest - (real) function to make requests via an adapter
26
+ * @param data - raw contentful-Function data
27
+ * @return Wrapped Function data
28
+ */
29
+ export declare function wrapFunction(makeRequest: MakeRequest, data: FunctionProps): FunctionProps & ReturnType<typeof createFunctionApi>;
30
+ /**
31
+ * @private
32
+ * @param makeRequest - real) function to make requests via an adapter
33
+ * @param data - raw contentful-function data
34
+ * @return Wrapped App Function collection data
35
+ */
36
+ export declare const wrapFunctionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionProps>) => import("../common-types").Collection<FunctionProps & {
37
+ getManyFunctions(): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
38
+ getFunction(functionId: string): Promise<FunctionProps & any>;
39
+ getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
40
+ }, FunctionProps>;
@@ -23,6 +23,8 @@ import * as environmentAlias from './environment-alias';
23
23
  import * as environmentTemplate from './environment-template';
24
24
  import * as environmentTemplateInstallation from './environment-template-installation';
25
25
  import * as extension from './extension';
26
+ import * as func from './function';
27
+ import * as functionLog from './function-log';
26
28
  import * as locale from './locale';
27
29
  import * as organization from './organization';
28
30
  import * as organizationInvitation from './organization-invitation';
@@ -84,6 +86,8 @@ declare const _default: {
84
86
  environmentTemplate: typeof environmentTemplate;
85
87
  environmentTemplateInstallation: typeof environmentTemplateInstallation;
86
88
  extension: typeof extension;
89
+ func: typeof func;
90
+ functionLog: typeof functionLog;
87
91
  locale: typeof locale;
88
92
  organization: typeof organization;
89
93
  organizationInvitation: typeof organizationInvitation;
@@ -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, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetAppDefinitionParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, QueryParams } from '../common-types';
3
+ import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, QueryParams } 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';
@@ -10,7 +10,6 @@ import type { ContentTypeProps, CreateContentTypeProps } from '../entities/conte
10
10
  import type { CreateEntryProps, EntryProps, EntryReferenceProps } from '../entities/entry';
11
11
  import type { CreateEnvironmentTemplateProps, EnvironmentTemplateProps } from '../entities/environment-template';
12
12
  import type { CreateEnvironmentTemplateInstallationProps, EnvironmentTemplateInstallationProps, EnvironmentTemplateValidationProps, ValidateEnvironmentTemplateInstallationProps } from '../entities/environment-template-installation';
13
- import type { FunctionProps } from '../entities/function';
14
13
  import type { CreateOrganizationInvitationProps, OrganizationInvitationProps } from '../entities/organization-invitation';
15
14
  import type { OrganizationMembershipProps } from '../entities/organization-membership';
16
15
  import type { CreatePersonalAccessTokenProps, PersonalAccessTokenProps } from '../entities/personal-access-token';
@@ -38,6 +37,7 @@ import type { EditorInterfacePlainClientAPI } from './entities/editor-interface'
38
37
  import type { EnvironmentPlainClientAPI } from './entities/environment';
39
38
  import type { EnvironmentAliasPlainClientAPI } from './entities/environment-alias';
40
39
  import type { ExtensionPlainClientAPI } from './entities/extension';
40
+ import type { FunctionPlainClientAPI } from './entities/function';
41
41
  import type { LocalePlainClientAPI } from './entities/locale';
42
42
  import type { OrganizationPlainClientAPI } from './entities/organization';
43
43
  import type { ResourcePlainAPI } from './entities/resource';
@@ -63,6 +63,7 @@ import type { WorkflowPlainClientAPI } from './entities/workflow';
63
63
  import type { WorkflowDefinitionPlainClientAPI } from './entities/workflow-definition';
64
64
  import type { WorkflowsChangelogPlainClientAPI } from './entities/workflows-changelog';
65
65
  import type { DefaultParams, OptionalDefaults } from './wrappers/wrap';
66
+ import type { FunctionLogPlainClientAPI } from './entities/function-log';
66
67
  export type PlainClientAPI = {
67
68
  raw: {
68
69
  getDefaultParams(): DefaultParams | undefined;
@@ -82,9 +83,8 @@ export type PlainClientAPI = {
82
83
  appSignedRequest: AppSignedRequestPlainClientAPI;
83
84
  appSigningSecret: AppSigningSecretPlainClientAPI;
84
85
  appAccessToken: AppAccessTokenPlainClientAPI;
85
- function: {
86
- getMany(params: OptionalDefaults<GetAppDefinitionParams & QueryParams>): Promise<CollectionProp<FunctionProps>>;
87
- };
86
+ function: FunctionPlainClientAPI;
87
+ functionLog: FunctionLogPlainClientAPI;
88
88
  editorInterface: EditorInterfacePlainClientAPI;
89
89
  space: SpacePlainClientAPI;
90
90
  environment: EnvironmentPlainClientAPI;
@@ -0,0 +1,38 @@
1
+ import type { CollectionProp, GetFunctionLogParams, GetAllFunctionLogParams } from '../../common-types';
2
+ import type { FunctionLogProps } from '../../entities/function-log';
3
+ import type { OptionalDefaults } from '../wrappers/wrap';
4
+ export type FunctionLogPlainClientAPI = {
5
+ /**
6
+ * Fetches the specified FunctionLog
7
+ * @param params - spaceId, environmentId, appInstallationId, functionId, logId
8
+ * @returns the FunctionLog
9
+ * @throws if the request fails, or the FunctionLog is not found
10
+ * @example
11
+ * ```javascript
12
+ * const functionLog = await client.functionLog.get({
13
+ * spaceId: '<space_id>',
14
+ * environmentId: '<environment_id>',
15
+ * appInstallationId: '<app_installation_id>',
16
+ * functionId: '<function_id>',
17
+ * logId: '<log_id>'
18
+ * });
19
+ * ```
20
+ */
21
+ get(params: OptionalDefaults<GetFunctionLogParams>): Promise<FunctionLogProps>;
22
+ /**
23
+ * Fetches all FunctionLogs for the given function
24
+ * @param params - spaceId, environmentId, appInstallationId, functionId
25
+ * @returns an object containing an array of FunctionLogs
26
+ * @throws if the request fails, or the FunctionLogs are not found
27
+ * @example
28
+ * ```javascript
29
+ * const functionLogs = await client.functionLog.getAll({
30
+ * spaceId: '<space_id>',
31
+ * environmentId: '<environment_id>',
32
+ * appInstallationId: '<app_installation_id>',
33
+ * functionId: '<function_id>'
34
+ * });
35
+ * ```
36
+ */
37
+ getAll(params: OptionalDefaults<GetAllFunctionLogParams>): Promise<CollectionProp<FunctionLogProps>>;
38
+ };
@@ -0,0 +1,49 @@
1
+ import type { CollectionProp, GetFunctionParams, GetFunctionForEnvParams, GetManyFunctionParams } from '../../common-types';
2
+ import type { FunctionProps } from '../../entities/function';
3
+ import type { OptionalDefaults } from '../wrappers/wrap';
4
+ export type FunctionPlainClientAPI = {
5
+ /**
6
+ * Fetches the specified Function
7
+ * @param params organization ID, app definition ID, entity ID to identify the function
8
+ * @returns the Function
9
+ * @throws if the request fails, or the Function is not found
10
+ * @example
11
+ * ```javascript
12
+ * const func = await client.function.get({
13
+ * organizationId: "<org_id>",
14
+ * appDefinitionId: "<app_definition_id>",
15
+ * functionId: "<function_id>",
16
+ * });
17
+ * ```
18
+ */
19
+ get(params: OptionalDefaults<GetFunctionParams>): Promise<FunctionProps>;
20
+ /**
21
+ * Fetches all Functions for the given app
22
+ * @param params organization ID, app definition ID to identify the functions
23
+ * @returns an object containing an array of Functions
24
+ * @throws if the request fails, or the App is not found
25
+ * @example
26
+ * ```javascript
27
+ * const functions = await client.function.getMany({
28
+ * organizationId: "<org_id>",
29
+ * appDefinitionId: "<app_definition_id>",
30
+ * });
31
+ * ```
32
+ */
33
+ getMany(params: OptionalDefaults<GetManyFunctionParams>): Promise<CollectionProp<FunctionProps>>;
34
+ /**
35
+ * Fetches all Functions for the given environment
36
+ * @param params space ID, environment ID, app installation ID to identify the functions
37
+ * @returns an object containing an array of Functions
38
+ * @throws if the request fails, or the Environment is not found
39
+ * @example
40
+ * ```javascript
41
+ * const functions = await client.function.getManyForEnvironment({
42
+ * spaceId: "<space_id>",
43
+ * environmentId: "<environment_id>",
44
+ * appInstallationId: "<app_installation_id>",
45
+ * });
46
+ * ```
47
+ */
48
+ getManyForEnvironment(params: OptionalDefaults<GetFunctionForEnvParams>): Promise<CollectionProp<FunctionProps>>;
49
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.42.0",
3
+ "version": "11.43.0-beta.2",
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",