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