appium 2.0.0-beta.8 → 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 +678 -441
- 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 +71 -60
- 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 +373 -271
- 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 +555 -185
- 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 +47 -20
- 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 +315 -167
- package/package.json +84 -82
- 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 -14
- 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 -10
|
@@ -0,0 +1,124 @@
|
|
|
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.transformers = void 0;
|
|
7
|
+
const argparse_1 = require("argparse");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
/**
|
|
11
|
+
* This module provides custom keywords for Appium schemas, as well as
|
|
12
|
+
* "transformers" (see `argTransformers` below).
|
|
13
|
+
*
|
|
14
|
+
* Custom keywords are just properties that will appear in a schema (e.g.,
|
|
15
|
+
* `appium-config-schema.js`) beyond what the JSON Schema spec offers. These
|
|
16
|
+
* are usable by extensions, as well.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Splits a CSV string into an array
|
|
20
|
+
* @param {string} value
|
|
21
|
+
* @returns {string[]}
|
|
22
|
+
*/
|
|
23
|
+
function parseCsvLine(value) {
|
|
24
|
+
return value
|
|
25
|
+
.split(',')
|
|
26
|
+
.map((v) => v.trim())
|
|
27
|
+
.filter(Boolean);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Split a file by newline then calls {@link parseCsvLine} on each line.
|
|
31
|
+
* @param {string} value
|
|
32
|
+
* @returns {string[]}
|
|
33
|
+
*/
|
|
34
|
+
function parseCsvFile(value) {
|
|
35
|
+
return value
|
|
36
|
+
.split(/\r?\n/)
|
|
37
|
+
.map((v) => v.trim())
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.flatMap(parseCsvLine);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Namespace containing _transformers_ for CLI arguments. "Validators" and
|
|
43
|
+
* "formatters" do not actually modify the value, but these do.
|
|
44
|
+
*
|
|
45
|
+
* Use case is for when the config file can accept e.g., a `string[]`, but the
|
|
46
|
+
* CLI can only take a `string` (as `argparse` seems to be limited in that
|
|
47
|
+
* fashion; it also cannot understand an argument having multiple types).
|
|
48
|
+
*
|
|
49
|
+
* For example, the `csv` transform takes a `string` and returns a `string[]` by
|
|
50
|
+
* splitting it by comma--_or_ if that `string` happens to be a
|
|
51
|
+
* filepath--reading the file as a `.csv`.
|
|
52
|
+
*
|
|
53
|
+
* This contains some copy-pasted code from `lib/cli/parser-helpers.js`, which was
|
|
54
|
+
* obliterated.
|
|
55
|
+
*/
|
|
56
|
+
exports.transformers = {
|
|
57
|
+
/**
|
|
58
|
+
* Given a CSV-style string or pathname, parse it into an array.
|
|
59
|
+
* The file can also be split on newlines.
|
|
60
|
+
* @param {string} csvOrPath
|
|
61
|
+
* @returns {string[]}
|
|
62
|
+
*/
|
|
63
|
+
csv: (csvOrPath) => {
|
|
64
|
+
let csv = csvOrPath;
|
|
65
|
+
let loadedFromFile = false;
|
|
66
|
+
// since this value could be a single string (no commas) _or_ a pathname, we will need
|
|
67
|
+
// to attempt to parse it as a file _first_.
|
|
68
|
+
if ((0, fs_1.existsSync)(csvOrPath)) {
|
|
69
|
+
try {
|
|
70
|
+
csv = (0, fs_1.readFileSync)(csvOrPath, 'utf8');
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw new argparse_1.ArgumentTypeError(`Could not read file '${csvOrPath}': ${err.message}`);
|
|
74
|
+
}
|
|
75
|
+
loadedFromFile = true;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
return loadedFromFile ? parseCsvFile(csv) : parseCsvLine(csv);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
const msg = loadedFromFile
|
|
82
|
+
? `The provided value of '${csvOrPath}' must be a valid CSV`
|
|
83
|
+
: `Must be a comma-delimited string, e.g., "foo,bar,baz"`;
|
|
84
|
+
throw new TypeError(`${msg}. Original error: ${err.message}`);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Parse a string which could be a path to a JSON file or a JSON string.
|
|
89
|
+
* @param {string} jsonOrPath
|
|
90
|
+
* @returns {object}
|
|
91
|
+
*/
|
|
92
|
+
json: (jsonOrPath) => {
|
|
93
|
+
let json = jsonOrPath;
|
|
94
|
+
let loadedFromFile = false;
|
|
95
|
+
if ((0, fs_1.existsSync)(jsonOrPath)) {
|
|
96
|
+
try {
|
|
97
|
+
// use synchronous file access, as `argparse` provides no way of either
|
|
98
|
+
// awaiting or using callbacks. This step happens in startup, in what is
|
|
99
|
+
// effectively command-line code, so nothing is blocked in terms of
|
|
100
|
+
// sessions, so holding up the event loop does not incur the usual
|
|
101
|
+
// drawbacks.
|
|
102
|
+
json = (0, fs_1.readFileSync)(jsonOrPath, 'utf8');
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
throw new argparse_1.ArgumentTypeError(`Could not read file '${jsonOrPath}': ${err.message}`);
|
|
106
|
+
}
|
|
107
|
+
loadedFromFile = true;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const result = JSON.parse(json);
|
|
111
|
+
if (!lodash_1.default.isPlainObject(result)) {
|
|
112
|
+
throw new Error(`'${lodash_1.default.truncate(result, { length: 100 })}' is not an object`);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
const msg = loadedFromFile
|
|
118
|
+
? `The provided value of '${jsonOrPath}' must be a valid JSON`
|
|
119
|
+
: `The provided value must be a valid JSON`;
|
|
120
|
+
throw new TypeError(`${msg}. Original error: ${e.message}`);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=cli-transformers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-transformers.js","sourceRoot":"","sources":["../../../lib/schema/cli-transformers.js"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/schema/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./schema"), exports);
|
|
18
|
+
__exportStar(require("./cli-args"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/schema/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection of keyword definitions to add to the singleton `Ajv` instance.
|
|
3
|
+
* @type {Record<string,KeywordDefinition>}
|
|
4
|
+
*/
|
|
5
|
+
export const keywords: Record<string, KeywordDefinition>;
|
|
6
|
+
/**
|
|
7
|
+
* These are the valid values for the `appiumCliTransformer` keyword.
|
|
8
|
+
* Unfortunately, TS cannot infer this in a JS context. In TS, we'd use
|
|
9
|
+
* `as const` when defining `argTransformers`, then get `keyof typeof argTransformers`. alas.
|
|
10
|
+
*/
|
|
11
|
+
export type AppiumCliTransformerName = 'csv' | 'json';
|
|
12
|
+
/**
|
|
13
|
+
* These are the custom keywords that Appium recognizes.
|
|
14
|
+
*/
|
|
15
|
+
export type AppiumJSONSchemaKeywords = {
|
|
16
|
+
appiumCliDest?: string | undefined;
|
|
17
|
+
appiumCliDescription?: string | undefined;
|
|
18
|
+
appiumCliAliases?: string[] | undefined;
|
|
19
|
+
appiumCliIgnored?: boolean | undefined;
|
|
20
|
+
appiumCliTransformer?: AppiumCliTransformerName | undefined;
|
|
21
|
+
appiumDeprecated?: boolean | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type KeywordDefinition = import('ajv').KeywordDefinition;
|
|
24
|
+
//# sourceMappingURL=keywords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keywords.d.ts","sourceRoot":"","sources":["../../../lib/schema/keywords.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,uBAFU,OAAO,MAAM,EAAC,iBAAiB,CAAC,CA4GxC;;;;;;uCAMW,KAAK,GAAC,MAAM;;;;;;;;;;;;gCAgBZ,OAAO,KAAK,EAAE,iBAAiB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keywords = void 0;
|
|
4
|
+
const cli_transformers_1 = require("./cli-transformers");
|
|
5
|
+
/**
|
|
6
|
+
* Collection of keyword definitions to add to the singleton `Ajv` instance.
|
|
7
|
+
* @type {Record<string,KeywordDefinition>}
|
|
8
|
+
*/
|
|
9
|
+
exports.keywords = {
|
|
10
|
+
/**
|
|
11
|
+
* Keyword to provide a list of command alias names for the CLI.
|
|
12
|
+
*
|
|
13
|
+
* If defined, there must be at least one item in the array and it must be non-empty.
|
|
14
|
+
* All items in the array must be unique.
|
|
15
|
+
*
|
|
16
|
+
* @todo Avoid alias collisions!
|
|
17
|
+
* @type {KeywordDefinition}
|
|
18
|
+
* @example
|
|
19
|
+
* {appiumCliAliases: ['B', 'bobby', 'robert']}
|
|
20
|
+
*/
|
|
21
|
+
appiumCliAliases: {
|
|
22
|
+
keyword: 'appiumCliAliases',
|
|
23
|
+
metaSchema: {
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
minLength: 1,
|
|
28
|
+
},
|
|
29
|
+
minItems: 1,
|
|
30
|
+
uniqueItems: true,
|
|
31
|
+
description: 'List of aliases for the argument. Aliases shorter than three (3) characters will be prefixed with a single dash; otherwise two (2).',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Keyword to provide the name of the property in the destination (parsed
|
|
36
|
+
* args) object. By default, this value will be whatever the property name is,
|
|
37
|
+
* but camel-cased. If a flag needs something _other_ than just camel-casing,
|
|
38
|
+
* use this.
|
|
39
|
+
* @type {KeywordDefinition}
|
|
40
|
+
* @example
|
|
41
|
+
* // for prop 'no-color'
|
|
42
|
+
* {appiumCliDest: 'NOCOLOR'} // value will be stored as property `NOCOLOR` instead of `noColor`
|
|
43
|
+
*/
|
|
44
|
+
appiumCliDest: {
|
|
45
|
+
keyword: 'appiumCliDest',
|
|
46
|
+
metaSchema: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
minLength: 1,
|
|
49
|
+
description: 'Name of the associated property in the parsed CLI arguments object',
|
|
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
|
+
* Transformers for CLI args. These usually take strings then do something with them, like
|
|
71
|
+
* read a file or parse further.
|
|
72
|
+
* @type {KeywordDefinition}
|
|
73
|
+
*/
|
|
74
|
+
appiumCliTransformer: {
|
|
75
|
+
keyword: 'appiumCliTransformer',
|
|
76
|
+
metaSchema: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
enum: Object.keys(cli_transformers_1.transformers),
|
|
79
|
+
description: 'The name of a custom transformer to run against the value as provided via the CLI.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Flag to tell Appium to _not_ provide this property as a CLI argument.
|
|
84
|
+
* @type {KeywordDefinition}
|
|
85
|
+
*/
|
|
86
|
+
appiumCliIgnored: {
|
|
87
|
+
keyword: 'appiumCliIgnored',
|
|
88
|
+
metaSchema: {
|
|
89
|
+
type: 'boolean',
|
|
90
|
+
description: 'If `true`, Appium will not provide this property as a CLI argument. This is NOT the same as a "hidden" argument.',
|
|
91
|
+
enum: [true],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* Mark this property as deprecated.
|
|
96
|
+
* @type {KeywordDefinition}
|
|
97
|
+
*/
|
|
98
|
+
appiumDeprecated: {
|
|
99
|
+
keyword: 'appiumDeprecated',
|
|
100
|
+
metaSchema: {
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
description: 'If `true`, this property will be displayed as "deprecated" to the user',
|
|
103
|
+
enum: [true],
|
|
104
|
+
$comment: 'JSON schema draft-2019-09 keyword `deprecated` serves the same purpose. This keyword should itself be deprecated if we move to draft-2019-09!',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* These are the valid values for the `appiumCliTransformer` keyword.
|
|
110
|
+
* Unfortunately, TS cannot infer this in a JS context. In TS, we'd use
|
|
111
|
+
* `as const` when defining `argTransformers`, then get `keyof typeof argTransformers`. alas.
|
|
112
|
+
* @typedef {'csv'|'json'} AppiumCliTransformerName
|
|
113
|
+
*/
|
|
114
|
+
/**
|
|
115
|
+
* These are the custom keywords that Appium recognizes.
|
|
116
|
+
*
|
|
117
|
+
* @typedef AppiumJSONSchemaKeywords
|
|
118
|
+
* @property {string} [appiumCliDest]
|
|
119
|
+
* @property {string} [appiumCliDescription]
|
|
120
|
+
* @property {string[]} [appiumCliAliases]
|
|
121
|
+
* @property {boolean} [appiumCliIgnored]
|
|
122
|
+
* @property {AppiumCliTransformerName} [appiumCliTransformer]
|
|
123
|
+
* @property {boolean} [appiumDeprecated]
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* @typedef {import('ajv').KeywordDefinition} KeywordDefinition
|
|
127
|
+
*/
|
|
128
|
+
//# sourceMappingURL=keywords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../../../lib/schema/keywords.js"],"names":[],"mappings":";;;AAAA,yDAAgD;AAEhD;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB;;;;;;;;;;OAUG;IACH,gBAAgB,EAAE;QAChB,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,CAAC;aACb;YACD,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,IAAI;YACjB,WAAW,EACT,qIAAqI;SACxI;KACF;IACD;;;;;;;;;OASG;IACH,aAAa,EAAE;QACb,OAAO,EAAE,eAAe;QACxB,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,oEAAoE;SAClF;KACF;IAED;;;;;;;OAOG;IACH,oBAAoB,EAAE;QACpB,OAAO,EAAE,sBAAsB;QAC/B,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,+EAA+E;SAC7F;KACF;IAED;;;;OAIG;IACH,oBAAoB,EAAE;QACpB,OAAO,EAAE,sBAAsB;QAC/B,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,+BAAY,CAAC;YAC/B,WAAW,EACT,oFAAoF;SACvF;KACF;IAED;;;OAGG;IACH,gBAAgB,EAAE;QAChB,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EACT,kHAAkH;YACpH,IAAI,EAAE,CAAC,IAAI,CAAC;SACb;KACF;IAED;;;OAGG;IACH,gBAAgB,EAAE;QAChB,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,CAAC,IAAI,CAAC;YACZ,QAAQ,EACN,+IAA+I;SAClJ;KACF;CACF,CAAC;AAEF;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AAEH;;GAEG"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key/value pairs go in... but they don't come out.
|
|
3
|
+
*
|
|
4
|
+
* @template K,V
|
|
5
|
+
* @extends {Map<K,V>}
|
|
6
|
+
*/
|
|
7
|
+
export class RoachHotelMap<K, V> extends Map<K, V> {
|
|
8
|
+
constructor();
|
|
9
|
+
constructor(entries?: readonly (readonly [K, V])[] | null | undefined);
|
|
10
|
+
constructor();
|
|
11
|
+
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Extensions that an extension schema file can have.
|
|
15
|
+
*/
|
|
16
|
+
export const ALLOWED_SCHEMA_EXTENSIONS: Readonly<Set<AllowedSchemaExtension>>;
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when the {@link AppiumSchema} instance has not yet been finalized, but
|
|
19
|
+
* the method called requires it.
|
|
20
|
+
*/
|
|
21
|
+
export class SchemaFinalizationError extends Error {
|
|
22
|
+
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* @type {Readonly<string>}
|
|
25
|
+
*/
|
|
26
|
+
code: Readonly<string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when a "unique" schema ID conflicts with an existing schema ID.
|
|
30
|
+
*
|
|
31
|
+
* This is likely going to be caused by attempting to register the same schema twice.
|
|
32
|
+
*/
|
|
33
|
+
export class SchemaNameConflictError extends Error {
|
|
34
|
+
/**
|
|
35
|
+
* @param {ExtensionType} extType
|
|
36
|
+
* @param {string} extName
|
|
37
|
+
*/
|
|
38
|
+
constructor(extType: ExtensionType, extName: string);
|
|
39
|
+
/**
|
|
40
|
+
* @type {Readonly<string>}
|
|
41
|
+
*/
|
|
42
|
+
code: Readonly<string>;
|
|
43
|
+
/**
|
|
44
|
+
* @type {Readonly<{extType: ExtensionType, extName: string}>}
|
|
45
|
+
*/
|
|
46
|
+
data: Readonly<{
|
|
47
|
+
extType: ExtensionType;
|
|
48
|
+
extName: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thrown when a schema ID was expected, but it doesn't exist on the {@link Ajv} instance.
|
|
53
|
+
*/
|
|
54
|
+
export class SchemaUnknownSchemaError extends ReferenceError {
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} schemaId
|
|
57
|
+
*/
|
|
58
|
+
constructor(schemaId: string);
|
|
59
|
+
/**
|
|
60
|
+
* @type {Readonly<string>}
|
|
61
|
+
*/
|
|
62
|
+
code: Readonly<string>;
|
|
63
|
+
/**
|
|
64
|
+
* @type {Readonly<{schemaId: string}>}
|
|
65
|
+
*/
|
|
66
|
+
data: Readonly<{
|
|
67
|
+
schemaId: string;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Thrown when a schema is provided, but it's of an unsupported type.
|
|
72
|
+
*
|
|
73
|
+
* "Valid" schemas which are unsupported include boolean schemas and async schemas
|
|
74
|
+
* (having a `true` `$async` property).
|
|
75
|
+
*/
|
|
76
|
+
export class SchemaUnsupportedSchemaError extends TypeError {
|
|
77
|
+
/**
|
|
78
|
+
* @param {any} schema
|
|
79
|
+
* @param {ExtensionType} extType
|
|
80
|
+
* @param {string} extName
|
|
81
|
+
*/
|
|
82
|
+
constructor(schema: any, extType: ExtensionType, extName: string);
|
|
83
|
+
/**
|
|
84
|
+
* @type {Readonly<string>}
|
|
85
|
+
*/
|
|
86
|
+
code: Readonly<string>;
|
|
87
|
+
/**
|
|
88
|
+
* @type {Readonly<{schema: any, extType: ExtensionType, extName: string}>}
|
|
89
|
+
*/
|
|
90
|
+
data: Readonly<{
|
|
91
|
+
schema: any;
|
|
92
|
+
extType: ExtensionType;
|
|
93
|
+
extName: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Registers a schema from an extension.
|
|
98
|
+
*
|
|
99
|
+
* This is "fail-fast" in that the schema will immediately be validated against JSON schema draft-07 _or_ whatever the value of the schema's `$schema` prop is.
|
|
100
|
+
*
|
|
101
|
+
* Does _not_ add the schema to the `ajv` instance (this is done by {@link AppiumSchema.finalize}).
|
|
102
|
+
* @param {ExtensionType} extType - Extension type
|
|
103
|
+
* @param {string} extName - Unique extension name for `type`
|
|
104
|
+
* @param {SchemaObject} schema - Schema object
|
|
105
|
+
* @throws {SchemaNameConflictError} If the schema is an invalid
|
|
106
|
+
* @returns {void}
|
|
107
|
+
*/
|
|
108
|
+
export function registerSchema(extType: ExtensionType, extName: string, schema: SchemaObject): void;
|
|
109
|
+
export function getAllArgSpecs(): RoachHotelMap<string, ArgSpec<any>>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns a {@link ArgSpec} for the given argument name.
|
|
112
|
+
* @param {string} name - CLI argument name
|
|
113
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
114
|
+
* @param {string} [extName] - Extension name
|
|
115
|
+
* @returns {ArgSpec|undefined} ArgSpec or `undefined` if not found
|
|
116
|
+
*/
|
|
117
|
+
export function getArgSpec(name: string, extType?: import("@appium/types").ExtensionType | undefined, extName?: string | undefined): ArgSpec<any> | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Returns `true` if the instance knows about an argument by the given `name`.
|
|
120
|
+
* @param {string} name - CLI argument name
|
|
121
|
+
* @param {ExtensionType} [extType] - Extension type
|
|
122
|
+
* @param {string} [extName] - Extension name
|
|
123
|
+
* @returns {boolean} `true` if such an {@link ArgSpec} exists
|
|
124
|
+
*/
|
|
125
|
+
export function hasArgSpec(name: string, extType?: import("@appium/types").ExtensionType | undefined, extName?: string | undefined): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Return `true` if {@link AppiumSchema.finalize finalize} has been called
|
|
128
|
+
* successfully and {@link AppiumSchema.reset reset} has not been called since.
|
|
129
|
+
* @returns {boolean} If finalized
|
|
130
|
+
*/
|
|
131
|
+
export function isFinalized(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Call this when no more schemas will be registered.
|
|
134
|
+
*
|
|
135
|
+
* This does three things:
|
|
136
|
+
* 1. It combines all schemas from extensions into the Appium config schema,
|
|
137
|
+
* then adds the result to the `Ajv` instance.
|
|
138
|
+
* 2. It adds schemas for _each_ argument/property for validation purposes.
|
|
139
|
+
* The CLI uses these schemas to validate specific arguments.
|
|
140
|
+
* 3. The schemas are validated against JSON schema draft-07 (which is the
|
|
141
|
+
* only one supported at this time)
|
|
142
|
+
*
|
|
143
|
+
* Any method in this instance that needs to interact with the `Ajv` instance
|
|
144
|
+
* will throw if this method has not been called.
|
|
145
|
+
*
|
|
146
|
+
* If the instance has already been finalized, this is a no-op.
|
|
147
|
+
* @public
|
|
148
|
+
* @throws {Error} If the schema is not valid
|
|
149
|
+
* @returns {Readonly<Record<string,StrictSchemaObject>>} Record of schema IDs to full schema objects
|
|
150
|
+
*/
|
|
151
|
+
export function finalizeSchema(): Readonly<Record<string, StrictSchemaObject>>;
|
|
152
|
+
/**
|
|
153
|
+
* Resets this instance to its original state.
|
|
154
|
+
*
|
|
155
|
+
* - Removes all added schemas from the `Ajv` instance
|
|
156
|
+
* - Resets the map of {@link ArgSpec ArgSpecs}
|
|
157
|
+
* - Resets the map of registered schemas
|
|
158
|
+
* - Sets the {@link AppiumSchema._finalized _finalized} flag to `false`
|
|
159
|
+
*
|
|
160
|
+
* If you need to call {@link AppiumSchema.finalize} again, you'll want to call this first.
|
|
161
|
+
* @returns {void}
|
|
162
|
+
*/
|
|
163
|
+
export function resetSchema(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Given an object, validates it against the Appium config schema.
|
|
166
|
+
* If errors occur, the returned array will be non-empty.
|
|
167
|
+
* @param {any} value - The value (hopefully an object) to validate against the schema
|
|
168
|
+
* @param {string} [ref] - Schema ID or ref.
|
|
169
|
+
* @public
|
|
170
|
+
* @returns {import('ajv').ErrorObject[]} Array of errors, if any.
|
|
171
|
+
*/
|
|
172
|
+
export function validate(value: any, ref?: string | undefined): import('ajv').ErrorObject[];
|
|
173
|
+
/**
|
|
174
|
+
* Retrieves the schema itself
|
|
175
|
+
* @public
|
|
176
|
+
* @param {string} [ref] - Schema ID
|
|
177
|
+
* @throws If the schema has not yet been finalized
|
|
178
|
+
* @returns {SchemaObject}
|
|
179
|
+
*/
|
|
180
|
+
export function getSchema(ref?: string | undefined): SchemaObject;
|
|
181
|
+
/**
|
|
182
|
+
* Flatten schema into an array of `SchemaObject`s and associated
|
|
183
|
+
* {@link ArgSpec ArgSpecs}.
|
|
184
|
+
*
|
|
185
|
+
* Converts nested extension schemas to keys based on the extension type and
|
|
186
|
+
* name. Used when translating to `argparse` options or getting the list of
|
|
187
|
+
* default values (see {@link AppiumSchema.getDefaults}) for CLI or otherwise.
|
|
188
|
+
*
|
|
189
|
+
* The return value is an intermediate reprsentation used by `cli-args`
|
|
190
|
+
* module's `toParserArgs`, which converts the finalized schema to parameters
|
|
191
|
+
* used by `argparse`.
|
|
192
|
+
* @throws If {@link AppiumSchema.finalize} has not been called yet.
|
|
193
|
+
* @returns {FlattenedSchema}
|
|
194
|
+
*/
|
|
195
|
+
export function flattenSchema(): FlattenedSchema;
|
|
196
|
+
/**
|
|
197
|
+
* Returns a `Record` of argument "dest" strings to default values.
|
|
198
|
+
*
|
|
199
|
+
* The "dest" string is the property name in object returned by
|
|
200
|
+
* `argparse.ArgumentParser['parse_args']`.
|
|
201
|
+
* @template {boolean|undefined} Flattened
|
|
202
|
+
* @param {Flattened} [flatten=true] - If `true`, flattens the returned object
|
|
203
|
+
* using "keypath"-style keys of the format `<extType>.<extName>.<argName>`.
|
|
204
|
+
* Otherwise, returns a nested object using `extType` and `extName` as
|
|
205
|
+
* properties. Base arguments (server arguments) are always at the top level.
|
|
206
|
+
* @returns {DefaultValues<Flattened>}
|
|
207
|
+
*/
|
|
208
|
+
export function getDefaultsForSchema<Flattened extends boolean | undefined>(flatten?: Flattened | undefined): DefaultValues<Flattened>;
|
|
209
|
+
/**
|
|
210
|
+
* Returns a flattened Record of defaults for a specific extension. Keys will
|
|
211
|
+
* be of format `<argName>`.
|
|
212
|
+
* @param {ExtensionType} extType - Extension type
|
|
213
|
+
* @param {string} extName - Extension name
|
|
214
|
+
* @returns {Record<string,ArgSpecDefaultValue>}
|
|
215
|
+
*/
|
|
216
|
+
export function getDefaultsForExtension(extType: ExtensionType, extName: string): Record<string, ArgSpecDefaultValue>;
|
|
217
|
+
/**
|
|
218
|
+
* Returns `true` if `filename`'s file extension is allowed (in {@link ALLOWED_SCHEMA_EXTENSIONS}).
|
|
219
|
+
* @param {import('type-fest').LiteralUnion<AllowedSchemaExtension, string>} filename
|
|
220
|
+
* @returns {boolean}
|
|
221
|
+
*/
|
|
222
|
+
export function isAllowedSchemaFileExtension(filename: import('type-fest').LiteralUnion<AllowedSchemaExtension, string>): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Appium only supports schemas that are plain objects; not arrays.
|
|
225
|
+
*/
|
|
226
|
+
export type SchemaObject = import("ajv").SchemaObject & {
|
|
227
|
+
[key: number]: never;
|
|
228
|
+
};
|
|
229
|
+
export type ExtensionType = import('@appium/types').ExtensionType;
|
|
230
|
+
/**
|
|
231
|
+
* An object having property `additionalProperties: false`
|
|
232
|
+
*/
|
|
233
|
+
export type StrictProp = {
|
|
234
|
+
additionalProperties: false;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* A {@link SchemaObject } with `additionalProperties: false`
|
|
238
|
+
*/
|
|
239
|
+
export type StrictSchemaObject = SchemaObject & StrictProp;
|
|
240
|
+
/**
|
|
241
|
+
* A list of schemas associated with properties and their corresponding {@link ArgSpec } objects.
|
|
242
|
+
*
|
|
243
|
+
* Intermediate data structure used when converting the entire schema down to CLI arguments.
|
|
244
|
+
*/
|
|
245
|
+
export type FlattenedSchema = {
|
|
246
|
+
schema: SchemaObject;
|
|
247
|
+
argSpec: ArgSpec<any>;
|
|
248
|
+
}[];
|
|
249
|
+
export type ArgSpecDefaultValue = ArgSpec<any>['defaultValue'];
|
|
250
|
+
/**
|
|
251
|
+
* e.g. `{driver: {foo: 'bar'}}` where `foo` is the arg name and `bar` is the default value.
|
|
252
|
+
*/
|
|
253
|
+
export type NestedArgSpecDefaultValue = Record<string, Record<string, ArgSpecDefaultValue>>;
|
|
254
|
+
/**
|
|
255
|
+
* Helper type for the return value of {@link AppiumSchema.getDefaults }
|
|
256
|
+
*/
|
|
257
|
+
export type DefaultValues<Flattened extends boolean | undefined> = Record<string, Flattened extends true ? ArgSpecDefaultValue : ArgSpecDefaultValue | NestedArgSpecDefaultValue>;
|
|
258
|
+
export type AllowedSchemaExtension = '.json' | '.js' | '.cjs';
|
|
259
|
+
import { ArgSpec } from "./arg-spec";
|
|
260
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../lib/schema/schema.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH;IAyE2B,cAE1B;IAAE,uEAAyE;IA+E9C,cAEpB;IAAA,qEACP;CAtIF;AAED;;GAEG;AACH,8EAEE;AAyfF;;;GAGG;AACH;IAME,cAEC;IAPD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEa;CAKxC;AAED;;;;GAIG;AACH;IAWE;;;OAGG;IACH,qBAHW,aAAa,WACb,MAAM,EAKhB;IAjBD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEc;IAExC;;OAEG;IACH,MAFU,SAAS;QAAC,OAAO,EAAE,aAAa,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAExD;CAUN;AAED;;GAEG;AACH;IAWE;;OAEG;IACH,sBAFW,MAAM,EAKhB;IAhBD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEe;IAEzC;;OAEG;IACH,MAFU,SAAS;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,CAAC,CAEjC;CASN;AAED;;;;;GAKG;AACH;IAWE;;;;OAIG;IACH,oBAJW,GAAG,WACH,aAAa,WACb,MAAM,EAyBhB;IAtCD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEmB;IAE7C;;OAEG;IACH,MAFU,SAAS;QAAC,MAAM,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,aAAa,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAErE;CA+BN;AA5WC;;;;;;;;;;;GAWG;AACH,wCANW,aAAa,WACb,MAAM,UACN,YAAY,GAEV,IAAI,CAmBhB;AAzKD,sEAEC;AAyKD;;;;;;GAMG;AACH,iCALW,MAAM,8FAGJ,eAAQ,SAAS,CAI7B;AAED;;;;;;GAMG;AACH,iCALW,MAAM,8FAGJ,OAAO,CAInB;AAxMD;;;;GAIG;AACH,+BAFa,OAAO,CAInB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,kCAFa,SAAS,OAAO,MAAM,EAAC,kBAAkB,CAAC,CAAC,CAsEvD;AAuBD;;;;;;;;;;GAUG;AACH,+BAFa,IAAI,CAehB;AA8ND;;;;;;;GAOG;AACH,gCALW,GAAG,6BAGD,OAAO,KAAK,EAAE,WAAW,EAAE,CAKvC;AAxCD;;;;;;GAMG;AACH,qDAFa,YAAY,CAIxB;AAjFD;;;;;;;;;;;;;GAaG;AACH,iDAwDC;AAxID;;;;;;;;;;;GAWG;AACH,uIA8BC;AAED;;;;;;GAMG;AACH,iDAJW,aAAa,WACb,MAAM,GACJ,OAAO,MAAM,EAAC,mBAAmB,CAAC,CAe9C;AAoHD;;;;GAIG;AACH,uDAHW,OAAO,WAAW,EAAE,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,GAC9D,OAAO,CAMnB;;;;;;;4BAoJU,OAAO,eAAe,EAAE,aAAa;;;;;0BAMpC,KAAK;;;;;iCAKN,YAAY,GAAG,UAAU;;;;;;8BAOxB;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,OAAO,eAAS;CAAC,EAAE;kCAI3C,aAAQ,cAAc,CAAC;;;;wCAKvB,OAAO,MAAM,EAAC,OAAO,MAAM,EAAC,mBAAmB,CAAC,CAAC;;;;mEAMjD,OAAO,MAAM,EAAC,SAAS,SAAS,IAAI,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,yBAAyB,CAAC;qCAI7G,OAAO,GAAC,KAAK,GAAC,MAAM"}
|