appium 3.2.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/build/lib/cli/args.d.ts +16 -12
  2. package/build/lib/cli/args.d.ts.map +1 -1
  3. package/build/lib/cli/args.js +15 -35
  4. package/build/lib/cli/args.js.map +1 -1
  5. package/build/lib/cli/driver-command.d.ts +51 -93
  6. package/build/lib/cli/driver-command.d.ts.map +1 -1
  7. package/build/lib/cli/driver-command.js +11 -66
  8. package/build/lib/cli/driver-command.js.map +1 -1
  9. package/build/lib/cli/extension-command.d.ts +211 -415
  10. package/build/lib/cli/extension-command.d.ts.map +1 -1
  11. package/build/lib/cli/extension-command.js +384 -653
  12. package/build/lib/cli/extension-command.js.map +1 -1
  13. package/build/lib/cli/extension.d.ts +11 -16
  14. package/build/lib/cli/extension.d.ts.map +1 -1
  15. package/build/lib/cli/extension.js +10 -28
  16. package/build/lib/cli/extension.js.map +1 -1
  17. package/build/lib/cli/parser.d.ts +40 -69
  18. package/build/lib/cli/parser.d.ts.map +1 -1
  19. package/build/lib/cli/parser.js +24 -59
  20. package/build/lib/cli/parser.js.map +1 -1
  21. package/build/lib/cli/plugin-command.d.ts +50 -90
  22. package/build/lib/cli/plugin-command.d.ts.map +1 -1
  23. package/build/lib/cli/plugin-command.js +11 -63
  24. package/build/lib/cli/plugin-command.js.map +1 -1
  25. package/build/lib/cli/setup-command.d.ts +21 -26
  26. package/build/lib/cli/setup-command.d.ts.map +1 -1
  27. package/build/lib/cli/setup-command.js +13 -55
  28. package/build/lib/cli/setup-command.js.map +1 -1
  29. package/build/lib/cli/utils.d.ts +27 -29
  30. package/build/lib/cli/utils.d.ts.map +1 -1
  31. package/build/lib/cli/utils.js +29 -31
  32. package/build/lib/cli/utils.js.map +1 -1
  33. package/build/lib/config-file.d.ts +24 -67
  34. package/build/lib/config-file.d.ts.map +1 -1
  35. package/build/lib/config-file.js +56 -115
  36. package/build/lib/config-file.js.map +1 -1
  37. package/build/lib/config.d.ts +42 -44
  38. package/build/lib/config.d.ts.map +1 -1
  39. package/build/lib/config.js +75 -107
  40. package/build/lib/config.js.map +1 -1
  41. package/build/lib/constants.d.ts +23 -23
  42. package/build/lib/constants.d.ts.map +1 -1
  43. package/build/lib/constants.js +10 -15
  44. package/build/lib/constants.js.map +1 -1
  45. package/build/lib/doctor/doctor.d.ts +40 -57
  46. package/build/lib/doctor/doctor.d.ts.map +1 -1
  47. package/build/lib/doctor/doctor.js +29 -60
  48. package/build/lib/doctor/doctor.js.map +1 -1
  49. package/build/lib/grid-register.d.ts +32 -7
  50. package/build/lib/grid-register.d.ts.map +1 -1
  51. package/build/lib/grid-register.js +84 -48
  52. package/build/lib/grid-register.js.map +1 -1
  53. package/build/lib/logsink.d.ts +13 -22
  54. package/build/lib/logsink.d.ts.map +1 -1
  55. package/build/lib/logsink.js +48 -103
  56. package/build/lib/logsink.js.map +1 -1
  57. package/build/lib/main.js +1 -1
  58. package/build/lib/main.js.map +1 -1
  59. package/build/lib/schema/arg-spec.d.ts +32 -107
  60. package/build/lib/schema/arg-spec.d.ts.map +1 -1
  61. package/build/lib/schema/arg-spec.js +11 -107
  62. package/build/lib/schema/arg-spec.js.map +1 -1
  63. package/build/lib/schema/cli-args.d.ts +3 -15
  64. package/build/lib/schema/cli-args.d.ts.map +1 -1
  65. package/build/lib/schema/cli-args.js +15 -105
  66. package/build/lib/schema/cli-args.js.map +1 -1
  67. package/build/lib/schema/cli-transformers.d.ts +15 -12
  68. package/build/lib/schema/cli-transformers.d.ts.map +1 -1
  69. package/build/lib/schema/cli-transformers.js +15 -45
  70. package/build/lib/schema/cli-transformers.js.map +1 -1
  71. package/build/lib/schema/index.d.ts +2 -2
  72. package/build/lib/schema/index.d.ts.map +1 -1
  73. package/build/lib/schema/index.js.map +1 -1
  74. package/build/lib/schema/keywords.d.ts +12 -20
  75. package/build/lib/schema/keywords.d.ts.map +1 -1
  76. package/build/lib/schema/keywords.js +6 -51
  77. package/build/lib/schema/keywords.js.map +1 -1
  78. package/build/lib/schema/schema.d.ts +106 -231
  79. package/build/lib/schema/schema.d.ts.map +1 -1
  80. package/build/lib/schema/schema.js +75 -345
  81. package/build/lib/schema/schema.js.map +1 -1
  82. package/build/lib/utils.d.ts +59 -238
  83. package/build/lib/utils.d.ts.map +1 -1
  84. package/build/lib/utils.js +55 -207
  85. package/build/lib/utils.js.map +1 -1
  86. package/lib/cli/{args.js → args.ts} +40 -51
  87. package/lib/cli/driver-command.ts +122 -0
  88. package/lib/cli/{extension-command.js → extension-command.ts} +610 -689
  89. package/lib/cli/extension.ts +65 -0
  90. package/lib/cli/{parser.js → parser.ts} +48 -71
  91. package/lib/cli/plugin-command.ts +117 -0
  92. package/lib/cli/{setup-command.js → setup-command.ts} +57 -72
  93. package/lib/cli/utils.ts +97 -0
  94. package/lib/config-file.ts +212 -0
  95. package/lib/{config.js → config.ts} +129 -141
  96. package/lib/{constants.js → constants.ts} +30 -41
  97. package/lib/doctor/{doctor.js → doctor.ts} +81 -91
  98. package/lib/grid-register.ts +250 -0
  99. package/lib/{logsink.js → logsink.ts} +91 -137
  100. package/lib/main.js +1 -1
  101. package/lib/schema/arg-spec.ts +131 -0
  102. package/lib/schema/cli-args.ts +171 -0
  103. package/lib/schema/cli-transformers.ts +83 -0
  104. package/lib/schema/keywords.ts +96 -0
  105. package/lib/schema/schema.ts +449 -0
  106. package/lib/utils.ts +404 -0
  107. package/package.json +19 -20
  108. package/tsconfig.json +1 -1
  109. package/build/package.json +0 -99
  110. package/lib/cli/driver-command.js +0 -174
  111. package/lib/cli/extension.js +0 -74
  112. package/lib/cli/plugin-command.js +0 -164
  113. package/lib/cli/utils.js +0 -91
  114. package/lib/config-file.js +0 -228
  115. package/lib/grid-register.js +0 -146
  116. package/lib/schema/arg-spec.js +0 -229
  117. package/lib/schema/cli-args.js +0 -254
  118. package/lib/schema/cli-transformers.js +0 -113
  119. package/lib/schema/keywords.js +0 -136
  120. package/lib/schema/schema.js +0 -725
  121. package/lib/utils.js +0 -512
  122. /package/lib/schema/{index.js → index.ts} +0 -0
