@commercetools-frontend/mc-scripts 21.18.0 → 21.19.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/bin/cli.js +6 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +318 -295
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +318 -295
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +317 -294
- package/dist/{build-70142b7e.esm.js → build-20d77feb.esm.js} +3 -3
- package/dist/{build-5fb0fc10.cjs.prod.js → build-b1030e29.cjs.prod.js} +3 -3
- package/dist/{build-6f94dc3b.cjs.dev.js → build-c1a3c8cd.cjs.dev.js} +3 -3
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
- package/dist/{config-sync-5987fd39.cjs.dev.js → config-sync-2263c2ec.cjs.dev.js} +259 -137
- package/dist/{config-sync-0844f13b.esm.js → config-sync-6a39d2e3.esm.js} +255 -134
- package/dist/{config-sync-27736a53.cjs.prod.js → config-sync-edec607e.cjs.prod.js} +259 -137
- package/dist/{create-postcss-config-9b9a988c.cjs.dev.js → create-postcss-config-3a117693.cjs.dev.js} +1 -1
- package/dist/{create-postcss-config-0c7dbb5c.esm.js → create-postcss-config-6dcc86ab.esm.js} +1 -1
- package/dist/{create-postcss-config-b8604cd6.cjs.prod.js → create-postcss-config-ef589644.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-development-5b4f9f05.cjs.dev.js → create-webpack-config-for-development-28510e96.cjs.dev.js} +1 -1
- package/dist/{create-webpack-config-for-development-10c389cd.esm.js → create-webpack-config-for-development-a29fdeee.esm.js} +1 -1
- package/dist/{create-webpack-config-for-development-bd88930a.cjs.prod.js → create-webpack-config-for-development-fa017d55.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-production-e80b6fc7.cjs.prod.js → create-webpack-config-for-production-15e6365d.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-production-2c77e9fe.esm.js → create-webpack-config-for-production-39453789.esm.js} +1 -1
- package/dist/{create-webpack-config-for-production-48ad7e6a.cjs.dev.js → create-webpack-config-for-production-dfcafa81.cjs.dev.js} +1 -1
- package/dist/declarations/src/cli.d.ts +1 -1
- package/dist/declarations/src/utils/graphql-requests.d.ts +4 -8
- package/dist/{login-ce9906f4.esm.js → login-bdc2976a.esm.js} +17 -15
- package/dist/{login-c7baca5e.cjs.prod.js → login-dad3f3b8.cjs.prod.js} +17 -15
- package/dist/{login-bf79b277.cjs.dev.js → login-ed5c7f5e.cjs.dev.js} +17 -15
- package/dist/{package-663c0f80.cjs.prod.js → package-19e5588c.cjs.dev.js} +9 -8
- package/dist/{package-3ac48b2d.esm.js → package-47ad699b.esm.js} +9 -8
- package/dist/{package-bec920c0.cjs.dev.js → package-bbd49c17.cjs.prod.js} +9 -8
- package/dist/{start-70f1d650.cjs.dev.js → start-31119852.cjs.dev.js} +3 -3
- package/dist/{start-598dab76.esm.js → start-7ca70f00.esm.js} +3 -3
- package/dist/{start-9d376be4.cjs.prod.js → start-a2641c71.cjs.prod.js} +3 -3
- package/dist/{user-agent-cf9eb504.esm.js → user-agent-0a7ca83a.esm.js} +1 -1
- package/dist/{user-agent-d9cc2dfa.cjs.prod.js → user-agent-4b9aa874.cjs.prod.js} +1 -1
- package/dist/{user-agent-56268751.cjs.dev.js → user-agent-ff2423ef.cjs.dev.js} +1 -1
- package/package.json +9 -8
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
|
@@ -6,26 +6,28 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
|
6
6
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
7
7
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
8
8
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
9
10
|
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
10
11
|
var omit = require('lodash/omit');
|
|
11
12
|
var prompts = require('prompts');
|
|
12
13
|
var chalk = require('chalk');
|
|
13
14
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
14
|
-
var userAgent = require('./user-agent-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var userAgent = require('./user-agent-ff2423ef.cjs.dev.js');
|
|
16
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
17
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
18
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
17
19
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
18
20
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
21
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
19
22
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
20
23
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
21
24
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
22
|
-
var
|
|
25
|
+
var graphql = require('graphql');
|
|
26
|
+
var graphqlRequest = require('graphql-request');
|
|
27
|
+
var constants = require('@commercetools-frontend/constants');
|
|
23
28
|
var _repeatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/repeat');
|
|
24
29
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
25
|
-
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
26
30
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
27
|
-
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
28
|
-
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
29
31
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
30
32
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
31
33
|
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
@@ -33,7 +35,7 @@ require('fs');
|
|
|
33
35
|
require('path');
|
|
34
36
|
require('os');
|
|
35
37
|
require('@commercetools/http-user-agent');
|
|
36
|
-
require('./package-
|
|
38
|
+
require('./package-19e5588c.cjs.dev.js');
|
|
37
39
|
|
|
38
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
39
41
|
|
|
@@ -41,59 +43,159 @@ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRunt
|
|
|
41
43
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
42
44
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
43
45
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
46
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
44
47
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
45
48
|
var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
46
49
|
var prompts__default = /*#__PURE__*/_interopDefault(prompts);
|
|
47
50
|
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
51
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
52
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
48
53
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
49
54
|
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
55
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
50
56
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
51
57
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
52
58
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
53
59
|
var _repeatInstanceProperty__default = /*#__PURE__*/_interopDefault(_repeatInstanceProperty);
|
|
54
60
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
55
|
-
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
61
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
57
|
-
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
58
|
-
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
59
62
|
|
|
63
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
64
|
+
|
|
65
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context7, _context8; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$1(Object(source), !0)).call(_context7, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$1(Object(source))).call(_context8, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
60
66
|
var FetchCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationExtensionForCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "entryPointUriPath" }, value: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "description" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 647, source: { body: "query FetchCustomApplicationFromCli($entryPointUriPath: String!) {\n organizationExtensionForCustomApplication(\n entryPointUriPath: $entryPointUriPath\n ) {\n organizationId\n application {\n id\n entryPointUriPath\n name\n description\n url\n icon\n permissions {\n name\n oAuthScopes\n }\n mainMenuLink {\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n uriPath\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
61
67
|
var UpdateCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDraftDataInput" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 268, source: { body: "mutation UpdateCustomApplicationFromCli(\n $organizationId: String!\n $data: CustomApplicationDraftDataInput!\n $applicationId: ID!\n) {\n updateCustomApplication(\n organizationId: $organizationId\n data: $data\n applicationId: $applicationId\n ) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
62
68
|
var CreateCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDraftDataInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 201, source: { body: "mutation CreateCustomApplicationFromCli(\n $organizationId: String!\n $data: CustomApplicationDraftDataInput!\n) {\n createCustomApplication(organizationId: $organizationId, data: $data) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
63
69
|
var FetchMyOrganizationsFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchMyOrganizationsFromCli" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "myOrganizations" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 112, source: { body: "query FetchMyOrganizationsFromCli {\n myOrganizations {\n total\n results {\n id\n name\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
70
|
+
var credentialsStorage$1 = new userAgent.CredentialsStorage();
|
|
71
|
+
var client = new graphqlRequest.GraphQLClient('', // <-- Set on demand
|
|
72
|
+
{
|
|
73
|
+
headers: {
|
|
74
|
+
Accept: 'application/json',
|
|
75
|
+
'Content-Type': 'application/json',
|
|
76
|
+
'x-user-agent': userAgent.userAgent
|
|
77
|
+
}
|
|
78
|
+
});
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
function requestWithTokenRetry(_x, _x2) {
|
|
81
|
+
return _requestWithTokenRetry.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _requestWithTokenRetry() {
|
|
85
|
+
_requestWithTokenRetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(document, requestOptions) {
|
|
86
|
+
var retryCount,
|
|
87
|
+
token,
|
|
88
|
+
result,
|
|
89
|
+
refreshedSessionToken,
|
|
90
|
+
refreshedSessionTokenExpiresAt,
|
|
91
|
+
_context5,
|
|
92
|
+
isUnauthorizedError,
|
|
93
|
+
_args5 = arguments;
|
|
94
|
+
|
|
95
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context6) {
|
|
96
|
+
while (1) {
|
|
97
|
+
switch (_context6.prev = _context6.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
retryCount = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : 0;
|
|
100
|
+
token = credentialsStorage$1.getToken(requestOptions.mcApiUrl);
|
|
101
|
+
client.setEndpoint("".concat(requestOptions.mcApiUrl, "/graphql"));
|
|
102
|
+
client.setHeaders(requestOptions.headers);
|
|
103
|
+
|
|
104
|
+
if (token) {
|
|
105
|
+
client.setHeader('x-mc-cli-access-token', token);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_context6.prev = 5;
|
|
109
|
+
_context6.next = 8;
|
|
110
|
+
return client.rawRequest(graphql.print(document), requestOptions.variables);
|
|
111
|
+
|
|
112
|
+
case 8:
|
|
113
|
+
result = _context6.sent;
|
|
114
|
+
// In case a new session token is returned from the server, save it.
|
|
115
|
+
refreshedSessionToken = result.headers.get('x-refreshed-session-token');
|
|
116
|
+
|
|
117
|
+
if (refreshedSessionToken) {
|
|
118
|
+
console.log(chalk__default["default"].green('Session token refreshed.'));
|
|
119
|
+
console.log();
|
|
120
|
+
refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at'); // Store the updated access token.
|
|
121
|
+
|
|
122
|
+
credentialsStorage$1.setToken(requestOptions.mcApiUrl, {
|
|
123
|
+
token: refreshedSessionToken,
|
|
124
|
+
expiresAt: Number(refreshedSessionTokenExpiresAt)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return _context6.abrupt("return", result.data);
|
|
129
|
+
|
|
130
|
+
case 14:
|
|
131
|
+
_context6.prev = 14;
|
|
132
|
+
_context6.t0 = _context6["catch"](5);
|
|
133
|
+
|
|
134
|
+
if (!(_context6.t0 instanceof graphqlRequest.ClientError)) {
|
|
135
|
+
_context6.next = 22;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!(retryCount === 0 && _context6.t0.response.errors && _context6.t0.response.errors.length > 0)) {
|
|
140
|
+
_context6.next = 22;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
isUnauthorizedError = _someInstanceProperty__default["default"](_context5 = _context6.t0.response.errors).call(_context5, function (graphqlError) {
|
|
145
|
+
var _graphqlError$extensi;
|
|
146
|
+
|
|
147
|
+
return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
if (!isUnauthorizedError) {
|
|
151
|
+
_context6.next = 22;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
|
|
156
|
+
return _context6.abrupt("return", requestWithTokenRetry(document, _objectSpread$1(_objectSpread$1({}, requestOptions), {}, {
|
|
157
|
+
headers: _objectSpread$1(_objectSpread$1({}, requestOptions.headers), {}, {
|
|
158
|
+
'X-Force-Token': 'true'
|
|
159
|
+
})
|
|
160
|
+
}), retryCount + 1));
|
|
161
|
+
|
|
162
|
+
case 22:
|
|
163
|
+
throw _context6.t0;
|
|
164
|
+
|
|
165
|
+
case 23:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context6.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee5, null, [[5, 14]]);
|
|
171
|
+
}));
|
|
172
|
+
return _requestWithTokenRetry.apply(this, arguments);
|
|
173
|
+
}
|
|
77
174
|
|
|
78
175
|
var fetchCustomApplication = /*#__PURE__*/function () {
|
|
79
176
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(_ref) {
|
|
80
|
-
var mcApiUrl,
|
|
177
|
+
var mcApiUrl, entryPointUriPath, customAppData;
|
|
81
178
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
82
179
|
while (1) {
|
|
83
180
|
switch (_context.prev = _context.next) {
|
|
84
181
|
case 0:
|
|
85
|
-
mcApiUrl = _ref.mcApiUrl,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
182
|
+
mcApiUrl = _ref.mcApiUrl, entryPointUriPath = _ref.entryPointUriPath;
|
|
183
|
+
_context.next = 3;
|
|
184
|
+
return requestWithTokenRetry(FetchCustomApplicationFromCli, {
|
|
185
|
+
variables: {
|
|
186
|
+
entryPointUriPath: entryPointUriPath
|
|
187
|
+
},
|
|
188
|
+
mcApiUrl: mcApiUrl,
|
|
189
|
+
headers: {
|
|
190
|
+
'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
case 3:
|
|
93
195
|
customAppData = _context.sent;
|
|
94
196
|
return _context.abrupt("return", customAppData.organizationExtensionForCustomApplication);
|
|
95
197
|
|
|
96
|
-
case
|
|
198
|
+
case 5:
|
|
97
199
|
case "end":
|
|
98
200
|
return _context.stop();
|
|
99
201
|
}
|
|
@@ -101,32 +203,37 @@ var fetchCustomApplication = /*#__PURE__*/function () {
|
|
|
101
203
|
}, _callee);
|
|
102
204
|
}));
|
|
103
205
|
|
|
104
|
-
return function fetchCustomApplication(
|
|
206
|
+
return function fetchCustomApplication(_x3) {
|
|
105
207
|
return _ref2.apply(this, arguments);
|
|
106
208
|
};
|
|
107
209
|
}();
|
|
108
210
|
|
|
109
211
|
var updateCustomApplication = /*#__PURE__*/function () {
|
|
110
212
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref3) {
|
|
111
|
-
var mcApiUrl,
|
|
213
|
+
var mcApiUrl, applicationId, organizationId, data, updatedCustomAppsData;
|
|
112
214
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
113
215
|
while (1) {
|
|
114
216
|
switch (_context2.prev = _context2.next) {
|
|
115
217
|
case 0:
|
|
116
|
-
mcApiUrl = _ref3.mcApiUrl,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
218
|
+
mcApiUrl = _ref3.mcApiUrl, applicationId = _ref3.applicationId, organizationId = _ref3.organizationId, data = _ref3.data;
|
|
219
|
+
_context2.next = 3;
|
|
220
|
+
return requestWithTokenRetry(UpdateCustomApplicationFromCli, {
|
|
221
|
+
variables: {
|
|
222
|
+
organizationId: organizationId,
|
|
223
|
+
applicationId: applicationId,
|
|
224
|
+
data: data
|
|
225
|
+
},
|
|
226
|
+
mcApiUrl: mcApiUrl,
|
|
227
|
+
headers: {
|
|
228
|
+
'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
229
|
+
}
|
|
230
|
+
});
|
|
124
231
|
|
|
125
|
-
case
|
|
232
|
+
case 3:
|
|
126
233
|
updatedCustomAppsData = _context2.sent;
|
|
127
234
|
return _context2.abrupt("return", updatedCustomAppsData.updateCustomApplication);
|
|
128
235
|
|
|
129
|
-
case
|
|
236
|
+
case 5:
|
|
130
237
|
case "end":
|
|
131
238
|
return _context2.stop();
|
|
132
239
|
}
|
|
@@ -134,31 +241,36 @@ var updateCustomApplication = /*#__PURE__*/function () {
|
|
|
134
241
|
}, _callee2);
|
|
135
242
|
}));
|
|
136
243
|
|
|
137
|
-
return function updateCustomApplication(
|
|
244
|
+
return function updateCustomApplication(_x4) {
|
|
138
245
|
return _ref4.apply(this, arguments);
|
|
139
246
|
};
|
|
140
247
|
}();
|
|
141
248
|
|
|
142
249
|
var createCustomApplication = /*#__PURE__*/function () {
|
|
143
250
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref5) {
|
|
144
|
-
var mcApiUrl,
|
|
251
|
+
var mcApiUrl, organizationId, data, createdCustomAppData;
|
|
145
252
|
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
146
253
|
while (1) {
|
|
147
254
|
switch (_context3.prev = _context3.next) {
|
|
148
255
|
case 0:
|
|
149
|
-
mcApiUrl = _ref5.mcApiUrl,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
256
|
+
mcApiUrl = _ref5.mcApiUrl, organizationId = _ref5.organizationId, data = _ref5.data;
|
|
257
|
+
_context3.next = 3;
|
|
258
|
+
return requestWithTokenRetry(CreateCustomApplicationFromCli, {
|
|
259
|
+
variables: {
|
|
260
|
+
organizationId: organizationId,
|
|
261
|
+
data: data
|
|
262
|
+
},
|
|
263
|
+
mcApiUrl: mcApiUrl,
|
|
264
|
+
headers: {
|
|
265
|
+
'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
266
|
+
}
|
|
267
|
+
});
|
|
156
268
|
|
|
157
|
-
case
|
|
269
|
+
case 3:
|
|
158
270
|
createdCustomAppData = _context3.sent;
|
|
159
271
|
return _context3.abrupt("return", createdCustomAppData.createCustomApplication);
|
|
160
272
|
|
|
161
|
-
case
|
|
273
|
+
case 5:
|
|
162
274
|
case "end":
|
|
163
275
|
return _context3.stop();
|
|
164
276
|
}
|
|
@@ -166,21 +278,26 @@ var createCustomApplication = /*#__PURE__*/function () {
|
|
|
166
278
|
}, _callee3);
|
|
167
279
|
}));
|
|
168
280
|
|
|
169
|
-
return function createCustomApplication(
|
|
281
|
+
return function createCustomApplication(_x5) {
|
|
170
282
|
return _ref6.apply(this, arguments);
|
|
171
283
|
};
|
|
172
284
|
}();
|
|
173
285
|
|
|
174
286
|
var fetchUserOrganizations = /*#__PURE__*/function () {
|
|
175
287
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
|
|
176
|
-
var mcApiUrl,
|
|
288
|
+
var mcApiUrl, userOrganizations;
|
|
177
289
|
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
|
|
178
290
|
while (1) {
|
|
179
291
|
switch (_context4.prev = _context4.next) {
|
|
180
292
|
case 0:
|
|
181
|
-
mcApiUrl = _ref7.mcApiUrl
|
|
293
|
+
mcApiUrl = _ref7.mcApiUrl;
|
|
182
294
|
_context4.next = 3;
|
|
183
|
-
return
|
|
295
|
+
return requestWithTokenRetry(FetchMyOrganizationsFromCli, {
|
|
296
|
+
mcApiUrl: mcApiUrl,
|
|
297
|
+
headers: {
|
|
298
|
+
'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
|
|
299
|
+
}
|
|
300
|
+
});
|
|
184
301
|
|
|
185
302
|
case 3:
|
|
186
303
|
userOrganizations = _context4.sent;
|
|
@@ -194,7 +311,7 @@ var fetchUserOrganizations = /*#__PURE__*/function () {
|
|
|
194
311
|
}, _callee4);
|
|
195
312
|
}));
|
|
196
313
|
|
|
197
|
-
return function fetchUserOrganizations(
|
|
314
|
+
return function fetchUserOrganizations(_x6) {
|
|
198
315
|
return _ref8.apply(this, arguments);
|
|
199
316
|
};
|
|
200
317
|
}();
|
|
@@ -638,225 +755,230 @@ function run(_x) {
|
|
|
638
755
|
|
|
639
756
|
function _run() {
|
|
640
757
|
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
|
|
641
|
-
var
|
|
758
|
+
var _context5;
|
|
642
759
|
|
|
643
|
-
var applicationConfig$1, localCustomAppData, mcApiUrl,
|
|
760
|
+
var applicationConfig$1, localCustomAppData, mcApiUrl, isSessionValid, fetchedCustomApplication, _context4, userOrganizations, organizationId, organizationName, _userOrganizations$re, organization, _context3, organizationChoices, _yield$prompts, selectedOrganizationId, _yield$prompts2, _confirmation, _data, createdCustomApplication, _customAppLink, customAppLink, configDiff, _yield$prompts3, confirmation, data;
|
|
644
761
|
|
|
645
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(
|
|
762
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context6) {
|
|
646
763
|
while (1) {
|
|
647
|
-
switch (
|
|
764
|
+
switch (_context6.prev = _context6.next) {
|
|
648
765
|
case 0:
|
|
649
766
|
applicationConfig$1 = applicationConfig.processConfig();
|
|
650
767
|
localCustomAppData = applicationConfig$1.data;
|
|
651
768
|
mcApiUrl = applicationConfig$1.env.mcApiUrl;
|
|
652
|
-
|
|
769
|
+
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
770
|
+
console.log();
|
|
771
|
+
isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
653
772
|
|
|
654
|
-
if (
|
|
655
|
-
|
|
773
|
+
if (isSessionValid) {
|
|
774
|
+
_context6.next = 8;
|
|
656
775
|
break;
|
|
657
776
|
}
|
|
658
777
|
|
|
659
|
-
throw new Error("You don't have a valid session
|
|
778
|
+
throw new Error("You don't have a valid session. Please, run the \"mc-scripts login\" command to authenticate yourself.");
|
|
660
779
|
|
|
661
|
-
case
|
|
662
|
-
|
|
780
|
+
case 8:
|
|
781
|
+
_context6.next = 10;
|
|
663
782
|
return fetchCustomApplication({
|
|
664
783
|
mcApiUrl: mcApiUrl,
|
|
665
|
-
token: token,
|
|
666
784
|
entryPointUriPath: localCustomAppData.entryPointUriPath
|
|
667
785
|
});
|
|
668
786
|
|
|
669
|
-
case
|
|
670
|
-
fetchedCustomApplication =
|
|
787
|
+
case 10:
|
|
788
|
+
fetchedCustomApplication = _context6.sent;
|
|
671
789
|
|
|
672
790
|
if (fetchedCustomApplication) {
|
|
673
|
-
|
|
791
|
+
_context6.next = 55;
|
|
674
792
|
break;
|
|
675
793
|
}
|
|
676
794
|
|
|
677
|
-
|
|
795
|
+
_context6.next = 14;
|
|
678
796
|
return fetchUserOrganizations({
|
|
679
|
-
mcApiUrl: mcApiUrl
|
|
680
|
-
token: token
|
|
797
|
+
mcApiUrl: mcApiUrl
|
|
681
798
|
});
|
|
682
799
|
|
|
683
|
-
case
|
|
684
|
-
userOrganizations =
|
|
800
|
+
case 14:
|
|
801
|
+
userOrganizations = _context6.sent;
|
|
685
802
|
|
|
686
803
|
if (!(userOrganizations.total === 0)) {
|
|
687
|
-
|
|
804
|
+
_context6.next = 17;
|
|
688
805
|
break;
|
|
689
806
|
}
|
|
690
807
|
|
|
691
808
|
throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.");
|
|
692
809
|
|
|
693
|
-
case
|
|
810
|
+
case 17:
|
|
694
811
|
if (!(userOrganizations.total === 1)) {
|
|
695
|
-
|
|
812
|
+
_context6.next = 23;
|
|
696
813
|
break;
|
|
697
814
|
}
|
|
698
815
|
|
|
699
816
|
_userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
|
|
700
817
|
organizationId = organization.id;
|
|
701
818
|
organizationName = organization.name;
|
|
702
|
-
|
|
819
|
+
_context6.next = 32;
|
|
703
820
|
break;
|
|
704
821
|
|
|
705
|
-
case
|
|
822
|
+
case 23:
|
|
706
823
|
organizationChoices = _mapInstanceProperty__default["default"](_context3 = userOrganizations.results).call(_context3, function (organization) {
|
|
707
824
|
return {
|
|
708
825
|
title: organization.name,
|
|
709
826
|
value: organization.id
|
|
710
827
|
};
|
|
711
828
|
});
|
|
712
|
-
|
|
829
|
+
_context6.next = 26;
|
|
713
830
|
return prompts__default["default"]({
|
|
714
831
|
type: 'select',
|
|
715
832
|
name: 'organizationId',
|
|
716
|
-
message: 'Select Organization',
|
|
833
|
+
message: 'Select an Organization',
|
|
717
834
|
choices: organizationChoices,
|
|
718
835
|
initial: 0
|
|
719
836
|
});
|
|
720
837
|
|
|
721
|
-
case
|
|
722
|
-
_yield$prompts =
|
|
838
|
+
case 26:
|
|
839
|
+
_yield$prompts = _context6.sent;
|
|
723
840
|
selectedOrganizationId = _yield$prompts.organizationId;
|
|
724
841
|
|
|
725
842
|
if (selectedOrganizationId) {
|
|
726
|
-
|
|
843
|
+
_context6.next = 30;
|
|
727
844
|
break;
|
|
728
845
|
}
|
|
729
846
|
|
|
730
847
|
throw new Error("No Organization selected, aborting.");
|
|
731
848
|
|
|
732
|
-
case
|
|
849
|
+
case 30:
|
|
733
850
|
organizationId = selectedOrganizationId;
|
|
734
851
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, function (_ref) {
|
|
735
852
|
var value = _ref.value;
|
|
736
853
|
return value === organizationId;
|
|
737
854
|
}).title;
|
|
738
855
|
|
|
739
|
-
case
|
|
740
|
-
|
|
856
|
+
case 32:
|
|
857
|
+
_context6.next = 34;
|
|
741
858
|
return prompts__default["default"]({
|
|
742
859
|
type: 'text',
|
|
743
860
|
name: 'confirmation',
|
|
744
|
-
message:
|
|
861
|
+
message: _filterInstanceProperty__default["default"](_context4 = ["You are about to create a new Custom Application in the \"".concat(chalk__default["default"].green(organizationName), "\" organization. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be created.')]).call(_context4, Boolean).join('\n'),
|
|
745
862
|
initial: 'yes'
|
|
746
863
|
});
|
|
747
864
|
|
|
748
|
-
case
|
|
749
|
-
_yield$prompts2 =
|
|
865
|
+
case 34:
|
|
866
|
+
_yield$prompts2 = _context6.sent;
|
|
750
867
|
_confirmation = _yield$prompts2.confirmation;
|
|
751
868
|
|
|
752
869
|
if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
753
|
-
|
|
870
|
+
_context6.next = 39;
|
|
754
871
|
break;
|
|
755
872
|
}
|
|
756
873
|
|
|
757
874
|
console.log(chalk__default["default"].red('Aborted.'));
|
|
758
|
-
return
|
|
875
|
+
return _context6.abrupt("return");
|
|
759
876
|
|
|
760
|
-
case
|
|
877
|
+
case 39:
|
|
761
878
|
_data = omit__default["default"](localCustomAppData, ['id']);
|
|
762
879
|
|
|
763
880
|
if (!options.dryRun) {
|
|
764
|
-
|
|
881
|
+
_context6.next = 46;
|
|
765
882
|
break;
|
|
766
883
|
}
|
|
767
884
|
|
|
768
|
-
console.log(
|
|
769
|
-
console.log("
|
|
770
|
-
console.log(
|
|
771
|
-
|
|
885
|
+
console.log();
|
|
886
|
+
console.log("The following payload would be used to create a new Custom Application.");
|
|
887
|
+
console.log();
|
|
888
|
+
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](_data, null, 2)));
|
|
889
|
+
return _context6.abrupt("return");
|
|
772
890
|
|
|
773
|
-
case
|
|
774
|
-
|
|
891
|
+
case 46:
|
|
892
|
+
_context6.next = 48;
|
|
775
893
|
return createCustomApplication({
|
|
776
894
|
mcApiUrl: mcApiUrl,
|
|
777
|
-
token: token,
|
|
778
895
|
organizationId: organizationId,
|
|
779
896
|
data: _data
|
|
780
897
|
});
|
|
781
898
|
|
|
782
|
-
case
|
|
783
|
-
createdCustomApplication =
|
|
899
|
+
case 48:
|
|
900
|
+
createdCustomApplication = _context6.sent;
|
|
784
901
|
|
|
785
902
|
if (createdCustomApplication) {
|
|
786
|
-
|
|
903
|
+
_context6.next = 51;
|
|
787
904
|
break;
|
|
788
905
|
}
|
|
789
906
|
|
|
790
907
|
throw new Error('Failed to create the Custom Application.');
|
|
791
908
|
|
|
792
|
-
case
|
|
909
|
+
case 51:
|
|
793
910
|
_customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
|
|
794
|
-
console.log(chalk__default["default"].green(
|
|
795
|
-
|
|
911
|
+
console.log(chalk__default["default"].green("Custom Application created.\nPlease update the \"env.production.applicationId\" field in your local Custom Application config file with the following value: \"".concat(chalk__default["default"].green(createdCustomApplication.id), "\".")));
|
|
912
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(_customAppLink), "\"."));
|
|
913
|
+
return _context6.abrupt("return");
|
|
796
914
|
|
|
797
|
-
case
|
|
915
|
+
case 55:
|
|
798
916
|
customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
|
|
799
917
|
configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
|
|
800
918
|
|
|
801
919
|
if (configDiff) {
|
|
802
|
-
|
|
920
|
+
_context6.next = 61;
|
|
803
921
|
break;
|
|
804
922
|
}
|
|
805
923
|
|
|
806
|
-
console.log(chalk__default["default"].green("Custom Application
|
|
807
|
-
|
|
924
|
+
console.log(chalk__default["default"].green("Custom Application up-to-date."));
|
|
925
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
926
|
+
return _context6.abrupt("return");
|
|
808
927
|
|
|
809
|
-
case
|
|
928
|
+
case 61:
|
|
929
|
+
console.log('Changes detected:');
|
|
810
930
|
console.log(configDiff);
|
|
811
|
-
|
|
931
|
+
console.log();
|
|
932
|
+
_context6.next = 66;
|
|
812
933
|
return prompts__default["default"]({
|
|
813
934
|
type: 'text',
|
|
814
935
|
name: 'confirmation',
|
|
815
|
-
message:
|
|
936
|
+
message: _filterInstanceProperty__default["default"](_context5 = ["You are about to update the Custom Application \"".concat(chalk__default["default"].green(localCustomAppData.entryPointUriPath), "\" with the changes above. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be updated.')]).call(_context5, Boolean).join('\n'),
|
|
816
937
|
initial: 'yes'
|
|
817
938
|
});
|
|
818
939
|
|
|
819
|
-
case
|
|
820
|
-
_yield$prompts3 =
|
|
940
|
+
case 66:
|
|
941
|
+
_yield$prompts3 = _context6.sent;
|
|
821
942
|
confirmation = _yield$prompts3.confirmation;
|
|
822
943
|
|
|
823
944
|
if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
824
|
-
|
|
945
|
+
_context6.next = 71;
|
|
825
946
|
break;
|
|
826
947
|
}
|
|
827
948
|
|
|
828
949
|
console.log(chalk__default["default"].red('Aborted.'));
|
|
829
|
-
return
|
|
950
|
+
return _context6.abrupt("return");
|
|
830
951
|
|
|
831
|
-
case
|
|
952
|
+
case 71:
|
|
832
953
|
data = omit__default["default"](localCustomAppData, ['id']);
|
|
833
954
|
|
|
834
955
|
if (!options.dryRun) {
|
|
835
|
-
|
|
956
|
+
_context6.next = 78;
|
|
836
957
|
break;
|
|
837
958
|
}
|
|
838
959
|
|
|
839
|
-
console.log(
|
|
840
|
-
console.log("The Custom Application ".concat(data.
|
|
841
|
-
console.log(
|
|
842
|
-
|
|
960
|
+
console.log();
|
|
961
|
+
console.log("The following payload would be used to update the Custom Application \"".concat(chalk__default["default"].green(data.entryPointUriPath), "\"."));
|
|
962
|
+
console.log();
|
|
963
|
+
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
964
|
+
return _context6.abrupt("return");
|
|
843
965
|
|
|
844
|
-
case
|
|
845
|
-
|
|
966
|
+
case 78:
|
|
967
|
+
_context6.next = 80;
|
|
846
968
|
return updateCustomApplication({
|
|
847
969
|
mcApiUrl: mcApiUrl,
|
|
848
|
-
token: token,
|
|
849
970
|
organizationId: fetchedCustomApplication.organizationId,
|
|
850
971
|
data: omit__default["default"](localCustomAppData, ['id']),
|
|
851
972
|
applicationId: fetchedCustomApplication.application.id
|
|
852
973
|
});
|
|
853
974
|
|
|
854
|
-
case
|
|
855
|
-
console.log(chalk__default["default"].green("Custom Application updated
|
|
975
|
+
case 80:
|
|
976
|
+
console.log(chalk__default["default"].green("Custom Application updated."));
|
|
977
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
856
978
|
|
|
857
|
-
case
|
|
979
|
+
case 82:
|
|
858
980
|
case "end":
|
|
859
|
-
return
|
|
981
|
+
return _context6.stop();
|
|
860
982
|
}
|
|
861
983
|
}
|
|
862
984
|
}, _callee);
|