"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.ChromiumArchivePaths = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _path = _interopRequireDefault(require("path")); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ var BaseUrl; (function (BaseUrl) { BaseUrl["common"] = "https://commondatastorage.googleapis.com/chromium-browser-snapshots"; BaseUrl["custom"] = "https://storage.googleapis.com/headless_shell"; })(BaseUrl || (BaseUrl = {})); function isCommonPackage(p) { return p.location === 'common'; } class ChromiumArchivePaths { constructor() { (0, _defineProperty2.default)(this, "packages", [{ platform: 'darwin', architecture: 'x64', archiveFilename: 'chrome-mac.zip', archiveChecksum: '086ffb9d1e248f41f1e385aaea1bb568', binaryChecksum: '58ed6d2bba7773b85aaec1d78b9c1a7b', binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium', revision: 1181205, location: 'common', archivePath: 'Mac', isPreInstalled: false }, { platform: 'darwin', architecture: 'arm64', archiveFilename: 'chrome-mac.zip', archiveChecksum: 'f80b2cb14025e283a740836aa66e46d4', binaryChecksum: '361f7cbac5bcac1d9974a43e29bf4bf5', binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium', revision: 1181286, // 1181205 is not available for Mac_Arm location: 'common', archivePath: 'Mac_Arm', isPreInstalled: false }, { platform: 'linux', architecture: 'x64', archiveFilename: 'chromium-67649b1-locales-linux_x64.zip', archiveChecksum: '21bd8a1e06f236fa405c74d92a7ccd63', binaryChecksum: 'b75d45d3044cc320bb09ce7356003d24', binaryRelativePath: 'headless_shell-linux_x64/headless_shell', revision: 1181205, location: 'custom', isPreInstalled: true }, { platform: 'linux', architecture: 'arm64', archiveFilename: 'chromium-67649b1-locales-linux_arm64.zip', archiveChecksum: '0c3b42ada934258b4596f3e984d011e3', binaryChecksum: 'ac521fbc52fb1589416a214ce7b299ee', binaryRelativePath: 'headless_shell-linux_arm64/headless_shell', revision: 1181205, location: 'custom', isPreInstalled: true }, { platform: 'win32', architecture: 'x64', archiveFilename: 'chrome-win.zip', archiveChecksum: '08186d7494e75c2cca03270d9a4ff589', binaryChecksum: '1623fed921c9acee7221b2de98abe54e', binaryRelativePath: _path.default.join('chrome-win', 'chrome.exe'), revision: 1181280, // 1181205 is not available for win location: 'common', archivePath: 'Win', isPreInstalled: true }]); // zip files get downloaded to a .chromium directory in the kibana root (0, _defineProperty2.default)(this, "archivesPath", _path.default.resolve(__dirname, '../../../../../../.chromium')); } find(platform, architecture, packages = this.packages) { return packages.find(p => p.platform === platform && p.architecture === architecture); } resolvePath(p) { // adding architecture to the path allows it to download two binaries that have the same name, but are different architecture return _path.default.resolve(this.archivesPath, p.architecture, p.archiveFilename); } getAllArchiveFilenames() { return this.packages.map(p => this.resolvePath(p)); } getDownloadUrl(p) { if (isCommonPackage(p)) { const { common } = BaseUrl; const { archivePath, revision, archiveFilename } = p; return `${common}/${archivePath}/${revision}/${archiveFilename}`; } return BaseUrl.custom + '/' + p.archiveFilename; // revision is not used for URL if package is a custom build } getBinaryPath(p, chromiumPath) { return _path.default.join(chromiumPath, p.binaryRelativePath); } } exports.ChromiumArchivePaths = ChromiumArchivePaths;