@@ -1,254 +0,0 @@
1
- import {ArgumentTypeError} from 'argparse';
2
- import _ from 'lodash';
3
- import {formatErrors} from '../config-file';
4
- import {flattenSchema, validate} from './schema';
5
- import {transformers, parseCsvLine} from './cli-transformers';
6
-
7
- /**
8
- * This module concerns functions which convert schema definitions to
9
- * `argparse`-compatible data structures, for deriving CLI arguments from a
10
- * schema.
11
- */
12
-
13
- /**
14
- * Lookup of possible values for the `type` field in a JSON schema.
15
- * @type {Readonly<Record<string, import('json-schema').JSONSchema7TypeName>>}
16
- */
17
- const TYPENAMES = Object.freeze({
18
- ARRAY: 'array',
19
- OBJECT: 'object',
20
- BOOLEAN: 'boolean',
21
- INTEGER: 'integer',
22
- NUMBER: 'number',
23
- NULL: 'null',
24
- STRING: 'string',
25
- });
26
-
27
- /**
28
- * Options with alias lengths less than this will be considered "short" flags.
29
- */
30
- const SHORT_ARG_CUTOFF = 3;
31
-
32
- /**
33
- * Convert an alias (`foo`) to a flag (`--foo`) or a short flag (`-f`).
34
- * @param {ArgSpec} argSpec - the argument specification
35
- * @param {string} [alias] - the alias to convert to a flag
36
- * @returns {string} the flag
37
- */
38
- function aliasToFlag(argSpec, alias) {
39
- const {extType, extName, name} = argSpec;
40
- const arg = alias ?? name;
41
- const isShort = arg.length < SHORT_ARG_CUTOFF;
42
- if (extType && extName) {
43
- return isShort
44
- ? `--${extType}-${_.kebabCase(extName)}-${arg}`
45
- : `--${extType}-${_.kebabCase(extName)}-${_.kebabCase(arg)}`;
46
- }
47
- return isShort ? `-${arg}` : `--${_.kebabCase(arg)}`;
48
- }
49
-
50
- /**
51
- * Converts a string to SCREAMING_SNAKE_CASE
52
- */
53
- const screamingSnakeCase = _.flow(_.snakeCase, _.toUpper);
54
-
55
- /**
56
- * Given unique property name `name`, return a function which validates a value
57
- * against a property within the schema.
58
- * @template Coerced
59
- * @param {ArgSpec} argSpec - Argument name
60
- * @param {(value: string) => Coerced} [coerce] - Function to coerce to a different
61
- * primitive
62
- * @todo See if we can remove `coerce` by allowing Ajv to coerce in its
63
- * constructor options
64
- * @returns
65
- */
66
- function getSchemaValidator({ref: schemaId}, coerce = _.identity) {
67
- /** @param {string} value */
68
- return (value) => {
69
- const coerced = coerce(value);
70
- const errors = validate(coerced, schemaId);
71
- if (_.isEmpty(errors)) {
72
- return coerced;
73
- }
74
- throw new ArgumentTypeError('\n\n' + formatErrors(errors, value, {schemaId}));
75
- };
76
- }
77
-
78
- /**
79
- * Determine the description for display on the CLI, given the schema.
80
- * @param {AppiumJSONSchema} schema
81
- * @returns {string}
82
- */
83
- function makeDescription(schema) {
84
- const {appiumCliDescription, description = '', appiumDeprecated} = schema;
85
- let desc = appiumCliDescription ?? description;
86
- if (appiumDeprecated) {
87
- desc = `[DEPRECATED] ${desc}`;
88
- }
89
- return desc;
90
- }
91
-
92
- /**
93
- * Given arg `name`, a JSON schema `subSchema`, and options, return an argument definition
94
- * as understood by `argparse`.
95
- * @param {AppiumJSONSchema} subSchema - JSON schema for the option
96
- * @param {ArgSpec} argSpec - Argument spec tuple
97
- * @returns {[[string]|[string, string], import('argparse').ArgumentOptions]} Tuple of flag and options
98
- */
99
- function subSchemaToArgDef(subSchema, argSpec) {
100
- let {type, appiumCliAliases, appiumCliTransformer, enum: enumValues} = subSchema;
101
-
102
- const {name, arg} = argSpec;
103
-
104
- const aliases = [
105
- aliasToFlag(argSpec),
106
- .../** @type {string[]} */ (appiumCliAliases ?? []).map((alias) => aliasToFlag(argSpec, alias)),
107
- ];
108
-
109
- /** @type {import('argparse').ArgumentOptions} */
110
- let argOpts = {
111
- required: false,
112
- help: makeDescription(subSchema),
113
- };
114
-
115
- // argparse infers dest from the option string (e.g. --log-level → log_level).
116
- // We need schema dest (e.g. loglevel) so merged server args and logsink use the right key.
117
- if (!argSpec.extType) {
118
- argOpts.dest = argSpec.rawDest;
119
- }
120
-
121
- /**
122
- * Generally we will provide a `type` to `argparse` as a function which
123
- * validates using ajv (which is much more full-featured than what `argparse`
124
- * can offer). The exception is `boolean`-type options, which have no
125
- * `argType`.
126
- *
127
- * Not sure if this type is correct, but it's not doing what I want. I want
128
- * to say "this is a function which returns something of type `T` where `T` is
129
- * never a `Promise`". This function must be sync.
130
- * @type {((value: string) => unknown)|undefined}
131
- */
132
- let argTypeFunction;
133
-
134
- // handle special cases for various types
135
- switch (type) {
136
- // booleans do not have a type per `ArgumentOptions`, just an "action"
137
- // NOTE: due to limitations of `argparse`, we cannot provide fancy help text, and must rely on its internal error messaging.
138
- case TYPENAMES.BOOLEAN: {
139
- argOpts.action = 'store_const';
140
- argOpts.const = true;
141
- break;
142
- }
143
-
144
- case TYPENAMES.OBJECT: {
145
- argTypeFunction = _.flow(transformers.json, (o) => {
146
- // Arrays and plain strings are also valid JSON
147
- if (!_.isPlainObject(o)) {
148
- throw new ArgumentTypeError(`'${_.truncate(o, {length: 100})}' must be a plain object`);;
149
- }
150
- return o;
151
- });
152
- break;
153
- }
154
-
155
- // arrays are treated as CSVs, because `argparse` doesn't handle array data.
156
- case TYPENAMES.ARRAY: {
157
- argTypeFunction = parseCsvLine;
158
- break;
159
- }
160
-
161
- // "number" type is coerced to float. `argparse` does this for us if we use `float` type, but
162
- // we don't.
163
- case TYPENAMES.NUMBER: {
164
- argTypeFunction = getSchemaValidator(argSpec, parseFloat);
165
- break;
166
- }
167
-
168
- // "integer" is coerced to an .. integer. again, `argparse` would do this for us if we used `int`.
169
- case TYPENAMES.INTEGER: {
170
- argTypeFunction = getSchemaValidator(argSpec, _.parseInt);
171
- break;
172
- }
173
-
174
- // strings (like number and integer) are subject to further validation
175
- // (e.g., must satisfy a mask or regex or even some custom validation
176
- // function)
177
- case TYPENAMES.STRING: {
178
- argTypeFunction = getSchemaValidator(argSpec);
179
- break;
180
- }
181
-
182
- // TODO: there may be some way to restrict this at the Ajv level --
183
- // that may involve patching the metaschema.
184
- case TYPENAMES.NULL:
185
- // falls through
186
- default: {
187
- throw new TypeError(`Schema property "${arg}": \`${type}\` type unknown or disallowed`);
188
- }
189
- }
190
-
191
- // metavar is used in help text. `boolean` cannot have a metavar--it is not
192
- // displayed--and `argparse` throws if you give it one.
193
- if (type !== TYPENAMES.BOOLEAN) {
194
- argOpts.metavar = screamingSnakeCase(name);
195
- }
196
-
197
- if (appiumCliTransformer && transformers[appiumCliTransformer]) {
198
- if (type === TYPENAMES.ARRAY) {
199
- const csvTransformer = /** @type {(x: string) => string[]} */ (argTypeFunction);
200
- argTypeFunction = (val) => _.flatMap(csvTransformer(val).map(transformers[appiumCliTransformer]));
201
- } else {
202
- argTypeFunction = _.flow(argTypeFunction ?? _.identity, transformers[appiumCliTransformer]);
203
- }
204
- }
205
-
206
- if (argTypeFunction) {
207
- argOpts.type = argTypeFunction;
208
- }
209
-
210
- // convert JSON schema `enum` to `choices`. `enum` can contain any JSON type, but `argparse`
211
- // is limited to a single type per arg (I think). so let's make everything a string.
212
- // and might as well _require_ the `type: string` while we're at it.
213
- if (enumValues && !_.isEmpty(enumValues)) {
214
- if (type === TYPENAMES.STRING) {
215
- argOpts.choices = enumValues.map(String);
216
- } else {
217
- throw new TypeError(
218
- `Problem with schema for ${arg}; \`enum\` is only supported for \`type: 'string'\``
219
- );
220
- }
221
- }
222
-
223
- // TODO: argparse only accepts the command name and a single alias; any extra aliases
224
- // will be silently discarded.
225
- const finalAliases = /** @type {[string]|[string, string]} */ (aliases);
226
- return [finalAliases, argOpts];
227
- }
228
-
229
- /**
230
- * Converts the finalized, flattened schema representation into
231
- * ArgumentDefinitions for handoff to `argparse`.
232
- *
233
- * @throws If schema has not been added to ajv (via `finalizeSchema()`)
234
- * @returns {import('../cli/args').ArgumentDefinitions} A map of arrays of
235
- * aliases to `argparse` arguments; empty if no schema found
236
- */
237
- export function toParserArgs() {
238
- const flattened = flattenSchema().filter(({schema}) => !schema.appiumCliIgnored);
239
- return new Map(_.map(flattened, ({schema, argSpec}) => subSchemaToArgDef(schema, argSpec)));
240
- }
241
-
242
- /**
243
- * @template {string|number} T
244
- * @typedef {import('ajv/dist/types').FormatValidator<T>} FormatValidator<T>
245
- */
246
-
247
- /**
248
- * A JSON 7 schema with our custom keywords.
249
- * @typedef {import('./keywords').AppiumJSONSchemaKeywords & import('json-schema').JSONSchema7} AppiumJSONSchema
250
- */
251
-
252
- /**
253
- * @typedef {import('./arg-spec').ArgSpec} ArgSpec
254
- */
@@ -1,113 +0,0 @@
1
- import {ArgumentTypeError} from 'argparse';
2
- import {readFileSync, existsSync} from 'node:fs';
3
-
4
- /**
5
- * This module provides custom keywords for Appium schemas, as well as
6
- * "transformers" (see `argTransformers` below).
7
- *
8
- * Custom keywords are just properties that will appear in a schema (e.g.,
9
- * `appium-config-schema.js`) beyond what the JSON Schema spec offers. These
10
- * are usable by extensions, as well.
11
- */
12
-
13
- /**
14
- * Splits a CSV string into an array
15
- * @param {string} value
16
- * @returns {string[]}
17
- */
18
- export function parseCsvLine(value) {
19
- return value
20
- .split(',')
21
- .map((v) => v.trim())
22
- .filter(Boolean);
23
- }
24
-
25
- /**
26
- * Split a file by newline then calls {@link parseCsvLine} on each line.
27
- * @param {string} value
28
- * @returns {string[]}
29
- */
30
- function parseCsvFile(value) {
31
- return value
32
- .split(/\r?\n/)
33
- .map((v) => v.trim())
34
- .filter(Boolean)
35
- .flatMap(parseCsvLine);
36
- }
37
-
38
- /**
39
- * Namespace containing _transformers_ for CLI arguments. "Validators" and
40
- * "formatters" do not actually modify the value, but these do.
41
- *
42
- * Use case is for when the config file can accept e.g., a `string[]`, but the
43
- * CLI can only take a `string` (as `argparse` seems to be limited in that
44
- * fashion; it also cannot understand an argument having multiple types).
45
- *
46
- * For example, the `csv` transform takes a `string` and returns a `string[]` by
47
- * splitting it by comma--_or_ if that `string` happens to be a
48
- * filepath--reading the file as a `.csv`.
49
- *
50
- * This contains some copy-pasted code from `lib/cli/parser-helpers.js`, which was
51
- * obliterated.
52
- */
53
- export const transformers = {
54
- /**
55
- * Given a CSV-style string or pathname, parse it into an array.
56
- * The file can also be split on newlines.
57
- * @param {string} csvOrPath
58
- * @returns {string[]}
59
- */
60
- csv: (csvOrPath) => {
61
- let csv = csvOrPath;
62
- let loadedFromFile = false;
63
- // since this value could be a single string (no commas) _or_ a pathname, we will need
64
- // to attempt to parse it as a file _first_.
65
- if (existsSync(csvOrPath)) {
66
- try {
67
- csv = readFileSync(csvOrPath, 'utf8');
68
- } catch (err) {
69
- throw new ArgumentTypeError(`Could not read file '${csvOrPath}': ${err.message}`);
70
- }
71
- loadedFromFile = true;
72
- }
73
- try {
74
- return loadedFromFile ? parseCsvFile(csv) : parseCsvLine(csv);
75
- } catch (err) {
76
- const msg = loadedFromFile
77
- ? `The provided value of '${csvOrPath}' must be a valid CSV`
78
- : `Must be a comma-delimited string, e.g., "foo,bar,baz"`;
79
- throw new TypeError(`${msg}. Original error: ${err.message}`);
80
- }
81
- },
82
-
83
- /**
84
- * Parse a string which could be a path to a JSON file or a JSON string.
85
- * @param {string} jsonOrPath
86
- * @returns {object}
87
- */
88
- json: (jsonOrPath) => {
89
- let json = jsonOrPath;
90
- let loadedFromFile = false;
91
- if (existsSync(jsonOrPath)) {
92
- try {
93
- // use synchronous file access, as `argparse` provides no way of either
94
- // awaiting or using callbacks. This step happens in startup, in what is
95
- // effectively command-line code, so nothing is blocked in terms of
96
- // sessions, so holding up the event loop does not incur the usual
97
- // drawbacks.
98
- json = readFileSync(jsonOrPath, 'utf8');
99
- } catch (err) {
100
- throw new ArgumentTypeError(`Could not read file '${jsonOrPath}': ${err.message}`);
101
- }
102
- loadedFromFile = true;
103
- }
104
- try {
105
- return JSON.parse(json);
106
- } catch (e) {
107
- const msg = loadedFromFile
108
- ? `'${jsonOrPath}' must be a valid JSON`
109
- : `The provided value must be a valid JSON`;
110
- throw new TypeError(`${msg}. Original error: ${e.message}`);
111
- }
112
- },
113
- };
@@ -1,136 +0,0 @@
1
- import {transformers} from './cli-transformers';
2
-
3
- /**
4
- * Collection of keyword definitions to add to the singleton `Ajv` instance.
5
- * @type {Record<string,KeywordDefinition>}
6
- */
7
- export const keywords = {
8
- /**
9
- * Keyword to provide a list of command alias names for the CLI.
10
- *
11
- * If defined, there must be at least one item in the array and it must be non-empty.
12
- * All items in the array must be unique.
13
- *
14
- * @todo Avoid alias collisions!
15
- * @type {KeywordDefinition}
16
- * @example
17
- * {appiumCliAliases: ['B', 'bobby', 'robert']}
18
- */
19
- appiumCliAliases: {
20
- keyword: 'appiumCliAliases',
21
- metaSchema: {
22
- type: 'array',
23
- items: {
24
- type: 'string',
25
- minLength: 1,
26
- },
27
- minItems: 1,
28
- uniqueItems: true,
29
- description:
30
- 'List of aliases for the argument. Aliases shorter than three (3) characters will be prefixed with a single dash; otherwise two (2).',
31
- },
32
- },
33
- /**
34
- * Keyword to provide the name of the property in the destination (parsed
35
- * args) object. By default, this value will be whatever the property name is,
36
- * but camel-cased. If a flag needs something _other_ than just camel-casing,
37
- * use this.
38
- * @type {KeywordDefinition}
39
- * @example
40
- * // for prop 'no-color'
41
- * {appiumCliDest: 'NOCOLOR'} // value will be stored as property `NOCOLOR` instead of `noColor`
42
- */
43
- appiumCliDest: {
44
- keyword: 'appiumCliDest',
45
- metaSchema: {
46
- type: 'string',
47
- minLength: 1,
48
- description: 'Name of the associated property in the parsed CLI arguments object',
49
- },
50
- },
51
-
52
- /**
53
- * CLI-specific description of the property. Sometimes the allowed type can
54
- * be different enough on the CLI that providing a description written for a
55
- * config file context wouldn't make sense.
56
- * @type {KeywordDefinition}
57
- * @example
58
- * {appiumCliDescription: 'This is a comma-delimited string, but in the config file it is an array'}
59
- */
60
- appiumCliDescription: {
61
- keyword: 'appiumCliDescription',
62
- schemaType: 'string',
63
- metaSchema: {
64
- type: 'string',
65
- minLength: 1,
66
- description: 'Description to provide in the --help text of the CLI. Overrides `description`',
67
- },
68
- },
69
-
70
- /**
71
- * Transformers for CLI args. These usually take strings then do something with them, like
72
- * read a file or parse further.
73
- * @type {KeywordDefinition}
74
- */
75
- appiumCliTransformer: {
76
- keyword: 'appiumCliTransformer',
77
- metaSchema: {
78
- type: 'string',
79
- enum: Object.keys(transformers),
80
- description:
81
- 'The name of a custom transformer to run against the value as provided via the CLI.',
82
- },
83
- },
84
-
85
- /**
86
- * Flag to tell Appium to _not_ provide this property as a CLI argument.
87
- * @type {KeywordDefinition}
88
- */
89
- appiumCliIgnored: {
90
- keyword: 'appiumCliIgnored',
91
- metaSchema: {
92
- type: 'boolean',
93
- description:
94
- 'If `true`, Appium will not provide this property as a CLI argument. This is NOT the same as a "hidden" argument.',
95
- enum: [true],
96
- },
97
- },
98
-
99
- /**
100
- * Mark this property as deprecated.
101
- * @type {KeywordDefinition}
102
- */
103
- appiumDeprecated: {
104
- keyword: 'appiumDeprecated',
105
- metaSchema: {
106
- type: 'boolean',
107
- description: 'If `true`, this property will be displayed as "deprecated" to the user',
108
- enum: [true],
109
- $comment:
110
- 'JSON schema draft-2019-09 keyword `deprecated` serves the same purpose. This keyword should itself be deprecated if we move to draft-2019-09!',
111
- },
112
- },
113
- };
114
-
115
- /**
116
- * These are the valid values for the `appiumCliTransformer` keyword.
117
- * Unfortunately, TS cannot infer this in a JS context. In TS, we'd use
118
- * `as const` when defining `argTransformers`, then get `keyof typeof argTransformers`. alas.
119
- * @typedef {'csv'|'json'} AppiumCliTransformerName
120
- */
121
-
122
- /**
123
- * These are the custom keywords that Appium recognizes.
124
- *
125
- * @typedef AppiumJSONSchemaKeywords
126
- * @property {string} [appiumCliDest]
127
- * @property {string} [appiumCliDescription]
128
- * @property {string[]} [appiumCliAliases]
129
- * @property {boolean} [appiumCliIgnored]
130
- * @property {AppiumCliTransformerName} [appiumCliTransformer]
131
- * @property {boolean} [appiumDeprecated]
132
- */
133
-
134
- /**
135
- * @typedef {import('ajv').KeywordDefinition} KeywordDefinition
136
- */