contentful-management 11.43.0-beta.2 → 11.43.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.
Files changed (28) hide show
  1. package/dist/contentful-management.browser.js +862 -655
  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 +966 -733
  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/bulk-action.js +0 -2
  8. package/dist/es-modules/adapters/REST/endpoints/index.js +0 -2
  9. package/dist/es-modules/adapters/REST/endpoints/release-action.js +0 -2
  10. package/dist/es-modules/common-types.js +0 -1
  11. package/dist/es-modules/contentful-management.js +1 -1
  12. package/dist/es-modules/entities/bulk-action.js +4 -0
  13. package/dist/es-modules/entities/index.js +0 -2
  14. package/dist/es-modules/entities/scheduled-action.js +5 -0
  15. package/dist/es-modules/plain/plain-client.js +0 -4
  16. package/dist/typings/adapters/REST/endpoints/index.d.ts +0 -2
  17. package/dist/typings/common-types.d.ts +0 -21
  18. package/dist/typings/entities/index.d.ts +0 -2
  19. package/dist/typings/plain/common-types.d.ts +0 -2
  20. package/package.json +8 -19
  21. package/dist/es-modules/adapters/REST/endpoints/function-log.js +0 -21
  22. package/dist/es-modules/create-function-log-api.js +0 -94
  23. package/dist/es-modules/entities/function-log.js +0 -24
  24. package/dist/es-modules/plain/entities/function-log.js +0 -1
  25. package/dist/typings/adapters/REST/endpoints/function-log.d.ts +0 -3
  26. package/dist/typings/create-function-log-api.d.ts +0 -63
  27. package/dist/typings/entities/function-log.d.ts +0 -50
  28. package/dist/typings/plain/entities/function-log.d.ts +0 -38
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
1
  import * as raw from './raw';
4
2
  export const get = (http, params) => {
5
3
  return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/bulk_actions/actions/${params.bulkActionId}`);
@@ -27,7 +27,6 @@ import * as EnvironmentTemplate from './environment-template';
27
27
  import * as EnvironmentTemplateInstallation from './environment-template-installation';
28
28
  import * as Extension from './extension';
29
29
  import * as Function from './function';
30
- import * as FunctionLog from './function-log';
31
30
  import * as Http from './http';
32
31
  import * as Locale from './locale';
33
32
  import * as Organization from './organization';
@@ -90,7 +89,6 @@ export default {
90
89
  EnvironmentTemplateInstallation,
91
90
  Extension,
92
91
  Function,
93
- FunctionLog,
94
92
  Http,
95
93
  Locale,
96
94
  Organization,
@@ -3,8 +3,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
-
8
6
  import * as raw from './raw';
9
7
  export const get = (http, params) => {
10
8
  return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/actions/${params.actionId}`);
@@ -43,7 +43,6 @@
43
43
  */
44
44
 
45
45
  /** Base interface for all Payload interfaces. Used as part of the MakeRequestOptions to simplify payload definitions. */
46
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
47
46
 
48
47
  export let ScheduledActionReferenceFilters = /*#__PURE__*/function (ScheduledActionReferenceFilters) {
49
48
  ScheduledActionReferenceFilters["contentTypeAnnotationNotIn"] = "sys.contentType.metadata.annotations.ContentType[nin]";
@@ -46,7 +46,7 @@ function createClient(params, opts = {}) {
46
46
  const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
47
47
  const userAgent = getUserAgentHeader(
48
48
  // @ts-expect-error
49
- `${sdkMain}/${"11.43.0-beta.2"}`, params.application, params.integration, params.feature);
49
+ `${sdkMain}/${"11.43.1"}`, params.application, params.integration, params.feature);
50
50
  const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
51
51
  userAgent
52
52
  }));
@@ -8,9 +8,13 @@ import { pollAsyncActionStatus } from '../methods/action';
8
8
 
9
9
  /** Represents the state of the BulkAction */
