@burdenoff/be-sdk 2026.1002.1 → 2026.1004.1

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 (58) hide show
  1. package/dist/auth/index.d.ts +3 -3
  2. package/dist/cache/index.d.ts +1 -1
  3. package/dist/cache/index.js +1 -1
  4. package/dist/{chunk-Z32KFAPT.js → chunk-AHEXIONU.js} +4 -4
  5. package/dist/chunk-AHEXIONU.js.map +1 -0
  6. package/dist/{chunk-CPLFP5JK.js → chunk-E5DTAGCA.js} +2 -2
  7. package/dist/chunk-E5DTAGCA.js.map +1 -0
  8. package/dist/{chunk-AIBMTE56.js → chunk-KXY4RSYI.js} +2 -2
  9. package/dist/{chunk-AIBMTE56.js.map → chunk-KXY4RSYI.js.map} +1 -1
  10. package/dist/{chunk-TYLVMGOP.js → chunk-L22J3BYR.js} +3 -3
  11. package/dist/{chunk-TYLVMGOP.js.map → chunk-L22J3BYR.js.map} +1 -1
  12. package/dist/{chunk-RDSYCRHC.js → chunk-NCC5UN3L.js} +13 -12
  13. package/dist/chunk-NCC5UN3L.js.map +1 -0
  14. package/dist/{chunk-G6XPO5D7.js → chunk-OZTLACXT.js} +3 -3
  15. package/dist/{chunk-G6XPO5D7.js.map → chunk-OZTLACXT.js.map} +1 -1
  16. package/dist/{chunk-AFLPUWVI.js → chunk-PVNNVIIA.js} +40 -12
  17. package/dist/chunk-PVNNVIIA.js.map +1 -0
  18. package/dist/{chunk-VKYGGS2F.js → chunk-RFXAHMY4.js} +3 -3
  19. package/dist/{chunk-VKYGGS2F.js.map → chunk-RFXAHMY4.js.map} +1 -1
  20. package/dist/event-queue/index.d.ts +3 -3
  21. package/dist/export/index.js +3 -3
  22. package/dist/feature-flags/index.d.ts +2 -2
  23. package/dist/gateway/index.js +2 -2
  24. package/dist/gateway/security/index.js +1 -1
  25. package/dist/graph/index.d.ts +3 -3
  26. package/dist/{graphql-Dxxpbzr3.d.ts → graphql-AaLJfGzz.d.ts} +1 -1
  27. package/dist/{index-hWpL68Vx.d.ts → index-BKafOO7G.d.ts} +1 -1
  28. package/dist/{index-MsCFY9Ht.d.ts → index-BSlifT21.d.ts} +3 -3
  29. package/dist/{index-B8viwwDM.d.ts → index-CfRZtB99.d.ts} +1 -1
  30. package/dist/{index-BCelo6F3.d.ts → index-Cx5I3ydM.d.ts} +1 -0
  31. package/dist/{index-Cpr38QiE.d.ts → index-DMlr5R6K.d.ts} +2 -2
  32. package/dist/{index-By4Rxoj1.d.ts → index-Drvw0QPe.d.ts} +1 -1
  33. package/dist/{index-BLWIKXin.d.ts → index-Dvv6irk0.d.ts} +1 -1
  34. package/dist/{index-CQGCVFmI.d.ts → index-INu1AlYt.d.ts} +2 -2
  35. package/dist/{index-CUeQCuE5.d.ts → index-_dsCeVat.d.ts} +2 -2
  36. package/dist/index.d.ts +16 -16
  37. package/dist/index.js +10 -10
  38. package/dist/init/index.js +3 -3
  39. package/dist/instrumentation/index.d.ts +3 -3
  40. package/dist/instrumentation/index.js +1 -1
  41. package/dist/logger/index.d.ts +2 -2
  42. package/dist/notifications/index.d.ts +3 -3
  43. package/dist/rbac/index.d.ts +2 -2
  44. package/dist/resource-caps/index.d.ts +2 -2
  45. package/dist/server/index.d.ts +2 -2
  46. package/dist/server/index.js +74 -1
  47. package/dist/server/index.js.map +1 -1
  48. package/dist/telemetry/index.d.ts +4 -4
  49. package/dist/telemetry/index.js +2 -2
  50. package/dist/tracker/index.d.ts +4 -4
  51. package/dist/tracker/index.js +1 -1
  52. package/dist/{types-BAHkj1GE.d.ts → types-Biv0uaJk.d.ts} +17 -1
  53. package/dist/validation/index.js +1 -1
  54. package/package.json +47 -39
  55. package/dist/chunk-AFLPUWVI.js.map +0 -1
  56. package/dist/chunk-CPLFP5JK.js.map +0 -1
  57. package/dist/chunk-RDSYCRHC.js.map +0 -1
  58. package/dist/chunk-Z32KFAPT.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { B as BurdenoffGraphQLClient } from '../graphql-Dxxpbzr3.js';
