@commercetools-frontend/mc-scripts 22.28.0 → 22.30.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.
Files changed (64) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +20 -5
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +20 -5
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +20 -5
  4. package/dist/{build-e34b99e8.cjs.prod.js → build-9cec9200.cjs.prod.js} +4 -5
  5. package/dist/{build-5fa51b8c.esm.js → build-da3b32c2.esm.js} +4 -5
  6. package/dist/{build-999eabc6.cjs.dev.js → build-f3afcd49.cjs.dev.js} +4 -5
  7. package/dist/{build-vite-0ec1e9cf.cjs.dev.js → build-vite-87662f4d.cjs.dev.js} +16 -11
  8. package/dist/{build-vite-5d0fa021.esm.js → build-vite-b19a39fb.esm.js} +16 -11
  9. package/dist/{build-vite-acf05a1a.cjs.prod.js → build-vite-c7ccff49.cjs.prod.js} +16 -11
  10. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  11. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  12. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  13. package/dist/{config-sync-3aaa3f5d.cjs.dev.js → config-sync-1382d742.cjs.dev.js} +21 -208
  14. package/dist/{config-sync-97ba72f5.cjs.prod.js → config-sync-5630eaf3.cjs.prod.js} +21 -208
  15. package/dist/{config-sync-cabd5374.esm.js → config-sync-994c65af.esm.js} +12 -198
  16. package/dist/{create-postcss-config-0323c669.esm.js → create-postcss-config-80fcacc8.esm.js} +1 -1
  17. package/dist/{create-postcss-config-5d1737f0.cjs.dev.js → create-postcss-config-a77dddc9.cjs.dev.js} +1 -1
  18. package/dist/{create-postcss-config-069ef9c3.cjs.prod.js → create-postcss-config-c9d6c97d.cjs.prod.js} +1 -1
  19. package/dist/{create-webpack-config-for-development-e7733a1b.cjs.prod.js → create-webpack-config-for-development-0afc61bd.cjs.prod.js} +1 -1
  20. package/dist/{create-webpack-config-for-development-43c88bf6.esm.js → create-webpack-config-for-development-12426c95.esm.js} +1 -1
  21. package/dist/{create-webpack-config-for-development-4690f4cf.cjs.dev.js → create-webpack-config-for-development-744f2450.cjs.dev.js} +1 -1
  22. package/dist/{create-webpack-config-for-production-778d2b5e.cjs.dev.js → create-webpack-config-for-production-a416f4e0.cjs.dev.js} +2 -2
  23. package/dist/{create-webpack-config-for-production-cbf22a83.cjs.prod.js → create-webpack-config-for-production-ec594cb8.cjs.prod.js} +2 -2
  24. package/dist/{create-webpack-config-for-production-28d51113.esm.js → create-webpack-config-for-production-fa398fe5.esm.js} +2 -2
  25. package/dist/{credentials-storage-8b9ddb0b.cjs.dev.js → credentials-storage-1552e722.cjs.dev.js} +1 -1
  26. package/dist/{credentials-storage-0fb8f4a6.cjs.prod.js → credentials-storage-44ff9622.cjs.prod.js} +1 -1
  27. package/dist/{credentials-storage-f4e08e09.esm.js → credentials-storage-cb50e964.esm.js} +1 -1
  28. package/dist/declarations/src/commands/deployment-previews-set.d.ts +3 -0
  29. package/dist/declarations/src/generated/settings.d.ts +45 -0
  30. package/dist/declarations/src/types.d.ts +5 -0
  31. package/dist/declarations/src/utils/graphql-requests.d.ts +41 -2
  32. package/dist/declarations/src/utils/i18n-message-complilation.d.ts +4 -0
  33. package/dist/deployment-previews-set-9433ec82.esm.js +197 -0
  34. package/dist/deployment-previews-set-d6e7505a.cjs.prod.js +209 -0
  35. package/dist/deployment-previews-set-f538d323.cjs.dev.js +209 -0
  36. package/dist/graphql-requests-2a72a4f1.cjs.dev.js +269 -0
  37. package/dist/graphql-requests-c92192aa.esm.js +246 -0
  38. package/dist/graphql-requests-cbebcbb8.cjs.prod.js +269 -0
  39. package/dist/i18n-message-complilation-393d344a.cjs.prod.js +23 -0
  40. package/dist/i18n-message-complilation-3f80e8d6.cjs.dev.js +23 -0
  41. package/dist/i18n-message-complilation-8aec9d1b.esm.js +15 -0
  42. package/dist/{login-bd94d195.cjs.dev.js → login-532a3a88.cjs.dev.js} +2 -2
  43. package/dist/{login-9ee301cd.cjs.prod.js → login-958fbc54.cjs.prod.js} +2 -2
  44. package/dist/{login-90029738.esm.js → login-b5ed7cfc.esm.js} +2 -2
  45. package/dist/{package-50be39f9.esm.js → package-16f29309.esm.js} +12 -12
  46. package/dist/{package-1bf866e8.cjs.dev.js → package-218d42f5.cjs.prod.js} +12 -12
  47. package/dist/{package-d977cdc9.cjs.prod.js → package-dc01b1e0.cjs.dev.js} +12 -12
  48. package/dist/{start-4671c540.esm.js → start-04208901.esm.js} +3 -3
  49. package/dist/{start-54be934f.cjs.dev.js → start-c51f7ab5.cjs.dev.js} +3 -3
  50. package/dist/{start-a0031945.cjs.prod.js → start-fb1cc1c8.cjs.prod.js} +3 -3
  51. package/package.json +12 -12
  52. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  53. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  54. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  55. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
  56. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
  57. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
  58. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +12 -2
  59. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +12 -2
  60. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +12 -2
  61. package/dist/declarations/src/utils/get-i18n-message-format.d.ts +0 -3
  62. package/dist/get-i18n-message-format-3e59a0d7.cjs.prod.js +0 -15
  63. package/dist/get-i18n-message-format-44a20fa2.cjs.dev.js +0 -15
  64. package/dist/get-i18n-message-format-58852baf.esm.js +0 -9
@@ -10,7 +10,7 @@ var chalk = require('chalk');
10
10
  var omit = require('lodash/omit');
11
11
  var prompts = require('prompts');
12
12
  var applicationConfig = require('@commercetools-frontend/application-config');
13
- var credentialsStorage$2 = require('./credentials-storage-8b9ddb0b.cjs.dev.js');
13
+ var credentialsStorage$1 = require('./credentials-storage-1552e722.cjs.dev.js');
14
14
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
15
15
  var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
16
16
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
@@ -22,12 +22,9 @@ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
22
22
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
23
23
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
24
24
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
25
- var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
26
- var graphql = require('graphql');
27
- var graphqlRequest = require('graphql-request');
28
- var constants = require('@commercetools-frontend/constants');
25
+ var graphqlRequests = require('./graphql-requests-2a72a4f1.cjs.dev.js');
29
26
  require('@commercetools/http-user-agent');
30
- require('./package-1bf866e8.cjs.dev.js');
27
+ require('./package-dc01b1e0.cjs.dev.js');
31
28
  require('@babel/runtime-corejs3/helpers/classCallCheck');
32
29
  require('@babel/runtime-corejs3/helpers/createClass');
33
30
  require('@babel/runtime-corejs3/core-js-stable/date/now');
@@ -36,6 +33,10 @@ require('os');
36
33
  require('path');
37
34
  require('./does-file-exist-eb86baca.cjs.dev.js');
38
35
  require('node:fs');
36
+ require('@babel/runtime-corejs3/core-js-stable/instance/some');
37
+ require('graphql');
38
+ require('graphql-request');
39
+ require('@commercetools-frontend/constants');
39
40
 
40
41
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
41
42
 
@@ -57,10 +58,9 @@ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
57
58
  var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
58
59
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
59
60
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
60
- var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
61
61
 
62
- function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
63
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context21, _context22; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context21 = ownKeys$1(Object(t), !0)).call(_context21, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context22 = ownKeys$1(Object(t))).call(_context22, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
62
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
63
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context21, _context22; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context21 = ownKeys(Object(t), !0)).call(_context21, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context22 = ownKeys(Object(t))).call(_context22, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
64
64
 
65
65
  // Since not all terminal supports colors, to make things more consistent for testing purposes,
66
66
  // during tests the color used is appended before the string instead of coloring it.
@@ -136,7 +136,7 @@ const getPermissionsDiff = _ref3 => {
136
136
  const mappedOldPermissions = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousPermission, _ref4) => {
137
137
  let name = _ref4.name,
138
138
  oAuthScopes = _ref4.oAuthScopes;
139
- return _objectSpread$1(_objectSpread$1({}, previousPermission), {}, {
139
+ return _objectSpread(_objectSpread({}, previousPermission), {}, {
140
140
  [name]: oAuthScopes
141
141
  });
142
142
  }, {});
@@ -183,7 +183,7 @@ const getLabelAllLocalesDiff = _ref5 => {
183
183
  const mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
184
184
  let locale = _ref6.locale,
185
185
  value = _ref6.value;
186
- return _objectSpread$1(_objectSpread$1({}, previousLabelAllLocale), {}, {
186
+ return _objectSpread(_objectSpread({}, previousLabelAllLocale), {}, {
187
187
  [locale]: value
188
188
  });
189
189
  }, {});
@@ -297,7 +297,7 @@ const getSubmenuLinksDiff = _ref10 => {
297
297
  let previousValue = _ref10.previousValue,
298
298
  nextValue = _ref10.nextValue;
299
299
  const submenuLinksDiff = ['submenuLink changed'];
300
- const mappedSubmenuLinks = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread$1(_objectSpread$1({}, previousSubmenuLink), {}, {
300
+ const mappedSubmenuLinks = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread(_objectSpread({}, previousSubmenuLink), {}, {
301
301
  [currentSubmenuLink.uriPath]: currentSubmenuLink
302
302
  }), {});
303
303
  _forEachInstanceProperty__default["default"](nextValue).call(nextValue, newSubmenuLink => {
@@ -537,194 +537,7 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
537
537
  return diff.join('\n');
538
538
  };
539
539
 
540
- function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
541
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
542
- 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 } } } };
543
- 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 } } } };
544
- 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 } } } };
545
- 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 } } } };
546
- 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 } } } };
547
- 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 } } } };
548
- 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 } } } };
549
- const credentialsStorage$1 = new credentialsStorage$2.CredentialsStorage();
550
- async function requestWithTokenRetry(document, requestOptions) {
551
- let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
552
- const token = credentialsStorage$1.getToken(requestOptions.mcApiUrl);
553
- const client = new graphqlRequest.GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
554
- headers: _objectSpread(_objectSpread({
555
- Accept: 'application/json',
556
- 'Content-Type': 'application/json',
557
- 'x-user-agent': credentialsStorage$2.userAgent
558
- }, token ? {
559
- 'x-mc-cli-access-token': token
560
- } : {}), requestOptions.headers)
561
- });
562
- try {
563
- const result = await client.rawRequest(graphql.print(document), requestOptions.variables);
564
-
565
- // In case a new session token is returned from the server, save it.
566
- const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
567
- if (refreshedSessionToken) {
568
- console.log(chalk__default["default"].green('Session token refreshed.'));
569
- console.log();
570
- const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
571
- // Store the updated access token.
572
- credentialsStorage$1.setToken(requestOptions.mcApiUrl, {
573
- token: refreshedSessionToken,
574
- expiresAt: Number(refreshedSessionTokenExpiresAt)
575
- });
576
- }
577
- return result.data;
578
- } catch (error) {
579
- if (error instanceof graphqlRequest.ClientError) {
580
- // If it's an unauthorized error, retry the request to force the token to be refreshed.
581
- if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
582
- var _context;
583
- const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => {
584
- var _graphqlError$extensi;
585
- return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
586
- });
587
- if (isUnauthorizedError) {
588
- console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
589
- return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
590
- headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
591
- 'X-Force-Token': 'true'
592
- })
593
- }), retryCount + 1);
594
- }
595
- }
596
- }
597
- throw error;
598
- }
599
- }
600
- const fetchCustomApplication = async _ref => {
601
- let mcApiUrl = _ref.mcApiUrl,
602
- entryPointUriPath = _ref.entryPointUriPath,
603
- applicationIdentifier = _ref.applicationIdentifier;
604
- const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
605
- variables: {
606
- entryPointUriPath
607
- },
608
- mcApiUrl,
609
- headers: {
610
- 'x-application-id': applicationIdentifier,
611
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
612
- }
613
- });
614
- return customAppData.organizationExtensionForCustomApplication;
615
- };
616
- const fetchCustomView = async _ref2 => {
617
- let mcApiUrl = _ref2.mcApiUrl,
618
- customViewId = _ref2.customViewId,
619
- applicationIdentifier = _ref2.applicationIdentifier;
620
- const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
621
- variables: {
622
- customViewId
623
- },
624
- mcApiUrl,
625
- headers: {
626
- 'x-custom-view-id': customViewId,
627
- 'x-application-id': applicationIdentifier,
628
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
629
- }
630
- });
631
- return customViewData.organizationExtensionForCustomView;
632
- };
633
- const updateCustomApplication = async _ref3 => {
634
- let mcApiUrl = _ref3.mcApiUrl,
635
- applicationId = _ref3.applicationId,
636
- organizationId = _ref3.organizationId,
637
- data = _ref3.data,
638
- applicationIdentifier = _ref3.applicationIdentifier;
639
- const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
640
- variables: {
641
- organizationId,
642
- applicationId,
643
- data
644
- },
645
- mcApiUrl,
646
- headers: {
647
- 'x-application-id': applicationIdentifier,
648
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
649
- }
650
- });
651
- return updatedCustomAppsData.updateCustomApplication;
652
- };
653
- const updateCustomView = async _ref4 => {
654
- let mcApiUrl = _ref4.mcApiUrl,
655
- organizationId = _ref4.organizationId,
656
- data = _ref4.data,
657
- customViewId = _ref4.customViewId,
658
- applicationIdentifier = _ref4.applicationIdentifier;
659
- const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
660
- variables: {
661
- organizationId,
662
- customViewId,
663
- data
664
- },
665
- mcApiUrl,
666
- headers: {
667
- 'x-custom-view-id': customViewId,
668
- 'x-application-id': applicationIdentifier,
669
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
670
- }
671
- });
672
- return updatedCustomViewData.updateCustomView;
673
- };
674
- const createCustomApplication = async _ref5 => {
675
- let mcApiUrl = _ref5.mcApiUrl,
676
- organizationId = _ref5.organizationId,
677
- data = _ref5.data,
678
- applicationIdentifier = _ref5.applicationIdentifier;
679
- const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
680
- variables: {
681
- organizationId,
682
- data
683
- },
684
- mcApiUrl,
685
- headers: {
686
- 'x-application-id': applicationIdentifier,
687
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
688
- }
689
- });
690
- return createdCustomAppData.createCustomApplication;
691
- };
692
- const createCustomView = async _ref6 => {
693
- let mcApiUrl = _ref6.mcApiUrl,
694
- organizationId = _ref6.organizationId,
695
- data = _ref6.data,
696
- applicationIdentifier = _ref6.applicationIdentifier;
697
- const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
698
- variables: {
699
- organizationId,
700
- data
701
- },
702
- mcApiUrl,
703
- headers: {
704
- 'x-application-id': applicationIdentifier,
705
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
706
- }
707
- });
708
- return createdCustomViewData.createCustomView;
709
- };
710
- const fetchUserOrganizations = async _ref7 => {
711
- let mcApiUrl = _ref7.mcApiUrl,
712
- applicationIdentifier = _ref7.applicationIdentifier,
713
- customViewId = _ref7.customViewId;
714
- const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
715
- mcApiUrl,
716
- headers: _objectSpread(_objectSpread({
717
- 'x-application-id': applicationIdentifier
718
- }, customViewId && {
719
- 'x-custom-view-id': customViewId
720
- }), {}, {
721
- 'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
722
- })
723
- });
724
- return userOrganizations.myOrganizations;
725
- };
726
-
727
- const credentialsStorage = new credentialsStorage$2.CredentialsStorage();
540
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
728
541
  const getMcUrlLink = _ref => {
729
542
  var _context, _context2, _context3;
730
543
  let mcApiUrl = _ref.mcApiUrl,
@@ -742,14 +555,14 @@ async function createOrUpdateCustomApplication(_ref2) {
742
555
  localCustomEntityData = _ref2.localCustomEntityData,
743
556
  applicationIdentifier = _ref2.applicationIdentifier,
744
557
  options = _ref2.options;
745
- const fetchedCustomApplication = await fetchCustomApplication({
558
+ const fetchedCustomApplication = await graphqlRequests.fetchCustomApplication({
746
559
  mcApiUrl,
747
560
  entryPointUriPath: localCustomEntityData.entryPointUriPath,
748
561
  applicationIdentifier
749
562
  });
750
563
  if (!fetchedCustomApplication) {
751
564
  var _context5;
752
- const userOrganizations = await fetchUserOrganizations({
565
+ const userOrganizations = await graphqlRequests.fetchUserOrganizations({
753
566
  mcApiUrl,
754
567
  applicationIdentifier
755
568
  });
@@ -804,7 +617,7 @@ async function createOrUpdateCustomApplication(_ref2) {
804
617
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
805
618
  return;
806
619
  }
807
- const createdCustomApplication = await createCustomApplication({
620
+ const createdCustomApplication = await graphqlRequests.createCustomApplication({
808
621
  mcApiUrl,
809
622
  organizationId,
810
623
  data,
@@ -860,7 +673,7 @@ async function createOrUpdateCustomApplication(_ref2) {
860
673
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
861
674
  return;
862
675
  }
863
- await updateCustomApplication({
676
+ await graphqlRequests.updateCustomApplication({
864
677
  mcApiUrl,
865
678
  organizationId: fetchedCustomApplication.organizationId,
866
679
  data: omit__default["default"](localCustomEntityData, ['id']),
@@ -877,14 +690,14 @@ async function createOrUpdateCustomView(_ref4) {
877
690
  customViewId = _ref4.customViewId,
878
691
  options = _ref4.options,
879
692
  applicationIdentifier = _ref4.applicationIdentifier;
880
- const fetchedCustomView = await fetchCustomView({
693
+ const fetchedCustomView = await graphqlRequests.fetchCustomView({
881
694
  mcApiUrl,
882
695
  customViewId,
883
696
  applicationIdentifier
884
697
  });
885
698
  if (!fetchedCustomView) {
886
699
  var _context8;
887
- const userOrganizations = await fetchUserOrganizations({
700
+ const userOrganizations = await graphqlRequests.fetchUserOrganizations({
888
701
  mcApiUrl,
889
702
  customViewId,
890
703
  applicationIdentifier
@@ -940,7 +753,7 @@ async function createOrUpdateCustomView(_ref4) {
940
753
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
941
754
  return;
942
755
  }
943
- const createdCustomView = await createCustomView({
756
+ const createdCustomView = await graphqlRequests.createCustomView({
944
757
  mcApiUrl,
945
758
  organizationId,
946
759
  data,
@@ -998,7 +811,7 @@ async function createOrUpdateCustomView(_ref4) {
998
811
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
999
812
  return;
1000
813
  }
1001
- await updateCustomView({
814
+ await graphqlRequests.updateCustomView({
1002
815
  mcApiUrl,
1003
816
  organizationId: fetchedCustomView.organizationId,
1004
817
  data: omit__default["default"](localCustomEntityData, ['id']),