@hot-updater/vercel 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17558,7 +17558,7 @@ const postgres = (config) => {
17558
17558
  };
17559
17559
  //#endregion
17560
17560
  //#region ../../packages/server/dist/version.mjs
17561
- const HOT_UPDATER_SERVER_VERSION = "1.0.4";
17561
+ const HOT_UPDATER_SERVER_VERSION = "1.0.5";
17562
17562
  //#endregion
17563
17563
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
17564
17564
  const createVersionRouteHandlers = (plugins = []) => {
@@ -6536,10 +6536,6 @@ const createVercelApi = ({ token, teamId, fetch: fetchImpl = fetch }) => {
6536
6536
  envVarPrefix: input.envVarPrefix
6537
6537
  } });
6538
6538
  },
6539
- /** Removes a store's connection, and the variables it added, from a project. */
6540
- async disconnectBlobStore(storeId, connectionId) {
6541
- await request("DELETE", `/v1/storage/stores/${encodeURIComponent(storeId)}/connections/${encodeURIComponent(connectionId)}`);
6542
- },
6543
6539
  async listProjectEnv(projectId) {
6544
6540
  return (await paginate(`/v10/projects/${encodeURIComponent(projectId)}/env`, "envs")).flatMap((env) => isRecord(env) && typeof env.id === "string" && typeof env.key === "string" ? [{
6545
6541
  id: env.id,
@@ -6838,38 +6834,13 @@ const resolveProjectName = async (savedName, nonInteractive) => {
6838
6834
  }));
6839
6835
  };
6840
6836
  /**
6841
- * The saved store, or one the user selects or creates; `replaces` is a saved
6842
- * public store the selection takes the place of.
6837
+ * The saved private store, or one the user selects or creates. Bundles
6838
+ * download only through signed URLs, so a public store is never used.
6843
6839
  */
6844
6840
  const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) => {
6845
- const found = stores.find((store) => store.id === savedId) ?? (savedId === void 0 ? stores.find((store) => store.name === savedName) : void 0);
6846
- const publicStore = found?.access === "public" ? found : void 0;
6847
- const replacement = publicStore && `Blob store ${publicStore.name} is public. Hot Updater keeps bundles in a private store, and the bundles deployed to ${publicStore.name} stop downloading until you deploy them again.`;
6848
- const saved = publicStore ? void 0 : found;
6849
6841
  const privateStores = stores.filter((store) => store.access === "private");
6842
+ const saved = privateStores.find((store) => store.id === savedId) ?? (savedId === void 0 ? privateStores.find((store) => store.name === savedName) : void 0);
6850
6843
  if (nonInteractive) {
6851
- if (publicStore) {
6852
- const named = stores.find((store) => store.name === savedName);
6853
- if (savedName && savedName !== publicStore.name) {
6854
- if (named?.access === "private") {
6855
- _hot_updater_cli_tools.p.log.warn(replacement);
6856
- return {
6857
- kind: "existing",
6858
- store: named,
6859
- replaces: publicStore
6860
- };
6861
- }
6862
- if (!named) {
6863
- _hot_updater_cli_tools.p.log.warn(replacement);
6864
- return {
6865
- kind: "create",
6866
- name: savedName,
6867
- replaces: publicStore
6868
- };
6869
- }
6870
- }
6871
- throw new _hot_updater_cli_tools.InitError(`${replacement} Set ${inputs.blobStoreName.envKey} to a private or new store to replace it.`);
6872
- }
6873
6844
  if (saved) return {
6874
6845
  kind: "existing",
6875
6846
  store: saved
@@ -6880,13 +6851,7 @@ const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) =
6880
6851
  };
6881
6852
  throw new _hot_updater_cli_tools.InitError(`${inputs.blobStoreName.envKey} is required to select the Blob store.`);
6882
6853
  }
6883
- if (publicStore) {
6884
- _hot_updater_cli_tools.p.log.warn(replacement);
6885
- if (!exitIfCancelled(await _hot_updater_cli_tools.p.confirm({
6886
- message: `Replace ${publicStore.name} with a private Blob store?`,
6887
- initialValue: false
6888
- }))) process.exit(1);
6889
- } else if ((savedId || savedName) && !saved) _hot_updater_cli_tools.p.log.warn("The saved Blob store was not found. Select a store again.");
6854
+ if ((savedId || savedName) && !saved) _hot_updater_cli_tools.p.log.warn("The saved Blob store was not found. Select a store again.");
6890
6855
  const createKey = "\0create";
