@powerlines/plugin-cloudflare 0.6.247 → 0.6.249
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/components/cloudflare-builtin.cjs +101 -101
- package/dist/components/cloudflare-builtin.mjs +3 -3
- package/dist/components/env-builtin.cjs +2 -2
- package/dist/components/env-builtin.mjs +1 -1
- package/dist/components/worker-entry.cjs +2 -2
- package/dist/components/worker-entry.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +20 -20
|
@@ -5,10 +5,10 @@ let _alloy_js_core = require("@alloy-js/core");
|
|
|
5
5
|
let defu = require("defu");
|
|
6
6
|
defu = require_runtime.__toESM(defu, 1);
|
|
7
7
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
-
let
|
|
8
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
9
|
+
let _power_plant_alloy_js_typescript_components_interface_declaration = require("@power-plant/alloy-js/typescript/components/interface-declaration");
|
|
10
|
+
let _power_plant_alloy_js_typescript_components_tsdoc = require("@power-plant/alloy-js/typescript/components/tsdoc");
|
|
9
11
|
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
|
|
11
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
12
|
|
|
13
13
|
//#region src/components/cloudflare-builtin.tsx
|
|
14
14
|
/**
|
|
@@ -82,9 +82,9 @@ function CloudflareBuiltin(props) {
|
|
|
82
82
|
name: "globalContextStorage",
|
|
83
83
|
initializer: _alloy_js_core.code`globalThis as unknown as Record<PropertyKey, unknown>; `
|
|
84
84
|
}),
|
|
85
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
86
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
87
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
86
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
88
88
|
"export": true,
|
|
89
89
|
name: "CloudflareFetchContext",
|
|
90
90
|
typeParameters: [{
|
|
@@ -97,17 +97,17 @@ function CloudflareBuiltin(props) {
|
|
|
97
97
|
doc: "An interface representing the runtime context for Cloudflare operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
98
98
|
get children() {
|
|
99
99
|
return [
|
|
100
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
100
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
101
101
|
name: "request",
|
|
102
102
|
type: "Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>",
|
|
103
103
|
doc: "The incoming Cloudflare request."
|
|
104
104
|
}),
|
|
105
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
105
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
106
106
|
name: "env",
|
|
107
107
|
type: "Env",
|
|
108
108
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
109
109
|
}),
|
|
110
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
110
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
111
111
|
name: "ctx",
|
|
112
112
|
type: "ExecutionContext",
|
|
113
113
|
doc: "The Cloudflare execution context for the incoming request."
|
|
@@ -130,10 +130,10 @@ function CloudflareBuiltin(props) {
|
|
|
130
130
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_FETCH_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareFetchContext>()) as AsyncLocalStorage<CloudflareFetchContext>; `
|
|
131
131
|
}),
|
|
132
132
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
133
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
133
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
134
134
|
heading: "Retrieves the current Cloudflare fetch context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
135
135
|
get children() {
|
|
136
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
136
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare fetch context.` });
|
|
137
137
|
}
|
|
138
138
|
}),
|
|
139
139
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -155,19 +155,19 @@ if (!context) {
|
|
|
155
155
|
return context as CloudflareFetchContext<Env, CfHostMetadata>; `
|
|
156
156
|
}),
|
|
157
157
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
158
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
158
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
159
159
|
heading: "Runs a given function within the scope of a Cloudflare fetch context. This is typically used to set up the context for handling a Cloudflare fetch request, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getFetchContext` function for any code executed within the callback.",
|
|
160
160
|
get children() {
|
|
161
161
|
return [
|
|
162
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
162
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
163
163
|
name: "context",
|
|
164
164
|
children: _alloy_js_core.code`The Cloudflare fetch context to run the function with.`
|
|
165
165
|
}),
|
|
166
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
166
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
167
167
|
name: "callback",
|
|
168
168
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
169
169
|
}),
|
|
170
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
170
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
171
171
|
];
|
|
172
172
|
}
|
|
173
173
|
}),
|
|
@@ -191,9 +191,9 @@ return context as CloudflareFetchContext<Env, CfHostMetadata>; `
|
|
|
191
191
|
returnType: "Promise<Response>",
|
|
192
192
|
children: _alloy_js_core.code`return fetchContextStorage.run(context, () => callback(context.request, context.env, context.ctx)); `
|
|
193
193
|
}),
|
|
194
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
195
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
196
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
194
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
195
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
196
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
197
197
|
"export": true,
|
|
198
198
|
name: "CloudflareScheduledContext",
|
|
199
199
|
typeParameters: [{
|
|
@@ -203,17 +203,17 @@ return context as CloudflareFetchContext<Env, CfHostMetadata>; `
|
|
|
203
203
|
doc: "An interface representing the runtime context for Cloudflare scheduled operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
204
204
|
get children() {
|
|
205
205
|
return [
|
|
206
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
206
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
207
207
|
name: "controller",
|
|
208
208
|
type: "ScheduledController",
|
|
209
209
|
doc: "The Cloudflare scheduled controller for the scheduled operation."
|
|
210
210
|
}),
|
|
211
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
211
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
212
212
|
name: "env",
|
|
213
213
|
type: "Env",
|
|
214
214
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
215
215
|
}),
|
|
216
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
216
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
217
217
|
name: "ctx",
|
|
218
218
|
type: "ExecutionContext",
|
|
219
219
|
doc: "The Cloudflare execution context for the scheduled operation."
|
|
@@ -236,10 +236,10 @@ return context as CloudflareFetchContext<Env, CfHostMetadata>; `
|
|
|
236
236
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_SCHEDULED_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareScheduledContext>()) as AsyncLocalStorage<CloudflareScheduledContext>; `
|
|
237
237
|
}),
|
|
238
238
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
239
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
239
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
240
240
|
heading: "Retrieves the current Cloudflare scheduled runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
241
241
|
get children() {
|
|
242
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
242
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare scheduled runtime context.` });
|
|
243
243
|
}
|
|
244
244
|
}),
|
|
245
245
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -258,19 +258,19 @@ if (!context) {
|
|
|
258
258
|
return context as CloudflareScheduledContext<Env>; `
|
|
259
259
|
}),
|
|
260
260
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
261
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
261
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
262
262
|
heading: "Runs a given function within the scope of a Cloudflare scheduled context. This is typically used to set up the context for handling a Cloudflare scheduled operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getScheduledContext` function for any code executed within the callback.",
|
|
263
263
|
get children() {
|
|
264
264
|
return [
|
|
265
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
265
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
266
266
|
name: "context",
|
|
267
267
|
children: _alloy_js_core.code`The Cloudflare scheduled context to run the function with.`
|
|
268
268
|
}),
|
|
269
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
269
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
270
270
|
name: "callback",
|
|
271
271
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
272
272
|
}),
|
|
273
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
273
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
274
274
|
];
|
|
275
275
|
}
|
|
276
276
|
}),
|
|
@@ -291,9 +291,9 @@ return context as CloudflareScheduledContext<Env>; `
|
|
|
291
291
|
returnType: "Promise<void>",
|
|
292
292
|
children: _alloy_js_core.code`return scheduledContextStorage.run(context, () => callback(context)); `
|
|
293
293
|
}),
|
|
294
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
295
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
296
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
294
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
295
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
296
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
297
297
|
"export": true,
|
|
298
298
|
name: "CloudflareEmailContext",
|
|
299
299
|
typeParameters: [{
|
|
@@ -303,17 +303,17 @@ return context as CloudflareScheduledContext<Env>; `
|
|
|
303
303
|
doc: "An interface representing the runtime context for Cloudflare email operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
304
304
|
get children() {
|
|
305
305
|
return [
|
|
306
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
306
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
307
307
|
name: "message",
|
|
308
308
|
type: "ForwardableEmailMessage",
|
|
309
309
|
doc: "The Cloudflare email instance for the email operation."
|
|
310
310
|
}),
|
|
311
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
311
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
312
312
|
name: "env",
|
|
313
313
|
type: "Env",
|
|
314
314
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
315
315
|
}),
|
|
316
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
316
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
317
317
|
name: "ctx",
|
|
318
318
|
type: "ExecutionContext",
|
|
319
319
|
doc: "The Cloudflare execution context for the email operation."
|
|
@@ -336,10 +336,10 @@ return context as CloudflareScheduledContext<Env>; `
|
|
|
336
336
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_EMAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareEmailContext>()) as AsyncLocalStorage<CloudflareEmailContext>; `
|
|
337
337
|
}),
|
|
338
338
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
339
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
339
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
340
340
|
heading: "Retrieves the current Cloudflare email runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
341
341
|
get children() {
|
|
342
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
342
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare email runtime context.` });
|
|
343
343
|
}
|
|
344
344
|
}),
|
|
345
345
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -358,19 +358,19 @@ if (!context) {
|
|
|
358
358
|
return context as CloudflareEmailContext<Env>; `
|
|
359
359
|
}),
|
|
360
360
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
361
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
361
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
362
362
|
heading: "Runs a given function within the scope of a Cloudflare email context. This is typically used to set up the context for handling a Cloudflare email operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getEmailContext` function for any code executed within the callback.",
|
|
363
363
|
get children() {
|
|
364
364
|
return [
|
|
365
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
365
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
366
366
|
name: "context",
|
|
367
367
|
children: _alloy_js_core.code`The Cloudflare email context to run the function with.`
|
|
368
368
|
}),
|
|
369
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
369
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
370
370
|
name: "callback",
|
|
371
371
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
372
372
|
}),
|
|
373
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
373
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`A promise that resolves with the result of the executed function.` })
|
|
374
374
|
];
|
|
375
375
|
}
|
|
376
376
|
}),
|
|
@@ -391,9 +391,9 @@ return context as CloudflareEmailContext<Env>; `
|
|
|
391
391
|
returnType: "Promise<void>",
|
|
392
392
|
children: _alloy_js_core.code`return emailContextStorage.run(context, () => callback(context)); `
|
|
393
393
|
}),
|
|
394
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
395
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
396
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
394
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
395
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
396
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
397
397
|
"export": true,
|
|
398
398
|
name: "CloudflareQueueContext",
|
|
399
399
|
typeParameters: [{
|
|
@@ -406,17 +406,17 @@ return context as CloudflareEmailContext<Env>; `
|
|
|
406
406
|
doc: "An interface representing the runtime context for Cloudflare queue operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
407
407
|
get children() {
|
|
408
408
|
return [
|
|
409
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
409
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
410
410
|
name: "batch",
|
|
411
411
|
type: "MessageBatch<Message>",
|
|
412
412
|
doc: "The Cloudflare queue event instance for the queue operation."
|
|
413
413
|
}),
|
|
414
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
414
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
415
415
|
name: "env",
|
|
416
416
|
type: "Env",
|
|
417
417
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
418
418
|
}),
|
|
419
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
419
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
420
420
|
name: "ctx",
|
|
421
421
|
type: "ExecutionContext",
|
|
422
422
|
doc: "The Cloudflare execution context for the queue operation."
|
|
@@ -439,10 +439,10 @@ return context as CloudflareEmailContext<Env>; `
|
|
|
439
439
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_QUEUE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareQueueContext>()) as AsyncLocalStorage<CloudflareQueueContext>; `
|
|
440
440
|
}),
|
|
441
441
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
442
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
442
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
443
443
|
heading: "Retrieves the current Cloudflare queue runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
444
444
|
get children() {
|
|
445
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
445
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare queue runtime context.` });
|
|
446
446
|
}
|
|
447
447
|
}),
|
|
448
448
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -464,19 +464,19 @@ if (!context) {
|
|
|
464
464
|
return context as CloudflareQueueContext<Message, Env>; `
|
|
465
465
|
}),
|
|
466
466
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
467
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
467
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
468
468
|
heading: "Runs a given function within the scope of a Cloudflare queue context. This is typically used to set up the context for handling a Cloudflare queue operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getQueueContext` function for any code executed within the callback.",
|
|
469
469
|
get children() {
|
|
470
470
|
return [
|
|
471
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
471
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
472
472
|
name: "context",
|
|
473
473
|
children: _alloy_js_core.code`The Cloudflare queue context to run the function with.`
|
|
474
474
|
}),
|
|
475
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
475
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
476
476
|
name: "callback",
|
|
477
477
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
478
478
|
}),
|
|
479
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
479
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
480
480
|
];
|
|
481
481
|
}
|
|
482
482
|
}),
|
|
@@ -500,9 +500,9 @@ return context as CloudflareQueueContext<Message, Env>; `
|
|
|
500
500
|
returnType: "Promise<void>",
|
|
501
501
|
children: _alloy_js_core.code`return queueContextStorage.run(context, () => callback(context)); `
|
|
502
502
|
}),
|
|
503
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
504
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
505
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
503
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
504
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
505
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
506
506
|
"export": true,
|
|
507
507
|
name: "CloudflareTailContext",
|
|
508
508
|
typeParameters: [{
|
|
@@ -512,17 +512,17 @@ return context as CloudflareQueueContext<Message, Env>; `
|
|
|
512
512
|
doc: "An interface representing the tail context for Cloudflare tail operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
513
513
|
get children() {
|
|
514
514
|
return [
|
|
515
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
515
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
516
516
|
name: "events",
|
|
517
517
|
type: "TraceItem[]",
|
|
518
518
|
doc: "An array of trace items representing the events in the Cloudflare tail context."
|
|
519
519
|
}),
|
|
520
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
520
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
521
521
|
name: "env",
|
|
522
522
|
type: "Env",
|
|
523
523
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
524
524
|
}),
|
|
525
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
525
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
526
526
|
name: "ctx",
|
|
527
527
|
type: "ExecutionContext",
|
|
528
528
|
doc: "The Cloudflare execution context for the tail operation."
|
|
@@ -545,10 +545,10 @@ return context as CloudflareQueueContext<Message, Env>; `
|
|
|
545
545
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailContext>()) as AsyncLocalStorage<CloudflareTailContext>; `
|
|
546
546
|
}),
|
|
547
547
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
548
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
548
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
549
549
|
heading: "Retrieves the current Cloudflare tail runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
550
550
|
get children() {
|
|
551
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
551
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare tail runtime context.` });
|
|
552
552
|
}
|
|
553
553
|
}),
|
|
554
554
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -567,19 +567,19 @@ if (!context) {
|
|
|
567
567
|
return context as CloudflareTailContext<Env>; `
|
|
568
568
|
}),
|
|
569
569
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
570
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
570
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
571
571
|
heading: "Runs a given function within the scope of a Cloudflare tail context. This is typically used to set up the context for handling a Cloudflare tail operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailContext` function for any code executed within the callback.",
|
|
572
572
|
get children() {
|
|
573
573
|
return [
|
|
574
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
574
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
575
575
|
name: "context",
|
|
576
576
|
children: _alloy_js_core.code`The Cloudflare tail context to run the function with.`
|
|
577
577
|
}),
|
|
578
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
578
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
579
579
|
name: "callback",
|
|
580
580
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
581
581
|
}),
|
|
582
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
582
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
583
583
|
];
|
|
584
584
|
}
|
|
585
585
|
}),
|
|
@@ -600,9 +600,9 @@ return context as CloudflareTailContext<Env>; `
|
|
|
600
600
|
returnType: "T",
|
|
601
601
|
children: _alloy_js_core.code`return tailContextStorage.run(context, () => callback(context)); `
|
|
602
602
|
}),
|
|
603
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
604
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
605
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
603
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
604
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
605
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
606
606
|
"export": true,
|
|
607
607
|
name: "CloudflareTailStreamContext",
|
|
608
608
|
typeParameters: [{
|
|
@@ -612,17 +612,17 @@ return context as CloudflareTailContext<Env>; `
|
|
|
612
612
|
doc: "An interface representing the tail context for Cloudflare tail stream operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
613
613
|
get children() {
|
|
614
614
|
return [
|
|
615
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
615
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
616
616
|
name: "event",
|
|
617
617
|
type: "TailStream.TailEvent<TailStream.Onset>",
|
|
618
618
|
doc: "The tail event associated with the Cloudflare tail stream context."
|
|
619
619
|
}),
|
|
620
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
620
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
621
621
|
name: "env",
|
|
622
622
|
type: "Env",
|
|
623
623
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
624
624
|
}),
|
|
625
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
625
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
626
626
|
name: "ctx",
|
|
627
627
|
type: "ExecutionContext",
|
|
628
628
|
doc: "The Cloudflare execution context for the tail stream operation."
|
|
@@ -645,10 +645,10 @@ return context as CloudflareTailContext<Env>; `
|
|
|
645
645
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailStreamContext>()) as AsyncLocalStorage<CloudflareTailStreamContext>; `
|
|
646
646
|
}),
|
|
647
647
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
648
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
648
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
649
649
|
heading: "Retrieves the current Cloudflare tail stream runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
650
650
|
get children() {
|
|
651
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
651
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare tail stream runtime context.` });
|
|
652
652
|
}
|
|
653
653
|
}),
|
|
654
654
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -667,19 +667,19 @@ if (!context) {
|
|
|
667
667
|
return context as CloudflareTailStreamContext<Env>; `
|
|
668
668
|
}),
|
|
669
669
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
670
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
670
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
671
671
|
heading: "Runs a given function within the scope of a Cloudflare tail stream context. This is typically used to set up the context for handling a Cloudflare tail stream operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailStreamContext` function for any code executed within the callback.",
|
|
672
672
|
get children() {
|
|
673
673
|
return [
|
|
674
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
674
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
675
675
|
name: "context",
|
|
676
676
|
children: _alloy_js_core.code`The Cloudflare tail stream context to run the function with.`
|
|
677
677
|
}),
|
|
678
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
678
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
679
679
|
name: "callback",
|
|
680
680
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
681
681
|
}),
|
|
682
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
682
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
683
683
|
];
|
|
684
684
|
}
|
|
685
685
|
}),
|
|
@@ -700,9 +700,9 @@ return context as CloudflareTailStreamContext<Env>; `
|
|
|
700
700
|
returnType: "Promise<TailStream.TailEventHandlerType>",
|
|
701
701
|
children: _alloy_js_core.code`return tailStreamContextStorage.run(context, () => callback(context)); `
|
|
702
702
|
}),
|
|
703
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
704
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
705
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
703
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
704
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
705
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
706
706
|
"export": true,
|
|
707
707
|
name: "CloudflareTraceContext",
|
|
708
708
|
typeParameters: [{
|
|
@@ -712,17 +712,17 @@ return context as CloudflareTailStreamContext<Env>; `
|
|
|
712
712
|
doc: "An interface representing the trace context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
713
713
|
get children() {
|
|
714
714
|
return [
|
|
715
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
715
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
716
716
|
name: "traces",
|
|
717
717
|
type: "TraceItem[]",
|
|
718
718
|
doc: "An array of trace items associated with the Cloudflare trace context."
|
|
719
719
|
}),
|
|
720
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
720
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
721
721
|
name: "env",
|
|
722
722
|
type: "Env",
|
|
723
723
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
724
724
|
}),
|
|
725
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
725
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
726
726
|
name: "ctx",
|
|
727
727
|
type: "ExecutionContext",
|
|
728
728
|
doc: "The Cloudflare execution context for the trace operation."
|
|
@@ -745,10 +745,10 @@ return context as CloudflareTailStreamContext<Env>; `
|
|
|
745
745
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TRACE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTraceContext>()) as AsyncLocalStorage<CloudflareTraceContext>; `
|
|
746
746
|
}),
|
|
747
747
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
748
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
748
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
749
749
|
heading: "Retrieves the current Cloudflare trace runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
750
750
|
get children() {
|
|
751
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
751
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare trace runtime context.` });
|
|
752
752
|
}
|
|
753
753
|
}),
|
|
754
754
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -767,19 +767,19 @@ if (!context) {
|
|
|
767
767
|
return context as CloudflareTraceContext<Env>; `
|
|
768
768
|
}),
|
|
769
769
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
770
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
770
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
771
771
|
heading: "Runs a given function within the scope of a Cloudflare trace context. This is typically used to set up the context for handling a Cloudflare trace operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTraceContext` function for any code executed within the callback.",
|
|
772
772
|
get children() {
|
|
773
773
|
return [
|
|
774
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
774
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
775
775
|
name: "context",
|
|
776
776
|
children: _alloy_js_core.code`The Cloudflare trace context to run the function with.`
|
|
777
777
|
}),
|
|
778
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
778
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
779
779
|
name: "callback",
|
|
780
780
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
781
781
|
}),
|
|
782
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
782
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
783
783
|
];
|
|
784
784
|
}
|
|
785
785
|
}),
|
|
@@ -800,9 +800,9 @@ return context as CloudflareTraceContext<Env>; `
|
|
|
800
800
|
returnType: "Promise<void>",
|
|
801
801
|
children: _alloy_js_core.code`return traceContextStorage.run(context, () => callback(context)); `
|
|
802
802
|
}),
|
|
803
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
804
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
805
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
803
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
804
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
805
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
806
806
|
"export": true,
|
|
807
807
|
name: "CloudflareTestContext",
|
|
808
808
|
typeParameters: [{
|
|
@@ -812,17 +812,17 @@ return context as CloudflareTraceContext<Env>; `
|
|
|
812
812
|
doc: "An interface representing the test context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
|
|
813
813
|
get children() {
|
|
814
814
|
return [
|
|
815
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
815
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
816
816
|
name: "controller",
|
|
817
817
|
type: "TestController",
|
|
818
818
|
doc: "The test controller associated with the Cloudflare test context."
|
|
819
819
|
}),
|
|
820
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
820
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
821
821
|
name: "env",
|
|
822
822
|
type: "Env",
|
|
823
823
|
doc: "The Cloudflare environment bindings available during runtime."
|
|
824
824
|
}),
|
|
825
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
825
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_interface_declaration.InterfaceMember, {
|
|
826
826
|
name: "ctx",
|
|
827
827
|
type: "ExecutionContext",
|
|
828
828
|
doc: "The Cloudflare execution context for the test operation."
|
|
@@ -845,10 +845,10 @@ return context as CloudflareTraceContext<Env>; `
|
|
|
845
845
|
initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TEST_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTestContext>()) as AsyncLocalStorage<CloudflareTestContext>; `
|
|
846
846
|
}),
|
|
847
847
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
848
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
848
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
849
849
|
heading: "Retrieves the current Cloudflare test runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.",
|
|
850
850
|
get children() {
|
|
851
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
851
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare test runtime context.` });
|
|
852
852
|
}
|
|
853
853
|
}),
|
|
854
854
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -867,19 +867,19 @@ if (!context) {
|
|
|
867
867
|
return context as CloudflareTestContext<Env>; `
|
|
868
868
|
}),
|
|
869
869
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
870
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
870
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
871
871
|
heading: "Runs a given function within the scope of a Cloudflare test context. This is typically used to set up the context for handling a Cloudflare test operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTestContext` function for any code executed within the callback.",
|
|
872
872
|
get children() {
|
|
873
873
|
return [
|
|
874
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
874
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
875
875
|
name: "context",
|
|
876
876
|
children: _alloy_js_core.code`The Cloudflare test context to run the function with.`
|
|
877
877
|
}),
|
|
878
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
878
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
879
879
|
name: "callback",
|
|
880
880
|
children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
|
|
881
881
|
}),
|
|
882
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
882
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
|
|
883
883
|
];
|
|
884
884
|
}
|
|
885
885
|
}),
|
|
@@ -900,8 +900,8 @@ return context as CloudflareTestContext<Env>; `
|
|
|
900
900
|
returnType: "Promise<void>",
|
|
901
901
|
children: _alloy_js_core.code`return testContextStorage.run(context, () => callback(context)); `
|
|
902
902
|
}),
|
|
903
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
904
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
903
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
904
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
905
905
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
906
906
|
get when() {
|
|
907
907
|
return Boolean(children);
|
|
@@ -2,10 +2,10 @@ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx
|
|
|
2
2
|
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
3
|
import defu from "defu";
|
|
4
4
|
import { FunctionDeclaration, VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
-
import { Spacing } from "@
|
|
5
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
6
|
+
import { InterfaceDeclaration, InterfaceMember } from "@power-plant/alloy-js/typescript/components/interface-declaration";
|
|
7
|
+
import { TSDoc, TSDocParam, TSDocReturns } from "@power-plant/alloy-js/typescript/components/tsdoc";
|
|
6
8
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
7
|
-
import { InterfaceDeclaration, InterfaceMember } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
8
|
-
import { TSDoc, TSDocParam, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
9
|
|
|
10
10
|
//#region src/components/cloudflare-builtin.tsx
|
|
11
11
|
/**
|
|
@@ -4,7 +4,7 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let defu = require("defu");
|
|
6
6
|
defu = require_runtime.__toESM(defu, 1);
|
|
7
|
-
let
|
|
7
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
8
8
|
let _powerlines_plugin_env_components_env_builtin = require("@powerlines/plugin-env/components/env-builtin");
|
|
9
9
|
|
|
10
10
|
//#region src/components/env-builtin.tsx
|
|
@@ -18,7 +18,7 @@ function CloudflareEnvBuiltin(props) {
|
|
|
18
18
|
return (0, defu.default)({ "cloudflare:workers": ["env"] }, imports ?? {});
|
|
19
19
|
},
|
|
20
20
|
get children() {
|
|
21
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
21
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
22
22
|
get when() {
|
|
23
23
|
return Boolean(children);
|
|
24
24
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
3
|
import defu from "defu";
|
|
4
|
-
import { Spacing } from "@
|
|
4
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
5
5
|
import { EnvBuiltin } from "@powerlines/plugin-env/components/env-builtin";
|
|
6
6
|
|
|
7
7
|
//#region src/components/env-builtin.tsx
|
|
@@ -4,7 +4,7 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let defu = require("defu");
|
|
6
6
|
defu = require_runtime.__toESM(defu, 1);
|
|
7
|
-
let
|
|
7
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
8
8
|
let _powerlines_plugin_alloy_core_contexts = require("@powerlines/plugin-alloy/core/contexts");
|
|
9
9
|
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
10
10
|
let _stryke_hash = require("@stryke/hash");
|
|
@@ -187,7 +187,7 @@ function WorkerEntry(props) {
|
|
|
187
187
|
}),
|
|
188
188
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
189
189
|
_alloy_js_core.code` } satisfies ExportedHandler<CloudflareBindings>; `,
|
|
190
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
190
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
191
191
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
192
192
|
get when() {
|
|
193
193
|
return Boolean(children);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Show, code, computed, splitProps } from "@alloy-js/core";
|
|
3
3
|
import defu from "defu";
|
|
4
|
-
import { Spacing } from "@
|
|
4
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
5
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts";
|
|
6
6
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
7
7
|
import { murmurhash } from "@stryke/hash";
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,6 @@ let _powerlines_plugin_pulumi = require("@powerlines/plugin-pulumi");
|
|
|
14
14
|
_powerlines_plugin_pulumi = require_runtime.__toESM(_powerlines_plugin_pulumi, 1);
|
|
15
15
|
let _powerlines_plugin_unenv = require("@powerlines/plugin-unenv");
|
|
16
16
|
_powerlines_plugin_unenv = require_runtime.__toESM(_powerlines_plugin_unenv, 1);
|
|
17
|
-
let _powerlines_schema = require("@powerlines/schema");
|
|
18
17
|
let _pulumi_cloudflare = require("@pulumi/cloudflare");
|
|
19
18
|
_pulumi_cloudflare = require_runtime.__toESM(_pulumi_cloudflare, 1);
|
|
20
19
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
@@ -23,6 +22,7 @@ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case
|
|
|
23
22
|
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
24
23
|
let defu = require("defu");
|
|
25
24
|
defu = require_runtime.__toESM(defu, 1);
|
|
25
|
+
let powerlines_schema = require("powerlines/schema");
|
|
26
26
|
let wrangler = require("wrangler");
|
|
27
27
|
|
|
28
28
|
//#region src/index.tsx
|
|
@@ -64,7 +64,7 @@ function plugin(options = {}) {
|
|
|
64
64
|
this.cloudflare ??= { workers: [] };
|
|
65
65
|
this.cloudflare.workers = await Promise.all(this.entry.map(async (entry, i, arr) => {
|
|
66
66
|
if (!entry.input) throw new Error(`Cloudflare Worker entry "${entry.file}" is missing an input file.`);
|
|
67
|
-
const workerModule = await (0,
|
|
67
|
+
const workerModule = await (0, powerlines_schema.resolveModule)(this, entry.input);
|
|
68
68
|
if (!workerModule?.default) throw new Error(`Cloudflare Worker entry "${entry.file}" does not export a default handler. The Powerlines Cloudflare plugin expects each Worker entry module to export a default object matching the \`ExportedHandler\` interface from "@cloudflare/workers-types".`);
|
|
69
69
|
const name = workerModule.metadata?.name || (0, _stryke_path.replaceExtension)(entry.input.file || entry.file) || arr.length > 1 ? `${this.config.name}-${i}` : this.config.name;
|
|
70
70
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -10,13 +10,13 @@ import { render } from "@powerlines/plugin-alloy/render";
|
|
|
10
10
|
import { extractEnv } from "@powerlines/plugin-env/helpers";
|
|
11
11
|
import pulumi from "@powerlines/plugin-pulumi";
|
|
12
12
|
import unenv from "@powerlines/plugin-unenv";
|
|
13
|
-
import { resolveModule } from "@powerlines/schema";
|
|
14
13
|
import * as pulumiCloudflare from "@pulumi/cloudflare";
|
|
15
14
|
import { omit } from "@stryke/helpers/omit";
|
|
16
15
|
import { joinPaths, replaceExtension } from "@stryke/path";
|
|
17
16
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
18
17
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
19
18
|
import defu from "defu";
|
|
19
|
+
import { resolveModule } from "powerlines/schema";
|
|
20
20
|
import { unstable_readConfig } from "wrangler";
|
|
21
21
|
|
|
22
22
|
//#region src/index.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-cloudflare",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.249",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin that provides integration with Cloudflare services.",
|
|
6
6
|
"keywords": ["powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -207,33 +207,33 @@
|
|
|
207
207
|
"zod": "^3.25.0 || ^4.0.0"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@alloy-js/core": "^0.
|
|
211
|
-
"@alloy-js/typescript": "^0.
|
|
212
|
-
"@
|
|
213
|
-
"@powerlines/plugin-
|
|
214
|
-
"@powerlines/plugin-
|
|
215
|
-
"@powerlines/
|
|
216
|
-
"@pulumi/cloudflare": "^6.
|
|
210
|
+
"@alloy-js/core": "^0.24.1",
|
|
211
|
+
"@alloy-js/typescript": "^0.24.0",
|
|
212
|
+
"@power-plant/alloy-js": "^0.0.20",
|
|
213
|
+
"@powerlines/plugin-env": "^0.16.350",
|
|
214
|
+
"@powerlines/plugin-pulumi": "^0.6.248",
|
|
215
|
+
"@powerlines/plugin-unenv": "^0.1.596",
|
|
216
|
+
"@pulumi/cloudflare": "^6.18.0",
|
|
217
217
|
"@pulumi/pulumi": "^3.253.0",
|
|
218
|
-
"@storm-software/config-tools": "^1.190.
|
|
219
|
-
"@stryke/hash": "^0.13.
|
|
220
|
-
"@stryke/helpers": "^0.10.
|
|
221
|
-
"@stryke/path": "^0.29.
|
|
222
|
-
"@stryke/string-format": "^0.17.
|
|
223
|
-
"@stryke/type-checks": "^0.6.
|
|
224
|
-
"@stryke/types": "^0.12.
|
|
218
|
+
"@storm-software/config-tools": "^1.190.109",
|
|
219
|
+
"@stryke/hash": "^0.13.50",
|
|
220
|
+
"@stryke/helpers": "^0.10.36",
|
|
221
|
+
"@stryke/path": "^0.29.23",
|
|
222
|
+
"@stryke/string-format": "^0.17.38",
|
|
223
|
+
"@stryke/type-checks": "^0.6.29",
|
|
224
|
+
"@stryke/types": "^0.12.24",
|
|
225
225
|
"defu": "^6.1.7",
|
|
226
|
-
"powerlines": "0.47.
|
|
226
|
+
"powerlines": "^0.47.146"
|
|
227
227
|
},
|
|
228
228
|
"devDependencies": {
|
|
229
229
|
"@cloudflare/unenv-preset": "^2.16.1",
|
|
230
230
|
"@cloudflare/workers-types": "^4.20260702.1",
|
|
231
|
-
"@powerlines/plugin-alloy": "0.26.
|
|
232
|
-
"@powerlines/plugin-plugin": "0.12.
|
|
231
|
+
"@powerlines/plugin-alloy": "^0.26.239",
|
|
232
|
+
"@powerlines/plugin-plugin": "^0.12.558",
|
|
233
233
|
"@types/node": "^25.9.5",
|
|
234
|
-
"wrangler": "^4.
|
|
234
|
+
"wrangler": "^4.114.0",
|
|
235
235
|
"zod": "^4.4.3"
|
|
236
236
|
},
|
|
237
237
|
"publishConfig": { "access": "public" },
|
|
238
|
-
"gitHead": "
|
|
238
|
+
"gitHead": "e86d6fab3bd4d2e2f9f6d05df8df7a07d399857e"
|
|
239
239
|
}
|