alchemy 0.1.16 → 0.1.18

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 (250) hide show
  1. package/lib/$.d.ts +12 -0
  2. package/lib/$.d.ts.map +1 -0
  3. package/lib/$.js +42 -0
  4. package/lib/$.js.map +1 -0
  5. package/lib/alchemize.d.ts +47 -0
  6. package/lib/alchemize.d.ts.map +1 -0
  7. package/lib/alchemize.js +116 -0
  8. package/lib/alchemize.js.map +1 -0
  9. package/lib/apply.d.ts +23 -0
  10. package/lib/apply.d.ts.map +1 -1
  11. package/lib/apply.js +4 -0
  12. package/lib/apply.js.map +1 -1
  13. package/lib/aws/account-id.d.ts +5 -0
  14. package/lib/aws/account-id.d.ts.map +1 -0
  15. package/lib/aws/account-id.js +10 -0
  16. package/lib/aws/account-id.js.map +1 -0
  17. package/lib/aws/bucket.d.ts +21 -0
  18. package/lib/aws/bucket.d.ts.map +1 -0
  19. package/lib/aws/bucket.js +114 -0
  20. package/lib/aws/bucket.js.map +1 -0
  21. package/lib/aws/function.d.ts +53 -0
  22. package/lib/aws/function.d.ts.map +1 -0
  23. package/lib/aws/function.js +195 -0
  24. package/lib/aws/function.js.map +1 -0
  25. package/lib/aws/index.d.ts +9 -0
  26. package/lib/aws/index.d.ts.map +1 -0
  27. package/lib/aws/index.js +9 -0
  28. package/lib/aws/index.js.map +1 -0
  29. package/lib/aws/oidc/github-oidc-provider.d.ts +11 -0
  30. package/lib/aws/oidc/github-oidc-provider.d.ts.map +1 -0
  31. package/lib/aws/oidc/github-oidc-provider.js +22 -0
  32. package/lib/aws/oidc/github-oidc-provider.js.map +1 -0
  33. package/lib/aws/oidc/index.d.ts +3 -0
  34. package/lib/aws/oidc/index.d.ts.map +1 -0
  35. package/lib/aws/oidc/index.js +3 -0
  36. package/lib/aws/oidc/index.js.map +1 -0
  37. package/lib/aws/oidc/oidc-provider.d.ts +60 -0
  38. package/lib/aws/oidc/oidc-provider.d.ts.map +1 -0
  39. package/lib/aws/oidc/oidc-provider.js +140 -0
  40. package/lib/aws/oidc/oidc-provider.js.map +1 -0
  41. package/lib/aws/policy.d.ts +46 -0
  42. package/lib/aws/policy.d.ts.map +1 -0
  43. package/lib/aws/policy.js +139 -0
  44. package/lib/aws/policy.js.map +1 -0
  45. package/lib/aws/queue.d.ts +62 -0
  46. package/lib/aws/queue.d.ts.map +1 -0
  47. package/lib/aws/queue.js +167 -0
  48. package/lib/aws/queue.js.map +1 -0
  49. package/lib/aws/role.d.ts +27 -0
  50. package/lib/aws/role.d.ts.map +1 -0
  51. package/lib/aws/role.js +197 -0
  52. package/lib/aws/role.js.map +1 -0
  53. package/lib/aws/ses.d.ts +75 -0
  54. package/lib/aws/ses.d.ts.map +1 -0
  55. package/lib/aws/ses.js +189 -0
  56. package/lib/aws/ses.js.map +1 -0
  57. package/lib/aws/table.d.ts +26 -0
  58. package/lib/aws/table.d.ts.map +1 -0
  59. package/lib/aws/table.js +154 -0
  60. package/lib/aws/table.js.map +1 -0
  61. package/lib/cloudflare/api.d.ts +88 -0
  62. package/lib/cloudflare/api.d.ts.map +1 -0
  63. package/lib/cloudflare/api.js +184 -0
  64. package/lib/cloudflare/api.js.map +1 -0
  65. package/lib/cloudflare/asset-manifest.d.ts +15 -0
  66. package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
  67. package/lib/cloudflare/asset-manifest.js +2 -0
  68. package/lib/cloudflare/asset-manifest.js.map +1 -0
  69. package/lib/cloudflare/auth.d.ts +52 -0
  70. package/lib/cloudflare/auth.d.ts.map +1 -0
  71. package/lib/cloudflare/auth.js +114 -0
  72. package/lib/cloudflare/auth.js.map +1 -0
  73. package/lib/cloudflare/bindings.d.ts +261 -0
  74. package/lib/cloudflare/bindings.d.ts.map +1 -0
  75. package/lib/cloudflare/bindings.js +2 -0
  76. package/lib/cloudflare/bindings.js.map +1 -0
  77. package/lib/cloudflare/bound.d.ts +8 -0
  78. package/lib/cloudflare/bound.d.ts.map +1 -0
  79. package/lib/cloudflare/bound.js +2 -0
  80. package/lib/cloudflare/bound.js.map +1 -0
  81. package/lib/cloudflare/bucket.d.ts +54 -0
  82. package/lib/cloudflare/bucket.d.ts.map +1 -0
  83. package/lib/cloudflare/bucket.js +120 -0
  84. package/lib/cloudflare/bucket.js.map +1 -0
  85. package/lib/cloudflare/durable-object-namespace.d.ts +20 -0
  86. package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -0
  87. package/lib/cloudflare/durable-object-namespace.js +21 -0
  88. package/lib/cloudflare/durable-object-namespace.js.map +1 -0
  89. package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
  90. package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
  91. package/lib/cloudflare/generate-asset-manifest.js +69 -0
  92. package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
  93. package/lib/cloudflare/index.d.ts +8 -0
  94. package/lib/cloudflare/index.d.ts.map +1 -0
  95. package/lib/cloudflare/index.js +8 -0
  96. package/lib/cloudflare/index.js.map +1 -0
  97. package/lib/cloudflare/kv-namespace.d.ts +64 -0
  98. package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
  99. package/lib/cloudflare/kv-namespace.js +114 -0
  100. package/lib/cloudflare/kv-namespace.js.map +1 -0
  101. package/lib/cloudflare/state.d.ts +83 -0
  102. package/lib/cloudflare/state.d.ts.map +1 -0
  103. package/lib/cloudflare/state.js +109 -0
  104. package/lib/cloudflare/state.js.map +1 -0
  105. package/lib/cloudflare/static-site-router.d.ts +19 -0
  106. package/lib/cloudflare/static-site-router.d.ts.map +1 -0
  107. package/lib/cloudflare/static-site-router.js +110 -0
  108. package/lib/cloudflare/static-site-router.js.map +1 -0
  109. package/lib/cloudflare/static-site.d.ts +166 -0
  110. package/lib/cloudflare/static-site.d.ts.map +1 -0
  111. package/lib/cloudflare/static-site.js +161 -0
  112. package/lib/cloudflare/static-site.js.map +1 -0
  113. package/lib/cloudflare/types.d.ts +52 -0
  114. package/lib/cloudflare/types.d.ts.map +1 -0
  115. package/lib/cloudflare/types.js +21 -0
  116. package/lib/cloudflare/types.js.map +1 -0
  117. package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
  118. package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
  119. package/lib/cloudflare/upload-asset-manifest.js +55 -0
  120. package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
  121. package/lib/cloudflare/worker-metadata.d.ts +130 -0
  122. package/lib/cloudflare/worker-metadata.d.ts.map +1 -0
  123. package/lib/cloudflare/worker-metadata.js +2 -0
  124. package/lib/cloudflare/worker-metadata.js.map +1 -0
  125. package/lib/cloudflare/worker-migration.d.ts +110 -0
  126. package/lib/cloudflare/worker-migration.d.ts.map +1 -0
  127. package/lib/cloudflare/worker-migration.js +11 -0
  128. package/lib/cloudflare/worker-migration.js.map +1 -0
  129. package/lib/cloudflare/worker.d.ts +114 -0
  130. package/lib/cloudflare/worker.d.ts.map +1 -0
  131. package/lib/cloudflare/worker.js +419 -0
  132. package/lib/cloudflare/worker.js.map +1 -0
  133. package/lib/destroy.d.ts +19 -0
  134. package/lib/encrypt.d.ts +17 -0
  135. package/lib/encrypt.d.ts.map +1 -0
  136. package/lib/encrypt.js +45 -0
  137. package/lib/encrypt.js.map +1 -0
  138. package/lib/error.d.ts +2 -0
  139. package/lib/error.d.ts.map +1 -0
  140. package/lib/error.js +13 -0
  141. package/lib/error.js.map +1 -0
  142. package/lib/esbuild.d.ts +152 -0
  143. package/lib/esbuild.d.ts.map +1 -0
  144. package/lib/esbuild.js +67 -0
  145. package/lib/esbuild.js.map +1 -0
  146. package/lib/fs.d.ts +12 -0
  147. package/lib/fs.d.ts.map +1 -0
  148. package/lib/fs.js +41 -0
  149. package/lib/fs.js.map +1 -0
  150. package/lib/github/client.d.ts +34 -0
  151. package/lib/github/client.d.ts.map +1 -0
  152. package/lib/github/client.js +91 -0
  153. package/lib/github/client.js.map +1 -0
  154. package/lib/github/index.d.ts +2 -0
  155. package/lib/github/index.d.ts.map +1 -0
  156. package/lib/github/index.js +2 -0
  157. package/lib/github/index.js.map +1 -0
  158. package/lib/github/secret.d.ts +47 -0
  159. package/lib/github/secret.d.ts.map +1 -0
  160. package/lib/github/secret.js +99 -0
  161. package/lib/github/secret.js.map +1 -0
  162. package/lib/global.d.ts +16 -0
  163. package/lib/global.d.ts.map +1 -0
  164. package/lib/global.js +42 -0
  165. package/lib/global.js.map +1 -0
  166. package/lib/index.d.ts +11 -0
  167. package/lib/index.d.ts.map +1 -0
  168. package/lib/index.js +10 -0
  169. package/lib/index.js.map +1 -0
  170. package/lib/input.d.ts +7 -0
  171. package/lib/input.d.ts.map +1 -0
  172. package/lib/input.js +2 -0
  173. package/lib/input.js.map +1 -0
  174. package/lib/main.d.ts +3 -0
  175. package/lib/main.d.ts.map +1 -0
  176. package/lib/main.js +32 -0
  177. package/lib/main.js.map +1 -0
  178. package/lib/output.d.ts +25 -0
  179. package/lib/output.d.ts.map +1 -0
  180. package/lib/output.js +23 -0
  181. package/lib/output.js.map +1 -0
  182. package/lib/print.d.ts +7 -0
  183. package/lib/print.d.ts.map +1 -0
  184. package/lib/print.js +10 -0
  185. package/lib/print.js.map +1 -0
  186. package/lib/resource.d.ts +71 -0
  187. package/lib/resource.d.ts.map +1 -0
  188. package/lib/resource.js +276 -0
  189. package/lib/resource.js.map +1 -0
  190. package/lib/scope.d.ts +18 -0
  191. package/lib/scope.d.ts.map +1 -0
  192. package/lib/scope.js +30 -0
  193. package/lib/scope.js.map +1 -0
  194. package/lib/secret.d.ts +12 -0
  195. package/lib/secret.d.ts.map +1 -0
  196. package/lib/secret.js +30 -0
  197. package/lib/secret.js.map +1 -0
  198. package/lib/serde.d.ts +3 -0
  199. package/lib/serde.d.ts.map +1 -0
  200. package/lib/serde.js +37 -0
  201. package/lib/serde.js.map +1 -0
  202. package/lib/slug.d.ts +2 -0
  203. package/lib/slug.d.ts.map +1 -0
  204. package/lib/slug.js +4 -0
  205. package/lib/slug.js.map +1 -0
  206. package/lib/state.d.ts +40 -0
  207. package/lib/state.d.ts.map +1 -0
  208. package/lib/state.js +74 -0
  209. package/lib/state.js.map +1 -0
  210. package/lib/stripe/index.d.ts +4 -0
  211. package/lib/stripe/index.d.ts.map +1 -0
  212. package/lib/stripe/index.js +4 -0
  213. package/lib/stripe/index.js.map +1 -0
  214. package/lib/stripe/price.d.ts +109 -0
  215. package/lib/stripe/price.d.ts.map +1 -0
  216. package/lib/stripe/price.js +112 -0
  217. package/lib/stripe/price.js.map +1 -0
  218. package/lib/stripe/product.d.ts +86 -0
  219. package/lib/stripe/product.d.ts.map +1 -0
  220. package/lib/stripe/product.js +90 -0
  221. package/lib/stripe/product.js.map +1 -0
  222. package/lib/stripe/webhook.d.ts +73 -0
  223. package/lib/stripe/webhook.d.ts.map +1 -0
  224. package/lib/stripe/webhook.js +94 -0
  225. package/lib/stripe/webhook.js.map +1 -0
  226. package/lib/utils/content-type.d.ts +8 -0
  227. package/lib/utils/content-type.d.ts.map +1 -0
  228. package/lib/utils/content-type.js +41 -0
  229. package/lib/utils/content-type.js.map +1 -0
  230. package/lib/utils/retry.d.ts +13 -0
  231. package/lib/utils/retry.d.ts.map +1 -0
  232. package/lib/utils/retry.js +32 -0
  233. package/lib/utils/retry.js.map +1 -0
  234. package/package.json +3 -6
  235. package/src/alchemize.ts +9 -0
  236. package/src/apply.ts +3 -0
  237. package/src/cloudflare/bindings.ts +9 -1
  238. package/src/cloudflare/bound.ts +18 -0
  239. package/src/cloudflare/bucket.ts +240 -0
  240. package/src/cloudflare/index.ts +1 -0
  241. package/src/cloudflare/static-site.ts +14 -2
  242. package/src/cloudflare/worker.ts +84 -59
  243. package/src/encrypt.ts +79 -0
  244. package/src/github/secret.ts +34 -33
  245. package/src/index.ts +1 -0
  246. package/src/input.ts +13 -10
  247. package/src/output.ts +13 -9
  248. package/src/secret.ts +41 -0
  249. package/src/serde.ts +46 -0
  250. package/src/state.ts +3 -2
