alchemy 0.2.3 → 0.2.4

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 (138) hide show
  1. package/lib/ai/ark.d.ts +11 -0
  2. package/lib/ai/ark.js +86 -0
  3. package/lib/ai/client.d.ts +51 -0
  4. package/lib/ai/client.js +29 -0
  5. package/lib/ai/document.d.ts +97 -0
  6. package/lib/ai/document.js +82 -0
  7. package/lib/{docs → ai}/index.d.ts +1 -0
  8. package/lib/{docs → ai}/index.js +1 -0
  9. package/lib/ai/object.d.ts +101 -0
  10. package/lib/ai/object.js +70 -0
  11. package/lib/alchemy.d.ts +83 -2
  12. package/lib/alchemy.js +31 -3
  13. package/lib/aws/bucket.d.ts +87 -1
  14. package/lib/aws/bucket.js +48 -1
  15. package/lib/aws/function.d.ts +186 -1
  16. package/lib/aws/function.js +62 -8
  17. package/lib/aws/oidc/github-oidc-provider.d.ts +81 -0
  18. package/lib/aws/oidc/github-oidc-provider.js +68 -0
  19. package/lib/aws/oidc/oidc-provider.d.ts +14 -6
  20. package/lib/aws/oidc/oidc-provider.js +26 -5
  21. package/lib/aws/policy-attachment.d.ts +44 -1
  22. package/lib/aws/policy-attachment.js +31 -0
  23. package/lib/aws/policy.d.ts +160 -1
  24. package/lib/aws/policy.js +78 -0
  25. package/lib/aws/queue.d.ts +83 -1
  26. package/lib/aws/queue.js +39 -0
  27. package/lib/aws/role.d.ts +162 -1
  28. package/lib/aws/role.js +114 -0
  29. package/lib/aws/ses.d.ts +57 -2
  30. package/lib/aws/ses.js +42 -1
  31. package/lib/aws/table.d.ts +96 -1
  32. package/lib/aws/table.js +36 -0
  33. package/lib/cloudflare/asset-manifest.js +0 -1
  34. package/lib/cloudflare/bound.js +0 -1
  35. package/lib/cloudflare/bucket.d.ts +37 -1
  36. package/lib/cloudflare/bucket.js +36 -0
  37. package/lib/cloudflare/durable-object-namespace.d.ts +25 -0
  38. package/lib/cloudflare/durable-object-namespace.js +22 -0
  39. package/lib/cloudflare/kv-namespace.d.ts +37 -1
  40. package/lib/cloudflare/kv-namespace.js +36 -0
  41. package/lib/cloudflare/static-site.d.ts +53 -1
  42. package/lib/cloudflare/static-site.js +53 -1
  43. package/lib/cloudflare/worker-metadata.js +0 -1
  44. package/lib/cloudflare/worker.d.ts +64 -1
  45. package/lib/cloudflare/worker.js +63 -0
  46. package/lib/cloudflare/wrangler.json.d.ts +1 -1
  47. package/lib/cloudflare/zone-settings.js +0 -1
  48. package/lib/cloudflare/zone.d.ts +56 -1
  49. package/lib/cloudflare/zone.js +55 -0
  50. package/lib/destroy.js +1 -1
  51. package/lib/esbuild/bundle.d.ts +43 -4
  52. package/lib/esbuild/bundle.js +16 -0
  53. package/lib/fs/file-collection.d.ts +16 -0
  54. package/lib/fs/file-collection.js +6 -0
  55. package/lib/fs/file-ref.d.ts +14 -0
  56. package/lib/fs/file-ref.js +6 -0
  57. package/lib/fs/file.d.ts +71 -25
  58. package/lib/fs/file.js +20 -44
  59. package/lib/fs/folder.d.ts +37 -5
  60. package/lib/fs/folder.js +26 -2
  61. package/lib/fs/index.d.ts +6 -0
  62. package/lib/fs/index.js +6 -0
  63. package/lib/fs/json-file.d.ts +16 -0
  64. package/lib/fs/json-file.js +7 -0
  65. package/lib/fs/text-file.d.ts +12 -0
  66. package/lib/fs/text-file.js +7 -0
  67. package/lib/fs/typescript-file.d.ts +19 -0
  68. package/lib/fs/typescript-file.js +14 -0
  69. package/lib/fs/yaml-file.d.ts +19 -0
  70. package/lib/fs/yaml-file.js +8 -0
  71. package/lib/github/secret.d.ts +63 -2
  72. package/lib/github/secret.js +61 -1
  73. package/lib/internal/docs.d.ts +5 -0
  74. package/lib/internal/docs.js +324 -0
  75. package/lib/resource.d.ts +1 -1
  76. package/lib/secret.d.ts +67 -0
  77. package/lib/secret.js +67 -0
  78. package/lib/shadcn/component.d.ts +1 -1
  79. package/lib/stripe/price.d.ts +51 -1
  80. package/lib/stripe/price.js +50 -0
  81. package/lib/stripe/product.d.ts +39 -1
  82. package/lib/stripe/product.js +38 -0
  83. package/lib/stripe/webhook.d.ts +46 -1
  84. package/lib/stripe/webhook.js +45 -0
  85. package/lib/test/bun.d.ts +64 -0
  86. package/lib/test/bun.js +35 -3
  87. package/lib/util/serde.js +14 -0
  88. package/lib/vite/vite.d.ts +1 -1
  89. package/lib/vitepress/dependencies.d.ts +2 -6
  90. package/lib/vitepress/vitepress.d.ts +12 -1
  91. package/lib/vitepress/vitepress.js +29 -23
  92. package/package.json +8 -3
  93. package/src/ai/ark.ts +118 -0
  94. package/src/ai/client.ts +78 -0
  95. package/src/ai/document.ts +160 -0
  96. package/src/{docs → ai}/index.ts +1 -0
  97. package/src/ai/object.ts +149 -0
  98. package/src/alchemy.ts +88 -5
  99. package/src/aws/bucket.ts +111 -7
  100. package/src/aws/function.ts +231 -10
  101. package/src/aws/oidc/github-oidc-provider.ts +83 -0
  102. package/src/aws/oidc/oidc-provider.ts +39 -7
  103. package/src/aws/policy-attachment.ts +44 -1
  104. package/src/aws/policy.ts +177 -2
  105. package/src/aws/queue.ts +89 -0
  106. package/src/aws/role.ts +174 -2
  107. package/src/aws/ses.ts +56 -1
  108. package/src/aws/table.ts +103 -0
  109. package/src/cloudflare/bucket.ts +36 -0
  110. package/src/cloudflare/durable-object-namespace.ts +25 -0
  111. package/src/cloudflare/kv-namespace.ts +36 -0
  112. package/src/cloudflare/static-site.ts +53 -1
  113. package/src/cloudflare/worker.ts +63 -0
  114. package/src/cloudflare/zone.ts +55 -0
  115. package/src/destroy.ts +1 -1
  116. package/src/esbuild/bundle.ts +53 -3
  117. package/src/fs/file-collection.ts +24 -0
  118. package/src/fs/file-ref.ts +22 -0
  119. package/src/fs/file.ts +70 -77
  120. package/src/fs/folder.ts +44 -5
  121. package/src/fs/index.ts +6 -0
  122. package/src/fs/json-file.ts +23 -0
  123. package/src/fs/text-file.ts +19 -0
  124. package/src/fs/typescript-file.ts +36 -0
  125. package/src/fs/yaml-file.ts +26 -0
  126. package/src/github/secret.ts +65 -2
  127. package/src/internal/docs.ts +369 -0
  128. package/src/resource.ts +1 -1
  129. package/src/secret.ts +67 -0
  130. package/src/stripe/price.ts +50 -0
  131. package/src/stripe/product.ts +38 -0
  132. package/src/stripe/webhook.ts +45 -0
  133. package/src/test/bun.ts +83 -3
  134. package/src/util/serde.ts +17 -0
  135. package/src/vitepress/vitepress.ts +47 -26
  136. package/lib/docs/document.d.ts +0 -123
  137. package/lib/docs/document.js +0 -67
  138. package/src/docs/document.ts +0 -225
