asterflow 0.0.5 → 0.0.6

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.
@@ -21,7 +21,7 @@ A(C, {
21
21
  });
22
22
  module.exports = I(C);
23
23
  // core/src/controllers/Asterflow.ts
24
- var m = require("@asterflow/adapter"), f = require("@asterflow/response"), l = require("@asterflow/router"), R = require("@asterflow/url-parser"), g = require("reminist");
24
+ var f = require("@asterflow/adapter"), m = require("@asterflow/response"), l = require("@asterflow/router"), R = require("@asterflow/url-parser"), g = require("reminist");
25
25
  // core/src/utils/parser.ts
26
26
  function p(u, e) {
27
27
  return `${u}${e}`.replace(/\/{2,}/g, "/");
@@ -37,10 +37,10 @@ var c = class {
37
37
  beforeInitializePlugins = [];
38
38
  afterInitializePlugins = [];
39
39
  constructor(e) {
40
- this.driver = e?.driver ?? m.adapters.node, this.driver.onRequest = this.handleRequest.bind(this);
40
+ this.driver = e?.driver ?? f.adapters.node, this.driver.onRequest = this.handleRequest.bind(this);
41
41
  }
42
42
  async handleRequest(e, t) {
43
- t = t ?? new f.AsterResponse();
43
+ t = t ?? new m.AsterResponse();
44
44
  let s = () => t.notFound({
45
45
  statusCode: 404,
46
46
  code: "NOT_FOUND",
@@ -125,7 +125,7 @@ var c = class {
125
125
  if (!n || !r || !s) return;
126
126
  for (let d of o) {
127
127
  let h = await d({ instance: t, router: s, request: n, response: r, plugin: a });
128
- if (h && typeof h == "object" && h.constructor?.name === "AsterResponse")
128
+ if (h && h instanceof m.AsterResponse)
129
129
  return h;
130
130
  }
131
131
  }
package/dist/mjs/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // core/src/controllers/Asterflow.ts
2
- import { adapters as m } from "@asterflow/adapter";
3
- import { AsterResponse as f } from "@asterflow/response";
2
+ import { adapters as f } from "@asterflow/adapter";
3
+ import { AsterResponse as y } from "@asterflow/response";
4
4
  import {
5
5
  Method as l,
6
6
  MethodType as g,
7
7
  Router as x
8
8
  } from "@asterflow/router";
9
- import { Analyze as P, ErrorLog as y, InternalExpression as p } from "@asterflow/url-parser";
9
+ import { Analyze as P, ErrorLog as p, InternalExpression as m } from "@asterflow/url-parser";
10
10
  import { Reminist as w } from "reminist";
11
11
  // core/src/utils/parser.ts
12
12
  function R(c, e) {
@@ -23,10 +23,10 @@ var h = class {
23
23
  beforeInitializePlugins = [];
24
24
  afterInitializePlugins = [];
25
25
  constructor(e) {
26
- this.driver = e?.driver ?? m.node, this.driver.onRequest = this.handleRequest.bind(this);
26
+ this.driver = e?.driver ?? f.node, this.driver.onRequest = this.handleRequest.bind(this);
27
27
  }
28
28
  async handleRequest(e, t) {
29
- t = t ?? new f();
29
+ t = t ?? new y();
30
30
  let s = () => t.notFound({
31
31
  statusCode: 404,
32
32
  code: "NOT_FOUND",
@@ -37,14 +37,14 @@ var h = class {
37
37
  if (!r?.node?.store) return s();
38
38
  let i = r.node.store, a = await this.runHooks("onRequest", this, i, e, t);
39
39
  if (a) return a;
40
- (i.url.ast.expressions.has(p.Variable) || i.url.ast.expressions.has(p.Slug)) && (e.url = e.url.withParser(i.url));
40
+ (i.url.ast.expressions.has(m.Variable) || i.url.ast.expressions.has(m.Slug)) && (e.url = e.url.withParser(i.url));
41
41
  try {
42
42
  return await this.runHandler(i, e, t), await this.runHooks("onResponse", this, i, e, t), t;
43
43
  } catch (o) {
44
44
  return console.log(o), t.badRequest({
45
45
  statusCode: 400,
46
- message: o instanceof y ? "AST_ERROR" : "ERROR",
47
- error: o instanceof y || o instanceof Error ? o.message : o
46
+ message: o instanceof p ? "AST_ERROR" : "ERROR",
47
+ error: o instanceof p || o instanceof Error ? o.message : o
48
48
  });
49
49
  }
50
50
  }
@@ -111,7 +111,7 @@ var h = class {
111
111
  if (!n || !r || !s) return;
112
112
  for (let d of o) {
113
113
  let u = await d({ instance: t, router: s, request: n, response: r, plugin: a });
114
- if (u && typeof u == "object" && u.constructor?.name === "AsterResponse")
114
+ if (u && u instanceof y)
115
115
  return u;
116
116
  }
117
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterflow",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "dist/cjs/index.cjs",
5
5
  "module": "dist/mjs/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -34,10 +34,10 @@
34
34
  "typescript": "^5.8.3"
35
35
  },
36
36
  "dependencies": {
37
- "@asterflow/adapter": "1.0.13",
38
- "@asterflow/plugin": "1.0.9",
39
- "@asterflow/response": "1.0.10",
40
- "@asterflow/router": "1.0.13",
37
+ "@asterflow/adapter": "1.0.14",
38
+ "@asterflow/plugin": "1.0.10",
39
+ "@asterflow/response": "1.0.11",
40
+ "@asterflow/router": "1.0.14",
41
41
  "@asterflow/url-parser": "^2.0.3",
42
42
  "reminist": "^1.0.5"
43
43
  }