@burdenoff/be-sdk 2026.1112.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.
- package/dist/activity/index.d.ts +2 -2
- package/dist/ai-credits/index.d.ts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/cache/index.d.ts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/event-queue/index.d.ts +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/export/index.js +1 -1
- package/dist/{export-DJXE3Osa.js → export-lqKewsuF.js} +2 -2
- package/dist/{export-DJXE3Osa.js.map → export-lqKewsuF.js.map} +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/gateway/index.d.ts +3 -3
- package/dist/gateway/index.js +2 -2
- package/dist/gateway-2en8Gx_a.js +274 -0
- package/dist/gateway-2en8Gx_a.js.map +1 -0
- package/dist/graph/index.d.ts +1 -1
- package/dist/{graphql-CUDyhibV.d.ts → graphql-C8jKLLel.d.ts} +1 -1
- package/dist/{index-B2LCaK0R.d.ts → index-479i3w77.d.ts} +1 -1
- package/dist/{index-BGzMYJsm.d.ts → index-8pUSoT85.d.ts} +1 -1
- package/dist/{index-ADmsX0BI.d.ts → index-9MJVKzWA.d.ts} +3 -3
- package/dist/{index-FbXPfen7.d.ts → index-BJwHEzpN.d.ts} +1 -1
- package/dist/{index-CTTwo9av.d.ts → index-BTaQMEgB.d.ts} +1 -1
- package/dist/{index-CDOqxSIi.d.ts → index-Base-sg5.d.ts} +1 -1
- package/dist/{index-C_GXXF32.d.ts → index-Bh6W5JO4.d.ts} +3 -3
- package/dist/{index-BeVtqGO-.d.ts → index-Bwn5Z1h-.d.ts} +1 -1
- package/dist/{index-FRRaa6h2.d.ts → index-CEtULfb_.d.ts} +3 -3
- package/dist/{index-DqbGqfAy.d.ts → index-Cwu5Mpji.d.ts} +1 -1
- package/dist/{index-CaM9JUcc.d.ts → index-DSynXDRD.d.ts} +1 -1
- package/dist/{index-CVCyKzhB.d.ts → index-DWER4-_x.d.ts} +3 -3
- package/dist/{index-cmR9k9ga.d.ts → index-DhFP_AIB.d.ts} +1 -1
- package/dist/{index-zd_NPGJo.d.ts → index-DqpCL9kD.d.ts} +4 -4
- package/dist/{index-U_tu3zUl.d.ts → index-Dw_0wE4q.d.ts} +2 -2
- package/dist/{index-3KOZ1zN9.d.ts → index-HeUeEsMU.d.ts} +1 -1
- package/dist/{index-Cot73bdh.d.ts → index-KlrnELrN.d.ts} +1 -1
- package/dist/{index-MArCb8Aq.d.ts → index-SvWwlTUC.d.ts} +1 -1
- package/dist/{index-CHwMhK6v.d.ts → index-YMGOJins.d.ts} +2 -2
- package/dist/index-oJMtR3nl.d.ts +88 -0
- package/dist/index.d.ts +21 -21
- package/dist/index.js +5 -5
- package/dist/init/index.d.ts +1 -1
- package/dist/init/index.js +1 -1
- package/dist/{init-CQPFmOOe.js → init-D814LeLF.js} +2 -2
- package/dist/{init-CQPFmOOe.js.map → init-D814LeLF.js.map} +1 -1
- package/dist/instrumentation/index.d.ts +2 -2
- package/dist/layer/index.d.ts +2 -2
- package/dist/layer-Bcix-WCl.js.map +1 -1
- package/dist/{layer-BZBZZWeV.d.ts → layer-C0zxAUgR.d.ts} +1 -0
- package/dist/logger/index.d.ts +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/payments/index.d.ts +2 -2
- package/dist/rbac/index.d.ts +1 -1
- package/dist/resource-caps/index.d.ts +1 -1
- package/dist/search/index.d.ts +2 -2
- package/dist/security/index.d.ts +1 -1
- package/dist/security/rate-limit/index.d.ts +1 -1
- package/dist/tags/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/temporal/index.d.ts +1 -1
- package/dist/tracker/index.d.ts +2 -2
- package/dist/tracker/index.js +2 -2
- package/dist/{tracker-PQztSlhJ.js → tracker-Cl3cGKe-.js} +2 -2
- package/dist/{tracker-PQztSlhJ.js.map → tracker-Cl3cGKe-.js.map} +1 -1
- package/dist/translation/index.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{types-C6EKaS3V.d.ts → types-gJ9Qqi9E.d.ts} +1 -1
- package/dist/usage/index.d.ts +1 -1
- package/dist/usage/index.js +1 -1
- package/dist/{usage-BRqVP3CJ.js → usage-ygkKsxdd.js} +2 -2
- package/dist/{usage-BRqVP3CJ.js.map → usage-ygkKsxdd.js.map} +1 -1
- package/package.json +1 -1
- package/dist/gateway-ByVo-n37.js +0 -50
- package/dist/gateway-ByVo-n37.js.map +0 -1
- package/dist/index-YOShAwkq.d.ts +0 -45
package/dist/activity/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "../graphql-
|
|
2
|
-
import { m as SDKError, p as SDKContext } from "../index-
|
|
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-
|
|
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 };
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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;
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/export/index.d.ts
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/export/index.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
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,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,MAAM,SAAS;EAEf,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,CAAC,gBAAgB,SAAS,GAAG,GAC/B,SAAS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AK,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,MAAM,SAAS;EAEf,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,CAAC,gBAAgB,SAAS,GAAG,GAC/B,SAAS,OAAO;EAIpB,OAAO;CACT;;;;;;;;CASA,AAAU,iBACR,UACA,eAC2B;EAC3B,OAAO,SAAS,KAAK,WAAW,KAAK,aAAa,QAAQ,aAAa,CAAC;CAC1E;;;;;;;;;;;;;;;;;;;;;;;;CAyBA,MAAgB,SACd,SACA,OAAe,GACf,WAAmB,KACS;EAC5B,MAAM,QAAQ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,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"}
|
package/dist/files/index.d.ts
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/gateway/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
import { a as
|
|
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 };
|
package/dist/gateway/index.js
CHANGED
|
@@ -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
|
|
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
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
|
|
2
|
+
import { a as isGatewayClientError, i as createGatewayClientFromEnv, r as createGatewayClient, t as GatewayClient } from "./client-sAJTrb4i.js";
|
|
3
|
+
import { t as signServiceJwt } from "./service-jwt-Bu-WNA_-.js";
|
|
4
|
+
import { n as GatewayError, r as GatewayErrorType, t as CircuitState } from "./types-BYMYND1L.js";
|
|
5
|
+
import { t as security_exports } from "./security-DIG-95Ic.js";
|
|
6
|
+
|
|
7
|
+
// src/gateway/delegated-transport.ts
|
|
8
|
+
/** Header an internal gateway reads a delegated `app_as_user` bearer from. */
|
|
9
|
+
const DELEGATED_AUTHORIZATION_HEADER = "x-delegated-authorization";
|
|
10
|
+
const JWT_SEGMENT = /^[A-Za-z0-9_-]+$/;
|
|
11
|
+
function isCompactJwt(token) {
|
|
12
|
+
const segments = token.split(".");
|
|
13
|
+
return segments.length === 3 && segments.every((segment) => JWT_SEGMENT.test(segment));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Builds the request headers for a delegated internal-gateway call, for use as
|
|
17
|
+
* `GatewayClient.internalQuery({ query, headers })`.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error when the token is not a compact JWS (so a malformed value can
|
|
20
|
+
* never be smuggled into a header) or the workspace id is blank.
|
|
21
|
+
*/
|
|
22
|
+
function buildDelegatedGatewayHeaders(input) {
|
|
23
|
+
const token = input.appAsUserToken;
|
|
24
|
+
if (typeof token !== "string" || token.length === 0 || token.length > 8192 || !isCompactJwt(token)) throw new Error("Delegated gateway transport requires a compact app_as_user token");
|
|
25
|
+
const headers = { [DELEGATED_AUTHORIZATION_HEADER]: `Bearer ${token}` };
|
|
26
|
+
if (input.workspaceId !== void 0) {
|
|
27
|
+
const workspaceId = input.workspaceId.trim();
|
|
28
|
+
if (workspaceId.length === 0 || workspaceId !== input.workspaceId) throw new Error("Delegated gateway transport requires a non-blank workspace id");
|
|
29
|
+
headers["x-workspace-id"] = workspaceId;
|
|
30
|
+
}
|
|
31
|
+
return headers;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/gateway/proactive-identity.ts
|
|
35
|
+
/**
|
|
36
|
+
* Proactive assistant identity (BOFF-13161, Contract C2 of BOFF-13159).
|
|
37
|
+
*
|
|
38
|
+
* A background proactive assistant reads a product AS a user, read-only, and
|
|
39
|
+
* only after the user opted in. global-auth-svc owns the identity: one
|
|
40
|
+
* service-managed BOT app per product (`proactive-assistant-<product>`), the
|
|
41
|
+
* user's consent as an AppUserDelegation with scopes `["delegation:read"]`
|
|
42
|
+
* per workspace for 30 days, and a short-lived `app_as_user` read token. The
|
|
43
|
+
* gateways refuse every mutation and subscription such a token sends
|
|
44
|
+
* (FORBIDDEN / DELEGATION_READ_ONLY, Contract C1).
|
|
45
|
+
*
|
|
46
|
+
* These helpers call global-auth's internal, service-only fields over the
|
|
47
|
+
* global internal gateway, signed as the calling service. Only the proactive
|
|
48
|
+
* orchestrator service (wspace-sandbox-svc) is accepted by global-auth.
|
|
49
|
+
*
|
|
50
|
+
* Trust boundary: pass the user the calling service authenticated itself (the
|
|
51
|
+
* gateway-verified actor of its own self-scoped request), never an id taken
|
|
52
|
+
* from job input, a model's output or any other untrusted text.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import {
|
|
57
|
+
* buildDelegatedGatewayHeaders,
|
|
58
|
+
* createGatewayClientFromEnv,
|
|
59
|
+
* issueProactiveReadToken,
|
|
60
|
+
* } from '@burdenoff/be-sdk/gateway';
|
|
61
|
+
*
|
|
62
|
+
* const { token } = await issueProactiveReadToken({ product: 'fluidgrids', userId, workspaceId });
|
|
63
|
+
* // Read as the user through the internal gateway; a mutation is refused there.
|
|
64
|
+
* await createGatewayClientFromEnv().internalQuery({
|
|
65
|
+
* query: '{ workflows { id name } }',
|
|
66
|
+
* headers: buildDelegatedGatewayHeaders({ appAsUserToken: token, workspaceId }),
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @module gateway/proactive-identity
|
|
71
|
+
*/
|
|
72
|
+
/** The only scope a proactive consent or read token carries. */
|
|
73
|
+
const PROACTIVE_READ_SCOPE = "delegation:read";
|
|
74
|
+
/** Client id of a product's proactive assistant app. */
|
|
75
|
+
function proactiveAssistantClientId(product) {
|
|
76
|
+
return `proactive-assistant-${product.trim().toLowerCase()}`;
|
|
77
|
+
}
|
|
78
|
+
var ProactiveIdentityError = class extends Error {
|
|
79
|
+
code;
|
|
80
|
+
constructor(message, code) {
|
|
81
|
+
super(message);
|
|
82
|
+
this.code = code;
|
|
83
|
+
this.name = "ProactiveIdentityError";
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/** Whether `error` is the refusal for a user without live consent. */
|
|
87
|
+
function isProactiveConsentMissing(error) {
|
|
88
|
+
return error instanceof ProactiveIdentityError && error.code === "CONSENT_MISSING";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* GraphQL codes that describe an unavailable dependency rather than a decision
|
|
92
|
+
* by global-auth; the gateways mask an unreachable subgraph with these.
|
|
93
|
+
*/
|
|
94
|
+
const UNAVAILABLE_CODES = /* @__PURE__ */ new Set([
|
|
95
|
+
"INTERNAL_SERVER_ERROR",
|
|
96
|
+
"SERVICE_UNAVAILABLE",
|
|
97
|
+
"AUTH_SERVICE_UNAVAILABLE",
|
|
98
|
+
"DOWNSTREAM_SERVICE_ERROR",
|
|
99
|
+
"GATEWAY_TIMEOUT"
|
|
100
|
+
]);
|
|
101
|
+
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
102
|
+
function codeOf(error) {
|
|
103
|
+
const code = error.extensions?.["code"];
|
|
104
|
+
return typeof code === "string" ? code : null;
|
|
105
|
+
}
|
|
106
|
+
/** The refusal carried by a GraphQL error, or null when it is not a decision. */
|
|
107
|
+
function refusalOf(errors) {
|
|
108
|
+
const first = errors?.[0];
|
|
109
|
+
if (!first) return null;
|
|
110
|
+
const code = codeOf(first);
|
|
111
|
+
if (!code || UNAVAILABLE_CODES.has(code)) return null;
|
|
112
|
+
return new ProactiveIdentityError(first.message, code);
|
|
113
|
+
}
|
|
114
|
+
function cloudflareAccessHeaders() {
|
|
115
|
+
const id = process.env["CF_ACCESS_CLIENT_ID"];
|
|
116
|
+
const secret = process.env["CF_ACCESS_CLIENT_SECRET"];
|
|
117
|
+
return id && secret ? {
|
|
118
|
+
"cf-access-client-id": id,
|
|
119
|
+
"cf-access-client-secret": secret
|
|
120
|
+
} : {};
|
|
121
|
+
}
|
|
122
|
+
function envServiceIdentity() {
|
|
123
|
+
return (process.env["SERVICE_IDENTITY"] || process.env["SERVICE_NAME"])?.trim() || void 0;
|
|
124
|
+
}
|
|
125
|
+
function defaultClient(timeoutMs, identity) {
|
|
126
|
+
const url = (process.env["GLOBAL_INT_GATEWAY_URL"] || process.env["GLOBAL_PUBLIC_GATEWAY_URL"])?.trim();
|
|
127
|
+
if (!url) throw new ProactiveIdentityError("No global gateway is configured (GLOBAL_INT_GATEWAY_URL)", "UNAVAILABLE");
|
|
128
|
+
if (!identity) throw new ProactiveIdentityError("SERVICE_IDENTITY or SERVICE_NAME is required to sign the call", "UNAVAILABLE");
|
|
129
|
+
const layer = process.env["SERVICE_LAYER"] === "global" ? "global" : "wspace";
|
|
130
|
+
return new GatewayClient({
|
|
131
|
+
layer,
|
|
132
|
+
serviceName: identity,
|
|
133
|
+
serviceIdentity: identity,
|
|
134
|
+
crossLayerGatewayUrl: url,
|
|
135
|
+
timeout: timeoutMs
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function requireTarget(input) {
|
|
139
|
+
for (const [name, value] of Object.entries({
|
|
140
|
+
product: input.product,
|
|
141
|
+
userId: input.userId,
|
|
142
|
+
workspaceId: input.workspaceId
|
|
143
|
+
})) if (typeof value !== "string" || value.trim().length === 0) throw new ProactiveIdentityError(`${name} is required`, "BAD_USER_INPUT");
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Call one global-auth field as this service. The call is never retried and
|
|
147
|
+
* bypasses the circuit breaker: a refusal must surface at once, and the
|
|
148
|
+
* callers fail closed.
|
|
149
|
+
*/
|
|
150
|
+
async function call(query, variables, field, options) {
|
|
151
|
+
const identity = options.serviceIdentity?.trim() || envServiceIdentity();
|
|
152
|
+
const client = options.client ?? defaultClient(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, identity);
|
|
153
|
+
let response;
|
|
154
|
+
try {
|
|
155
|
+
response = await client.crossLayerQuery({
|
|
156
|
+
query,
|
|
157
|
+
variables,
|
|
158
|
+
headers: {
|
|
159
|
+
"x-actor-type": "service",
|
|
160
|
+
...identity ? { "x-service-name": identity } : {},
|
|
161
|
+
...cloudflareAccessHeaders()
|
|
162
|
+
},
|
|
163
|
+
skipRetry: true,
|
|
164
|
+
skipCircuitBreaker: true
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
const refusal = error instanceof GatewayError ? refusalOf(error.graphqlErrors) : null;
|
|
168
|
+
if (refusal) throw refusal;
|
|
169
|
+
throw new ProactiveIdentityError(`global-auth is unreachable: ${error instanceof Error ? error.message : String(error)}`, "UNAVAILABLE");
|
|
170
|
+
}
|
|
171
|
+
if (response.errors?.length) throw refusalOf(response.errors) ?? new ProactiveIdentityError(response.errors[0]?.message ?? "global-auth failed", "UNAVAILABLE");
|
|
172
|
+
const data = response.data?.[field];
|
|
173
|
+
if (data === void 0 || data === null) throw new ProactiveIdentityError(`global-auth returned no ${field}`, "EMPTY_RESPONSE");
|
|
174
|
+
return data;
|
|
175
|
+
}
|
|
176
|
+
const CONSENT_FIELDS = "product clientId userId workspaceId granted expiresAt";
|
|
177
|
+
function toConsent(raw) {
|
|
178
|
+
return {
|
|
179
|
+
...raw,
|
|
180
|
+
expiresAt: raw.expiresAt ? new Date(raw.expiresAt) : null
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Mint a read-only `app_as_user` token (scope `delegation:read`, bound to the
|
|
185
|
+
* workspace, 15 minutes by default and never past the consent) for the
|
|
186
|
+
* product's proactive assistant acting as the user. Use it with
|
|
187
|
+
* `buildDelegatedGatewayHeaders`.
|
|
188
|
+
*
|
|
189
|
+
* @throws ProactiveIdentityError with code `CONSENT_MISSING` when the user has
|
|
190
|
+
* no live consent for the workspace, or another code when the call failed.
|
|
191
|
+
*/
|
|
192
|
+
async function issueProactiveReadToken(input, options = {}) {
|
|
193
|
+
requireTarget(input);
|
|
194
|
+
const minted = await call(`mutation IssueProactiveReadToken($input: IssueProactiveReadTokenInternalInput!) {
|
|
195
|
+
issueProactiveReadTokenInternal(input: $input) { token expiresAt }
|
|
196
|
+
}`, { input: {
|
|
197
|
+
product: input.product,
|
|
198
|
+
userId: input.userId,
|
|
199
|
+
workspaceId: input.workspaceId,
|
|
200
|
+
...input.ttlSeconds === void 0 ? {} : { ttlSeconds: input.ttlSeconds }
|
|
201
|
+
} }, "issueProactiveReadTokenInternal", options);
|
|
202
|
+
const expiresAt = new Date(minted.expiresAt);
|
|
203
|
+
if (typeof minted.token !== "string" || minted.token.length === 0 || Number.isNaN(expiresAt.getTime())) throw new ProactiveIdentityError("global-auth returned a malformed read token", "EMPTY_RESPONSE");
|
|
204
|
+
return {
|
|
205
|
+
token: minted.token,
|
|
206
|
+
expiresAt
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Record or renew the user's opt-in to the product's proactive assistant for
|
|
211
|
+
* one workspace (30 days from now).
|
|
212
|
+
*/
|
|
213
|
+
async function grantProactiveConsent(input, options = {}) {
|
|
214
|
+
requireTarget(input);
|
|
215
|
+
return toConsent(await call(`mutation GrantProactiveConsent($input: ProactiveConsentInternalInput!) {
|
|
216
|
+
grantProactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }
|
|
217
|
+
}`, { input: {
|
|
218
|
+
product: input.product,
|
|
219
|
+
userId: input.userId,
|
|
220
|
+
workspaceId: input.workspaceId
|
|
221
|
+
} }, "grantProactiveConsentInternal", options));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Withdraw the user's opt-in for one workspace. Tokens already minted for it
|
|
225
|
+
* stop verifying at the gateways. False when there was nothing to withdraw.
|
|
226
|
+
*/
|
|
227
|
+
async function revokeProactiveConsent(input, options = {}) {
|
|
228
|
+
requireTarget(input);
|
|
229
|
+
return call(`mutation RevokeProactiveConsent($input: RevokeProactiveConsentInternalInput!) {
|
|
230
|
+
revokeProactiveConsentInternal(input: $input)
|
|
231
|
+
}`, { input: {
|
|
232
|
+
product: input.product,
|
|
233
|
+
userId: input.userId,
|
|
234
|
+
workspaceId: input.workspaceId,
|
|
235
|
+
...input.reason === void 0 ? {} : { reason: input.reason }
|
|
236
|
+
} }, "revokeProactiveConsentInternal", options);
|
|
237
|
+
}
|
|
238
|
+
/** The user's current consent state for the product and workspace. */
|
|
239
|
+
async function getProactiveConsent(input, options = {}) {
|
|
240
|
+
requireTarget(input);
|
|
241
|
+
return toConsent(await call(`query ProactiveConsent($input: ProactiveConsentInternalInput!) {
|
|
242
|
+
proactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }
|
|
243
|
+
}`, { input: {
|
|
244
|
+
product: input.product,
|
|
245
|
+
userId: input.userId,
|
|
246
|
+
workspaceId: input.workspaceId
|
|
247
|
+
} }, "proactiveConsentInternal", options));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/gateway/index.ts
|
|
251
|
+
var gateway_exports = /* @__PURE__ */ __exportAll({
|
|
252
|
+
CircuitState: () => CircuitState,
|
|
253
|
+
DELEGATED_AUTHORIZATION_HEADER: () => DELEGATED_AUTHORIZATION_HEADER,
|
|
254
|
+
GatewayClient: () => GatewayClient,
|
|
255
|
+
GatewayError: () => GatewayError,
|
|
256
|
+
GatewayErrorType: () => GatewayErrorType,
|
|
257
|
+
PROACTIVE_READ_SCOPE: () => PROACTIVE_READ_SCOPE,
|
|
258
|
+
ProactiveIdentityError: () => ProactiveIdentityError,
|
|
259
|
+
Security: () => security_exports,
|
|
260
|
+
buildDelegatedGatewayHeaders: () => buildDelegatedGatewayHeaders,
|
|
261
|
+
createGatewayClient: () => createGatewayClient,
|
|
262
|
+
createGatewayClientFromEnv: () => createGatewayClientFromEnv,
|
|
263
|
+
getProactiveConsent: () => getProactiveConsent,
|
|
264
|
+
grantProactiveConsent: () => grantProactiveConsent,
|
|
265
|
+
isGatewayClientError: () => isGatewayClientError,
|
|
266
|
+
isProactiveConsentMissing: () => isProactiveConsentMissing,
|
|
267
|
+
issueProactiveReadToken: () => issueProactiveReadToken,
|
|
268
|
+
proactiveAssistantClientId: () => proactiveAssistantClientId,
|
|
269
|
+
revokeProactiveConsent: () => revokeProactiveConsent,
|
|
270
|
+
signServiceJwt: () => signServiceJwt
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
export { grantProactiveConsent as a, proactiveAssistantClientId as c, buildDelegatedGatewayHeaders as d, getProactiveConsent as i, revokeProactiveConsent as l, PROACTIVE_READ_SCOPE as n, isProactiveConsentMissing as o, ProactiveIdentityError as r, issueProactiveReadToken as s, gateway_exports as t, DELEGATED_AUTHORIZATION_HEADER as u };
|
|
274
|
+
//# sourceMappingURL=gateway-2en8Gx_a.js.map
|