@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-4b9aa874.cjs.prod.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-bbd49c17.cjs.prod.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
|
}();
|
|
@@ -633,225 +750,230 @@ function run(_x) {
|
|
|
633
750
|
|
|
634
751
|
function _run() {
|
|
635
752
|
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
|
|
636
|
-
var
|
|
753
|
+
var _context5;
|
|
637
754
|
|
|
638
|
-
var applicationConfig$1, localCustomAppData, mcApiUrl,
|
|
755
|
+
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;
|
|
639
756
|
|
|
640
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(
|
|
757
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context6) {
|
|
641
758
|
while (1) {
|
|
642
|
-
switch (
|
|
759
|
+
switch (_context6.prev = _context6.next) {
|
|
643
760
|
case 0:
|
|
644
761
|
applicationConfig$1 = applicationConfig.processConfig();
|
|
645
762
|
localCustomAppData = applicationConfig$1.data;
|
|
646
763
|
mcApiUrl = applicationConfig$1.env.mcApiUrl;
|
|
647
|
-
|
|
764
|
+
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
765
|
+
console.log();
|
|
766
|
+
isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
648
767
|
|
|
649
|
-
if (
|
|
650
|
-
|
|
768
|
+
if (isSessionValid) {
|
|
769
|
+
_context6.next = 8;
|
|
651
770
|
break;
|
|
652
771
|
}
|
|
653
772
|
|
|
654
|
-
throw new Error("You don't have a valid session
|
|
773
|
+
throw new Error("You don't have a valid session. Please, run the \"mc-scripts login\" command to authenticate yourself.");
|
|
655
774
|
|
|
656
|
-
case
|
|
657
|
-
|
|
775
|
+
case 8:
|
|
776
|
+
_context6.next = 10;
|
|
658
777
|
return fetchCustomApplication({
|
|
659
778
|
mcApiUrl: mcApiUrl,
|
|
660
|
-
token: token,
|
|
661
779
|
entryPointUriPath: localCustomAppData.entryPointUriPath
|
|
662
780
|
});
|
|
663
781
|
|
|
664
|
-
case
|
|
665
|
-
fetchedCustomApplication =
|
|
782
|
+
case 10:
|
|
783
|
+
fetchedCustomApplication = _context6.sent;
|
|
666
784
|
|
|
667
785
|
if (fetchedCustomApplication) {
|
|
668
|
-
|
|
786
|
+
_context6.next = 55;
|
|
669
787
|
break;
|
|
670
788
|
}
|
|
671
789
|
|
|
672
|
-
|
|
790
|
+
_context6.next = 14;
|
|
673
791
|
return fetchUserOrganizations({
|
|
674
|
-
mcApiUrl: mcApiUrl
|
|
675
|
-
token: token
|
|
792
|
+
mcApiUrl: mcApiUrl
|
|
676
793
|
});
|
|
677
794
|
|
|
678
|
-
case
|
|
679
|
-
userOrganizations =
|
|
795
|
+
case 14:
|
|
796
|
+
userOrganizations = _context6.sent;
|
|
680
797
|
|
|
681
798
|
if (!(userOrganizations.total === 0)) {
|
|
682
|
-
|
|
799
|
+
_context6.next = 17;
|
|
683
800
|
break;
|
|
684
801
|
}
|
|
685
802
|
|
|
686
803
|
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.");
|
|
687
804
|
|
|
688
|
-
case
|
|
805
|
+
case 17:
|
|
689
806
|
if (!(userOrganizations.total === 1)) {
|
|
690
|
-
|
|
807
|
+
_context6.next = 23;
|
|
691
808
|
break;
|
|
692
809
|
}
|
|
693
810
|
|
|
694
811
|
_userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
|
|
695
812
|
organizationId = organization.id;
|
|
696
813
|
organizationName = organization.name;
|
|
697
|
-
|
|
814
|
+
_context6.next = 32;
|
|
698
815
|
break;
|
|
699
816
|
|
|
700
|
-
case
|
|
817
|
+
case 23:
|
|
701
818
|
organizationChoices = _mapInstanceProperty__default["default"](_context3 = userOrganizations.results).call(_context3, function (organization) {
|
|
702
819
|
return {
|
|
703
820
|
title: organization.name,
|
|
704
821
|
value: organization.id
|
|
705
822
|
};
|
|
706
823
|
});
|
|
707
|
-
|
|
824
|
+
_context6.next = 26;
|
|
708
825
|
return prompts__default["default"]({
|
|
709
826
|
type: 'select',
|
|
710
827
|
name: 'organizationId',
|
|
711
|
-
message: 'Select Organization',
|
|
828
|
+
message: 'Select an Organization',
|
|
712
829
|
choices: organizationChoices,
|
|
713
830
|
initial: 0
|
|
714
831
|
});
|
|
715
832
|
|
|
716
|
-
case
|
|
717
|
-
_yield$prompts =
|
|
833
|
+
case 26:
|
|
834
|
+
_yield$prompts = _context6.sent;
|
|
718
835
|
selectedOrganizationId = _yield$prompts.organizationId;
|
|
719
836
|
|
|
720
837
|
if (selectedOrganizationId) {
|
|
721
|
-
|
|
838
|
+
_context6.next = 30;
|
|
722
839
|
break;
|
|
723
840
|
}
|
|
724
841
|
|
|
725
842
|
throw new Error("No Organization selected, aborting.");
|
|
726
843
|
|
|
727
|
-
case
|
|
844
|
+
case 30:
|
|
728
845
|
organizationId = selectedOrganizationId;
|
|
729
846
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, function (_ref) {
|
|
730
847
|
var value = _ref.value;
|
|
731
848
|
return value === organizationId;
|
|
732
849
|
}).title;
|
|
733
850
|
|
|
734
|
-
case
|
|
735
|
-
|
|
851
|
+
case 32:
|
|
852
|
+
_context6.next = 34;
|
|
736
853
|
return prompts__default["default"]({
|
|
737
854
|
type: 'text',
|
|
738
855
|
name: 'confirmation',
|
|
739
|
-
message:
|
|
856
|
+
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'),
|
|
740
857
|
initial: 'yes'
|
|
741
858
|
});
|
|
742
859
|
|
|
743
|
-
case
|
|
744
|
-
_yield$prompts2 =
|
|
860
|
+
case 34:
|
|
861
|
+
_yield$prompts2 = _context6.sent;
|
|
745
862
|
_confirmation = _yield$prompts2.confirmation;
|
|
746
863
|
|
|
747
864
|
if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
748
|
-
|
|
865
|
+
_context6.next = 39;
|
|
749
866
|
break;
|
|
750
867
|
}
|
|
751
868
|
|
|
752
869
|
console.log(chalk__default["default"].red('Aborted.'));
|
|
753
|
-
return
|
|
870
|
+
return _context6.abrupt("return");
|
|
754
871
|
|
|
755
|
-
case
|
|
872
|
+
case 39:
|
|
756
873
|
_data = omit__default["default"](localCustomAppData, ['id']);
|
|
757
874
|
|
|
758
875
|
if (!options.dryRun) {
|
|
759
|
-
|
|
876
|
+
_context6.next = 46;
|
|
760
877
|
break;
|
|
761
878
|
}
|
|
762
879
|
|
|
763
|
-
console.log(
|
|
764
|
-
console.log("
|
|
765
|
-
console.log(
|
|
766
|
-
|
|
880
|
+
console.log();
|
|
881
|
+
console.log("The following payload would be used to create a new Custom Application.");
|
|
882
|
+
console.log();
|
|
883
|
+
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](_data, null, 2)));
|
|
884
|
+
return _context6.abrupt("return");
|
|
767
885
|
|
|
768
|
-
case
|
|
769
|
-
|
|
886
|
+
case 46:
|
|
887
|
+
_context6.next = 48;
|
|
770
888
|
return createCustomApplication({
|
|
771
889
|
mcApiUrl: mcApiUrl,
|
|
772
|
-
token: token,
|
|
773
890
|
organizationId: organizationId,
|
|
774
891
|
data: _data
|
|
775
892
|
});
|
|
776
893
|
|
|
777
|
-
case
|
|
778
|
-
createdCustomApplication =
|
|
894
|
+
case 48:
|
|
895
|
+
createdCustomApplication = _context6.sent;
|
|
779
896
|
|
|
780
897
|
if (createdCustomApplication) {
|
|
781
|
-
|
|
898
|
+
_context6.next = 51;
|
|
782
899
|
break;
|
|
783
900
|
}
|
|
784
901
|
|
|
785
902
|
throw new Error('Failed to create the Custom Application.');
|
|
786
903
|
|
|
787
|
-
case
|
|
904
|
+
case 51:
|
|
788
905
|
_customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
|
|
789
|
-
console.log(chalk__default["default"].green(
|
|
790
|
-
|
|
906
|
+
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), "\".")));
|
|
907
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(_customAppLink), "\"."));
|
|
908
|
+
return _context6.abrupt("return");
|
|
791
909
|
|
|
792
|
-
case
|
|
910
|
+
case 55:
|
|
793
911
|
customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
|
|
794
912
|
configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
|
|
795
913
|
|
|
796
914
|
if (configDiff) {
|
|
797
|
-
|
|
915
|
+
_context6.next = 61;
|
|
798
916
|
break;
|
|
799
917
|
}
|
|
800
918
|
|
|
801
|
-
console.log(chalk__default["default"].green("Custom Application
|
|
802
|
-
|
|
919
|
+
console.log(chalk__default["default"].green("Custom Application up-to-date."));
|
|
920
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
921
|
+
return _context6.abrupt("return");
|
|
803
922
|
|
|
804
|
-
case
|
|
923
|
+
case 61:
|
|
924
|
+
console.log('Changes detected:');
|
|
805
925
|
console.log(configDiff);
|
|
806
|
-
|
|
926
|
+
console.log();
|
|
927
|
+
_context6.next = 66;
|
|
807
928
|
return prompts__default["default"]({
|
|
808
929
|
type: 'text',
|
|
809
930
|
name: 'confirmation',
|
|
810
|
-
message:
|
|
931
|
+
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'),
|
|
811
932
|
initial: 'yes'
|
|
812
933
|
});
|
|
813
934
|
|
|
814
|
-
case
|
|
815
|
-
_yield$prompts3 =
|
|
935
|
+
case 66:
|
|
936
|
+
_yield$prompts3 = _context6.sent;
|
|
816
937
|
confirmation = _yield$prompts3.confirmation;
|
|
817
938
|
|
|
818
939
|
if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
819
|
-
|
|
940
|
+
_context6.next = 71;
|
|
820
941
|
break;
|
|
821
942
|
}
|
|
822
943
|
|
|
823
944
|
console.log(chalk__default["default"].red('Aborted.'));
|
|
824
|
-
return
|
|
945
|
+
return _context6.abrupt("return");
|
|
825
946
|
|
|
826
|
-
case
|
|
947
|
+
case 71:
|
|
827
948
|
data = omit__default["default"](localCustomAppData, ['id']);
|
|
828
949
|
|
|
829
950
|
if (!options.dryRun) {
|
|
830
|
-
|
|
951
|
+
_context6.next = 78;
|
|
831
952
|
break;
|
|
832
953
|
}
|
|
833
954
|
|
|
834
|
-
console.log(
|
|
835
|
-
console.log("The Custom Application ".concat(data.
|
|
836
|
-
console.log(
|
|
837
|
-
|
|
955
|
+
console.log();
|
|
956
|
+
console.log("The following payload would be used to update the Custom Application \"".concat(chalk__default["default"].green(data.entryPointUriPath), "\"."));
|
|
957
|
+
console.log();
|
|
958
|
+
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
959
|
+
return _context6.abrupt("return");
|
|
838
960
|
|
|
839
|
-
case
|
|
840
|
-
|
|
961
|
+
case 78:
|
|
962
|
+
_context6.next = 80;
|
|
841
963
|
return updateCustomApplication({
|
|
842
964
|
mcApiUrl: mcApiUrl,
|
|
843
|
-
token: token,
|
|
844
965
|
organizationId: fetchedCustomApplication.organizationId,
|
|
845
966
|
data: omit__default["default"](localCustomAppData, ['id']),
|
|
846
967
|
applicationId: fetchedCustomApplication.application.id
|
|
847
968
|
});
|
|
848
969
|
|
|
849
|
-
case
|
|
850
|
-
console.log(chalk__default["default"].green("Custom Application updated
|
|
970
|
+
case 80:
|
|
971
|
+
console.log(chalk__default["default"].green("Custom Application updated."));
|
|
972
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
851
973
|
|
|
852
|
-
case
|
|
974
|
+
case 82:
|
|
853
975
|
case "end":
|
|
854
|
-
return
|
|
976
|
+
return _context6.stop();
|
|
855
977
|
}
|
|
856
978
|
}
|
|
857
979
|
}, _callee);
|