appium 2.0.0-beta.9 → 2.0.0-rc.1
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/LICENSE +1 -1
- package/README.md +149 -58
- package/build/lib/appium.d.ts +229 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +677 -449
- package/build/lib/appium.js.map +1 -0
- package/build/lib/cli/args.d.ts +17 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +263 -300
- package/build/lib/cli/args.js.map +1 -0
- package/build/lib/cli/driver-command.d.ts +102 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +131 -81
- package/build/lib/cli/driver-command.js.map +1 -0
- package/build/lib/cli/extension-command.d.ts +402 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +799 -383
- package/build/lib/cli/extension-command.js.map +1 -0
- package/build/lib/cli/extension.d.ts +23 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +70 -68
- package/build/lib/cli/extension.js.map +1 -0
- package/build/lib/cli/parser.d.ts +84 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +252 -148
- package/build/lib/cli/parser.js.map +1 -0
- package/build/lib/cli/plugin-command.d.ts +99 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +125 -81
- package/build/lib/cli/plugin-command.js.map +1 -0
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +72 -51
- package/build/lib/cli/utils.js.map +1 -0
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +207 -0
- package/build/lib/config-file.js.map +1 -0
- package/build/lib/config.d.ts +49 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +262 -223
- package/build/lib/config.js.map +1 -0
- package/build/lib/constants.d.ts +56 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +73 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/extension/driver-config.d.ts +82 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +210 -0
- package/build/lib/extension/driver-config.js.map +1 -0
- package/build/lib/extension/extension-config.d.ts +270 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +601 -0
- package/build/lib/extension/extension-config.js.map +1 -0
- package/build/lib/extension/index.d.ts +48 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +105 -0
- package/build/lib/extension/index.js.map +1 -0
- 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 +134 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +145 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +528 -0
- package/build/lib/extension/manifest.js.map +1 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +62 -0
- package/build/lib/extension/package-changed.js.map +1 -0
- package/build/lib/extension/plugin-config.d.ts +56 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +102 -0
- package/build/lib/extension/plugin-config.js.map +1 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +122 -144
- package/build/lib/grid-register.js.map +1 -0
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +5 -17
- package/build/lib/logger.js.map +1 -0
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +189 -184
- package/build/lib/logsink.js.map +1 -0
- package/build/lib/main.d.ts +62 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +406 -234
- package/build/lib/main.js.map +1 -0
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +164 -0
- package/build/lib/schema/arg-spec.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +220 -0
- package/build/lib/schema/cli-args.js.map +1 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +124 -0
- package/build/lib/schema/cli-transformers.js.map +1 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +19 -0
- package/build/lib/schema/index.js.map +1 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +128 -0
- package/build/lib/schema/keywords.js.map +1 -0
- package/build/lib/schema/schema.d.ts +260 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +640 -0
- package/build/lib/schema/schema.js.map +1 -0
- package/build/lib/utils.d.ts +276 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +372 -192
- package/build/lib/utils.js.map +1 -0
- package/build/types/cli.d.ts +134 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- 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 +21 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +42 -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/build/types/manifest/v4.d.ts +139 -0
- package/build/types/manifest/v4.d.ts.map +1 -0
- package/build/types/manifest/v4.js +3 -0
- package/build/types/manifest/v4.js.map +1 -0
- package/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/index.js +11 -0
- package/lib/appium.js +545 -188
- package/lib/cli/args.js +275 -407
- package/lib/cli/driver-command.js +132 -24
- package/lib/cli/extension-command.js +751 -272
- package/lib/cli/extension.js +38 -19
- package/lib/cli/parser.js +267 -95
- package/lib/cli/plugin-command.js +122 -22
- package/lib/cli/utils.js +24 -10
- package/lib/config-file.js +220 -0
- package/lib/config.js +243 -132
- package/lib/constants.js +79 -0
- package/lib/extension/driver-config.js +247 -0
- package/lib/extension/extension-config.js +709 -0
- package/lib/extension/index.js +116 -0
- package/lib/extension/manifest-migrations.js +136 -0
- package/lib/extension/manifest.js +580 -0
- package/lib/extension/package-changed.js +64 -0
- package/lib/extension/plugin-config.js +112 -0
- package/lib/grid-register.js +49 -35
- package/lib/logger.js +1 -2
- package/lib/logsink.js +59 -36
- package/lib/main.js +392 -104
- package/lib/schema/arg-spec.js +229 -0
- package/lib/schema/cli-args.js +241 -0
- package/lib/schema/cli-transformers.js +119 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +136 -0
- package/lib/schema/schema.js +725 -0
- package/lib/utils.js +310 -89
- package/package.json +84 -84
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +243 -0
- package/support.d.ts +1 -0
- package/support.js +13 -0
- package/tsconfig.json +25 -0
- package/types/cli.ts +193 -0
- package/types/index.ts +20 -0
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +28 -0
- package/types/manifest/v3.ts +161 -0
- package/types/manifest/v4.ts +161 -0
- package/CHANGELOG.md +0 -3669
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/argparse-actions.js +0 -104
- package/build/lib/cli/npm.js +0 -207
- package/build/lib/cli/parser-helpers.js +0 -93
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -99
- package/build/lib/extension-config.js +0 -253
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -16
- package/build/postinstall.js +0 -90
- package/lib/cli/argparse-actions.js +0 -77
- package/lib/cli/npm.js +0 -183
- package/lib/cli/parser-helpers.js +0 -91
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -84
- package/lib/extension-config.js +0 -209
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -11
- package/postinstall.js +0 -71
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../lib/main.js"],"names":[],"mappings":";;;;;;;AAEA,uCAA8C,CAAC,iEAAiE;AAChH,sDAA8B,CAAC,gCAAgC;AAC/D,qDAAiG;AACjG,6CAAoE;AACpE,uCAAkC;AAClC,oDAAuB;AACvB,qCAAsC;AACtC,+CAAoD;AACpD,yCAAuC;AACvC,qCAUkB;AAClB,+CAA6C;AAC7C,2CAA+E;AAC/E,2CAAqE;AACrE,oEAA2C;AAC3C,4CAA+D;AAC/D,mCAUiB;AACjB,sDAAyB;AAEzB,MAAM,EAAC,iBAAiB,EAAC,GAAG,aAAG,CAAC;AAwaZ,8CAAiB;AAtarC;;;;GAIG;AACH,KAAK,UAAU,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,KAAK;IAC7D,IAAI;QACF,IAAA,oBAAW,GAAE,CAAC;QACd,MAAM,IAAA,mBAAU,GAAE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AAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;YAAC,OAAO,CAAC,EAAE;gBACV,gBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;QACH,CAAC,CAAC,CAAC;KACJ;IAED,gBAAgB,CAAC,UAAU,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE1F,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEhD,OAAO,sFAAsF,CAAC,CAC5F,MAAM,CACP,CAAC;AACJ,CAAC;AAYO,oBAAI;AAVZ,yFAAyF;AACzF,2CAA2C;AAC3C,wFAAwF;AACxF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC;CAChB;AAED,wDAAwD;AACxD,6CAA6C;AAArC,6GAAA,cAAc,OAAA;AACtB,0CAAoE;AAA5D,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAG3C;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The original ID of the Appium config schema.
|
|
3
|
+
* We use this in the CLI to convert it to `argparse` options.
|
|
4
|
+
*/
|
|
5
|
+
export const APPIUM_CONFIG_SCHEMA_ID: "appium.json";
|
|
6
|
+
/**
|
|
7
|
+
* The schema prop containing server-related options. Everything in here
|
|
8
|
+
* is "native" to Appium.
|
|
9
|
+
* Used by {@link flattenSchema} for transforming the schema into CLI args.
|
|
10
|
+
*/
|
|
11
|
+
export const SERVER_PROP_NAME: "server";
|
|
12
|
+
/**
|
|
13
|
+
* An `ArgSpec` is a class representing metadata about an argument (or config
|
|
14
|
+
* option) used for cross-referencing.
|
|
15
|
+
*
|
|
16
|
+
* This class has no instance methods, and is basically just a read-only "struct".
|
|
17
|
+
* @template D
|
|
18
|
+
*/
|
|
19
|
+
export class ArgSpec<D> {
|
|
20
|
+
/**
|
|
21
|
+
* Return the schema ID (`$id`) for the **argument** given the parameters.
|
|
22
|
+
*
|
|
23
|
+
* If you need the "root" or "base" schema ID, use {@link ArgSpec.toSchemaBaseRef} instead.
|
|
24
|
+
* @param {string} name - Argument name
|
|
25
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
26
|
+
* @param {string} [extName] - Extension name
|
|
27
|
+
* @returns {string} Schema ID
|
|
28
|
+
*/
|
|
29
|
+
static toSchemaRef(name: string, extType?: import("@appium/types").ExtensionType | undefined, extName?: string | undefined): string;
|
|
30
|
+
/**
|
|
31
|
+
* Return the schema ID for an extension or the base schema ID.
|
|
32
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
33
|
+
* @param {string} [extName] - Extension name
|
|
34
|
+
*/
|
|
35
|
+
static toSchemaBaseRef(extType?: import("@appium/types").ExtensionType | undefined, extName?: string | undefined): string;
|
|
36
|
+
/**
|
|
37
|
+
* Return the unique ID for the argument given the parameters.
|
|
38
|
+
* @param {string} name - Argument name
|
|
39
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
40
|
+
* @param {string} [extName] - Extension name
|
|
41
|
+
* @returns {string} Unique ID
|
|
42
|
+
*/
|
|
43
|
+
static toArg(name: string, extType?: import("@appium/types").ExtensionType | undefined, extName?: string | undefined): string;
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes a raw extension name (not including the type).
|
|
46
|
+
* @param {string} extName - Extension name
|
|
47
|
+
* @returns {string} Normalized extension name
|
|
48
|
+
*/
|
|
49
|
+
static toNormalizedExtName(extName: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* When given the root ID of a schema for an extension (`<extType>-<normalizedExtName>.json`) Returns an object containing the extension type and the _normalized_ extension name.
|
|
52
|
+
* @param {string} schemaId - Root schema ID
|
|
53
|
+
* @returns { {extType?: ExtensionType, normalizedExtName?: string} }
|
|
54
|
+
*/
|
|
55
|
+
static extensionInfoFromRootSchemaId(schemaId: string): {
|
|
56
|
+
extType?: ExtensionType;
|
|
57
|
+
normalizedExtName?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Creates an `ArgSpec`
|
|
61
|
+
*
|
|
62
|
+
* @param {string} name - The canonical name of the argument. Corresponds to a key in a schema's
|
|
63
|
+
* `properties` property.
|
|
64
|
+
* @template D
|
|
65
|
+
* @param {ArgSpecOptions<D>} [opts] - Options
|
|
66
|
+
* @returns {Readonly<ArgSpec>}
|
|
67
|
+
*/
|
|
68
|
+
static create<D_1>(name: string, opts?: ArgSpecOptions<D_1> | undefined): Readonly<ArgSpec<any>>;
|
|
69
|
+
/**
|
|
70
|
+
* Builds some computed fields and assigns them to the instance.
|
|
71
|
+
*
|
|
72
|
+
* Undefined properties are not assigned.
|
|
73
|
+
*
|
|
74
|
+
* The _constructor_ is private. Use {@link ArgSpec.create} instead.
|
|
75
|
+
* @private
|
|
76
|
+
* @param {string} name
|
|
77
|
+
* @param {ArgSpecOptions<D>} opts
|
|
78
|
+
*/
|
|
79
|
+
private constructor();
|
|
80
|
+
/**
|
|
81
|
+
* The canonical name of the argument. Corresponds to key in schema's `properties` prop.
|
|
82
|
+
* @type {string}
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* The `ExtensionType` of the argument. This will be set if the arg came from an extension;
|
|
87
|
+
* otherwise it will be `undefined`.
|
|
88
|
+
* @type {ExtensionType|undefined}
|
|
89
|
+
*/
|
|
90
|
+
extType: ExtensionType | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The name of the extension, if this argument came from an extension.
|
|
93
|
+
*
|
|
94
|
+
* Otherwise `undefined`.
|
|
95
|
+
* @type {string|undefined}
|
|
96
|
+
*/
|
|
97
|
+
extName: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* The schema ID (`$id`) for the argument. This is automatically determined, and any user-provided `$id`s will be overwritten.
|
|
100
|
+
*
|
|
101
|
+
* @type {string}
|
|
102
|
+
*/
|
|
103
|
+
ref: string;
|
|
104
|
+
/**
|
|
105
|
+
* The CLI argument, sans leading dashes.
|
|
106
|
+
* @type {string}
|
|
107
|
+
*/
|
|
108
|
+
arg: string;
|
|
109
|
+
/**
|
|
110
|
+
* The desired keypath for the argument after arguments have been parsed.
|
|
111
|
+
*
|
|
112
|
+
* Typically this is camelCased. If the arg came from an extension, it will be prefixed with
|
|
113
|
+
* `<extType>.<extName>.`
|
|
114
|
+
* @type {string}
|
|
115
|
+
*/
|
|
116
|
+
dest: string;
|
|
117
|
+
/**
|
|
118
|
+
* The same as {@link ArgSpec.dest} but without the leading `<extType>.<extName>.` prefix.
|
|
119
|
+
*/
|
|
120
|
+
rawDest: string;
|
|
121
|
+
/**
|
|
122
|
+
* Whatever the default value of this argument is, as specified by the
|
|
123
|
+
* `default` property of the schema.
|
|
124
|
+
* @type {D|undefined}
|
|
125
|
+
*/
|
|
126
|
+
defaultValue: D | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* String representation, useful for debugging
|
|
129
|
+
* @returns {string}
|
|
130
|
+
*/
|
|
131
|
+
toString(): string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for {@link ArgSpec.create }
|
|
135
|
+
*/
|
|
136
|
+
export type ArgSpecOptions<D> = {
|
|
137
|
+
extName?: string | undefined;
|
|
138
|
+
extType?: import("@appium/types").ExtensionType | undefined;
|
|
139
|
+
dest?: string | undefined;
|
|
140
|
+
defaultValue?: D | undefined;
|
|
141
|
+
};
|
|
142
|
+
export type ExtensionType = import('@appium/types').ExtensionType;
|
|
143
|
+
//# sourceMappingURL=arg-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-spec.d.ts","sourceRoot":"","sources":["../../../lib/schema/arg-spec.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,oDAAqD;AAErD;;;;GAIG;AACH,wCAAyC;AAYzC;;;;;;GAMG;AACH;IAyFE;;;;;;;;OAQG;IACH,yBALW,MAAM,8FAGJ,MAAM,CAQlB;IAED;;;;OAIG;IACH,0HAKC;IAED;;;;;;OAMG;IACH,mBALW,MAAM,8FAGJ,MAAM,CAQlB;IAED;;;;OAIG;IACH,oCAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,+CAHW,MAAM,GACH;QAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAC,CAUlE;IAED;;;;;;;;OAQG;IACH,yBANW,MAAM,2CAIJ,sBAAiB,CAI7B;IAhHD;;;;;;;;;OASG;IACH,sBAqBC;IAtFD;;;OAGG;IACH,MAFU,MAAM,CAEX;IAEL;;;;OAIG;IACH,SAFU,aAAa,GAAC,SAAS,CAEzB;IAER;;;;;OAKG;IACH,SAFU,MAAM,GAAC,SAAS,CAElB;IAER;;;;OAIG;IACH,KAFU,MAAM,CAEZ;IAEJ;;;OAGG;IACH,KAFU,MAAM,CAEZ;IAEJ;;;;;;OAMG;IACH,MAFU,MAAM,CAEX;IAEL;;OAEG;IACH,gBAAQ;IAER;;;;OAIG;IACH,cAFU,CAAC,GAAC,SAAS,CAER;IAoHb;;;OAGG;IAEH,YAHa,MAAM,CASlB;CACF;;;;;;;;;;4BAaY,OAAO,eAAe,EAAE,aAAa"}
|
|
@@ -0,0 +1,164 @@
|
|
|
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.ArgSpec = exports.SERVER_PROP_NAME = exports.APPIUM_CONFIG_SCHEMA_ID = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
/**
|
|
9
|
+
* The original ID of the Appium config schema.
|
|
10
|
+
* We use this in the CLI to convert it to `argparse` options.
|
|
11
|
+
*/
|
|
12
|
+
exports.APPIUM_CONFIG_SCHEMA_ID = 'appium.json';
|
|
13
|
+
/**
|
|
14
|
+
* The schema prop containing server-related options. Everything in here
|
|
15
|
+
* is "native" to Appium.
|
|
16
|
+
* Used by {@link flattenSchema} for transforming the schema into CLI args.
|
|
17
|
+
*/
|
|
18
|
+
exports.SERVER_PROP_NAME = 'server';
|
|
19
|
+
/**
|
|
20
|
+
* Used to parse extension info from a schema ID.
|
|
21
|
+
*/
|
|
22
|
+
const SCHEMA_ID_REGEXP = /^(?<extType>.+?)-(?<normalizedExtName>.+)\.json$/;
|
|
23
|
+
/**
|
|
24
|
+
* Avoid typos by using constants!
|
|
25
|
+
*/
|
|
26
|
+
const PROPERTIES = 'properties';
|
|
27
|
+
/**
|
|
28
|
+
* An `ArgSpec` is a class representing metadata about an argument (or config
|
|
29
|
+
* option) used for cross-referencing.
|
|
30
|
+
*
|
|
31
|
+
* This class has no instance methods, and is basically just a read-only "struct".
|
|
32
|
+
* @template D
|
|
33
|
+
*/
|
|
34
|
+
class ArgSpec {
|
|
35
|
+
/**
|
|
36
|
+
* Builds some computed fields and assigns them to the instance.
|
|
37
|
+
*
|
|
38
|
+
* Undefined properties are not assigned.
|
|
39
|
+
*
|
|
40
|
+
* The _constructor_ is private. Use {@link ArgSpec.create} instead.
|
|
41
|
+
* @private
|
|
42
|
+
* @param {string} name
|
|
43
|
+
* @param {ArgSpecOptions<D>} opts
|
|
44
|
+
*/
|
|
45
|
+
constructor(name, { extType, extName, dest, defaultValue } = {}) {
|
|
46
|
+
// we must normalize the extension name to fit into our convention for CLI
|
|
47
|
+
// args.
|
|
48
|
+
const arg = ArgSpec.toArg(name, extType, extName);
|
|
49
|
+
const ref = ArgSpec.toSchemaRef(name, extType, extName);
|
|
50
|
+
// if no explicit `dest` provided, just camelCase the name to avoid needing
|
|
51
|
+
// to use bracket syntax when accessing props on the parsed args object.
|
|
52
|
+
const rawDest = lodash_1.default.camelCase(dest ?? name);
|
|
53
|
+
const destKeypath = extType && extName ? [extType, extName, rawDest].join('.') : rawDest;
|
|
54
|
+
this.defaultValue = defaultValue;
|
|
55
|
+
this.name = name;
|
|
56
|
+
this.extType = extType;
|
|
57
|
+
this.extName = extName;
|
|
58
|
+
this.arg = arg;
|
|
59
|
+
this.dest = destKeypath;
|
|
60
|
+
this.ref = ref;
|
|
61
|
+
this.rawDest = rawDest;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Return the schema ID (`$id`) for the **argument** given the parameters.
|
|
65
|
+
*
|
|
66
|
+
* If you need the "root" or "base" schema ID, use {@link ArgSpec.toSchemaBaseRef} instead.
|
|
67
|
+
* @param {string} name - Argument name
|
|
68
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
69
|
+
* @param {string} [extName] - Extension name
|
|
70
|
+
* @returns {string} Schema ID
|
|
71
|
+
*/
|
|
72
|
+
static toSchemaRef(name, extType, extName) {
|
|
73
|
+
const baseRef = ArgSpec.toSchemaBaseRef(extType, extName);
|
|
74
|
+
if (extType && extName) {
|
|
75
|
+
return [`${baseRef}#`, PROPERTIES, name].join('/');
|
|
76
|
+
}
|
|
77
|
+
return [`${baseRef}#`, PROPERTIES, exports.SERVER_PROP_NAME, PROPERTIES, name].join('/');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Return the schema ID for an extension or the base schema ID.
|
|
81
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
82
|
+
* @param {string} [extName] - Extension name
|
|
83
|
+
*/
|
|
84
|
+
static toSchemaBaseRef(extType, extName) {
|
|
85
|
+
if (extType && extName) {
|
|
86
|
+
return `${extType}-${ArgSpec.toNormalizedExtName(extName)}.json`;
|
|
87
|
+
}
|
|
88
|
+
return exports.APPIUM_CONFIG_SCHEMA_ID;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Return the unique ID for the argument given the parameters.
|
|
92
|
+
* @param {string} name - Argument name
|
|
93
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
94
|
+
* @param {string} [extName] - Extension name
|
|
95
|
+
* @returns {string} Unique ID
|
|
96
|
+
*/
|
|
97
|
+
static toArg(name, extType, extName) {
|
|
98
|
+
const properName = lodash_1.default.kebabCase(name.replace(/^--?/, ''));
|
|
99
|
+
if (extType && extName) {
|
|
100
|
+
return [extType, lodash_1.default.kebabCase(extName), properName].join('-');
|
|
101
|
+
}
|
|
102
|
+
return properName;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Normalizes a raw extension name (not including the type).
|
|
106
|
+
* @param {string} extName - Extension name
|
|
107
|
+
* @returns {string} Normalized extension name
|
|
108
|
+
*/
|
|
109
|
+
static toNormalizedExtName(extName) {
|
|
110
|
+
return lodash_1.default.kebabCase(extName);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* When given the root ID of a schema for an extension (`<extType>-<normalizedExtName>.json`) Returns an object containing the extension type and the _normalized_ extension name.
|
|
114
|
+
* @param {string} schemaId - Root schema ID
|
|
115
|
+
* @returns { {extType?: ExtensionType, normalizedExtName?: string} }
|
|
116
|
+
*/
|
|
117
|
+
static extensionInfoFromRootSchemaId(schemaId) {
|
|
118
|
+
const matches = schemaId.match(SCHEMA_ID_REGEXP);
|
|
119
|
+
if (matches?.groups) {
|
|
120
|
+
const { extType, normalizedExtName } =
|
|
121
|
+
/** @type { {extType: ExtensionType, normalizedExtName: string} } */ (matches.groups);
|
|
122
|
+
return { extType, normalizedExtName };
|
|
123
|
+
}
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Creates an `ArgSpec`
|
|
128
|
+
*
|
|
129
|
+
* @param {string} name - The canonical name of the argument. Corresponds to a key in a schema's
|
|
130
|
+
* `properties` property.
|
|
131
|
+
* @template D
|
|
132
|
+
* @param {ArgSpecOptions<D>} [opts] - Options
|
|
133
|
+
* @returns {Readonly<ArgSpec>}
|
|
134
|
+
*/
|
|
135
|
+
static create(name, opts) {
|
|
136
|
+
return Object.freeze(new ArgSpec(name, opts));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* String representation, useful for debugging
|
|
140
|
+
* @returns {string}
|
|
141
|
+
*/
|
|
142
|
+
/* istanbul ignore next */
|
|
143
|
+
toString() {
|
|
144
|
+
let str = `[ArgSpec] ${this.name} (${this.ref})`;
|
|
145
|
+
if (this.extType && this.extName) {
|
|
146
|
+
str += ` (ext: ${this.extType}/${this.extName})`;
|
|
147
|
+
}
|
|
148
|
+
return str;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.ArgSpec = ArgSpec;
|
|
152
|
+
/**
|
|
153
|
+
* Options for {@link ArgSpec.create}
|
|
154
|
+
* @template D
|
|
155
|
+
* @typedef ArgSpecOptions
|
|
156
|
+
* @property {string} [extName]
|
|
157
|
+
* @property {ExtensionType} [extType]
|
|
158
|
+
* @property {string} [dest]
|
|
159
|
+
* @property {D} [defaultValue]
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
162
|
+
* @typedef {import('@appium/types').ExtensionType} ExtensionType
|
|
163
|
+
*/
|
|
164
|
+
//# sourceMappingURL=arg-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-spec.js","sourceRoot":"","sources":["../../../lib/schema/arg-spec.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB;;;GAGG;AACU,QAAA,uBAAuB,GAAG,aAAa,CAAC;AAErD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;;;;;GA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,CAAC;IACZ,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI;QACtB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,0BAA0B;IAC1B,QAAQ;QACN,IAAI,GAAG,GAAG,aAAa,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC;QACjD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE;YAChC,GAAG,IAAI,UAAU,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC;SAClD;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAtLD,0BAsLC;AAED;;;;;;;;GAQG;AAEH;;GAEG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the finalized, flattened schema representation into
|
|
3
|
+
* ArgumentDefinitions for handoff to `argparse`.
|
|
4
|
+
*
|
|
5
|
+
* @throws If schema has not been added to ajv (via `finalizeSchema()`)
|
|
6
|
+
* @returns {import('../cli/args').ArgumentDefinitions} A map of arryas of
|
|
7
|
+
* aliases to `argparse` arguments; empty if no schema found
|
|
8
|
+
*/
|
|
9
|
+
export function toParserArgs(): import('../cli/args').ArgumentDefinitions;
|
|
10
|
+
/**
|
|
11
|
+
* <T>
|
|
12
|
+
*/
|
|
13
|
+
export type FormatValidator<T extends string | number> = import('ajv/dist/types').FormatValidator<T>;
|
|
14
|
+
/**
|
|
15
|
+
* A JSON 7 schema with our custom keywords.
|
|
16
|
+
*/
|
|
17
|
+
export type AppiumJSONSchema = import('./keywords').AppiumJSONSchemaKeywords & import('json-schema').JSONSchema7;
|
|
18
|
+
export type ArgSpec = import("./arg-spec").ArgSpec<any>;
|
|
19
|
+
//# sourceMappingURL=cli-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../../../lib/schema/cli-args.js"],"names":[],"mappings":"AAuNA;;;;;;;GAOG;AACH,gCAHa,OAAO,aAAa,EAAE,mBAAmB,CAMrD;;;;yDAIY,OAAO,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;;;;+BAK3C,OAAO,YAAY,EAAE,wBAAwB,GAAG,OAAO,aAAa,EAAE,WAAW"}
|
|
@@ -0,0 +1,220 @@
|
|
|
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.toParserArgs = void 0;
|
|
7
|
+
const argparse_1 = require("argparse");
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const config_file_1 = require("../config-file");
|
|
10
|
+
const schema_1 = require("./schema");
|
|
11
|
+
const cli_transformers_1 = require("./cli-transformers");
|
|
12
|
+
/**
|
|
13
|
+
* This module concerns functions which convert schema definitions to
|
|
14
|
+
* `argparse`-compatible data structures, for deriving CLI arguments from a
|
|
15
|
+
* schema.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Lookup of possible values for the `type` field in a JSON schema.
|
|
19
|
+
* @type {Readonly<Record<string, import('json-schema').JSONSchema7TypeName>>}
|
|
20
|
+
*/
|
|
21
|
+
const TYPENAMES = Object.freeze({
|
|
22
|
+
ARRAY: 'array',
|
|
23
|
+
OBJECT: 'object',
|
|
24
|
+
BOOLEAN: 'boolean',
|
|
25
|
+
INTEGER: 'integer',
|
|
26
|
+
NUMBER: 'number',
|
|
27
|
+
NULL: 'null',
|
|
28
|
+
STRING: 'string',
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Options with alias lengths less than this will be considered "short" flags.
|
|
32
|
+
*/
|
|
33
|
+
const SHORT_ARG_CUTOFF = 3;
|
|
34
|
+
/**
|
|
35
|
+
* Convert an alias (`foo`) to a flag (`--foo`) or a short flag (`-f`).
|
|
36
|
+
* @param {ArgSpec} argSpec - the argument specification
|
|
37
|
+
* @param {string} [alias] - the alias to convert to a flag
|
|
38
|
+
* @returns {string} the flag
|
|
39
|
+
*/
|
|
40
|
+
function aliasToFlag(argSpec, alias) {
|
|
41
|
+
const { extType, extName, name } = argSpec;
|
|
42
|
+
const arg = alias ?? name;
|
|
43
|
+
const isShort = arg.length < SHORT_ARG_CUTOFF;
|
|
44
|
+
if (extType && extName) {
|
|
45
|
+
return isShort
|
|
46
|
+
? `--${extType}-${lodash_1.default.kebabCase(extName)}-${arg}`
|
|
47
|
+
: `--${extType}-${lodash_1.default.kebabCase(extName)}-${lodash_1.default.kebabCase(arg)}`;
|
|
48
|
+
}
|
|
49
|
+
return isShort ? `-${arg}` : `--${lodash_1.default.kebabCase(arg)}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Converts a string to SCREAMING_SNAKE_CASE
|
|
53
|
+
*/
|
|
54
|
+
const screamingSnakeCase = lodash_1.default.flow(lodash_1.default.snakeCase, lodash_1.default.toUpper);
|
|
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 = lodash_1.default.identity) {
|
|
67
|
+
/** @param {string} value */
|
|
68
|
+
return (value) => {
|
|
69
|
+
const coerced = coerce(value);
|
|
70
|
+
const errors = (0, schema_1.validate)(coerced, schemaId);
|
|
71
|
+
if (lodash_1.default.isEmpty(errors)) {
|
|
72
|
+
return coerced;
|
|
73
|
+
}
|
|
74
|
+
throw new argparse_1.ArgumentTypeError('\n\n' + (0, config_file_1.formatErrors)(errors, value, { schemaId }));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Determine the description for display on the CLI, given the schema.
|
|
79
|
+
* @param {AppiumJSONSchema} schema
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
function makeDescription(schema) {
|
|
83
|
+
const { appiumCliDescription, description = '', appiumDeprecated } = schema;
|
|
84
|
+
let desc = appiumCliDescription ?? description;
|
|
85
|
+
if (appiumDeprecated) {
|
|
86
|
+
desc = `[DEPRECATED] ${desc}`;
|
|
87
|
+
}
|
|
88
|
+
return desc;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Given arg `name`, a JSON schema `subSchema`, and options, return an argument definition
|
|
92
|
+
* as understood by `argparse`.
|
|
93
|
+
* @param {AppiumJSONSchema} subSchema - JSON schema for the option
|
|
94
|
+
* @param {ArgSpec} argSpec - Argument spec tuple
|
|
95
|
+
* @returns {[[string]|[string, string], import('argparse').ArgumentOptions]} Tuple of flag and options
|
|
96
|
+
*/
|
|
97
|
+
function subSchemaToArgDef(subSchema, argSpec) {
|
|
98
|
+
let { type, appiumCliAliases, appiumCliTransformer, enum: enumValues } = subSchema;
|
|
99
|
+
const { name, arg } = argSpec;
|
|
100
|
+
const aliases = [
|
|
101
|
+
aliasToFlag(argSpec),
|
|
102
|
+
... /** @type {string[]} */(appiumCliAliases ?? []).map((alias) => aliasToFlag(argSpec, alias)),
|
|
103
|
+
];
|
|
104
|
+
/** @type {import('argparse').ArgumentOptions} */
|
|
105
|
+
let argOpts = {
|
|
106
|
+
required: false,
|
|
107
|
+
help: makeDescription(subSchema),
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Generally we will provide a `type` to `argparse` as a function which
|
|
111
|
+
* validates using ajv (which is much more full-featured than what `argparse`
|
|
112
|
+
* can offer). The exception is `boolean`-type options, which have no
|
|
113
|
+
* `argType`.
|
|
114
|
+
*
|
|
115
|
+
* Not sure if this type is correct, but it's not doing what I want. I want
|
|
116
|
+
* to say "this is a function which returns something of type `T` where `T` is
|
|
117
|
+
* never a `Promise`". This function must be sync.
|
|
118
|
+
* @type {((value: string) => unknown)|undefined}
|
|
119
|
+
*/
|
|
120
|
+
let argTypeFunction;
|
|
121
|
+
// handle special cases for various types
|
|
122
|
+
switch (type) {
|
|
123
|
+
// booleans do not have a type per `ArgumentOptions`, just an "action"
|
|
124
|
+
// NOTE: due to limitations of `argparse`, we cannot provide fancy help text, and must rely on its internal error messaging.
|
|
125
|
+
case TYPENAMES.BOOLEAN: {
|
|
126
|
+
argOpts.action = 'store_const';
|
|
127
|
+
argOpts.const = true;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case TYPENAMES.OBJECT: {
|
|
131
|
+
argTypeFunction = cli_transformers_1.transformers.json;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
// arrays are treated as CSVs, because `argparse` doesn't handle array data.
|
|
135
|
+
case TYPENAMES.ARRAY: {
|
|
136
|
+
argTypeFunction = cli_transformers_1.transformers.csv;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
// "number" type is coerced to float. `argparse` does this for us if we use `float` type, but
|
|
140
|
+
// we don't.
|
|
141
|
+
case TYPENAMES.NUMBER: {
|
|
142
|
+
argTypeFunction = getSchemaValidator(argSpec, parseFloat);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
// "integer" is coerced to an .. integer. again, `argparse` would do this for us if we used `int`.
|
|
146
|
+
case TYPENAMES.INTEGER: {
|
|
147
|
+
argTypeFunction = getSchemaValidator(argSpec, lodash_1.default.parseInt);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
// strings (like number and integer) are subject to further validation
|
|
151
|
+
// (e.g., must satisfy a mask or regex or even some custom validation
|
|
152
|
+
// function)
|
|
153
|
+
case TYPENAMES.STRING: {
|
|
154
|
+
argTypeFunction = getSchemaValidator(argSpec);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
// TODO: there may be some way to restrict this at the Ajv level --
|
|
158
|
+
// that may involve patching the metaschema.
|
|
159
|
+
case TYPENAMES.NULL:
|
|
160
|
+
// falls through
|
|
161
|
+
default: {
|
|
162
|
+
throw new TypeError(`Schema property "${arg}": \`${type}\` type unknown or disallowed`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// metavar is used in help text. `boolean` cannot have a metavar--it is not
|
|
166
|
+
// displayed--and `argparse` throws if you give it one.
|
|
167
|
+
if (type !== TYPENAMES.BOOLEAN) {
|
|
168
|
+
argOpts.metavar = screamingSnakeCase(name);
|
|
169
|
+
}
|
|
170
|
+
// the validity of "appiumCliTransformer" should already have been determined
|
|
171
|
+
// by ajv during schema validation in `finalizeSchema()`. the `array` &
|
|
172
|
+
// `object` types have already added a formatter (see above, so we don't do it
|
|
173
|
+
// twice).
|
|
174
|
+
if (type !== TYPENAMES.ARRAY && type !== TYPENAMES.OBJECT && appiumCliTransformer) {
|
|
175
|
+
argTypeFunction = lodash_1.default.flow(argTypeFunction ?? lodash_1.default.identity, cli_transformers_1.transformers[appiumCliTransformer]);
|
|
176
|
+
}
|
|
177
|
+
if (argTypeFunction) {
|
|
178
|
+
argOpts.type = argTypeFunction;
|
|
179
|
+
}
|
|
180
|
+
// convert JSON schema `enum` to `choices`. `enum` can contain any JSON type, but `argparse`
|
|
181
|
+
// is limited to a single type per arg (I think). so let's make everything a string.
|
|
182
|
+
// and might as well _require_ the `type: string` while we're at it.
|
|
183
|
+
if (enumValues && !lodash_1.default.isEmpty(enumValues)) {
|
|
184
|
+
if (type === TYPENAMES.STRING) {
|
|
185
|
+
argOpts.choices = enumValues.map(String);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
throw new TypeError(`Problem with schema for ${arg}; \`enum\` is only supported for \`type: 'string'\``);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// TODO: argparse only accepts the command name and a single alias; any extra aliases
|
|
192
|
+
// will be silently discarded.
|
|
193
|
+
const finalAliases = /** @type {[string]|[string, string]} */ (aliases);
|
|
194
|
+
return [finalAliases, argOpts];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Converts the finalized, flattened schema representation into
|
|
198
|
+
* ArgumentDefinitions for handoff to `argparse`.
|
|
199
|
+
*
|
|
200
|
+
* @throws If schema has not been added to ajv (via `finalizeSchema()`)
|
|
201
|
+
* @returns {import('../cli/args').ArgumentDefinitions} A map of arryas of
|
|
202
|
+
* aliases to `argparse` arguments; empty if no schema found
|
|
203
|
+
*/
|
|
204
|
+
function toParserArgs() {
|
|
205
|
+
const flattened = (0, schema_1.flattenSchema)().filter(({ schema }) => !schema.appiumCliIgnored);
|
|
206
|
+
return new Map(lodash_1.default.map(flattened, ({ schema, argSpec }) => subSchemaToArgDef(schema, argSpec)));
|
|
207
|
+
}
|
|
208
|
+
exports.toParserArgs = toParserArgs;
|
|
209
|
+
/**
|
|
210
|
+
* @template {string|number} T
|
|
211
|
+
* @typedef {import('ajv/dist/types').FormatValidator<T>} FormatValidator<T>
|
|
212
|
+
*/
|
|
213
|
+
/**
|
|
214
|
+
* A JSON 7 schema with our custom keywords.
|
|
215
|
+
* @typedef {import('./keywords').AppiumJSONSchemaKeywords & import('json-schema').JSONSchema7} AppiumJSONSchema
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* @typedef {import('./arg-spec').ArgSpec} ArgSpec
|
|
219
|
+
*/
|
|
220
|
+
//# sourceMappingURL=cli-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../../lib/schema/cli-args.js"],"names":[],"mappings":";;;;;;AAAA,uCAA2C;AAC3C,oDAAuB;AACvB,gDAA4D;AAC5D,qCAAiD;AACjD,yD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