@lensjs/express 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.
package/dist/adapter.cjs CHANGED
@@ -78,8 +78,8 @@ var ExpressAdapter = class extends import_core.LensAdapter {
78
78
  serveUI(uiPath, spaRoute, _dataToInject) {
79
79
  this.app.use(this.normalizePath(spaRoute), import_express.default.static(uiPath));
80
80
  this.app.get(
81
- this.normalizePath(`${spaRoute}/favicon.svg`),
82
- (_, res) => res.sendFile(path.join(uiPath, "favicon.svg"))
81
+ this.normalizePath(`${spaRoute}/favicon.ico`),
82
+ (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
83
83
  );
84
84
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
85
85
  if (import_core.lensUtils.isStaticFile(req.path.split("/"))) {
@@ -169,7 +169,7 @@ var ExpressAdapter = class extends import_core.LensAdapter {
169
169
  createdAt: (0, import_date.nowISO)()
170
170
  },
171
171
  response: {
172
- json: res._body ?? null,
172
+ json: this.parseBody(res._body),
173
173
  headers: res.getHeaders?.()
174
174
  },
175
175
  user: await this.config.isAuthenticated?.(req) ? await this.config.getUser?.(req) : null
@@ -182,4 +182,10 @@ var ExpressAdapter = class extends import_core.LensAdapter {
182
182
  normalizePath(pathStr) {
183
183
  return pathStr.startsWith("/") ? pathStr : `/${pathStr}`;
184
184
  }
185
+ parseBody(body) {
186
+ if (!body) {
187
+ return null;
188
+ }
189
+ return JSON.parse(body);
190
+ }
185
191
  };
@@ -18,6 +18,7 @@ declare class ExpressAdapter extends LensAdapter {
18
18
  private patchResponseMethods;
19
19
  private finalizeRequestLog;
20
20
  private normalizePath;
21
+ private parseBody;
21
22
  }
22
23
 
23
24
  export { ExpressAdapter as default };
package/dist/adapter.d.ts CHANGED
@@ -18,6 +18,7 @@ declare class ExpressAdapter extends LensAdapter {
18
18
  private patchResponseMethods;
19
19
  private finalizeRequestLog;
20
20
  private normalizePath;
21
+ private parseBody;
21
22
  }
22
23
 
23
24
  export { ExpressAdapter as default };
package/dist/adapter.js CHANGED
@@ -48,8 +48,8 @@ var ExpressAdapter = class extends LensAdapter {
48
48
  serveUI(uiPath, spaRoute, _dataToInject) {
49
49
  this.app.use(this.normalizePath(spaRoute), express.static(uiPath));
50
50
  this.app.get(
51
- this.normalizePath(`${spaRoute}/favicon.svg`),
52
- (_, res) => res.sendFile(path.join(uiPath, "favicon.svg"))
51
+ this.normalizePath(`${spaRoute}/favicon.ico`),
52
+ (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
53
53
  );
54
54
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
55
55
  if (lensUtils.isStaticFile(req.path.split("/"))) {
@@ -139,7 +139,7 @@ var ExpressAdapter = class extends LensAdapter {
139
139
  createdAt: nowISO()
140
140
  },
141
141
  response: {
142
- json: res._body ?? null,
142
+ json: this.parseBody(res._body),
143
143
  headers: res.getHeaders?.()
144
144
  },
145
145
  user: await this.config.isAuthenticated?.(req) ? await this.config.getUser?.(req) : null
@@ -152,6 +152,12 @@ var ExpressAdapter = class extends LensAdapter {
152
152
  normalizePath(pathStr) {
153
153
  return pathStr.startsWith("/") ? pathStr : `/${pathStr}`;
154
154
  }
155
+ parseBody(body) {
156
+ if (!body) {
157
+ return null;
158
+ }
159
+ return JSON.parse(body);
160
+ }
155
161
  };
156
162
  export {
157
163
  ExpressAdapter as default
package/dist/index.cjs CHANGED
@@ -81,8 +81,8 @@ var ExpressAdapter = class extends import_core.LensAdapter {
81
81
  serveUI(uiPath, spaRoute, _dataToInject) {
82
82
  this.app.use(this.normalizePath(spaRoute), import_express.default.static(uiPath));
83
83
  this.app.get(
84
- this.normalizePath(`${spaRoute}/favicon.svg`),
85
- (_, res) => res.sendFile(path.join(uiPath, "favicon.svg"))
84
+ this.normalizePath(`${spaRoute}/favicon.ico`),
85
+ (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
86
86
  );
87
87
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
88
88
  if (import_core.lensUtils.isStaticFile(req.path.split("/"))) {
@@ -172,7 +172,7 @@ var ExpressAdapter = class extends import_core.LensAdapter {
172
172
  createdAt: (0, import_date.nowISO)()
173
173
  },
174
174
  response: {
175
- json: res._body ?? null,
175
+ json: this.parseBody(res._body),
176
176
  headers: res.getHeaders?.()
177
177
  },
178
178
  user: await this.config.isAuthenticated?.(req) ? await this.config.getUser?.(req) : null
@@ -185,6 +185,12 @@ var ExpressAdapter = class extends import_core.LensAdapter {
185
185
  normalizePath(pathStr) {
186
186
  return pathStr.startsWith("/") ? pathStr : `/${pathStr}`;
187
187
  }
188
+ parseBody(body) {
189
+ if (!body) {
190
+ return null;
191
+ }
192
+ return JSON.parse(body);
193
+ }
188
194
  };
189
195
 
190
196
  // src/index.ts
package/dist/index.js CHANGED
@@ -56,8 +56,8 @@ var ExpressAdapter = class extends LensAdapter {
56
56
  serveUI(uiPath, spaRoute, _dataToInject) {
57
57
  this.app.use(this.normalizePath(spaRoute), express.static(uiPath));
58
58
  this.app.get(
59
- this.normalizePath(`${spaRoute}/favicon.svg`),
60
- (_, res) => res.sendFile(path.join(uiPath, "favicon.svg"))
59
+ this.normalizePath(`${spaRoute}/favicon.ico`),
60
+ (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
61
61
  );
62
62
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
63
63
  if (lensUtils.isStaticFile(req.path.split("/"))) {
@@ -147,7 +147,7 @@ var ExpressAdapter = class extends LensAdapter {
147
147
  createdAt: nowISO()
148
148
  },
149
149
  response: {
150
- json: res._body ?? null,
150
+ json: this.parseBody(res._body),
151
151
  headers: res.getHeaders?.()
152
152
  },
153
153
  user: await this.config.isAuthenticated?.(req) ? await this.config.getUser?.(req) : null
@@ -160,6 +160,12 @@ var ExpressAdapter = class extends LensAdapter {
160
160
  normalizePath(pathStr) {
161
161
  return pathStr.startsWith("/") ? pathStr : `/${pathStr}`;
162
162
  }
163
+ parseBody(body) {
164
+ if (!body) {
165
+ return null;
166
+ }
167
+ return JSON.parse(body);
168
+ }
163
169
  };
164
170
 
165
171
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensjs/express",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Express adapter for LensJs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "express": "^5.1.0",
22
- "@lensjs/date": "1.0.10",
23
- "@lensjs/watchers": "1.0.10",
24
- "@lensjs/typescript-config": "1.0.10",
25
- "@lensjs/core": "1.0.10"
22
+ "@lensjs/watchers": "1.0.11",
23
+ "@lensjs/core": "1.0.11",
24
+ "@lensjs/typescript-config": "1.0.11",
25
+ "@lensjs/date": "1.0.11"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/express": "^5.0.3"