@hot-updater/cloudflare 1.0.0-rc.5 → 1.0.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 (51) hide show
  1. package/dist/index.cjs +90 -924
  2. package/dist/index.d.cts +16 -6
  3. package/dist/index.d.mts +16 -6
  4. package/dist/index.mjs +91 -926
  5. package/dist/init/index.cjs +11777 -0
  6. package/dist/init/index.d.cts +5 -1
  7. package/dist/init/index.d.mts +5 -1
  8. package/dist/init/index.mjs +11771 -1
  9. package/dist/worker/index.cjs +117 -916
  10. package/dist/worker/index.d.cts +45 -11
  11. package/dist/worker/index.d.mts +45 -11
  12. package/dist/worker/index.mjs +118 -917
  13. package/package.json +9 -14
  14. package/sql/bundles.sql +121 -212
  15. package/src/d1Database.ts +58 -43
  16. package/src/d1Executor.ts +84 -0
  17. package/src/d1Schema.ts +26 -0
  18. package/src/presignR2Url.ts +103 -0
  19. package/src/r2S3Storage.ts +20 -19
  20. package/src/r2Storage.ts +5 -3
  21. package/src/r2WorkerStorage.ts +55 -17
  22. package/src/worker/d1Database.ts +21 -39
  23. package/worker/dist/README.md +1 -1
  24. package/worker/dist/index.js +9859 -5696
  25. package/worker/dist/index.js.map +4 -4
  26. package/worker/migrations/0001_hot-updater_1.0.0.sql +121 -222
  27. package/worker/src/index.ts +15 -9
  28. package/worker/wrangler.json +1 -0
  29. package/dist/iac/index.cjs +0 -12687
  30. package/dist/iac/index.d.cts +0 -5
  31. package/dist/iac/index.d.mts +0 -5
  32. package/dist/iac/index.mjs +0 -12679
  33. package/src/d1Database.spec.ts +0 -277
  34. package/src/d1Implementation.spec.ts +0 -342
  35. package/src/d1Implementation.ts +0 -781
  36. package/src/d1Query.spec.ts +0 -46
  37. package/src/d1Query.ts +0 -92
  38. package/src/d1Rows.spec.ts +0 -143
  39. package/src/d1Rows.ts +0 -357
  40. package/src/d1Sql.spec.ts +0 -30
  41. package/src/d1Sql.ts +0 -175
  42. package/src/r2Storage.spec.ts +0 -346
  43. package/src/r2WorkerStorage.spec.ts +0 -184
  44. package/src/utils/createWrangler.spec.ts +0 -75
  45. package/src/worker/d1Database.spec.ts +0 -69
  46. package/worker/src/databaseMigration.integration.spec.ts +0 -191
  47. package/worker/src/databasePlugins.integration.spec.ts +0 -326
  48. package/worker/src/index.integration.spec.ts +0 -190
  49. package/worker/src/insightsMovement.integration.spec.ts +0 -73
  50. package/worker/src/storagePlugin.integration.spec.ts +0 -59
  51. package/worker/src/testWorker.ts +0 -5
package/dist/index.d.cts CHANGED
@@ -1,12 +1,24 @@
1
- import { StoragePluginWith } from "@hot-updater/plugin-core";
1
+ import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
2
2
  import { S3ClientConfig } from "@aws-sdk/client-s3";
3
+ //#region src/d1Executor.d.ts
4
+ declare class D1ExecutionError extends Error {
5
+ readonly name = "D1ExecutionError";
6
+ constructor();
7
+ }
8
+ //#endregion
3
9
  //#region src/d1Database.d.ts
4
10
  interface D1DatabaseConfig {
5
11
  readonly databaseId: string;
6
12
  readonly accountId: string;
7
13
  readonly cloudflareApiToken: string;
8
14
  }
9
- declare const d1Database: (config: D1DatabaseConfig) => import("@hot-updater/plugin-core").DatabasePlugin;
15
+ /**
16
+ * Hot Updater's database on D1 through the Cloudflare REST API, for the CLI
17
+ * and console. `hot-updater db generate` writes a D1 migration of the built-in
18
+ * tables and the server's plugin tables to `migrations`, and
19
+ * `hot-updater db migrate` applies them through the API.
20
+ */
21
+ declare const d1Database: (config: D1DatabaseConfig) => ToolingDatabase;
10
22
  //#endregion
11
23
  //#region src/r2S3Storage.d.ts
12
24
  interface R2S3StorageConfig extends S3ClientConfig {
@@ -15,12 +27,10 @@ interface R2S3StorageConfig extends S3ClientConfig {
15
27
  credentials: NonNullable<S3ClientConfig["credentials"]>;
16
28
  /** Base path where bundles will be stored in the bucket. */
17
29
  basePath?: string;
18
- /** Required when this storage serves downloads through createHotUpdater. */
19
- downloadUrlSigningKey?: string;
20
30
  }
21
31
  //#endregion
22
32
  //#region src/r2Storage.d.ts
23
33
  type R2StorageConfig = R2S3StorageConfig;
24
- declare const r2Storage: (config: R2S3StorageConfig) => StoragePluginWith<"put" | "get" | "exists" | "delete">;
34
+ declare const r2Storage: (config: R2S3StorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
25
35
  //#endregion
26
- export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };
36
+ export { D1DatabaseConfig, D1ExecutionError, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,24 @@
1
- import { StoragePluginWith } from "@hot-updater/plugin-core";
1
+ import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
2
2
  import { S3ClientConfig } from "@aws-sdk/client-s3";
3
+ //#region src/d1Executor.d.ts
4
+ declare class D1ExecutionError extends Error {
5
+ readonly name = "D1ExecutionError";
6
+ constructor();
7
+ }
8
+ //#endregion
3
9
  //#region src/d1Database.d.ts
4
10
  interface D1DatabaseConfig {
5
11
  readonly databaseId: string;
6
12
  readonly accountId: string;
7
13
  readonly cloudflareApiToken: string;
8
14
  }
9
- declare const d1Database: (config: D1DatabaseConfig) => import("@hot-updater/plugin-core").DatabasePlugin;
15
+ /**
16
+ * Hot Updater's database on D1 through the Cloudflare REST API, for the CLI
17
+ * and console. `hot-updater db generate` writes a D1 migration of the built-in
18
+ * tables and the server's plugin tables to `migrations`, and
19
+ * `hot-updater db migrate` applies them through the API.
20
+ */
21
+ declare const d1Database: (config: D1DatabaseConfig) => ToolingDatabase;
10
22
  //#endregion
11
23
  //#region src/r2S3Storage.d.ts
12
24
  interface R2S3StorageConfig extends S3ClientConfig {
@@ -15,12 +27,10 @@ interface R2S3StorageConfig extends S3ClientConfig {
15
27
  credentials: NonNullable<S3ClientConfig["credentials"]>;
16
28
  /** Base path where bundles will be stored in the bucket. */
17
29
  basePath?: string;
18
- /** Required when this storage serves downloads through createHotUpdater. */
19
- downloadUrlSigningKey?: string;
20
30
  }
21
31
  //#endregion
22
32
  //#region src/r2Storage.d.ts
23
33
  type R2StorageConfig = R2S3StorageConfig;
24
- declare const r2Storage: (config: R2S3StorageConfig) => StoragePluginWith<"put" | "get" | "exists" | "delete">;
34
+ declare const r2Storage: (config: R2S3StorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
25
35
  //#endregion
26
- export { D1DatabaseConfig, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };
36
+ export { D1DatabaseConfig, D1ExecutionError, type R2S3StorageConfig, R2StorageConfig, d1Database, r2Storage };