@@ -43,4 +43,40 @@ export interface R2Bucket extends Resource<"cloudflare::R2Bucket">, BucketProps
43
43
  */
44
44
  creationDate: number;
45
45
  }
46
- export declare const R2Bucket: ((this: Context<R2Bucket>, id: string, props: BucketProps) => Promise<R2Bucket>) | (((this: any, id: string, props?: BucketProps | undefined) => never) & (new (_: never) => never));
46
+ /**
47
+ * Creates and manages Cloudflare R2 Buckets for object storage.
48
+ *
49
+ * R2 Buckets provide S3-compatible object storage with automatic data replication
50
+ * across multiple regions for high availability and durability.
51
+ *
52
+ * @example
53
+ * // Create a basic R2 bucket with default settings
54
+ * const basicBucket = await R2Bucket("my-app-data", {
55
+ * name: "my-app-data"
56
+ * });
57
+ *
58
+ * @example
59
+ * // Create a bucket with location hint for optimal performance
60
+ * const euBucket = await R2Bucket("eu-user-data", {
61
+ * name: "eu-user-data",
62
+ * locationHint: "eu",
63
+ * jurisdiction: "eu"
64
+ * });
65
+ *
66
+ * @example
67
+ * // Create a development bucket with public access enabled
68
+ * const publicBucket = await R2Bucket("public-assets", {
69
+ * name: "public-assets",
70
+ * allowPublicAccess: true
71
+ * });
72
+ *
73
+ * @example
74
+ * // Create a FedRAMP compliant bucket for government workloads
75
+ * const fedRampBucket = await R2Bucket("gov-data", {
76
+ * name: "gov-data",
77
+ * jurisdiction: "fedramp"
78
+ * });
79
+ *
80
+ * @see https://developers.cloudflare.com/r2/buckets/
81
+ */
82
+ export declare const R2Bucket: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<R2Bucket>, id: string, props: BucketProps) => Promise<R2Bucket>);
@@ -1,5 +1,41 @@
1
1
  import { Resource } from "../resource";
2
2
  import { createCloudflareApi } from "./api";
3
+ /**
4
+ * Creates and manages Cloudflare R2 Buckets for object storage.
5
+ *
6
+ * R2 Buckets provide S3-compatible object storage with automatic data replication
7
+ * across multiple regions for high availability and durability.
8
+ *
9
+ * @example
10
+ * // Create a basic R2 bucket with default settings
11
+ * const basicBucket = await R2Bucket("my-app-data", {
12
+ * name: "my-app-data"
13
+ * });
14
+ *
15
+ * @example
16
+ * // Create a bucket with location hint for optimal performance
17
+ * const euBucket = await R2Bucket("eu-user-data", {
18
+ * name: "eu-user-data",
19
+ * locationHint: "eu",
20
+ * jurisdiction: "eu"
21
+ * });
22
+ *
23
+ * @example
24
+ * // Create a development bucket with public access enabled
25
+ * const publicBucket = await R2Bucket("public-assets", {
26
+ * name: "public-assets",
27
+ * allowPublicAccess: true
28
+ * });
29
+ *
30
+ * @example
31
+ * // Create a FedRAMP compliant bucket for government workloads
32
+ * const fedRampBucket = await R2Bucket("gov-data", {
33
+ * name: "gov-data",
34
+ * jurisdiction: "fedramp"
35
+ * });
36
+ *
37
+ * @see https://developers.cloudflare.com/r2/buckets/
38
+ */
3
39
  export const R2Bucket = Resource("cloudflare::R2Bucket", async function (id, props) {
4
40
  // Create Cloudflare API client with automatic account discovery
5
41
  const api = await createCloudflareApi();
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Properties for creating a Durable Object Namespace
3
+ */
1
4
  export interface DurableObjectNamespaceInput {
2
5
  className: string;
3
6
  scriptName?: string | undefined;
@@ -5,6 +8,28 @@ export interface DurableObjectNamespaceInput {
5
8
  sqlite?: boolean | undefined;
6
9
  namespaceId?: string | undefined;
7
10
  }
11
+ /**
12
+ * @example
13
+ * // Create a basic Durable Object namespace for stateful chat rooms
14
+ * const rooms = new DurableObjectNamespace("chat-rooms", {
15
+ * className: "ChatRoom"
16
+ * });
17
+ *
18
+ * @example
19
+ * // Create a Durable Object with SQLite storage for user data
20
+ * const users = new DurableObjectNamespace("user-store", {
21
+ * className: "User",
22
+ * sqlite: true
23
+ * });
24
+ *
25
+ * @example
26
+ * // Create a Durable Object in production for game state management
27
+ * const game = new DurableObjectNamespace("game-state", {
28
+ * className: "GameState",
29
+ * scriptName: "game-worker",
30
+ * environment: "production"
31
+ * });
32
+ */
8
33
  export declare class DurableObjectNamespace implements DurableObjectNamespaceInput {
9
34
  readonly id: string;
10
35
  readonly type: "durable_object_namespace";
@@ -1,3 +1,25 @@
1
+ /**
2
+ * @example
3
+ * // Create a basic Durable Object namespace for stateful chat rooms
4
+ * const rooms = new DurableObjectNamespace("chat-rooms", {
5
+ * className: "ChatRoom"
6
+ * });
7
+ *
8
+ * @example
9
+ * // Create a Durable Object with SQLite storage for user data
10
+ * const users = new DurableObjectNamespace("user-store", {
11
+ * className: "User",
12
+ * sqlite: true
13
+ * });
14
+ *
15
+ * @example
16
+ * // Create a Durable Object in production for game state management
17
+ * const game = new DurableObjectNamespace("game-state", {
18
+ * className: "GameState",
19
+ * scriptName: "game-worker",
20
+ * environment: "production"
21
+ * });
22
+ */
1
23
  export class DurableObjectNamespace {
2
24
  id;
3
25
  type = "durable_object_namespace";
@@ -58,4 +58,40 @@ export interface KVNamespace extends Resource<"cloudflare::KVNamespace">, KVName
58
58
  */
59
59
  modifiedAt: number;
60
60
  }
61
- export declare const KVNamespace: ((this: Context<KVNamespace>, id: string, props: KVNamespaceProps) => Promise<KVNamespace>) | (((this: any, id: string, props?: KVNamespaceProps | undefined) => never) & (new (_: never) => never));
61
+ /**
62
+ * A Cloudflare KV Namespace is a key-value store that can be used to store data for your application.
63
+ *
64
+ * @see https://developers.cloudflare.com/kv/concepts/kv-namespaces/
65
+ *
66
+ * @example
67
+ * // Create a basic KV namespace for storing user data
68
+ * const users = await KVNamespace("users", {
69
+ * title: "user-data"
70
+ * });
71
+ *
72
+ * @example
73
+ * // Create a KV namespace with initial values and TTL
74
+ * const sessions = await KVNamespace("sessions", {
75
+ * title: "user-sessions",
76
+ * values: [{
77
+ * key: "session_123",
78
+ * value: { userId: "user_456", role: "admin" },
79
+ * expirationTtl: 3600 // Expires in 1 hour
80
+ * }]
81
+ * });
82
+ *
83
+ * @example
84
+ * // Create a KV namespace with metadata for caching
85
+ * const assets = await KVNamespace("assets", {
86
+ * title: "static-assets",
87
+ * values: [{
88
+ * key: "main.js",
89
+ * value: "content...",
90
+ * metadata: {
91
+ * contentType: "application/javascript",
92
+ * etag: "abc123"
93
+ * }
94
+ * }]
95
+ * });
96
+ */
97
+ export declare const KVNamespace: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<KVNamespace>, id: string, props: KVNamespaceProps) => Promise<KVNamespace>);
@@ -4,6 +4,42 @@ import { createCloudflareApi } from "./api";
4
4
  export function isKVNamespace(resource) {
5
5
  return (resource && typeof resource === "object" && resource.type === "kv_namespace");
6
6
  }
7
+ /**
8
+ * A Cloudflare KV Namespace is a key-value store that can be used to store data for your application.
9
+ *
10
+ * @see https://developers.cloudflare.com/kv/concepts/kv-namespaces/
11
+ *
12
+ * @example
13
+ * // Create a basic KV namespace for storing user data
14
+ * const users = await KVNamespace("users", {
15
+ * title: "user-data"
16
+ * });
17
+ *
18
+ * @example
19
+ * // Create a KV namespace with initial values and TTL
20
+ * const sessions = await KVNamespace("sessions", {
21
+ * title: "user-sessions",
22
+ * values: [{
23
+ * key: "session_123",
24
+ * value: { userId: "user_456", role: "admin" },
25
+ * expirationTtl: 3600 // Expires in 1 hour
26
+ * }]
27
+ * });
28
+ *
29
+ * @example
30
+ * // Create a KV namespace with metadata for caching
31
+ * const assets = await KVNamespace("assets", {
32
+ * title: "static-assets",
33
+ * values: [{
34
+ * key: "main.js",
35
+ * value: "content...",
36
+ * metadata: {
37
+ * contentType: "application/javascript",
38
+ * etag: "abc123"
39
+ * }
40
+ * }]
41
+ * });
42
+ */
7
43
  export const KVNamespace = Resource("cloudflare::KVNamespace", async function (id, props) {
8
44
  // Create Cloudflare API client with automatic account discovery
9
45
  const api = await createCloudflareApi();
@@ -157,4 +157,56 @@ export interface StaticSite extends Resource<"cloudflare::StaticSite"> {
157
157
  */
158
158
  routes?: Record<string, string>;
159
159
  }
160
- export declare const StaticSite: ((this: Context<StaticSite>, id: string, props: StaticSiteProps) => Promise<StaticSite>) | (((this: any, id: string, props?: StaticSiteProps | undefined) => never) & (new (_: never) => never));
160
+ /**
161
+ * A StaticSite resource deploys static web content to Cloudflare Workers, using KV for asset storage.
162
+ * It provides an efficient way to serve static websites with global distribution and caching.
163
+ *
164
+ * @example
165
+ * // Create a basic static site with default settings
166
+ * const basicSite = await StaticSite("my-site", {
167
+ * name: "my-site",
168
+ * dir: "./dist",
169
+ * url: true
170
+ * });
171
+ *
172
+ * @example
173
+ * // Create a static site with custom build command and minification disabled
174
+ * const devSite = await StaticSite("dev-site", {
175
+ * name: "dev-site",
176
+ * dir: "./public",
177
+ * build: {
178
+ * command: "npm run build"
179
+ * },
180
+ * bundle: {
181
+ * minify: false
182
+ * }
183
+ * });
184
+ *
185
+ * @example
186
+ * // Create a static site with a backend API worker
187
+ * const backend = await Worker("api-backend", {
188
+ * name: "api-backend",
189
+ * entrypoint: "./src/api.ts"
190
+ * });
191
+ *
192
+ * const fullSite = await StaticSite("full-site", {
193
+ * name: "full-site",
194
+ * dir: "./dist",
195
+ * routes: {
196
+ * "/api/*": backend
197
+ * }
198
+ * });
199
+ *
200
+ * @example
201
+ * // Create a static site with custom error page and index
202
+ * const customSite = await StaticSite("custom-site", {
203
+ * name: "custom-site",
204
+ * dir: "./www",
205
+ * errorPage: "404.html",
206
+ * indexPage: "home.html",
207
+ * domain: "www.example.com"
208
+ * });
209
+ *
210
+ * @see https://developers.cloudflare.com/workers/platform/sites
211
+ */
212
+ export declare const StaticSite: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<StaticSite>, id: string, props: StaticSiteProps) => Promise<StaticSite>);
@@ -1,6 +1,6 @@
1
1
  import { exec } from "child_process";
2
2
  import { promises as fs } from "fs";
3
- import path from "path";
3
+ import path from "node:path";
4
4
  import { promisify } from "util";
5
5
  import { Resource } from "../resource";
6
6
  import { createCloudflareApi } from "./api";
@@ -9,6 +9,58 @@ import { KVNamespace } from "./kv-namespace";
9
9
  import { uploadAssetManifest } from "./upload-asset-manifest";
10
10
  import { Worker } from "./worker";
11
11
  const __dirname = import.meta.dirname;
12
+ /**
13
+ * A StaticSite resource deploys static web content to Cloudflare Workers, using KV for asset storage.
14
+ * It provides an efficient way to serve static websites with global distribution and caching.
15
+ *
16
+ * @example
17
+ * // Create a basic static site with default settings
18
+ * const basicSite = await StaticSite("my-site", {
19
+ * name: "my-site",
20
+ * dir: "./dist",
21
+ * url: true
22
+ * });
23
+ *
24
+ * @example
25
+ * // Create a static site with custom build command and minification disabled
26
+ * const devSite = await StaticSite("dev-site", {
27
+ * name: "dev-site",
28
+ * dir: "./public",
29
+ * build: {
30
+ * command: "npm run build"
31
+ * },
32
+ * bundle: {
33
+ * minify: false
34
+ * }
35
+ * });
36
+ *
37
+ * @example
38
+ * // Create a static site with a backend API worker
39
+ * const backend = await Worker("api-backend", {
40
+ * name: "api-backend",
41
+ * entrypoint: "./src/api.ts"
42
+ * });
43
+ *
44
+ * const fullSite = await StaticSite("full-site", {
45
+ * name: "full-site",
46
+ * dir: "./dist",
47
+ * routes: {
48
+ * "/api/*": backend
49
+ * }
50
+ * });
51
+ *
52
+ * @example
53
+ * // Create a static site with custom error page and index
54
+ * const customSite = await StaticSite("custom-site", {
55
+ * name: "custom-site",
56
+ * dir: "./www",
57
+ * errorPage: "404.html",
58
+ * indexPage: "home.html",
59
+ * domain: "www.example.com"
60
+ * });
61
+ *
62
+ * @see https://developers.cloudflare.com/workers/platform/sites
63
+ */
12
64
  export const StaticSite = Resource("cloudflare::StaticSite", {
13
65
  alwaysUpdate: true,
14
66
  }, async function (id, props) {
@@ -1 +0,0 @@
1
- export {};
@@ -105,4 +105,67 @@ export interface Worker<B extends Bindings = Bindings> extends Resource<"cloudfl
105
105
  [bindingName in keyof B]: Bound<B[bindingName]>;
106
106
  };
107
107
  }
108
- export declare const Worker: (<const B extends Bindings>(this: Context<Worker<NoInfer<B>>>, id: string, props: WorkerProps<B>) => Promise<Worker<B>>) | (((this: any, id: string, props?: WorkerProps<Bindings> | undefined) => never) & (new (_: never) => never));
108
+ /**
109
+ * A Cloudflare Worker is a serverless function that can be deployed to the Cloudflare network.
110
+ *
111
+ * @example
112
+ * // Create a basic HTTP handler worker with custom domain routing
113
+ * // and workers.dev URL:
114
+ * const api = await Worker("api", {
115
+ * name: "api-worker",
116
+ * entrypoint: "./src/api.ts",
117
+ * routes: ["api.example.com/*"],
118
+ * url: true
119
+ * });
120
+ *
121
+ * @example
122
+ * // Create a real-time chat worker using Durable Objects
123
+ * // for state management:
124
+ * const chatRooms = new DurableObjectNamespace("chat-rooms");
125
+ * const userStore = new DurableObjectNamespace("user-store");
126
+ *
127
+ * const chat = await Worker("chat", {
128
+ * name: "chat-worker",
129
+ * entrypoint: "./src/chat.ts",
130
+ * bindings: {
131
+ * ROOMS: chatRooms,
132
+ * USERS: userStore
133
+ * },
134
+ * });
135
+ *
136
+ * @example
137
+ * // Create a worker with KV namespace for caching and data storage:
138
+ * const cache = await KVNamespace("cache-store");
139
+ * const settings = await KVNamespace("user-settings");
140
+ *
141
+ * const cacheWorker = await Worker("cache", {
142
+ * name: "cache-worker",
143
+ * entrypoint: "./src/cache.ts",
144
+ * bindings: {
145
+ * CACHE: cache,
146
+ * SETTINGS: settings
147
+ * }
148
+ * });
149
+ *
150
+ * @example
151
+ * // Create a worker with R2 bucket for object storage:
152
+ * const uploads = await R2Bucket("uploads", {
153
+ * name: "user-uploads"
154
+ * });
155
+ * const assets = await R2Bucket("assets", {
156
+ * name: "static-assets",
157
+ * allowPublicAccess: true
158
+ * });
159
+ *
160
+ * const storageWorker = await Worker("storage", {
161
+ * name: "storage-worker",
162
+ * entrypoint: "./src/storage.ts",
163
+ * bindings: {
164
+ * UPLOADS: uploads,
165
+ * ASSETS: assets
166
+ * }
167
+ * });
168
+ *
169
+ * @see https://developers.cloudflare.com/workers/
170
+ */
171
+ export declare const Worker: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | (<const B extends Bindings>(this: Context<Worker<NoInfer<B>>>, id: string, props: WorkerProps<B>) => Promise<Worker<B>>);
@@ -7,6 +7,69 @@ import { slugify } from "../util/slugify";
7
7
  import { createCloudflareApi } from "./api";
8
8
  import { isDurableObjectNamespace, } from "./bindings";
9
9
  import { isKVNamespace } from "./kv-namespace";
10
+ /**
11
+ * A Cloudflare Worker is a serverless function that can be deployed to the Cloudflare network.
12
+ *
13
+ * @example
14
+ * // Create a basic HTTP handler worker with custom domain routing
15
+ * // and workers.dev URL:
16
+ * const api = await Worker("api", {
17
+ * name: "api-worker",
18
+ * entrypoint: "./src/api.ts",
19
+ * routes: ["api.example.com/*"],
20
+ * url: true
21
+ * });
22
+ *
23
+ * @example
24
+ * // Create a real-time chat worker using Durable Objects
25
+ * // for state management:
26
+ * const chatRooms = new DurableObjectNamespace("chat-rooms");
27
+ * const userStore = new DurableObjectNamespace("user-store");
28
+ *
29
+ * const chat = await Worker("chat", {
30
+ * name: "chat-worker",
31
+ * entrypoint: "./src/chat.ts",
32
+ * bindings: {
33
+ * ROOMS: chatRooms,
34
+ * USERS: userStore
35
+ * },
36
+ * });
37
+ *
38
+ * @example
39
+ * // Create a worker with KV namespace for caching and data storage:
40
+ * const cache = await KVNamespace("cache-store");
41
+ * const settings = await KVNamespace("user-settings");
42
+ *
43
+ * const cacheWorker = await Worker("cache", {
44
+ * name: "cache-worker",
45
+ * entrypoint: "./src/cache.ts",
46
+ * bindings: {
47
+ * CACHE: cache,
48
+ * SETTINGS: settings
49
+ * }
50
+ * });
51
+ *
52
+ * @example
53
+ * // Create a worker with R2 bucket for object storage:
54
+ * const uploads = await R2Bucket("uploads", {
55
+ * name: "user-uploads"
56
+ * });
57
+ * const assets = await R2Bucket("assets", {
58
+ * name: "static-assets",
59
+ * allowPublicAccess: true
60
+ * });
61
+ *
62
+ * const storageWorker = await Worker("storage", {
63
+ * name: "storage-worker",
64
+ * entrypoint: "./src/storage.ts",
65
+ * bindings: {
66
+ * UPLOADS: uploads,
67
+ * ASSETS: assets
68
+ * }
69
+ * });
70
+ *
71
+ * @see https://developers.cloudflare.com/workers/
72
+ */
10
73
  export const Worker = Resource("cloudflare::Worker", {
11
74
  alwaysUpdate: true,
12
75
  }, async function (id, props) {
@@ -240,4 +240,4 @@ export interface WranglerJson extends Resource<"cloudflare::WranglerJson">, Wran
240
240
  /**
241
241
  * Resource for managing wrangler.json configuration files
242
242
  */
243
- export declare const WranglerJson: ((this: Context<WranglerJson>, id: string, props: WranglerJsonProps) => Promise<WranglerJson>) | (((this: any, id: string, props?: WranglerJsonProps | undefined) => never) & (new (_: never) => never));
243
+ export declare const WranglerJson: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<WranglerJson>, id: string, props: WranglerJsonProps) => Promise<WranglerJson>);
@@ -1 +0,0 @@
1
- export {};
@@ -193,4 +193,59 @@ export interface Zone extends Resource<"cloudflare::Zone"> {
193
193
  minTlsVersion: MinTLSVersionValue;
194
194
  };
195
195
  }
196
- export declare const Zone: ((this: Context<Zone>, id: string, props: ZoneProps) => Promise<Zone>) | (((this: any, id: string, props?: ZoneProps | undefined) => never) & (new (_: never) => never));
196
+ /**
197
+ * A Cloudflare Zone represents a domain and its configuration settings on Cloudflare.
198
+ * Zones allow you to manage DNS, SSL/TLS, caching, security and other settings for a domain.
199
+ *
200
+ * @example
201
+ * // Create a basic zone with default settings
202
+ * const basicZone = await Zone("example.com", {
203
+ * name: "example.com",
204
+ * type: "full",
205
+ * jumpStart: true
206
+ * });
207
+ *
208
+ * @example
209
+ * // Create a zone with enhanced security settings
210
+ * const secureZone = await Zone("secure.example.com", {
211
+ * name: "secure.example.com",
212
+ * type: "full",
213
+ * settings: {
214
+ * ssl: "strict",
215
+ * alwaysUseHttps: "on",
216
+ * automaticHttpsRewrites: "on",
217
+ * minTlsVersion: "1.3",
218
+ * tls13: "zrt"
219
+ * }
220
+ * });
221
+ *
222
+ * @example
223
+ * // Create a zone with optimized performance settings
224
+ * const fastZone = await Zone("fast.example.com", {
225
+ * name: "fast.example.com",
226
+ * settings: {
227
+ * browserCacheTtl: 7200,
228
+ * brotli: "on",
229
+ * zeroRtt: "on",
230
+ * http2: "on",
231
+ * http3: "on",
232
+ * earlyHints: "on"
233
+ * }
234
+ * });
235
+ *
236
+ * @example
237
+ * // Create a development zone with specific features
238
+ * const devZone = await Zone("dev.example.com", {
239
+ * name: "dev.example.com",
240
+ * settings: {
241
+ * developmentMode: "on",
242
+ * emailObfuscation: "on",
243
+ * hotlinkProtection: "on",
244
+ * ipv6: "on",
245
+ * websockets: "on"
246
+ * }
247
+ * });
248
+ *
249
+ * @see https://developers.cloudflare.com/dns/zone-setups/
250
+ */
251
+ export declare const Zone: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<Zone>, id: string, props: ZoneProps) => Promise<Zone>);
@@ -1,5 +1,60 @@
1
1
  import { Resource } from "../resource";
