sealtrail 0.1.2 → 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/README.md +22 -0
- package/dist/index.cjs +13 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,28 @@ console.log(result.valid); // true/false
|
|
|
91
91
|
console.log(result.chainIntact); // hash chain verification
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
### Export
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// Export events as CSV for compliance reporting
|
|
98
|
+
const csv = await st.events.export({
|
|
99
|
+
format: "csv",
|
|
100
|
+
after: "2026-01-01T00:00:00Z",
|
|
101
|
+
before: "2026-04-01T00:00:00Z",
|
|
102
|
+
actor: "user_123", // optional filter
|
|
103
|
+
});
|
|
104
|
+
// csv is a raw string: "id,actor,action,...\nevt_abc,user_123,..."
|
|
105
|
+
|
|
106
|
+
// Export events as JSON with metadata
|
|
107
|
+
const json = await st.events.export({
|
|
108
|
+
format: "json",
|
|
109
|
+
after: "2026-01-01T00:00:00Z",
|
|
110
|
+
before: "2026-04-01T00:00:00Z",
|
|
111
|
+
});
|
|
112
|
+
console.log(json.export.count); // number of events
|
|
113
|
+
console.log(json.data); // AuditEvent[]
|
|
114
|
+
```
|
|
115
|
+
|
|
94
116
|
### Chains
|
|
95
117
|
|
|
96
118
|
```typescript
|
package/dist/index.cjs
CHANGED
|
@@ -120,7 +120,7 @@ function mapError(status, body, retryAfter) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// src/version.ts
|
|
123
|
-
var VERSION = true ? "0.
|
|
123
|
+
var VERSION = true ? "0.3.0" : "0.1.2";
|
|
124
124
|
|
|
125
125
|
// src/lib/fetch.ts
|
|
126
126
|
var DEFAULT_BASE_URL = "https://api.sealtrail.dev";
|
|
@@ -209,6 +209,10 @@ async function request(config, method, path, options) {
|
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
211
|
if (response.ok) {
|
|
212
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
213
|
+
if (contentType.includes("text/")) {
|
|
214
|
+
return await response.text();
|
|
215
|
+
}
|
|
212
216
|
return await response.json();
|
|
213
217
|
}
|
|
214
218
|
let errorBody;
|
|
@@ -361,6 +365,14 @@ var EventsResource = class extends BaseResource {
|
|
|
361
365
|
listAutoPaginate(params) {
|
|
362
366
|
return createAutoPaginator((cursor) => this.list({ ...params, cursor }));
|
|
363
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Export events for compliance reporting (CSV or JSON).
|
|
370
|
+
*/
|
|
371
|
+
async export(params) {
|
|
372
|
+
return this.client._request("GET", "/v1/events/export", {
|
|
373
|
+
query: params
|
|
374
|
+
});
|
|
375
|
+
}
|
|
364
376
|
};
|
|
365
377
|
|
|
366
378
|
// src/client.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -78,6 +78,35 @@ interface Chain {
|
|
|
78
78
|
eventCount: number;
|
|
79
79
|
createdAt: string;
|
|
80
80
|
}
|
|
81
|
+
interface ExportEventsParams {
|
|
82
|
+
/** Export format */
|
|
83
|
+
format: "csv" | "json";
|
|
84
|
+
/** Period start (ISO 8601, required) */
|
|
85
|
+
after: string;
|
|
86
|
+
/** Period end (ISO 8601, required) */
|
|
87
|
+
before: string;
|
|
88
|
+
/** Filter by actor */
|
|
89
|
+
actor?: string;
|
|
90
|
+
/** Filter by action */
|
|
91
|
+
action?: string;
|
|
92
|
+
/** Filter by resource */
|
|
93
|
+
resource?: string;
|
|
94
|
+
/** Filter by chain ID */
|
|
95
|
+
chain_id?: string;
|
|
96
|
+
}
|
|
97
|
+
interface ExportJsonResponse {
|
|
98
|
+
export: {
|
|
99
|
+
format: "json";
|
|
100
|
+
generatedAt: string;
|
|
101
|
+
period: {
|
|
102
|
+
after: string;
|
|
103
|
+
before: string;
|
|
104
|
+
};
|
|
105
|
+
filters: Record<string, string>;
|
|
106
|
+
count: number;
|
|
107
|
+
};
|
|
108
|
+
data: AuditEvent[];
|
|
109
|
+
}
|
|
81
110
|
interface RequestOptions {
|
|
82
111
|
body?: unknown;
|
|
83
112
|
query?: Record<string, string | number | undefined>;
|
|
@@ -130,6 +159,10 @@ declare class EventsResource extends BaseResource {
|
|
|
130
159
|
* ```
|
|
131
160
|
*/
|
|
132
161
|
listAutoPaginate(params?: Omit<ListEventsParams, "cursor">): AsyncIterable<AuditEvent>;
|
|
162
|
+
/**
|
|
163
|
+
* Export events for compliance reporting (CSV or JSON).
|
|
164
|
+
*/
|
|
165
|
+
export(params: ExportEventsParams): Promise<string | ExportJsonResponse>;
|
|
133
166
|
}
|
|
134
167
|
|
|
135
168
|
declare class SealTrail {
|
|
@@ -173,4 +206,4 @@ declare class InternalError extends SealTrailError {
|
|
|
173
206
|
constructor(message: string, code: string, status: number);
|
|
174
207
|
}
|
|
175
208
|
|
|
176
|
-
export { type AuditEvent, AuthenticationError, type Chain, ConflictError, type EventListResponse, ForbiddenError, InternalError, type ListEventsParams, type LogEventParams, NotFoundError, QuotaExceededError, RateLimitError, SealTrail, type SealTrailConfig, SealTrailError, ValidationError, type VerifyResult };
|
|
209
|
+
export { type AuditEvent, AuthenticationError, type Chain, ConflictError, type EventListResponse, type ExportEventsParams, type ExportJsonResponse, ForbiddenError, InternalError, type ListEventsParams, type LogEventParams, NotFoundError, QuotaExceededError, RateLimitError, SealTrail, type SealTrailConfig, SealTrailError, ValidationError, type VerifyResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,35 @@ interface Chain {
|
|
|
78
78
|
eventCount: number;
|
|
79
79
|
createdAt: string;
|
|
80
80
|
}
|
|
81
|
+
interface ExportEventsParams {
|
|
82
|
+
/** Export format */
|
|
83
|
+
format: "csv" | "json";
|
|
84
|
+
/** Period start (ISO 8601, required) */
|
|
85
|
+
after: string;
|
|
86
|
+
/** Period end (ISO 8601, required) */
|
|
87
|
+
before: string;
|
|
88
|
+
/** Filter by actor */
|
|
89
|
+
actor?: string;
|
|
90
|
+
/** Filter by action */
|
|
91
|
+
action?: string;
|
|
92
|
+
/** Filter by resource */
|
|
93
|
+
resource?: string;
|
|
94
|
+
/** Filter by chain ID */
|
|
95
|
+
chain_id?: string;
|
|
96
|
+
}
|
|
97
|
+
interface ExportJsonResponse {
|
|
98
|
+
export: {
|
|
99
|
+
format: "json";
|
|
100
|
+
generatedAt: string;
|
|
101
|
+
period: {
|
|
102
|
+
after: string;
|
|
103
|
+
before: string;
|
|
104
|
+
};
|
|
105
|
+
filters: Record<string, string>;
|
|
106
|
+
count: number;
|
|
107
|
+
};
|
|
108
|
+
data: AuditEvent[];
|
|
109
|
+
}
|
|
81
110
|
interface RequestOptions {
|
|
82
111
|
body?: unknown;
|
|
83
112
|
query?: Record<string, string | number | undefined>;
|
|
@@ -130,6 +159,10 @@ declare class EventsResource extends BaseResource {
|
|
|
130
159
|
* ```
|
|
131
160
|
*/
|
|
132
161
|
listAutoPaginate(params?: Omit<ListEventsParams, "cursor">): AsyncIterable<AuditEvent>;
|
|
162
|
+
/**
|
|
163
|
+
* Export events for compliance reporting (CSV or JSON).
|
|
164
|
+
*/
|
|
165
|
+
export(params: ExportEventsParams): Promise<string | ExportJsonResponse>;
|
|
133
166
|
}
|
|
134
167
|
|
|
135
168
|
declare class SealTrail {
|
|
@@ -173,4 +206,4 @@ declare class InternalError extends SealTrailError {
|
|
|
173
206
|
constructor(message: string, code: string, status: number);
|
|
174
207
|
}
|
|
175
208
|
|
|
176
|
-
export { type AuditEvent, AuthenticationError, type Chain, ConflictError, type EventListResponse, ForbiddenError, InternalError, type ListEventsParams, type LogEventParams, NotFoundError, QuotaExceededError, RateLimitError, SealTrail, type SealTrailConfig, SealTrailError, ValidationError, type VerifyResult };
|
|
209
|
+
export { type AuditEvent, AuthenticationError, type Chain, ConflictError, type EventListResponse, type ExportEventsParams, type ExportJsonResponse, ForbiddenError, InternalError, type ListEventsParams, type LogEventParams, NotFoundError, QuotaExceededError, RateLimitError, SealTrail, type SealTrailConfig, SealTrailError, ValidationError, type VerifyResult };
|
package/dist/index.mjs
CHANGED
|
@@ -85,7 +85,7 @@ function mapError(status, body, retryAfter) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// src/version.ts
|
|
88
|
-
var VERSION = true ? "0.
|
|
88
|
+
var VERSION = true ? "0.3.0" : "0.1.2";
|
|
89
89
|
|
|
90
90
|
// src/lib/fetch.ts
|
|
91
91
|
var DEFAULT_BASE_URL = "https://api.sealtrail.dev";
|
|
@@ -174,6 +174,10 @@ async function request(config, method, path, options) {
|
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
if (response.ok) {
|
|
177
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
178
|
+
if (contentType.includes("text/")) {
|
|
179
|
+
return await response.text();
|
|
180
|
+
}
|
|
177
181
|
return await response.json();
|
|
178
182
|
}
|
|
179
183
|
let errorBody;
|
|
@@ -326,6 +330,14 @@ var EventsResource = class extends BaseResource {
|
|
|
326
330
|
listAutoPaginate(params) {
|
|
327
331
|
return createAutoPaginator((cursor) => this.list({ ...params, cursor }));
|
|
328
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Export events for compliance reporting (CSV or JSON).
|
|
335
|
+
*/
|
|
336
|
+
async export(params) {
|
|
337
|
+
return this.client._request("GET", "/v1/events/export", {
|
|
338
|
+
query: params
|
|
339
|
+
});
|
|
340
|
+
}
|
|
329
341
|
};
|
|
330
342
|
|
|
331
343
|
// src/client.ts
|