@commercetools-frontend/mc-scripts 21.23.10 → 21.24.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/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +116 -321
- package/dist/build-980cf2c9.cjs.prod.js +170 -0
- package/dist/build-c9601b07.esm.js +156 -0
- package/dist/build-e8a49b56.cjs.dev.js +170 -0
- package/dist/build-vite-b531d3d3.esm.js +118 -0
- package/dist/build-vite-c40a55c3.cjs.dev.js +129 -0
- package/dist/build-vite-d17432ec.cjs.prod.js +129 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
- package/dist/compile-html-41195e35.cjs.dev.js +49 -0
- package/dist/compile-html-5abd78aa.cjs.prod.js +49 -0
- package/dist/compile-html-f9de842c.esm.js +40 -0
- package/dist/config-sync-0ecc13b3.cjs.dev.js +783 -0
- package/dist/config-sync-4b1ddec3.esm.js +759 -0
- package/dist/config-sync-bb59a82d.cjs.prod.js +778 -0
- package/dist/{create-postcss-config-f65c7e31.cjs.dev.js → create-postcss-config-5cc679d5.cjs.dev.js} +9 -14
- package/dist/{create-postcss-config-06b2e5c2.esm.js → create-postcss-config-a0d4cffa.esm.js} +9 -13
- package/dist/{create-postcss-config-787d905f.cjs.prod.js → create-postcss-config-f94c07fd.cjs.prod.js} +9 -14
- package/dist/{create-webpack-config-for-development-fd365d6a.esm.js → create-webpack-config-for-development-95334073.esm.js} +21 -25
- package/dist/{create-webpack-config-for-development-d46ef148.cjs.dev.js → create-webpack-config-for-development-a53bab71.cjs.dev.js} +24 -28
- package/dist/{create-webpack-config-for-development-59faaed8.cjs.prod.js → create-webpack-config-for-development-c915ec0c.cjs.prod.js} +24 -28
- package/dist/{create-webpack-config-for-production-b28b3d33.esm.js → create-webpack-config-for-production-342485cd.esm.js} +18 -21
- package/dist/{create-webpack-config-for-production-1af3a454.cjs.prod.js → create-webpack-config-for-production-af6f3138.cjs.prod.js} +20 -23
- package/dist/{create-webpack-config-for-production-e12e3c30.cjs.dev.js → create-webpack-config-for-production-db45d9ab.cjs.dev.js} +20 -23
- package/dist/{user-agent-9a470e39.cjs.dev.js → credentials-storage-a37a8915.cjs.dev.js} +24 -24
- package/dist/{user-agent-6e8d0e0b.cjs.prod.js → credentials-storage-b803a804.cjs.prod.js} +24 -24
- package/dist/{user-agent-4b60934e.esm.js → credentials-storage-cb88e8fc.esm.js} +22 -22
- package/dist/declarations/src/deprecated-entry-points.d.ts +1 -1
- package/dist/login-35040a86.cjs.dev.js +93 -0
- package/dist/login-6e17747d.esm.js +84 -0
- package/dist/login-90736d7e.cjs.prod.js +93 -0
- package/dist/{package-a5454c97.esm.js → package-17f18481.esm.js} +17 -16
- package/dist/{package-e2d9b5e0.cjs.dev.js → package-c42dc2ac.cjs.dev.js} +17 -16
- package/dist/{package-808a31f1.cjs.prod.js → package-db15171f.cjs.prod.js} +17 -16
- package/dist/{paths-76b66e74.cjs.prod.js → paths-284c77fb.cjs.prod.js} +6 -8
- package/dist/{paths-ed23d5a1.esm.js → paths-55c5d5a2.esm.js} +6 -8
- package/dist/{paths-16823f56.cjs.dev.js → paths-db35ac0f.cjs.dev.js} +6 -8
- package/dist/serve-41077dad.cjs.prod.js +48 -0
- package/dist/serve-660e2ee0.esm.js +41 -0
- package/dist/serve-b8063204.cjs.dev.js +48 -0
- package/dist/start-0aa71e9a.esm.js +166 -0
- package/dist/start-2e7ec87c.cjs.dev.js +180 -0
- package/dist/start-c0ffe8d7.cjs.prod.js +180 -0
- package/dist/start-vite-324af14d.cjs.prod.js +119 -0
- package/dist/start-vite-7d10ae71.esm.js +107 -0
- package/dist/start-vite-8f03b0df.cjs.dev.js +119 -0
- package/dist/{vendors-to-transpile-367e0ba8.cjs.prod.js → vendors-to-transpile-04a49d40.cjs.prod.js} +1 -1
- package/dist/{vendors-to-transpile-b51af5d3.cjs.dev.js → vendors-to-transpile-6ab4ea06.cjs.dev.js} +1 -1
- package/dist/{vendors-to-transpile-68e03526.esm.js → vendors-to-transpile-7dc84a72.esm.js} +1 -1
- package/dist/vite-plugin-svgr-9a4e7f77.cjs.prod.js +79 -0
- package/dist/vite-plugin-svgr-f17db78a.esm.js +55 -0
- package/dist/vite-plugin-svgr-fdb37ccf.cjs.dev.js +79 -0
- package/package.json +17 -16
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +12 -13
- package/dist/build-0e6d74d1.esm.js +0 -209
- package/dist/build-9074fc85.cjs.dev.js +0 -224
- package/dist/build-ae132901.cjs.prod.js +0 -224
- package/dist/build-vite-482a21b8.cjs.dev.js +0 -151
- package/dist/build-vite-cc68e3bf.esm.js +0 -139
- package/dist/build-vite-f095b68d.cjs.prod.js +0 -151
- package/dist/compile-html-4361a0b3.esm.js +0 -77
- package/dist/compile-html-d6331c35.cjs.prod.js +0 -87
- package/dist/compile-html-d9e731aa.cjs.dev.js +0 -87
- package/dist/config-sync-2a9945bc.cjs.dev.js +0 -989
- package/dist/config-sync-43a80f60.cjs.prod.js +0 -984
- package/dist/config-sync-c6c4d1cf.esm.js +0 -964
- package/dist/login-7f1cc8d0.cjs.prod.js +0 -167
- package/dist/login-d21a49e8.esm.js +0 -157
- package/dist/login-ed827138.cjs.dev.js +0 -167
- package/dist/serve-12de323b.cjs.dev.js +0 -70
- package/dist/serve-784f4fcd.cjs.prod.js +0 -70
- package/dist/serve-d6b437b1.esm.js +0 -62
- package/dist/start-10a4d95a.esm.js +0 -194
- package/dist/start-d021fa98.cjs.prod.js +0 -209
- package/dist/start-eea524f2.cjs.dev.js +0 -209
- package/dist/start-vite-57ec5175.cjs.dev.js +0 -146
- package/dist/start-vite-94c2db8c.esm.js +0 -133
- package/dist/start-vite-fc0b15d3.cjs.prod.js +0 -146
- package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +0 -110
- package/dist/vite-plugin-svgr-eb8524fa.esm.js +0 -85
- package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +0 -110
|
@@ -1,984 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
5
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
6
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
7
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
8
|
-
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
-
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
10
|
-
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
11
|
-
var omit = require('lodash/omit');
|
|
12
|
-
var prompts = require('prompts');
|
|
13
|
-
var chalk = require('chalk');
|
|
14
|
-
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
|
-
var userAgent = require('./user-agent-6e8d0e0b.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');
|
|
19
|
-
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
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');
|
|
22
|
-
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
23
|
-
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
24
|
-
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
25
|
-
var graphql = require('graphql');
|
|
26
|
-
var graphqlRequest = require('graphql-request');
|
|
27
|
-
var constants = require('@commercetools-frontend/constants');
|
|
28
|
-
var _repeatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/repeat');
|
|
29
|
-
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
30
|
-
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
31
|
-
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
32
|
-
require('@babel/runtime-corejs3/helpers/createClass');
|
|
33
|
-
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
34
|
-
require('fs');
|
|
35
|
-
require('path');
|
|
36
|
-
require('os');
|
|
37
|
-
require('@commercetools/http-user-agent');
|
|
38
|
-
require('./package-808a31f1.cjs.prod.js');
|
|
39
|
-
|
|
40
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
41
|
-
|
|
42
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
43
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
44
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
45
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
46
|
-
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
47
|
-
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
48
|
-
var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
49
|
-
var prompts__default = /*#__PURE__*/_interopDefault(prompts);
|
|
50
|
-
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
51
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
52
|
-
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
53
|
-
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
54
|
-
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
55
|
-
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
|
-
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
57
|
-
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
58
|
-
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
59
|
-
var _repeatInstanceProperty__default = /*#__PURE__*/_interopDefault(_repeatInstanceProperty);
|
|
60
|
-
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
61
|
-
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
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; }
|
|
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 } } } };
|
|
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 } } } };
|
|
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 } } } };
|
|
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
|
-
});
|
|
79
|
-
|
|
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
|
-
}
|
|
174
|
-
|
|
175
|
-
var fetchCustomApplication = /*#__PURE__*/function () {
|
|
176
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(_ref) {
|
|
177
|
-
var mcApiUrl, entryPointUriPath, customAppData;
|
|
178
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
179
|
-
while (1) {
|
|
180
|
-
switch (_context.prev = _context.next) {
|
|
181
|
-
case 0:
|
|
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:
|
|
195
|
-
customAppData = _context.sent;
|
|
196
|
-
return _context.abrupt("return", customAppData.organizationExtensionForCustomApplication);
|
|
197
|
-
|
|
198
|
-
case 5:
|
|
199
|
-
case "end":
|
|
200
|
-
return _context.stop();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}, _callee);
|
|
204
|
-
}));
|
|
205
|
-
|
|
206
|
-
return function fetchCustomApplication(_x3) {
|
|
207
|
-
return _ref2.apply(this, arguments);
|
|
208
|
-
};
|
|
209
|
-
}();
|
|
210
|
-
|
|
211
|
-
var updateCustomApplication = /*#__PURE__*/function () {
|
|
212
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref3) {
|
|
213
|
-
var mcApiUrl, applicationId, organizationId, data, updatedCustomAppsData;
|
|
214
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
215
|
-
while (1) {
|
|
216
|
-
switch (_context2.prev = _context2.next) {
|
|
217
|
-
case 0:
|
|
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
|
-
});
|
|
231
|
-
|
|
232
|
-
case 3:
|
|
233
|
-
updatedCustomAppsData = _context2.sent;
|
|
234
|
-
return _context2.abrupt("return", updatedCustomAppsData.updateCustomApplication);
|
|
235
|
-
|
|
236
|
-
case 5:
|
|
237
|
-
case "end":
|
|
238
|
-
return _context2.stop();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}, _callee2);
|
|
242
|
-
}));
|
|
243
|
-
|
|
244
|
-
return function updateCustomApplication(_x4) {
|
|
245
|
-
return _ref4.apply(this, arguments);
|
|
246
|
-
};
|
|
247
|
-
}();
|
|
248
|
-
|
|
249
|
-
var createCustomApplication = /*#__PURE__*/function () {
|
|
250
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref5) {
|
|
251
|
-
var mcApiUrl, organizationId, data, createdCustomAppData;
|
|
252
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
253
|
-
while (1) {
|
|
254
|
-
switch (_context3.prev = _context3.next) {
|
|
255
|
-
case 0:
|
|
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
|
-
});
|
|
268
|
-
|
|
269
|
-
case 3:
|
|
270
|
-
createdCustomAppData = _context3.sent;
|
|
271
|
-
return _context3.abrupt("return", createdCustomAppData.createCustomApplication);
|
|
272
|
-
|
|
273
|
-
case 5:
|
|
274
|
-
case "end":
|
|
275
|
-
return _context3.stop();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}, _callee3);
|
|
279
|
-
}));
|
|
280
|
-
|
|
281
|
-
return function createCustomApplication(_x5) {
|
|
282
|
-
return _ref6.apply(this, arguments);
|
|
283
|
-
};
|
|
284
|
-
}();
|
|
285
|
-
|
|
286
|
-
var fetchUserOrganizations = /*#__PURE__*/function () {
|
|
287
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
|
|
288
|
-
var mcApiUrl, userOrganizations;
|
|
289
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
|
|
290
|
-
while (1) {
|
|
291
|
-
switch (_context4.prev = _context4.next) {
|
|
292
|
-
case 0:
|
|
293
|
-
mcApiUrl = _ref7.mcApiUrl;
|
|
294
|
-
_context4.next = 3;
|
|
295
|
-
return requestWithTokenRetry(FetchMyOrganizationsFromCli, {
|
|
296
|
-
mcApiUrl: mcApiUrl,
|
|
297
|
-
headers: {
|
|
298
|
-
'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
case 3:
|
|
303
|
-
userOrganizations = _context4.sent;
|
|
304
|
-
return _context4.abrupt("return", userOrganizations.myOrganizations);
|
|
305
|
-
|
|
306
|
-
case 5:
|
|
307
|
-
case "end":
|
|
308
|
-
return _context4.stop();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}, _callee4);
|
|
312
|
-
}));
|
|
313
|
-
|
|
314
|
-
return function fetchUserOrganizations(_x6) {
|
|
315
|
-
return _ref8.apply(this, arguments);
|
|
316
|
-
};
|
|
317
|
-
}();
|
|
318
|
-
|
|
319
|
-
function ownKeys(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; }
|
|
320
|
-
|
|
321
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context20, _context21; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context20 = ownKeys(Object(source), !0)).call(_context20, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context21 = ownKeys(Object(source))).call(_context21, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
322
|
-
|
|
323
|
-
var red = function red(str) {
|
|
324
|
-
return chalk__default["default"].red(str);
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
var green = function green(str) {
|
|
328
|
-
return chalk__default["default"].green(str);
|
|
329
|
-
}; // Two spaces are used for indentation.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var indent = function indent(indentLevel) {
|
|
333
|
-
var _context;
|
|
334
|
-
|
|
335
|
-
return _repeatInstanceProperty__default["default"](_context = ' ').call(_context, indentLevel);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
var getStringDiff = function getStringDiff(_ref) {
|
|
339
|
-
var previousValue = _ref.previousValue,
|
|
340
|
-
nextValue = _ref.nextValue,
|
|
341
|
-
label = _ref.label,
|
|
342
|
-
_ref$indentLevel = _ref.indentLevel,
|
|
343
|
-
indentLevel = _ref$indentLevel === void 0 ? 0 : _ref$indentLevel;
|
|
344
|
-
|
|
345
|
-
if (!previousValue && nextValue) {
|
|
346
|
-
var _context2, _context3;
|
|
347
|
-
|
|
348
|
-
return _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(indent(indentLevel))).call(_context3, label, " added: ")).call(_context2, green(nextValue));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (previousValue && !nextValue) {
|
|
352
|
-
var _context4, _context5;
|
|
353
|
-
|
|
354
|
-
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(indent(indentLevel))).call(_context5, label, " removed: ")).call(_context4, red(previousValue));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (previousValue && nextValue && previousValue !== nextValue) {
|
|
358
|
-
var _context6, _context7, _context8;
|
|
359
|
-
|
|
360
|
-
return _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = "".concat(indent(indentLevel))).call(_context8, label, " changed: ")).call(_context7, red(previousValue), " => ")).call(_context6, green(nextValue));
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return null;
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// NOTE: this assumes that the array values are scalar values (not objects).
|
|
367
|
-
var getArrayDiff = function getArrayDiff(_ref2) {
|
|
368
|
-
var previousValue = _ref2.previousValue,
|
|
369
|
-
nextValue = _ref2.nextValue,
|
|
370
|
-
label = _ref2.label,
|
|
371
|
-
_ref2$indentLevel = _ref2.indentLevel,
|
|
372
|
-
indentLevel = _ref2$indentLevel === void 0 ? 0 : _ref2$indentLevel;
|
|
373
|
-
var oldArraySet = new _Set__default["default"](previousValue);
|
|
374
|
-
var arrayDiff = [];
|
|
375
|
-
nextValue === null || nextValue === void 0 ? void 0 : _forEachInstanceProperty__default["default"](nextValue).call(nextValue, function (item) {
|
|
376
|
-
if (oldArraySet.has(item)) {
|
|
377
|
-
oldArraySet.delete(item);
|
|
378
|
-
} else {
|
|
379
|
-
arrayDiff.push(getStringDiff({
|
|
380
|
-
nextValue: item,
|
|
381
|
-
label: label,
|
|
382
|
-
indentLevel: indentLevel
|
|
383
|
-
}));
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
_forEachInstanceProperty__default["default"](oldArraySet).call(oldArraySet, function (item) {
|
|
388
|
-
arrayDiff.push(getStringDiff({
|
|
389
|
-
previousValue: item,
|
|
390
|
-
label: label,
|
|
391
|
-
indentLevel: indentLevel
|
|
392
|
-
}));
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
return arrayDiff.join('\n');
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
var getPermissionsDiff = function getPermissionsDiff(_ref3) {
|
|
399
|
-
var _context11;
|
|
400
|
-
|
|
401
|
-
var previousValue = _ref3.previousValue,
|
|
402
|
-
nextValue = _ref3.nextValue;
|
|
403
|
-
var permissionDiff = ['permissions changed'];
|
|
404
|
-
|
|
405
|
-
var mappedOldPermissions = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, function (previousPermission, _ref4) {
|
|
406
|
-
var name = _ref4.name,
|
|
407
|
-
oAuthScopes = _ref4.oAuthScopes;
|
|
408
|
-
return _objectSpread(_objectSpread({}, previousPermission), {}, _defineProperty({}, name, oAuthScopes));
|
|
409
|
-
}, {});
|
|
410
|
-
|
|
411
|
-
var indentLevel = 1;
|
|
412
|
-
|
|
413
|
-
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, function (newPermission) {
|
|
414
|
-
var _context9;
|
|
415
|
-
|
|
416
|
-
var currentDiff = [_concatInstanceProperty__default["default"](_context9 = "".concat(indent(indentLevel), "\"")).call(_context9, newPermission.name, "\" changed")]; // if the permission name is not in the old config, it means it is a new addition.
|
|
417
|
-
|
|
418
|
-
if (!mappedOldPermissions[newPermission.name]) {
|
|
419
|
-
var _context10;
|
|
420
|
-
|
|
421
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context10 = "".concat(indent(indentLevel), "\"")).call(_context10, green(newPermission.name), "\" was added"));
|
|
422
|
-
} // if permission name is in the old config, now we check if there was a change
|
|
423
|
-
else {
|
|
424
|
-
currentDiff.push(getArrayDiff({
|
|
425
|
-
previousValue: mappedOldPermissions[newPermission.name],
|
|
426
|
-
nextValue: newPermission.oAuthScopes,
|
|
427
|
-
label: 'oauth scope',
|
|
428
|
-
indentLevel: 2
|
|
429
|
-
}));
|
|
430
|
-
delete mappedOldPermissions[newPermission.name];
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
_filterInstanceProperty__default["default"](currentDiff).call(currentDiff, Boolean).length > 1 && permissionDiff.push(currentDiff.join('\n'));
|
|
434
|
-
}); // if there are old permissions left, it means they were deleted in the new Permissions.
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
_forEachInstanceProperty__default["default"](_context11 = _Object$keys__default["default"](mappedOldPermissions)).call(_context11, function (oldPermissionName) {
|
|
438
|
-
var _context12;
|
|
439
|
-
|
|
440
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context12 = "".concat(indent(indentLevel), "\"")).call(_context12, red(oldPermissionName), "\" was removed"));
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
if (permissionDiff.length > 1) return permissionDiff.join('\n');
|
|
444
|
-
return null;
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
var getLabelAllLocalesDiff = function getLabelAllLocalesDiff(_ref5) {
|
|
448
|
-
var _context16;
|
|
449
|
-
|
|
450
|
-
var _ref5$previousValue = _ref5.previousValue,
|
|
451
|
-
previousValue = _ref5$previousValue === void 0 ? [] : _ref5$previousValue,
|
|
452
|
-
_ref5$nextValue = _ref5.nextValue,
|
|
453
|
-
nextValue = _ref5$nextValue === void 0 ? [] : _ref5$nextValue,
|
|
454
|
-
_ref5$indentLevel = _ref5.indentLevel,
|
|
455
|
-
indentLevel = _ref5$indentLevel === void 0 ? 0 : _ref5$indentLevel;
|
|
456
|
-
var labelAllLocalesDiff = ["".concat(indent(indentLevel - 1), "labelAllLocales changed")];
|
|
457
|
-
|
|
458
|
-
var mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, function (previousLabelAllLocale, _ref6) {
|
|
459
|
-
var locale = _ref6.locale,
|
|
460
|
-
value = _ref6.value;
|
|
461
|
-
return _objectSpread(_objectSpread({}, previousLabelAllLocale), {}, _defineProperty({}, locale, value));
|
|
462
|
-
}, {});
|
|
463
|
-
|
|
464
|
-
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, function (newLabelAllLocale) {
|
|
465
|
-
if (newLabelAllLocale.locale in mappedOldLabelAllLocales) {
|
|
466
|
-
var oldLocaleValue = mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
467
|
-
|
|
468
|
-
if (oldLocaleValue !== newLabelAllLocale.value) {
|
|
469
|
-
var _context13, _context14, _context15;
|
|
470
|
-
|
|
471
|
-
labelAllLocalesDiff.push(_concatInstanceProperty__default["default"](_context13 = _concatInstanceProperty__default["default"](_context14 = _concatInstanceProperty__default["default"](_context15 = "".concat(indent(indentLevel), "locale \"")).call(_context15, newLabelAllLocale.locale, "\" changed: ")).call(_context14, red(oldLocaleValue), " => ")).call(_context13, green(newLabelAllLocale.value)));
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
delete mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
475
|
-
} else {
|
|
476
|
-
var localeDiff = getStringDiff({
|
|
477
|
-
nextValue: newLabelAllLocale.locale,
|
|
478
|
-
label: 'locale',
|
|
479
|
-
indentLevel: indentLevel
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
if (localeDiff) {
|
|
483
|
-
labelAllLocalesDiff.push(localeDiff);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
_forEachInstanceProperty__default["default"](_context16 = _Object$keys__default["default"](mappedOldLabelAllLocales)).call(_context16, function (key) {
|
|
489
|
-
var localeDiff = getStringDiff({
|
|
490
|
-
previousValue: key,
|
|
491
|
-
label: 'locale',
|
|
492
|
-
indentLevel: indentLevel
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
if (localeDiff) {
|
|
496
|
-
labelAllLocalesDiff.push(localeDiff);
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
if (labelAllLocalesDiff.length > 1) return labelAllLocalesDiff.join('\n');
|
|
501
|
-
return null;
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
var getMainMenuLinkDiff = function getMainMenuLinkDiff(_ref7) {
|
|
505
|
-
var previousValue = _ref7.previousValue,
|
|
506
|
-
nextValue = _ref7.nextValue;
|
|
507
|
-
var mainMenuLinkDiff = ['mainMenuLink changed'];
|
|
508
|
-
var menuDiff = getStringDiff({
|
|
509
|
-
previousValue: previousValue.defaultLabel,
|
|
510
|
-
nextValue: nextValue.defaultLabel,
|
|
511
|
-
label: 'defaultLabel',
|
|
512
|
-
indentLevel: 1
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
if (menuDiff) {
|
|
516
|
-
mainMenuLinkDiff.push(menuDiff);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
var mainMenuLinkPermissionsDiff = getArrayDiff({
|
|
520
|
-
previousValue: previousValue.permissions,
|
|
521
|
-
nextValue: nextValue.permissions,
|
|
522
|
-
label: 'applied permission',
|
|
523
|
-
indentLevel: 2
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
if (mainMenuLinkPermissionsDiff.length > 0) {
|
|
527
|
-
mainMenuLinkDiff.push("".concat(indent(1), "permissions changed"));
|
|
528
|
-
mainMenuLinkDiff.push(mainMenuLinkPermissionsDiff);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
var menuLabelsDiff = getLabelAllLocalesDiff({
|
|
532
|
-
previousValue: previousValue.labelAllLocales,
|
|
533
|
-
nextValue: nextValue.labelAllLocales,
|
|
534
|
-
indentLevel: 2
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
if (menuLabelsDiff) {
|
|
538
|
-
mainMenuLinkDiff.push(menuLabelsDiff);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
var filteredMainMenuLinkDiff = _filterInstanceProperty__default["default"](mainMenuLinkDiff).call(mainMenuLinkDiff, Boolean);
|
|
542
|
-
|
|
543
|
-
if (filteredMainMenuLinkDiff.length > 1) return filteredMainMenuLinkDiff.join('\n');
|
|
544
|
-
return null;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
var getSubmenuLinksDiff = function getSubmenuLinksDiff(_ref8) {
|
|
548
|
-
var _context19;
|
|
549
|
-
|
|
550
|
-
var previousValue = _ref8.previousValue,
|
|
551
|
-
nextValue = _ref8.nextValue;
|
|
552
|
-
var submenuLinksDiff = ['submenuLink changed'];
|
|
553
|
-
|
|
554
|
-
var mappedSubmenuLinks = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, function (previousSubmenuLink, currentSubmenuLink) {
|
|
555
|
-
return _objectSpread(_objectSpread({}, previousSubmenuLink), {}, _defineProperty({}, currentSubmenuLink.uriPath, currentSubmenuLink));
|
|
556
|
-
}, {});
|
|
557
|
-
|
|
558
|
-
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, function (newSubmenuLink) {
|
|
559
|
-
var oldSubMenuLink = mappedSubmenuLinks[newSubmenuLink.uriPath];
|
|
560
|
-
|
|
561
|
-
if (newSubmenuLink.uriPath in mappedSubmenuLinks) {
|
|
562
|
-
var _context17, _context18;
|
|
563
|
-
|
|
564
|
-
var submenuLinkDiff = [_concatInstanceProperty__default["default"](_context17 = "".concat(indent(1), "menu link \"")).call(_context17, newSubmenuLink.uriPath, "\" changed")];
|
|
565
|
-
|
|
566
|
-
_forEachInstanceProperty__default["default"](_context18 = _Object$keys__default["default"](mappedSubmenuLinks[newSubmenuLink.uriPath])).call(_context18, function (key) {
|
|
567
|
-
switch (key) {
|
|
568
|
-
case 'defaultLabel':
|
|
569
|
-
{
|
|
570
|
-
var labelDiff = getStringDiff({
|
|
571
|
-
previousValue: oldSubMenuLink.defaultLabel,
|
|
572
|
-
nextValue: newSubmenuLink.defaultLabel,
|
|
573
|
-
label: 'defaultLabel',
|
|
574
|
-
indentLevel: 2
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
if (labelDiff) {
|
|
578
|
-
submenuLinkDiff.push(labelDiff);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
case 'permissions':
|
|
585
|
-
{
|
|
586
|
-
var submenuLinkPermissionsDiff = getArrayDiff({
|
|
587
|
-
previousValue: oldSubMenuLink.permissions,
|
|
588
|
-
nextValue: newSubmenuLink.permissions,
|
|
589
|
-
label: 'applied permission',
|
|
590
|
-
indentLevel: 3
|
|
591
|
-
});
|
|
592
|
-
|
|
593
|
-
if (submenuLinkPermissionsDiff.length > 0) {
|
|
594
|
-
submenuLinkDiff.push("".concat(indent(2), "permissions changed"));
|
|
595
|
-
submenuLinkDiff.push(submenuLinkPermissionsDiff);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
break;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
case 'labelAllLocales':
|
|
602
|
-
{
|
|
603
|
-
var labelsDiff = getLabelAllLocalesDiff({
|
|
604
|
-
previousValue: oldSubMenuLink.labelAllLocales,
|
|
605
|
-
nextValue: newSubmenuLink.labelAllLocales,
|
|
606
|
-
indentLevel: 3
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
if (labelsDiff) {
|
|
610
|
-
submenuLinkDiff.push(labelsDiff);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
break;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
delete mappedSubmenuLinks[newSubmenuLink.uriPath];
|
|
619
|
-
|
|
620
|
-
var filteredSubmenuLinksDiff = _filterInstanceProperty__default["default"](submenuLinkDiff).call(submenuLinkDiff, Boolean);
|
|
621
|
-
|
|
622
|
-
if (filteredSubmenuLinksDiff.length > 1) {
|
|
623
|
-
submenuLinksDiff.push(filteredSubmenuLinksDiff.join('\n'));
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
var linksDiff = getStringDiff({
|
|
627
|
-
nextValue: newSubmenuLink.uriPath,
|
|
628
|
-
label: 'menu link',
|
|
629
|
-
indentLevel: 1
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
if (linksDiff) {
|
|
633
|
-
submenuLinksDiff.push(linksDiff);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
_forEachInstanceProperty__default["default"](_context19 = _Object$keys__default["default"](mappedSubmenuLinks)).call(_context19, function (key) {
|
|
639
|
-
var linksDiff = getStringDiff({
|
|
640
|
-
previousValue: key,
|
|
641
|
-
label: 'menu link',
|
|
642
|
-
indentLevel: 1
|
|
643
|
-
});
|
|
644
|
-
if (linksDiff) submenuLinksDiff.push(linksDiff);
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
if (submenuLinksDiff.length > 1) return submenuLinksDiff.join('\n');
|
|
648
|
-
return null;
|
|
649
|
-
}; // Compute diff changes of the Custom Application config.
|
|
650
|
-
// NOTE: Only known keys are evaluated.
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
var getConfigDiff = function getConfigDiff(oldConfig, newConfig) {
|
|
654
|
-
var diff = []; // Name
|
|
655
|
-
|
|
656
|
-
var nameDiff = getStringDiff({
|
|
657
|
-
previousValue: oldConfig.name,
|
|
658
|
-
nextValue: newConfig.name,
|
|
659
|
-
label: 'name'
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
if (nameDiff) {
|
|
663
|
-
diff.push(nameDiff);
|
|
664
|
-
} // Description
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
var descriptionDiff = getStringDiff({
|
|
668
|
-
previousValue: oldConfig.description,
|
|
669
|
-
nextValue: newConfig.description,
|
|
670
|
-
label: 'description'
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
if (descriptionDiff) {
|
|
674
|
-
diff.push(descriptionDiff);
|
|
675
|
-
} // URL
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
var urlDiff = getStringDiff({
|
|
679
|
-
previousValue: oldConfig.url,
|
|
680
|
-
nextValue: newConfig.url,
|
|
681
|
-
label: 'url'
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
if (urlDiff) {
|
|
685
|
-
diff.push(urlDiff);
|
|
686
|
-
} // Icon
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
var iconDiff = getStringDiff({
|
|
690
|
-
// This icon stored in the database has already been sanitized.
|
|
691
|
-
previousValue: oldConfig.icon,
|
|
692
|
-
// Sanitize the raw icon as-if it was stored in the database,
|
|
693
|
-
// to ensure the data can be safely compared.
|
|
694
|
-
nextValue: applicationConfig.sanitizeSvg(newConfig.icon),
|
|
695
|
-
label: 'icon'
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
if (iconDiff) {
|
|
699
|
-
diff.push(iconDiff);
|
|
700
|
-
} // Permissions
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
var permissionsDiff = getPermissionsDiff({
|
|
704
|
-
previousValue: oldConfig.permissions,
|
|
705
|
-
nextValue: newConfig.permissions
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
if (permissionsDiff) {
|
|
709
|
-
diff.push(permissionsDiff);
|
|
710
|
-
} // Main menu link
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
var mainMenuDiff = getMainMenuLinkDiff({
|
|
714
|
-
previousValue: oldConfig.mainMenuLink,
|
|
715
|
-
nextValue: newConfig.mainMenuLink
|
|
716
|
-
});
|
|
717
|
-
|
|
718
|
-
if (mainMenuDiff) {
|
|
719
|
-
diff.push(mainMenuDiff);
|
|
720
|
-
} // Submenu links
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
var submenuDiff = getSubmenuLinksDiff({
|
|
724
|
-
previousValue: oldConfig.submenuLinks,
|
|
725
|
-
nextValue: newConfig.submenuLinks
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
if (submenuDiff) {
|
|
729
|
-
diff.push(submenuDiff);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
return diff.join('\n');
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
var credentialsStorage = new userAgent.CredentialsStorage();
|
|
736
|
-
|
|
737
|
-
var getMcUrlLink = function getMcUrlLink(mcApiUrl, organizationId, applicationId) {
|
|
738
|
-
var _context, _context2;
|
|
739
|
-
|
|
740
|
-
var mcUrl = mcApiUrl.replace('mc-api', 'mc');
|
|
741
|
-
|
|
742
|
-
var customAppLink = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "".concat(mcUrl, "/account/organizations/")).call(_context2, organizationId, "/custom-applications/owned/")).call(_context, applicationId);
|
|
743
|
-
|
|
744
|
-
return customAppLink;
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
function run(_x) {
|
|
748
|
-
return _run.apply(this, arguments);
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function _run() {
|
|
752
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
|
|
753
|
-
var _context5;
|
|
754
|
-
|
|
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;
|
|
756
|
-
|
|
757
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context6) {
|
|
758
|
-
while (1) {
|
|
759
|
-
switch (_context6.prev = _context6.next) {
|
|
760
|
-
case 0:
|
|
761
|
-
applicationConfig$1 = applicationConfig.processConfig();
|
|
762
|
-
localCustomAppData = applicationConfig$1.data;
|
|
763
|
-
mcApiUrl = applicationConfig$1.env.mcApiUrl;
|
|
764
|
-
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
765
|
-
console.log();
|
|
766
|
-
isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
767
|
-
|
|
768
|
-
if (isSessionValid) {
|
|
769
|
-
_context6.next = 8;
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
throw new Error("You don't have a valid session. Please, run the \"mc-scripts login\" command to authenticate yourself.");
|
|
774
|
-
|
|
775
|
-
case 8:
|
|
776
|
-
_context6.next = 10;
|
|
777
|
-
return fetchCustomApplication({
|
|
778
|
-
mcApiUrl: mcApiUrl,
|
|
779
|
-
entryPointUriPath: localCustomAppData.entryPointUriPath
|
|
780
|
-
});
|
|
781
|
-
|
|
782
|
-
case 10:
|
|
783
|
-
fetchedCustomApplication = _context6.sent;
|
|
784
|
-
|
|
785
|
-
if (fetchedCustomApplication) {
|
|
786
|
-
_context6.next = 55;
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
_context6.next = 14;
|
|
791
|
-
return fetchUserOrganizations({
|
|
792
|
-
mcApiUrl: mcApiUrl
|
|
793
|
-
});
|
|
794
|
-
|
|
795
|
-
case 14:
|
|
796
|
-
userOrganizations = _context6.sent;
|
|
797
|
-
|
|
798
|
-
if (!(userOrganizations.total === 0)) {
|
|
799
|
-
_context6.next = 17;
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
|
|
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.");
|
|
804
|
-
|
|
805
|
-
case 17:
|
|
806
|
-
if (!(userOrganizations.total === 1)) {
|
|
807
|
-
_context6.next = 23;
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
_userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
|
|
812
|
-
organizationId = organization.id;
|
|
813
|
-
organizationName = organization.name;
|
|
814
|
-
_context6.next = 32;
|
|
815
|
-
break;
|
|
816
|
-
|
|
817
|
-
case 23:
|
|
818
|
-
organizationChoices = _mapInstanceProperty__default["default"](_context3 = userOrganizations.results).call(_context3, function (organization) {
|
|
819
|
-
return {
|
|
820
|
-
title: organization.name,
|
|
821
|
-
value: organization.id
|
|
822
|
-
};
|
|
823
|
-
});
|
|
824
|
-
_context6.next = 26;
|
|
825
|
-
return prompts__default["default"]({
|
|
826
|
-
type: 'select',
|
|
827
|
-
name: 'organizationId',
|
|
828
|
-
message: 'Select an Organization',
|
|
829
|
-
choices: organizationChoices,
|
|
830
|
-
initial: 0
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
case 26:
|
|
834
|
-
_yield$prompts = _context6.sent;
|
|
835
|
-
selectedOrganizationId = _yield$prompts.organizationId;
|
|
836
|
-
|
|
837
|
-
if (selectedOrganizationId) {
|
|
838
|
-
_context6.next = 30;
|
|
839
|
-
break;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
throw new Error("No Organization selected, aborting.");
|
|
843
|
-
|
|
844
|
-
case 30:
|
|
845
|
-
organizationId = selectedOrganizationId;
|
|
846
|
-
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, function (_ref) {
|
|
847
|
-
var value = _ref.value;
|
|
848
|
-
return value === organizationId;
|
|
849
|
-
}).title;
|
|
850
|
-
|
|
851
|
-
case 32:
|
|
852
|
-
_context6.next = 34;
|
|
853
|
-
return prompts__default["default"]({
|
|
854
|
-
type: 'text',
|
|
855
|
-
name: 'confirmation',
|
|
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'),
|
|
857
|
-
initial: 'yes'
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
case 34:
|
|
861
|
-
_yield$prompts2 = _context6.sent;
|
|
862
|
-
_confirmation = _yield$prompts2.confirmation;
|
|
863
|
-
|
|
864
|
-
if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
865
|
-
_context6.next = 39;
|
|
866
|
-
break;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
console.log(chalk__default["default"].red('Aborted.'));
|
|
870
|
-
return _context6.abrupt("return");
|
|
871
|
-
|
|
872
|
-
case 39:
|
|
873
|
-
_data = omit__default["default"](localCustomAppData, ['id']);
|
|
874
|
-
|
|
875
|
-
if (!options.dryRun) {
|
|
876
|
-
_context6.next = 46;
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
|
|
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");
|
|
885
|
-
|
|
886
|
-
case 46:
|
|
887
|
-
_context6.next = 48;
|
|
888
|
-
return createCustomApplication({
|
|
889
|
-
mcApiUrl: mcApiUrl,
|
|
890
|
-
organizationId: organizationId,
|
|
891
|
-
data: _data
|
|
892
|
-
});
|
|
893
|
-
|
|
894
|
-
case 48:
|
|
895
|
-
createdCustomApplication = _context6.sent;
|
|
896
|
-
|
|
897
|
-
if (createdCustomApplication) {
|
|
898
|
-
_context6.next = 51;
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
throw new Error('Failed to create the Custom Application.');
|
|
903
|
-
|
|
904
|
-
case 51:
|
|
905
|
-
_customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
|
|
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");
|
|
909
|
-
|
|
910
|
-
case 55:
|
|
911
|
-
customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
|
|
912
|
-
configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
|
|
913
|
-
|
|
914
|
-
if (configDiff) {
|
|
915
|
-
_context6.next = 61;
|
|
916
|
-
break;
|
|
917
|
-
}
|
|
918
|
-
|
|
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");
|
|
922
|
-
|
|
923
|
-
case 61:
|
|
924
|
-
console.log('Changes detected:');
|
|
925
|
-
console.log(configDiff);
|
|
926
|
-
console.log();
|
|
927
|
-
_context6.next = 66;
|
|
928
|
-
return prompts__default["default"]({
|
|
929
|
-
type: 'text',
|
|
930
|
-
name: 'confirmation',
|
|
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'),
|
|
932
|
-
initial: 'yes'
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
case 66:
|
|
936
|
-
_yield$prompts3 = _context6.sent;
|
|
937
|
-
confirmation = _yield$prompts3.confirmation;
|
|
938
|
-
|
|
939
|
-
if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
|
|
940
|
-
_context6.next = 71;
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
console.log(chalk__default["default"].red('Aborted.'));
|
|
945
|
-
return _context6.abrupt("return");
|
|
946
|
-
|
|
947
|
-
case 71:
|
|
948
|
-
data = omit__default["default"](localCustomAppData, ['id']);
|
|
949
|
-
|
|
950
|
-
if (!options.dryRun) {
|
|
951
|
-
_context6.next = 78;
|
|
952
|
-
break;
|
|
953
|
-
}
|
|
954
|
-
|
|
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");
|
|
960
|
-
|
|
961
|
-
case 78:
|
|
962
|
-
_context6.next = 80;
|
|
963
|
-
return updateCustomApplication({
|
|
964
|
-
mcApiUrl: mcApiUrl,
|
|
965
|
-
organizationId: fetchedCustomApplication.organizationId,
|
|
966
|
-
data: omit__default["default"](localCustomAppData, ['id']),
|
|
967
|
-
applicationId: fetchedCustomApplication.application.id
|
|
968
|
-
});
|
|
969
|
-
|
|
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), "\"."));
|
|
973
|
-
|
|
974
|
-
case 82:
|
|
975
|
-
case "end":
|
|
976
|
-
return _context6.stop();
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}, _callee);
|
|
980
|
-
}));
|
|
981
|
-
return _run.apply(this, arguments);
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
exports["default"] = run;
|