@contentstack/marketplace-sdk 1.4.0 → 1.4.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 (38) hide show
  1. package/CHANGELOG.md +12 -6
  2. package/CODEOWNERS +9 -1
  3. package/LICENSE +1 -1
  4. package/dist/es-modules/contentstack.js +5 -10
  5. package/dist/es-modules/contentstackClient.js +9 -8
  6. package/dist/es-modules/core/Util.js +17 -1
  7. package/dist/es-modules/core/contentstackHTTPClient.js +3 -16
  8. package/dist/es-modules/core/messageHandler.js +126 -0
  9. package/dist/es-modules/entity.js +1 -0
  10. package/dist/es-modules/marketplace/app/hosting/deployment.js +1 -0
  11. package/dist/es-modules/marketplace/app/hosting/index.js +1 -0
  12. package/dist/es-modules/marketplace/app/index.js +15 -14
  13. package/dist/es-modules/marketplace/app/oauth/index.js +7 -6
  14. package/dist/es-modules/marketplace/apprequest/index.js +7 -6
  15. package/dist/es-modules/marketplace/authorization/index.js +7 -6
  16. package/dist/es-modules/marketplace/index.js +5 -4
  17. package/dist/es-modules/marketplace/installation/index.js +14 -13
  18. package/dist/es-modules/marketplace/installation/webhooks/index.js +2 -1
  19. package/dist/es5/contentstack.js +4 -9
  20. package/dist/es5/contentstackClient.js +9 -8
  21. package/dist/es5/core/Util.js +21 -1
  22. package/dist/es5/core/contentstackHTTPClient.js +3 -17
  23. package/dist/es5/core/messageHandler.js +131 -0
  24. package/dist/es5/entity.js +1 -0
  25. package/dist/es5/marketplace/app/hosting/deployment.js +1 -0
  26. package/dist/es5/marketplace/app/hosting/index.js +1 -0
  27. package/dist/es5/marketplace/app/index.js +15 -14
  28. package/dist/es5/marketplace/app/oauth/index.js +7 -6
  29. package/dist/es5/marketplace/apprequest/index.js +7 -6
  30. package/dist/es5/marketplace/authorization/index.js +7 -6
  31. package/dist/es5/marketplace/index.js +5 -4
  32. package/dist/es5/marketplace/installation/index.js +14 -13
  33. package/dist/es5/marketplace/installation/webhooks/index.js +2 -1
  34. package/dist/nativescript/contentstack-marketplace.js +1 -1
  35. package/dist/node/contentstack-marketplace.js +1 -1
  36. package/dist/react-native/contentstack-marketplace.js +1 -1
  37. package/dist/web/contentstack-marketplace.js +1 -1
  38. package/package.json +5 -3
package/CHANGELOG.md CHANGED
@@ -1,24 +1,30 @@
1
1
  # Changelog
2
2
 
3
- ## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2024-08-25)
3
+ ## [v1.4.2](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.2) (2026-01-12)
4
+ - Enhancement: Improved error messages
5
+
6
+ ## [v1.4.1](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.1) (2026-01-05)
7
+ - Fix: Security issues
8
+
9
+ ## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.0) (2025-08-25)
4
10
  - Enhancement: Retry logic to make use of x-ratelimit-remaining header
5
11
 
6
- ## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2024-08-11)
12
+ ## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2025-08-11)
7
13
  - Enh: Add search function to query apps by names
8
14
 
9
- ## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (2024-08-04)
15
+ ## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (2025-08-04)
10
16
  - Fix: Fixed the Linting issues
11
17
  - Updated all the dependency to the latest version
12
18
  - Added Pre-commit hook to run the snyk and talismand scans
13
19
 
14
- ## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (2024-05-26)
20
+ ## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (2025-05-26)
15
21
 
16
22
  - Fix: Added params support to getInstalledApps method for enhanced flexibility
17
23
 
18
- ## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (2024-05-15)
24
+ ## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (2025-05-15)
19
25
  - Fixed base URL path logic in contentstackClient to handle when region and host not provided
20
26
 
21
- ## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-03-03)
27
+ ## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2025-03-03)
22
28
  - Update sanity tests
23
29
 
24
30
  ## [v1.2.5](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.5) (2025-01-17)
