@contentstack/marketplace-sdk 1.4.1 → 1.5.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.
- package/CHANGELOG.md +16 -7
- package/dist/es-modules/contentstack.js +6 -9
- package/dist/es-modules/contentstackClient.js +8 -8
- package/dist/es-modules/core/contentstackHTTPClient.js +3 -16
- package/dist/es-modules/core/messageHandler.js +126 -0
- package/dist/es-modules/marketplace/app/index.js +14 -14
- package/dist/es-modules/marketplace/app/oauth/index.js +6 -6
- package/dist/es-modules/marketplace/apprequest/index.js +6 -6
- package/dist/es-modules/marketplace/authorization/index.js +6 -6
- package/dist/es-modules/marketplace/index.js +5 -5
- package/dist/es-modules/marketplace/installation/index.js +13 -13
- package/dist/es-modules/marketplace/installation/webhooks/index.js +1 -1
- package/dist/es5/contentstack.js +6 -9
- package/dist/es5/contentstackClient.js +8 -8
- package/dist/es5/core/contentstackHTTPClient.js +3 -17
- package/dist/es5/core/messageHandler.js +131 -0
- package/dist/es5/marketplace/app/index.js +14 -14
- package/dist/es5/marketplace/app/oauth/index.js +6 -6
- package/dist/es5/marketplace/apprequest/index.js +6 -6
- package/dist/es5/marketplace/authorization/index.js +6 -6
- package/dist/es5/marketplace/index.js +5 -5
- package/dist/es5/marketplace/installation/index.js +13 -13
- package/dist/es5/marketplace/installation/webhooks/index.js +1 -1
- package/dist/nativescript/contentstack-marketplace.js +1 -1
- package/dist/node/contentstack-marketplace.js +1 -1
- package/dist/react-native/contentstack-marketplace.js +1 -1
- package/dist/web/contentstack-marketplace.js +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [v1.
|
|
3
|
+
## [v1.5.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.5.0) (2026-02-02)
|
|
4
|
+
- Enhancement: Use `getContentstackEndpoint` from `@contentstack/utils` to set marketplace host based on region
|
|
5
|
+
- Removed local `regions.json` and `getRegionEndpoint`; region endpoints are now resolved via `@contentstack/utils`
|
|
6
|
+
- Removed `postinstall` and `postupdate` scripts that downloaded `regions.json`
|
|
7
|
+
- Fix: Removed unused imports (MESSAGES, ERROR_MESSAGES) and lint issues
|
|
8
|
+
|
|
9
|
+
## [v1.4.2](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.2) (2026-01-12)
|
|
10
|
+
- Enhancement: Improved error messages
|
|
11
|
+
|
|
12
|
+
## [v1.4.1](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.1) (2026-01-05)
|
|
4
13
|
- Fix: Security issues
|
|
5
14
|
|
|
6
|
-
## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.0) (
|
|
15
|
+
## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.0) (2025-08-25)
|
|
7
16
|
- Enhancement: Retry logic to make use of x-ratelimit-remaining header
|
|
8
17
|
|
|
9
|
-
## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (
|
|
18
|
+
## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2025-08-11)
|
|
10
19
|
- Enh: Add search function to query apps by names
|
|
11
20
|
|
|
12
|
-
## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (
|
|
21
|
+
## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (2025-08-04)
|
|
13
22
|
- Fix: Fixed the Linting issues
|
|
14
23
|
- Updated all the dependency to the latest version
|
|
15
24
|
- Added Pre-commit hook to run the snyk and talismand scans
|
|
16
25
|
|
|
17
|
-
## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (
|
|
26
|
+
## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (2025-05-26)
|
|
18
27
|
|
|
19
28
|
- Fix: Added params support to getInstalledApps method for enhanced flexibility
|
|
20
29
|
|
|
21
|
-
## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (
|
|
30
|
+
## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (2025-05-15)
|
|
22
31
|
- Fixed base URL path logic in contentstackClient to handle when region and host not provided
|
|
23
32
|
|
|
24
|
-
## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (
|
|
33
|
+
## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2025-03-03)
|
|
25
34
|
- Update sanity tests
|
|
26
35
|
|
|
27
36
|
## [v1.2.5](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.5) (2025-01-17)
|
|
@@ -8,6 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import packages from '../package.json';
|
|
9
9
|
import clonedeep from 'lodash/cloneDeep';
|
|
10
10
|
import getUserAgent from './core/Util.js';
|
|
11
|
+
import { getContentstackEndpoint } from '@contentstack/utils';
|
|
11
12
|
import contentstackClient from './contentstackClient.js';
|
|
12
13
|
import httpClient from './core/contentstackHTTPClient.js';
|
|
13
14
|
import Region from './core/region.js';
|
|
@@ -114,14 +115,8 @@ import Region from './core/region.js';
|
|
|
114
115
|
* @prop {function=} params.logHandler - A log handler function to process given log messages & errors.
|
|
115
116
|
* @example //Set the `logHandler`
|
|
116
117
|
* import * as contentstack from '@contentstack/management'
|
|
117
|
-
*
|
|
118
|
-
|
|
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
|
-
} })
|
|
118
|
+
* import { logHandler } from '@contentstack/management/core/messageHandler'
|
|
119
|
+
* const client = contentstack.client({ logHandler: logHandler })
|
|
125
120
|
*
|
|
126
121
|
* @prop {function=} params.refreshToken - Optional function used to refresh token.
|
|
127
122
|
* @example // OAuth example
|
|
@@ -161,8 +156,10 @@ import Region from './core/region.js';
|
|
|
161
156
|
*/
|
|
162
157
|
function client() {
|
|
163
158
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
159
|
+
var region = params.region ? params.region.toLowerCase() : 'na';
|
|
160
|
+
var devHubHost = getContentstackEndpoint(region, 'developerHub', true);
|
|
164
161
|
var defaultParameter = {
|
|
165
|
-
defaultHostName:
|
|
162
|
+
defaultHostName: devHubHost
|
|
166
163
|
};
|
|
167
164
|
var sdkAgent = "contentstack-marketplace-sdk/".concat(packages.version);
|
|
168
165
|
var userAgentHeader = getUserAgent(sdkAgent, params.application, params.integration, params.feature);
|
|
@@ -21,8 +21,8 @@ export default function contentstackClient(_ref) {
|
|
|
21
21
|
* import * as contentstack from '@contentstack/management'
|
|
22
22
|
* const client = contentstack.client()
|
|
23
23
|
*
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* client.login({ email: <emailid>, password: <password> })
|
|
25
|
+
* .then(() => console.log(MESSAGES.LOGIN_SUCCESS))
|
|
26
26
|
*
|
|
27
27
|
* client.marketplace()
|
|
28
28
|
*/
|
|
@@ -62,8 +62,8 @@ export default function contentstackClient(_ref) {
|
|
|
62
62
|
* import * as contentstack from '@contentstack/management'
|
|
63
63
|
* const client = contentstack.client()
|
|
64
64
|
*
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
* client.organization().findAll()
|
|
66
|
+
* .then((organization) => console.log(MESSAGES.ORGANIZATION_LOADED))
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* import * as contentstack from '@contentstack/management'
|
|
@@ -89,14 +89,14 @@ export default function contentstackClient(_ref) {
|
|
|
89
89
|
* @example
|
|
90
90
|
* import * as contentstack from '@contentstack/management'
|
|
91
91
|
* const client = contentstack.client()
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* client.logout()
|
|
93
|
+
* .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
|
|
94
94
|
*
|
|
95
95
|
* @example
|
|
96
96
|
* import * as contentstack from '@contentstack/management'
|
|
97
97
|
* const client = contentstack.client()
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
* client.logout('AUTHTOKEN')
|
|
99
|
+
* .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
|
|
100
100
|
* */
|
|
101
101
|
function logout(authtoken) {
|
|
102
102
|
http.defaults.versioningStrategy = 'path';
|
|
@@ -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
|
|
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:
|
|
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
|
-
|
|
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
|
+
};
|
|
@@ -52,8 +52,8 @@ export function App(http, data) {
|
|
|
52
52
|
* }
|
|
53
53
|
* const app = client.marketplace('organization_uid').app('manifest_uid')
|
|
54
54
|
* app = Object.assign(app, updateApp)
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
* app.update()
|
|
56
|
+
* .then((app) => console.log('App details loaded successfully.'))
|
|
57
57
|
*
|
|
58
58
|
*/
|
|
59
59
|
this.update = update(http, undefined, this.params);
|
|
@@ -68,8 +68,8 @@ export function App(http, data) {
|
|
|
68
68
|
* import * as contentstack from '@contentstack/marketplace'
|
|
69
69
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
70
70
|
*
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
* client.marketplace('organization_uid').app('manifest_uid').fetch()
|
|
72
|
+
* .then((app) => console.log('App details loaded successfully.'))
|
|
73
73
|
*
|
|
74
74
|
*/
|
|
75
75
|
this.fetch = fetch(http, 'data', this.params);
|
|
@@ -84,8 +84,8 @@ export function App(http, data) {
|
|
|
84
84
|
* import * as contentstack from '@contentstack/marketplace'
|
|
85
85
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
86
86
|
*
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
* client.marketplace('organization_uid').app('manifest_uid').delete()
|
|
88
|
+
* .then((response) => console.log('App request response received.'))
|
|
89
89
|
*/
|
|
90
90
|
this["delete"] = deleteEntity(http, false, this.params);
|
|
91
91
|
|
|
@@ -136,7 +136,7 @@ export function App(http, data) {
|
|
|
136
136
|
* import * as contentstack from '@contentstack/marketplace'
|
|
137
137
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
138
138
|
* client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
|
|
139
|
-
* .then((installation) => console.log(installation))
|
|
139
|
+
* .then((installation) => console.log('App installation details loaded successfully.'))
|
|
140
140
|
*/
|
|
141
141
|
this.install = /*#__PURE__*/function () {
|
|
142
142
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
@@ -193,7 +193,7 @@ export function App(http, data) {
|
|
|
193
193
|
* import * as contentstack from '@contentstack/marketplace'
|
|
194
194
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
195
195
|
* client.marketplace('organization_uid').app('manifest_uid').reinstall({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
|
|
196
|
-
* .then((reinstallation) => console.log(installation))
|
|
196
|
+
* .then((reinstallation) => console.log('App installation details loaded successfully.'))
|
|
197
197
|
*/
|
|
198
198
|
this.reinstall = /*#__PURE__*/function () {
|
|
199
199
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
@@ -249,8 +249,8 @@ export function App(http, data) {
|
|
|
249
249
|
* @example
|
|
250
250
|
* import * as contentstack from '@contentstack/marketplace'
|
|
251
251
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
252
|
-
* client.marketplace('organization_uid').app('manifest_uid').
|
|
253
|
-
* .then((installation) => console.log(installation))
|
|
252
|
+
* client.marketplace('organization_uid').app('manifest_uid').upgrade({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
|
|
253
|
+
* .then((installation) => console.log('App installation details loaded successfully.'))
|
|
254
254
|
*/
|
|
255
255
|
this.upgrade = /*#__PURE__*/function () {
|
|
256
256
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
@@ -305,7 +305,7 @@ export function App(http, data) {
|
|
|
305
305
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
306
306
|
*
|
|
307
307
|
* client.marketplace('organization_uid').app('app_uid').getRequests()
|
|
308
|
-
* .then((response) => console.log(response))
|
|
308
|
+
* .then((response) => console.log('API response received for app operation.'))
|
|
309
309
|
*
|
|
310
310
|
*/
|
|
311
311
|
this.getRequests = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
@@ -358,7 +358,7 @@ export function App(http, data) {
|
|
|
358
358
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
359
359
|
*
|
|
360
360
|
* client.marketplace('organization_uid').app('app_uid').authorize({ responseType, clientId, redirectUri, scope, state })
|
|
361
|
-
* .then((response) => console.log(response))
|
|
361
|
+
* .then((response) => console.log('API response received for app operation.'))
|
|
362
362
|
*
|
|
363
363
|
*/
|
|
364
364
|
this.authorize = /*#__PURE__*/function () {
|
|
@@ -437,7 +437,7 @@ export function App(http, data) {
|
|
|
437
437
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
438
438
|
*
|
|
439
439
|
* client.marketplace('organization_uid').app('app_uid').listInstallations()
|
|
440
|
-
* .then((collection) => console.log(collection))
|
|
440
|
+
* .then((collection) => console.log('App collection loaded successfully.'))
|
|
441
441
|
*
|
|
442
442
|
*/
|
|
443
443
|
this.listInstallations = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
@@ -500,7 +500,7 @@ export function App(http, data) {
|
|
|
500
500
|
* }
|
|
501
501
|
*
|
|
502
502
|
* client.marketplace('organization_uid').app().create(app)
|
|
503
|
-
* .then((app) => console.log(
|
|
503
|
+
* .then((app) => console.log('App details loaded successfully.'))
|
|
504
504
|
*
|
|
505
505
|
*/
|
|
506
506
|
this.create = create({
|
|
@@ -33,8 +33,8 @@ export function Oauth(http, data, params) {
|
|
|
33
33
|
* import * as contentstack from '@contentstack/marketplace'
|
|
34
34
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
35
35
|
*
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* client.marketplace('organization_uid').app('manifest_uid').oauth().fetch()
|
|
37
|
+
* .then((oAuthConfig) => console.log(MESSAGES.OAUTH_CONFIG_LOADED))
|
|
38
38
|
*/
|
|
39
39
|
this.fetch = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
40
40
|
var param,
|
|
@@ -96,8 +96,8 @@ export function Oauth(http, data, params) {
|
|
|
96
96
|
* scopes: ['scope1', 'scope2']
|
|
97
97
|
* }
|
|
98
98
|
* }
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
* client.marketplace('organization_uid').app('manifest_uid').oauth().update({ config })
|
|
100
|
+
* .then((oAuthConfig) => console.log(MESSAGES.OAUTH_CONFIG_LOADED))
|
|
101
101
|
*/
|
|
102
102
|
this.update = /*#__PURE__*/function () {
|
|
103
103
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
@@ -150,8 +150,8 @@ export function Oauth(http, data, params) {
|
|
|
150
150
|
* import * as contentstack from '@contentstack/marketplace'
|
|
151
151
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
152
152
|
*
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
* client.marketplace('organization_uid').app('manifest_uid').oauth().getScopes()
|
|
154
|
+
* .then((scopes) => console.log(MESSAGES.OAUTH_SCOPES_LOADED))
|
|
155
155
|
*/
|
|
156
156
|
this.getScopes = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
157
157
|
var headers, response, _t3;
|
|
@@ -31,8 +31,8 @@ export function AppRequest(http, data, param) {
|
|
|
31
31
|
* import * as contentstack from '@contentstack/marketplace'
|
|
32
32
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
33
33
|
*
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
* client.marketplace('organization_uid').appRequests().delete('request_uid`)
|
|
35
|
+
* .then((response) => console.log(MESSAGES.APP_REQUEST_RESPONSE))
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
38
|
this["delete"] = /*#__PURE__*/function () {
|
|
@@ -85,8 +85,8 @@ export function AppRequest(http, data, param) {
|
|
|
85
85
|
* import * as contentstack from '@contentstack/marketplace'
|
|
86
86
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
87
87
|
*
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* client.marketplace('organization_uid').appRequests().create({ appUid: 'app_uid', targetUid: 'target_uid' })
|
|
89
|
+
* .then((response) => console.log(MESSAGES.APP_REQUEST_RESPONSE))
|
|
90
90
|
*
|
|
91
91
|
*/
|
|
92
92
|
this.create = /*#__PURE__*/function () {
|
|
@@ -142,8 +142,8 @@ export function AppRequest(http, data, param) {
|
|
|
142
142
|
* import * as contentstack from '@contentstack/marketplace'
|
|
143
143
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
144
144
|
*
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
* client.marketplace('organization_uid').appRequests().findAll()
|
|
146
|
+
* .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
|
|
147
147
|
*
|
|
148
148
|
*/
|
|
149
149
|
this.findAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
@@ -32,8 +32,8 @@ export function Authorization(http, data, params) {
|
|
|
32
32
|
* import * as contentstack from '@contentstack/marketplace'
|
|
33
33
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
34
34
|
*
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
* client.marketplace('organization_uid').app('manifest_uid').authorization().findAll()
|
|
36
|
+
* .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
|
|
37
37
|
*/
|
|
38
38
|
this.findAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
39
39
|
var param,
|
|
@@ -84,8 +84,8 @@ export function Authorization(http, data, params) {
|
|
|
84
84
|
* import * as contentstack from '@contentstack/marketplace'
|
|
85
85
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
86
86
|
*
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
* client.marketplace('organization_uid').app('manifest_uid').authorization().revokeAll()
|
|
88
|
+
* .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
|
|
89
89
|
*/
|
|
90
90
|
this.revokeAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
91
91
|
var headers, response, _t2;
|
|
@@ -130,8 +130,8 @@ export function Authorization(http, data, params) {
|
|
|
130
130
|
* import * as contentstack from '@contentstack/marketplace'
|
|
131
131
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
132
132
|
*
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
* client.marketplace('organization_uid').app('manifest_uid').authorization().revoke('authorization_uid')
|
|
134
|
+
* .then((response) => console.log(MESSAGES.AUTHORIZATION_RESPONSE))
|
|
135
135
|
*/
|
|
136
136
|
this.revoke = /*#__PURE__*/function () {
|
|
137
137
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(authorizationUid) {
|
|
@@ -59,13 +59,13 @@ export function Marketplace(http, data) {
|
|
|
59
59
|
* import * as contentstack from '@contentstack/marketplace'
|
|
60
60
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
61
61
|
* client.organization('organization_uid').app('manifest_uid').installation().findAll()
|
|
62
|
-
* .then((installations) => console.log(
|
|
62
|
+
* .then((installations) => console.log('App installation details loaded successfully.'))
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* import * as contentstack from '@contentstack/marketplace'
|
|
66
66
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
67
67
|
* client.marketplace('organization_uid').installation('installation_uid').fetch()
|
|
68
|
-
* .then((installation) => console.log(installation))
|
|
68
|
+
* .then((installation) => console.log('App installation details loaded successfully.'))
|
|
69
69
|
*/
|
|
70
70
|
this.installation = function () {
|
|
71
71
|
var installationUid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
@@ -106,7 +106,7 @@ export function Marketplace(http, data) {
|
|
|
106
106
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
107
107
|
*
|
|
108
108
|
* client.marketplace('organization_uid').findAllApps()
|
|
109
|
-
* .then((collection) => console.log(collection))
|
|
109
|
+
* .then((collection) => console.log('App collection loaded successfully.'))
|
|
110
110
|
*
|
|
111
111
|
*/
|
|
112
112
|
this.urlPath = '/manifests';
|
|
@@ -144,7 +144,7 @@ export function Marketplace(http, data) {
|
|
|
144
144
|
_context.next = 2;
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
throw new Error(
|
|
147
|
+
throw new Error('Search parameter is required');
|
|
148
148
|
case 2:
|
|
149
149
|
headers = {
|
|
150
150
|
headers: _objectSpread({}, cloneDeep(_this.params)),
|
|
@@ -191,7 +191,7 @@ export function Marketplace(http, data) {
|
|
|
191
191
|
* const client = contentstack.client()
|
|
192
192
|
*
|
|
193
193
|
* client.marketplace('organization_uid').findAllAuthorizedApps({ skip: 10 })
|
|
194
|
-
* .then((roles) => console.log(roles))
|
|
194
|
+
* .then((roles) => console.log('Marketplace roles loaded successfully.'))
|
|
195
195
|
*
|
|
196
196
|
*/
|
|
197
197
|
this.findAllAuthorizedApps = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
@@ -38,7 +38,7 @@ export function Installation(http, data) {
|
|
|
38
38
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
39
39
|
*
|
|
40
40
|
* client.marketplace('organization_uid').installation('installation_uid').fetch()
|
|
41
|
-
* .then((installation) => console.log(installation))
|
|
41
|
+
* .then((installation) => console.log('App installation details loaded successfully.'))
|
|
42
42
|
*
|
|
43
43
|
*/
|
|
44
44
|
this.fetch = fetch(http, 'data', this.params);
|
|
@@ -62,7 +62,7 @@ export function Installation(http, data) {
|
|
|
62
62
|
* const installation = client.marketplace('organization_uid').installation('installation_uid')
|
|
63
63
|
* installation = Object.assign(installation, updateInstallation)
|
|
64
64
|
* installation.update()
|
|
65
|
-
* .then((installation) => console.log(installation))
|
|
65
|
+
* .then((installation) => console.log('App installation details loaded successfully.'))
|
|
66
66
|
*/
|
|
67
67
|
this.update = update(http, 'data', this.params);
|
|
68
68
|
|
|
@@ -77,7 +77,7 @@ export function Installation(http, data) {
|
|
|
77
77
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
78
78
|
*
|
|
79
79
|
* client.marketplace('organization_uid').installation('installation_uid').uninstall()
|
|
80
|
-
* .then((response) => console.log(response))
|
|
80
|
+
* .then((response) => console.log('Installation response received.'))
|
|
81
81
|
*/
|
|
82
82
|
this.uninstall = deleteEntity(http, false, this.params);
|
|
83
83
|
|
|
@@ -93,7 +93,7 @@ export function Installation(http, data) {
|
|
|
93
93
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
94
94
|
*
|
|
95
95
|
* client.marketplace('organization_uid').installation('installation_uid').configuration()
|
|
96
|
-
* .then((response) => console.log(response))
|
|
96
|
+
* .then((response) => console.log('Installation response received.'))
|
|
97
97
|
*/
|
|
98
98
|
this.configuration = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
99
99
|
var param,
|
|
@@ -147,7 +147,7 @@ export function Installation(http, data) {
|
|
|
147
147
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
148
148
|
*
|
|
149
149
|
* client.marketplace('organization_uid').installation('installation_uid').setConfiguration({<configuration_details>})
|
|
150
|
-
* .then((response) => console.log(response))
|
|
150
|
+
* .then((response) => console.log('Installation response received.'))
|
|
151
151
|
*/
|
|
152
152
|
this.setConfiguration = /*#__PURE__*/function () {
|
|
153
153
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
@@ -200,7 +200,7 @@ export function Installation(http, data) {
|
|
|
200
200
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
201
201
|
*
|
|
202
202
|
* client.marketplace('organization_uid').installation('installation_uid').getConfigLocation()
|
|
203
|
-
* .then((response) => console.log(response))
|
|
203
|
+
* .then((response) => console.log('Installation response received.'))
|
|
204
204
|
*/
|
|
205
205
|
this.getConfigLocation = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
206
206
|
var headers, response, _t3;
|
|
@@ -248,7 +248,7 @@ export function Installation(http, data) {
|
|
|
248
248
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
249
249
|
*
|
|
250
250
|
* client.marketplace('organization_uid').installation('installation_uid').serverConfig()
|
|
251
|
-
* .then((response) => console.log(response))
|
|
251
|
+
* .then((response) => console.log('Installation response received.'))
|
|
252
252
|
*/
|
|
253
253
|
this.serverConfig = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
254
254
|
var param,
|
|
@@ -302,7 +302,7 @@ export function Installation(http, data) {
|
|
|
302
302
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
303
303
|
*
|
|
304
304
|
* client.marketplace('organization_uid').installation('installation_uid').setServerConfig({<configuration_details>})
|
|
305
|
-
* .then((response) => console.log(response))
|
|
305
|
+
* .then((response) => console.log('Installation response received.'))
|
|
306
306
|
*/
|
|
307
307
|
this.setServerConfig = /*#__PURE__*/function () {
|
|
308
308
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(config) {
|
|
@@ -354,7 +354,7 @@ export function Installation(http, data) {
|
|
|
354
354
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
355
355
|
*
|
|
356
356
|
* client.marketplace('organization_uid').installation('installation_uid').installationData()
|
|
357
|
-
* .then((response) => console.log(response))
|
|
357
|
+
* .then((response) => console.log('Installation response received.'))
|
|
358
358
|
*/
|
|
359
359
|
this.installationData = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
360
360
|
var headers, response, _t6;
|
|
@@ -421,7 +421,7 @@ export function Installation(http, data) {
|
|
|
421
421
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
422
422
|
*
|
|
423
423
|
* client.marketplace('organization_uid').installation().fetchAll()
|
|
424
|
-
* .then((collection) => console.log(collection))
|
|
424
|
+
* .then((collection) => console.log('Installation collection loaded successfully.'))
|
|
425
425
|
*
|
|
426
426
|
*/
|
|
427
427
|
this.fetchAll = fetchAll(http, InstallationCollection, params);
|
|
@@ -437,7 +437,7 @@ export function Installation(http, data) {
|
|
|
437
437
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
438
438
|
*
|
|
439
439
|
* client.marketplace('organization_uid').installation().getInstalledApps()
|
|
440
|
-
* .then((collection) => console.log(collection))
|
|
440
|
+
* .then((collection) => console.log('Installation collection loaded successfully.'))
|
|
441
441
|
*
|
|
442
442
|
*/
|
|
443
443
|
this.getInstalledApps = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
@@ -491,7 +491,7 @@ export function Installation(http, data) {
|
|
|
491
491
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
492
492
|
*
|
|
493
493
|
* client.marketplace('organization_uid').installation().getInstalledUsers()
|
|
494
|
-
* .then((collection) => console.log(collection))
|
|
494
|
+
* .then((collection) => console.log('Installation collection loaded successfully.'))
|
|
495
495
|
*
|
|
496
496
|
*/
|
|
497
497
|
this.getInstalledUsers = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
@@ -539,7 +539,7 @@ export function Installation(http, data) {
|
|
|
539
539
|
* const client = contentstack.client({ authtoken: 'TOKEN'})
|
|
540
540
|
*
|
|
541
541
|
* client.marketplace('organization_uid').installation().getInstalledStacks()
|
|
542
|
-
* .then((collection) => console.log(collection))
|
|
542
|
+
* .then((collection) => console.log('Installation collection loaded successfully.'))
|
|
543
543
|
*
|
|
544
544
|
*/
|
|
545
545
|
this.getInstalledStacks = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|