@webiny/app-headless-cms 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.ecd8734205

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 (31) hide show
  1. package/admin/plugins/install.js +3 -39
  2. package/admin/plugins/install.js.map +1 -1
  3. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js +17 -3
  4. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js.map +1 -1
  5. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js +16 -3
  6. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js.map +1 -1
  7. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js +8 -0
  8. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js.map +1 -1
  9. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js +6 -0
  10. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js.map +1 -1
  11. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js +7 -0
  12. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js.map +1 -1
  13. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js +6 -0
  14. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js.map +1 -1
  15. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js +101 -72
  16. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js.map +1 -1
  17. package/admin/plugins/upgrades/5.33.0/locales.js +42 -25
  18. package/admin/plugins/upgrades/5.33.0/locales.js.map +1 -1
  19. package/admin/plugins/upgrades/5.33.0/upgrade.js +56 -34
  20. package/admin/plugins/upgrades/5.33.0/upgrade.js.map +1 -1
  21. package/admin/plugins/upgrades/v5.0.0.js +57 -28
  22. package/admin/plugins/upgrades/v5.0.0.js.map +1 -1
  23. package/admin/plugins/upgrades/v5.19.0.js +480 -334
  24. package/admin/plugins/upgrades/v5.19.0.js.map +1 -1
  25. package/admin/plugins/upgrades/v5.33.0.js +45 -16
  26. package/admin/plugins/upgrades/v5.33.0.js.map +1 -1
  27. package/admin/plugins/upgrades/v5.5.0.js +57 -28
  28. package/admin/plugins/upgrades/v5.5.0.js.map +1 -1
  29. package/admin/plugins/upgrades/v5.8.0.js +57 -28
  30. package/admin/plugins/upgrades/v5.8.0.js.map +1 -1
  31. package/package.json +18 -19
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
10
9
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
11
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
14
- var _react = _interopRequireWildcard3(require("react"));
13
+ var _react = _interopRequireWildcard(require("react"));
15
14
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
16
15
  var _reactHooks = require("@apollo/react-hooks");
17
16
  var _i18n = require("@webiny/app/i18n");
@@ -110,42 +109,7 @@ var plugin = {
110
109
  return /*#__PURE__*/_react.default.createElement(CMSInstaller, {
111
110
  onInstalled: onInstalled
112
111
  });
113
- },
114
- upgrades: [
115
- // {
116
- // version: "5.0.0",
117
- // getComponent() {
118
- // return lazy(() => import("./upgrades/v5.0.0"));
119
- // }
120
- // },
121
- // {
122
- // version: "5.5.0",
123
- // getComponent() {
124
- // return lazy(() => import("./upgrades/v5.5.0"));
125
- // }
126
- // },
127
- // {
128
- // version: "5.8.0",
129
- // getComponent() {
130
- // return lazy(() => import("./upgrades/v5.8.0"));
131
- // }
132
- // },
133
- // {
134
- // version: "5.19.0",
135
- // getComponent() {
136
- // return lazy(() => import("./upgrades/v5.19.0"));
137
- // }
138
- // }
139
- {
140
- version: "5.33.0",
141
- getComponent: function getComponent() {
142
- return /*#__PURE__*/(0, _react.lazy)(function () {
143
- return Promise.resolve().then(function () {
144
- return (0, _interopRequireWildcard2.default)(require("./upgrades/v5.33.0"));
145
- });
146
- });
147
- }
148
- }]
112
+ }
149
113
  };
150
114
  var _default = plugin;
