@archiva/archiva-nextjs 0.2.93 → 0.3.0

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/index.js CHANGED
@@ -239,6 +239,91 @@ var ArchivaError = class extends Error {
239
239
  }
240
240
  };
241
241
 
242
+ // src/eventNormalizer.ts
243
+ var coerceString = (value) => {
244
+ if (value === null || value === void 0) {
245
+ return void 0;
246
+ }
247
+ if (typeof value === "string") {
248
+ return value;
249
+ }
250
+ if (typeof value === "number" || typeof value === "boolean") {
251
+ return String(value);
252
+ }
253
+ return void 0;
254
+ };
255
+ var coerceNullableString = (value) => {
256
+ if (value === null || value === void 0) {
257
+ return null;
258
+ }
259
+ if (typeof value === "string") {
260
+ return value;
261
+ }
262
+ if (typeof value === "number" || typeof value === "boolean") {
263
+ return String(value);
264
+ }
265
+ return null;
266
+ };
267
+ var coerceActorType = (value) => {
268
+ if (typeof value !== "string") {
269
+ return void 0;
270
+ }
271
+ const normalized = value.toLowerCase();
272
+ if (normalized === "user" || normalized === "service" || normalized === "system") {
273
+ return normalized;
274
+ }
275
+ return void 0;
276
+ };
277
+ var getActorValue = (event, actorRecord, keys) => {
278
+ for (const key of keys) {
279
+ if (Object.prototype.hasOwnProperty.call(event, key)) {
280
+ return event[key];
281
+ }
282
+ if (actorRecord && Object.prototype.hasOwnProperty.call(actorRecord, key)) {
283
+ return actorRecord[key];
284
+ }
285
+ }
286
+ return void 0;
287
+ };
288
+ var normalizeAuditEventItem = (event) => {
289
+ const actorRecord = typeof event.actor === "object" && event.actor !== null ? event.actor : void 0;
290
+ const actorDisplayValue = getActorValue(event, actorRecord, [
291
+ "actorDisplay",
292
+ "actor_display",
293
+ "display",
294
+ "display_name",
295
+ "name"
296
+ ]);
297
+ const actorTypeValue = getActorValue(event, actorRecord, [
298
+ "actorType",
299
+ "actor_type",
300
+ "type"
301
+ ]);
302
+ const actorIdValue = getActorValue(event, actorRecord, [
303
+ "actorId",
304
+ "actor_id",
305
+ "id"
306
+ ]);
307
+ const actionKeyValue = coerceString(event.actionKey ?? event.action_key ?? event.action);
308
+ const actionDescriptionValue = coerceString(event.actionDescription ?? event.action_description);
309
+ const tenantIdValue = coerceString(event.tenantId ?? event.tenant_id);
310
+ return {
311
+ id: coerceString(event.id) ?? "",
312
+ receivedAt: coerceString(event.receivedAt ?? event.received_at) ?? "",
313
+ actionKey: actionKeyValue ?? "",
314
+ actionDescription: actionDescriptionValue ?? void 0,
315
+ tenantId: tenantIdValue ?? void 0,
316
+ // Legacy support: include action for backward compatibility
317
+ action: actionKeyValue ?? "",
318
+ entityType: coerceString(event.entityType ?? event.entity_type) ?? "",
319
+ entityId: coerceString(event.entityId ?? event.entity_id) ?? "",
320
+ actorId: coerceNullableString(actorIdValue),
321
+ actorType: coerceActorType(actorTypeValue),
322
+ actorDisplay: coerceString(actorDisplayValue) ?? "",
323
+ source: coerceNullableString(event.source)
324
+ };
325
+ };
326
+
242
327
  // src/client.ts
243
328
  var DEFAULT_BASE_URL = "https://api.archiva.app";
244
329
  function buildHeaders(apiKey, overrides) {
@@ -300,7 +385,20 @@ async function loadEvents(apiKey, params, baseUrl = DEFAULT_BASE_URL) {
300
385
  url.searchParams.set("entityType", params.entityType);
301
386
  }
302
387
  if (params.actorType) {
303
- url.searchParams.set("actorType", params.actorType);
388
+ if (Array.isArray(params.actorType)) {
389
+ url.searchParams.set("actorType", params.actorType.join(","));
390
+ } else {
391
+ url.searchParams.set("actorType", params.actorType);
392
+ }
393
+ }
394
+ if (params.tenantId) {
395
+ url.searchParams.set("tenantId", params.tenantId);
396
+ }
397
+ if (params.actionKey) {
398
+ url.searchParams.set("actionKey", params.actionKey);
399
+ }
400
+ if (params.q) {
401
+ url.searchParams.set("q", params.q);
304
402
  }
305
403
  if (params.limit) {
306
404
  url.searchParams.set("limit", String(params.limit));
@@ -332,20 +430,7 @@ async function loadEvents(apiKey, params, baseUrl = DEFAULT_BASE_URL) {
332
430
  details: item
333
431
  });
334
432
  }
335
- const event = item;
336
- const actorDisplay = event.actorDisplay !== null && event.actorDisplay !== void 0 ? event.actorDisplay : event.actor_display !== null && event.actor_display !== void 0 ? event.actor_display : void 0;
337
- const actorType = event.actorType !== null && event.actorType !== void 0 ? event.actorType : event.actor_type !== null && event.actor_type !== void 0 ? event.actor_type : void 0;
338
- return {
339
- id: String(event.id ?? ""),
340
- receivedAt: String(event.receivedAt ?? event.received_at ?? ""),
341
- action: String(event.action ?? ""),
342
- entityType: String(event.entityType ?? event.entity_type ?? ""),
343
- entityId: String(event.entityId ?? event.entity_id ?? ""),
344
- actorId: event.actorId !== null && event.actorId !== void 0 ? String(event.actorId) : event.actor_id !== null && event.actor_id !== void 0 ? String(event.actor_id) : null,
345
- actorType: actorType && (actorType === "user" || actorType === "service" || actorType === "system") ? actorType : void 0,
346
- actorDisplay: actorDisplay !== null && actorDisplay !== void 0 ? String(actorDisplay) : void 0,
347
- source: event.source !== null && event.source !== void 0 ? String(event.source) : null
348
- };
433
+ return normalizeAuditEventItem(item);
349
434
  });
