@tstdl/base 0.93.37 → 0.93.38

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.
@@ -82,7 +82,7 @@ export declare class AuditEvent<Details extends UndefinableJsonObject = Undefina
82
82
  /**
83
83
  * The (if possible unique) identifier of the actor who performed the action.
84
84
  */
85
- actor: string | null;
85
+ actor: string;
86
86
  /**
87
87
  * The type of the impersonator, if applicable.
88
88
  */
@@ -180,7 +180,7 @@ __decorate([
180
180
  ], AuditEvent.prototype, "actorType", void 0);
181
181
  __decorate([
182
182
  StringProperty(),
183
- __metadata("design:type", Object)
183
+ __metadata("design:type", String)
184
184
  ], AuditEvent.prototype, "actor", void 0);
185
185
  __decorate([
186
186
  Enumeration(ActorType, { nullable: true }),
@@ -98,7 +98,7 @@ export declare class Auditor<Events extends AuditEvents = Record<never, never>>
98
98
  * @param action The name of the action being logged.
99
99
  * @param data The payload containing details about the event.
100
100
  */
101
- info<const E extends Extract<keyof Events, string>>(action: E, data: AuditPayload<Events[E]>): Promise<void>;
101
+ info<const E extends Extract<keyof Events, string>>(action: E, data?: AuditPayload<Events[E]>): Promise<void>;
102
102
  /**
103
103
  * Logs a warning event.
104
104
  * Automatically sets severity to `Warn` and defaults outcome to `Failure`.
@@ -106,7 +106,7 @@ export declare class Auditor<Events extends AuditEvents = Record<never, never>>
106
106
  * @param action The name of the action being logged.
107
107
  * @param data The payload containing details about the event.
108
108
  */
109
- warn<const E extends Extract<keyof Events, string>>(action: E, data: AuditPayload<Events[E]>): Promise<void>;
109
+ warn<const E extends Extract<keyof Events, string>>(action: E, data?: AuditPayload<Events[E]>): Promise<void>;
110
110
  /**
111
111
  * Logs an error event.
112
112
  * Automatically sets severity to `Error` and defaults outcome to `Failure`.
@@ -114,7 +114,7 @@ export declare class Auditor<Events extends AuditEvents = Record<never, never>>
114
114
  * @param action The name of the action being logged.
115
115
  * @param data The payload containing details about the event.
116
116
  */
117
- error<const E extends Extract<keyof Events, string>>(action: E, data: AuditPayload<Events[E]>): Promise<void>;
117
+ error<const E extends Extract<keyof Events, string>>(action: E, data?: AuditPayload<Events[E]>): Promise<void>;
118
118
  /**
119
119
  * Logs a critical event.
120
120
  * Automatically sets severity to `Critical` and defaults outcome to `Failure`.
@@ -122,6 +122,6 @@ export declare class Auditor<Events extends AuditEvents = Record<never, never>>
122
122
  * @param action The name of the action being logged.
123
123
  * @param data The payload containing details about the event.
124
124
  */
125
- critical<const E extends Extract<keyof Events, string>>(action: E, data: AuditPayload<Events[E]>): Promise<void>;
125
+ critical<const E extends Extract<keyof Events, string>>(action: E, data?: AuditPayload<Events[E]>): Promise<void>;
126
126
  }
127
127
  export {};
package/audit/auditor.js CHANGED
@@ -178,7 +178,7 @@ let Auditor = Auditor_1 = class Auditor {
178
178
  await this.log(action, {
179
179
  ...data,
180
180
  severity: AuditSeverity.Info,
181
- outcome: data.outcome ?? AuditOutcome.Success,
181
+ outcome: data?.outcome ?? AuditOutcome.Success,
182
182
  });
183
183
  }
184
184
  /**
@@ -192,7 +192,7 @@ let Auditor = Auditor_1 = class Auditor {
192
192
  await this.log(action, {
193
193
  ...data,
194
194
  severity: AuditSeverity.Warn,
195
- outcome: data.outcome ?? AuditOutcome.Failure,
195
+ outcome: data?.outcome ?? AuditOutcome.Failure,
196
196
  });
197
197
  }
198
198
  /**
@@ -206,7 +206,7 @@ let Auditor = Auditor_1 = class Auditor {
206
206
  await this.log(action, {
207
207
  ...data,
208
208
  severity: AuditSeverity.Error,
209
- outcome: data.outcome ?? AuditOutcome.Failure,
209
+ outcome: data?.outcome ?? AuditOutcome.Failure,
210
210
  });
211
211
  }
212
212
  /**
@@ -220,7 +220,7 @@ let Auditor = Auditor_1 = class Auditor {
220
220
  await this.log(action, {
221
221
  ...data,
222
222
  severity: AuditSeverity.Critical,
223
- outcome: data.outcome ?? AuditOutcome.Failure,
223
+ outcome: data?.outcome ?? AuditOutcome.Failure,
224
224
  });
225
225
  }
226
226
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.37",
3
+ "version": "0.93.38",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"