@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.
@@ -0,0 +1,81 @@
1
+ // src/eventNormalizer.ts
2
+ var coerceString = (value) => {
3
+ if (value === null || value === void 0) {
4
+ return void 0;
5
+ }
6
+ if (typeof value === "string") {
7
+ return value;
8
+ }
9
+ if (typeof value === "number" || typeof value === "boolean") {
10
+ return String(value);
11
+ }
12
+ return void 0;
13
+ };
14
+ var coerceNullableString = (value) => {
15
+ if (value === null || value === void 0) {
16
+ return null;
17
+ }
18
+ if (typeof value === "string") {
19
+ return value;
20
+ }
21
+ if (typeof value === "number" || typeof value === "boolean") {
22
+ return String(value);
23
+ }
24
+ return null;
25
+ };
26
+ var coerceActorType = (value) => {
27
+ if (typeof value !== "string") {
28
+ return void 0;
29
+ }
30
+ const normalized = value.toLowerCase();
31
+ if (normalized === "user" || normalized === "service" || normalized === "system") {
32
+ return normalized;
33
+ }
34
+ return void 0;
35
+ };
36
+ var getActorValue = (event, actorRecord, keys) => {
37
+ for (const key of keys) {
38
+ if (Object.prototype.hasOwnProperty.call(event, key)) {
39
+ return event[key];
40
+ }
41
+ if (actorRecord && Object.prototype.hasOwnProperty.call(actorRecord, key)) {
42
+ return actorRecord[key];
43
+ }
44
+ }
45
+ return void 0;
46
+ };
47
+ var normalizeAuditEventItem = (event) => {
48
+ const actorRecord = typeof event.actor === "object" && event.actor !== null ? event.actor : void 0;
49
+ const actorDisplayValue = getActorValue(event, actorRecord, [
50
+ "actorDisplay",
51
+ "actor_display",
52
+ "display",
53
+ "display_name",
54
+ "name"
55
+ ]);
56
+ const actorTypeValue = getActorValue(event, actorRecord, [
57
+ "actorType",
58
+ "actor_type",
59
+ "type"
60
+ ]);
61
+ const actorIdValue = getActorValue(event, actorRecord, [
62
+ "actorId",
63
+ "actor_id",
64
+ "id"
65
+ ]);
66
+ return {
67
+ id: coerceString(event.id) ?? "",
68
+ receivedAt: coerceString(event.receivedAt ?? event.received_at) ?? "",
69
+ action: coerceString(event.action) ?? "",
70
+ entityType: coerceString(event.entityType ?? event.entity_type) ?? "",
71
+ entityId: coerceString(event.entityId ?? event.entity_id) ?? "",
72
+ actorId: coerceNullableString(actorIdValue),
73
+ actorType: coerceActorType(actorTypeValue),
74
+ actorDisplay: coerceString(actorDisplayValue) ?? "",
75
+ source: coerceNullableString(event.source)
76
+ };
77
+ };
78
+
79
+ export {
80
+ normalizeAuditEventItem
81
+ };
@@ -0,0 +1,139 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ type EventChange = {
4
+ op: "set" | "unset" | "add" | "remove" | "replace" | string;
5
+ path: string;
6
+ before?: unknown;
7
+ after?: unknown;
8
+ };
9
+ type CreateEventInput = {
10
+ action: string;
11
+ entityType: string;
12
+ entityId: string;
13
+ actorType?: string;
14
+ actorId?: string;
15
+ actorDisplay?: string;
16
+ occurredAt?: string;
17
+ source?: string;
18
+ context?: Record<string, unknown>;
19
+ changes?: EventChange[];
20
+ };
21
+ type CreateEventOptions = {
22
+ idempotencyKey?: string;
23
+ requestId?: string;
24
+ };
25
+ type AuditEventListItem = {
26
+ id: string;
27
+ receivedAt: string;
28
+ action: string;
29
+ entityType: string;
30
+ entityId: string;
31
+ actorId: string | null;
32
+ actorType?: 'user' | 'service' | 'system';
33
+ actorDisplay: string;
34
+ source: string | null;
35
+ };
36
+ type PageResult<T> = {
37
+ items: T[];
38
+ nextCursor?: string;
39
+ };
40
+ type LoadEventsParams = {
41
+ entityId?: string;
42
+ actorId?: string;
43
+ entityType?: string;
44
+ actorType?: 'user' | 'service' | 'system';
45
+ limit?: number;
46
+ cursor?: string;
47
+ };
48
+ declare class ArchivaError extends Error {
49
+ statusCode: number;
50
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
51
+ retryAfterSeconds?: number;
52
+ details?: unknown;
53
+ constructor(params: {
54
+ statusCode: number;
55
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
56
+ message: string;
57
+ retryAfterSeconds?: number;
58
+ details?: unknown;
59
+ });
60
+ }
61
+
62
+ /**
63
+ * Server action to load audit events
64
+ *
65
+ * @param params - Query parameters for filtering events
66
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
67
+ * @returns Paginated list of audit events
68
+ */
69
+ declare function loadEvents(params: LoadEventsParams, apiKey?: string): Promise<PageResult<AuditEventListItem>>;
70
+ /**
71
+ * Server action to create a single audit event
72
+ *
73
+ * @param event - Event data to create
74
+ * @param options - Optional idempotency and request ID options
75
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
76
+ * @returns Created event ID and replay status
77
+ */
78
+ declare function createEvent(event: CreateEventInput, options?: CreateEventOptions, apiKey?: string): Promise<{
79
+ eventId: string;
80
+ replayed: boolean;
81
+ }>;
82
+ /**
83
+ * Server action to create multiple audit events (bulk)
84
+ *
85
+ * @param events - Array of events to create
86
+ * @param options - Optional idempotency and request ID options
87
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
88
+ * @returns Array of created event IDs
89
+ */
90
+ declare function createEvents(events: CreateEventInput[], options?: CreateEventOptions, apiKey?: string): Promise<{
91
+ eventIds: string[];
92
+ }>;
93
+
94
+ interface FrontendTokenResponse {
95
+ token: string;
96
+ expiresAt: number;
97
+ }
98
+ /**
99
+ * Fetches a frontend token from the Archiva API
100
+ *
101
+ * @param projectId - Optional project ID for scoping
102
+ * @param apiBaseUrl - Archiva API base URL (defaults to https://api.archiva.app)
103
+ * @returns Frontend token response
104
+ */
105
+ declare function createFrontendTokenGET(projectId?: string, apiBaseUrl?: string): Promise<FrontendTokenResponse>;
106
+
107
+ /**
108
+ * Next.js route handler for GET /api/archiva/frontend-token
109
+ *
110
+ * This handler can be used in the host app's route file:
111
+ *
112
+ * ```ts
113
+ * // app/api/archiva/frontend-token/route.ts
114
+ * export { GET } from '@archiva/archiva-nextjs/server';
115
+ * ```
116
+ *
117
+ * Or with custom configuration:
118
+ *
119
+ * ```ts
120
+ * import { createFrontendTokenRoute } from '@archiva/archiva-nextjs/server';
121
+ *
122
+ * export const GET = createFrontendTokenRoute({
123
+ * apiBaseUrl: process.env.ARCHIVA_API_URL,
124
+ * });
125
+ * ```
126
+ */
127
+ declare function createFrontendTokenRoute(options?: {
128
+ apiBaseUrl?: string;
129
+ }): (request: NextRequest) => Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
130
+ error: string;
131
+ }>>;
132
+ /**
133
+ * Default GET handler (for direct export)
134
+ */
135
+ declare function GET(request: NextRequest): Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
136
+ error: string;
137
+ }>>;
138
+
139
+ export { ArchivaError as A, type CreateEventInput as C, type EventChange as E, type FrontendTokenResponse as F, GET as G, type LoadEventsParams as L, type PageResult as P, createEvents as a, createFrontendTokenGET as b, createEvent as c, createFrontendTokenRoute as d, type CreateEventOptions as e, type AuditEventListItem as f, loadEvents as l };
@@ -0,0 +1,139 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ type EventChange = {
4
+ op: "set" | "unset" | "add" | "remove" | "replace" | string;
5
+ path: string;
6
+ before?: unknown;
7
+ after?: unknown;
8
+ };
9
+ type CreateEventInput = {
10
+ action: string;
11
+ entityType: string;
12
+ entityId: string;
13
+ actorType?: string;
14
+ actorId?: string;
15
+ actorDisplay?: string;
16
+ occurredAt?: string;
17
+ source?: string;
18
+ context?: Record<string, unknown>;
19
+ changes?: EventChange[];
20
+ };
21
+ type CreateEventOptions = {
22
+ idempotencyKey?: string;
23
+ requestId?: string;
24
+ };
25
+ type AuditEventListItem = {
26
+ id: string;
27
+ receivedAt: string;
28
+ action: string;
29
+ entityType: string;
30
+ entityId: string;
31
+ actorId: string | null;
32
+ actorType?: 'user' | 'service' | 'system';
33
+ actorDisplay: string;
34
+ source: string | null;
35
+ };
36
+ type PageResult<T> = {
37
+ items: T[];
38
+ nextCursor?: string;
39
+ };
40
+ type LoadEventsParams = {
41
+ entityId?: string;
42
+ actorId?: string;
43
+ entityType?: string;
44
+ actorType?: 'user' | 'service' | 'system';
45
+ limit?: number;
46
+ cursor?: string;
47
+ };
48
+ declare class ArchivaError extends Error {
49
+ statusCode: number;
50
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
51
+ retryAfterSeconds?: number;
52
+ details?: unknown;
53
+ constructor(params: {
54
+ statusCode: number;
55
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
56
+ message: string;
57
+ retryAfterSeconds?: number;
58
+ details?: unknown;
59
+ });
60
+ }
61
+
62
+ /**
63
+ * Server action to load audit events
64
+ *
65
+ * @param params - Query parameters for filtering events
66
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
67
+ * @returns Paginated list of audit events
68
+ */
69
+ declare function loadEvents(params: LoadEventsParams, apiKey?: string): Promise<PageResult<AuditEventListItem>>;
70
+ /**
71
+ * Server action to create a single audit event
72
+ *
73
+ * @param event - Event data to create
74
+ * @param options - Optional idempotency and request ID options
75
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
76
+ * @returns Created event ID and replay status
77
+ */
78
+ declare function createEvent(event: CreateEventInput, options?: CreateEventOptions, apiKey?: string): Promise<{
79
+ eventId: string;
80
+ replayed: boolean;
81
+ }>;
82
+ /**
83
+ * Server action to create multiple audit events (bulk)
84
+ *
85
+ * @param events - Array of events to create
86
+ * @param options - Optional idempotency and request ID options
87
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
88
+ * @returns Array of created event IDs
89
+ */
90
+ declare function createEvents(events: CreateEventInput[], options?: CreateEventOptions, apiKey?: string): Promise<{
91
+ eventIds: string[];
92
+ }>;
93
+
94
+ interface FrontendTokenResponse {
95
+ token: string;
96
+ expiresAt: number;
97
+ }
98
+ /**
99
+ * Fetches a frontend token from the Archiva API
100
+ *
101
+ * @param projectId - Optional project ID for scoping
102
+ * @param apiBaseUrl - Archiva API base URL (defaults to https://api.archiva.app)
103
+ * @returns Frontend token response
104
+ */
105
+ declare function createFrontendTokenGET(projectId?: string, apiBaseUrl?: string): Promise<FrontendTokenResponse>;
106
+
107
+ /**
108
+ * Next.js route handler for GET /api/archiva/frontend-token
109
+ *
110
+ * This handler can be used in the host app's route file:
111
+ *
112
+ * ```ts
113
+ * // app/api/archiva/frontend-token/route.ts
114
+ * export { GET } from '@archiva/archiva-nextjs/server';
115
+ * ```
116
+ *
117
+ * Or with custom configuration:
118
+ *
119
+ * ```ts
120
+ * import { createFrontendTokenRoute } from '@archiva/archiva-nextjs/server';
121
+ *
122
+ * export const GET = createFrontendTokenRoute({
123
+ * apiBaseUrl: process.env.ARCHIVA_API_URL,
124
+ * });
125
+ * ```
126
+ */
127
+ declare function createFrontendTokenRoute(options?: {
128
+ apiBaseUrl?: string;
129
+ }): (request: NextRequest) => Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
130
+ error: string;
131
+ }>>;
132
+ /**
133
+ * Default GET handler (for direct export)
134
+ */
135
+ declare function GET(request: NextRequest): Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
136
+ error: string;
137
+ }>>;
138
+
139
+ export { ArchivaError as A, type CreateEventInput as C, type EventChange as E, type FrontendTokenResponse as F, GET as G, type LoadEventsParams as L, type PageResult as P, createEvents as a, createFrontendTokenGET as b, createEvent as c, createFrontendTokenRoute as d, type CreateEventOptions as e, type AuditEventListItem as f, loadEvents as l };
@@ -0,0 +1,148 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ type EventChange = {
4
+ op: "set" | "unset" | "add" | "remove" | "replace" | string;
5
+ path: string;
6
+ before?: unknown;
7
+ after?: unknown;
8
+ };
9
+ type CreateEventInput = {
10
+ actionKey?: string;
11
+ actionDescription?: string;
12
+ tenantId?: string;
13
+ action?: string;
14
+ entityType: string;
15
+ entityId: string;
16
+ actorType?: string;
17
+ actorId?: string;
18
+ actorDisplay?: string;
19
+ occurredAt?: string;
20
+ source?: string;
21
+ context?: Record<string, unknown>;
22
+ changes?: EventChange[];
23
+ };
24
+ type CreateEventOptions = {
25
+ idempotencyKey?: string;
26
+ requestId?: string;
27
+ };
28
+ type AuditEventListItem = {
29
+ id: string;
30
+ receivedAt: string;
31
+ actionKey: string;
32
+ actionDescription?: string;
33
+ tenantId?: string;
34
+ action?: string;
35
+ entityType: string;
36
+ entityId: string;
37
+ actorId: string | null;
38
+ actorType?: 'user' | 'service' | 'system';
39
+ actorDisplay: string;
40
+ source: string | null;
41
+ };
42
+ type PageResult<T> = {
43
+ items: T[];
44
+ nextCursor?: string;
45
+ };
46
+ type LoadEventsParams = {
47
+ entityId?: string;
48
+ actorId?: string;
49
+ entityType?: string;
50
+ actorType?: 'user' | 'service' | 'system' | ('user' | 'service' | 'system')[];
51
+ tenantId?: string;
52
+ actionKey?: string;
53
+ q?: string;
54
+ limit?: number;
55
+ cursor?: string;
56
+ };
57
+ declare class ArchivaError extends Error {
58
+ statusCode: number;
59
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
60
+ retryAfterSeconds?: number;
61
+ details?: unknown;
62
+ constructor(params: {
63
+ statusCode: number;
64
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
65
+ message: string;
66
+ retryAfterSeconds?: number;
67
+ details?: unknown;
68
+ });
69
+ }
70
+
71
+ /**
72
+ * Server action to load audit events
73
+ *
74
+ * @param params - Query parameters for filtering events
75
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
76
+ * @returns Paginated list of audit events
77
+ */
78
+ declare function loadEvents(params: LoadEventsParams, apiKey?: string): Promise<PageResult<AuditEventListItem>>;
79
+ /**
80
+ * Server action to create a single audit event
81
+ *
82
+ * @param event - Event data to create
83
+ * @param options - Optional idempotency and request ID options
84
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
85
+ * @returns Created event ID and replay status
86
+ */
87
+ declare function createEvent(event: CreateEventInput, options?: CreateEventOptions, apiKey?: string): Promise<{
88
+ eventId: string;
89
+ replayed: boolean;
90
+ }>;
91
+ /**
92
+ * Server action to create multiple audit events (bulk)
93
+ *
94
+ * @param events - Array of events to create
95
+ * @param options - Optional idempotency and request ID options
96
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
97
+ * @returns Array of created event IDs
98
+ */
99
+ declare function createEvents(events: CreateEventInput[], options?: CreateEventOptions, apiKey?: string): Promise<{
100
+ eventIds: string[];
101
+ }>;
102
+
103
+ interface FrontendTokenResponse {
104
+ token: string;
105
+ expiresAt: number;
106
+ }
107
+ /**
108
+ * Fetches a frontend token from the Archiva API
109
+ *
110
+ * @param projectId - Optional project ID for scoping
111
+ * @param apiBaseUrl - Archiva API base URL (defaults to https://api.archiva.app)
112
+ * @returns Frontend token response
113
+ */
114
+ declare function createFrontendTokenGET(projectId?: string, apiBaseUrl?: string): Promise<FrontendTokenResponse>;
115
+
116
+ /**
117
+ * Next.js route handler for GET /api/archiva/frontend-token
118
+ *
119
+ * This handler can be used in the host app's route file:
120
+ *
121
+ * ```ts
122
+ * // app/api/archiva/frontend-token/route.ts
123
+ * export { GET } from '@archiva/archiva-nextjs/server';
124
+ * ```
125
+ *
126
+ * Or with custom configuration:
127
+ *
128
+ * ```ts
129
+ * import { createFrontendTokenRoute } from '@archiva/archiva-nextjs/server';
130
+ *
131
+ * export const GET = createFrontendTokenRoute({
132
+ * apiBaseUrl: process.env.ARCHIVA_API_URL,
133
+ * });
134
+ * ```
135
+ */
136
+ declare function createFrontendTokenRoute(options?: {
137
+ apiBaseUrl?: string;
138
+ }): (request: NextRequest) => Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
139
+ error: string;
140
+ }>>;
141
+ /**
142
+ * Default GET handler (for direct export)
143
+ */
144
+ declare function GET(request: NextRequest): Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
145
+ error: string;
146
+ }>>;
147
+
148
+ export { ArchivaError as A, type CreateEventInput as C, type EventChange as E, type FrontendTokenResponse as F, GET as G, type LoadEventsParams as L, type PageResult as P, createEvents as a, createFrontendTokenGET as b, createEvent as c, createFrontendTokenRoute as d, type CreateEventOptions as e, type AuditEventListItem as f, loadEvents as l };
@@ -0,0 +1,148 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ type EventChange = {
4
+ op: "set" | "unset" | "add" | "remove" | "replace" | string;
5
+ path: string;
6
+ before?: unknown;
7
+ after?: unknown;
8
+ };
9
+ type CreateEventInput = {
10
+ actionKey?: string;
11
+ actionDescription?: string;
12
+ tenantId?: string;
13
+ action?: string;
14
+ entityType: string;
15
+ entityId: string;
16
+ actorType?: string;
17
+ actorId?: string;
18
+ actorDisplay?: string;
19
+ occurredAt?: string;
20
+ source?: string;
21
+ context?: Record<string, unknown>;
22
+ changes?: EventChange[];
23
+ };
24
+ type CreateEventOptions = {
25
+ idempotencyKey?: string;
26
+ requestId?: string;
27
+ };
28
+ type AuditEventListItem = {
29
+ id: string;
30
+ receivedAt: string;
31
+ actionKey: string;
32
+ actionDescription?: string;
33
+ tenantId?: string;
34
+ action?: string;
35
+ entityType: string;
36
+ entityId: string;
37
+ actorId: string | null;
38
+ actorType?: 'user' | 'service' | 'system';
39
+ actorDisplay: string;
40
+ source: string | null;
41
+ };
42
+ type PageResult<T> = {
43
+ items: T[];
44
+ nextCursor?: string;
45
+ };
46
+ type LoadEventsParams = {
47
+ entityId?: string;
48
+ actorId?: string;
49
+ entityType?: string;
50
+ actorType?: 'user' | 'service' | 'system' | ('user' | 'service' | 'system')[];
51
+ tenantId?: string;
52
+ actionKey?: string;
53
+ q?: string;
54
+ limit?: number;
55
+ cursor?: string;
56
+ };
57
+ declare class ArchivaError extends Error {
58
+ statusCode: number;
59
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
60
+ retryAfterSeconds?: number;
61
+ details?: unknown;
62
+ constructor(params: {
63
+ statusCode: number;
64
+ code: "UNAUTHORIZED" | "FORBIDDEN" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "IDEMPOTENCY_CONFLICT" | "HTTP_ERROR";
65
+ message: string;
66
+ retryAfterSeconds?: number;
67
+ details?: unknown;
68
+ });
69
+ }
70
+
71
+ /**
72
+ * Server action to load audit events
73
+ *
74
+ * @param params - Query parameters for filtering events
75
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
76
+ * @returns Paginated list of audit events
77
+ */
78
+ declare function loadEvents(params: LoadEventsParams, apiKey?: string): Promise<PageResult<AuditEventListItem>>;
79
+ /**
80
+ * Server action to create a single audit event
81
+ *
82
+ * @param event - Event data to create
83
+ * @param options - Optional idempotency and request ID options
84
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
85
+ * @returns Created event ID and replay status
86
+ */
87
+ declare function createEvent(event: CreateEventInput, options?: CreateEventOptions, apiKey?: string): Promise<{
88
+ eventId: string;
89
+ replayed: boolean;
90
+ }>;
91
+ /**
92
+ * Server action to create multiple audit events (bulk)
93
+ *
94
+ * @param events - Array of events to create
95
+ * @param options - Optional idempotency and request ID options
96
+ * @param apiKey - Optional API key (otherwise uses ARCHIVA_SECRET_KEY env var)
97
+ * @returns Array of created event IDs
98
+ */
99
+ declare function createEvents(events: CreateEventInput[], options?: CreateEventOptions, apiKey?: string): Promise<{
100
+ eventIds: string[];
101
+ }>;
102
+
103
+ interface FrontendTokenResponse {
104
+ token: string;
105
+ expiresAt: number;
106
+ }
107
+ /**
108
+ * Fetches a frontend token from the Archiva API
109
+ *
110
+ * @param projectId - Optional project ID for scoping
111
+ * @param apiBaseUrl - Archiva API base URL (defaults to https://api.archiva.app)
112
+ * @returns Frontend token response
113
+ */
114
+ declare function createFrontendTokenGET(projectId?: string, apiBaseUrl?: string): Promise<FrontendTokenResponse>;
115
+
116
+ /**
117
+ * Next.js route handler for GET /api/archiva/frontend-token
118
+ *
119
+ * This handler can be used in the host app's route file:
120
+ *
121
+ * ```ts
122
+ * // app/api/archiva/frontend-token/route.ts
123
+ * export { GET } from '@archiva/archiva-nextjs/server';
124
+ * ```
125
+ *
126
+ * Or with custom configuration:
127
+ *
128
+ * ```ts
129
+ * import { createFrontendTokenRoute } from '@archiva/archiva-nextjs/server';
130
+ *
131
+ * export const GET = createFrontendTokenRoute({
132
+ * apiBaseUrl: process.env.ARCHIVA_API_URL,
133
+ * });
134
+ * ```
135
+ */
136
+ declare function createFrontendTokenRoute(options?: {
137
+ apiBaseUrl?: string;
138
+ }): (request: NextRequest) => Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
139
+ error: string;
140
+ }>>;
141
+ /**
142
+ * Default GET handler (for direct export)
143
+ */
144
+ declare function GET(request: NextRequest): Promise<NextResponse<FrontendTokenResponse> | NextResponse<{
145
+ error: string;
146
+ }>>;
147
+
148
+ export { ArchivaError as A, type CreateEventInput as C, type EventChange as E, type FrontendTokenResponse as F, GET as G, type LoadEventsParams as L, type PageResult as P, createEvents as a, createFrontendTokenGET as b, createEvent as c, createFrontendTokenRoute as d, type CreateEventOptions as e, type AuditEventListItem as f, loadEvents as l };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ArchivaProvider, ArchivaProviderProps } from './react/index.mjs';
2
- export { A as ArchivaError, f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, E as EventChange, 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';
2
+ export { A as ArchivaError, f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, E as EventChange, 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';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import 'next/server';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ArchivaProvider, ArchivaProviderProps } from './react/index.js';
2
- export { A as ArchivaError, f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, E as EventChange, 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';
2
+ export { A as ArchivaError, f as AuditEventListItem, C as CreateEventInput, e as CreateEventOptions, E as EventChange, 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';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import 'next/server';