151
115
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["SimpleFormPlaceholder","styled","minHeight","minWidth","t","i18n","ns","IS_INSTALLED","gql","INSTALL","CMSInstaller","onInstalled","client","useApolloClient","useState","error","setError","useEffect","setTimeout","mutate","mutation","then","result","data","cms","install","message","label","plugin","name","type","title","dependencies","secure","getInstalledVersion","query","version","render","upgrades","getComponent","lazy"],"sources":["install.tsx"],"sourcesContent":["import React, { useState, useEffect, lazy } from \"react\";\nimport gql from \"graphql-tag\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { SimpleForm, SimpleFormContent } from \"@webiny/app-admin/components/SimpleForm\";\nimport styled from \"@emotion/styled\";\nimport { AdminInstallationPlugin } from \"@webiny/app-admin/types\";\nimport { CmsErrorResponse } from \"~/types\";\n\nconst SimpleFormPlaceholder = styled.div({\n minHeight: 300,\n minWidth: 400\n});\n\nconst t = i18n.ns(\"app-headless-cms/admin/installation\");\n/**\n * ########################\n * Is Installed Query\n */\nexport interface CmsIsInstalledQueryResponse {\n cms: {\n version: string | null;\n };\n}\nconst IS_INSTALLED = gql`\n query IsCMSInstalled {\n cms {\n version\n }\n }\n`;\n/**\n * ########################\n * Install Mutation\n */\nexport interface CmsInstallMutationResponse {\n cms: {\n install: {\n data: boolean;\n error?: CmsErrorResponse;\n };\n };\n}\nconst INSTALL = gql`\n mutation InstallCms {\n cms {\n install {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\ninterface CMSInstallerProps {\n onInstalled: () => void;\n}\nconst CMSInstaller: React.FC<CMSInstallerProps> = ({ onInstalled }) => {\n const client = useApolloClient();\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n // Temporary fix for the ES index creation failure.\n // Let's try waiting a bit before running the installation.\n setTimeout(() => {\n client\n .mutate<CmsInstallMutationResponse>({\n mutation: INSTALL\n })\n .then(result => {\n if (!result || !result.data) {\n setError(\"Missing Install Mutation response data.\");\n return;\n }\n const { error } = result.data.cms.install;\n if (error) {\n setError(error.message);\n return;\n }\n\n // Just so the user sees the actual message.\n setTimeout(onInstalled, 3000);\n });\n }, 10000);\n }, []);\n\n const label = error ? (\n <Alert title={t`Something went wrong`} type={\"danger\"}>\n {error}\n </Alert>\n ) : (\n t`Installing Headless CMS...`\n );\n\n return (\n <SimpleForm>\n <CircularProgress label={label} />\n <SimpleFormContent>\n <SimpleFormPlaceholder />\n </SimpleFormContent>\n </SimpleForm>\n );\n};\n\nconst plugin: AdminInstallationPlugin = {\n name: \"admin-installation-cms\",\n type: \"admin-installation\",\n title: t`Headless CMS`,\n dependencies: [\n \"admin-installation-security\",\n \"admin-installation-i18n\",\n \"admin-installation-fm\"\n ],\n secure: true,\n async getInstalledVersion({ client }) {\n const { data } = await client.query<CmsIsInstalledQueryResponse>({ query: IS_INSTALLED });\n return data.cms.version;\n },\n render({ onInstalled }) {\n return <CMSInstaller onInstalled={onInstalled} />;\n },\n upgrades: [\n // {\n // version: \"5.0.0\",\n // getComponent() {\n // return lazy(() => import(\"./upgrades/v5.0.0\"));\n // }\n // },\n // {\n // version: \"5.5.0\",\n // getComponent() {\n // return lazy(() => import(\"./upgrades/v5.5.0\"));\n // }\n // },\n // {\n // version: \"5.8.0\",\n // getComponent() {\n // return lazy(() => import(\"./upgrades/v5.8.0\"));\n // }\n // },\n // {\n // version: \"5.19.0\",\n // getComponent() {\n // return lazy(() => import(\"./upgrades/v5.19.0\"));\n // }\n // }\n {\n version: \"5.33.0\",\n getComponent() {\n return lazy(() => import(\"./upgrades/v5.33.0\"));\n }\n }\n ]\n};\n\nexport default plugin;\n"],"mappings":"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"}
1
+ {"version":3,"names":["SimpleFormPlaceholder","styled","minHeight","minWidth","t","i18n","ns","IS_INSTALLED","gql","INSTALL","CMSInstaller","onInstalled","client","useApolloClient","useState","error","setError","useEffect","setTimeout","mutate","mutation","then","result","data","cms","install","message","label","plugin","name","type","title","dependencies","secure","getInstalledVersion","query","version","render"],"sources":["install.tsx"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport gql from \"graphql-tag\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { SimpleForm, SimpleFormContent } from \"@webiny/app-admin/components/SimpleForm\";\nimport styled from \"@emotion/styled\";\nimport { AdminInstallationPlugin } from \"@webiny/app-admin/types\";\nimport { CmsErrorResponse } from \"~/types\";\n\nconst SimpleFormPlaceholder = styled.div({\n minHeight: 300,\n minWidth: 400\n});\n\nconst t = i18n.ns(\"app-headless-cms/admin/installation\");\n/**\n * ########################\n * Is Installed Query\n */\nexport interface CmsIsInstalledQueryResponse {\n cms: {\n version: string | null;\n };\n}\nconst IS_INSTALLED = gql`\n query IsCMSInstalled {\n cms {\n version\n }\n }\n`;\n/**\n * ########################\n * Install Mutation\n */\nexport interface CmsInstallMutationResponse {\n cms: {\n install: {\n data: boolean;\n error?: CmsErrorResponse;\n };\n };\n}\nconst INSTALL = gql`\n mutation InstallCms {\n cms {\n install {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\ninterface CMSInstallerProps {\n onInstalled: () => void;\n}\nconst CMSInstaller: React.FC<CMSInstallerProps> = ({ onInstalled }) => {\n const client = useApolloClient();\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n // Temporary fix for the ES index creation failure.\n // Let's try waiting a bit before running the installation.\n setTimeout(() => {\n client\n .mutate<CmsInstallMutationResponse>({\n mutation: INSTALL\n })\n .then(result => {\n if (!result || !result.data) {\n setError(\"Missing Install Mutation response data.\");\n return;\n }\n const { error } = result.data.cms.install;\n if (error) {\n setError(error.message);\n return;\n }\n\n // Just so the user sees the actual message.\n setTimeout(onInstalled, 3000);\n });\n }, 10000);\n }, []);\n\n const label = error ? (\n <Alert title={t`Something went wrong`} type={\"danger\"}>\n {error}\n </Alert>\n ) : (\n t`Installing Headless CMS...`\n );\n\n return (\n <SimpleForm>\n <CircularProgress label={label} />\n <SimpleFormContent>\n <SimpleFormPlaceholder />\n </SimpleFormContent>\n </SimpleForm>\n );\n};\n\nconst plugin: AdminInstallationPlugin = {\n name: \"admin-installation-cms\",\n type: \"admin-installation\",\n title: t`Headless CMS`,\n dependencies: [\n \"admin-installation-security\",\n \"admin-installation-i18n\",\n \"admin-installation-fm\"\n ],\n secure: true,\n async getInstalledVersion({ client }) {\n const { data } = await client.query<CmsIsInstalledQueryResponse>({ query: IS_INSTALLED });\n return data.cms.version;\n },\n render({ onInstalled }) {\n return <CMSInstaller onInstalled={onInstalled} />;\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAqC;AAIrC,IAAMA,qBAAqB,oBAAGC,eAAM;EAAA;EAAA;AAAA,GAAK;EACrCC,SAAS,EAAE,GAAG;EACdC,QAAQ,EAAE;AACd,CAAC,CAAC;AAEF,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,qCAAqC,CAAC;AACxD;AACA;AACA;AACA;;AAMA,IAAMC,YAAY,OAAGC,mBAAG,wKAMvB;AACD;AACA;AACA;AACA;;AASA,IAAMC,OAAO,OAAGD,mBAAG,6UAalB;AAID,IAAME,YAAyC,GAAG,SAA5CA,YAAyC,OAAwB;EAAA,IAAlBC,WAAW,QAAXA,WAAW;EAC5D,IAAMC,MAAM,GAAG,IAAAC,2BAAe,GAAE;EAChC,gBAA0B,IAAAC,eAAQ,EAAgB,IAAI,CAAC;IAAA;IAAhDC,KAAK;IAAEC,QAAQ;EAEtB,IAAAC,gBAAS,EAAC,YAAM;IACZ;IACA;IACAC,UAAU,CAAC,YAAM;MACbN,MAAM,CACDO,MAAM,CAA6B;QAChCC,QAAQ,EAAEX;MACd,CAAC,CAAC,CACDY,IAAI,CAAC,UAAAC,MAAM,EAAI;QACZ,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,IAAI,EAAE;UACzBP,QAAQ,CAAC,yCAAyC,CAAC;UACnD;QACJ;QACA,IAAQD,KAAK,GAAKO,MAAM,CAACC,IAAI,CAACC,GAAG,CAACC,OAAO,CAAjCV,KAAK;QACb,IAAIA,KAAK,EAAE;UACPC,QAAQ,CAACD,KAAK,CAACW,OAAO,CAAC;UACvB;QACJ;;QAEA;QACAR,UAAU,CAACP,WAAW,EAAE,IAAI,CAAC;MACjC,CAAC,CAAC;IACV,CAAC,EAAE,KAAK,CAAC;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMgB,KAAK,GAAGZ,KAAK,gBACf,6BAAC,YAAK;IAAC,KAAK,EAAEX,CAAC,yGAAuB;IAAC,IAAI,EAAE;EAAS,GACjDW,KAAK,CACF,GAERX,CAAC,+GACJ;EAED,oBACI,6BAAC,sBAAU,qBACP,6BAAC,0BAAgB;IAAC,KAAK,EAAEuB;EAAM,EAAG,eAClC,6BAAC,6BAAiB,qBACd,6BAAC,qBAAqB,OAAG,CACT,CACX;AAErB,CAAC;AAED,IAAMC,MAA+B,GAAG;EACpCC,IAAI,EAAE,wBAAwB;EAC9BC,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE3B,CAAC,iGAAc;EACtB4B,YAAY,EAAE,CACV,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,CAC1B;EACDC,MAAM,EAAE,IAAI;EACNC,mBAAmB,sCAAa;IAAA;MAAA;MAAA;QAAA;UAAA;YAAVtB,MAAM,SAANA,MAAM;YAAA;YAAA,OACPA,MAAM,CAACuB,KAAK,CAA8B;cAAEA,KAAK,EAAE5B;YAAa,CAAC,CAAC;UAAA;YAAA;YAAjFgB,IAAI,uBAAJA,IAAI;YAAA,iCACLA,IAAI,CAACC,GAAG,CAACY,OAAO;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAC3B,CAAC;EACDC,MAAM,yBAAkB;IAAA,IAAf1B,WAAW,SAAXA,WAAW;IAChB,oBAAO,6BAAC,YAAY;MAAC,WAAW,EAAEA;IAAY,EAAG;EACrD;AACJ,CAAC;AAAC,eAEaiB,MAAM;AAAA"}
@@ -1,22 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.UpgradeItemsInfo = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _Typography = require("@webiny/ui/Typography");
13
+
10
14
  var findUpgradingModel = function findUpgradingModel(locales) {
11
15
  for (var locale in locales) {
12
16
  if (!locales[locale]) {
13
17
  continue;
14
18
  }
19
+
15
20
  var modelsData = Object.values(locales[locale]);
21
+
16
22
  for (var modelId in modelsData) {
17
23
  if (modelsData[modelId].upgrading !== true) {
18
24
  continue;
19
25
  }
26
+
20
27
  return {
21
28
  locale: locale,
22
29
  model: modelsData[modelId].model,
@@ -27,25 +34,32 @@ var findUpgradingModel = function findUpgradingModel(locales) {
27
34
  };
28
35
  }
29
36
  }
37
+
30
38
  return null;
31
39
  };
40
+
32
41
  var UpgradeItemsInfo = function UpgradeItemsInfo(props) {
33
42
  var upgradeItems = props.upgradeItems;
43
+
34
44
  if (!upgradeItems || upgradeItems.loadedModels !== true || !upgradeItems.locales) {
35
45
  return null;
36
46
  }
47
+
37
48
  var locales = upgradeItems.locales;
38
49
  var result = findUpgradingModel(locales);
50
+
39
51
  if (!result) {
40
52
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
41
53
  }
54
+
42
55
  var locale = result.locale,
43
- model = result.model,
44
- current = result.current,
45
- total = result.total;
56
+ model = result.model,
57
+ current = result.current,
58
+ total = result.total;
46
59
  return /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
47
60
  use: "body1",
48
61
  tag: "div"
49
62
  }, "Upgrading model ", /*#__PURE__*/_react.default.createElement("strong", null, model.name), " in locale ", /*#__PURE__*/_react.default.createElement("strong", null, locale), " (", current, " of ", total, " updated)");
50
63
  };
