@hot-updater/cli-tools 1.2.0-rc.6 → 1.2.0-rc.8
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.mts +292 -97
- package/dist/index.mjs +743 -541
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from "stream";
|
|
2
2
|
import { Key as Key$1 } from "node:readline";
|
|
3
|
-
import { AnyHotUpdaterPlugin,
|
|
3
|
+
import { AnyHotUpdaterPlugin, ConfigInput, ConfiguredDatabase, EngineDatabase, HotUpdaterCoreApi, Migrator, NativeFingerprint, NativeFingerprintOptions, Platform, PluginClientPlugin, RequiredDeep, SchemaGenerator, SecretRef, SecretsAdapter, SigningConfig, StorageAdapter, StorageAdapterWith, StoragePutResult, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
4
4
|
import { Readable as Readable$1, Writable } from "node:stream";
|
|
5
5
|
import { ManifestArchive } from "@hot-updater/protocol";
|
|
6
6
|
//#region src/BuildLogger.d.ts
|
|
@@ -19,12 +19,21 @@ interface BuildFailureSummaryConfig {
|
|
|
19
19
|
includeEnd: boolean;
|
|
20
20
|
}[];
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Reads the short phase a live build line shows, such as `Compiling
|
|
24
|
+
* React-Core · 412 files`, from each line of the tool's raw output, or
|
|
25
|
+
* undefined for a line that starts no phase. One reader reads one run.
|
|
26
|
+
*/
|
|
27
|
+
type BuildPhaseReader = (line: string) => string | undefined;
|
|
22
28
|
interface BuildLoggerConfig {
|
|
23
29
|
logPrefix: string;
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The log file to append to, such as an archive's for its export, instead
|
|
32
|
+
* of a new one.
|
|
33
|
+
*/
|
|
34
|
+
logFilePath?: string;
|
|
35
|
+
/** A phase reader for each run. */
|
|
36
|
+
createPhaseReader: () => BuildPhaseReader;
|
|
28
37
|
/** What a failure prints from the tool's raw output. */
|
|
29
38
|
failureSummary: BuildFailureSummaryConfig;
|
|
30
39
|
}
|
|
@@ -38,33 +47,48 @@ declare class BuildFailedError extends Error {
|
|
|
38
47
|
readonly logPath: string | null;
|
|
39
48
|
/** The lines of the tool's output the summary printed. */
|
|
40
49
|
readonly summary: string[];
|
|
41
|
-
|
|
50
|
+
/**
|
|
51
|
+
* What to do about it, such as accepting an agreement, which the summary
|
|
52
|
+
* doesn't say: the one line a command prints after it, or null.
|
|
53
|
+
*/
|
|
54
|
+
readonly hint: string | null;
|
|
55
|
+
constructor(message: string, { logPath, summary, hint, cause }: {
|
|
42
56
|
logPath: string | null;
|
|
43
57
|
summary: string[];
|
|
58
|
+
hint?: string | null;
|
|
44
59
|
cause?: unknown;
|
|
45
60
|
});
|
|
46
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Runs a native build tool's output through a step: the step's live line
|
|
64
|
+
* shows the phase its reader finds, the log file keeps the raw output, and a
|
|
65
|
+
* failure prints the summary of it on stderr.
|
|
66
|
+
*/
|
|
47
67
|
declare class BuildLogger {
|
|
48
68
|
private readonly config;
|
|
49
|
-
private state;
|
|
50
69
|
private logWriter?;
|
|
70
|
+
private step?;
|
|
51
71
|
private summaryLines;
|
|
52
72
|
private tailLines;
|
|
53
73
|
private openBlock?;
|
|
54
|
-
private readonly promptProgress;
|
|
55
|
-
private readonly stageCount;
|
|
56
74
|
constructor(config: BuildLoggerConfig);
|
|
57
|
-
start(): Promise<void>;
|
|
58
75
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* output of it such as xcbeautify's, or from the raw output without one.
|
|
76
|
+
* Opens the log, writes `header` to it, such as the tool's command line,
|
|
77
|
+
* which the terminal doesn't show, and starts the step titled `title`.
|
|
62
78
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
start({ title, header }: {
|
|
80
|
+
title: string;
|
|
81
|
+
header?: string[];
|
|
65
82
|
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Writes the tool's raw output to the log file, reads its failure summary
|
|
85
|
+
* from it, and shows its phases on the step's line.
|
|
86
|
+
*/
|
|
87
|
+
processStream(input: Readable): Promise<void>;
|
|
66
88
|
/** The build log, relative to the project, or null without one. */
|
|
67
89
|
get logPath(): string | null;
|
|
90
|
+
/** The build log's absolute path, or null without one. */
|
|
91
|
+
get logFilePath(): string | null;
|
|
68
92
|
/**
|
|
69
93
|
* The lines of the raw output a failure prints: the ones the config's
|
|
70
94
|
* `failureSummary` keeps, deduplicated, or the last lines without any.
|
|
@@ -74,19 +98,18 @@ declare class BuildLogger {
|
|
|
74
98
|
private processSummaryLine;
|
|
75
99
|
private keepSummaryLine;
|
|
76
100
|
private consumeProgressStream;
|
|
77
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Ends the step with `message` and its duration, or, for a failure, as
|
|
103
|
+
* failed, then prints the failure summary and the log's path.
|
|
104
|
+
*/
|
|
78
105
|
stop(message?: string, success?: boolean): void;
|
|
79
106
|
writeError(error: unknown): void;
|
|
80
107
|
close(): Promise<void>;
|
|
81
|
-
private updateProgress;
|
|
82
|
-
private finishRemainingProgress;
|
|
83
|
-
private shouldLogLine;
|
|
84
108
|
/**
|
|
85
109
|
* Prints the failure summary and the log's path to stderr, so a `--json`
|
|
86
110
|
* command's stdout stays its JSON.
|
|
87
111
|
*/
|
|
88
112
|
private showFailureSummary;
|
|
89
|
-
private showLogFileLocation;
|
|
90
113
|
}
|
|
91
114
|
//#endregion
|
|
92
115
|
//#region src/appSetup.d.ts
|
|
@@ -196,21 +219,77 @@ declare const banner: (version?: string) => string;
|
|
|
196
219
|
declare const printBanner: (version?: string) => void;
|
|
197
220
|
//#endregion
|
|
198
221
|
//#region src/bundleSigning.d.ts
|
|
222
|
+
/** The secret `signing: secret("bundle-signing-key")` names, which `secrets issue` creates. */
|
|
223
|
+
declare const BUNDLE_SIGNING_KEY_SECRET = "bundle-signing-key";
|
|
224
|
+
/** The command that creates and stores a bundle signing key. */
|
|
225
|
+
declare const ISSUE_SIGNING_KEY_COMMAND = "npx hot-updater secrets issue bundle-signing-key";
|
|
226
|
+
/** The command that stores a bundle signing key you have. */
|
|
227
|
+
declare const PUT_SIGNING_KEY_COMMAND = "npx hot-updater secrets put bundle-signing-key <key.pem>";
|
|
228
|
+
/** What deploy and doctor say when the config sets no `signing`. */
|
|
229
|
+
declare const UNSIGNED_BUNDLES_WARNING = "Bundles are unsigned.";
|
|
230
|
+
/** The next step after `UNSIGNED_BUNDLES_WARNING`. */
|
|
231
|
+
declare const UNSIGNED_BUNDLES_NEXT_STEP = "To sign them, run:";
|
|
232
|
+
/** What deploy and doctor say when `signing` is no shape it takes. */
|
|
233
|
+
declare const INVALID_SIGNING_MESSAGE = "signing takes secret(\"bundle-signing-key\").";
|
|
234
|
+
/** The next step after `INVALID_SIGNING_MESSAGE`. */
|
|
235
|
+
declare const INVALID_SIGNING_NEXT_STEP = "Store your key:";
|
|
236
|
+
/**
|
|
237
|
+
* The config's `signing`, read without reading any key:
|
|
238
|
+
* - `on`: signs, with the private key from a secret or a file. The
|
|
239
|
+
* shorthand `secret("<name>")` is `{ enabled: true, privateKey }`;
|
|
240
|
+
* - `off`: `{ enabled: false }`, which turns signing off on purpose;
|
|
241
|
+
* - `unsigned`: no `signing`, which deploy and doctor warn about;
|
|
242
|
+
* - `invalid`: any other value, such as a signing adapter of earlier
|
|
243
|
+
* releases, which deploy refuses rather than deploy unsigned.
|
|
244
|
+
*/
|
|
245
|
+
type BundleSigningState = {
|
|
246
|
+
readonly status: "on";
|
|
247
|
+
readonly key: {
|
|
248
|
+
readonly secret: string;
|
|
249
|
+
} | {
|
|
250
|
+
readonly privateKeyPath: string;
|
|
251
|
+
};
|
|
252
|
+
} | {
|
|
253
|
+
readonly status: "off";
|
|
254
|
+
} | {
|
|
255
|
+
readonly status: "unsigned";
|
|
256
|
+
} | {
|
|
257
|
+
readonly status: "invalid";
|
|
258
|
+
readonly message: string;
|
|
259
|
+
};
|
|
260
|
+
declare const readBundleSigningState: (signing: unknown) => BundleSigningState;
|
|
261
|
+
/** The `secret()` the config's `signing` reads its private key from, if any. */
|
|
262
|
+
declare const bundleSigningSecretRef: (signing: unknown) => SecretRef | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* A bundle signing failure whose message the CLI prints as it is: it names
|
|
265
|
+
* the secret and the next step, and quotes no key material.
|
|
266
|
+
*/
|
|
267
|
+
declare class BundleSigningKeyError extends Error {
|
|
268
|
+
constructor(message: string, options?: ErrorOptions);
|
|
269
|
+
}
|
|
199
270
|
interface BundleSigningSession {
|
|
200
|
-
readonly name: string;
|
|
201
271
|
readonly publicKey: string;
|
|
202
272
|
readonly signFileHash: (fileHash: string) => Promise<string>;
|
|
203
273
|
}
|
|
204
274
|
declare const readBundleSigningPublicKeyFile: (publicKeyPath: string, options?: {
|
|
205
275
|
readonly cwd?: string;
|
|
206
276
|
}) => Promise<string>;
|
|
207
|
-
|
|
277
|
+
interface BundleSigningOptions {
|
|
208
278
|
readonly cwd?: string;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
279
|
+
/** The config's `secrets` adapter; the configured one by default. */
|
|
280
|
+
readonly secrets?: SecretsAdapter;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Prepares the run's bundle signing: the public key the app must embed, and
|
|
284
|
+
* a signer of SHA-256 file hashes that signs each hash once. Null when
|
|
285
|
+
* `signing` is omitted or `{ enabled: false }`.
|
|
286
|
+
*/
|
|
287
|
+
declare const prepareBundleSigning: (signing: unknown, options?: BundleSigningOptions) => Promise<BundleSigningSession | null>;
|
|
288
|
+
/**
|
|
289
|
+
* The public key of the configured bundle signing key, in SPKI PEM; null
|
|
290
|
+
* when `signing` signs nothing.
|
|
291
|
+
*/
|
|
292
|
+
declare const getBundleSigningPublicKey: (signing: unknown, options?: BundleSigningOptions) => Promise<string | null>;
|
|
214
293
|
//#endregion
|
|
215
294
|
//#region src/ConfigBuilder.d.ts
|
|
216
295
|
type BuildType = "bare" | "rock" | "expo";
|
|
@@ -364,8 +443,8 @@ declare const CREDENTIAL_ENV_NAMES: {
|
|
|
364
443
|
//#endregion
|
|
365
444
|
//#region src/credentialResolver.d.ts
|
|
366
445
|
/**
|
|
367
|
-
* The build credentials the CLI resolves by name.
|
|
368
|
-
* the
|
|
446
|
+
* The build credentials the CLI resolves by name. Adapter credentials are
|
|
447
|
+
* `secret()`s the adapters call.
|
|
369
448
|
*/
|
|
370
449
|
interface Credentials {
|
|
371
450
|
/** App Store Connect API key, for automatic signing and uploads. */
|
|
@@ -412,29 +491,34 @@ interface CredentialResolver {
|
|
|
412
491
|
dispose(): Promise<void>;
|
|
413
492
|
}
|
|
414
493
|
/** The credentials Hot Updater issues itself after a sign-in. */
|
|
415
|
-
type IssuedCredentialKind =
|
|
494
|
+
type IssuedCredentialKind = "asc-api-key";
|
|
495
|
+
/** The credentials `secrets put <name> <file>` stores from one file. */
|
|
496
|
+
type FileCredentialKind = Exclude<CredentialKind, IssuedCredentialKind>;
|
|
497
|
+
/**
|
|
498
|
+
* The command that stores the file you have as `name`: the service
|
|
499
|
+
* account's JSON key, or the app's upload keystore. `--kind` is named only
|
|
500
|
+
* for a name that is not the kind.
|
|
501
|
+
*/
|
|
502
|
+
declare const credentialPutCommand: (kind: FileCredentialKind, name?: string) => string;
|
|
416
503
|
/**
|
|
417
504
|
* The command that stores the key Hot Updater issues as `name`: an App
|
|
418
|
-
* Store Connect API key after an Apple Account sign-in,
|
|
419
|
-
*
|
|
505
|
+
* Store Connect API key after an Apple Account sign-in, and an upload
|
|
506
|
+
* keystore it creates.
|
|
420
507
|
*/
|
|
421
508
|
declare const credentialIssueCommand: (kind: CredentialKind, name?: string) => string;
|
|
422
509
|
/** The command group of each issued kind's shortcut, `<group> login`. */
|
|
423
510
|
declare const CREDENTIAL_LOGIN_GROUPS: {
|
|
424
511
|
readonly "asc-api-key": "apple";
|
|
425
|
-
readonly "play-service-account": "google-play";
|
|
426
512
|
};
|
|
427
513
|
/**
|
|
428
514
|
* The command people meet first that issues `kind` as `name`: its shortcut,
|
|
429
|
-
* `apple login` for an App Store Connect API key
|
|
430
|
-
*
|
|
431
|
-
* own name; for another name, `credentialIssueCommand`.
|
|
515
|
+
* `apple login` for an App Store Connect API key, which takes nothing and
|
|
516
|
+
* stores the kind's own name; for another name, `credentialIssueCommand`.
|
|
432
517
|
*/
|
|
433
518
|
declare const credentialLoginCommand: (kind: IssuedCredentialKind, name?: string) => string;
|
|
434
519
|
/**
|
|
435
520
|
* The command that stores a missing credential of `kind` as `name`: the
|
|
436
|
-
*
|
|
437
|
-
* sign-in.
|
|
521
|
+
* key Hot Updater issues after an Apple sign-in, or the file you have.
|
|
438
522
|
*/
|
|
439
523
|
declare const credentialStoreCommand: (kind: CredentialKind, name?: string) => string;
|
|
440
524
|
declare class CredentialUnavailableError extends Error {
|
|
@@ -565,15 +649,6 @@ type WriteHotUpdaterConfigResult = {
|
|
|
565
649
|
path: string;
|
|
566
650
|
reason?: string;
|
|
567
651
|
};
|
|
568
|
-
/**
|
|
569
|
-
* `const <name> = secretEnv([...names])`, a helper a managed config reads
|
|
570
|
-
* credentials with: from the environment and `.env.hotupdater` first, then
|
|
571
|
-
* from the config's `secrets` adapter. `storageSecrets` and
|
|
572
|
-
* `databaseSecrets` read each adapter's own, so a command that reaches only
|
|
573
|
-
* one needs only its credentials; `deploySecrets` reads what both share.
|
|
574
|
-
* Its builder imports `secretEnv` from `hot-updater`.
|
|
575
|
-
*/
|
|
576
|
-
declare const secretEnvHelper: (name: "databaseSecrets" | "deploySecrets" | "storageSecrets", names: readonly string[]) => ManagedHelperStatement;
|
|
577
652
|
declare const createHotUpdaterConfigScaffold: ({ build, storage, database, plugins, extraImports, helperStatements, updateStrategy }: CreateHotUpdaterConfigScaffoldOptions) => HotUpdaterConfigScaffold;
|
|
578
653
|
declare const createHotUpdaterConfigScaffoldFromBuilder: (builder: ConfigBuilder, { helperStatements, updateStrategy }?: CreateHotUpdaterConfigScaffoldFromBuilderOptions) => HotUpdaterConfigScaffold;
|
|
579
654
|
/**
|
|
@@ -581,6 +656,14 @@ declare const createHotUpdaterConfigScaffoldFromBuilder: (builder: ConfigBuilder
|
|
|
581
656
|
* existing config with the scaffold's build, storage, database, plugins, and
|
|
582
657
|
* helpers merged in, keeping the project's own settings.
|
|
583
658
|
*/
|
|
659
|
+
/**
|
|
660
|
+
* Whether `hot-updater.config.ts` in `cwd` sets a team `secrets` adapter,
|
|
661
|
+
* read from its text: a `secrets` property other than `localSecrets(...)`,
|
|
662
|
+
* or a config whose shape init can't read. False without the file. Init
|
|
663
|
+
* reads the store through the loaded config, so one that sets a store but
|
|
664
|
+
* doesn't load must be fixed first.
|
|
665
|
+
*/
|
|
666
|
+
declare const configSetsTeamSecrets: (cwd: string) => Promise<boolean>;
|
|
584
667
|
declare const writeHotUpdaterConfig: (scaffold: HotUpdaterConfigScaffold, filePath?: string) => Promise<WriteHotUpdaterConfigResult>;
|
|
585
668
|
/**
|
|
586
669
|
* Writes hot-updater.config.ts and says what it did. `settings` names the
|
|
@@ -593,6 +676,30 @@ declare const writeHotUpdaterFiles: (scaffold: HotUpdaterConfigScaffold, { cwd,
|
|
|
593
676
|
}) => Promise<{
|
|
594
677
|
readonly config: WriteHotUpdaterConfigResult;
|
|
595
678
|
}>;
|
|
679
|
+
/** What `addSigningSecretToConfigText` did. */
|
|
680
|
+
type AddSigningSecretResult = {
|
|
681
|
+
readonly status: "added";
|
|
682
|
+
readonly text: string;
|
|
683
|
+
} |
|
|
684
|
+
/** The config already sets `signing`, which stays as it is. */
|
|
685
|
+
{
|
|
686
|
+
readonly status: "kept";
|
|
687
|
+
} |
|
|
688
|
+
/** The file is no `export default defineConfig({ ... })` it can edit. */
|
|
689
|
+
{
|
|
690
|
+
readonly status: "unsupported";
|
|
691
|
+
};
|
|
692
|
+
/**
|
|
693
|
+
* The config text with `signing: secret("<name>")` added, and `secret` in
|
|
694
|
+
* its `hot-updater` import, once. A config that sets `signing` in any form,
|
|
695
|
+
* such as 1.1's `{ enabled: true, privateKeyPath }`, is kept.
|
|
696
|
+
*/
|
|
697
|
+
declare const addSigningSecretToConfigText: (text: string, name: string) => AddSigningSecretResult;
|
|
698
|
+
/**
|
|
699
|
+
* Adds `signing: secret("<name>")` to `hot-updater.config.ts` in `cwd`, as
|
|
700
|
+
* `addSigningSecretToConfigText` does. Without the file, nothing is written.
|
|
701
|
+
*/
|
|
702
|
+
declare const addSigningSecretToConfig: (cwd: string, name: string) => Promise<AddSigningSecretResult["status"] | "missing">;
|
|
596
703
|
//#endregion
|
|
597
704
|
//#region src/hotUpdaterEnv.d.ts
|
|
598
705
|
type HotUpdaterInitEnv = {
|
|
@@ -616,6 +723,11 @@ declare const getHotUpdaterEnvValue: (env: Readonly<Record<string, string>>, key
|
|
|
616
723
|
declare const parseLoadedEnv: (content: string) => Readonly<Record<string, string>>;
|
|
617
724
|
/** `cwd`'s `.env.hotupdater` as the config loads it; empty when there is none. */
|
|
618
725
|
declare const readLoadedHotUpdaterEnv: (cwd: string) => Promise<Readonly<Record<string, string>>>;
|
|
726
|
+
/**
|
|
727
|
+
* `file`, an env file a command was given, relative to `cwd`, as
|
|
728
|
+
* `parseLoadedEnv` reads it; a file that can't be read is refused by name.
|
|
729
|
+
*/
|
|
730
|
+
declare const readLoadedEnvFile: (file: string, cwd: string) => Promise<Readonly<Record<string, string>>>;
|
|
619
731
|
//#endregion
|
|
620
732
|
//#region src/HotUpdateDirUtil.d.ts
|
|
621
733
|
declare const HotUpdateDirUtil: {
|
|
@@ -680,7 +792,7 @@ type InitProviderDefinition<TInputs extends InitProviderInputsDefinition = InitP
|
|
|
680
792
|
readonly label: string;
|
|
681
793
|
/**
|
|
682
794
|
* The variables of the credentials the config init writes reads with
|
|
683
|
-
* `
|
|
795
|
+
* `secret()`, such as an API token. With a team `secrets` adapter, init
|
|
684
796
|
* stores them there with the app's API key, and reads one the
|
|
685
797
|
* environment and the env file lack from it.
|
|
686
798
|
*/
|
|
@@ -897,6 +1009,8 @@ declare const reactNativeCliFingerprint: (cwd: string, options: NativeFingerprin
|
|
|
897
1009
|
type HotUpdaterLogWriter = {
|
|
898
1010
|
logFilePath: string | null;
|
|
899
1011
|
writeStream: (input: Readable) => Promise<void>;
|
|
1012
|
+
/** Writes lines of its own, such as the command a build runs. */
|
|
1013
|
+
writeLines: (lines: readonly string[]) => void;
|
|
900
1014
|
writeError: (error: unknown) => void;
|
|
901
1015
|
close: () => Promise<void>;
|
|
902
1016
|
};
|
|
@@ -906,17 +1020,6 @@ declare const createLogWriter: ({ prefix, logFilePath }: {
|
|
|
906
1020
|
logFilePath?: string;
|
|
907
1021
|
}) => Promise<HotUpdaterLogWriter>;
|
|
908
1022
|
//#endregion
|
|
909
|
-
//#region src/localBundleSigning.d.ts
|
|
910
|
-
/** The secret `keys generate --secret` stores the private key as by default. */
|
|
911
|
-
declare const DEFAULT_SIGNING_KEY_SECRET = "bundle-signing-key";
|
|
912
|
-
/** Local signing enabled, with its private key from a file or a secret. */
|
|
913
|
-
type EnabledLocalSigningConfig = Extract<LocalSigningConfig, {
|
|
914
|
-
enabled: true;
|
|
915
|
-
}>;
|
|
916
|
-
declare const normalizeSigningConfig: (signing: SigningConfig | undefined, { secrets }?: {
|
|
917
|
-
readonly secrets?: SecretsAdapter;
|
|
918
|
-
}) => BundleSigningAdapter | EnabledLocalSigningConfig | undefined;
|
|
919
|
-
//#endregion
|
|
920
1023
|
//#region src/loadConfig.d.ts
|
|
921
1024
|
type HotUpdaterConfigOptions = {
|
|
922
1025
|
platform: Platform;
|
|
@@ -929,9 +1032,14 @@ type ConfigResponse = RequiredDeep<Omit<ConfigInput, "database" | "storage" | "p
|
|
|
929
1032
|
storage?: StorageAdapter;
|
|
930
1033
|
/** The plugins the server runs; none when the config lists none. */
|
|
931
1034
|
plugins: readonly AnyHotUpdaterPlugin[];
|
|
932
|
-
signing?: ReturnType<typeof normalizeSigningConfig>;
|
|
933
1035
|
/**
|
|
934
|
-
*
|
|
1036
|
+
* As the config sets it, read only when a command signs: deploy refuses a
|
|
1037
|
+
* value it doesn't take (`readBundleSigningState`), and other commands,
|
|
1038
|
+
* such as the `secrets put` that fixes it, still load the config.
|
|
1039
|
+
*/
|
|
1040
|
+
signing?: SigningConfig;
|
|
1041
|
+
/**
|
|
1042
|
+
* Where `secret()` references and issued keys are read and stored: the
|
|
935
1043
|
* config's adapter alone, or `localSecrets()` when it sets none
|
|
936
1044
|
* (`resolveSecretsAdapter`).
|
|
937
1045
|
*/
|
|
@@ -951,10 +1059,12 @@ declare const loadPlatformConfigs: <TPlatform extends Platform>(platforms: reado
|
|
|
951
1059
|
readonly config: ConfigResponse;
|
|
952
1060
|
}[]>;
|
|
953
1061
|
/**
|
|
954
|
-
* The names
|
|
955
|
-
*
|
|
1062
|
+
* The names the config's `secret()`s reference for its adapters, such as
|
|
1063
|
+
* `HOT_UPDATER_CLOUDFLARE_API_TOKEN`, in the order the config created
|
|
1064
|
+
* them: every name but those of build credentials, which `doctor` lists
|
|
1065
|
+
* by field.
|
|
956
1066
|
*/
|
|
957
|
-
declare const
|
|
1067
|
+
declare const getDeploySecretNames: (config: ConfigResponse) => readonly string[];
|
|
958
1068
|
//#endregion
|
|
959
1069
|
//#region src/serverDefinition.d.ts
|
|
960
1070
|
/** A plugin's endpoint on a server's `handlers.client`. */
|
|
@@ -2321,7 +2431,7 @@ declare const readPackageUp: <T = unknown>(cwd: string) => Promise<ReadPackageUp
|
|
|
2321
2431
|
* interpreter reads (`NODE_*` but `NODE_ENV`, `PATH`, `LD_*`, `DYLD_*`,
|
|
2322
2432
|
* `BASH_ENV`, `ENV`, `GIT_*`, `npm_config_*`, the JVM's, Gradle's, Ruby's,
|
|
2323
2433
|
* Python's, and Perl's options), or one Hot Updater reads its credentials
|
|
2324
|
-
* from. `
|
|
2434
|
+
* from. `secret()` refuses these names, and so does every environment the
|
|
2325
2435
|
* CLI gives a child process from resolved secrets.
|
|
2326
2436
|
*/
|
|
2327
2437
|
declare const isReservedVariableName: (name: string) => boolean;
|
|
@@ -2411,14 +2521,16 @@ declare const readLocalKey: (name: string, cwd: string) => Promise<string | unde
|
|
|
2411
2521
|
declare const writeLocalKey: (name: string, value: string, cwd: string) => Promise<string>;
|
|
2412
2522
|
//#endregion
|
|
2413
2523
|
//#region src/secrets.d.ts
|
|
2414
|
-
/** Whether `name` is a secret's name, as `secret
|
|
2524
|
+
/** Whether `name` is a secret's name, as `secret("<name>")` takes one. */
|
|
2415
2525
|
declare const isSecretName: (name: string) => boolean;
|
|
2526
|
+
/** Whether `value` is a `secret("<name>")` reference. */
|
|
2527
|
+
declare const isSecretRef: (value: unknown) => value is SecretRef;
|
|
2416
2528
|
/**
|
|
2417
|
-
* The secret name a config's `secret
|
|
2418
|
-
* `release-keystore` for `"
|
|
2419
|
-
* field
|
|
2529
|
+
* The secret name a config's `secret("<name>")` names, such as
|
|
2530
|
+
* `release-keystore` for `secret("release-keystore")`. `field` is the
|
|
2531
|
+
* config field it is in, which the error names.
|
|
2420
2532
|
*/
|
|
2421
|
-
declare const parseSecretReference: (reference:
|
|
2533
|
+
declare const parseSecretReference: (reference: unknown, field: string) => string;
|
|
2422
2534
|
/**
|
|
2423
2535
|
* The environment variable the default store reads a secret from: a name
|
|
2424
2536
|
* that is a variable name already, such as `CLOUDFLARE_API_TOKEN`, as it
|
|
@@ -2470,8 +2582,8 @@ declare const resolveSecretsAdapter: (configured?: SecretsAdapter) => SecretsAda
|
|
|
2470
2582
|
declare const getLocalSecretsStore: (secrets: SecretsAdapter) => LocalSecretsStore | undefined;
|
|
2471
2583
|
/**
|
|
2472
2584
|
* The config's own `secrets` adapter: undefined for `localSecrets()`,
|
|
2473
|
-
* which is the adapter when the config sets none. `
|
|
2474
|
-
*
|
|
2585
|
+
* which is the adapter when the config sets none. A called `secret()` reads
|
|
2586
|
+
* from it.
|
|
2475
2587
|
*/
|
|
2476
2588
|
declare const getConfiguredAdapter: (secrets: SecretsAdapter) => SecretsAdapter | undefined;
|
|
2477
2589
|
/**
|
|
@@ -2496,23 +2608,30 @@ declare const readSecretWithSource: (secrets: SecretsAdapter, name: string, cwd:
|
|
|
2496
2608
|
declare const keepsKeysOnThisMachine: (secrets: SecretsAdapter) => boolean;
|
|
2497
2609
|
/**
|
|
2498
2610
|
* The `secrets` adapter of one config load, filled once the config it
|
|
2499
|
-
* evaluates resolves: each `
|
|
2500
|
-
* and adds
|
|
2611
|
+
* evaluates resolves: each `secret()` the evaluation creates reads from it,
|
|
2612
|
+
* and adds its name to `names`.
|
|
2501
2613
|
*/
|
|
2502
2614
|
interface SecretsScope {
|
|
2503
2615
|
secrets?: SecretsAdapter;
|
|
2504
2616
|
names?: Set<string>;
|
|
2617
|
+
/**
|
|
2618
|
+
* The names build credentials reference, such as `signing.keystore`'s,
|
|
2619
|
+
* which the CLI reads for their kind: the batched read leaves them out.
|
|
2620
|
+
*/
|
|
2621
|
+
buildNames?: Set<string>;
|
|
2622
|
+
/** The one read of the scope's other names, once a `secret()` is called. */
|
|
2623
|
+
read?: Promise<Readonly<Record<string, string | undefined>>>;
|
|
2505
2624
|
}
|
|
2506
2625
|
/**
|
|
2507
2626
|
* Evaluates a config, the file or a config function, with `scope` as the
|
|
2508
|
-
* scope of every `
|
|
2627
|
+
* scope of every `secret()` it creates, so each reads the `secrets` of the
|
|
2509
2628
|
* config that created it, whatever config loads after. It is kept on
|
|
2510
2629
|
* `globalThis`: the config file loads its own copy of Hot Updater's modules.
|
|
2511
2630
|
*/
|
|
2512
2631
|
declare const withSecretsScope: <T>(scope: SecretsScope, evaluate: () => Promise<T> | T) => Promise<T>;
|
|
2513
2632
|
/**
|
|
2514
2633
|
* Makes `secrets` the adapter a credential resolver reads from by default,
|
|
2515
|
-
* and a `
|
|
2634
|
+
* and a `secret()` created outside any config load, as `loadConfig` does
|
|
2516
2635
|
* with the config's. It is kept on `globalThis`: the config file loads Hot
|
|
2517
2636
|
* Updater's modules again, as its own copies.
|
|
2518
2637
|
*/
|
|
@@ -2522,32 +2641,105 @@ declare const setConfiguredSecrets: (secrets: SecretsAdapter) => void;
|
|
|
2522
2641
|
* until a config loads.
|
|
2523
2642
|
*/
|
|
2524
2643
|
declare const getConfiguredSecrets: () => SecretsAdapter;
|
|
2644
|
+
/**
|
|
2645
|
+
* `names` from `secrets` in one `get`. A read that fails names the secrets
|
|
2646
|
+
* and the adapter, with the adapter's own error on the next line, such as
|
|
2647
|
+
* `EACCES: permission denied, open '<file>'`.
|
|
2648
|
+
*/
|
|
2649
|
+
declare const readSecrets: (secrets: SecretsAdapter, names: readonly string[], cwd: string) => Promise<Readonly<Record<string, string | undefined>>>;
|
|
2525
2650
|
/** Where an adapter keeps `name`, for messages. */
|
|
2526
2651
|
declare const describeSecret: (secrets: SecretsAdapter, name: string) => string;
|
|
2527
2652
|
/**
|
|
2528
|
-
*
|
|
2529
|
-
*
|
|
2530
|
-
*
|
|
2531
|
-
*
|
|
2532
|
-
*
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2653
|
+
* `secret("<name>")`: the secret `name` in `hot-updater.config.ts`, for a
|
|
2654
|
+
* build credential, such as `signing.keystore`, or any adapter credential,
|
|
2655
|
+
* which calls it on first use, so loading the config reads no secret.
|
|
2656
|
+
* Called, it reads `name`'s variable (`secretVariableName`) in the
|
|
2657
|
+
* environment or `.env.hotupdater`, else the config's `secrets` adapter:
|
|
2658
|
+
* the first call reads every name the config's `secret()`s reference and
|
|
2659
|
+
* the environment doesn't set, in one `get`. With `localSecrets()`, the
|
|
2660
|
+
* variable must be set: its files hold only the keys Hot Updater stores.
|
|
2661
|
+
* Values are masked in the CLI's logs and never set in `process.env`.
|
|
2662
|
+
* Names a loader or interpreter reads, such as `NODE_OPTIONS`, are refused.
|
|
2663
|
+
* A server passes its own environment's values instead.
|
|
2535
2664
|
*
|
|
2536
2665
|
* @example
|
|
2537
|
-
*
|
|
2538
|
-
* s3Storage({
|
|
2666
|
+
* r2Storage({
|
|
2539
2667
|
* bucketName: "bundles",
|
|
2540
|
-
*
|
|
2541
|
-
* credentials:
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
* accessKeyId: env.S3_ACCESS_KEY_ID,
|
|
2545
|
-
* secretAccessKey: env.S3_SECRET_ACCESS_KEY,
|
|
2546
|
-
* };
|
|
2668
|
+
* accountId: "<account-id>",
|
|
2669
|
+
* credentials: {
|
|
2670
|
+
* accessKeyId: secret("HOT_UPDATER_CLOUDFLARE_R2_ACCESS_KEY_ID"),
|
|
2671
|
+
* secretAccessKey: secret("HOT_UPDATER_CLOUDFLARE_R2_SECRET_ACCESS_KEY"),
|
|
2547
2672
|
* },
|
|
2548
2673
|
* });
|
|
2549
2674
|
*/
|
|
2550
|
-
declare const
|
|
2675
|
+
declare const secret: (name: string) => SecretRef;
|
|
2676
|
+
//#endregion
|
|
2677
|
+
//#region src/step.d.ts
|
|
2678
|
+
type Output = Writable & {
|
|
2679
|
+
isTTY?: boolean;
|
|
2680
|
+
columns?: number;
|
|
2681
|
+
};
|
|
2682
|
+
/** `4.2s`, `38s`, `6m41s`, `1h02m`. */
|
|
2683
|
+
declare const formatDuration: (ms: number) => string;
|
|
2684
|
+
/**
|
|
2685
|
+
* `message` with `duration` at the right edge of a step's line, the message
|
|
2686
|
+
* cut with `…` when the line would be wider.
|
|
2687
|
+
*/
|
|
2688
|
+
declare const withDuration: (message: string, ms: number, width?: number) => string;
|
|
2689
|
+
/** `text` cut to `width` visible columns, with `…` for the rest. */
|
|
2690
|
+
declare const truncateLine: (text: string, width: number) => string;
|
|
2691
|
+
/** How a finished step's line is marked. */
|
|
2692
|
+
type StepLevel = "step" | "info" | "warn";
|
|
2693
|
+
/**
|
|
2694
|
+
* A step of a command that takes a while, shown as one line: at a terminal,
|
|
2695
|
+
* a spinner whose line shows the step's current detail and its elapsed
|
|
2696
|
+
* time, which ends as the step's line with its duration; elsewhere, such as
|
|
2697
|
+
* in CI, only that last line.
|
|
2698
|
+
*
|
|
2699
|
+
* While it runs, what other code prints through `p` is held: a spinner's
|
|
2700
|
+
* messages become the step's detail, and logs print after the step's line,
|
|
2701
|
+
* but an error ends the step as failed first and prints at once, since the
|
|
2702
|
+
* process may exit right after it.
|
|
2703
|
+
*/
|
|
2704
|
+
interface Step {
|
|
2705
|
+
/** Starts the step, once: nothing shows before. */
|
|
2706
|
+
start(): Step;
|
|
2707
|
+
/** Shows `detail` after the title on the live line, or the title alone. */
|
|
2708
|
+
update(detail?: string): void;
|
|
2709
|
+
/**
|
|
2710
|
+
* Ends the step with `message`, the title by default, and its duration,
|
|
2711
|
+
* marked as a finished step or with `level`.
|
|
2712
|
+
*/
|
|
2713
|
+
succeed(message?: string, options?: {
|
|
2714
|
+
level?: StepLevel;
|
|
2715
|
+
}): void;
|
|
2716
|
+
/** Ends the step as failed, with `message` or `<title> failed`. */
|
|
2717
|
+
fail(message?: string): void;
|
|
2718
|
+
/** Milliseconds since it started, or 0 before. */
|
|
2719
|
+
readonly elapsedMs: number;
|
|
2720
|
+
/** Whether it started and has not ended. */
|
|
2721
|
+
readonly active: boolean;
|
|
2722
|
+
}
|
|
2723
|
+
interface StepOptions {
|
|
2724
|
+
output?: Output;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* A step that shows nothing until `start()`. A step created while another
|
|
2728
|
+
* runs is part of it: its title and detail become the running step's detail.
|
|
2729
|
+
*/
|
|
2730
|
+
declare const createStep: (title: string, { output }?: StepOptions) => Step;
|
|
2731
|
+
/**
|
|
2732
|
+
* Ends the running step as failed, if one runs, before a command prints
|
|
2733
|
+
* its error.
|
|
2734
|
+
*/
|
|
2735
|
+
declare const failActiveStep: () => void;
|
|
2736
|
+
/** A step, started. */
|
|
2737
|
+
declare const startStep: (title: string, options?: StepOptions) => Step;
|
|
2738
|
+
/**
|
|
2739
|
+
* Runs `run` as a step titled `title`, which ends with `done(result)`, or as
|
|
2740
|
+
* failed when `run` throws.
|
|
2741
|
+
*/
|
|
2742
|
+
declare const withStep: <T>(title: string, run: (step: Step) => Promise<T>, done?: (result: T) => string, options?: StepOptions) => Promise<T>;
|
|
2551
2743
|
//#endregion
|
|
2552
2744
|
//#region src/teamSecrets.d.ts
|
|
2553
2745
|
/**
|
|
@@ -2574,12 +2766,15 @@ declare const readMissingFromTeamSecrets: (secrets: SecretsAdapter, names: reado
|
|
|
2574
2766
|
readonly cwd: string;
|
|
2575
2767
|
}) => Promise<Readonly<Record<string, string>>>;
|
|
2576
2768
|
/**
|
|
2577
|
-
* Stores each of `names` that `.env.hotupdater`
|
|
2578
|
-
* then reads them back in one call.
|
|
2769
|
+
* Stores each of `names` that `envFile`, `.env.hotupdater` by default,
|
|
2770
|
+
* holds through `secrets`, then reads them back in one call. Only the file
|
|
2771
|
+
* is read, never the environment. The file is left as it is. Returns the
|
|
2579
2772
|
* names stored, in the order of `names`; throws when the adapter reads
|
|
2580
2773
|
* back another value.
|
|
2581
2774
|
*/
|
|
2582
|
-
declare const storeEnvFileSecrets: (secrets: SecretsAdapter, names: readonly string[], cwd: string
|
|
2775
|
+
declare const storeEnvFileSecrets: (secrets: SecretsAdapter, names: readonly string[], cwd: string,
|
|
2776
|
+
/** An env file to read instead of `.env.hotupdater`, relative to `cwd`. */
|
|
2777
|
+
envFile?: string) => Promise<readonly string[]>;
|
|
2583
2778
|
//#endregion
|
|
2584
2779
|
//#region src/storageFiles.d.ts
|
|
2585
2780
|
declare const getStorageFileByteSize: (filePath: string) => Promise<number>;
|
|
@@ -2604,4 +2799,4 @@ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]
|
|
|
2604
2799
|
*/
|
|
2605
2800
|
declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
|
|
2606
2801
|
//#endregion
|
|
2607
|
-
export { AppClientCredential, AppClientPlugin, AssembleServerOptions, AssembledServer, BuildFailedError, BuildFailureSummaryConfig, BuildLogger, BuildLoggerConfig, BuildType, BundleSigningSession, CREDENTIAL_ENV_NAMES, CREDENTIAL_LOGIN_GROUPS, ClientAuthSpec, ClientCredentialSpec, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateCredentialResolverOptions, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, type CredentialFiles, CredentialKind, CredentialRequest, CredentialResolver, CredentialUnavailableError, Credentials,
|
|
2802
|
+
export { AddSigningSecretResult, AppClientCredential, AppClientPlugin, AssembleServerOptions, AssembledServer, BUNDLE_SIGNING_KEY_SECRET, BuildFailedError, BuildFailureSummaryConfig, BuildLogger, BuildLoggerConfig, BuildPhaseReader, BuildType, BundleSigningKeyError, BundleSigningOptions, BundleSigningSession, BundleSigningState, CREDENTIAL_ENV_NAMES, CREDENTIAL_LOGIN_GROUPS, ClientAuthSpec, ClientCredentialSpec, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateCredentialResolverOptions, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, type CredentialFiles, CredentialKind, CredentialRequest, CredentialResolver, CredentialUnavailableError, Credentials, FileCredentialKind, HOT_UPDATER_HOME_ENV, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, HotUpdaterConfigOptions, HotUpdaterConfigScaffold, HotUpdaterInitEnv, HotUpdaterLogWriter, INTERFACE_FINGERPRINT_ENGINE, INVALID_SIGNING_MESSAGE, INVALID_SIGNING_NEXT_STEP, ISSUE_SIGNING_KEY_COMMAND, ImportInfo, InitEnvFileError, InitError, InitProviderDefinition, InitProviderInputDefinition, InitProviderInputPersistence, IssuedCredentialKind, LOCAL_SECRETS_NAME, LegacyInfrastructureError, LocalSecretsOptions, LocalSecretsStore, MANAGED_CLIENT_CREDENTIAL_ENV, ManagedHelperStatement, ManagedHelperStrategy, MissingInitInputsError, NativeDependency, NativeInterface, PUT_SIGNING_KEY_COMMAND, PromptProgress, PromptSpinner, ProviderConfig, ProvisionedClientCredential, ReactNativeMetadata, ReadPackageUpResult, RunInitOptions, SecretsScope, ServerClientEndpoint, ServerDefinition, ServerDefinitionError, Step, StepLevel, UNSIGNED_BUNDLES_NEXT_STEP, UNSIGNED_BUNDLES_WARNING, WriteHotUpdaterConfigResult, addSigningSecretToConfig, addSigningSecretToConfigText, assembleServer, assertInfrastructureGenerationAtUrl, assertInfrastructureGenerationPayload, assertInitInputs, assertInitProviderInputs, assertUnreservedEnv, autolinkingConfigCommand, banner, bundleSigningSecretRef, clientAuthOf, typedColors as colors, configSetsTeamSecrets, confirmInitInputPersistence, copyDirToTmp, createCredentialResolver, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createInterfaceFingerprint, createLocalSecretsStore, createLogWriter, createMigrator, createMinBundleId, createStep, createTarBrTargetFiles, createZip, credentialIssueCommand, credentialLoginCommand, credentialPutCommand, credentialStoreCommand, decryptJson, defineInitProvider, describeSecret, describeStoredSecret, encryptJson, ensureInstallPackages, failActiveStep, formatDuration, generateClientCredential, generateSchema, generatesSchema, getAndroidSdkPath, getBundleSigningPublicKey, getConfiguredAdapter, getConfiguredSecrets, getCwd, getDeploySecretNames, getHotUpdaterEnvValue, getHotUpdaterHome, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, getLocalKeyFile, getLocalKeyStoreDir, getLocalSecretsStore, getMissingInitInputs, getMissingInitProviderInputs, getPackageManager, getProjectKey, getReactNativeMetadatas, getStorageFileByteSize, isCI, isCodegenSpecFile, isReservedVariableName, isSecretName, isSecretRef, isServerDefinition, keepsKeysOnThisMachine, link, loadConfig, loadPlatformConfigs, loadTeamSecrets, localSecrets, log, makeEnv, maskSecretValues, moduleSpecifiersOf, nonInteractiveReason, p, parseLoadedEnv, parseSecretReference, prepareBundleSigning, printAppSetup, printBanner, provisionClientCredential, putStorageFile, reactNativeCliFingerprint, reactNativeConfigCommand, readBundleSigningPublicKeyFile, readBundleSigningState, readHotUpdaterInitEnv, readLoadedEnvFile, readLoadedHotUpdaterEnv, readLocalKey, readMissingFromTeamSecrets, readPackageUp, readReactNativeInterface, readSecretVariables, readSecretWithSource, readSecrets, registerCredentialValue, registerSecretValue, renderAppImports, renderAppSetup, renderImportStatements, resolveExpoAutolinking, resolveHotUpdaterServerVersion, resolveInitProviderInput, resolveInitProviderInputs, resolveLocalSecretsPath, resolvePackageVersion, resolveSecretsAdapter, secret, secretVariableName, serverDefinitionOf, setConfiguredSecrets, shouldAutoSelectOnlyInitResource, startStep, storeEnvFileSecrets, stripAnsi, transformEnv, transformTemplate, truncateLine, withCredentialResolver, withDuration, withSecretsScope, withStep, writeHotUpdaterConfig, writeHotUpdaterFiles, writeLocalKey };
|