2
2
  import { createCloudflareApi } from "./api";
3
+ /**
4
+ * A Cloudflare Zone represents a domain and its configuration settings on Cloudflare.
5
+ * Zones allow you to manage DNS, SSL/TLS, caching, security and other settings for a domain.
6
+ *
7
+ * @example
8
+ * // Create a basic zone with default settings
9
+ * const basicZone = await Zone("example.com", {
10
+ * name: "example.com",
11
+ * type: "full",
12
+ * jumpStart: true
13
+ * });
14
+ *
15
+ * @example
16
+ * // Create a zone with enhanced security settings
17
+ * const secureZone = await Zone("secure.example.com", {
18
+ * name: "secure.example.com",
19
+ * type: "full",
20
+ * settings: {
21
+ * ssl: "strict",
22
+ * alwaysUseHttps: "on",
23
+ * automaticHttpsRewrites: "on",
24
+ * minTlsVersion: "1.3",
25
+ * tls13: "zrt"
26
+ * }
27
+ * });
28
+ *
29
+ * @example
30
+ * // Create a zone with optimized performance settings
31
+ * const fastZone = await Zone("fast.example.com", {
32
+ * name: "fast.example.com",
33
+ * settings: {
34
+ * browserCacheTtl: 7200,
35
+ * brotli: "on",
36
+ * zeroRtt: "on",
37
+ * http2: "on",
38
+ * http3: "on",
39
+ * earlyHints: "on"
40
+ * }
41
+ * });
42
+ *
43
+ * @example
44
+ * // Create a development zone with specific features
45
+ * const devZone = await Zone("dev.example.com", {
46
+ * name: "dev.example.com",
47
+ * settings: {
48
+ * developmentMode: "on",
49
+ * emailObfuscation: "on",
50
+ * hotlinkProtection: "on",
51
+ * ipv6: "on",
52
+ * websockets: "on"
53
+ * }
54
+ * });
55
+ *
56
+ * @see https://developers.cloudflare.com/dns/zone-setups/
57
+ */
3
58
  export const Zone = Resource("cloudflare::Zone", async function (id, props) {
4
59
  // Create Cloudflare API client with automatic account discovery
5
60
  const api = await createCloudflareApi({
package/lib/destroy.js CHANGED
@@ -35,7 +35,7 @@ export async function destroy(...args) {
35
35
  }
36
36
  const Provider = PROVIDERS.get(instance.Kind);
37
37
  if (!Provider) {
38
- throw new Error(`Cannot destroy resource type ${instance.Kind} - no provider found. You may need to import the provider in your alchemy.config.ts.`);
38
+ throw new Error(`Cannot destroy resource "${instance.FQN}" type ${instance.Kind} - no provider found. You may need to import the provider in your alchemy.config.ts.`);
39
39
  }
40
40
  const scope = instance.Scope;
41
41
  if (!scope) {