@hot-updater/cloudflare 0.21.4 → 0.21.6

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.cjs CHANGED
@@ -6789,6 +6789,29 @@ const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
6789
6789
 
6790
6790
  //#endregion
6791
6791
  //#region src/r2Storage.ts
6792
+ /**
6793
+ * Cloudflare R2 storage plugin for Hot Updater.
6794
+ *
6795
+ * Note: This plugin does not support `getDownloadUrl()`.
6796
+ * If you need download URL generation, use `s3Storage` from `@hot-updater/aws` instead,
6797
+ * which is fully compatible with Cloudflare R2.
6798
+ *
6799
+ * @example
6800
+ * ```typescript
6801
+ * // Using s3Storage with Cloudflare R2 for download URL support
6802
+ * import { s3Storage } from "@hot-updater/aws";
6803
+ *
6804
+ * s3Storage({
6805
+ * region: "auto",
6806
+ * endpoint: "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
6807
+ * credentials: {
6808
+ * accessKeyId: "YOUR_ACCESS_KEY_ID",
6809
+ * secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
6810
+ * },
6811
+ * bucketName: "YOUR_BUCKET_NAME",
6812
+ * })
6813
+ * ```
6814
+ */
6792
6815
  const r2Storage = (config, hooks) => (_) => {
6793
6816
  const { bucketName, cloudflareApiToken, accountId } = config;
6794
6817
  const wrangler = createWrangler({
@@ -6822,13 +6845,8 @@ const r2Storage = (config, hooks) => (_) => {
6822
6845
  hooks?.onStorageUploaded?.();
6823
6846
  return { storageUri: `r2://${bucketName}/${Key}` };
6824
6847
  },
6825
- async getDownloadUrl(storageUri) {
6826
- const u$1 = new URL(storageUri);
6827
- if (u$1.protocol.replace(":", "") !== "r2") throw new Error("Invalid R2 storage URI protocol");
6828
- const { stdout: urlOutput } = await wrangler("r2", "object", "presign", [bucketName, u$1.pathname.slice(1)].join("/"), "--expires-in", "3600", "--remote");
6829
- const signedUrl = urlOutput?.trim();
6830
- if (!signedUrl) throw new Error("Failed to generate download URL");
6831
- return { fileUrl: signedUrl };
6848
+ async getDownloadUrl() {
6849
+ throw new Error("`r2Storage` does not support `getDownloadUrl()`. Use `s3Storage` from `@hot-updater/aws` instead (compatible with Cloudflare R2).\n\nExample:\ns3Storage({\n region: 'auto',\n endpoint: 'https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com',\n credentials: {\n accessKeyId: 'YOUR_ACCESS_KEY_ID',\n secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',\n },\n bucketName: 'YOUR_BUCKET_NAME',\n})");
6832
6850
  }
6833
6851
  };
6834
6852
  };
package/dist/index.d.cts CHANGED
@@ -19,6 +19,29 @@ interface R2StorageConfig {
19
19
  */
20
20
  basePath?: string;
21
21
  }
22
+ /**
23
+ * Cloudflare R2 storage plugin for Hot Updater.
24
+ *
25
+ * Note: This plugin does not support `getDownloadUrl()`.
26
+ * If you need download URL generation, use `s3Storage` from `@hot-updater/aws` instead,
27
+ * which is fully compatible with Cloudflare R2.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Using s3Storage with Cloudflare R2 for download URL support
32
+ * import { s3Storage } from "@hot-updater/aws";
33
+ *
34
+ * s3Storage({
35
+ * region: "auto",
36
+ * endpoint: "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
37
+ * credentials: {
38
+ * accessKeyId: "YOUR_ACCESS_KEY_ID",
39
+ * secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
40
+ * },
41
+ * bucketName: "YOUR_BUCKET_NAME",
42
+ * })
43
+ * ```
44
+ */
22
45
  declare const r2Storage: (config: R2StorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
23
46
  //#endregion
24
47
  export { D1DatabaseConfig, R2StorageConfig, d1Database, r2Storage };
package/dist/index.d.ts CHANGED
@@ -19,6 +19,29 @@ interface R2StorageConfig {
19
19
  */
20
20
  basePath?: string;
21
21
  }
22
+ /**
23
+ * Cloudflare R2 storage plugin for Hot Updater.
24
+ *
25
+ * Note: This plugin does not support `getDownloadUrl()`.
26
+ * If you need download URL generation, use `s3Storage` from `@hot-updater/aws` instead,
27
+ * which is fully compatible with Cloudflare R2.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Using s3Storage with Cloudflare R2 for download URL support
32
+ * import { s3Storage } from "@hot-updater/aws";
33
+ *
34
+ * s3Storage({
35
+ * region: "auto",
36
+ * endpoint: "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
37
+ * credentials: {
38
+ * accessKeyId: "YOUR_ACCESS_KEY_ID",
39
+ * secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
40
+ * },
41
+ * bucketName: "YOUR_BUCKET_NAME",
42
+ * })
43
+ * ```
44
+ */
22
45
  declare const r2Storage: (config: R2StorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
23
46
  //#endregion
24
47
  export { D1DatabaseConfig, R2StorageConfig, d1Database, r2Storage };
package/dist/index.js CHANGED
@@ -6773,6 +6773,29 @@ const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
6773
6773
 
6774
6774
  //#endregion
6775
6775
  //#region src/r2Storage.ts
6776
+ /**
6777
+ * Cloudflare R2 storage plugin for Hot Updater.
6778
+ *
6779
+ * Note: This plugin does not support `getDownloadUrl()`.
6780
+ * If you need download URL generation, use `s3Storage` from `@hot-updater/aws` instead,
6781
+ * which is fully compatible with Cloudflare R2.
6782
+ *
6783
+ * @example
6784
+ * ```typescript
6785
+ * // Using s3Storage with Cloudflare R2 for download URL support
6786
+ * import { s3Storage } from "@hot-updater/aws";
6787
+ *
6788
+ * s3Storage({
6789
+ * region: "auto",
6790
+ * endpoint: "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
6791
+ * credentials: {
6792
+ * accessKeyId: "YOUR_ACCESS_KEY_ID",
6793
+ * secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
6794
+ * },
6795
+ * bucketName: "YOUR_BUCKET_NAME",
6796
+ * })
6797
+ * ```
6798
+ */
6776
6799
  const r2Storage = (config, hooks) => (_) => {
6777
6800
  const { bucketName, cloudflareApiToken, accountId } = config;
6778
6801
  const wrangler = createWrangler({
@@ -6806,13 +6829,8 @@ const r2Storage = (config, hooks) => (_) => {
6806
6829
  hooks?.onStorageUploaded?.();
6807
6830
  return { storageUri: `r2://${bucketName}/${Key}` };
6808
6831
  },
6809
- async getDownloadUrl(storageUri) {
6810
- const u$1 = new URL(storageUri);
6811
- if (u$1.protocol.replace(":", "") !== "r2") throw new Error("Invalid R2 storage URI protocol");
6812
- const { stdout: urlOutput } = await wrangler("r2", "object", "presign", [bucketName, u$1.pathname.slice(1)].join("/"), "--expires-in", "3600", "--remote");
6813
- const signedUrl = urlOutput?.trim();
6814
- if (!signedUrl) throw new Error("Failed to generate download URL");
6815
- return { fileUrl: signedUrl };
6832
+ async getDownloadUrl() {
6833
+ throw new Error("`r2Storage` does not support `getDownloadUrl()`. Use `s3Storage` from `@hot-updater/aws` instead (compatible with Cloudflare R2).\n\nExample:\ns3Storage({\n region: 'auto',\n endpoint: 'https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com',\n credentials: {\n accessKeyId: 'YOUR_ACCESS_KEY_ID',\n secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',\n },\n bucketName: 'YOUR_BUCKET_NAME',\n})");
6816
6834
  }
6817
6835
  };
6818
6836
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "0.21.4",
4
+ "version": "0.21.6",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -41,9 +41,9 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "cloudflare": "4.2.0",
44
- "@hot-updater/core": "0.21.4",
45
- "@hot-updater/js": "0.21.4",
46
- "@hot-updater/plugin-core": "0.21.4"
44
+ "@hot-updater/core": "0.21.6",
45
+ "@hot-updater/js": "0.21.6",
46
+ "@hot-updater/plugin-core": "0.21.6"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@clack/prompts": "0.10.0",
@@ -63,7 +63,7 @@
63
63
  "vitest": "2.1.8",
64
64
  "wrangler": "^4.5.0",
65
65
  "xdg-app-paths": "^8.3.0",
66
- "@hot-updater/test-utils": "0.21.4"
66
+ "@hot-updater/test-utils": "0.21.6"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsdown && pnpm build:worker",
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2025-10-29T06:11:58.235Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2025-11-06T19:57:01.557Z.