@develit-io/backend-sdk 9.1.0 → 9.1.1

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.
@@ -165,12 +165,12 @@ const logger = () => {
165
165
  const requestLog = await composeRequestLog(context.req);
166
166
  logRequest(requestLog);
167
167
  if (!context.env.MIDDLEWARE_LOGGER_AUDITLOG_DISABLED) {
168
- const user = context.get("user");
168
+ const user = context.get("user") || {};
169
169
  await context.env.AUDITLOG_SERVICE.processLog({
170
170
  type: "REQUEST",
171
171
  actor: {
172
- email: user.email,
173
- organizationId: user.organizationId
172
+ email: user.email || "UNKNOWN",
173
+ organizationId: user.organizationId || "UNKNOWN"
174
174
  },
175
175
  metadata: {
176
176
  ip: getRequestIpAddress(context.req),
@@ -190,12 +190,12 @@ const logger = () => {
190
190
  );
191
191
  logResponse(responseLog);
192
192
  if (!context.env.MIDDLEWARE_LOGGER_AUDITLOG_DISABLED) {
193
- const user = context.get("user");
193
+ const user = context.get("user") || {};
194
194
  await context.env.AUDITLOG_SERVICE.processLog({
195
195
  type: "RESPONSE",
196
196
  actor: {
197
- email: user.email,
198
- organizationId: user.organizationId
197
+ email: user.email || "UNKNOWN",
198
+ organizationId: user.organizationId || "UNKNOWN"
199
199
  },
200
200
  metadata: {
201
201
  ip: getRequestIpAddress(context.req),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",