@burdenoff/be-sdk 2026.1107.4 → 2026.1107.5

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.
Files changed (66) hide show
  1. package/dist/EventQueueFactory-T7T6GRWZ.js +8 -0
  2. package/dist/{EventQueueFactory-PP534MBQ.js.map → EventQueueFactory-T7T6GRWZ.js.map} +1 -1
  3. package/dist/auth/index.d.ts +2 -2
  4. package/dist/auth/index.js +2 -2
  5. package/dist/{chunk-YZIWBUIN.js → chunk-4XIBXZ6J.js} +3 -3
  6. package/dist/{chunk-YZIWBUIN.js.map → chunk-4XIBXZ6J.js.map} +1 -1
  7. package/dist/{chunk-Y4N7N2G4.js → chunk-A6DE32ZS.js} +3 -3
  8. package/dist/{chunk-Y4N7N2G4.js.map → chunk-A6DE32ZS.js.map} +1 -1
  9. package/dist/{chunk-OBZQ4AJC.js → chunk-FG37SJML.js} +3 -3
  10. package/dist/{chunk-OBZQ4AJC.js.map → chunk-FG37SJML.js.map} +1 -1
  11. package/dist/{chunk-7EISSMFP.js → chunk-FVWXQ26J.js} +3 -3
  12. package/dist/{chunk-7EISSMFP.js.map → chunk-FVWXQ26J.js.map} +1 -1
  13. package/dist/{chunk-5SIL5AG2.js → chunk-I3KOWRT3.js} +3 -3
  14. package/dist/chunk-I3KOWRT3.js.map +1 -0
  15. package/dist/{chunk-LQYHWC7F.js → chunk-IA6AUVAG.js} +5 -5
  16. package/dist/{chunk-LQYHWC7F.js.map → chunk-IA6AUVAG.js.map} +1 -1
  17. package/dist/{chunk-DXTBH7IW.js → chunk-ID3WR4JS.js} +3 -3
  18. package/dist/{chunk-DXTBH7IW.js.map → chunk-ID3WR4JS.js.map} +1 -1
  19. package/dist/{chunk-5CS3ZITV.js → chunk-KH4TRQCO.js} +3 -3
  20. package/dist/{chunk-5CS3ZITV.js.map → chunk-KH4TRQCO.js.map} +1 -1
  21. package/dist/{chunk-5EVD6HOD.js → chunk-LRFUXS73.js} +248 -315
  22. package/dist/chunk-LRFUXS73.js.map +1 -0
  23. package/dist/{chunk-E6OAFS7A.js → chunk-MIK45HQD.js} +4 -4
  24. package/dist/{chunk-E6OAFS7A.js.map → chunk-MIK45HQD.js.map} +1 -1
  25. package/dist/{chunk-DJNHR37J.js → chunk-OQGA4RU6.js} +3 -3
  26. package/dist/{chunk-DJNHR37J.js.map → chunk-OQGA4RU6.js.map} +1 -1
  27. package/dist/{chunk-DIOS6L7M.js → chunk-QFS5VXM2.js} +4 -4
  28. package/dist/{chunk-DIOS6L7M.js.map → chunk-QFS5VXM2.js.map} +1 -1
  29. package/dist/{chunk-BD3SMWUU.js → chunk-TRYGWO7H.js} +3 -3
  30. package/dist/{chunk-BD3SMWUU.js.map → chunk-TRYGWO7H.js.map} +1 -1
  31. package/dist/{chunk-K56L7NUR.js → chunk-XGNOYVSW.js} +3 -3
  32. package/dist/{chunk-K56L7NUR.js.map → chunk-XGNOYVSW.js.map} +1 -1
  33. package/dist/database/index.js +2 -2
  34. package/dist/event-queue/index.d.ts +3 -3
  35. package/dist/event-queue/index.js +4 -4
  36. package/dist/graph/index.d.ts +3 -3
  37. package/dist/graph/index.js +7 -7
  38. package/dist/{graphql-CEblo7lw.d.ts → graphql-CMHMQjvd.d.ts} +1 -1
  39. package/dist/{index-XzbbMKe4.d.ts → index-B8KrxO4j.d.ts} +2 -2
  40. package/dist/{index-BV8hveh_.d.ts → index-C1IPam0T.d.ts} +33 -15
  41. package/dist/{index-BioY0Ewz.d.ts → index-CmpG-zak.d.ts} +1 -1
  42. package/dist/{index-DHQKCVDQ.d.ts → index-DCaVm66D.d.ts} +2 -2
  43. package/dist/{index-7pTpoN3Q.d.ts → index-DE2w7E0d.d.ts} +6 -1
  44. package/dist/{index-BHe7zIVb.d.ts → index-DwMJZ8PP.d.ts} +2 -2
  45. package/dist/{index-KZ4OzW6D.d.ts → index-pxYge_6k.d.ts} +1 -1
  46. package/dist/index.d.ts +14 -13
  47. package/dist/index.js +35 -32
  48. package/dist/index.js.map +1 -1
  49. package/dist/init/index.js +1 -1
  50. package/dist/instrumentation/index.d.ts +3 -3
  51. package/dist/logger/index.d.ts +2 -2
  52. package/dist/notifications/index.d.ts +3 -3
  53. package/dist/notifications/index.js +2 -2
  54. package/dist/prisma/index.js +5 -5
  55. package/dist/rbac/index.d.ts +2 -2
  56. package/dist/rbac/index.js +2 -2
  57. package/dist/resource-caps/index.d.ts +2 -2
  58. package/dist/telemetry/index.d.ts +4 -4
  59. package/dist/tracker/index.d.ts +4 -4
  60. package/dist/tracker/index.js +5 -5
  61. package/dist/usage/index.d.ts +2 -2
  62. package/dist/usage/index.js +2 -2
  63. package/package.json +1 -1
  64. package/dist/EventQueueFactory-PP534MBQ.js +0 -8
  65. package/dist/chunk-5EVD6HOD.js.map +0 -1
  66. package/dist/chunk-5SIL5AG2.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { markExplicitActivity, runInExplicitActivityScope, createExplicitActivityScope, trackOperation } from './chunk-JVMAQOA3.js';
2
- import { UsageModule } from './chunk-BD3SMWUU.js';
3
- import { NotificationsModule, NotificationType2 } from './chunk-5CS3ZITV.js';
4
- import { RBACModule } from './chunk-Y4N7N2G4.js';
5
- import { ValidationError, PermissionDeniedError, QuotaExceededError } from './chunk-5SIL5AG2.js';
2
+ import { UsageModule } from './chunk-TRYGWO7H.js';
3
+ import { NotificationsModule, NotificationType2 } from './chunk-KH4TRQCO.js';
4
+ import { RBACModule } from './chunk-A6DE32ZS.js';
5
+ import { SDKError, ValidationError, PermissionDeniedError, QuotaExceededError } from './chunk-I3KOWRT3.js';
6
6
  import { logger } from './chunk-RU266375.js';
7
7
  import { __name } from './chunk-XE4OXN2W.js';
8
+ import { randomUUID } from 'crypto';
8
9
 
9
- // src/activity/index.ts
10
10
  var ActivityType = /* @__PURE__ */ (function(ActivityType2) {
11
11
  ActivityType2["CREATE"] = "create";
12
12
  ActivityType2["READ"] = "read";
@@ -39,6 +39,194 @@ var ActivitySeverity = /* @__PURE__ */ (function(ActivitySeverity2) {
39
39
  ActivitySeverity2["CRITICAL"] = "critical";
40
40
  return ActivitySeverity2;
41
41
  })({});
42
+ var ActivityOperationUnsupportedError = class _ActivityOperationUnsupportedError extends SDKError {
43
+ static {
44
+ __name(this, "ActivityOperationUnsupportedError");
45
+ }
46
+ constructor(operation, guidance) {
47
+ super(`ActivityModule.${operation} is not supported by the workspace activity owner: ${guidance}`, "ACTIVITY_OPERATION_UNSUPPORTED", {
48
+ operation
49
+ });
50
+ this.name = "ActivityOperationUnsupportedError";
51
+ Object.setPrototypeOf(this, _ActivityOperationUnsupportedError.prototype);
52
+ }
53
+ };
54
+ var ACTIVITY_LOG_SELECTION = `
55
+ id
56
+ userId
57
+ action
58
+ description
59
+ details
60
+ timestamp
61
+ productId
62
+ workspaceId
63
+ resourceType
64
+ resourceId
65
+ targetUserId
66
+ ipAddress
67
+ userAgent
68
+ actorType
69
+ onBehalfOf
70
+ context {
71
+ projectId
72
+ custom
73
+ }
74
+ `;
75
+ var RECORD_ACTIVITY_MUTATION = `
76
+ mutation RecordActivity($input: RecordActivityInput!) {
77
+ recordActivity(input: $input) {
78
+ ${ACTIVITY_LOG_SELECTION}
79
+ }
80
+ }
81
+ `;
82
+ var WORKSPACE_ACTIVITY_SLICE_QUERY = `
83
+ query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {
84
+ getWorkspaceActivitySlice(filter: $filter) {
85
+ ${ACTIVITY_LOG_SELECTION}
86
+ }
87
+ activityCount(filter: $filter)
88
+ }
89
+ `;
90
+ var SDK_DETAIL_KEYS = [
91
+ "activityType",
92
+ "status",
93
+ "severity",
94
+ "duration",
95
+ "organizationId",
96
+ "projectId",
97
+ "requestIpAddress",
98
+ "requestUserAgent",
99
+ "errorMessage",
100
+ "ipAddress",
101
+ "userAgent"
102
+ ];
103
+ function readRecord(value) {
104
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
105
+ }
106
+ __name(readRecord, "readRecord");
107
+ function readString(value) {
108
+ return typeof value === "string" && value.length > 0 ? value : void 0;
109
+ }
110
+ __name(readString, "readString");
111
+ function readEnum(values, value, fallback) {
112
+ const allowed = Object.values(values);
113
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
114
+ }
115
+ __name(readEnum, "readEnum");
116
+ function compact(input) {
117
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
118
+ }
119
+ __name(compact, "compact");
120
+ function buildRecordActivityInput(options, context = {}) {
121
+ const severity = options.severity ?? "low";
122
+ const metadata = compact({
123
+ ...options.metadata,
124
+ activityType: options.activityType,
125
+ status: options.status,
126
+ severity,
127
+ duration: options.duration,
128
+ // The owner stores errorMessage in a column it does not expose on ActivityLog; keeping a
129
+ // copy in details is what lets a read return it.
130
+ errorMessage: options.errorMessage,
131
+ organizationId: options.organizationId,
132
+ projectId: options.projectId,
133
+ requestIpAddress: options.ipAddress,
134
+ requestUserAgent: options.userAgent
135
+ });
136
+ const activityContext = compact({
137
+ workspaceId: options.workspaceId,
138
+ userId: options.userId,
139
+ projectId: options.projectId,
140
+ custom: options.organizationId ? {
141
+ organizationId: options.organizationId
142
+ } : void 0
143
+ });
144
+ return compact({
145
+ action: options.action,
146
+ description: options.description,
147
+ resourceType: options.resourceType,
148
+ resourceId: options.resourceId,
149
+ workspaceId: options.workspaceId,
150
+ productId: options.productId ?? context.productId,
151
+ targetUserId: options.targetUserId,
152
+ teamId: options.teamId,
153
+ success: options.status !== "failure",
154
+ errorMessage: options.errorMessage,
155
+ actorType: options.actorType,
156
+ onBehalfOf: options.onBehalfOf,
157
+ context: activityContext,
158
+ metadata,
159
+ dedupeKey: options.dedupeKey ?? `sdk-activity:${randomUUID()}`
160
+ });
161
+ }
162
+ __name(buildRecordActivityInput, "buildRecordActivityInput");
163
+ function toActivity(record) {
164
+ const details = readRecord(record.details) ?? {};
165
+ const custom = readRecord(record.context?.custom);
166
+ const metadata = {};
167
+ for (const [key, value] of Object.entries(details)) {
168
+ if (!SDK_DETAIL_KEYS.includes(key)) metadata[key] = value;
169
+ }
170
+ const duration = details["duration"];
171
+ return {
172
+ id: record.id,
173
+ userId: record.userId,
174
+ activityType: readEnum(ActivityType, details["activityType"], "custom"),
175
+ resourceType: record.resourceType ?? "",
176
+ resourceId: record.resourceId ?? void 0,
177
+ action: record.action,
178
+ status: readEnum(ActivityStatus, details["status"], "success"),
179
+ workspaceId: record.workspaceId ?? void 0,
180
+ organizationId: readString(details["organizationId"]) ?? readString(custom?.["organizationId"]),
181
+ projectId: record.context?.projectId ?? readString(details["projectId"]),
182
+ productId: record.productId ?? void 0,
183
+ description: record.description ?? void 0,
184
+ targetUserId: record.targetUserId ?? void 0,
185
+ actorType: record.actorType ?? void 0,
186
+ onBehalfOf: record.onBehalfOf ?? void 0,
187
+ ipAddress: readString(details["requestIpAddress"]) ?? record.ipAddress ?? void 0,
188
+ userAgent: readString(details["requestUserAgent"]) ?? record.userAgent ?? void 0,
189
+ metadata,
190
+ severity: readEnum(ActivitySeverity, details["severity"], "low"),
191
+ errorMessage: readString(details["errorMessage"]),
192
+ duration: typeof duration === "number" && Number.isFinite(duration) ? duration : void 0,
193
+ createdAt: record.timestamp
194
+ };
195
+ }
196
+ __name(toActivity, "toActivity");
197
+ function buildActivityLogFilter(options) {
198
+ if (!options.workspaceId) {
199
+ throw new ValidationError("workspaceId is required to read activities");
200
+ }
201
+ const unsupported = [
202
+ "organizationId",
203
+ "projectId",
204
+ "activityType",
205
+ "status",
206
+ "severity",
207
+ "search"
208
+ ].filter((key) => options[key] !== void 0);
209
+ if (options.sortBy !== void 0 && options.sortBy !== "createdAt") unsupported.push("sortBy");
210
+ if (options.sortOrder !== void 0 && options.sortOrder !== "desc") unsupported.push("sortOrder");
211
+ if (unsupported.length > 0) {
212
+ throw new ValidationError(`Activity filters not supported by the workspace activity owner: ${unsupported.join(", ")}`, {
213
+ unsupported
214
+ });
215
+ }
216
+ return compact({
217
+ workspaceId: options.workspaceId,
218
+ userId: options.userId,
219
+ action: options.action,
220
+ resourceType: options.resourceType,
221
+ resourceId: options.resourceId,
222
+ targetUserId: options.targetUserId,
223
+ startDate: options.startDate,
224
+ endDate: options.endDate,
225
+ limit: options.limit ?? 50,
226
+ offset: options.offset ?? 0
227
+ });
228
+ }
229
+ __name(buildActivityLogFilter, "buildActivityLogFilter");
42
230
  var ActivityModule = class {
43
231
  static {
44
232
  __name(this, "ActivityModule");
@@ -51,6 +239,10 @@ var ActivityModule = class {
51
239
  }
52
240
  /**
53
241
  * Log activity
242
+ *
243
+ * The write is relayed as a platform service acting for `userId`, the same identity
244
+ * transport `trackOperation` uses, so the owner records the end user as the actor and
245
+ * honours `actorType`/`onBehalfOf` from the input.
54
246
  */
55
247
  async log(options) {
56
248
  if (!options.userId) {
@@ -74,92 +266,21 @@ var ActivityModule = class {
74
266
  action: options.action,
75
267
  resourceType: options.resourceType
76
268
  });
77
- const recordActivityMutation = `
78
- mutation RecordActivity($input: RecordActivityInput!) {
79
- recordActivity(input: $input) {
80
- id
81
- userId
82
- activityType
83
- resourceType
84
- resourceId
85
- action
86
- status
87
- workspaceId
88
- organizationId
89
- projectId
90
- ipAddress
91
- userAgent
92
- metadata
93
- severity
94
- errorMessage
95
- duration
96
- createdAt
97
- }
98
- }
99
- `;
100
- const legacyLogActivityMutation = `
101
- mutation LogActivity($input: LogActivityInput!) {
102
- logActivity(input: $input) {
103
- id
104
- userId
105
- activityType
106
- resourceType
107
- resourceId
108
- action
109
- status
110
- workspaceId
111
- organizationId
112
- projectId
113
- ipAddress
114
- userAgent
115
- metadata
116
- severity
117
- errorMessage
118
- duration
119
- createdAt
120
- }
121
- }
122
- `;
123
- const variables = {
124
- input: {
125
- userId: options.userId,
126
- activityType: options.activityType,
127
- resourceType: options.resourceType,
128
- resourceId: options.resourceId,
129
- action: options.action,
130
- status: options.status,
131
- workspaceId: options.workspaceId,
132
- organizationId: options.organizationId,
133
- projectId: options.projectId,
134
- ipAddress: options.ipAddress,
135
- userAgent: options.userAgent,
136
- metadata: options.metadata,
137
- severity: options.severity || "low",
138
- errorMessage: options.errorMessage,
139
- duration: options.duration
140
- }
269
+ const input = buildRecordActivityInput(options, this.context);
270
+ const requestContext = {
271
+ ...this.context,
272
+ actorId: options.userId,
273
+ actorType: "service",
274
+ workspaceId: options.workspaceId ?? this.context.workspaceId
141
275
  };
142
- try {
143
- const response = await this.client.query(recordActivityMutation, variables, this.context);
144
- logger.info("[Activity] Activity logged", {
145
- activityId: response.recordActivity.id
146
- });
147
- return response.recordActivity;
148
- } catch (error) {
149
- const message = error instanceof Error ? error.message : String(error);
150
- const isRecordActivityUnavailable = message.includes('Cannot query field "recordActivity"') || message.includes('Unknown type "RecordActivityInput"');
151
- if (!isRecordActivityUnavailable) {
152
- throw error;
153
- }
154
- logger.warn("[Activity] Falling back to legacy logActivity mutation", {
155
- reason: message
156
- });
157
- const legacyResponse = await this.client.query(legacyLogActivityMutation, variables, this.context);
158
- logger.info("[Activity] Activity logged (legacy)", {
159
- activityId: legacyResponse.logActivity.id
160
- });
161
- return legacyResponse.logActivity;
162
- }
276
+ const response = await this.client.query(RECORD_ACTIVITY_MUTATION, {
277
+ input
278
+ }, requestContext);
279
+ const activity = toActivity(response.recordActivity);
280
+ logger.info("[Activity] Activity logged", {
281
+ activityId: activity.id
282
+ });
283
+ return activity;
163
284
  }
164
285
  /**
165
286
  * Log activity with automatic status detection
@@ -195,207 +316,53 @@ var ActivityModule = class {
195
316
  });
196
317
  }
197
318
  /**
198
- * Get activities with filters
319
+ * Get one workspace's activities, newest first.
320
+ *
321
+ * Reads the owner's workspace-scoped slice (`getWorkspaceActivitySlice`) together with the
322
+ * matching `activityCount`, so `total` counts every row the filter matches, not just the page.
199
323
  */
200
324
  async getActivities(options) {
201
325
  logger.debug("[Activity] Getting activities", options);
202
- const query = `
203
- query GetActivities(
204
- $userId: ID
205
- $workspaceId: ID
206
- $organizationId: ID
207
- $projectId: ID
208
- $activityType: ActivityType
209
- $resourceType: String
210
- $resourceId: ID
211
- $status: ActivityStatus
212
- $severity: ActivitySeverity
213
- $startDate: DateTime
214
- $endDate: DateTime
215
- $search: String
216
- $limit: Int
217
- $offset: Int
218
- $sortBy: String
219
- $sortOrder: String
220
- ) {
221
- getActivities(
222
- userId: $userId
223
- workspaceId: $workspaceId
224
- organizationId: $organizationId
225
- projectId: $projectId
226
- activityType: $activityType
227
- resourceType: $resourceType
228
- resourceId: $resourceId
229
- status: $status
230
- severity: $severity
231
- startDate: $startDate
232
- endDate: $endDate
233
- search: $search
234
- limit: $limit
235
- offset: $offset
236
- sortBy: $sortBy
237
- sortOrder: $sortOrder
238
- ) {
239
- activities {
240
- id
241
- userId
242
- activityType
243
- resourceType
244
- resourceId
245
- action
246
- status
247
- workspaceId
248
- organizationId
249
- projectId
250
- ipAddress
251
- userAgent
252
- metadata
253
- severity
254
- errorMessage
255
- duration
256
- createdAt
257
- }
258
- total
259
- }
260
- }
261
- `;
262
- const variables = {
263
- userId: options.userId,
264
- workspaceId: options.workspaceId,
265
- organizationId: options.organizationId,
266
- projectId: options.projectId,
267
- activityType: options.activityType,
268
- resourceType: options.resourceType,
269
- resourceId: options.resourceId,
270
- status: options.status,
271
- severity: options.severity,
272
- startDate: options.startDate,
273
- endDate: options.endDate,
274
- search: options.search,
275
- limit: options.limit || 50,
276
- offset: options.offset || 0,
277
- sortBy: options.sortBy || "createdAt",
278
- sortOrder: options.sortOrder || "desc"
326
+ const filter = buildActivityLogFilter(options);
327
+ const requestContext = {
328
+ ...this.context,
329
+ workspaceId: options.workspaceId
330
+ };
331
+ const response = await this.client.query(WORKSPACE_ACTIVITY_SLICE_QUERY, {
332
+ filter
333
+ }, requestContext);
334
+ return {
335
+ activities: response.getWorkspaceActivitySlice.map(toActivity),
336
+ total: response.activityCount
279
337
  };
280
- const response = await this.client.query(query, variables, this.context);
281
- return response.getActivities;
282
338
  }
283
339
  /**
284
- * Get activity by ID
340
+ * @deprecated The workspace activity owner has no read-by-id operation. Use
341
+ * {@link getActivities} with `resourceId`/`action` filters instead.
285
342
  */
286
- async getActivity(activityId) {
287
- logger.debug("[Activity] Getting activity", {
288
- activityId
289
- });
290
- const query = `
291
- query GetActivity($activityId: ID!) {
292
- getActivity(activityId: $activityId) {
293
- id
294
- userId
295
- activityType
296
- resourceType
297
- resourceId
298
- action
299
- status
300
- workspaceId
301
- organizationId
302
- projectId
303
- ipAddress
304
- userAgent
305
- metadata
306
- severity
307
- errorMessage
308
- duration
309
- createdAt
310
- }
311
- }
312
- `;
313
- const response = await this.client.query(query, {
314
- activityId
315
- }, this.context);
316
- return response.getActivity;
343
+ async getActivity(_activityId) {
344
+ throw new ActivityOperationUnsupportedError("getActivity", "use getActivities with a workspace filter");
317
345
  }
318
346
  /**
319
- * Get activity statistics
347
+ * @deprecated The workspace activity owner has no statistics operation. Use
348
+ * {@link getActivities} (its `total` is the owner's `activityCount`) per filter instead.
320
349
  */
321
- async getStats(options) {
322
- logger.debug("[Activity] Getting activity stats", options);
323
- const query = `
324
- query GetActivityStats(
325
- $userId: ID
326
- $workspaceId: ID
327
- $organizationId: ID
328
- $projectId: ID
329
- $activityType: ActivityType
330
- $resourceType: String
331
- $startDate: DateTime
332
- $endDate: DateTime
333
- ) {
334
- getActivityStats(
335
- userId: $userId
336
- workspaceId: $workspaceId
337
- organizationId: $organizationId
338
- projectId: $projectId
339
- activityType: $activityType
340
- resourceType: $resourceType
341
- startDate: $startDate
342
- endDate: $endDate
343
- ) {
344
- totalActivities
345
- successCount
346
- failureCount
347
- pendingCount
348
- warningCount
349
- averageDuration
350
- activitiesByType
351
- activitiesBySeverity
352
- topUsers {
353
- userId
354
- count
355
- }
356
- topResources {
357
- resourceType
358
- count
359
- }
360
- }
361
- }
362
- `;
363
- const variables = {
364
- userId: options.userId,
365
- workspaceId: options.workspaceId,
366
- organizationId: options.organizationId,
367
- projectId: options.projectId,
368
- activityType: options.activityType,
369
- resourceType: options.resourceType,
370
- startDate: options.startDate,
371
- endDate: options.endDate
372
- };
373
- const response = await this.client.query(query, variables, this.context);
374
- return response.getActivityStats;
350
+ async getStats(_options) {
351
+ throw new ActivityOperationUnsupportedError("getStats", "use getActivities and its total per filter");
375
352
  }
376
353
  /**
377
- * Delete old activities (cleanup)
354
+ * @deprecated Retention is enforced by the activity owner's retention policy and legal holds;
355
+ * there is no client-driven cleanup operation.
378
356
  */
379
- async cleanup(olderThanDays, workspaceId) {
380
- logger.debug("[Activity] Cleaning up old activities", {
381
- olderThanDays,
382
- workspaceId
383
- });
384
- const mutation = `
385
- mutation CleanupActivities($olderThanDays: Int!, $workspaceId: ID) {
386
- cleanupActivities(olderThanDays: $olderThanDays, workspaceId: $workspaceId) {
387
- deletedCount
388
- }
389
- }
390
- `;
391
- const response = await this.client.query(mutation, {
392
- olderThanDays,
393
- workspaceId
394
- }, this.context);
395
- logger.info("[Activity] Cleanup completed", {
396
- deletedCount: response.cleanupActivities.deletedCount
397
- });
398
- return response.cleanupActivities.deletedCount;
357
+ async cleanup(_olderThanDays, _workspaceId) {
358
+ throw new ActivityOperationUnsupportedError("cleanup", "retention is enforced by the activity owner");
359
+ }
360
+ /**
361
+ * @deprecated The workspace activity owner exports through `exportActivityLogsSiem`
362
+ * (CEF/LEEF/JSON lines); there is no CSV export operation.
363
+ */
364
+ async exportToCSV(_options) {
365
+ throw new ActivityOperationUnsupportedError("exportToCSV", "use the owner exportActivityLogsSiem query");
399
366
  }
400
367
  /**
401
368
  * Infer activity type from action string
@@ -446,40 +413,6 @@ var ActivityModule = class {
446
413
  }
447
414
  return "custom";
448
415
  }
449
- /**
450
- * Export activities to CSV
451
- */
452
- async exportToCSV(options) {
453
- logger.debug("[Activity] Exporting activities to CSV");
454
- const query = `
455
- query ExportActivities(
456
- $userId: ID
457
- $workspaceId: ID
458
- $organizationId: ID
459
- $startDate: DateTime
460
- $endDate: DateTime
461
- ) {
462
- exportActivities(
463
- userId: $userId
464
- workspaceId: $workspaceId
465
- organizationId: $organizationId
466
- startDate: $startDate
467
- endDate: $endDate
468
- ) {
469
- csvData
470
- }
471
- }
472
- `;
473
- const response = await this.client.query(query, {
474
- userId: options.userId,
475
- workspaceId: options.workspaceId,
476
- organizationId: options.organizationId,
477
- startDate: options.startDate,
478
- endDate: options.endDate
479
- }, this.context);
480
- logger.info("[Activity] Activities exported to CSV");
481
- return response.exportActivities.csvData;
482
- }
483
416
  };
484
417
 
485
418
  // src/tracker/agent-activity.ts
@@ -923,6 +856,6 @@ var TrackerModule = class {
923
856
  }
924
857
  };
925
858
 
926
- export { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, ActivityModule, TrackerModule, trackAgentActivity };
927
- //# sourceMappingURL=chunk-5EVD6HOD.js.map
928
- //# sourceMappingURL=chunk-5EVD6HOD.js.map
859
+ export { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, ActivityModule, ActivityOperationUnsupportedError, TrackerModule, trackAgentActivity };
860
+ //# sourceMappingURL=chunk-LRFUXS73.js.map
861
+ //# sourceMappingURL=chunk-LRFUXS73.js.map