@verdaccio/ui-components 4.0.0-next-8.2 → 4.0.0-next-8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +9 -1
- package/CHANGELOG.md +4 -269
- package/build/AppTest/AppRoute.js +18 -27
- package/build/AppTest/pages/Front/Home.js +2 -8
- package/build/AppTest/pages/Front/index.js +1 -13
- package/build/AppTest/pages/Version/Version.js +15 -19
- package/build/AppTest/pages/Version/index.js +1 -13
- package/build/Theme/ResetStyles.js +10 -16
- package/build/Theme/StyleBaseline.js +6 -13
- package/build/Theme/ThemeProvider.js +25 -33
- package/build/Theme/colors.js +1 -7
- package/build/Theme/index.js +5 -44
- package/build/Theme/theme.js +26 -32
- package/build/components/ActionBar/ActionBar.js +26 -33
- package/build/components/ActionBar/ActionBarAction.js +59 -59
- package/build/components/ActionBar/index.js +1 -13
- package/build/components/Author/Author.js +17 -23
- package/build/components/Author/index.js +1 -13
- package/build/components/Author/styles.js +5 -12
- package/build/components/CopyClipboard/CopyToClipBoard.js +40 -40
- package/build/components/CopyClipboard/index.js +2 -20
- package/build/components/CopyClipboard/utils.js +1 -8
- package/build/components/Dependencies/Dependencies.js +27 -34
- package/build/components/Dependencies/DependencyBlock.js +29 -35
- package/build/components/Dependencies/index.js +1 -13
- package/build/components/Dependencies/types.js +1 -5
- package/build/components/Dependencies/utits.js +1 -7
- package/build/components/Deprecated/Deprecated.js +10 -16
- package/build/components/Deprecated/index.js +1 -13
- package/build/components/Developers/DeveloperType.js +1 -7
- package/build/components/Developers/Developers.js +29 -37
- package/build/components/Developers/Title.js +26 -29
- package/build/components/Developers/get-unique-developer-values.js +1 -7
- package/build/components/Developers/index.js +2 -20
- package/build/components/Distribution/Dist.js +29 -32
- package/build/components/Distribution/index.js +1 -13
- package/build/components/Distribution/styles.js +7 -14
- package/build/components/Engines/Engines.js +53 -54
- package/build/components/Engines/index.js +1 -13
- package/build/components/Engines/styles.js +5 -12
- package/build/components/ErrorBoundary/ErrorBoundary.js +5 -14
- package/build/components/ErrorBoundary/index.js +1 -13
- package/build/components/Forbidden/Forbidden.js +33 -35
- package/build/components/Forbidden/index.js +1 -13
- package/build/components/FundButton/FundButton.js +42 -41
- package/build/components/FundButton/index.js +1 -13
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +39 -41
- package/build/components/HeaderInfoDialog/index.js +1 -13
- package/build/components/Heading/Heading.js +12 -17
- package/build/components/Heading/index.js +1 -13
- package/build/components/Help/Help.js +23 -31
- package/build/components/Help/index.js +1 -13
- package/build/components/Help/styles.js +3 -10
- package/build/components/Icons/DevsIcons/CommonJS.js +4 -11
- package/build/components/Icons/DevsIcons/ES6Module.js +4 -11
- package/build/components/Icons/DevsIcons/Git.js +4 -11
- package/build/components/Icons/DevsIcons/NodeJS.js +4 -11
- package/build/components/Icons/DevsIcons/TypeScript.js +4 -11
- package/build/components/Icons/DevsIcons/index.js +5 -40
- package/build/components/Icons/Earth.js +13 -19
- package/build/components/Icons/FileBinary.js +6 -12
- package/build/components/Icons/Law.js +6 -12
- package/build/components/Icons/License.js +7 -13
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +4 -11
- package/build/components/Icons/Managers/Pnpm.js +4 -11
- package/build/components/Icons/Managers/Yarn.js +4 -11
- package/build/components/Icons/Managers/index.js +3 -26
- package/build/components/Icons/SvgIcon.js +27 -23
- package/build/components/Icons/Time.js +8 -14
- package/build/components/Icons/Version.js +6 -12
- package/build/components/Icons/index.js +8 -79
- package/build/components/Install/Install.js +32 -39
- package/build/components/Install/InstallListItem.js +47 -52
- package/build/components/Install/index.js +1 -13
- package/build/components/Keywords/KeywordListItems.js +11 -17
- package/build/components/Keywords/Keywords.js +20 -25
- package/build/components/Keywords/index.js +1 -13
- package/build/components/Label/Label.js +17 -18
- package/build/components/Label/index.js +1 -13
- package/build/components/Link/Link.js +16 -22
- package/build/components/Link/index.js +1 -13
- package/build/components/LinkExternal/LinkExternal.js +15 -19
- package/build/components/LinkExternal/index.js +1 -13
- package/build/components/Loading/Loading.js +8 -15
- package/build/components/Loading/Spinner/Spinner.js +41 -35
- package/build/components/Loading/Spinner/index.js +1 -13
- package/build/components/Loading/index.js +1 -13
- package/build/components/Loading/styles.js +15 -19
- package/build/components/LoginDialog/LoginDialog.js +72 -68
- package/build/components/LoginDialog/LoginDialogCloseButton.js +28 -31
- package/build/components/LoginDialog/LoginDialogForm.js +46 -45
- package/build/components/LoginDialog/LoginDialogFormError.js +34 -36
- package/build/components/LoginDialog/LoginDialogHeader.js +42 -42
- package/build/components/LoginDialog/index.js +1 -13
- package/build/components/Logo/Logo.js +44 -47
- package/build/components/Logo/index.js +1 -13
- package/build/components/MenuItem/MenuItem.js +7 -16
- package/build/components/MenuItem/index.js +1 -13
- package/build/components/NoItems/NoItems.js +16 -17
- package/build/components/NoItems/index.js +1 -13
- package/build/components/NotFound/NotFound.js +31 -35
- package/build/components/NotFound/index.js +1 -13
- package/build/components/Package/Package.js +105 -100
- package/build/components/Package/index.js +1 -20
- package/build/components/Package/styles.js +78 -73
- package/build/components/PackageList/PackageList.js +56 -57
- package/build/components/PackageList/index.js +1 -13
- package/build/components/Person/Person.js +22 -28
- package/build/components/Person/PersonTooltip.js +17 -21
- package/build/components/Person/index.js +1 -13
- package/build/components/Person/utils.js +6 -14
- package/build/components/RawViewer/RawViewer.js +27 -33
- package/build/components/RawViewer/index.js +1 -13
- package/build/components/Readme/Readme.js +21 -27
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +10 -13
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/index.js +1 -13
- package/build/components/Readme/types.js +1 -5
- package/build/components/Readme/utils.js +8 -16
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +18 -24
- package/build/components/RegistryInfoDialog/index.js +1 -13
- package/build/components/RegistryInfoDialog/styles.js +34 -32
- package/build/components/RegistryInfoDialog/types.js +1 -5
- package/build/components/Repository/Repository.js +36 -41
- package/build/components/Repository/index.js +1 -13
- package/build/components/Search/AutoComplete/AutoComplete.js +22 -31
- package/build/components/Search/AutoComplete/index.js +1 -13
- package/build/components/Search/AutoComplete/styles.js +2 -9
- package/build/components/Search/Search.js +71 -69
- package/build/components/Search/SearchItem.js +87 -79
- package/build/components/Search/index.js +1 -13
- package/build/components/Search/styles.js +7 -14
- package/build/components/Search/utils.js +3 -9
- package/build/components/SettingsMenu/SettingsMenu.js +56 -57
- package/build/components/SettingsMenu/index.js +1 -13
- package/build/components/SideBarTitle/SideBarTitle.js +56 -54
- package/build/components/SideBarTitle/index.js +1 -13
- package/build/components/SideBarTitle/utils.js +6 -15
- package/build/components/TextField/TextField.js +22 -21
- package/build/components/TextField/index.js +1 -13
- package/build/components/UpLinks/UpLinks.js +32 -38
- package/build/components/UpLinks/UplinkLink.js +12 -18
- package/build/components/UpLinks/index.js +1 -13
- package/build/components/UpLinks/styles.js +28 -29
- package/build/components/Versions/HistoryList.js +56 -60
- package/build/components/Versions/TagList.js +29 -33
- package/build/components/Versions/Versions.js +44 -52
- package/build/components/Versions/index.js +1 -13
- package/build/components/Versions/styles.js +26 -27
- package/build/components/Versions/types.js +1 -5
- package/build/hooks/index.js +2 -20
- package/build/hooks/useLocalStorage.js +7 -12
- package/build/hooks/useOnClickOutside.js +4 -9
- package/build/index.js +63 -530
- package/build/layouts/Version/Version.js +9 -16
- package/build/layouts/Version/index.js +1 -13
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +24 -31
- package/build/providers/AppConfigurationProvider/index.js +1 -20
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +15 -24
- package/build/providers/PersistenceSettingProvider/index.js +1 -20
- package/build/providers/TranslatorProvider/TranslatorProvider.js +24 -30
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +19 -22
- package/build/providers/TranslatorProvider/index.js +1 -26
- package/build/providers/VersionProvider/VersionProvider.js +27 -29
- package/build/providers/VersionProvider/index.js +1 -20
- package/build/providers/index.js +3 -38
- package/build/sections/Detail/ContainerContent.js +20 -28
- package/build/sections/Detail/Detail.js +22 -30
- package/build/sections/Detail/ReadmeSection.js +8 -14
- package/build/sections/Detail/Tabs.js +20 -26
- package/build/sections/Detail/index.js +1 -13
- package/build/sections/Footer/Footer.js +73 -70
- package/build/sections/Footer/index.js +1 -13
- package/build/sections/Footer/styles.js +62 -57
- package/build/sections/Header/Header.js +34 -42
- package/build/sections/Header/HeaderGreetings.js +12 -18
- package/build/sections/Header/HeaderLeft.js +25 -29
- package/build/sections/Header/HeaderMenu.js +23 -29
- package/build/sections/Header/HeaderRight.js +41 -49
- package/build/sections/Header/HeaderSettingsDialog.js +60 -58
- package/build/sections/Header/HeaderToolTip.js +13 -17
- package/build/sections/Header/HeaderToolTipIcon.js +23 -31
- package/build/sections/Header/LanguageSwitch.js +51 -54
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +75 -80
- package/build/sections/Header/RegistryInfoContent/index.js +1 -13
- package/build/sections/Header/RegistryInfoContent/styles.js +12 -16
- package/build/sections/Header/index.js +1 -13
- package/build/sections/Header/styles.js +32 -36
- package/build/sections/Home/Home.js +14 -19
- package/build/sections/Home/index.js +1 -13
- package/build/sections/SideBar/Sidebar.js +45 -52
- package/build/sections/SideBar/index.js +1 -13
- package/build/sections/index.js +2 -20
- package/build/src/Theme/index.d.ts +1 -1
- package/build/src/components/SideBarTitle/SideBarTitle.d.ts +1 -1
- package/build/src/components/SideBarTitle/SideBarTitle.stories.d.ts +1 -0
- package/build/store/api.js +28 -29
- package/build/store/index.js +3 -51
- package/build/store/models/configuration.js +20 -22
- package/build/store/models/download.js +26 -27
- package/build/store/models/index.js +13 -19
- package/build/store/models/login.js +60 -63
- package/build/store/models/manifest.js +57 -58
- package/build/store/models/packages.js +29 -27
- package/build/store/models/routes.js +1 -7
- package/build/store/models/search.js +62 -61
- package/build/store/models/utils.js +1 -7
- package/build/store/storage.js +4 -11
- package/build/store/store.js +6 -13
- package/build/test/i18n-config.js +4 -11
- package/build/test/test-react-testing-library.js +32 -50
- package/build/types/index.js +1 -5
- package/build/types/packageMeta.js +1 -5
- package/build/utils/__partials__/packageMeta.js +1 -7
- package/build/utils/cli-utils.js +12 -32
- package/build/utils/index.js +8 -74
- package/build/utils/loadable.js +6 -14
- package/build/utils/routes.js +1 -7
- package/build/utils/token.js +11 -18
- package/build/utils/url.js +12 -22
- package/build/utils/utils.js +32 -46
- package/package.json +11 -9
- package/src/AppTest/AppRoute.test.tsx +5 -4
- package/src/Theme/index.ts +1 -1
- package/src/components/Author/Author.test.tsx +2 -1
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +2 -1
- package/src/components/Dependencies/Dependencies.test.tsx +7 -0
- package/src/components/Dependencies/DependencyBlock.test.tsx +3 -2
- package/src/components/Engines/Engines.test.tsx +3 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +2 -1
- package/src/components/Forbidden/Forbidden.test.tsx +3 -2
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +2 -1
- package/src/components/LoginDialog/LoginDialog.test.tsx +8 -7
- package/src/components/NotFound/Notfound.test.tsx +3 -2
- package/src/components/PackageList/Packagelist.test.tsx +2 -1
- package/src/components/Search/Search.test.tsx +9 -8
- package/src/components/SideBarTitle/SideBarTitle.stories.tsx +17 -4
- package/src/components/SideBarTitle/SideBarTitle.tsx +5 -3
- package/src/components/Versions/Versions.test.tsx +8 -8
- package/src/providers/TranslatorProvider/TranslatorProvider.spec.tsx +2 -1
- package/src/providers/VersionProvider/VersionProvider.tsx +5 -2
- package/src/sections/Home/Home.test.tsx +7 -3
- package/src/sections/SideBar/Sidebar.test.tsx +8 -7
- package/src/sections/SideBar/Sidebar.tsx +11 -7
- package/src/store/api.test.ts +8 -6
- package/src/store/models/login.test.ts +24 -20
- package/src/test/test-react-testing-library.tsx +3 -5
- package/src/utils/cli-utils.test.ts +10 -9
- package/src/utils/token.test.ts +5 -3
- package/tsconfig.build.json +1 -1
- package/vitest/api/glob-sidebar.json +12520 -0
- package/vitest/api/got-sidebar.json +23346 -0
- package/vitest/api/home-packages.json +40 -0
- package/vitest/api/jquery-readme.js +3 -0
- package/vitest/api/jquery-sidebar.json +5908 -0
- package/vitest/api/search-verdaccio.json +1192 -0
- package/vitest/api/storybook-readme.js +3 -0
- package/vitest/api/storybook-sidebar.json +53782 -0
- package/vitest/api/storybook-v.json +53782 -0
- package/vitest/identity.js +29 -0
- package/vitest/react-markdown.tsx +7 -0
- package/vitest/server-handlers.ts +82 -0
- package/vitest/server.ts +6 -0
- package/vitest/setup-env.ts +33 -0
- package/vitest/setup.ts +40 -0
- package/vitest/unit/components/__mocks__/token.ts +33 -0
- package/vitest/unit/empty-string.ts +1 -0
- package/vitest/unit/empty.ts +1 -0
- package/vitest/vitestSerializer.ts +31 -0
- package/vitest.config.mjs +39 -0
- package/build/__mocks__/react-markdown.js +0 -18
- package/build/__mocks__/remark-plugin.js +0 -8
- package/build/src/__mocks__/react-markdown.d.ts +0 -4
- package/build/src/__mocks__/remark-plugin.d.ts +0 -1
- package/src/__mocks__/react-markdown.tsx +0 -8
- package/src/__mocks__/remark-plugin.ts +0 -1
package/build/store/api.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
exports.handleResponseType = handleResponseType;
|
|
8
|
-
var _storage = _interopRequireDefault(require("./storage"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import storage from './storage';
|
|
10
7
|
class CustomError extends Error {}
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -14,17 +11,17 @@ class CustomError extends Error {}
|
|
|
14
11
|
* @param {object} response
|
|
15
12
|
* @returns {promise}
|
|
16
13
|
*/
|
|
17
|
-
function handleResponseType(response) {
|
|
14
|
+
export function handleResponseType(response) {
|
|
18
15
|
if (response.headers) {
|
|
19
|
-
|
|
20
|
-
if (contentType
|
|
16
|
+
var contentType = response.headers.get('Content-Type');
|
|
17
|
+
if (contentType !== null && contentType !== void 0 && contentType.includes('application/pdf')) {
|
|
21
18
|
return Promise.all([response.ok, response.blob()]);
|
|
22
19
|
}
|
|
23
|
-
if (contentType
|
|
20
|
+
if (contentType !== null && contentType !== void 0 && contentType.includes('application/json')) {
|
|
24
21
|
return Promise.all([response.ok, response.json()]);
|
|
25
22
|
}
|
|
26
23
|
// it includes all text types
|
|
27
|
-
if (contentType
|
|
24
|
+
if (contentType !== null && contentType !== void 0 && contentType.includes('text/')) {
|
|
28
25
|
return Promise.all([response.ok, response.text()]);
|
|
29
26
|
}
|
|
30
27
|
|
|
@@ -37,31 +34,33 @@ function handleResponseType(response) {
|
|
|
37
34
|
// error handling
|
|
38
35
|
return Promise.all([response.ok, response]);
|
|
39
36
|
}
|
|
40
|
-
|
|
37
|
+
var AuthHeader = 'Authorization';
|
|
41
38
|
class API {
|
|
42
|
-
request(url
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
request(url) {
|
|
40
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GET';
|
|
41
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
42
|
+
headers: {}
|
|
43
|
+
};
|
|
44
|
+
var token = storage.getItem('token');
|
|
45
|
+
var headers = new Headers(options.headers);
|
|
47
46
|
if (token && headers.has(AuthHeader) === false) {
|
|
48
|
-
headers.set(AuthHeader,
|
|
47
|
+
headers.set(AuthHeader, "Bearer ".concat(token));
|
|
49
48
|
options.headers = headers;
|
|
50
49
|
}
|
|
51
50
|
headers.set('x-client', 'verdaccio-ui');
|
|
52
51
|
return new Promise((resolve, reject) => {
|
|
53
|
-
fetch(url, {
|
|
52
|
+
fetch(url, _objectSpread({
|
|
54
53
|
method,
|
|
55
54
|
credentials: 'same-origin',
|
|
56
|
-
signal: options.signal
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const [ok, data] = response;
|
|
55
|
+
signal: options.signal
|
|
56
|
+
}, options)).then(handleResponseType).then(response => {
|
|
57
|
+
var [ok, data] = response;
|
|
60
58
|
if (ok === true) {
|
|
61
59
|
resolve(data);
|
|
62
60
|
} else {
|
|
63
|
-
|
|
64
|
-
error
|
|
61
|
+
var _data$statusText, _data$status;
|
|
62
|
+
var error = new CustomError((_data$statusText = data === null || data === void 0 ? void 0 : data.statusText) !== null && _data$statusText !== void 0 ? _data$statusText : 'Unknown error');
|
|
63
|
+
error.code = (_data$status = data === null || data === void 0 ? void 0 : data.status) !== null && _data$status !== void 0 ? _data$status : 500;
|
|
65
64
|
reject(error);
|
|
66
65
|
}
|
|
67
66
|
}).catch(error => {
|
|
@@ -70,5 +69,5 @@ class API {
|
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
|
|
72
|
+
export default new API();
|
|
74
73
|
//# sourceMappingURL=api.js.map
|
package/build/store/index.js
CHANGED
|
@@ -1,52 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Dispatch", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _store.Dispatch;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "LoginBody", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _login.LoginBody;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "LoginError", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _login.LoginError;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "LoginResponse", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _login.LoginResponse;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "RootState", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _store.RootState;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "api", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _api.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "store", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _store.store;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var _store = require("./store");
|
|
49
|
-
var _login = require("./models/login");
|
|
50
|
-
var _api = _interopRequireDefault(require("./api"));
|
|
51
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
export { store, RootState, Dispatch } from './store';
|
|
2
|
+
export { LoginError, LoginBody, LoginResponse } from './models/login';
|
|
3
|
+
export { default as api } from './api';
|
|
52
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _api = _interopRequireDefault(require("../api"));
|
|
12
|
-
var _routes = require("./routes");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const defaultValues = {
|
|
15
|
-
primaryColor: _Theme.colors.PRIMARY_COLOR,
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
|
+
import { createModel } from '@rematch/core';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
5
|
+
import isNil from 'lodash/isNil';
|
|
6
|
+
import { colors } from '../../Theme';
|
|
7
|
+
import API from '../api';
|
|
8
|
+
import { APIRoute } from './routes';
|
|
9
|
+
var defaultValues = {
|
|
10
|
+
primaryColor: colors.PRIMARY_COLOR,
|
|
16
11
|
darkMode: false,
|
|
17
12
|
pkgManagers: ['yarn', 'pnpm', 'npm'],
|
|
18
13
|
scope: '',
|
|
@@ -23,9 +18,10 @@ const defaultValues = {
|
|
|
23
18
|
title: 'Verdaccio'
|
|
24
19
|
};
|
|
25
20
|
function getConfiguration() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
var _window$__VERDACCIO_B, _window;
|
|
22
|
+
var uiConfiguration = (_window$__VERDACCIO_B = (_window = window) === null || _window === void 0 ? void 0 : _window.__VERDACCIO_BASENAME_UI_OPTIONS) !== null && _window$__VERDACCIO_B !== void 0 ? _window$__VERDACCIO_B : defaultValues;
|
|
23
|
+
if (isNil(uiConfiguration.primaryColor) || isEmpty(uiConfiguration.primaryColor)) {
|
|
24
|
+
uiConfiguration.primaryColor = colors.PRIMARY_COLOR;
|
|
29
25
|
}
|
|
30
26
|
return uiConfiguration;
|
|
31
27
|
}
|
|
@@ -34,14 +30,16 @@ function getConfiguration() {
|
|
|
34
30
|
*
|
|
35
31
|
* @category Model
|
|
36
32
|
*/
|
|
37
|
-
|
|
33
|
+
export var configuration = createModel()({
|
|
38
34
|
state: {
|
|
39
35
|
config: getConfiguration()
|
|
40
36
|
},
|
|
41
37
|
effects: dispatch => ({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
getPackages() {
|
|
39
|
+
return _asyncToGenerator(function* () {
|
|
40
|
+
var payload = yield API.request(APIRoute.CONFIG, 'GET');
|
|
41
|
+
dispatch.packages.savePackages(payload);
|
|
42
|
+
})();
|
|
45
43
|
}
|
|
46
44
|
})
|
|
47
45
|
});
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
|
+
import { createModel } from '@rematch/core';
|
|
4
|
+
import { downloadFile, extractFileName } from '../../utils/url';
|
|
5
|
+
import API from '../api';
|
|
2
6
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.download = void 0;
|
|
7
|
-
var _core = require("@rematch/core");
|
|
8
|
-
var _url = require("../../utils/url");
|
|
9
|
-
var _api = _interopRequireDefault(require("../api"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
7
|
/**
|
|
12
8
|
*
|
|
13
9
|
* @category Model
|
|
14
10
|
*/
|
|
15
|
-
|
|
11
|
+
export var download = createModel()({
|
|
16
12
|
state: {},
|
|
17
13
|
reducers: {},
|
|
18
14
|
effects: () => ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
getTarball(_ref) {
|
|
16
|
+
return _asyncToGenerator(function* () {
|
|
17
|
+
var {
|
|
18
|
+
link
|
|
19
|
+
} = _ref;
|
|
20
|
+
try {
|
|
21
|
+
var fileStream = yield API.request(link, 'GET', {
|
|
22
|
+
headers: {
|
|
23
|
+
['accept']: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3'
|
|
24
|
+
},
|
|
25
|
+
credentials: 'include'
|
|
26
|
+
});
|
|
27
|
+
var fileName = extractFileName(link);
|
|
28
|
+
downloadFile(fileStream, fileName);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// TODO: handle better error
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error('error on download', error);
|
|
33
|
+
}
|
|
34
|
+
})();
|
|
36
35
|
}
|
|
37
36
|
})
|
|
38
37
|
});
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
packages: _packages.packages,
|
|
15
|
-
configuration: _configuration.configuration,
|
|
16
|
-
search: _search.search,
|
|
17
|
-
download: _download.download,
|
|
18
|
-
login: _login.login,
|
|
19
|
-
manifest: _manifest.manifest
|
|
1
|
+
import { configuration } from './configuration';
|
|
2
|
+
import { download } from './download';
|
|
3
|
+
import { login } from './login';
|
|
4
|
+
import { manifest } from './manifest';
|
|
5
|
+
import { packages } from './packages';
|
|
6
|
+
import { search } from './search';
|
|
7
|
+
export var models = {
|
|
8
|
+
packages,
|
|
9
|
+
configuration,
|
|
10
|
+
search,
|
|
11
|
+
download,
|
|
12
|
+
login,
|
|
13
|
+
manifest
|
|
20
14
|
};
|
|
21
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
const HEADERS = exports.HEADERS = {
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { createModel } from '@rematch/core';
|
|
9
|
+
import i18next from 'i18next';
|
|
10
|
+
import { isTokenExpire } from '../../utils';
|
|
11
|
+
import API from '../api';
|
|
12
|
+
import storage from '../storage';
|
|
13
|
+
import { APIRoute } from './routes';
|
|
14
|
+
import { stripTrailingSlash } from './utils';
|
|
15
|
+
export var HEADERS = {
|
|
18
16
|
JSON: 'application/json'
|
|
19
17
|
};
|
|
20
|
-
function getDefaultUserState() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export function getDefaultUserState() {
|
|
19
|
+
var token = storage.getItem('token');
|
|
20
|
+
var username = storage.getItem('username');
|
|
21
|
+
var defaultUserState = isTokenExpire(token) ? {
|
|
24
22
|
token: null,
|
|
25
23
|
username: null
|
|
26
24
|
} : {
|
|
@@ -29,75 +27,74 @@ function getDefaultUserState() {
|
|
|
29
27
|
};
|
|
30
28
|
return defaultUserState;
|
|
31
29
|
}
|
|
32
|
-
|
|
30
|
+
var defaultUserState = getDefaultUserState();
|
|
33
31
|
|
|
34
32
|
/**
|
|
35
33
|
*
|
|
36
34
|
* @category Model
|
|
37
35
|
*/
|
|
38
|
-
|
|
36
|
+
export var login = createModel()({
|
|
39
37
|
state: {
|
|
40
38
|
username: defaultUserState.username,
|
|
41
39
|
token: defaultUserState.token
|
|
42
40
|
},
|
|
43
41
|
reducers: {
|
|
44
42
|
logOutUser(state) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
...state,
|
|
43
|
+
storage.removeItem('username');
|
|
44
|
+
storage.removeItem('token');
|
|
45
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
49
46
|
username: null,
|
|
50
47
|
token: null
|
|
51
|
-
};
|
|
48
|
+
});
|
|
52
49
|
},
|
|
53
50
|
addError(state, error) {
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
51
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
56
52
|
error
|
|
57
|
-
};
|
|
53
|
+
});
|
|
58
54
|
},
|
|
59
55
|
clearError(state) {
|
|
60
|
-
return {
|
|
61
|
-
...state,
|
|
56
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
62
57
|
error: undefined
|
|
63
|
-
};
|
|
58
|
+
});
|
|
64
59
|
},
|
|
65
60
|
logInUser(state, response) {
|
|
66
61
|
// we might persist this in another way with
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
...state,
|
|
62
|
+
storage.setItem('username', response.username);
|
|
63
|
+
storage.setItem('token', response.token);
|
|
64
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
71
65
|
token: response.token,
|
|
72
66
|
username: response.username
|
|
73
|
-
};
|
|
67
|
+
});
|
|
74
68
|
}
|
|
75
69
|
},
|
|
76
70
|
effects: dispatch => ({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
71
|
+
getUser(_ref, state) {
|
|
72
|
+
return _asyncToGenerator(function* () {
|
|
73
|
+
var {
|
|
74
|
+
username,
|
|
75
|
+
password
|
|
76
|
+
} = _ref;
|
|
77
|
+
var basePath = stripTrailingSlash(state.configuration.config.base);
|
|
78
|
+
try {
|
|
79
|
+
var payload = yield API.request("".concat(basePath).concat(APIRoute.LOGIN), 'POST', {
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
username,
|
|
82
|
+
password
|
|
83
|
+
}),
|
|
84
|
+
headers: {
|
|
85
|
+
Accept: HEADERS.JSON,
|
|
86
|
+
'Content-Type': HEADERS.JSON
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
dispatch.login.logInUser(payload);
|
|
90
|
+
dispatch.packages.getPackages(undefined);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
dispatch.login.addError({
|
|
93
|
+
type: 'error',
|
|
94
|
+
description: i18next.t('form-validation.unable-to-sign-in')
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
})();
|
|
101
98
|
}
|
|
102
99
|
})
|
|
103
100
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { createModel } from '@rematch/core';
|
|
9
|
+
import API from '../api';
|
|
10
|
+
import { APIRoute } from './routes';
|
|
11
|
+
import { stripTrailingSlash } from './utils';
|
|
12
12
|
function isPackageVersionValid(packageMeta, packageVersion) {
|
|
13
13
|
if (!packageVersion || typeof packageVersion === 'undefined') {
|
|
14
14
|
// if is undefined, that means versions does not exist, we continue
|
|
@@ -24,40 +24,36 @@ function isPackageVersionValid(packageMeta, packageVersion) {
|
|
|
24
24
|
*
|
|
25
25
|
* @category Model
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
export var manifest = createModel()({
|
|
28
28
|
state: {},
|
|
29
29
|
reducers: {
|
|
30
30
|
notFound(state) {
|
|
31
|
-
return {
|
|
32
|
-
...state,
|
|
31
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
33
32
|
hasNotBeenFound: true,
|
|
34
33
|
forbidden: false,
|
|
35
34
|
manifest: undefined,
|
|
36
35
|
packageName: undefined,
|
|
37
36
|
packageVersion: undefined,
|
|
38
37
|
readme: undefined
|
|
39
|
-
};
|
|
38
|
+
});
|
|
40
39
|
},
|
|
41
40
|
forbidden(state) {
|
|
42
|
-
return {
|
|
43
|
-
...state,
|
|
41
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
44
42
|
forbidden: true,
|
|
45
43
|
hasNotBeenFound: false,
|
|
46
44
|
manifest: undefined,
|
|
47
45
|
packageName: undefined,
|
|
48
46
|
packageVersion: undefined,
|
|
49
47
|
readme: undefined
|
|
50
|
-
};
|
|
48
|
+
});
|
|
51
49
|
},
|
|
52
50
|
clearError(state) {
|
|
53
|
-
return {
|
|
54
|
-
...state,
|
|
51
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
55
52
|
isError: null
|
|
56
|
-
};
|
|
53
|
+
});
|
|
57
54
|
},
|
|
58
55
|
isError(state) {
|
|
59
|
-
return {
|
|
60
|
-
...state,
|
|
56
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
61
57
|
isError: true,
|
|
62
58
|
hasNotBeenFound: false,
|
|
63
59
|
forbidden: false,
|
|
@@ -65,53 +61,56 @@ const manifest = exports.manifest = (0, _core.createModel)()({
|
|
|
65
61
|
packageName: undefined,
|
|
66
62
|
packageVersion: undefined,
|
|
67
63
|
readme: undefined
|
|
68
|
-
};
|
|
64
|
+
});
|
|
69
65
|
},
|
|
70
|
-
saveManifest(state, {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
saveManifest(state, _ref) {
|
|
67
|
+
var {
|
|
68
|
+
packageName,
|
|
69
|
+
packageVersion,
|
|
70
|
+
manifest,
|
|
71
|
+
readme
|
|
72
|
+
} = _ref;
|
|
73
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
78
74
|
manifest,
|
|
79
75
|
packageName,
|
|
80
76
|
packageVersion,
|
|
81
77
|
readme,
|
|
82
78
|
hasNotBeenFound: false,
|
|
83
79
|
forbidden: false
|
|
84
|
-
};
|
|
80
|
+
});
|
|
85
81
|
}
|
|
86
82
|
},
|
|
87
83
|
effects: dispatch => ({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, state) {
|
|
92
|
-
const basePath = (0, _utils.stripTrailingSlash)(state.configuration.config.base);
|
|
93
|
-
try {
|
|
94
|
-
const manifest = await _api.default.request(`${basePath}${_routes.APIRoute.SIDEBAR}${packageName}${packageVersion ? `?v=${packageVersion}` : ''}`);
|
|
95
|
-
|
|
96
|
-
// FIXME: update types accordingly
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
if (!isPackageVersionValid(manifest, packageVersion)) {
|
|
99
|
-
throw new Error('not found');
|
|
100
|
-
}
|
|
101
|
-
const readme = await _api.default.request(`${basePath}${_routes.APIRoute.README}${packageName}${packageVersion ? `?v=${packageVersion}` : ''}`);
|
|
102
|
-
dispatch.manifest.saveManifest({
|
|
84
|
+
getManifest(_ref2, state) {
|
|
85
|
+
return _asyncToGenerator(function* () {
|
|
86
|
+
var {
|
|
103
87
|
packageName,
|
|
104
|
-
packageVersion
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
88
|
+
packageVersion
|
|
89
|
+
} = _ref2;
|
|
90
|
+
var basePath = stripTrailingSlash(state.configuration.config.base);
|
|
91
|
+
try {
|
|
92
|
+
var _manifest = yield API.request("".concat(basePath).concat(APIRoute.SIDEBAR).concat(packageName).concat(packageVersion ? "?v=".concat(packageVersion) : ''));
|
|
93
|
+
|
|
94
|
+
// FIXME: update types accordingly
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
if (!isPackageVersionValid(_manifest, packageVersion)) {
|
|
97
|
+
throw new Error('not found');
|
|
98
|
+
}
|
|
99
|
+
var readme = yield API.request("".concat(basePath).concat(APIRoute.README).concat(packageName).concat(packageVersion ? "?v=".concat(packageVersion) : ''));
|
|
100
|
+
dispatch.manifest.saveManifest({
|
|
101
|
+
packageName,
|
|
102
|
+
packageVersion,
|
|
103
|
+
manifest: _manifest,
|
|
104
|
+
readme
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (error.code === 404) {
|
|
108
|
+
dispatch.manifest.notFound();
|
|
109
|
+
} else {
|
|
110
|
+
dispatch.manifest.forbidden();
|
|
111
|
+
}
|
|
113
112
|
}
|
|
114
|
-
}
|
|
113
|
+
})();
|
|
115
114
|
}
|
|
116
115
|
})
|
|
117
116
|
});
|