@powerlines/plugin-cloudflare 0.2.23 → 0.2.25

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.
@@ -8,6 +8,7 @@ let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy
8
8
  let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
9
9
  let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
10
10
  let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
11
12
 
12
13
  //#region src/components/cloudflare-builtin.tsx
13
14
  /**
@@ -15,450 +16,847 @@ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/
15
16
  */
16
17
  function CloudflareBuiltin(props) {
17
18
  const [{ imports, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["imports", "children"]);
18
- return <_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile id="cloudflare" description="A set of helpful runtime utilities for integrating Cloudflare services." {...rest} imports={(0, defu.default)({
19
- "node:async_hooks": ["AsyncLocalStorage"],
20
- "@cloudflare/workers-types": [
21
- {
22
- name: "Request",
23
- type: true
24
- },
25
- {
26
- name: "Response",
27
- type: true
28
- },
29
- {
30
- name: "ExecutionContext",
31
- type: true
32
- },
33
- {
34
- name: "IncomingRequestCfProperties",
35
- type: true
36
- },
37
- {
38
- name: "ScheduledController",
39
- type: true
40
- },
41
- {
42
- name: "ForwardableEmailMessage",
43
- type: true
44
- },
45
- {
46
- name: "MessageBatch",
47
- type: true
48
- },
49
- {
50
- name: "TailStream",
51
- type: true
52
- },
53
- {
54
- name: "TraceItem",
55
- type: true
56
- },
57
- {
58
- name: "TailStream.TailEvent",
59
- type: true
60
- },
61
- {
62
- name: "TailStream.Onset",
63
- type: true
64
- },
65
- {
66
- name: "TailStream.TailEventHandlerType",
67
- type: true
68
- }
69
- ]
70
- }, imports ?? {})}>
71
- <_alloy_js_typescript.VarDeclaration const name="globalContextStorage" initializer={_alloy_js_core.code`globalThis as unknown as Record<PropertyKey, unknown>; `} />
72
- <_powerlines_plugin_alloy_core_components.Spacing />
73
- <_powerlines_plugin_alloy_core_components.Spacing />
74
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareFetchContext" typeParameters={[{
75
- name: "Env",
76
- default: "CloudflareBindings"
77
- }, {
78
- name: "CfHostMetadata",
79
- default: "unknown"
80
- }]} doc="An interface representing the runtime context for Cloudflare operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
81
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="request" type="Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>" doc="The incoming Cloudflare request." />
82
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
83
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the incoming request." />
84
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
85
- <hbr />
86
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_FETCH_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-fetch"); `} />
87
- <hbr />
88
- <_alloy_js_typescript.VarDeclaration export const name="fetchContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare fetch context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_FETCH_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareFetchContext>()) as AsyncLocalStorage<CloudflareFetchContext>; `} />
89
- <hbr />
90
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
91
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare fetch context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
92
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
93
- <_alloy_js_typescript.FunctionDeclaration export name="getFetchContext" typeParameters={[{
94
- name: "Env",
95
- default: "CloudflareBindings"
96
- }, {
97
- name: "CfHostMetadata",
98
- default: "unknown"
99
- }]} parameters={[]} returnType="CloudflareFetchContext<Env, CfHostMetadata>">
100
- {_alloy_js_core.code`const context = fetchContextStorage.getStore();
19
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, {
20
+ id: "cloudflare",
21
+ description: "A set of helpful runtime utilities for integrating Cloudflare services.",
22
+ ...rest,
23
+ imports: (0, defu.default)({
24
+ "node:async_hooks": ["AsyncLocalStorage"],
25
+ "@cloudflare/workers-types": [
26
+ {
27
+ name: "Request",
28
+ type: true
29
+ },
30
+ {
31
+ name: "Response",
32
+ type: true
33
+ },
34
+ {
35
+ name: "ExecutionContext",
36
+ type: true
37
+ },
38
+ {
39
+ name: "IncomingRequestCfProperties",
40
+ type: true
41
+ },
42
+ {
43
+ name: "ScheduledController",
44
+ type: true
45
+ },
46
+ {
47
+ name: "ForwardableEmailMessage",
48
+ type: true
49
+ },
50
+ {
51
+ name: "MessageBatch",
52
+ type: true
53
+ },
54
+ {
55
+ name: "TailStream",
56
+ type: true
57
+ },
58
+ {
59
+ name: "TraceItem",
60
+ type: true
61
+ },
62
+ {
63
+ name: "TailStream.TailEvent",
64
+ type: true
65
+ },
66
+ {
67
+ name: "TailStream.Onset",
68
+ type: true
69
+ },
70
+ {
71
+ name: "TailStream.TailEventHandlerType",
72
+ type: true
73
+ }
74
+ ]
75
+ }, imports ?? {}),
76
+ children: [
77
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
78
+ const: true,
79
+ name: "globalContextStorage",
80
+ initializer: _alloy_js_core.code`globalThis as unknown as Record<PropertyKey, unknown>; `
81
+ }),
82
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
83
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
84
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
85
+ export: true,
86
+ name: "CloudflareFetchContext",
87
+ typeParameters: [{
88
+ name: "Env",
89
+ default: "CloudflareBindings"
90
+ }, {
91
+ name: "CfHostMetadata",
92
+ default: "unknown"
93
+ }],
94
+ doc: "An interface representing the runtime context for Cloudflare operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
95
+ children: [
96
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
97
+ name: "request",
98
+ type: "Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>",
99
+ doc: "The incoming Cloudflare request."
100
+ }),
101
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
102
+ name: "env",
103
+ type: "Env",
104
+ doc: "The Cloudflare environment bindings available during runtime."
105
+ }),
106
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
107
+ name: "ctx",
108
+ type: "ExecutionContext",
109
+ doc: "The Cloudflare execution context for the incoming request."
110
+ })
111
+ ]
112
+ }),
113
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
114
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
115
+ const: true,
116
+ name: "CLOUDFLARE_FETCH_CONTEXT_KEY",
117
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-fetch"); `
118
+ }),
119
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
120
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
121
+ export: true,
122
+ const: true,
123
+ name: "fetchContextStorage",
124
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare fetch context.",
125
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_FETCH_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareFetchContext>()) as AsyncLocalStorage<CloudflareFetchContext>; `
126
+ }),
127
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
128
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
129
+ 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.",
130
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare fetch context.` })
131
+ }),
132
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
133
+ export: true,
134
+ name: "getFetchContext",
135
+ typeParameters: [{
136
+ name: "Env",
137
+ default: "CloudflareBindings"
138
+ }, {
139
+ name: "CfHostMetadata",
140
+ default: "unknown"
141
+ }],
142
+ parameters: [],
143
+ returnType: "CloudflareFetchContext<Env, CfHostMetadata>",
144
+ children: _alloy_js_core.code`const context = fetchContextStorage.getStore();
101
145
  if (!context) {
102
146
  throw new Error("Cloudflare fetch context is not available. Ensure that you are calling this function within the scope of a Cloudflare fetch request.");
103
147
  }
104
- return context as CloudflareFetchContext<Env, CfHostMetadata>; `}
105
- </_alloy_js_typescript.FunctionDeclaration>
106
- <hbr />
107
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
108
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare fetch context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
109
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
110
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
111
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
112
- <_alloy_js_typescript.FunctionDeclaration export name="withFetchContext" typeParameters={[{
113
- name: "Env",
114
- default: "CloudflareBindings"
115
- }, {
116
- name: "CfHostMetadata",
117
- default: "unknown"
118
- }]} parameters={[{
119
- name: "context",
120
- type: "CloudflareFetchContext<Env, CfHostMetadata>"
121
- }, {
122
- name: "callback",
123
- type: "(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Promise<Response>"
124
- }]} returnType="Promise<Response>">
125
- {_alloy_js_core.code`return fetchContextStorage.run(context, () => callback(context.request, context.env, context.ctx)); `}
126
- </_alloy_js_typescript.FunctionDeclaration>
127
- <_powerlines_plugin_alloy_core_components.Spacing />
128
- <_powerlines_plugin_alloy_core_components.Spacing />
129
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareScheduledContext" typeParameters={[{
130
- name: "Env",
131
- default: "CloudflareBindings"
132
- }]} doc="An interface representing the runtime context for Cloudflare scheduled operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
133
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="controller" type="ScheduledController" doc="The Cloudflare scheduled controller for the scheduled operation." />
134
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
135
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the scheduled operation." />
136
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
137
- <hbr />
138
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_SCHEDULED_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-scheduled"); `} />
139
- <hbr />
140
- <_alloy_js_typescript.VarDeclaration export const name="scheduledContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare scheduled runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_SCHEDULED_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareScheduledContext>()) as AsyncLocalStorage<CloudflareScheduledContext>; `} />
141
- <hbr />
142
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
143
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare scheduled runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
144
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
145
- <_alloy_js_typescript.FunctionDeclaration export name="getScheduledContext" typeParameters={[{
146
- name: "Env",
147
- default: "CloudflareBindings"
148
- }]} parameters={[]} returnType="CloudflareScheduledContext<Env>">
149
- {_alloy_js_core.code`const context = scheduledContextStorage.getStore();
148
+ return context as CloudflareFetchContext<Env, CfHostMetadata>; `
149
+ }),
150
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
151
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
152
+ 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.",
153
+ children: [
154
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
155
+ name: "context",
156
+ children: _alloy_js_core.code`The Cloudflare fetch context to run the function with.`
157
+ }),
158
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
159
+ name: "callback",
160
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
161
+ }),
162
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
163
+ ]
164
+ }),
165
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
166
+ export: true,
167
+ name: "withFetchContext",
168
+ typeParameters: [{
169
+ name: "Env",
170
+ default: "CloudflareBindings"
171
+ }, {
172
+ name: "CfHostMetadata",
173
+ default: "unknown"
174
+ }],
175
+ parameters: [{
176
+ name: "context",
177
+ type: "CloudflareFetchContext<Env, CfHostMetadata>"
178
+ }, {
179
+ name: "callback",
180
+ type: "(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Promise<Response>"
181
+ }],
182
+ returnType: "Promise<Response>",
183
+ children: _alloy_js_core.code`return fetchContextStorage.run(context, () => callback(context.request, context.env, context.ctx)); `
184
+ }),
185
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
186
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
187
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
188
+ export: true,
189
+ name: "CloudflareScheduledContext",
190
+ typeParameters: [{
191
+ name: "Env",
192
+ default: "CloudflareBindings"
193
+ }],
194
+ doc: "An interface representing the runtime context for Cloudflare scheduled operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
195
+ children: [
196
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
197
+ name: "controller",
198
+ type: "ScheduledController",
199
+ doc: "The Cloudflare scheduled controller for the scheduled operation."
200
+ }),
201
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
202
+ name: "env",
203
+ type: "Env",
204
+ doc: "The Cloudflare environment bindings available during runtime."
205
+ }),
206
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
207
+ name: "ctx",
208
+ type: "ExecutionContext",
209
+ doc: "The Cloudflare execution context for the scheduled operation."
210
+ })
211
+ ]
212
+ }),
213
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
214
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
215
+ const: true,
216
+ name: "CLOUDFLARE_SCHEDULED_CONTEXT_KEY",
217
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-scheduled"); `
218
+ }),
219
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
220
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
221
+ export: true,
222
+ const: true,
223
+ name: "scheduledContextStorage",
224
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare scheduled runtime context.",
225
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_SCHEDULED_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareScheduledContext>()) as AsyncLocalStorage<CloudflareScheduledContext>; `
226
+ }),
227
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
228
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
229
+ 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.",
230
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare scheduled runtime context.` })
231
+ }),
232
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
233
+ export: true,
234
+ name: "getScheduledContext",
235
+ typeParameters: [{
236
+ name: "Env",
237
+ default: "CloudflareBindings"
238
+ }],
239
+ parameters: [],
240
+ returnType: "CloudflareScheduledContext<Env>",
241
+ children: _alloy_js_core.code`const context = scheduledContextStorage.getStore();
150
242
  if (!context) {
151
243
  throw new Error("Cloudflare scheduled context is not available. Ensure that you are calling this function within the scope of a Cloudflare scheduled operation.");
152
244
  }
153
- return context as CloudflareScheduledContext<Env>; `}
154
- </_alloy_js_typescript.FunctionDeclaration>
155
- <hbr />
156
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
157
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare scheduled context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
158
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
159
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
160
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
161
- <_alloy_js_typescript.FunctionDeclaration export name="withScheduledContext" typeParameters={[{
162
- name: "Env",
163
- default: "CloudflareBindings"
164
- }]} parameters={[{
165
- name: "context",
166
- type: "CloudflareScheduledContext<Env>"
167
- }, {
168
- name: "callback",
169
- type: "(ctx: CloudflareScheduledContext<Env>) => Promise<void>"
170
- }]} returnType="Promise<void>">
171
- {_alloy_js_core.code`return scheduledContextStorage.run(context, () => callback(context)); `}
172
- </_alloy_js_typescript.FunctionDeclaration>
173
- <_powerlines_plugin_alloy_core_components.Spacing />
174
- <_powerlines_plugin_alloy_core_components.Spacing />
175
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareEmailContext" typeParameters={[{
176
- name: "Env",
177
- default: "CloudflareBindings"
178
- }]} doc="An interface representing the runtime context for Cloudflare email operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
179
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="message" type="ForwardableEmailMessage" doc="The Cloudflare email instance for the email operation." />
180
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
181
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the email operation." />
182
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
183
- <hbr />
184
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_EMAIL_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-email"); `} />
185
- <hbr />
186
- <_alloy_js_typescript.VarDeclaration export const name="emailContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare email runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_EMAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareEmailContext>()) as AsyncLocalStorage<CloudflareEmailContext>; `} />
187
- <hbr />
188
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
189
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare email runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
190
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
191
- <_alloy_js_typescript.FunctionDeclaration export name="getEmailContext" typeParameters={[{
192
- name: "Env",
193
- default: "CloudflareBindings"
194
- }]} parameters={[]} returnType="CloudflareEmailContext<Env>">
195
- {_alloy_js_core.code`const context = emailContextStorage.getStore();
245
+ return context as CloudflareScheduledContext<Env>; `
246
+ }),
247
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
248
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
249
+ 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.",
250
+ children: [
251
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
252
+ name: "context",
253
+ children: _alloy_js_core.code`The Cloudflare scheduled context to run the function with.`
254
+ }),
255
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
256
+ name: "callback",
257
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
258
+ }),
259
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
260
+ ]
261
+ }),
262
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
263
+ export: true,
264
+ name: "withScheduledContext",
265
+ typeParameters: [{
266
+ name: "Env",
267
+ default: "CloudflareBindings"
268
+ }],
269
+ parameters: [{
270
+ name: "context",
271
+ type: "CloudflareScheduledContext<Env>"
272
+ }, {
273
+ name: "callback",
274
+ type: "(ctx: CloudflareScheduledContext<Env>) => Promise<void>"
275
+ }],
276
+ returnType: "Promise<void>",
277
+ children: _alloy_js_core.code`return scheduledContextStorage.run(context, () => callback(context)); `
278
+ }),
279
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
280
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
281
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
282
+ export: true,
283
+ name: "CloudflareEmailContext",
284
+ typeParameters: [{
285
+ name: "Env",
286
+ default: "CloudflareBindings"
287
+ }],
288
+ doc: "An interface representing the runtime context for Cloudflare email operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
289
+ children: [
290
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
291
+ name: "message",
292
+ type: "ForwardableEmailMessage",
293
+ doc: "The Cloudflare email instance for the email operation."
294
+ }),
295
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
296
+ name: "env",
297
+ type: "Env",
298
+ doc: "The Cloudflare environment bindings available during runtime."
299
+ }),
300
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
301
+ name: "ctx",
302
+ type: "ExecutionContext",
303
+ doc: "The Cloudflare execution context for the email operation."
304
+ })
305
+ ]
306
+ }),
307
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
308
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
309
+ const: true,
310
+ name: "CLOUDFLARE_EMAIL_CONTEXT_KEY",
311
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-email"); `
312
+ }),
313
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
314
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
315
+ export: true,
316
+ const: true,
317
+ name: "emailContextStorage",
318
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare email runtime context.",
319
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_EMAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareEmailContext>()) as AsyncLocalStorage<CloudflareEmailContext>; `
320
+ }),
321
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
322
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
323
+ 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.",
324
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare email runtime context.` })
325
+ }),
326
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
327
+ export: true,
328
+ name: "getEmailContext",
329
+ typeParameters: [{
330
+ name: "Env",
331
+ default: "CloudflareBindings"
332
+ }],
333
+ parameters: [],
334
+ returnType: "CloudflareEmailContext<Env>",
335
+ children: _alloy_js_core.code`const context = emailContextStorage.getStore();
196
336
  if (!context) {
197
337
  throw new Error("Cloudflare email context is not available. Ensure that you are calling this function within the scope of a Cloudflare email operation.");
198
338
  }
199
- return context as CloudflareEmailContext<Env>; `}
200
- </_alloy_js_typescript.FunctionDeclaration>
201
- <hbr />
202
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
203
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare email context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
204
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
205
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`A promise that resolves with the result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
206
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
207
- <_alloy_js_typescript.FunctionDeclaration export name="withEmailContext" typeParameters={[{
208
- name: "Env",
209
- default: "CloudflareBindings"
210
- }]} parameters={[{
211
- name: "context",
212
- type: "CloudflareEmailContext<Env>"
213
- }, {
214
- name: "callback",
215
- type: "(ctx: CloudflareEmailContext<Env>) => Promise<void>"
216
- }]} returnType="Promise<void>">
217
- {_alloy_js_core.code`return emailContextStorage.run(context, () => callback(context)); `}
218
- </_alloy_js_typescript.FunctionDeclaration>
219
- <_powerlines_plugin_alloy_core_components.Spacing />
220
- <_powerlines_plugin_alloy_core_components.Spacing />
221
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareQueueContext" typeParameters={[{
222
- name: "Message",
223
- default: "unknown"
224
- }, {
225
- name: "Env",
226
- default: "CloudflareBindings"
227
- }]} doc="An interface representing the runtime context for Cloudflare queue operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
228
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="batch" type="MessageBatch<Message>" doc="The Cloudflare queue event instance for the queue operation." />
229
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
230
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the queue operation." />
231
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
232
- <hbr />
233
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_QUEUE_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-queue"); `} />
234
- <hbr />
235
- <_alloy_js_typescript.VarDeclaration export const name="queueContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare queue runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_QUEUE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareQueueContext>()) as AsyncLocalStorage<CloudflareQueueContext>; `} />
236
- <hbr />
237
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
238
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare queue runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
239
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
240
- <_alloy_js_typescript.FunctionDeclaration export name="getQueueContext" typeParameters={[{
241
- name: "Message",
242
- default: "unknown"
243
- }, {
244
- name: "Env",
245
- default: "CloudflareBindings"
246
- }]} parameters={[]} returnType="CloudflareQueueContext<Message, Env>">
247
- {_alloy_js_core.code`const context = queueContextStorage.getStore();
339
+ return context as CloudflareEmailContext<Env>; `
340
+ }),
341
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
342
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
343
+ 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.",
344
+ children: [
345
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
346
+ name: "context",
347
+ children: _alloy_js_core.code`The Cloudflare email context to run the function with.`
348
+ }),
349
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
350
+ name: "callback",
351
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
352
+ }),
353
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`A promise that resolves with the result of the executed function.` })
354
+ ]
355
+ }),
356
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
357
+ export: true,
358
+ name: "withEmailContext",
359
+ typeParameters: [{
360
+ name: "Env",
361
+ default: "CloudflareBindings"
362
+ }],
363
+ parameters: [{
364
+ name: "context",
365
+ type: "CloudflareEmailContext<Env>"
366
+ }, {
367
+ name: "callback",
368
+ type: "(ctx: CloudflareEmailContext<Env>) => Promise<void>"
369
+ }],
370
+ returnType: "Promise<void>",
371
+ children: _alloy_js_core.code`return emailContextStorage.run(context, () => callback(context)); `
372
+ }),
373
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
374
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
375
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
376
+ export: true,
377
+ name: "CloudflareQueueContext",
378
+ typeParameters: [{
379
+ name: "Message",
380
+ default: "unknown"
381
+ }, {
382
+ name: "Env",
383
+ default: "CloudflareBindings"
384
+ }],
385
+ doc: "An interface representing the runtime context for Cloudflare queue operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
386
+ children: [
387
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
388
+ name: "batch",
389
+ type: "MessageBatch<Message>",
390
+ doc: "The Cloudflare queue event instance for the queue operation."
391
+ }),
392
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
393
+ name: "env",
394
+ type: "Env",
395
+ doc: "The Cloudflare environment bindings available during runtime."
396
+ }),
397
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
398
+ name: "ctx",
399
+ type: "ExecutionContext",
400
+ doc: "The Cloudflare execution context for the queue operation."
401
+ })
402
+ ]
403
+ }),
404
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
405
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
406
+ const: true,
407
+ name: "CLOUDFLARE_QUEUE_CONTEXT_KEY",
408
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-queue"); `
409
+ }),
410
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
411
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
412
+ export: true,
413
+ const: true,
414
+ name: "queueContextStorage",
415
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare queue runtime context.",
416
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_QUEUE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareQueueContext>()) as AsyncLocalStorage<CloudflareQueueContext>; `
417
+ }),
418
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
419
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
420
+ 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.",
421
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare queue runtime context.` })
422
+ }),
423
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
424
+ export: true,
425
+ name: "getQueueContext",
426
+ typeParameters: [{
427
+ name: "Message",
428
+ default: "unknown"
429
+ }, {
430
+ name: "Env",
431
+ default: "CloudflareBindings"
432
+ }],
433
+ parameters: [],
434
+ returnType: "CloudflareQueueContext<Message, Env>",
435
+ children: _alloy_js_core.code`const context = queueContextStorage.getStore();
248
436
  if (!context) {
249
437
  throw new Error("Cloudflare queue context is not available. Ensure that you are calling this function within the scope of a Cloudflare queue operation.");
250
438
  }
251
- return context as CloudflareQueueContext<Message, Env>; `}
252
- </_alloy_js_typescript.FunctionDeclaration>
253
- <hbr />
254
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
255
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare queue context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
256
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
257
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
258
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
259
- <_alloy_js_typescript.FunctionDeclaration export name="withQueueContext" typeParameters={[{
260
- name: "Message",
261
- default: "unknown"
262
- }, {
263
- name: "Env",
264
- default: "CloudflareBindings"
265
- }]} parameters={[{
266
- name: "context",
267
- type: "CloudflareQueueContext<Message, Env>"
268
- }, {
269
- name: "callback",
270
- type: "(ctx: CloudflareQueueContext<Message, Env>) => Promise<void>"
271
- }]} returnType="Promise<void>">
272
- {_alloy_js_core.code`return queueContextStorage.run(context, () => callback(context)); `}
273
- </_alloy_js_typescript.FunctionDeclaration>
274
- <_powerlines_plugin_alloy_core_components.Spacing />
275
- <_powerlines_plugin_alloy_core_components.Spacing />
276
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareTailContext" typeParameters={[{
277
- name: "Env",
278
- default: "CloudflareBindings"
279
- }]} doc="An interface representing the tail context for Cloudflare tail operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
280
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="events" type="TraceItem[]" doc="An array of trace items representing the events in the Cloudflare tail context." />
281
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
282
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the tail operation." />
283
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
284
- <hbr />
285
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_TAIL_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-tail"); `} />
286
- <hbr />
287
- <_alloy_js_typescript.VarDeclaration export const name="tailContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare tail runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailContext>()) as AsyncLocalStorage<CloudflareTailContext>; `} />
288
- <hbr />
289
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
290
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare tail runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
291
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
292
- <_alloy_js_typescript.FunctionDeclaration export name="getTailContext" typeParameters={[{
293
- name: "Env",
294
- default: "CloudflareBindings"
295
- }]} parameters={[]} returnType="CloudflareTailContext<Env>">
296
- {_alloy_js_core.code`const context = tailContextStorage.getStore();
439
+ return context as CloudflareQueueContext<Message, Env>; `
440
+ }),
441
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
442
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
443
+ 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.",
444
+ children: [
445
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
446
+ name: "context",
447
+ children: _alloy_js_core.code`The Cloudflare queue context to run the function with.`
448
+ }),
449
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
450
+ name: "callback",
451
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
452
+ }),
453
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
454
+ ]
455
+ }),
456
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
457
+ export: true,
458
+ name: "withQueueContext",
459
+ typeParameters: [{
460
+ name: "Message",
461
+ default: "unknown"
462
+ }, {
463
+ name: "Env",
464
+ default: "CloudflareBindings"
465
+ }],
466
+ parameters: [{
467
+ name: "context",
468
+ type: "CloudflareQueueContext<Message, Env>"
469
+ }, {
470
+ name: "callback",
471
+ type: "(ctx: CloudflareQueueContext<Message, Env>) => Promise<void>"
472
+ }],
473
+ returnType: "Promise<void>",
474
+ children: _alloy_js_core.code`return queueContextStorage.run(context, () => callback(context)); `
475
+ }),
476
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
477
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
478
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
479
+ export: true,
480
+ name: "CloudflareTailContext",
481
+ typeParameters: [{
482
+ name: "Env",
483
+ default: "CloudflareBindings"
484
+ }],
485
+ doc: "An interface representing the tail context for Cloudflare tail operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
486
+ children: [
487
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
488
+ name: "events",
489
+ type: "TraceItem[]",
490
+ doc: "An array of trace items representing the events in the Cloudflare tail context."
491
+ }),
492
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
493
+ name: "env",
494
+ type: "Env",
495
+ doc: "The Cloudflare environment bindings available during runtime."
496
+ }),
497
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
498
+ name: "ctx",
499
+ type: "ExecutionContext",
500
+ doc: "The Cloudflare execution context for the tail operation."
501
+ })
502
+ ]
503
+ }),
504
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
505
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
506
+ const: true,
507
+ name: "CLOUDFLARE_TAIL_CONTEXT_KEY",
508
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-tail"); `
509
+ }),
510
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
511
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
512
+ export: true,
513
+ const: true,
514
+ name: "tailContextStorage",
515
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare tail runtime context.",
516
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailContext>()) as AsyncLocalStorage<CloudflareTailContext>; `
517
+ }),
518
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
519
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
520
+ 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.",
521
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare tail runtime context.` })
522
+ }),
523
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
524
+ export: true,
525
+ name: "getTailContext",
526
+ typeParameters: [{
527
+ name: "Env",
528
+ default: "CloudflareBindings"
529
+ }],
530
+ parameters: [],
531
+ returnType: "CloudflareTailContext<Env>",
532
+ children: _alloy_js_core.code`const context = tailContextStorage.getStore();
297
533
  if (!context) {
298
534
  throw new Error("Cloudflare tail context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail operation.");
299
535
  }
300
- return context as CloudflareTailContext<Env>; `}
301
- </_alloy_js_typescript.FunctionDeclaration>
302
- <hbr />
303
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
304
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare tail context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
305
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
306
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
307
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
308
- <_alloy_js_typescript.FunctionDeclaration export name="withTailContext" typeParameters={[{
309
- name: "Env",
310
- default: "CloudflareBindings"
311
- }]} parameters={[{
312
- name: "context",
313
- type: "CloudflareTailContext<Env>"
314
- }, {
315
- name: "callback",
316
- type: "(ctx: CloudflareTailContext<Env>) => Promise<void>"
317
- }]} returnType="T">
318
- {_alloy_js_core.code`return tailContextStorage.run(context, () => callback(context)); `}
319
- </_alloy_js_typescript.FunctionDeclaration>
320
- <_powerlines_plugin_alloy_core_components.Spacing />
321
- <_powerlines_plugin_alloy_core_components.Spacing />
322
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareTailStreamContext" typeParameters={[{
323
- name: "Env",
324
- default: "CloudflareBindings"
325
- }]} doc="An interface representing the tail context for Cloudflare tail stream operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
326
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="event" type="TailStream.TailEvent<TailStream.Onset>" doc="The tail event associated with the Cloudflare tail stream context." />
327
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
328
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the tail stream operation." />
329
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
330
- <hbr />
331
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-tail-stream"); `} />
332
- <hbr />
333
- <_alloy_js_typescript.VarDeclaration export const name="tailStreamContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare tail stream runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailStreamContext>()) as AsyncLocalStorage<CloudflareTailStreamContext>; `} />
334
- <hbr />
335
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
336
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare tail stream runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
337
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
338
- <_alloy_js_typescript.FunctionDeclaration export name="getTailStreamContext" typeParameters={[{
339
- name: "Env",
340
- default: "CloudflareBindings"
341
- }]} parameters={[]} returnType="CloudflareTailStreamContext<Env>">
342
- {_alloy_js_core.code`const context = tailStreamContextStorage.getStore();
536
+ return context as CloudflareTailContext<Env>; `
537
+ }),
538
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
539
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
540
+ 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.",
541
+ children: [
542
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
543
+ name: "context",
544
+ children: _alloy_js_core.code`The Cloudflare tail context to run the function with.`
545
+ }),
546
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
547
+ name: "callback",
548
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
549
+ }),
550
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
551
+ ]
552
+ }),
553
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
554
+ export: true,
555
+ name: "withTailContext",
556
+ typeParameters: [{
557
+ name: "Env",
558
+ default: "CloudflareBindings"
559
+ }],
560
+ parameters: [{
561
+ name: "context",
562
+ type: "CloudflareTailContext<Env>"
563
+ }, {
564
+ name: "callback",
565
+ type: "(ctx: CloudflareTailContext<Env>) => Promise<void>"
566
+ }],
567
+ returnType: "T",
568
+ children: _alloy_js_core.code`return tailContextStorage.run(context, () => callback(context)); `
569
+ }),
570
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
571
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
572
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
573
+ export: true,
574
+ name: "CloudflareTailStreamContext",
575
+ typeParameters: [{
576
+ name: "Env",
577
+ default: "CloudflareBindings"
578
+ }],
579
+ doc: "An interface representing the tail context for Cloudflare tail stream operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
580
+ children: [
581
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
582
+ name: "event",
583
+ type: "TailStream.TailEvent<TailStream.Onset>",
584
+ doc: "The tail event associated with the Cloudflare tail stream context."
585
+ }),
586
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
587
+ name: "env",
588
+ type: "Env",
589
+ doc: "The Cloudflare environment bindings available during runtime."
590
+ }),
591
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
592
+ name: "ctx",
593
+ type: "ExecutionContext",
594
+ doc: "The Cloudflare execution context for the tail stream operation."
595
+ })
596
+ ]
597
+ }),
598
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
599
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
600
+ const: true,
601
+ name: "CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY",
602
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-tail-stream"); `
603
+ }),
604
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
605
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
606
+ export: true,
607
+ const: true,
608
+ name: "tailStreamContextStorage",
609
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare tail stream runtime context.",
610
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailStreamContext>()) as AsyncLocalStorage<CloudflareTailStreamContext>; `
611
+ }),
612
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
613
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
614
+ 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.",
615
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare tail stream runtime context.` })
616
+ }),
617
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
618
+ export: true,
619
+ name: "getTailStreamContext",
620
+ typeParameters: [{
621
+ name: "Env",
622
+ default: "CloudflareBindings"
623
+ }],
624
+ parameters: [],
625
+ returnType: "CloudflareTailStreamContext<Env>",
626
+ children: _alloy_js_core.code`const context = tailStreamContextStorage.getStore();
343
627
  if (!context) {
344
628
  throw new Error("Cloudflare tail stream context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail stream operation.");
345
629
  }
346
- return context as CloudflareTailStreamContext<Env>; `}
347
- </_alloy_js_typescript.FunctionDeclaration>
348
- <hbr />
349
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
350
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare tail stream context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
351
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
352
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
353
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
354
- <_alloy_js_typescript.FunctionDeclaration export name="withTailStreamContext" typeParameters={[{
355
- name: "Env",
356
- default: "CloudflareBindings"
357
- }]} parameters={[{
358
- name: "context",
359
- type: "CloudflareTailStreamContext<Env>"
360
- }, {
361
- name: "callback",
362
- type: "(ctx: CloudflareTailStreamContext<Env>) => Promise<TailStream.TailEventHandlerType>"
363
- }]} returnType="Promise<TailStream.TailEventHandlerType>">
364
- {_alloy_js_core.code`return tailStreamContextStorage.run(context, () => callback(context)); `}
365
- </_alloy_js_typescript.FunctionDeclaration>
366
- <_powerlines_plugin_alloy_core_components.Spacing />
367
- <_powerlines_plugin_alloy_core_components.Spacing />
368
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareTraceContext" typeParameters={[{
369
- name: "Env",
370
- default: "CloudflareBindings"
371
- }]} doc="An interface representing the trace context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
372
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="traces" type="TraceItem[]" doc="An array of trace items associated with the Cloudflare trace context." />
373
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
374
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the trace operation." />
375
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
376
- <hbr />
377
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_TRACE_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-trace"); `} />
378
- <hbr />
379
- <_alloy_js_typescript.VarDeclaration export const name="traceContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare trace runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TRACE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTraceContext>()) as AsyncLocalStorage<CloudflareTraceContext>; `} />
380
- <hbr />
381
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
382
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare trace runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
383
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
384
- <_alloy_js_typescript.FunctionDeclaration export name="getTraceContext" typeParameters={[{
385
- name: "Env",
386
- default: "CloudflareBindings"
387
- }]} parameters={[]} returnType="CloudflareTraceContext<Env>">
388
- {_alloy_js_core.code`const context = traceContextStorage.getStore();
630
+ return context as CloudflareTailStreamContext<Env>; `
631
+ }),
632
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
633
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
634
+ 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.",
635
+ children: [
636
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
637
+ name: "context",
638
+ children: _alloy_js_core.code`The Cloudflare tail stream context to run the function with.`
639
+ }),
640
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
641
+ name: "callback",
642
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
643
+ }),
644
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
645
+ ]
646
+ }),
647
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
648
+ export: true,
649
+ name: "withTailStreamContext",
650
+ typeParameters: [{
651
+ name: "Env",
652
+ default: "CloudflareBindings"
653
+ }],
654
+ parameters: [{
655
+ name: "context",
656
+ type: "CloudflareTailStreamContext<Env>"
657
+ }, {
658
+ name: "callback",
659
+ type: "(ctx: CloudflareTailStreamContext<Env>) => Promise<TailStream.TailEventHandlerType>"
660
+ }],
661
+ returnType: "Promise<TailStream.TailEventHandlerType>",
662
+ children: _alloy_js_core.code`return tailStreamContextStorage.run(context, () => callback(context)); `
663
+ }),
664
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
665
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
666
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
667
+ export: true,
668
+ name: "CloudflareTraceContext",
669
+ typeParameters: [{
670
+ name: "Env",
671
+ default: "CloudflareBindings"
672
+ }],
673
+ doc: "An interface representing the trace context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
674
+ children: [
675
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
676
+ name: "traces",
677
+ type: "TraceItem[]",
678
+ doc: "An array of trace items associated with the Cloudflare trace context."
679
+ }),
680
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
681
+ name: "env",
682
+ type: "Env",
683
+ doc: "The Cloudflare environment bindings available during runtime."
684
+ }),
685
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
686
+ name: "ctx",
687
+ type: "ExecutionContext",
688
+ doc: "The Cloudflare execution context for the trace operation."
689
+ })
690
+ ]
691
+ }),
692
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
693
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
694
+ const: true,
695
+ name: "CLOUDFLARE_TRACE_CONTEXT_KEY",
696
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-trace"); `
697
+ }),
698
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
699
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
700
+ export: true,
701
+ const: true,
702
+ name: "traceContextStorage",
703
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare trace runtime context.",
704
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TRACE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTraceContext>()) as AsyncLocalStorage<CloudflareTraceContext>; `
705
+ }),
706
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
707
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
708
+ 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.",
709
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare trace runtime context.` })
710
+ }),
711
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
712
+ export: true,
713
+ name: "getTraceContext",
714
+ typeParameters: [{
715
+ name: "Env",
716
+ default: "CloudflareBindings"
717
+ }],
718
+ parameters: [],
719
+ returnType: "CloudflareTraceContext<Env>",
720
+ children: _alloy_js_core.code`const context = traceContextStorage.getStore();
389
721
  if (!context) {
390
722
  throw new Error("Cloudflare trace context is not available. Ensure that you are calling this function within the scope of a Cloudflare trace operation.");
391
723
  }
392
- return context as CloudflareTraceContext<Env>; `}
393
- </_alloy_js_typescript.FunctionDeclaration>
394
- <hbr />
395
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
396
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare trace context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
397
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
398
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
399
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
400
- <_alloy_js_typescript.FunctionDeclaration export name="withTraceContext" typeParameters={[{
401
- name: "Env",
402
- default: "CloudflareBindings"
403
- }]} parameters={[{
404
- name: "context",
405
- type: "CloudflareTraceContext<Env>"
406
- }, {
407
- name: "callback",
408
- type: "(ctx: CloudflareTraceContext<Env>) => Promise<void>"
409
- }]} returnType="Promise<void>">
410
- {_alloy_js_core.code`return traceContextStorage.run(context, () => callback(context)); `}
411
- </_alloy_js_typescript.FunctionDeclaration>
412
- <_powerlines_plugin_alloy_core_components.Spacing />
413
- <_powerlines_plugin_alloy_core_components.Spacing />
414
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration export name="CloudflareTestContext" typeParameters={[{
415
- name: "Env",
416
- default: "CloudflareBindings"
417
- }]} doc="An interface representing the test context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.">
418
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="controller" type="TestController" doc="The test controller associated with the Cloudflare test context." />
419
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="env" type="Env" doc="The Cloudflare environment bindings available during runtime." />
420
- <_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember name="ctx" type="ExecutionContext" doc="The Cloudflare execution context for the test operation." />
421
- </_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration>
422
- <hbr />
423
- <_alloy_js_typescript.VarDeclaration const name="CLOUDFLARE_TEST_CONTEXT_KEY" initializer={_alloy_js_core.code`Symbol.for("powerlines-cloudflare-test"); `} />
424
- <hbr />
425
- <_alloy_js_typescript.VarDeclaration export const name="testContextStorage" doc="An AsyncLocalStorage instance for managing the Cloudflare test runtime context." initializer={_alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TEST_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTestContext>()) as AsyncLocalStorage<CloudflareTestContext>; `} />
426
- <hbr />
427
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
428
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The current Cloudflare test runtime context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
429
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
430
- <_alloy_js_typescript.FunctionDeclaration export name="getTestContext" typeParameters={[{
431
- name: "Env",
432
- default: "CloudflareBindings"
433
- }]} parameters={[]} returnType="CloudflareTestContext<Env>">
434
- {_alloy_js_core.code`const context = testContextStorage.getStore();
724
+ return context as CloudflareTraceContext<Env>; `
725
+ }),
726
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
727
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
728
+ 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.",
729
+ children: [
730
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
731
+ name: "context",
732
+ children: _alloy_js_core.code`The Cloudflare trace context to run the function with.`
733
+ }),
734
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
735
+ name: "callback",
736
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
737
+ }),
738
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
739
+ ]
740
+ }),
741
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
742
+ export: true,
743
+ name: "withTraceContext",
744
+ typeParameters: [{
745
+ name: "Env",
746
+ default: "CloudflareBindings"
747
+ }],
748
+ parameters: [{
749
+ name: "context",
750
+ type: "CloudflareTraceContext<Env>"
751
+ }, {
752
+ name: "callback",
753
+ type: "(ctx: CloudflareTraceContext<Env>) => Promise<void>"
754
+ }],
755
+ returnType: "Promise<void>",
756
+ children: _alloy_js_core.code`return traceContextStorage.run(context, () => callback(context)); `
757
+ }),
758
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
759
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
760
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
761
+ export: true,
762
+ name: "CloudflareTestContext",
763
+ typeParameters: [{
764
+ name: "Env",
765
+ default: "CloudflareBindings"
766
+ }],
767
+ doc: "An interface representing the test context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.",
768
+ children: [
769
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
770
+ name: "controller",
771
+ type: "TestController",
772
+ doc: "The test controller associated with the Cloudflare test context."
773
+ }),
774
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
775
+ name: "env",
776
+ type: "Env",
777
+ doc: "The Cloudflare environment bindings available during runtime."
778
+ }),
779
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
780
+ name: "ctx",
781
+ type: "ExecutionContext",
782
+ doc: "The Cloudflare execution context for the test operation."
783
+ })
784
+ ]
785
+ }),
786
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
787
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
788
+ const: true,
789
+ name: "CLOUDFLARE_TEST_CONTEXT_KEY",
790
+ initializer: _alloy_js_core.code`Symbol.for("powerlines-cloudflare-test"); `
791
+ }),
792
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
793
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
794
+ export: true,
795
+ const: true,
796
+ name: "testContextStorage",
797
+ doc: "An AsyncLocalStorage instance for managing the Cloudflare test runtime context.",
798
+ initializer: _alloy_js_core.code`(globalContextStorage[CLOUDFLARE_TEST_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTestContext>()) as AsyncLocalStorage<CloudflareTestContext>; `
799
+ }),
800
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
801
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
802
+ 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.",
803
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The current Cloudflare test runtime context.` })
804
+ }),
805
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
806
+ export: true,
807
+ name: "getTestContext",
808
+ typeParameters: [{
809
+ name: "Env",
810
+ default: "CloudflareBindings"
811
+ }],
812
+ parameters: [],
813
+ returnType: "CloudflareTestContext<Env>",
814
+ children: _alloy_js_core.code`const context = testContextStorage.getStore();
435
815
  if (!context) {
436
816
  throw new Error("Cloudflare test context is not available. Ensure that you are calling this function within the scope of a Cloudflare test operation.");
437
817
  }
438
- return context as CloudflareTestContext<Env>; `}
439
- </_alloy_js_typescript.FunctionDeclaration>
440
- <hbr />
441
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc 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.">
442
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="context">{_alloy_js_core.code`The Cloudflare test context to run the function with.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
443
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam name="callback">{_alloy_js_core.code`The function to execute within the scope of the provided context.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam>
444
- <_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>{_alloy_js_core.code`The result of the executed function.`}</_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns>
445
- </_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc>
446
- <_alloy_js_typescript.FunctionDeclaration export name="withTestContext" typeParameters={[{
447
- name: "Env",
448
- default: "CloudflareBindings"
449
- }]} parameters={[{
450
- name: "context",
451
- type: "CloudflareTestContext<Env>"
452
- }, {
453
- name: "callback",
454
- type: "(ctx: CloudflareTestContext<Env>) => Promise<void>"
455
- }]} returnType="Promise<void>">
456
- {_alloy_js_core.code`return testContextStorage.run(context, () => callback(context)); `}
457
- </_alloy_js_typescript.FunctionDeclaration>
458
- <_powerlines_plugin_alloy_core_components.Spacing />
459
- <_powerlines_plugin_alloy_core_components.Spacing />
460
- <_alloy_js_core.Show when={Boolean(children)}>{children}</_alloy_js_core.Show>
461
- </_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile>;
818
+ return context as CloudflareTestContext<Env>; `
819
+ }),
820
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
821
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
822
+ 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.",
823
+ children: [
824
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
825
+ name: "context",
826
+ children: _alloy_js_core.code`The Cloudflare test context to run the function with.`
827
+ }),
828
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
829
+ name: "callback",
830
+ children: _alloy_js_core.code`The function to execute within the scope of the provided context.`
831
+ }),
832
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: _alloy_js_core.code`The result of the executed function.` })
833
+ ]
834
+ }),
835
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
836
+ export: true,
837
+ name: "withTestContext",
838
+ typeParameters: [{
839
+ name: "Env",
840
+ default: "CloudflareBindings"
841
+ }],
842
+ parameters: [{
843
+ name: "context",
844
+ type: "CloudflareTestContext<Env>"
845
+ }, {
846
+ name: "callback",
847
+ type: "(ctx: CloudflareTestContext<Env>) => Promise<void>"
848
+ }],
849
+ returnType: "Promise<void>",
850
+ children: _alloy_js_core.code`return testContextStorage.run(context, () => callback(context)); `
851
+ }),
852
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
853
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
854
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
855
+ when: Boolean(children),
856
+ children
857
+ })
858
+ ]
859
+ });
462
860
  }
463
861
 
464
862
  //#endregion