@burdenoff/be-sdk 2026.1110.3 → 2026.1110.4

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 (108) hide show
  1. package/dist/activity/index.d.ts +165 -0
  2. package/dist/activity/index.js +389 -0
  3. package/dist/activity/index.js.map +1 -0
  4. package/dist/ai-credits/index.js +1 -1
  5. package/dist/{ai-credits-Ca-NNcVx.js → ai-credits-xxfwGpHS.js} +2 -2
  6. package/dist/{ai-credits-Ca-NNcVx.js.map → ai-credits-xxfwGpHS.js.map} +1 -1
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.js +1 -1
  9. package/dist/{auth-CEuBEBQN.js → auth-C5ctwSLp.js} +2 -2
  10. package/dist/{auth-CEuBEBQN.js.map → auth-C5ctwSLp.js.map} +1 -1
  11. package/dist/bootstrap/index.d.ts +74 -0
  12. package/dist/bootstrap/index.js +282 -0
  13. package/dist/bootstrap/index.js.map +1 -0
  14. package/dist/{client-DcZ3iGES.js → client-sAJTrb4i.js} +2 -2
  15. package/dist/{client-DcZ3iGES.js.map → client-sAJTrb4i.js.map} +1 -1
  16. package/dist/context/index.d.ts +35 -0
  17. package/dist/{context-CZnXf2yb.js → context/index.js} +38 -2
  18. package/dist/context/index.js.map +1 -0
  19. package/dist/database/index.js +1 -1
  20. package/dist/event-queue/index.d.ts +1 -1
  21. package/dist/explicit-activity-scope-DikJ7NAE.js +57 -0
  22. package/dist/explicit-activity-scope-DikJ7NAE.js.map +1 -0
  23. package/dist/export/index.js +1 -1
  24. package/dist/{export-B6fphx8a.js → export-DJXE3Osa.js} +3 -3
  25. package/dist/{export-B6fphx8a.js.map → export-DJXE3Osa.js.map} +1 -1
  26. package/dist/feature-flags/index.js +1 -1
  27. package/dist/{feature-flags-71oDkrUe.js → feature-flags-CP1KRgwD.js} +2 -2
  28. package/dist/{feature-flags-71oDkrUe.js.map → feature-flags-CP1KRgwD.js.map} +1 -1
  29. package/dist/files/index.js +1 -1
  30. package/dist/{files-DjH0099H.js → files-h5U-D2AF.js} +2 -2
  31. package/dist/{files-DjH0099H.js.map → files-h5U-D2AF.js.map} +1 -1
  32. package/dist/gateway/index.js +2 -2
  33. package/dist/{gateway-DBFmxWks.js → gateway-ByVo-n37.js} +2 -2
  34. package/dist/{gateway-DBFmxWks.js.map → gateway-ByVo-n37.js.map} +1 -1
  35. package/dist/graph/index.d.ts +1 -1
  36. package/dist/graph/index.js +1 -1
  37. package/dist/{graph-DDYgIryR.js → graph-CR7u4lpl.js} +2 -2
  38. package/dist/{graph-DDYgIryR.js.map → graph-CR7u4lpl.js.map} +1 -1
  39. package/dist/{graphql-DNkMkGBZ.d.ts → graphql-CUDyhibV.d.ts} +1 -1
  40. package/dist/{index-bZKZUvBu.d.ts → index-ADmsX0BI.d.ts} +3 -3
  41. package/dist/{index-BqYfCQSP.d.ts → index-B2LCaK0R.d.ts} +1 -1
  42. package/dist/{index-D6UeLAye.d.ts → index-CHwMhK6v.d.ts} +2 -2
  43. package/dist/{index-BQDsNAMR.d.ts → index-CTTwo9av.d.ts} +22 -1
  44. package/dist/{index-DZC-2o9R.d.ts → index-CVCyKzhB.d.ts} +2 -2
  45. package/dist/{index-CkT2aUr3.d.ts → index-C_GXXF32.d.ts} +2 -2
  46. package/dist/{index-BKwHQtHQ.d.ts → index-Cot73bdh.d.ts} +1 -1
  47. package/dist/{index-CnzbJZP7.d.ts → index-FRRaa6h2.d.ts} +2 -2
  48. package/dist/{index-N-huORcj.d.ts → index-U_tu3zUl.d.ts} +2 -2
  49. package/dist/index-cmR9k9ga.d.ts +26 -0
  50. package/dist/{index-CZTnQIRU.d.ts → index-zd_NPGJo.d.ts} +6 -141
  51. package/dist/index.d.ts +19 -479
  52. package/dist/index.js +22 -1492
  53. package/dist/index.js.map +1 -1
  54. package/dist/init/index.js +1 -1
  55. package/dist/{init-Dy3KhT6Y.js → init-CQPFmOOe.js} +3 -3
  56. package/dist/{init-Dy3KhT6Y.js.map → init-CQPFmOOe.js.map} +1 -1
  57. package/dist/instrumentation/index.d.ts +2 -2
  58. package/dist/logger/index.d.ts +1 -1
  59. package/dist/notifications/index.d.ts +1 -1
  60. package/dist/notifications/index.js +1 -1
  61. package/dist/{notifications-CdETrtFK.js → notifications-DY_i37WN.js} +2 -2
  62. package/dist/{notifications-CdETrtFK.js.map → notifications-DY_i37WN.js.map} +1 -1
  63. package/dist/payments/index.d.ts +144 -0
  64. package/dist/payments/index.js +404 -0
  65. package/dist/payments/index.js.map +1 -0
  66. package/dist/rate-limit-CBrK_U5H.js +142 -0
  67. package/dist/rate-limit-CBrK_U5H.js.map +1 -0
  68. package/dist/rbac/index.d.ts +1 -1
  69. package/dist/rbac/index.js +1 -1
  70. package/dist/{rbac-BB9l9Xph.js → rbac-Dvz0YzEt.js} +2 -2
  71. package/dist/{rbac-BB9l9Xph.js.map → rbac-Dvz0YzEt.js.map} +1 -1
  72. package/dist/resource-caps/index.d.ts +1 -1
  73. package/dist/search/index.d.ts +112 -0
  74. package/dist/search/index.js +266 -0
  75. package/dist/search/index.js.map +1 -0
  76. package/dist/security/index.d.ts +2 -0
  77. package/dist/security/index.js +4 -0
  78. package/dist/security/index.js.map +1 -0
  79. package/dist/security/rate-limit/index.d.ts +2 -0
  80. package/dist/security/rate-limit/index.js +4 -0
  81. package/dist/security/rate-limit/index.js.map +1 -0
  82. package/dist/server/index.js +3 -2
  83. package/dist/server/index.js.map +1 -1
  84. package/dist/{stub-BqwKn4eh.js → stub-BUnfMiAS.js} +3 -56
  85. package/dist/stub-BUnfMiAS.js.map +1 -0
  86. package/dist/tags/index.js +1 -1
  87. package/dist/{tags-B5xpbgsk.js → tags-CbijgoqR.js} +2 -2
  88. package/dist/{tags-B5xpbgsk.js.map → tags-CbijgoqR.js.map} +1 -1
  89. package/dist/telemetry/index.d.ts +2 -2
  90. package/dist/tracker/index.d.ts +2 -2
  91. package/dist/tracker/index.js +5 -3
  92. package/dist/{tracker-BQVoEFUo.js → tracker-PQztSlhJ.js} +9 -390
  93. package/dist/tracker-PQztSlhJ.js.map +1 -0
  94. package/dist/translation/index.d.ts +120 -0
  95. package/dist/translation/index.js +573 -0
  96. package/dist/translation/index.js.map +1 -0
  97. package/dist/types/index.d.ts +3 -0
  98. package/dist/{types-Cj2RWXbz.js → types/index.js} +3 -3
  99. package/dist/types/index.js.map +1 -0
  100. package/dist/usage/index.d.ts +1 -1
  101. package/dist/usage/index.js +1 -1
  102. package/dist/{usage-BKFZiWQn.js → usage-BRqVP3CJ.js} +4 -4
  103. package/dist/{usage-BKFZiWQn.js.map → usage-BRqVP3CJ.js.map} +1 -1
  104. package/package.json +1 -1
  105. package/dist/context-CZnXf2yb.js.map +0 -1
  106. package/dist/stub-BqwKn4eh.js.map +0 -1
  107. package/dist/tracker-BQVoEFUo.js.map +0 -1
  108. package/dist/types-Cj2RWXbz.js.map +0 -1
@@ -1,6 +1,8 @@
1
- import { a as resolveAssistantSession, i as isTrackedActorType, l as AI_ASSISTANT_ACTOR_ORIGIN, n as UnifiedTrackerStub, o as trackOperation, r as createProductTracker, s as trackerStub, t as UNIFIED_TRACKER_CONSTANTS, v as suppressMutationAudit } from "../stub-BqwKn4eh.js";
2
- import { i as trackAgentActivity, n as AGENT_ACTIVITY_ACTIONS, r as AGENT_ACTIVITY_RESOURCE_TYPE, t as TrackerModule } from "../tracker-BQVoEFUo.js";
3
- import { i as UsageMetricType } from "../usage-BKFZiWQn.js";
1
+ import { i as suppressMutationAudit } from "../explicit-activity-scope-DikJ7NAE.js";
2
+ import "../activity/index.js";
3
+ import { i as UsageMetricType } from "../usage-BRqVP3CJ.js";
4
+ import { a as resolveAssistantSession, i as isTrackedActorType, l as AI_ASSISTANT_ACTOR_ORIGIN, n as UnifiedTrackerStub, o as trackOperation, r as createProductTracker, s as trackerStub, t as UNIFIED_TRACKER_CONSTANTS } from "../stub-BUnfMiAS.js";
5
+ import { i as trackAgentActivity, n as AGENT_ACTIVITY_ACTIONS, r as AGENT_ACTIVITY_RESOURCE_TYPE, t as TrackerModule } from "../tracker-PQztSlhJ.js";
4
6
 
5
7
  export { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, AI_ASSISTANT_ACTOR_ORIGIN, TrackerModule, UNIFIED_TRACKER_CONSTANTS, UnifiedTrackerStub, UsageMetricType, createProductTracker, isTrackedActorType, resolveAssistantSession, suppressMutationAudit, trackAgentActivity, trackOperation, trackerStub };
6
8
  //# sourceMappingURL=index.js.map
@@ -1,392 +1,11 @@
1
- import { a as QuotaExceededError, c as ValidationError, i as PermissionDeniedError, o as SDKError } from "./types-Cj2RWXbz.js";
1
+ import { PermissionDeniedError, QuotaExceededError, ValidationError } from "./types/index.js";
2
2
  import { a as logger } from "./logger-B6rCpb7D.js";
3
- import { t as RBACModule } from "./rbac-BB9l9Xph.js";
4
- import { _ as runInExplicitActivityScope, g as markExplicitActivity, h as createExplicitActivityScope, o as trackOperation } from "./stub-BqwKn4eh.js";
5
- import { a as UsageModule } from "./usage-BKFZiWQn.js";
6
- import { n as NotificationType, r as NotificationsModule } from "./notifications-CdETrtFK.js";
7
- import { randomUUID } from "node:crypto";
8
-
9
- // src/activity/index.ts
10
- /**
11
- * Activity Tracking Module
12
- *
13
- * Audit trail writes and reads against the workspace activity owner
14
- * (`wspace-activity-svc`), reached through the configured workspace internal gateway.
15
- *
16
- * The SDK keeps its own descriptive vocabulary (`activityType`, `status`, `severity`,
17
- * `duration`, ...) for callers, but the owning subgraph's `ActivityLog` type does not have
18
- * those columns. This module therefore maps between the two contracts explicitly:
19
- *
20
- * - writes send only fields `RecordActivityInput` defines and carry the SDK-only fields in
21
- * `metadata`, which the owner persists verbatim in the row's `details` column;
22
- * - reads select only fields `ActivityLog` defines and rebuild the SDK shape from the row
23
- * plus those persisted `details`.
24
- *
25
- * Selecting a field the owner does not define fails GraphQL validation for the whole
26
- * operation, so the selections below are pinned by unit tests against the published schema.
27
- */
28
- let ActivityType = /* @__PURE__ */ function(ActivityType) {
29
- ActivityType["CREATE"] = "create";
30
- ActivityType["READ"] = "read";
31
- ActivityType["UPDATE"] = "update";
32
- ActivityType["DELETE"] = "delete";
33
- ActivityType["LOGIN"] = "login";
34
- ActivityType["LOGOUT"] = "logout";
35
- ActivityType["EXPORT"] = "export";
36
- ActivityType["IMPORT"] = "import";
37
- ActivityType["SHARE"] = "share";
38
- ActivityType["DOWNLOAD"] = "download";
39
- ActivityType["UPLOAD"] = "upload";
40
- ActivityType["EXECUTE"] = "execute";
41
- ActivityType["APPROVE"] = "approve";
42
- ActivityType["REJECT"] = "reject";
43
- ActivityType["CUSTOM"] = "custom";
44
- return ActivityType;
45
- }({});
46
- let ActivityStatus = /* @__PURE__ */ function(ActivityStatus) {
47
- ActivityStatus["SUCCESS"] = "success";
48
- ActivityStatus["FAILURE"] = "failure";
49
- ActivityStatus["PENDING"] = "pending";
50
- ActivityStatus["WARNING"] = "warning";
51
- return ActivityStatus;
52
- }({});
53
- let ActivitySeverity = /* @__PURE__ */ function(ActivitySeverity) {
54
- ActivitySeverity["LOW"] = "low";
55
- ActivitySeverity["MEDIUM"] = "medium";
56
- ActivitySeverity["HIGH"] = "high";
57
- ActivitySeverity["CRITICAL"] = "critical";
58
- return ActivitySeverity;
59
- }({});
60
- /** Thrown by SDK operations the current activity owner does not expose. */
61
- var ActivityOperationUnsupportedError = class ActivityOperationUnsupportedError extends SDKError {
62
- constructor(operation, guidance) {
63
- super(`ActivityModule.${operation} is not supported by the workspace activity owner: ${guidance}`, "ACTIVITY_OPERATION_UNSUPPORTED", { operation });
64
- this.name = "ActivityOperationUnsupportedError";
65
- Object.setPrototypeOf(this, ActivityOperationUnsupportedError.prototype);
66
- }
67
- };
68
- /**
69
- * `ActivityLog` fields selected from wspace-activity-svc. Every name here must exist on the
70
- * owner's published `ActivityLog` type (see tests/activity-module.test.ts).
71
- */
72
- const ACTIVITY_LOG_SELECTION = `
73
- id
74
- userId
75
- action
76
- description
77
- details
78
- timestamp
79
- productId
80
- workspaceId
81
- resourceType
82
- resourceId
83
- targetUserId
84
- ipAddress
85
- userAgent
86
- actorType
87
- onBehalfOf
88
- context {
89
- projectId
90
- custom
91
- }
92
- `;
93
- const RECORD_ACTIVITY_MUTATION = `
94
- mutation RecordActivity($input: RecordActivityInput!) {
95
- recordActivity(input: $input) {
96
- ${ACTIVITY_LOG_SELECTION}
97
- }
98
- }
99
- `;
100
- const WORKSPACE_ACTIVITY_SLICE_QUERY = `
101
- query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {
102
- getWorkspaceActivitySlice(filter: $filter) {
103
- ${ACTIVITY_LOG_SELECTION}
104
- }
105
- activityCount(filter: $filter)
106
- }
107
- `;
108
- /**
109
- * Keys the SDK stores inside `metadata`/`details` for its own fields. The owner overwrites
110
- * `metadata.ipAddress`/`metadata.userAgent` with the relaying request's values, so the end
111
- * user's request details travel under their own keys.
112
- */
113
- const SDK_DETAIL_KEYS = [
114
- "activityType",
115
- "status",
116
- "severity",
117
- "duration",
118
- "organizationId",
119
- "projectId",
120
- "requestIpAddress",
121
- "requestUserAgent",
122
- "errorMessage",
123
- "ipAddress",
124
- "userAgent"
125
- ];
126
- function readRecord(value) {
127
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
128
- }
129
- function readString(value) {
130
- return typeof value === "string" && value.length > 0 ? value : void 0;
131
- }
132
- function readEnum(values, value, fallback) {
133
- const allowed = Object.values(values);
134
- return typeof value === "string" && allowed.includes(value) ? value : fallback;
135
- }
136
- /** Remove undefined entries so the payload only names fields the caller actually set. */
137
- function compact(input) {
138
- return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
139
- }
140
- /**
141
- * Build the wspace-activity-svc `RecordActivityInput` for an SDK activity.
142
- * Exported for unit tests.
143
- */
144
- function buildRecordActivityInput(options, context = {}) {
145
- const severity = options.severity ?? "low";
146
- const metadata = compact({
147
- ...options.metadata,
148
- activityType: options.activityType,
149
- status: options.status,
150
- severity,
151
- duration: options.duration,
152
- errorMessage: options.errorMessage,
153
- organizationId: options.organizationId,
154
- projectId: options.projectId,
155
- requestIpAddress: options.ipAddress,
156
- requestUserAgent: options.userAgent
157
- });
158
- const activityContext = compact({
159
- workspaceId: options.workspaceId,
160
- userId: options.userId,
161
- projectId: options.projectId,
162
- custom: options.organizationId ? { organizationId: options.organizationId } : void 0
163
- });
164
- return compact({
165
- action: options.action,
166
- description: options.description,
167
- resourceType: options.resourceType,
168
- resourceId: options.resourceId,
169
- workspaceId: options.workspaceId,
170
- productId: options.productId ?? context.productId,
171
- targetUserId: options.targetUserId,
172
- teamId: options.teamId,
173
- success: options.status !== "failure",
174
- errorMessage: options.errorMessage,
175
- actorType: options.actorType,
176
- onBehalfOf: options.onBehalfOf,
177
- context: activityContext,
178
- metadata,
179
- dedupeKey: options.dedupeKey ?? `sdk-activity:${randomUUID()}`
180
- });
181
- }
182
- /**
183
- * Rebuild the SDK `Activity` shape from an owner row. Fields the owner has no column for are
184
- * read back from the persisted `details`. Exported for unit tests.
185
- */
186
- function toActivity(record) {
187
- const details = readRecord(record.details) ?? {};
188
- const custom = readRecord(record.context?.custom);
189
- const metadata = {};
190
- for (const [key, value] of Object.entries(details)) if (!SDK_DETAIL_KEYS.includes(key)) metadata[key] = value;
191
- const duration = details["duration"];
192
- return {
193
- id: record.id,
194
- userId: record.userId,
195
- activityType: readEnum(ActivityType, details["activityType"], "custom"),
196
- resourceType: record.resourceType ?? "",
197
- resourceId: record.resourceId ?? void 0,
198
- action: record.action,
199
- status: readEnum(ActivityStatus, details["status"], "success"),
200
- workspaceId: record.workspaceId ?? void 0,
201
- organizationId: readString(details["organizationId"]) ?? readString(custom?.["organizationId"]),
202
- projectId: record.context?.projectId ?? readString(details["projectId"]),
203
- productId: record.productId ?? void 0,
204
- description: record.description ?? void 0,
205
- targetUserId: record.targetUserId ?? void 0,
206
- actorType: record.actorType ?? void 0,
207
- onBehalfOf: record.onBehalfOf ?? void 0,
208
- ipAddress: readString(details["requestIpAddress"]) ?? record.ipAddress ?? void 0,
209
- userAgent: readString(details["requestUserAgent"]) ?? record.userAgent ?? void 0,
210
- metadata,
211
- severity: readEnum(ActivitySeverity, details["severity"], "low"),
212
- errorMessage: readString(details["errorMessage"]),
213
- duration: typeof duration === "number" && Number.isFinite(duration) ? duration : void 0,
214
- createdAt: record.timestamp
215
- };
216
- }
217
- /**
218
- * Build the owner's `ActivityLogFilter` for an SDK read. Filters the owner cannot apply are
219
- * rejected rather than dropped, because dropping them would return rows the caller excluded.
220
- * Exported for unit tests.
221
- */
222
- function buildActivityLogFilter(options) {
223
- if (!options.workspaceId) throw new ValidationError("workspaceId is required to read activities");
224
- const unsupported = [
225
- "organizationId",
226
- "projectId",
227
- "activityType",
228
- "status",
229
- "severity",
230
- "search"
231
- ].filter((key) => options[key] !== void 0);
232
- if (options.sortBy !== void 0 && options.sortBy !== "createdAt") unsupported.push("sortBy");
233
- if (options.sortOrder !== void 0 && options.sortOrder !== "desc") unsupported.push("sortOrder");
234
- if (unsupported.length > 0) throw new ValidationError(`Activity filters not supported by the workspace activity owner: ${unsupported.join(", ")}`, { unsupported });
235
- return compact({
236
- workspaceId: options.workspaceId,
237
- userId: options.userId,
238
- action: options.action,
239
- resourceType: options.resourceType,
240
- resourceId: options.resourceId,
241
- targetUserId: options.targetUserId,
242
- startDate: options.startDate,
243
- endDate: options.endDate,
244
- limit: options.limit ?? 50,
245
- offset: options.offset ?? 0
246
- });
247
- }
248
- /**
249
- * Activity Tracking Module
250
- */
251
- var ActivityModule = class {
252
- client;
253
- context;
254
- constructor(client, context) {
255
- this.client = client;
256
- this.context = context;
257
- }
258
- /**
259
- * Log activity
260
- *
261
- * The write is relayed as a platform service acting for `userId`, the same identity
262
- * transport `trackOperation` uses, so the owner records the end user as the actor and
263
- * honours `actorType`/`onBehalfOf` from the input.
264
- */
265
- async log(options) {
266
- if (!options.userId) throw new ValidationError("User ID is required");
267
- if (!options.activityType) throw new ValidationError("Activity type is required");
268
- if (!options.resourceType) throw new ValidationError("Resource type is required");
269
- if (!options.action) throw new ValidationError("Action is required");
270
- if (!options.status) throw new ValidationError("Status is required");
271
- markExplicitActivity();
272
- logger.debug("[Activity] Logging activity", {
273
- userId: options.userId,
274
- action: options.action,
275
- resourceType: options.resourceType
276
- });
277
- const input = buildRecordActivityInput(options, this.context);
278
- const requestContext = {
279
- ...this.context,
280
- actorId: options.userId,
281
- actorType: "service",
282
- workspaceId: options.workspaceId ?? this.context.workspaceId
283
- };
284
- const activity = toActivity((await this.client.query(RECORD_ACTIVITY_MUTATION, { input }, requestContext)).recordActivity);
285
- logger.info("[Activity] Activity logged", { activityId: activity.id });
286
- return activity;
287
- }
288
- /**
289
- * Log activity with automatic status detection
290
- */
291
- async logSuccess(userId, action, resourceType, resourceId, metadata) {
292
- return this.log({
293
- userId,
294
- action,
295
- resourceType,
296
- resourceId,
297
- activityType: this.inferActivityType(action),
298
- status: "success",
299
- severity: "low",
300
- metadata,
301
- workspaceId: this.context.workspaceId
302
- });
303
- }
304
- /**
305
- * Log failed activity
306
- */
307
- async logFailure(userId, action, resourceType, errorMessage, resourceId, metadata) {
308
- return this.log({
309
- userId,
310
- action,
311
- resourceType,
312
- resourceId,
313
- activityType: this.inferActivityType(action),
314
- status: "failure",
315
- severity: "high",
316
- errorMessage,
317
- metadata,
318
- workspaceId: this.context.workspaceId
319
- });
320
- }
321
- /**
322
- * Get one workspace's activities, newest first.
323
- *
324
- * Reads the owner's workspace-scoped slice (`getWorkspaceActivitySlice`) together with the
325
- * matching `activityCount`, so `total` counts every row the filter matches, not just the page.
326
- */
327
- async getActivities(options) {
328
- logger.debug("[Activity] Getting activities", options);
329
- const filter = buildActivityLogFilter(options);
330
- const requestContext = {
331
- ...this.context,
332
- workspaceId: options.workspaceId
333
- };
334
- const response = await this.client.query(WORKSPACE_ACTIVITY_SLICE_QUERY, { filter }, requestContext);
335
- return {
336
- activities: response.getWorkspaceActivitySlice.map(toActivity),
337
- total: response.activityCount
338
- };
339
- }
340
- /**
341
- * @deprecated The workspace activity owner has no read-by-id operation. Use
342
- * {@link getActivities} with `resourceId`/`action` filters instead.
343
- */
344
- async getActivity(_activityId) {
345
- throw new ActivityOperationUnsupportedError("getActivity", "use getActivities with a workspace filter");
346
- }
347
- /**
348
- * @deprecated The workspace activity owner has no statistics operation. Use
349
- * {@link getActivities} (its `total` is the owner's `activityCount`) per filter instead.
350
- */
351
- async getStats(_options) {
352
- throw new ActivityOperationUnsupportedError("getStats", "use getActivities and its total per filter");
353
- }
354
- /**
355
- * @deprecated Retention is enforced by the activity owner's retention policy and legal holds;
356
- * there is no client-driven cleanup operation.
357
- */
358
- async cleanup(_olderThanDays, _workspaceId) {
359
- throw new ActivityOperationUnsupportedError("cleanup", "retention is enforced by the activity owner");
360
- }
361
- /**
362
- * @deprecated The workspace activity owner exports through `exportActivityLogsSiem`
363
- * (CEF/LEEF/JSON lines); there is no CSV export operation.
364
- */
365
- async exportToCSV(_options) {
366
- throw new ActivityOperationUnsupportedError("exportToCSV", "use the owner exportActivityLogsSiem query");
367
- }
368
- /**
369
- * Infer activity type from action string
370
- */
371
- inferActivityType(action) {
372
- const actionLower = action.toLowerCase();
373
- if (actionLower.includes("create") || actionLower.includes("add")) return "create";
374
- if (actionLower.includes("update") || actionLower.includes("edit") || actionLower.includes("modify")) return "update";
375
- if (actionLower.includes("delete") || actionLower.includes("remove")) return "delete";
376
- if (actionLower.includes("read") || actionLower.includes("view") || actionLower.includes("get")) return "read";
377
- if (actionLower.includes("login") || actionLower.includes("signin")) return "login";
378
- if (actionLower.includes("logout") || actionLower.includes("signout")) return "logout";
379
- if (actionLower.includes("export")) return "export";
380
- if (actionLower.includes("import")) return "import";
381
- if (actionLower.includes("share")) return "share";
382
- if (actionLower.includes("download")) return "download";
383
- if (actionLower.includes("upload")) return "upload";
384
- if (actionLower.includes("execute") || actionLower.includes("run")) return "execute";
385
- if (actionLower.includes("approve")) return "approve";
386
- if (actionLower.includes("reject")) return "reject";
387
- return "custom";
388
- }
389
- };
3
+ import { t as RBACModule } from "./rbac-Dvz0YzEt.js";
4
+ import { ActivityModule, ActivitySeverity, ActivityStatus, ActivityType } from "./activity/index.js";
5
+ import { a as UsageModule } from "./usage-BRqVP3CJ.js";
6
+ import { n as NotificationType, r as NotificationsModule } from "./notifications-DY_i37WN.js";
7
+ import { o as trackOperation } from "./stub-BUnfMiAS.js";
8
+ import { r as runInExplicitActivityScope, t as createExplicitActivityScope } from "./explicit-activity-scope-DikJ7NAE.js";
390
9
 
391
10
  // src/tracker/agent-activity.ts
392
11
  /**
@@ -835,5 +454,5 @@ var TrackerModule = class {
835
454
  }
836
455
  };
837
456
 
838
- export { ActivityModule as a, trackAgentActivity as i, AGENT_ACTIVITY_ACTIONS as n, ActivityOperationUnsupportedError as o, AGENT_ACTIVITY_RESOURCE_TYPE as r, TrackerModule as t };
839
- //# sourceMappingURL=tracker-BQVoEFUo.js.map
457
+ export { trackAgentActivity as i, AGENT_ACTIVITY_ACTIONS as n, AGENT_ACTIVITY_RESOURCE_TYPE as r, TrackerModule as t };
458
+ //# sourceMappingURL=tracker-PQztSlhJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker-PQztSlhJ.js","names":[],"sources":["../src/tracker/agent-activity.ts","../src/tracker/index.ts"],"sourcesContent":["/**\n * AI-agent activity (BOFF-9684)\n *\n * Platform-wide activity actions for what an AI agent does, and a helper that records them with\n * the agent as an `app` actor. The audit trail can then separate agent actions from the human\n * actions around them (ISO/IEC 42001 Annex A.9 evidence) and link each one back to the person\n * who started the run (`onBehalfOf`).\n *\n * The action names follow the platform taxonomy `<domain>.<resource>.<verb>` and are shared by\n * every product that runs agents; the product is identified by `productId`.\n *\n * @example\n * ```ts\n * import { AGENT_ACTIVITY_ACTIONS, trackAgentActivity } from '@burdenoff/be-sdk/tracker';\n *\n * await trackAgentActivity({\n * action: AGENT_ACTIVITY_ACTIONS.TOOL_CALLED,\n * agentId: agent.id,\n * workspaceId,\n * onBehalfOf: userId,\n * productId: 'botmanor',\n * metadata: { toolName: 'search' },\n * });\n * ```\n *\n * @module tracker/agent-activity\n * @category Tracking\n */\nimport { createExplicitActivityScope, runInExplicitActivityScope } from '../activity/explicit-activity-scope.js';\nimport { trackOperation } from './stub.js';\n\n/** Activity actions for AI-agent behaviour. */\nexport const AGENT_ACTIVITY_ACTIONS = Object.freeze({\n /** An agent run (one turn) finished and produced a response. */\n RUN_COMPLETED: 'agent.run.completed',\n /** An agent run failed before producing a response. */\n RUN_FAILED: 'agent.run.failed',\n /** The agent called a tool (MCP or similar). `success: false` when the call failed. */\n TOOL_CALLED: 'agent.tool.called',\n /** The agent delegated a sub-task to another agent. */\n DELEGATION_SENT: 'agent.delegation.sent',\n /** A governance policy refused something the agent run attempted (input, output, tool, model, budget, rate). */\n POLICY_BLOCKED: 'agent.policy.blocked',\n} as const);\n\nexport type AgentActivityAction = (typeof AGENT_ACTIVITY_ACTIONS)[keyof typeof AGENT_ACTIVITY_ACTIONS];\n\n/** Default `resourceType` of agent activity rows; `resourceId` defaults to the agent id. */\nexport const AGENT_ACTIVITY_RESOURCE_TYPE = 'agent';\n\nconst FAILURE_ACTIONS: ReadonlySet<AgentActivityAction> = new Set<AgentActivityAction>([\n AGENT_ACTIVITY_ACTIONS.RUN_FAILED,\n AGENT_ACTIVITY_ACTIONS.POLICY_BLOCKED,\n]);\n\nexport interface AgentActivityOptions {\n action: AgentActivityAction;\n /** The agent that acted. Recorded as the row's actor (`userId`) with `actorType: 'app'`. */\n agentId: string;\n workspaceId: string;\n /** The human who started the run, when there is one. */\n onBehalfOf?: string;\n /** Product that runs the agent, e.g. `botmanor`. */\n productId?: string;\n /** Defaults to false for RUN_FAILED and POLICY_BLOCKED, true otherwise. */\n success?: boolean;\n errorMessage?: string;\n description?: string;\n /** Defaults to `AGENT_ACTIVITY_RESOURCE_TYPE`. */\n resourceType?: string;\n /** Defaults to `agentId`. */\n resourceId?: string;\n metadata?: Record<string, unknown>;\n /** Stable idempotency key, only for callers that may replay the same event. */\n dedupeKey?: string;\n}\n\n/**\n * Record one AI-agent activity row, attributed to the agent as an `app` actor.\n *\n * Fire-and-forget like `trackOperation`: it never throws for a delivery failure and never blocks\n * on the activity service. It runs in its own explicit-activity scope, so recording what the\n * agent did does not suppress the mutation-audit row of the human request that started the run.\n */\nexport function trackAgentActivity(options: AgentActivityOptions): Promise<boolean> {\n const success = options.success ?? !FAILURE_ACTIONS.has(options.action);\n return runInExplicitActivityScope(createExplicitActivityScope(), () =>\n trackOperation({\n operationName: options.action,\n userId: options.agentId,\n actorType: 'app',\n ...(options.onBehalfOf ? { onBehalfOf: options.onBehalfOf } : {}),\n workspaceId: options.workspaceId,\n ...(options.productId ? { productId: options.productId } : {}),\n success,\n ...(options.errorMessage ? { errorMessage: options.errorMessage } : {}),\n activityOptions: {\n enabled: true,\n activityType: options.action,\n description: options.description ?? `Agent ${options.agentId}: ${options.action}`,\n workspaceId: options.workspaceId,\n resourceType: options.resourceType ?? AGENT_ACTIVITY_RESOURCE_TYPE,\n resourceId: options.resourceId ?? options.agentId,\n metadata: { ...options.metadata, agentId: options.agentId },\n ...(options.dedupeKey ? { dedupeKey: options.dedupeKey } : {}),\n },\n })\n );\n}\n","/**\n * Unified Tracker Module\n * Aggregates RBAC + Activity + Usage + Notifications in single function call\n * This is the MOST IMPORTANT module that products should use for most operations\n */\n\nimport type { BurdenoffGraphQLClient } from '../client/graphql.js';\nimport type { SDKContext } from '../types/index.js';\nimport { PermissionDeniedError, QuotaExceededError, ValidationError } from '../types/index.js';\nimport { logger } from '../logger/index.js';\nimport { RBACModule, type CheckPermissionOptions } from '../rbac/index.js';\nimport { ActivityModule, ActivityType, ActivityStatus, ActivitySeverity } from '../activity/index.js';\nimport { UsageModule, type UsageMetricType } from '../usage/index.js';\nimport { NotificationsModule, NotificationType } from '../notifications/index.js';\n\nexport interface TrackOptions {\n /** User performing the action */\n userId: string;\n /** Action being performed */\n action: string;\n /** Resource type */\n resourceType: string;\n /** Optional resource ID */\n resourceId?: string;\n /** Workspace context */\n workspaceId?: string;\n /** Organization context */\n organizationId?: string;\n /** Project context */\n projectId?: string;\n\n /** RBAC options */\n rbac?: {\n /** Check permission before executing (default: true) */\n enabled?: boolean;\n /** Custom permission action (defaults to action parameter) */\n permissionAction?: string;\n };\n\n /** Activity tracking options */\n activity?: {\n /** Enable activity tracking (default: true) */\n enabled?: boolean;\n /** Activity type (auto-inferred if not provided) */\n activityType?: ActivityType;\n /** Additional metadata */\n metadata?: Record<string, unknown>;\n /** IP address */\n ipAddress?: string;\n /** User agent */\n userAgent?: string;\n /** Severity level */\n severity?: ActivitySeverity;\n };\n\n /**\n * Usage tracking options.\n *\n * The tracker meters a workspace quota only when `quotaName` is set: it checks capacity\n * with the owner's `checkWorkspaceQuota` (for positive amounts) and records the amount\n * with `trackUsage`. Without a `quotaName` the usage step is skipped. Mutations whose\n * schema carries a gateway `@usage` directive are already metered by the gateway and\n * should not set `quotaName` here, or the quota is charged twice.\n */\n usage?: {\n /** Enable usage tracking (default: true) */\n enabled?: boolean;\n /** Workspace quota to charge, for example `platform.projects.created`. */\n quotaName?: string;\n /** Product that owns the quota. Defaults to the SDK context's `productId`. */\n productId?: string;\n /** Description stored on the usage record. Defaults to `<action> <resourceType>`. */\n description?: string;\n /**\n * Amount to record (default: 1). A negative amount releases usage, for example on\n * delete; the quota check is skipped for it.\n */\n amount?: number;\n /** Check quota before recording a positive amount (default: true) */\n checkQuota?: boolean;\n /**\n * Legacy metric name. The workspace usage owner has no metric types, so a metric type\n * without a `quotaName` is not metered by the tracker.\n */\n metricType?: UsageMetricType;\n /** Legacy entity type. Workspace quotas are always charged to the workspace. */\n entityType?: 'user' | 'workspace' | 'organization';\n };\n\n /** Notification options */\n notification?: {\n /** Send notification on success */\n onSuccess?: {\n title: string;\n message: string;\n type?: NotificationType;\n /** Additional user IDs to notify */\n additionalUserIds?: string[];\n };\n /** Send notification on failure */\n onFailure?: {\n title: string;\n message: string;\n type?: NotificationType;\n /** Additional user IDs to notify */\n additionalUserIds?: string[];\n };\n };\n}\n\n/** A usage step that meters a named workspace quota. */\ninterface ResolvedUsage {\n quotaName: string;\n amount: number;\n workspaceId: string;\n checkQuota: boolean;\n}\n\nexport interface TrackResult {\n success: boolean;\n /** Permission check result */\n permissionGranted: boolean;\n /** Quota check result (if quota checking enabled) */\n quotaAvailable?: boolean;\n quotaRemaining?: number;\n /** Activity record ID */\n activityId?: string;\n /** True when the usage step recorded the amount with the owner */\n usageTracked?: boolean;\n /**\n * @deprecated The owner's `trackUsage` returns `Boolean!` and no record id, so this is\n * never set. Read `usageTracked` instead.\n */\n usageRecordId?: string;\n /** Notification IDs sent */\n notificationIds?: string[];\n /** Error if operation failed */\n error?: {\n type: 'permission' | 'quota' | 'validation' | 'unknown';\n message: string;\n details?: Record<string, unknown>;\n };\n /** Operation duration in milliseconds */\n duration: number;\n}\n\n/**\n * Unified Tracker Module\n *\n * The primary module products should use for tracking operations.\n * Automatically handles RBAC checks, activity logging, usage tracking, and notifications.\n *\n * @example\n * ```typescript\n * const result = await sdk.tracker.track({\n * userId: 'user123',\n * action: 'create_project',\n * resourceType: 'project',\n * workspaceId: 'ws123',\n * usage: {\n * quotaName: 'myproduct.projects.count',\n * productId: 'myproduct',\n * amount: 1,\n * checkQuota: true,\n * },\n * notification: {\n * onSuccess: {\n * title: 'Project Created',\n * message: 'Your project has been created successfully',\n * },\n * },\n * });\n *\n * if (!result.success) {\n * // Handle error\n * }\n * ```\n */\nexport class TrackerModule {\n private rbac: RBACModule;\n private activity: ActivityModule;\n private usage: UsageModule;\n private notifications: NotificationsModule;\n\n constructor(\n client: BurdenoffGraphQLClient,\n private context: SDKContext = {}\n ) {\n this.rbac = new RBACModule(client, context);\n this.activity = new ActivityModule(client, context);\n this.usage = new UsageModule(client, context);\n this.notifications = new NotificationsModule(client, context);\n }\n\n /**\n * Track operation with RBAC, Activity, Usage, and Notifications\n * This is the primary method products should use\n */\n public async track(options: TrackOptions): Promise<TrackResult> {\n const startTime = Date.now();\n const result: TrackResult = {\n success: false,\n permissionGranted: false,\n duration: 0,\n };\n\n try {\n // Validate required fields\n this.validateOptions(options);\n\n // Step 1: Check RBAC permission (if enabled)\n if (options.rbac?.enabled !== false) {\n await this.checkPermission(options, result);\n if (!result.permissionGranted) {\n result.duration = Date.now() - startTime;\n await this.logFailedActivity(options, result, startTime);\n return result;\n }\n } else {\n result.permissionGranted = true;\n }\n\n // Steps 2 and 3: check quota, then record usage (only for a named workspace quota)\n const usage = this.resolveUsage(options);\n if (usage) {\n let quotaAssignmentId: string | undefined;\n if (usage.checkQuota) {\n quotaAssignmentId = await this.checkQuota(options, usage, result);\n if (result.quotaAvailable === false) {\n result.duration = Date.now() - startTime;\n await this.logFailedActivity(options, result, startTime);\n return result;\n }\n }\n await this.trackUsage(options, usage, quotaAssignmentId, result);\n }\n\n // Step 4: Log successful activity (if enabled)\n if (options.activity?.enabled !== false) {\n await this.logSuccessActivity(options, result, startTime);\n }\n\n // Step 5: Send success notification (if configured)\n if (options.notification?.onSuccess) {\n await this.sendSuccessNotification(options, result);\n }\n\n result.success = true;\n result.duration = Date.now() - startTime;\n\n logger.info('[Tracker] Operation tracked successfully', {\n action: options.action,\n duration: result.duration,\n });\n\n return result;\n } catch (error) {\n result.duration = Date.now() - startTime;\n result.success = false;\n\n // Categorize error\n if (error instanceof PermissionDeniedError) {\n result.error = {\n type: 'permission',\n message: error.message,\n details: error.details,\n };\n } else if (error instanceof QuotaExceededError) {\n result.error = {\n type: 'quota',\n message: error.message,\n details: error.details,\n };\n } else if (error instanceof ValidationError) {\n result.error = {\n type: 'validation',\n message: error.message,\n details: error.details,\n };\n } else {\n result.error = {\n type: 'unknown',\n message: error instanceof Error ? error.message : 'Unknown error',\n };\n }\n\n // Log failed activity\n await this.logFailedActivity(options, result, startTime);\n\n // Send failure notification (if configured)\n if (options.notification?.onFailure) {\n await this.sendFailureNotification(options, result);\n }\n\n logger.error('[Tracker] Operation tracking failed', {\n action: options.action,\n error: result.error,\n duration: result.duration,\n });\n\n return result;\n }\n }\n\n /**\n * Track operation and throw on failure\n * Convenience method that throws errors instead of returning them in result\n */\n public async trackOrThrow(options: TrackOptions): Promise<TrackResult> {\n const result = await this.track(options);\n\n if (!result.success && result.error) {\n const errorMessage = result.error.message;\n const errorDetails = result.error.details;\n\n switch (result.error.type) {\n case 'permission':\n throw new PermissionDeniedError(errorMessage, errorDetails);\n case 'quota':\n throw new QuotaExceededError(errorMessage, errorDetails);\n case 'validation':\n throw new ValidationError(errorMessage, errorDetails);\n default:\n throw new Error(errorMessage);\n }\n }\n\n return result;\n }\n\n /**\n * Simplified track method for common operations.\n * The trailing metric type is accepted for source compatibility and is not metered.\n */\n public async trackSimple(\n userId: string,\n action: string,\n resourceType: string,\n resourceId?: string,\n _metricType?: UsageMetricType\n ): Promise<boolean> {\n // A metric type has no workspace quota on the owner, so trackSimple never meters usage.\n // Call track() with `usage.quotaName` to charge a quota.\n const result = await this.track({\n userId,\n action,\n resourceType,\n resourceId,\n workspaceId: this.context.workspaceId,\n usage: { enabled: false },\n });\n\n return result.success;\n }\n\n /**\n * Validate tracking options\n */\n private validateOptions(options: TrackOptions): void {\n if (!options.userId) {\n throw new ValidationError('User ID is required');\n }\n\n if (!options.action) {\n throw new ValidationError('Action is required');\n }\n\n if (!options.resourceType) {\n throw new ValidationError('Resource type is required');\n }\n }\n\n /**\n * Check RBAC permission\n */\n private async checkPermission(options: TrackOptions, result: TrackResult): Promise<void> {\n const permissionOptions: CheckPermissionOptions = {\n userId: options.userId,\n action: options.rbac?.permissionAction || options.action,\n resourceType: options.resourceType,\n resourceId: options.resourceId,\n workspaceId: options.workspaceId,\n };\n\n const hasPermission = await this.rbac.checkPermission(permissionOptions);\n result.permissionGranted = hasPermission;\n\n if (!hasPermission) {\n result.error = {\n type: 'permission',\n message: 'Permission denied',\n details: permissionOptions as unknown as Record<string, unknown>,\n };\n }\n }\n\n /**\n * Resolve the usage step for an operation, or null when nothing is metered: usage is\n * disabled, or no workspace quota is named (a legacy `metricType` alone has no owner\n * quota to charge).\n */\n private resolveUsage(options: TrackOptions): ResolvedUsage | null {\n const usage = options.usage;\n if (!usage || usage.enabled === false) {\n return null;\n }\n const quotaName = usage.quotaName?.trim();\n if (!quotaName) {\n if (usage.metricType) {\n logger.debug('[Tracker] Usage step skipped: no quotaName for legacy metricType', {\n action: options.action,\n metricType: usage.metricType,\n });\n }\n return null;\n }\n const amount = usage.amount ?? 1;\n if (typeof amount !== 'number' || !Number.isFinite(amount) || amount === 0) {\n throw new ValidationError('Usage amount must be a finite, non-zero number');\n }\n const workspaceId = options.workspaceId ?? this.context.workspaceId;\n if (!workspaceId) {\n throw new ValidationError('Workspace ID is required to track workspace quota usage');\n }\n return {\n quotaName,\n amount,\n workspaceId,\n // Only consumption is gated; a release (negative amount) must always go through.\n checkQuota: usage.checkQuota !== false && amount > 0,\n };\n }\n\n /**\n * Check workspace quota capacity. Returns the assignment to charge when one exists.\n */\n private async checkQuota(\n options: TrackOptions,\n usage: ResolvedUsage,\n result: TrackResult\n ): Promise<string | undefined> {\n const quotaCheck = await this.usage.checkWorkspaceQuota({\n quotaName: usage.quotaName,\n amount: usage.amount,\n workspaceId: usage.workspaceId,\n userId: options.userId,\n });\n\n result.quotaAvailable = quotaCheck.allowed;\n result.quotaRemaining = quotaCheck.limitLeft ?? undefined;\n\n if (!quotaCheck.allowed) {\n const notProvisioned = quotaCheck.assignmentId === null;\n result.error = {\n type: 'quota',\n message: notProvisioned\n ? `Quota ${usage.quotaName} is not included in this workspace's plan`\n : 'Quota exceeded',\n details: {\n quotaName: usage.quotaName,\n requestedAmount: usage.amount,\n limitLeft: quotaCheck.limitLeft,\n notProvisioned,\n },\n };\n }\n\n return quotaCheck.assignmentId ?? undefined;\n }\n\n /**\n * Record workspace quota usage with the owner.\n */\n private async trackUsage(\n options: TrackOptions,\n usage: ResolvedUsage,\n quotaAssignmentId: string | undefined,\n result: TrackResult\n ): Promise<void> {\n result.usageTracked = await this.usage.trackUsage({\n quotaName: usage.quotaName,\n productId: options.usage?.productId,\n amount: usage.amount,\n description: options.usage?.description?.trim() || `${options.action} ${options.resourceType}`,\n workspaceId: usage.workspaceId,\n userId: options.userId,\n quotaAssignmentId,\n metadata: {\n action: options.action,\n resourceType: options.resourceType,\n ...(options.resourceId ? { resourceId: options.resourceId } : {}),\n },\n });\n }\n\n /**\n * Log successful activity\n */\n private async logSuccessActivity(options: TrackOptions, result: TrackResult, startTime: number): Promise<void> {\n const activityRecord = await this.activity.log({\n userId: options.userId,\n activityType: options.activity?.activityType || this.inferActivityType(options.action),\n resourceType: options.resourceType,\n resourceId: options.resourceId,\n action: options.action,\n status: ActivityStatus.SUCCESS,\n workspaceId: options.workspaceId,\n organizationId: options.organizationId,\n projectId: options.projectId,\n ipAddress: options.activity?.ipAddress,\n userAgent: options.activity?.userAgent,\n metadata: options.activity?.metadata,\n severity: options.activity?.severity || ActivitySeverity.LOW,\n duration: Date.now() - startTime,\n });\n\n result.activityId = activityRecord.id;\n }\n\n /**\n * Log failed activity\n */\n private async logFailedActivity(options: TrackOptions, result: TrackResult, startTime: number): Promise<void> {\n if (options.activity?.enabled === false) {\n return;\n }\n\n try {\n const activityRecord = await this.activity.log({\n userId: options.userId,\n activityType: options.activity?.activityType || this.inferActivityType(options.action),\n resourceType: options.resourceType,\n resourceId: options.resourceId,\n action: options.action,\n status: ActivityStatus.FAILURE,\n workspaceId: options.workspaceId,\n organizationId: options.organizationId,\n projectId: options.projectId,\n ipAddress: options.activity?.ipAddress,\n userAgent: options.activity?.userAgent,\n metadata: options.activity?.metadata,\n severity: ActivitySeverity.HIGH,\n errorMessage: result.error?.message,\n duration: Date.now() - startTime,\n });\n\n result.activityId = activityRecord.id;\n } catch (error) {\n logger.error('[Tracker] Failed to log activity', { error });\n }\n }\n\n /**\n * Send success notification\n */\n private async sendSuccessNotification(options: TrackOptions, result: TrackResult): Promise<void> {\n if (!options.notification?.onSuccess) {\n return;\n }\n\n try {\n const userIds = [options.userId, ...(options.notification.onSuccess.additionalUserIds || [])];\n\n const response = await this.notifications.send({\n title: options.notification.onSuccess.title,\n message: options.notification.onSuccess.message,\n type: options.notification.onSuccess.type || NotificationType.SUCCESS,\n userIds,\n });\n\n result.notificationIds = response.notificationIds;\n } catch (error) {\n logger.error('[Tracker] Failed to send success notification', { error });\n }\n }\n\n /**\n * Send failure notification\n */\n private async sendFailureNotification(options: TrackOptions, result: TrackResult): Promise<void> {\n if (!options.notification?.onFailure) {\n return;\n }\n\n try {\n const userIds = [options.userId, ...(options.notification.onFailure.additionalUserIds || [])];\n\n const response = await this.notifications.send({\n title: options.notification.onFailure.title,\n message: options.notification.onFailure.message,\n type: options.notification.onFailure.type || NotificationType.ERROR,\n userIds,\n });\n\n result.notificationIds = response.notificationIds;\n } catch (error) {\n logger.error('[Tracker] Failed to send failure notification', { error });\n }\n }\n\n /**\n * Infer activity type from action\n */\n private inferActivityType(action: string): ActivityType {\n const actionLower = action.toLowerCase();\n\n if (actionLower.includes('create') || actionLower.includes('add')) return ActivityType.CREATE;\n if (actionLower.includes('update') || actionLower.includes('edit')) return ActivityType.UPDATE;\n if (actionLower.includes('delete') || actionLower.includes('remove')) return ActivityType.DELETE;\n if (actionLower.includes('read') || actionLower.includes('view')) return ActivityType.READ;\n if (actionLower.includes('login')) return ActivityType.LOGIN;\n if (actionLower.includes('logout')) return ActivityType.LOGOUT;\n if (actionLower.includes('export')) return ActivityType.EXPORT;\n if (actionLower.includes('import')) return ActivityType.IMPORT;\n if (actionLower.includes('share')) return ActivityType.SHARE;\n if (actionLower.includes('download')) return ActivityType.DOWNLOAD;\n if (actionLower.includes('upload')) return ActivityType.UPLOAD;\n\n return ActivityType.CUSTOM;\n }\n\n /**\n * Batch track multiple operations\n */\n public async trackBatch(operations: TrackOptions[]): Promise<TrackResult[]> {\n logger.debug('[Tracker] Batch tracking operations', { count: operations.length });\n\n const results = await Promise.all(operations.map((op) => this.track(op)));\n\n logger.info('[Tracker] Batch tracking completed', {\n total: results.length,\n successful: results.filter((r) => r.success).length,\n failed: results.filter((r) => !r.success).length,\n });\n\n return results;\n }\n}\n\n// Export stub implementation for services that don't need full tracking\nexport {\n trackOperation,\n createProductTracker,\n UnifiedTrackerStub,\n trackerStub,\n UNIFIED_TRACKER_CONSTANTS,\n} from './stub.js';\nexport { isTrackedActorType, resolveAssistantSession } from './stub.js';\n// Assistant-session attribution on activity rows (BOFF-9649)\nexport { AI_ASSISTANT_ACTOR_ORIGIN } from '../activity/assistant-session.js';\nexport type { ActorOrigin, AssistantSessionAttribution } from '../activity/assistant-session.js';\nexport type {\n TrackingEvent,\n RbacCheckOptions,\n UsageTrackingOptions,\n ActivityTrackingOptions,\n UnifiedTrackingOptions,\n ProductTracker,\n TrackedActorType,\n} from './stub.js';\n\n// AI-agent activity actions and recorder (BOFF-9684)\nexport { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, trackAgentActivity } from './agent-activity.js';\nexport type { AgentActivityAction, AgentActivityOptions } from './agent-activity.js';\n\n// Opt a resolver out of the mutation-audit backstop row (see server/mutation-audit.ts)\nexport { suppressMutationAudit } from '../activity/explicit-activity-scope.js';\n\n// Re-export UsageMetricType from usage module for convenience\nexport { UsageMetricType } from '../usage/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,yBAAyB,OAAO,OAAO;;CAElD,eAAe;;CAEf,YAAY;;CAEZ,aAAa;;CAEb,iBAAiB;;CAEjB,gBAAgB;AAClB,CAAU;;AAKV,MAAa,+BAA+B;AAE5C,MAAM,kCAAoD,IAAI,IAAyB,CACrF,uBAAuB,YACvB,uBAAuB,cACzB,CAAC;;;;;;;;AA+BD,SAAgB,mBAAmB,SAAiD;CAClF,MAAM,UAAU,QAAQ,WAAW,CAAC,gBAAgB,IAAI,QAAQ,MAAM;CACtE,OAAO,2BAA2B,4BAA4B,SAC5D,eAAe;EACb,eAAe,QAAQ;EACvB,QAAQ,QAAQ;EAChB,WAAW;EACX,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ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I,YAAY,SAAS,QAAQ,GAAG;EACpC,IAAI,YAAY,SAAS,QAAQ,GAAG;EACpC,IAAI,YAAY,SAAS,QAAQ,GAAG;EACpC,IAAI,YAAY,SAAS,OAAO,GAAG;EACnC,IAAI,YAAY,SAAS,UAAU,GAAG;EACtC,IAAI,YAAY,SAAS,QAAQ,GAAG;EAEpC;CACF;;;;CAKA,MAAa,WAAW,YAAoD;EAC1E,OAAO,MAAM,uCAAuC,EAAE,OAAO,WAAW,OAAO,CAAC;EAEhF,MAAM,UAAU,MAAM,QAAQ,IAAI,WAAW,KAAK,OAAO,KAAK,MAAM,EAAE,CAAC,CAAC;EAExE,OAAO,KAAK,sCAAsC;GAChD,OAAO,QAAQ;GACf,YAAY,QAAQ,QAAQ,MAAM,EAAE,OAAO,CAAC,CAAC;GAC7C,QAAQ,QAAQ,QAAQ,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;EAC5C,CAAC;EAED,OAAO;CACT;AACF"}
@@ -0,0 +1,120 @@
1
+ import { t as BurdenoffGraphQLClient } from "../graphql-CUDyhibV.js";
2
+ import { p as SDKContext } from "../index-CTTwo9av.js";
3
+ export type SupportedLanguage = 'en' | 'es' | 'fr' | 'de' | 'it' | 'pt' | 'ru' | 'zh' | 'ja' | 'ko' | 'ar' | 'hi' | 'bn' | 'ta' | 'te' | 'ml';
4
+ export interface TranslationOptions {
5
+ text: string;
6
+ sourceLanguage?: SupportedLanguage;
7
+ targetLanguage: SupportedLanguage;
8
+ context?: string;
9
+ variables?: Record<string, string | number>;
10
+ }
11
+ export interface Translation {
12
+ original: string;
13
+ translated: string;
14
+ sourceLanguage: string;
15
+ targetLanguage: string;
16
+ confidence?: number;
17
+ }
18
+ export interface GetTranslationsOptions {
19
+ keys: string[];
20
+ language: SupportedLanguage;
21
+ namespace?: string;
22
+ fallbackLanguage?: SupportedLanguage;
23
+ }
24
+ export interface TranslationKey {
25
+ key: string;
26
+ value: string;
27
+ language: SupportedLanguage;
28
+ namespace?: string;
29
+ description?: string;
30
+ variables?: string[];
31
+ }
32
+ export interface SetTranslationOptions {
33
+ key: string;
34
+ value: string;
35
+ language: SupportedLanguage;
36
+ namespace?: string;
37
+ description?: string;
38
+ variables?: string[];
39
+ }
40
+ export type TranslationExportFormat = 'JSON' | 'CSV' | 'XLSX' | 'PO' | 'XLIFF';
41
+ export interface ProductTranslationTree {
42
+ [key: string]: string | ProductTranslationTree;
43
+ }
44
+ export interface ExportProductTranslationsOptions {
45
+ productId?: string;
46
+ productName?: string;
47
+ languageCode?: string;
48
+ format?: TranslationExportFormat;
49
+ decodeJson?: boolean;
50
+ }
51
+ export interface ProductTranslationsExportResult {
52
+ format: TranslationExportFormat;
53
+ url: string;
54
+ translations?: Record<string, unknown>;
55
+ }
56
+ export interface UpsertProductTranslationsOptions {
57
+ productId?: string;
58
+ productName?: string;
59
+ languageCode: string;
60
+ translations: Record<string, string> | ProductTranslationTree;
61
+ defaultValues?: Record<string, string> | ProductTranslationTree;
62
+ updateExisting?: boolean;
63
+ publish?: boolean;
64
+ }
65
+ export interface UpsertProductTranslationsResult {
66
+ productId: string;
67
+ languageCode: string;
68
+ keysProcessed: number;
69
+ createdKeys: number;
70
+ updatedKeyDefaults: number;
71
+ createdTranslations: number;
72
+ updatedTranslations: number;
73
+ }
74
+ export declare class TranslationModule {
75
+ private client;
76
+ private context;
77
+ constructor(client: BurdenoffGraphQLClient, context: SDKContext);
78
+ translate(options: TranslationOptions): Promise<Translation>;
79
+ getTranslations(options: GetTranslationsOptions): Promise<Record<string, string>>;
80
+ get(key: string, language: SupportedLanguage, variables?: Record<string, string | number>): Promise<string>;
81
+ setTranslation(options: SetTranslationOptions): Promise<TranslationKey>;
82
+ deleteTranslation(key: string, language: SupportedLanguage, namespace?: string): Promise<boolean>;
83
+ setTranslationsBatch(translations: SetTranslationOptions[]): Promise<TranslationKey[]>;
84
+ getAllTranslations(language: SupportedLanguage, namespace?: string): Promise<TranslationKey[]>;
85
+ detectLanguage(text: string): Promise<{
86
+ language: SupportedLanguage;
87
+ confidence: number;
88
+ }>;
89
+ getSupportedLanguages(): Promise<Array<{
90
+ code: SupportedLanguage;
91
+ name: string;
92
+ nativeName: string;
93
+ }>>;
94
+ importTranslations(language: SupportedLanguage, translations: Record<string, string>, namespace?: string): Promise<{
95
+ imported: number;
96
+ failed: number;
97
+ }>;
98
+ exportTranslations(language: SupportedLanguage, namespace?: string): Promise<Record<string, string>>;
99
+ exportProductTranslations(options: ExportProductTranslationsOptions): Promise<ProductTranslationsExportResult>;
100
+ upsertProductTranslations(options: UpsertProductTranslationsOptions): Promise<UpsertProductTranslationsResult>;
101
+ private flattenTranslationTree;
102
+ private decodeDataUrlJson;
103
+ private resolveProductId;
104
+ private findTranslationKeyByKey;
105
+ private createTranslationKey;
106
+ private updateTranslationKeyDefaultValue;
107
+ private findGlobalTranslation;
108
+ private createLanguageTranslation;
109
+ private updateLanguageTranslation;
110
+ private escapeRegex;
111
+ private interpolate;
112
+ formatPlural(_language: SupportedLanguage, count: number, translations: {
113
+ zero?: string;
114
+ one: string;
115
+ other: string;
116
+ }): string;
117
+ formatDateTime(date: Date | string, language: SupportedLanguage, options?: Intl.DateTimeFormatOptions): string;
118
+ formatNumber(number: number, language: SupportedLanguage, options?: Intl.NumberFormatOptions): string;
119
+ formatCurrency(amount: number, currency: string, language: SupportedLanguage): string;
120
+ }