package/CODEOWNERS CHANGED
@@ -1 +1,9 @@
1
- * @contentstack/security-admin
1
+ * @contentstack/devex-pr-reviewers
2
+
3
+ .github/workflows/sca-scan.yml @contentstack/security-admin
4
+
5
+ **/.snyk @contentstack/security-admin
6
+
7
+ .github/workflows/policy-scan.yml @contentstack/security-admin
8
+
9
+ .github/workflows/issues-jira.yml @contentstack/security-admin
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2012-2025 Contentstack
3
+ Copyright (c) 2012-2026 Contentstack
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  */
8
8
  import packages from '../package.json';
9
9
  import clonedeep from 'lodash/cloneDeep';
10
- import getUserAgent from './core/Util.js';
10
+ import getUserAgent, { getRegionEndpoint } from './core/Util.js';
11
11
  import contentstackClient from './contentstackClient.js';
12
12
  import httpClient from './core/contentstackHTTPClient.js';
13
13
  import Region from './core/region.js';
@@ -114,14 +114,8 @@ import Region from './core/region.js';
114
114
  * @prop {function=} params.logHandler - A log handler function to process given log messages & errors.
115
115
  * @example //Set the `logHandler`
116
116
  * import * as contentstack from '@contentstack/management'
117
- * const client = contentstack.client({ logHandler: (level, data) => {
118
- if (level === 'error' && data) {
119
- const title = [data.name, data.message].filter((a) => a).join(' - ')
120
- console.error(`[error] ${title}`)
121
- return
122
- }
123
- console.log(`[${level}] ${data}`)
124
- } })
117
+ * import { logHandler } from '@contentstack/management/core/messageHandler'
118
+ * const client = contentstack.client({ logHandler: logHandler })
125
119
  *
126
120
  * @prop {function=} params.refreshToken - Optional function used to refresh token.
127
121
  * @example // OAuth example
@@ -161,8 +155,9 @@ import Region from './core/region.js';
161
155
  */