6891
6856
  const selected = exitIfCancelled(await _hot_updater_cli_tools.p.select({
6892
6857
  message: "Select the Blob store for bundles",
@@ -6900,21 +6865,18 @@ const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) =
6900
6865
  }]
6901
6866
  }));
6902
6867
  const store = privateStores.find((candidate) => candidate.id === selected);
6903
- const replaces = publicStore ? { replaces: publicStore } : {};
6904
6868
  if (store) return {
6905
6869
  kind: "existing",
6906
- store,
6907
- ...replaces
6870
+ store
6908
6871
  };
6909
6872
  const prompt = inputs.blobStoreName.prompt;
6910
6873
  return {
6911
6874
  kind: "create",
6912
6875
  name: exitIfCancelled(await _hot_updater_cli_tools.p.text({
6913
- ...(0, _hot_updater_cli_tools.getInitProviderTextPromptValues)(prompt, savedName === publicStore?.name ? void 0 : savedName),
6876
+ ...(0, _hot_updater_cli_tools.getInitProviderTextPromptValues)(prompt, savedName),
6914
6877
  message: prompt.message,
6915
6878
  validate: (value) => isVercelBlobStoreName(value) ? void 0 : "Use up to 32 letters, digits, '_', or '-'."
6916
- })),
6917
- ...replaces
6879
+ }))
6918
6880
  };
6919
6881
  };
6920
6882
  /**
@@ -7086,11 +7048,6 @@ const runInit = async ({ build, envFile }) => {
7086
7048
  ...saved.databaseUrl ? { savedUrl: saved.databaseUrl } : {}
7087
7049
  });
7088
7050
  assertPostgresCanInitialize(await readHotUpdaterTables(databaseUrl));
7089
- for (const connection of storeSelection.replaces?.connections ?? []) {
7090
- if (connection.projectId !== project.id) continue;
7091
- await api.disconnectBlobStore(storeSelection.replaces.id, connection.id);
7092
- _hot_updater_cli_tools.p.log.info(`Disconnected Blob store ${storeSelection.replaces.name} from ${project.name}`);
7093
- }
7094
7051
  let store;
7095
7052
  if (storeSelection.kind === "existing") {
7096
7053
  store = storeSelection.store;
@@ -6530,10 +6530,6 @@ const createVercelApi = ({ token, teamId, fetch: fetchImpl = fetch }) => {
6530
6530
  envVarPrefix: input.envVarPrefix
6531
6531
  } });
6532
6532
  },
6533
- /** Removes a store's connection, and the variables it added, from a project. */
6534
- async disconnectBlobStore(storeId, connectionId) {
6535
- await request("DELETE", `/v1/storage/stores/${encodeURIComponent(storeId)}/connections/${encodeURIComponent(connectionId)}`);
6536
- },
6537
6533
  async listProjectEnv(projectId) {
6538
6534
  return (await paginate(`/v10/projects/${encodeURIComponent(projectId)}/env`, "envs")).flatMap((env) => isRecord(env) && typeof env.id === "string" && typeof env.key === "string" ? [{
6539
6535
  id: env.id,
@@ -6832,38 +6828,13 @@ const resolveProjectName = async (savedName, nonInteractive) => {
6832
6828
  }));
6833
6829
  };
6834
6830
  /**
6835
- * The saved store, or one the user selects or creates; `replaces` is a saved
6836
- * public store the selection takes the place of.
6831
+ * The saved private store, or one the user selects or creates. Bundles
6832
+ * download only through signed URLs, so a public store is never used.
6837
6833
  */
6838
6834
  const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) => {
6839
- const found = stores.find((store) => store.id === savedId) ?? (savedId === void 0 ? stores.find((store) => store.name === savedName) : void 0);
6840
- const publicStore = found?.access === "public" ? found : void 0;
6841
- const replacement = publicStore && `Blob store ${publicStore.name} is public. Hot Updater keeps bundles in a private store, and the bundles deployed to ${publicStore.name} stop downloading until you deploy them again.`;
6842
- const saved = publicStore ? void 0 : found;
6843
6835
  const privateStores = stores.filter((store) => store.access === "private");
6836
+ const saved = privateStores.find((store) => store.id === savedId) ?? (savedId === void 0 ? privateStores.find((store) => store.name === savedName) : void 0);
6844
6837
  if (nonInteractive) {
6845
- if (publicStore) {
6846
- const named = stores.find((store) => store.name === savedName);
6847
- if (savedName && savedName !== publicStore.name) {
6848
- if (named?.access === "private") {
6849
- p.log.warn(replacement);
6850
- return {
6851
- kind: "existing",
6852
- store: named,
6853
- replaces: publicStore
6854
- };
6855
- }
6856
- if (!named) {
6857
- p.log.warn(replacement);
6858
- return {
6859
- kind: "create",
6860
- name: savedName,
6861
- replaces: publicStore
6862
- };
6863
- }
6864
- }
6865
- throw new InitError(`${replacement} Set ${inputs.blobStoreName.envKey} to a private or new store to replace it.`);
6866
- }
6867
6838
  if (saved) return {
6868
6839
  kind: "existing",
6869
6840
  store: saved
@@ -6874,13 +6845,7 @@ const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) =
6874
6845
  };
6875
6846
  throw new InitError(`${inputs.blobStoreName.envKey} is required to select the Blob store.`);
6876
6847
  }
