@getstrata/bootstrap 0.2.26 → 0.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/bootstrap/http/securedRouteModelBinding.d.ts +2 -2
  2. package/dist/bootstrap/listeners/invalidateCacheOnModelWrite.d.ts +1 -1
  3. package/dist/bootstrap/schedule.d.ts +2 -1
  4. package/dist/bootstrap/web/forms.d.ts +1 -1
  5. package/dist/entries/applicationRegistry.js +2 -0
  6. package/dist/entries/buildModuleRoutes.js +5 -0
  7. package/dist/entries/buildWebModuleRoutes.js +5 -0
  8. package/dist/entries/cache/modelCacheTags.js +2 -0
  9. package/dist/entries/config.js +2 -0
  10. package/dist/entries/context.js +99 -3156
  11. package/dist/entries/contracts.js +2 -0
  12. package/dist/entries/createRoutes.js +1468 -0
  13. package/dist/entries/createSpaRoutes.js +64 -0
  14. package/dist/entries/createWebRoutes.js +5 -0
  15. package/dist/entries/dependencies.js +99 -3156
  16. package/dist/entries/discoverModules.js +2 -0
  17. package/dist/entries/health.js +215 -0
  18. package/dist/entries/http/securedRouteModelBinding.js +6 -293
  19. package/dist/entries/httpKernel.js +5 -0
  20. package/dist/entries/listeners/invalidateCacheOnModelWrite.js +120 -0
  21. package/dist/entries/membershipService.js +2 -0
  22. package/dist/entries/metricsRoutes.js +18 -0
  23. package/dist/entries/providers/view.js +8 -603
  24. package/dist/entries/providers.js +94 -3158
  25. package/dist/entries/queue/defaultJobs.js +7 -465
  26. package/dist/entries/routeRegistry.js +2 -0
  27. package/dist/entries/schedule.js +49 -0
  28. package/dist/entries/secretsGuard.js +9 -0
  29. package/dist/entries/web/forms.js +4 -18
  30. package/dist/entries/web/routing.js +21 -304
  31. package/dist/entries/web/server.js +2 -0
  32. package/dist/entries/web/session.js +3 -26
  33. package/dist/entries/web/slug.js +2 -0
  34. package/dist/index-sfreg6q3.js +0 -0
  35. package/dist/index.js +176 -3543
  36. package/package.json +32 -2
@@ -1,474 +1,16 @@
1
1
  // @bun
2
- // ../../src/core/jobs/dispatchWebhookJob.ts
3
- import { createHmac } from "crypto";
4
-
5
- // ../../src/config/app.ts
6
- var appConfig = {
7
- name: "WorkHub",
8
- env: process.env.APP_ENV ?? "local",
9
- debug: (process.env.APP_DEBUG ?? "true") !== "false",
10
- url: process.env.APP_URL ?? "http://localhost:3000",
11
- apiPrefix: process.env.API_PREFIX ?? "/api/v1"
12
- };
13
-
14
- // ../../src/core/database/boundConnection.ts
15
- var boundConnectionHolder = {
16
- connection: null
17
- };
18
- function getBoundDatabaseConnection() {
19
- return boundConnectionHolder.connection;
20
- }
21
-
22
- // ../../src/core/runtime/asyncContextStore.ts
23
- import { AsyncLocalStorage } from "async_hooks";
24
- function createAsyncContextStore(key) {
25
- const symbol = Symbol.for(key);
26
- const globalRecord = globalThis;
27
- const existing = globalRecord[symbol];
28
- if (existing) {
29
- return existing;
30
- }
31
- const store = new AsyncLocalStorage;
32
- globalRecord[symbol] = store;
33
- return store;
34
- }
35
-
36
- // ../../src/core/database/connectionContext.ts
37
- var activeConnection = createAsyncContextStore("@getstrata/databaseConnectionContext");
38
- function getActiveDatabaseConnection(fallback) {
39
- return activeConnection.getStore() ?? fallback;
40
- }
41
-
42
- // ../../src/core/database/queryProxy.ts
43
- var POOL_CONNECTION_METHODS = new Set(["begin", "close", "connect"]);
44
- function createDatabaseQueryProxy(pool) {
45
- function resolveDatabase() {
46
- return getActiveDatabaseConnection(pool);
47
- }
48
- function resolveDatabaseForProperty(property) {
49
- if (typeof property === "string" && POOL_CONNECTION_METHODS.has(property)) {
50
- return pool;
51
- }
52
- return resolveDatabase();
53
- }
54
- return new Proxy(function database() {}, {
55
- apply(_target, _thisArg, args) {
56
- return resolveDatabase()(...args);
57
- },
58
- get(_target, property) {
59
- const connection = resolveDatabaseForProperty(property);
60
- const value = connection[property];
61
- return typeof value === "function" ? value.bind(connection) : value;
62
- }
63
- });
64
- }
65
-
66
- // ../../src/core/database/defaultConnection.ts
67
- var defaultPool = {
68
- connection: null
69
- };
70
- var defaultQuery = {
71
- connection: null
72
- };
73
- function registerDefaultDatabasePool(connection) {
74
- defaultPool.connection = connection;
75
- defaultQuery.connection = createDatabaseQueryProxy(connection);
76
- }
77
- function getDefaultDatabaseQuery() {
78
- if (!defaultQuery.connection) {
79
- throw new Error("Default database query handle is not registered. Call registerDefaultDatabasePool() during app bootstrap.");
80
- }
81
- return defaultQuery.connection;
82
- }
83
-
84
- // ../../src/core/database/repositoryConnection.ts
85
- function resolveRepositoryConnection() {
86
- return getBoundDatabaseConnection() ?? getDefaultDatabaseQuery();
87
- }
88
- var repositoryConnection = new Proxy(function repositoryConnection2() {}, {
89
- apply(_target, _thisArg, args) {
90
- return resolveRepositoryConnection()(...args);
91
- },
92
- get(_target, property) {
93
- const connection = resolveRepositoryConnection();
94
- const value = connection[property];
95
- return typeof value === "function" ? value.bind(connection) : value;
96
- }
97
- });
98
-
99
- // ../../src/core/queue/index.ts
100
- class Job {
101
- maxAttempts;
102
- backoffMs;
103
- priority;
104
- }
105
-
106
- // ../../src/core/security/safeUrl.ts
107
- import { lookup as dnsLookupImpl } from "dns/promises";
108
-
109
- // ../../src/core/errors/http.ts
110
- class HttpError extends Error {
111
- status;
112
- details;
113
- constructor(status, message, details) {
114
- super(message);
115
- this.name = new.target.name;
116
- this.status = status;
117
- this.details = details;
118
- }
119
- }
120
-
121
- class BadRequestError extends HttpError {
122
- constructor(message = "Bad Request", details) {
123
- super(400, message, details);
124
- }
125
- }
126
- class ConflictError extends HttpError {
127
- constructor(message = "Conflict", details) {
128
- super(409, message, details);
129
- }
130
- }
131
-
132
- class UnprocessableEntityError extends HttpError {
133
- constructor(message = "Unprocessable Entity", details) {
134
- super(422, message, details);
135
- }
136
- }
137
- class ForbiddenError extends HttpError {
138
- constructor(message = "Forbidden", details) {
139
- super(403, message, details);
140
- }
141
- }
142
-
143
- class UnauthorizedError extends HttpError {
144
- constructor(message = "Unauthorized", details) {
145
- super(401, message, details);
146
- }
147
- }
148
- class PreconditionFailedError extends HttpError {
149
- constructor(message = "Precondition Failed", details) {
150
- super(412, message, details);
151
- }
152
- }
153
-
154
- // ../../src/core/security/safeUrl.ts
155
- var dnsLookup = dnsLookupImpl;
156
- var BLOCKED_HOSTNAMES = new Set([
157
- "localhost",
158
- "127.0.0.1",
159
- "0.0.0.0",
160
- "::1",
161
- "metadata.google.internal"
162
- ]);
163
- function isPrivateIpv4(hostname) {
164
- const match = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(hostname);
165
- if (!match) {
166
- return false;
167
- }
168
- const octets = match.slice(1, 5).map((part) => Number.parseInt(part, 10));
169
- if (octets.some((octet) => octet < 0 || octet > 255)) {
170
- return true;
171
- }
172
- const [a = 0, b = 0] = octets;
173
- if (a === 10) {
174
- return true;
175
- }
176
- if (a === 127) {
177
- return true;
178
- }
179
- if (a === 0) {
180
- return true;
181
- }
182
- if (a === 169 && b === 254) {
183
- return true;
184
- }
185
- if (a === 172 && b >= 16 && b <= 31) {
186
- return true;
187
- }
188
- if (a === 192 && b === 168) {
189
- return true;
190
- }
191
- return false;
192
- }
193
- function isBlockedHostname(hostname) {
194
- const normalized = hostname.trim().toLowerCase();
195
- if (normalized.length === 0) {
196
- return true;
197
- }
198
- if (BLOCKED_HOSTNAMES.has(normalized)) {
199
- return true;
200
- }
201
- if (normalized.endsWith(".local") || normalized.endsWith(".internal")) {
202
- return true;
203
- }
204
- if (normalized.includes(":")) {
205
- return true;
206
- }
207
- return isPrivateIpv4(normalized);
208
- }
209
- function assertSafeOutboundUrl(rawUrl, options = {}) {
210
- let parsed;
211
- try {
212
- parsed = new URL(rawUrl);
213
- } catch {
214
- throw new BadRequestError("Webhook URL is invalid.");
215
- }
216
- if (parsed.protocol !== "https:" && !(options.allowHttp && parsed.protocol === "http:")) {
217
- throw new BadRequestError("Webhook URL must use HTTPS.");
218
- }
219
- if (parsed.username || parsed.password) {
220
- throw new BadRequestError("Webhook URL must not include credentials.");
221
- }
222
- if (isBlockedHostname(parsed.hostname)) {
223
- throw new BadRequestError("Webhook URL targets a blocked host.");
224
- }
225
- return parsed;
226
- }
227
- function isBlockedIpAddress(address) {
228
- return isBlockedHostname(address.trim().toLowerCase());
229
- }
230
- async function assertSafeOutboundUrlResolved(rawUrl, options = {}) {
231
- const parsed = assertSafeOutboundUrl(rawUrl, options);
232
- if (options.resolveDns === false) {
233
- return parsed;
234
- }
235
- const hostname = parsed.hostname.trim().toLowerCase();
236
- const results = await dnsLookup(hostname, { all: true, verbatim: true });
237
- if (results.some((result) => isBlockedIpAddress(result.address))) {
238
- throw new BadRequestError("Webhook URL targets a blocked host.");
239
- }
240
- return parsed;
241
- }
242
-
243
- // ../../src/core/security/safeFetch.ts
244
- var DEFAULT_FETCH_TIMEOUT_MS = 1e4;
245
- async function safeFetch(input, init = {}, options = {}) {
246
- const timeoutMs = options.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
247
- const maxRedirects = options.maxRedirects ?? 0;
248
- const resolveDns = options.resolveDns ?? appConfig.env === "production";
249
- const urlOptions = { allowHttp: options.allowHttp, resolveDns };
250
- const controller = new AbortController;
251
- const timeout = setTimeout(() => controller.abort(), timeoutMs);
252
- try {
253
- let currentUrl = (await assertSafeOutboundUrlResolved(input, urlOptions)).toString();
254
- let redirectCount = 0;
255
- while (true) {
256
- const response = await fetch(currentUrl, {
257
- ...init,
258
- signal: controller.signal,
259
- redirect: "manual"
260
- });
261
- if (response.status >= 300 && response.status < 400) {
262
- const location = response.headers.get("location");
263
- if (!location || redirectCount >= maxRedirects) {
264
- return response;
265
- }
266
- currentUrl = (await assertSafeOutboundUrlResolved(new URL(location, currentUrl).toString(), urlOptions)).toString();
267
- redirectCount += 1;
268
- continue;
269
- }
270
- return response;
271
- }
272
- } finally {
273
- clearTimeout(timeout);
274
- }
275
- }
276
-
277
- // ../../src/core/jobs/dispatchWebhookJob.ts
278
- class DispatchWebhookJob extends Job {
279
- maxAttempts = 3;
280
- backoffMs = 2000;
281
- async handle(payload) {
282
- const rows = await repositoryConnection`
283
- SELECT id, url, secret
284
- FROM webhook
285
- WHERE id = ${payload.webhookId} AND active = TRUE
286
- LIMIT 1
287
- `;
288
- const webhook = rows[0];
289
- if (!webhook) {
290
- return;
291
- }
292
- const body = JSON.stringify({ event: payload.event, payload: payload.payload });
293
- const signature = createHmac("sha256", webhook.secret).update(body).digest("hex");
294
- assertSafeOutboundUrl(webhook.url, { allowHttp: appConfig.env !== "production" });
295
- let responseStatus = null;
296
- let errorMessage = null;
297
- try {
298
- const response = await safeFetch(webhook.url, {
299
- method: "POST",
300
- headers: {
301
- "content-type": "application/json",
302
- "x-workhub-signature": signature
303
- },
304
- body
305
- }, { allowHttp: appConfig.env !== "production" });
306
- responseStatus = response.status;
307
- if (!response.ok) {
308
- throw new Error(`Webhook delivery failed with status ${response.status}.`);
309
- }
310
- } catch (error) {
311
- errorMessage = error instanceof Error ? error.message : String(error);
312
- await repositoryConnection`
313
- INSERT INTO webhook_delivery (webhook_id, event, payload, response_status, error)
314
- VALUES (
315
- ${webhook.id},
316
- ${payload.event},
317
- ${JSON.stringify(payload.payload)}::jsonb,
318
- ${responseStatus},
319
- ${errorMessage}
320
- )
321
- `;
322
- throw error instanceof Error ? error : new Error(errorMessage);
323
- }
324
- await repositoryConnection`
325
- INSERT INTO webhook_delivery (webhook_id, event, payload, response_status)
326
- VALUES (
327
- ${webhook.id},
328
- ${payload.event},
329
- ${JSON.stringify(payload.payload)}::jsonb,
330
- ${responseStatus}
331
- )
332
- `;
333
- }
334
- }
335
- var dispatchWebhookJob_default = DispatchWebhookJob;
336
-
337
- // ../../src/core/jobs/invalidateCacheTagsJob.ts
338
- class InvalidateCacheTagsJob extends Job {
339
- cache;
340
- constructor(cache) {
341
- super();
342
- this.cache = cache;
343
- }
344
- async handle(payload) {
345
- await this.cache.tags(...payload.tags).flush();
346
- }
347
- }
348
- var invalidateCacheTagsJob_default = InvalidateCacheTagsJob;
349
-
350
- // ../../src/core/queue/jobRegistry.ts
351
- class JobRegistry {
352
- factories = new Map;
353
- instances = new WeakMap;
354
- register(name, factory) {
355
- this.factories.set(name, factory);
356
- }
357
- resolveName(job) {
358
- return this.instances.get(job);
359
- }
360
- track(name, job) {
361
- this.instances.set(job, name);
362
- return job;
363
- }
364
- create(name) {
365
- const factory = this.factories.get(name);
366
- if (!factory) {
367
- return;
368
- }
369
- return factory();
370
- }
371
- names() {
372
- return [...this.factories.keys()];
373
- }
374
- }
375
- var JOB_REGISTRY_KEY = Symbol.for("@getstrata/jobRegistry");
376
- function readSharedJobRegistry() {
377
- const globalRegistry = globalThis[JOB_REGISTRY_KEY];
378
- if (globalRegistry) {
379
- return globalRegistry;
380
- }
381
- const registry = new JobRegistry;
382
- globalThis[JOB_REGISTRY_KEY] = registry;
383
- return registry;
384
- }
385
- var jobRegistry = readSharedJobRegistry();
386
-
387
- // ../../src/core/contracts/di.ts
388
- function getRequiredDependency(dependencies, key) {
389
- const dependency = dependencies[key];
390
- if (dependency === undefined) {
391
- throw new Error(`Required dependency "${key}" is not registered.`);
392
- }
393
- return dependency;
394
- }
395
-
396
- // ../../src/core/contracts/serviceTokens.ts
397
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
398
- var CORE_AUTH_TOKEN = "core.auth";
399
-
400
- // ../../src/core/logging/logger.ts
401
- class Logger {
402
- channel;
403
- constructor(channel = "app") {
404
- this.channel = channel;
405
- }
406
- write(level, message, context = {}) {
407
- const entry = {
408
- level,
409
- channel: this.channel,
410
- message,
411
- timestamp: new Date().toISOString(),
412
- ...context
413
- };
414
- const line = JSON.stringify(entry);
415
- if (level === "error") {
416
- console.error(line);
417
- return;
418
- }
419
- console.log(line);
420
- }
421
- debug(message, context) {
422
- this.write("debug", message, context);
423
- }
424
- info(message, context) {
425
- this.write("info", message, context);
426
- }
427
- warn(message, context) {
428
- this.write("warn", message, context);
429
- }
430
- error(message, context) {
431
- this.write("error", message, context);
432
- }
433
- }
434
- var appLogger = new Logger("app");
435
-
436
- // ../../src/core/runtime/applicationRegistry.ts
437
- var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
438
- var activeContext;
439
- function readStoredApplicationContext() {
440
- if (activeContext) {
441
- return activeContext;
442
- }
443
- const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
444
- if (globalContext) {
445
- activeContext = globalContext;
446
- }
447
- return activeContext;
448
- }
449
- function requireActiveApplicationContext() {
450
- const context = readStoredApplicationContext();
451
- if (!context) {
452
- throw new Error("The application context has not been bootstrapped.");
453
- }
454
- return context;
455
- }
456
- function resolveApplicationCache() {
457
- return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
458
- }
459
- function resolveApplicationAuth() {
460
- return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
461
- }
462
- function resolveApplicationPolicyGate() {
463
- return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
464
- }
2
+ var __jsonParse = (a) => JSON.parse(a);
465
3
 
466
4
  // ../../src/bootstrap/queue/defaultJobs.ts
5
+ import DispatchWebhookJob from "@getstrata/core/jobs/dispatchWebhookJob";
6
+ import InvalidateCacheTagsJob from "@getstrata/core/jobs/invalidateCacheTagsJob";
7
+ import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
8
+ import { resolveApplicationCache } from "@getstrata/core/runtime/applicationRegistry";
467
9
  function registerDefaultJobs() {
468
10
  jobRegistry.register("cache.invalidate-tags", () => {
469
- return new invalidateCacheTagsJob_default(resolveApplicationCache());
11
+ return new InvalidateCacheTagsJob(resolveApplicationCache());
470
12
  });
471
- jobRegistry.register("webhook.dispatch", () => new dispatchWebhookJob_default);
13
+ jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
472
14
  }
473
15
  export {
474
16
  registerDefaultJobs
@@ -1,4 +1,6 @@
1
1
  // @bun
2
+ var __jsonParse = (a) => JSON.parse(a);
3
+
2
4
  // ../../src/bootstrap/routeRegistry.ts
3
5
  class RouteRegistry {
4
6
  routes = [];
@@ -0,0 +1,49 @@
1
+ // @bun
2
+ var __jsonParse = (a) => JSON.parse(a);
3
+
4
+ // ../../src/bootstrap/schedule.ts
5
+ import { exportPendingAuditLogs } from "@getstrata/core/audit/exportAuditLogs";
6
+ import { appLogger } from "@getstrata/core/logging/logger";
7
+ import { appSchedule } from "@getstrata/core/scheduler/schedule";
8
+
9
+ // ../../src/config/features.ts
10
+ function readFeatureFlags() {
11
+ return {
12
+ webhooks: (process.env.FEATURE_WEBHOOKS ?? "true") !== "false",
13
+ fullTextSearch: (process.env.FEATURE_SEARCH ?? "true") !== "false",
14
+ auditLog: (process.env.FEATURE_AUDIT_LOG ?? "true") !== "false",
15
+ oauthLogin: (process.env.FEATURE_OAUTH ?? "true") !== "false",
16
+ samlLogin: (process.env.FEATURE_SAML ?? "false") === "true",
17
+ scim: (process.env.FEATURE_SCIM ?? "true") !== "false",
18
+ billing: (process.env.FEATURE_BILLING ?? "true") !== "false",
19
+ siemExport: (process.env.FEATURE_SIEM_EXPORT ?? "true") !== "false",
20
+ publicReads: (process.env.FEATURE_PUBLIC_READS ?? "true") !== "false",
21
+ emailVerification: (process.env.FEATURE_EMAIL_VERIFICATION ?? "false") === "true",
22
+ mfa: (process.env.FEATURE_MFA ?? "false") === "true"
23
+ };
24
+ }
25
+ var featureFlags = readFeatureFlags();
26
+ function isFeatureEnabled(feature) {
27
+ return readFeatureFlags()[feature];
28
+ }
29
+
30
+ // ../../src/bootstrap/schedule.ts
31
+ appSchedule.command("* * * * *", "heartbeat", () => {
32
+ appLogger.debug("Scheduler heartbeat");
33
+ });
34
+ appSchedule.command("* * * * *", "audit-export", async () => {
35
+ if (!isFeatureEnabled("siemExport")) {
36
+ return;
37
+ }
38
+ try {
39
+ const exported = await exportPendingAuditLogs();
40
+ if (exported > 0) {
41
+ appLogger.info(`Exported ${exported} audit log entries to SIEM.`);
42
+ }
43
+ } catch (error) {
44
+ appLogger.error("Audit export failed.", { error: String(error) });
45
+ }
46
+ });
47
+ export {
48
+ appSchedule
49
+ };
@@ -1,4 +1,6 @@
1
1
  // @bun
2
+ var __jsonParse = (a) => JSON.parse(a);
3
+
2
4
  // ../../src/config/app.ts
3
5
  var appConfig = {
4
6
  name: "WorkHub",
@@ -36,6 +38,13 @@ var TEST_MEMBER_API_TOKEN = "workhub-member-test-token";
36
38
  // ../../src/domain/scim.ts
37
39
  var TEST_SCIM_BEARER_TOKEN = "workhub-scim-test-token";
38
40
  var DEFAULT_SCIM_BEARER_TOKEN = TEST_SCIM_BEARER_TOKEN;
41
+ var SCIM_SCHEMAS = {
42
+ user: "urn:ietf:params:scim:schemas:core:2.0:User",
43
+ group: "urn:ietf:params:scim:schemas:core:2.0:Group",
44
+ listResponse: "urn:ietf:params:scim:api:messages:2.0:ListResponse",
45
+ patchOp: "urn:ietf:params:scim:api:messages:2.0:PatchOp",
46
+ serviceProviderConfig: "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"
47
+ };
39
48
 
40
49
  // ../../src/bootstrap/secretsGuard.ts
41
50
  var DEFAULT_TOKENS = new Set([TEST_ADMIN_API_TOKEN, TEST_MEMBER_API_TOKEN]);
@@ -1,24 +1,10 @@
1
1
  // @bun
2
- // ../../src/core/http/csrfProtection.ts
3
- var DEFAULT_CSRF_TTL_MS = 60 * 60 * 1000;
4
- function createCsrfProtection(secret, options = {}) {
5
- const expiresIn = options.expiresIn ?? DEFAULT_CSRF_TTL_MS;
6
- const maxAge = options.maxAge ?? expiresIn;
7
- return {
8
- generate(_sessionKey) {
9
- return Bun.CSRF.generate(secret, { expiresIn });
10
- },
11
- verify(token, _sessionKey) {
12
- if (!token) {
13
- return false;
14
- }
15
- return Bun.CSRF.verify(token, { secret, maxAge });
16
- },
17
- secret
18
- };
19
- }
2
+ var __jsonParse = (a) => JSON.parse(a);
20
3
 
21
4
  // ../../src/bootstrap/web/forms.ts
5
+ import {
6
+ createCsrfProtection
7
+ } from "@getstrata/core/http/csrfProtection";
22
8
  async function parseFormBody(request) {
23
9
  const contentType = request.headers.get("content-type") ?? "";
24
10
  const fields = {};