@hot-updater/android-helper 1.2.0-rc.3 → 1.2.0-rc.5
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.cjs +213 -324
- package/dist/index.d.cts +38 -58
- package/dist/index.d.mts +38 -58
- package/dist/index.mjs +213 -321
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -54,6 +54,16 @@ declare const findPlayInternalRelease: ({ versionCode, packageName, serviceAccou
|
|
|
54
54
|
serviceAccount: Credentials["play-service-account"];
|
|
55
55
|
fetch?: typeof globalThis.fetch;
|
|
56
56
|
}) => Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Whether Google Play releases any version of `packageName` on any track,
|
|
59
|
+
* which means Play has the app's upload key. It reads the tracks in an edit
|
|
60
|
+
* it then deletes, changing nothing.
|
|
61
|
+
*/
|
|
62
|
+
declare const hasPlayReleases: ({ packageName, serviceAccount: { json }, fetch }: {
|
|
63
|
+
packageName: string;
|
|
64
|
+
serviceAccount: Credentials["play-service-account"];
|
|
65
|
+
fetch?: typeof globalThis.fetch;
|
|
66
|
+
}) => Promise<boolean>;
|
|
57
67
|
/**
|
|
58
68
|
* Throws when the `.aab` is signed with the Android debug keystore, which
|
|
59
69
|
* Google Play refuses: a release build type left on `signingConfigs.debug`,
|
|
@@ -146,28 +156,22 @@ declare const readBuiltVersionCode: ({ artifactPath, androidProjectPath }: {
|
|
|
146
156
|
//#region src/google/types.d.ts
|
|
147
157
|
/** What stopped Hot Updater from issuing the Play service account key. */
|
|
148
158
|
type PlayServiceAccountErrorCode =
|
|
149
|
-
/**
|
|
150
|
-
"
|
|
151
|
-
/**
|
|
152
|
-
"
|
|
153
|
-
/** The account unticked a scope the setup needs on Google's consent screen. */
|
|
154
|
-
"scope-not-granted" |
|
|
155
|
-
/** The developer account ID names no Play Console account. */
|
|
156
|
-
"developer-not-found" |
|
|
157
|
-
/** The Google Account is no admin of the Play Console developer account. */
|
|
158
|
-
"not-play-admin" |
|
|
159
|
-
/** Google Play has no app with the package name in the developer account. */
|
|
160
|
-
"app-not-found" |
|
|
159
|
+
/** The gcloud CLI, which signs in to Google, is not installed. */
|
|
160
|
+
"gcloud-not-installed" |
|
|
161
|
+
/** `gcloud auth login` ended with no active Google Account. */
|
|
162
|
+
"gcloud-not-signed-in" |
|
|
161
163
|
/** The Google Account may not create a Google Cloud project. */
|
|
162
164
|
"project-create-denied" |
|
|
163
165
|
/** The Google Account has no Google Cloud project quota left. */
|
|
164
166
|
"project-quota" |
|
|
165
167
|
/** The Google Account may not enable APIs or create service accounts in the project. */
|
|
166
168
|
"project-access-denied" |
|
|
167
|
-
/** Google is still enabling an API, or it is disabled in
|
|
169
|
+
/** Google is still enabling an API, or it is disabled in another project. */
|
|
168
170
|
"api-not-enabled" |
|
|
169
171
|
/** An organization policy (`iam.disableServiceAccountKeyCreation`) forbids keys. */
|
|
170
|
-
"key-creation-disabled"
|
|
172
|
+
"key-creation-disabled" |
|
|
173
|
+
/** The key never reached the app: the Play Console invite, or the app's first upload, is missing. */
|
|
174
|
+
"play-access-pending";
|
|
171
175
|
/** A named failure of `issuePlayServiceAccount`, with what to do in its message. */
|
|
172
176
|
declare class PlayServiceAccountError extends Error {
|
|
173
177
|
readonly code: PlayServiceAccountErrorCode;
|
|
@@ -175,31 +179,10 @@ declare class PlayServiceAccountError extends Error {
|
|
|
175
179
|
cause?: unknown;
|
|
176
180
|
});
|
|
177
181
|
}
|
|
178
|
-
/**
|
|
179
|
-
* A Google OAuth client of type "Desktop app". Google treats an installed
|
|
180
|
-
* app's client secret as public, so it ships with the client ID.
|
|
181
|
-
*/
|
|
182
|
-
interface GoogleOAuthClient {
|
|
183
|
-
readonly clientId: string;
|
|
184
|
-
readonly clientSecret?: string;
|
|
185
|
-
}
|
|
186
|
-
/** The environment variables that replace Hot Updater's Google OAuth client. */
|
|
187
|
-
declare const GOOGLE_OAUTH_CLIENT_ENV_NAMES: {
|
|
188
|
-
readonly clientId: "HOT_UPDATER_GOOGLE_OAUTH_CLIENT_ID";
|
|
189
|
-
readonly clientSecret: "HOT_UPDATER_GOOGLE_OAUTH_CLIENT_SECRET";
|
|
190
|
-
};
|
|
191
182
|
/** The service account Hot Updater creates, `hot-updater-play@<project>.iam.gserviceaccount.com`. */
|
|
192
183
|
declare const PLAY_SERVICE_ACCOUNT_ID = "hot-updater-play";
|
|
193
|
-
/** Where a Play Console admin finds the developer account ID. */
|
|
194
|
-
declare const PLAY_CONSOLE_URL = "https://play.google.com/console";
|
|
195
184
|
//#endregion
|
|
196
185
|
//#region src/playServiceAccount.d.ts
|
|
197
|
-
/**
|
|
198
|
-
* Hot Updater's Google OAuth client, a "Desktop app" client the sign-in
|
|
199
|
-
* opens Google's consent screen for. Empty in a build that has none, where
|
|
200
|
-
* `HOT_UPDATER_GOOGLE_OAUTH_CLIENT_ID` and `_SECRET` name one.
|
|
201
|
-
*/
|
|
202
|
-
declare const HOT_UPDATER_GOOGLE_OAUTH_CLIENT: GoogleOAuthClient;
|
|
203
186
|
/** A Google Cloud project the signed-in account can use. */
|
|
204
187
|
interface GoogleCloudProject {
|
|
205
188
|
readonly projectId: string;
|
|
@@ -208,24 +191,23 @@ interface GoogleCloudProject {
|
|
|
208
191
|
interface IssuePlayServiceAccountRequest {
|
|
209
192
|
/** The app's package name in Google Play, which the service account may release. */
|
|
210
193
|
readonly packageName: string;
|
|
211
|
-
/** The OAuth client to sign in with; Hot Updater's unless set. */
|
|
212
|
-
readonly oauthClient?: GoogleOAuthClient;
|
|
213
|
-
/** Sees the sign-in URL, to print it and open it in a browser. */
|
|
214
|
-
readonly onSignInUrl: (url: string) => Promise<void> | void;
|
|
215
|
-
/** Asks for the Play Console developer account ID, after the sign-in. */
|
|
216
|
-
readonly askDeveloperId: () => Promise<string>;
|
|
217
194
|
/**
|
|
218
|
-
* Sees
|
|
219
|
-
*
|
|
195
|
+
* Sees Play Console's page that invites the service account `email`, to
|
|
196
|
+
* print it and open it in a browser; the issuer then waits for the invite.
|
|
197
|
+
*/
|
|
198
|
+
readonly onInvite: (url: string, email: string) => Promise<void> | void;
|
|
199
|
+
/**
|
|
200
|
+
* Sees the account's projects when Google refuses to create one for it,
|
|
201
|
+
* and returns the one to create the service account in, or undefined to
|
|
202
|
+
* stop with Google's refusal.
|
|
220
203
|
*/
|
|
221
204
|
readonly chooseProject: (projects: readonly GoogleCloudProject[]) => Promise<string | undefined>;
|
|
222
205
|
/** Reports each step, such as "Creating the service account". */
|
|
223
206
|
readonly onStep?: (message: string) => void;
|
|
224
207
|
}
|
|
225
208
|
/**
|
|
226
|
-
* A Play service account's JSON key, just created,
|
|
227
|
-
*
|
|
228
|
-
* sign-in lasts, and `dispose` ends the sign-in.
|
|
209
|
+
* A Play service account's JSON key, just created, which already reaches
|
|
210
|
+
* the app in Google Play. `revoke` deletes the key with gcloud's sign-in.
|
|
229
211
|
*/
|
|
230
212
|
interface IssuedPlayServiceAccount {
|
|
231
213
|
/** The JSON key file, as Google Cloud downloads it. */
|
|
@@ -233,27 +215,25 @@ interface IssuedPlayServiceAccount {
|
|
|
233
215
|
/** The service account's email, the Play Console user it releases as. */
|
|
234
216
|
readonly email: string;
|
|
235
217
|
readonly projectId: string;
|
|
236
|
-
readonly developerId: string;
|
|
237
218
|
/** The key's ID, as Google Cloud lists it under the service account's keys. */
|
|
238
219
|
readonly keyId: string;
|
|
239
|
-
/** Deletes the key with
|
|
220
|
+
/** Deletes the key with gcloud's sign-in; whether Google Cloud did. */
|
|
240
221
|
revoke(): Promise<boolean>;
|
|
241
|
-
/**
|
|
222
|
+
/** Releases what the issue held; gcloud keeps its own sign-in. */
|
|
242
223
|
dispose(): Promise<void>;
|
|
243
224
|
}
|
|
244
225
|
/**
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* the sign-in outlives `dispose`.
|
|
226
|
+
* Issues a service account key that releases the app to Google Play, with
|
|
227
|
+
* the gcloud CLI's Google sign-in: the caller never sees the password, and
|
|
228
|
+
* the developer invites the service account in Play Console once.
|
|
249
229
|
*/
|
|
250
230
|
type IssuePlayServiceAccount = (request: IssuePlayServiceAccountRequest) => Promise<IssuedPlayServiceAccount>;
|
|
251
231
|
/**
|
|
252
|
-
* Hot Updater's issuer, the one place that picks how it is done:
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
232
|
+
* Hot Updater's issuer, the one place that picks how it is done: gcloud's
|
|
233
|
+
* sign-in, then the Cloud Resource Manager, Service Usage, IAM, and Play
|
|
234
|
+
* Developer APIs. Another implementation of `IssuePlayServiceAccount`
|
|
235
|
+
* replaces it here without touching its callers.
|
|
256
236
|
*/
|
|
257
237
|
declare const issuePlayServiceAccount: IssuePlayServiceAccount;
|
|
258
238
|
//#endregion
|
|
259
|
-
export { type EnrichedNativeBuildAndroidScheme,
|
|
239
|
+
export { type EnrichedNativeBuildAndroidScheme, type GoogleCloudProject, type IssuePlayServiceAccount, type IssuePlayServiceAccountRequest, type IssuedPlayServiceAccount, PLAY_SERVICE_ACCOUNT_ID, PlayServiceAccountError, type PlayServiceAccountErrorCode, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, hasPlayReleases, issuePlayServiceAccount, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, resolvePlayUploadServiceAccount, uploadToPlay };
|
package/dist/index.d.mts
CHANGED
|
@@ -55,6 +55,16 @@ declare const findPlayInternalRelease: ({ versionCode, packageName, serviceAccou
|
|
|
55
55
|
serviceAccount: Credentials["play-service-account"];
|
|
56
56
|
fetch?: typeof globalThis.fetch;
|
|
57
57
|
}) => Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Whether Google Play releases any version of `packageName` on any track,
|
|
60
|
+
* which means Play has the app's upload key. It reads the tracks in an edit
|
|
61
|
+
* it then deletes, changing nothing.
|
|
62
|
+
*/
|
|
63
|
+
declare const hasPlayReleases: ({ packageName, serviceAccount: { json }, fetch }: {
|
|
64
|
+
packageName: string;
|
|
65
|
+
serviceAccount: Credentials["play-service-account"];
|
|
66
|
+
fetch?: typeof globalThis.fetch;
|
|
67
|
+
}) => Promise<boolean>;
|
|
58
68
|
/**
|
|
59
69
|
* Throws when the `.aab` is signed with the Android debug keystore, which
|
|
60
70
|
* Google Play refuses: a release build type left on `signingConfigs.debug`,
|
|
@@ -147,28 +157,22 @@ declare const readBuiltVersionCode: ({ artifactPath, androidProjectPath }: {
|
|
|
147
157
|
//#region src/google/types.d.ts
|
|
148
158
|
/** What stopped Hot Updater from issuing the Play service account key. */
|
|
149
159
|
type PlayServiceAccountErrorCode =
|
|
150
|
-
/**
|
|
151
|
-
"
|
|
152
|
-
/**
|
|
153
|
-
"
|
|
154
|
-
/** The account unticked a scope the setup needs on Google's consent screen. */
|
|
155
|
-
"scope-not-granted" |
|
|
156
|
-
/** The developer account ID names no Play Console account. */
|
|
157
|
-
"developer-not-found" |
|
|
158
|
-
/** The Google Account is no admin of the Play Console developer account. */
|
|
159
|
-
"not-play-admin" |
|
|
160
|
-
/** Google Play has no app with the package name in the developer account. */
|
|
161
|
-
"app-not-found" |
|
|
160
|
+
/** The gcloud CLI, which signs in to Google, is not installed. */
|
|
161
|
+
"gcloud-not-installed" |
|
|
162
|
+
/** `gcloud auth login` ended with no active Google Account. */
|
|
163
|
+
"gcloud-not-signed-in" |
|
|
162
164
|
/** The Google Account may not create a Google Cloud project. */
|
|
163
165
|
"project-create-denied" |
|
|
164
166
|
/** The Google Account has no Google Cloud project quota left. */
|
|
165
167
|
"project-quota" |
|
|
166
168
|
/** The Google Account may not enable APIs or create service accounts in the project. */
|
|
167
169
|
"project-access-denied" |
|
|
168
|
-
/** Google is still enabling an API, or it is disabled in
|
|
170
|
+
/** Google is still enabling an API, or it is disabled in another project. */
|
|
169
171
|
"api-not-enabled" |
|
|
170
172
|
/** An organization policy (`iam.disableServiceAccountKeyCreation`) forbids keys. */
|
|
171
|
-
"key-creation-disabled"
|
|
173
|
+
"key-creation-disabled" |
|
|
174
|
+
/** The key never reached the app: the Play Console invite, or the app's first upload, is missing. */
|
|
175
|
+
"play-access-pending";
|
|
172
176
|
/** A named failure of `issuePlayServiceAccount`, with what to do in its message. */
|
|
173
177
|
declare class PlayServiceAccountError extends Error {
|
|
174
178
|
readonly code: PlayServiceAccountErrorCode;
|
|
@@ -176,31 +180,10 @@ declare class PlayServiceAccountError extends Error {
|
|
|
176
180
|
cause?: unknown;
|
|
177
181
|
});
|
|
178
182
|
}
|
|
179
|
-
/**
|
|
180
|
-
* A Google OAuth client of type "Desktop app". Google treats an installed
|
|
181
|
-
* app's client secret as public, so it ships with the client ID.
|
|
182
|
-
*/
|
|
183
|
-
interface GoogleOAuthClient {
|
|
184
|
-
readonly clientId: string;
|
|
185
|
-
readonly clientSecret?: string;
|
|
186
|
-
}
|
|
187
|
-
/** The environment variables that replace Hot Updater's Google OAuth client. */
|
|
188
|
-
declare const GOOGLE_OAUTH_CLIENT_ENV_NAMES: {
|
|
189
|
-
readonly clientId: "HOT_UPDATER_GOOGLE_OAUTH_CLIENT_ID";
|
|
190
|
-
readonly clientSecret: "HOT_UPDATER_GOOGLE_OAUTH_CLIENT_SECRET";
|
|
191
|
-
};
|
|
192
183
|
/** The service account Hot Updater creates, `hot-updater-play@<project>.iam.gserviceaccount.com`. */
|
|
193
184
|
declare const PLAY_SERVICE_ACCOUNT_ID = "hot-updater-play";
|
|
194
|
-
/** Where a Play Console admin finds the developer account ID. */
|
|
195
|
-
declare const PLAY_CONSOLE_URL = "https://play.google.com/console";
|
|
196
185
|
//#endregion
|
|
197
186
|
//#region src/playServiceAccount.d.ts
|
|
198
|
-
/**
|
|
199
|
-
* Hot Updater's Google OAuth client, a "Desktop app" client the sign-in
|
|
200
|
-
* opens Google's consent screen for. Empty in a build that has none, where
|
|
201
|
-
* `HOT_UPDATER_GOOGLE_OAUTH_CLIENT_ID` and `_SECRET` name one.
|
|
202
|
-
*/
|
|
203
|
-
declare const HOT_UPDATER_GOOGLE_OAUTH_CLIENT: GoogleOAuthClient;
|
|
204
187
|
/** A Google Cloud project the signed-in account can use. */
|
|
205
188
|
interface GoogleCloudProject {
|
|
206
189
|
readonly projectId: string;
|
|
@@ -209,24 +192,23 @@ interface GoogleCloudProject {
|
|
|
209
192
|
interface IssuePlayServiceAccountRequest {
|
|
210
193
|
/** The app's package name in Google Play, which the service account may release. */
|
|
211
194
|
readonly packageName: string;
|
|
212
|
-
/** The OAuth client to sign in with; Hot Updater's unless set. */
|
|
213
|
-
readonly oauthClient?: GoogleOAuthClient;
|
|
214
|
-
/** Sees the sign-in URL, to print it and open it in a browser. */
|
|
215
|
-
readonly onSignInUrl: (url: string) => Promise<void> | void;
|
|
216
|
-
/** Asks for the Play Console developer account ID, after the sign-in. */
|
|
217
|
-
readonly askDeveloperId: () => Promise<string>;
|
|
218
195
|
/**
|
|
219
|
-
* Sees
|
|
220
|
-
*
|
|
196
|
+
* Sees Play Console's page that invites the service account `email`, to
|
|
197
|
+
* print it and open it in a browser; the issuer then waits for the invite.
|
|
198
|
+
*/
|
|
199
|
+
readonly onInvite: (url: string, email: string) => Promise<void> | void;
|
|
200
|
+
/**
|
|
201
|
+
* Sees the account's projects when Google refuses to create one for it,
|
|
202
|
+
* and returns the one to create the service account in, or undefined to
|
|
203
|
+
* stop with Google's refusal.
|
|
221
204
|
*/
|
|
222
205
|
readonly chooseProject: (projects: readonly GoogleCloudProject[]) => Promise<string | undefined>;
|
|
223
206
|
/** Reports each step, such as "Creating the service account". */
|
|
224
207
|
readonly onStep?: (message: string) => void;
|
|
225
208
|
}
|
|
226
209
|
/**
|
|
227
|
-
* A Play service account's JSON key, just created,
|
|
228
|
-
*
|
|
229
|
-
* sign-in lasts, and `dispose` ends the sign-in.
|
|
210
|
+
* A Play service account's JSON key, just created, which already reaches
|
|
211
|
+
* the app in Google Play. `revoke` deletes the key with gcloud's sign-in.
|
|
230
212
|
*/
|
|
231
213
|
interface IssuedPlayServiceAccount {
|
|
232
214
|
/** The JSON key file, as Google Cloud downloads it. */
|
|
@@ -234,27 +216,25 @@ interface IssuedPlayServiceAccount {
|
|
|
234
216
|
/** The service account's email, the Play Console user it releases as. */
|
|
235
217
|
readonly email: string;
|
|
236
218
|
readonly projectId: string;
|
|
237
|
-
readonly developerId: string;
|
|
238
219
|
/** The key's ID, as Google Cloud lists it under the service account's keys. */
|
|
239
220
|
readonly keyId: string;
|
|
240
|
-
/** Deletes the key with
|
|
221
|
+
/** Deletes the key with gcloud's sign-in; whether Google Cloud did. */
|
|
241
222
|
revoke(): Promise<boolean>;
|
|
242
|
-
/**
|
|
223
|
+
/** Releases what the issue held; gcloud keeps its own sign-in. */
|
|
243
224
|
dispose(): Promise<void>;
|
|
244
225
|
}
|
|
245
226
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* the sign-in outlives `dispose`.
|
|
227
|
+
* Issues a service account key that releases the app to Google Play, with
|
|
228
|
+
* the gcloud CLI's Google sign-in: the caller never sees the password, and
|
|
229
|
+
* the developer invites the service account in Play Console once.
|
|
250
230
|
*/
|
|
251
231
|
type IssuePlayServiceAccount = (request: IssuePlayServiceAccountRequest) => Promise<IssuedPlayServiceAccount>;
|
|
252
232
|
/**
|
|
253
|
-
* Hot Updater's issuer, the one place that picks how it is done:
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
233
|
+
* Hot Updater's issuer, the one place that picks how it is done: gcloud's
|
|
234
|
+
* sign-in, then the Cloud Resource Manager, Service Usage, IAM, and Play
|
|
235
|
+
* Developer APIs. Another implementation of `IssuePlayServiceAccount`
|
|
236
|
+
* replaces it here without touching its callers.
|
|
257
237
|
*/
|
|
258
238
|
declare const issuePlayServiceAccount: IssuePlayServiceAccount;
|
|
259
239
|
//#endregion
|
|
260
|
-
export { type EnrichedNativeBuildAndroidScheme,
|
|
240
|
+
export { type EnrichedNativeBuildAndroidScheme, type GoogleCloudProject, type IssuePlayServiceAccount, type IssuePlayServiceAccountRequest, type IssuedPlayServiceAccount, PLAY_SERVICE_ACCOUNT_ID, PlayServiceAccountError, type PlayServiceAccountErrorCode, PlayVersionCodeUsedError, type UploadToPlayResult, assertPlaySigned, buildAndroid, enrichNativeBuildAndroidScheme, extractBuiltInBundle, findPlayInternalRelease, hasPlayReleases, issuePlayServiceAccount, readBuiltApp, readBuiltPackageName, readBuiltVersionCode, resolvePlayUploadServiceAccount, uploadToPlay };
|