10
10
  export let BulkActionStatus = /*#__PURE__*/function (BulkActionStatus) {
11
+ /** BulkAction is pending execution */
11
12
  BulkActionStatus["created"] = "created";
13
+ /** BulkAction has been started and pending completion */
12
14
  BulkActionStatus["inProgress"] = "inProgress";
15
+ /** BulkAction was completed successfully (terminal state) */
13
16
  BulkActionStatus["succeeded"] = "succeeded";
17
+ /** BulkAction failed to complete (terminal state) */
14
18
  BulkActionStatus["failed"] = "failed";
15
19
  return BulkActionStatus;
16
20
  }({});
@@ -24,7 +24,6 @@ import * as environmentTemplate from './environment-template';
24
24
  import * as environmentTemplateInstallation from './environment-template-installation';
25
25
  import * as extension from './extension';
26
26
  import * as func from './function';
27
- import * as functionLog from './function-log';
28
27
  import * as locale from './locale';
29
28
  import * as organization from './organization';
30
29
  import * as organizationInvitation from './organization-invitation';
@@ -87,7 +86,6 @@ export default {
87
86
  environmentTemplateInstallation,
88
87
  extension,
89
88
  func,
90
- functionLog,
91
89
  locale,
92
90
  organization,
93
91
  organizationInvitation,
@@ -10,10 +10,15 @@ import enhanceWithMethods from '../enhance-with-methods';
10
10
  * Represents that state of the scheduled action
11
11
  */
12
12
  export let ScheduledActionStatus = /*#__PURE__*/function (ScheduledActionStatus) {
13
+ /** action is pending execution */
13
14
  ScheduledActionStatus["scheduled"] = "scheduled";
15
+ /** action has been started and pending completion */
14
16
  ScheduledActionStatus["inProgress"] = "inProgress";
17
+ /** action was completed successfully (terminal state) */
15
18
  ScheduledActionStatus["succeeded"] = "succeeded";
19
+ /** action failed to complete (terminal state) */
16
20
  ScheduledActionStatus["failed"] = "failed";
21
+ /** action was canceled by a user (terminal state) */
17
22
  ScheduledActionStatus["canceled"] = "canceled";
18
23
  return ScheduledActionStatus;
19
24
  }({});
@@ -143,10 +143,6 @@ export const createPlainClient = (makeRequest, defaults) => {
143
143
  getMany: wrap(wrapParams, 'Function', 'getMany'),
144
144
  getManyForEnvironment: wrap(wrapParams, 'Function', 'getManyForEnvironment')
145
145
  },
146
- functionLog: {
147
- get: wrap(wrapParams, 'FunctionLog', 'get'),
148
- getAll: wrap(wrapParams, 'FunctionLog', 'getAll')
149
- },
150
146
  editorInterface: {
151
147
  get: wrap(wrapParams, 'EditorInterface', 'get'),
152
148
  getMany: wrap(wrapParams, 'EditorInterface', 'getMany'),
@@ -27,7 +27,6 @@ import * as EnvironmentTemplate from './environment-template';
27
27
  import * as EnvironmentTemplateInstallation from './environment-template-installation';
28
28
  import * as Extension from './extension';
29
29
  import * as Function from './function';
30
- import * as FunctionLog from './function-log';
31
30
  import * as Http from './http';
32
31
  import * as Locale from './locale';
33
32
  import * as Organization from './organization';
@@ -90,7 +89,6 @@ declare const _default: {
90
89
  EnvironmentTemplateInstallation: typeof EnvironmentTemplateInstallation;
91
90
  Extension: typeof Extension;
92
91
  Function: typeof Function;
93
- FunctionLog: typeof FunctionLog;
94
92
  Http: typeof Http;
95
93
  Locale: typeof Locale;
96
94
  Organization: typeof Organization;
@@ -60,7 +60,6 @@ import type { UserUIConfigProps } from './entities/user-ui-config';
60
60
  import type { CompleteWorkflowParams, CreateWorkflowParams, CreateWorkflowProps, DeleteWorkflowParams, WorkflowProps, WorkflowQueryOptions } from './entities/workflow';
61
61
  import type { CreateWorkflowDefinitionParams, CreateWorkflowDefinitionProps, DeleteWorkflowDefinitionParams, WorkflowDefinitionProps, WorkflowDefinitionQueryOptions } from './entities/workflow-definition';
62
62
  import type { WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions } from './entities/workflows-changelog-entry';
63
- import type { FunctionLogProps } from './entities/function-log';
64
63
  export interface DefaultElements<TPlainObject extends object = object> {
65
64
  toPlainObject(): TPlainObject;
66
65
  }
@@ -364,8 +363,6 @@ type MRInternal<UA extends boolean> = {
364
363
  (opts: MROpts<'Function', 'get', UA>): MRReturn<'Function', 'get'>;
365
364
  (opts: MROpts<'Function', 'getMany', UA>): MRReturn<'Function', 'getMany'>;
366
365
  (opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn<'Function', 'getManyForEnvironment'>;
367
- (opts: MROpts<'FunctionLog', 'get', UA>): MRReturn<'FunctionLog', 'get'>;
368
- (opts: MROpts<'FunctionLog', 'getAll', UA>): MRReturn<'FunctionLog', 'getAll'>;
369
366
  (opts: MROpts<'Locale', 'get', UA>): MRReturn<'Locale', 'get'>;
370
367
  (opts: MROpts<'Locale', 'getMany', UA>): MRReturn<'Locale', 'getMany'>;
371
368
  (opts: MROpts<'Locale', 'delete', UA>): MRReturn<'Locale', 'delete'>;
@@ -1500,18 +1497,6 @@ export type MRActions = {
1500
1497
  return: CollectionProp<FunctionProps>;
1501
1498
  };
1502
1499
  };
1503
- FunctionLog: {
1504
- get: {
1505
- params: GetFunctionLogParams;
1506
- return: FunctionLogProps;
1507
- headers?: RawAxiosRequestHeaders;
1508
- };
1509
- getAll: {
1510
- params: GetAllFunctionLogParams;
1511
- return: CollectionProp<FunctionLogProps>;
1512
- headers?: RawAxiosRequestHeaders;
1513
- };
1514
- };
1515
1500
  Locale: {
1516
1501
  get: {
1517
1502
  params: GetSpaceEnvironmentParams & {
@@ -2400,12 +2385,6 @@ export type GetManyFunctionParams = GetAppDefinitionParams;
2400
2385
  export type GetFunctionForEnvParams = GetSpaceEnvironmentParams & {
2401
2386
  appInstallationId: string;
2402
2387
  };
2403
- export type GetAllFunctionLogParams = GetFunctionForEnvParams & {
2404
- functionId: string;
2405
- };
2406
- export type GetFunctionLogParams = GetAllFunctionLogParams & {
2407
- logId: string;
2408
- };
2409
2388
  export type GetOrganizationParams = {
2410
2389
  organizationId: string;
2411
2390
  };
@@ -24,7 +24,6 @@ import * as environmentTemplate from './environment-template';
24
24
  import * as environmentTemplateInstallation from './environment-template-installation';
25
25
  import * as extension from './extension';
26
26
  import * as func from './function';
27
- import * as functionLog from './function-log';
28
27
  import * as locale from './locale';
29
28
  import * as organization from './organization';
30
29
  import * as organizationInvitation from './organization-invitation';
@@ -87,7 +86,6 @@ declare const _default: {
87
86
  environmentTemplateInstallation: typeof environmentTemplateInstallation;
88
87
  extension: typeof extension;
89
88
  func: typeof func;
90
- functionLog: typeof functionLog;
91
89
  locale: typeof locale;
92
90
  organization: typeof organization;
93
91
  organizationInvitation: typeof organizationInvitation;
@@ -63,7 +63,6 @@ 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';
67
66
  export type PlainClientAPI = {
68
67
  raw: {
69
68
  getDefaultParams(): DefaultParams | undefined;
@@ -84,7 +83,6 @@ export type PlainClientAPI = {
84
83
  appSigningSecret: AppSigningSecretPlainClientAPI;
85
84
  appAccessToken: AppAccessTokenPlainClientAPI;
86
85
  function: FunctionPlainClientAPI;
87
- functionLog: FunctionLogPlainClientAPI;
88
86
  editorInterface: EditorInterfacePlainClientAPI;
89
87
  space: SpacePlainClientAPI;
90
88
  environment: EnvironmentPlainClientAPI;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "11.43.0-beta.2",
3
+ "version": "11.43.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",
@@ -35,7 +35,7 @@
35
35
  "docs:watch": "nodemon --exec npm run docs:dev -w lib typings",
36
36
  "docs:publish": "npm run build:docs && ./node_modules/contentful-sdk-jsdoc/bin/publish-docs.sh contentful-management.js contentful-management",
37
37
  "check-types": "tsc",
38
- "lint": "eslint lib test --ext '.ts,.tsx,.js,.jsx'",
38
+ "lint": "eslint lib test",
39
39
  "pretest": "rimraf coverage && npm run lint",
40
40
  "test": "npm run test:cover-unit && npm run test:types && npm run test:cover-integration && npm run test:size",
41
41
  "test:cover-unit": "npm run test:unit -- --coverage",
@@ -70,7 +70,6 @@
70
70
  "devDependencies": {
71
71
  "@babel/cli": "^7.24.6",
72
72
  "@babel/core": "^7.24.6",
73
- "@babel/eslint-parser": "^7.24.6",
74
73
  "@babel/node": "^7.13.13",
75
74
  "@babel/plugin-proposal-class-properties": "^7.12.1",
76
75
  "@babel/plugin-proposal-export-namespace-from": "^7.12.1",
@@ -80,13 +79,12 @@
80
79
  "@babel/preset-env": "^7.24.6",
81
80
  "@babel/preset-typescript": "^7.24.7",
82
81
  "@contentful/integration-test-utils": "^2.0.1",
82
+ "@eslint/js": "^9.15.0",
83
83
  "@semantic-release/changelog": "^6.0.0",
84
84
  "@size-limit/file": "^11.1.6",
85
85
  "@types/json-patch": "0.0.30",
86
86
  "@types/lodash": "^4.14.168",
87
87
  "@types/node": "^20.12.13",
88
- "@typescript-eslint/eslint-plugin": "^7.14.1",
89
- "@typescript-eslint/parser": "^7.14.1",
90
88
  "@vitest/browser": "^2.1.5",
91
89
  "@vitest/coverage-v8": "^2.1.5",
92
90
  "babel-loader": "^8.2.1",
@@ -94,14 +92,9 @@
94
92
  "babel-plugin-lodash": "^3.3.4",
95
93
  "contentful-sdk-jsdoc": "3.1.0",
96
94
  "cz-conventional-changelog": "^3.3.0",
97
- "eslint": "^8.11.0",
98
- "eslint-config-prettier": "^9.0.0",
99
- "eslint-plugin-import": "^2.22.1",
100
- "eslint-plugin-no-only-tests": "^3.1.0",
101
- "eslint-plugin-node": "^11.1.0",
102
- "eslint-plugin-promise": "^6.2.0",
95
+ "eslint": "^9.15.0",
103
96
  "express": "^4.21.1",
104
- "husky": "^4.3.8",
97
+ "husky": "^9.1.7",
105
98
  "in-publish": "^2.0.1",
106
99
  "json-patch": "^0.7.0",
107
100
  "jsonwebtoken": "^9.0.2",
@@ -116,7 +109,8 @@
116
109
  "size-limit": "^11.1.6",
117
110
  "type-fest": "^4.18.3",
118
111
  "typedoc": "^0.26.2",
119
- "typescript": "^5.5.2",
112
+ "typescript": "^5.6.3",
113
+ "typescript-eslint": "^8.16.0",
120
114
  "vitest": "^2.1.5",
121
115
  "webpack": "^5.91.0",
122
116
  "webpack-bundle-analyzer": "^4.9.0",
@@ -128,7 +122,7 @@
128
122
  }
129
123
  },
130
124
  "lint-staged": {
131
- "*.{js,jsx,ts,tsx}": [
125
+ "*.{js,ts}": [
132
126
  "prettier --write",
133
127
  "eslint"
134
128
  ],
@@ -136,11 +130,6 @@
136
130
  "prettier --write"
137
131
  ]
138
132
  },
139
- "husky": {
140
- "hooks": {
141
- "pre-commit": "lint-staged"
142
- }
143
- },
144
133
  "release": {
145
134
  "branches": [
146
135
  "master",
@@ -1,21 +0,0 @@
1
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
- import * as raw from './raw';
7
- const FunctionLogAlphaHeaders = {
8
- 'x-contentful-enable-alpha-feature': 'function-logs'
9
- };
10
- const baseURL = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions/${params.functionId}/logs`;
11
- const getURL = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions/${params.functionId}/logs/${params.logId}`;
12
- export const get = (http, params) => {
13
- return raw.get(http, getURL(params), {
14
- headers: _objectSpread({}, FunctionLogAlphaHeaders)
15
- });
16
- };
17
- export const getAll = (http, params) => {
18
- return raw.get(http, baseURL(params), {
19
- headers: _objectSpread({}, FunctionLogAlphaHeaders)
20
- });
21
- };
@@ -1,94 +0,0 @@
1
- import entities from './entities';
2
- import { wrapFunctionLogCollection } from './entities/function-log';
3
-
4
- /**
5
- * @private
6
- */
7
-
8
- /**
9
- * @private
10
- */
11
- export default function createFunctionLogApi(makeRequest) {
12
- const {
13
- wrapFunctionLog
14
- } = entities.functionLog;
15
- return {
16
- /**
17
- * Get a FunctionLog by it's log ID
18
- * @Param spaceId - Space ID
19
- * @Param environmentId - Environment ID
20
- * @Param appInstallationId - App Installation ID
21
- * @Param functionId - Function ID
22
- * @Param logId - Log ID
23
- * @returns a function log
24
- * ```javascript
25
- * const contentful = require('contentful-management')
26
- *
27
- * const client = contentful.createClient({
28
- * accessToken: '<content_management_api_key>'
29
- * })
30
- *
31
- * client.functionLog.get({
32
- * spaceId: '<space_id>',
33
- * environmentId: '<environment_id>',
34
- * appInstallationId: '<app_installation_id>',
35
- * functionId: '<function_id>',
36
- * logId: '<log_id>'
37
- * })
38
- * .then((response) => console.log(response.items))
39
- * .catch(console.error)
40
- * ```
41
- */
42
- get(logId) {
43
- const raw = this.toPlainObject();
44
- return makeRequest({
45
- entityType: 'FunctionLog',
46
- action: 'get',
47
- params: {
48
- spaceId: raw.sys.space.sys.id,
49
- environmentId: raw.sys.environment.sys.id,
50
- appInstallationId: raw.sys.appDefinition.sys.id,
51
- functionId: raw.sys.id,
52
- logId: logId
53
- }
54
- }).then(data => wrapFunctionLog(makeRequest, data));
55
- },
56
- /**
57
- * Get all FunctionLogs
58
- * @Param spaceId - Space ID
59
- * @Param environmentId - Environment ID
60
- * @Param appInstallationId - App Installation ID
61
- * @Param functionId - Function ID
62
- * @returns a collection of FunctionLogs
63
- * ```javascript
64
- * const contentful = require('contentful-management')
65
- *
66
- * const client = contentful.createClient({
67
- * accessToken: '<content_management_api_key>'
68
- * })
69
- *
70
- * client.functionLog.getAll({
71
- * spaceId: '<space_id>',
72
- * environmentId: '<environment_id>',
73
- * appInstallationId: '<app_installation_id>',
74
- * functionId: '<function_id>'
75
- * })
76
- * .then((response) => console.log(response.items))
77
- * .catch(console.error)
78
- * ```
79
- */
80
- getAll() {
81
- const raw = this.toPlainObject();
82
- return makeRequest({
83
- entityType: 'FunctionLog',
84
- action: 'getAll',
85
- params: {
86
- spaceId: raw.sys.space.sys.id,
87
- environmentId: raw.sys.environment.sys.id,
88
- appInstallationId: raw.sys.appDefinition.sys.id,
89
- functionId: raw.sys.id
90
- }
91
- }).then(data => wrapFunctionLogCollection(makeRequest, data));
92
- }
93
- };
94
- }
@@ -1,24 +0,0 @@
1
- import { freezeSys, toPlainObject } from 'contentful-sdk-core';
2
- import copy from 'fast-copy';
3
- import { wrapCollection } from '../common-utils';
4
- import enhanceWithMethods from '../enhance-with-methods';
5
- import createFunctionLogApi from '../create-function-log-api';
6
- /**
7
- * @private
8
- * @param makeRequest - function to make requests via an adapter
9
- * @param data - raw contentful-Function data
10
- * @return Wrapped Function data
11
- */
12
- export function wrapFunctionLog(makeRequest, data) {
13
- const appAction = toPlainObject(copy(data));
14
- const appActionWithMethods = enhanceWithMethods(appAction, createFunctionLogApi(makeRequest));
15
- return freezeSys(appActionWithMethods);
16
- }
17
-
18
- /**
19
- * @private
20
- * @param makeRequest - function to make requests via an adapter
21
- * @param data - raw contentful-function data
22
- * @return Wrapped App Function collection data
23
- */
24
- export const wrapFunctionLogCollection = wrapCollection(wrapFunctionLog);
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import type { RestEndpoint } from '../types';
2
- export declare const get: RestEndpoint<'FunctionLog', 'get'>;
3
- export declare const getAll: RestEndpoint<'FunctionLog', 'getAll'>;
@@ -1,63 +0,0 @@
1
- import type { MakeRequest } from './common-types';
2
- import type { FunctionLogProps } from './entities/function-log';
3
- /**
4
- * @private
5
- */
6
- export type ContentfulFunctionLogApi = ReturnType<typeof createFunctionLogApi>;
7
- /**
8
- * @private
9
- */
10
- export default function createFunctionLogApi(makeRequest: MakeRequest): {
11
- /**
12
- * Get a FunctionLog by it's log ID
13
- * @Param spaceId - Space ID
14
- * @Param environmentId - Environment ID
15
- * @Param appInstallationId - App Installation ID
16
- * @Param functionId - Function ID
17
- * @Param logId - Log ID
18
- * @returns a function log
19
- * ```javascript
20
- * const contentful = require('contentful-management')
21
- *
22
- * const client = contentful.createClient({
23
- * accessToken: '<content_management_api_key>'
24
- * })
25
- *
26
- * client.functionLog.get({
27
- * spaceId: '<space_id>',
28
- * environmentId: '<environment_id>',
29
- * appInstallationId: '<app_installation_id>',
30
- * functionId: '<function_id>',
31
- * logId: '<log_id>'
32
- * })
33
- * .then((response) => console.log(response.items))
34
- * .catch(console.error)
35
- * ```
36
- */
37
- get(logId: string): Promise<FunctionLogProps & any>;
38
- /**
39
- * Get all FunctionLogs
40
- * @Param spaceId - Space ID
41
- * @Param environmentId - Environment ID
42
- * @Param appInstallationId - App Installation ID
43
- * @Param functionId - Function ID
44
- * @returns a collection of FunctionLogs
45
- * ```javascript
46
- * const contentful = require('contentful-management')
47
- *
48
- * const client = contentful.createClient({
49
- * accessToken: '<content_management_api_key>'
50
- * })
51
- *
52
- * client.functionLog.getAll({
53
- * spaceId: '<space_id>',
54
- * environmentId: '<environment_id>',
55
- * appInstallationId: '<app_installation_id>',
56
- * functionId: '<function_id>'
57
- * })
58
- * .then((response) => console.log(response.items))
59
- * .catch(console.error)
60
- * ```
61
- */
62
- getAll(): Promise<import("./common-types").Collection<FunctionLogProps & any, FunctionLogProps>>;
63
- };
@@ -1,50 +0,0 @@
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,38 +0,0 @@
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
- };