@hot-updater/plugin-core 1.2.0-rc.2 → 1.2.0-rc.21

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.
@@ -3,10 +3,37 @@ import { AnyHotUpdaterPlugin } from "../serverPlugin/definePlugin.cjs";
3
3
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
4
4
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
5
5
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
6
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./models.cjs";
6
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./models.cjs";
7
7
  import "./public.cjs";
8
8
  import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/protocol";
9
9
  //#region src/types/index.d.ts
10
+ /**
11
+ * A value, or a function that returns it, called on first use: an
12
+ * adapter shared by servers and the CLI takes its credentials so, as a
13
+ * string from a server's own environment or as `secret("<name>")` from
14
+ * `hot-updater.config.ts`, which loads without reading a secret.
15
+ */
16
+ type Lazy<T> = T | (() => T | Promise<T>);
17
+ /** The value of a `Lazy`, calling its function. */
18
+ declare const resolveLazy: <T>(value: Lazy<T>) => Promise<T>;
19
+ /**
20
+ * The brand of a `SecretRef`, `Symbol.for("@hot-updater/secret-ref")` at
21
+ * runtime: `hot-updater`'s `secret()` sets it, and the CLI recognizes a
22
+ * reference by it, so a plain string or function is none.
23
+ */
24
+ declare const secretRefBrand: unique symbol;
25
+ /**
26
+ * `secret("<name>")` in `hot-updater.config.ts`: the secret the config's
27
+ * `secrets` adapter holds as `name`. Called, it reads the value, the
28
+ * environment first, so it is a `Lazy<string>` any adapter credential
29
+ * takes; the build credentials, such as `signing.keystore`, take only a
30
+ * reference, which the CLI resolves by `name` for its kind.
31
+ */
32
+ type SecretRef = (() => Promise<string>) & {
33
+ readonly [secretRefBrand]: true;
34
+ /** The secret's name in the config's `secrets` adapter. */
35
+ readonly name: string;
36
+ };
10
37
  interface BuildAdapterArgs {
11
38
  cwd: string;
12
39
  }
@@ -89,6 +116,11 @@ interface BuildAdapter {
89
116
  readonly appVersion?: string;
90
117
  /** The channel the native build would embed. */
91
118
  readonly channel?: string;
119
+ /**
120
+ * The trust-anchor file the prebuild embeds as the bundle signing
121
+ * public key, such as the Expo config plugin's `publicKeyPath`.
122
+ */
123
+ readonly publicKeyPath?: string;
92
124
  }>;
