@h3ravel/shared 0.25.0 → 0.27.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/dist/index.cjs CHANGED
@@ -38,44 +38,6 @@ crypto = __toESM(crypto);
38
38
  let preferred_pm = require("preferred-pm");
39
39
  preferred_pm = __toESM(preferred_pm);
40
40
 
41
- //#region src/Contracts/IHttp.ts
42
- /**
43
- * Represents the HTTP context for a single request lifecycle.
44
- * Encapsulates the application instance, request, and response objects.
45
- */
46
- var HttpContext = class HttpContext {
47
- static contexts = /* @__PURE__ */ new WeakMap();
48
- constructor(app, request, response) {
49
- this.app = app;
50
- this.request = request;
51
- this.response = response;
52
- }
53
- /**
54
- * Factory method to create a new HttpContext instance from a context object.
55
- * @param ctx - Object containing app, request, and response
56
- * @returns A new HttpContext instance
57
- */
58
- static init(ctx, event) {
59
- if (event && HttpContext.contexts.has(event)) return HttpContext.contexts.get(event);
60
- const instance = new HttpContext(ctx.app, ctx.request, ctx.response);
61
- if (event) HttpContext.contexts.set(event, instance);
62
- return instance;
63
- }
64
- /**
65
- * Retrieve an existing HttpContext instance for an event, if any.
66
- */
67
- static get(event) {
68
- return HttpContext.contexts.get(event);
69
- }
70
- /**
71
- * Delete the cached context for a given event (optional cleanup).
72
- */
73
- static forget(event) {
74
- HttpContext.contexts.delete(event);
75
- }
76
- };
77
-
78
- //#endregion
79
41
  //#region src/Utils/EnvParser.ts
80
42
  var EnvParser = class {
81
43
  static parse(initial) {
@@ -466,6 +428,16 @@ var Resolver = class {
466
428
  static hashObjectOrFunction(provider) {
467
429
  return crypto.default.createHash("sha1").update(provider.toString()).digest("hex");
468
430
  }
431
+ /**
432
+ * Checks if a function is asyncronous
433
+ *
434
+ * @param func
435
+ * @returns
436
+ */
437
+ static isAsyncFunction(func) {
438
+ if (typeof func !== "function") return false;
439
+ return Object.prototype.toString.call(func) === "[object AsyncFunction]";
440
+ }
469
441
  };
470
442
 
471
443
  //#endregion
@@ -557,7 +529,6 @@ var TaskManager = class {
557
529
  //#endregion
558
530
  exports.EnvParser = EnvParser;
559
531
  exports.FileSystem = FileSystem;
560
- exports.HttpContext = HttpContext;
561
532
  exports.Logger = Logger;
562
533
  exports.PathLoader = PathLoader;
563
534
  exports.Prompts = Prompts;