@@ -0,0 +1,8 @@
1
+ import type { Secret } from "../secret";
2
+ import type { Binding } from "./bindings";
3
+ import type { R2Bucket as _R2Bucket } from "./bucket";
4
+ import type { DurableObjectNamespace as _DurableObjectNamespace } from "./durable-object-namespace";
5
+ import type { KVNamespace as _KVNamespace } from "./kv-namespace";
6
+ import type { Worker as _Worker } from "./worker";
7
+ export type Bound<T extends Binding> = T extends _DurableObjectNamespace ? DurableObjectNamespace : T extends _KVNamespace ? KVNamespace : T extends _Worker ? Worker : T extends _R2Bucket ? R2Bucket : T extends Secret ? string : never;
8
+ //# sourceMappingURL=bound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bound.d.ts","sourceRoot":"","sources":["../../src/cloudflare/bound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,uBAAuB,GACpE,sBAAsB,GACtB,CAAC,SAAS,YAAY,GACpB,WAAW,GACX,CAAC,SAAS,OAAO,GACf,MAAM,GACN,CAAC,SAAS,SAAS,GACjB,QAAQ,GACR,CAAC,SAAS,MAAM,GACd,MAAM,GACN,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bound.js","sourceRoot":"","sources":["../../src/cloudflare/bound.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import type { Resolved } from "../output";
2
+ /**
3
+ * Properties for creating or updating an R2 Bucket
4
+ */
5
+ export interface BucketProps {
6
+ /**
7
+ * Name of the bucket
8
+ * Names can only contain lowercase letters (a-z), numbers (0-9), and hyphens (-)
9
+ * Cannot begin or end with a hyphen
10
+ */
11
+ name?: string;
12
+ /**
13
+ * Optional location hint for the bucket
14
+ * Indicates the primary geographical location data will be accessed from
15
+ */
16
+ locationHint?: string;
17
+ /**
18
+ * Optional jurisdiction for the bucket
19
+ * Determines the regulatory jurisdiction the bucket data falls under
20
+ */
21
+ jurisdiction?: "default" | "eu" | "fedramp";
22
+ /**
23
+ * Whether to allow public access through the r2.dev subdomain
24
+ * Only for development purposes - use custom domains for production
25
+ */
26
+ allowPublicAccess?: boolean;
27
+ }
28
+ /**
29
+ * Output returned after R2 Bucket creation/update
30
+ */
31
+ export interface BucketOutput extends BucketProps {
32
+ /**
33
+ * The ID of the bucket (same as name)
34
+ */
35
+ id: string;
36
+ /**
37
+ * Location of the bucket
38
+ */
39
+ location: string;
40
+ /**
41
+ * Time at which the bucket was created (Unix timestamp in seconds)
42
+ */
43
+ creationDate: number;
44
+ /**
45
+ * Resource type identifier
46
+ */
47
+ type: "r2_bucket";
48
+ }
49
+ export declare function isBucket(resource: any): resource is Resolved<R2Bucket>;
50
+ declare const R2Bucket_base: import("../resource").Provider<"cloudflare::R2Bucket", [props: BucketProps], BucketOutput>;
51
+ export declare class R2Bucket extends R2Bucket_base {
52
+ }
53
+ export {};
54
+ //# sourceMappingURL=bucket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../src/cloudflare/bucket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAE5C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;CACnB;AAgBD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAItE;;AAED,qBAAa,QAAS,SAAQ,aAmI7B;CAAG"}
@@ -0,0 +1,120 @@
1
+ import { Resource } from "../resource";
2
+ import { createCloudflareApi } from "./api";
3
+ export function isBucket(resource) {
4
+ return (resource && typeof resource === "object" && resource.id && resource.location);
5
+ }
6
+ export class R2Bucket extends Resource("cloudflare::R2Bucket", async (ctx, props) => {
7
+ // Create Cloudflare API client with automatic account discovery
8
+ const api = await createCloudflareApi();
9
+ // Resource ID defaults to bucket name if provided
10
+ const bucketName = props.name || ctx.resourceID;
11
+ if (ctx.event === "delete") {
12
+ if (ctx.output?.id) {
13
+ // Delete R2 bucket
14
+ const headers = {};
15
+ if (props.jurisdiction && props.jurisdiction !== "default") {
16
+ headers["cf-r2-jurisdiction"] = props.jurisdiction;
17
+ }
18
+ const deleteResponse = await api.delete(`/accounts/${api.accountId}/r2/buckets/${ctx.output.id}`, { headers });
19
+ if (!deleteResponse.ok && deleteResponse.status !== 404) {
20
+ const errorData = await deleteResponse.json().catch(() => ({
21
+ errors: [{ message: deleteResponse.statusText }],
22
+ }));
23
+ throw new Error(`Error deleting R2 bucket '${bucketName}': ${errorData.errors?.[0]?.message || deleteResponse.statusText}`);
24
+ }
25
+ }
26
+ // Return void (a deleted bucket has no content)
27
+ return;
28
+ }
29
+ else {
30
+ try {
31
+ let bucketOutput;
32
+ if (ctx.event === "update" && ctx.output?.id) {
33
+ // Get bucket details to verify it exists
34
+ const headers = {};
35
+ if (props.jurisdiction && props.jurisdiction !== "default") {
36
+ headers["cf-r2-jurisdiction"] = props.jurisdiction;
37
+ }
38
+ const getResponse = await api.get(`/accounts/${api.accountId}/r2/buckets/${bucketName}`, { headers });
39
+ if (!getResponse.ok) {
40
+ const errorData = await getResponse.json().catch(() => ({
41
+ errors: [{ message: getResponse.statusText }],
42
+ }));
43
+ throw new Error(`Error getting R2 bucket '${bucketName}': ${errorData.errors?.[0]?.message || getResponse.statusText}`);
44
+ }
45
+ const result = (await getResponse.json());
46
+ bucketOutput = {
47
+ id: result.result.name,
48
+ name: result.result.name,
49
+ location: result.result.location || "default",
50
+ creationDate: Math.floor(new Date(result.result.creation_date).getTime() / 1000),
51
+ jurisdiction: props.jurisdiction || "default",
52
+ type: "r2_bucket",
53
+ };
54
+ // Update public access setting if it has changed
55
+ if (props.allowPublicAccess !== undefined) {
56
+ await updatePublicAccess(api, bucketName, props.allowPublicAccess);
57
+ }
58
+ }
59
+ else {
60
+ // Create new R2 bucket
61
+ const createPayload = {
62
+ name: bucketName,
63
+ };
64
+ if (props.locationHint) {
65
+ createPayload.location_hint = props.locationHint;
66
+ }
67
+ const headers = {};
68
+ if (props.jurisdiction && props.jurisdiction !== "default") {
69
+ headers["cf-r2-jurisdiction"] = props.jurisdiction;
70
+ }
71
+ const createResponse = await api.post(`/accounts/${api.accountId}/r2/buckets`, createPayload, { headers });
72
+ if (!createResponse.ok) {
73
+ const errorData = await createResponse.json().catch(() => ({
74
+ errors: [{ message: createResponse.statusText }],
75
+ }));
76
+ throw new Error(`Error creating R2 bucket '${bucketName}': ${errorData.errors?.[0]?.message || createResponse.statusText}`);
77
+ }
78
+ const result = (await createResponse.json());
79
+ bucketOutput = {
80
+ id: result.result.name,
81
+ name: result.result.name,
82
+ location: result.result.location || "default",
83
+ creationDate: Math.floor(new Date(result.result.creation_date).getTime() / 1000),
84
+ jurisdiction: props.jurisdiction || "default",
85
+ type: "r2_bucket",
86
+ };
87
+ // Set public access if requested
88
+ if (props.allowPublicAccess) {
89
+ await updatePublicAccess(api, bucketName, true);
90
+ }
91
+ }
92
+ return bucketOutput;
93
+ }
94
+ catch (error) {
95
+ console.error("Error creating/updating R2 bucket:", error);
96
+ throw error;
97
+ }
98
+ }
99
+ }) {
100
+ }
101
+ /**
102
+ * Helper function to update the public access setting for a bucket
103
+ */
104
+ async function updatePublicAccess(api, bucketName, allowPublicAccess) {
105
+ try {
106
+ const response = await api.put(`/accounts/${api.accountId}/r2/buckets/${bucketName}/domains/managed`, {
107
+ enabled: allowPublicAccess,
108
+ });
109
+ if (!response.ok) {
110
+ const errorData = await response.json().catch(() => ({
111
+ errors: [{ message: response.statusText }],
112
+ }));
113
+ throw new Error(`Error updating R2 bucket public access: ${errorData.errors?.[0]?.message || response.statusText}`);
114
+ }
115
+ }
116
+ catch (error) {
117
+ console.warn("Could not set public access:", error);
118
+ }
119
+ }
120
+ //# sourceMappingURL=bucket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucket.js","sourceRoot":"","sources":["../../src/cloudflare/bucket.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAuE5C,MAAM,UAAU,QAAQ,CAAC,QAAa;IACpC,OAAO,CACL,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,QAAQ,CAC7E,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,QAAQ,CACpC,sBAAsB,EACtB,KAAK,EAAE,GAA0B,EAAE,KAAkB,EAAE,EAAE;IACvD,gEAAgE;IAChE,MAAM,GAAG,GAAG,MAAM,mBAAmB,EAAE,CAA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C,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,CACnG,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Resolved } from "../output";
2
+ export interface DurableObjectNamespaceInput {
3
+ className: string;
4
+ scriptName?: string | undefined;
5
+ environment?: string | undefined;
6
+ sqlite?: boolean | undefined;
7
+ namespaceId?: string | undefined;
8
+ }
9
+ export declare function isDurableObjectNamespace(binding: any): binding is Resolved<DurableObjectNamespace>;
10
+ export declare class DurableObjectNamespace implements DurableObjectNamespaceInput {
11
+ readonly id: string;
12
+ readonly type: "durable_object_namespace";
13
+ readonly className: string;
14
+ readonly scriptName?: string | undefined;
15
+ readonly environment?: string | undefined;
16
+ readonly sqlite?: boolean | undefined;
17
+ readonly namespaceId?: string | undefined;
18
+ constructor(id: string, input: DurableObjectNamespaceInput);
19
+ }
20
+ //# sourceMappingURL=durable-object-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-object-namespace.d.ts","sourceRoot":"","sources":["../../src/cloudflare/durable-object-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,GAAG,GACX,OAAO,IAAI,QAAQ,CAAC,sBAAsB,CAAC,CAI7C;AAED,qBAAa,sBAAuB,YAAW,2BAA2B;aAUtD,EAAE,EAAE,MAAM;IAT5B,SAAgB,IAAI,EAAG,0BAA0B,CAAU;IAE3D,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,SAAgB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,SAAgB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7C,SAAgB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAG/B,EAAE,EAAE,MAAM,EAC1B,KAAK,EAAE,2BAA2B;CAOrC"}
@@ -0,0 +1,21 @@
1
+ export function isDurableObjectNamespace(binding) {
2
+ return (typeof binding === "object" && binding.type === "durable_object_namespace");
3
+ }
4
+ export class DurableObjectNamespace {
5
+ id;
6
+ type = "durable_object_namespace";
7
+ // alias for bindingName to be consistent with other bindings
8
+ className;
9
+ scriptName;
10
+ environment;
11
+ sqlite;
12
+ namespaceId;
13
+ constructor(id, input) {
14
+ this.id = id;
15
+ this.className = input.className;
16
+ this.scriptName = input.scriptName;
17
+ this.environment = input.environment;
18
+ this.sqlite = input.sqlite;
19
+ }
20
+ }
21
+ //# sourceMappingURL=durable-object-namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-object-namespace.js","sourceRoot":"","sources":["../../src/cloudflare/durable-object-namespace.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,wBAAwB,CACtC,OAAY;IAEZ,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,0BAA0B,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,sBAAsB;IAUf;IATF,IAAI,GAAG,0BAAmC,CAAC;IAC3D,6DAA6D;IAC7C,SAAS,CAAS;IAClB,UAAU,CAAsB;IAChC,WAAW,CAAsB;IACjC,MAAM,CAAuB;IAC7B,WAAW,CAAsB;IAEjD,YACkB,EAAU,EAC1B,KAAkC;QADlB,OAAE,GAAF,EAAE,CAAQ;QAG1B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import type { AssetManifest, FileOption } from "./asset-manifest";
2
+ export declare function generateAssetManifest(dir: string, fileOptions?: FileOption[]): Promise<AssetManifest>;
3
+ //# sourceMappingURL=generate-asset-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-asset-manifest.d.ts","sourceRoot":"","sources":["../../src/cloudflare/generate-asset-manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EAEb,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,WAAW,GAAE,UAAU,EAStB,GACA,OAAO,CAAC,aAAa,CAAC,CAqExB"}
@@ -0,0 +1,69 @@
1
+ import crypto from "crypto";
2
+ import { promises as fs } from "fs";
3
+ import { glob } from "glob";
4
+ import path from "path";
5
+ import { getContentType } from "../utils/content-type";
6
+ export async function generateAssetManifest(dir, fileOptions = [
7
+ {
8
+ files: "**",
9
+ cacheControl: "max-age=0,no-cache,no-store,must-revalidate",
10
+ },
11
+ {
12
+ files: ["**/*.js", "**/*.css"],
13
+ cacheControl: "max-age=31536000,public,immutable",
14
+ },
15
+ ]) {
16
+ // First, collect all file info based on fileOptions (reversed to prioritize later rules)
17
+ const fileInfos = [];
18
+ const filesProcessed = new Set();
19
+ // Process file options in reverse order (later rules override earlier ones)
20
+ // Use for...of to maintain order but allow await inside the loop
21
+ const reversedOptions = [...fileOptions].reverse();
22
+ for (const fileOption of reversedOptions) {
23
+ const patterns = Array.isArray(fileOption.files)
24
+ ? fileOption.files
25
+ : [fileOption.files];
26
+ // Get all files matching the pattern
27
+ const files = (await Promise.all(patterns.map(async (p) => {
28
+ // Use glob as async function instead of globSync
29
+ return glob(p, {
30
+ cwd: path.resolve(dir),
31
+ nodir: true,
32
+ dot: true,
33
+ ignore: [
34
+ ".git/**",
35
+ "node_modules/**",
36
+ ...(typeof fileOption.ignore === "string"
37
+ ? [fileOption.ignore]
38
+ : (fileOption.ignore ?? [])),
39
+ ],
40
+ });
41
+ })))
42
+ .flat()
43
+ .filter((file) => !filesProcessed.has(file));
44
+ // Add files to processed set
45
+ for (const file of files) {
46
+ filesProcessed.add(file);
47
+ fileInfos.push({
48
+ file,
49
+ cacheControl: fileOption.cacheControl,
50
+ contentType: fileOption.contentType,
51
+ });
52
+ }
53
+ }
54
+ // Process all files in parallel
55
+ const manifestEntries = await Promise.all(fileInfos.map(async ({ file, cacheControl, contentType }) => {
56
+ const source = path.resolve(dir, file);
57
+ const content = await fs.readFile(source);
58
+ const hash = crypto.createHash("sha256").update(content).digest("hex");
59
+ return {
60
+ source,
61
+ key: file,
62
+ hash,
63
+ cacheControl,
64
+ contentType: contentType ?? getContentType(file),
65
+ };
66
+ }));
67
+ return manifestEntries;
68
+ }
69
+ //# sourceMappingURL=generate-asset-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-asset-manifest.js","sourceRoot":"","sources":["../../src/cloudflare/generate-asset-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAOvD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC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AC,IAAI,CAAC,CAAC,CAAC;QAE/C,6BAA6B;QAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACzB,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI;gBACJ,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,WAAW,EAAE,UAAU,CAAC,WAAW;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CACvC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,OAAO;YACL,MAAM;YACN,GAAG,EAAE,IAAI;YACT,IAAI;YACJ,YAAY;YACZ,WAAW,EAAE,WAAW,IAAI,cAAc,CAAC,IAAI,CAAC;SACpB,CAAC;IACjC,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from "./bindings";
2
+ export * from "./bucket";
3
+ export * from "./durable-object-namespace";
4
+ export * from "./kv-namespace";
5
+ export * from "./state";
6
+ export * from "./static-site";
7
+ export * from "./worker";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from "./bindings";
2
+ export * from "./bucket";
3
+ export * from "./durable-object-namespace";
4
+ export * from "./kv-namespace";
5
+ export * from "./state";
6
+ export * from "./static-site";
7
+ export * from "./worker";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { Resolved } from "../output";
2
+ /**
3
+ * Properties for creating or updating a KV Namespace
4
+ */
5
+ export interface KVNamespaceProps {
6
+ /**
7
+ * Title of the namespace
8
+ */
9
+ title: string;
10
+ /**
11
+ * KV pairs to store in the namespace
12
+ * Only used for initial setup or updates
13
+ */
14
+ values?: KVPair[];
15
+ }
16
+ /**
17
+ * Key-value pair to store in a KV Namespace
18
+ */
19
+ export interface KVPair {
20
+ /**
21
+ * Key name
22
+ */
23
+ key: string;
24
+ /**
25
+ * Value to store (string or JSON object)
26
+ */
27
+ value: string | object;
28
+ /**
29
+ * Optional expiration in seconds from now
30
+ */
31
+ expiration?: number;
32
+ /**
33
+ * Optional expiration timestamp in seconds since epoch
34
+ */
35
+ expirationTtl?: number;
36
+ /**
37
+ * Optional metadata for the key
38
+ */
39
+ metadata?: any;
40
+ }
41
+ /**
42
+ * Output returned after KV Namespace creation/update
43
+ */
44
+ export interface KVNamespaceOutput extends KVNamespaceProps {
45
+ type: "kv_namespace";
46
+ /**
47
+ * The ID of the namespace
48
+ */
49
+ id: string;
50
+ /**
51
+ * Time at which the namespace was created
52
+ */
53
+ createdAt: number;
54
+ /**
55
+ * Time at which the namespace was last modified
56
+ */
57
+ modifiedAt: number;
58
+ }
59
+ export declare function isKVNamespace(resource: any): resource is Resolved<KVNamespace>;
60
+ declare const KVNamespace_base: import("../resource").Provider<"cloudflare::KVNamespace", [props: KVNamespaceProps], KVNamespaceOutput>;
61
+ export declare class KVNamespace extends KVNamespace_base {
62
+ }
63
+ export {};
64
+ //# sourceMappingURL=kv-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv-namespace.d.ts","sourceRoot":"","sources":["../../src/cloudflare/kv-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK1C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,IAAI,EAAE,cAAc,CAAC;IACrB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,GACZ,QAAQ,IAAI,QAAQ,CAAC,WAAW,CAAC,CAInC;;AAED,qBAAa,WAAY,SAAQ,gBAgJhC;CAAG"}
@@ -0,0 +1,114 @@
1
+ import { Resource } from "../resource";
2
+ import { withExponentialBackoff } from "../utils/retry";
3
+ import { createCloudflareApi } from "./api";
4
+ export function isKVNamespace(resource) {
5
+ return (resource && typeof resource === "object" && resource.type === "kv_namespace");
6
+ }
7
+ export class KVNamespace extends Resource("cloudflare::KVNamespace", async (ctx, props) => {
8
+ // Create Cloudflare API client with automatic account discovery
9
+ const api = await createCloudflareApi();
10
+ if (ctx.event === "delete") {
11
+ // For delete operations, we need to check if the namespace ID exists in the output
12
+ const namespaceId = ctx.output?.id;
13
+ if (namespaceId) {
14
+ // Delete KV namespace
15
+ const deleteResponse = await api.delete(`/accounts/${api.accountId}/storage/kv/namespaces/${namespaceId}`);
16
+ if (!deleteResponse.ok && deleteResponse.status !== 404) {
17
+ const errorData = await deleteResponse.json().catch(() => ({
18
+ errors: [{ message: deleteResponse.statusText }],
19
+ }));
20
+ throw new Error(`Error deleting KV namespace '${props.title}': ${errorData.errors?.[0]?.message || deleteResponse.statusText}`);
21
+ }
22
+ }
23
+ // Return minimal output for deleted state
24
+ return;
25
+ }
26
+ else {
27
+ // For create or update operations
28
+ // If ctx.event is "update", we expect ctx.output to exist
29
+ let namespaceId = ctx.event === "update" ? ctx.output?.id || "" : "";
30
+ let createdAt = ctx.event === "update"
31
+ ? ctx.output?.createdAt || Date.now()
32
+ : Date.now();
33
+ if (ctx.event === "update" && namespaceId) {
34
+ // Can't update a KV namespace title directly, just work with existing ID
35
+ }
36
+ else {
37
+ // Create new KV namespace
38
+ const createResponse = await api.post(`/accounts/${api.accountId}/storage/kv/namespaces`, {
39
+ title: props.title,
40
+ });
41
+ if (!createResponse.ok) {
42
+ const errorData = await createResponse.json().catch(() => ({
43
+ errors: [{ message: createResponse.statusText }],
44
+ }));
45
+ throw new Error(`Error creating KV namespace '${props.title}': ${errorData.errors?.[0]?.message || createResponse.statusText}`);
46
+ }
47
+ const createResult = await createResponse.json();
48
+ namespaceId = createResult.result.id;
49
+ createdAt = Date.now();
50
+ }
51
+ // Handle KV pairs if provided
52
+ if (props.values && props.values.length > 0 && namespaceId) {
53
+ // Process KV pairs in batches of 10000 (API limit)
54
+ const BATCH_SIZE = 10000;
55
+ for (let i = 0; i < props.values.length; i += BATCH_SIZE) {
56
+ const batch = props.values.slice(i, i + BATCH_SIZE);
57
+ const bulkPayload = batch.map((entry) => {
58
+ const item = {
59
+ key: entry.key,
60
+ value: typeof entry.value === "string"
61
+ ? entry.value
62
+ : JSON.stringify(entry.value),
63
+ };
64
+ if (entry.expiration) {
65
+ item.expiration = entry.expiration;
66
+ }
67
+ if (entry.expirationTtl) {
68
+ item.expiration_ttl = entry.expirationTtl;
69
+ }
70
+ if (entry.metadata) {
71
+ item.metadata = entry.metadata;
72
+ }
73
+ return item;
74
+ });
75
+ try {
76
+ await withExponentialBackoff(async () => {
77
+ const bulkResponse = await api.put(`/accounts/${api.accountId}/storage/kv/namespaces/${namespaceId}/bulk`, bulkPayload);
78
+ if (!bulkResponse.ok) {
79
+ const errorData = await bulkResponse
80
+ .json()
81
+ .catch(() => ({
82
+ errors: [{ message: bulkResponse.statusText }],
83
+ }));
84
+ const errorMessage = errorData.errors?.[0]?.message || bulkResponse.statusText;
85
+ // Throw error to trigger retry
86
+ throw new Error(`Error writing KV batch: ${errorMessage}`);
87
+ }
88
+ return bulkResponse;
89
+ }, (error) => {
90
+ // Retry on "namespace not found" errors as they're likely propagation delays
91
+ return error.message?.includes("not found");
92
+ }, 5, // 5 retry attempts
93
+ 1000);
94
+ }
95
+ catch (error) {
96
+ console.warn(error.message);
97
+ }
98
+ }
99
+ }
100
+ const now = Date.now();
101
+ // Construct the output
102
+ const output = {
103
+ type: "kv_namespace",
104
+ id: namespaceId,
105
+ title: props.title,
106
+ values: props.values,
107
+ createdAt: createdAt,
108
+ modifiedAt: now,
109
+ };
110
+ return output;
111
+ }
112
+ }) {
113
+ }
114
+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B,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,GAAG;SAChB,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC,CACF;CAAG"}
@@ -0,0 +1,83 @@
1
+ import type { KVNamespace } from "@cloudflare/workers-types";
2
+ import type { State, StateStore } from "../state";
3
+ /**
4
+ * Options for CloudflareStateStore
5
+ */
6
+ export interface CloudflareStateStoreOptions {
7
+ /**
8
+ * The prefix to use for keys in the KV namespace
9
+ * This allows multiple state stores to use the same KV namespace
10
+ */
11
+ prefix?: string;
12
+ }
13
+ /**
14
+ * State store implementation using Cloudflare KV Namespace
15
+ */
16
+ export declare class CloudflareStateStore implements StateStore {
17
+ private namespace;
18
+ private prefix;
19
+ /**
20
+ * Create a new CloudflareStateStore
21
+ *
22
+ * @param namespace The KV namespace to use for storing state
23
+ * @param options Options for the state store
24
+ */
25
+ constructor(namespace: KVNamespace, options?: CloudflareStateStoreOptions);
26
+ /**
27
+ * No initialization needed for KV namespaces as they are pre-provisioned
28
+ */
29
+ init(): Promise<void>;
30
+ /**
31
+ * KV namespaces cannot be deleted programmatically
32
+ */
33
+ deinit(): Promise<void>;
34
+ /**
35
+ * List all resources in the state store
36
+ */
37
+ list(): Promise<string[]>;
38
+ /**
39
+ * Count the number of items in the state store
40
+ */
41
+ count(): Promise<number>;
42
+ /**
43
+ * Get a state by key
44
+ *
45
+ * @param key The key to look up
46
+ * @returns The state or undefined if not found
47
+ */
48
+ get(key: string): Promise<State | undefined>;
49
+ /**
50
+ * Get multiple states by their keys
51
+ *
52
+ * @param ids Array of keys to fetch
53
+ * @returns Record mapping keys to their states
54
+ */
55
+ getBatch(ids: string[]): Promise<Record<string, State>>;
56
+ /**
57
+ * Get all states in the store
58
+ *
59
+ * @returns Record mapping all keys to their states
60
+ */
61
+ all(): Promise<Record<string, State>>;
62
+ /**
63
+ * Set a state for a key
64
+ *
65
+ * @param key The key to set
66
+ * @param value The state to store
67
+ */
68
+ set(key: string, value: State): Promise<void>;
69
+ /**
70
+ * Delete a state by key
71
+ *
72
+ * @param key The key to delete
73
+ */
74
+ delete(key: string): Promise<void>;
75
+ /**
76
+ * Get the namespaced key for storage
77
+ *
78
+ * @param key The original key
79
+ * @returns The key with prefix for use in the KV namespace
80
+ */
81
+ private getNamespacedKey;
82
+ }
83
+ //# sourceMappingURL=state.d.ts.map