93
125
  prebuild?: (args: {
94
126
  platform: Platform;
@@ -144,16 +176,25 @@ interface NativeBuildAndroidScheme {
144
176
  applicationId?: string;
145
177
  /**
146
178
  * Signs a release variant with a keystore the CLI resolves: `keystore` is
147
- * `secret:<name>`, the `android-keystore` the config's `secrets` adapter
179
+ * `secret("<name>")`, the `android-keystore` the config's `secrets` adapter
148
180
  * holds as `<name>`, which the `HOT_UPDATER_ANDROID_KEYSTORE_*`
149
181
  * environment variables override. Debug variants keep the debug keystore
150
182
  * and resolve nothing. Without it, the variant's own `signingConfig` signs.
151
183
  *
152
- * @example { keystore: "secret:release-keystore" }
184
+ * @example { keystore: secret("release-keystore") }
153
185
  */
154
186
  signing?: {
155
- keystore: `secret:${string}`;
187
+ keystore: SecretRef;
156
188
  };
189
+ /**
190
+ * Builds the app with the sandbox native layer, for testing OTA bundles on
191
+ * a device, as a separate app: the application ID gets a `.sandbox` suffix.
192
+ * It registers on the reserved channel `sandbox-<scheme>`, and reaches
193
+ * Google Play's internal testing only. No other build compiles the layer.
194
+ *
195
+ * @default false
196
+ */
197
+ sandbox?: boolean;
157
198
  }
158
199
  type IosBuildDestination = {
159
200
  id: string;
@@ -241,17 +282,29 @@ interface NativeBuildIosScheme {
241
282
  simulator?: boolean;
242
283
  /**
243
284
  * Signs a device build with automatic signing, authenticated by an App
244
- * Store Connect API key the CLI resolves: `ascApiKey` is `secret:<name>`,
285
+ * Store Connect API key the CLI resolves: `ascApiKey` is `secret("<name>")`,
245
286
  * the `asc-api-key` the config's `secrets` adapter holds as `<name>`,
246
287
  * which the `HOT_UPDATER_ASC_KEY*` environment variables override.
247
288
  * Simulator builds resolve nothing. Without it, the project's signing
248
289
  * settings and Xcode's accounts sign.
249
290
  *
250
- * @example { ascApiKey: "secret:asc-api-key" }
291
+ * @example { ascApiKey: secret("asc-api-key") }
251
292
  */
252
293
  signing?: {
253
- ascApiKey: `secret:${string}`;
294
+ ascApiKey: SecretRef;
254
295
  };
296
+ /**
297
+ * Builds the app with the sandbox native layer, for testing OTA bundles on
298
+ * a device. It has the bundle identifier its Xcode configuration builds,
299
+ * which `bundleIdentifier` must name: the store app's by default, which it
300
+ * replaces on a device, or its own from a separate configuration. It
301
+ * registers on the reserved channel `sandbox-<scheme>`, and its `.ipa` is for
302
+ * TestFlight internal testing only, never App Store review. No other build
303
+ * compiles the layer.
304
+ *
305
+ * @default false
306
+ */
307
+ sandbox?: boolean;
255
308
  }
256
309
  interface PlatformConfig {
257
310
  /**
@@ -362,28 +415,6 @@ interface StorageAdapter {
362
415
  /** Deletes only the exact base-path-relative keys supplied by the caller. */
363
416
  readonly deleteObjects?: (keys: readonly string[]) => Promise<void>;
364
417
  }
365
- interface BundleSigningAdapter {
366
- readonly name: string;
367
- /** Returns the RSA public key used by this provider in SPKI PEM format. */
368
- readonly getPublicKey: (input?: {
369
- readonly cwd?: string;
370
- }) => Promise<{
371
- readonly publicKey: string;
372
- }>;
373
- /**
374
- * Signs `message` with RSA PKCS#1 v1.5 SHA-256.
375
- *
376
- * Hot Updater passes the 32 raw bytes decoded from a SHA-256 file hash.
377
- * Remote signing services must treat this value as the raw message, not as
378
- * an already-computed digest.
379
- */
380
- readonly sign: (input: {
381
- readonly message: Uint8Array;
382
- readonly cwd?: string;
383
- }) => Promise<{
384
- readonly signature: Uint8Array;
385
- }>;
386
- }
387
418
  /**
388
419
  * What a secrets adapter is given with each call. It carries no secret: an
389
420
  * adapter reads its own credentials, such as a token or a CLI sign-in.
@@ -393,11 +424,12 @@ interface SecretsContext {
393
424
  readonly cwd: string;
394
425
  }
395
426
  /**
396
- * Where the CLI reads secrets by name: the build credentials `secret:<name>`
397
- * references, and the deploy credentials `secretEnv([...])` names. Values
427
+ * Where the CLI reads the secrets `secret("<name>")` names in a config: build
428
+ * credentials, such as a keystore, and adapter credentials. Values
398
429
  * are strings: binary is base64, and a credential with several fields is one
399
430
  * JSON value per name. `localSecrets()`, an export of `hot-updater`, keeps them
400
- * in files on this machine; a store of your own implements this.
431
+ * in files on this machine, and `infisical()`, another, in an Infisical
432
+ * project; a store of your own implements this.
401
433
  */
402
434
  interface SecretsAdapter {
403
435
  readonly name: string;
@@ -408,10 +440,11 @@ interface SecretsAdapter {
408
440
  */
409
441
  readonly get: (names: readonly string[], context: SecretsContext) => Promise<Readonly<Record<string, string | undefined>>>;
410
442
  /**
411
- * Stores `value` as `name`, replacing what it held. Absent when the store
412
- * is read-only to Hot Updater.
443
+ * Stores `value` as `name`, replacing what it held. Every adapter stores:
444
+ * the CLI keeps the keys it issues and imports here, and nowhere else. A
445
+ * write the store refuses, such as with a read-only token, throws.
413
446
  */
414
- readonly set?: (name: string, value: string, context: SecretsContext) => Promise<void>;
447
+ readonly set: (name: string, value: string, context: SecretsContext) => Promise<void>;
415
448
  /** Where the user finds `name` in the store, such as a URL or a path, for messages. */
416
449
  readonly describe?: (name: string) => string;
417
450
  }
@@ -427,22 +460,27 @@ type LocalSigningConfig = {
427
460
  } | {
428
461
  readonly enabled: true;
429
462
  /**
430
- * `secret:<name>`, the RSA private key in PEM format that the config's
431
- * `secrets` adapter holds as `<name>`. The CLI reads it once per run,
432
- * when it first signs or derives the public key, and keeps it in
433
- * memory only.
463
+ * `secret("<name>")`, the RSA private key in PEM format that the
464
+ * config's `secrets` adapter holds as `<name>`. The CLI reads it once
465
+ * per run, when it first signs or derives the public key, and keeps it
466
+ * in memory only.
434
467
  *
435
- * @example { enabled: true, privateKey: "secret:bundle-signing-key" }
468
+ * @example { enabled: true, privateKey: secret("bundle-signing-key") }
436
469
  */
437
- readonly privateKey: `secret:${string}`;
470
+ readonly privateKey: SecretRef;
438
471
  readonly privateKeyPath?: never;
439
472
  } | {
440
473
  readonly enabled: false;
441
474
  readonly privateKeyPath?: string;
442
- readonly privateKey?: `secret:${string}`;
475
+ readonly privateKey?: SecretRef;
443
476
  };
444
- /** Local config or signing adapter. Signing is disabled when omitted. */
445
- type SigningConfig = BundleSigningAdapter | LocalSigningConfig;
477
+ /**
478
+ * Bundle signing with an RSA private key in PEM. `secret("<name>")` is the
479
+ * shorthand of `{ enabled: true, privateKey: secret("<name>") }`. Without
480
+ * `signing`, bundles are unsigned and deploy warns; `enabled: false` turns
481
+ * signing off without the warning.
482
+ */
483
+ type SigningConfig = SecretRef | LocalSigningConfig;
446
484
  /**
447
485
  * Extra fingerprint sources.
448
486
  *
@@ -470,6 +508,9 @@ type ConfigInput = {
470
508
  * If `appVersion`, the bundle will be updated if the target app version is valid.
471
509
  * @docs https://hot-updater.dev/docs/guides/update-strategies/app-version
472
510
  *
511
+ * `hot-updater init` writes `fingerprint` for a new project; a config that
512
+ * sets none keeps `appVersion`, so upgrading never retargets shipped apps.
513
+ *
473
514
  * @default "appVersion"
474
515
  */
475
516
  updateStrategy: "fingerprint" | "appVersion";
@@ -503,7 +544,8 @@ type ConfigInput = {
503
544
  */
504
545
  nativeVersion?: string | number;
505
546
  /**
506
- * When debug mode is enabled, more detailed information will be exposed in fingerprint.json.
547
+ * Passed to the build adapter's fingerprint, which may use it for its own
548
+ * diagnostics. fingerprint.json never records them.
507
549
  */
508
550
  debug?: boolean;
509
551
  };
@@ -546,26 +588,23 @@ type ConfigInput = {
546
588
  platform?: PlatformConfig;
547
589
  nativeBuild?: NativeBuildArgs;
548
590
  /**
549
- * Code signing configuration for bundle verification.
550
- * Enables RSA-SHA256 cryptographic signatures for bundle integrity.
551
- *
552
- * @optional Feature is opt-in.
591
+ * Signs each bundle with RSA-SHA256, which the app verifies with the
592
+ * public key it embeds. `secret("bundle-signing-key")` reads the RSA
593
+ * private key in PEM from the config's `secrets` adapter; the object
594
+ * forms take it from a secret (`privateKey`) or a file
595
+ * (`privateKeyPath`). Without `signing`, bundles are unsigned and deploy
596
+ * warns; `{ enabled: false }` turns signing off without the warning.
553
597
  *
554
598
  * @example
555
599
  * ```ts
556
- * signing: {
557
- * enabled: true,
558
- * privateKey: "secret:bundle-signing-key",
559
- * }
600
+ * signing: secret("bundle-signing-key"),
560
601
  * ```
561
602
  */
562
603
  signing?: SigningConfig;
563
604
  /**
564
- * Where the CLI reads the secrets the config names: `secret:<name>` build
565
- * credentials and `secretEnv([...])` deploy credentials. Builds read a
566
- * credential this adapter does not hold from `localSecrets()`'s store,
567
- * `~/.hot-updater/secrets/<project-key>/<name>.json`, where keys Hot Updater
568
- * issues go when the adapter stores nothing.
605
+ * Where the CLI reads the secrets the config names with `secret("<name>")`,
606
+ * after the environment, and stores the keys it issues. It is the only
607
+ * store: nothing is kept on this machine under it.
569
608
  *
570
609
  * @default localSecrets()
571
610
  */
@@ -592,4 +631,4 @@ interface NativeBuildOptions {
592
631
  scheme?: string;
593
632
  }
594
633
  //#endregion
595
- export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, BundleSigningAdapter, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, NativeBuildOptions, type NativeBuildRow, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, supportedIosPlatforms };
634
+ export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, Lazy, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRow, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, resolveLazy, supportedIosPlatforms };
@@ -3,10 +3,37 @@ import { AnyHotUpdaterPlugin } from "../serverPlugin/definePlugin.mjs";
3
3
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
4
4
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.mjs";
5
5
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
6
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./models.mjs";
6
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./models.mjs";
7
7
  import "./public.mjs";
8
8
  import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/protocol";
9
9
  //#region src/types/index.d.ts
10
+ /**
11
+ * A value, or a function that returns it, called on first use: an
12
+ * adapter shared by servers and the CLI takes its credentials so, as a
13
+ * string from a server's own environment or as `secret("<name>")` from
14
+ * `hot-updater.config.ts`, which loads without reading a secret.
15
+ */
16
+ type Lazy<T> = T | (() => T | Promise<T>);
17
+ /** The value of a `Lazy`, calling its function. */
18
+ declare const resolveLazy: <T>(value: Lazy<T>) => Promise<T>;
19
+ /**
20
+ * The brand of a `SecretRef`, `Symbol.for("@hot-updater/secret-ref")` at
21
+ * runtime: `hot-updater`'s `secret()` sets it, and the CLI recognizes a
22
+ * reference by it, so a plain string or function is none.
23
+ */
24
+ declare const secretRefBrand: unique symbol;
25
+ /**
26
+ * `secret("<name>")` in `hot-updater.config.ts`: the secret the config's
27
+ * `secrets` adapter holds as `name`. Called, it reads the value, the
28
+ * environment first, so it is a `Lazy<string>` any adapter credential
29
+ * takes; the build credentials, such as `signing.keystore`, take only a
30
+ * reference, which the CLI resolves by `name` for its kind.
31
+ */
32
+ type SecretRef = (() => Promise<string>) & {
33
+ readonly [secretRefBrand]: true;
34
+ /** The secret's name in the config's `secrets` adapter. */
35
+ readonly name: string;
36
+ };
10
37
  interface BuildAdapterArgs {
11
38
  cwd: string;
12
39
  }
@@ -89,6 +116,11 @@ interface BuildAdapter {
89
116
  readonly appVersion?: string;
90
117
  /** The channel the native build would embed. */
91
118
  readonly channel?: string;
119
+ /**
120
+ * The trust-anchor file the prebuild embeds as the bundle signing
121
+ * public key, such as the Expo config plugin's `publicKeyPath`.
122
+ */
123
+ readonly publicKeyPath?: string;
92
124
  }>;
93
125
  prebuild?: (args: {
94
126
  platform: Platform;
@@ -144,16 +176,25 @@ interface NativeBuildAndroidScheme {
144
176
  applicationId?: string;
145
177
  /**
146
178
  * Signs a release variant with a keystore the CLI resolves: `keystore` is
147
- * `secret:<name>`, the `android-keystore` the config's `secrets` adapter
179
+ * `secret("<name>")`, the `android-keystore` the config's `secrets` adapter
148
180
  * holds as `<name>`, which the `HOT_UPDATER_ANDROID_KEYSTORE_*`
149
181
  * environment variables override. Debug variants keep the debug keystore
150
182
  * and resolve nothing. Without it, the variant's own `signingConfig` signs.
151
183
  *
152
- * @example { keystore: "secret:release-keystore" }
184
+ * @example { keystore: secret("release-keystore") }
153
185
  */
154
186
  signing?: {
155
- keystore: `secret:${string}`;
187
+ keystore: SecretRef;
156
188
  };
189
+ /**
190
+ * Builds the app with the sandbox native layer, for testing OTA bundles on
191
+ * a device, as a separate app: the application ID gets a `.sandbox` suffix.
192
+ * It registers on the reserved channel `sandbox-<scheme>`, and reaches
193
+ * Google Play's internal testing only. No other build compiles the layer.
194
+ *
195
+ * @default false
196
+ */
197
+ sandbox?: boolean;
157
198
  }
158
199
  type IosBuildDestination = {
159
200
  id: string;
@@ -241,17 +282,29 @@ interface NativeBuildIosScheme {
241
282
  simulator?: boolean;
242
283
  /**
243
284
  * Signs a device build with automatic signing, authenticated by an App
244
- * Store Connect API key the CLI resolves: `ascApiKey` is `secret:<name>`,
285
+ * Store Connect API key the CLI resolves: `ascApiKey` is `secret("<name>")`,
245
286
  * the `asc-api-key` the config's `secrets` adapter holds as `<name>`,
246
287
  * which the `HOT_UPDATER_ASC_KEY*` environment variables override.
247
288
  * Simulator builds resolve nothing. Without it, the project's signing
248
289
  * settings and Xcode's accounts sign.
249
290
  *
250
- * @example { ascApiKey: "secret:asc-api-key" }
291
+ * @example { ascApiKey: secret("asc-api-key") }
251
292
  */
252
293
  signing?: {
253
- ascApiKey: `secret:${string}`;
294
+ ascApiKey: SecretRef;
254
295
  };
296
+ /**
297
+ * Builds the app with the sandbox native layer, for testing OTA bundles on
298
+ * a device. It has the bundle identifier its Xcode configuration builds,
299
+ * which `bundleIdentifier` must name: the store app's by default, which it
300
+ * replaces on a device, or its own from a separate configuration. It
301
+ * registers on the reserved channel `sandbox-<scheme>`, and its `.ipa` is for
302
+ * TestFlight internal testing only, never App Store review. No other build
303
+ * compiles the layer.
304
+ *
305
+ * @default false
306
+ */
307
+ sandbox?: boolean;
255
308
  }
256
309
  interface PlatformConfig {
257
310
  /**
@@ -362,28 +415,6 @@ interface StorageAdapter {
362
415
  /** Deletes only the exact base-path-relative keys supplied by the caller. */
363
416
  readonly deleteObjects?: (keys: readonly string[]) => Promise<void>;
364
417
  }
365
- interface BundleSigningAdapter {
366
- readonly name: string;
367
- /** Returns the RSA public key used by this provider in SPKI PEM format. */
368
- readonly getPublicKey: (input?: {
369
- readonly cwd?: string;
370
- }) => Promise<{
371
- readonly publicKey: string;
372
- }>;
373
- /**
374
- * Signs `message` with RSA PKCS#1 v1.5 SHA-256.
375
- *
376
- * Hot Updater passes the 32 raw bytes decoded from a SHA-256 file hash.
377
- * Remote signing services must treat this value as the raw message, not as
378
- * an already-computed digest.
379
- */
380
- readonly sign: (input: {
381
- readonly message: Uint8Array;
382
- readonly cwd?: string;
383
- }) => Promise<{
384
- readonly signature: Uint8Array;
385
- }>;
386
- }
387
418
  /**
388
419
  * What a secrets adapter is given with each call. It carries no secret: an
389
420
  * adapter reads its own credentials, such as a token or a CLI sign-in.
@@ -393,11 +424,12 @@ interface SecretsContext {
393
424
  readonly cwd: string;
394
425
  }
395
426
  /**
396
- * Where the CLI reads secrets by name: the build credentials `secret:<name>`
397
- * references, and the deploy credentials `secretEnv([...])` names. Values
427
+ * Where the CLI reads the secrets `secret("<name>")` names in a config: build
428
+ * credentials, such as a keystore, and adapter credentials. Values
398
429
  * are strings: binary is base64, and a credential with several fields is one
399
430
  * JSON value per name. `localSecrets()`, an export of `hot-updater`, keeps them
400
- * in files on this machine; a store of your own implements this.
431
+ * in files on this machine, and `infisical()`, another, in an Infisical
432
+ * project; a store of your own implements this.
401
433
  */
402
434
  interface SecretsAdapter {
403
435
  readonly name: string;
@@ -408,10 +440,11 @@ interface SecretsAdapter {
408
440
  */
409
441
  readonly get: (names: readonly string[], context: SecretsContext) => Promise<Readonly<Record<string, string | undefined>>>;
410
442
  /**
411
- * Stores `value` as `name`, replacing what it held. Absent when the store
412
- * is read-only to Hot Updater.
443
+ * Stores `value` as `name`, replacing what it held. Every adapter stores:
444
+ * the CLI keeps the keys it issues and imports here, and nowhere else. A
445
+ * write the store refuses, such as with a read-only token, throws.
413
446
  */
414
- readonly set?: (name: string, value: string, context: SecretsContext) => Promise<void>;
447
+ readonly set: (name: string, value: string, context: SecretsContext) => Promise<void>;
415
448
  /** Where the user finds `name` in the store, such as a URL or a path, for messages. */
416
449
  readonly describe?: (name: string) => string;
417
450
  }
@@ -427,22 +460,27 @@ type LocalSigningConfig = {
427
460
  } | {
428
461
  readonly enabled: true;
429
462
  /**
430
- * `secret:<name>`, the RSA private key in PEM format that the config's
431
- * `secrets` adapter holds as `<name>`. The CLI reads it once per run,
432
- * when it first signs or derives the public key, and keeps it in
433
- * memory only.
463
+ * `secret("<name>")`, the RSA private key in PEM format that the
464
+ * config's `secrets` adapter holds as `<name>`. The CLI reads it once
465
+ * per run, when it first signs or derives the public key, and keeps it
466
+ * in memory only.
434
467
  *
435
- * @example { enabled: true, privateKey: "secret:bundle-signing-key" }
468
+ * @example { enabled: true, privateKey: secret("bundle-signing-key") }
436
469
  */
437
- readonly privateKey: `secret:${string}`;
470
+ readonly privateKey: SecretRef;
438
471
  readonly privateKeyPath?: never;
439
472
  } | {
440
473
  readonly enabled: false;
441
474
  readonly privateKeyPath?: string;
442
- readonly privateKey?: `secret:${string}`;
475
+ readonly privateKey?: SecretRef;
443
476
  };
444
- /** Local config or signing adapter. Signing is disabled when omitted. */
445
- type SigningConfig = BundleSigningAdapter | LocalSigningConfig;
477
+ /**
478
+ * Bundle signing with an RSA private key in PEM. `secret("<name>")` is the
479
+ * shorthand of `{ enabled: true, privateKey: secret("<name>") }`. Without
480
+ * `signing`, bundles are unsigned and deploy warns; `enabled: false` turns
481
+ * signing off without the warning.
482
+ */
483
+ type SigningConfig = SecretRef | LocalSigningConfig;
446
484
  /**
447
485
  * Extra fingerprint sources.
448
486
  *
@@ -470,6 +508,9 @@ type ConfigInput = {
470
508
  * If `appVersion`, the bundle will be updated if the target app version is valid.
471
509
  * @docs https://hot-updater.dev/docs/guides/update-strategies/app-version
472
510
  *
511
+ * `hot-updater init` writes `fingerprint` for a new project; a config that
512
+ * sets none keeps `appVersion`, so upgrading never retargets shipped apps.
513
+ *
473
514
  * @default "appVersion"
474
515
  */
475
516
  updateStrategy: "fingerprint" | "appVersion";
@@ -503,7 +544,8 @@ type ConfigInput = {
503
544
  */
504
545
  nativeVersion?: string | number;
505
546
  /**
506
- * When debug mode is enabled, more detailed information will be exposed in fingerprint.json.
547
+ * Passed to the build adapter's fingerprint, which may use it for its own
548
+ * diagnostics. fingerprint.json never records them.
507
549
  */
508
550
  debug?: boolean;
509
551
  };
@@ -546,26 +588,23 @@ type ConfigInput = {
546
588
  platform?: PlatformConfig;
547
589
  nativeBuild?: NativeBuildArgs;
548
590
  /**
549
- * Code signing configuration for bundle verification.
550
- * Enables RSA-SHA256 cryptographic signatures for bundle integrity.
551
- *
552
- * @optional Feature is opt-in.
591
+ * Signs each bundle with RSA-SHA256, which the app verifies with the
592
+ * public key it embeds. `secret("bundle-signing-key")` reads the RSA
593
+ * private key in PEM from the config's `secrets` adapter; the object
594
+ * forms take it from a secret (`privateKey`) or a file
595
+ * (`privateKeyPath`). Without `signing`, bundles are unsigned and deploy
596
+ * warns; `{ enabled: false }` turns signing off without the warning.
553
597
  *
554
598
  * @example
555
599
  * ```ts
556
- * signing: {
557
- * enabled: true,
558
- * privateKey: "secret:bundle-signing-key",
559
- * }
600
+ * signing: secret("bundle-signing-key"),
560
601
  * ```
561
602
  */
562
603
  signing?: SigningConfig;
563
604
  /**
564
- * Where the CLI reads the secrets the config names: `secret:<name>` build
565
- * credentials and `secretEnv([...])` deploy credentials. Builds read a
566
- * credential this adapter does not hold from `localSecrets()`'s store,
567
- * `~/.hot-updater/secrets/<project-key>/<name>.json`, where keys Hot Updater
568
- * issues go when the adapter stores nothing.
605
+ * Where the CLI reads the secrets the config names with `secret("<name>")`,
606
+ * after the environment, and stores the keys it issues. It is the only
607
+ * store: nothing is kept on this machine under it.
569
608
  *
570
609
  * @default localSecrets()
571
610
  */
@@ -592,4 +631,4 @@ interface NativeBuildOptions {
592
631
  scheme?: string;
593
632
  }
594
633
  //#endregion
595
- export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, BundleSigningAdapter, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, NativeBuildOptions, type NativeBuildRow, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, supportedIosPlatforms };
634
+ export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, Lazy, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRow, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, resolveLazy, supportedIosPlatforms };
@@ -1,8 +1,10 @@
1
1
  import { isRemoteDatabase } from "./databaseConfig.mjs";
2
2
  //#region src/types/index.ts
3
+ /** The value of a `Lazy`, calling its function. */
4
+ const resolveLazy = async (value) => typeof value === "function" ? await value() : value;
3
5
  /**
4
6
  * Supported Apple platforms for building and deployment
5
7
  */
6
8
  const supportedIosPlatforms = { ios: "ios" };
7
9
  //#endregion
8
- export { isRemoteDatabase, supportedIosPlatforms };
10
+ export { isRemoteDatabase, resolveLazy, supportedIosPlatforms };
@@ -21,5 +21,13 @@ type NativeBuildDeleteResult = {
21
21
  readonly deleted: false;
22
22
  readonly reason: "not_found";
23
23
  };
24
+ /**
25
+ * A store build mark's result: the build, and the build whose mark it replaced,
26
+ * or null when it replaced none.
27
+ */
28
+ interface NativeBuildMarkResult {
29
+ readonly nativeBuild: NativeBuildRow;
30
+ readonly previous: NativeBuildRow | null;
31
+ }
24
32
  //#endregion
25
- export { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult };
33
+ export { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult };
@@ -21,5 +21,13 @@ type NativeBuildDeleteResult = {
21
21
  readonly deleted: false;
22
22
  readonly reason: "not_found";
23
23
  };
24
+ /**
25
+ * A store build mark's result: the build, and the build whose mark it replaced,
26
+ * or null when it replaced none.
27
+ */
28
+ interface NativeBuildMarkResult {
29
+ readonly nativeBuild: NativeBuildRow;
30
+ readonly previous: NativeBuildRow | null;
31
+ }
24
32
  //#endregion
25
- export { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult };
33
+ export { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult };
@@ -1,5 +1,5 @@
1
1
  import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
2
2
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
3
3
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
4
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./models.cjs";
5
- export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildRow, type NativeBuildSubmissionDestination, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
4
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./models.cjs";
5
+ export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildMarkResult, type NativeBuildRow, type NativeBuildSubmissionDestination, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
@@ -1,5 +1,5 @@
1
1
  import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
2
2
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
3
3
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
4
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./models.mjs";
5
- export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildRow, type NativeBuildSubmissionDestination, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
4
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./models.mjs";
5
+ export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildMarkResult, type NativeBuildRow, type NativeBuildSubmissionDestination, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "1.2.0-rc.2",
3
+ "version": "1.2.0-rc.21",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -45,19 +45,13 @@
45
45
  "es-toolkit": "^1.32.0",
46
46
  "mime": "^4.0.4",
47
47
  "verkit": "0.4.0",
48
- "@hot-updater/protocol": "1.2.0-rc.2"
48
+ "@hot-updater/protocol": "1.2.0-rc.21"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@electric-sql/pglite": "0.4.1",
52
52
  "@types/node": "^20",
53
53
  "@typescript/native": "npm:typescript@7.0.2",
54
- "typescript": "npm:@typescript/typescript6@6.0.2",
55
- "@hot-updater/test-utils": "1.2.0-rc.2"
56
- },
57
- "nx": {
58
- "implicitDependencies": [
59
- "!@hot-updater/test-utils"
60
- ]
54
+ "typescript": "npm:@typescript/typescript6@6.0.2"
61
55
  },
62
56
  "inlinedDependencies": {
63
57
  "verkit": "0.4.0"