@commercetools-frontend/mc-scripts 22.28.0 → 22.29.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 +20 -5
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +20 -5
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +20 -5
- package/dist/{build-e34b99e8.cjs.prod.js → build-62792a03.cjs.prod.js} +4 -5
- package/dist/{build-5fa51b8c.esm.js → build-66dc70af.esm.js} +4 -5
- package/dist/{build-999eabc6.cjs.dev.js → build-e3be9274.cjs.dev.js} +4 -5
- package/dist/{build-vite-0ec1e9cf.cjs.dev.js → build-vite-87662f4d.cjs.dev.js} +16 -11
- package/dist/{build-vite-5d0fa021.esm.js → build-vite-b19a39fb.esm.js} +16 -11
- package/dist/{build-vite-acf05a1a.cjs.prod.js → build-vite-c7ccff49.cjs.prod.js} +16 -11
- 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-3aaa3f5d.cjs.dev.js → config-sync-3c396d96.cjs.dev.js} +21 -208
- package/dist/{config-sync-cabd5374.esm.js → config-sync-98db26e7.esm.js} +12 -198
- package/dist/{config-sync-97ba72f5.cjs.prod.js → config-sync-b4656190.cjs.prod.js} +21 -208
- package/dist/{create-postcss-config-069ef9c3.cjs.prod.js → create-postcss-config-12b7a8d6.cjs.prod.js} +1 -1
- package/dist/{create-postcss-config-5d1737f0.cjs.dev.js → create-postcss-config-f7a8f441.cjs.dev.js} +1 -1
- package/dist/{create-postcss-config-0323c669.esm.js → create-postcss-config-fba058e4.esm.js} +1 -1
- package/dist/{create-webpack-config-for-development-43c88bf6.esm.js → create-webpack-config-for-development-5b46add2.esm.js} +1 -1
- package/dist/{create-webpack-config-for-development-e7733a1b.cjs.prod.js → create-webpack-config-for-development-ab714b8d.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-development-4690f4cf.cjs.dev.js → create-webpack-config-for-development-fb65e8be.cjs.dev.js} +1 -1
- package/dist/{create-webpack-config-for-production-778d2b5e.cjs.dev.js → create-webpack-config-for-production-167f752a.cjs.dev.js} +2 -2
- package/dist/{create-webpack-config-for-production-28d51113.esm.js → create-webpack-config-for-production-6125de30.esm.js} +2 -2
- package/dist/{create-webpack-config-for-production-cbf22a83.cjs.prod.js → create-webpack-config-for-production-959fa22b.cjs.prod.js} +2 -2
- package/dist/{credentials-storage-f4e08e09.esm.js → credentials-storage-0b44c17e.esm.js} +1 -1
- package/dist/{credentials-storage-0fb8f4a6.cjs.prod.js → credentials-storage-4222b4e8.cjs.prod.js} +1 -1
- package/dist/{credentials-storage-8b9ddb0b.cjs.dev.js → credentials-storage-94fe55f8.cjs.dev.js} +1 -1
- package/dist/declarations/src/commands/deployment-previews-set.d.ts +3 -0
- package/dist/declarations/src/generated/settings.d.ts +45 -0
- package/dist/declarations/src/types.d.ts +5 -0
- package/dist/declarations/src/utils/graphql-requests.d.ts +41 -2
- package/dist/declarations/src/utils/i18n-message-complilation.d.ts +4 -0
- package/dist/deployment-previews-set-848a1bf9.esm.js +197 -0
- package/dist/deployment-previews-set-dc99dc5c.cjs.dev.js +209 -0
- package/dist/deployment-previews-set-ee78c1da.cjs.prod.js +209 -0
- package/dist/graphql-requests-734ca08d.cjs.prod.js +269 -0
- package/dist/graphql-requests-9f05bdac.cjs.dev.js +269 -0
- package/dist/graphql-requests-ffd9c148.esm.js +246 -0
- package/dist/i18n-message-complilation-393d344a.cjs.prod.js +23 -0
- package/dist/i18n-message-complilation-3f80e8d6.cjs.dev.js +23 -0
- package/dist/i18n-message-complilation-8aec9d1b.esm.js +15 -0
- package/dist/{login-bd94d195.cjs.dev.js → login-8a734416.cjs.dev.js} +2 -2
- package/dist/{login-90029738.esm.js → login-933238a2.esm.js} +2 -2
- package/dist/{login-9ee301cd.cjs.prod.js → login-db3ba9ca.cjs.prod.js} +2 -2
- package/dist/{package-1bf866e8.cjs.dev.js → package-2e7a3b2c.cjs.prod.js} +12 -12
- package/dist/{package-d977cdc9.cjs.prod.js → package-5c8e1e42.cjs.dev.js} +12 -12
- package/dist/{package-50be39f9.esm.js → package-61d870ab.esm.js} +12 -12
- package/dist/{start-a0031945.cjs.prod.js → start-27e158a1.cjs.prod.js} +3 -3
- package/dist/{start-4671c540.esm.js → start-2c0c7162.esm.js} +3 -3
- package/dist/{start-54be934f.cjs.dev.js → start-336282f7.cjs.dev.js} +3 -3
- package/package.json +12 -12
- 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
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +12 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +12 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +12 -2
- package/dist/declarations/src/utils/get-i18n-message-format.d.ts +0 -3
- package/dist/get-i18n-message-format-3e59a0d7.cjs.prod.js +0 -15
- package/dist/get-i18n-message-format-44a20fa2.cjs.dev.js +0 -15
- package/dist/get-i18n-message-format-58852baf.esm.js +0 -9
|
@@ -8,7 +8,7 @@ import chalk from 'chalk';
|
|
|
8
8
|
import omit from 'lodash/omit';
|
|
9
9
|
import prompts from 'prompts';
|
|
10
10
|
import { sanitizeSvg, processConfig } from '@commercetools-frontend/application-config';
|
|
11
|
-
import { C as CredentialsStorage
|
|
11
|
+
import { C as CredentialsStorage } from './credentials-storage-0b44c17e.esm.js';
|
|
12
12
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
13
13
|
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
14
14
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
@@ -20,12 +20,9 @@ import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
|
20
20
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
21
21
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
22
22
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
23
|
-
import
|
|
24
|
-
import { print } from 'graphql';
|
|
25
|
-
import { GraphQLClient, ClientError } from 'graphql-request';
|
|
26
|
-
import { GRAPHQL_TARGETS } from '@commercetools-frontend/constants';
|
|
23
|
+
import { f as fetchCustomApplication, a as fetchUserOrganizations, c as createCustomApplication, u as updateCustomApplication, b as fetchCustomView, d as createCustomView, e as updateCustomView } from './graphql-requests-ffd9c148.esm.js';
|
|
27
24
|
import '@commercetools/http-user-agent';
|
|
28
|
-
import './package-
|
|
25
|
+
import './package-61d870ab.esm.js';
|
|
29
26
|
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
30
27
|
import '@babel/runtime-corejs3/helpers/createClass';
|
|
31
28
|
import '@babel/runtime-corejs3/core-js-stable/date/now';
|
|
@@ -34,9 +31,13 @@ import 'os';
|
|
|
34
31
|
import 'path';
|
|
35
32
|
import './does-file-exist-32618334.esm.js';
|
|
36
33
|
import 'node:fs';
|
|
34
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
35
|
+
import 'graphql';
|
|
36
|
+
import 'graphql-request';
|
|
37
|
+
import '@commercetools-frontend/constants';
|
|
37
38
|
|
|
38
|
-
function ownKeys
|
|
39
|
-
function _objectSpread
|
|
39
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
40
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context21, _context22; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context21 = ownKeys(Object(t), !0)).call(_context21, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context22 = ownKeys(Object(t))).call(_context22, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
41
|
|
|
41
42
|
// Since not all terminal supports colors, to make things more consistent for testing purposes,
|
|
42
43
|
// during tests the color used is appended before the string instead of coloring it.
|
|
@@ -112,7 +113,7 @@ const getPermissionsDiff = _ref3 => {
|
|
|
112
113
|
const mappedOldPermissions = _reduceInstanceProperty(previousValue).call(previousValue, (previousPermission, _ref4) => {
|
|
113
114
|
let name = _ref4.name,
|
|
114
115
|
oAuthScopes = _ref4.oAuthScopes;
|
|
115
|
-
return _objectSpread
|
|
116
|
+
return _objectSpread(_objectSpread({}, previousPermission), {}, {
|
|
116
117
|
[name]: oAuthScopes
|
|
117
118
|
});
|
|
118
119
|
}, {});
|
|
@@ -159,7 +160,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
159
160
|
const mappedOldLabelAllLocales = _reduceInstanceProperty(previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
|
|
160
161
|
let locale = _ref6.locale,
|
|
161
162
|
value = _ref6.value;
|
|
162
|
-
return _objectSpread
|
|
163
|
+
return _objectSpread(_objectSpread({}, previousLabelAllLocale), {}, {
|
|
163
164
|
[locale]: value
|
|
164
165
|
});
|
|
165
166
|
}, {});
|
|
@@ -273,7 +274,7 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
273
274
|
let previousValue = _ref10.previousValue,
|
|
274
275
|
nextValue = _ref10.nextValue;
|
|
275
276
|
const submenuLinksDiff = ['submenuLink changed'];
|
|
276
|
-
const mappedSubmenuLinks = _reduceInstanceProperty(previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread
|
|
277
|
+
const mappedSubmenuLinks = _reduceInstanceProperty(previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread(_objectSpread({}, previousSubmenuLink), {}, {
|
|
277
278
|
[currentSubmenuLink.uriPath]: currentSubmenuLink
|
|
278
279
|
}), {});
|
|
279
280
|
_forEachInstanceProperty(nextValue).call(nextValue, newSubmenuLink => {
|
|
@@ -513,193 +514,6 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
|
|
|
513
514
|
return diff.join('\n');
|
|
514
515
|
};
|
|
515
516
|
|
|
516
|
-
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
517
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
518
|
-
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 } } } };
|
|
519
|
-
var CreateCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomViewFromCli" }, 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: "CustomViewDraftDataInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomView" }, 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: 180, source: { body: "mutation CreateCustomViewFromCli(\n $organizationId: String!\n $data: CustomViewDraftDataInput!\n) {\n createCustomView(organizationId: $organizationId, data: $data) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
520
|
-
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 } } } };
|
|
521
|
-
var FetchCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomViewFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationExtensionForCustomView" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "customViewId" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "customView" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, 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: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "typeSettings" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "size" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "locators" }, 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: [] }] } }] } }] } }] } }], loc: { start: 0, end: 399, source: { body: "query FetchCustomViewFromCli($customViewId: String!) {\n organizationExtensionForCustomView(customViewId: $customViewId) {\n organizationId\n customView {\n id\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n url\n type\n typeSettings {\n size\n }\n locators\n permissions {\n name\n oAuthScopes\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
522
|
-
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 } } } };
|
|
523
|
-
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 } } } };
|
|
524
|
-
var UpdateCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomViewFromCli" }, 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: "CustomViewDraftDataInput" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomView" }, 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: "customViewId" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 248, source: { body: "mutation UpdateCustomViewFromCli(\n $organizationId: String!\n $data: CustomViewDraftDataInput!\n $customViewId: String!\n) {\n updateCustomView(\n organizationId: $organizationId\n data: $data\n customViewId: $customViewId\n ) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
525
|
-
const credentialsStorage$1 = new CredentialsStorage();
|
|
526
|
-
async function requestWithTokenRetry(document, requestOptions) {
|
|
527
|
-
let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
528
|
-
const token = credentialsStorage$1.getToken(requestOptions.mcApiUrl);
|
|
529
|
-
const client = new GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
|
|
530
|
-
headers: _objectSpread(_objectSpread({
|
|
531
|
-
Accept: 'application/json',
|
|
532
|
-
'Content-Type': 'application/json',
|
|
533
|
-
'x-user-agent': userAgent
|
|
534
|
-
}, token ? {
|
|
535
|
-
'x-mc-cli-access-token': token
|
|
536
|
-
} : {}), requestOptions.headers)
|
|
537
|
-
});
|
|
538
|
-
try {
|
|
539
|
-
const result = await client.rawRequest(print(document), requestOptions.variables);
|
|
540
|
-
|
|
541
|
-
// In case a new session token is returned from the server, save it.
|
|
542
|
-
const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
|
|
543
|
-
if (refreshedSessionToken) {
|
|
544
|
-
console.log(chalk.green('Session token refreshed.'));
|
|
545
|
-
console.log();
|
|
546
|
-
const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
|
|
547
|
-
// Store the updated access token.
|
|
548
|
-
credentialsStorage$1.setToken(requestOptions.mcApiUrl, {
|
|
549
|
-
token: refreshedSessionToken,
|
|
550
|
-
expiresAt: Number(refreshedSessionTokenExpiresAt)
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
return result.data;
|
|
554
|
-
} catch (error) {
|
|
555
|
-
if (error instanceof ClientError) {
|
|
556
|
-
// If it's an unauthorized error, retry the request to force the token to be refreshed.
|
|
557
|
-
if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
|
|
558
|
-
var _context;
|
|
559
|
-
const isUnauthorizedError = _someInstanceProperty(_context = error.response.errors).call(_context, graphqlError => {
|
|
560
|
-
var _graphqlError$extensi;
|
|
561
|
-
return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
|
|
562
|
-
});
|
|
563
|
-
if (isUnauthorizedError) {
|
|
564
|
-
console.log(chalk.yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
|
|
565
|
-
return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
|
|
566
|
-
headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
|
|
567
|
-
'X-Force-Token': 'true'
|
|
568
|
-
})
|
|
569
|
-
}), retryCount + 1);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
throw error;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
const fetchCustomApplication = async _ref => {
|
|
577
|
-
let mcApiUrl = _ref.mcApiUrl,
|
|
578
|
-
entryPointUriPath = _ref.entryPointUriPath,
|
|
579
|
-
applicationIdentifier = _ref.applicationIdentifier;
|
|
580
|
-
const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
|
|
581
|
-
variables: {
|
|
582
|
-
entryPointUriPath
|
|
583
|
-
},
|
|
584
|
-
mcApiUrl,
|
|
585
|
-
headers: {
|
|
586
|
-
'x-application-id': applicationIdentifier,
|
|
587
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
return customAppData.organizationExtensionForCustomApplication;
|
|
591
|
-
};
|
|
592
|
-
const fetchCustomView = async _ref2 => {
|
|
593
|
-
let mcApiUrl = _ref2.mcApiUrl,
|
|
594
|
-
customViewId = _ref2.customViewId,
|
|
595
|
-
applicationIdentifier = _ref2.applicationIdentifier;
|
|
596
|
-
const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
|
|
597
|
-
variables: {
|
|
598
|
-
customViewId
|
|
599
|
-
},
|
|
600
|
-
mcApiUrl,
|
|
601
|
-
headers: {
|
|
602
|
-
'x-custom-view-id': customViewId,
|
|
603
|
-
'x-application-id': applicationIdentifier,
|
|
604
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
return customViewData.organizationExtensionForCustomView;
|
|
608
|
-
};
|
|
609
|
-
const updateCustomApplication = async _ref3 => {
|
|
610
|
-
let mcApiUrl = _ref3.mcApiUrl,
|
|
611
|
-
applicationId = _ref3.applicationId,
|
|
612
|
-
organizationId = _ref3.organizationId,
|
|
613
|
-
data = _ref3.data,
|
|
614
|
-
applicationIdentifier = _ref3.applicationIdentifier;
|
|
615
|
-
const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
|
|
616
|
-
variables: {
|
|
617
|
-
organizationId,
|
|
618
|
-
applicationId,
|
|
619
|
-
data
|
|
620
|
-
},
|
|
621
|
-
mcApiUrl,
|
|
622
|
-
headers: {
|
|
623
|
-
'x-application-id': applicationIdentifier,
|
|
624
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
return updatedCustomAppsData.updateCustomApplication;
|
|
628
|
-
};
|
|
629
|
-
const updateCustomView = async _ref4 => {
|
|
630
|
-
let mcApiUrl = _ref4.mcApiUrl,
|
|
631
|
-
organizationId = _ref4.organizationId,
|
|
632
|
-
data = _ref4.data,
|
|
633
|
-
customViewId = _ref4.customViewId,
|
|
634
|
-
applicationIdentifier = _ref4.applicationIdentifier;
|
|
635
|
-
const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
|
|
636
|
-
variables: {
|
|
637
|
-
organizationId,
|
|
638
|
-
customViewId,
|
|
639
|
-
data
|
|
640
|
-
},
|
|
641
|
-
mcApiUrl,
|
|
642
|
-
headers: {
|
|
643
|
-
'x-custom-view-id': customViewId,
|
|
644
|
-
'x-application-id': applicationIdentifier,
|
|
645
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
return updatedCustomViewData.updateCustomView;
|
|
649
|
-
};
|
|
650
|
-
const createCustomApplication = async _ref5 => {
|
|
651
|
-
let mcApiUrl = _ref5.mcApiUrl,
|
|
652
|
-
organizationId = _ref5.organizationId,
|
|
653
|
-
data = _ref5.data,
|
|
654
|
-
applicationIdentifier = _ref5.applicationIdentifier;
|
|
655
|
-
const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
|
|
656
|
-
variables: {
|
|
657
|
-
organizationId,
|
|
658
|
-
data
|
|
659
|
-
},
|
|
660
|
-
mcApiUrl,
|
|
661
|
-
headers: {
|
|
662
|
-
'x-application-id': applicationIdentifier,
|
|
663
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
return createdCustomAppData.createCustomApplication;
|
|
667
|
-
};
|
|
668
|
-
const createCustomView = async _ref6 => {
|
|
669
|
-
let mcApiUrl = _ref6.mcApiUrl,
|
|
670
|
-
organizationId = _ref6.organizationId,
|
|
671
|
-
data = _ref6.data,
|
|
672
|
-
applicationIdentifier = _ref6.applicationIdentifier;
|
|
673
|
-
const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
|
|
674
|
-
variables: {
|
|
675
|
-
organizationId,
|
|
676
|
-
data
|
|
677
|
-
},
|
|
678
|
-
mcApiUrl,
|
|
679
|
-
headers: {
|
|
680
|
-
'x-application-id': applicationIdentifier,
|
|
681
|
-
'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
return createdCustomViewData.createCustomView;
|
|
685
|
-
};
|
|
686
|
-
const fetchUserOrganizations = async _ref7 => {
|
|
687
|
-
let mcApiUrl = _ref7.mcApiUrl,
|
|
688
|
-
applicationIdentifier = _ref7.applicationIdentifier,
|
|
689
|
-
customViewId = _ref7.customViewId;
|
|
690
|
-
const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
|
|
691
|
-
mcApiUrl,
|
|
692
|
-
headers: _objectSpread(_objectSpread({
|
|
693
|
-
'x-application-id': applicationIdentifier
|
|
694
|
-
}, customViewId && {
|
|
695
|
-
'x-custom-view-id': customViewId
|
|
696
|
-
}), {}, {
|
|
697
|
-
'x-graphql-target': GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
|
|
698
|
-
})
|
|
699
|
-
});
|
|
700
|
-
return userOrganizations.myOrganizations;
|
|
701
|
-
};
|
|
702
|
-
|
|
703
517
|
const credentialsStorage = new CredentialsStorage();
|
|
704
518
|
const getMcUrlLink = _ref => {
|
|
705
519
|
var _context, _context2, _context3;
|