@burdenoff/be-sdk 2026.1111.1 → 2026.1113.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 (83) hide show
  1. package/dist/activity/index.d.ts +2 -2
  2. package/dist/ai-credits/index.d.ts +1 -1
  3. package/dist/auth/index.d.ts +1 -1
  4. package/dist/bootstrap/index.d.ts +1 -1
  5. package/dist/bun-runtime-metrics-CPy5D6NT.js +58 -0
  6. package/dist/bun-runtime-metrics-CPy5D6NT.js.map +1 -0
  7. package/dist/cache/index.d.ts +1 -1
  8. package/dist/context/index.d.ts +1 -1
  9. package/dist/event-queue/index.d.ts +1 -1
  10. package/dist/export/index.d.ts +1 -1
  11. package/dist/export/index.js +1 -1
  12. package/dist/{export-DJXE3Osa.js → export-lqKewsuF.js} +2 -2
  13. package/dist/{export-DJXE3Osa.js.map → export-lqKewsuF.js.map} +1 -1
  14. package/dist/files/index.d.ts +1 -1
  15. package/dist/gateway/index.d.ts +3 -3
  16. package/dist/gateway/index.js +2 -2
  17. package/dist/gateway-2en8Gx_a.js +274 -0
  18. package/dist/gateway-2en8Gx_a.js.map +1 -0
  19. package/dist/graph/index.d.ts +1 -1
  20. package/dist/{graphql-CUDyhibV.d.ts → graphql-C8jKLLel.d.ts} +1 -1
  21. package/dist/{index-B2LCaK0R.d.ts → index-479i3w77.d.ts} +1 -1
  22. package/dist/{index-BGzMYJsm.d.ts → index-8pUSoT85.d.ts} +1 -1
  23. package/dist/{index-ADmsX0BI.d.ts → index-9MJVKzWA.d.ts} +3 -3
  24. package/dist/{index-FbXPfen7.d.ts → index-BJwHEzpN.d.ts} +1 -1
  25. package/dist/{index-CTTwo9av.d.ts → index-BTaQMEgB.d.ts} +1 -1
  26. package/dist/{index-CDOqxSIi.d.ts → index-Base-sg5.d.ts} +1 -1
  27. package/dist/{index-C_GXXF32.d.ts → index-Bh6W5JO4.d.ts} +3 -3
  28. package/dist/{index-BeVtqGO-.d.ts → index-Bwn5Z1h-.d.ts} +1 -1
  29. package/dist/{index-FRRaa6h2.d.ts → index-CEtULfb_.d.ts} +3 -3
  30. package/dist/{index-DqbGqfAy.d.ts → index-Cwu5Mpji.d.ts} +1 -1
  31. package/dist/{index-CaM9JUcc.d.ts → index-DSynXDRD.d.ts} +1 -1
  32. package/dist/{index-CVCyKzhB.d.ts → index-DWER4-_x.d.ts} +3 -3
  33. package/dist/{index-cmR9k9ga.d.ts → index-DhFP_AIB.d.ts} +1 -1
  34. package/dist/{index-zd_NPGJo.d.ts → index-DqpCL9kD.d.ts} +4 -4
  35. package/dist/{index-U_tu3zUl.d.ts → index-Dw_0wE4q.d.ts} +2 -2
  36. package/dist/{index-3KOZ1zN9.d.ts → index-HeUeEsMU.d.ts} +1 -1
  37. package/dist/{index-Cot73bdh.d.ts → index-KlrnELrN.d.ts} +1 -1
  38. package/dist/{index-MArCb8Aq.d.ts → index-SvWwlTUC.d.ts} +1 -1
  39. package/dist/{index-CHwMhK6v.d.ts → index-YMGOJins.d.ts} +2 -2
  40. package/dist/index-oJMtR3nl.d.ts +88 -0
  41. package/dist/index.d.ts +21 -21
  42. package/dist/index.js +5 -5
  43. package/dist/init/index.d.ts +1 -1
  44. package/dist/init/index.js +1 -1
  45. package/dist/{init-CQPFmOOe.js → init-D814LeLF.js} +2 -2
  46. package/dist/{init-CQPFmOOe.js.map → init-D814LeLF.js.map} +1 -1
  47. package/dist/instrumentation/index.d.ts +2 -2
  48. package/dist/layer/index.d.ts +2 -2
  49. package/dist/layer-Bcix-WCl.js.map +1 -1
  50. package/dist/{layer-BZBZZWeV.d.ts → layer-C0zxAUgR.d.ts} +1 -0
  51. package/dist/logger/index.d.ts +1 -1
  52. package/dist/notifications/index.d.ts +1 -1
  53. package/dist/payments/index.d.ts +2 -2
  54. package/dist/rbac/index.d.ts +1 -1
  55. package/dist/resource-caps/index.d.ts +1 -1
  56. package/dist/{sdk-B62itAH1.js → sdk-DqIqX-Ue.js} +33 -2
  57. package/dist/sdk-DqIqX-Ue.js.map +1 -0
  58. package/dist/search/index.d.ts +2 -2
  59. package/dist/security/index.d.ts +1 -1
  60. package/dist/security/rate-limit/index.d.ts +1 -1
  61. package/dist/server/index.js +2 -3
  62. package/dist/server/index.js.map +1 -1
  63. package/dist/tags/index.d.ts +1 -1
  64. package/dist/telemetry/index.d.ts +2 -2
  65. package/dist/telemetry/index.js +8 -4
  66. package/dist/telemetry/index.js.map +1 -1
  67. package/dist/temporal/index.d.ts +1 -1
  68. package/dist/tracker/index.d.ts +2 -2
  69. package/dist/tracker/index.js +2 -2
  70. package/dist/{tracker-PQztSlhJ.js → tracker-Cl3cGKe-.js} +2 -2
  71. package/dist/{tracker-PQztSlhJ.js.map → tracker-Cl3cGKe-.js.map} +1 -1
  72. package/dist/translation/index.d.ts +2 -2
  73. package/dist/types/index.d.ts +2 -2
  74. package/dist/{types-C6EKaS3V.d.ts → types-gJ9Qqi9E.d.ts} +1 -1
  75. package/dist/usage/index.d.ts +1 -1
  76. package/dist/usage/index.js +1 -1
  77. package/dist/{usage-BRqVP3CJ.js → usage-ygkKsxdd.js} +2 -2
  78. package/dist/{usage-BRqVP3CJ.js.map → usage-ygkKsxdd.js.map} +1 -1
  79. package/package.json +1 -1
  80. package/dist/gateway-ByVo-n37.js +0 -50
  81. package/dist/gateway-ByVo-n37.js.map +0 -1
  82. package/dist/index-YOShAwkq.d.ts +0 -45
  83. package/dist/sdk-B62itAH1.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { t as BurdenoffGraphQLClient } from "../graphql-CUDyhibV.js";
2
- import { m as SDKError, p as SDKContext } from "../index-CTTwo9av.js";
1
+ import { t as BurdenoffGraphQLClient } from "../graphql-C8jKLLel.js";
2
+ import { m as SDKError, p as SDKContext } from "../index-BTaQMEgB.js";
3
3
  export declare enum ActivityType {
4
4
  CREATE = "create",
5
5
  READ = "read",
@@ -1,2 +1,2 @@
1
- import { C as AiCreditPricingTransport, D as WorkspaceQuotaUsage, E as AiTokenUsageReport, S as AiCreditLogger, T as AiCreditSkipReason, _ as AiCreditChargeInput, a as AiCreditInputErrorCode, b as AiCreditGate, c as AiTokenUsageValidationError, d as aiCreditQuotaName, f as defaultAiCreditHashPrefix, g as AiCreditChargeGuard, h as AiCreditAllowance, i as AiCreditInputError, l as AiTokenUsageViolation, m as validateAiTokenUsage, n as AiCreditMeter, o as isAiCreditInputError, p as encodeAiCreditHashComponent, r as AiCreditMeterOptions, s as AI_CREDIT_MAX_TOKENS_PER_REPORT, u as aiCreditIdempotencyHash, v as AiCreditChargeResult, w as AiCreditQuoteInput, x as AiCreditGuardVerdict, y as AiCreditFetch } from "../index-FbXPfen7.js";
1
+ import { C as AiCreditPricingTransport, D as WorkspaceQuotaUsage, E as AiTokenUsageReport, S as AiCreditLogger, T as AiCreditSkipReason, _ as AiCreditChargeInput, a as AiCreditInputErrorCode, b as AiCreditGate, c as AiTokenUsageValidationError, d as aiCreditQuotaName, f as defaultAiCreditHashPrefix, g as AiCreditChargeGuard, h as AiCreditAllowance, i as AiCreditInputError, l as AiTokenUsageViolation, m as validateAiTokenUsage, n as AiCreditMeter, o as isAiCreditInputError, p as encodeAiCreditHashComponent, r as AiCreditMeterOptions, s as AI_CREDIT_MAX_TOKENS_PER_REPORT, u as aiCreditIdempotencyHash, v as AiCreditChargeResult, w as AiCreditQuoteInput, x as AiCreditGuardVerdict, y as AiCreditFetch } from "../index-BJwHEzpN.js";
2
2
  export { AI_CREDIT_MAX_TOKENS_PER_REPORT, type AiCreditAllowance, type AiCreditChargeGuard, type AiCreditChargeInput, type AiCreditChargeResult, type AiCreditFetch, type AiCreditGate, type AiCreditGuardVerdict, AiCreditInputError, type AiCreditInputErrorCode, type AiCreditLogger, AiCreditMeter, type AiCreditMeterOptions, type AiCreditPricingTransport, type AiCreditQuoteInput, type AiCreditSkipReason, type AiTokenUsageReport, type AiTokenUsageValidationError, type AiTokenUsageViolation, type WorkspaceQuotaUsage, aiCreditIdempotencyHash, aiCreditQuotaName, defaultAiCreditHashPrefix, encodeAiCreditHashComponent, isAiCreditInputError, validateAiTokenUsage };
@@ -1,2 +1,2 @@
1
- import { a as AuthCookieHelper, i as VerifyTokenResult, n as RefreshTokenResult, o as CookieOptions, r as TokenPayload, t as AuthModule } from "../index-CHwMhK6v.js";
1
+ import { a as AuthCookieHelper, i as VerifyTokenResult, n as RefreshTokenResult, o as CookieOptions, r as TokenPayload, t as AuthModule } from "../index-YMGOJins.js";
2
2
  export { AuthCookieHelper, AuthModule, CookieOptions, RefreshTokenResult, TokenPayload, VerifyTokenResult };
@@ -1,5 +1,5 @@
1
1
  import { DatabaseConfig } from "../database/index.js";
2
- import { f as SDKConfig, p as SDKContext } from "../index-CTTwo9av.js";
2
+ import { f as SDKConfig, p as SDKContext } from "../index-BTaQMEgB.js";
3
3
  type HeaderValue = string | string[] | undefined;
4
4
  export interface BootstrapConfig extends SDKConfig {
5
5
  database?: DatabaseConfig;
@@ -0,0 +1,58 @@
1
+ // src/telemetry/bun-runtime-metrics.ts
2
+ /**
3
+ * Runtime metrics that stall a Bun process (BOFF-12287).
4
+ *
5
+ * `v8.getHeapStatistics()` and `v8.getHeapSpaceStatistics()` are cheap under
6
+ * Node. Under Bun 1.4 they walk the whole JavaScriptCore heap synchronously:
7
+ * about 0.44 s per call on a 3M-object heap, during which the process serves
8
+ * nothing. Two collectors that be-sdk services load call one of them on a
9
+ * timer, so every Bun 1.4 service paid a recurring block sized to its heap:
10
+ *
11
+ * - prom-client's default `nodejs_heap_space_size_*_bytes` gauges, on every
12
+ * Prometheus scrape. Bun 1.3 threw `ERR_NOT_IMPLEMENTED` and prom-client
13
+ * skipped them; Bun 1.4 implements the call, so from the Bun 1.4.4 upgrade
14
+ * on the scrape itself became the block (wspace-int-gateway: 0.01 s →
15
+ * 0.5–0.76 s per scrape). Handled here.
16
+ * - the OpenTelemetry `runtime-node` instrumentation, on every 60 s OTLP
17
+ * metric export. Handled in `sdk.ts` (`autoInstrumentationConfig`).
18
+ *
19
+ * Heap size stays visible through prom-client's `nodejs_heap_size_*_bytes`,
20
+ * which reads `process.memoryUsage()`, and event-loop lag through
21
+ * `nodejs_eventloop_lag_*`. No dashboard or alert reads the dropped series.
22
+ */
23
+ /** True when the process runs on Bun (also inside a `bun build --compile` binary). */
24
+ function isBunRuntime() {
25
+ return typeof process.versions["bun"] === "string";
26
+ }
27
+ /**
28
+ * prom-client default metrics that are not served under Bun. The `total` gauge
29
+ * carries the collect callback that calls `v8.getHeapSpaceStatistics()`; the
30
+ * other two are only filled by it, so all three go.
31
+ */
32
+ const BUN_HEAP_WALK_DEFAULT_METRICS = [
33
+ "nodejs_heap_space_size_total_bytes",
34
+ "nodejs_heap_space_size_used_bytes",
35
+ "nodejs_heap_space_size_available_bytes"
36
+ ];
37
+ /**
38
+ * Registers prom-client's default metrics on `prom.register` and, under Bun,
39
+ * removes the heap-space gauges again.
40
+ *
41
+ * Safe to call on every scrape: prom-client throws on the first metric name
42
+ * that is already registered, before it reaches the heap-space gauges, and the
43
+ * removal is a map delete. Calling it again also removes the gauges when the
44
+ * service registered the default metrics on the same registry itself.
45
+ *
46
+ * prom-client probes `v8.getHeapSpaceStatistics()` once when it registers the
47
+ * defaults, so a Bun process still pays one heap walk, on its first scrape.
48
+ */
49
+ function collectPromDefaultMetrics(prom, bun = isBunRuntime()) {
50
+ try {
51
+ prom.collectDefaultMetrics({ register: prom.register });
52
+ } catch {}
53
+ if (!bun) return;
54
+ for (const name of BUN_HEAP_WALK_DEFAULT_METRICS) prom.register.removeSingleMetric(name);
55
+ }
56
+
57
+ export { isBunRuntime as n, collectPromDefaultMetrics as t };
58
+ //# sourceMappingURL=bun-runtime-metrics-CPy5D6NT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-runtime-metrics-CPy5D6NT.js","names":[],"sources":["../src/telemetry/bun-runtime-metrics.ts"],"sourcesContent":["/**\n * Runtime metrics that stall a Bun process (BOFF-12287).\n *\n * `v8.getHeapStatistics()` and `v8.getHeapSpaceStatistics()` are cheap under\n * Node. Under Bun 1.4 they walk the whole JavaScriptCore heap synchronously:\n * about 0.44 s per call on a 3M-object heap, during which the process serves\n * nothing. Two collectors that be-sdk services load call one of them on a\n * timer, so every Bun 1.4 service paid a recurring block sized to its heap:\n *\n * - prom-client's default `nodejs_heap_space_size_*_bytes` gauges, on every\n * Prometheus scrape. Bun 1.3 threw `ERR_NOT_IMPLEMENTED` and prom-client\n * skipped them; Bun 1.4 implements the call, so from the Bun 1.4.4 upgrade\n * on the scrape itself became the block (wspace-int-gateway: 0.01 s →\n * 0.5–0.76 s per scrape). Handled here.\n * - the OpenTelemetry `runtime-node` instrumentation, on every 60 s OTLP\n * metric export. Handled in `sdk.ts` (`autoInstrumentationConfig`).\n *\n * Heap size stays visible through prom-client's `nodejs_heap_size_*_bytes`,\n * which reads `process.memoryUsage()`, and event-loop lag through\n * `nodejs_eventloop_lag_*`. No dashboard or alert reads the dropped series.\n */\n\n/** True when the process runs on Bun (also inside a `bun build --compile` binary). */\nexport function isBunRuntime(): boolean {\n return typeof process.versions['bun'] === 'string';\n}\n\n/**\n * prom-client default metrics that are not served under Bun. The `total` gauge\n * carries the collect callback that calls `v8.getHeapSpaceStatistics()`; the\n * other two are only filled by it, so all three go.\n */\nexport const BUN_HEAP_WALK_DEFAULT_METRICS: readonly string[] = [\n 'nodejs_heap_space_size_total_bytes',\n 'nodejs_heap_space_size_used_bytes',\n 'nodejs_heap_space_size_available_bytes',\n];\n\n/** The part of the `prom-client` module that {@link collectPromDefaultMetrics} uses. */\nexport interface PromDefaultMetricsClient {\n register: { removeSingleMetric: (name: string) => void };\n collectDefaultMetrics: (opts?: Record<string, unknown>) => void;\n}\n\n/**\n * Registers prom-client's default metrics on `prom.register` and, under Bun,\n * removes the heap-space gauges again.\n *\n * Safe to call on every scrape: prom-client throws on the first metric name\n * that is already registered, before it reaches the heap-space gauges, and the\n * removal is a map delete. Calling it again also removes the gauges when the\n * service registered the default metrics on the same registry itself.\n *\n * prom-client probes `v8.getHeapSpaceStatistics()` once when it registers the\n * defaults, so a Bun process still pays one heap walk, on its first scrape.\n */\nexport function collectPromDefaultMetrics(prom: PromDefaultMetricsClient, bun: boolean = isBunRuntime()): void {\n try {\n prom.collectDefaultMetrics({ register: prom.register });\n } catch {\n // Already registered on this registry: prom-client rejects duplicate names.\n }\n if (!bun) return;\n for (const name of BUN_HEAP_WALK_DEFAULT_METRICS) prom.register.removeSingleMetric(name);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,eAAwB;CACtC,OAAO,OAAO,QAAQ,SAAS,WAAW;AAC5C;;;;;;AAOA,MAAa,gCAAmD;CAC9D;CACA;CACA;AACF;;;;;;;;;;;;;AAoBA,SAAgB,0BAA0B,MAAgC,MAAe,aAAa,GAAS;CAC7G,IAAI;EACF,KAAK,sBAAsB,EAAE,UAAU,KAAK,SAAS,CAAC;CACxD,QAAQ,CAER;CACA,IAAI,CAAC,KAAK;CACV,KAAK,MAAM,QAAQ,+BAA+B,KAAK,SAAS,mBAAmB,IAAI;AACzF"}
@@ -1,2 +1,2 @@
1
- import { C as CacheHealthCheckResult, D as MemcachedCacheConfig, E as CacheStatistics, O as MemoryCacheConfig, S as CacheConfig, T as CacheProviderTypeLiteral, _ as CacheEntry, a as getValkeyClient, b as PatternResult, c as ValkeyGlideConfig, d as assertCacheEndpointConfigured, f as warnOnLayerDefaultEndpoint, g as BatchCacheOptions, h as ICache, i as getCache, k as ValkeyCacheConfig, l as ValkeyGlideProvider, m as ICacheProvider, n as closeAllCaches, p as CacheFactory, r as createCache, s as MemoryCacheProvider, t as ValkeyGlideClient, u as CacheEndpointCheck, v as CacheOptions, w as CacheProviderType, x as BaseCacheConfig, y as PatternOptions } from "../index-MArCb8Aq.js";
1
+ import { C as CacheHealthCheckResult, D as MemcachedCacheConfig, E as CacheStatistics, O as MemoryCacheConfig, S as CacheConfig, T as CacheProviderTypeLiteral, _ as CacheEntry, a as getValkeyClient, b as PatternResult, c as ValkeyGlideConfig, d as assertCacheEndpointConfigured, f as warnOnLayerDefaultEndpoint, g as BatchCacheOptions, h as ICache, i as getCache, k as ValkeyCacheConfig, l as ValkeyGlideProvider, m as ICacheProvider, n as closeAllCaches, p as CacheFactory, r as createCache, s as MemoryCacheProvider, t as ValkeyGlideClient, u as CacheEndpointCheck, v as CacheOptions, w as CacheProviderType, x as BaseCacheConfig, y as PatternOptions } from "../index-SvWwlTUC.js";
2
2
  export { type BaseCacheConfig, type BatchCacheOptions, type CacheConfig, type CacheEndpointCheck, type CacheEntry, CacheFactory, type CacheHealthCheckResult, type CacheOptions, CacheProviderType, type CacheProviderTypeLiteral, type CacheStatistics, type ICache, type ICacheProvider, type MemcachedCacheConfig, type MemoryCacheConfig, MemoryCacheProvider, type PatternOptions, type PatternResult, type ValkeyCacheConfig, ValkeyGlideClient, type ValkeyGlideConfig, ValkeyGlideProvider, assertCacheEndpointConfigured, closeAllCaches, createCache, getCache, getValkeyClient, warnOnLayerDefaultEndpoint };
@@ -1,4 +1,4 @@
1
- import { p as SDKContext } from "../index-CTTwo9av.js";
1
+ import { p as SDKContext } from "../index-BTaQMEgB.js";
2
2
  export declare class ContextManager {
3
3
  static getContext(): SDKContext | undefined;
4
4
  static setContext(context: SDKContext): void;
@@ -1,2 +1,2 @@
1
- import { $ as WorkspaceMemberRemovedPayload, $t as IEventQueue, A as OrganizationDeletedPayload, At as EntityEventType, B as TaxonomyPublishMetadata, Bt as createGraphEventEmitter$1, C as EventsManagerSubscribeOptions, Ct as SubscribeOptions, D as EventSpec, Dt as ModuleEventsService, E as EVENT_TAXONOMY_BRAND, Et as ModuleEventsConfig, F as TaxonomyEventKind, Ft as resetGraphEventEmitter, G as VibecontrolsSessionStartedPayload, Gt as RedisStreamsEventConsumer, H as VibecontrolsAgentConnectedPayload, Ht as createMemoryPublisher, I as TaxonomyEventLayer, It as MemoryEventBus, J as WorkflowRunFailedPayload, Jt as EventQueueFactory, K as WSPACE_GRAPH_EVENTS_STREAM, Kt as RedisStreamsEventPublisher, L as TaxonomyEventPii, Lt as MemoryEventConsumer, M as PublishableEventName, Mt as GraphEventEmitterImpl, N as REFERENCE_PRODUCT_EVENT_TAXONOMY, Nt as createGraphEventEmitter, O as EventTaxonomy, Ot as createModuleEventsService, P as SubscriptionChangedPayload, Pt as getGraphEventEmitter, Q as WorkspaceMemberAddedPayload, Qt as PublishOptions, R as TaxonomyEventStatus, Rt as MemoryEventPublisher, S as EventsManagerStreamRoute, St as StreamInfo, T as DefinedEventTaxonomy, Tt as ModuleEventPayload, U as VibecontrolsAgentDisconnectedPayload, Ut as dlqKey, V as UserDeletedPayload, Vt as createMemoryConsumer, W as VibecontrolsSessionEndedPayload, Wt as streamKey, X as WorkspaceCreatedPayload, Xt as ISubscription, Y as WorkflowRunStartedPayload, Yt as IEventConsumer, Z as WorkspaceDeletedPayload, Zt as IEventPublisher, _ as EventsManager, _t as EventMessage$1, a as LifecycleEventContext, an as QueueType, at as publishTaxonomyEvent, b as EventsManagerOptions, bt as PublishEventOptions, c as OrganizationDeletedFact, cn as EventHandler, ct as EVENT_STREAMS_URL_ENV_KEYS, d as buildConsumerGroupName, dn as StreamConfig, dt as resolveEventStreamsUrl, en as BaseQueueConfig, et as WorkspaceMemberRoleUpdatedPayload, f as createLifecycleConsumer, fn as SubscriptionOptions, ft as resolveEventStreamsUrlSource, g as parseWorkspaceMemberRemoved, gt as createPublisher, h as parseWorkspaceDeletedStream, ht as createConsumer, i as LifecycleConsumerOptions, in as QueueStatistics, it as mergeEventTaxonomies, j as PLATFORM_EVENT_TAXONOMY, jt as GraphEventEmitter, k as GraphEntityEventPayload, kt as EntityEventRbacMetadata, l as WorkspaceDeletedFact, ln as EventMessage, lt as GRAPH_EVENTS_URL_ENV_KEYS, m as parseWorkspaceDeletedGraph, mt as resolveGraphEventsUrlSource, n as LIFECYCLE_SUBJECTS, nn as EventQueueHealthCheckResult, nt as eventSpec, o as LifecycleEventSource, on as AcknowledgeableEvent, ot as taxonomyEventNames, p as parseOrganizationDeleted, pt as resolveGraphEventsUrl, q as WorkflowRunCompletedPayload, qt as RedisStreamsConnection, r as LifecycleConsumer, rn as PublisherConfig, rt as isDefinedEventTaxonomy, s as LifecycleHandlers, sn as ConsumerOptions, st as taxonomyNameViolation, tn as ConsumerConfig, tt as defineEventTaxonomy, u as WorkspaceMemberRemovedFact, un as EventMetadata, ut as eventKeyScopeForUrl, v as EventsManagerHandler, vt as EventPriority, w as createEventsManagerSingleton, wt as BulkEventPayload, x as EventsManagerSingleton, xt as PublishResult, y as EventsManagerMessage, yt as EventsModule, z as TaxonomyPayload, zt as MemoryEventQueue } from "../index-FRRaa6h2.js";
1
+ import { $ as WorkspaceMemberRemovedPayload, $t as IEventQueue, A as OrganizationDeletedPayload, At as EntityEventType, B as TaxonomyPublishMetadata, Bt as createGraphEventEmitter$1, C as EventsManagerSubscribeOptions, Ct as SubscribeOptions, D as EventSpec, Dt as ModuleEventsService, E as EVENT_TAXONOMY_BRAND, Et as ModuleEventsConfig, F as TaxonomyEventKind, Ft as resetGraphEventEmitter, G as VibecontrolsSessionStartedPayload, Gt as RedisStreamsEventConsumer, H as VibecontrolsAgentConnectedPayload, Ht as createMemoryPublisher, I as TaxonomyEventLayer, It as MemoryEventBus, J as WorkflowRunFailedPayload, Jt as EventQueueFactory, K as WSPACE_GRAPH_EVENTS_STREAM, Kt as RedisStreamsEventPublisher, L as TaxonomyEventPii, Lt as MemoryEventConsumer, M as PublishableEventName, Mt as GraphEventEmitterImpl, N as REFERENCE_PRODUCT_EVENT_TAXONOMY, Nt as createGraphEventEmitter, O as EventTaxonomy, Ot as createModuleEventsService, P as SubscriptionChangedPayload, Pt as getGraphEventEmitter, Q as WorkspaceMemberAddedPayload, Qt as PublishOptions, R as TaxonomyEventStatus, Rt as MemoryEventPublisher, S as EventsManagerStreamRoute, St as StreamInfo, T as DefinedEventTaxonomy, Tt as ModuleEventPayload, U as VibecontrolsAgentDisconnectedPayload, Ut as dlqKey, V as UserDeletedPayload, Vt as createMemoryConsumer, W as VibecontrolsSessionEndedPayload, Wt as streamKey, X as WorkspaceCreatedPayload, Xt as ISubscription, Y as WorkflowRunStartedPayload, Yt as IEventConsumer, Z as WorkspaceDeletedPayload, Zt as IEventPublisher, _ as EventsManager, _t as EventMessage$1, a as LifecycleEventContext, an as QueueType, at as publishTaxonomyEvent, b as EventsManagerOptions, bt as PublishEventOptions, c as OrganizationDeletedFact, cn as EventHandler, ct as EVENT_STREAMS_URL_ENV_KEYS, d as buildConsumerGroupName, dn as StreamConfig, dt as resolveEventStreamsUrl, en as BaseQueueConfig, et as WorkspaceMemberRoleUpdatedPayload, f as createLifecycleConsumer, fn as SubscriptionOptions, ft as resolveEventStreamsUrlSource, g as parseWorkspaceMemberRemoved, gt as createPublisher, h as parseWorkspaceDeletedStream, ht as createConsumer, i as LifecycleConsumerOptions, in as QueueStatistics, it as mergeEventTaxonomies, j as PLATFORM_EVENT_TAXONOMY, jt as GraphEventEmitter, k as GraphEntityEventPayload, kt as EntityEventRbacMetadata, l as WorkspaceDeletedFact, ln as EventMessage, lt as GRAPH_EVENTS_URL_ENV_KEYS, m as parseWorkspaceDeletedGraph, mt as resolveGraphEventsUrlSource, n as LIFECYCLE_SUBJECTS, nn as EventQueueHealthCheckResult, nt as eventSpec, o as LifecycleEventSource, on as AcknowledgeableEvent, ot as taxonomyEventNames, p as parseOrganizationDeleted, pt as resolveGraphEventsUrl, q as WorkflowRunCompletedPayload, qt as RedisStreamsConnection, r as LifecycleConsumer, rn as PublisherConfig, rt as isDefinedEventTaxonomy, s as LifecycleHandlers, sn as ConsumerOptions, st as taxonomyNameViolation, tn as ConsumerConfig, tt as defineEventTaxonomy, u as WorkspaceMemberRemovedFact, un as EventMetadata, ut as eventKeyScopeForUrl, v as EventsManagerHandler, vt as EventPriority, w as createEventsManagerSingleton, wt as BulkEventPayload, x as EventsManagerSingleton, xt as PublishResult, y as EventsManagerMessage, yt as EventsModule, z as TaxonomyPayload, zt as MemoryEventQueue } from "../index-CEtULfb_.js";
2
2
  export { type AcknowledgeableEvent, type BaseQueueConfig, type BulkEventPayload, type ConsumerConfig, type ConsumerOptions, type DefinedEventTaxonomy, EVENT_STREAMS_URL_ENV_KEYS, EVENT_TAXONOMY_BRAND, type EntityEventRbacMetadata, type EntityEventType, type EventHandler, type EventMessage, type EventMetadata, EventPriority, EventQueueFactory, type EventQueueHealthCheckResult, type EventQueueHealthCheckResult as HealthCheckResult, type EventSpec, type EventTaxonomy, EventsManager, type EventsManagerHandler, type EventsManagerMessage, type EventsManagerOptions, type EventsManagerSingleton, type EventsManagerStreamRoute, type EventsManagerSubscribeOptions, EventsModule, GRAPH_EVENTS_URL_ENV_KEYS, type GraphEntityEventPayload, type GraphEventEmitter, GraphEventEmitterImpl, type EventMessage$1 as GraphQLEventMessage, type IEventConsumer, type IEventPublisher, type IEventQueue, type ISubscription, LIFECYCLE_SUBJECTS, type LifecycleConsumer, type LifecycleConsumerOptions, type LifecycleEventContext, type LifecycleEventSource, type LifecycleHandlers, MemoryEventBus, MemoryEventConsumer, MemoryEventPublisher, MemoryEventQueue, type ModuleEventPayload, type ModuleEventsConfig, ModuleEventsService, type OrganizationDeletedFact, type OrganizationDeletedPayload, PLATFORM_EVENT_TAXONOMY, type PublishEventOptions, type PublishOptions, type PublishResult, type PublishableEventName, type PublisherConfig, type QueueStatistics, QueueType, REFERENCE_PRODUCT_EVENT_TAXONOMY, RedisStreamsConnection, RedisStreamsEventConsumer, RedisStreamsEventPublisher, type StreamConfig, type StreamInfo, type SubscribeOptions, type SubscriptionChangedPayload, type SubscriptionOptions, type TaxonomyEventKind, type TaxonomyEventLayer, type TaxonomyEventPii, type TaxonomyEventStatus, type TaxonomyPayload, type TaxonomyPublishMetadata, type UserDeletedPayload, type VibecontrolsAgentConnectedPayload, type VibecontrolsAgentDisconnectedPayload, type VibecontrolsSessionEndedPayload, type VibecontrolsSessionStartedPayload, WSPACE_GRAPH_EVENTS_STREAM, type WorkflowRunCompletedPayload, type WorkflowRunFailedPayload, type WorkflowRunStartedPayload, type WorkspaceCreatedPayload, type WorkspaceDeletedFact, type WorkspaceDeletedPayload, type WorkspaceMemberAddedPayload, type WorkspaceMemberRemovedFact, type WorkspaceMemberRemovedPayload, type WorkspaceMemberRoleUpdatedPayload, buildConsumerGroupName, createConsumer, createEventsManagerSingleton, createGraphEventEmitter, createLifecycleConsumer, createMemoryConsumer, createGraphEventEmitter$1 as createMemoryGraphEventEmitter, createMemoryPublisher, createModuleEventsService, createPublisher, defineEventTaxonomy, eventKeyScopeForUrl, eventSpec, getGraphEventEmitter, isDefinedEventTaxonomy, mergeEventTaxonomies, parseOrganizationDeleted, parseWorkspaceDeletedGraph, parseWorkspaceDeletedStream, parseWorkspaceMemberRemoved, publishTaxonomyEvent, dlqKey as redisDlqKey, streamKey as redisStreamKey, resetGraphEventEmitter, resolveEventStreamsUrl, resolveEventStreamsUrlSource, resolveGraphEventsUrl, resolveGraphEventsUrlSource, taxonomyEventNames, taxonomyNameViolation };
@@ -1,2 +1,2 @@
1
- import { A as PaginationParams, C as ExportProgress, D as PaginateResult, E as PaginateQueryFn, O as PaginatedQueryOptions, S as ExportOptions, T as ExportableModule, _ as ExportFetchResult, a as TriggerExportJobParams, b as ExportJob, c as csvToJSON, d as parseCSV, f as PaginationService, g as ExportFetchOptions, h as ExportConfig, i as ExportJobResult, k as PaginatedResult, l as estimateCSVSize, m as CSVConversionOptions, n as ExportActorType, o as triggerExportJob, p as BaseModuleExporter, r as ExportFormatGql, s as convertToCSV, u as getCSVHeaders, v as ExportFormat, w as ExportResult, x as ExportJobStatus, y as ExportFormatEnum } from "../index-BeVtqGO-.js";
1
+ import { A as PaginationParams, C as ExportProgress, D as PaginateResult, E as PaginateQueryFn, O as PaginatedQueryOptions, S as ExportOptions, T as ExportableModule, _ as ExportFetchResult, a as TriggerExportJobParams, b as ExportJob, c as csvToJSON, d as parseCSV, f as PaginationService, g as ExportFetchOptions, h as ExportConfig, i as ExportJobResult, k as PaginatedResult, l as estimateCSVSize, m as CSVConversionOptions, n as ExportActorType, o as triggerExportJob, p as BaseModuleExporter, r as ExportFormatGql, s as convertToCSV, u as getCSVHeaders, v as ExportFormat, w as ExportResult, x as ExportJobStatus, y as ExportFormatEnum } from "../index-Bwn5Z1h-.js";
2
2
  export { BaseModuleExporter, type CSVConversionOptions, type ExportActorType, type ExportConfig, type ExportFetchOptions, type ExportFetchResult, type ExportFormat, type ExportFormatEnum, type ExportFormatGql, type ExportJob, type ExportJobResult, type ExportJobStatus, type ExportOptions, type ExportProgress, type ExportResult, type ExportableModule, type PaginateQueryFn, type PaginateResult, type PaginatedQueryOptions, type PaginatedResult, type PaginationParams, PaginationService, type TriggerExportJobParams, convertToCSV, csvToJSON, estimateCSVSize, getCSVHeaders, parseCSV, triggerExportJob };
@@ -1,4 +1,4 @@
1
- import { a as estimateCSVSize, c as PaginationService, i as csvToJSON, l as BaseModuleExporter, n as triggerExportJob, o as getCSVHeaders, r as convertToCSV, s as parseCSV } from "../export-DJXE3Osa.js";
1
+ import { a as estimateCSVSize, c as PaginationService, i as csvToJSON, l as BaseModuleExporter, n as triggerExportJob, o as getCSVHeaders, r as convertToCSV, s as parseCSV } from "../export-lqKewsuF.js";
2
2
 
3
3
  export { BaseModuleExporter, PaginationService, convertToCSV, csvToJSON, estimateCSVSize, getCSVHeaders, parseCSV, triggerExportJob };
4
4
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
2
2
  import { t as GatewayClient } from "./client-sAJTrb4i.js";
3
- import "./gateway-ByVo-n37.js";
3
+ import "./gateway-2en8Gx_a.js";
4
4
 
5
5
  // src/export/base-exporter.ts
6
6
  /**
@@ -639,4 +639,4 @@ var export_exports = /* @__PURE__ */ __exportAll({
639
639
  });
640
640
 
641
641
  export { estimateCSVSize as a, PaginationService as c, csvToJSON as i, BaseModuleExporter as l, triggerExportJob as n, getCSVHeaders as o, convertToCSV as r, parseCSV as s, export_exports as t };
642
- //# sourceMappingURL=export-DJXE3Osa.js.map
642
+ //# sourceMappingURL=export-lqKewsuF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-DJXE3Osa.js","names":[],"sources":["../src/export/base-exporter.ts","../src/export/pagination.ts","../src/export/csv.ts","../src/export/gateway-client.ts","../src/export/index.ts"],"sourcesContent":["/**\n * Base Module Exporter\n *\n * Abstract base class for module exporters across all Burdenoff microservices.\n * Provides common functionality for exporting data from different modules.\n *\n * @module export/base-exporter\n *\n * @example\n * ```typescript\n * import { BaseModuleExporter } from '@burdenoff/be-sdk/export';\n *\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n * description = 'Export user data';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * // Implementation\n * }\n * }\n * ```\n */\n\nimport type { ExportOptions, ExportResult, PaginateQueryFn, PaginateResult } from './types.js';\n\n/**\n * Abstract base class for module exporters\n *\n * Provides common functionality that all module exporters can inherit:\n * - Field filtering\n * - Pagination helpers\n * - Module metadata\n *\n * @typeParam T - The type of entity this exporter handles\n */\nexport abstract class BaseModuleExporter<T = unknown> {\n /** Unique key identifying this module (e.g., 'users', 'tags', 'orders') */\n moduleKey?: string;\n\n /** Human-readable display name for the module */\n displayName?: string;\n\n /** Description of what this module exports */\n description?: string;\n\n /** Default fields to exclude from export (e.g., sensitive data) */\n defaultExcludeFields?: string[];\n\n /** List of product IDs this exporter supports */\n supportedProducts?: string[];\n\n /** Model name for database operations */\n protected modelName?: string;\n\n /**\n * Export data from this module\n *\n * Subclasses should implement this method to perform the actual export.\n * The method is optional to allow for gradual implementation.\n *\n * @param options - Export options including format, filters, and pagination\n * @returns Export result with data or download URL\n */\n export?(options: ExportOptions): Promise<ExportResult>;\n\n /**\n * Filter fields from an entity based on exclude list\n *\n * Use this to remove sensitive or unnecessary fields from exported data.\n *\n * @param entity - Entity to filter\n * @param excludeFields - Fields to exclude (uses defaultExcludeFields if not provided)\n * @returns Filtered entity as a plain object\n *\n * @example\n * ```typescript\n * const user = { id: '1', name: 'John', password: 'secret', ssn: '123' };\n * const filtered = this.filterFields(user, ['password', 'ssn']);\n * // Result: { id: '1', name: 'John' }\n * ```\n */\n protected filterFields(entity: T | Record<string, unknown>, excludeFields?: string[]): Record<string, unknown> {\n const fieldsToExclude = excludeFields || this.defaultExcludeFields || [];\n\n if (fieldsToExclude.length === 0) {\n return entity as Record<string, unknown>;\n }\n\n const filtered: Record<string, unknown> = {};\n const record = entity as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(record)) {\n if (!fieldsToExclude.includes(key)) {\n filtered[key] = value;\n }\n }\n\n return filtered;\n }\n\n /**\n * Filter multiple entities\n *\n * @param entities - Array of entities to filter\n * @param excludeFields - Fields to exclude\n * @returns Array of filtered entities\n */\n protected filterFieldsMany(\n entities: (T | Record<string, unknown>)[],\n excludeFields?: string[]\n ): Record<string, unknown>[] {\n return entities.map((entity) => this.filterFields(entity, excludeFields));\n }\n\n /**\n * Paginate helper for database queries\n *\n * Use this to implement paginated data fetching in your export method.\n *\n * @param queryFn - Function that executes the paginated query\n * @param page - Page number (1-indexed)\n * @param pageSize - Number of items per page\n * @returns Paginated result with data and metadata\n *\n * @example\n * ```typescript\n * const result = await this.paginate(\n * async ({ skip, take }) => {\n * const items = await db.user.findMany({ skip, take });\n * const total = await db.user.count();\n * return { items, total };\n * },\n * 1,\n * 100\n * );\n * ```\n */\n protected async paginate(\n queryFn: PaginateQueryFn<T>,\n page: number = 1,\n pageSize: number = 100\n ): Promise<PaginateResult<T>> {\n const skip = (page - 1) * pageSize;\n const take = pageSize;\n\n const { items, total } = await queryFn({ skip, take });\n\n return {\n data: items,\n total,\n hasMore: skip + items.length < total,\n nextCursor: items.length > 0 && skip + items.length < total ? String(page + 1) : undefined,\n };\n }\n\n /**\n * Fetch all data using cursor-based pagination\n *\n * Use this for exporting large datasets efficiently.\n *\n * @param fetchBatch - Function to fetch a batch of data\n * @param batchSize - Number of items per batch\n * @returns All fetched items\n *\n * @example\n * ```typescript\n * const allUsers = await this.fetchAll(\n * async (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n * ```\n */\n protected async fetchAll(\n fetchBatch: (cursor?: string) => Promise<(T & { id: string })[]>,\n batchSize: number = 100\n ): Promise<T[]> {\n const allItems: T[] = [];\n let cursor: string | undefined;\n\n while (true) {\n const batch = await fetchBatch(cursor);\n\n if (batch.length === 0) {\n break;\n }\n\n allItems.push(...batch);\n\n // Get cursor from last item\n const lastItem = batch[batch.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than batch size, we're done\n if (batch.length < batchSize) {\n break;\n }\n }\n\n return allItems;\n }\n\n /**\n * Transform entity for export\n *\n * Override this method to customize how entities are transformed before export.\n * Default implementation returns the entity as-is after field filtering.\n *\n * @param entity - Entity to transform\n * @param excludeFields - Fields to exclude\n * @returns Transformed entity\n */\n protected transformForExport(entity: T, excludeFields?: string[]): Record<string, unknown> {\n return this.filterFields(entity, excludeFields);\n }\n\n /**\n * Validate export options\n *\n * Override this to add custom validation for export options.\n *\n * @param options - Export options to validate\n * @throws Error if options are invalid\n */\n protected validateOptions(options: ExportOptions): void {\n const validFormats = ['csv', 'json', 'xlsx'];\n if (!validFormats.includes(options.format)) {\n throw new Error(`Invalid export format: ${options.format}. Valid formats: ${validFormats.join(', ')}`);\n }\n }\n\n /**\n * Get supported export formats\n *\n * @returns Array of supported format strings\n */\n getSupportedFormats(): string[] {\n return ['csv', 'json', 'xlsx'];\n }\n\n /**\n * Get module metadata\n *\n * @returns Module metadata object\n */\n getMetadata(): {\n moduleKey?: string;\n displayName?: string;\n description?: string;\n supportedProducts?: string[];\n supportedFormats: string[];\n } {\n return {\n moduleKey: this.moduleKey,\n displayName: this.displayName,\n description: this.description,\n supportedProducts: this.supportedProducts,\n supportedFormats: this.getSupportedFormats(),\n };\n }\n}\n","/**\n * Pagination Service\n *\n * Provides pagination utilities for export operations across all Burdenoff microservices.\n * Supports both offset-based and cursor-based pagination strategies.\n *\n * @module export/pagination\n *\n * @example\n * ```typescript\n * import { PaginationService } from '@burdenoff/be-sdk/export';\n *\n * // Offset-based pagination\n * const result = PaginationService.paginate(items, { page: 2, pageSize: 20 });\n *\n * // Cursor-based pagination with async generator\n * for await (const item of PaginationService.paginatedQuery(fetchFn, { limit: 100 })) {\n * console.log(item);\n * }\n * ```\n */\n\nimport type { PaginatedQueryOptions, PaginatedResult, PaginationParams } from './types.js';\n\n/**\n * Service providing pagination utilities for export and data fetching operations\n */\nexport class PaginationService {\n /**\n * Paginate an array of items using offset-based pagination\n *\n * @param items - Array of items to paginate\n * @param params - Pagination parameters\n * @returns Paginated result with items and metadata\n *\n * @example\n * ```typescript\n * const allUsers = await db.user.findMany();\n * const page = PaginationService.paginate(allUsers, { page: 1, pageSize: 10 });\n * console.log(page.items); // First 10 users\n * console.log(page.pageInfo.hasNextPage); // true if more pages exist\n * ```\n */\n static paginate<T>(items: T[], params: PaginationParams): PaginatedResult<T> {\n const page = params.page ?? 1;\n const pageSize = params.pageSize ?? 20;\n const start = (page - 1) * pageSize;\n const end = start + pageSize;\n\n const paginatedItems = items.slice(start, end);\n\n return {\n items: paginatedItems,\n totalCount: items.length,\n pageInfo: {\n hasNextPage: end < items.length,\n hasPreviousPage: page > 1,\n startCursor: paginatedItems.length > 0 ? String(start) : undefined,\n endCursor: paginatedItems.length > 0 ? String(Math.min(end, items.length) - 1) : undefined,\n },\n };\n }\n\n /**\n * Calculate pagination metadata without slicing data\n *\n * @param totalCount - Total number of items\n * @param page - Current page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Pagination metadata\n *\n * @example\n * ```typescript\n * const meta = PaginationService.calculatePagination(150, 3, 20);\n * // meta.hasNextPage = true (page 4 exists)\n * // meta.hasPreviousPage = true (page 2 exists)\n * // meta.totalPages = 8\n * ```\n */\n static calculatePagination(\n totalCount: number,\n page: number,\n pageSize: number\n ): {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n totalPages: number;\n currentPage: number;\n pageSize: number;\n startIndex: number;\n endIndex: number;\n } {\n const totalPages = Math.ceil(totalCount / pageSize);\n const startIndex = (page - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalCount - 1);\n\n return {\n hasNextPage: page < totalPages,\n hasPreviousPage: page > 1,\n totalPages,\n currentPage: page,\n pageSize,\n startIndex,\n endIndex,\n };\n }\n\n /**\n * Async generator for paginated database queries using cursor-based pagination\n *\n * This is ideal for processing large datasets without loading everything into memory.\n * The generator yields items one at a time, fetching new batches as needed.\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Async generator of items\n *\n * @example\n * ```typescript\n * // Define fetch function that queries the database\n * const fetchUsers = async (cursor?: string) => {\n * return db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * });\n * };\n *\n * // Process all users without loading all into memory\n * for await (const user of PaginationService.paginatedQuery(fetchUsers)) {\n * await processUser(user);\n * }\n * ```\n */\n static async *paginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): AsyncGenerator<T, void, unknown> {\n const { limit, initialCursor } = options;\n let cursor = initialCursor;\n let hasMore = true;\n let totalYielded = 0;\n\n while (hasMore) {\n const items = await fetchFn(cursor);\n\n if (items.length === 0) {\n break;\n }\n\n for (const item of items) {\n yield item;\n totalYielded++;\n\n if (limit && totalYielded >= limit) {\n return;\n }\n }\n\n // Get next cursor from last item\n const lastItem = items[items.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than expected batch size, we're done\n // Note: This assumes fetchFn respects a consistent batch size internally\n hasMore = items.length > 0;\n }\n }\n\n /**\n * Collect all items from a paginated query into an array\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Array of all items\n *\n * @example\n * ```typescript\n * const allUsers = await PaginationService.collectPaginatedQuery(fetchUsers, { limit: 1000 });\n * ```\n */\n static async collectPaginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): Promise<T[]> {\n const items: T[] = [];\n\n for await (const item of PaginationService.paginatedQuery(fetchFn, options)) {\n items.push(item);\n }\n\n return items;\n }\n\n /**\n * Create a cursor-based paginated fetch function from a Prisma-style query\n *\n * @param queryFn - Prisma-style query function\n * @param batchSize - Number of items to fetch per batch\n * @returns Fetch function compatible with paginatedQuery\n *\n * @example\n * ```typescript\n * const fetchFn = PaginationService.createPrismaFetchFn(\n * (cursor) => db.user.findMany({\n * where: { isActive: true, ...(cursor ? { id: { gt: cursor } } : {}) },\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n *\n * for await (const user of PaginationService.paginatedQuery(fetchFn)) {\n * console.log(user);\n * }\n * ```\n */\n static createPrismaFetchFn<T extends { id: string }>(\n queryFn: (cursor?: string) => Promise<T[]>,\n _batchSize: number = 100\n ): (cursor?: string) => Promise<T[]> {\n return queryFn;\n }\n\n /**\n * Calculate offset for skip-based pagination\n *\n * @param page - Page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Offset value for skip\n */\n static calculateOffset(page: number, pageSize: number): number {\n return (Math.max(1, page) - 1) * pageSize;\n }\n\n /**\n * Parse cursor string to extract pagination state\n *\n * @param cursor - Base64-encoded cursor string\n * @returns Decoded cursor data or null if invalid\n */\n static parseCursor<T = Record<string, unknown>>(cursor: string): T | null {\n try {\n const decoded = Buffer.from(cursor, 'base64').toString('utf-8');\n return JSON.parse(decoded) as T;\n } catch {\n return null;\n }\n }\n\n /**\n * Create cursor string from pagination state\n *\n * @param data - Data to encode in cursor\n * @returns Base64-encoded cursor string\n */\n static createCursor(data: Record<string, unknown>): string {\n return Buffer.from(JSON.stringify(data)).toString('base64');\n }\n}\n","/**\n * CSV Utilities\n *\n * Utilities for converting data to CSV format for export operations.\n *\n * @module export/csv\n *\n * @example\n * ```typescript\n * import { convertToCSV, parseCSV } from '@burdenoff/be-sdk/export';\n *\n * const csv = convertToCSV(users, { includeHeaders: true });\n * console.log(csv);\n * ```\n */\n\nimport type { CSVConversionOptions } from './types.js';\n\nconst FORMULA_PREFIX_RE = /^[=+\\-@]/;\n\nexport function sanitizeCSVCell(value: string): string {\n return FORMULA_PREFIX_RE.test(value) ? `'${value}` : value;\n}\n\n/**\n * Convert an array of objects to CSV format\n *\n * Handles nested objects by flattening them with dot notation.\n * Arrays are JSON stringified.\n * Dates are converted to ISO strings.\n *\n * @param data - Array of objects to convert\n * @param options - CSV conversion options\n * @returns CSV string\n *\n * @example\n * ```typescript\n * const users = [\n * { id: 1, name: 'John', address: { city: 'NYC' } },\n * { id: 2, name: 'Jane', address: { city: 'LA' } },\n * ];\n *\n * const csv = convertToCSV(users);\n * // Output:\n * // id,name,address.city\n * // 1,John,NYC\n * // 2,Jane,LA\n * ```\n */\nexport function convertToCSV(data: unknown[], options: CSVConversionOptions = {}): string {\n const { delimiter = ',', includeHeaders = true, flattenFields = true, maxFlattenDepth = 3 } = options;\n\n if (data.length === 0) {\n return '';\n }\n\n // Flatten objects and get all keys\n const flattenObject = (obj: unknown, prefix = '', depth = 0): Record<string, string> => {\n const result: Record<string, string> = {};\n\n if (obj === null || obj === undefined) {\n return result;\n }\n\n if (typeof obj !== 'object') {\n return { [prefix || 'value']: String(obj) };\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n\n if (value === null || value === undefined) {\n result[newKey] = '';\n } else if (value instanceof Date) {\n result[newKey] = value.toISOString();\n } else if (Array.isArray(value)) {\n result[newKey] = JSON.stringify(value);\n } else if (typeof value === 'object' && flattenFields && depth < maxFlattenDepth) {\n Object.assign(result, flattenObject(value, newKey, depth + 1));\n } else if (typeof value === 'object') {\n result[newKey] = JSON.stringify(value);\n } else {\n result[newKey] = String(value);\n }\n }\n\n return result;\n };\n\n // Flatten all records and collect all keys\n const flattenedRecords = data.map((item) => flattenObject(item));\n const allKeys = new Set<string>();\n for (const record of flattenedRecords) {\n for (const key of Object.keys(record)) {\n allKeys.add(key);\n }\n }\n\n const headers = Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n\n // Escape CSV values\n const escapeCSV = (value: string): string => {\n const sanitizedValue = sanitizeCSVCell(value);\n\n if (\n sanitizedValue.includes(delimiter) ||\n sanitizedValue.includes('\"') ||\n sanitizedValue.includes('\\n') ||\n sanitizedValue.includes('\\r')\n ) {\n return `\"${sanitizedValue.replace(/\"/g, '\"\"')}\"`;\n }\n return sanitizedValue;\n };\n\n // Build CSV\n const lines: string[] = [];\n\n if (includeHeaders) {\n lines.push(headers.map(escapeCSV).join(delimiter));\n }\n\n for (const record of flattenedRecords) {\n const row = headers.map((header) => escapeCSV(record[header] || ''));\n lines.push(row.join(delimiter));\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Parse a CSV string into an array of objects\n *\n * @param csv - CSV string to parse\n * @param options - Parse options\n * @returns Array of parsed objects\n *\n * @example\n * ```typescript\n * const csv = 'id,name\\n1,John\\n2,Jane';\n * const data = parseCSV(csv);\n * // [{ id: '1', name: 'John' }, { id: '2', name: 'Jane' }]\n * ```\n */\nexport function parseCSV(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean } = {}\n): Record<string, string>[] {\n const { delimiter = ',', hasHeaders = true } = options;\n\n const lines = csv.split(/\\r?\\n/).filter((line) => line.trim());\n\n if (lines.length === 0) {\n return [];\n }\n\n // Parse a single CSV line, handling quoted values\n const parseLine = (line: string): string[] => {\n const values: string[] = [];\n let current = '';\n let inQuotes = false;\n\n let i = 0;\n while (i < line.length) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n if (char === '\"' && inQuotes && nextChar === '\"') {\n current += '\"';\n i += 2; // Skip next quote\n } else if (char === '\"') {\n inQuotes = !inQuotes;\n i++;\n } else if (char === delimiter && !inQuotes) {\n values.push(current);\n current = '';\n i++;\n } else {\n current += char;\n i++;\n }\n }\n\n values.push(current);\n return values;\n };\n\n let headers: string[];\n let dataLines: string[];\n\n // We've already checked that lines.length > 0, so lines[0] is guaranteed to exist\n const firstLine = lines[0] as string;\n\n if (hasHeaders) {\n headers = parseLine(firstLine);\n dataLines = lines.slice(1);\n } else {\n // Generate numeric headers if no header row\n const firstRow = parseLine(firstLine);\n headers = firstRow.map((_, i) => `col${i}`);\n dataLines = lines;\n }\n\n return dataLines.map((line) => {\n const values = parseLine(line);\n const obj: Record<string, string> = {};\n\n headers.forEach((header, i) => {\n obj[header] = values[i] || '';\n });\n\n return obj;\n });\n}\n\n/**\n * Convert CSV to JSON string\n *\n * @param csv - CSV string\n * @param options - Parse options\n * @returns JSON string\n */\nexport function csvToJSON(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean; pretty?: boolean } = {}\n): string {\n const { pretty = false, ...parseOptions } = options;\n const data = parseCSV(csv, parseOptions);\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n}\n\n/**\n * Get CSV headers from data\n *\n * @param data - Array of objects\n * @param flattenFields - Whether to flatten nested objects\n * @returns Array of header strings\n */\nexport function getCSVHeaders(data: unknown[], flattenFields: boolean = true): string[] {\n if (data.length === 0) {\n return [];\n }\n\n const collectKeys = (obj: unknown, prefix = '', depth = 0): string[] => {\n const keys: string[] = [];\n\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return prefix ? [prefix] : [];\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n flattenFields &&\n depth < 3\n ) {\n keys.push(...collectKeys(value, fullKey, depth + 1));\n } else {\n keys.push(fullKey);\n }\n }\n\n return keys;\n };\n\n const allKeys = new Set<string>();\n for (const item of data) {\n for (const key of collectKeys(item)) {\n allKeys.add(key);\n }\n }\n\n return Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Estimate CSV file size for a dataset\n *\n * @param data - Array of objects\n * @param sampleSize - Number of records to sample for estimation\n * @returns Estimated size in bytes\n */\nexport function estimateCSVSize(data: unknown[], sampleSize: number = 100): number {\n if (data.length === 0) {\n return 0;\n }\n\n // Take a sample to estimate average row size\n const sample = data.slice(0, Math.min(sampleSize, data.length));\n const sampleCSV = convertToCSV(sample);\n const averageRowSize = sampleCSV.length / sample.length;\n\n // Estimate total size (headers + data rows)\n const headers = getCSVHeaders(data);\n const headerSize = headers.join(',').length + 1; // +1 for newline\n\n return Math.ceil(headerSize + averageRowSize * data.length);\n}\n","/**\n * Export Gateway Helper\n *\n * Centralised wrapper around the workspace internal gateway's\n * `createExportJob` mutation, used by per-svc convenience resolvers\n * (e.g. `createTagsExportJob`, `createGroupsExportJob`).\n *\n * Replaces the duplicated `src/clients/export-gateway.ts` files that\n * existed in 19+ workspace svcs.\n *\n * @module export/gateway-client\n *\n * @example\n * ```typescript\n * import { triggerExportJob } from '@burdenoff/be-sdk/export';\n *\n * const result = await triggerExportJob({\n * serviceName: 'wspace-tags-svc',\n * workspaceId: ctx.workspaceId,\n * name: input.name,\n * entityTypes: ['tags', 'vocabularies'],\n * format: input.format,\n * actorId: ctx.actorId,\n * actorType: ctx.actorType,\n * });\n * ```\n */\n\nimport { GatewayClient } from '../gateway/index.js';\nimport type { ServiceLayer } from '../types/layer.js';\n\nconst CREATE_EXPORT_JOB_MUTATION = `mutation CreateExportJob($input: CreateExportJobInput!) {\n createExportJob(input: $input) {\n id\n status\n workspaceId\n entityTypes\n format\n createdAt\n }\n}`;\n\nexport type ExportActorType = 'user' | 'app' | 'service' | 'super_admin';\nexport type ExportFormatGql = 'JSON' | 'CSV';\n\nexport interface TriggerExportJobParams {\n /** Caller service name, used by gateway client telemetry/auth */\n serviceName: string;\n /** Layer for the gateway. Defaults to `wspace`. */\n layer?: ServiceLayer;\n /** Workspace context (required for wspace exports). Sent as the `x-workspace-id` header, never in the input. */\n workspaceId: string;\n /** Human-readable name for the export job. */\n name: string;\n /** Entity types registered in `wspace-export-svc` to include. */\n entityTypes: string[];\n /** Output format. */\n format: ExportFormatGql;\n /** Actor making the request (forwarded to RBAC). */\n actorId: string;\n actorType: ExportActorType;\n /** Whether to include extended metadata in the export ZIP. */\n includeMetadata?: boolean;\n /** Optional ISO date-range bounds. */\n dateRangeStart?: string;\n dateRangeEnd?: string;\n}\n\nexport interface ExportJobResult {\n id: string;\n status: string;\n workspaceId: string;\n entityTypes: string[];\n format: string;\n createdAt: string;\n}\n\ninterface CreateExportJobResponse {\n createExportJob?: ExportJobResult;\n}\n\n/**\n * Submit a `createExportJob` mutation to the workspace internal gateway.\n *\n * The caller is expected to map the returned `ExportJobResult` to its\n * own GraphQL output type (the per-svc `ExportJobResponse`).\n */\nexport async function triggerExportJob(params: TriggerExportJobParams): Promise<ExportJobResult> {\n const {\n serviceName,\n layer = 'wspace',\n actorId,\n actorType,\n workspaceId,\n name,\n entityTypes,\n format,\n includeMetadata,\n dateRangeStart,\n dateRangeEnd,\n } = params;\n\n const client = new GatewayClient({ layer, serviceName });\n\n // `CreateExportJobInput` carries no `workspaceId`: wspace-export-svc takes\n // the workspace from the `x-workspace-id` header so a caller can never\n // export another tenant's data. Sending the field makes GraphQL reject the\n // whole variable (\"Field \\\"workspaceId\\\" is not defined by type\n // \\\"CreateExportJobInput\\\"\"), so the workspace travels in the header only.\n const input = {\n name,\n entityTypes,\n format,\n ...(includeMetadata !== undefined ? { includeMetadata } : {}),\n ...(dateRangeStart !== undefined ? { dateRangeStart } : {}),\n ...(dateRangeEnd !== undefined ? { dateRangeEnd } : {}),\n };\n\n const response = await client.internalQuery<CreateExportJobResponse>({\n query: CREATE_EXPORT_JOB_MUTATION,\n variables: { input },\n headers: {\n 'x-actor-id': actorId,\n 'x-actor-type': actorType,\n 'x-workspace-id': workspaceId,\n },\n });\n\n const job = response.data?.createExportJob;\n if (!job) {\n throw new Error('Export service did not return a job');\n }\n return job;\n}\n","/**\n * Export Module\n *\n * Provides common utilities for data export operations across all Burdenoff microservices.\n * Includes pagination services, base exporter classes, CSV utilities, and type definitions.\n *\n * @module export\n *\n * @example\n * ```typescript\n * // Import from the export module\n * import {\n * BaseModuleExporter,\n * PaginationService,\n * convertToCSV,\n * } from '@burdenoff/be-sdk/export';\n *\n * // Create a custom exporter\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * const data = await this.fetchAll(\n * (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : {},\n * take: 100,\n * })\n * );\n *\n * const csv = convertToCSV(data);\n * return { data, format: 'csv' };\n * }\n * }\n *\n * // Use pagination utilities\n * const result = PaginationService.paginate(items, { page: 1, pageSize: 20 });\n * ```\n */\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type {\n // Export format types\n ExportFormat,\n ExportFormatEnum,\n\n // Configuration types\n ExportConfig,\n ExportOptions,\n\n // Job types\n ExportJobStatus,\n ExportJob,\n ExportProgress,\n ExportResult,\n\n // Fetch types\n ExportFetchOptions,\n ExportFetchResult,\n\n // Pagination types\n PaginationParams,\n PaginatedResult,\n PaginatedQueryOptions,\n PaginateResult,\n PaginateQueryFn,\n\n // Module interface\n ExportableModule,\n\n // CSV types\n CSVConversionOptions,\n} from './types.js';\n\n// ============================================================================\n// Class Exports\n// ============================================================================\n\nexport { BaseModuleExporter } from './base-exporter.js';\nexport { PaginationService } from './pagination.js';\n\n// ============================================================================\n// Function Exports\n// ============================================================================\n\nexport { convertToCSV, parseCSV, csvToJSON, getCSVHeaders, estimateCSVSize } from './csv.js';\n\n// ============================================================================\n// Gateway Helper Exports\n// ============================================================================\n\nexport { triggerExportJob } from './gateway-client.js';\nexport type { TriggerExportJobParams, ExportJobResult, ExportActorType, ExportFormatGql } from './gateway-client.js';\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,IAAsB,qBAAtB,M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AAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAC9D;;;;;;;;AASA,SAAgB,gBAAgB,MAAiB,aAAqB,KAAa;CACjF,IAAI,KAAK,WAAW,GAClB,OAAO;CAIT,MAAM,SAAS,KAAK,MAAM,GAAG,KAAK,IAAI,YAAY,KAAK,MAAM,CAAC;CAE9D,MAAM,iBADY,aAAa,MACA,CAAC,CAAC,SAAS,OAAO;CAIjD,MAAM,aADU,cAAc,IACL,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS;CAE9C,OAAO,KAAK,KAAK,aAAa,iBAAiB,KAAK,MAAM;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/QA,MAAM,6BAA6B;;;;;;;;;;;;;;;;AAwDnC,eAAsB,iBAAiB,QAA0D;CAC/F,MAAM,EACJ,aACA,QAAQ,UACR,SACA,WACA,aACA,MACA,aACA,QACA,iBACA,gBACA,iBACE;CAEJ,MAAM,SAAS,IAAI,cAAc;EAAE;EAAO;CAAY,CAAC;CAOvD,MAAM,QAAQ;EACZ;EACA;EACA;EACA,GAAI,oBAAoB,SAAY,EAAE,gBAAgB,IAAI,CAAC;EAC3D,GAAI,mBAAmB,SAAY,EAAE,eAAe,IAAI,CAAC;EACzD,GAAI,iBAAiB,SAAY,EAAE,aAAa,IAAI,CAAC;CACvD;CAYA,MAAM,OAAM,MAVW,OAAO,cAAuC;EACnE,OAAO;EACP,WAAW,EAAE,MAAM;EACnB,SAAS;GACP,cAAc;GACd,gBAAgB;GAChB,kBAAkB;EACpB;CACF,CAAC,EAEmB,CAAC,MAAM;CAC3B,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,qCAAqC;CAEvD,OAAO;AACT"}
1
+ {"version":3,"file":"export-lqKewsuF.js","names":[],"sources":["../src/export/base-exporter.ts","../src/export/pagination.ts","../src/export/csv.ts","../src/export/gateway-client.ts","../src/export/index.ts"],"sourcesContent":["/**\n * Base Module Exporter\n *\n * Abstract base class for module exporters across all Burdenoff microservices.\n * Provides common functionality for exporting data from different modules.\n *\n * @module export/base-exporter\n *\n * @example\n * ```typescript\n * import { BaseModuleExporter } from '@burdenoff/be-sdk/export';\n *\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n * description = 'Export user data';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * // Implementation\n * }\n * }\n * ```\n */\n\nimport type { ExportOptions, ExportResult, PaginateQueryFn, PaginateResult } from './types.js';\n\n/**\n * Abstract base class for module exporters\n *\n * Provides common functionality that all module exporters can inherit:\n * - Field filtering\n * - Pagination helpers\n * - Module metadata\n *\n * @typeParam T - The type of entity this exporter handles\n */\nexport abstract class BaseModuleExporter<T = unknown> {\n /** Unique key identifying this module (e.g., 'users', 'tags', 'orders') */\n moduleKey?: string;\n\n /** Human-readable display name for the module */\n displayName?: string;\n\n /** Description of what this module exports */\n description?: string;\n\n /** Default fields to exclude from export (e.g., sensitive data) */\n defaultExcludeFields?: string[];\n\n /** List of product IDs this exporter supports */\n supportedProducts?: string[];\n\n /** Model name for database operations */\n protected modelName?: string;\n\n /**\n * Export data from this module\n *\n * Subclasses should implement this method to perform the actual export.\n * The method is optional to allow for gradual implementation.\n *\n * @param options - Export options including format, filters, and pagination\n * @returns Export result with data or download URL\n */\n export?(options: ExportOptions): Promise<ExportResult>;\n\n /**\n * Filter fields from an entity based on exclude list\n *\n * Use this to remove sensitive or unnecessary fields from exported data.\n *\n * @param entity - Entity to filter\n * @param excludeFields - Fields to exclude (uses defaultExcludeFields if not provided)\n * @returns Filtered entity as a plain object\n *\n * @example\n * ```typescript\n * const user = { id: '1', name: 'John', password: 'secret', ssn: '123' };\n * const filtered = this.filterFields(user, ['password', 'ssn']);\n * // Result: { id: '1', name: 'John' }\n * ```\n */\n protected filterFields(entity: T | Record<string, unknown>, excludeFields?: string[]): Record<string, unknown> {\n const fieldsToExclude = excludeFields || this.defaultExcludeFields || [];\n\n if (fieldsToExclude.length === 0) {\n return entity as Record<string, unknown>;\n }\n\n const filtered: Record<string, unknown> = {};\n const record = entity as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(record)) {\n if (!fieldsToExclude.includes(key)) {\n filtered[key] = value;\n }\n }\n\n return filtered;\n }\n\n /**\n * Filter multiple entities\n *\n * @param entities - Array of entities to filter\n * @param excludeFields - Fields to exclude\n * @returns Array of filtered entities\n */\n protected filterFieldsMany(\n entities: (T | Record<string, unknown>)[],\n excludeFields?: string[]\n ): Record<string, unknown>[] {\n return entities.map((entity) => this.filterFields(entity, excludeFields));\n }\n\n /**\n * Paginate helper for database queries\n *\n * Use this to implement paginated data fetching in your export method.\n *\n * @param queryFn - Function that executes the paginated query\n * @param page - Page number (1-indexed)\n * @param pageSize - Number of items per page\n * @returns Paginated result with data and metadata\n *\n * @example\n * ```typescript\n * const result = await this.paginate(\n * async ({ skip, take }) => {\n * const items = await db.user.findMany({ skip, take });\n * const total = await db.user.count();\n * return { items, total };\n * },\n * 1,\n * 100\n * );\n * ```\n */\n protected async paginate(\n queryFn: PaginateQueryFn<T>,\n page: number = 1,\n pageSize: number = 100\n ): Promise<PaginateResult<T>> {\n const skip = (page - 1) * pageSize;\n const take = pageSize;\n\n const { items, total } = await queryFn({ skip, take });\n\n return {\n data: items,\n total,\n hasMore: skip + items.length < total,\n nextCursor: items.length > 0 && skip + items.length < total ? String(page + 1) : undefined,\n };\n }\n\n /**\n * Fetch all data using cursor-based pagination\n *\n * Use this for exporting large datasets efficiently.\n *\n * @param fetchBatch - Function to fetch a batch of data\n * @param batchSize - Number of items per batch\n * @returns All fetched items\n *\n * @example\n * ```typescript\n * const allUsers = await this.fetchAll(\n * async (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n * ```\n */\n protected async fetchAll(\n fetchBatch: (cursor?: string) => Promise<(T & { id: string })[]>,\n batchSize: number = 100\n ): Promise<T[]> {\n const allItems: T[] = [];\n let cursor: string | undefined;\n\n while (true) {\n const batch = await fetchBatch(cursor);\n\n if (batch.length === 0) {\n break;\n }\n\n allItems.push(...batch);\n\n // Get cursor from last item\n const lastItem = batch[batch.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than batch size, we're done\n if (batch.length < batchSize) {\n break;\n }\n }\n\n return allItems;\n }\n\n /**\n * Transform entity for export\n *\n * Override this method to customize how entities are transformed before export.\n * Default implementation returns the entity as-is after field filtering.\n *\n * @param entity - Entity to transform\n * @param excludeFields - Fields to exclude\n * @returns Transformed entity\n */\n protected transformForExport(entity: T, excludeFields?: string[]): Record<string, unknown> {\n return this.filterFields(entity, excludeFields);\n }\n\n /**\n * Validate export options\n *\n * Override this to add custom validation for export options.\n *\n * @param options - Export options to validate\n * @throws Error if options are invalid\n */\n protected validateOptions(options: ExportOptions): void {\n const validFormats = ['csv', 'json', 'xlsx'];\n if (!validFormats.includes(options.format)) {\n throw new Error(`Invalid export format: ${options.format}. Valid formats: ${validFormats.join(', ')}`);\n }\n }\n\n /**\n * Get supported export formats\n *\n * @returns Array of supported format strings\n */\n getSupportedFormats(): string[] {\n return ['csv', 'json', 'xlsx'];\n }\n\n /**\n * Get module metadata\n *\n * @returns Module metadata object\n */\n getMetadata(): {\n moduleKey?: string;\n displayName?: string;\n description?: string;\n supportedProducts?: string[];\n supportedFormats: string[];\n } {\n return {\n moduleKey: this.moduleKey,\n displayName: this.displayName,\n description: this.description,\n supportedProducts: this.supportedProducts,\n supportedFormats: this.getSupportedFormats(),\n };\n }\n}\n","/**\n * Pagination Service\n *\n * Provides pagination utilities for export operations across all Burdenoff microservices.\n * Supports both offset-based and cursor-based pagination strategies.\n *\n * @module export/pagination\n *\n * @example\n * ```typescript\n * import { PaginationService } from '@burdenoff/be-sdk/export';\n *\n * // Offset-based pagination\n * const result = PaginationService.paginate(items, { page: 2, pageSize: 20 });\n *\n * // Cursor-based pagination with async generator\n * for await (const item of PaginationService.paginatedQuery(fetchFn, { limit: 100 })) {\n * console.log(item);\n * }\n * ```\n */\n\nimport type { PaginatedQueryOptions, PaginatedResult, PaginationParams } from './types.js';\n\n/**\n * Service providing pagination utilities for export and data fetching operations\n */\nexport class PaginationService {\n /**\n * Paginate an array of items using offset-based pagination\n *\n * @param items - Array of items to paginate\n * @param params - Pagination parameters\n * @returns Paginated result with items and metadata\n *\n * @example\n * ```typescript\n * const allUsers = await db.user.findMany();\n * const page = PaginationService.paginate(allUsers, { page: 1, pageSize: 10 });\n * console.log(page.items); // First 10 users\n * console.log(page.pageInfo.hasNextPage); // true if more pages exist\n * ```\n */\n static paginate<T>(items: T[], params: PaginationParams): PaginatedResult<T> {\n const page = params.page ?? 1;\n const pageSize = params.pageSize ?? 20;\n const start = (page - 1) * pageSize;\n const end = start + pageSize;\n\n const paginatedItems = items.slice(start, end);\n\n return {\n items: paginatedItems,\n totalCount: items.length,\n pageInfo: {\n hasNextPage: end < items.length,\n hasPreviousPage: page > 1,\n startCursor: paginatedItems.length > 0 ? String(start) : undefined,\n endCursor: paginatedItems.length > 0 ? String(Math.min(end, items.length) - 1) : undefined,\n },\n };\n }\n\n /**\n * Calculate pagination metadata without slicing data\n *\n * @param totalCount - Total number of items\n * @param page - Current page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Pagination metadata\n *\n * @example\n * ```typescript\n * const meta = PaginationService.calculatePagination(150, 3, 20);\n * // meta.hasNextPage = true (page 4 exists)\n * // meta.hasPreviousPage = true (page 2 exists)\n * // meta.totalPages = 8\n * ```\n */\n static calculatePagination(\n totalCount: number,\n page: number,\n pageSize: number\n ): {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n totalPages: number;\n currentPage: number;\n pageSize: number;\n startIndex: number;\n endIndex: number;\n } {\n const totalPages = Math.ceil(totalCount / pageSize);\n const startIndex = (page - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalCount - 1);\n\n return {\n hasNextPage: page < totalPages,\n hasPreviousPage: page > 1,\n totalPages,\n currentPage: page,\n pageSize,\n startIndex,\n endIndex,\n };\n }\n\n /**\n * Async generator for paginated database queries using cursor-based pagination\n *\n * This is ideal for processing large datasets without loading everything into memory.\n * The generator yields items one at a time, fetching new batches as needed.\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Async generator of items\n *\n * @example\n * ```typescript\n * // Define fetch function that queries the database\n * const fetchUsers = async (cursor?: string) => {\n * return db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : undefined,\n * orderBy: { id: 'asc' },\n * take: 100,\n * });\n * };\n *\n * // Process all users without loading all into memory\n * for await (const user of PaginationService.paginatedQuery(fetchUsers)) {\n * await processUser(user);\n * }\n * ```\n */\n static async *paginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): AsyncGenerator<T, void, unknown> {\n const { limit, initialCursor } = options;\n let cursor = initialCursor;\n let hasMore = true;\n let totalYielded = 0;\n\n while (hasMore) {\n const items = await fetchFn(cursor);\n\n if (items.length === 0) {\n break;\n }\n\n for (const item of items) {\n yield item;\n totalYielded++;\n\n if (limit && totalYielded >= limit) {\n return;\n }\n }\n\n // Get next cursor from last item\n const lastItem = items[items.length - 1];\n if (lastItem) {\n cursor = lastItem.id;\n }\n\n // If we got fewer items than expected batch size, we're done\n // Note: This assumes fetchFn respects a consistent batch size internally\n hasMore = items.length > 0;\n }\n }\n\n /**\n * Collect all items from a paginated query into an array\n *\n * @param fetchFn - Function to fetch data given a cursor\n * @param options - Pagination options\n * @returns Array of all items\n *\n * @example\n * ```typescript\n * const allUsers = await PaginationService.collectPaginatedQuery(fetchUsers, { limit: 1000 });\n * ```\n */\n static async collectPaginatedQuery<T extends { id: string }>(\n fetchFn: (cursor?: string) => Promise<T[]>,\n options: PaginatedQueryOptions = {}\n ): Promise<T[]> {\n const items: T[] = [];\n\n for await (const item of PaginationService.paginatedQuery(fetchFn, options)) {\n items.push(item);\n }\n\n return items;\n }\n\n /**\n * Create a cursor-based paginated fetch function from a Prisma-style query\n *\n * @param queryFn - Prisma-style query function\n * @param batchSize - Number of items to fetch per batch\n * @returns Fetch function compatible with paginatedQuery\n *\n * @example\n * ```typescript\n * const fetchFn = PaginationService.createPrismaFetchFn(\n * (cursor) => db.user.findMany({\n * where: { isActive: true, ...(cursor ? { id: { gt: cursor } } : {}) },\n * orderBy: { id: 'asc' },\n * take: 100,\n * }),\n * 100\n * );\n *\n * for await (const user of PaginationService.paginatedQuery(fetchFn)) {\n * console.log(user);\n * }\n * ```\n */\n static createPrismaFetchFn<T extends { id: string }>(\n queryFn: (cursor?: string) => Promise<T[]>,\n _batchSize: number = 100\n ): (cursor?: string) => Promise<T[]> {\n return queryFn;\n }\n\n /**\n * Calculate offset for skip-based pagination\n *\n * @param page - Page number (1-indexed)\n * @param pageSize - Items per page\n * @returns Offset value for skip\n */\n static calculateOffset(page: number, pageSize: number): number {\n return (Math.max(1, page) - 1) * pageSize;\n }\n\n /**\n * Parse cursor string to extract pagination state\n *\n * @param cursor - Base64-encoded cursor string\n * @returns Decoded cursor data or null if invalid\n */\n static parseCursor<T = Record<string, unknown>>(cursor: string): T | null {\n try {\n const decoded = Buffer.from(cursor, 'base64').toString('utf-8');\n return JSON.parse(decoded) as T;\n } catch {\n return null;\n }\n }\n\n /**\n * Create cursor string from pagination state\n *\n * @param data - Data to encode in cursor\n * @returns Base64-encoded cursor string\n */\n static createCursor(data: Record<string, unknown>): string {\n return Buffer.from(JSON.stringify(data)).toString('base64');\n }\n}\n","/**\n * CSV Utilities\n *\n * Utilities for converting data to CSV format for export operations.\n *\n * @module export/csv\n *\n * @example\n * ```typescript\n * import { convertToCSV, parseCSV } from '@burdenoff/be-sdk/export';\n *\n * const csv = convertToCSV(users, { includeHeaders: true });\n * console.log(csv);\n * ```\n */\n\nimport type { CSVConversionOptions } from './types.js';\n\nconst FORMULA_PREFIX_RE = /^[=+\\-@]/;\n\nexport function sanitizeCSVCell(value: string): string {\n return FORMULA_PREFIX_RE.test(value) ? `'${value}` : value;\n}\n\n/**\n * Convert an array of objects to CSV format\n *\n * Handles nested objects by flattening them with dot notation.\n * Arrays are JSON stringified.\n * Dates are converted to ISO strings.\n *\n * @param data - Array of objects to convert\n * @param options - CSV conversion options\n * @returns CSV string\n *\n * @example\n * ```typescript\n * const users = [\n * { id: 1, name: 'John', address: { city: 'NYC' } },\n * { id: 2, name: 'Jane', address: { city: 'LA' } },\n * ];\n *\n * const csv = convertToCSV(users);\n * // Output:\n * // id,name,address.city\n * // 1,John,NYC\n * // 2,Jane,LA\n * ```\n */\nexport function convertToCSV(data: unknown[], options: CSVConversionOptions = {}): string {\n const { delimiter = ',', includeHeaders = true, flattenFields = true, maxFlattenDepth = 3 } = options;\n\n if (data.length === 0) {\n return '';\n }\n\n // Flatten objects and get all keys\n const flattenObject = (obj: unknown, prefix = '', depth = 0): Record<string, string> => {\n const result: Record<string, string> = {};\n\n if (obj === null || obj === undefined) {\n return result;\n }\n\n if (typeof obj !== 'object') {\n return { [prefix || 'value']: String(obj) };\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n\n if (value === null || value === undefined) {\n result[newKey] = '';\n } else if (value instanceof Date) {\n result[newKey] = value.toISOString();\n } else if (Array.isArray(value)) {\n result[newKey] = JSON.stringify(value);\n } else if (typeof value === 'object' && flattenFields && depth < maxFlattenDepth) {\n Object.assign(result, flattenObject(value, newKey, depth + 1));\n } else if (typeof value === 'object') {\n result[newKey] = JSON.stringify(value);\n } else {\n result[newKey] = String(value);\n }\n }\n\n return result;\n };\n\n // Flatten all records and collect all keys\n const flattenedRecords = data.map((item) => flattenObject(item));\n const allKeys = new Set<string>();\n for (const record of flattenedRecords) {\n for (const key of Object.keys(record)) {\n allKeys.add(key);\n }\n }\n\n const headers = Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n\n // Escape CSV values\n const escapeCSV = (value: string): string => {\n const sanitizedValue = sanitizeCSVCell(value);\n\n if (\n sanitizedValue.includes(delimiter) ||\n sanitizedValue.includes('\"') ||\n sanitizedValue.includes('\\n') ||\n sanitizedValue.includes('\\r')\n ) {\n return `\"${sanitizedValue.replace(/\"/g, '\"\"')}\"`;\n }\n return sanitizedValue;\n };\n\n // Build CSV\n const lines: string[] = [];\n\n if (includeHeaders) {\n lines.push(headers.map(escapeCSV).join(delimiter));\n }\n\n for (const record of flattenedRecords) {\n const row = headers.map((header) => escapeCSV(record[header] || ''));\n lines.push(row.join(delimiter));\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Parse a CSV string into an array of objects\n *\n * @param csv - CSV string to parse\n * @param options - Parse options\n * @returns Array of parsed objects\n *\n * @example\n * ```typescript\n * const csv = 'id,name\\n1,John\\n2,Jane';\n * const data = parseCSV(csv);\n * // [{ id: '1', name: 'John' }, { id: '2', name: 'Jane' }]\n * ```\n */\nexport function parseCSV(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean } = {}\n): Record<string, string>[] {\n const { delimiter = ',', hasHeaders = true } = options;\n\n const lines = csv.split(/\\r?\\n/).filter((line) => line.trim());\n\n if (lines.length === 0) {\n return [];\n }\n\n // Parse a single CSV line, handling quoted values\n const parseLine = (line: string): string[] => {\n const values: string[] = [];\n let current = '';\n let inQuotes = false;\n\n let i = 0;\n while (i < line.length) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n if (char === '\"' && inQuotes && nextChar === '\"') {\n current += '\"';\n i += 2; // Skip next quote\n } else if (char === '\"') {\n inQuotes = !inQuotes;\n i++;\n } else if (char === delimiter && !inQuotes) {\n values.push(current);\n current = '';\n i++;\n } else {\n current += char;\n i++;\n }\n }\n\n values.push(current);\n return values;\n };\n\n let headers: string[];\n let dataLines: string[];\n\n // We've already checked that lines.length > 0, so lines[0] is guaranteed to exist\n const firstLine = lines[0] as string;\n\n if (hasHeaders) {\n headers = parseLine(firstLine);\n dataLines = lines.slice(1);\n } else {\n // Generate numeric headers if no header row\n const firstRow = parseLine(firstLine);\n headers = firstRow.map((_, i) => `col${i}`);\n dataLines = lines;\n }\n\n return dataLines.map((line) => {\n const values = parseLine(line);\n const obj: Record<string, string> = {};\n\n headers.forEach((header, i) => {\n obj[header] = values[i] || '';\n });\n\n return obj;\n });\n}\n\n/**\n * Convert CSV to JSON string\n *\n * @param csv - CSV string\n * @param options - Parse options\n * @returns JSON string\n */\nexport function csvToJSON(\n csv: string,\n options: { delimiter?: string; hasHeaders?: boolean; pretty?: boolean } = {}\n): string {\n const { pretty = false, ...parseOptions } = options;\n const data = parseCSV(csv, parseOptions);\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n}\n\n/**\n * Get CSV headers from data\n *\n * @param data - Array of objects\n * @param flattenFields - Whether to flatten nested objects\n * @returns Array of header strings\n */\nexport function getCSVHeaders(data: unknown[], flattenFields: boolean = true): string[] {\n if (data.length === 0) {\n return [];\n }\n\n const collectKeys = (obj: unknown, prefix = '', depth = 0): string[] => {\n const keys: string[] = [];\n\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return prefix ? [prefix] : [];\n }\n\n for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n flattenFields &&\n depth < 3\n ) {\n keys.push(...collectKeys(value, fullKey, depth + 1));\n } else {\n keys.push(fullKey);\n }\n }\n\n return keys;\n };\n\n const allKeys = new Set<string>();\n for (const item of data) {\n for (const key of collectKeys(item)) {\n allKeys.add(key);\n }\n }\n\n return Array.from(allKeys).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Estimate CSV file size for a dataset\n *\n * @param data - Array of objects\n * @param sampleSize - Number of records to sample for estimation\n * @returns Estimated size in bytes\n */\nexport function estimateCSVSize(data: unknown[], sampleSize: number = 100): number {\n if (data.length === 0) {\n return 0;\n }\n\n // Take a sample to estimate average row size\n const sample = data.slice(0, Math.min(sampleSize, data.length));\n const sampleCSV = convertToCSV(sample);\n const averageRowSize = sampleCSV.length / sample.length;\n\n // Estimate total size (headers + data rows)\n const headers = getCSVHeaders(data);\n const headerSize = headers.join(',').length + 1; // +1 for newline\n\n return Math.ceil(headerSize + averageRowSize * data.length);\n}\n","/**\n * Export Gateway Helper\n *\n * Centralised wrapper around the workspace internal gateway's\n * `createExportJob` mutation, used by per-svc convenience resolvers\n * (e.g. `createTagsExportJob`, `createGroupsExportJob`).\n *\n * Replaces the duplicated `src/clients/export-gateway.ts` files that\n * existed in 19+ workspace svcs.\n *\n * @module export/gateway-client\n *\n * @example\n * ```typescript\n * import { triggerExportJob } from '@burdenoff/be-sdk/export';\n *\n * const result = await triggerExportJob({\n * serviceName: 'wspace-tags-svc',\n * workspaceId: ctx.workspaceId,\n * name: input.name,\n * entityTypes: ['tags', 'vocabularies'],\n * format: input.format,\n * actorId: ctx.actorId,\n * actorType: ctx.actorType,\n * });\n * ```\n */\n\nimport { GatewayClient } from '../gateway/index.js';\nimport type { ServiceLayer } from '../types/layer.js';\n\nconst CREATE_EXPORT_JOB_MUTATION = `mutation CreateExportJob($input: CreateExportJobInput!) {\n createExportJob(input: $input) {\n id\n status\n workspaceId\n entityTypes\n format\n createdAt\n }\n}`;\n\nexport type ExportActorType = 'user' | 'app' | 'service' | 'super_admin';\nexport type ExportFormatGql = 'JSON' | 'CSV';\n\nexport interface TriggerExportJobParams {\n /** Caller service name, used by gateway client telemetry/auth */\n serviceName: string;\n /** Layer for the gateway. Defaults to `wspace`. */\n layer?: ServiceLayer;\n /** Workspace context (required for wspace exports). Sent as the `x-workspace-id` header, never in the input. */\n workspaceId: string;\n /** Human-readable name for the export job. */\n name: string;\n /** Entity types registered in `wspace-export-svc` to include. */\n entityTypes: string[];\n /** Output format. */\n format: ExportFormatGql;\n /** Actor making the request (forwarded to RBAC). */\n actorId: string;\n actorType: ExportActorType;\n /** Whether to include extended metadata in the export ZIP. */\n includeMetadata?: boolean;\n /** Optional ISO date-range bounds. */\n dateRangeStart?: string;\n dateRangeEnd?: string;\n}\n\nexport interface ExportJobResult {\n id: string;\n status: string;\n workspaceId: string;\n entityTypes: string[];\n format: string;\n createdAt: string;\n}\n\ninterface CreateExportJobResponse {\n createExportJob?: ExportJobResult;\n}\n\n/**\n * Submit a `createExportJob` mutation to the workspace internal gateway.\n *\n * The caller is expected to map the returned `ExportJobResult` to its\n * own GraphQL output type (the per-svc `ExportJobResponse`).\n */\nexport async function triggerExportJob(params: TriggerExportJobParams): Promise<ExportJobResult> {\n const {\n serviceName,\n layer = 'wspace',\n actorId,\n actorType,\n workspaceId,\n name,\n entityTypes,\n format,\n includeMetadata,\n dateRangeStart,\n dateRangeEnd,\n } = params;\n\n const client = new GatewayClient({ layer, serviceName });\n\n // `CreateExportJobInput` carries no `workspaceId`: wspace-export-svc takes\n // the workspace from the `x-workspace-id` header so a caller can never\n // export another tenant's data. Sending the field makes GraphQL reject the\n // whole variable (\"Field \\\"workspaceId\\\" is not defined by type\n // \\\"CreateExportJobInput\\\"\"), so the workspace travels in the header only.\n const input = {\n name,\n entityTypes,\n format,\n ...(includeMetadata !== undefined ? { includeMetadata } : {}),\n ...(dateRangeStart !== undefined ? { dateRangeStart } : {}),\n ...(dateRangeEnd !== undefined ? { dateRangeEnd } : {}),\n };\n\n const response = await client.internalQuery<CreateExportJobResponse>({\n query: CREATE_EXPORT_JOB_MUTATION,\n variables: { input },\n headers: {\n 'x-actor-id': actorId,\n 'x-actor-type': actorType,\n 'x-workspace-id': workspaceId,\n },\n });\n\n const job = response.data?.createExportJob;\n if (!job) {\n throw new Error('Export service did not return a job');\n }\n return job;\n}\n","/**\n * Export Module\n *\n * Provides common utilities for data export operations across all Burdenoff microservices.\n * Includes pagination services, base exporter classes, CSV utilities, and type definitions.\n *\n * @module export\n *\n * @example\n * ```typescript\n * // Import from the export module\n * import {\n * BaseModuleExporter,\n * PaginationService,\n * convertToCSV,\n * } from '@burdenoff/be-sdk/export';\n *\n * // Create a custom exporter\n * class UserExporter extends BaseModuleExporter<User> {\n * moduleKey = 'users';\n * displayName = 'Users';\n *\n * async export(options: ExportOptions): Promise<ExportResult> {\n * const data = await this.fetchAll(\n * (cursor) => db.user.findMany({\n * where: cursor ? { id: { gt: cursor } } : {},\n * take: 100,\n * })\n * );\n *\n * const csv = convertToCSV(data);\n * return { data, format: 'csv' };\n * }\n * }\n *\n * // Use pagination utilities\n * const result = PaginationService.paginate(items, { page: 1, pageSize: 20 });\n * ```\n */\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type {\n // Export format types\n ExportFormat,\n ExportFormatEnum,\n\n // Configuration types\n ExportConfig,\n ExportOptions,\n\n // Job types\n ExportJobStatus,\n ExportJob,\n ExportProgress,\n ExportResult,\n\n // Fetch types\n ExportFetchOptions,\n ExportFetchResult,\n\n // Pagination types\n PaginationParams,\n PaginatedResult,\n PaginatedQueryOptions,\n PaginateResult,\n PaginateQueryFn,\n\n // Module interface\n ExportableModule,\n\n // CSV types\n CSVConversionOptions,\n} from './types.js';\n\n// ============================================================================\n// Class Exports\n// ============================================================================\n\nexport { BaseModuleExporter } from './base-exporter.js';\nexport { PaginationService } from './pagination.js';\n\n// ============================================================================\n// Function Exports\n// ============================================================================\n\nexport { convertToCSV, parseCSV, csvToJSON, getCSVHeaders, estimateCSVSize } from './csv.js';\n\n// ============================================================================\n// Gateway Helper Exports\n// ============================================================================\n\nexport { triggerExportJob } from './gateway-client.js';\nexport type { TriggerExportJobParams, ExportJobResult, ExportActorType, ExportFormatGql } from './gateway-client.js';\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,IAAsB,qBAAtB,MAAsD;;CAEpD;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA,AAAU;;;;;;;;;;;;;;;;;CA6BV,AAAU,aAAa,QAAqC,eAAmD;EAC7G,MAAM,kBAAkB,iBAAiB,KAAK,wBAAwB,CAAC;EAEvE,IAAI,gBAAgB,WAAW,GAC7B,OAAO;EAGT,MAAM,WAAoC,CAAC;EAC3C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AAa,MACA,CAAC,CAAC,SAAS,OAAO;CAIjD,MAAM,aADU,cAAc,IACL,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS;CAE9C,OAAO,KAAK,KAAK,aAAa,iBAAiB,KAAK,MAAM;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/QA,MAAM,6BAA6B;;;;;;;;;;;;;;;;AAwDnC,eAAsB,iBAAiB,QAA0D;CAC/F,MAAM,EACJ,aACA,QAAQ,UACR,SACA,WACA,aACA,MACA,aACA,QACA,iBACA,gBACA,iBACE;CAEJ,MAAM,SAAS,IAAI,cAAc;EAAE;EAAO;CAAY,CAAC;CAOvD,MAAM,QAAQ;EACZ;EACA;EACA;EACA,GAAI,oBAAoB,SAAY,EAAE,gBAAgB,IAAI,CAAC;EAC3D,GAAI,mBAAmB,SAAY,EAAE,eAAe,IAAI,CAAC;EACzD,GAAI,iBAAiB,SAAY,EAAE,aAAa,IAAI,CAAC;CACvD;CAYA,MAAM,OAAM,MAVW,OAAO,cAAuC;EACnE,OAAO;EACP,WAAW,EAAE,MAAM;EACnB,SAAS;GACP,cAAc;GACd,gBAAgB;GAChB,kBAAkB;EACpB;CACF,CAAC,EAEmB,CAAC,MAAM;CAC3B,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,qCAAqC;CAEvD,OAAO;AACT"}
@@ -1,2 +1,2 @@
1
- import { A as FileMetadata, B as UploadSessionPart, C as DownloadUrlOptions, D as FileActor, E as FILE_VISIBILITIES, F as FilesTransport, H as UploadedPart, I as RawFileMetadata, L as RequireFileOptions, M as FileUploadType, N as FileVisibility, O as FileActorType, P as FilesFetch, R as StoredFile, S as DownloadFileOptions, T as FILE_ACTOR_TYPES, V as UploadSessionTicket, _ as isFilesClientError, a as toFileReference, b as CreateUploadSessionInput, c as MAX_DOWNLOAD_URL_TTL_SECONDS, d as fileExtensionOf, f as mapFileMetadata, g as classifyFilesErrors, h as FilesClientErrorCode, i as isFileReference, j as FileStatus, k as FileBytes, l as MIN_DOWNLOAD_URL_TTL_SECONDS, m as FilesClientError, n as FILE_REFERENCE_KIND, o as FilesClient, p as FILES_CLIENT_GRAPHQL_CODES, r as FileReference, s as FilesClientOptions, u as clampDownloadUrlTtl, v as toFilesClientError, w as DownloadedFile, x as DeleteFileOptions, y as CompleteUploadSessionInput, z as UploadFileInput } from "../index-BGzMYJsm.js";
1
+ import { A as FileMetadata, B as UploadSessionPart, C as DownloadUrlOptions, D as FileActor, E as FILE_VISIBILITIES, F as FilesTransport, H as UploadedPart, I as RawFileMetadata, L as RequireFileOptions, M as FileUploadType, N as FileVisibility, O as FileActorType, P as FilesFetch, R as StoredFile, S as DownloadFileOptions, T as FILE_ACTOR_TYPES, V as UploadSessionTicket, _ as isFilesClientError, a as toFileReference, b as CreateUploadSessionInput, c as MAX_DOWNLOAD_URL_TTL_SECONDS, d as fileExtensionOf, f as mapFileMetadata, g as classifyFilesErrors, h as FilesClientErrorCode, i as isFileReference, j as FileStatus, k as FileBytes, l as MIN_DOWNLOAD_URL_TTL_SECONDS, m as FilesClientError, n as FILE_REFERENCE_KIND, o as FilesClient, p as FILES_CLIENT_GRAPHQL_CODES, r as FileReference, s as FilesClientOptions, u as clampDownloadUrlTtl, v as toFilesClientError, w as DownloadedFile, x as DeleteFileOptions, y as CompleteUploadSessionInput, z as UploadFileInput } from "../index-8pUSoT85.js";
2
2
  export { type CompleteUploadSessionInput, type CreateUploadSessionInput, type DeleteFileOptions, type DownloadFileOptions, type DownloadUrlOptions, type DownloadedFile, FILES_CLIENT_GRAPHQL_CODES, FILE_ACTOR_TYPES, FILE_REFERENCE_KIND, FILE_VISIBILITIES, type FileActor, type FileActorType, type FileBytes, type FileMetadata, type FileReference, type FileStatus, type FileUploadType, type FileVisibility, FilesClient, FilesClientError, type FilesClientErrorCode, type FilesClientOptions, type FilesFetch, type FilesTransport, MAX_DOWNLOAD_URL_TTL_SECONDS, MIN_DOWNLOAD_URL_TTL_SECONDS, type RawFileMetadata, type RequireFileOptions, type StoredFile, type UploadFileInput, type UploadSessionPart, type UploadSessionTicket, type UploadedPart, clampDownloadUrlTtl, classifyFilesErrors, fileExtensionOf, isFileReference, isFilesClientError, mapFileMetadata, toFileReference, toFilesClientError };
@@ -1,4 +1,4 @@
1
- import { a as GatewayError, c as GraphQLRequestOptions, d as IGatewayClient, f as RequestContext, i as GatewayClientHealth, l as GraphQLResponse, n as CircuitState, o as GatewayErrorType, r as GatewayClientConfig, s as GraphQLError, t as CircuitBreakerStats, u as ICircuitBreaker } from "../types-C6EKaS3V.js";
2
- import { a as signServiceJwt, c as createGatewayClientFromEnv, i as buildDelegatedGatewayHeaders, l as isGatewayClientError, n as DELEGATED_AUTHORIZATION_HEADER, o as GatewayClient, r as DelegatedGatewayTransportInput, s as createGatewayClient } from "../index-YOShAwkq.js";
1
+ import { a as GatewayError, c as GraphQLRequestOptions, d as IGatewayClient, f as RequestContext, i as GatewayClientHealth, l as GraphQLResponse, n as CircuitState, o as GatewayErrorType, r as GatewayClientConfig, s as GraphQLError, t as CircuitBreakerStats, u as ICircuitBreaker } from "../types-gJ9Qqi9E.js";
2
+ import { C as createGatewayClient, S as GatewayClient, T as isGatewayClientError, _ as revokeProactiveConsent, a as ProactiveIdentityClient, b as buildDelegatedGatewayHeaders, c as ProactiveIdentityOptions, d as RevokeProactiveConsentInput, f as getProactiveConsent, g as proactiveAssistantClientId, h as issueProactiveReadToken, i as ProactiveConsent, l as ProactiveIdentityTarget, m as isProactiveConsentMissing, n as IssueProactiveReadTokenInput, o as ProactiveIdentityError, p as grantProactiveConsent, r as PROACTIVE_READ_SCOPE, s as ProactiveIdentityErrorCode, u as ProactiveReadToken, v as DELEGATED_AUTHORIZATION_HEADER, w as createGatewayClientFromEnv, x as signServiceJwt, y as DelegatedGatewayTransportInput } from "../index-oJMtR3nl.js";
3
3
  import { t as index_d_exports } from "../index-C0qLquY0.js";
4
- export { type CircuitBreakerStats, CircuitState, DELEGATED_AUTHORIZATION_HEADER, type DelegatedGatewayTransportInput, GatewayClient, type GatewayClientConfig, type GatewayClientHealth, GatewayError, GatewayErrorType, type GraphQLError, type GraphQLRequestOptions, type GraphQLResponse, type ICircuitBreaker, type IGatewayClient, type RequestContext, index_d_exports as Security, buildDelegatedGatewayHeaders, createGatewayClient, createGatewayClientFromEnv, isGatewayClientError, signServiceJwt };
4
+ export { type CircuitBreakerStats, CircuitState, DELEGATED_AUTHORIZATION_HEADER, type DelegatedGatewayTransportInput, GatewayClient, type GatewayClientConfig, type GatewayClientHealth, GatewayError, GatewayErrorType, type GraphQLError, type GraphQLRequestOptions, type GraphQLResponse, type ICircuitBreaker, type IGatewayClient, type IssueProactiveReadTokenInput, PROACTIVE_READ_SCOPE, type ProactiveConsent, type ProactiveIdentityClient, ProactiveIdentityError, type ProactiveIdentityErrorCode, type ProactiveIdentityOptions, type ProactiveIdentityTarget, type ProactiveReadToken, type RequestContext, type RevokeProactiveConsentInput, index_d_exports as Security, buildDelegatedGatewayHeaders, createGatewayClient, createGatewayClientFromEnv, getProactiveConsent, grantProactiveConsent, isGatewayClientError, isProactiveConsentMissing, issueProactiveReadToken, proactiveAssistantClientId, revokeProactiveConsent, signServiceJwt };
@@ -1,8 +1,8 @@
1
1
  import { t as signServiceJwt } from "../service-jwt-Bu-WNA_-.js";
2
2
  import { a as isGatewayClientError, i as createGatewayClientFromEnv, r as createGatewayClient, t as GatewayClient } from "../client-sAJTrb4i.js";
3
3
  import { n as GatewayError, r as GatewayErrorType, t as CircuitState } from "../types-BYMYND1L.js";
4
- import { n as DELEGATED_AUTHORIZATION_HEADER, r as buildDelegatedGatewayHeaders } from "../gateway-ByVo-n37.js";
4
+ import { a as grantProactiveConsent, c as proactiveAssistantClientId, d as buildDelegatedGatewayHeaders, i as getProactiveConsent, l as revokeProactiveConsent, n as PROACTIVE_READ_SCOPE, o as isProactiveConsentMissing, r as ProactiveIdentityError, s as issueProactiveReadToken, u as DELEGATED_AUTHORIZATION_HEADER } from "../gateway-2en8Gx_a.js";
5
5
  import { t as security_exports } from "../security-DIG-95Ic.js";
6
6
 
7
- export { CircuitState, DELEGATED_AUTHORIZATION_HEADER, GatewayClient, GatewayError, GatewayErrorType, security_exports as Security, buildDelegatedGatewayHeaders, createGatewayClient, createGatewayClientFromEnv, isGatewayClientError, signServiceJwt };
7
+ export { CircuitState, DELEGATED_AUTHORIZATION_HEADER, GatewayClient, GatewayError, GatewayErrorType, PROACTIVE_READ_SCOPE, ProactiveIdentityError, security_exports as Security, buildDelegatedGatewayHeaders, createGatewayClient, createGatewayClientFromEnv, getProactiveConsent, grantProactiveConsent, isGatewayClientError, isProactiveConsentMissing, issueProactiveReadToken, proactiveAssistantClientId, revokeProactiveConsent, signServiceJwt };
8
8
  //# sourceMappingURL=index.js.map