@hoox-sh/hoox-shared 1.4.0 → 1.5.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.
Files changed (77) hide show
  1. package/README.md +6 -0
  2. package/dist/agent-config-fields.js +21 -29
  3. package/dist/analytics.d.ts +3 -4
  4. package/dist/analytics.d.ts.map +1 -1
  5. package/dist/analytics.js +56 -16
  6. package/dist/api-client.js +12 -21
  7. package/dist/colors.js +5 -21
  8. package/dist/config.js +11 -27
  9. package/dist/cron-handler.js +0 -16
  10. package/dist/d1/index.js +8 -25
  11. package/dist/d1/repository.js +3 -19
  12. package/dist/d1/schemas.js +4 -20
  13. package/dist/dashboard-manifest.d.ts +2 -1
  14. package/dist/dashboard-manifest.d.ts.map +1 -1
  15. package/dist/dashboard-manifest.js +37 -33
  16. package/dist/entitlements.d.ts +46 -0
  17. package/dist/entitlements.d.ts.map +1 -0
  18. package/dist/entitlements.js +15 -0
  19. package/dist/errors.js +7 -23
  20. package/dist/exchange-client.js +2 -18
  21. package/dist/exchanges/base-exchange-client.js +0 -16
  22. package/dist/exchanges/index.js +0 -16
  23. package/dist/format-time.js +2 -18
  24. package/dist/formatters.js +12 -28
  25. package/dist/health.js +3 -19
  26. package/dist/index.d.ts +5 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2211 -2098
  29. package/dist/kill-switch.js +12 -20
  30. package/dist/kvKeys.d.ts +8 -0
  31. package/dist/kvKeys.d.ts.map +1 -1
  32. package/dist/kvKeys.js +42 -46
  33. package/dist/kvUtils.js +8 -24
  34. package/dist/legal.js +5 -21
  35. package/dist/middleware/auth.js +9 -25
  36. package/dist/middleware/cors.js +4 -20
  37. package/dist/middleware/index.js +141 -163
  38. package/dist/middleware/logger.js +9 -25
  39. package/dist/middleware/rate-limit.js +2 -18
  40. package/dist/middleware/security-headers.js +2 -18
  41. package/dist/middleware/validate.js +5 -21
  42. package/dist/middleware/wait-until.js +2 -18
  43. package/dist/operator-transport.js +13 -17
  44. package/dist/path-utils.js +15 -31
  45. package/dist/queue-handler.js +0 -16
  46. package/dist/router.js +0 -16
  47. package/dist/schemas/index.js +35 -27
  48. package/dist/schemas/registry.d.ts.map +1 -1
  49. package/dist/schemas/registry.js +29 -20
  50. package/dist/schemas/validators.js +5 -21
  51. package/dist/service-bindings.js +13 -29
  52. package/dist/session.js +2 -18
  53. package/dist/sse.js +10 -18
  54. package/dist/stores/config-store.js +8 -22
  55. package/dist/stores/service-store.js +16 -29
  56. package/dist/stores/ui-store.js +0 -16
  57. package/dist/tenant.d.ts +61 -0
  58. package/dist/tenant.d.ts.map +1 -0
  59. package/dist/tenant.js +56 -0
  60. package/dist/test-utils.js +11 -27
  61. package/dist/types.d.ts +4 -2
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js +10 -24
  64. package/dist/wizard/engine.d.ts.map +1 -1
  65. package/dist/wizard/engine.js +21 -21
  66. package/dist/wizard/index.d.ts +1 -0
  67. package/dist/wizard/index.d.ts.map +1 -1
  68. package/dist/wizard/index.js +36 -33
  69. package/dist/wizard/persistence.d.ts +4 -0
  70. package/dist/wizard/persistence.d.ts.map +1 -1
  71. package/dist/wizard/persistence.js +7 -19
  72. package/dist/wizard/presets.d.ts.map +1 -1
  73. package/dist/wizard/presets.js +10 -22
  74. package/dist/wizard/types.d.ts +6 -0
  75. package/dist/wizard/types.d.ts.map +1 -1
  76. package/dist/wizard/types.js +5 -0
  77. package/package.json +7 -2
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/errors.ts
19
3
  function toError(err, fallback = "Unknown error") {
20
4
  if (err instanceof Error)
@@ -72,14 +56,14 @@ function sanitizeOutput(data) {
72
56
  const obj = data;
73
57
  const keys = Object.keys(obj);
74
58
  if (keys.length < 10) {
75
- const sanitized2 = {};
59
+ const sanitized = {};
76
60
  for (const k of keys) {
77
61
  if (k === "stack" || k === "cause")
78
62
  continue;
79
63
  const v = obj[k];
80
- sanitized2[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
64
+ sanitized[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
81
65
  }
82
- return sanitized2;
66
+ return sanitized;
83
67
  }
84
68
  if (!hasSensitiveFields(obj) && !hasErrorValues(obj)) {
85
69
  return obj;
@@ -143,6 +127,61 @@ var Errors = {
143
127
  }
144
128
  };
145
129
 
130
+ // src/middleware/logger.ts
131
+ function createLogger(ctx) {
132
+ const base = { service: ctx.service, module: ctx.module };
133
+ function emit(level, message, context) {
134
+ const entry = {
135
+ level,
136
+ timestamp: new Date().toISOString(),
137
+ ...base,
138
+ message,
139
+ ...context && { context }
140
+ };
141
+ const line = JSON.stringify(entry);
142
+ if (level === "error")
143
+ console.error(line);
144
+ else if (level === "warn")
145
+ console.warn(line);
146
+ else if (level === "debug")
147
+ console.debug(line);
148
+ else
149
+ console.info(line);
150
+ }
151
+ return {
152
+ debug: (msg, ctx) => emit("debug", msg, ctx),
153
+ info: (msg, ctx) => emit("info", msg, ctx),
154
+ warn: (msg, ctx) => emit("warn", msg, ctx),
155
+ error: (msg, ctx) => emit("error", msg, ctx)
156
+ };
157
+ }
158
+ function withRequestLog(handler, logCtx) {
159
+ return async (request, env, ctx) => {
160
+ const start = Date.now();
161
+ const logger = createLogger(logCtx);
162
+ try {
163
+ const response = await handler(request, env, ctx);
164
+ const duration = Date.now() - start;
165
+ const url = new URL(request.url);
166
+ logger.info(`${request.method} ${url.pathname}`, {
167
+ method: request.method,
168
+ path: url.pathname,
169
+ status: response.status,
170
+ durationMs: duration
171
+ });
172
+ return response;
173
+ } catch (error) {
174
+ const duration = Date.now() - start;
175
+ logger.error("Request failed", {
176
+ method: request.method,
177
+ path: new URL(request.url).pathname,
178
+ durationMs: duration,
179
+ error: toError(error)
180
+ });
181
+ throw error;
182
+ }
183
+ };
184
+ }
146
185
  // src/middleware/auth.ts
147
186
  function timingSafeEqual(a, b) {
148
187
  const encoder = new TextEncoder;
@@ -279,117 +318,6 @@ function checkInternalAuth(request, env, keyName = "INTERNAL_KEY_BINDING") {
279
318
  }
280
319
  return { authorized: true };
281
320
  }
282
-
283
- // src/middleware/cors.ts
284
- var DEFAULT_OPTIONS = {
285
- allowOrigin: "",
286
- allowMethods: "GET, POST, OPTIONS, PUT, DELETE",
287
- allowHeaders: "Content-Type, Authorization, X-Request-ID",
288
- allowCredentials: false,
289
- maxAge: 86400
290
- };
291
- function corsHeaders(options) {
292
- const opts = { ...DEFAULT_OPTIONS, ...options };
293
- const headers = {
294
- "Access-Control-Allow-Methods": opts.allowMethods,
295
- "Access-Control-Allow-Headers": opts.allowHeaders,
296
- "Access-Control-Max-Age": String(opts.maxAge)
297
- };
298
- if (opts.allowOrigin) {
299
- headers["Access-Control-Allow-Origin"] = opts.allowOrigin;
300
- }
301
- if (opts.allowCredentials) {
302
- headers["Access-Control-Allow-Credentials"] = "true";
303
- }
304
- return headers;
305
- }
306
- function publicCorsHeaders(origin = "*", options) {
307
- return corsHeaders({ ...options, allowOrigin: origin });
308
- }
309
- function internalCorsHeaders() {
310
- return {};
311
- }
312
- function resolveCorsOptions(request, env) {
313
- const raw = env && typeof env === "object" && "CORS_ALLOW_ORIGIN" in env && typeof env.CORS_ALLOW_ORIGIN === "string" ? env.CORS_ALLOW_ORIGIN : undefined;
314
- const configured = raw?.trim();
315
- if (!configured) {
316
- return {};
317
- }
318
- const allowed = configured.split(",").map((entry) => entry.trim()).filter(Boolean);
319
- const origin = request.headers.get("Origin");
320
- if (origin && allowed.includes(origin)) {
321
- return { allowOrigin: origin, allowCredentials: true };
322
- }
323
- if (!origin && allowed.length === 1) {
324
- return { allowOrigin: allowed[0] };
325
- }
326
- return {};
327
- }
328
- function handleCorsPreflightRequest(request, options) {
329
- if (request.method !== "OPTIONS")
330
- return null;
331
- return new Response(null, {
332
- status: 204,
333
- headers: corsHeaders(options)
334
- });
335
- }
336
-
337
- // src/middleware/logger.ts
338
- function createLogger(ctx) {
339
- const base = { service: ctx.service, module: ctx.module };
340
- function emit(level, message, context) {
341
- const entry = {
342
- level,
343
- timestamp: new Date().toISOString(),
344
- ...base,
345
- message,
346
- ...context && { context }
347
- };
348
- const line = JSON.stringify(entry);
349
- if (level === "error")
350
- console.error(line);
351
- else if (level === "warn")
352
- console.warn(line);
353
- else if (level === "debug")
354
- console.debug(line);
355
- else
356
- console.info(line);
357
- }
358
- return {
359
- debug: (msg, ctx2) => emit("debug", msg, ctx2),
360
- info: (msg, ctx2) => emit("info", msg, ctx2),
361
- warn: (msg, ctx2) => emit("warn", msg, ctx2),
362
- error: (msg, ctx2) => emit("error", msg, ctx2)
363
- };
364
- }
365
- function withRequestLog(handler, logCtx) {
366
- return async (request, env, ctx) => {
367
- const start = Date.now();
368
- const logger = createLogger(logCtx);
369
- try {
370
- const response = await handler(request, env, ctx);
371
- const duration = Date.now() - start;
372
- const url = new URL(request.url);
373
- logger.info(`${request.method} ${url.pathname}`, {
374
- method: request.method,
375
- path: url.pathname,
376
- status: response.status,
377
- durationMs: duration
378
- });
379
- return response;
380
- } catch (error) {
381
- const duration = Date.now() - start;
382
- logger.error("Request failed", {
383
- method: request.method,
384
- path: new URL(request.url).pathname,
385
- durationMs: duration,
386
- error: toError(error)
387
- });
388
- throw error;
389
- }
390
- };
391
- }
392
-
393
321
  // src/middleware/rate-limit.ts
394
322
  function createStorage(kv) {
395
323
  if (!kv) {
@@ -444,8 +372,8 @@ function createStorage(kv) {
444
372
  attempts++;
445
373
  if (attempts >= maxAttempts) {
446
374
  const current = await this.get(key);
447
- const count2 = current ? parseInt(current, 10) : 0;
448
- newValue = count2 + 1;
375
+ const count = current ? parseInt(current, 10) : 0;
376
+ newValue = count + 1;
449
377
  const ttl = opts?.expirationTtl ?? 0;
450
378
  const expiresAt = ttl > 0 ? Date.now() + ttl * 1000 : Infinity;
451
379
  memory.set(key, { value: String(newValue), expiresAt });
@@ -551,7 +479,6 @@ function createRateLimiter(kv, config) {
551
479
  }
552
480
  return { check, enforce, checkKey, enforceKey };
553
481
  }
554
-
555
482
  // src/middleware/validate.ts
556
483
  var DEFAULT_MAX_JSON_BODY_BYTES = 1048576;
557
484
  function validateJson(schema, data) {
@@ -619,7 +546,6 @@ function optionalField(body, field, defaultValue) {
619
546
  return defaultValue;
620
547
  return body[field];
621
548
  }
622
-
623
549
  // src/middleware/wait-until.ts
624
550
  function safeWaitUntil(ctx, promise, onError) {
625
551
  ctx.waitUntil(promise.catch((err) => {
@@ -645,7 +571,59 @@ function waitUntilAll(ctx, promises, onError) {
645
571
  }
646
572
  }), onError);
647
573
  }
648
-
574
+ // src/middleware/cors.ts
575
+ var DEFAULT_OPTIONS = {
576
+ allowOrigin: "",
577
+ allowMethods: "GET, POST, OPTIONS, PUT, DELETE",
578
+ allowHeaders: "Content-Type, Authorization, X-Request-ID",
579
+ allowCredentials: false,
580
+ maxAge: 86400
581
+ };
582
+ function corsHeaders(options) {
583
+ const opts = { ...DEFAULT_OPTIONS, ...options };
584
+ const headers = {
585
+ "Access-Control-Allow-Methods": opts.allowMethods,
586
+ "Access-Control-Allow-Headers": opts.allowHeaders,
587
+ "Access-Control-Max-Age": String(opts.maxAge)
588
+ };
589
+ if (opts.allowOrigin) {
590
+ headers["Access-Control-Allow-Origin"] = opts.allowOrigin;
591
+ }
592
+ if (opts.allowCredentials) {
593
+ headers["Access-Control-Allow-Credentials"] = "true";
594
+ }
595
+ return headers;
596
+ }
597
+ function publicCorsHeaders(origin = "*", options) {
598
+ return corsHeaders({ ...options, allowOrigin: origin });
599
+ }
600
+ function internalCorsHeaders() {
601
+ return {};
602
+ }
603
+ function resolveCorsOptions(request, env) {
604
+ const raw = env && typeof env === "object" && "CORS_ALLOW_ORIGIN" in env && typeof env.CORS_ALLOW_ORIGIN === "string" ? env.CORS_ALLOW_ORIGIN : undefined;
605
+ const configured = raw?.trim();
606
+ if (!configured) {
607
+ return {};
608
+ }
609
+ const allowed = configured.split(",").map((entry) => entry.trim()).filter(Boolean);
610
+ const origin = request.headers.get("Origin");
611
+ if (origin && allowed.includes(origin)) {
612
+ return { allowOrigin: origin, allowCredentials: true };
613
+ }
614
+ if (!origin && allowed.length === 1) {
615
+ return { allowOrigin: allowed[0] };
616
+ }
617
+ return {};
618
+ }
619
+ function handleCorsPreflightRequest(request, options) {
620
+ if (request.method !== "OPTIONS")
621
+ return null;
622
+ return new Response(null, {
623
+ status: 204,
624
+ headers: corsHeaders(options)
625
+ });
626
+ }
649
627
  // src/middleware/security-headers.ts
650
628
  var SECURITY_HEADERS_DEFAULTS = {
651
629
  xContentTypeOptions: "nosniff",
@@ -683,33 +661,33 @@ function wrapWithSecurityHeaders(response, options) {
683
661
  });
684
662
  }
685
663
  export {
686
- wrapWithSecurityHeaders,
687
- withRequestLog,
688
- waitUntilAll,
689
- validateJsonLegacy,
690
- validateJson,
691
- timingSafeEqualAsync,
692
- timingSafeEqual,
693
- secureHeaders,
694
- safeWaitUntil,
695
- resolveOperatorApiKey,
696
- resolveCorsOptions,
697
- requireOperatorAuth,
698
- requireInternalAuth,
699
- requireField,
700
- requireAuth,
701
- publicCorsHeaders,
702
- parseJsonBody,
703
- optionalField,
704
- internalCorsHeaders,
705
- handleCorsPreflightRequest,
706
- createRateLimiter,
707
- createOperatorAuthMiddleware,
708
- createLogger,
709
- createInternalAuthMiddleware,
710
- corsHeaders,
711
- collectInternalAuthKeys,
712
- checkInternalAuth,
664
+ DEFAULT_MAX_JSON_BODY_BYTES,
713
665
  SECURITY_HEADERS_DEFAULTS,
714
- DEFAULT_MAX_JSON_BODY_BYTES
666
+ checkInternalAuth,
667
+ collectInternalAuthKeys,
668
+ corsHeaders,
669
+ createInternalAuthMiddleware,
670
+ createLogger,
671
+ createOperatorAuthMiddleware,
672
+ createRateLimiter,
673
+ handleCorsPreflightRequest,
674
+ internalCorsHeaders,
675
+ optionalField,
676
+ parseJsonBody,
677
+ publicCorsHeaders,
678
+ requireAuth,
679
+ requireField,
680
+ requireInternalAuth,
681
+ requireOperatorAuth,
682
+ resolveCorsOptions,
683
+ resolveOperatorApiKey,
684
+ safeWaitUntil,
685
+ secureHeaders,
686
+ timingSafeEqual,
687
+ timingSafeEqualAsync,
688
+ validateJson,
689
+ validateJsonLegacy,
690
+ waitUntilAll,
691
+ withRequestLog,
692
+ wrapWithSecurityHeaders
715
693
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/errors.ts
19
3
  function toError(err, fallback = "Unknown error") {
20
4
  if (err instanceof Error)
@@ -72,14 +56,14 @@ function sanitizeOutput(data) {
72
56
  const obj = data;
73
57
  const keys = Object.keys(obj);
74
58
  if (keys.length < 10) {
75
- const sanitized2 = {};
59
+ const sanitized = {};
76
60
  for (const k of keys) {
77
61
  if (k === "stack" || k === "cause")
78
62
  continue;
79
63
  const v = obj[k];
80
- sanitized2[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
64
+ sanitized[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
81
65
  }
82
- return sanitized2;
66
+ return sanitized;
83
67
  }
84
68
  if (!hasSensitiveFields(obj) && !hasErrorValues(obj)) {
85
69
  return obj;
@@ -165,10 +149,10 @@ function createLogger(ctx) {
165
149
  console.info(line);
166
150
  }
167
151
  return {
168
- debug: (msg, ctx2) => emit("debug", msg, ctx2),
169
- info: (msg, ctx2) => emit("info", msg, ctx2),
170
- warn: (msg, ctx2) => emit("warn", msg, ctx2),
171
- error: (msg, ctx2) => emit("error", msg, ctx2)
152
+ debug: (msg, ctx) => emit("debug", msg, ctx),
153
+ info: (msg, ctx) => emit("info", msg, ctx),
154
+ warn: (msg, ctx) => emit("warn", msg, ctx),
155
+ error: (msg, ctx) => emit("error", msg, ctx)
172
156
  };
173
157
  }
174
158
  function withRequestLog(handler, logCtx) {
@@ -199,6 +183,6 @@ function withRequestLog(handler, logCtx) {
199
183
  };
200
184
  }
201
185
  export {
202
- withRequestLog,
203
- createLogger
186
+ createLogger,
187
+ withRequestLog
204
188
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/middleware/rate-limit.ts
19
3
  function createStorage(kv) {
20
4
  if (!kv) {
@@ -69,8 +53,8 @@ function createStorage(kv) {
69
53
  attempts++;
70
54
  if (attempts >= maxAttempts) {
71
55
  const current = await this.get(key);
72
- const count2 = current ? parseInt(current, 10) : 0;
73
- newValue = count2 + 1;
56
+ const count = current ? parseInt(current, 10) : 0;
57
+ newValue = count + 1;
74
58
  const ttl = opts?.expirationTtl ?? 0;
75
59
  const expiresAt = ttl > 0 ? Date.now() + ttl * 1000 : Infinity;
76
60
  memory.set(key, { value: String(newValue), expiresAt });
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/middleware/security-headers.ts
19
3
  var SECURITY_HEADERS_DEFAULTS = {
20
4
  xContentTypeOptions: "nosniff",
@@ -52,7 +36,7 @@ function wrapWithSecurityHeaders(response, options) {
52
36
  });
53
37
  }
54
38
  export {
55
- wrapWithSecurityHeaders,
39
+ SECURITY_HEADERS_DEFAULTS,
56
40
  secureHeaders,
57
- SECURITY_HEADERS_DEFAULTS
41
+ wrapWithSecurityHeaders
58
42
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/middleware/validate.ts
19
3
  var DEFAULT_MAX_JSON_BODY_BYTES = 1048576;
20
4
  function validateJson(schema, data) {
@@ -83,10 +67,10 @@ function optionalField(body, field, defaultValue) {
83
67
  return body[field];
84
68
  }
85
69
  export {
86
- validateJsonLegacy,
87
- validateJson,
88
- requireField,
89
- parseJsonBody,
70
+ DEFAULT_MAX_JSON_BODY_BYTES,
90
71
  optionalField,
91
- DEFAULT_MAX_JSON_BODY_BYTES
72
+ parseJsonBody,
73
+ requireField,
74
+ validateJson,
75
+ validateJsonLegacy
92
76
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/middleware/wait-until.ts
19
3
  function safeWaitUntil(ctx, promise, onError) {
20
4
  ctx.waitUntil(promise.catch((err) => {
@@ -41,6 +25,6 @@ function waitUntilAll(ctx, promises, onError) {
41
25
  }), onError);
42
26
  }
43
27
  export {
44
- waitUntilAll,
45
- safeWaitUntil
28
+ safeWaitUntil,
29
+ waitUntilAll
46
30
  };
@@ -1,19 +1,15 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
2
+ var __esm = (fn, res, err) => () => {
3
+ if (fn)
4
+ try {
5
+ res = fn(fn = 0);
6
+ } catch (e) {
7
+ err = [e];
8
+ }
9
+ if (err)
10
+ throw err[0];
11
+ return res;
15
12
  };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
13
 
18
14
  // src/operator-transport.ts
19
15
  function stripTrailingSlashes(url) {
@@ -84,8 +80,8 @@ var init_operator_transport = __esm(() => {
84
80
  init_operator_transport();
85
81
 
86
82
  export {
87
- resolveOperatorTransportProfile,
88
- operatorUrl,
83
+ buildOperatorAuthHeaders,
89
84
  hasOperatorClientCredentials,
90
- buildOperatorAuthHeaders
85
+ operatorUrl,
86
+ resolveOperatorTransportProfile
91
87
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/path-utils.ts
19
3
  import {
20
4
  existsSync,
@@ -236,20 +220,20 @@ function getHooxStatePath() {
236
220
  return resolveHooxPath("data/state.json");
237
221
  }
238
222
  export {
239
- resolveHooxRuntimeRoot,
240
- resolveHooxPath,
241
- rememberMonorepoRoot,
242
- isWithinHooxHome,
243
- isHooxSetupRoot,
244
- getTuiEntryCandidates,
245
- getRememberedMonorepoRoot,
246
- getRememberedMonorepoPath,
247
- getRelativeHooxPath,
248
- getHooxWranglerPath,
249
- getHooxStatePath,
250
- getHooxRepoPath,
251
- getHooxHome,
252
- getHooxDataDir,
223
+ findHooxSetupRoot,
253
224
  getHooxConfigDir,
254
- findHooxSetupRoot
225
+ getHooxDataDir,
226
+ getHooxHome,
227
+ getHooxRepoPath,
228
+ getHooxStatePath,
229
+ getHooxWranglerPath,
230
+ getRelativeHooxPath,
231
+ getRememberedMonorepoPath,
232
+ getRememberedMonorepoRoot,
233
+ getTuiEntryCandidates,
234
+ isHooxSetupRoot,
235
+ isWithinHooxHome,
236
+ rememberMonorepoRoot,
237
+ resolveHooxPath,
238
+ resolveHooxRuntimeRoot
255
239
  };
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/queue-handler.ts
19
3
  async function mapPool(items, concurrency, fn) {
20
4
  if (items.length === 0)
package/dist/router.js CHANGED
@@ -1,20 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
2
  // src/router.ts
19
3
  function createRouter() {
20
4
  const routes = [];