@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-0fb8f4a6.cjs.prod.js');
13
+ var credentialsStorage$1 = require('./credentials-storage-44ff9622.cjs.prod.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-cbebcbb8.cjs.prod.js');
29
26
  require('@commercetools/http-user-agent');
30
- require('./package-d977cdc9.cjs.prod.js');
27
+ require('./package-218d42f5.cjs.prod.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-be53305d.cjs.prod.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
  const red = str => {
65
65
  return chalk__default["default"].red(str);
66
66
  };
@@ -130,7 +130,7 @@ const getPermissionsDiff = _ref3 => {
130
130
  const mappedOldPermissions = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousPermission, _ref4) => {
131
131
  let name = _ref4.name,
132
132
  oAuthScopes = _ref4.oAuthScopes;
133
- return _objectSpread$1(_objectSpread$1({}, previousPermission), {}, {
133
+ return _objectSpread(_objectSpread({}, previousPermission), {}, {
134
134
  [name]: oAuthScopes
135
135
  });
136
136
  }, {});
@@ -177,7 +177,7 @@ const getLabelAllLocalesDiff = _ref5 => {
177
177
  const mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
178
178
  let locale = _ref6.locale,
179
179
  value = _ref6.value;
180
- return _objectSpread$1(_objectSpread$1({}, previousLabelAllLocale), {}, {
180
+ return _objectSpread(_objectSpread({}, previousLabelAllLocale), {}, {
181
181
  [locale]: value
182
182
  });
183
183
  }, {});
@@ -291,7 +291,7 @@ const getSubmenuLinksDiff = _ref10 => {
291
291
  let previousValue = _ref10.previousValue,
292
292
  nextValue = _ref10.nextValue;
293
293
  const submenuLinksDiff = ['submenuLink changed'];
294
- const mappedSubmenuLinks = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread$1(_objectSpread$1({}, previousSubmenuLink), {}, {
294
+ const mappedSubmenuLinks = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousSubmenuLink, currentSubmenuLink) => _objectSpread(_objectSpread({}, previousSubmenuLink), {}, {
295
295
  [currentSubmenuLink.uriPath]: currentSubmenuLink
296
296
  }), {});
297
297
  _forEachInstanceProperty__default["default"](nextValue).call(nextValue, newSubmenuLink => {
@@ -531,194 +531,7 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
531
531
  return diff.join('\n');
532
532
  };
533
533
 
534
- 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; }
535
- 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; }
536
- 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 } } } };
537
- 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 } } } };
538
- 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 } } } };
539
- 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 } } } };
540
- 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 } } } };
541
- 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 } } } };
542
- 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 } } } };
543
- const credentialsStorage$1 = new credentialsStorage$2.CredentialsStorage();
544
- async function requestWithTokenRetry(document, requestOptions) {
545
- let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
546
- const token = credentialsStorage$1.getToken(requestOptions.mcApiUrl);
547
- const client = new graphqlRequest.GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
548
- headers: _objectSpread(_objectSpread({
549
- Accept: 'application/json',
550
- 'Content-Type': 'application/json',
551
- 'x-user-agent': credentialsStorage$2.userAgent
552
- }, token ? {
553
- 'x-mc-cli-access-token': token
554
- } : {}), requestOptions.headers)
555
- });
556
- try {
557
- const result = await client.rawRequest(graphql.print(document), requestOptions.variables);
558
-
559
- // In case a new session token is returned from the server, save it.
560
- const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
561
- if (refreshedSessionToken) {
562
- console.log(chalk__default["default"].green('Session token refreshed.'));
563
- console.log();
564
- const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
565
- // Store the updated access token.
566
- credentialsStorage$1.setToken(requestOptions.mcApiUrl, {
567
- token: refreshedSessionToken,
568
- expiresAt: Number(refreshedSessionTokenExpiresAt)
569
- });
570
- }
571
- return result.data;
572
- } catch (error) {
573
- if (error instanceof graphqlRequest.ClientError) {
574
- // If it's an unauthorized error, retry the request to force the token to be refreshed.
575
- if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
576
- var _context;
577
- const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => {
578
- var _graphqlError$extensi;
579
- return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
580
- });
581
- if (isUnauthorizedError) {
582
- console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
583
- return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
584
- headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
585
- 'X-Force-Token': 'true'
586
- })
587
- }), retryCount + 1);
588
- }
589
- }
590
- }
591
- throw error;
592
- }
593
- }
594
- const fetchCustomApplication = async _ref => {
595
- let mcApiUrl = _ref.mcApiUrl,
596
- entryPointUriPath = _ref.entryPointUriPath,
597
- applicationIdentifier = _ref.applicationIdentifier;
598
- const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
599
- variables: {
600
- entryPointUriPath
601
- },
602
- mcApiUrl,
603
- headers: {
604
- 'x-application-id': applicationIdentifier,
605
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
606
- }
607
- });
608
- return customAppData.organizationExtensionForCustomApplication;
609
- };
610
- const fetchCustomView = async _ref2 => {
611
- let mcApiUrl = _ref2.mcApiUrl,
612
- customViewId = _ref2.customViewId,
613
- applicationIdentifier = _ref2.applicationIdentifier;
614
- const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
615
- variables: {
616
- customViewId
617
- },
618
- mcApiUrl,
619
- headers: {
620
- 'x-custom-view-id': customViewId,
621
- 'x-application-id': applicationIdentifier,
622
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
623
- }
624
- });
625
- return customViewData.organizationExtensionForCustomView;
626
- };
627
- const updateCustomApplication = async _ref3 => {
628
- let mcApiUrl = _ref3.mcApiUrl,
629
- applicationId = _ref3.applicationId,
630
- organizationId = _ref3.organizationId,
631
- data = _ref3.data,
632
- applicationIdentifier = _ref3.applicationIdentifier;
633
- const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
634
- variables: {
635
- organizationId,
636
- applicationId,
637
- data
638
- },
639
- mcApiUrl,
640
- headers: {
641
- 'x-application-id': applicationIdentifier,
642
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
643
- }
644
- });
645
- return updatedCustomAppsData.updateCustomApplication;
646
- };
647
- const updateCustomView = async _ref4 => {
648
- let mcApiUrl = _ref4.mcApiUrl,
649
- organizationId = _ref4.organizationId,
650
- data = _ref4.data,
651
- customViewId = _ref4.customViewId,
652
- applicationIdentifier = _ref4.applicationIdentifier;
653
- const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
654
- variables: {
655
- organizationId,
656
- customViewId,
657
- data
658
- },
659
- mcApiUrl,
660
- headers: {
661
- 'x-custom-view-id': customViewId,
662
- 'x-application-id': applicationIdentifier,
663
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
664
- }
665
- });
666
- return updatedCustomViewData.updateCustomView;
667
- };
668
- const createCustomApplication = async _ref5 => {
669
- let mcApiUrl = _ref5.mcApiUrl,
670
- organizationId = _ref5.organizationId,
671
- data = _ref5.data,
672
- applicationIdentifier = _ref5.applicationIdentifier;
673
- const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
674
- variables: {
675
- organizationId,
676
- data
677
- },
678
- mcApiUrl,
679
- headers: {
680
- 'x-application-id': applicationIdentifier,
681
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
682
- }
683
- });
684
- return createdCustomAppData.createCustomApplication;
685
- };
686
- const createCustomView = async _ref6 => {
687
- let mcApiUrl = _ref6.mcApiUrl,
688
- organizationId = _ref6.organizationId,
689
- data = _ref6.data,
690
- applicationIdentifier = _ref6.applicationIdentifier;
691
- const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
692
- variables: {
693
- organizationId,
694
- data
695
- },
696
- mcApiUrl,
697
- headers: {
698
- 'x-application-id': applicationIdentifier,
699
- 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
700
- }
701
- });
702
- return createdCustomViewData.createCustomView;
703
- };
704
- const fetchUserOrganizations = async _ref7 => {
705
- let mcApiUrl = _ref7.mcApiUrl,
706
- applicationIdentifier = _ref7.applicationIdentifier,
707
- customViewId = _ref7.customViewId;
708
- const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
709
- mcApiUrl,
710
- headers: _objectSpread(_objectSpread({
711
- 'x-application-id': applicationIdentifier
712
- }, customViewId && {
713
- 'x-custom-view-id': customViewId
714
- }), {}, {
715
- 'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
716
- })
717
- });
718
- return userOrganizations.myOrganizations;
719
- };
720
-
721
- const credentialsStorage = new credentialsStorage$2.CredentialsStorage();
534
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
722
535
  const getMcUrlLink = _ref => {
723
536
  var _context, _context2, _context3;
724
537
  let mcApiUrl = _ref.mcApiUrl,
@@ -736,14 +549,14 @@ async function createOrUpdateCustomApplication(_ref2) {
736
549
  localCustomEntityData = _ref2.localCustomEntityData,
737
550
  applicationIdentifier = _ref2.applicationIdentifier,
738
551
  options = _ref2.options;
739
- const fetchedCustomApplication = await fetchCustomApplication({
552
+ const fetchedCustomApplication = await graphqlRequests.fetchCustomApplication({
740
553
  mcApiUrl,
741
554
  entryPointUriPath: localCustomEntityData.entryPointUriPath,
742
555
  applicationIdentifier
743
556
  });
744
557
  if (!fetchedCustomApplication) {
745
558
  var _context5;
746
- const userOrganizations = await fetchUserOrganizations({
559
+ const userOrganizations = await graphqlRequests.fetchUserOrganizations({
747
560
  mcApiUrl,
748
561
  applicationIdentifier
749
562
  });
@@ -798,7 +611,7 @@ async function createOrUpdateCustomApplication(_ref2) {
798
611
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
799
612
  return;
800
613
  }
801
- const createdCustomApplication = await createCustomApplication({
614
+ const createdCustomApplication = await graphqlRequests.createCustomApplication({
802
615
  mcApiUrl,
803
616
  organizationId,
804
617
  data,
@@ -854,7 +667,7 @@ async function createOrUpdateCustomApplication(_ref2) {
854
667
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
855
668
  return;
856
669
  }
857
- await updateCustomApplication({
670
+ await graphqlRequests.updateCustomApplication({
858
671
  mcApiUrl,
859
672
  organizationId: fetchedCustomApplication.organizationId,
860
673
  data: omit__default["default"](localCustomEntityData, ['id']),
@@ -871,14 +684,14 @@ async function createOrUpdateCustomView(_ref4) {
871
684
  customViewId = _ref4.customViewId,
872
685
  options = _ref4.options,
873
686
  applicationIdentifier = _ref4.applicationIdentifier;
874
- const fetchedCustomView = await fetchCustomView({
687
+ const fetchedCustomView = await graphqlRequests.fetchCustomView({
875
688
  mcApiUrl,
876
689
  customViewId,
877
690
  applicationIdentifier
878
691
  });
879
692
  if (!fetchedCustomView) {
880
693
  var _context8;
881
- const userOrganizations = await fetchUserOrganizations({
694
+ const userOrganizations = await graphqlRequests.fetchUserOrganizations({
882
695
  mcApiUrl,
883
696
  customViewId,
884
697
  applicationIdentifier
@@ -934,7 +747,7 @@ async function createOrUpdateCustomView(_ref4) {
934
747
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
935
748
  return;
936
749
  }
937
- const createdCustomView = await createCustomView({
750
+ const createdCustomView = await graphqlRequests.createCustomView({
938
751
  mcApiUrl,
939
752
  organizationId,
940
753
  data,
@@ -992,7 +805,7 @@ async function createOrUpdateCustomView(_ref4) {
992
805
  console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
993
806
  return;
994
807
  }
995
- await updateCustomView({
808
+ await graphqlRequests.updateCustomView({
996
809
  mcApiUrl,
997
810
  organizationId: fetchedCustomView.organizationId,
998
811
  data: omit__default["default"](localCustomEntityData, ['id']),