162
156
  function client() {
163
157
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
158
+ var devHubHost = params.region ? getRegionEndpoint(params.region.toLowerCase(), 'developerHub') : getRegionEndpoint("na", 'developerHub');
164
159
  var defaultParameter = {
165
- defaultHostName: 'developerhub-api.contentstack.com'
160
+ defaultHostName: devHubHost
166
161
  };
167
162
  var sdkAgent = "contentstack-marketplace-sdk/".concat(packages.version);
168
163
  var userAgentHeader = getUserAgent(sdkAgent, params.application, params.integration, params.feature);
@@ -5,6 +5,7 @@
5
5
  import error from './core/contentstackError';
6
6
  import { Marketplace } from './marketplace/index.js';
7
7
  import { Region } from './contentstack.js';
8
+ import { MESSAGES } from './core/messageHandler.js';
8
9
  export default function contentstackClient(_ref) {
9
10
  var _http$defaults;
10
11
  var http = _ref.http;
@@ -21,8 +22,8 @@ export default function contentstackClient(_ref) {
21
22
  * import * as contentstack from '@contentstack/management'
22
23
  * const client = contentstack.client()
23
24
  *
24
- * client.login({ email: <emailid>, password: <password> })
25
- * .then(() => console.log('Logged in successfully'))
25
+ * client.login({ email: <emailid>, password: <password> })
26
+ * .then(() => console.log(MESSAGES.LOGIN_SUCCESS))
26
27
  *
27
28
  * client.marketplace()
28
29
  */
@@ -62,8 +63,8 @@ export default function contentstackClient(_ref) {
62
63
  * import * as contentstack from '@contentstack/management'
63
64
  * const client = contentstack.client()
64
65
  *
65
- * client.organization().findAll()
66
- * .then((organization) => console.log(organization))
66
+ * client.organization().findAll()
67
+ * .then((organization) => console.log(MESSAGES.ORGANIZATION_LOADED))
67
68
  *
68
69
  * @example
69
70
  * import * as contentstack from '@contentstack/management'
@@ -89,14 +90,14 @@ export default function contentstackClient(_ref) {
89
90
  * @example
90
91
  * import * as contentstack from '@contentstack/management'
91
92
  * const client = contentstack.client()
92
- * client.logout()
93
- * .then((response) => console.log(response))
93
+ * client.logout()
94
+ * .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
94
95
  *
95
96
  * @example
96
97
  * import * as contentstack from '@contentstack/management'
97
98
  * const client = contentstack.client()
98
- * client.logout('AUTHTOKEN')
99
- * .then((response) => console.log(response))
99
+ * client.logout('AUTHTOKEN')
100
+ * .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
100
101
  * */
101
102
  function logout(authtoken) {
102
103
  http.defaults.versioningStrategy = 'path';
@@ -1,4 +1,5 @@
1
1
  import { platform, release } from 'os';
2
+ import regionHostMap from '../assets/regions.json';
2
3
  var HOST_REGEX = /^(?!\w+:\/\/)([\w-:]+\.)+([\w-:]+)(?::(\d+))?(?!:)$/;
3
4
  export function isHost(host) {
4
5
  return HOST_REGEX.test(host);
@@ -86,4 +87,19 @@ export default function getUserAgent(sdk, application, integration, feature) {
86
87
  return "".concat(headerParts.filter(function (item) {
87
88
  return item !== '';
88
89
  }).join('; '), ";");
89
- }
90
+ }
91
+ export var getRegionEndpoint = function getRegionEndpoint(region) {
92
+ var _regionData$endpoints;
93
+ var service = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'developerHub';
94
+ var regionData = regionHostMap.regions.find(function (r) {
95
+ return r.id === region || r.alias.some(function (alias) {
96
+ return alias === region;
97
+ });
98
+ });
99
+ if (!regionData) {
100
+ throw new Error("Invalid region '".concat(region, "' provided. Allowed regions are: ").concat(regionHostMap.regions.map(function (r) {
101
+ return r.id;
102
+ }).join(', ')));
103
+ }
104
+ return (_regionData$endpoints = regionData.endpoints[service]) === null || _regionData$endpoints === void 0 ? void 0 : _regionData$endpoints.replace(/^https?:\/\//, '');
105
+ };
@@ -7,21 +7,12 @@ import clonedeep from 'lodash/cloneDeep';
7
7
  import Qs from 'qs';
8
8
  import { ConcurrencyQueue } from './concurrency-queue';
9
9
  import { isHost } from './Util';
10
- import Region from './region';
10
+ import { httpLogHandler } from './messageHandler.js';
11
11
  export default function contentstackHttpClient(options) {
12
12
  var defaultConfig = {
13
13
  insecure: false,
14
14
  retryOnError: true,
15
- logHandler: function logHandler(level, data) {
16
- if (level === 'error' && data) {
17
- var title = [data.name, data.message].filter(function (a) {
18
- return a;
19
- }).join(' - ');
20
- console.error("[error] ".concat(title));
21
- return;
22
- }
23
- console.log("[".concat(level, "] ").concat(data));
24
- },
15
+ logHandler: httpLogHandler,
25
16
  retryCondition: function retryCondition(error) {
26
17
  if (error.response && error.response.status === 429) {
27
18
  return true;
@@ -60,11 +51,7 @@ export default function contentstackHttpClient(options) {
60
51
  if (config.basePath) {
61
52
  config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
62
53
  }
63
- if (config.region && config.region !== Region.NA) {
64
- baseUrlPath = "".concat(protocol, "://").concat(config.region, "-").concat(hostname, ":").concat(port).concat(config.basePath);
65
- } else {
66
- baseUrlPath = "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath);
67
- }
54
+ baseUrlPath = "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath);
68
55
  var baseURL = config.endpoint || baseUrlPath;
69
56
  var axiosOptions = _objectSpread(_objectSpread({
70
57
  // Axios
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Centralized message handler for all console logs and error messages
3
+ * @namespace MessageHandler
4
+ */
5
+
6
+ /**
7
+ * Success messages catalog
8
+ */
9
+ export var MESSAGES = {
10
+ // Authentication
11
+ LOGIN_SUCCESS: 'Login successful.',
12
+ // Organization - Includes org UID, name, metadata
13
+ ORGANIZATION_LOADED: 'Organization details loaded successfully.',
14
+ // API Responses
15
+ API_RESPONSE_SUCCESS: 'API response received successfully.',
16
+ API_RESPONSE_APP_OPERATION: 'API response received for app operation.',
17
+ // Marketplace
18
+ MARKETPLACE_API_RESPONSE: 'Marketplace API response received.',
19
+ MARKETPLACE_ROLES_LOADED: 'Marketplace roles loaded successfully.',
20
+ // Apps - Includes UID, name, description, config
21
+ APP_LOADED: 'App details loaded successfully.',
22
+ APP_COLLECTION_LOADED: 'App collection loaded successfully.',
23
+ APP_REQUEST_RESPONSE: 'App request response received successfully.',
24
+ // Installations - Includes installation UID, app UID, status, config
25
+ INSTALLATION_LOADED: 'App installation details loaded successfully.',
26
+ INSTALLATIONS_LOADED: 'App installation details loaded successfully.',
27
+ INSTALLATION_RESPONSE: 'Installation response received.',
28
+ INSTALLATION_COLLECTION_LOADED: 'Installation collection loaded successfully.',
29
+ INSTALLATION_WEBHOOK_LOADED: 'Installation webhook details loaded successfully.',
30
+ // Authorization - Includes redirect URIs, auth codes (no tokens for security)
31
+ AUTHORIZATION_RESPONSE: 'Authorization response received.',
32
+ // OAuth - WARNING: May contain sensitive values (client_secret)
33
+ OAUTH_CONFIG_LOADED: 'OAuth configuration loaded successfully.',
34
+ OAUTH_SCOPES_LOADED: 'OAuth scopes loaded successfully.',
35
+ // Slack
36
+ SLACK_MESSAGE_SENT: 'Slack message sent successfully.'
37
+ };
38
+
39
+ /**
40
+ * Error messages catalog
41
+ * All errors include: status, statusText, errorMessage, errorCode, errors object, request details
42
+ */
43
+ export var ERROR_MESSAGES = {
44
+ // General Request Errors
45
+ REQUEST_FAILED: function REQUEST_FAILED(title) {
46
+ return "Request failed: ".concat(title, ". Review the error details and try again.");
47
+ },
48
+ HTTP_REQUEST_FAILED: function HTTP_REQUEST_FAILED(title) {
49
+ return "HTTP request failed: ".concat(title, ". Verify your request and try again.");
50
+ },
51
+ // App Request Errors - Operations: create, update, fetch, delete, install
52
+ APP_REQUEST_PROCESS_FAILED: 'App request process failed. Check the response details and try again.',
53
+ APP_REQUEST_ERROR: 'App request failed. Check the error details and try again.',
54
+ APP_REQUEST_REVIEW: 'App request failed. Review the error details and try again.',
55
+ APP_REQUEST_FAILED: 'Failed to process app request. Check the response details and try again.',
56
+ APP_OPERATION_ERROR: 'App operation error. Review the error details and try again.',
57
+ APP_REQUEST_RESPONSE_RECEIVED: 'App request response received.',
58
+ // Authorization Errors - Common causes: invalid client_id, unauthorized redirect_uri, expired codes
59
+ AUTHORIZATION_FAILED: 'Failed to process authorization request. Check the response details and try again.',
60
+ AUTHORIZATION_ERROR: 'Authorization failed. Check the error details and try again.',
61
+ AUTHORIZATION_REVIEW: 'Authorization failed. Review the error details and try again.',
62
+ AUTHORIZATION_RESPONSE_RECEIVED: 'Authorization response received.',
63
+ // Deployment Errors - Common causes: build failures, config issues, timeouts
64
+ DEPLOYMENT_FAILED: 'Deployment failed. Check the response details for errors and try again.',
65
+ DEPLOYMENT_ERROR: 'Deployment error occurred. Review the error details and try again.',
66
+ // Hosting Errors - Common causes: invalid config, timeouts, deployment failures
67
+ HOSTING_REQUEST_FAILED: 'Hosting request failed. Check the response details and try again.',
68
+ HOSTING_ERROR: 'Hosting error occurred. Review the error details and try again.',
69
+ HOSTING_REQUEST_ERROR: 'Hosting request error. Review the error details and try again.',
70
+ // OAuth Errors - Common causes: invalid credentials, expired tokens, scope errors
71
+ OAUTH_REQUEST_FAILED: 'OAuth request failed. Check the response details and try again.',
72
+ OAUTH_ERROR: 'OAuth error occurred. Review the error details and try again.',
73
+ // Installation Errors - Operations: fetch, update, uninstall, config
74
+ INSTALLATION_REQUEST_FAILED: 'Installation request failed. Check the response details and try again.',
75
+ INSTALLATION_ERROR: 'Installation error occurred. Review the error details and try again.',
76
+ INSTALLATION_WEBHOOK_FAILED: 'Installation webhook request failed. Check the response details and try again.',
77
+ INSTALLATION_WEBHOOK_ERROR: 'Installation webhook error occurred. Review the error details and try again.',
78
+ // Entity Errors - Operations: create, read, update, delete
79
+ ENTITY_REQUEST_FAILED: 'Entity request failed. Check the response details and try again.',
80
+ ENTITY_ERROR: 'Entity error occurred. Review the error details and try again.',
81
+ // Marketplace Errors
82
+ MARKETPLACE_REQUEST_FAILED: 'Marketplace request failed. Review the error details and try again.',
83
+ // Generic Errors
84
+ GENERIC_ERROR: 'An error occurred. Check the details and try again.'
85
+ };
86
+
87
+ /**
88
+ * Log level constants
89
+ */
90
+ export var LOG_LEVELS = {
91
+ ERROR: 'error',
92
+ INFO: 'info',
93
+ WARN: 'warn'
94
+ };
95
+
96
+ /**
97
+ * Log handler for general operations
98
+ * @param {string} level - Log level (error, info, warn)
99
+ * @param {*} data - Data to log
100
+ */
101
+ export var logHandler = function logHandler(level, data) {
102
+ if (level === LOG_LEVELS.ERROR && data) {
103
+ var title = [data.name, data.message].filter(function (a) {
104
+ return a;
105
+ }).join(' - ');
106
+ console.error("".concat(ERROR_MESSAGES.REQUEST_FAILED(title)));
107
+ return;
108
+ }
109
+ console.log("".concat(level, ": ").concat(data, ". Check the details for troubleshooting."));
110
+ };
111
+
112
+ /**
113
+ * Log handler for HTTP client operations
114
+ * @param {string} level - Log level (error, info, warn)
115
+ * @param {*} data - Data to log
116
+ */
117
+ export var httpLogHandler = function httpLogHandler(level, data) {
118
+ if (level === LOG_LEVELS.ERROR && data) {
119
+ var title = [data.name, data.message].filter(function (a) {
120
+ return a;
121
+ }).join(' - ');
122
+ console.error("".concat(ERROR_MESSAGES.HTTP_REQUEST_FAILED(title)));
123
+ return;
124
+ }
125
+ console.log("".concat(level, ": ").concat(data, ". Check the HTTP client logs for more information."));
126
+ };
@@ -6,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import error from './core/contentstackError';
7
7
  import cloneDeep from 'lodash/cloneDeep';
8
8
  import ContentstackCollection from './contentstackCollection';
9
+ import { ERROR_MESSAGES } from './core/messageHandler.js';
9
10
  export var create = function create(_ref) {
10
11
  var http = _ref.http,
11
12
  params = _ref.params;
@@ -6,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import cloneDeep from 'lodash/cloneDeep';
7
7
  import ContentstackCollection from '../../../contentstackCollection';
8
8
  import error from '../../../core/contentstackError';
9
+ import { ERROR_MESSAGES } from '../../../core/messageHandler.js';
9
10
 
10
11
  /**
11
12
  *
@@ -6,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import cloneDeep from 'lodash/cloneDeep';
7
7
  import error from '../../../core/contentstackError';
8
8
  import { Deployment } from './deployment';
9
+ import { ERROR_MESSAGES } from '../../../core/messageHandler.js';
9
10
 
10
11
  /**
11
12
  *
@@ -11,6 +11,7 @@ import { Hosting } from './hosting';
11
11
  import { Installation, InstallationCollection } from '../installation';
12
12
  import { Oauth } from './oauth';
13
13
  import ContentstackCollection from '../../contentstackCollection';
14
+ import { MESSAGES, ERROR_MESSAGES } from '../../core/messageHandler.js';
14
15
 
15
16
  /**
16
17
  *
@@ -52,8 +53,8 @@ export function App(http, data) {
52
53
  * }
53
54
  * const app = client.marketplace('organization_uid').app('manifest_uid')
54
55
  * app = Object.assign(app, updateApp)
55
- * app.update()
56
- * .then((app) => console.log(app))
56
+ * app.update()
57
+ * .then((app) => console.log('App details loaded successfully.'))
57
58
  *
58
59
  */
59
60
  this.update = update(http, undefined, this.params);
@@ -68,8 +69,8 @@ export function App(http, data) {
68
69
  * import * as contentstack from '@contentstack/marketplace'
69
70
  * const client = contentstack.client({ authtoken: 'TOKEN'})
70
71
  *
71
- * client.marketplace('organization_uid').app('manifest_uid').fetch()
72
- * .then((app) => console.log(app))
72
+ * client.marketplace('organization_uid').app('manifest_uid').fetch()
73
+ * .then((app) => console.log('App details loaded successfully.'))
73
74
  *
74
75
  */
75
76
  this.fetch = fetch(http, 'data', this.params);
@@ -84,8 +85,8 @@ export function App(http, data) {
84
85
  * import * as contentstack from '@contentstack/marketplace'
85
86
  * const client = contentstack.client({ authtoken: 'TOKEN'})
86
87
  *
87
- * client.marketplace('organization_uid').app('manifest_uid').delete()
88
- * .then((response) => console.log(response))
88
+ * client.marketplace('organization_uid').app('manifest_uid').delete()
89
+ * .then((response) => console.log('App request response received.'))
89
90
  */
90
91
  this["delete"] = deleteEntity(http, false, this.params);
91
92
 
@@ -136,7 +137,7 @@ export function App(http, data) {
136
137
  * import * as contentstack from '@contentstack/marketplace'
137
138
  * const client = contentstack.client({ authtoken: 'TOKEN'})
138
139
  * client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
139
- * .then((installation) => console.log(installation))
140
+ * .then((installation) => console.log('App installation details loaded successfully.'))
140
141
  */
141
142
  this.install = /*#__PURE__*/function () {
142
143
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
@@ -193,7 +194,7 @@ export function App(http, data) {
193
194
  * import * as contentstack from '@contentstack/marketplace'
194
195
  * const client = contentstack.client({ authtoken: 'TOKEN'})
195
196
  * client.marketplace('organization_uid').app('manifest_uid').reinstall({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
196
- * .then((reinstallation) => console.log(installation))
197
+ * .then((reinstallation) => console.log('App installation details loaded successfully.'))
197
198
  */
198
199
  this.reinstall = /*#__PURE__*/function () {
199
200
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
@@ -249,8 +250,8 @@ export function App(http, data) {
249
250
  * @example
250
251
  * import * as contentstack from '@contentstack/marketplace'
251
252
  * const client = contentstack.client({ authtoken: 'TOKEN'})
252
- * client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
253
- * .then((installation) => console.log(installation))
253
+ * client.marketplace('organization_uid').app('manifest_uid').upgrade({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
254
+ * .then((installation) => console.log('App installation details loaded successfully.'))
254
255
  */
255
256
  this.upgrade = /*#__PURE__*/function () {
256
257
  var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
@@ -305,7 +306,7 @@ export function App(http, data) {
305
306
  * const client = contentstack.client({ authtoken: 'TOKEN'})
306
307
  *
307
308
  * client.marketplace('organization_uid').app('app_uid').getRequests()
308
- * .then((response) => console.log(response))
309
+ * .then((response) => console.log('API response received for app operation.'))
309
310
  *
310
311
  */
311
312
  this.getRequests = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
@@ -358,7 +359,7 @@ export function App(http, data) {
358
359
  * const client = contentstack.client({ authtoken: 'TOKEN'})
359
360
  *
360
361
  * client.marketplace('organization_uid').app('app_uid').authorize({ responseType, clientId, redirectUri, scope, state })
361
- * .then((response) => console.log(response))
362
+ * .then((response) => console.log('API response received for app operation.'))
362
363
  *
363
364
  */
364
365
  this.authorize = /*#__PURE__*/function () {
@@ -437,7 +438,7 @@ export function App(http, data) {
437
438
  * const client = contentstack.client({ authtoken: 'TOKEN'})
438
439
  *
439
440
  * client.marketplace('organization_uid').app('app_uid').listInstallations()
440
- * .then((collection) => console.log(collection))
441
+ * .then((collection) => console.log('App collection loaded successfully.'))
441
442
  *
442
443
  */
443
444
  this.listInstallations = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
@@ -500,7 +501,7 @@ export function App(http, data) {
500
501
  * }
501
502
  *
502
503
  * client.marketplace('organization_uid').app().create(app)
503
- * .then((app) => console.log(app))
504
+ * .then((app) => console.log('App details loaded successfully.'))
504
505
  *
505
506
  */
506
507
  this.create = create({
@@ -5,6 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  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; }
6
6
  import error from '../../../core/contentstackError';
7
7
  import cloneDeep from 'lodash/cloneDeep';
8
+ import { MESSAGES } from '../../../core/messageHandler.js';
8
9
 
9
10
  /**
10
11
  *
@@ -33,8 +34,8 @@ export function Oauth(http, data, params) {
33
34
  * import * as contentstack from '@contentstack/marketplace'
34
35
  * const client = contentstack.client({ authtoken: 'TOKEN'})
35
36
  *
36
- * client.marketplace('organization_uid').app('manifest_uid').oauth().fetch()
37
- * .then((oAuthConfig) => console.log(oAuthConfig))
37
+ * client.marketplace('organization_uid').app('manifest_uid').oauth().fetch()
38
+ * .then((oAuthConfig) => console.log(MESSAGES.OAUTH_CONFIG_LOADED))
38
39
  */
39
40
  this.fetch = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
40
41
  var param,
@@ -96,8 +97,8 @@ export function Oauth(http, data, params) {
96
97
  * scopes: ['scope1', 'scope2']
97
98
  * }
98
99
  * }
99
- * client.marketplace('organization_uid').app('manifest_uid').oauth().update({ config })
100
- * .then((oAuthConfig) => console.log(oAuthConfig))
100
+ * client.marketplace('organization_uid').app('manifest_uid').oauth().update({ config })
101
+ * .then((oAuthConfig) => console.log(MESSAGES.OAUTH_CONFIG_LOADED))
101
102
  */
102
103
  this.update = /*#__PURE__*/function () {
103
104
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
@@ -150,8 +151,8 @@ export function Oauth(http, data, params) {
150
151
  * import * as contentstack from '@contentstack/marketplace'
151
152
  * const client = contentstack.client({ authtoken: 'TOKEN'})
152
153
  *
153
- * client.marketplace('organization_uid').app('manifest_uid').oauth().getScopes()
154
- * .then((scopes) => console.log(scopes))
154
+ * client.marketplace('organization_uid').app('manifest_uid').oauth().getScopes()
155
+ * .then((scopes) => console.log(MESSAGES.OAUTH_SCOPES_LOADED))
155
156
  */
156
157
  this.getScopes = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
157
158
  var headers, response, _t3;
@@ -5,6 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  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; }
6
6
  import cloneDeep from 'lodash/cloneDeep';
7
7
  import error from '../../core/contentstackError';
8
+ import { MESSAGES, ERROR_MESSAGES } from '../../core/messageHandler.js';
8
9
 
9
10
  /**
10
11
  *
@@ -31,8 +32,8 @@ export function AppRequest(http, data, param) {
31
32
  * import * as contentstack from '@contentstack/marketplace'
32
33
  * const client = contentstack.client({ authtoken: 'TOKEN'})
33
34
  *
34
- * client.marketplace('organization_uid').appRequests().delete('request_uid`)
35
- * .then((response) => console.log(response))
35
+ * client.marketplace('organization_uid').appRequests().delete('request_uid`)
36
+ * .then((response) => console.log(MESSAGES.APP_REQUEST_RESPONSE))
36
37
  *
37
38
  */
38
39
  this["delete"] = /*#__PURE__*/function () {
@@ -85,8 +86,8 @@ export function AppRequest(http, data, param) {
85
86
  * import * as contentstack from '@contentstack/marketplace'
86
87
  * const client = contentstack.client({ authtoken: 'TOKEN'})
87
88
  *
88
- * client.marketplace('organization_uid').appRequests().create({ appUid: 'app_uid', targetUid: 'target_uid' })
89
- * .then((response) => console.log(response))
89
+ * client.marketplace('organization_uid').appRequests().create({ appUid: 'app_uid', targetUid: 'target_uid' })
90
+ * .then((response) => console.log(MESSAGES.APP_REQUEST_RESPONSE))
90
91
  *
91
92
  */
92
93
  this.create = /*#__PURE__*/function () {
@@ -142,8 +143,8 @@ export function AppRequest(http, data, param) {
142
143
  * import * as contentstack from '@contentstack/marketplace'
143
144
  * const client = contentstack.client({ authtoken: 'TOKEN'})
144
145
  *
145
- * client.marketplace('organization_uid').appRequests().findAll()
146
- * .then((response) => console.log(response))
146
+ * client.marketplace('organization_uid').appRequests().findAll()
147
+ * .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
147
148
  *
148
149
  */
149
150
  this.findAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
@@ -5,6 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  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; }
6
6
  import cloneDeep from 'lodash/cloneDeep';
7
7
  import error from '../../core/contentstackError';
8
+ import { MESSAGES } from '../../core/messageHandler.js';
8
9
 
9
10
  /**
10
11
  *
@@ -32,8 +33,8 @@ export function Authorization(http, data, params) {
32
33
  * import * as contentstack from '@contentstack/marketplace'
33
34
  * const client = contentstack.client({ authtoken: 'TOKEN'})
34
35
  *
35
- * client.marketplace('organization_uid').app('manifest_uid').authorization().findAll()
36
- * .then((response) => console.log(response))
36
+ * client.marketplace('organization_uid').app('manifest_uid').authorization().findAll()
37
+ * .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
37
38
  */
38
39
  this.findAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
39
40
  var param,
@@ -84,8 +85,8 @@ export function Authorization(http, data, params) {
84
85
  * import * as contentstack from '@contentstack/marketplace'
85
86
  * const client = contentstack.client({ authtoken: 'TOKEN'})
86
87
  *
87
- * client.marketplace('organization_uid').app('manifest_uid').authorization().revokeAll()
88
- * .then((response) => console.log(response))
88
+ * client.marketplace('organization_uid').app('manifest_uid').authorization().revokeAll()
89
+ * .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
89
90
  */
90
91
  this.revokeAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
91
92
  var headers, response, _t2;
@@ -130,8 +131,8 @@ export function Authorization(http, data, params) {
130
131
  * import * as contentstack from '@contentstack/marketplace'
131
132
  * const client = contentstack.client({ authtoken: 'TOKEN'})
132
133
  *
133
- * client.marketplace('organization_uid').app('manifest_uid').authorization().revoke('authorization_uid')
134
- * .then((response) => console.log(response))
134
+ * client.marketplace('organization_uid').app('manifest_uid').authorization().revoke('authorization_uid')
135
+ * .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
135
136
  */
136
137
  this.revoke = /*#__PURE__*/function () {
137
138
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(authorizationUid) {
@@ -9,6 +9,7 @@ import { Installation } from './installation';
9
9
  import error from '../core/contentstackError';
10
10
  import { fetchAll } from '../entity';
11
11
  import { AppRequest } from './apprequest';
12
+ import { MESSAGES, ERROR_MESSAGES } from '../core/messageHandler.js';
12
13
 
13
14
  /**
14
15
  *
@@ -59,13 +60,13 @@ export function Marketplace(http, data) {
59
60
  * import * as contentstack from '@contentstack/marketplace'
60
61
  * const client = contentstack.client({ authtoken: 'TOKEN'})
61
62
  * client.organization('organization_uid').app('manifest_uid').installation().findAll()
62
- * .then((installations) => console.log(installations))
63
+ * .then((installations) => console.log('App installation details loaded successfully.'))
63
64
  *
64
65
  * @example
65
66
  * import * as contentstack from '@contentstack/marketplace'
66
67
  * const client = contentstack.client({ authtoken: 'TOKEN'})
67
68
  * client.marketplace('organization_uid').installation('installation_uid').fetch()
68
- * .then((installation) => console.log(installation))
69
+ * .then((installation) => console.log('App installation details loaded successfully.'))
69
70
  */
70
71
  this.installation = function () {
71
72
  var installationUid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -106,7 +107,7 @@ export function Marketplace(http, data) {
106
107
  * const client = contentstack.client({ authtoken: 'TOKEN'})
107
108
  *
108
109
  * client.marketplace('organization_uid').findAllApps()
109
- * .then((collection) => console.log(collection))
110
+ * .then((collection) => console.log('App collection loaded successfully.'))
110
111
  *
111
112
  */
112
113
  this.urlPath = '/manifests';
@@ -191,7 +192,7 @@ export function Marketplace(http, data) {
191
192
  * const client = contentstack.client()
192
193
  *
193
194
  * client.marketplace('organization_uid').findAllAuthorizedApps({ skip: 10 })
194
- * .then((roles) => console.log(roles))
195
+ * .then((roles) => console.log('Marketplace roles loaded successfully.'))
195
196
  *
196
197
  */
197
198
  this.findAllAuthorizedApps = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {