@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.
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-62792a03.cjs.prod.js} +4 -5
  5. package/dist/{build-5fa51b8c.esm.js → build-66dc70af.esm.js} +4 -5
  6. package/dist/{build-999eabc6.cjs.dev.js → build-e3be9274.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-3c396d96.cjs.dev.js} +21 -208
  14. package/dist/{config-sync-cabd5374.esm.js → config-sync-98db26e7.esm.js} +12 -198
  15. package/dist/{config-sync-97ba72f5.cjs.prod.js → config-sync-b4656190.cjs.prod.js} +21 -208
  16. package/dist/{create-postcss-config-069ef9c3.cjs.prod.js → create-postcss-config-12b7a8d6.cjs.prod.js} +1 -1
  17. package/dist/{create-postcss-config-5d1737f0.cjs.dev.js → create-postcss-config-f7a8f441.cjs.dev.js} +1 -1
  18. package/dist/{create-postcss-config-0323c669.esm.js → create-postcss-config-fba058e4.esm.js} +1 -1
  19. package/dist/{create-webpack-config-for-development-43c88bf6.esm.js → create-webpack-config-for-development-5b46add2.esm.js} +1 -1
  20. package/dist/{create-webpack-config-for-development-e7733a1b.cjs.prod.js → create-webpack-config-for-development-ab714b8d.cjs.prod.js} +1 -1
  21. package/dist/{create-webpack-config-for-development-4690f4cf.cjs.dev.js → create-webpack-config-for-development-fb65e8be.cjs.dev.js} +1 -1
  22. package/dist/{create-webpack-config-for-production-778d2b5e.cjs.dev.js → create-webpack-config-for-production-167f752a.cjs.dev.js} +2 -2
  23. package/dist/{create-webpack-config-for-production-28d51113.esm.js → create-webpack-config-for-production-6125de30.esm.js} +2 -2
  24. package/dist/{create-webpack-config-for-production-cbf22a83.cjs.prod.js → create-webpack-config-for-production-959fa22b.cjs.prod.js} +2 -2
  25. package/dist/{credentials-storage-f4e08e09.esm.js → credentials-storage-0b44c17e.esm.js} +1 -1
  26. package/dist/{credentials-storage-0fb8f4a6.cjs.prod.js → credentials-storage-4222b4e8.cjs.prod.js} +1 -1
  27. package/dist/{credentials-storage-8b9ddb0b.cjs.dev.js → credentials-storage-94fe55f8.cjs.dev.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-848a1bf9.esm.js +197 -0
  34. package/dist/deployment-previews-set-dc99dc5c.cjs.dev.js +209 -0
  35. package/dist/deployment-previews-set-ee78c1da.cjs.prod.js +209 -0
  36. package/dist/graphql-requests-734ca08d.cjs.prod.js +269 -0
  37. package/dist/graphql-requests-9f05bdac.cjs.dev.js +269 -0
  38. package/dist/graphql-requests-ffd9c148.esm.js +246 -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-8a734416.cjs.dev.js} +2 -2
  43. package/dist/{login-90029738.esm.js → login-933238a2.esm.js} +2 -2
  44. package/dist/{login-9ee301cd.cjs.prod.js → login-db3ba9ca.cjs.prod.js} +2 -2
  45. package/dist/{package-1bf866e8.cjs.dev.js → package-2e7a3b2c.cjs.prod.js} +12 -12
  46. package/dist/{package-d977cdc9.cjs.prod.js → package-5c8e1e42.cjs.dev.js} +12 -12
  47. package/dist/{package-50be39f9.esm.js → package-61d870ab.esm.js} +12 -12
  48. package/dist/{start-a0031945.cjs.prod.js → start-27e158a1.cjs.prod.js} +3 -3
  49. package/dist/{start-4671c540.esm.js → start-2c0c7162.esm.js} +3 -3
  50. package/dist/{start-54be934f.cjs.dev.js → start-336282f7.cjs.dev.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
@@ -0,0 +1,269 @@
1
+ 'use strict';
2
+
3
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
4
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
5
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
7
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
9
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
12
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
13
+ var chalk = require('chalk');
14
+ var graphql = require('graphql');
15
+ var graphqlRequest = require('graphql-request');
16
+ var constants = require('@commercetools-frontend/constants');
17
+ var credentialsStorage$1 = require('./credentials-storage-94fe55f8.cjs.dev.js');
18
+
19
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
20
+
21
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
22
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
23
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
24
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
25
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
26
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
27
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
28
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
29
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
30
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
31
+
32
+ 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; }
33
+ 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; }
34
+ var CreateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomApplicationDeploymentPreview" }, 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: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewCreateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }, { 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: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 327, source: { body: "mutation CreateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $applicationId: ID!\n $data: CustomApplicationDeploymentPreviewCreateInput!\n) {\n createCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n applicationId: $applicationId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
35
+ 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 } } } };
36
+ 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 } } } };
37
+ 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: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "deployments" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 712, 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 deployments {\n id\n url\n alias\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
38
+ 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 } } } };
39
+ 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 } } } };
40
+ var UpdateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationDeploymentPreview" }, 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: "deploymentId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewUpdateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "deploymentId" }, value: { kind: "Variable", name: { kind: "Name", value: "deploymentId" } } }, { 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: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 324, source: { body: "mutation UpdateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $deploymentId: ID!\n $data: CustomApplicationDeploymentPreviewUpdateInput!\n) {\n updateCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n deploymentId: $deploymentId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
41
+ 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 } } } };
42
+ 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 } } } };
43
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
44
+ async function requestWithTokenRetry(document, requestOptions) {
45
+ let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
46
+ const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
47
+ const client = new graphqlRequest.GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
48
+ headers: _objectSpread(_objectSpread({
49
+ Accept: 'application/json',
50
+ 'Content-Type': 'application/json',
51
+ 'x-user-agent': credentialsStorage$1.userAgent
52
+ }, token ? {
53
+ 'x-mc-cli-access-token': token
54
+ } : {}), requestOptions.headers)
55
+ });
56
+ try {
57
+ const result = await client.rawRequest(graphql.print(document), requestOptions.variables);
58
+
59
+ // In case a new session token is returned from the server, save it.
60
+ const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
61
+ if (refreshedSessionToken) {
62
+ console.log(chalk__default["default"].green('Session token refreshed.'));
63
+ console.log();
64
+ const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
65
+ // Store the updated access token.
66
+ credentialsStorage.setToken(requestOptions.mcApiUrl, {
67
+ token: refreshedSessionToken,
68
+ expiresAt: Number(refreshedSessionTokenExpiresAt)
69
+ });
70
+ }
71
+ return result.data;
72
+ } catch (error) {
73
+ if (error instanceof graphqlRequest.ClientError) {
74
+ // If it's an unauthorized error, retry the request to force the token to be refreshed.
75
+ if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
76
+ var _context;
77
+ const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => {
78
+ var _graphqlError$extensi;
79
+ return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
80
+ });
81
+ if (isUnauthorizedError) {
82
+ console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
83
+ return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
84
+ headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
85
+ 'X-Force-Token': 'true'
86
+ })
87
+ }), retryCount + 1);
88
+ }
89
+ }
90
+ }
91
+ throw error;
92
+ }
93
+ }
94
+ const fetchCustomApplication = async _ref => {
95
+ let mcApiUrl = _ref.mcApiUrl,
96
+ entryPointUriPath = _ref.entryPointUriPath,
97
+ applicationIdentifier = _ref.applicationIdentifier;
98
+ const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
99
+ variables: {
100
+ entryPointUriPath
101
+ },
102
+ mcApiUrl,
103
+ headers: {
104
+ 'x-application-id': applicationIdentifier,
105
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
106
+ }
107
+ });
108
+ return customAppData.organizationExtensionForCustomApplication;
109
+ };
110
+ const fetchCustomView = async _ref2 => {
111
+ let mcApiUrl = _ref2.mcApiUrl,
112
+ customViewId = _ref2.customViewId,
113
+ applicationIdentifier = _ref2.applicationIdentifier;
114
+ const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
115
+ variables: {
116
+ customViewId
117
+ },
118
+ mcApiUrl,
119
+ headers: {
120
+ 'x-custom-view-id': customViewId,
121
+ 'x-application-id': applicationIdentifier,
122
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
123
+ }
124
+ });
125
+ return customViewData.organizationExtensionForCustomView;
126
+ };
127
+ const updateCustomApplication = async _ref3 => {
128
+ let mcApiUrl = _ref3.mcApiUrl,
129
+ applicationId = _ref3.applicationId,
130
+ organizationId = _ref3.organizationId,
131
+ data = _ref3.data,
132
+ applicationIdentifier = _ref3.applicationIdentifier;
133
+ const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
134
+ variables: {
135
+ organizationId,
136
+ applicationId,
137
+ data
138
+ },
139
+ mcApiUrl,
140
+ headers: {
141
+ 'x-application-id': applicationIdentifier,
142
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
143
+ }
144
+ });
145
+ return updatedCustomAppsData.updateCustomApplication;
146
+ };
147
+ const updateCustomView = async _ref4 => {
148
+ let mcApiUrl = _ref4.mcApiUrl,
149
+ organizationId = _ref4.organizationId,
150
+ data = _ref4.data,
151
+ customViewId = _ref4.customViewId,
152
+ applicationIdentifier = _ref4.applicationIdentifier;
153
+ const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
154
+ variables: {
155
+ organizationId,
156
+ customViewId,
157
+ data
158
+ },
159
+ mcApiUrl,
160
+ headers: {
161
+ 'x-custom-view-id': customViewId,
162
+ 'x-application-id': applicationIdentifier,
163
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
164
+ }
165
+ });
166
+ return updatedCustomViewData.updateCustomView;
167
+ };
168
+ const createCustomApplication = async _ref5 => {
169
+ let mcApiUrl = _ref5.mcApiUrl,
170
+ organizationId = _ref5.organizationId,
171
+ data = _ref5.data,
172
+ applicationIdentifier = _ref5.applicationIdentifier;
173
+ const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
174
+ variables: {
175
+ organizationId,
176
+ data
177
+ },
178
+ mcApiUrl,
179
+ headers: {
180
+ 'x-application-id': applicationIdentifier,
181
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
182
+ }
183
+ });
184
+ return createdCustomAppData.createCustomApplication;
185
+ };
186
+ const createCustomView = async _ref6 => {
187
+ let mcApiUrl = _ref6.mcApiUrl,
188
+ organizationId = _ref6.organizationId,
189
+ data = _ref6.data,
190
+ applicationIdentifier = _ref6.applicationIdentifier;
191
+ const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
192
+ variables: {
193
+ organizationId,
194
+ data
195
+ },
196
+ mcApiUrl,
197
+ headers: {
198
+ 'x-application-id': applicationIdentifier,
199
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
200
+ }
201
+ });
202
+ return createdCustomViewData.createCustomView;
203
+ };
204
+ const fetchUserOrganizations = async _ref7 => {
205
+ let mcApiUrl = _ref7.mcApiUrl,
206
+ applicationIdentifier = _ref7.applicationIdentifier,
207
+ customViewId = _ref7.customViewId;
208
+ const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
209
+ mcApiUrl,
210
+ headers: _objectSpread(_objectSpread({
211
+ 'x-application-id': applicationIdentifier
212
+ }, customViewId && {
213
+ 'x-custom-view-id': customViewId
214
+ }), {}, {
215
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
216
+ })
217
+ });
218
+ return userOrganizations.myOrganizations;
219
+ };
220
+ const createCustomApplicationDeploymentPreview = async _ref8 => {
221
+ let mcApiUrl = _ref8.mcApiUrl,
222
+ organizationId = _ref8.organizationId,
223
+ applicationId = _ref8.applicationId,
224
+ applicationIdentifier = _ref8.applicationIdentifier,
225
+ data = _ref8.data;
226
+ const createdDeploymentPreviewResult = await requestWithTokenRetry(CreateCustomApplicationDeploymentPreviewFromCli, {
227
+ variables: {
228
+ organizationId,
229
+ applicationId,
230
+ data
231
+ },
232
+ mcApiUrl,
233
+ headers: {
234
+ 'x-application-id': applicationIdentifier,
235
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
236
+ }
237
+ });
238
+ return createdDeploymentPreviewResult.createCustomApplicationDeploymentPreview;
239
+ };
240
+ const updateCustomApplicationDeploymentPreview = async _ref9 => {
241
+ let mcApiUrl = _ref9.mcApiUrl,
242
+ organizationId = _ref9.organizationId,
243
+ deploymentId = _ref9.deploymentId,
244
+ data = _ref9.data,
245
+ applicationIdentifier = _ref9.applicationIdentifier;
246
+ const updatedDeploymentPreviewResult = await requestWithTokenRetry(UpdateCustomApplicationDeploymentPreviewFromCli, {
247
+ variables: {
248
+ organizationId,
249
+ deploymentId,
250
+ data
251
+ },
252
+ mcApiUrl,
253
+ headers: {
254
+ 'x-application-id': applicationIdentifier,
255
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
256
+ }
257
+ });
258
+ return updatedDeploymentPreviewResult.updateCustomApplicationDeploymentPreview;
259
+ };
260
+
261
+ exports.createCustomApplication = createCustomApplication;
262
+ exports.createCustomApplicationDeploymentPreview = createCustomApplicationDeploymentPreview;
263
+ exports.createCustomView = createCustomView;
264
+ exports.fetchCustomApplication = fetchCustomApplication;
265
+ exports.fetchCustomView = fetchCustomView;
266
+ exports.fetchUserOrganizations = fetchUserOrganizations;
267
+ exports.updateCustomApplication = updateCustomApplication;
268
+ exports.updateCustomApplicationDeploymentPreview = updateCustomApplicationDeploymentPreview;
269
+ exports.updateCustomView = updateCustomView;
@@ -0,0 +1,246 @@
1
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
5
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
6
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
7
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
+ import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
11
+ import chalk from 'chalk';
12
+ import { print } from 'graphql';
13
+ import { GraphQLClient, ClientError } from 'graphql-request';
14
+ import { GRAPHQL_TARGETS } from '@commercetools-frontend/constants';
15
+ import { C as CredentialsStorage, u as userAgent } from './credentials-storage-0b44c17e.esm.js';
16
+
17
+ 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; }
18
+ 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; }
19
+ var CreateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomApplicationDeploymentPreview" }, 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: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewCreateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }, { 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: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 327, source: { body: "mutation CreateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $applicationId: ID!\n $data: CustomApplicationDeploymentPreviewCreateInput!\n) {\n createCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n applicationId: $applicationId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
20
+ 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 } } } };
21
+ 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 } } } };
22
+ 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: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "deployments" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 712, 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 deployments {\n id\n url\n alias\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
23
+ 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 } } } };
24
+ 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 } } } };
25
+ var UpdateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationDeploymentPreview" }, 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: "deploymentId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewUpdateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "deploymentId" }, value: { kind: "Variable", name: { kind: "Name", value: "deploymentId" } } }, { 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: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 324, source: { body: "mutation UpdateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $deploymentId: ID!\n $data: CustomApplicationDeploymentPreviewUpdateInput!\n) {\n updateCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n deploymentId: $deploymentId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
26
+ 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 } } } };
27
+ 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 } } } };
28
+ const credentialsStorage = new CredentialsStorage();
29
+ async function requestWithTokenRetry(document, requestOptions) {
30
+ let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
31
+ const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
32
+ const client = new GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
33
+ headers: _objectSpread(_objectSpread({
34
+ Accept: 'application/json',
35
+ 'Content-Type': 'application/json',
36
+ 'x-user-agent': userAgent
37
+ }, token ? {
38
+ 'x-mc-cli-access-token': token
39
+ } : {}), requestOptions.headers)
40
+ });
41
+ try {
42
+ const result = await client.rawRequest(print(document), requestOptions.variables);
43
+
44
+ // In case a new session token is returned from the server, save it.
45
+ const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
46
+ if (refreshedSessionToken) {
47
+ console.log(chalk.green('Session token refreshed.'));
48
+ console.log();
49
+ const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
50
+ // Store the updated access token.
51
+ credentialsStorage.setToken(requestOptions.mcApiUrl, {
52
+ token: refreshedSessionToken,
53
+ expiresAt: Number(refreshedSessionTokenExpiresAt)
54
+ });
55
+ }
56
+ return result.data;
57
+ } catch (error) {
58
+ if (error instanceof ClientError) {
59
+ // If it's an unauthorized error, retry the request to force the token to be refreshed.
60
+ if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
61
+ var _context;
62
+ const isUnauthorizedError = _someInstanceProperty(_context = error.response.errors).call(_context, graphqlError => {
63
+ var _graphqlError$extensi;
64
+ return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
65
+ });
66
+ if (isUnauthorizedError) {
67
+ console.log(chalk.yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
68
+ return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
69
+ headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
70
+ 'X-Force-Token': 'true'
71
+ })
72
+ }), retryCount + 1);
73
+ }
74
+ }
75
+ }
76
+ throw error;
77
+ }
78
+ }
79
+ const fetchCustomApplication = async _ref => {
80
+ let mcApiUrl = _ref.mcApiUrl,
81
+ entryPointUriPath = _ref.entryPointUriPath,
82
+ applicationIdentifier = _ref.applicationIdentifier;
83
+ const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
84
+ variables: {
85
+ entryPointUriPath
86
+ },
87
+ mcApiUrl,
88
+ headers: {
89
+ 'x-application-id': applicationIdentifier,
90
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
91
+ }
92
+ });
93
+ return customAppData.organizationExtensionForCustomApplication;
94
+ };
95
+ const fetchCustomView = async _ref2 => {
96
+ let mcApiUrl = _ref2.mcApiUrl,
97
+ customViewId = _ref2.customViewId,
98
+ applicationIdentifier = _ref2.applicationIdentifier;
99
+ const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
100
+ variables: {
101
+ customViewId
102
+ },
103
+ mcApiUrl,
104
+ headers: {
105
+ 'x-custom-view-id': customViewId,
106
+ 'x-application-id': applicationIdentifier,
107
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
108
+ }
109
+ });
110
+ return customViewData.organizationExtensionForCustomView;
111
+ };
112
+ const updateCustomApplication = async _ref3 => {
113
+ let mcApiUrl = _ref3.mcApiUrl,
114
+ applicationId = _ref3.applicationId,
115
+ organizationId = _ref3.organizationId,
116
+ data = _ref3.data,
117
+ applicationIdentifier = _ref3.applicationIdentifier;
118
+ const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
119
+ variables: {
120
+ organizationId,
121
+ applicationId,
122
+ data
123
+ },
124
+ mcApiUrl,
125
+ headers: {
126
+ 'x-application-id': applicationIdentifier,
127
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
128
+ }
129
+ });
130
+ return updatedCustomAppsData.updateCustomApplication;
131
+ };
132
+ const updateCustomView = async _ref4 => {
133
+ let mcApiUrl = _ref4.mcApiUrl,
134
+ organizationId = _ref4.organizationId,
135
+ data = _ref4.data,
136
+ customViewId = _ref4.customViewId,
137
+ applicationIdentifier = _ref4.applicationIdentifier;
138
+ const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
139
+ variables: {
140
+ organizationId,
141
+ customViewId,
142
+ data
143
+ },
144
+ mcApiUrl,
145
+ headers: {
146
+ 'x-custom-view-id': customViewId,
147
+ 'x-application-id': applicationIdentifier,
148
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
149
+ }
150
+ });
151
+ return updatedCustomViewData.updateCustomView;
152
+ };
153
+ const createCustomApplication = async _ref5 => {
154
+ let mcApiUrl = _ref5.mcApiUrl,
155
+ organizationId = _ref5.organizationId,
156
+ data = _ref5.data,
157
+ applicationIdentifier = _ref5.applicationIdentifier;
158
+ const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
159
+ variables: {
160
+ organizationId,
161
+ data
162
+ },
163
+ mcApiUrl,
164
+ headers: {
165
+ 'x-application-id': applicationIdentifier,
166
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
167
+ }
168
+ });
169
+ return createdCustomAppData.createCustomApplication;
170
+ };
171
+ const createCustomView = async _ref6 => {
172
+ let mcApiUrl = _ref6.mcApiUrl,
173
+ organizationId = _ref6.organizationId,
174
+ data = _ref6.data,
175
+ applicationIdentifier = _ref6.applicationIdentifier;
176
+ const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
177
+ variables: {
178
+ organizationId,
179
+ data
180
+ },
181
+ mcApiUrl,
182
+ headers: {
183
+ 'x-application-id': applicationIdentifier,
184
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
185
+ }
186
+ });
187
+ return createdCustomViewData.createCustomView;
188
+ };
189
+ const fetchUserOrganizations = async _ref7 => {
190
+ let mcApiUrl = _ref7.mcApiUrl,
191
+ applicationIdentifier = _ref7.applicationIdentifier,
192
+ customViewId = _ref7.customViewId;
193
+ const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
194
+ mcApiUrl,
195
+ headers: _objectSpread(_objectSpread({
196
+ 'x-application-id': applicationIdentifier
197
+ }, customViewId && {
198
+ 'x-custom-view-id': customViewId
199
+ }), {}, {
200
+ 'x-graphql-target': GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
201
+ })
202
+ });
203
+ return userOrganizations.myOrganizations;
204
+ };
205
+ const createCustomApplicationDeploymentPreview = async _ref8 => {
206
+ let mcApiUrl = _ref8.mcApiUrl,
207
+ organizationId = _ref8.organizationId,
208
+ applicationId = _ref8.applicationId,
209
+ applicationIdentifier = _ref8.applicationIdentifier,
210
+ data = _ref8.data;
211
+ const createdDeploymentPreviewResult = await requestWithTokenRetry(CreateCustomApplicationDeploymentPreviewFromCli, {
212
+ variables: {
213
+ organizationId,
214
+ applicationId,
215
+ data
216
+ },
217
+ mcApiUrl,
218
+ headers: {
219
+ 'x-application-id': applicationIdentifier,
220
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
221
+ }
222
+ });
223
+ return createdDeploymentPreviewResult.createCustomApplicationDeploymentPreview;
224
+ };
225
+ const updateCustomApplicationDeploymentPreview = async _ref9 => {
226
+ let mcApiUrl = _ref9.mcApiUrl,
227
+ organizationId = _ref9.organizationId,
228
+ deploymentId = _ref9.deploymentId,
229
+ data = _ref9.data,
230
+ applicationIdentifier = _ref9.applicationIdentifier;
231
+ const updatedDeploymentPreviewResult = await requestWithTokenRetry(UpdateCustomApplicationDeploymentPreviewFromCli, {
232
+ variables: {
233
+ organizationId,
234
+ deploymentId,
235
+ data
236
+ },
237
+ mcApiUrl,
238
+ headers: {
239
+ 'x-application-id': applicationIdentifier,
240
+ 'x-graphql-target': GRAPHQL_TARGETS.SETTINGS_SERVICE
241
+ }
242
+ });
243
+ return updatedDeploymentPreviewResult.updateCustomApplicationDeploymentPreview;
244
+ };
245
+
246
+ export { fetchUserOrganizations as a, fetchCustomView as b, createCustomApplication as c, createCustomView as d, updateCustomView as e, fetchCustomApplication as f, updateCustomApplicationDeploymentPreview as g, createCustomApplicationDeploymentPreview as h, updateCustomApplication as u };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
4
+ var chalk = require('chalk');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
7
+
8
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
9
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
10
+
11
+ function getI18nMessageFormat(source) {
12
+ const messageContents = JSON.parse(source);
13
+ const firstValue = _Object$values__default["default"](messageContents)[0];
14
+ return typeof firstValue === 'string' ? 'simple' : 'transifex';
15
+ }
16
+ function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
17
+ if (!process.env.CI) {
18
+ warnFunction(new Error("[i18n message compilation] Message compilation on ".concat(fileIdentifier, " has failed.\n") + "Consider setting the environmental variable ".concat(chalk__default["default"].yellow('DISABLE_I18N_MESSAGE_COMPILATION'), " to true to disable the message loader or resolve the issues on the messages file.\n") + "".concat(error instanceof Error ? "Error: ".concat(error.message) : '')));
19
+ }
20
+ }
21
+
22
+ exports.getI18nMessageFormat = getI18nMessageFormat;
23
+ exports.handleMessageCompilationError = handleMessageCompilationError;