@hot-updater/cloudflare 0.36.7 → 1.0.0-rc.0

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.
Files changed (49) hide show
  1. package/dist/iac/index.cjs +988 -10
  2. package/dist/iac/index.mjs +991 -14
  3. package/dist/index.cjs +919 -6989
  4. package/dist/index.d.cts +11 -47
  5. package/dist/index.d.mts +11 -47
  6. package/dist/index.mjs +917 -7006
  7. package/dist/worker/index.cjs +898 -336
  8. package/dist/worker/index.d.cts +18 -33
  9. package/dist/worker/index.d.mts +18 -33
  10. package/dist/worker/index.mjs +899 -331
  11. package/package.json +7 -10
  12. package/sql/bundles.sql +183 -35
  13. package/src/d1Database.spec.ts +143 -392
  14. package/src/d1Database.ts +55 -650
  15. package/src/d1Implementation.spec.ts +252 -0
  16. package/src/d1Implementation.ts +742 -0
  17. package/src/d1Query.spec.ts +46 -0
  18. package/src/d1Query.ts +89 -0
  19. package/src/d1Rows.spec.ts +111 -0
  20. package/src/d1Rows.ts +326 -0
  21. package/src/d1Sql.spec.ts +30 -0
  22. package/src/d1Sql.ts +175 -0
  23. package/src/r2S3Storage.ts +93 -137
  24. package/src/r2Storage.spec.ts +120 -218
  25. package/src/r2Storage.ts +13 -61
  26. package/src/r2WorkerStorage.spec.ts +161 -50
  27. package/src/r2WorkerStorage.ts +85 -118
  28. package/src/worker/d1Database.spec.ts +33 -0
  29. package/src/worker/d1Database.ts +52 -0
  30. package/src/worker/index.ts +3 -31
  31. package/worker/dist/README.md +1 -1
  32. package/worker/dist/index.js +5968 -4701
  33. package/worker/dist/index.js.map +4 -4
  34. package/worker/migrations/0001_hot-updater_1.0.0.sql +197 -0
  35. package/worker/migrations/0002_hot-updater_artifact_byte_sizes.sql +11 -0
  36. package/worker/src/databaseMigration.integration.spec.ts +114 -0
  37. package/worker/src/databasePlugins.integration.spec.ts +292 -0
  38. package/worker/src/index.integration.spec.ts +102 -294
  39. package/worker/src/index.ts +14 -66
  40. package/worker/src/storagePlugin.integration.spec.ts +59 -0
  41. package/worker/wrangler.json +5 -2
  42. package/src/cloudflareWorkerDatabase.spec.ts +0 -260
  43. package/src/cloudflareWorkerDatabase.ts +0 -651
  44. package/src/r2WranglerStorage.ts +0 -193
  45. package/worker/migrations/0001_hot-updater_init.sql +0 -16
  46. package/worker/migrations/0002_hot-updater_0.13.0.sql +0 -8
  47. package/worker/migrations/0003_hot-updater_0.18.0.sql +0 -38
  48. package/worker/migrations/0004_hot-updater_0.29.0.sql +0 -11
  49. package/worker/migrations/0005_hot-updater_0.31.0.sql +0 -24
package/dist/index.d.cts CHANGED
@@ -1,64 +1,28 @@
1
1
  import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import { StoragePluginHooks, UniversalStoragePlugin } from "@hot-updater/plugin-core";
2
+ import { StoragePluginWith } from "@hot-updater/plugin-core";
3
3
  import { S3ClientConfig } from "@aws-sdk/client-s3";
4
4
 
5
5
  //#region src/d1Database.d.ts
6
6
  interface D1DatabaseConfig {
7
- databaseId: string;
8
- accountId: string;
9
- cloudflareApiToken: string;
7
+ readonly databaseId: string;
8
+ readonly accountId: string;
9
+ readonly cloudflareApiToken: string;
10
10
  }