350
435
  return {
351
436
  items,
package/dist/index.mjs CHANGED
@@ -9,7 +9,8 @@ import {
9
9
  createFrontendTokenGET,
10
10
  createFrontendTokenRoute,
11
11
  loadEvents
12
- } from "./chunk-2YLLG2IF.mjs";
12
+ } from "./chunk-5ZJUGBTU.mjs";
13
+ import "./chunk-LOKBGU6S.mjs";
13
14
  export {
14
15
  ArchivaError,
15
16
  ArchivaProvider,
@@ -56,6 +56,91 @@ function useArchiva() {
56
56
  return useArchivaContext();
57
57
  }
58
58
 
59
+ // src/eventNormalizer.ts
60
+ var coerceString = (value) => {
61
+ if (value === null || value === void 0) {
62
+ return void 0;
63
+ }
64
+ if (typeof value === "string") {
65
+ return value;
66
+ }
67
+ if (typeof value === "number" || typeof value === "boolean") {
68
+ return String(value);
69
+ }
70
+ return void 0;
71
+ };
72
+ var coerceNullableString = (value) => {
73
+ if (value === null || value === void 0) {
74
+ return null;
75
+ }
76
+ if (typeof value === "string") {
77
+ return value;
78
+ }
79
+ if (typeof value === "number" || typeof value === "boolean") {
80
+ return String(value);
81
+ }
82
+ return null;
83
+ };
84
+ var coerceActorType = (value) => {
85
+ if (typeof value !== "string") {
86
+ return void 0;
87
+ }
88
+ const normalized = value.toLowerCase();
89
+ if (normalized === "user" || normalized === "service" || normalized === "system") {
90
+ return normalized;
91
+ }
92
+ return void 0;
93
+ };
94
+ var getActorValue = (event, actorRecord, keys) => {
95
+ for (const key of keys) {
96
+ if (Object.prototype.hasOwnProperty.call(event, key)) {
97
+ return event[key];
98
+ }
99
+ if (actorRecord && Object.prototype.hasOwnProperty.call(actorRecord, key)) {
100
+ return actorRecord[key];
101
+ }
102
+ }
103
+ return void 0;
104
+ };
105
+ var normalizeAuditEventItem = (event) => {
106
+ const actorRecord = typeof event.actor === "object" && event.actor !== null ? event.actor : void 0;
107
+ const actorDisplayValue = getActorValue(event, actorRecord, [
108
+ "actorDisplay",
109
+ "actor_display",
110
+ "display",
111
+ "display_name",
112
+ "name"
113
+ ]);
114
+ const actorTypeValue = getActorValue(event, actorRecord, [
115
+ "actorType",
116
+ "actor_type",
117
+ "type"
118
+ ]);
119
+ const actorIdValue = getActorValue(event, actorRecord, [
120
+ "actorId",
121
+ "actor_id",
122
+ "id"
123
+ ]);
124
+ const actionKeyValue = coerceString(event.actionKey ?? event.action_key ?? event.action);
125
+ const actionDescriptionValue = coerceString(event.actionDescription ?? event.action_description);
126
+ const tenantIdValue = coerceString(event.tenantId ?? event.tenant_id);
127
+ return {
128
+ id: coerceString(event.id) ?? "",
129
+ receivedAt: coerceString(event.receivedAt ?? event.received_at) ?? "",
130
+ actionKey: actionKeyValue ?? "",
131
+ actionDescription: actionDescriptionValue ?? void 0,
132
+ tenantId: tenantIdValue ?? void 0,
133
+ // Legacy support: include action for backward compatibility
134
+ action: actionKeyValue ?? "",
135
+ entityType: coerceString(event.entityType ?? event.entity_type) ?? "",
136
+ entityId: coerceString(event.entityId ?? event.entity_id) ?? "",
137
+ actorId: coerceNullableString(actorIdValue),
138
+ actorType: coerceActorType(actorTypeValue),
139
+ actorDisplay: coerceString(actorDisplayValue) ?? "",
140
+ source: coerceNullableString(event.source)
141
+ };
142
+ };
143
+
59
144
  // src/react/Timeline.tsx
60
145
  var import_jsx_runtime2 = require("react/jsx-runtime");
61
146
  function formatTimestamp(timestamp, format = "default") {
@@ -118,7 +203,8 @@ var CloudCogIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.js
118
203
  }
119
204
  );
120
205
  function eventToTimelineItem(event, getActorAvatar) {
121
- const action = event.action.charAt(0).toUpperCase() + event.action.slice(1);
206
+ const actionValue = event.actionKey || event.action || "";
207
+ const action = actionValue.charAt(0).toUpperCase() + actionValue.slice(1);
122
208
  const description = action;
123
209
  const actorId = event.actorId || "unknown";
124
210
  const userName = actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId;
@@ -148,7 +234,7 @@ function eventToTimelineItem(event, getActorAvatar) {
148
234
  // Required by TimelineItem type, but not used in activity layout - matches ActivityLog.tsx line 352
149
235
  userName: userName.charAt(0).toUpperCase() + userName.slice(1),
150
236
  // Matches ActivityLog.tsx line 353
151
- actorDisplay: event.actorDisplay ?? void 0,
237
+ actorDisplay: event.actorDisplay,
152
238
  // Matches ActivityLog.tsx line 354
153
239
  userHandle,
154
240
  // Matches ActivityLog.tsx line 355
@@ -181,7 +267,8 @@ async function fetchEventsWithRetry(apiBaseUrl, getToken, forceRefreshToken, par
181
267
  url.searchParams.set("entityType", params.entityType);
182
268
  }
183
269
  if (params.actorType) {
184
- url.searchParams.set("actorType", params.actorType);
270
+ const actorTypeValue = Array.isArray(params.actorType) ? params.actorType.join(",") : params.actorType;
271
+ url.searchParams.set("actorType", actorTypeValue);
185
272
  }
186
273
  if (params.limit) {
187
274
  url.searchParams.set("limit", String(params.limit));
@@ -217,20 +304,7 @@ async function fetchEventsWithRetry(apiBaseUrl, getToken, forceRefreshToken, par
217
304
  if (typeof item !== "object" || item === null) {
218
305
  throw new Error("Invalid item format in response");
219
306
  }
220
- const event = item;
221
- const actorDisplay = event.actorDisplay !== null && event.actorDisplay !== void 0 ? event.actorDisplay : event.actor_display !== null && event.actor_display !== void 0 ? event.actor_display : void 0;
222
- const actorType = event.actorType !== null && event.actorType !== void 0 ? event.actorType : event.actor_type !== null && event.actor_type !== void 0 ? event.actor_type : void 0;
223
- return {
224
- id: String(event.id ?? ""),
225
- receivedAt: String(event.receivedAt ?? event.received_at ?? ""),
226
- action: String(event.action ?? ""),
227
- entityType: String(event.entityType ?? event.entity_type ?? ""),
228
- entityId: String(event.entityId ?? event.entity_id ?? ""),
229
- actorId: event.actorId !== null && event.actorId !== void 0 ? String(event.actorId) : event.actor_id !== null && event.actor_id !== void 0 ? String(event.actor_id) : null,
230
- actorType: actorType && (actorType === "user" || actorType === "service" || actorType === "system") ? actorType : void 0,
231
- actorDisplay: actorDisplay !== null && actorDisplay !== void 0 ? String(actorDisplay) : void 0,
232
- source: event.source !== null && event.source !== void 0 ? String(event.source) : null
233
- };
307
+ return normalizeAuditEventItem(item);
234
308
  });
235
309
  return {
236
310
  items,
@@ -353,7 +427,8 @@ function applyClientSideFilters(events, searchQuery, showSystemAndServices) {
353
427
  }
354
428
  const query = searchQuery.toLowerCase();
355
429
  return filtered.filter((event) => {
356
- return event.action.toLowerCase().includes(query) || event.entityType.toLowerCase().includes(query) || event.entityId.toLowerCase().includes(query) || event.actorId && event.actorId.toLowerCase().includes(query) || event.source && event.source.toLowerCase().includes(query) || event.actorDisplay && event.actorDisplay.toLowerCase().includes(query);
430
+ const actionValue = (event.actionKey || event.action || "").toLowerCase();
431
+ return actionValue.includes(query) || event.entityType.toLowerCase().includes(query) || event.entityId.toLowerCase().includes(query) || event.actorId && event.actorId.toLowerCase().includes(query) || event.source && event.source.toLowerCase().includes(query) || event.actorDisplay && event.actorDisplay.toLowerCase().includes(query);
357
432
  });
358
433
  }
359
434
  function Timeline({
@@ -1,4 +1,7 @@
1
1
  "use client";
2
+ import {
3
+ normalizeAuditEventItem
4
+ } from "../chunk-LOKBGU6S.mjs";
2
5
  import {
3
6
  useArchivaContext
4
7
  } from "../chunk-H4TGL57C.mjs";
@@ -73,7 +76,8 @@ var CloudCogIcon = ({ className }) => /* @__PURE__ */ jsxs(
73
76
  }
74
77
  );
75
78
  function eventToTimelineItem(event, getActorAvatar) {
76
- const action = event.action.charAt(0).toUpperCase() + event.action.slice(1);
79
+ const actionValue = event.actionKey || event.action || "";
80
+ const action = actionValue.charAt(0).toUpperCase() + actionValue.slice(1);
77
81
  const description = action;
78
82
  const actorId = event.actorId || "unknown";
79
83
  const userName = actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId;
@@ -103,7 +107,7 @@ function eventToTimelineItem(event, getActorAvatar) {
103
107
  // Required by TimelineItem type, but not used in activity layout - matches ActivityLog.tsx line 352
104
108
  userName: userName.charAt(0).toUpperCase() + userName.slice(1),
105
109
  // Matches ActivityLog.tsx line 353
106
- actorDisplay: event.actorDisplay ?? void 0,
110
+ actorDisplay: event.actorDisplay,
107
111
  // Matches ActivityLog.tsx line 354
108
112
  userHandle,
109
113
  // Matches ActivityLog.tsx line 355
@@ -136,7 +140,8 @@ async function fetchEventsWithRetry(apiBaseUrl, getToken, forceRefreshToken, par
136
140
  url.searchParams.set("entityType", params.entityType);
137
141
  }
138
142
  if (params.actorType) {
139
- url.searchParams.set("actorType", params.actorType);
143
+ const actorTypeValue = Array.isArray(params.actorType) ? params.actorType.join(",") : params.actorType;
144
+ url.searchParams.set("actorType", actorTypeValue);
140
145
  }
141
146
  if (params.limit) {
142
147
  url.searchParams.set("limit", String(params.limit));
@@ -172,20 +177,7 @@ async function fetchEventsWithRetry(apiBaseUrl, getToken, forceRefreshToken, par
172
177
  if (typeof item !== "object" || item === null) {
173
178
  throw new Error("Invalid item format in response");
174
179
  }
175
- const event = item;
176
- const actorDisplay = event.actorDisplay !== null && event.actorDisplay !== void 0 ? event.actorDisplay : event.actor_display !== null && event.actor_display !== void 0 ? event.actor_display : void 0;
177
- const actorType = event.actorType !== null && event.actorType !== void 0 ? event.actorType : event.actor_type !== null && event.actor_type !== void 0 ? event.actor_type : void 0;
178
- return {
179
- id: String(event.id ?? ""),
180
- receivedAt: String(event.receivedAt ?? event.received_at ?? ""),
181
- action: String(event.action ?? ""),
182
- entityType: String(event.entityType ?? event.entity_type ?? ""),
183
- entityId: String(event.entityId ?? event.entity_id ?? ""),
184
- actorId: event.actorId !== null && event.actorId !== void 0 ? String(event.actorId) : event.actor_id !== null && event.actor_id !== void 0 ? String(event.actor_id) : null,
185
- actorType: actorType && (actorType === "user" || actorType === "service" || actorType === "system") ? actorType : void 0,
186
- actorDisplay: actorDisplay !== null && actorDisplay !== void 0 ? String(actorDisplay) : void 0,
187
- source: event.source !== null && event.source !== void 0 ? String(event.source) : null
188
- };
180
+ return normalizeAuditEventItem(item);
189
181
  });
190
182
  return {
191
183
  items,
@@ -308,7 +300,8 @@ function applyClientSideFilters(events, searchQuery, showSystemAndServices) {
308
300
  }
309
301
  const query = searchQuery.toLowerCase();
310
302
  return filtered.filter((event) => {
311
- return event.action.toLowerCase().includes(query) || event.entityType.toLowerCase().includes(query) || event.entityId.toLowerCase().includes(query) || event.actorId && event.actorId.toLowerCase().includes(query) || event.source && event.source.toLowerCase().includes(query) || event.actorDisplay && event.actorDisplay.toLowerCase().includes(query);
303
+ const actionValue = (event.actionKey || event.action || "").toLowerCase();
304
+ return actionValue.includes(query) || event.entityType.toLowerCase().includes(query) || event.entityId.toLowerCase().includes(query) || event.actorId && event.actorId.toLowerCase().includes(query) || event.source && event.source.toLowerCase().includes(query) || event.actorDisplay && event.actorDisplay.toLowerCase().includes(query);
312
305
  });
313
306
  }
314
307
  function Timeline({
@@ -1,2 +1,2 @@
1
- export { f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, F as FrontendTokenResponse, G as GET, L as LoadEventsParams, P as PageResult, c as createEvent, a as createEvents, b as createFrontendTokenGET, d as createFrontendTokenRoute, l as loadEvents } from '../index-BJ8aJsbs.mjs';
1
+ export { f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, F as FrontendTokenResponse, G as GET, L as LoadEventsParams, P as PageResult, c as createEvent, a as createEvents, b as createFrontendTokenGET, d as createFrontendTokenRoute, l as loadEvents } from '../index-DfJ2Gf0Y.mjs';
2
2
  import 'next/server';
@@ -1,2 +1,2 @@
1
- export { f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, F as FrontendTokenResponse, G as GET, L as LoadEventsParams, P as PageResult, c as createEvent, a as createEvents, b as createFrontendTokenGET, d as createFrontendTokenRoute, l as loadEvents } from '../index-BJ8aJsbs.js';
1
+ export { f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, F as FrontendTokenResponse, G as GET, L as LoadEventsParams, P as PageResult, c as createEvent, a as createEvents, b as createFrontendTokenGET, d as createFrontendTokenRoute, l as loadEvents } from '../index-DfJ2Gf0Y.js';
2
2
  import 'next/server';
@@ -113,6 +113,91 @@ var ArchivaError = class extends Error {
113
113
  }
114
114
  };
115
115
 
116
+ // src/eventNormalizer.ts
117
+ var coerceString = (value) => {
118
+ if (value === null || value === void 0) {
119
+ return void 0;
120
+ }
121
+ if (typeof value === "string") {
122
+ return value;
123
+ }
124
+ if (typeof value === "number" || typeof value === "boolean") {
125
+ return String(value);
126
+ }
127
+ return void 0;
128
+ };
129
+ var coerceNullableString = (value) => {
130
+ if (value === null || value === void 0) {
131
+ return null;
132
+ }
133
+ if (typeof value === "string") {
134
+ return value;
135
+ }
136
+ if (typeof value === "number" || typeof value === "boolean") {
137
+ return String(value);
138
+ }
139
+ return null;
140
+ };
141
+ var coerceActorType = (value) => {
142
+ if (typeof value !== "string") {
143
+ return void 0;
144
+ }
145
+ const normalized = value.toLowerCase();
146
+ if (normalized === "user" || normalized === "service" || normalized === "system") {
147
+ return normalized;
148
+ }
149
+ return void 0;
150
+ };
151
+ var getActorValue = (event, actorRecord, keys) => {
152
+ for (const key of keys) {
153
+ if (Object.prototype.hasOwnProperty.call(event, key)) {
154
+ return event[key];
155
+ }
156
+ if (actorRecord && Object.prototype.hasOwnProperty.call(actorRecord, key)) {
157
+ return actorRecord[key];
158
+ }
159
+ }
160
+ return void 0;
161
+ };
162
+ var normalizeAuditEventItem = (event) => {
163
+ const actorRecord = typeof event.actor === "object" && event.actor !== null ? event.actor : void 0;
164
+ const actorDisplayValue = getActorValue(event, actorRecord, [
165
+ "actorDisplay",
166
+ "actor_display",
167
+ "display",
168
+ "display_name",
169
+ "name"
170
+ ]);
171
+ const actorTypeValue = getActorValue(event, actorRecord, [
172
+ "actorType",
173
+ "actor_type",
174
+ "type"
175
+ ]);
176
+ const actorIdValue = getActorValue(event, actorRecord, [
177
+ "actorId",
178
+ "actor_id",
179
+ "id"
180
+ ]);
181
+ const actionKeyValue = coerceString(event.actionKey ?? event.action_key ?? event.action);
182
+ const actionDescriptionValue = coerceString(event.actionDescription ?? event.action_description);
183
+ const tenantIdValue = coerceString(event.tenantId ?? event.tenant_id);
184
+ return {
185
+ id: coerceString(event.id) ?? "",
186
+ receivedAt: coerceString(event.receivedAt ?? event.received_at) ?? "",
187
+ actionKey: actionKeyValue ?? "",
188
+ actionDescription: actionDescriptionValue ?? void 0,
189
+ tenantId: tenantIdValue ?? void 0,
190
+ // Legacy support: include action for backward compatibility
191
+ action: actionKeyValue ?? "",
192
+ entityType: coerceString(event.entityType ?? event.entity_type) ?? "",
193
+ entityId: coerceString(event.entityId ?? event.entity_id) ?? "",
194
+ actorId: coerceNullableString(actorIdValue),
195
+ actorType: coerceActorType(actorTypeValue),
196
+ actorDisplay: coerceString(actorDisplayValue) ?? "",
197
+ source: coerceNullableString(event.source)
198
+ };
199
+ };
200
+
116
201
  // src/client.ts
117
202
  var DEFAULT_BASE_URL = "https://api.archiva.app";
118
203
  function buildHeaders(apiKey, overrides) {
@@ -174,7 +259,20 @@ async function loadEvents(apiKey, params, baseUrl = DEFAULT_BASE_URL) {
174
259
  url.searchParams.set("entityType", params.entityType);
175
260
  }
176
261
  if (params.actorType) {
177
- url.searchParams.set("actorType", params.actorType);
262
+ if (Array.isArray(params.actorType)) {
263
+ url.searchParams.set("actorType", params.actorType.join(","));
264
+ } else {
265
+ url.searchParams.set("actorType", params.actorType);
266
+ }
267
+ }
268
+ if (params.tenantId) {
269
+ url.searchParams.set("tenantId", params.tenantId);
270
+ }
271
+ if (params.actionKey) {
272
+ url.searchParams.set("actionKey", params.actionKey);
273
+ }
274
+ if (params.q) {
275
+ url.searchParams.set("q", params.q);
178
276
  }
179
277
  if (params.limit) {
180
278
  url.searchParams.set("limit", String(params.limit));
@@ -206,20 +304,7 @@ async function loadEvents(apiKey, params, baseUrl = DEFAULT_BASE_URL) {
206
304
  details: item
207
305
  });
208
306
  }
209
- const event = item;
210
- const actorDisplay = event.actorDisplay !== null && event.actorDisplay !== void 0 ? event.actorDisplay : event.actor_display !== null && event.actor_display !== void 0 ? event.actor_display : void 0;
211
- const actorType = event.actorType !== null && event.actorType !== void 0 ? event.actorType : event.actor_type !== null && event.actor_type !== void 0 ? event.actor_type : void 0;
212
- return {
213
- id: String(event.id ?? ""),
214
- receivedAt: String(event.receivedAt ?? event.received_at ?? ""),
215
- action: String(event.action ?? ""),
216
- entityType: String(event.entityType ?? event.entity_type ?? ""),
217
- entityId: String(event.entityId ?? event.entity_id ?? ""),
218
- actorId: event.actorId !== null && event.actorId !== void 0 ? String(event.actorId) : event.actor_id !== null && event.actor_id !== void 0 ? String(event.actor_id) : null,
219
- actorType: actorType && (actorType === "user" || actorType === "service" || actorType === "system") ? actorType : void 0,
220
- actorDisplay: actorDisplay !== null && actorDisplay !== void 0 ? String(actorDisplay) : void 0,
221
- source: event.source !== null && event.source !== void 0 ? String(event.source) : null
222
- };
307
+ return normalizeAuditEventItem(item);
223
308
  });
224
309
  return {
225
310
  items,
@@ -5,7 +5,8 @@ import {
5
5
  createFrontendTokenGET,
6
6
  createFrontendTokenRoute,
7
7
  loadEvents
8
- } from "../chunk-2YLLG2IF.mjs";
8
+ } from "../chunk-5ZJUGBTU.mjs";
9
+ import "../chunk-LOKBGU6S.mjs";
9
10
  export {
10
11
  GET,
11
12
  createEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archiva/archiva-nextjs",
3
- "version": "0.2.93",
3
+ "version": "0.3.0",
4
4
  "description": "Archiva Next.js SDK - Server Actions and Timeline Component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",