appium-adb 14.3.5 → 14.4.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 (134) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/adb.d.ts +9 -4
  3. package/build/lib/adb.d.ts.map +1 -1
  4. package/build/lib/adb.js +8 -9
  5. package/build/lib/adb.js.map +1 -1
  6. package/build/lib/index.d.ts +1 -1
  7. package/build/lib/index.d.ts.map +1 -1
  8. package/build/lib/index.js +2 -2
  9. package/build/lib/index.js.map +1 -1
  10. package/build/lib/logcat.d.ts.map +1 -1
  11. package/build/lib/logcat.js +6 -14
  12. package/build/lib/logcat.js.map +1 -1
  13. package/build/lib/tools/aab-utils.d.ts.map +1 -1
  14. package/build/lib/tools/aab-utils.js +2 -2
  15. package/build/lib/tools/aab-utils.js.map +1 -1
  16. package/build/lib/tools/android-manifest.d.ts.map +1 -1
  17. package/build/lib/tools/android-manifest.js +11 -12
  18. package/build/lib/tools/android-manifest.js.map +1 -1
  19. package/build/lib/tools/apk-signing.d.ts.map +1 -1
  20. package/build/lib/tools/apk-signing.js +18 -19
  21. package/build/lib/tools/apk-signing.js.map +1 -1
  22. package/build/lib/tools/apk-utils.d.ts.map +1 -1
  23. package/build/lib/tools/apk-utils.js +39 -40
  24. package/build/lib/tools/apk-utils.js.map +1 -1
  25. package/build/lib/tools/apks-utils.d.ts.map +1 -1
  26. package/build/lib/tools/apks-utils.js +8 -9
  27. package/build/lib/tools/apks-utils.js.map +1 -1
  28. package/build/lib/tools/app-commands.d.ts.map +1 -1
  29. package/build/lib/tools/app-commands.js +37 -36
  30. package/build/lib/tools/app-commands.js.map +1 -1
  31. package/build/lib/tools/device-settings.d.ts.map +1 -1
  32. package/build/lib/tools/device-settings.js +17 -18
  33. package/build/lib/tools/device-settings.js.map +1 -1
  34. package/build/lib/tools/emulator-commands.d.ts.map +1 -1
  35. package/build/lib/tools/emulator-commands.js +22 -23
  36. package/build/lib/tools/emulator-commands.js.map +1 -1
  37. package/build/lib/tools/fs-commands.d.ts.map +1 -1
  38. package/build/lib/tools/fs-commands.js +5 -4
  39. package/build/lib/tools/fs-commands.js.map +1 -1
  40. package/build/lib/tools/general-commands.d.ts.map +1 -1
  41. package/build/lib/tools/general-commands.js +29 -29
  42. package/build/lib/tools/general-commands.js.map +1 -1
  43. package/build/lib/tools/keyboard-commands.d.ts.map +1 -1
  44. package/build/lib/tools/keyboard-commands.js +6 -4
  45. package/build/lib/tools/keyboard-commands.js.map +1 -1
  46. package/build/lib/tools/lockmgmt.d.ts.map +1 -1
  47. package/build/lib/tools/lockmgmt.js +17 -20
  48. package/build/lib/tools/lockmgmt.js.map +1 -1
  49. package/build/lib/tools/logcat-commands.d.ts.map +1 -1
  50. package/build/lib/tools/logcat-commands.js +5 -9
  51. package/build/lib/tools/logcat-commands.js.map +1 -1
  52. package/build/lib/tools/network-commands.d.ts.map +1 -1
  53. package/build/lib/tools/network-commands.js +1 -5
  54. package/build/lib/tools/network-commands.js.map +1 -1
  55. package/build/lib/tools/process-commands.d.ts.map +1 -1
  56. package/build/lib/tools/process-commands.js +11 -12
  57. package/build/lib/tools/process-commands.js.map +1 -1
  58. package/build/lib/tools/system-calls.d.ts +12 -5
  59. package/build/lib/tools/system-calls.d.ts.map +1 -1
  60. package/build/lib/tools/system-calls.js +56 -50
  61. package/build/lib/tools/system-calls.js.map +1 -1
  62. package/build/lib/tools/types.d.ts +1 -1
  63. package/build/lib/tools/types.d.ts.map +1 -1
  64. package/build/lib/utils/helpers/constants.d.ts +6 -0
  65. package/build/lib/utils/helpers/constants.d.ts.map +1 -0
  66. package/build/lib/utils/helpers/constants.js +9 -0
  67. package/build/lib/utils/helpers/constants.js.map +1 -0
  68. package/build/lib/utils/helpers/index.d.ts +6 -0
  69. package/build/lib/utils/helpers/index.d.ts.map +1 -0
  70. package/build/lib/utils/helpers/index.js +21 -0
  71. package/build/lib/utils/helpers/index.js.map +1 -0
  72. package/build/lib/utils/helpers/install.d.ts +16 -0
  73. package/build/lib/utils/helpers/install.d.ts.map +1 -0
  74. package/build/lib/utils/helpers/install.js +39 -0
  75. package/build/lib/utils/helpers/install.js.map +1 -0
  76. package/build/lib/utils/helpers/manifest.d.ts +10 -0
  77. package/build/lib/utils/helpers/manifest.d.ts.map +1 -0
  78. package/build/lib/utils/helpers/manifest.js +124 -0
  79. package/build/lib/utils/helpers/manifest.js.map +1 -0
  80. package/build/lib/utils/helpers/resource.d.ts +11 -0
  81. package/build/lib/utils/helpers/resource.d.ts.map +1 -0
  82. package/build/lib/utils/helpers/resource.js +59 -0
  83. package/build/lib/utils/helpers/resource.js.map +1 -0
  84. package/build/lib/utils/helpers/sdk.d.ts +20 -0
  85. package/build/lib/utils/helpers/sdk.d.ts.map +1 -0
  86. package/build/lib/utils/helpers/sdk.js +80 -0
  87. package/build/lib/utils/helpers/sdk.js.map +1 -0
  88. package/build/lib/utils/index.d.ts +40 -0
  89. package/build/lib/utils/index.d.ts.map +1 -0
  90. package/build/lib/utils/index.js +58 -0
  91. package/build/lib/utils/index.js.map +1 -0
  92. package/build/lib/utils/lodash/core.d.ts +9 -0
  93. package/build/lib/utils/lodash/core.d.ts.map +1 -0
  94. package/build/lib/utils/lodash/core.js +60 -0
  95. package/build/lib/utils/lodash/core.js.map +1 -0
  96. package/build/lib/utils/lodash/index.d.ts +2 -0
  97. package/build/lib/utils/lodash/index.d.ts.map +1 -0
  98. package/build/lib/utils/lodash/index.js +18 -0
  99. package/build/lib/utils/lodash/index.js.map +1 -0
  100. package/lib/adb.ts +14 -6
  101. package/lib/index.ts +1 -1
  102. package/lib/logcat.ts +6 -11
  103. package/lib/tools/aab-utils.ts +1 -1
  104. package/lib/tools/android-manifest.ts +4 -4
  105. package/lib/tools/apk-signing.ts +11 -7
  106. package/lib/tools/apk-utils.ts +41 -42
  107. package/lib/tools/apks-utils.ts +4 -5
  108. package/lib/tools/app-commands.ts +40 -34
  109. package/lib/tools/device-settings.ts +17 -15
  110. package/lib/tools/emulator-commands.ts +22 -23
  111. package/lib/tools/fs-commands.ts +5 -4
  112. package/lib/tools/general-commands.ts +32 -27
  113. package/lib/tools/keyboard-commands.ts +6 -4
  114. package/lib/tools/lockmgmt.ts +17 -13
  115. package/lib/tools/logcat-commands.ts +5 -6
  116. package/lib/tools/network-commands.ts +1 -2
  117. package/lib/tools/process-commands.ts +11 -9
  118. package/lib/tools/system-calls.ts +54 -46
  119. package/lib/tools/types.ts +1 -1
  120. package/lib/utils/helpers/constants.ts +6 -0
  121. package/lib/utils/helpers/index.ts +10 -0
  122. package/lib/utils/helpers/install.ts +50 -0
  123. package/lib/utils/helpers/manifest.ts +127 -0
  124. package/lib/utils/helpers/resource.ts +63 -0
  125. package/lib/utils/helpers/sdk.ts +81 -0
  126. package/lib/utils/index.ts +25 -0
  127. package/lib/utils/lodash/core.ts +65 -0
  128. package/lib/utils/lodash/index.ts +1 -0
  129. package/package.json +2 -4
  130. package/build/lib/helpers.d.ts +0 -47
  131. package/build/lib/helpers.d.ts.map +0 -1
  132. package/build/lib/helpers.js +0 -283
  133. package/build/lib/helpers.js.map +0 -1
  134. package/lib/helpers.ts +0 -323
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODULE_NAME = exports.DEFAULT_ADB_EXEC_TIMEOUT = exports.APK_INSTALL_TIMEOUT = exports.APK_EXTENSION = exports.APKS_EXTENSION = void 0;
4
+ exports.APKS_EXTENSION = '.apks';
5
+ exports.APK_EXTENSION = '.apk';
6
+ exports.APK_INSTALL_TIMEOUT = 60000;
7
+ exports.DEFAULT_ADB_EXEC_TIMEOUT = 20000; // in milliseconds
8
+ exports.MODULE_NAME = 'appium-adb';
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,OAAO,CAAC;AACzB,QAAA,aAAa,GAAG,MAAM,CAAC;AACvB,QAAA,mBAAmB,GAAG,KAAK,CAAC;AAC5B,QAAA,wBAAwB,GAAG,KAAK,CAAC,CAAC,kBAAkB;AAEpD,QAAA,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { APKS_EXTENSION, APK_EXTENSION, APK_INSTALL_TIMEOUT, DEFAULT_ADB_EXEC_TIMEOUT, } from './constants';
2
+ export { buildInstallArgs, type BuildInstallArgsOptions } from './install';
3
+ export { readPackageManifest } from './manifest';
4
+ export { getResourcePath, unzipFile } from './resource';
5
+ export { getSdkRootFromEnv, requireSdkRoot, getJavaHome, getJavaForOs } from './sdk';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/utils/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,gBAAgB,EAAE,KAAK,uBAAuB,EAAC,MAAM,WAAW,CAAC;AACzE,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,OAAO,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJavaForOs = exports.getJavaHome = exports.requireSdkRoot = exports.getSdkRootFromEnv = exports.unzipFile = exports.getResourcePath = exports.readPackageManifest = exports.buildInstallArgs = exports.DEFAULT_ADB_EXEC_TIMEOUT = exports.APK_INSTALL_TIMEOUT = exports.APK_EXTENSION = exports.APKS_EXTENSION = void 0;
4
+ var constants_1 = require("./constants");
5
+ Object.defineProperty(exports, "APKS_EXTENSION", { enumerable: true, get: function () { return constants_1.APKS_EXTENSION; } });
6
+ Object.defineProperty(exports, "APK_EXTENSION", { enumerable: true, get: function () { return constants_1.APK_EXTENSION; } });
7
+ Object.defineProperty(exports, "APK_INSTALL_TIMEOUT", { enumerable: true, get: function () { return constants_1.APK_INSTALL_TIMEOUT; } });
8
+ Object.defineProperty(exports, "DEFAULT_ADB_EXEC_TIMEOUT", { enumerable: true, get: function () { return constants_1.DEFAULT_ADB_EXEC_TIMEOUT; } });
9
+ var install_1 = require("./install");
10
+ Object.defineProperty(exports, "buildInstallArgs", { enumerable: true, get: function () { return install_1.buildInstallArgs; } });
11
+ var manifest_1 = require("./manifest");
12
+ Object.defineProperty(exports, "readPackageManifest", { enumerable: true, get: function () { return manifest_1.readPackageManifest; } });
13
+ var resource_1 = require("./resource");
14
+ Object.defineProperty(exports, "getResourcePath", { enumerable: true, get: function () { return resource_1.getResourcePath; } });
15
+ Object.defineProperty(exports, "unzipFile", { enumerable: true, get: function () { return resource_1.unzipFile; } });
16
+ var sdk_1 = require("./sdk");
17
+ Object.defineProperty(exports, "getSdkRootFromEnv", { enumerable: true, get: function () { return sdk_1.getSdkRootFromEnv; } });
18
+ Object.defineProperty(exports, "requireSdkRoot", { enumerable: true, get: function () { return sdk_1.requireSdkRoot; } });
19
+ Object.defineProperty(exports, "getJavaHome", { enumerable: true, get: function () { return sdk_1.getJavaHome; } });
20
+ Object.defineProperty(exports, "getJavaForOs", { enumerable: true, get: function () { return sdk_1.getJavaForOs; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/index.ts"],"names":[],"mappings":";;;AAAA,yCAKqB;AAJnB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,qHAAA,wBAAwB,OAAA;AAE1B,qCAAyE;AAAjE,2GAAA,gBAAgB,OAAA;AACxB,uCAA+C;AAAvC,+GAAA,mBAAmB,OAAA;AAC3B,uCAAsD;AAA9C,2GAAA,eAAe,OAAA;AAAE,qGAAA,SAAS,OAAA;AAClC,6BAAmF;AAA3E,wGAAA,iBAAiB,OAAA;AAAE,qGAAA,cAAc,OAAA;AAAE,kGAAA,WAAW,OAAA;AAAE,mGAAA,YAAY,OAAA"}
@@ -0,0 +1,16 @@
1
+ export interface BuildInstallArgsOptions {
2
+ replace?: boolean;
3
+ allowTestPackages?: boolean;
4
+ useSdcard?: boolean;
5
+ grantPermissions?: boolean;
6
+ partialInstall?: boolean;
7
+ }
8
+ /**
9
+ * Builds command-line arguments for `adb install`.
10
+ *
11
+ * @param apiLevel - Android API level of the target device
12
+ * @param options - Install options mapped to adb flags
13
+ * @returns A list of install flags
14
+ */
15
+ export declare function buildInstallArgs(apiLevel: number, options?: BuildInstallArgsOptions): string[];
16
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../lib/utils/helpers/install.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,uBAA4B,GACpC,MAAM,EAAE,CA4BV"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildInstallArgs = buildInstallArgs;
4
+ const support_1 = require("@appium/support");
5
+ const logger_1 = require("../../logger");
6
+ /**
7
+ * Builds command-line arguments for `adb install`.
8
+ *
9
+ * @param apiLevel - Android API level of the target device
10
+ * @param options - Install options mapped to adb flags
11
+ * @returns A list of install flags
12
+ */
13
+ function buildInstallArgs(apiLevel, options = {}) {
14
+ const result = [];
15
+ if (!support_1.util.hasValue(options.replace) || options.replace) {
16
+ result.push('-r');
17
+ }
18
+ if (options.allowTestPackages) {
19
+ result.push('-t');
20
+ }
21
+ if (options.useSdcard) {
22
+ result.push('-s');
23
+ }
24
+ if (options.grantPermissions) {
25
+ if (apiLevel < 23) {
26
+ logger_1.log.debug(`Skipping permissions grant option, since ` +
27
+ `the current API level ${apiLevel} does not support applications ` +
28
+ `permissions customization`);
29
+ }
30
+ else {
31
+ result.push('-g');
32
+ }
33
+ }
34
+ if (options.partialInstall) {
35
+ result.push('-p');
36
+ }
37
+ return result;
38
+ }
39
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/install.ts"],"names":[],"mappings":";;AAkBA,4CA+BC;AAjDD,6CAAqC;AACrC,yCAAiC;AAUjC;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,UAAmC,EAAE;IAErC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACvD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,IAAI,QAAQ,GAAG,EAAE,EAAE,CAAC;YAClB,YAAG,CAAC,KAAK,CACP,2CAA2C;gBACzC,yBAAyB,QAAQ,iCAAiC;gBAClE,2BAA2B,CAC9B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ADB } from '../../adb';
2
+ import type { ApkManifest } from '../../tools/types';
3
+ /**
4
+ * Reads and parses Android manifest metadata from an APK via `aapt2`.
5
+ *
6
+ * @param apkPath - Local path to the APK file
7
+ * @returns Parsed manifest data
8
+ */
9
+ export declare function readPackageManifest(this: ADB, apkPath: string): Promise<ApkManifest>;
10
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../../lib/utils/helpers/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAkH1F"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readPackageManifest = readPackageManifest;
4
+ const support_1 = require("@appium/support");
5
+ const teen_process_1 = require("teen_process");
6
+ const logger_1 = require("../../logger");
7
+ /**
8
+ * Reads and parses Android manifest metadata from an APK via `aapt2`.
9
+ *
10
+ * @param apkPath - Local path to the APK file
11
+ * @returns Parsed manifest data
12
+ */
13
+ async function readPackageManifest(apkPath) {
14
+ await this.initAapt2();
15
+ const aapt2Binary = this.binaries?.aapt2;
16
+ if (!aapt2Binary) {
17
+ throw new Error('aapt2 binary is not available');
18
+ }
19
+ const args = ['dump', 'badging', apkPath];
20
+ logger_1.log.debug(`Reading package manifest: '${support_1.util.quote([aapt2Binary, ...args])}'`);
21
+ let stdout;
22
+ try {
23
+ ({ stdout } = await (0, teen_process_1.exec)(aapt2Binary, args));
24
+ }
25
+ catch (e) {
26
+ const error = e;
27
+ const prefix = `Cannot read the manifest from '${apkPath}'`;
28
+ const suffix = `Original error: ${error.stderr || error.message}`;
29
+ if (error.stderr && error.stderr.includes(`Unable to open 'badging'`)) {
30
+ throw new Error(`${prefix}. Update build tools to use a newer aapt2 version. ${suffix}`, {
31
+ cause: e,
32
+ });
33
+ }
34
+ throw new Error(`${prefix}. ${suffix}`, { cause: e });
35
+ }
36
+ const extractValue = (line, propPattern, valueTransformer) => {
37
+ const match = propPattern.exec(line);
38
+ if (match) {
39
+ return valueTransformer ? valueTransformer(match[1]) : match[1];
40
+ }
41
+ return undefined;
42
+ };
43
+ const extractArray = (line, propPattern, valueTransformer) => {
44
+ let match;
45
+ const resultArray = [];
46
+ while ((match = propPattern.exec(line))) {
47
+ resultArray.push(valueTransformer ? valueTransformer(match[1]) : match[1]);
48
+ }
49
+ return resultArray;
50
+ };
51
+ const toInt = (x) => parseInt(x, 10);
52
+ const result = {
53
+ name: '',
54
+ versionCode: 0,
55
+ minSdkVersion: 0,
56
+ compileSdkVersion: 0,
57
+ usesPermissions: [],
58
+ launchableActivity: {
59
+ name: '',
60
+ },
61
+ architectures: [],
62
+ locales: [],
63
+ densities: [],
64
+ };
65
+ for (const line of stdout.split('\n')) {
66
+ if (line.startsWith('package:')) {
67
+ for (const [name, pattern, transformer] of [
68
+ ['name', /name='([^']+)'/, null],
69
+ ['versionCode', /versionCode='([^']+)'/, toInt],
70
+ ['versionName', /versionName='([^']+)'/, null],
71
+ ['platformBuildVersionName', /platformBuildVersionName='([^']+)'/, null],
72
+ ['platformBuildVersionCode', /platformBuildVersionCode='([^']+)'/, toInt],
73
+ ['compileSdkVersion', /compileSdkVersion='([^']+)'/, toInt],
74
+ ['compileSdkVersionCodename', /compileSdkVersionCodename='([^']+)'/, null],
75
+ ]) {
76
+ const value = extractValue(line, pattern, transformer);
77
+ if (value !== undefined) {
78
+ result[name] = value;
79
+ }
80
+ }
81
+ }
82
+ else if (line.startsWith('sdkVersion:') || line.startsWith('minSdkVersion:')) {
83
+ const value = extractValue(line, /[sS]dkVersion:'([^']+)'/, toInt);
84
+ if (value) {
85
+ result.minSdkVersion = value;
86
+ }
87
+ }
88
+ else if (line.startsWith('targetSdkVersion:')) {
89
+ const value = extractValue(line, /targetSdkVersion:'([^']+)'/, toInt);
90
+ if (value) {
91
+ result.targetSdkVersion = value;
92
+ }
93
+ }
94
+ else if (line.startsWith('uses-permission:')) {
95
+ const value = extractValue(line, /name='([^']+)'/, null);
96
+ if (value) {
97
+ result.usesPermissions.push(value);
98
+ }
99
+ }
100
+ else if (line.startsWith('launchable-activity:')) {
101
+ for (const [name, pattern] of [
102
+ ['name', /name='([^']+)'/],
103
+ ['label', /label='([^']+)'/],
104
+ ['icon', /icon='([^']+)'/],
105
+ ]) {
106
+ const value = extractValue(line, pattern, null);
107
+ if (value) {
108
+ result.launchableActivity[name] = value;
109
+ }
110
+ }
111
+ }
112
+ else if (line.startsWith('locales:')) {
113
+ result.locales = extractArray(line, /'([^']+)'/g, null);
114
+ }
115
+ else if (line.startsWith('native-code:')) {
116
+ result.architectures = extractArray(line, /'([^']+)'/g, null);
117
+ }
118
+ else if (line.startsWith('densities:')) {
119
+ result.densities = extractArray(line, /'([^']+)'/g, toInt);
120
+ }
121
+ }
122
+ return result;
123
+ }
124
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/manifest.ts"],"names":[],"mappings":";;AAYA,kDAkHC;AA9HD,6CAAqC;AACrC,+CAAkD;AAClD,yCAAiC;AAIjC;;;;;GAKG;AACI,K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, Promise<string>>;
3
+ };
4
+ /**
5
+ * Unzips an archive into the target destination directory.
6
+ *
7
+ * @param zipPath - Source zip file path
8
+ * @param dstRoot - Destination directory. Defaults to zip parent directory
9
+ */
10
+ export declare function unzipFile(zipPath: string, dstRoot?: string): Promise<void>;
11
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../../lib/utils/helpers/resource.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,aACjB,MAAM,KACd,OAAO,CAAC,MAAM,CAAC;;CAUhB,CAAC;AAEH;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,MAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAKf"}
@@ -0,0 +1,59 @@
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.getResourcePath = void 0;
7
+ exports.unzipFile = unzipFile;
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const support_1 = require("@appium/support");
10
+ const logger_1 = require("../../logger");
11
+ const constants_1 = require("./constants");
12
+ exports.getResourcePath = support_1.util.memoize(async function getResourcePath(relPath) {
13
+ const moduleRoot = await getModuleRoot();
14
+ const resultPath = node_path_1.default.resolve(moduleRoot, relPath);
15
+ if (!(await support_1.fs.exists(resultPath))) {
16
+ throw new Error(`Cannot find the resource '${relPath}' under the '${moduleRoot}' ` +
17
+ `folder of ${constants_1.MODULE_NAME} Node.js module`);
18
+ }
19
+ return resultPath;
20
+ });
21
+ /**
22
+ * Unzips an archive into the target destination directory.
23
+ *
24
+ * @param zipPath - Source zip file path
25
+ * @param dstRoot - Destination directory. Defaults to zip parent directory
26
+ */
27
+ async function unzipFile(zipPath, dstRoot = node_path_1.default.dirname(zipPath)) {
28
+ logger_1.log.debug(`Unzipping '${zipPath}' to '${dstRoot}'`);
29
+ await support_1.zip.assertValidZip(zipPath);
30
+ await support_1.zip.extractAllTo(zipPath, dstRoot);
31
+ logger_1.log.debug('Unzip successful');
32
+ }
33
+ const getModuleRoot = support_1.util.memoize(async function getModuleRoot() {
34
+ let moduleRoot = node_path_1.default.dirname(node_path_1.default.resolve(__filename));
35
+ let isAtFsRoot = false;
36
+ while (!isAtFsRoot) {
37
+ const manifestPath = node_path_1.default.join(moduleRoot, 'package.json');
38
+ try {
39
+ if (await support_1.fs.exists(manifestPath)) {
40
+ const manifestContent = await support_1.fs.readFile(manifestPath, 'utf8');
41
+ const manifest = JSON.parse(manifestContent);
42
+ if (manifest.name === constants_1.MODULE_NAME) {
43
+ return moduleRoot;
44
+ }
45
+ }
46
+ }
47
+ catch {
48
+ // Ignore errors and continue searching
49
+ }
50
+ const parentDir = node_path_1.default.dirname(moduleRoot);
51
+ isAtFsRoot = moduleRoot.length <= parentDir.length;
52
+ moduleRoot = parentDir;
53
+ }
54
+ if (isAtFsRoot) {
55
+ throw new Error(`Cannot find the root folder of the ${constants_1.MODULE_NAME} Node.js module`);
56
+ }
57
+ return moduleRoot;
58
+ });
59
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/resource.ts"],"names":[],"mappings":";;;;;;AA4BA,8BAQC;AApCD,0DAA6B;AAC7B,6CAA8C;AAC9C,yCAAiC;AACjC,2CAAwC;AAK3B,QAAA,eAAe,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,UAAU,eAAe,CACxE,OAAe;IAEf,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,mBAAI,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,CAAC,MAAM,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC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CAAC;QACD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC3C,UAAU,GAAG,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC;QACnD,UAAU,GAAG,SAAS,CAAC;IACzB,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,uBAAW,iBAAiB,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Gets Android SDK root from environment variables.
3
+ *
4
+ * @returns SDK root path if present
5
+ */
6
+ export declare function getSdkRootFromEnv(): string | undefined;
7
+ /**
8
+ * Resolves and validates Android SDK root path.
9
+ *
10
+ * @param customRoot - Optional explicit SDK root path override
11
+ * @returns Absolute path to a valid SDK root directory
12
+ */
13
+ export declare function requireSdkRoot(customRoot?: string | null): Promise<string>;
14
+ export declare const getJavaHome: (() => Promise<string>) & {
15
+ cache: Map<unknown, Promise<string>>;
16
+ };
17
+ export declare const getJavaForOs: (() => Promise<string>) & {
18
+ cache: Map<unknown, Promise<string>>;
19
+ };
20
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../../lib/utils/helpers/sdk.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAEtD;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,UAAU,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBtF;AAED,eAAO,MAAM,WAAW,SAA8C,OAAO,CAAC,MAAM,CAAC;;CAanF,CAAC;AAEH,eAAO,MAAM,YAAY,SAA+C,OAAO,CAAC,MAAM,CAAC;;CAyBrF,CAAC"}
@@ -0,0 +1,80 @@
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.getJavaForOs = exports.getJavaHome = void 0;
7
+ exports.getSdkRootFromEnv = getSdkRootFromEnv;
8
+ exports.requireSdkRoot = requireSdkRoot;
9
+ const support_1 = require("@appium/support");
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ /**
12
+ * Gets Android SDK root from environment variables.
13
+ *
14
+ * @returns SDK root path if present
15
+ */
16
+ function getSdkRootFromEnv() {
17
+ return process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT;
18
+ }
19
+ /**
20
+ * Resolves and validates Android SDK root path.
21
+ *
22
+ * @param customRoot - Optional explicit SDK root path override
23
+ * @returns Absolute path to a valid SDK root directory
24
+ */
25
+ async function requireSdkRoot(customRoot = null) {
26
+ const sdkRoot = customRoot || getSdkRootFromEnv();
27
+ const docMsg = 'Read https://developer.android.com/studio/command-line/variables for more details';
28
+ if (!sdkRoot || support_1.util.isEmpty(sdkRoot)) {
29
+ throw new Error(`Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. ${docMsg}`);
30
+ }
31
+ if (!(await support_1.fs.exists(sdkRoot))) {
32
+ throw new Error(`The Android SDK root folder '${sdkRoot}' does not exist on the local file system. ${docMsg}`);
33
+ }
34
+ const stats = await support_1.fs.stat(sdkRoot);
35
+ if (!stats.isDirectory()) {
36
+ throw new Error(`The Android SDK root '${sdkRoot}' must be a folder. ${docMsg}`);
37
+ }
38
+ return sdkRoot;
39
+ }
40
+ exports.getJavaHome = support_1.util.memoize(async function getJavaHome() {
41
+ const result = process.env.JAVA_HOME;
42
+ if (!result) {
43
+ throw new Error('The JAVA_HOME environment variable is not set for the current process');
44
+ }
45
+ if (!(await support_1.fs.exists(result))) {
46
+ throw new Error(`The JAVA_HOME location '${result}' must exist`);
47
+ }
48
+ const stats = await support_1.fs.stat(result);
49
+ if (!stats.isDirectory()) {
50
+ throw new Error(`The JAVA_HOME location '${result}' must be a valid folder`);
51
+ }
52
+ return result;
53
+ });
54
+ exports.getJavaForOs = support_1.util.memoize(async function getJavaForOs() {
55
+ let javaHome;
56
+ let errMsg;
57
+ try {
58
+ javaHome = await (0, exports.getJavaHome)();
59
+ }
60
+ catch (err) {
61
+ const error = err;
62
+ errMsg = error.message;
63
+ }
64
+ const executableName = `java${support_1.system.isWindows() ? '.exe' : ''}`;
65
+ if (javaHome) {
66
+ const resultPath = node_path_1.default.resolve(javaHome, 'bin', executableName);
67
+ if (await support_1.fs.exists(resultPath)) {
68
+ return resultPath;
69
+ }
70
+ }
71
+ try {
72
+ return await support_1.fs.which(executableName);
73
+ }
74
+ catch {
75
+ // Ignore and throw custom error below
76
+ }
77
+ throw new Error(`The '${executableName}' binary could not be found ` +
78
+ `neither in PATH nor under JAVA_HOME (${javaHome ? node_path_1.default.resolve(javaHome, 'bin') : errMsg})`);
79
+ });
80
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../../lib/utils/helpers/sdk.ts"],"names":[],"mappings":";;;;;;AAQA,8CAEC;AAQD,wCAoBC;AAtCD,6CAAiD;AACjD,0DAA6B;AAE7B;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,aAA4B,IAAI;IACnE,MAAM,OAAO,GAAG,UAAU,IAAI,iBAAiB,EAAE,CAAC;IAClD,MAAM,MAAM,GACV,mFAAmF,CAAC;IACtF,IAAI,CAAC,OAAO,IAAI,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,gFAAgF,MAAM,EAAE,CACzF,CAAC;IACJ,CAAC;IACD,IAAI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IACjC,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,GAAY,CAAC;QAC3B,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,gBAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACjE,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,UAAU,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,MAAM,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,YAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;IACD,MAAM,IAAI,KAAK,CACb,QAAQ,cAAc,8BAA8B;QAClD,wCAAwC,QAAQ,CAAC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAC/F,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import * as helpers from './helpers';
2
+ import { util } from '@appium/support';
3
+ export declare const APKS_EXTENSION = ".apks";
4
+ export declare const APK_INSTALL_TIMEOUT = 60000;
5
+ export declare const DEFAULT_ADB_EXEC_TIMEOUT = 20000;
6
+ export declare const buildInstallArgs: typeof helpers.buildInstallArgs;
7
+ export declare const readPackageManifest: typeof helpers.readPackageManifest;
8
+ export declare const getResourcePath: ((relPath: string) => Promise<string>) & {
9
+ cache: Map<unknown, Promise<string>>;
10
+ };
11
+ export declare const unzipFile: typeof helpers.unzipFile;
12
+ export declare const getSdkRootFromEnv: typeof helpers.getSdkRootFromEnv;
13
+ export declare const requireSdkRoot: typeof helpers.requireSdkRoot;
14
+ export declare const getJavaHome: (() => Promise<string>) & {
15
+ cache: Map<unknown, Promise<string>>;
16
+ };
17
+ export declare const getJavaForOs: (() => Promise<string>) & {
18
+ cache: Map<unknown, Promise<string>>;
19
+ };
20
+ export declare const memoize: typeof util.memoize;
21
+ export declare const cloneDeep: <T>(value: T) => T;
22
+ export declare const defaults: (target: {
23
+ [x: string]: any;
24
+ }, ...sources: {
25
+ [x: string]: any;
26
+ }[]) => {
27
+ [x: string]: any;
28
+ };
29
+ export declare const intersectionWith: <T>(first: T[], second: T[], comparator: (left: T, right: T) => boolean) => T[];
30
+ export declare const zip: <A, B>(arrA: readonly A[], arrB: readonly B[]) => Array<[A | undefined, B | undefined]>;
31
+ export declare const pick: <T extends {
32
+ [x: string]: any;
33
+ }>(obj: T, keysArg: string[]) => Partial<T>;
34
+ export declare const defaultsDeep: <T extends {
35
+ [x: string]: any;
36
+ }>(target: T, ...sources: {
37
+ [x: string]: any;
38
+ }[]) => T;
39
+ export type { BuildInstallArgsOptions } from './helpers';
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAErC,eAAO,MAAM,cAAc,UAAyB,CAAC;AACrD,eAAO,MAAM,mBAAmB,QAA8B,CAAC;AAC/D,eAAO,MAAM,wBAAwB,QAAmC,CAAC;AACzE,eAAO,MAAM,gBAAgB,iCAA2B,CAAC;AACzD,eAAO,MAAM,mBAAmB,oCAA8B,CAAC;AAC/D,eAAO,MAAM,eAAe;;CAA0B,CAAC;AACvD,eAAO,MAAM,SAAS,0BAAoB,CAAC;AAC3C,eAAO,MAAM,iBAAiB,kCAA4B,CAAC;AAC3D,eAAO,MAAM,cAAc,+BAAyB,CAAC;AACrD,eAAO,MAAM,WAAW;;CAAsB,CAAC;AAC/C,eAAO,MAAM,YAAY;;CAAuB,CAAC;AAEjD,eAAO,MAAM,OAAO,qBAAe,CAAC;AACpC,eAAO,MAAM,SAAS,oBAAmB,CAAC;AAC1C,eAAO,MAAM,QAAQ;;;;;;CAAkB,CAAC;AACxC,eAAO,MAAM,gBAAgB,iFAA0B,CAAC;AACxD,eAAO,MAAM,GAAG,yFAAa,CAAC;AAC9B,eAAO,MAAM,IAAI;;2CAAc,CAAC;AAChC,eAAO,MAAM,YAAY;;;;SAAsB,CAAC;AAEhD,YAAY,EAAC,uBAAuB,EAAC,MAAM,WAAW,CAAC"}
@@ -0,0 +1,58 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.defaultsDeep = exports.pick = exports.zip = exports.intersectionWith = exports.defaults = exports.cloneDeep = exports.memoize = exports.getJavaForOs = exports.getJavaHome = exports.requireSdkRoot = exports.getSdkRootFromEnv = exports.unzipFile = exports.getResourcePath = exports.readPackageManifest = exports.buildInstallArgs = exports.DEFAULT_ADB_EXEC_TIMEOUT = exports.APK_INSTALL_TIMEOUT = exports.APKS_EXTENSION = void 0;
37
+ const helpers = __importStar(require("./helpers"));
38
+ const lodash = __importStar(require("./lodash"));
39
+ const support_1 = require("@appium/support");
40
+ exports.APKS_EXTENSION = helpers.APKS_EXTENSION;
41
+ exports.APK_INSTALL_TIMEOUT = helpers.APK_INSTALL_TIMEOUT;
42
+ exports.DEFAULT_ADB_EXEC_TIMEOUT = helpers.DEFAULT_ADB_EXEC_TIMEOUT;
43
+ exports.buildInstallArgs = helpers.buildInstallArgs;
44
+ exports.readPackageManifest = helpers.readPackageManifest;
45
+ exports.getResourcePath = helpers.getResourcePath;
46
+ exports.unzipFile = helpers.unzipFile;
47
+ exports.getSdkRootFromEnv = helpers.getSdkRootFromEnv;
48
+ exports.requireSdkRoot = helpers.requireSdkRoot;
49
+ exports.getJavaHome = helpers.getJavaHome;
50
+ exports.getJavaForOs = helpers.getJavaForOs;
51
+ exports.memoize = support_1.util.memoize;
52
+ exports.cloneDeep = lodash.cloneDeep;
53
+ exports.defaults = lodash.defaults;
54
+ exports.intersectionWith = lodash.intersectionWith;
55
+ exports.zip = lodash.zip;
56
+ exports.pick = lodash.pick;
57
+ exports.defaultsDeep = lodash.defaultsDeep;
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AACrC,iDAAmC;AACnC,6CAAqC;AAExB,QAAA,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAClD,QAAA,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAC5D,QAAA,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC5C,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAClD,QAAA,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;AAC1C,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AAC9B,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC9C,QAAA,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,QAAA,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AAClC,QAAA,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAEpC,QAAA,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC;AACvB,QAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,QAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC3C,QAAA,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;AACjB,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;AACnB,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ type AnyObject = Record<string, any>;
2
+ export declare const cloneDeep: <T>(value: T) => T;
3
+ export declare const defaults: (target: AnyObject, ...sources: AnyObject[]) => AnyObject;
4
+ export declare const intersectionWith: <T>(first: T[], second: T[], comparator: (left: T, right: T) => boolean) => T[];
5
+ export declare const zip: <A, B>(arrA: readonly A[], arrB: readonly B[]) => Array<[A | undefined, B | undefined]>;
6
+ export declare const pick: <T extends AnyObject>(obj: T, keysArg: string[]) => Partial<T>;
7
+ export declare const defaultsDeep: <T extends AnyObject>(target: T, ...sources: AnyObject[]) => T;
8
+ export {};
9
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../lib/utils/lodash/core.ts"],"names":[],"mappings":"AAEA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErC,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,CAKvC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,QAAQ,SAAS,EAAE,GAAG,SAAS,SAAS,EAAE,KAAG,SAYrE,CAAC;AAqBF,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,OAAO,CAAC,EAAE,EACV,QAAQ,CAAC,EAAE,EACX,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,KACzC,CAAC,EAA6E,CAAC;AAClF,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EACtB,MAAM,SAAS,CAAC,EAAE,EAClB,MAAM,SAAS,CAAC,EAAE,KACjB,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,SAAS,CAAC,CAGtC,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,SAAS,EAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,KAM1C,OAAO,CAAC,CAAC,CAAC,CAAC;AACpC,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,SAAS,EAAE,QAAQ,CAAC,EAAE,GAAG,SAAS,SAAS,EAAE,KAAG,CAC/C,CAAC"}