64
+
51
65
  exports.UpgradeItemsInfo = UpgradeItemsInfo;
@@ -1 +1 @@
1
- {"version":3,"names":["findUpgradingModel","locales","locale","modelsData","Object","values","modelId","upgrading","model","total","entries","length","current","filter","item","done","UpgradeItemsInfo","props","upgradeItems","loadedModels","result","name"],"sources":["UpgradeItemsInfo.tsx"],"sourcesContent":["import React from \"react\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { UpgradeItems } from \"./types\";\nimport { CmsEditorContentModel } from \"~/types\";\n\ninterface UpgradingModelResponse {\n model: CmsEditorContentModel;\n total: number;\n current: number;\n locale: string;\n}\nconst findUpgradingModel = (locales: UpgradeItems[\"locales\"]): UpgradingModelResponse | null => {\n for (const locale in locales) {\n if (!locales[locale]) {\n continue;\n }\n const modelsData = Object.values(locales[locale]);\n for (const modelId in modelsData) {\n if (modelsData[modelId].upgrading !== true) {\n continue;\n }\n return {\n locale,\n model: modelsData[modelId].model,\n total: modelsData[modelId].entries.length,\n current: modelsData[modelId].entries.filter(item => item.done).length\n };\n }\n }\n return null;\n};\n\ninterface UpgradeItemsInfoProps {\n upgradeItems: UpgradeItems | null;\n}\nexport const UpgradeItemsInfo: React.FC<UpgradeItemsInfoProps> = props => {\n const { upgradeItems } = props;\n if (!upgradeItems || upgradeItems.loadedModels !== true || !upgradeItems.locales) {\n return null;\n }\n const { locales } = upgradeItems;\n\n const result = findUpgradingModel(locales);\n if (!result) {\n return <></>;\n }\n const { locale, model, current, total } = result;\n return (\n <Typography use={\"body1\"} tag={\"div\"}>\n Upgrading model <strong>{model.name}</strong> in locale <strong>{locale}</strong> (\n {current} of {total} updated)\n </Typography>\n );\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAUA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIC,OAAgC,EAAoC;EAC5F,KAAK,IAAMC,MAAM,IAAID,OAAO,EAAE;IAC1B,IAAI,CAACA,OAAO,CAACC,MAAM,CAAC,EAAE;MAClB;IACJ;IACA,IAAMC,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACJ,OAAO,CAACC,MAAM,CAAC,CAAC;IACjD,KAAK,IAAMI,OAAO,IAAIH,UAAU,EAAE;MAC9B,IAAIA,UAAU,CAACG,OAAO,CAAC,CAACC,SAAS,KAAK,IAAI,EAAE;QACxC;MACJ;MACA,OAAO;QACHL,MAAM,EAANA,MAAM;QACNM,KAAK,EAAEL,UAAU,CAACG,OAAO,CAAC,CAACE,KAAK;QAChCC,KAAK,EAAEN,UAAU,CAACG,OAAO,CAAC,CAACI,OAAO,CAACC,MAAM;QACzCC,OAAO,EAAET,UAAU,CAACG,OAAO,CAAC,CAACI,OAAO,CAACG,MAAM,CAAC,UAAAC,IAAI;UAAA,OAAIA,IAAI,CAACC,IAAI;QAAA,EAAC,CAACJ;MACnE,CAAC;IACL;EACJ;EACA,OAAO,IAAI;AACf,CAAC;AAKM,IAAMK,gBAAiD,GAAG,SAApDA,gBAAiD,CAAGC,KAAK,EAAI;EACtE,IAAQC,YAAY,GAAKD,KAAK,CAAtBC,YAAY;EACpB,IAAI,CAACA,YAAY,IAAIA,YAAY,CAACC,YAAY,KAAK,IAAI,IAAI,CAACD,YAAY,CAACjB,OAAO,EAAE;IAC9E,OAAO,IAAI;EACf;EACA,IAAQA,OAAO,GAAKiB,YAAY,CAAxBjB,OAAO;EAEf,IAAMmB,MAAM,GAAGpB,kBAAkB,CAACC,OAAO,CAAC;EAC1C,IAAI,CAACmB,MAAM,EAAE;IACT,oBAAO,2DAAK;EAChB;EACA,IAAQlB,MAAM,GAA4BkB,MAAM,CAAxClB,MAAM;IAAEM,KAAK,GAAqBY,MAAM,CAAhCZ,KAAK;IAAEI,OAAO,GAAYQ,MAAM,CAAzBR,OAAO;IAAEH,KAAK,GAAKW,MAAM,CAAhBX,KAAK;EACrC,oBACI,6BAAC,sBAAU;IAAC,GAAG,EAAE,OAAQ;IAAC,GAAG,EAAE;EAAM,GAAC,kBAClB,4DAASD,KAAK,CAACa,IAAI,CAAU,eAAW,4DAASnB,MAAM,CAAU,MACjF,EAACU,OAAO,EAAC,MAAI,EAACH,KAAK,EAAC,WACxB,CAAa;AAErB,CAAC;AAAC"}
1
+ {"version":3,"names":["findUpgradingModel","locales","locale","modelsData","Object","values","modelId","upgrading","model","total","entries","length","current","filter","item","done","UpgradeItemsInfo","props","upgradeItems","loadedModels","result","name"],"sources":["UpgradeItemsInfo.tsx"],"sourcesContent":["import React from \"react\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { UpgradeItems } from \"./types\";\nimport { CmsEditorContentModel } from \"~/types\";\n\ninterface UpgradingModelResponse {\n model: CmsEditorContentModel;\n total: number;\n current: number;\n locale: string;\n}\nconst findUpgradingModel = (locales: UpgradeItems[\"locales\"]): UpgradingModelResponse | null => {\n for (const locale in locales) {\n if (!locales[locale]) {\n continue;\n }\n const modelsData = Object.values(locales[locale]);\n for (const modelId in modelsData) {\n if (modelsData[modelId].upgrading !== true) {\n continue;\n }\n return {\n locale,\n model: modelsData[modelId].model,\n total: modelsData[modelId].entries.length,\n current: modelsData[modelId].entries.filter(item => item.done).length\n };\n }\n }\n return null;\n};\n\ninterface UpgradeItemsInfoProps {\n upgradeItems: UpgradeItems | null;\n}\nexport const UpgradeItemsInfo: React.FC<UpgradeItemsInfoProps> = props => {\n const { upgradeItems } = props;\n if (!upgradeItems || upgradeItems.loadedModels !== true || !upgradeItems.locales) {\n return null;\n }\n const { locales } = upgradeItems;\n\n const result = findUpgradingModel(locales);\n if (!result) {\n return <></>;\n }\n const { locale, model, current, total } = result;\n return (\n <Typography use={\"body1\"} tag={\"div\"}>\n Upgrading model <strong>{model.name}</strong> in locale <strong>{locale}</strong> (\n {current} of {total} updated)\n </Typography>\n );\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAUA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,OAAD,EAAqE;EAC5F,KAAK,IAAMC,MAAX,IAAqBD,OAArB,EAA8B;IAC1B,IAAI,CAACA,OAAO,CAACC,MAAD,CAAZ,EAAsB;MAClB;IACH;;IACD,IAAMC,UAAU,GAAGC,MAAM,CAACC,MAAP,CAAcJ,OAAO,CAACC,MAAD,CAArB,CAAnB;;IACA,KAAK,IAAMI,OAAX,IAAsBH,UAAtB,EAAkC;MAC9B,IAAIA,UAAU,CAACG,OAAD,CAAV,CAAoBC,SAApB,KAAkC,IAAtC,EAA4C;QACxC;MACH;;MACD,OAAO;QACHL,MAAM,EAANA,MADG;QAEHM,KAAK,EAAEL,UAAU,CAACG,OAAD,CAAV,CAAoBE,KAFxB;QAGHC,KAAK,EAAEN,UAAU,CAACG,OAAD,CAAV,CAAoBI,OAApB,CAA4BC,MAHhC;QAIHC,OAAO,EAAET,UAAU,CAACG,OAAD,CAAV,CAAoBI,OAApB,CAA4BG,MAA5B,CAAmC,UAAAC,IAAI;UAAA,OAAIA,IAAI,CAACC,IAAT;QAAA,CAAvC,EAAsDJ;MAJ5D,CAAP;IAMH;EACJ;;EACD,OAAO,IAAP;AACH,CAnBD;;AAwBO,IAAMK,gBAAiD,GAAG,SAApDA,gBAAoD,CAAAC,KAAK,EAAI;EACtE,IAAQC,YAAR,GAAyBD,KAAzB,CAAQC,YAAR;;EACA,IAAI,CAACA,YAAD,IAAiBA,YAAY,CAACC,YAAb,KAA8B,IAA/C,IAAuD,CAACD,YAAY,CAACjB,OAAzE,EAAkF;IAC9E,OAAO,IAAP;EACH;;EACD,IAAQA,OAAR,GAAoBiB,YAApB,CAAQjB,OAAR;EAEA,IAAMmB,MAAM,GAAGpB,kBAAkB,CAACC,OAAD,CAAjC;;EACA,IAAI,CAACmB,MAAL,EAAa;IACT,oBAAO,2DAAP;EACH;;EACD,IAAQlB,MAAR,GAA0CkB,MAA1C,CAAQlB,MAAR;EAAA,IAAgBM,KAAhB,GAA0CY,MAA1C,CAAgBZ,KAAhB;EAAA,IAAuBI,OAAvB,GAA0CQ,MAA1C,CAAuBR,OAAvB;EAAA,IAAgCH,KAAhC,GAA0CW,MAA1C,CAAgCX,KAAhC;EACA,oBACI,6BAAC,sBAAD;IAAY,GAAG,EAAE,OAAjB;IAA0B,GAAG,EAAE;EAA/B,GAAsC,kBAAtC,eACoB,6CAASD,KAAK,CAACa,IAAf,CADpB,EACiD,aADjD,eAC4D,6CAASnB,MAAT,CAD5D,EACqF,IADrF,EAEKU,OAFL,EAEa,MAFb,EAEkBH,KAFlB,EAEwB,WAFxB,CADJ;AAMH,CAlBM"}
@@ -1,21 +1,30 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createCmsApolloClient = void 0;
9
+
8
10
  var _apolloClient = _interopRequireDefault(require("apollo-client"));
11
+
9
12
  var _apolloLink = require("apollo-link");
13
+
10
14
  var _ApolloDynamicLink = require("@webiny/app/plugins/ApolloDynamicLink");
15
+
11
16
  var _InMemoryCache = require("@webiny/app/apollo-client/InMemoryCache");
17
+
12
18
  var _plugins = require("@webiny/plugins");
19
+
13
20
  var _ApolloCacheObjectIdPlugin = require("@webiny/app/plugins/ApolloCacheObjectIdPlugin");
21
+
14
22
  var _apolloLinkBatchHttp = require("apollo-link-batch-http");
23
+
15
24
  var createCmsApolloClient = function createCmsApolloClient(_ref) {
16
25
  var locale = _ref.locale,
17
- apiUrl = _ref.apiUrl,
18
- endpoint = _ref.endpoint;
26
+ apiUrl = _ref.apiUrl,
27
+ endpoint = _ref.endpoint;
19
28
  return new _apolloClient.default({
20
29
  link: _apolloLink.ApolloLink.from([
21
30
  /**
@@ -36,19 +45,23 @@ var createCmsApolloClient = function createCmsApolloClient(_ref) {
36
45
  * we cannot rely on having an `id` field.
37
46
  */
38
47
  var getters = _plugins.plugins.byType(_ApolloCacheObjectIdPlugin.ApolloCacheObjectIdPlugin.type);
48
+
39
49
  for (var i = 0; i < getters.length; i++) {
40
50
  var id = getters[i].getObjectId(obj);
51
+
41
52
  if (typeof id !== "undefined") {
42
53
  return id;
43
54
  }
44
55
  }
45
-
46
56
  /**
47
57
  * As a fallback, try getting object's `id`.
48
58
  */
59
+
60
+
49
61
  return obj.id || null;
50
62
  }
51
63
  })
52
64
  });
53
65
  };
66
+
54
67
  exports.createCmsApolloClient = createCmsApolloClient;
@@ -1 +1 @@
1
- {"version":3,"names":["createCmsApolloClient","locale","apiUrl","endpoint","ApolloClient","link","ApolloLink","from","ApolloDynamicLink","BatchHttpLink","uri","cache","InMemoryCache","addTypename","dataIdFromObject","obj","getters","plugins","byType","ApolloCacheObjectIdPlugin","type","i","length","id","getObjectId"],"sources":["createCmsApolloClient.ts"],"sourcesContent":["import ApolloClient from \"apollo-client\";\nimport { ApolloLink } from \"apollo-link\";\nimport { ApolloDynamicLink } from \"@webiny/app/plugins/ApolloDynamicLink\";\nimport { InMemoryCache } from \"@webiny/app/apollo-client/InMemoryCache\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloCacheObjectIdPlugin } from \"@webiny/app/plugins/ApolloCacheObjectIdPlugin\";\nimport { BatchHttpLink } from \"apollo-link-batch-http\";\n\nexport interface CreateCmsApolloClientParams {\n locale: string;\n apiUrl: string;\n endpoint: \"manage\" | \"read\";\n}\nexport const createCmsApolloClient = ({\n locale,\n apiUrl,\n endpoint\n}: CreateCmsApolloClientParams) => {\n return new ApolloClient({\n link: ApolloLink.from([\n /**\n * This will process links from plugins on every request.\n */\n new ApolloDynamicLink(),\n /**\n * This batches requests made to the API to pack multiple requests into a single HTTP request.\n */\n new BatchHttpLink({\n uri: `${apiUrl}/cms/${endpoint}/${locale}`\n })\n ]),\n cache: new InMemoryCache({\n addTypename: true,\n dataIdFromObject: obj => {\n /**\n * Since every data type coming from API can have a different data structure,\n * we cannot rely on having an `id` field.\n */\n const getters = plugins.byType<ApolloCacheObjectIdPlugin>(\n ApolloCacheObjectIdPlugin.type\n );\n\n for (let i = 0; i < getters.length; i++) {\n const id = getters[i].getObjectId(obj);\n if (typeof id !== \"undefined\") {\n return id;\n }\n }\n\n /**\n * As a fallback, try getting object's `id`.\n */\n return obj.id || null;\n }\n })\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqB,OAIC;EAAA,IAH/BC,MAAM,QAANA,MAAM;IACNC,MAAM,QAANA,MAAM;IACNC,QAAQ,QAARA,QAAQ;EAER,OAAO,IAAIC,qBAAY,CAAC;IACpBC,IAAI,EAAEC,sBAAU,CAACC,IAAI,CAAC;IAClB;AACZ;AACA;IACY,IAAIC,oCAAiB,EAAE;IACvB;AACZ;AACA;IACY,IAAIC,kCAAa,CAAC;MACdC,GAAG,YAAKR,MAAM,kBAAQC,QAAQ,cAAIF,MAAM;IAC5C,CAAC,CAAC,CACL,CAAC;IACFU,KAAK,EAAE,IAAIC,4BAAa,CAAC;MACrBC,WAAW,EAAE,IAAI;MACjBC,gBAAgB,EAAE,0BAAAC,GAAG,EAAI;QACrB;AAChB;AACA;AACA;QACgB,IAAMC,OAAO,GAAGC,gBAAO,CAACC,MAAM,CAC1BC,oDAAyB,CAACC,IAAI,CACjC;QAED,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,OAAO,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;UACrC,IAAME,EAAE,GAAGP,OAAO,CAACK,CAAC,CAAC,CAACG,WAAW,CAACT,GAAG,CAAC;UACtC,IAAI,OAAOQ,EAAE,KAAK,WAAW,EAAE;YAC3B,OAAOA,EAAE;UACb;QACJ;;QAEA;AAChB;AACA;QACgB,OAAOR,GAAG,CAACQ,EAAE,IAAI,IAAI;MACzB;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["createCmsApolloClient","locale","apiUrl","endpoint","ApolloClient","link","ApolloLink","from","ApolloDynamicLink","BatchHttpLink","uri","cache","InMemoryCache","addTypename","dataIdFromObject","obj","getters","plugins","byType","ApolloCacheObjectIdPlugin","type","i","length","id","getObjectId"],"sources":["createCmsApolloClient.ts"],"sourcesContent":["import ApolloClient from \"apollo-client\";\nimport { ApolloLink } from \"apollo-link\";\nimport { ApolloDynamicLink } from \"@webiny/app/plugins/ApolloDynamicLink\";\nimport { InMemoryCache } from \"@webiny/app/apollo-client/InMemoryCache\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloCacheObjectIdPlugin } from \"@webiny/app/plugins/ApolloCacheObjectIdPlugin\";\nimport { BatchHttpLink } from \"apollo-link-batch-http\";\n\nexport interface CreateCmsApolloClientParams {\n locale: string;\n apiUrl: string;\n endpoint: \"manage\" | \"read\";\n}\nexport const createCmsApolloClient = ({\n locale,\n apiUrl,\n endpoint\n}: CreateCmsApolloClientParams) => {\n return new ApolloClient({\n link: ApolloLink.from([\n /**\n * This will process links from plugins on every request.\n */\n new ApolloDynamicLink(),\n /**\n * This batches requests made to the API to pack multiple requests into a single HTTP request.\n */\n new BatchHttpLink({\n uri: `${apiUrl}/cms/${endpoint}/${locale}`\n })\n ]),\n cache: new InMemoryCache({\n addTypename: true,\n dataIdFromObject: obj => {\n /**\n * Since every data type coming from API can have a different data structure,\n * we cannot rely on having an `id` field.\n */\n const getters = plugins.byType<ApolloCacheObjectIdPlugin>(\n ApolloCacheObjectIdPlugin.type\n );\n\n for (let i = 0; i < getters.length; i++) {\n const id = getters[i].getObjectId(obj);\n if (typeof id !== \"undefined\") {\n return id;\n }\n }\n\n /**\n * As a fallback, try getting object's `id`.\n */\n return obj.id || null;\n }\n })\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,OAIF;EAAA,IAH/BC,MAG+B,QAH/BA,MAG+B;EAAA,IAF/BC,MAE+B,QAF/BA,MAE+B;EAAA,IAD/BC,QAC+B,QAD/BA,QAC+B;EAC/B,OAAO,IAAIC,qBAAJ,CAAiB;IACpBC,IAAI,EAAEC,sBAAA,CAAWC,IAAX,CAAgB;IAClB;AACZ;AACA;IACY,IAAIC,oCAAJ,EAJkB;IAKlB;AACZ;AACA;IACY,IAAIC,kCAAJ,CAAkB;MACdC,GAAG,YAAKR,MAAL,kBAAmBC,QAAnB,cAA+BF,MAA/B;IADW,CAAlB,CARkB,CAAhB,CADc;IAapBU,KAAK,EAAE,IAAIC,4BAAJ,CAAkB;MACrBC,WAAW,EAAE,IADQ;MAErBC,gBAAgB,EAAE,0BAAAC,GAAG,EAAI;QACrB;AAChB;AACA;AACA;QACgB,IAAMC,OAAO,GAAGC,gBAAA,CAAQC,MAAR,CACZC,oDAAA,CAA0BC,IADd,CAAhB;;QAIA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,OAAO,CAACM,MAA5B,EAAoCD,CAAC,EAArC,EAAyC;UACrC,IAAME,EAAE,GAAGP,OAAO,CAACK,CAAD,CAAP,CAAWG,WAAX,CAAuBT,GAAvB,CAAX;;UACA,IAAI,OAAOQ,EAAP,KAAc,WAAlB,EAA+B;YAC3B,OAAOA,EAAP;UACH;QACJ;QAED;AAChB;AACA;;;QACgB,OAAOR,GAAG,CAACQ,EAAJ,IAAU,IAAjB;MACH;IAtBoB,CAAlB;EAba,CAAjB,CAAP;AAsCH,CA3CM"}
@@ -1,18 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createListEntriesQuery = void 0;
9
+
8
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
9
12
  var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
13
+
10
14
  var _pluralize = _interopRequireDefault(require("pluralize"));
15
+
11
16
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
17
+
12
18
  var _templateObject;
19
+
13
20
  var createListEntriesQuery = function createListEntriesQuery(model) {
14
21
  var ucFirstPluralizedModelId = (0, _upperFirst.default)((0, _pluralize.default)(model.modelId));
15
22
  var ucFirstModelId = (0, _upperFirst.default)(model.modelId);
16
23
  return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesList", "($where: ", "ListWhereInput, $sort: [", "ListSorter], $limit: Int, $after: String) {\n content: list", "(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n ) {\n data {\n id\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n "])), ucFirstPluralizedModelId, ucFirstModelId, ucFirstModelId, ucFirstPluralizedModelId);
17
24
  };
25
+
18
26
  exports.createListEntriesQuery = createListEntriesQuery;
@@ -1 +1 @@
1
- {"version":3,"names":["createListEntriesQuery","model","ucFirstPluralizedModelId","upperFirst","pluralize","modelId","ucFirstModelId","gql"],"sources":["createListEntriesQuery.ts"],"sourcesContent":["import { CmsEditorContentModel } from \"~/types\";\nimport upperFirst from \"lodash/upperFirst\";\nimport pluralize from \"pluralize\";\nimport gql from \"graphql-tag\";\n\nexport const createListEntriesQuery = (model: CmsEditorContentModel) => {\n const ucFirstPluralizedModelId = upperFirst(pluralize(model.modelId));\n const ucFirstModelId = upperFirst(model.modelId);\n\n return gql`\n query CmsEntriesList${ucFirstPluralizedModelId}($where: ${ucFirstModelId}ListWhereInput, $sort: [${ucFirstModelId}ListSorter], $limit: Int, $after: String) {\n content: list${ucFirstPluralizedModelId}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n ) {\n data {\n id\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AAA8B;AAEvB,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsB,CAAIC,KAA4B,EAAK;EACpE,IAAMC,wBAAwB,GAAG,IAAAC,mBAAU,EAAC,IAAAC,kBAAS,EAACH,KAAK,CAACI,OAAO,CAAC,CAAC;EACrE,IAAMC,cAAc,GAAG,IAAAH,mBAAU,EAACF,KAAK,CAACI,OAAO,CAAC;EAEhD,WAAOE,mBAAG,upBACgBL,wBAAwB,EAAYI,cAAc,EAA2BA,cAAc,EAC9FJ,wBAAwB;AAsBnD,CAAC;AAAC"}
1
+ {"version":3,"names":["createListEntriesQuery","model","ucFirstPluralizedModelId","upperFirst","pluralize","modelId","ucFirstModelId","gql"],"sources":["createListEntriesQuery.ts"],"sourcesContent":["import { CmsEditorContentModel } from \"~/types\";\nimport upperFirst from \"lodash/upperFirst\";\nimport pluralize from \"pluralize\";\nimport gql from \"graphql-tag\";\n\nexport const createListEntriesQuery = (model: CmsEditorContentModel) => {\n const ucFirstPluralizedModelId = upperFirst(pluralize(model.modelId));\n const ucFirstModelId = upperFirst(model.modelId);\n\n return gql`\n query CmsEntriesList${ucFirstPluralizedModelId}($where: ${ucFirstModelId}ListWhereInput, $sort: [${ucFirstModelId}ListSorter], $limit: Int, $after: String) {\n content: list${ucFirstPluralizedModelId}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n ) {\n data {\n id\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD,EAAkC;EACpE,IAAMC,wBAAwB,GAAG,IAAAC,mBAAA,EAAW,IAAAC,kBAAA,EAAUH,KAAK,CAACI,OAAhB,CAAX,CAAjC;EACA,IAAMC,cAAc,GAAG,IAAAH,mBAAA,EAAWF,KAAK,CAACI,OAAjB,CAAvB;EAEA,WAAOE,mBAAP,upBAC0BL,wBAD1B,EAC8DI,cAD9D,EACuGA,cADvG,EAEuBJ,wBAFvB;AAwBH,CA5BM"}
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createListModelsQuery = void 0;
9
+
8
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
9
12
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
13
+
10
14
  var _templateObject;
15
+
11
16
  var createListModelsQuery = function createListModelsQuery() {
12
17
  return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsListContentModels {\n listContentModels {\n data {\n modelId\n name\n fields {\n id\n type\n }\n }\n error {\n message\n code\n data\n }\n }\n }\n "])));
13
18
  };
19
+
14
20
  exports.createListModelsQuery = createListModelsQuery;
@@ -1 +1 @@
1
- {"version":3,"names":["createListModelsQuery","gql"],"sources":["createListModelsQuery.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const createListModelsQuery = () => {\n return gql`\n query CmsListContentModels {\n listContentModels {\n data {\n modelId\n name\n fields {\n id\n type\n }\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;AAAA;AAA8B;AAEvB,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqB,GAAS;EACvC,WAAOC,mBAAG;AAmBd,CAAC;AAAC"}
1
+ {"version":3,"names":["createListModelsQuery","gql"],"sources":["createListModelsQuery.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const createListModelsQuery = () => {\n return gql`\n query CmsListContentModels {\n listContentModels {\n data {\n modelId\n name\n fields {\n id\n type\n }\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;;;;AAAA;;;;AAEO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,GAAM;EACvC,WAAOC,mBAAP;AAmBH,CApBM"}
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createRepublishMutation = void 0;
9
+
8
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
9
12
  var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
13
+
10
14
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
15
+
11
16
  var _templateObject;
17
+
12
18
  var createRepublishMutation = function createRepublishMutation(model) {
13
19
  var ucFirstModelId = (0, _upperFirst.default)(model.modelId);
14
20
  return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsRepublish", "($revision: ID!) {\n content: republish", "(revision: $revision) {\n data {\n id\n }\n error {\n message\n data\n code\n }\n }\n }"])), ucFirstModelId, ucFirstModelId);
15
21
  };
22
+
16
23
  exports.createRepublishMutation = createRepublishMutation;
@@ -1 +1 @@
1
- {"version":3,"names":["createRepublishMutation","model","ucFirstModelId","upperFirst","modelId","gql"],"sources":["createRepublishMutation.ts"],"sourcesContent":["import upperFirst from \"lodash/upperFirst\";\nimport gql from \"graphql-tag\";\nimport { CmsModel } from \"~/types\";\n\nexport const createRepublishMutation = (model: CmsModel) => {\n const ucFirstModelId = upperFirst(model.modelId);\n\n return gql`\n mutation CmsRepublish${ucFirstModelId}($revision: ID!) {\n content: republish${ucFirstModelId}(revision: $revision) {\n data {\n id\n }\n error {\n message\n data\n code\n }\n }\n }`;\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AAA8B;AAGvB,IAAMA,uBAAuB,GAAG,SAA1BA,uBAAuB,CAAIC,KAAe,EAAK;EACxD,IAAMC,cAAc,GAAG,IAAAC,mBAAU,EAACF,KAAK,CAACG,OAAO,CAAC;EAEhD,WAAOC,mBAAG,uXACiBH,cAAc,EACbA,cAAc;AAW9C,CAAC;AAAC"}
1
+ {"version":3,"names":["createRepublishMutation","model","ucFirstModelId","upperFirst","modelId","gql"],"sources":["createRepublishMutation.ts"],"sourcesContent":["import upperFirst from \"lodash/upperFirst\";\nimport gql from \"graphql-tag\";\nimport { CmsModel } from \"~/types\";\n\nexport const createRepublishMutation = (model: CmsModel) => {\n const ucFirstModelId = upperFirst(model.modelId);\n\n return gql`\n mutation CmsRepublish${ucFirstModelId}($revision: ID!) {\n content: republish${ucFirstModelId}(revision: $revision) {\n data {\n id\n }\n error {\n message\n data\n code\n }\n }\n }`;\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;AAGO,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,KAAD,EAAqB;EACxD,IAAMC,cAAc,GAAG,IAAAC,mBAAA,EAAWF,KAAK,CAACG,OAAjB,CAAvB;EAEA,WAAOC,mBAAP,uXAC2BH,cAD3B,EAE4BA,cAF5B;AAaH,CAhBM"}
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createUpgradeMutation = void 0;
9
+
8
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
9
12
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
13
+
10
14
  var _templateObject;
15
+
11
16
  var createUpgradeMutation = function createUpgradeMutation() {
12
17
  return (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n mutation UpgradeCMS($version: String!) {\n cms {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n "])));
13
18
  };
19
+
14
20
  exports.createUpgradeMutation = createUpgradeMutation;
@@ -1 +1 @@
1
- {"version":3,"names":["createUpgradeMutation","gql"],"sources":["createUpgradeMutation.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const createUpgradeMutation = () => {\n return gql`\n mutation UpgradeCMS($version: String!) {\n cms {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;AAAA;AAA8B;AAEvB,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqB,GAAS;EACvC,WAAOC,mBAAG;AAcd,CAAC;AAAC"}
1
+ {"version":3,"names":["createUpgradeMutation","gql"],"sources":["createUpgradeMutation.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const createUpgradeMutation = () => {\n return gql`\n mutation UpgradeCMS($version: String!) {\n cms {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n `;\n};\n"],"mappings":";;;;;;;;;;;AAAA;;;;AAEO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,GAAM;EACvC,WAAOC,mBAAP;AAcH,CAfM"}
@@ -1,108 +1,137 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.fetchModelEntries = void 0;
9
+
8
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
9
12
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
13
+
10
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
+
11
16
  var _createListEntriesQuery = require("./createListEntriesQuery");
12
- // @ts-nocheck
13
17
 
18
+ // @ts-nocheck
14
19
  var fetchEntries = /*#__PURE__*/function () {
15
20
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(params) {
16
21
  var client, query, variables, response, _response$data$conten, items, error, meta;
22
+
17
23
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
18
- while (1) switch (_context.prev = _context.next) {
19
- case 0:
20
- client = params.client, query = params.query, variables = params.variables;
21
- _context.next = 3;
22
- return client.query({
23
- query: query,
24
- variables: variables
25
- });
26
- case 3:
27
- response = _context.sent;
28
- _response$data$conten = response.data.content, items = _response$data$conten.data, error = _response$data$conten.error, meta = _response$data$conten.meta;
29
- if (!error) {
30
- _context.next = 8;
31
- break;
32
- }
33
- console.error(error.message);
34
- return _context.abrupt("return", null);
35
- case 8:
36
- return _context.abrupt("return", {
37
- items: items || [],
38
- hasMoreItems: meta.hasMoreItems,
39
- cursor: meta.cursor,
40
- totalCount: meta.totalCount
41
- });
42
- case 9:
43
- case "end":
44
- return _context.stop();
24
+ while (1) {
25
+ switch (_context.prev = _context.next) {
26
+ case 0:
27
+ client = params.client, query = params.query, variables = params.variables;
28
+ _context.next = 3;
29
+ return client.query({
30
+ query: query,
31
+ variables: variables
32
+ });
33
+
34
+ case 3:
35
+ response = _context.sent;
36
+ _response$data$conten = response.data.content, items = _response$data$conten.data, error = _response$data$conten.error, meta = _response$data$conten.meta;
37
+
38
+ if (!error) {
39
+ _context.next = 8;
40
+ break;
41
+ }
42
+
43
+ console.error(error.message);
44
+ return _context.abrupt("return", null);
45
+
46
+ case 8:
47
+ return _context.abrupt("return", {
48
+ items: items || [],
49
+ hasMoreItems: meta.hasMoreItems,
50
+ cursor: meta.cursor,
51
+ totalCount: meta.totalCount
52
+ });
53
+
54
+ case 9:
55
+ case "end":
56
+ return _context.stop();
57
+ }
45
58
  }
46
59
  }, _callee);
47
60
  }));
61
+
48
62
  return function fetchEntries(_x) {
49
63
  return _ref.apply(this, arguments);
50
64
  };
51
65
  }();
66
+
52
67
  var fetchModelEntries = /*#__PURE__*/function () {
53
68
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(params) {
54
69
  var model, client, items, query, variables, result;
55
70
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
56
- while (1) switch (_context2.prev = _context2.next) {
57
- case 0:
58
- model = params.model, client = params.client;
59
- items = [];
60
- query = (0, _createListEntriesQuery.createListEntriesQuery)(model);
61
- variables = {
62
- limit: 100,
63
- after: null,
64
- where: {}
65
- };
66
- case 4:
67
- _context2.next = 6;
68
- return fetchEntries({
69
- client: client,
70
- query: query,
71
- variables: variables
72
- });
73
- case 6:
74
- if (!(result = _context2.sent)) {
75
- _context2.next = 15;
76
- break;
77
- }
78
- if (result) {
79
- _context2.next = 9;
80
- break;
81
- }
82
- return _context2.abrupt("return", items);
83
- case 9:
84
- items.push.apply(items, (0, _toConsumableArray2.default)(result.items.map(function (item) {
85
- return item.id;
86
- })));
87
- if (!(result.hasMoreItems === false)) {
88
- _context2.next = 12;
71
+ while (1) {
72
+ switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ model = params.model, client = params.client;
75
+ items = [];
76
+ query = (0, _createListEntriesQuery.createListEntriesQuery)(model);
77
+ variables = {
78
+ limit: 100,
79
+ after: null,
80
+ where: {}
81
+ };
82
+
83
+ case 4:
84
+ _context2.next = 6;
85
+ return fetchEntries({
86
+ client: client,
87
+ query: query,
88
+ variables: variables
89
+ });
90
+
91
+ case 6:
92
+ if (!(result = _context2.sent)) {
93
+ _context2.next = 15;
94
+ break;
95
+ }
96
+
97
+ if (result) {
98
+ _context2.next = 9;
99
+ break;
100
+ }
101
+
102
+ return _context2.abrupt("return", items);
103
+
104
+ case 9:
105
+ items.push.apply(items, (0, _toConsumableArray2.default)(result.items.map(function (item) {
106
+ return item.id;
107
+ })));
108
+
109
+ if (!(result.hasMoreItems === false)) {
110
+ _context2.next = 12;
111
+ break;
112
+ }
113
+
114
+ return _context2.abrupt("return", items);
115
+
116
+ case 12:
117
+ variables.after = result.cursor;
118
+ _context2.next = 4;
89
119
  break;
90
- }
91
- return _context2.abrupt("return", items);
92
- case 12:
93
- variables.after = result.cursor;
94
- _context2.next = 4;
95
- break;
96
- case 15:
97
- return _context2.abrupt("return", items);
98
- case 16:
99
- case "end":
100
- return _context2.stop();
120
+
121
+ case 15:
122
+ return _context2.abrupt("return", items);
123
+
124
+ case 16:
125
+ case "end":
126
+ return _context2.stop();
127
+ }
101
128
  }
102
129
  }, _callee2);
103
130
  }));
131
+
104
132
  return function fetchModelEntries(_x2) {
105
133
  return _ref2.apply(this, arguments);
106
134
  };
107
135
  }();
136
+
108
137
  exports.fetchModelEntries = fetchModelEntries;