2
- import { S as SDKContext } from '../index-B8viwwDM.js';
1
+ import { B as BurdenoffGraphQLClient } from '../graphql-AaLJfGzz.js';
2
+ import { a as SDKContext } from '../index-CfRZtB99.js';
3
3
  import { Plugin } from '@envelop/core';
4
4
  import { S as ServiceLayer } from '../layer-GNAVXBMf.js';
5
5
  import 'graphql-request';
@@ -1,7 +1,7 @@
1
1
  import { GraphQLError } from 'graphql';
2
- import { B as BurdenoffGraphQLClient } from '../graphql-Dxxpbzr3.js';
2
+ import { B as BurdenoffGraphQLClient } from '../graphql-AaLJfGzz.js';
3
3
  import 'graphql-request';
4
- import '../index-B8viwwDM.js';
4
+ import '../index-CfRZtB99.js';
5
5
  import '../layer-GNAVXBMf.js';
6
6
 
7
7
  type ResourceName = 'workspace' | 'workspaceMember' | 'sandbox' | 'vibe' | 'agent' | 'conversation' | 'message' | 'tag' | 'file' | 'group' | 'calendar' | 'scheduledTask' | 'form' | 'apiKey' | 'webhook';
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-BAHkj1GE.js';
2
- export { C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, m as WspaceGraphQLContext } from '../types-BAHkj1GE.js';
1
+ import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-Biv0uaJk.js';
2
+ export { A as ActorProvenance, C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, V as VerifiedDelegationContext, m as WspaceGraphQLContext } from '../types-Biv0uaJk.js';
3
3
  import * as jose from 'jose';
4
4
  import { VerifyOptions } from 'jsonwebtoken';
5
5
  import { I as I18n } from '../i18n-DrdPTann.js';
@@ -123,7 +123,7 @@ __name(verifyJWT, "verifyJWT");
123
123
  async function decodeJWT(token) {
124
124
  try {
125
125
  const joseLib = await getJose();
126
- return await joseLib.decodeJwt(token);
126
+ return joseLib.decodeJwt(token);
127
127
  } catch {
128
128
  return null;
129
129
  }
@@ -184,6 +184,70 @@ function tenantCheck(context) {
184
184
  return context.tenant.id;
185
185
  }
186
186
  __name(tenantCheck, "tenantCheck");
187
+
188
+ // src/server/verified-delegation.ts
189
+ function object(value) {
190
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
191
+ }
192
+ __name(object, "object");
193
+ function identifier(value) {
194
+ return typeof value === "string" && value["length"] > 0 && value["length"] <= 200 && value["trim"]() === value && Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127);
195
+ }
196
+ __name(identifier, "identifier");
197
+ function list(value) {
198
+ return Array.isArray(value) && value["length"] <= 1e3 && value["every"](identifier);
199
+ }
200
+ __name(list, "list");
201
+ function instant(value) {
202
+ if (typeof value !== "string") return null;
203
+ const time = Date.parse(value);
204
+ return Number.isFinite(time) && new Date(time).toISOString() === value ? new Date(time) : null;
205
+ }
206
+ __name(instant, "instant");
207
+ function decodeVerifiedDelegation(header, actor, workspaceId, trustedGateway, now = Date.now()) {
208
+ if (!trustedGateway || !actor || actor.provenance !== "delegated" || ![
209
+ "user",
210
+ "super_admin"
211
+ ].includes(actor.type) || header === void 0) return void 0;
212
+ const invalid = /* @__PURE__ */ __name(() => new Error("Invalid verified delegation context"), "invalid");
213
+ let raw;
214
+ try {
215
+ raw = JSON.parse(header);
216
+ } catch {
217
+ throw invalid();
218
+ }
219
+ const value = object(raw);
220
+ const tokenExpiresAt = instant(value?.["tokenExpiresAt"]);
221
+ if (!value || !identifier(value["representedUserId"]) || value["representedUserId"] !== actor.id || !identifier(value["originatingAppId"]) || !identifier(value["delegationId"]) || !list(value["scopes"]) || !list(value["allowedWorkspaceIds"]) || !tokenExpiresAt || tokenExpiresAt.getTime() <= now || workspaceId && value["allowedWorkspaceIds"].length > 0 && !value["allowedWorkspaceIds"].includes(workspaceId)) throw invalid();
222
+ let consent = null;
223
+ if (value["consent"] !== null) {
224
+ const facts = object(value["consent"]);
225
+ const grantedAt = instant(facts?.["grantedAt"]);
226
+ const expiresAt = facts?.["expiresAt"] === null ? null : instant(facts?.["expiresAt"]);
227
+ if (!facts || !identifier(facts["grantedBy"]) || !grantedAt || grantedAt.getTime() > now || facts["expiresAt"] !== null && (!expiresAt || expiresAt.getTime() <= grantedAt.getTime() || tokenExpiresAt.getTime() > expiresAt.getTime())) throw invalid();
228
+ consent = {
229
+ grantedBy: facts["grantedBy"],
230
+ grantedAt,
231
+ expiresAt
232
+ };
233
+ }
234
+ return {
235
+ representedUserId: value["representedUserId"],
236
+ originatingAppId: value["originatingAppId"],
237
+ delegationId: value["delegationId"],
238
+ scopes: [
239
+ ...value["scopes"]
240
+ ],
241
+ allowedWorkspaceIds: [
242
+ ...value["allowedWorkspaceIds"]
243
+ ],
244
+ tokenExpiresAt,
245
+ consent
246
+ };
247
+ }
248
+ __name(decodeVerifiedDelegation, "decodeVerifiedDelegation");
249
+
250
+ // src/server/context.ts
187
251
  var contextOptions = null;
188
252
  function configureContext(options) {
189
253
  contextOptions = options;
@@ -227,6 +291,11 @@ function extractTracking(request) {
227
291
  };
228
292
  }
229
293
  __name(extractTracking, "extractTracking");
294
+ function actorProvenance(request) {
295
+ const value = getHeader(request, "x-verified-actor-provenance");
296
+ return value === "direct_human" || value === "delegated" || value === "non_human" ? value : "unknown";
297
+ }
298
+ __name(actorProvenance, "actorProvenance");
230
299
  async function extractActor(request) {
231
300
  const actorId = getHeader(request, "x-actor-id");
232
301
  if (actorId && shouldTrustActorHeaders(request)) {
@@ -236,6 +305,7 @@ async function extractActor(request) {
236
305
  return {
237
306
  id: actorId,
238
307
  type: actorType,
308
+ provenance: actorProvenance(request),
239
309
  workspace_id: getHeader(request, "x-workspace-id"),
240
310
  tenant_id: getHeader(request, "x-tenant-id"),
241
311
  org_id: getHeader(request, "x-org-id") || getHeader(request, "x-organization-id"),
@@ -259,6 +329,7 @@ async function extractActor(request) {
259
329
  return {
260
330
  id: payload.id,
261
331
  type: "user",
332
+ provenance: "unknown",
262
333
  workspace_id: payload.workspace_id
263
334
  };
264
335
  } catch (error) {
@@ -363,6 +434,7 @@ async function buildContext(request) {
363
434
  const product = extractProduct(request);
364
435
  const tracking = extractTracking(request);
365
436
  const consentContext = extractConsentContext(request);
437
+ const verifiedDelegation = decodeVerifiedDelegation(getHeader(request, "x-verified-delegation"), actor, workspace?.id, shouldTrustActorHeaders(request));
366
438
  let i18n;
367
439
  if (contextOptions.i18n) {
368
440
  i18n = contextOptions.i18n.createContextFromRequest(request);
@@ -416,6 +488,7 @@ async function buildContext(request) {
416
488
  product,
417
489
  tracking,
418
490
  consentContext: consentContext || void 0,
491
+ verifiedDelegation,
419
492
  onBehalfOf: onBehalfOf || actor?.id || "",
420
493
  db: contextOptions.getDb(),
421
494
  i18n,