@goodandready/dsh-cron 0.3.16 → 0.3.17

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/lib/http-utils.js CHANGED
@@ -78,10 +78,16 @@ export function parseJsonBody(req, limit = MAX_BODY_BYTES) {
78
78
 
79
79
  /**
80
80
  * Safe helper to get the DSH connection service from context or request (#357).
81
+ * Defensively degrades when context is a Cordis proxy throwing without inject (#366, GH #13).
81
82
  */
82
83
  export function getConnection(ctx) {
83
84
  if (!ctx) return null;
84
- return Reflect.get(ctx, 'connection') || ctx.connection || null;
85
+ try {
86
+ return Reflect.get(ctx, 'connection') || ctx.connection || null;
87
+ } catch (_err) {
88
+ // Degrade gracefully if context is a Cordis proxy throwing without inject (GH #13)
89
+ return null;
90
+ }
85
91
  }
86
92
 
87
93
  export function getDshConnection(req, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-cron",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "description": "Background automation runner for DSH: isolated agent runs, script/HTTP/SSH/Docker runtimes, cost guard, notifications, heartbeats.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",