6877
- if (publicStore) {
6878
- p.log.warn(replacement);
6879
- if (!exitIfCancelled(await p.confirm({
6880
- message: `Replace ${publicStore.name} with a private Blob store?`,
6881
- initialValue: false
6882
- }))) process.exit(1);
6883
- } else if ((savedId || savedName) && !saved) p.log.warn("The saved Blob store was not found. Select a store again.");
6848
+ if ((savedId || savedName) && !saved) p.log.warn("The saved Blob store was not found. Select a store again.");
6884
6849
  const createKey = "\0create";
6885
6850
  const selected = exitIfCancelled(await p.select({
6886
6851
  message: "Select the Blob store for bundles",
@@ -6894,21 +6859,18 @@ const selectBlobStore = async ({ nonInteractive, savedId, savedName, stores }) =
6894
6859
  }]
6895
6860
  }));
6896
6861
  const store = privateStores.find((candidate) => candidate.id === selected);
6897
- const replaces = publicStore ? { replaces: publicStore } : {};
6898
6862
  if (store) return {
6899
6863
  kind: "existing",
6900
- store,
6901
- ...replaces
6864
+ store
6902
6865
  };
6903
6866
  const prompt = inputs.blobStoreName.prompt;
6904
6867
  return {
6905
6868
  kind: "create",
6906
6869
  name: exitIfCancelled(await p.text({
6907
- ...getInitProviderTextPromptValues(prompt, savedName === publicStore?.name ? void 0 : savedName),
6870
+ ...getInitProviderTextPromptValues(prompt, savedName),
6908
6871
  message: prompt.message,
6909
6872
  validate: (value) => isVercelBlobStoreName(value) ? void 0 : "Use up to 32 letters, digits, '_', or '-'."
6910
- })),
6911
- ...replaces
6873
+ }))
6912
6874
  };
6913
6875
  };
6914
6876
  /**
@@ -7080,11 +7042,6 @@ const runInit = async ({ build, envFile }) => {
7080
7042
  ...saved.databaseUrl ? { savedUrl: saved.databaseUrl } : {}
7081
7043
  });
7082
7044
  assertPostgresCanInitialize(await readHotUpdaterTables(databaseUrl));
7083
- for (const connection of storeSelection.replaces?.connections ?? []) {
7084
- if (connection.projectId !== project.id) continue;
7085
- await api.disconnectBlobStore(storeSelection.replaces.id, connection.id);
7086
- p.log.info(`Disconnected Blob store ${storeSelection.replaces.name} from ${project.name}`);
7087
- }
7088
7045
  let store;
7089
7046
  if (storeSelection.kind === "existing") {
7090
7047
  store = storeSelection.store;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/vercel",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
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.0.4",
45
- "@hot-updater/plugin-core": "1.0.4",
46
- "@hot-updater/postgres": "1.0.4",
47
- "@hot-updater/protocol": "1.0.4",
48
- "@hot-updater/server": "1.0.4"
44
+ "@hot-updater/cli-tools": "1.0.5",
45
+ "@hot-updater/postgres": "1.0.5",
46
+ "@hot-updater/protocol": "1.0.5",
47
+ "@hot-updater/plugin-core": "1.0.5",
48
+ "@hot-updater/server": "1.0.5"
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.0.4"
57
+ "@hot-updater/test-utils": "1.0.5"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown",