@bool-ts/core 1.0.10 → 1.0.11

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.
@@ -69,8 +69,8 @@ export const BoolFactory = (target) => {
69
69
  });
70
70
  app.set("etag", "strong");
71
71
  app.set("query parser", (query) => Qs.parse(query, {
72
- ["depth"]: 10,
73
- ["arrayLimit"]: 50
72
+ depth: 10,
73
+ arrayLimit: 50
74
74
  }));
75
75
  app.use(urlencoded({
76
76
  extended: true,
@@ -122,8 +122,13 @@ export const BoolFactory = (target) => {
122
122
  if (!allowOrigins.includes("*")) {
123
123
  if (!allowOrigins.includes(req.headers.origin || "*")) {
124
124
  return res.status(403).json({
125
- ["httpCode"]: 403,
126
- ["data"]: "Invalid origin."
125
+ httpCode: 403,
126
+ data: {
127
+ origin: {
128
+ code: "origin:invalid:0x00001",
129
+ message: "Invalid origin."
130
+ }
131
+ }
127
132
  });
128
133
  }
129
134
  }
@@ -133,7 +138,9 @@ export const BoolFactory = (target) => {
133
138
  res.header("Access-Control-Allow-Methods", allowMethods.join(", "));
134
139
  next();
135
140
  });
136
- app.use(routers);
141
+ if (routers.length > 0) {
142
+ app.use(routers);
143
+ }
137
144
  return app;
138
145
  };
139
146
  export default BoolFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bool-ts/core",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -88,8 +88,8 @@ export const BoolFactory = (
88
88
 
89
89
  app.set("etag", "strong");
90
90
  app.set("query parser", (query: string) => Qs.parse(query, {
91
- ["depth"]: 10,
92
- ["arrayLimit"]: 50
91
+ depth: 10,
92
+ arrayLimit: 50
93
93
  }));
94
94
 
95
95
  app.use(
@@ -152,8 +152,13 @@ export const BoolFactory = (
152
152
  if (!allowOrigins.includes("*")) {
153
153
  if (!allowOrigins.includes(req.headers.origin || "*")) {
154
154
  return res.status(403).json({
155
- ["httpCode"]: 403,
156
- ["data"]: "Invalid origin."
155
+ httpCode: 403,
156
+ data: {
157
+ origin: {
158
+ code: "origin:invalid:0x00001",
159
+ message: "Invalid origin."
160
+ }
161
+ }
157
162
  });
158
163
  }
159
164
  }
@@ -166,7 +171,9 @@ export const BoolFactory = (
166
171
  next();
167
172
  });
168
173
 
169
- app.use(routers);
174
+ if (routers.length > 0) {
175
+ app.use(routers);
176
+ }
170
177
 
171
178
  return app;
172
179
  }