@authhero/cloudflare-adapter 3.0.11 → 3.1.0
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/README.md +61 -0
- package/dist/cloudflare-adapter.cjs +23 -23
- package/dist/cloudflare-adapter.d.ts +142 -2
- package/dist/cloudflare-adapter.mjs +397 -297
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/analytics-engine-outbox-metrics/index.d.ts +61 -0
- package/dist/types/customDomains/index.d.ts +24 -1
- package/dist/types/customDomains/sync.d.ts +78 -0
- package/dist/types/index.d.ts +6 -1
- package/package.json +5 -5
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import { a as e, i as t, n, t as r } from "./sync-defaults-errors-BlLZh6Gt.mjs";
|
|
2
|
-
import { TRIGGER_API_SHAPES as i, actionExecutionStatusSchema as a,
|
|
3
|
-
import { z as
|
|
4
|
-
import { HTTPException as
|
|
5
|
-
import
|
|
6
|
-
import { dedupe as
|
|
2
|
+
import { TRIGGER_API_SHAPES as i, actionExecutionStatusSchema as a, tokenizeLuceneQuery as o, unescapeLuceneValue as s, verificationMethodsSchema as c } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { z as l } from "@hono/zod-openapi";
|
|
4
|
+
import { HTTPException as u } from "hono/http-exception";
|
|
5
|
+
import d from "wretch";
|
|
6
|
+
import { dedupe as f, retry as p } from "wretch/middlewares";
|
|
7
7
|
//#region src/types/CustomDomain.ts
|
|
8
|
-
var
|
|
9
|
-
code:
|
|
10
|
-
message:
|
|
11
|
-
}),
|
|
12
|
-
emails:
|
|
13
|
-
http_body:
|
|
14
|
-
http_url:
|
|
15
|
-
txt_name:
|
|
16
|
-
txt_value:
|
|
17
|
-
}),
|
|
18
|
-
ciphers:
|
|
19
|
-
early_hints:
|
|
20
|
-
http2:
|
|
21
|
-
min_tls_version:
|
|
22
|
-
tls_1_3:
|
|
23
|
-
}),
|
|
24
|
-
id:
|
|
25
|
-
bundle_method:
|
|
26
|
-
certificate_authority:
|
|
27
|
-
custom_certificate:
|
|
28
|
-
custom_csr_id:
|
|
29
|
-
custom_key:
|
|
30
|
-
expires_on:
|
|
31
|
-
hosts:
|
|
32
|
-
issuer:
|
|
33
|
-
method:
|
|
34
|
-
serial_number:
|
|
35
|
-
settings:
|
|
36
|
-
signature:
|
|
37
|
-
type:
|
|
38
|
-
uploaded_on:
|
|
39
|
-
validation_errors:
|
|
40
|
-
validation_records:
|
|
41
|
-
wildcard:
|
|
42
|
-
}),
|
|
43
|
-
name:
|
|
44
|
-
type:
|
|
45
|
-
value:
|
|
46
|
-
}),
|
|
47
|
-
http_body:
|
|
48
|
-
http_url:
|
|
49
|
-
}), v =
|
|
50
|
-
id:
|
|
51
|
-
ssl:
|
|
52
|
-
hostname:
|
|
53
|
-
custom_metadata:
|
|
54
|
-
custom_origin_server:
|
|
55
|
-
custom_origin_sni:
|
|
56
|
-
ownership_verification:
|
|
57
|
-
ownership_verification_http:
|
|
58
|
-
status:
|
|
59
|
-
verification_errors:
|
|
60
|
-
created_at:
|
|
61
|
-
}), y =
|
|
62
|
-
errors:
|
|
63
|
-
messages:
|
|
64
|
-
success:
|
|
8
|
+
var m = l.object({
|
|
9
|
+
code: l.number(),
|
|
10
|
+
message: l.string()
|
|
11
|
+
}), h = l.object({ message: l.string() }), g = l.object({
|
|
12
|
+
emails: l.array(l.string()).optional(),
|
|
13
|
+
http_body: l.string().optional(),
|
|
14
|
+
http_url: l.string().optional(),
|
|
15
|
+
txt_name: l.string().optional(),
|
|
16
|
+
txt_value: l.string().optional()
|
|
17
|
+
}), _ = l.object({
|
|
18
|
+
ciphers: l.array(l.string()).optional(),
|
|
19
|
+
early_hints: l.string().optional(),
|
|
20
|
+
http2: l.string().optional(),
|
|
21
|
+
min_tls_version: l.string().optional(),
|
|
22
|
+
tls_1_3: l.string().optional()
|
|
23
|
+
}), ee = l.object({
|
|
24
|
+
id: l.string(),
|
|
25
|
+
bundle_method: l.string().optional(),
|
|
26
|
+
certificate_authority: l.string(),
|
|
27
|
+
custom_certificate: l.string().optional(),
|
|
28
|
+
custom_csr_id: l.string().optional(),
|
|
29
|
+
custom_key: l.string().optional(),
|
|
30
|
+
expires_on: l.string().optional(),
|
|
31
|
+
hosts: l.array(l.string()).optional(),
|
|
32
|
+
issuer: l.string().optional(),
|
|
33
|
+
method: l.string(),
|
|
34
|
+
serial_number: l.string().optional(),
|
|
35
|
+
settings: _.optional(),
|
|
36
|
+
signature: l.string().optional(),
|
|
37
|
+
type: l.string(),
|
|
38
|
+
uploaded_on: l.string().optional(),
|
|
39
|
+
validation_errors: l.array(h).optional(),
|
|
40
|
+
validation_records: l.array(g).optional(),
|
|
41
|
+
wildcard: l.boolean()
|
|
42
|
+
}), te = l.object({
|
|
43
|
+
name: l.string(),
|
|
44
|
+
type: l.string(),
|
|
45
|
+
value: l.string()
|
|
46
|
+
}), ne = l.object({
|
|
47
|
+
http_body: l.string().optional(),
|
|
48
|
+
http_url: l.string().optional()
|
|
49
|
+
}), v = l.object({
|
|
50
|
+
id: l.string(),
|
|
51
|
+
ssl: ee,
|
|
52
|
+
hostname: l.string(),
|
|
53
|
+
custom_metadata: l.record(l.string(), l.string()).optional(),
|
|
54
|
+
custom_origin_server: l.string().optional(),
|
|
55
|
+
custom_origin_sni: l.string().optional(),
|
|
56
|
+
ownership_verification: te.optional(),
|
|
57
|
+
ownership_verification_http: ne.optional(),
|
|
58
|
+
status: l.string(),
|
|
59
|
+
verification_errors: l.array(l.string()).optional(),
|
|
60
|
+
created_at: l.string()
|
|
61
|
+
}), y = l.object({
|
|
62
|
+
errors: l.array(m),
|
|
63
|
+
messages: l.array(m),
|
|
64
|
+
success: l.boolean(),
|
|
65
65
|
result: v
|
|
66
|
-
}),
|
|
67
|
-
errors:
|
|
68
|
-
messages:
|
|
69
|
-
success:
|
|
70
|
-
result:
|
|
66
|
+
}), b = l.object({
|
|
67
|
+
errors: l.array(m),
|
|
68
|
+
messages: l.array(m),
|
|
69
|
+
success: l.boolean(),
|
|
70
|
+
result: l.array(v)
|
|
71
71
|
});
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/customDomains/index.ts
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function x(e) {
|
|
75
|
+
return d(`https://api.cloudflare.com/client/v4/zones/${e.zoneId}`).headers({
|
|
76
76
|
"X-Auth-Email": e.authEmail,
|
|
77
77
|
"X-Auth-Key": e.authKey,
|
|
78
78
|
"Content-Type": "application/json"
|
|
79
|
-
}).middlewares([
|
|
79
|
+
}).middlewares([p(), f()]);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function S(e) {
|
|
82
82
|
let t = {}, n = {};
|
|
83
83
|
if (!e) return {
|
|
84
84
|
sslOverrides: t,
|
|
@@ -90,7 +90,7 @@ function x(e) {
|
|
|
90
90
|
rest: n
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function C(e) {
|
|
94
94
|
let t = [];
|
|
95
95
|
if (e.ssl.validation_records) for (let n of e.ssl.validation_records) n.txt_name && n.txt_value && t.push({
|
|
96
96
|
name: "txt",
|
|
@@ -122,34 +122,67 @@ function S(e) {
|
|
|
122
122
|
primary: e.primary,
|
|
123
123
|
status: e.status === "active" ? "ready" : "pending",
|
|
124
124
|
type: e.type ?? "auth0_managed_certs",
|
|
125
|
-
verification: { methods:
|
|
125
|
+
verification: { methods: l.array(c).parse(t) },
|
|
126
126
|
domain_metadata: n
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function re(e) {
|
|
130
130
|
let t = e instanceof Error ? e.message : String(e);
|
|
131
131
|
return /duplicate/i.test(t);
|
|
132
132
|
}
|
|
133
|
-
async function
|
|
133
|
+
async function ie(e, t, n) {
|
|
134
134
|
let r;
|
|
135
135
|
try {
|
|
136
|
-
r = await
|
|
136
|
+
r = await x(e).get(`/custom_hostnames?hostname=${encodeURIComponent(n)}`).json();
|
|
137
137
|
} catch {
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
|
-
let i =
|
|
140
|
+
let i = b.safeParse(r);
|
|
141
141
|
if (!i.success || !i.data.success) return null;
|
|
142
142
|
let a = i.data.result.find((e) => e.hostname.toLowerCase() === n.toLowerCase());
|
|
143
143
|
return !a || e.enterprise && a.custom_metadata?.tenant_id !== t ? null : a;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
async function ae(e, t, n, r) {
|
|
146
|
+
let i = n.custom_domain_id, a;
|
|
147
|
+
try {
|
|
148
|
+
a = C({
|
|
149
|
+
...n,
|
|
150
|
+
...r
|
|
151
|
+
});
|
|
152
|
+
} catch (e) {
|
|
153
|
+
return console.warn(`[custom-domains] mapCustomDomainResponse failed for ${i} (tenant=${t}); keeping the stored row.`, e instanceof Error ? e.message : e), {
|
|
154
|
+
domain: n,
|
|
155
|
+
outcome: "failed"
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (a.status === n.status && JSON.stringify(a.verification) === JSON.stringify(n.verification)) return {
|
|
159
|
+
domain: a,
|
|
160
|
+
outcome: "unchanged"
|
|
161
|
+
};
|
|
162
|
+
try {
|
|
163
|
+
await e.customDomainAdapter.update(t, i, {
|
|
164
|
+
status: a.status,
|
|
165
|
+
verification: a.verification
|
|
166
|
+
});
|
|
167
|
+
} catch (e) {
|
|
168
|
+
return console.warn(`[custom-domains] DB writeback failed for ${i} (tenant=${t}); returning merged response without DB sync.`, e instanceof Error ? e.message : e), {
|
|
169
|
+
domain: a,
|
|
170
|
+
outcome: "failed"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
domain: a,
|
|
175
|
+
outcome: "updated"
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function oe(e) {
|
|
146
179
|
return {
|
|
147
180
|
create: async (t, n) => {
|
|
148
|
-
let { sslOverrides: r, rest: i } =
|
|
149
|
-
if (await e.customDomainAdapter.getByDomain(n.domain)) throw new
|
|
181
|
+
let { sslOverrides: r, rest: i } = S(n.domain_metadata);
|
|
182
|
+
if (await e.customDomainAdapter.getByDomain(n.domain)) throw new u(409, { message: `The domain ${n.domain} is already registered` });
|
|
150
183
|
let a;
|
|
151
184
|
try {
|
|
152
|
-
let i = y.parse(await
|
|
185
|
+
let i = y.parse(await x(e).post({
|
|
153
186
|
hostname: n.domain,
|
|
154
187
|
ssl: {
|
|
155
188
|
method: "txt",
|
|
@@ -161,12 +194,12 @@ function re(e) {
|
|
|
161
194
|
if (!i.success) throw Error(JSON.stringify(i.errors));
|
|
162
195
|
a = i.result;
|
|
163
196
|
} catch (r) {
|
|
164
|
-
if (!
|
|
165
|
-
let i = await
|
|
197
|
+
if (!re(r)) throw r;
|
|
198
|
+
let i = await ie(e, t, n.domain);
|
|
166
199
|
if (!i) throw r;
|
|
167
200
|
a = i;
|
|
168
201
|
}
|
|
169
|
-
let o =
|
|
202
|
+
let o = C({
|
|
170
203
|
...a,
|
|
171
204
|
primary: !1,
|
|
172
205
|
type: n.type,
|
|
@@ -185,10 +218,10 @@ function re(e) {
|
|
|
185
218
|
},
|
|
186
219
|
get: async (t, n) => {
|
|
187
220
|
let r = await e.customDomainAdapter.get(t, n);
|
|
188
|
-
if (!r) throw new
|
|
221
|
+
if (!r) throw new u(404);
|
|
189
222
|
let i;
|
|
190
223
|
try {
|
|
191
|
-
i = await
|
|
224
|
+
i = await x(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json();
|
|
192
225
|
} catch (e) {
|
|
193
226
|
return console.warn(`[custom-domains] CF fetch failed for ${n} (tenant=${t}); returning stale DB row:`, e instanceof Error ? e.message : e), r;
|
|
194
227
|
}
|
|
@@ -198,47 +231,31 @@ function re(e) {
|
|
|
198
231
|
body: i
|
|
199
232
|
}), r;
|
|
200
233
|
let { result: o } = a.data;
|
|
201
|
-
if (e.enterprise && o.custom_metadata?.tenant_id !== t) throw new
|
|
202
|
-
let s;
|
|
203
|
-
try {
|
|
204
|
-
s = S({
|
|
205
|
-
...r,
|
|
206
|
-
...o
|
|
207
|
-
});
|
|
208
|
-
} catch (e) {
|
|
209
|
-
return console.warn(`[custom-domains] mapCustomDomainResponse failed for ${n} (tenant=${t}); returning stale DB row.`, e instanceof Error ? e.message : e), r;
|
|
210
|
-
}
|
|
211
|
-
if (s.status !== r.status || JSON.stringify(s.verification) !== JSON.stringify(r.verification)) try {
|
|
212
|
-
await e.customDomainAdapter.update(t, n, {
|
|
213
|
-
status: s.status,
|
|
214
|
-
verification: s.verification
|
|
215
|
-
});
|
|
216
|
-
} catch (e) {
|
|
217
|
-
console.warn(`[custom-domains] DB writeback failed for ${n} (tenant=${t}); returning merged response without DB sync.`, e instanceof Error ? e.message : e);
|
|
218
|
-
}
|
|
234
|
+
if (e.enterprise && o.custom_metadata?.tenant_id !== t) throw new u(404);
|
|
235
|
+
let { domain: s } = await ae(e, t, r, o);
|
|
219
236
|
return s;
|
|
220
237
|
},
|
|
221
238
|
getByDomain: async (t) => e.customDomainAdapter.getByDomain(t),
|
|
222
239
|
list: async (t) => e.customDomainAdapter.list(t),
|
|
223
240
|
remove: async (t, n) => {
|
|
224
241
|
if (e.enterprise) {
|
|
225
|
-
let { result: r, success: i } = y.parse(await
|
|
226
|
-
if (!i || r.custom_metadata?.tenant_id !== t) throw new
|
|
242
|
+
let { result: r, success: i } = y.parse(await x(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json());
|
|
243
|
+
if (!i || r.custom_metadata?.tenant_id !== t) throw new u(404);
|
|
227
244
|
}
|
|
228
|
-
let r = await
|
|
245
|
+
let r = await x(e).delete(`/custom_hostnames/${encodeURIComponent(n)}`).res();
|
|
229
246
|
return r.ok && await e.customDomainAdapter.remove(t, n), r.ok;
|
|
230
247
|
},
|
|
231
248
|
update: async (t, n, r) => {
|
|
232
|
-
let { sslOverrides: i } =
|
|
249
|
+
let { sslOverrides: i } = S(r.domain_metadata), a = {};
|
|
233
250
|
if (Object.keys(i).length > 0) {
|
|
234
251
|
let t;
|
|
235
252
|
try {
|
|
236
|
-
t = await
|
|
253
|
+
t = await x(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json();
|
|
237
254
|
} catch (e) {
|
|
238
|
-
throw new
|
|
255
|
+
throw new u(503, { message: `Failed to fetch current custom hostname state: ${e instanceof Error ? e.message : String(e)}` });
|
|
239
256
|
}
|
|
240
257
|
let r = y.safeParse(t);
|
|
241
|
-
if (!r.success || !r.data.success) throw new
|
|
258
|
+
if (!r.success || !r.data.success) throw new u(503, { message: `Failed to parse current custom hostname state: ${JSON.stringify(r.success ? r.data.errors : r.error.issues)}` });
|
|
242
259
|
a.ssl = {
|
|
243
260
|
method: r.data.result.ssl.method,
|
|
244
261
|
type: r.data.result.ssl.type,
|
|
@@ -247,35 +264,35 @@ function re(e) {
|
|
|
247
264
|
};
|
|
248
265
|
}
|
|
249
266
|
if (Object.keys(a).length > 0) {
|
|
250
|
-
let t = await
|
|
251
|
-
throw new
|
|
267
|
+
let t = await x(e).patch(a, `/custom_hostnames/${encodeURIComponent(n)}`).res().catch((e) => {
|
|
268
|
+
throw new u(503, { message: `Failed to update custom hostname: ${e instanceof Error ? e.message : String(e)}` });
|
|
252
269
|
});
|
|
253
|
-
if (!t.ok) throw new
|
|
270
|
+
if (!t.ok) throw new u(503, { message: await t.text() });
|
|
254
271
|
}
|
|
255
272
|
return e.customDomainAdapter.update(t, n, r);
|
|
256
273
|
},
|
|
257
274
|
uploadCertificate: async (t, n, r) => {
|
|
258
275
|
let i = await e.customDomainAdapter.get(t, n);
|
|
259
|
-
if (!i) throw new
|
|
260
|
-
let a = await
|
|
276
|
+
if (!i) throw new u(404);
|
|
277
|
+
let a = await x(e).patch({ ssl: {
|
|
261
278
|
custom_certificate: r.certificate,
|
|
262
279
|
custom_key: r.private_key
|
|
263
|
-
} }, `/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, errors: s, success:
|
|
264
|
-
if (!
|
|
265
|
-
let
|
|
280
|
+
} }, `/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, errors: s, success: c } = y.parse(a);
|
|
281
|
+
if (!c) throw new u(503, { message: JSON.stringify(s) });
|
|
282
|
+
let l = C({
|
|
266
283
|
...i,
|
|
267
284
|
...o
|
|
268
285
|
});
|
|
269
286
|
return await e.customDomainAdapter.update(t, n, {
|
|
270
|
-
status:
|
|
271
|
-
verification:
|
|
272
|
-
}),
|
|
287
|
+
status: l.status,
|
|
288
|
+
verification: l.verification
|
|
289
|
+
}), l;
|
|
273
290
|
}
|
|
274
291
|
};
|
|
275
292
|
}
|
|
276
293
|
//#endregion
|
|
277
294
|
//#region src/cache/index.ts
|
|
278
|
-
var
|
|
295
|
+
var se = class {
|
|
279
296
|
config;
|
|
280
297
|
cache = null;
|
|
281
298
|
constructor(e) {
|
|
@@ -349,8 +366,8 @@ var ie = class {
|
|
|
349
366
|
console.warn("CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries");
|
|
350
367
|
}
|
|
351
368
|
};
|
|
352
|
-
function
|
|
353
|
-
return new
|
|
369
|
+
function ce(e = {}) {
|
|
370
|
+
return new se({
|
|
354
371
|
defaultTtlSeconds: 300,
|
|
355
372
|
keyPrefix: "authhero",
|
|
356
373
|
getTimeoutMs: 200,
|
|
@@ -359,9 +376,9 @@ function ae(e = {}) {
|
|
|
359
376
|
}
|
|
360
377
|
//#endregion
|
|
361
378
|
//#region ../../node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/url-alphabet/index.js
|
|
362
|
-
var
|
|
379
|
+
var le = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", w = (e = 21) => {
|
|
363
380
|
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
364
|
-
for (; e--;) t +=
|
|
381
|
+
for (; e--;) t += le[n[e] & 63];
|
|
365
382
|
return t;
|
|
366
383
|
};
|
|
367
384
|
//#endregion
|
|
@@ -434,16 +451,16 @@ function O(e) {
|
|
|
434
451
|
} : void 0
|
|
435
452
|
};
|
|
436
453
|
}
|
|
437
|
-
function
|
|
454
|
+
function ue(e) {
|
|
438
455
|
return async (t, n) => {
|
|
439
456
|
let r = n.log_id || w(), i = {
|
|
440
457
|
...n,
|
|
441
458
|
log_id: r
|
|
442
459
|
};
|
|
443
|
-
return await
|
|
460
|
+
return await de(e, t, i), i;
|
|
444
461
|
};
|
|
445
462
|
}
|
|
446
|
-
async function
|
|
463
|
+
async function de(e, t, n) {
|
|
447
464
|
let r = (e) => e ? JSON.stringify(e) : void 0, i = {
|
|
448
465
|
id: n.log_id,
|
|
449
466
|
tenant_id: t,
|
|
@@ -494,7 +511,7 @@ async function ce(e, t, n) {
|
|
|
494
511
|
throw console.error("Failed to send log to Pipeline:", e), e;
|
|
495
512
|
}
|
|
496
513
|
}
|
|
497
|
-
function
|
|
514
|
+
function fe(e) {
|
|
498
515
|
return async (t, n) => {
|
|
499
516
|
let r = e.namespace || "default", i = e.tableName || "logs", a = await T(e, `
|
|
500
517
|
SELECT * FROM ${D(r)}.${D(i)}
|
|
@@ -509,7 +526,7 @@ function le(e) {
|
|
|
509
526
|
}
|
|
510
527
|
//#endregion
|
|
511
528
|
//#region src/r2-sql-logs/list.ts
|
|
512
|
-
function
|
|
529
|
+
function pe(e) {
|
|
513
530
|
let t = {}, n = /(\w+):(?:"([^"]*)"|(\S+))/g, r;
|
|
514
531
|
for (; (r = n.exec(e)) !== null;) {
|
|
515
532
|
let e = r[1], n = r[2] === void 0 ? r[3] : r[2];
|
|
@@ -517,7 +534,7 @@ function ue(e) {
|
|
|
517
534
|
}
|
|
518
535
|
return t;
|
|
519
536
|
}
|
|
520
|
-
function
|
|
537
|
+
function me(e) {
|
|
521
538
|
let t = [];
|
|
522
539
|
for (let [n, r] of Object.entries(e)) {
|
|
523
540
|
let e = n.replace(/[^a-zA-Z0-9_]/g, "");
|
|
@@ -525,12 +542,12 @@ function de(e) {
|
|
|
525
542
|
}
|
|
526
543
|
return t;
|
|
527
544
|
}
|
|
528
|
-
function
|
|
545
|
+
function he(e) {
|
|
529
546
|
return async (t, n = {}) => {
|
|
530
547
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s } = n, c = e.namespace || "default", l = e.tableName || "logs", u = [`tenant_id = ${E(t)}`];
|
|
531
548
|
if (s) {
|
|
532
|
-
let e =
|
|
533
|
-
u.push(...
|
|
549
|
+
let e = pe(s);
|
|
550
|
+
u.push(...me(e));
|
|
534
551
|
}
|
|
535
552
|
let d = u.join(" AND "), f = "ORDER BY date DESC";
|
|
536
553
|
if (o && o.sort_by) {
|
|
@@ -563,7 +580,7 @@ function fe(e) {
|
|
|
563
580
|
}
|
|
564
581
|
//#endregion
|
|
565
582
|
//#region src/r2-sql-logs/stats.ts
|
|
566
|
-
function
|
|
583
|
+
function ge() {
|
|
567
584
|
return {
|
|
568
585
|
async getDaily() {
|
|
569
586
|
throw Error("Stats queries are not supported by R2 SQL logs adapter. Use Analytics Engine or Kysely adapter instead.");
|
|
@@ -575,20 +592,20 @@ function pe() {
|
|
|
575
592
|
}
|
|
576
593
|
//#endregion
|
|
577
594
|
//#region src/r2-sql-logs/index.ts
|
|
578
|
-
function
|
|
595
|
+
function _e(e) {
|
|
579
596
|
let t = !!e.pipelineEndpoint, n = !!e.pipelineBinding;
|
|
580
597
|
if (!t && !n) throw Error("R2 SQL logs adapter requires one of: \"pipelineEndpoint\" or \"pipelineBinding\"");
|
|
581
598
|
if (!e.authToken) throw Error("R2 SQL logs adapter requires \"authToken\" configuration");
|
|
582
599
|
if (!e.warehouseName) throw Error("R2 SQL logs adapter requires \"warehouseName\" configuration");
|
|
583
600
|
return {
|
|
584
|
-
create:
|
|
585
|
-
list:
|
|
586
|
-
get:
|
|
601
|
+
create: ue(e),
|
|
602
|
+
list: he(e),
|
|
603
|
+
get: fe(e)
|
|
587
604
|
};
|
|
588
605
|
}
|
|
589
606
|
//#endregion
|
|
590
607
|
//#region src/analytics-engine-logs/query.ts
|
|
591
|
-
async function
|
|
608
|
+
async function k(e, t) {
|
|
592
609
|
let n = e.timeout || 3e4, r = new AbortController(), i = setTimeout(() => r.abort(), n);
|
|
593
610
|
try {
|
|
594
611
|
let n = `https://api.cloudflare.com/client/v4/accounts/${e.accountId}/analytics_engine/sql`, i = await fetch(n, {
|
|
@@ -611,15 +628,15 @@ async function A(e, t) {
|
|
|
611
628
|
clearTimeout(i);
|
|
612
629
|
}
|
|
613
630
|
}
|
|
614
|
-
function
|
|
631
|
+
function A(e) {
|
|
615
632
|
return `'${e.replace(/'/g, "''").replace(/\\/g, "\\\\")}'`;
|
|
616
633
|
}
|
|
617
|
-
function
|
|
634
|
+
function j(e) {
|
|
618
635
|
return `"${e.replace(/"/g, "\"\"")}"`;
|
|
619
636
|
}
|
|
620
637
|
//#endregion
|
|
621
638
|
//#region src/analytics-engine-logs/logs.ts
|
|
622
|
-
function
|
|
639
|
+
function M(e) {
|
|
623
640
|
let t = (e) => {
|
|
624
641
|
if (e) try {
|
|
625
642
|
return JSON.parse(e);
|
|
@@ -651,16 +668,16 @@ function N(e) {
|
|
|
651
668
|
isMobile: e.double1 === 1
|
|
652
669
|
};
|
|
653
670
|
}
|
|
654
|
-
function
|
|
671
|
+
function ve(e) {
|
|
655
672
|
return async (t, n) => {
|
|
656
673
|
let r = n.log_id || w(), i = {
|
|
657
674
|
...n,
|
|
658
675
|
log_id: r
|
|
659
676
|
};
|
|
660
|
-
return
|
|
677
|
+
return ye(e, t, i), i;
|
|
661
678
|
};
|
|
662
679
|
}
|
|
663
|
-
function
|
|
680
|
+
function ye(e, t, n) {
|
|
664
681
|
if (!e.analyticsEngineBinding) {
|
|
665
682
|
console.error("Analytics Engine binding not configured");
|
|
666
683
|
return;
|
|
@@ -697,45 +714,34 @@ function he(e, t, n) {
|
|
|
697
714
|
console.error("Failed to write log to Analytics Engine:", e);
|
|
698
715
|
}
|
|
699
716
|
}
|
|
700
|
-
function
|
|
717
|
+
function be(e) {
|
|
701
718
|
return async (t, n) => {
|
|
702
|
-
let r = await
|
|
719
|
+
let r = await k(e, `
|
|
703
720
|
SELECT *
|
|
704
|
-
FROM ${
|
|
705
|
-
WHERE index1 = ${
|
|
706
|
-
AND blob1 = ${
|
|
721
|
+
FROM ${j(e.dataset || "authhero_logs")}
|
|
722
|
+
WHERE index1 = ${A(t)}
|
|
723
|
+
AND blob1 = ${A(n)}
|
|
707
724
|
LIMIT 1
|
|
708
725
|
`);
|
|
709
|
-
return r.length === 0 || !r[0] ? null :
|
|
726
|
+
return r.length === 0 || !r[0] ? null : M(r[0]);
|
|
710
727
|
};
|
|
711
728
|
}
|
|
712
729
|
//#endregion
|
|
713
730
|
//#region src/analytics-engine-logs/list.ts
|
|
714
|
-
function
|
|
715
|
-
return e.replace(/\\([\\"+\-!(){}[\]^~*?:/&|])/g, "$1");
|
|
716
|
-
}
|
|
717
|
-
function I(e) {
|
|
718
|
-
let t = [], n = "", r = !1;
|
|
719
|
-
for (let i = 0; i < e.length; i++) {
|
|
720
|
-
let a = e[i];
|
|
721
|
-
a === "\"" ? (r = !r, n += a) : a === " " && !r ? (n.trim() && t.push(n.trim()), n = "") : n += a;
|
|
722
|
-
}
|
|
723
|
-
return n.trim() && t.push(n.trim()), t;
|
|
724
|
-
}
|
|
725
|
-
function L(e) {
|
|
731
|
+
function N(e) {
|
|
726
732
|
let t = e;
|
|
727
|
-
return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)),
|
|
733
|
+
return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)), s(t);
|
|
728
734
|
}
|
|
729
|
-
function
|
|
735
|
+
function xe(e) {
|
|
730
736
|
let t = {}, n = [];
|
|
731
|
-
for (let r of
|
|
737
|
+
for (let r of o(e)) {
|
|
732
738
|
if (r === "OR" || r === "AND") continue;
|
|
733
739
|
let e = r.match(/^(\w+):([\s\S]*)$/);
|
|
734
740
|
if (e) {
|
|
735
|
-
let n = e[1], r =
|
|
741
|
+
let n = e[1], r = N(e[2]);
|
|
736
742
|
t[n] || (t[n] = []), t[n].push(r);
|
|
737
743
|
} else {
|
|
738
|
-
let e =
|
|
744
|
+
let e = N(r);
|
|
739
745
|
e && n.push(e);
|
|
740
746
|
}
|
|
741
747
|
}
|
|
@@ -744,7 +750,7 @@ function R(e) {
|
|
|
744
750
|
terms: n
|
|
745
751
|
};
|
|
746
752
|
}
|
|
747
|
-
function
|
|
753
|
+
function P(e) {
|
|
748
754
|
return {
|
|
749
755
|
log_id: "blob1",
|
|
750
756
|
tenant_id: "blob2",
|
|
@@ -765,7 +771,7 @@ function z(e) {
|
|
|
765
771
|
hostname: "blob17"
|
|
766
772
|
}[e] || null;
|
|
767
773
|
}
|
|
768
|
-
function
|
|
774
|
+
function Se(e) {
|
|
769
775
|
let t = [];
|
|
770
776
|
for (let [n, r] of Object.entries(e)) {
|
|
771
777
|
let e = r.filter((e) => e !== "");
|
|
@@ -776,41 +782,41 @@ function ge(e) {
|
|
|
776
782
|
n.length > 0 && t.push(`(${n.join(" OR ")})`);
|
|
777
783
|
continue;
|
|
778
784
|
}
|
|
779
|
-
let i =
|
|
780
|
-
if (i) if (e.length === 1) t.push(`${i} = ${
|
|
785
|
+
let i = P(n);
|
|
786
|
+
if (i) if (e.length === 1) t.push(`${i} = ${A(e[0])}`);
|
|
781
787
|
else {
|
|
782
|
-
let n = e.map((e) =>
|
|
788
|
+
let n = e.map((e) => A(e)).join(", ");
|
|
783
789
|
t.push(`${i} IN (${n})`);
|
|
784
790
|
}
|
|
785
791
|
}
|
|
786
792
|
return t;
|
|
787
793
|
}
|
|
788
|
-
function
|
|
794
|
+
function Ce(e) {
|
|
789
795
|
return e.filter((e) => e !== "").map((e) => {
|
|
790
|
-
let t =
|
|
796
|
+
let t = A(e), n = A(`%${e}%`);
|
|
791
797
|
return `(blob7 = ${t} OR blob5 LIKE ${n} OR blob4 LIKE ${n})`;
|
|
792
798
|
});
|
|
793
799
|
}
|
|
794
|
-
function
|
|
795
|
-
return e === "date" ? "double2" :
|
|
800
|
+
function we(e) {
|
|
801
|
+
return e === "date" ? "double2" : P(e) || "timestamp";
|
|
796
802
|
}
|
|
797
|
-
function
|
|
803
|
+
function Te(e) {
|
|
798
804
|
return async (t, n = {}) => {
|
|
799
|
-
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s, from_date: c, to_date: l } = n, u = e.dataset || "authhero_logs", d = [`index1 = ${
|
|
805
|
+
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s, from_date: c, to_date: l } = n, u = e.dataset || "authhero_logs", d = [`index1 = ${A(t)}`];
|
|
800
806
|
if (s) {
|
|
801
|
-
let { fields: e, terms: t } =
|
|
802
|
-
d.push(...
|
|
807
|
+
let { fields: e, terms: t } = xe(s);
|
|
808
|
+
d.push(...Se(e)), d.push(...Ce(t));
|
|
803
809
|
}
|
|
804
810
|
typeof c == "number" && Number.isFinite(c) && d.push(`double2 >= ${Math.floor(c) * 1e3}`), typeof l == "number" && Number.isFinite(l) && d.push(`double2 <= ${Math.floor(l) * 1e3}`);
|
|
805
811
|
let f = d.join(" AND "), p = "ORDER BY timestamp DESC";
|
|
806
|
-
o && o.sort_by && (p = `ORDER BY ${
|
|
807
|
-
let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await
|
|
812
|
+
o && o.sort_by && (p = `ORDER BY ${we(o.sort_by)} ${o.sort_order === "asc" ? "ASC" : "DESC"}`);
|
|
813
|
+
let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await k(e, `
|
|
808
814
|
SELECT *
|
|
809
|
-
FROM ${
|
|
815
|
+
FROM ${j(u)}
|
|
810
816
|
WHERE ${f}
|
|
811
817
|
${p}
|
|
812
818
|
${h}
|
|
813
|
-
`)).map(
|
|
819
|
+
`)).map(M);
|
|
814
820
|
if (!a) return {
|
|
815
821
|
logs: g,
|
|
816
822
|
start: 0,
|
|
@@ -819,11 +825,11 @@ function ye(e) {
|
|
|
819
825
|
};
|
|
820
826
|
let _ = `
|
|
821
827
|
SELECT count() as count
|
|
822
|
-
FROM ${
|
|
828
|
+
FROM ${j(u)}
|
|
823
829
|
WHERE ${f}
|
|
824
830
|
`;
|
|
825
831
|
try {
|
|
826
|
-
let t = (await
|
|
832
|
+
let t = (await k(e, _))[0]?.count || 0;
|
|
827
833
|
return {
|
|
828
834
|
logs: g,
|
|
829
835
|
start: m,
|
|
@@ -842,30 +848,39 @@ function ye(e) {
|
|
|
842
848
|
}
|
|
843
849
|
//#endregion
|
|
844
850
|
//#region src/analytics-engine-logs/stats.ts
|
|
845
|
-
var
|
|
846
|
-
function
|
|
847
|
-
return `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}
|
|
851
|
+
var F = ["s"], Ee = ["pwd_leak"];
|
|
852
|
+
function I(e) {
|
|
853
|
+
return /^\d{8}$/.test(e) ? `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}` : e;
|
|
848
854
|
}
|
|
849
|
-
function
|
|
855
|
+
function L(e) {
|
|
850
856
|
return e.toISOString().split("T")[0];
|
|
851
857
|
}
|
|
852
|
-
function
|
|
858
|
+
function R(e, t) {
|
|
859
|
+
let n = (/* @__PURE__ */ new Date(`${e}T${t === "end" ? "23:59:59.999" : "00:00:00.000"}Z`)).getTime();
|
|
860
|
+
if (Number.isNaN(n)) return NaN;
|
|
861
|
+
let r = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
862
|
+
if (!r) return n;
|
|
863
|
+
let i = new Date(n);
|
|
864
|
+
return i.getUTCFullYear() !== Number(r[1]) || i.getUTCMonth() + 1 !== Number(r[2]) || i.getUTCDate() !== Number(r[3]) ? NaN : n;
|
|
865
|
+
}
|
|
866
|
+
function z(e) {
|
|
853
867
|
let t = e.dataset || "authhero_logs";
|
|
854
868
|
return {
|
|
855
869
|
async getDaily(n, r = {}) {
|
|
856
870
|
let { from: i, to: a } = r, o = /* @__PURE__ */ new Date(), s = new Date(o);
|
|
857
871
|
s.setDate(s.getDate() - 30);
|
|
858
|
-
let c = i ?
|
|
859
|
-
|
|
872
|
+
let c = i ? I(i) : L(s), l = a ? I(a) : L(o), u = R(c, "start"), d = R(l, "end");
|
|
873
|
+
if (Number.isNaN(u) || Number.isNaN(d)) throw Error(`Invalid stats date range: from='${c}' to='${l}'`);
|
|
874
|
+
return (await k(e, `
|
|
860
875
|
SELECT
|
|
861
876
|
toDate(toDateTime(double2 / 1000)) AS date,
|
|
862
|
-
SUM(CASE WHEN blob3 IN (${
|
|
877
|
+
SUM(CASE WHEN blob3 IN (${F.map((e) => A(e)).join(", ")}) THEN 1 ELSE 0 END) AS logins,
|
|
863
878
|
SUM(CASE WHEN blob3 = 'ss' THEN 1 ELSE 0 END) AS signups,
|
|
864
|
-
SUM(CASE WHEN blob3 IN (${
|
|
879
|
+
SUM(CASE WHEN blob3 IN (${Ee.map((e) => A(e)).join(", ")}) THEN 1 ELSE 0 END) AS leaked_passwords,
|
|
865
880
|
MIN(double2) AS first_event,
|
|
866
881
|
MAX(double2) AS last_event
|
|
867
882
|
FROM "${t}"
|
|
868
|
-
WHERE index1 = ${
|
|
883
|
+
WHERE index1 = ${A(n)}
|
|
869
884
|
AND double2 >= ${u}
|
|
870
885
|
AND double2 <= ${d}
|
|
871
886
|
GROUP BY date
|
|
@@ -882,10 +897,10 @@ function xe(e) {
|
|
|
882
897
|
async getActiveUsers(n) {
|
|
883
898
|
let r = /* @__PURE__ */ new Date();
|
|
884
899
|
r.setDate(r.getDate() - 30);
|
|
885
|
-
let i = r.getTime(), a =
|
|
900
|
+
let i = r.getTime(), a = F.map((e) => A(e)).join(", "), o = (await k(e, `
|
|
886
901
|
SELECT COUNT(DISTINCT blob7) AS count
|
|
887
902
|
FROM "${t}"
|
|
888
|
-
WHERE index1 = ${
|
|
903
|
+
WHERE index1 = ${A(n)}
|
|
889
904
|
AND double2 >= ${i}
|
|
890
905
|
AND blob3 IN (${a})
|
|
891
906
|
AND blob7 IS NOT NULL
|
|
@@ -897,7 +912,7 @@ function xe(e) {
|
|
|
897
912
|
}
|
|
898
913
|
//#endregion
|
|
899
914
|
//#region src/analytics-engine-logs/analytics.ts
|
|
900
|
-
var
|
|
915
|
+
var De = {
|
|
901
916
|
"active-users": ["s", "seacft"],
|
|
902
917
|
logins: [
|
|
903
918
|
"s",
|
|
@@ -927,17 +942,17 @@ var Se = {
|
|
|
927
942
|
"fvr"
|
|
928
943
|
],
|
|
929
944
|
"codes-sent": ["cls", "cs"]
|
|
930
|
-
},
|
|
945
|
+
}, Oe = {
|
|
931
946
|
connection: "blob9",
|
|
932
947
|
client_id: "blob11",
|
|
933
948
|
user_type: "blob16",
|
|
934
949
|
event: "blob3"
|
|
935
|
-
},
|
|
950
|
+
}, ke = {
|
|
936
951
|
connection: "blob9",
|
|
937
952
|
client_id: "blob11",
|
|
938
953
|
user_type: "blob16",
|
|
939
954
|
user_id: "blob7"
|
|
940
|
-
},
|
|
955
|
+
}, Ae = {
|
|
941
956
|
"active-users": {
|
|
942
957
|
expr: "count(DISTINCT blob7)",
|
|
943
958
|
alias: "active_users",
|
|
@@ -994,8 +1009,8 @@ var Se = {
|
|
|
994
1009
|
type: "UInt64"
|
|
995
1010
|
}
|
|
996
1011
|
};
|
|
997
|
-
function
|
|
998
|
-
let n = `toDateTime(intDiv(double2, 1000), ${
|
|
1012
|
+
function je(e, t) {
|
|
1013
|
+
let n = `toDateTime(intDiv(double2, 1000), ${A(t)})`;
|
|
999
1014
|
switch (e) {
|
|
1000
1015
|
case "hour": return `toStartOfHour(${n})`;
|
|
1001
1016
|
case "week": return `toStartOfWeek(${n})`;
|
|
@@ -1003,45 +1018,45 @@ function Ee(e, t) {
|
|
|
1003
1018
|
default: return `toStartOfDay(${n})`;
|
|
1004
1019
|
}
|
|
1005
1020
|
}
|
|
1006
|
-
function
|
|
1021
|
+
function Me(e) {
|
|
1007
1022
|
return e === "hour" ? "DateTime" : "Date";
|
|
1008
1023
|
}
|
|
1009
|
-
function
|
|
1010
|
-
let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) =>
|
|
1011
|
-
`index1 = ${
|
|
1024
|
+
function Ne(e, t, n) {
|
|
1025
|
+
let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) => A(e)).join(", "), o = [
|
|
1026
|
+
`index1 = ${A(t)}`,
|
|
1012
1027
|
`double2 >= ${r}`,
|
|
1013
1028
|
`double2 < ${i}`,
|
|
1014
1029
|
`blob3 IN (${a})`
|
|
1015
1030
|
];
|
|
1016
|
-
for (let [t, n] of Object.entries(
|
|
1031
|
+
for (let [t, n] of Object.entries(ke)) {
|
|
1017
1032
|
let r = e.filters[t];
|
|
1018
1033
|
if (r && r.length > 0) {
|
|
1019
|
-
let e = r.map((e) =>
|
|
1034
|
+
let e = r.map((e) => A(e)).join(", ");
|
|
1020
1035
|
o.push(`${n} IN (${e})`);
|
|
1021
1036
|
}
|
|
1022
1037
|
}
|
|
1023
1038
|
return o.join(" AND ");
|
|
1024
1039
|
}
|
|
1025
|
-
function
|
|
1040
|
+
function Pe(e, t, n) {
|
|
1026
1041
|
if (e.order_by) {
|
|
1027
1042
|
let t = e.order_by.startsWith("-");
|
|
1028
|
-
return `${
|
|
1043
|
+
return `${j(t ? e.order_by.slice(1) : e.order_by)} ${t ? "DESC" : "ASC"}`;
|
|
1029
1044
|
}
|
|
1030
|
-
return t.length > 0 && t[0] === "time" ? `${
|
|
1045
|
+
return t.length > 0 && t[0] === "time" ? `${j("time")} ASC` : `${j(n)} DESC`;
|
|
1031
1046
|
}
|
|
1032
|
-
function
|
|
1047
|
+
function B(e) {
|
|
1033
1048
|
let t = e.dataset || "authhero_logs";
|
|
1034
1049
|
return { async query(n, r, i) {
|
|
1035
|
-
let a =
|
|
1050
|
+
let a = De[r], o = Ae[r], s = [], c = [];
|
|
1036
1051
|
for (let e of i.group_by) if (e === "time") {
|
|
1037
|
-
let e =
|
|
1038
|
-
s.push(`${e} AS ${
|
|
1052
|
+
let e = je(i.interval, i.tz);
|
|
1053
|
+
s.push(`${e} AS ${j("time")}`), c.push({
|
|
1039
1054
|
name: "time",
|
|
1040
|
-
type:
|
|
1055
|
+
type: Me(i.interval)
|
|
1041
1056
|
});
|
|
1042
1057
|
} else {
|
|
1043
|
-
let t =
|
|
1044
|
-
s.push(`${t} AS ${
|
|
1058
|
+
let t = Oe[e];
|
|
1059
|
+
s.push(`${t} AS ${j(e)}`), c.push({
|
|
1045
1060
|
name: e,
|
|
1046
1061
|
type: "String"
|
|
1047
1062
|
});
|
|
@@ -1050,10 +1065,10 @@ function U(e) {
|
|
|
1050
1065
|
name: o.alias,
|
|
1051
1066
|
type: o.type
|
|
1052
1067
|
});
|
|
1053
|
-
let l = [...s, `${o.expr} AS ${
|
|
1068
|
+
let l = [...s, `${o.expr} AS ${j(o.alias)}`], u = i.group_by.length ? `GROUP BY ${i.group_by.map((e) => j(e === "time" ? "time" : e)).join(", ")}` : "", d = Pe(i, i.group_by.map((e) => e === "time" ? "time" : e), o.alias), f = `
|
|
1054
1069
|
SELECT ${l.join(", ")}
|
|
1055
|
-
FROM ${
|
|
1056
|
-
WHERE ${
|
|
1070
|
+
FROM ${j(t)}
|
|
1071
|
+
WHERE ${Ne(i, n, a)}
|
|
1057
1072
|
${u}
|
|
1058
1073
|
ORDER BY ${d}
|
|
1059
1074
|
LIMIT ${Math.max(0, i.limit)} OFFSET ${Math.max(0, i.offset)}
|
|
@@ -1090,47 +1105,47 @@ function U(e) {
|
|
|
1090
1105
|
}
|
|
1091
1106
|
//#endregion
|
|
1092
1107
|
//#region src/analytics-engine-logs/index.ts
|
|
1093
|
-
function
|
|
1108
|
+
function V(e) {
|
|
1094
1109
|
return e.analyticsEngineBinding || console.warn("Analytics Engine: No binding configured. Logs will not be written to Analytics Engine."), (!e.accountId || !e.apiToken) && console.warn("Analytics Engine: accountId and apiToken are required for querying logs via SQL API."), {
|
|
1095
|
-
create:
|
|
1096
|
-
list:
|
|
1097
|
-
get:
|
|
1110
|
+
create: ve(e),
|
|
1111
|
+
list: Te(e),
|
|
1112
|
+
get: be(e)
|
|
1098
1113
|
};
|
|
1099
1114
|
}
|
|
1100
1115
|
//#endregion
|
|
1101
1116
|
//#region src/analytics-engine-action-executions/actionExecutions.ts
|
|
1102
|
-
var
|
|
1103
|
-
function
|
|
1117
|
+
var Fe = "authhero_action_executions", Ie = 1024, Le = "[truncated]";
|
|
1118
|
+
function H(e) {
|
|
1104
1119
|
if (!(typeof e != "string" || e.length === 0)) try {
|
|
1105
1120
|
return JSON.parse(e);
|
|
1106
1121
|
} catch {
|
|
1107
1122
|
return;
|
|
1108
1123
|
}
|
|
1109
1124
|
}
|
|
1110
|
-
function
|
|
1125
|
+
function Re(e) {
|
|
1111
1126
|
let t = a.safeParse(e);
|
|
1112
1127
|
return t.success ? t.data : "unspecified";
|
|
1113
1128
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return e.length <= t ? e : `${e.substring(0, t - 11)}${
|
|
1129
|
+
function U(e, t = Ie) {
|
|
1130
|
+
return e.length <= t ? e : `${e.substring(0, t - 11)}${Le}`;
|
|
1116
1131
|
}
|
|
1117
|
-
function
|
|
1132
|
+
function W(e) {
|
|
1118
1133
|
return e == null ? "" : JSON.stringify(e);
|
|
1119
1134
|
}
|
|
1120
|
-
function
|
|
1135
|
+
function ze(e) {
|
|
1121
1136
|
let t = typeof e.blob6 == "string" && e.blob6.length > 0 ? e.blob6 : typeof e.double1 == "number" ? new Date(e.double1).toISOString() : "", n = typeof e.blob7 == "string" && e.blob7.length > 0 ? e.blob7 : t;
|
|
1122
1137
|
return {
|
|
1123
1138
|
id: typeof e.blob1 == "string" ? e.blob1 : "",
|
|
1124
1139
|
tenant_id: typeof e.index1 == "string" ? e.index1 : "",
|
|
1125
1140
|
trigger_id: typeof e.blob2 == "string" ? e.blob2 : "",
|
|
1126
|
-
status:
|
|
1127
|
-
results:
|
|
1128
|
-
logs:
|
|
1141
|
+
status: Re(e.blob3),
|
|
1142
|
+
results: H(e.blob4) ?? [],
|
|
1143
|
+
logs: H(e.blob5),
|
|
1129
1144
|
created_at: t,
|
|
1130
1145
|
updated_at: n
|
|
1131
1146
|
};
|
|
1132
1147
|
}
|
|
1133
|
-
function
|
|
1148
|
+
function Be(e) {
|
|
1134
1149
|
return async (t, n) => {
|
|
1135
1150
|
let r = Date.now(), i = new Date(r).toISOString(), a = {
|
|
1136
1151
|
id: n.id,
|
|
@@ -1142,10 +1157,10 @@ function Fe(e) {
|
|
|
1142
1157
|
created_at: i,
|
|
1143
1158
|
updated_at: i
|
|
1144
1159
|
};
|
|
1145
|
-
return
|
|
1160
|
+
return Ve(e, t, a, r), a;
|
|
1146
1161
|
};
|
|
1147
1162
|
}
|
|
1148
|
-
function
|
|
1163
|
+
function Ve(e, t, n, r) {
|
|
1149
1164
|
if (!e.analyticsEngineBinding) {
|
|
1150
1165
|
console.error("Analytics Engine action_executions binding not configured; skipping write");
|
|
1151
1166
|
return;
|
|
@@ -1153,13 +1168,13 @@ function Ie(e, t, n, r) {
|
|
|
1153
1168
|
try {
|
|
1154
1169
|
e.analyticsEngineBinding.writeDataPoint({
|
|
1155
1170
|
blobs: [
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1171
|
+
U(n.id),
|
|
1172
|
+
U(n.trigger_id),
|
|
1173
|
+
U(n.status),
|
|
1174
|
+
U(W(n.results)),
|
|
1175
|
+
U(W(n.logs)),
|
|
1176
|
+
U(n.created_at),
|
|
1177
|
+
U(n.updated_at)
|
|
1163
1178
|
],
|
|
1164
1179
|
doubles: [r],
|
|
1165
1180
|
indexes: [t.substring(0, 96)]
|
|
@@ -1168,29 +1183,29 @@ function Ie(e, t, n, r) {
|
|
|
1168
1183
|
console.error("Failed to write action_execution to Analytics Engine:", e);
|
|
1169
1184
|
}
|
|
1170
1185
|
}
|
|
1171
|
-
function
|
|
1186
|
+
function He(e) {
|
|
1172
1187
|
return async (t, n) => {
|
|
1173
|
-
let r = await
|
|
1188
|
+
let r = await k(e, `
|
|
1174
1189
|
SELECT *
|
|
1175
|
-
FROM ${
|
|
1176
|
-
WHERE index1 = ${
|
|
1177
|
-
AND blob1 = ${
|
|
1190
|
+
FROM ${j(e.dataset || Fe)}
|
|
1191
|
+
WHERE index1 = ${A(t)}
|
|
1192
|
+
AND blob1 = ${A(n)}
|
|
1178
1193
|
LIMIT 1
|
|
1179
1194
|
`);
|
|
1180
|
-
return r.length === 0 || !r[0] ? null :
|
|
1195
|
+
return r.length === 0 || !r[0] ? null : ze(r[0]);
|
|
1181
1196
|
};
|
|
1182
1197
|
}
|
|
1183
1198
|
//#endregion
|
|
1184
1199
|
//#region src/analytics-engine-action-executions/index.ts
|
|
1185
|
-
function
|
|
1200
|
+
function G(e) {
|
|
1186
1201
|
return e.analyticsEngineBinding || console.warn("Analytics Engine: No action_executions binding configured. Executions will not be written."), (!e.accountId || !e.apiToken) && console.warn("Analytics Engine: accountId and apiToken are required to read action_executions via the SQL API."), {
|
|
1187
|
-
create:
|
|
1188
|
-
get:
|
|
1202
|
+
create: Be(e),
|
|
1203
|
+
get: He(e)
|
|
1189
1204
|
};
|
|
1190
1205
|
}
|
|
1191
1206
|
//#endregion
|
|
1192
1207
|
//#region src/geo/index.ts
|
|
1193
|
-
function
|
|
1208
|
+
function Ue() {
|
|
1194
1209
|
return { async getGeoInfo(e) {
|
|
1195
1210
|
try {
|
|
1196
1211
|
let t = e["cf-ipcountry"], n = e["cf-ipcity"], r = e["cf-iplatitude"], i = e["cf-iplongitude"], a = e["cf-timezone"], o = e["cf-ipcontinent"];
|
|
@@ -1209,7 +1224,7 @@ function Re() {
|
|
|
1209
1224
|
}
|
|
1210
1225
|
//#endregion
|
|
1211
1226
|
//#region src/rate-limit/index.ts
|
|
1212
|
-
var
|
|
1227
|
+
var We = class {
|
|
1213
1228
|
bindings;
|
|
1214
1229
|
constructor(e) {
|
|
1215
1230
|
this.bindings = e;
|
|
@@ -1225,12 +1240,61 @@ var ze = class {
|
|
|
1225
1240
|
}
|
|
1226
1241
|
}
|
|
1227
1242
|
};
|
|
1228
|
-
function
|
|
1229
|
-
if (e && Object.keys(e).some((t) => e[t])) return new
|
|
1243
|
+
function K(e) {
|
|
1244
|
+
if (e && Object.keys(e).some((t) => e[t])) return new We(e);
|
|
1245
|
+
}
|
|
1246
|
+
//#endregion
|
|
1247
|
+
//#region src/customDomains/sync.ts
|
|
1248
|
+
var Ge = 5, Ke = 1e3, q = 50;
|
|
1249
|
+
async function qe(e, t = {}) {
|
|
1250
|
+
let n = Math.trunc(t.perPage ?? q), r = Number.isFinite(n) ? Math.min(Ke, Math.max(Ge, n)) : q, i = t.maxPages ?? 200, a = {
|
|
1251
|
+
scanned: 0,
|
|
1252
|
+
matched: 0,
|
|
1253
|
+
updated: 0,
|
|
1254
|
+
unknown: 0,
|
|
1255
|
+
mismatched: 0,
|
|
1256
|
+
errors: 0
|
|
1257
|
+
};
|
|
1258
|
+
for (let t = 1; t <= i; t++) {
|
|
1259
|
+
let n;
|
|
1260
|
+
try {
|
|
1261
|
+
n = await x(e).get(`/custom_hostnames?page=${t}&per_page=${r}`).json();
|
|
1262
|
+
} catch (n) {
|
|
1263
|
+
return console.warn(`[custom-domains] sync failed to list page ${t} of zone ${e.zoneId}; stopping the sweep:`, n instanceof Error ? n.message : n), a.errors++, a;
|
|
1264
|
+
}
|
|
1265
|
+
let i = b.safeParse(n);
|
|
1266
|
+
if (!i.success || !i.data.success) return console.warn(`[custom-domains] sync got an unparseable listing for page ${t} of zone ${e.zoneId}; stopping the sweep.`, i.success ? { cfErrors: i.data.errors } : { zodIssues: i.error.issues }), a.errors++, a;
|
|
1267
|
+
let o = i.data.result;
|
|
1268
|
+
for (let t of o) {
|
|
1269
|
+
a.scanned++;
|
|
1270
|
+
try {
|
|
1271
|
+
let n = await e.customDomainAdapter.getByDomain(t.hostname);
|
|
1272
|
+
if (!n) {
|
|
1273
|
+
a.unknown++;
|
|
1274
|
+
continue;
|
|
1275
|
+
}
|
|
1276
|
+
if (e.enterprise && t.custom_metadata?.tenant_id !== n.tenant_id) {
|
|
1277
|
+
console.warn(`[custom-domains] sync skipping ${t.hostname}: zone says tenant=${t.custom_metadata?.tenant_id}, database says tenant=${n.tenant_id}.`), a.mismatched++;
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
if (n.custom_domain_id !== t.id) {
|
|
1281
|
+
console.warn(`[custom-domains] sync skipping ${t.hostname} (tenant=${n.tenant_id}): stored id ${n.custom_domain_id} no longer matches the zone's ${t.id}.`), a.mismatched++;
|
|
1282
|
+
continue;
|
|
1283
|
+
}
|
|
1284
|
+
a.matched++;
|
|
1285
|
+
let { outcome: r } = await ae(e, n.tenant_id, n, t);
|
|
1286
|
+
r === "updated" ? a.updated++ : r === "failed" && a.errors++;
|
|
1287
|
+
} catch (e) {
|
|
1288
|
+
console.warn(`[custom-domains] sync failed for ${t.hostname}:`, e instanceof Error ? e.message : e), a.errors++;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (o.length < r) return a;
|
|
1292
|
+
}
|
|
1293
|
+
return console.warn(`[custom-domains] sync hit the ${i}-page limit for zone ${e.zoneId}; the tail of the zone was not swept.`), a;
|
|
1230
1294
|
}
|
|
1231
1295
|
//#endregion
|
|
1232
1296
|
//#region src/code-executor/worker-template.ts
|
|
1233
|
-
function
|
|
1297
|
+
function J(e) {
|
|
1234
1298
|
return `// Auto-generated AuthHero code hook worker
|
|
1235
1299
|
|
|
1236
1300
|
const fnNames = {
|
|
@@ -1322,7 +1386,7 @@ export default {
|
|
|
1322
1386
|
}
|
|
1323
1387
|
//#endregion
|
|
1324
1388
|
//#region src/code-executor/index.ts
|
|
1325
|
-
var
|
|
1389
|
+
var Y = class {
|
|
1326
1390
|
config;
|
|
1327
1391
|
constructor(e) {
|
|
1328
1392
|
this.config = e;
|
|
@@ -1383,7 +1447,7 @@ var Z = class {
|
|
|
1383
1447
|
}
|
|
1384
1448
|
}
|
|
1385
1449
|
async deploy(e, t) {
|
|
1386
|
-
let n = `hook-${e}`, r =
|
|
1450
|
+
let n = `hook-${e}`, r = J(t), i = `https://api.cloudflare.com/client/v4/accounts/${this.config.accountId}/workers/dispatch/namespaces/${this.config.dispatchNamespace}/scripts/${n}`, a = JSON.stringify({
|
|
1387
1451
|
main_module: "index.js",
|
|
1388
1452
|
compatibility_date: this.config.compatibilityDate ?? "2024-11-20"
|
|
1389
1453
|
}), o = new FormData();
|
|
@@ -1408,21 +1472,21 @@ var Z = class {
|
|
|
1408
1472
|
throw Error(`Failed to remove hook worker ${t}: ${r.status} ${e}`);
|
|
1409
1473
|
}
|
|
1410
1474
|
}
|
|
1411
|
-
},
|
|
1475
|
+
}, Je = Y, Ye = {
|
|
1412
1476
|
"post-user-login": "onExecutePostLogin",
|
|
1413
1477
|
"credentials-exchange": "onExecuteCredentialsExchange",
|
|
1414
1478
|
"pre-user-registration": "onExecutePreUserRegistration",
|
|
1415
1479
|
"post-user-registration": "onExecutePostUserRegistration"
|
|
1416
|
-
},
|
|
1417
|
-
async function
|
|
1480
|
+
}, Xe = i;
|
|
1481
|
+
async function Ze(e) {
|
|
1418
1482
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t), r = new Uint8Array(n), i = "";
|
|
1419
1483
|
for (let e of r) i += e.toString(16).padStart(2, "0");
|
|
1420
1484
|
return i;
|
|
1421
1485
|
}
|
|
1422
|
-
function
|
|
1486
|
+
function Qe(e) {
|
|
1423
1487
|
return `
|
|
1424
|
-
const TRIGGER_FN_NAMES = ${JSON.stringify(
|
|
1425
|
-
const API_SHAPES = ${JSON.stringify(
|
|
1488
|
+
const TRIGGER_FN_NAMES = ${JSON.stringify(Ye)};
|
|
1489
|
+
const API_SHAPES = ${JSON.stringify(Xe)};
|
|
1426
1490
|
const MAX_LOG_ENTRIES = 50;
|
|
1427
1491
|
const MAX_LOG_LENGTH = 500;
|
|
1428
1492
|
|
|
@@ -1522,7 +1586,7 @@ export default {
|
|
|
1522
1586
|
};
|
|
1523
1587
|
`;
|
|
1524
1588
|
}
|
|
1525
|
-
var
|
|
1589
|
+
var $e = class {
|
|
1526
1590
|
loader;
|
|
1527
1591
|
compatibilityDate;
|
|
1528
1592
|
constructor(e) {
|
|
@@ -1531,11 +1595,11 @@ var Ge = class {
|
|
|
1531
1595
|
async execute(e) {
|
|
1532
1596
|
let t = Date.now();
|
|
1533
1597
|
try {
|
|
1534
|
-
let t =
|
|
1598
|
+
let t = Qe(e.code), n = {
|
|
1535
1599
|
compatibilityDate: this.compatibilityDate,
|
|
1536
1600
|
mainModule: "hook.js",
|
|
1537
1601
|
modules: { "hook.js": t }
|
|
1538
|
-
}, r = e.hookCodeId ? `${e.hookCodeId}-${await
|
|
1602
|
+
}, r = e.hookCodeId ? `${e.hookCodeId}-${await Ze(e.code)}` : null;
|
|
1539
1603
|
return await (await (r ? this.loader.get(r, async () => n) : this.loader.load(n)).getEntrypoint().fetch(new Request("https://hook/execute", {
|
|
1540
1604
|
method: "POST",
|
|
1541
1605
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1553,10 +1617,46 @@ var Ge = class {
|
|
|
1553
1617
|
};
|
|
1554
1618
|
}
|
|
1555
1619
|
}
|
|
1556
|
-
};
|
|
1620
|
+
}, X = new TextEncoder();
|
|
1621
|
+
function Z(e, t) {
|
|
1622
|
+
if (X.encode(e).length <= t) return e;
|
|
1623
|
+
let n = 0, r = "";
|
|
1624
|
+
for (let i of e) {
|
|
1625
|
+
let e = X.encode(i).length;
|
|
1626
|
+
if (n + e > t) break;
|
|
1627
|
+
n += e, r += i;
|
|
1628
|
+
}
|
|
1629
|
+
return r;
|
|
1630
|
+
}
|
|
1631
|
+
var Q = (e, t = 1024) => Z(e, t);
|
|
1632
|
+
function et(e) {
|
|
1633
|
+
let t = e.analyticsEngineBinding;
|
|
1634
|
+
return (e) => {
|
|
1635
|
+
if (t) try {
|
|
1636
|
+
t.writeDataPoint({
|
|
1637
|
+
blobs: [
|
|
1638
|
+
Q(e.name),
|
|
1639
|
+
Q(e.tenantId),
|
|
1640
|
+
Q(e.eventType),
|
|
1641
|
+
Q(e.source),
|
|
1642
|
+
Q(e.destination ?? ""),
|
|
1643
|
+
Q(e.error ?? "")
|
|
1644
|
+
],
|
|
1645
|
+
doubles: [
|
|
1646
|
+
e.value,
|
|
1647
|
+
e.retryCount ?? 0,
|
|
1648
|
+
Date.now()
|
|
1649
|
+
],
|
|
1650
|
+
indexes: [Z(e.tenantId, 96)]
|
|
1651
|
+
});
|
|
1652
|
+
} catch (e) {
|
|
1653
|
+
console.error("Failed to write outbox metric to Analytics Engine:", e);
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1557
1657
|
//#endregion
|
|
1558
1658
|
//#region src/wfp-provisioner/provisioner.ts
|
|
1559
|
-
function
|
|
1659
|
+
function tt(e) {
|
|
1560
1660
|
let t = n(e);
|
|
1561
1661
|
return {
|
|
1562
1662
|
async onProvision(e) {
|
|
@@ -1577,10 +1677,10 @@ function Q(e) {
|
|
|
1577
1677
|
}
|
|
1578
1678
|
//#endregion
|
|
1579
1679
|
//#region src/wfp-provisioner/tenant-hook.ts
|
|
1580
|
-
function
|
|
1680
|
+
function nt(e) {
|
|
1581
1681
|
return e.deployment_type === "wfp";
|
|
1582
1682
|
}
|
|
1583
|
-
var
|
|
1683
|
+
var rt = 2048;
|
|
1584
1684
|
function $(e) {
|
|
1585
1685
|
let t;
|
|
1586
1686
|
if (e instanceof Error) t = e.message;
|
|
@@ -1589,10 +1689,10 @@ function $(e) {
|
|
|
1589
1689
|
} catch {
|
|
1590
1690
|
t = Object.prototype.toString.call(e);
|
|
1591
1691
|
}
|
|
1592
|
-
return t.slice(0,
|
|
1692
|
+
return t.slice(0, rt);
|
|
1593
1693
|
}
|
|
1594
|
-
function
|
|
1595
|
-
let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ??
|
|
1694
|
+
function it(e) {
|
|
1695
|
+
let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ?? nt, o = e.logger;
|
|
1596
1696
|
async function s(e, t) {
|
|
1597
1697
|
try {
|
|
1598
1698
|
await n.update(e, {
|
|
@@ -1686,15 +1786,15 @@ function Je(e) {
|
|
|
1686
1786
|
}
|
|
1687
1787
|
//#endregion
|
|
1688
1788
|
//#region src/wfp-provisioner/wfp-forward.ts
|
|
1689
|
-
var
|
|
1690
|
-
function
|
|
1789
|
+
var at = "DISPATCHER", ot = "tenant-{tenant_id}-auth", st = ["/u/widget/"];
|
|
1790
|
+
function ct(e) {
|
|
1691
1791
|
return typeof e == "object" && !!e && "get" in e && typeof Reflect.get(e, "get") == "function";
|
|
1692
1792
|
}
|
|
1693
|
-
function
|
|
1793
|
+
function lt(e, t) {
|
|
1694
1794
|
return e.replace(/\{tenant_id\}/g, t);
|
|
1695
1795
|
}
|
|
1696
|
-
function
|
|
1697
|
-
let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r =
|
|
1796
|
+
function ut(e) {
|
|
1797
|
+
let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r = at, scriptNameTemplate: i = ot, resolveTenantId: a = (e) => e.req.header("tenant-id"), localPaths: o = st } = e;
|
|
1698
1798
|
return async (e, s) => {
|
|
1699
1799
|
if (o.length > 0) {
|
|
1700
1800
|
let t = e.req.path;
|
|
@@ -1705,8 +1805,8 @@ function et(e) {
|
|
|
1705
1805
|
let l = await t.get(c);
|
|
1706
1806
|
if (!l || l.deployment_type !== "wfp" || l.provisioning_state && l.provisioning_state !== "ready") return s();
|
|
1707
1807
|
let u = Reflect.get(e.env ?? {}, r);
|
|
1708
|
-
if (!
|
|
1709
|
-
let d =
|
|
1808
|
+
if (!ct(u)) return s();
|
|
1809
|
+
let d = lt(i, c), f;
|
|
1710
1810
|
try {
|
|
1711
1811
|
f = await u.get(d).fetch(e.req.raw);
|
|
1712
1812
|
} catch (t) {
|
|
@@ -1729,19 +1829,19 @@ function et(e) {
|
|
|
1729
1829
|
}
|
|
1730
1830
|
//#endregion
|
|
1731
1831
|
//#region src/index.ts
|
|
1732
|
-
function
|
|
1832
|
+
function dt(e) {
|
|
1733
1833
|
let t = {
|
|
1734
|
-
customDomains:
|
|
1735
|
-
cache:
|
|
1834
|
+
customDomains: oe(e),
|
|
1835
|
+
cache: ce({
|
|
1736
1836
|
...e.cacheName && { cacheName: e.cacheName },
|
|
1737
1837
|
...e.defaultTtlSeconds !== void 0 && { defaultTtlSeconds: e.defaultTtlSeconds },
|
|
1738
1838
|
...e.keyPrefix && { keyPrefix: e.keyPrefix }
|
|
1739
1839
|
}),
|
|
1740
|
-
geo:
|
|
1840
|
+
geo: Ue()
|
|
1741
1841
|
};
|
|
1742
|
-
e.r2SqlLogs ? t.logs =
|
|
1743
|
-
let n =
|
|
1842
|
+
e.r2SqlLogs ? t.logs = _e(e.r2SqlLogs) : e.analyticsEngineLogs && (t.logs = V(e.analyticsEngineLogs)), e.analyticsEngineLogs && (t.analytics = B(e.analyticsEngineLogs), t.stats = z(e.analyticsEngineLogs)), e.analyticsEngineActionExecutions && (t.actionExecutions = G(e.analyticsEngineActionExecutions));
|
|
1843
|
+
let n = K(e.rateLimitBindings);
|
|
1744
1844
|
return n && (t.rateLimit = n), t;
|
|
1745
1845
|
}
|
|
1746
1846
|
//#endregion
|
|
1747
|
-
export { t as CloudflareApiClient, e as CloudflareApiError,
|
|
1847
|
+
export { t as CloudflareApiClient, e as CloudflareApiError, Je as CloudflareCodeExecutor, Y as DispatchNamespaceCodeExecutor, $e as WorkerLoaderCodeExecutor, G as createAnalyticsEngineActionExecutionsAdapter, B as createAnalyticsEngineAnalyticsAdapter, V as createAnalyticsEngineLogsAdapter, et as createAnalyticsEngineOutboxMetricsSink, z as createAnalyticsEngineStatsAdapter, K as createCloudflareRateLimitAdapter, tt as createCloudflareWfpD1Provisioner, _e as createR2SQLLogsAdapter, ge as createR2SQLStatsAdapter, ut as createWfpForwardMiddleware, n as createWfpProvisionerSteps, it as createWfpTenantProvisioningHook, dt as default, J as generateWorkerScript, qe as syncCustomDomains };
|