@hot-updater/android-helper 1.2.0-rc.11 → 1.2.0-rc.13

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/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { NativeBuildAndroidScheme } from "@hot-updater/plugin-core";
4
4
  /**
5
5
  * Validated scheme filled nullish values with default values.
6
6
  */
7
- type EnrichedNativeBuildAndroidScheme = Required<Omit<NativeBuildAndroidScheme, "signing">> & Pick<NativeBuildAndroidScheme, "signing"> & {
7
+ type EnrichedNativeBuildAndroidScheme = Required<Omit<NativeBuildAndroidScheme, "signing" | "sandbox">> & Pick<NativeBuildAndroidScheme, "signing" | "sandbox"> & {
8
8
  hotUpdaterSchemeName: string;
9
9
  };
10
10
  declare const enrichNativeBuildAndroidScheme: ({ schemeConfig, hotUpdaterSchemeName }: {
@@ -13,7 +13,7 @@ declare const enrichNativeBuildAndroidScheme: ({ schemeConfig, hotUpdaterSchemeN
13
13
  }) => Promise<EnrichedNativeBuildAndroidScheme>;
14
14
  //#endregion
15
15
  //#region src/buildAndroid.d.ts
16
- declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader }: {
16
+ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader, minVersionCode }: {
17
17
  schemeConfig: EnrichedNativeBuildAndroidScheme;
18
18
  /** The MIN_BUNDLE_ID the build compiles in. */
19
19
  minBundleId?: string;
@@ -21,6 +21,8 @@ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader
21
21
  credentials?: Pick<CredentialResolver, "resolve">;
22
22
  /** Lines the build log starts with, such as the native build key. */
23
23
  logHeader?: string[];
24
+ /** The lowest version code a sandbox build may have. */
25
+ minVersionCode?: number;
24
26
  }) => Promise<{
25
27
  buildDirectory: string;
26
28
  buildArtifactPath: string;
@@ -36,6 +38,29 @@ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader
36
38
  };
37
39
  }>;
38
40
  //#endregion
41
+ //#region src/device.d.ts
42
+ interface AdbDevice {
43
+ readonly serial: string;
44
+ /** `device` when it takes commands; else `offline`, `unauthorized`, and so on. */
45
+ readonly state: string;
46
+ }
47
+ /** What `adb devices` lists. */
48
+ declare const listAdbDevices: () => Promise<readonly AdbDevice[]>;
49
+ /**
50
+ * The device to install on: `serial`, as adb's own `ANDROID_SERIAL` names it
51
+ * too, or else the only one that takes commands.
52
+ */
53
+ declare const selectAdbDevice: (devices: readonly AdbDevice[], serial?: string | undefined) => AdbDevice;
54
+ /**
55
+ * Installs an APK on a device, and opens its launcher activity. `appId` is
56
+ * the APK's own application ID, whatever suffix its build gave it.
57
+ */
58
+ declare const installOnAndroidDevice: ({ serial, apkPath, appId }: {
59
+ readonly serial: string;
60
+ readonly apkPath: string;
61
+ readonly appId: string;
62
+ }) => Promise<void>;
63
+ //#endregion
39
64
  //#region src/uploadToPlay.d.ts
40
65
  /**
41
66
  * Google Play refused the upload: it already has a bundle or APK with the
@@ -84,18 +109,43 @@ declare const checkPlayAccess: ({ serviceAccount: { json }, packageName, fetch }
84
109
  packageName: string;
85
110
  fetch?: typeof globalThis.fetch;
86
111
  }) => Promise<PlayAccess>;
112
+ /**
113
+ * The status of the internal testing release holding `versionCode`, such as
114
+ * `completed` or `draft`, or null when the track doesn't hold it: never
115
+ * uploaded, or replaced by a newer release, which testers get instead.
116
+ */
117
+ declare const readPlayInternalRelease: ({ versionCode, packageName, serviceAccount, fetch }: {
118
+ versionCode: number;
119
+ /** The application ID the `.aab` was built with. */
120
+ packageName: string;
121
+ serviceAccount: Credentials["play-service-account"];
122
+ fetch?: typeof globalThis.fetch;
123
+ }) => Promise<string | null>;
87
124
  /**
88
125
  * Whether Google Play's internal testing track already releases the
89
- * `.aab`'s version code, as when a reused native build was uploaded
90
- * before. It reads the track in an edit it then deletes, changing nothing.
126
+ * `.aab`'s version code, as when a reused native build was uploaded before.
91
127
  */