11
- declare const d1Database: (config: D1DatabaseConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
11
+ declare const d1Database: (config: D1DatabaseConfig) => _$_hot_updater_plugin_core0.DatabasePlugin;
12
12
  //#endregion
13
13
  //#region src/r2S3Storage.d.ts
14
14
  interface R2S3StorageConfig extends S3ClientConfig {
15
15
  accountId: string;
16
16
  bucketName: string;
17
17
  credentials: NonNullable<S3ClientConfig["credentials"]>;
18
- /**
19
- * Base path where bundles will be stored in the bucket
20
- */
18
+ /** Base path where bundles will be stored in the bucket. */
21
19
  basePath?: string;
22
- }
23
- //#endregion
24
- //#region src/r2WranglerStorage.d.ts
25
- /**
26
- * @deprecated `cloudflareApiToken` uses the Wrangler CLI for R2 operations,
27
- * which is slower than direct S3-compatible API access. Create R2
28
- * S3-compatible credentials in the Cloudflare dashboard and pass them with
29
- * `r2Storage({ credentials })` instead.
30
- */
31
- interface R2WranglerStorageConfig {
32
- accountId: string;
33
- bucketName: string;
34
- /**
35
- * @deprecated This token keeps R2 access on the slower Wrangler CLI path.
36
- * Create R2 S3-compatible credentials in the Cloudflare dashboard and use
37
- * `credentials` instead.
38
- */
39
- cloudflareApiToken: string;
40
- /**
41
- * Base path where bundles will be stored in the bucket
42
- */
43
- basePath?: string;
44
- credentials?: never;
20
+ /** Required when this storage serves downloads through createHotUpdater. */
21
+ downloadUrlSigningKey?: string;
45
22
  }
46
23
  //#endregion
47
24
  //#region src/r2Storage.d.ts
48
- type R2StorageConfig = R2S3StorageConfig | R2WranglerStorageConfig;
49
- /**
50
- * Cloudflare R2 storage plugin for Hot Updater.
51
- */
52
- interface R2Storage {
53
- (config: R2S3StorageConfig, hooks?: StoragePluginHooks): () => UniversalStoragePlugin;
54
- /**
55
- * @deprecated `cloudflareApiToken` uses the Wrangler CLI for R2 operations,
56
- * which is slower than direct S3-compatible API access. Create R2
57
- * S3-compatible credentials in the Cloudflare dashboard and pass them with
58
- * `r2Storage({ credentials })` instead.
59
- */
60
- (config: R2WranglerStorageConfig, hooks?: StoragePluginHooks): () => UniversalStoragePlugin;
61
- }
62
- declare const r2Storage: R2Storage;
25
+ type R2StorageConfig = R2S3StorageConfig;
26
+ declare const r2Storage: (config: R2S3StorageConfig) => StoragePluginWith<"put" | "get" | "exists" | "delete">;
63
27
  //#endregion
64
- export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, type R2WranglerStorageConfig, d1Database, r2Storage };
28
+ export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };
package/dist/index.d.mts CHANGED
@@ -1,64 +1,28 @@
1
1
  import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import { StoragePluginHooks, UniversalStoragePlugin } from "@hot-updater/plugin-core";
2
+ import { StoragePluginWith } from "@hot-updater/plugin-core";
3
3
  import { S3ClientConfig } from "@aws-sdk/client-s3";
4
4
 
5
5
  //#region src/d1Database.d.ts
6
6
  interface D1DatabaseConfig {
7
- databaseId: string;
8
- accountId: string;
9
- cloudflareApiToken: string;
7
+ readonly databaseId: string;
8
+ readonly accountId: string;
9
+ readonly cloudflareApiToken: string;
10
10
  }
11
- declare const d1Database: (config: D1DatabaseConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
11
+ declare const d1Database: (config: D1DatabaseConfig) => _$_hot_updater_plugin_core0.DatabasePlugin;
12
12
  //#endregion
13
13
  //#region src/r2S3Storage.d.ts
14
14
  interface R2S3StorageConfig extends S3ClientConfig {
15
15
  accountId: string;
16
16
  bucketName: string;
17
17
  credentials: NonNullable<S3ClientConfig["credentials"]>;
18
- /**
19
- * Base path where bundles will be stored in the bucket
20
- */
18
+ /** Base path where bundles will be stored in the bucket. */
21
19
  basePath?: string;
22
- }
23
- //#endregion
24
- //#region src/r2WranglerStorage.d.ts
25
- /**
26
- * @deprecated `cloudflareApiToken` uses the Wrangler CLI for R2 operations,
27
- * which is slower than direct S3-compatible API access. Create R2
28
- * S3-compatible credentials in the Cloudflare dashboard and pass them with
29
- * `r2Storage({ credentials })` instead.
30
- */
31
- interface R2WranglerStorageConfig {
32
- accountId: string;
33
- bucketName: string;
34
- /**
35
- * @deprecated This token keeps R2 access on the slower Wrangler CLI path.
36
- * Create R2 S3-compatible credentials in the Cloudflare dashboard and use
37
- * `credentials` instead.
38
- */
39
- cloudflareApiToken: string;
40
- /**
41
- * Base path where bundles will be stored in the bucket
42
- */
43
- basePath?: string;
44
- credentials?: never;
20
+ /** Required when this storage serves downloads through createHotUpdater. */
21
+ downloadUrlSigningKey?: string;
45
22
  }
46
23
  //#endregion
47
24
  //#region src/r2Storage.d.ts
48
- type R2StorageConfig = R2S3StorageConfig | R2WranglerStorageConfig;
49
- /**
50
- * Cloudflare R2 storage plugin for Hot Updater.
51
- */
52
- interface R2Storage {
53
- (config: R2S3StorageConfig, hooks?: StoragePluginHooks): () => UniversalStoragePlugin;
54
- /**
55
- * @deprecated `cloudflareApiToken` uses the Wrangler CLI for R2 operations,
56
- * which is slower than direct S3-compatible API access. Create R2
57
- * S3-compatible credentials in the Cloudflare dashboard and pass them with
58
- * `r2Storage({ credentials })` instead.
59
- */
60
- (config: R2WranglerStorageConfig, hooks?: StoragePluginHooks): () => UniversalStoragePlugin;
61
- }
62
- declare const r2Storage: R2Storage;
25
+ type R2StorageConfig = R2S3StorageConfig;
26
+ declare const r2Storage: (config: R2S3StorageConfig) => StoragePluginWith<"put" | "get" | "exists" | "delete">;
63
27
  //#endregion
64
- export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, type R2WranglerStorageConfig, d1Database, r2Storage };
28
+ export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };