@better-update/cli 0.18.2 → 0.18.4
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.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { defineCommand, runMain } from "citty";
|
|
5
|
-
import { Console, Context, Data, Deferred, Duration, Effect, Layer, Match, Option, ParseResult, Schema } from "effect";
|
|
5
|
+
import { Console, Context, Data, Deferred, Duration, Effect, Layer, Match, Option, ParseResult, Schedule, Schema } from "effect";
|
|
6
6
|
import { Command, FetchHttpClient, FileSystem, HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, HttpApiSecurity, HttpClient, HttpClientRequest, OpenApi, Path } from "@effect/platform";
|
|
7
7
|
import { NodeContext } from "@effect/platform-node";
|
|
8
8
|
import path, { join } from "node:path";
|
|
@@ -32,7 +32,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region package.json
|
|
35
|
-
var version = "0.18.
|
|
35
|
+
var version = "0.18.4";
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/lib/interactive-mode.ts
|
|
@@ -1815,17 +1815,23 @@ const ConfigStoreLive = Layer.effect(ConfigStore, Effect.gen(function* () {
|
|
|
1815
1815
|
HttpApiClient.make(ManagementApi);
|
|
1816
1816
|
var ApiClientService = class extends Context.Tag("cli/ApiClient")() {};
|
|
1817
1817
|
const apiClient = Effect.flatMap(ApiClientService, ({ get }) => get);
|
|
1818
|
+
const RETRY_TRANSIENT_OPTIONS = {
|
|
1819
|
+
mode: "errors-only",
|
|
1820
|
+
times: 4,
|
|
1821
|
+
schedule: Schedule.exponential("500 millis", 2)
|
|
1822
|
+
};
|
|
1818
1823
|
const ApiClientLive = Layer.effect(ApiClientService, Effect.gen(function* () {
|
|
1819
1824
|
const clientService = yield* HttpClient.HttpClient;
|
|
1820
1825
|
const authStore = yield* AuthStore;
|
|
1821
1826
|
const configStore = yield* ConfigStore;
|
|
1827
|
+
const retryingClient = HttpClient.retryTransient(clientService, RETRY_TRANSIENT_OPTIONS);
|
|
1822
1828
|
return { get: Effect.gen(function* () {
|
|
1823
1829
|
const token = yield* authStore.getToken;
|
|
1824
1830
|
const baseUrl = yield* configStore.getBaseUrl;
|
|
1825
1831
|
return yield* HttpApiClient.make(ManagementApi, {
|
|
1826
1832
|
transformClient: HttpClient.mapRequest(HttpClientRequest.bearerToken(token)),
|
|
1827
1833
|
baseUrl
|
|
1828
|
-
}).pipe(Effect.provideService(HttpClient.HttpClient,
|
|
1834
|
+
}).pipe(Effect.provideService(HttpClient.HttpClient, retryingClient));
|
|
1829
1835
|
}) };
|
|
1830
1836
|
}));
|
|
1831
1837
|
|
|
@@ -5120,6 +5126,17 @@ const setupIosViaAscKey = (api, input) => Effect.gen(function* () {
|
|
|
5120
5126
|
//#region src/application/credentials-interactive.ts
|
|
5121
5127
|
const hasTag = (cause) => typeof cause === "object" && cause !== null && "_tag" in cause;
|
|
5122
5128
|
const isMissingResolveError = (cause) => hasTag(cause) && (cause._tag === "NotFound" || cause._tag === "BadRequest");
|
|
5129
|
+
const randomKeystoreSecret = () => randomBytes(24).toString("base64url");
|
|
5130
|
+
const generateKeystoreAuto = (api, applicationIdentifier) => Effect.gen(function* () {
|
|
5131
|
+
yield* Console.log("Generating a new Android Keystore...");
|
|
5132
|
+
return (yield* generateAndUploadKeystore(api, {
|
|
5133
|
+
keyAlias: "upload",
|
|
5134
|
+
storePassword: randomKeystoreSecret(),
|
|
5135
|
+
keyPassword: randomKeystoreSecret(),
|
|
5136
|
+
commonName: applicationIdentifier,
|
|
5137
|
+
organization: "better-update"
|
|
5138
|
+
})).id;
|
|
5139
|
+
});
|
|
5123
5140
|
const generateKeystoreInteractive = (api) => Effect.gen(function* () {
|
|
5124
5141
|
const alias = yield* promptText("Key alias", { placeholder: "upload-key" });
|
|
5125
5142
|
const storePassword = yield* promptPassword("Keystore password");
|
|
@@ -5177,7 +5194,7 @@ const setupAndroidInteractive = (api, input) => Effect.gen(function* () {
|
|
|
5177
5194
|
message: `Build aborted — no keystore bound to ${input.applicationIdentifier}.`,
|
|
5178
5195
|
hint: "Run `better-update credentials generate keystore` or upload via the dashboard."
|
|
5179
5196
|
}));
|
|
5180
|
-
const keystoreId = yield*
|
|
5197
|
+
const keystoreId = yield* choice === "generate" ? generateKeystoreAuto(api, input.applicationIdentifier) : pickExistingKeystore(api);
|
|
5181
5198
|
yield* api.androidBuildCredentials.create({
|
|
5182
5199
|
path: { applicationIdentifierId: appId },
|
|
5183
5200
|
payload: {
|