@hot-updater/vercel 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.
@@ -17698,7 +17698,7 @@ const postgres = (config) => {
17698
17698
  };
17699
17699
  //#endregion
17700
17700
  //#region ../../packages/server/dist/version.mjs
17701
- const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.6";
17701
+ const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.8";
17702
17702
  //#endregion
17703
17703
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
17704
17704
  const createVersionRouteHandlers = (plugins = []) => {
package/dist/index.d.cts CHANGED
@@ -1,14 +1,15 @@
1
- import { StorageAdapterWith } from "@hot-updater/plugin-core";
1
+ import { Lazy, StorageAdapterWith } from "@hot-updater/plugin-core";
2
2
  import { PostgresConfig, postgres } from "@hot-updater/postgres";
3
3
  //#region src/vercelBlobStorage.d.ts
4
4
  interface VercelBlobStorageConfig {
5
5
  /**
6
6
  * The Blob store's read-write token, `vercel_blob_rw_<storeId>_<secret>`:
7
7
  * the `BLOB_READ_WRITE_TOKEN` Vercel adds to a project the store connects
8
- * to. Or a function that returns it, such as one that reads it with
9
- * `secretEnv`: called on first use, so a config loads without the token.
8
+ * to. Or a function that returns it, such as `secret("<name>")` in
9
+ * `hot-updater.config.ts`: called on first use, so a config loads without
10
+ * the token.
10
11
  */
11
- token: string | (() => string | Promise<string>);
12
+ token: Lazy<string>;
12
13
  /** Base path where bundles will be stored in the store. */
13
14
  basePath?: string;
14
15
  /**
package/dist/index.d.mts CHANGED
@@ -1,14 +1,15 @@
1
- import { StorageAdapterWith } from "@hot-updater/plugin-core";
1
+ import { Lazy, StorageAdapterWith } from "@hot-updater/plugin-core";
2
2
  import { PostgresConfig, postgres } from "@hot-updater/postgres";
3
3
  //#region src/vercelBlobStorage.d.ts
4
4
  interface VercelBlobStorageConfig {
5
5
  /**
6
6
  * The Blob store's read-write token, `vercel_blob_rw_<storeId>_<secret>`:
7
7
  * the `BLOB_READ_WRITE_TOKEN` Vercel adds to a project the store connects
8
- * to. Or a function that returns it, such as one that reads it with
9
- * `secretEnv`: called on first use, so a config loads without the token.
8
+ * to. Or a function that returns it, such as `secret("<name>")` in
9
+ * `hot-updater.config.ts`: called on first use, so a config loads without
10
+ * the token.
10
11
  */
11
- token: string | (() => string | Promise<string>);
12
+ token: Lazy<string>;
12
13
  /** Base path where bundles will be stored in the store. */
13
14
  basePath?: string;
14
15
  /**
@@ -6268,29 +6268,29 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6268
6268
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6269
6269
  //#endregion
6270
6270
  //#region iac/configTemplate.ts
6271
- const getConfigScaffold = (build, { secretEnv } = { secretEnv: false }) => {
6272
- const read = (reader, name) => secretEnv ? `async () =>
6273
- (await ${reader}()).${name}` : `process.env.${name}!`;
6274
- const storageConfig = {
6271
+ /**
6272
+ * The config init and the agent scaffold write: the Blob token and the
6273
+ * database URL are read with `secret()`, from the environment and
6274
+ * `.env.hotupdater`, then the config's `secrets` adapter.
6275
+ */
6276
+ const getConfigScaffold = (build) => {
6277
+ const builder = new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage({
6275
6278
  imports: [{
6276
6279
  pkg: "@hot-updater/vercel",
6277
6280
  named: ["vercelBlobStorage"]
6278
6281
  }],
6279
6282
  configString: `vercelBlobStorage({
6280
- token: ${read("storageSecrets", "HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN")},
6283
+ token: secret("HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN"),
6281
6284
  })`
6282
- };
6283
- const databaseConfig = {
6285
+ }).setDatabase({
6284
6286
  imports: [{
6285
6287
  pkg: "@hot-updater/vercel",
6286
6288
  named: ["postgres"]
6287
6289
  }],
6288
6290
  configString: `postgres({
6289
- connectionString: ${read("databaseSecrets", "HOT_UPDATER_VERCEL_DATABASE_URL")},
6291
+ connectionString: secret("HOT_UPDATER_VERCEL_DATABASE_URL"),
6290
6292
  })`
6291
- };
6292
- const helperStatements = secretEnv ? [(0, _hot_updater_cli_tools.secretEnvHelper)("storageSecrets", ["HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN"]), (0, _hot_updater_cli_tools.secretEnvHelper)("databaseSecrets", ["HOT_UPDATER_VERCEL_DATABASE_URL"])] : [];
6293
- const builder = new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).setPlugins({
6293
+ }).setPlugins({
6294
6294
  imports: [{
6295
6295
  pkg: "hot-updater/plugins",
6296
6296
  named: [
@@ -6300,12 +6300,11 @@ const getConfigScaffold = (build, { secretEnv } = { secretEnv: false }) => {
6300
6300
  ]
6301
6301
  }],
6302
6302
  configString: "[apiKeys(), insights(), remoteConfig()]"
6303
- });
6304
- if (secretEnv) builder.addImport({
6303
+ }).addImport({
6305
6304
  pkg: "hot-updater",
6306
- named: ["secretEnv"]
6307
- }).setIntermediateCode(helperStatements.map(({ code }) => code).join("\n\n"));
6308
- return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(builder, { helperStatements });
6305
+ named: ["secret"]
6306
+ });
6307
+ return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(builder);
6309
6308
  };
6310
6309
  //#endregion
6311
6310
  //#region iac/init/index.ts
@@ -7144,7 +7143,7 @@ const runInit = async ({ build, envFile, secretsEnv }) => {
7144
7143
  await database.dispose?.();
7145
7144
  }
7146
7145
  _hot_updater_cli_tools.p.log.success("Generated '.env.hotupdater' file with Vercel settings.");
7147
- await (0, _hot_updater_cli_tools.writeHotUpdaterFiles)(getConfigScaffold(build, { secretEnv: true }), {
7146
+ await (0, _hot_updater_cli_tools.writeHotUpdaterFiles)(getConfigScaffold(build), {
7148
7147
  cwd,
7149
7148
  settings: "Vercel"
7150
7149
  });
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
2
2
  import fs from "fs/promises";
3
3
  import os from "os";
4
4
  import path from "path";
5
- import { ConfigBuilder, InitError, LegacyInfrastructureError, assembleServer, assertInfrastructureGenerationPayload, confirmInitInputPersistence, createHotUpdaterConfigScaffoldFromBuilder, createMigrator, getCwd, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, link, makeEnv, p, printAppSetup, provisionClientCredential, readHotUpdaterInitEnv, secretEnvHelper, shouldAutoSelectOnlyInitResource, writeHotUpdaterFiles } from "@hot-updater/cli-tools";
5
+ import { ConfigBuilder, InitError, LegacyInfrastructureError, assembleServer, assertInfrastructureGenerationPayload, confirmInitInputPersistence, createHotUpdaterConfigScaffoldFromBuilder, createMigrator, getCwd, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, link, makeEnv, p, printAppSetup, provisionClientCredential, readHotUpdaterInitEnv, shouldAutoSelectOnlyInitResource, writeHotUpdaterFiles } from "@hot-updater/cli-tools";
6
6
  import { postgres } from "@hot-updater/postgres";
7
7
  import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
8
8
  import { fileURLToPath } from "node:url";
@@ -6262,29 +6262,29 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6262
6262
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6263
6263
  //#endregion
6264
6264
  //#region iac/configTemplate.ts
6265
- const getConfigScaffold = (build, { secretEnv } = { secretEnv: false }) => {
6266
- const read = (reader, name) => secretEnv ? `async () =>
6267
- (await ${reader}()).${name}` : `process.env.${name}!`;
6268
- const storageConfig = {
6265
+ /**
6266
+ * The config init and the agent scaffold write: the Blob token and the
6267
+ * database URL are read with `secret()`, from the environment and
6268
+ * `.env.hotupdater`, then the config's `secrets` adapter.
6269
+ */
6270
+ const getConfigScaffold = (build) => {
6271
+ const builder = new ConfigBuilder().setBuildType(build).setStorage({
6269
6272
  imports: [{
6270
6273
  pkg: "@hot-updater/vercel",
6271
6274
  named: ["vercelBlobStorage"]
6272
6275
  }],
6273
6276
  configString: `vercelBlobStorage({
6274
- token: ${read("storageSecrets", "HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN")},
6277
+ token: secret("HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN"),
6275
6278
  })`
6276
- };
6277
- const databaseConfig = {
6279
+ }).setDatabase({
6278
6280
  imports: [{
6279
6281
  pkg: "@hot-updater/vercel",
6280
6282
  named: ["postgres"]
6281
6283
  }],
6282
6284
  configString: `postgres({
6283
- connectionString: ${read("databaseSecrets", "HOT_UPDATER_VERCEL_DATABASE_URL")},
6285
+ connectionString: secret("HOT_UPDATER_VERCEL_DATABASE_URL"),
6284
6286
  })`
6285
- };
6286
- const helperStatements = secretEnv ? [secretEnvHelper("storageSecrets", ["HOT_UPDATER_VERCEL_BLOB_READ_WRITE_TOKEN"]), secretEnvHelper("databaseSecrets", ["HOT_UPDATER_VERCEL_DATABASE_URL"])] : [];
6287
- const builder = new ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).setPlugins({
6287
+ }).setPlugins({
6288
6288
  imports: [{
6289
6289
  pkg: "hot-updater/plugins",
6290
6290
  named: [
@@ -6294,12 +6294,11 @@ const getConfigScaffold = (build, { secretEnv } = { secretEnv: false }) => {
6294
6294
  ]
6295
6295
  }],
6296
6296
  configString: "[apiKeys(), insights(), remoteConfig()]"
6297
- });
6298
- if (secretEnv) builder.addImport({
6297
+ }).addImport({
6299
6298
  pkg: "hot-updater",
6300
- named: ["secretEnv"]
6301
- }).setIntermediateCode(helperStatements.map(({ code }) => code).join("\n\n"));
6302
- return createHotUpdaterConfigScaffoldFromBuilder(builder, { helperStatements });
6299
+ named: ["secret"]
6300
+ });
6301
+ return createHotUpdaterConfigScaffoldFromBuilder(builder);
6303
6302
  };
6304
6303
  //#endregion
6305
6304
  //#region iac/init/index.ts
@@ -7138,7 +7137,7 @@ const runInit = async ({ build, envFile, secretsEnv }) => {
7138
7137
  await database.dispose?.();
7139
7138
  }
7140
7139
  p.log.success("Generated '.env.hotupdater' file with Vercel settings.");
7141
- await writeHotUpdaterFiles(getConfigScaffold(build, { secretEnv: true }), {
7140
+ await writeHotUpdaterFiles(getConfigScaffold(build), {
7142
7141
  cwd,
7143
7142
  settings: "Vercel"
7144
7143
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/vercel",
3
3
  "type": "module",
4
- "version": "1.2.0-rc.6",
4
+ "version": "1.2.0-rc.8",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -41,11 +41,11 @@
41
41
  "@vercel/cli-auth": "0.3.10",
42
42
  "@vercel/cli-config": "0.3.1",
43
43
  "pg": "8.13.1",
44
- "@hot-updater/cli-tools": "1.2.0-rc.6",
45
- "@hot-updater/plugin-core": "1.2.0-rc.6",
46
- "@hot-updater/postgres": "1.2.0-rc.6",
47
- "@hot-updater/protocol": "1.2.0-rc.6",
48
- "@hot-updater/server": "1.2.0-rc.6"
44
+ "@hot-updater/cli-tools": "1.2.0-rc.8",
45
+ "@hot-updater/plugin-core": "1.2.0-rc.8",
46
+ "@hot-updater/postgres": "1.2.0-rc.8",
47
+ "@hot-updater/server": "1.2.0-rc.8",
48
+ "@hot-updater/protocol": "1.2.0-rc.8"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^20",
@@ -54,7 +54,7 @@
54
54
  "execa": "9.5.2",
55
55
  "kysely": "0.28.17",
56
56
  "vitest": "4.1.4",
57
- "@hot-updater/test-utils": "1.2.0-rc.6"
57
+ "@hot-updater/test-utils": "1.2.0-rc.8"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown",