appium 2.0.0-beta.46 → 2.0.0-beta.48
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/README.md +145 -44
- package/build/lib/appium.d.ts +3 -103
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +679 -549
- package/build/lib/appium.js.map +1 -1
- package/build/lib/cli/args.js +247 -127
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +24 -5
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +78 -88
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +33 -24
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +729 -512
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +7 -6
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +68 -65
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +3 -3
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +234 -192
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/plugin-command.js +58 -87
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/cli/utils.js +66 -69
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/config-file.d.ts.map +1 -1
- package/build/lib/config-file.js +189 -120
- package/build/lib/config-file.js.map +1 -1
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +254 -213
- package/build/lib/config.js.map +1 -1
- package/build/lib/constants.d.ts +6 -5
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +65 -59
- package/build/lib/constants.js.map +1 -1
- package/build/lib/extension/driver-config.js +199 -164
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +33 -26
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +541 -396
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.js +98 -68
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts +27 -0
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -0
- package/build/lib/extension/manifest-migrations.js +118 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +35 -63
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +500 -240
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/package-changed.js +57 -61
- package/build/lib/extension/package-changed.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts +2 -3
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +94 -70
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/grid-register.js +119 -137
- package/build/lib/grid-register.js.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +5 -15
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +189 -183
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts +19 -12
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +330 -304
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.js +153 -108
- package/build/lib/schema/arg-spec.js.map +1 -1
- package/build/lib/schema/cli-args.js +203 -164
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/cli-transformers.js +117 -72
- package/build/lib/schema/cli-transformers.js.map +1 -1
- package/build/lib/schema/index.js +17 -32
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/keywords.js +125 -67
- package/build/lib/schema/keywords.js.map +1 -1
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +582 -417
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +41 -255
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +342 -193
- package/build/lib/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/cli.d.ts +45 -34
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +1 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +19 -0
- package/build/types/index.js.map +1 -0
- package/build/types/manifest/base.d.ts +135 -0
- package/build/types/manifest/base.d.ts.map +1 -0
- package/build/types/manifest/base.js +3 -0
- package/build/types/manifest/base.js.map +1 -0
- package/build/types/manifest/index.d.ts +19 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +40 -0
- package/build/types/manifest/index.js.map +1 -0
- package/build/types/manifest/v3.d.ts +139 -0
- package/build/types/manifest/v3.d.ts.map +1 -0
- package/build/types/manifest/v3.js +3 -0
- package/build/types/manifest/v3.js.map +1 -0
- package/lib/appium.js +1 -1
- package/lib/cli/args.js +1 -1
- package/lib/cli/driver-command.js +17 -0
- package/lib/cli/extension-command.js +119 -65
- package/lib/cli/extension.js +9 -8
- package/lib/cli/parser.js +2 -2
- package/lib/config-file.js +2 -3
- package/lib/config.js +3 -2
- package/lib/constants.js +7 -5
- package/lib/extension/extension-config.js +52 -47
- package/lib/extension/manifest-migrations.js +120 -0
- package/lib/extension/manifest.js +184 -103
- package/lib/extension/plugin-config.js +1 -2
- package/lib/logsink.js +26 -5
- package/lib/main.js +58 -50
- package/lib/schema/schema.js +6 -1
- package/lib/utils.js +62 -0
- package/package.json +24 -25
- package/scripts/autoinstall-extensions.js +78 -26
- package/types/cli.ts +81 -42
- package/types/index.ts +1 -2
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +27 -0
- package/types/manifest/v3.ts +161 -0
- package/build/types/appium-manifest.d.ts +0 -59
- package/build/types/appium-manifest.d.ts.map +0 -1
- package/build/types/extension-manifest.d.ts +0 -55
- package/build/types/extension-manifest.d.ts.map +0 -1
- package/types/appium-manifest.ts +0 -73
- package/types/extension-manifest.ts +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-config.js","names":["INSTALL_TYPE_NPM","INSTALL_TYPE_LOCAL","INSTALL_TYPE_GITHUB","INSTALL_TYPE_GIT","INSTALL_TYPES","Set","ExtensionConfig","extensionType","configKey","installedExtensions","log","manifest","_listDataCache","constructor","getExtensionData","manifestPath","appiumHome","getProblems","extName","extManifest","getGenericConfigProblems","getConfigProblems","getSchemaProblems","getWarnings","genericConfigWarnings","configWarnings","B","all","getGenericConfigWarnings","getConfigWarnings","getValidationResultSummaries","errorMap","Map","warningMap","errorSummaries","problems","entries","_","isEmpty","push","util","pluralize","length","problem","err","JSON","stringify","val","warningSummaries","warnings","extTypeText","capitalize","problemEnumerationText","warning","_validate","exts","toPairs","errors","set","error","size","summary","warn","getListData","CommandClass","commandClasses","cmd","config","json","listData","list","showInstalled","showUpdates","appiumVersion","installSpec","installType","pkgName","invalidFields","isString","has","invalidFieldsEnumerationText","invalidFieldsText","map","field","join","createPeerWarning","reason","APPIUM_VER","satisfies","extListData","installed","updateVersion","upToDate","schema","argSchemaPath","extDataHasSchema","isAllowedSchemaFileExtension","readExtensionSchema","message","ALLOWED_SCHEMA_EXTENSIONS","isPlainObject","version","mainClass","addExtension","write","updateExtension","removeExtension","print","activeNames","info","extensionDesc","Error","getInstallPath","path","require","reqPath","reqResolved","resolve","ReferenceError","process","env","APPIUM_RELOAD_EXTENSIONS","cache","debug","MainClass","isInstalled","includes","Object","keys","_readExtensionSchema","extType","TypeError","moduleObject","schemaPath","resolveFrom","__esModule","default","registerSchema","isObject"],"sources":["../../../lib/extension/extension-config.js"],"sourcesContent":["import _ from 'lodash';\nimport B from 'bluebird';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport {satisfies} from 'semver';\nimport {util} from '@appium/support';\nimport {commandClasses} from '../cli/extension';\nimport {APPIUM_VER} from '../config';\nimport log from '../logger';\nimport {\n ALLOWED_SCHEMA_EXTENSIONS,\n isAllowedSchemaFileExtension,\n registerSchema,\n} from '../schema/schema';\n\nconst INSTALL_TYPE_NPM = 'npm';\nconst INSTALL_TYPE_LOCAL = 'local';\nconst INSTALL_TYPE_GITHUB = 'github';\nconst INSTALL_TYPE_GIT = 'git';\n\n/** @type {Set<InstallType>} */\nconst INSTALL_TYPES = new Set([\n INSTALL_TYPE_GIT,\n INSTALL_TYPE_GITHUB,\n INSTALL_TYPE_LOCAL,\n INSTALL_TYPE_NPM,\n]);\n\n/**\n * This class is abstract. It should not be instantiated directly.\n *\n * Subclasses should provide the generic parameter to implement.\n * @template {ExtensionType} ExtType\n */\nexport class ExtensionConfig {\n /** @type {ExtType} */\n extensionType;\n\n /** @type {`${ExtType}s`} */\n configKey;\n\n /** @type {ExtRecord<ExtType>} */\n installedExtensions;\n\n /** @type {import('@appium/types').AppiumLogger} */\n log;\n\n /** @type {Manifest} */\n manifest;\n\n /**\n * @type {ExtensionListData}\n */\n _listDataCache;\n\n /**\n * @protected\n * @param {ExtType} extensionType - Type of extension\n * @param {Manifest} manifest - `Manifest` instance\n */\n constructor(extensionType, manifest) {\n this.extensionType = extensionType;\n this.configKey = `${extensionType}s`;\n this.installedExtensions = manifest.getExtensionData(extensionType);\n this.manifest = manifest;\n }\n\n get manifestPath() {\n return this.manifest.manifestPath;\n }\n\n get appiumHome() {\n return this.manifest.appiumHome;\n }\n\n /**\n * Returns a list of errors for a given extension.\n *\n * @param {ExtName<ExtType>} extName\n * @param {ExtManifest<ExtType>} extManifest\n * @returns {ExtManifestProblem[]}\n */\n getProblems(extName, extManifest) {\n return [\n ...this.getGenericConfigProblems(extManifest, extName),\n ...this.getConfigProblems(extManifest, extName),\n ...this.getSchemaProblems(extManifest, extName),\n ];\n }\n\n /**\n * Returns a list of warnings for a given extension.\n *\n * @param {ExtName<ExtType>} extName\n * @param {ExtManifest<ExtType>} extManifest\n * @returns {Promise<string[]>}\n */\n async getWarnings(extName, extManifest) {\n const [genericConfigWarnings, configWarnings] = await B.all([\n this.getGenericConfigWarnings(extManifest, extName),\n this.getConfigWarnings(extManifest, extName),\n ]);\n\n return [...genericConfigWarnings, ...configWarnings];\n }\n\n /**\n * Returns a list of extension-type-specific issues. To be implemented by subclasses.\n * @abstract\n * @param {ExtManifest<ExtType>} extManifest\n * @param {ExtName<ExtType>} extName\n * @returns {Promise<string[]>}\n */\n // eslint-disable-next-line no-unused-vars,require-await\n async getConfigWarnings(extManifest, extName) {\n return [];\n }\n\n /**\n *\n * @param {Map<ExtName<ExtType>,ExtManifestProblem[]>} [errorMap]\n * @param {Map<ExtName<ExtType>,string[]>} [warningMap]\n */\n getValidationResultSummaries(errorMap = new Map(), warningMap = new Map()) {\n /**\n * Array of computed strings\n * @type {string[]}\n */\n const errorSummaries = [];\n for (const [extName, problems] of errorMap.entries()) {\n if (_.isEmpty(problems)) {\n continue;\n }\n // remove this extension from the list since it's not valid\n errorSummaries.push(\n `${this.extensionType} \"${extName}\" had ${util.pluralize(\n 'error',\n problems.length\n )} and will not be available:`\n );\n for (const problem of problems) {\n errorSummaries.push(\n ` - ${problem.err} (Actual value: ` + `${JSON.stringify(problem.val)})`\n );\n }\n }\n /** @type {string[]} */\n const warningSummaries = [];\n for (const [extName, warnings] of warningMap.entries()) {\n if (_.isEmpty(warnings)) {\n continue;\n }\n const extTypeText = _.capitalize(this.extensionType);\n const problemEnumerationText = util.pluralize('potential problem', warnings.length, true);\n warningSummaries.push(`${extTypeText} \"${extName}\" has ${problemEnumerationText}: `);\n for (const warning of warnings) {\n warningSummaries.push(` - ${warning}`);\n }\n }\n\n return {errorSummaries, warningSummaries};\n }\n\n /**\n * Checks extensions for problems. To be called by subclasses' `validate` method.\n *\n * Errors and warnings will be displayed to the user.\n *\n * This method mutates `exts`.\n *\n * @protected\n * @param {ExtRecord<ExtType>} exts - Lookup of extension names to {@linkcode ExtManifest} objects\n * @returns {Promise<ExtRecord<ExtType>>} The same lookup, but picking only error-free extensions\n */\n async _validate(exts) {\n /**\n * Lookup of extension names to {@linkcode ExtManifestProblem ExtManifestProblems}\n * @type {Map<ExtName<ExtType>,ExtManifestProblem[]>}\n */\n const errorMap = new Map();\n /**\n * Lookup of extension names to warnings.\n * @type {Map<ExtName<ExtType>,string[]>}\n */\n const warningMap = new Map();\n\n for (const [extName, extManifest] of _.toPairs(exts)) {\n const [errors, warnings] = await B.all([\n this.getProblems(extName, extManifest),\n this.getWarnings(extName, extManifest),\n ]);\n if (errors.length) {\n delete exts[extName];\n }\n errorMap.set(extName, errors);\n warningMap.set(extName, warnings);\n }\n\n const {errorSummaries, warningSummaries} = this.getValidationResultSummaries(\n errorMap,\n warningMap\n );\n\n if (!_.isEmpty(errorSummaries)) {\n log.error(\n `Appium encountered ${util.pluralize('error', errorMap.size, true)} while validating ${\n this.configKey\n } found in manifest ${this.manifestPath}`\n );\n for (const summary of errorSummaries) {\n log.error(summary);\n }\n } else {\n // only display warnings if there are no errors!\n\n if (!_.isEmpty(warningSummaries)) {\n log.warn(\n `Appium encountered ${util.pluralize(\n 'warning',\n warningMap.size,\n true\n )} while validating ${this.configKey} found in manifest ${this.manifestPath}`\n );\n for (const summary of warningSummaries) {\n log.warn(summary);\n }\n }\n }\n return exts;\n }\n\n /**\n * Retrieves listing data for extensions via command class.\n * Caches the result in {@linkcode ExtensionConfig._listDataCache}\n * @protected\n * @returns {Promise<ExtensionListData>}\n */\n async getListData() {\n if (this._listDataCache) {\n return this._listDataCache;\n }\n const CommandClass = /** @type {ExtCommand<ExtType>} */ (commandClasses[this.extensionType]);\n const cmd = new CommandClass({config: this, json: true});\n const listData = await cmd.list({showInstalled: true, showUpdates: true});\n this._listDataCache = listData;\n return listData;\n }\n\n /**\n * Returns a list of warnings for a particular extension.\n *\n * By definition, a non-empty list of warnings does _not_ imply the extension cannot be loaded,\n * but it may not work as expected or otherwise throw an exception at runtime.\n *\n * @param {ExtManifest<ExtType>} extManifest\n * @param {ExtName<ExtType>} extName\n * @returns {Promise<string[]>}\n */\n async getGenericConfigWarnings(extManifest, extName) {\n const {appiumVersion, installSpec, installType, pkgName} = extManifest;\n const warnings = [];\n\n const invalidFields = [];\n if (!_.isString(installSpec)) {\n invalidFields.push('installSpec');\n }\n\n if (!INSTALL_TYPES.has(installType)) {\n invalidFields.push('installType');\n }\n\n const extTypeText = _.capitalize(this.extensionType);\n\n if (invalidFields.length) {\n const invalidFieldsEnumerationText = util.pluralize(\n 'invalid or missing field',\n invalidFields.length,\n true\n );\n const invalidFieldsText = invalidFields.map((field) => `\"${field}\"`).join(', ');\n\n warnings.push(\n `${extTypeText} \"${extName}\" (package \\`${pkgName}\\`) has ${invalidFieldsEnumerationText} (${invalidFieldsText}) in \\`extensions.yaml\\`; this may cause upgrades done via the \\`appium\\` CLI tool to fail. Please reinstall with \\`appium ${this.extensionType} uninstall ${extName}\\` and \\`appium ${this.extensionType} install ${extName}\\` to attempt a fix.`\n );\n }\n\n /**\n * Helps concatenate warning messages related to peer dependencies\n * @param {string} reason\n * @returns string\n */\n const createPeerWarning = (reason) =>\n `${extTypeText} \"${extName}\" (package \\`${pkgName}\\`) may be incompatible with the current version of Appium (v${APPIUM_VER}) due to ${reason}`;\n\n if (_.isString(appiumVersion) && !satisfies(APPIUM_VER, appiumVersion)) {\n const listData = await this.getListData();\n const extListData = /** @type {InstalledExtensionListData} */ (listData[extName]);\n if (extListData?.installed) {\n const {updateVersion, upToDate} = extListData;\n if (!upToDate) {\n warnings.push(\n createPeerWarning(\n `its peer dependency on older Appium v${appiumVersion}. Please upgrade \\`${pkgName}\\` to v${updateVersion} or newer.`\n )\n );\n } else {\n warnings.push(\n createPeerWarning(\n `its peer dependency on older Appium v${appiumVersion}. Please ask the developer of \\`${pkgName}\\` to update the peer dependency on Appium to v${APPIUM_VER}.`\n )\n );\n }\n }\n } else if (!_.isString(appiumVersion)) {\n const listData = await this.getListData();\n const extListData = /** @type {InstalledExtensionListData} */ (listData[extName]);\n if (!extListData?.upToDate && extListData?.updateVersion) {\n warnings.push(\n createPeerWarning(\n `an invalid or missing peer dependency on Appium. A newer version of \\`${pkgName}\\` is available; please attempt to upgrade \"${extName}\" to v${extListData.updateVersion} or newer.`\n )\n );\n } else {\n warnings.push(\n createPeerWarning(\n `an invalid or missing peer dependency on Appium. Please ask the developer of \\`${pkgName}\\` to add a peer dependency on \\`^appium@${APPIUM_VER}\\`.`\n )\n );\n }\n }\n return warnings;\n }\n /**\n * Returns list of unrecoverable errors (if any) for the given extension _if_ it has a `schema` property.\n *\n * @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)\n * @param {ExtName<ExtType>} extName - Extension name (from manifest)\n * @returns {ExtManifestProblem[]}\n */\n getSchemaProblems(extManifest, extName) {\n /** @type {ExtManifestProblem[]} */\n const problems = [];\n const {schema: argSchemaPath} = extManifest;\n if (ExtensionConfig.extDataHasSchema(extManifest)) {\n if (_.isString(argSchemaPath)) {\n if (isAllowedSchemaFileExtension(argSchemaPath)) {\n try {\n this.readExtensionSchema(extName, extManifest);\n } catch (err) {\n problems.push({\n err: `Unable to register schema at path ${argSchemaPath}; ${err.message}`,\n val: argSchemaPath,\n });\n }\n } else {\n problems.push({\n err: `Schema file has unsupported extension. Allowed: ${[\n ...ALLOWED_SCHEMA_EXTENSIONS,\n ].join(', ')}`,\n val: argSchemaPath,\n });\n }\n } else if (_.isPlainObject(argSchemaPath)) {\n try {\n this.readExtensionSchema(extName, extManifest);\n } catch (err) {\n problems.push({\n err: `Unable to register embedded schema; ${err.message}`,\n val: argSchemaPath,\n });\n }\n } else {\n problems.push({\n err: 'Incorrectly formatted schema field; must be a path to a schema file or a schema object.',\n val: argSchemaPath,\n });\n }\n }\n return problems;\n }\n\n /**\n * Return a list of generic unrecoverable errors for the given extension\n * @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)\n * @param {ExtName<ExtType>} extName - Extension name (from manifest)\n * @returns {ExtManifestProblem[]}\n */\n // eslint-disable-next-line no-unused-vars\n getGenericConfigProblems(extManifest, extName) {\n const {version, pkgName, mainClass} = extManifest;\n const problems = [];\n\n if (!_.isString(version)) {\n problems.push({\n err: `Invalid or missing \\`version\\` field in my \\`package.json\\` and/or \\`extensions.yaml\\` (must be a string)`,\n val: version,\n });\n }\n\n if (!_.isString(pkgName)) {\n problems.push({\n err: `Invalid or missing \\`name\\` field in my \\`package.json\\` and/or \\`extensions.yaml\\` (must be a string)`,\n val: pkgName,\n });\n }\n\n if (!_.isString(mainClass)) {\n problems.push({\n err: `Invalid or missing \\`appium.mainClass\\` field in my \\`package.json\\` and/or \\`mainClass\\` field in \\`extensions.yaml\\` (must be a string)`,\n val: mainClass,\n });\n }\n\n return problems;\n }\n\n /**\n * @abstract\n * @param {ExtManifest<ExtType>} extManifest\n * @param {ExtName<ExtType>} extName\n * @returns {ExtManifestProblem[]}\n */\n // eslint-disable-next-line no-unused-vars\n getConfigProblems(extManifest, extName) {\n // shoud override this method if special validation is necessary for this extension type\n return [];\n }\n\n /**\n * @param {string} extName\n * @param {ExtManifest<ExtType>} extManifest\n * @param {ExtensionConfigMutationOpts} [opts]\n * @returns {Promise<void>}\n */\n async addExtension(extName, extManifest, {write = true} = {}) {\n this.manifest.addExtension(this.extensionType, extName, extManifest);\n if (write) {\n await this.manifest.write();\n }\n }\n\n /**\n * @param {ExtName<ExtType>} extName\n * @param {ExtManifest<ExtType>|import('../cli/extension-command').ExtensionFields<ExtType>} extManifest\n * @param {ExtensionConfigMutationOpts} [opts]\n * @returns {Promise<void>}\n */\n async updateExtension(extName, extManifest, {write = true} = {}) {\n this.installedExtensions[extName] = {\n ...this.installedExtensions[extName],\n ...extManifest,\n };\n if (write) {\n await this.manifest.write();\n }\n }\n\n /**\n * Remove an extension from the list of installed extensions, and optionally avoid a write to the manifest file.\n *\n * @param {ExtName<ExtType>} extName\n * @param {ExtensionConfigMutationOpts} [opts]\n * @returns {Promise<void>}\n */\n async removeExtension(extName, {write = true} = {}) {\n delete this.installedExtensions[extName];\n if (write) {\n await this.manifest.write();\n }\n }\n\n /**\n * @param {ExtName<ExtType>[]} [activeNames]\n * @returns {void}\n */\n // eslint-disable-next-line no-unused-vars\n print(activeNames) {\n if (_.isEmpty(this.installedExtensions)) {\n log.info(\n `No ${this.configKey} have been installed in ${this.appiumHome}. Use the \"appium ${this.extensionType}\" ` +\n 'command to install the one(s) you want to use.'\n );\n return;\n }\n\n log.info(`Available ${this.configKey}:`);\n for (const [extName, extManifest] of /** @type {[string, ExtManifest<ExtType>][]} */ (\n _.toPairs(this.installedExtensions)\n )) {\n log.info(` - ${this.extensionDesc(extName, extManifest)}`);\n }\n }\n\n /**\n * Returns a string describing the extension. Subclasses must implement.\n * @param {ExtName<ExtType>} extName - Extension name\n * @param {ExtManifest<ExtType>} extManifest - Extension data\n * @returns {string}\n * @abstract\n */\n // eslint-disable-next-line no-unused-vars\n extensionDesc(extName, extManifest) {\n throw new Error('This must be implemented in a subclass');\n }\n\n /**\n * @param {string} extName\n * @returns {string}\n */\n getInstallPath(extName) {\n return path.join(this.appiumHome, 'node_modules', this.installedExtensions[extName].pkgName);\n }\n\n /**\n * Loads extension and returns its main class (constructor)\n * @param {ExtName<ExtType>} extName\n * @returns {ExtClass<ExtType>}\n */\n require(extName) {\n const {mainClass} = this.installedExtensions[extName];\n const reqPath = this.getInstallPath(extName);\n /** @type {string} */\n let reqResolved;\n try {\n reqResolved = require.resolve(reqPath);\n } catch (err) {\n throw new ReferenceError(`Could not find a ${this.extensionType} installed at ${reqPath}`);\n }\n // note: this will only reload the entry point\n if (process.env.APPIUM_RELOAD_EXTENSIONS && require.cache[reqResolved]) {\n log.debug(`Removing ${reqResolved} from require cache`);\n delete require.cache[reqResolved];\n }\n log.debug(`Requiring ${this.extensionType} at ${reqPath}`);\n const MainClass = require(reqPath)[mainClass];\n if (!MainClass) {\n throw new ReferenceError(\n `Could not find a class named \"${mainClass}\" exported by ${this.extensionType} \"${extName}\"`\n );\n }\n return MainClass;\n }\n\n /**\n * @param {string} extName\n * @returns {boolean}\n */\n isInstalled(extName) {\n return _.includes(Object.keys(this.installedExtensions), extName);\n }\n\n /**\n * Intended to be called by corresponding instance methods of subclass.\n * @private\n * @template {ExtensionType} ExtType\n * @param {string} appiumHome\n * @param {ExtType} extType\n * @param {ExtName<ExtType>} extName - Extension name (unique to its type)\n * @param {ExtManifestWithSchema<ExtType>} extManifest - Extension config\n * @returns {import('ajv').SchemaObject|undefined}\n */\n static _readExtensionSchema(appiumHome, extType, extName, extManifest) {\n const {pkgName, schema: argSchemaPath} = extManifest;\n if (!argSchemaPath) {\n throw new TypeError(\n `No \\`schema\\` property found in config for ${extType} ${pkgName} -- why is this function being called?`\n );\n }\n let moduleObject;\n if (_.isString(argSchemaPath)) {\n const schemaPath = resolveFrom(appiumHome, path.join(pkgName, argSchemaPath));\n moduleObject = require(schemaPath);\n } else {\n moduleObject = argSchemaPath;\n }\n // this sucks. default exports should be destroyed\n const schema = moduleObject.__esModule ? moduleObject.default : moduleObject;\n registerSchema(extType, extName, schema);\n return schema;\n }\n\n /**\n * Returns `true` if a specific {@link ExtManifest} object has a `schema` prop.\n * The {@link ExtManifest} object becomes a {@link ExtManifestWithSchema} object.\n * @template {ExtensionType} ExtType\n * @param {ExtManifest<ExtType>} extManifest\n * @returns {extManifest is ExtManifestWithSchema<ExtType>}\n */\n static extDataHasSchema(extManifest) {\n return _.isString(extManifest?.schema) || _.isObject(extManifest?.schema);\n }\n\n /**\n * If an extension provides a schema, this will load the schema and attempt to\n * register it with the schema registrar.\n * @param {ExtName<ExtType>} extName - Name of extension\n * @param {ExtManifestWithSchema<ExtType>} extManifest - Extension data\n * @returns {import('ajv').SchemaObject|undefined}\n */\n readExtensionSchema(extName, extManifest) {\n return ExtensionConfig._readExtensionSchema(\n this.appiumHome,\n this.extensionType,\n extName,\n extManifest\n );\n }\n}\n\nexport {INSTALL_TYPE_NPM, INSTALL_TYPE_GIT, INSTALL_TYPE_LOCAL, INSTALL_TYPE_GITHUB, INSTALL_TYPES};\n\n/**\n * An issue with the {@linkcode ExtManifest} for a particular extension.\n *\n * The existance of such an object implies that the extension cannot be loaded.\n * @typedef ExtManifestProblem\n * @property {string} err - Error message\n * @property {any} val - Associated value\n */\n\n/**\n * An optional logging function provided to an {@link ExtensionConfig} subclass.\n * @callback ExtensionLogFn\n * @param {...any} args\n * @returns {void}\n */\n\n/**\n * @typedef {import('@appium/types').ExtensionType} ExtensionType\n * @typedef {import('./manifest').Manifest} Manifest\n */\n\n/**\n * @template T\n * @typedef {import('appium/types').ExtManifest<T>} ExtManifest\n */\n\n/**\n * @template T\n * @typedef {import('appium/types').ExtManifestWithSchema<T>} ExtManifestWithSchema\n */\n\n/**\n * @template T\n * @typedef {import('appium/types').ExtName<T>} ExtName\n */\n\n/**\n * @template T\n * @typedef {import('appium/types').ExtClass<T>} ExtClass\n */\n\n/**\n * @template T\n * @typedef {import('appium/types').ExtRecord<T>} ExtRecord\n */\n\n/**\n * @template T\n * @typedef {import('../cli/extension').ExtCommand<T>} ExtCommand\n */\n\n/**\n * Options for various methods in {@link ExtensionConfig}\n * @typedef ExtensionConfigMutationOpts\n * @property {boolean} [write=true] Whether or not to write the manifest to disk after a mutation operation\n */\n\n/**\n * A valid install type\n * @typedef {typeof INSTALL_TYPE_NPM | typeof INSTALL_TYPE_GIT | typeof INSTALL_TYPE_LOCAL | typeof INSTALL_TYPE_GITHUB} InstallType\n */\n\n/**\n * @typedef {import('../cli/extension-command').ExtensionListData} ExtensionListData\n * @typedef {import('../cli/extension-command').InstalledExtensionListData} InstalledExtensionListData\n */\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAMA,MAAMA,gBAAgB,GAAG,KAAzB;;AACA,MAAMC,kBAAkB,GAAG,OAA3B;;AACA,MAAMC,mBAAmB,GAAG,QAA5B;;AACA,MAAMC,gBAAgB,GAAG,KAAzB;;AAGA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
|
-
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getActiveDrivers = exports.getActivePlugins = exports.loadExtensions = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
10
|
+
const driver_config_1 = require("./driver-config");
|
|
11
|
+
const manifest_1 = require("./manifest");
|
|
12
|
+
const plugin_config_1 = require("./plugin-config");
|
|
13
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
14
|
+
/**
|
|
15
|
+
* Loads extensions and creates `ExtensionConfig` instances.
|
|
16
|
+
*
|
|
17
|
+
* - Reads the manifest file, creating if necessary
|
|
18
|
+
* - Using the parsed extension data, creates/gets the `ExtensionConfig` subclass instances
|
|
19
|
+
* - Returns these instances
|
|
20
|
+
*
|
|
21
|
+
* If `appiumHome` is needed, use `resolveAppiumHome` from the `env` module in `@appium/support`.
|
|
22
|
+
* @param {string} appiumHome
|
|
23
|
+
* @returns {Promise<ExtensionConfigs>}
|
|
24
|
+
*/
|
|
28
25
|
async function loadExtensions(appiumHome) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const pluginConfig = _pluginConfig.PluginConfig.getInstance(manifest) ?? _pluginConfig.PluginConfig.create(manifest);
|
|
36
|
-
|
|
37
|
-
await _bluebird.default.all([driverConfig.validate(), pluginConfig.validate()]);
|
|
38
|
-
return {
|
|
39
|
-
driverConfig,
|
|
40
|
-
pluginConfig
|
|
41
|
-
};
|
|
26
|
+
const manifest = manifest_1.Manifest.getInstance(appiumHome);
|
|
27
|
+
await manifest.read();
|
|
28
|
+
const driverConfig = driver_config_1.DriverConfig.getInstance(manifest) ?? driver_config_1.DriverConfig.create(manifest);
|
|
29
|
+
const pluginConfig = plugin_config_1.PluginConfig.getInstance(manifest) ?? plugin_config_1.PluginConfig.create(manifest);
|
|
30
|
+
await bluebird_1.default.all([driverConfig.validate(), pluginConfig.validate()]);
|
|
31
|
+
return { driverConfig, pluginConfig };
|
|
42
32
|
}
|
|
43
|
-
|
|
33
|
+
exports.loadExtensions = loadExtensions;
|
|
34
|
+
/**
|
|
35
|
+
* Find any plugin name which has been installed, and which has been requested for activation by
|
|
36
|
+
* using the --use-plugins flag, and turn each one into its class, so we can send them as objects
|
|
37
|
+
* to the server init. We also want to send/assign them to the umbrella driver so it can use them
|
|
38
|
+
* to wrap command execution
|
|
39
|
+
*
|
|
40
|
+
* @param {import('./plugin-config').PluginConfig} pluginConfig - a plugin extension config
|
|
41
|
+
* @param {string[]} usePlugins
|
|
42
|
+
* @returns {PluginNameMap} Mapping of PluginClass to name
|
|
43
|
+
*/
|
|
44
44
|
function getActivePlugins(pluginConfig, usePlugins = []) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
return new Map(lodash_1.default.compact(Object.keys(pluginConfig.installedExtensions)
|
|
46
|
+
.filter((pluginName) => lodash_1.default.includes(usePlugins, pluginName) ||
|
|
47
|
+
(usePlugins.length === 1 && usePlugins[0] === constants_1.USE_ALL_PLUGINS))
|
|
48
|
+
.map((pluginName) => {
|
|
49
|
+
try {
|
|
50
|
+
logger_1.default.info(`Attempting to load plugin ${pluginName}...`);
|
|
51
|
+
const PluginClass = pluginConfig.require(pluginName);
|
|
52
|
+
return [PluginClass, pluginName];
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
logger_1.default.error(`Could not load plugin '${pluginName}', so it will not be available. Error ` +
|
|
56
|
+
`in loading the plugin was: ${err.message}`);
|
|
57
|
+
logger_1.default.debug(err.stack);
|
|
58
|
+
}
|
|
59
|
+
})));
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
exports.getActivePlugins = getActivePlugins;
|
|
62
|
+
/**
|
|
63
|
+
* Find any driver name which has been installed, and turn each one into its class, so we can send
|
|
64
|
+
* them as objects to the server init in case they need to add methods/routes or update the server.
|
|
65
|
+
* If the --drivers flag was given, this method only loads the given drivers.
|
|
66
|
+
*
|
|
67
|
+
* @param {import('./driver-config').DriverConfig} driverConfig - a driver extension config
|
|
68
|
+
* @param {string[]} [useDrivers] - optional list of drivers to load
|
|
69
|
+
* @returns {DriverNameMap}
|
|
70
|
+
*/
|
|
60
71
|
function getActiveDrivers(driverConfig, useDrivers = []) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
return new Map(lodash_1.default.compact(Object.keys(driverConfig.installedExtensions)
|
|
73
|
+
.filter((driverName) => lodash_1.default.includes(useDrivers, driverName) || useDrivers.length === 0)
|
|
74
|
+
.map((driverName) => {
|
|
75
|
+
try {
|
|
76
|
+
logger_1.default.info(`Attempting to load driver ${driverName}...`);
|
|
77
|
+
const DriverClass = driverConfig.require(driverName);
|
|
78
|
+
return [DriverClass, driverName];
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
logger_1.default.error(`Could not load driver '${driverName}', so it will not be available. Error ` +
|
|
82
|
+
`in loading the driver was: ${err.message}`);
|
|
83
|
+
logger_1.default.debug(err.stack);
|
|
84
|
+
}
|
|
85
|
+
})));
|
|
74
86
|
}
|
|
75
|
-
|
|
87
|
+
exports.getActiveDrivers = getActiveDrivers;
|
|
88
|
+
/**
|
|
89
|
+
* A mapping of {@linkcode PluginClass} classes to their names.
|
|
90
|
+
* @typedef {Map<PluginClass,string>} PluginNameMap
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* A mapping of {@linkcode DriverClass} classes to their names.
|
|
94
|
+
* @typedef {Map<DriverClass,string>} DriverNameMap
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {import('@appium/types').PluginClass} PluginClass
|
|
98
|
+
* @typedef {import('@appium/types').DriverClass} DriverClass
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* @typedef ExtensionConfigs
|
|
102
|
+
* @property {import('./driver-config').DriverConfig} driverConfig
|
|
103
|
+
* @property {import('./plugin-config').PluginConfig} pluginConfig
|
|
104
|
+
*/
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/extension/index.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAA6C;AAC7C,uDAA4B;AAC5B,mDAA6C;AAC7C,yCAAoC;AACpC,mDAA6C;AAC7C,wDAAyB;AAEzB;;;;;;;;;;GAUG;AACI,KAAK,UAAU,cAAc,CAAC,UAAU;IAC7C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACtB,MAAM,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,4BAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzF,MAAM,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,4BAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEzF,MAAM,kBAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,QAAQ,EA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,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;SACrF,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAClB,IAAI;YACF,gBAAG,CAAC,IAAI,CAAC,6BAA6B,UAAU,KAAK,CAAC,CAAC;YACvD,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;SAClC;QAAC,OAAO,GAAG,EAAE;YACZ,gBAAG,CAAC,KAAK,CACP,0BAA0B,UAAU,wCAAwC;gBAC1E,8BAA8B,GAAG,CAAC,OAAO,EAAE,CAC9C,CAAC;YACF,gBAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CACL,CACF,CAAC;AACJ,CAAC;AApBD,4CAoBC;AAED;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies a series of migration functions to a manifest to update its manifest schema version.
|
|
3
|
+
*
|
|
4
|
+
* `data` is modified in-place.
|
|
5
|
+
*
|
|
6
|
+
* @param {Readonly<Manifest>} manifest
|
|
7
|
+
* @returns {Promise<boolean>} If `true` existing packages should be synced from disk and the manifest should be persisted.
|
|
8
|
+
*/
|
|
9
|
+
export function migrate(manifest: Readonly<Manifest>): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* A migration function. It will return `true` if a change _should be made_.
|
|
12
|
+
*
|
|
13
|
+
* A migration function should not modify `schemaRev`, as this is done automatically.
|
|
14
|
+
*
|
|
15
|
+
* Note that at the time of writing, we're not able to determine the version of the _current_ manifest file if there is no `schemaRev` prop present (and we may not want to trust it anyway).
|
|
16
|
+
*/
|
|
17
|
+
export type Migration = (manifest: Readonly<Manifest>) => boolean | Promise<boolean>;
|
|
18
|
+
export type ManifestData = import('appium/types').ManifestData;
|
|
19
|
+
export type DriverType = import('@appium/types').DriverType;
|
|
20
|
+
export type PluginType = import('@appium/types').PluginType;
|
|
21
|
+
export type AnyManifestDataVersion = import('appium/types').AnyManifestDataVersion;
|
|
22
|
+
export type ManifestDataVersions = import('appium/types').ManifestDataVersions;
|
|
23
|
+
export type ExtensionType = import('@appium/types').ExtensionType;
|
|
24
|
+
export type ManifestDataV2 = import('appium/types').ManifestV2.ManifestData;
|
|
25
|
+
export type Manifest = import('./manifest').Manifest;
|
|
26
|
+
export type ExtManifest<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtManifest<ExtType>;
|
|
27
|
+
//# sourceMappingURL=manifest-migrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-migrations.d.ts","sourceRoot":"","sources":["../../../lib/extension/manifest-migrations.js"],"names":[],"mappings":"AAsEA;;;;;;;GAOG;AACH,kCAHW,SAAS,QAAQ,CAAC,GAChB,QAAQ,OAAO,CAAC,CAgB5B;;;;;;;;mCASU,SAAS,QAAQ,CAAC,KAChB,OAAO,GAAC,QAAQ,OAAO,CAAC;2BAIxB,OAAO,cAAc,EAAE,YAAY;yBACnC,OAAO,eAAe,EAAE,UAAU;yBAClC,OAAO,eAAe,EAAE,UAAU;qCAClC,OAAO,cAAc,EAAE,sBAAsB;mCAC7C,OAAO,cAAc,EAAE,oBAAoB;4BAC3C,OAAO,eAAe,EAAE,aAAa;6BACrC,OAAO,cAAc,EAAE,UAAU,CAAC,YAAY;uBAC9C,OAAO,YAAY,EAAE,QAAQ;iFAK7B,OAAO,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.migrate = void 0;
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
9
|
+
/**
|
|
10
|
+
* This contains logic to migrate old versions of `extensions.yaml` to new versions.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Constant for v3 of the schema rev.
|
|
16
|
+
*/
|
|
17
|
+
const SCHEMA_REV_3 = 3;
|
|
18
|
+
/**
|
|
19
|
+
* Collection of functions to migrate from one version to another.
|
|
20
|
+
*
|
|
21
|
+
* These functions _should not actually perform the migration_; rather, they
|
|
22
|
+
* should return `true` if the migration should be performed. The migration
|
|
23
|
+
* itself will happen within {@linkcode Manifest.syncWithInstalledExtensions}; the extensions
|
|
24
|
+
* will be checked and the manifest file updated per the state of the filesystem.
|
|
25
|
+
*
|
|
26
|
+
* @type {{[P in keyof ManifestDataVersions]?: Migration}}
|
|
27
|
+
*/
|
|
28
|
+
const Migrations = {
|
|
29
|
+
/**
|
|
30
|
+
* If `installPath` is missing from the `ExtManifest` for any extension, return `true`.
|
|
31
|
+
*
|
|
32
|
+
* We cannot easily determine the path of any given extension here, but returning `true`
|
|
33
|
+
* will cause the `Manifest` to sync with the filesystem, which will populate the missing field.
|
|
34
|
+
*
|
|
35
|
+
* @type {Migration}
|
|
36
|
+
*/
|
|
37
|
+
[SCHEMA_REV_3]: (manifest) => {
|
|
38
|
+
let shouldSync = false;
|
|
39
|
+
/** @type {Array<ExtManifest<PluginType>|ExtManifest<DriverType>>} */
|
|
40
|
+
const allExtData = [
|
|
41
|
+
...Object.values(manifest.getExtensionData(constants_1.DRIVER_TYPE)),
|
|
42
|
+
...Object.values(manifest.getExtensionData(constants_1.PLUGIN_TYPE)),
|
|
43
|
+
];
|
|
44
|
+
for (const metadata of allExtData) {
|
|
45
|
+
if (!('installPath' in metadata)) {
|
|
46
|
+
shouldSync = true;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return shouldSync;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Set `schemaRev` to a specific version.
|
|
55
|
+
*
|
|
56
|
+
* This _does_ mutate `data` in-place, unlike functions in
|
|
57
|
+
* {@linkcode Migrations}.
|
|
58
|
+
*
|
|
59
|
+
* Again, returning `true` means that the manifest should be--at
|
|
60
|
+
* minimum--persisted to disk, since we changed it.
|
|
61
|
+
* @param {Readonly<Manifest>} manifest
|
|
62
|
+
* @param {keyof ManifestDataVersions} version
|
|
63
|
+
* @returns {boolean} Whether the data was modified
|
|
64
|
+
*/
|
|
65
|
+
function setSchemaRev(manifest, version) {
|
|
66
|
+
if (manifest.schemaRev ?? 0 < version) {
|
|
67
|
+
manifest.setSchemaRev(version);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Applies a series of migration functions to a manifest to update its manifest schema version.
|
|
74
|
+
*
|
|
75
|
+
* `data` is modified in-place.
|
|
76
|
+
*
|
|
77
|
+
* @param {Readonly<Manifest>} manifest
|
|
78
|
+
* @returns {Promise<boolean>} If `true` existing packages should be synced from disk and the manifest should be persisted.
|
|
79
|
+
*/
|
|
80
|
+
async function migrate(manifest) {
|
|
81
|
+
let didChange = false;
|
|
82
|
+
for await (const [v, migration] of Object.entries(Migrations)) {
|
|
83
|
+
const version = /** @type {keyof ManifestDataVersions} */ (Number(v));
|
|
84
|
+
didChange = (await migration(manifest)) || didChange;
|
|
85
|
+
didChange = setSchemaRev(manifest, version) || didChange;
|
|
86
|
+
}
|
|
87
|
+
if (didChange) {
|
|
88
|
+
// this is not _technically_ true, since we don't actually write the file here.
|
|
89
|
+
logger_1.default.info(`Upgraded extension manifest to schema v${manifest.schemaRev}`);
|
|
90
|
+
}
|
|
91
|
+
return didChange;
|
|
92
|
+
}
|
|
93
|
+
exports.migrate = migrate;
|
|
94
|
+
/**
|
|
95
|
+
* A migration function. It will return `true` if a change _should be made_.
|
|
96
|
+
*
|
|
97
|
+
* A migration function should not modify `schemaRev`, as this is done automatically.
|
|
98
|
+
*
|
|
99
|
+
* Note that at the time of writing, we're not able to determine the version of the _current_ manifest file if there is no `schemaRev` prop present (and we may not want to trust it anyway).
|
|
100
|
+
* @callback Migration
|
|
101
|
+
* @param {Readonly<Manifest>} manifest - The `Manifest` instance
|
|
102
|
+
* @returns {boolean|Promise<boolean>} If `true`, then something changed
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {import('appium/types').ManifestData} ManifestData
|
|
106
|
+
* @typedef {import('@appium/types').DriverType} DriverType
|
|
107
|
+
* @typedef {import('@appium/types').PluginType} PluginType
|
|
108
|
+
* @typedef {import('appium/types').AnyManifestDataVersion} AnyManifestDataVersion
|
|
109
|
+
* @typedef {import('appium/types').ManifestDataVersions} ManifestDataVersions
|
|
110
|
+
* @typedef {import('@appium/types').ExtensionType} ExtensionType
|
|
111
|
+
* @typedef {import('appium/types').ManifestV2.ManifestData} ManifestDataV2
|
|
112
|
+
* @typedef {import('./manifest').Manifest} Manifest
|
|
113
|
+
*/
|
|
114
|
+
/**
|
|
115
|
+
* @template {ExtensionType} ExtType
|
|
116
|
+
* @typedef {import('appium/types').ExtManifest<ExtType>} ExtManifest
|
|
117
|
+
*/
|
|
118
|
+
//# sourceMappingURL=manifest-migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-migrations.js","sourceRoot":"","sources":["../../../lib/extension/manifest-migrations.js"],"names":[],"mappings":";;;;;;AAAA,4CAAsD;AACtD,uDAA4B;AAE5B;;;;GAIG;AAEH;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,UAAU,GAAG;IACjB;;;;;;;OAOG;IACH,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC3B,IAAI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