@rustrak/client 0.3.7 → 0.3.9

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({
@@ -826,6 +841,31 @@ var IssuesResource = class extends BaseResource {
826
841
  }
827
842
  };
828
843
 
844
+ // src/resources/logs.ts
845
+ var LogsResource = class extends BaseResource {
846
+ /**
847
+ * List logs for a project with offset-based pagination (newest first by log
848
+ * timestamp), optionally filtered by level/trace_id.
849
+ */
850
+ async list(projectId, options) {
851
+ const searchParams = {};
852
+ if (options?.page) {
853
+ searchParams.page = String(options.page);
854
+ }
855
+ if (options?.per_page) {
856
+ searchParams.per_page = String(options.per_page);
857
+ }
858
+ if (options?.level) {
859
+ searchParams.level = options.level;
860
+ }
861
+ if (options?.trace_id) {
862
+ searchParams.trace_id = options.trace_id;
863
+ }
864
+ const data = await this.http.get(`api/projects/${projectId}/logs`, { searchParams }).json();
865
+ return this.validate(data, offsetPaginatedResponseSchema(logSchema));
866
+ }
867
+ };
868
+
829
869
  // src/resources/members.ts
830
870
  var MembersResource = class extends BaseResource {
831
871
  /**
@@ -1068,11 +1108,14 @@ var TokensResource = class extends BaseResource {
1068
1108
  return this.validate(data, authTokenSchema.array());
1069
1109
  }
1070
1110
  /**
1071
- * Get a single auth token by ID (masked)
1111
+ * Get a single auth token by ID (full token value).
1112
+ *
1113
+ * Previously returned a masked version, but the server now returns the
1114
+ * complete token for GET /api/tokens/{id}.
1072
1115
  */
1073
1116
  async get(id) {
1074
1117
  const data = await this.http.get(`api/tokens/${id}`).json();
1075
- return this.validate(data, authTokenSchema);
1118
+ return this.validate(data, authTokenCreatedSchema);
1076
1119
  }
1077
1120
  /**
1078
1121
  * Create a new auth token
@@ -1294,6 +1337,10 @@ var RustrakClient = class {
1294
1337
  * Transactions API resource (performance monitoring)
1295
1338
  */
1296
1339
  transactions;
1340
+ /**
1341
+ * Logs API resource (standalone logs)
1342
+ */
1343
+ logs;
1297
1344
  /**
1298
1345
  * Storage API resource (usage + retention cleanup, admin only)
1299
1346
  */
@@ -1322,6 +1369,7 @@ var RustrakClient = class {
1322
1369
  this.members = new MembersResource(this.http);
1323
1370
  this.sessions = new SessionsResource(this.http);
1324
1371
  this.transactions = new TransactionsResource(this.http);
1372
+ this.logs = new LogsResource(this.http);
1325
1373
  this.storage = new StorageResource(this.http);
1326
1374
  this.health = new HealthResource(this.http);
1327
1375
  }