@rustrak/client 0.3.8 → 0.3.10

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.cjs CHANGED
@@ -543,6 +543,18 @@ var updateIssueStateSchema = zod.z.object({
543
543
  is_resolved: zod.z.boolean().optional(),
544
544
  is_muted: zod.z.boolean().optional()
545
545
  });
546
+ var logSchema = zod.z.object({
547
+ id: uuidSchema,
548
+ trace_id: zod.z.string().nullable(),
549
+ span_id: zod.z.string().nullable(),
550
+ level: zod.z.string(),
551
+ /** OTel severity number (1=trace … 21=fatal). Null for unknown levels. */
552
+ severity_number: zod.z.number().int().nullable(),
553
+ body: zod.z.string(),
554
+ attributes: zod.z.record(zod.z.string(), zod.z.any()),
555
+ timestamp: dateTimeSchema,
556
+ ingested_at: dateTimeSchema
557
+ });
546
558
  var projectRoleSchema = zod.z.enum(["viewer", "editor", "admin"]);
547
559
  var projectMemberSchema = zod.z.object({
548
560
  user_id: zod.z.number().int(),
@@ -619,6 +631,7 @@ var storageSummarySchema = zod.z.object({
619
631
  events_count: zod.z.number(),
620
632
  transactions_count: zod.z.number(),
621
633
  spans_count: zod.z.number(),
634
+ logs_count: zod.z.number(),
622
635
  source_maps: sourceMapStorageSchema
623
636
  });
624
637
  var projectStorageSchema = zod.z.object({
@@ -627,6 +640,7 @@ var projectStorageSchema = zod.z.object({
627
640
  events_count: zod.z.number(),
628
641
  transactions_count: zod.z.number(),
629
642
  spans_count: zod.z.number(),
643
+ logs_count: zod.z.number(),
630
644
  source_maps_count: zod.z.number(),
631
645
  estimated_bytes: zod.z.number()
632
646
  });
@@ -634,6 +648,7 @@ var cleanupCountsSchema = zod.z.object({
634
648
  events: zod.z.number(),
635
649
  transactions: zod.z.number(),
636
650
  spans: zod.z.number(),
651
+ logs: zod.z.number(),
637
652
  issues_removed: zod.z.number()
638
653
  });
639
654
  var sourceMapGcResultSchema = zod.z.object({
@@ -642,7 +657,10 @@ var sourceMapGcResultSchema = zod.z.object({
642
657
  });
643
658
  var cleanupOptionsSchema = zod.z.object({
644
659
  older_than_days: zod.z.number().int().min(1),
645
- project_id: zod.z.number().int().optional()
660
+ project_id: zod.z.number().int().optional(),
661
+ include_events: zod.z.boolean().optional(),
662
+ include_transactions: zod.z.boolean().optional(),
663
+ include_logs: zod.z.boolean().optional()
646
664
  });
647
665
  var authTokenSchema = zod.z.object({
648
666
  id: zod.z.number().int(),
@@ -826,6 +844,31 @@ var IssuesResource = class extends BaseResource {
826
844
  }
827
845
  };
828
846
 
847
+ // src/resources/logs.ts
848
+ var LogsResource = class extends BaseResource {
849
+ /**
850
+ * List logs for a project with offset-based pagination (newest first by log
851
+ * timestamp), optionally filtered by level/trace_id.
852
+ */
853
+ async list(projectId, options) {
854
+ const searchParams = {};
855
+ if (options?.page) {
856
+ searchParams.page = String(options.page);
857
+ }
858
+ if (options?.per_page) {
859
+ searchParams.per_page = String(options.per_page);
860
+ }
861
+ if (options?.level) {
862
+ searchParams.level = options.level;
863
+ }
864
+ if (options?.trace_id) {
865
+ searchParams.trace_id = options.trace_id;
866
+ }
867
+ const data = await this.http.get(`api/projects/${projectId}/logs`, { searchParams }).json();
868
+ return this.validate(data, offsetPaginatedResponseSchema(logSchema));
869
+ }
870
+ };
871
+
829
872
  // src/resources/members.ts
830
873
  var MembersResource = class extends BaseResource {
831
874
  /**
@@ -1297,6 +1340,10 @@ var RustrakClient = class {
1297
1340
  * Transactions API resource (performance monitoring)
1298
1341
  */
1299
1342
  transactions;
1343
+ /**
1344
+ * Logs API resource (standalone logs)
1345
+ */
1346
+ logs;
1300
1347
  /**
1301
1348
  * Storage API resource (usage + retention cleanup, admin only)
1302
1349
  */
@@ -1325,6 +1372,7 @@ var RustrakClient = class {
1325
1372
  this.members = new MembersResource(this.http);
1326
1373
  this.sessions = new SessionsResource(this.http);
1327
1374
  this.transactions = new TransactionsResource(this.http);
1375
+ this.logs = new LogsResource(this.http);
1328
1376
  this.storage = new StorageResource(this.http);
1329
1377
  this.health = new HealthResource(this.http);
1330
1378
  }