92
- declare const findPlayInternalRelease: ({ versionCode, packageName, serviceAccount: { json }, fetch }: {
128
+ declare const findPlayInternalRelease: (options: {
93
129
  versionCode: number;
94
130
  /** The application ID the `.aab` was built with. */
95
131
  packageName: string;
96
132
  serviceAccount: Credentials["play-service-account"];
97
133
  fetch?: typeof globalThis.fetch;
98
134
  }) => Promise<boolean>;
135
+ /**
136
+ * The highest version code Google Play has taken for the app, on any track,
137
+ * or null with none: a new `.aab` needs one above it.
138
+ */
139
+ declare const readPlayHighestVersionCode: ({ packageName, serviceAccount, fetch }: {
140
+ packageName: string;
141
+ serviceAccount: Credentials["play-service-account"];
142
+ fetch?: typeof globalThis.fetch;
143
+ }) => Promise<number | null>;
144
+ /**
145
+ * The link that opts a tester in to the app's testing tracks. A build on the
146
+ * internal track installs through it, for the testers Play Console lists.
147
+ */
148
+ declare const playTestingUrl: (packageName: string) => string;
99
149
  /**
100
150
  * Throws when the `.aab` is signed with the Android debug keystore, which
101
151
  * Google Play refuses: a release build type left on `signingConfigs.debug`,
@@ -150,6 +200,17 @@ declare const extractBuiltInBundle: ({ artifactPath, outputPath }: {
150
200
  outputPath: string;
151
201
  }) => Promise<void>;
152
202
  //#endregion
203
+ //#region src/utils/sandboxGradle.d.ts
204
+ /**
205
+ * Why a sandbox build of a scheme can't work, read from the project's files
206
+ * before anything is built, or null. The init script checks again, with what
207
+ * Gradle actually resolved.
208
+ */
209
+ declare const findSandboxGradleBlocker: ({ variant, appModuleName }: {
210
+ readonly variant?: string;
211
+ readonly appModuleName?: string;
212
+ }) => string | null;
213
+ //#endregion
153
214
  //#region src/utils/readBuiltApp.d.ts
154
215
  /**
155
216
  * What the built `.apk` or `.aab` reports at runtime: the `versionName` and
@@ -185,4 +246,4 @@ declare const readBuiltVersionCode: ({ artifactPath, androidProjectPath }: {
185
246
  androidProjectPath: string;
186
247
  }) => Promise<number | undefined>;
187
248
  //#endregion
188
- export { type EnrichedNativeBuildAndroidScheme, type PlayAccess, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, checkPlayAccess, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, playConsoleInviteUrl, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, resolvePlayUploadServiceAccount, uploadToPlay };
249
+ export { type AdbDevice, type EnrichedNativeBuildAndroidScheme, type PlayAccess, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, checkPlayAccess, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, findSandboxGradleBlocker, installOnAndroidDevice, listAdbDevices, playConsoleInviteUrl, playTestingUrl, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, readPlayHighestVersionCode, readPlayInternalRelease, resolvePlayUploadServiceAccount, selectAdbDevice, uploadToPlay };
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { NativeBuildAndroidScheme } from "@hot-updater/plugin-core";
5
5
  /**
6
6
  * Validated scheme filled nullish values with default values.
7
7
  */
8
- type EnrichedNativeBuildAndroidScheme = Required<Omit<NativeBuildAndroidScheme, "signing">> & Pick<NativeBuildAndroidScheme, "signing"> & {
8
+ type EnrichedNativeBuildAndroidScheme = Required<Omit<NativeBuildAndroidScheme, "signing" | "sandbox">> & Pick<NativeBuildAndroidScheme, "signing" | "sandbox"> & {
9
9
  hotUpdaterSchemeName: string;
10
10
  };
11
11
  declare const enrichNativeBuildAndroidScheme: ({ schemeConfig, hotUpdaterSchemeName }: {
@@ -14,7 +14,7 @@ declare const enrichNativeBuildAndroidScheme: ({ schemeConfig, hotUpdaterSchemeN
14
14
  }) => Promise<EnrichedNativeBuildAndroidScheme>;
15
15
  //#endregion
16
16
  //#region src/buildAndroid.d.ts
17
- declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader }: {
17
+ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader, minVersionCode }: {
18
18
  schemeConfig: EnrichedNativeBuildAndroidScheme;
19
19
  /** The MIN_BUNDLE_ID the build compiles in. */
20
20
  minBundleId?: string;
@@ -22,6 +22,8 @@ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader
22
22
  credentials?: Pick<CredentialResolver, "resolve">;
23
23
  /** Lines the build log starts with, such as the native build key. */
24
24
  logHeader?: string[];
25
+ /** The lowest version code a sandbox build may have. */
26
+ minVersionCode?: number;
25
27
  }) => Promise<{
26
28
  buildDirectory: string;
27
29
  buildArtifactPath: string;
@@ -37,6 +39,29 @@ declare const buildAndroid: ({ schemeConfig, minBundleId, credentials, logHeader
37
39
  };
38
40
  }>;
39
41
  //#endregion
42
+ //#region src/device.d.ts
43
+ interface AdbDevice {
44
+ readonly serial: string;
45
+ /** `device` when it takes commands; else `offline`, `unauthorized`, and so on. */
46
+ readonly state: string;
47
+ }
48
+ /** What `adb devices` lists. */
49
+ declare const listAdbDevices: () => Promise<readonly AdbDevice[]>;
50
+ /**
51
+ * The device to install on: `serial`, as adb's own `ANDROID_SERIAL` names it
52
+ * too, or else the only one that takes commands.
53
+ */
54
+ declare const selectAdbDevice: (devices: readonly AdbDevice[], serial?: string | undefined) => AdbDevice;
55
+ /**
56
+ * Installs an APK on a device, and opens its launcher activity. `appId` is
57
+ * the APK's own application ID, whatever suffix its build gave it.
58
+ */
59
+ declare const installOnAndroidDevice: ({ serial, apkPath, appId }: {
60
+ readonly serial: string;
61
+ readonly apkPath: string;
62
+ readonly appId: string;
63
+ }) => Promise<void>;
64
+ //#endregion
40
65
  //#region src/uploadToPlay.d.ts
41
66
  /**
42
67
  * Google Play refused the upload: it already has a bundle or APK with the
@@ -85,18 +110,43 @@ declare const checkPlayAccess: ({ serviceAccount: { json }, packageName, fetch }
85
110
  packageName: string;
86
111
  fetch?: typeof globalThis.fetch;
87
112
  }) => Promise<PlayAccess>;
113
+ /**
114
+ * The status of the internal testing release holding `versionCode`, such as
115
+ * `completed` or `draft`, or null when the track doesn't hold it: never
116
+ * uploaded, or replaced by a newer release, which testers get instead.
117
+ */
118
+ declare const readPlayInternalRelease: ({ versionCode, packageName, serviceAccount, fetch }: {
119
+ versionCode: number;
120
+ /** The application ID the `.aab` was built with. */
121
+ packageName: string;
122
+ serviceAccount: Credentials["play-service-account"];
123
+ fetch?: typeof globalThis.fetch;
124
+ }) => Promise<string | null>;
88
125
  /**
89
126
  * Whether Google Play's internal testing track already releases the
90
- * `.aab`'s version code, as when a reused native build was uploaded
91
- * before. It reads the track in an edit it then deletes, changing nothing.
127
+ * `.aab`'s version code, as when a reused native build was uploaded before.
92
128
  */
93
- declare const findPlayInternalRelease: ({ versionCode, packageName, serviceAccount: { json }, fetch }: {
129
+ declare const findPlayInternalRelease: (options: {
94
130
  versionCode: number;
95
131
  /** The application ID the `.aab` was built with. */
96
132
  packageName: string;
97
133
  serviceAccount: Credentials["play-service-account"];
98
134
  fetch?: typeof globalThis.fetch;
99
135
  }) => Promise<boolean>;
136
+ /**
137
+ * The highest version code Google Play has taken for the app, on any track,
138
+ * or null with none: a new `.aab` needs one above it.
139
+ */
140
+ declare const readPlayHighestVersionCode: ({ packageName, serviceAccount, fetch }: {
141
+ packageName: string;
142
+ serviceAccount: Credentials["play-service-account"];
143
+ fetch?: typeof globalThis.fetch;
144
+ }) => Promise<number | null>;
145
+ /**
146
+ * The link that opts a tester in to the app's testing tracks. A build on the
147
+ * internal track installs through it, for the testers Play Console lists.
148
+ */
149
+ declare const playTestingUrl: (packageName: string) => string;
100
150
  /**
101
151
  * Throws when the `.aab` is signed with the Android debug keystore, which
102
152
  * Google Play refuses: a release build type left on `signingConfigs.debug`,
@@ -151,6 +201,17 @@ declare const extractBuiltInBundle: ({ artifactPath, outputPath }: {
151
201
  outputPath: string;
152
202
  }) => Promise<void>;
153
203
  //#endregion
204
+ //#region src/utils/sandboxGradle.d.ts
205
+ /**
206
+ * Why a sandbox build of a scheme can't work, read from the project's files
207
+ * before anything is built, or null. The init script checks again, with what
208
+ * Gradle actually resolved.
209
+ */
210
+ declare const findSandboxGradleBlocker: ({ variant, appModuleName }: {
211
+ readonly variant?: string;
212
+ readonly appModuleName?: string;
213
+ }) => string | null;
214
+ //#endregion
154
215
  //#region src/utils/readBuiltApp.d.ts
155
216
  /**
156
217
  * What the built `.apk` or `.aab` reports at runtime: the `versionName` and
@@ -186,4 +247,4 @@ declare const readBuiltVersionCode: ({ artifactPath, androidProjectPath }: {
186
247
  androidProjectPath: string;
187
248
  }) => Promise<number | undefined>;
188
249
  //#endregion
189
- export { type EnrichedNativeBuildAndroidScheme, type PlayAccess, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, checkPlayAccess, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, playConsoleInviteUrl, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, resolvePlayUploadServiceAccount, uploadToPlay };
250
+ export { type AdbDevice, type EnrichedNativeBuildAndroidScheme, type PlayAccess, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, checkPlayAccess, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, findSandboxGradleBlocker, installOnAndroidDevice, listAdbDevices, playConsoleInviteUrl, playTestingUrl, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, readPlayHighestVersionCode, readPlayInternalRelease, resolvePlayUploadServiceAccount, selectAdbDevice, uploadToPlay };