@burdenoff/be-sdk 2026.1101.4 → 2026.1102.2
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/README.md +39 -0
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/{chunk-INAZ3PKF.js → chunk-23WAZL7I.js} +232 -135
- package/dist/chunk-23WAZL7I.js.map +1 -0
- package/dist/{chunk-3UKS6TPM.js → chunk-5ENWB2S6.js} +8 -8
- package/dist/{chunk-3UKS6TPM.js.map → chunk-5ENWB2S6.js.map} +1 -1
- package/dist/{chunk-QGBXVNRM.js → chunk-5SIL5AG2.js} +2 -2
- package/dist/chunk-5SIL5AG2.js.map +1 -0
- package/dist/{chunk-CKL6U4XE.js → chunk-64QUSPYG.js} +3 -3
- package/dist/{chunk-CKL6U4XE.js.map → chunk-64QUSPYG.js.map} +1 -1
- package/dist/{chunk-6XZ4ELHR.js → chunk-7TOWWNHR.js} +3 -3
- package/dist/{chunk-6XZ4ELHR.js.map → chunk-7TOWWNHR.js.map} +1 -1
- package/dist/{chunk-UD5PPGVU.js → chunk-DXTBH7IW.js} +3 -3
- package/dist/{chunk-UD5PPGVU.js.map → chunk-DXTBH7IW.js.map} +1 -1
- package/dist/{chunk-WVOW3CJR.js → chunk-I57LWBZU.js} +128 -3
- package/dist/chunk-I57LWBZU.js.map +1 -0
- package/dist/{chunk-WSAWJC4D.js → chunk-QCOC2SF3.js} +3 -3
- package/dist/{chunk-WSAWJC4D.js.map → chunk-QCOC2SF3.js.map} +1 -1
- package/dist/{chunk-PQGMZH6K.js → chunk-Y4N7N2G4.js} +3 -3
- package/dist/{chunk-PQGMZH6K.js.map → chunk-Y4N7N2G4.js.map} +1 -1
- package/dist/{chunk-Q5MGYZHG.js → chunk-YZIWBUIN.js} +3 -3
- package/dist/{chunk-Q5MGYZHG.js.map → chunk-YZIWBUIN.js.map} +1 -1
- package/dist/database/index.js +2 -2
- package/dist/event-queue/index.d.ts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +2 -2
- package/dist/{graphql-BUbw43Zx.d.ts → graphql-CEblo7lw.d.ts} +1 -1
- package/dist/{index-CV3r9Taj.d.ts → index-7pTpoN3Q.d.ts} +1 -0
- package/dist/{index-qwG_TaUg.d.ts → index-B7dknayX.d.ts} +25 -2
- package/dist/{index-BKOBmdq7.d.ts → index-BHe7zIVb.d.ts} +16 -8
- package/dist/{index-DXPFlxpZ.d.ts → index-BV8hveh_.d.ts} +3 -3
- package/dist/{index-Coua7_P7.d.ts → index-BioY0Ewz.d.ts} +1 -1
- package/dist/{index-Dtj9Eer3.d.ts → index-KZ4OzW6D.d.ts} +1 -1
- package/dist/{index-3ZE1m-ZJ.d.ts → index-XzbbMKe4.d.ts} +2 -2
- package/dist/{index-JTx7ZQHe.d.ts → index-zCx_euvK.d.ts} +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +26 -23
- package/dist/index.js.map +1 -1
- package/dist/instrumentation/index.d.ts +3 -3
- package/dist/logger/index.d.ts +2 -2
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +2 -2
- package/dist/prisma/index.js +2 -2
- package/dist/rbac/index.d.ts +2 -2
- package/dist/rbac/index.js +2 -2
- package/dist/resource-caps/index.d.ts +2 -2
- package/dist/telemetry/index.d.ts +4 -4
- package/dist/tracker/index.d.ts +4 -4
- package/dist/tracker/index.js +5 -5
- package/dist/usage/index.d.ts +2 -2
- package/dist/usage/index.js +2 -2
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-INAZ3PKF.js.map +0 -1
- package/dist/chunk-QGBXVNRM.js.map +0 -1
- package/dist/chunk-WVOW3CJR.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApolloInlineTraceOptions, C as CacheInstrumentationConfig, b as Counter, D as DEFAULT_CACHE_CONFIG, c as DEFAULT_DATABASE_CONFIG, d as DEFAULT_EVENT_QUEUE_CONFIG, e as DEFAULT_FEATURE_FLAGS, f as DEFAULT_GRAPHQL_CONFIG, g as DEFAULT_HTTP_CONFIG, h as DEFAULT_LOGGING_CONFIG, j as DEFAULT_METRICS_CONFIG, k as DEFAULT_TRACING_CONFIG, l as DatabaseInstrumentationConfig, E as ENV_VARS, m as EventQueueInstrumentationConfig, G as Gauge, n as GraphQLInstrumentationConfig, o as GraphQLOperationInfo, p as GraphQLOperationType, H as HTTPInstrumentationConfig, q as Histogram, r as InitializeInstrumentationOptions, t as Instrument, u as InstrumentationConfig, v as InstrumentationContextExtension, w as InstrumentationFeatureFlags, I as InstrumentationSetupResult, L as Log, x as LoggingConfig, M as Metric, y as MetricDefinition, z as MetricLabels, B as MetricsConfig, F as MetricsRegistry, O as OperationContext, P as PrometheusPluginOptions, J as STANDARD_METRICS, S as SetupInstrumentationOptions, K as Span, N as SpanAttributes, Q as SpanContext, R as SpanEvent, T as SpanKind, U as SpanStatus, V as Trace, W as TraceContext, X as Tracer, Y as TracingConfig, Z as UpDownCounter, _ as buildDatabaseConfig, $ as buildFeatureFlags, a0 as buildGraphQLConfig, a1 as buildInstrumentationConfig, a2 as buildMetricsConfig, a3 as buildTracingConfig, a4 as createApolloInlineTracePlugin, a5 as createCounter, a6 as createGauge, a7 as createGraphQLInstrumentationPlugin, a8 as createHistogram, a9 as createPrometheusPlugin, aa as createUpDownCounter, ab as extractOperationInfo, ac as extractTraceContext, ad as getGraphQLOperationFromContext, ae as getGraphQLSpanFromContext, af as getInstrumentationConfig, ag as getLogger, ah as getMetricsRegistry, ai as getTraceContext, aj as getTracer, a as initializeInstrumentation, ak as initializeInstrumentationConfig, al as initializeMetricsRegistry, am as initializeTracer, an as injectTraceContext, ao as instrumentResolver, ap as instrumentResolverMap, aq as instrumented, ar as isApolloInlineTraceAvailable, as as isFeatureEnabled, at as isInstrumentationConfigInitialized, au as isInstrumentationInitialized, av as isMetricsRegistryInitialized, aw as isPrometheusAvailable, ax as isTracerInitialized, ay as resetInstrumentation, az as resetInstrumentationConfig, aA as resetMetricsRegistry, s as setupInstrumentation, aB as startSpan, aC as traced, aD as updateInstrumentationConfig, aE as withSpan } from '../index-
|
|
2
|
-
export { l as logger } from '../index-
|
|
3
|
-
import '../index-
|
|
1
|
+
export { A as ApolloInlineTraceOptions, C as CacheInstrumentationConfig, b as Counter, D as DEFAULT_CACHE_CONFIG, c as DEFAULT_DATABASE_CONFIG, d as DEFAULT_EVENT_QUEUE_CONFIG, e as DEFAULT_FEATURE_FLAGS, f as DEFAULT_GRAPHQL_CONFIG, g as DEFAULT_HTTP_CONFIG, h as DEFAULT_LOGGING_CONFIG, j as DEFAULT_METRICS_CONFIG, k as DEFAULT_TRACING_CONFIG, l as DatabaseInstrumentationConfig, E as ENV_VARS, m as EventQueueInstrumentationConfig, G as Gauge, n as GraphQLInstrumentationConfig, o as GraphQLOperationInfo, p as GraphQLOperationType, H as HTTPInstrumentationConfig, q as Histogram, r as InitializeInstrumentationOptions, t as Instrument, u as InstrumentationConfig, v as InstrumentationContextExtension, w as InstrumentationFeatureFlags, I as InstrumentationSetupResult, L as Log, x as LoggingConfig, M as Metric, y as MetricDefinition, z as MetricLabels, B as MetricsConfig, F as MetricsRegistry, O as OperationContext, P as PrometheusPluginOptions, J as STANDARD_METRICS, S as SetupInstrumentationOptions, K as Span, N as SpanAttributes, Q as SpanContext, R as SpanEvent, T as SpanKind, U as SpanStatus, V as Trace, W as TraceContext, X as Tracer, Y as TracingConfig, Z as UpDownCounter, _ as buildDatabaseConfig, $ as buildFeatureFlags, a0 as buildGraphQLConfig, a1 as buildInstrumentationConfig, a2 as buildMetricsConfig, a3 as buildTracingConfig, a4 as createApolloInlineTracePlugin, a5 as createCounter, a6 as createGauge, a7 as createGraphQLInstrumentationPlugin, a8 as createHistogram, a9 as createPrometheusPlugin, aa as createUpDownCounter, ab as extractOperationInfo, ac as extractTraceContext, ad as getGraphQLOperationFromContext, ae as getGraphQLSpanFromContext, af as getInstrumentationConfig, ag as getLogger, ah as getMetricsRegistry, ai as getTraceContext, aj as getTracer, a as initializeInstrumentation, ak as initializeInstrumentationConfig, al as initializeMetricsRegistry, am as initializeTracer, an as injectTraceContext, ao as instrumentResolver, ap as instrumentResolverMap, aq as instrumented, ar as isApolloInlineTraceAvailable, as as isFeatureEnabled, at as isInstrumentationConfigInitialized, au as isInstrumentationInitialized, av as isMetricsRegistryInitialized, aw as isPrometheusAvailable, ax as isTracerInitialized, ay as resetInstrumentation, az as resetInstrumentationConfig, aA as resetMetricsRegistry, s as setupInstrumentation, aB as startSpan, aC as traced, aD as updateInstrumentationConfig, aE as withSpan } from '../index-BioY0Ewz.js';
|
|
2
|
+
export { l as logger } from '../index-KZ4OzW6D.js';
|
|
3
|
+
import '../index-7pTpoN3Q.js';
|
|
4
4
|
import '../layer-Cv9vSwBx.js';
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../index-
|
|
2
|
-
export { a as LogLevel, b as LogMeta, L as Logger, c as LoggerConfig, d as LoggerTransport, e as debug, f as error, g as log, l as logger, r as redactSensitiveFields, h as redactSensitiveString, w as warn } from '../index-
|
|
1
|
+
import '../index-7pTpoN3Q.js';
|
|
2
|
+
export { a as LogLevel, b as LogMeta, L as Logger, c as LoggerConfig, d as LoggerTransport, e as debug, f as error, g as log, l as logger, r as redactSensitiveFields, h as redactSensitiveString, w as warn } from '../index-KZ4OzW6D.js';
|
|
3
3
|
import '../layer-Cv9vSwBx.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../graphql-
|
|
2
|
-
import '../index-
|
|
3
|
-
export { G as GetNotificationsOptions, b as Notification, c as NotificationChannel, d as NotificationPriority, e as NotificationResponse, N as NotificationType, a as NotificationsModule, R as RecipientInput, S as SendChannelNotificationOptions, f as SendNotificationOptions, g as SendTemplateNotificationOptions, T as TenantNotificationsModule } from '../index-
|
|
1
|
+
import '../graphql-CEblo7lw.js';
|
|
2
|
+
import '../index-7pTpoN3Q.js';
|
|
3
|
+
export { G as GetNotificationsOptions, b as Notification, c as NotificationChannel, d as NotificationPriority, e as NotificationResponse, N as NotificationType, a as NotificationsModule, R as RecipientInput, S as SendChannelNotificationOptions, f as SendNotificationOptions, g as SendTemplateNotificationOptions, B as TenantBatchNotificationInput, h as TenantNotificationChannel, i as TenantNotificationType, T as TenantNotificationsModule, j as TenantSendNotificationInput, k as TenantSendWithTemplateInput } from '../index-BHe7zIVb.js';
|
|
4
4
|
import 'graphql-request';
|
|
5
5
|
import '../layer-Cv9vSwBx.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { NotificationChannel, NotificationPriority, NotificationType, NotificationsModule, TenantNotificationsModule } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { NotificationChannel2 as NotificationChannel, NotificationPriority, NotificationType2 as NotificationType, NotificationsModule, NotificationChannel as TenantNotificationChannel, NotificationType as TenantNotificationType, TenantNotificationsModule } from '../chunk-23WAZL7I.js';
|
|
2
|
+
import '../chunk-5SIL5AG2.js';
|
|
3
3
|
import '../chunk-5CAFHK2Z.js';
|
|
4
4
|
import '../chunk-RU266375.js';
|
|
5
5
|
import '../chunk-XE4OXN2W.js';
|
package/dist/prisma/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, contextMatches, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, resolvePoolTuningFromEnv, testConnection, toContextJson } from '../chunk-
|
|
2
|
-
import '../chunk-OBBCR6WY.js';
|
|
1
|
+
export { buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, contextMatches, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, resolvePoolTuningFromEnv, testConnection, toContextJson } from '../chunk-QCOC2SF3.js';
|
|
3
2
|
export { addWorkspaceExtension, buildTransactionContextStatement, defaultWorkspaceExtensionConfig, getCallerTransaction, getScopedWorkspaceContext, getWorkspaceContext, injectCreateFields, injectWhereWorkspaceId, maybeSetRlsGuc, maybeTagConnection, resetCallerTransactionStateForTests, runOperationInCallerTransaction, runOperationWithRlsGuc, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync } from '../chunk-E4QNLVY4.js';
|
|
3
|
+
import '../chunk-OBBCR6WY.js';
|
|
4
4
|
export { PrismaClientWrapper, configurePrismaLogging, createConnectionPool, createPrismaAdapter, createPrismaClient, ensureServiceApplicationName, installAcquireRetry, isTransientAcquireError } from '../chunk-K52ICDCP.js';
|
|
5
5
|
import '../chunk-TX2GDIWP.js';
|
|
6
6
|
import '../chunk-SIAOIYHW.js';
|
package/dist/rbac/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BurdenoffGraphQLClient } from '../graphql-
|
|
2
|
-
import { a as SDKContext } from '../index-
|
|
1
|
+
import { B as BurdenoffGraphQLClient } from '../graphql-CEblo7lw.js';
|
|
2
|
+
import { a as SDKContext } from '../index-7pTpoN3Q.js';
|
|
3
3
|
import { Plugin } from '@envelop/core';
|
|
4
4
|
import { S as ServiceLayer } from '../layer-Cv9vSwBx.js';
|
|
5
5
|
import 'graphql-request';
|
package/dist/rbac/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { RBACClient, RBACModule, createRBACClientFromEnv, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { RBACClient, RBACModule, createRBACClientFromEnv, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from '../chunk-Y4N7N2G4.js';
|
|
2
|
+
import '../chunk-5SIL5AG2.js';
|
|
3
3
|
import '../chunk-5CAFHK2Z.js';
|
|
4
4
|
import '../chunk-RU266375.js';
|
|
5
5
|
import '../chunk-XE4OXN2W.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
|
-
import { B as BurdenoffGraphQLClient } from '../graphql-
|
|
2
|
+
import { B as BurdenoffGraphQLClient } from '../graphql-CEblo7lw.js';
|
|
3
3
|
import 'graphql-request';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-7pTpoN3Q.js';
|
|
5
5
|
import '../layer-Cv9vSwBx.js';
|
|
6
6
|
|
|
7
7
|
type ResourceName = 'workspace' | 'workspaceMember' | 'sandbox' | 'vibe' | 'agent' | 'conversation' | 'message' | 'tag' | 'file' | 'group' | 'calendar' | 'scheduledTask' | 'form' | 'apiKey' | 'webhook';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as Logger } from '../index-
|
|
2
|
-
import { S as SetupInstrumentationOptions, I as InstrumentationSetupResult } from '../index-
|
|
3
|
-
export { a as initializeInstrumentation, s as setupInstrumentation } from '../index-
|
|
4
|
-
import '../index-
|
|
1
|
+
import { L as Logger } from '../index-KZ4OzW6D.js';
|
|
2
|
+
import { S as SetupInstrumentationOptions, I as InstrumentationSetupResult } from '../index-BioY0Ewz.js';
|
|
3
|
+
export { a as initializeInstrumentation, s as setupInstrumentation } from '../index-BioY0Ewz.js';
|
|
4
|
+
import '../index-7pTpoN3Q.js';
|
|
5
5
|
import '../layer-Cv9vSwBx.js';
|
|
6
6
|
|
|
7
7
|
interface TelemetryIdGenerator {
|
package/dist/tracker/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import '../graphql-
|
|
2
|
-
import '../index-
|
|
3
|
-
export { a as AGENT_ACTIVITY_ACTIONS, b as AGENT_ACTIVITY_RESOURCE_TYPE, c as ActivityTrackingOptions, d as AgentActivityAction, e as AgentActivityOptions, P as ProductTracker, R as RbacCheckOptions, f as TrackOptions, g as TrackResult, h as TrackedActorType, T as TrackerModule, i as TrackingEvent, U as UNIFIED_TRACKER_CONSTANTS, j as UnifiedTrackerStub, k as UnifiedTrackingOptions, l as UsageTrackingOptions, m as createProductTracker, n as isTrackedActorType, r as resolveAssistantSession, t as trackAgentActivity, o as trackOperation, p as trackerStub } from '../index-
|
|
1
|
+
import '../graphql-CEblo7lw.js';
|
|
2
|
+
import '../index-7pTpoN3Q.js';
|
|
3
|
+
export { a as AGENT_ACTIVITY_ACTIONS, b as AGENT_ACTIVITY_RESOURCE_TYPE, c as ActivityTrackingOptions, d as AgentActivityAction, e as AgentActivityOptions, P as ProductTracker, R as RbacCheckOptions, f as TrackOptions, g as TrackResult, h as TrackedActorType, T as TrackerModule, i as TrackingEvent, U as UNIFIED_TRACKER_CONSTANTS, j as UnifiedTrackerStub, k as UnifiedTrackingOptions, l as UsageTrackingOptions, m as createProductTracker, n as isTrackedActorType, r as resolveAssistantSession, t as trackAgentActivity, o as trackOperation, p as trackerStub } from '../index-BV8hveh_.js';
|
|
4
4
|
export { UsageMetricType } from '../usage/index.js';
|
|
5
|
-
import '../index-
|
|
5
|
+
import '../index-BHe7zIVb.js';
|
|
6
6
|
export { a as AI_ASSISTANT_ACTOR_ORIGIN, b as ActorOrigin, A as AssistantSessionAttribution } from '../assistant-session-CJZhF4D6.js';
|
|
7
7
|
export { s as suppressMutationAudit } from '../explicit-activity-scope-CCoxVwAr.js';
|
|
8
8
|
import 'graphql-request';
|
package/dist/tracker/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, TrackerModule, trackAgentActivity } from '../chunk-
|
|
2
|
-
export { UsageMetricType } from '../chunk-
|
|
3
|
-
import '../chunk-INAZ3PKF.js';
|
|
4
|
-
import '../chunk-PQGMZH6K.js';
|
|
1
|
+
export { AGENT_ACTIVITY_ACTIONS, AGENT_ACTIVITY_RESOURCE_TYPE, TrackerModule, trackAgentActivity } from '../chunk-5ENWB2S6.js';
|
|
2
|
+
export { UsageMetricType } from '../chunk-64QUSPYG.js';
|
|
5
3
|
export { AI_ASSISTANT_ACTOR_ORIGIN, UNIFIED_TRACKER_CONSTANTS, UnifiedTrackerStub, createProductTracker, isTrackedActorType, resolveAssistantSession, suppressMutationAudit, trackOperation, trackerStub } from '../chunk-TANAOLAV.js';
|
|
4
|
+
import '../chunk-23WAZL7I.js';
|
|
6
5
|
import '../chunk-E4QNLVY4.js';
|
|
6
|
+
import '../chunk-Y4N7N2G4.js';
|
|
7
7
|
import '../chunk-Q5H45UXV.js';
|
|
8
8
|
import '../chunk-6SDWH4OM.js';
|
|
9
9
|
import '../chunk-ZWKJKL6Y.js';
|
|
@@ -13,7 +13,7 @@ import '../chunk-VFCMR5GX.js';
|
|
|
13
13
|
import '../chunk-RZOFS2BQ.js';
|
|
14
14
|
import '../chunk-4KK6YJ46.js';
|
|
15
15
|
import '../chunk-A5F6Z5UE.js';
|
|
16
|
-
import '../chunk-
|
|
16
|
+
import '../chunk-5SIL5AG2.js';
|
|
17
17
|
import '../chunk-5CAFHK2Z.js';
|
|
18
18
|
import '../chunk-RU266375.js';
|
|
19
19
|
import '../chunk-XE4OXN2W.js';
|
package/dist/usage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BurdenoffGraphQLClient } from '../graphql-
|
|
2
|
-
import { a as SDKContext } from '../index-
|
|
1
|
+
import { B as BurdenoffGraphQLClient } from '../graphql-CEblo7lw.js';
|
|
2
|
+
import { a as SDKContext } from '../index-7pTpoN3Q.js';
|
|
3
3
|
import { G as GatewayClient } from '../client-DSI_760t.js';
|
|
4
4
|
import 'graphql-request';
|
|
5
5
|
import '../layer-Cv9vSwBx.js';
|
package/dist/usage/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BillingUsageClient, QuotaPeriod, UsageMetricType, UsageModule } from '../chunk-
|
|
1
|
+
export { BillingUsageClient, QuotaPeriod, UsageMetricType, UsageModule } from '../chunk-64QUSPYG.js';
|
|
2
2
|
import '../chunk-Q5H45UXV.js';
|
|
3
3
|
import '../chunk-6SDWH4OM.js';
|
|
4
4
|
import '../chunk-ZWKJKL6Y.js';
|
|
@@ -8,7 +8,7 @@ import '../chunk-VFCMR5GX.js';
|
|
|
8
8
|
import '../chunk-RZOFS2BQ.js';
|
|
9
9
|
import '../chunk-4KK6YJ46.js';
|
|
10
10
|
import '../chunk-A5F6Z5UE.js';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-5SIL5AG2.js';
|
|
12
12
|
import '../chunk-5CAFHK2Z.js';
|
|
13
13
|
import '../chunk-RU266375.js';
|
|
14
14
|
import '../chunk-XE4OXN2W.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { D as DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS,
|
|
1
|
+
export { B as BillingAmountErrorCode, s as BillingAmountValidationResult, D as DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS, t as DEFAULT_RBAC_ROOT_TYPES, M as MAX_BILLING_AMOUNT, N as NAME_MAX_LENGTH, a as NAME_MIN_LENGTH, b as NameErrorCode, c as NameValidationResult, u as RBAC_GATED_SCOPE_TYPES, w as RBAC_SCOPE_TYPES, R as RbacCoverageError, d as RbacCoverageOptions, e as RbacCoverageReport, f as RbacCoverageSource, x as RbacDirectiveArgs, y as RbacFieldPin, z as RbacRootField, A as RbacSchemaDocument, C as RbacScopeType, S as SUPPORTED_BILLING_CURRENCIES, E as SupportedBillingCurrency, U as USERNAME_MAX_LENGTH, g as USERNAME_MIN_LENGTH, h as UserFieldError, i as UserFieldKey, j as UserFieldsValidationResult, k as UsernameErrorCode, l as UsernameValidationResult, V as ValidatedUserFields, n as analyzeRbacCoverage, o as assertRbacCoverage, F as isSupportedBillingCurrency, p as lengthInCodePoints, G as loadRbacSchemaDocuments, H as rbacArgPathProblem, I as readRbacDirectiveArgs, J as validateBillingAmount, v as validateName, q as validateUserFields, r as validateUsername } from '../index-B7dknayX.js';
|
|
2
2
|
import 'graphql';
|
package/dist/validation/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS, DEFAULT_RBAC_ROOT_TYPES, NAME_MAX_LENGTH, NAME_MIN_LENGTH, RBAC_GATED_SCOPE_TYPES, RBAC_SCOPE_TYPES, RbacCoverageError, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, analyzeRbacCoverage, assertRbacCoverage, lengthInCodePoints, loadRbacSchemaDocuments, rbacArgPathProblem, readRbacDirectiveArgs, validateName, validateUserFields, validateUsername } from '../chunk-
|
|
1
|
+
export { DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS, DEFAULT_RBAC_ROOT_TYPES, MAX_BILLING_AMOUNT, NAME_MAX_LENGTH, NAME_MIN_LENGTH, RBAC_GATED_SCOPE_TYPES, RBAC_SCOPE_TYPES, RbacCoverageError, SUPPORTED_BILLING_CURRENCIES, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, analyzeRbacCoverage, assertRbacCoverage, isSupportedBillingCurrency, lengthInCodePoints, loadRbacSchemaDocuments, rbacArgPathProblem, readRbacDirectiveArgs, validateBillingAmount, validateName, validateUserFields, validateUsername } from '../chunk-I57LWBZU.js';
|
|
2
2
|
import '../chunk-XE4OXN2W.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/be-sdk",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1102.2",
|
|
4
4
|
"description": "Backend SDK for Burdenoff products providing unified access to notifications, RBAC, activity tracking, usage monitoring, and more",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
"lint:fix": "eslint ./src --fix",
|
|
87
87
|
"format": "bunx prettier --write \"src/**/*.ts\"",
|
|
88
88
|
"format:check": "bunx prettier --check \"src/**/*.ts\"",
|
|
89
|
-
"test": "bun test
|
|
89
|
+
"test": "bun test",
|
|
90
90
|
"test:watch": "bun test --watch",
|
|
91
91
|
"test:coverage": "bun test --coverage",
|
|
92
92
|
"test:live-pg": "bunx prisma generate --schema tests/live-pg/rls-transactions/schema.prisma && bun test tests/live-pg",
|
|
93
|
-
"test:ci": "
|
|
93
|
+
"test:ci": "bun run test",
|
|
94
94
|
"audit": "bun audit --ignore=GHSA-g3hv-75wg-m249",
|
|
95
95
|
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run format:check && bun run lint:sanity && bun run typecheck && bun run build && bun run test:ci && bun run audit'",
|
|
96
96
|
"prepublishOnly": "bun run build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/notifications/tenant-notifications.ts","../src/notifications/index.ts"],"names":["NotificationChannel","NotificationPriority","NotificationType","TenantNotificationsModule","client","context","send","input","validateSendInput","logger","info","channel","type","priority","mutation","variables","recipient","subject","body","htmlBody","data","metadata","scheduledFor","toISOString","expiresAt","trackOpens","trackClicks","response","tenantQuery","notificationId","sendNotification","sendWithTemplate","templateSlug","trim","length","ValidationError","Object","keys","email","userId","channelId","platform","timezone","result","triggerNotificationWithTemplate","firstNotification","notifications","totalTriggered","totalRequested","totalFailed","id","status","sendBatch","count","batchSize","map","n","delayBetweenBatches","batchId","sendBatchNotifications","queued","totalQueued","failed","getNotification","query","notification","getNotifications","filter","startDate","endDate","undefined","limit","offset","getTemplate","slug","locale","notificationTemplate","getTemplates","notificationTemplates","getStats","notificationStats","markAsRead","notificationIds","markAllAsRead","deleteNotifications","deleteAllReadNotifications","phoneNumber","pushToken","mapNotificationType","resolveChannel","options","sms","NotificationsModule","title","message","userIds","userCount","errors","results","Promise","allSettled","redirectUrl","appName","includeInApp","triggerNotification","Error","index","settled","entries","push","value","reason","String","successCount","failureCount","sendToUser","debug","search","markMultipleAsRead","markNotificationsAsRead","markAllMyNotificationsAsRead","deleteNotification","deleteMultiple","getUnreadCount","unreadCount","sendChannelNotification","recipients","recipientCount","inAppUserCount","forEach","error","sendTemplateNotification"],"mappings":";;;;;AAAA,IAAA,4BAAA,GAAA;;;;;;;AAcO,IAAKA,mBAAAA,6BAAAA,oBAAAA,EAAAA;;;;;;;;;;;AAAAA,EAAAA,OAAAA,oBAAAA;;AAaL,IAAKC,oBAAAA,6BAAAA,qBAAAA,EAAAA;;;;;AAAAA,EAAAA,OAAAA,qBAAAA;;AAOL,IAAKC,gBAAAA,6BAAAA,iBAAAA,EAAAA;;;;;AAAAA,EAAAA,OAAAA,iBAAAA;;AAsIL,IAAMC,4BAAN,MAAMA;EAxKb;;;;;AAyKE,EAAA,WAAA,CACUC,QACAC,OAAAA,EACR;SAFQD,MAAAA,GAAAA,MAAAA;SACAC,OAAAA,GAAAA,OAAAA;AACP,EAAA;;;;AAKH,EAAA,MAAaC,KAAKC,KAAAA,EAA+C;AAE/D,IAAA,IAAA,CAAKC,kBAAkBD,KAAAA,CAAAA;AAEvBE,IAAAA,MAAAA,CAAOC,KAAK,4CAAA,EAA8C;AACxDC,MAAAA,OAAAA,EAASJ,KAAAA,CAAMI,OAAAA;AACfC,MAAAA,IAAAA,EAAML,MAAMK,IAAAA,IAAI,eAAA;AAChBC,MAAAA,QAAAA,EAAUN,MAAMM,QAAAA,IAAQ;KAC1B,CAAA;AAEA,IAAA,MAAMC,QAAAA,GAAW;;;;;AAMjB,IAAA,MAAMC,SAAAA,GAAY;MAChBR,KAAAA,EAAO;AACLS,QAAAA,SAAAA,EAAWT,KAA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CAAOyH,MAAM,sDAAA,EAAwD;AAAEA,QAAAA;OAAM,CAAA;AAE7E,MAAA,OAAO;QACLjB,YAAAA,EAAc,CAAA;QACdC,YAAAA,EAAc,CAAA;QACdjB,MAAAA,EAAQ;UAACiC,KAAAA,YAAiBzB,KAAAA,GAAQyB,MAAMpC,OAAAA,GAAU;;AAClDZ,QAAAA,eAAAA,EAAiB;AACnB,OAAA;AACF,IAAA;AACF,EAAA;AACF","file":"chunk-INAZ3PKF.js","sourcesContent":["/**\n * Tenant-Backend Notifications Module\n * Comprehensive notification system supporting 10+ channels via tenant-backend\n */\n\nimport type { BurdenoffGraphQLClient } from '../client/graphql.js';\nimport type { SDKContext } from '../types/index.js';\nimport { ValidationError } from '../types/index.js';\nimport { logger } from '../logger/index.js';\n\n// ========================================\n// Enums\n// ========================================\n\nexport enum NotificationChannel {\n EMAIL = 'EMAIL',\n SMS = 'SMS',\n PUSH = 'PUSH',\n IN_APP = 'IN_APP',\n WEBHOOK = 'WEBHOOK',\n WHATSAPP = 'WHATSAPP',\n TEAMS = 'TEAMS',\n SLACK = 'SLACK',\n TELEGRAM = 'TELEGRAM',\n DISCORD = 'DISCORD',\n}\n\nexport enum NotificationPriority {\n LOW = 'LOW',\n MEDIUM = 'MEDIUM',\n HIGH = 'HIGH',\n URGENT = 'URGENT',\n}\n\nexport enum NotificationType {\n TRANSACTIONAL = 'TRANSACTIONAL',\n MARKETING = 'MARKETING',\n SYSTEM = 'SYSTEM',\n ALERT = 'ALERT',\n}\n\n// ========================================\n// Types & Interfaces\n// ========================================\n\nexport interface RecipientInput {\n userId?: string;\n email?: string;\n phoneNumber?: string;\n pushToken?: string;\n whatsappNumber?: string;\n teamsUserId?: string;\n slackUserId?: string;\n webhookUrl?: string;\n name?: string;\n locale?: string;\n timezone?: string;\n}\n\nexport interface SendNotificationInput {\n recipient: RecipientInput;\n channel: NotificationChannel;\n type?: NotificationType;\n priority?: NotificationPriority;\n subject?: string;\n body: string;\n htmlBody?: string;\n data?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n scheduledFor?: Date;\n expiresAt?: Date;\n trackOpens?: boolean;\n trackClicks?: boolean;\n}\n\nexport interface SendWithTemplateInput {\n templateSlug: string;\n variables: Record<string, unknown>;\n recipient: RecipientInput;\n priority?: NotificationPriority;\n scheduledFor?: Date;\n expiresAt?: Date;\n trackOpens?: boolean;\n trackClicks?: boolean;\n /** Specific channel instance ID from channel service (takes precedence) */\n channelId?: string;\n /** Platform type for auto-failover (EMAIL, SMS, etc.) - used if channelId not provided */\n platform?: NotificationChannel;\n /** Timezone for scheduling */\n timezone?: string;\n}\n\nexport interface BatchNotificationInput {\n notifications: SendNotificationInput[];\n batchSize?: number;\n delayBetweenBatches?: number;\n priority?: NotificationPriority;\n}\n\nexport interface Notification {\n id: string;\n userId: string;\n channel: NotificationChannel;\n type: NotificationType;\n priority: NotificationPriority;\n status: string;\n deliveryStatus?: string;\n title: string;\n message: string;\n htmlMessage?: string;\n subject?: string;\n recipientEmail?: string;\n recipientPhone?: string;\n trackOpens: boolean;\n trackClicks: boolean;\n openedAt?: string;\n clickedAt?: string;\n sentAt?: string;\n deliveredAt?: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface NotificationTemplate {\n id: string;\n name: string;\n slug: string;\n description?: string;\n channel: NotificationChannel;\n type: NotificationType;\n locale: string;\n subject?: string;\n bodyTemplate: string;\n htmlTemplate?: string;\n variables: Array<{\n name: string;\n type: string;\n required: boolean;\n defaultValue?: unknown;\n description?: string;\n example?: unknown;\n }>;\n enabled: boolean;\n version: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface NotificationStats {\n total: number;\n pending: number;\n queued: number;\n processing: number;\n sent: number;\n delivered: number;\n failed: number;\n byChannel: Record<string, number>;\n byType: Record<string, number>;\n}\n\n// ========================================\n// Tenant Notifications Module\n// ========================================\n\n/**\n * Tenant-Backend Notifications Module\n * Provides access to the centralized notification system\n */\nexport class TenantNotificationsModule {\n constructor(\n private client: BurdenoffGraphQLClient,\n private context: SDKContext\n ) {}\n\n /**\n * Send a single notification\n */\n public async send(input: SendNotificationInput): Promise<string> {\n // Validate inputs\n this.validateSendInput(input);\n\n logger.info('[TenantNotifications] Sending notification', {\n channel: input.channel,\n type: input.type || NotificationType.TRANSACTIONAL,\n priority: input.priority || NotificationPriority.MEDIUM,\n });\n\n const mutation = `\n mutation SendNotification($input: SendNotificationInput!) {\n sendNotification(input: $input)\n }\n `;\n\n const variables = {\n input: {\n recipient: input.recipient,\n channel: input.channel,\n type: input.type || NotificationType.TRANSACTIONAL,\n priority: input.priority || NotificationPriority.MEDIUM,\n subject: input.subject,\n body: input.body,\n htmlBody: input.htmlBody,\n data: input.data,\n metadata: input.metadata,\n scheduledFor: input.scheduledFor?.toISOString(),\n expiresAt: input.expiresAt?.toISOString(),\n trackOpens: input.trackOpens,\n trackClicks: input.trackClicks,\n },\n };\n\n const response = await this.client.tenantQuery<{\n sendNotification: string;\n }>(mutation, variables, this.context);\n\n logger.info('[TenantNotifications] Notification sent', {\n notificationId: response.sendNotification,\n });\n\n return response.sendNotification;\n }\n\n /**\n * Send notification using a template\n */\n public async sendWithTemplate(input: SendWithTemplateInput): Promise<string> {\n // Validate inputs\n if (!input.templateSlug || input.templateSlug.trim().length === 0) {\n throw new ValidationError('Template slug is required');\n }\n\n if (!input.variables || Object.keys(input.variables).length === 0) {\n throw new ValidationError('Template variables are required');\n }\n\n if (!input.recipient || (!input.recipient.email && !input.recipient.userId)) {\n throw new ValidationError('Recipient email or userId is required');\n }\n\n logger.info('[TenantNotifications] Sending notification with template', {\n templateSlug: input.templateSlug,\n priority: input.priority || NotificationPriority.MEDIUM,\n });\n\n const mutation = `\n mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {\n triggerNotificationWithTemplate(input: $input) {\n totalRequested\n totalTriggered\n totalFailed\n notifications {\n id\n status\n deliveryStatus\n }\n }\n }\n `;\n\n const variables = {\n input: {\n templateSlug: input.templateSlug,\n variables: input.variables,\n recipient: input.recipient,\n priority: input.priority || NotificationPriority.MEDIUM,\n scheduledFor: input.scheduledFor?.toISOString(),\n expiresAt: input.expiresAt?.toISOString(),\n trackOpens: input.trackOpens,\n trackClicks: input.trackClicks,\n // Platform is required for notification delivery routing\n // If channelId is specified, it takes precedence; otherwise platform determines delivery\n channelId: input.channelId,\n platform: input.platform || NotificationChannel.EMAIL,\n timezone: input.timezone,\n },\n };\n\n const response = await this.client.tenantQuery<{\n triggerNotificationWithTemplate: {\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n notifications: Array<{ id: string; status: string; deliveryStatus?: string }>;\n };\n }>(mutation, variables, this.context);\n\n const result = response.triggerNotificationWithTemplate;\n const firstNotification = result.notifications[0];\n\n if (result.totalTriggered === 0 || !firstNotification) {\n throw new ValidationError(\n `Notification trigger failed: requested=${result.totalRequested}, triggered=${result.totalTriggered}, failed=${result.totalFailed}`\n );\n }\n\n logger.info('[TenantNotifications] Notification sent with template', {\n notificationId: firstNotification.id,\n status: firstNotification.status,\n totalTriggered: result.totalTriggered,\n totalFailed: result.totalFailed,\n });\n\n return firstNotification.id;\n }\n\n /**\n * Send batch notifications\n */\n public async sendBatch(input: BatchNotificationInput): Promise<{\n totalRequested: number;\n totalQueued: number;\n totalFailed: number;\n batchId: string;\n }> {\n if (!input.notifications || input.notifications.length === 0) {\n throw new ValidationError('At least one notification is required');\n }\n\n logger.info('[TenantNotifications] Sending batch notifications', {\n count: input.notifications.length,\n batchSize: input.batchSize,\n });\n\n const mutation = `\n mutation SendBatchNotifications($input: BatchNotificationInput!) {\n sendBatchNotifications(input: $input) {\n totalRequested\n totalQueued\n totalFailed\n batchId\n }\n }\n `;\n\n const variables = {\n input: {\n notifications: input.notifications.map((n) => ({\n recipient: n.recipient,\n channel: n.channel,\n type: n.type || NotificationType.TRANSACTIONAL,\n priority: n.priority || NotificationPriority.MEDIUM,\n subject: n.subject,\n body: n.body,\n htmlBody: n.htmlBody,\n data: n.data,\n metadata: n.metadata,\n scheduledFor: n.scheduledFor?.toISOString(),\n expiresAt: n.expiresAt?.toISOString(),\n trackOpens: n.trackOpens,\n trackClicks: n.trackClicks,\n })),\n batchSize: input.batchSize,\n delayBetweenBatches: input.delayBetweenBatches,\n priority: input.priority,\n },\n };\n\n const response = await this.client.tenantQuery<{\n sendBatchNotifications: {\n totalRequested: number;\n totalQueued: number;\n totalFailed: number;\n batchId: string;\n };\n }>(mutation, variables, this.context);\n\n logger.info('[TenantNotifications] Batch notifications sent', {\n batchId: response.sendBatchNotifications.batchId,\n queued: response.sendBatchNotifications.totalQueued,\n failed: response.sendBatchNotifications.totalFailed,\n });\n\n return response.sendBatchNotifications;\n }\n\n /**\n * Get a notification by ID\n */\n public async getNotification(id: string): Promise<Notification | null> {\n const query = `\n query GetNotification($id: ID!) {\n notification(id: $id) {\n id\n userId\n channel\n type\n priority\n status\n deliveryStatus\n title\n message\n htmlMessage\n subject\n recipientEmail\n recipientPhone\n trackOpens\n trackClicks\n openedAt\n clickedAt\n sentAt\n deliveredAt\n createdAt\n updatedAt\n }\n }\n `;\n\n const response = await this.client.tenantQuery<{\n notification: Notification | null;\n }>(query, { id }, this.context);\n\n return response.notification;\n }\n\n /**\n * Get notifications with filters\n */\n public async getNotifications(filter?: {\n userId?: string;\n channel?: NotificationChannel;\n type?: NotificationType;\n status?: string;\n priority?: NotificationPriority;\n startDate?: Date;\n endDate?: Date;\n limit?: number;\n offset?: number;\n }): Promise<Notification[]> {\n const query = `\n query GetNotifications($filter: NotificationFilterInput, $limit: Int, $offset: Int) {\n notifications(filter: $filter, limit: $limit, offset: $offset) {\n id\n userId\n channel\n type\n priority\n status\n deliveryStatus\n title\n message\n subject\n recipientEmail\n trackOpens\n trackClicks\n openedAt\n clickedAt\n sentAt\n deliveredAt\n createdAt\n updatedAt\n }\n }\n `;\n\n const variables = {\n filter: filter\n ? {\n userId: filter.userId,\n channel: filter.channel,\n type: filter.type,\n status: filter.status,\n priority: filter.priority,\n startDate: filter.startDate?.toISOString(),\n endDate: filter.endDate?.toISOString(),\n }\n : undefined,\n limit: filter?.limit || 50,\n offset: filter?.offset || 0,\n };\n\n const response = await this.client.tenantQuery<{\n notifications: Notification[];\n }>(query, variables, this.context);\n\n return response.notifications;\n }\n\n /**\n * Get notification template\n */\n public async getTemplate(slug: string, locale?: string): Promise<NotificationTemplate | null> {\n const query = `\n query GetNotificationTemplate($slug: String!, $locale: String) {\n notificationTemplate(slug: $slug, locale: $locale) {\n id\n name\n slug\n description\n channel\n type\n locale\n subject\n bodyTemplate\n htmlTemplate\n variables\n enabled\n version\n createdAt\n updatedAt\n }\n }\n `;\n\n const response = await this.client.tenantQuery<{\n notificationTemplate: NotificationTemplate | null;\n }>(query, { slug, locale }, this.context);\n\n return response.notificationTemplate;\n }\n\n /**\n * Get all notification templates\n */\n public async getTemplates(filter?: {\n channel?: NotificationChannel;\n type?: NotificationType;\n enabled?: boolean;\n }): Promise<NotificationTemplate[]> {\n const query = `\n query GetNotificationTemplates($filter: TemplateFilterInput) {\n notificationTemplates(filter: $filter) {\n id\n name\n slug\n description\n channel\n type\n locale\n subject\n bodyTemplate\n htmlTemplate\n variables\n enabled\n version\n createdAt\n updatedAt\n }\n }\n `;\n\n const response = await this.client.tenantQuery<{\n notificationTemplates: NotificationTemplate[];\n }>(query, { filter }, this.context);\n\n return response.notificationTemplates;\n }\n\n /**\n * Get notification statistics\n */\n public async getStats(filter?: { userId?: string; startDate?: Date; endDate?: Date }): Promise<NotificationStats> {\n const query = `\n query GetNotificationStats($filter: NotificationFilterInput) {\n notificationStats(filter: $filter) {\n total\n pending\n queued\n processing\n sent\n delivered\n failed\n byChannel\n byType\n }\n }\n `;\n\n const variables = {\n filter: filter\n ? {\n userId: filter.userId,\n startDate: filter.startDate?.toISOString(),\n endDate: filter.endDate?.toISOString(),\n }\n : undefined,\n };\n\n const response = await this.client.tenantQuery<{\n notificationStats: NotificationStats;\n }>(query, variables, this.context);\n\n return response.notificationStats;\n }\n\n /**\n * Mark notifications as read\n */\n public async markAsRead(notificationIds: string[]): Promise<boolean> {\n const mutation = `\n mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {\n markNotificationsAsRead(notificationIds: $notificationIds)\n }\n `;\n\n await this.client.tenantQuery(mutation, { notificationIds }, this.context);\n\n logger.info('[TenantNotifications] Notifications marked as read', {\n count: notificationIds.length,\n });\n\n return true;\n }\n\n /**\n * Mark all notifications as read for the current user\n */\n public async markAllAsRead(): Promise<boolean> {\n const mutation = `\n mutation MarkAllMyNotificationsAsRead {\n markAllMyNotificationsAsRead\n }\n `;\n\n await this.client.tenantQuery(mutation, {}, this.context);\n\n logger.info('[TenantNotifications] All notifications marked as read');\n\n return true;\n }\n\n /**\n * Delete notifications\n */\n public async deleteNotifications(notificationIds: string[]): Promise<boolean> {\n const mutation = `\n mutation DeleteNotifications($notificationIds: [ID!]!) {\n deleteNotifications(notificationIds: $notificationIds)\n }\n `;\n\n await this.client.tenantQuery(mutation, { notificationIds }, this.context);\n\n logger.info('[TenantNotifications] Notifications deleted', {\n count: notificationIds.length,\n });\n\n return true;\n }\n\n /**\n * Delete all read notifications for the current user\n */\n public async deleteAllReadNotifications(): Promise<boolean> {\n const mutation = `\n mutation DeleteMyReadNotifications {\n deleteMyReadNotifications\n }\n `;\n\n await this.client.tenantQuery(mutation, {}, this.context);\n\n logger.info('[TenantNotifications] All read notifications deleted');\n\n return true;\n }\n\n /**\n * Validate send notification input\n */\n private validateSendInput(input: SendNotificationInput): void {\n if (!input.recipient || (!input.recipient.email && !input.recipient.userId && !input.recipient.phoneNumber)) {\n throw new ValidationError('Recipient email, userId, or phoneNumber is required');\n }\n\n if (!input.channel) {\n throw new ValidationError('Notification channel is required');\n }\n\n if (!input.body || input.body.trim().length === 0) {\n throw new ValidationError('Notification body is required');\n }\n\n // Channel-specific validation\n if (input.channel === NotificationChannel.EMAIL && !input.recipient.email) {\n throw new ValidationError('Recipient email is required for EMAIL channel');\n }\n\n if (input.channel === NotificationChannel.SMS && !input.recipient.phoneNumber) {\n throw new ValidationError('Recipient phone number is required for SMS channel');\n }\n\n if (input.channel === NotificationChannel.PUSH && !input.recipient.pushToken && !input.recipient.userId) {\n throw new ValidationError('Recipient push token or userId is required for PUSH channel');\n }\n }\n}\n","/**\n * Notifications Module\n * Send in-app, email, SMS, and push notifications via workspaces-backend\n */\n\nimport type { BurdenoffGraphQLClient } from '../client/graphql.js';\nimport type { SDKContext } from '../types/index.js';\nimport { ValidationError } from '../types/index.js';\nimport { logger } from '../logger/index.js';\n\nexport enum NotificationType {\n INFO = 'info',\n SUCCESS = 'success',\n WARNING = 'warning',\n ERROR = 'error',\n}\n\nexport enum NotificationChannel {\n EMAIL = 'EMAIL',\n SMS = 'SMS',\n WHATSAPP = 'WHATSAPP',\n PUSH = 'PUSH',\n SLACK = 'SLACK',\n TEAMS = 'TEAMS',\n WEBHOOK = 'WEBHOOK',\n}\n\n// Re-export from tenant-notifications\nexport { NotificationPriority, TenantNotificationsModule } from './tenant-notifications.js';\n\nexport interface SendNotificationOptions {\n /** Notification title */\n title: string;\n /** Notification message */\n message: string;\n /** Notification type */\n type?: NotificationType;\n /** Target user IDs */\n userIds: string[];\n /** Optional redirect URL */\n redirectUrl?: string;\n /** Application name */\n appName?: string;\n /** Send email notification */\n email?: boolean;\n /** Send SMS notification */\n sms?: boolean;\n}\n\nexport interface NotificationResponse {\n /** Number of successful notifications */\n successCount: number;\n /** Number of failed notifications */\n failureCount: number;\n /** Error messages if any */\n errors: string[];\n /** Created notification IDs */\n notificationIds?: string[];\n}\n\nexport interface GetNotificationsOptions {\n /** User ID to get notifications for */\n userId: string;\n /** Filter by status */\n status?: 'unread' | 'read' | 'all';\n /** Filter by type */\n type?: NotificationType;\n /** Filter by app name */\n appName?: string;\n /** Search term */\n search?: string;\n /** Limit number of results */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n}\n\nexport interface Notification {\n id: string;\n userId: string;\n title: string;\n message: string;\n type: NotificationType;\n status: 'unread' | 'read';\n redirectUrl?: string;\n appName?: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface RecipientInput {\n email?: string;\n locale?: string;\n name?: string;\n phoneNumber?: string;\n pushToken?: string;\n slackUserId?: string;\n teamsUserId?: string;\n timezone?: string;\n userId?: string;\n webhookUrl?: string;\n whatsappNumber?: string;\n}\n\nexport interface SendChannelNotificationOptions {\n /** Primary delivery channel (EMAIL, SMS, WHATSAPP, etc.) */\n platform: NotificationChannel;\n /** Recipient information for primary channel */\n recipient: RecipientInput;\n /** Multiple recipients for bulk delivery */\n recipients?: RecipientInput[];\n /** Notification subject (for EMAIL) */\n subject?: string;\n /** Notification body/message */\n body: string;\n /** HTML body (for EMAIL) */\n htmlBody?: string;\n /** Notification type */\n type?: NotificationType;\n /** Application name */\n appName?: string;\n /** Redirect URL */\n redirectUrl?: string;\n /** Also send as in-app notification */\n includeInApp?: boolean;\n /** User IDs for in-app notifications (required when includeInApp is true) */\n userIds?: string[];\n /** Additional metadata */\n metadata?: Record<string, unknown>;\n /** Track email opens */\n trackOpens?: boolean;\n /** Track link clicks */\n trackClicks?: boolean;\n /** Expiration time */\n expiresAt?: Date;\n /** Specific channel instance ID (overrides platform) */\n channelId?: string;\n}\n\nexport interface SendTemplateNotificationOptions {\n /** Primary delivery channel (EMAIL, SMS, WHATSAPP, etc.) */\n platform: NotificationChannel;\n /** Template slug to use */\n templateSlug: string;\n /** Template variables */\n variables: Record<string, unknown>;\n /** Recipient information for primary channel */\n recipient?: RecipientInput;\n /** Multiple recipients for bulk delivery */\n recipients?: RecipientInput[];\n /** Also send as in-app notification */\n includeInApp?: boolean;\n /** User IDs for in-app notifications (required when includeInApp is true) */\n userIds?: string[];\n /** Application name */\n appName?: string;\n /** Track email opens */\n trackOpens?: boolean;\n /** Track link clicks */\n trackClicks?: boolean;\n /** Expiration time */\n expiresAt?: Date;\n /** Scheduled delivery time */\n scheduledFor?: Date;\n /** Timezone for scheduling */\n timezone?: string;\n /** Specific channel instance ID (overrides platform) */\n channelId?: string;\n}\n\n/**\n * Map the SDK's severity-flavoured `NotificationType` (info/success/warning/error) onto\n * global-notification-svc's delivery-intent `NotificationType`\n * (ALERT | MARKETING | SYSTEM | TRANSACTIONAL).\n *\n * The two enums describe different things and share no values, so an unmapped value would be\n * rejected by the owner. Warnings and errors are alerts; everything else is transactional.\n */\nfunction mapNotificationType(type?: NotificationType): 'ALERT' | 'TRANSACTIONAL' {\n return type === NotificationType.WARNING || type === NotificationType.ERROR ? 'ALERT' : 'TRANSACTIONAL';\n}\n\n/**\n * Choose the delivery channel required by `CreateNotificationInput.channel` (non-nullable).\n *\n * `SendNotificationOptions` expresses channel intent as the legacy `email`/`sms` booleans; the\n * owner expects a single `NotificationChannel`. In-app is the default so a caller that sets\n * neither flag still gets a delivered, visible notification.\n */\nfunction resolveChannel(options: SendNotificationOptions): 'EMAIL' | 'SMS' | 'IN_APP' {\n if (options.email) return 'EMAIL';\n if (options.sms) return 'SMS';\n return 'IN_APP';\n}\n\n/**\n * Notifications Module\n */\nexport class NotificationsModule {\n constructor(\n private client: BurdenoffGraphQLClient,\n private context: SDKContext\n ) {}\n\n /**\n * Send notification to users\n */\n public async send(options: SendNotificationOptions): Promise<NotificationResponse> {\n // Validate inputs\n if (!options.title || options.title.trim().length === 0) {\n throw new ValidationError('Notification title is required');\n }\n\n if (!options.message || options.message.trim().length === 0) {\n throw new ValidationError('Notification message is required');\n }\n\n if (!options.userIds || options.userIds.length === 0) {\n throw new ValidationError('At least one user ID is required');\n }\n\n logger.info('[Notifications] Sending notification', {\n title: options.title,\n userCount: options.userIds.length,\n type: options.type || NotificationType.INFO,\n });\n\n // `triggerNotification` both creates AND delivers. `createNotification` only persists —\n // its own schema doc says \"without triggering - use triggerNotification to send\" — so sending\n // through it would silently never deliver.\n const mutation = `\n mutation TriggerNotification($input: TriggerNotificationInput!) {\n triggerNotification(input: $input) {\n id\n status\n }\n }\n `;\n\n // global-notification-svc addresses ONE recipient per notification, so a multi-user send fans\n // out into one mutation per user rather than passing a `userIds` array (which the input does\n // not have). Failures are collected per recipient instead of rejecting the whole batch.\n const channel = resolveChannel(options);\n const notificationIds: string[] = [];\n const errors: string[] = [];\n\n const results = await Promise.allSettled(\n options.userIds.map(async (userId) => {\n const variables = {\n input: {\n notification: {\n recipient: { userId },\n channel,\n type: mapNotificationType(options.type),\n subject: options.title,\n body: options.message,\n ...(options.redirectUrl ? { redirectUrl: options.redirectUrl } : {}),\n ...(options.appName ? { appName: options.appName } : {}),\n },\n platform: channel,\n // Always leave an in-app trace when the primary channel is external, so the\n // notification is visible in the product even if email/SMS delivery fails.\n includeInApp: channel !== 'IN_APP',\n },\n };\n\n const response = await this.client.tenantQuery<{\n triggerNotification: { id: string; status?: string };\n }>(mutation, variables, this.context);\n\n const id = response.triggerNotification?.id;\n if (!id) {\n throw new Error(`notification service returned no id for user ${userId}`);\n }\n return id;\n })\n );\n\n for (const [index, settled] of results.entries()) {\n if (settled.status === 'fulfilled') {\n notificationIds.push(settled.value);\n } else {\n const reason = settled.reason instanceof Error ? settled.reason.message : String(settled.reason);\n errors.push(`${options.userIds[index] ?? 'unknown user'}: ${reason}`);\n }\n }\n\n const result: NotificationResponse = {\n successCount: notificationIds.length,\n failureCount: errors.length,\n errors,\n notificationIds,\n };\n\n logger.info('[Notifications] Notification sent', {\n successCount: result.successCount,\n failureCount: result.failureCount,\n });\n\n return result;\n }\n\n /**\n * Send notification to a single user (convenience method)\n */\n public async sendToUser(\n userId: string,\n title: string,\n message: string,\n options?: Omit<SendNotificationOptions, 'userIds' | 'title' | 'message'>\n ): Promise<NotificationResponse> {\n return this.send({\n title,\n message,\n userIds: [userId],\n ...options,\n });\n }\n\n /**\n * Get notifications for a user\n */\n public async getNotifications(options: GetNotificationsOptions): Promise<{\n notifications: Notification[];\n total: number;\n unreadCount: number;\n }> {\n logger.debug('[Notifications] Getting notifications', { userId: options.userId });\n\n const query = `\n query GetNotifications(\n $userId: ID!\n $status: NotificationStatus\n $type: NotificationType\n $appName: String\n $search: String\n $limit: Int\n $offset: Int\n ) {\n getNotifications(\n userId: $userId\n status: $status\n type: $type\n appName: $appName\n search: $search\n limit: $limit\n offset: $offset\n ) {\n notifications {\n id\n userId\n title\n message\n type\n status\n redirectUrl\n appName\n createdAt\n updatedAt\n }\n total\n unreadCount\n }\n }\n `;\n\n const variables = {\n userId: options.userId,\n status: options.status,\n type: options.type,\n appName: options.appName,\n search: options.search,\n limit: options.limit || 20,\n offset: options.offset || 0,\n };\n\n const response = await this.client.query<{\n getNotifications: {\n notifications: Notification[];\n total: number;\n unreadCount: number;\n };\n }>(query, variables, this.context);\n\n return response.getNotifications;\n }\n\n /**\n * Mark notification as read\n */\n public async markAsRead(notificationId: string): Promise<boolean> {\n logger.debug('[Notifications] Marking notification as read', { notificationId });\n\n const mutation = `\n mutation MarkNotificationAsRead($notificationId: ID!) {\n markNotificationAsRead(notificationId: $notificationId) {\n id\n status\n }\n }\n `;\n\n await this.client.tenantQuery(mutation, { notificationId }, this.context);\n\n logger.info('[Notifications] Notification marked as read', { notificationId });\n\n return true;\n }\n\n /**\n * Mark multiple notifications as read\n */\n public async markMultipleAsRead(notificationIds: string[]): Promise<number> {\n logger.debug('[Notifications] Marking multiple notifications as read', {\n count: notificationIds.length,\n });\n\n const mutation = `\n mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {\n markNotificationsAsRead(notificationIds: $notificationIds) {\n count\n }\n }\n `;\n\n const response = await this.client.query<{\n markNotificationsAsRead: { count: number };\n }>(mutation, { notificationIds }, this.context);\n\n logger.info('[Notifications] Notifications marked as read', {\n count: response.markNotificationsAsRead.count,\n });\n\n return response.markNotificationsAsRead.count;\n }\n\n /**\n * Mark all notifications as read for the current user\n */\n public async markAllAsRead(): Promise<number> {\n logger.debug('[Notifications] Marking all notifications as read');\n\n const mutation = `\n mutation MarkAllMyNotificationsAsRead {\n markAllMyNotificationsAsRead {\n count\n }\n }\n `;\n\n const response = await this.client.query<{\n markAllMyNotificationsAsRead: { count: number };\n }>(mutation, {}, this.context);\n\n logger.info('[Notifications] All notifications marked as read', {\n count: response.markAllMyNotificationsAsRead.count,\n });\n\n return response.markAllMyNotificationsAsRead.count;\n }\n\n /**\n * Delete notification\n */\n public async deleteNotification(notificationId: string): Promise<boolean> {\n logger.debug('[Notifications] Deleting notification', { notificationId });\n\n const mutation = `\n mutation DeleteNotification($notificationId: ID!) {\n deleteNotification(notificationId: $notificationId) {\n success\n }\n }\n `;\n\n await this.client.tenantQuery(mutation, { notificationId }, this.context);\n\n logger.info('[Notifications] Notification deleted', { notificationId });\n\n return true;\n }\n\n /**\n * Delete multiple notifications\n */\n public async deleteMultiple(notificationIds: string[]): Promise<number> {\n logger.debug('[Notifications] Deleting multiple notifications', {\n count: notificationIds.length,\n });\n\n const mutation = `\n mutation DeleteNotifications($notificationIds: [ID!]!) {\n deleteNotifications(notificationIds: $notificationIds) {\n count\n }\n }\n `;\n\n const response = await this.client.query<{\n deleteNotifications: { count: number };\n }>(mutation, { notificationIds }, this.context);\n\n logger.info('[Notifications] Notifications deleted', {\n count: response.deleteNotifications.count,\n });\n\n return response.deleteNotifications.count;\n }\n\n /**\n * Get unread notification count for a user\n */\n public async getUnreadCount(userId: string): Promise<number> {\n const result = await this.getNotifications({\n userId,\n status: 'unread',\n limit: 0,\n });\n\n return result.unreadCount;\n }\n\n /**\n * Send notification via specific channel (EMAIL, SMS, WHATSAPP, etc.)\n * with optional in-app notification\n */\n public async sendChannelNotification(options: SendChannelNotificationOptions): Promise<NotificationResponse> {\n // Validate inputs\n if (!options.body || options.body.trim().length === 0) {\n throw new ValidationError('Notification body is required');\n }\n\n if (!options.recipient && !options.recipients) {\n throw new ValidationError('At least one recipient is required');\n }\n\n if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) {\n throw new ValidationError('User IDs are required when includeInApp is true');\n }\n\n logger.info('[Notifications] Sending channel notification', {\n platform: options.platform,\n recipientCount: options.recipients ? options.recipients.length : 1,\n includeInApp: options.includeInApp,\n inAppUserCount: options.userIds ? options.userIds.length : 0,\n });\n\n const mutation = `\n mutation TriggerNotification($input: TriggerNotificationInput!) {\n triggerNotification(input: $input) {\n id\n status\n deliveryStatus\n }\n }\n `;\n\n const variables = {\n input: {\n platform: options.platform,\n channelId: options.channelId,\n includeInApp: options.includeInApp || false,\n userIds: options.userIds || [],\n notification: {\n subject: options.subject || '',\n body: options.body,\n htmlBody: options.htmlBody || '',\n channel: options.platform,\n type: options.type || NotificationType.INFO,\n recipient: options.recipient,\n appName: options.appName,\n redirectUrl: options.redirectUrl || '',\n metadata: options.metadata || {},\n trackOpens: options.trackOpens || false,\n trackClicks: options.trackClicks || false,\n expiresAt: options.expiresAt?.toISOString(),\n },\n },\n };\n\n // Handle bulk recipients\n if (options.recipients && options.recipients.length > 1) {\n const results = await Promise.allSettled(\n options.recipients.map((recipient) =>\n this.client.tenantQuery(\n mutation,\n {\n input: {\n ...variables.input,\n notification: {\n ...variables.input.notification,\n recipient,\n },\n },\n },\n this.context\n )\n )\n );\n\n let successCount = 0;\n let failureCount = 0;\n const errors: string[] = [];\n const notificationIds: string[] = [];\n\n results.forEach((result, index) => {\n if (result.status === 'fulfilled') {\n successCount++;\n const response = result.value as { triggerNotification: { id: string } };\n notificationIds.push(response.triggerNotification.id);\n } else {\n failureCount++;\n errors.push(\n `Recipient ${index + 1}: ${result.reason instanceof Error ? result.reason.message : 'Unknown error'}`\n );\n }\n });\n\n const response: NotificationResponse = {\n successCount,\n failureCount,\n errors,\n notificationIds,\n };\n\n logger.info('[Notifications] Channel notification sent (bulk)', {\n successCount,\n failureCount,\n });\n\n return response;\n } else {\n // Single recipient\n try {\n const response = await this.client.query<{\n triggerNotification: { id: string; status: string; deliveryStatus: string };\n }>(mutation, variables, this.context);\n\n const result: NotificationResponse = {\n successCount: 1,\n failureCount: 0,\n errors: [],\n notificationIds: [response.triggerNotification.id],\n };\n\n logger.info('[Notifications] Channel notification sent', {\n notificationId: response.triggerNotification.id,\n status: response.triggerNotification.status,\n });\n\n return result;\n } catch (error) {\n logger.error('[Notifications] Failed to send channel notification', { error });\n\n return {\n successCount: 0,\n failureCount: 1,\n errors: [error instanceof Error ? error.message : 'Unknown error'],\n notificationIds: [],\n };\n }\n }\n }\n\n /**\n * Send notification using a template with optional in-app notification\n */\n public async sendTemplateNotification(options: SendTemplateNotificationOptions): Promise<NotificationResponse> {\n // Validate inputs\n if (!options.templateSlug || options.templateSlug.trim().length === 0) {\n throw new ValidationError('Template slug is required');\n }\n\n if (!options.variables || typeof options.variables !== 'object') {\n throw new ValidationError('Template variables are required');\n }\n\n if (!options.recipient && !options.recipients) {\n throw new ValidationError('At least one recipient is required');\n }\n\n if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) {\n throw new ValidationError('User IDs are required when includeInApp is true');\n }\n\n logger.info('[Notifications] Sending template notification', {\n templateSlug: options.templateSlug,\n platform: options.platform,\n recipientCount: options.recipients ? options.recipients.length : 1,\n includeInApp: options.includeInApp,\n inAppUserCount: options.userIds ? options.userIds.length : 0,\n });\n\n const mutation = `\n mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {\n triggerNotificationWithTemplate(input: $input) {\n totalRequested\n totalTriggered\n totalFailed\n notifications {\n id\n status\n deliveryStatus\n }\n }\n }\n `;\n\n const variables = {\n input: {\n platform: options.platform,\n channelId: options.channelId,\n includeInApp: options.includeInApp || false,\n userIds: options.userIds || [],\n templateSlug: options.templateSlug,\n variables: options.variables,\n recipient: options.recipient,\n recipients: options.recipients,\n trackOpens: options.trackOpens || false,\n trackClicks: options.trackClicks || false,\n expiresAt: options.expiresAt?.toISOString(),\n scheduledFor: options.scheduledFor?.toISOString(),\n timezone: options.timezone,\n },\n };\n\n try {\n const response = await this.client.query<{\n triggerNotificationWithTemplate: {\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n notifications: Array<{ id: string; status: string; deliveryStatus?: string }>;\n };\n }>(mutation, variables, this.context);\n\n const data = response.triggerNotificationWithTemplate;\n\n const result: NotificationResponse = {\n successCount: data.totalTriggered,\n failureCount: data.totalFailed,\n errors: [],\n notificationIds: data.notifications.map((n) => n.id),\n };\n\n logger.info('[Notifications] Template notification sent', {\n templateSlug: options.templateSlug,\n totalTriggered: data.totalTriggered,\n totalFailed: data.totalFailed,\n notificationIds: result.notificationIds,\n });\n\n return result;\n } catch (error) {\n logger.error('[Notifications] Failed to send template notification', { error });\n\n return {\n successCount: 0,\n failureCount: 1,\n errors: [error instanceof Error ? error.message : 'Unknown error'],\n notificationIds: [],\n };\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts"],"names":["SDKError","Error","message","code","details","name","Object","setPrototypeOf","prototype","PermissionDeniedError","AuthenticationError","APIError","ValidationError","QuotaExceededError","NetworkError","TimeoutError"],"mappings":";;;AA6IO,IAAMA,QAAAA,GAAN,MAAMA,SAAAA,SAAiBC,KAAAA,CAAAA;EA7I9B;;;;;EA8IE,WAAA,CACEC,OAAAA,EACOC,MACAC,OAAAA,EACP;AACA,IAAA,KAAA,CAAMF,OAAAA,CAAAA,EAAAA,IAAAA,CAHCC,IAAAA,GAAAA,IAAAA,EAAAA,KACAC,OAAAA,GAAAA,OAAAA;AAGP,IAAA,IAAA,CAAKC,IAAAA,GAAO,UAAA;AACZC,IAAAA,MAAAA,CAAOC,cAAAA,CAAe,IAAA,EAAMP,SAAAA,CAASQ,SAAS,CAAA;AAChD,EAAA;AACF,CAAA;AAKO,IAAMC,qBAAAA,GAAN,MAAMA,sBAAAA,SAA8BT,QAAAA,CAAAA;EA5J3C;;;AA6JE,EAAA,WAAA,CAAYE,SAAiBE,OAAAA,EAAmC;AAC9D,IAAA,KAAA,CAAMF,OAAAA,EAAS,qBAAqBE,OAAAA,CAAAA;AACpC,IAAA,IAAA,CAAKC,IAAAA,GAAO,uBAAA;AACZC,IAAAA,MAAAA,CAAOC,cAAAA,CAAe,IAAA,EAAME,sBAAAA,CAAsBD,SAAS,CAAA;AAC7D,EAAA;AACF;AAKO,IAAME,mBAAAA,GAA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CAAOC,cAAAA,CAAe,IAAA,EAAMM,mBAAAA,CAAmBL,SAAS,CAAA;AAC1D,EAAA;AACF;AAKO,IAAMM,YAAAA,GAAN,MAAMA,aAAAA,SAAqBd,QAAAA,CAAAA;EAnNlC;;;AAoNE,EAAA,WAAA,CAAYE,SAAiBE,OAAAA,EAAmC;AAC9D,IAAA,KAAA,CAAMF,OAAAA,EAAS,iBAAiBE,OAAAA,CAAAA;AAChC,IAAA,IAAA,CAAKC,IAAAA,GAAO,cAAA;AACZC,IAAAA,MAAAA,CAAOC,cAAAA,CAAe,IAAA,EAAMO,aAAAA,CAAaN,SAAS,CAAA;AACpD,EAAA;AACF;AAKO,IAAMO,YAAAA,GAAN,MAAMA,aAAAA,SAAqBf,QAAAA,CAAAA;EA9NlC;;;AA+NE,EAAA,WAAA,CAAYE,SAAiBE,OAAAA,EAAmC;AAC9D,IAAA,KAAA,CAAMF,OAAAA,EAAS,iBAAiBE,OAAAA,CAAAA;AAChC,IAAA,IAAA,CAAKC,IAAAA,GAAO,cAAA;AACZC,IAAAA,MAAAA,CAAOC,cAAAA,CAAe,IAAA,EAAMQ,aAAAA,CAAaP,SAAS,CAAA;AACpD,EAAA;AACF","file":"chunk-QGBXVNRM.js","sourcesContent":["/**\n * Core type definitions for Burdenoff Backend SDK\n */\n\nimport type { ServiceLayer } from './layer.js';\n\n/**\n * SDK Configuration\n */\nexport interface SDKConfig {\n /** Workspaces API GraphQL endpoint (should point to wspace-int-gateway for M2M calls) */\n workspacesApiUrl: string;\n /**\n * Tenant API GraphQL endpoint for cross-layer (wspace → global) M2M calls.\n * Cross-layer traffic must go through the **public** global gateway\n * (`GLOBAL_PUBLIC_GATEWAY_URL`), not the internal gateway — ACA internal\n * ingress is environment-scoped and does not route across the wspace/global\n * environment boundary.\n */\n tenantApiUrl?: string;\n /**\n * Calling service's layer (`wspace` | `global`). Used to construct the\n * cross-layer GatewayClient. Defaults to the `SERVICE_LAYER` env var, then\n * `wspace`.\n */\n serviceLayer?: ServiceLayer;\n /**\n * Calling service name. Used as the cross-layer GatewayClient service identity\n * and the `sub` of the minted service JWT. Defaults to the `SERVICE_NAME` env\n * var, then `burdenoff-be-sdk`.\n */\n serviceName?: string;\n /** Default timeout for API requests in milliseconds */\n timeout?: number;\n /** Retry configuration */\n retry?: RetryConfig;\n /** Logger configuration */\n logger?: LoggerConfig;\n /** Event queue configuration (Redis Streams). Reads `REDIS_URL` when present. */\n eventQueue?: EventQueueSDKConfig;\n /** Temporal module type (workspace or tenant) */\n temporalModuleType?: 'workspace' | 'tenant';\n /** Temporal server address */\n temporalAddress?: string;\n /** Temporal namespace */\n temporalNamespace?: string;\n /** Temporal task queue */\n temporalTaskQueue?: string;\n /** Auto-connect to Temporal (default: true) */\n temporalAutoConnect?: boolean;\n}\n\n/**\n * Retry configuration for API requests\n */\nexport interface RetryConfig {\n /** Maximum number of retry attempts */\n maxAttempts: number;\n /** Initial retry delay in milliseconds */\n initialDelay: number;\n /** Maximum retry delay in milliseconds */\n maxDelay: number;\n /** Backoff multiplier */\n backoffMultiplier: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Log level */\n level: 'debug' | 'info' | 'warn' | 'error';\n /** Enable console output */\n console: boolean;\n /** Custom logger transport */\n transport?: LoggerTransport;\n}\n\n/**\n * Custom logger transport interface\n */\nexport interface LoggerTransport {\n log(level: string, message: string, meta?: Record<string, unknown>): void;\n}\n\n/**\n * Actor type for RBAC authorization\n * - user: Direct user request (via frontend)\n * - app: OAuth app acting on behalf of user\n * - service: M2M service-to-service communication\n * - super_admin: Platform administration (bypasses all checks)\n */\nexport type ActorType = 'user' | 'app' | 'service' | 'super_admin';\n\n/**\n * Request context passed with every SDK operation\n */\nexport interface SDKContext {\n /** Actor ID - identifies the entity making the request */\n actorId?: string;\n /** Actor type - determines authorization behavior */\n actorType?: ActorType;\n /** Workspace ID */\n workspaceId?: string;\n /** Tenant ID */\n tenantId?: string;\n /** Project ID */\n projectId?: string;\n /** App ID */\n appId?: string;\n /** JWT token for authentication */\n token?: string;\n /** Product ID */\n productId?: string;\n /**\n * Cloudflare Access service-token client id, captured from the inbound\n * `cf-access-client-id` header. Re-presented on cross-layer outbound calls so\n * the peer layer's CF-Access-gated public gateway admits the request.\n */\n cfAccessClientId?: string;\n /**\n * Cloudflare Access service-token client secret, from `cf-access-client-secret`.\n * Sensitive — redacted by the SDK logger's secret pattern; never log directly.\n */\n cfAccessClientSecret?: string;\n /**\n * Cloudflare Access USER-SSO credential — the `CF_Authorization` cookie value,\n * forwarded by the public gateway as `x-cf-authorization`. On alpha a real user\n * request carries this (not the service-token pair); re-presented as the\n * `CF_Authorization` cookie on cross-layer outbound calls so the peer layer's\n * CF-Access-gated public gateway (same CF-Access app / shared AUD) admits it.\n * Sensitive — never log directly. See BOFF-2929.\n */\n cfAuthorization?: string;\n /** Additional custom context */\n [key: string]: unknown;\n}\n\n/**\n * SDK Error base class\n */\nexport class SDKError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: Record<string, unknown>\n ) {\n super(message);\n this.name = 'SDKError';\n Object.setPrototypeOf(this, SDKError.prototype);\n }\n}\n\n/**\n * Permission denied error\n */\nexport class PermissionDeniedError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'PERMISSION_DENIED', details);\n this.name = 'PermissionDeniedError';\n Object.setPrototypeOf(this, PermissionDeniedError.prototype);\n }\n}\n\n/**\n * Authentication error\n */\nexport class AuthenticationError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'AUTHENTICATION_ERROR', details);\n this.name = 'AuthenticationError';\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n/**\n * API error from backend\n */\nexport class APIError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'API_ERROR', details);\n this.name = 'APIError';\n Object.setPrototypeOf(this, APIError.prototype);\n }\n}\n\n/**\n * Validation error\n */\nexport class ValidationError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'VALIDATION_ERROR', details);\n this.name = 'ValidationError';\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\n/**\n * Quota exceeded error\n */\nexport class QuotaExceededError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'QUOTA_EXCEEDED', details);\n this.name = 'QuotaExceededError';\n Object.setPrototypeOf(this, QuotaExceededError.prototype);\n }\n}\n\n/**\n * Network error\n */\nexport class NetworkError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'NETWORK_ERROR', details);\n this.name = 'NetworkError';\n Object.setPrototypeOf(this, NetworkError.prototype);\n }\n}\n\n/**\n * Timeout error\n */\nexport class TimeoutError extends SDKError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'TIMEOUT_ERROR', details);\n this.name = 'TimeoutError';\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Event queue SDK configuration (Redis Streams backend).\n *\n * The publisher is created via `createPublisher()` from\n * `@burdenoff/be-sdk/event-queue` and reads `REDIS_URL` from the env.\n * The fields here are for client-name + reconnect tuning only.\n */\nexport interface EventQueueSDKConfig {\n /** Redis Streams server URL. Overrides `REDIS_URL` env if set. */\n url?: string;\n /** Optional password for TLS/auth */\n password?: string;\n /** Maximum reconnect attempts (default: -1 = infinite) */\n maxReconnectAttempts?: number;\n /** Reconnect time wait in milliseconds (default: 2000) */\n reconnectTimeWait?: number;\n /** Client name for logging (default: service name) */\n name?: string;\n /** Auto-connect on SDK initialization (default: true) */\n autoConnect?: boolean;\n}\n\n/**\n * Event queue health status\n */\nexport interface EventQueueHealthStatus {\n status: 'healthy' | 'unhealthy' | 'not_configured';\n connected: boolean;\n url?: string;\n details?: Record<string, unknown>;\n}\n\n/**\n * Temporal health status\n */\nexport interface TemporalHealthStatus {\n status: 'healthy' | 'unhealthy' | 'not_configured';\n connected: boolean;\n address?: string;\n namespace?: string;\n details?: Record<string, unknown>;\n}\n\n/**\n * Overall SDK health status\n */\nexport interface SDKHealthStatus {\n eventQueue: EventQueueHealthStatus;\n temporal: TemporalHealthStatus;\n}\n\n/**\n * SDK shutdown options\n */\nexport interface SDKShutdownOptions {\n /** Shutdown timeout in milliseconds (default: 5000) */\n timeout?: number;\n /** Force shutdown even if timeout is exceeded (default: true) */\n force?: boolean;\n}\n\n// ============================================================================\n// Layer Types Export\n// ============================================================================\n\n/**\n * Re-export all layer-related types for convenience\n */\nexport type {\n ServiceLayer,\n LayerConfig,\n LayerGatewayConfig,\n LayerResourceUrls,\n LayerFullConfig,\n GatewayRoutingConfig,\n CircuitBreakerConfig,\n GatewayRetryConfig,\n GatewayRequestHeaders,\n} from './layer.js';\n\nexport {\n DEFAULT_GATEWAY_ROUTING,\n DEFAULT_LAYER_RESOURCES,\n DEFAULT_LAYER_STREAMS,\n DEFAULT_CIRCUIT_BREAKER_CONFIG,\n DEFAULT_GATEWAY_RETRY_CONFIG,\n} from './layer.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/validation/index.ts","../src/validation/name.ts","../src/validation/username.ts","../src/validation/userFields.ts","../src/validation/rbac-coverage.ts"],"names":["NAME_MIN_LENGTH","NAME_MAX_LENGTH","NAME_ALLOWED_CHARS","TYPOGRAPHIC_APOSTROPHES","TYPOGRAPHIC_HYPHENS","lengthInCodePoints","s","length","validateName","name","trimmed","normalize","replace","trim","valid","code","message","test","value","USERNAME_MIN_LENGTH","USERNAME_MAX_LENGTH","USERNAME_ALLOWED_CHARS","validateUsername","username","errors","push","validateUserFields","input","options","requireAll","isBlank","v","firstName","field","lastName","e","valueOr","result","fallback","values","RBAC_GATED_SCOPE_TYPES","RBAC_SCOPE_TYPES","DEFAULT_RBAC_ROOT_TYPES","DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS","DEFAULT_BILLING_SCOPE_ARG","DEFAULT_ID_SCALARS","SCHEMA_EXTENSIONS","Set","SKIPPED_DIRECTORIES","PLACEHOLDER_FIELD","RbacCoverageError","Error","report","problems","join","collectSchemaFiles","path","statSync","isDirectory","out","entries","readdirSync","withFileTypes","sort","a","b","localeCompare","entry","full","has","startsWith","extname","loadRbacSchemaDocuments","paths","files","flatMap","map","file","document","parse","readFileSync","error","String","cause","isDocumentNode","kind","Kind","DOCUMENT","toSchemaDocuments","source","items","every","item","TypeError","rbacDirective","directives","find","d","readRbacDirectiveArgs","directive","args","arg","arguments","BOOLEAN","public","LIST","actorTypes","STRING","rootTypeNames","docs","configured","names","def","definitions","SCHEMA_DEFINITION","SCHEMA_EXTENSION","op","operationTypes","add","type","inputFieldsByType","Map","INPUT_OBJECT_TYPE_DEFINITION","INPUT_OBJECT_TYPE_EXTENSION","existing","get","fields","set","unwrapSingular","NON_NULL_TYPE","LIST_TYPE","rbacArgPathProblem","inputs","maxSegments","idScalars","segments","split","some","head","rest","typeName","walked","segment","next","f","malformedReason","rbac","scopeType","hasActionResource","Boolean","action","resource","includes","scopeArg","pinEntries","pin","Array","isArray","Object","keys","matchesEntry","coordinate","sortLines","lines","collectRootFields","roots","exempt","OBJECT_TYPE_DEFINITION","OBJECT_TYPE_EXTENSION","definition","root","scopeArgPath","undefined","argPathProblems","context","checks","label","resourceIdArg","problem","selfScopedPinProblems","rootFields","unreviewed","stale","selfScoped","filter","analyzeRbacCoverage","collected","rootTypes","exemptFields","pathContext","maxArgPathSegments","missing","malformed","unresolvedArgPaths","reason","pins","selfScopedFields","unreviewedSelfScoped","staleSelfScoped","minRootFields","c","m","p","ok","assertRbacCoverage"],"mappings":";;;;;;AAAA,IAAA,kBAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;ACwCO,IAAMA,eAAAA,GAAkB;AACxB,IAAMC,eAAAA,GAAkB;AAc/B,IAAMC,kBAAAA,GAAqB,+CAAA;AAC3B,IAAMC,uBAAAA,GAA0B,uBAAA;AAChC,IAAMC,mBAAAA,GAAsB,iBAAA;AAarB,SAASC,mBAAmBC,CAAAA,EAAS;AAC1C,EAAA,OAAO;AAAIA,IA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H,MAAAA,EAA4B7D,OAAAA,GAA+B,EAAC,EAAC;AAC9F,EAAA,MAAMwB,MAAAA,GAASqI,mBAAAA,CAAoBhG,MAAAA,EAAQ7D,OAAAA,CAAAA;AAC3C,EAAA,IAAI,CAACwB,MAAAA,CAAOuJ,EAAAA,EAAI,MAAM,IAAIzJ,kBAAkBE,MAAAA,CAAAA;AAC5C,EAAA,OAAOA,MAAAA;AACT;AAJgBwJ,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA","file":"chunk-WVOW3CJR.js","sourcesContent":["/**\n * Server-side validators for user-identity fields (firstName, lastName,\n * username). Mirrors the client-side validators in\n * `microfe-auth/src/auth/utils/validation.ts` so the same invariant holds\n * whether the call arrives via the UI form, the GraphQL API directly,\n * or a programmatic client. See BOFF-7261.\n */\n\nexport { validateName, lengthInCodePoints, NAME_MIN_LENGTH, NAME_MAX_LENGTH } from './name.js';\nexport type { NameErrorCode, NameValidationResult } from './name.js';\n\nexport { validateUsername, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH } from './username.js';\nexport type { UsernameErrorCode, UsernameValidationResult } from './username.js';\n\nexport { validateUserFields } from './userFields.js';\nexport type { UserFieldKey, UserFieldError, ValidatedUserFields, UserFieldsValidationResult } from './userFields.js';\n\nexport {\n assertRbacCoverage,\n analyzeRbacCoverage,\n loadRbacSchemaDocuments,\n readRbacDirectiveArgs,\n rbacArgPathProblem,\n RbacCoverageError,\n RBAC_SCOPE_TYPES,\n RBAC_GATED_SCOPE_TYPES,\n DEFAULT_RBAC_ROOT_TYPES,\n DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS,\n} from './rbac-coverage.js';\nexport type {\n RbacCoverageOptions,\n RbacCoverageReport,\n RbacCoverageSource,\n RbacDirectiveArgs,\n RbacFieldPin,\n RbacRootField,\n RbacSchemaDocument,\n RbacScopeType,\n} from './rbac-coverage.js';\n","/**\n * Validate a person's name (first or last).\n *\n * Mirrors `microfe-auth/src/auth/utils/validation.ts:validateName` from\n * the BOFF-7214 client-side PR (#59) so the server and the client apply\n * the same invariant. Do not edit one without editing the other — the\n * two must stay byte-identical or client-passes-but-server-rejects errors\n * will surface in production (BOFF-7261 acceptance criteria).\n *\n * Rules:\n * - 1–100 Unicode code points (NOT JavaScript `.length`, which counts\n * UTF-16 code units — see `lengthInCodePoints`).\n * - must contain at least one letter (`\\p{L}`)\n * - allowed characters: letters, marks, literal space, hyphen,\n * apostrophe, period, middle-dot (U+00B7, U+30FB), and zero-width\n * join controls (U+200C, U+200D)\n * - typographic apostrophes (U+2018 / U+2019 / U+02BC) and\n * typographic hyphens (U+2010 / U+2011) are folded to their ASCII\n * equivalents before storage\n * - NFC normalisation runs before trim/length so combining-mark\n * sequences (e.g. `e\\u0301` for `é`) fold to their precomposed form\n *\n * Accepts `string | undefined | null` because the GraphQL input types\n * declare these fields as optional. An absent value fails validation.\n *\n * On success the result carries the canonicalised `value` (NFC,\n * typographic apostrophes folded to ASCII, trimmed) so the caller can\n * persist the exact same string the validator approved — otherwise the\n * validated string and the value written to the database would diverge.\n *\n * Returns a structured result so the caller can map each error code to\n * a distinct i18n key.\n */\n\nexport type NameErrorCode = 'required' | 'too_long' | 'no_letter' | 'invalid_chars';\n\nexport type NameValidationResult =\n | { valid: true; value: string }\n | { valid: false; code: NameErrorCode; message: string };\n\nexport const NAME_MIN_LENGTH = 1;\nexport const NAME_MAX_LENGTH = 100;\n\n/**\n * Allowed characters for a name. Every character must be a letter,\n * mark, literal space, hyphen, apostrophe, period, middle-dot, or join\n * control. Must contain at least one letter.\n *\n * Note: a literal space, not `\\s` — `\\s` matches tabs/newlines/other\n * Unicode whitespace which has no business being inside a person's name.\n *\n * Middle-dot codepoints U+00B7 and U+30FB are allowed as-is, NOT folded\n * to `.` — they're orthographically distinct and silently rewriting the\n * user's name would corrupt their identity.\n */\nconst NAME_ALLOWED_CHARS = /^[\\p{L}\\p{M} '.\\-\\u00B7\\u30FB\\u200C\\u200D]+$/u;\nconst TYPOGRAPHIC_APOSTROPHES = /[\\u2018\\u2019\\u02BC]/g;\nconst TYPOGRAPHIC_HYPHENS = /[\\u2010\\u2011]/g;\n\n/**\n * Count Unicode code points in `s` instead of UTF-16 code units. Names\n * written in scripts that live in the supplementary plane (Adlam 𞤁𞤔𞤣,\n * many CJK extensions, etc.) have each letter encoded as two UTF-16 units,\n * so a 51-letter Adlam name would otherwise be miscounted as 102 and\n * rejected as too long.\n *\n * Code-point counting is sufficient for the name validator — grapheme-\n * cluster counting would also handle emoji ZWJ sequences, but the name\n * regex already disallows emoji.\n */\nexport function lengthInCodePoints(s: string): number {\n return [...s].length;\n}\n\nexport function validateName(name: string | undefined | null): NameValidationResult {\n const trimmed = (name ?? '')\n .normalize('NFC')\n .replace(TYPOGRAPHIC_APOSTROPHES, \"'\")\n .replace(TYPOGRAPHIC_HYPHENS, '-')\n .trim();\n\n if (lengthInCodePoints(trimmed) < NAME_MIN_LENGTH) {\n return { valid: false, code: 'required', message: 'Name is required' };\n }\n\n if (lengthInCodePoints(trimmed) > NAME_MAX_LENGTH) {\n return {\n valid: false,\n code: 'too_long',\n message: `Name must be ${NAME_MAX_LENGTH} characters or fewer`,\n };\n }\n\n if (!NAME_ALLOWED_CHARS.test(trimmed) || !/\\p{L}/u.test(trimmed)) {\n if (!/\\p{L}/u.test(trimmed)) {\n return {\n valid: false,\n code: 'no_letter',\n message: 'Name must contain at least one letter',\n };\n }\n return {\n valid: false,\n code: 'invalid_chars',\n message: 'Name can only contain letters, spaces, periods, hyphens, and apostrophes',\n };\n }\n\n return { valid: true, value: trimmed };\n}\n","/**\n * Validate a username.\n *\n * Mirrors `microfe-auth/src/auth/utils/validation.ts:validateUsername`\n * from the BOFF-7214 client-side PR (#59). Do not edit one without\n * editing the other.\n *\n * Rules:\n * - 3–30 Unicode code points (NOT JavaScript `.length`)\n * - allow-list `[a-zA-Z0-9_-]`\n * - must contain at least one letter (so `12345` fails — this is the\n * specific BOFF-7214 invariant; a pure-numeric username used to\n * pass the character allow-list alone)\n * - surrounding whitespace is trimmed before validation so a pasted\n * `\" alice_01 \"` doesn't fail with a misleading \"invalid chars\"\n * error\n *\n * On success the result carries the trimmed `value` so the caller\n * persists the same string the validator approved.\n *\n * Returns a structured result with a list of errors so the caller can\n * render every failing rule at once.\n */\n\nimport { lengthInCodePoints } from './name.js';\n\nexport type UsernameErrorCode = 'required' | 'too_short' | 'too_long' | 'invalid_chars' | 'no_letter';\n\nexport type UsernameValidationResult =\n | { valid: true; value: string }\n | {\n valid: false;\n errors: Array<{ code: UsernameErrorCode; message: string }>;\n };\n\nexport const USERNAME_MIN_LENGTH = 3;\nexport const USERNAME_MAX_LENGTH = 30;\nconst USERNAME_ALLOWED_CHARS = /^[a-zA-Z0-9_-]+$/;\n\nexport function validateUsername(username: string | undefined | null): UsernameValidationResult {\n const errors: Array<{ code: UsernameErrorCode; message: string }> = [];\n const value = (username ?? '').trim();\n\n if (lengthInCodePoints(value) === 0) {\n errors.push({ code: 'required', message: 'Username is required' });\n return { valid: false, errors };\n }\n\n if (lengthInCodePoints(value) < USERNAME_MIN_LENGTH) {\n errors.push({\n code: 'too_short',\n message: `Username must be at least ${USERNAME_MIN_LENGTH} characters`,\n });\n }\n\n if (lengthInCodePoints(value) > USERNAME_MAX_LENGTH) {\n errors.push({\n code: 'too_long',\n message: `Username must be ${USERNAME_MAX_LENGTH} characters or fewer`,\n });\n }\n\n if (!USERNAME_ALLOWED_CHARS.test(value)) {\n errors.push({\n code: 'invalid_chars',\n message: 'Username can only contain letters, numbers, underscores, and hyphens',\n });\n }\n\n // Must contain at least one letter — guards against all-numeric or\n // all-symbol usernames slipping through. Pure numeric values like\n // \"12345\" previously passed the character allow-list alone. Only\n // check this when the length is in range so a too-short value doesn't\n // get two errors.\n if (\n lengthInCodePoints(value) >= USERNAME_MIN_LENGTH &&\n lengthInCodePoints(value) <= USERNAME_MAX_LENGTH &&\n !/[a-zA-Z]/.test(value)\n ) {\n errors.push({\n code: 'no_letter',\n message: 'Username must contain at least one letter',\n });\n }\n\n return errors.length === 0 ? { valid: true, value } : { valid: false, errors };\n}\n","/**\n * Bundle validation across all three user-identity fields.\n *\n * Mirrors `microfe-auth/src/auth/utils/validation.ts:validateUserFields`\n * from the BOFF-7214 client-side PR (#59). Do not edit one without\n * editing the other.\n *\n * Use this on the server in `signUp`, `updateCurrentUserProfile`, and\n * `updateUser` so the BOFF-7214 invariant — `firstName` / `lastName`\n * contain a letter, `username` contains a letter — holds at every\n * mutation surface, not just signup (BOFF-7261).\n *\n * `requireAll` controls how blank fields are treated:\n * - `true` (default): used by `signUp` — every field must validate.\n * An empty field fails with `code: \"required\"`.\n * - `false`: used by `updateCurrentUserProfile` / `updateUser` — an\n * existing user whose optional `firstName` / `lastName` is unset\n * (e.g. provisioned via an identity provider) can still update\n * unrelated fields like phone or role. Blank fields are skipped.\n *\n * On success, the result carries the canonicalised values from each\n * individual validator (NFC, typographic apostrophes folded to ASCII,\n * trimmed) so the caller writes the same strings the validators approved\n * — no validate/submit divergence.\n */\n\nimport { validateName } from './name.js';\nimport { validateUsername } from './username.js';\n\nexport type UserFieldKey = 'firstName' | 'lastName' | 'username';\n\nexport interface UserFieldError {\n field: UserFieldKey;\n code: string;\n message: string;\n}\n\nexport interface ValidatedUserFields {\n firstName: string;\n lastName: string;\n username: string;\n}\n\nexport type UserFieldsValidationResult =\n | { valid: true; values: ValidatedUserFields }\n | { valid: false; errors: UserFieldError[] };\n\nexport function validateUserFields(\n input: {\n firstName?: string | null;\n lastName?: string | null;\n username?: string | null;\n },\n options: { requireAll?: boolean } = {}\n): UserFieldsValidationResult {\n const requireAll = options.requireAll ?? true;\n const errors: UserFieldError[] = [];\n\n const isBlank = (v: string | null | undefined): boolean => !v || v.trim().length === 0;\n\n const firstName = !isBlank(input.firstName) || requireAll ? validateName(input.firstName) : null;\n if (firstName && !firstName.valid) {\n errors.push({\n field: 'firstName',\n code: firstName.code,\n message: firstName.message,\n });\n }\n\n const lastName = !isBlank(input.lastName) || requireAll ? validateName(input.lastName) : null;\n if (lastName && !lastName.valid) {\n errors.push({\n field: 'lastName',\n code: lastName.code,\n message: lastName.message,\n });\n }\n\n const username = !isBlank(input.username) || requireAll ? validateUsername(input.username) : null;\n if (username && !username.valid) {\n for (const e of username.errors) {\n errors.push({ field: 'username', code: e.code, message: e.message });\n }\n }\n\n if (errors.length > 0) return { valid: false, errors };\n\n const valueOr = (result: { valid: true; value: string } | null, fallback: string | null | undefined): string =>\n result ? result.value : (fallback ?? '').trim();\n\n return {\n valid: true,\n values: {\n firstName: valueOr(firstName as { valid: true; value: string } | null, input.firstName),\n lastName: valueOr(lastName as { valid: true; value: string } | null, input.lastName),\n username: valueOr(username as { valid: true; value: string } | null, input.username),\n },\n };\n}\n","/**\n * Whole-schema `@rbac` coverage guard for subgraph services.\n *\n * Authorization on the platform is enforced at the API gateway, driven entirely by the\n * `@rbac` directive on each root-operation field (see\n * `~/products/dev/platform/context/identity/rbac/`). The gateway's rbac-middleware\n * fails CLOSED for HTTP Query/Mutation traffic, so a field without a usable `@rbac`\n * is denied for every caller (\"Field X is missing @rbac directive\"): an outage.\n * Subscriptions over the WebSocket transport are let through with only a warning,\n * so a missing `@rbac` there is a silent authorization hole.\n *\n * `assertRbacCoverage` is meant to be called from one unit test per svc. It parses\n * the svc's real SDL into a GraphQL AST (no regex) and checks, for every\n * Query/Mutation/Subscription field:\n *\n * 1. it carries an `@rbac` directive;\n * 2. the directive is well-formed the way the gateway reads it: `public: true`,\n * `scopeType: \"self\"`, an `actorTypes`-only gate, or `action` + `resource` +\n * a known `scopeType` (`entity` additionally needs `scopeArg`);\n * 3. `resourceIdArg` (and the `scopeArg` of `entity`/`billing` scopes) resolves to a\n * single ID/String through the field's arguments and input objects, at most two\n * segments deep — anything else silently degrades to a type-wide check or a deny;\n * 4. optionally, the set of `scopeType: \"self\"` fields equals a pinned, reviewed list,\n * because \"self\" is an authentication gate only and the resolver alone must scope\n * the data to the caller.\n *\n * Lifted from wspace-healthybowl-svc `src/__tests__/rbac-coverage.test.ts`\n * (BOFF-6052, BOFF-7476) so every svc runs one implementation.\n *\n * @example\n * ```ts\n * import { assertRbacCoverage } from '@burdenoff/be-sdk/validation';\n *\n * it('gates every root field with a well-formed @rbac', () => {\n * const report = assertRbacCoverage(join(__dirname, '../modules'), {\n * selfScopedFields: { myAgents: 'resolver filters by ctx.actorId' },\n * minRootFields: 200,\n * });\n * expect(report.rootFields.length).toBeGreaterThan(200);\n * });\n * ```\n */\nimport { readdirSync, readFileSync, statSync } from 'node:fs';\nimport { extname, join } from 'node:path';\nimport {\n Kind,\n parse,\n type DirectiveNode,\n type DocumentNode,\n type FieldDefinitionNode,\n type InputObjectTypeDefinitionNode,\n type InputObjectTypeExtensionNode,\n type InputValueDefinitionNode,\n type TypeNode,\n} from 'graphql';\n\n/** Scope types the gateway rbac-middleware understands for an action+resource check. */\nexport const RBAC_GATED_SCOPE_TYPES = ['wspace', 'global', 'entity', 'billing', 'organization'] as const;\n\n/** Every `scopeType` value the gateway accepts (the gated ones plus the `self` authentication gate). */\nexport const RBAC_SCOPE_TYPES = [...RBAC_GATED_SCOPE_TYPES, 'self'] as const;\n\nexport type RbacScopeType = (typeof RBAC_SCOPE_TYPES)[number];\n\n/** Default root operation types whose every field must be RBAC-gated. */\nexport const DEFAULT_RBAC_ROOT_TYPES = ['Query', 'Mutation', 'Subscription'] as const;\n\n/**\n * The most segments a `resourceIdArg`/`scopeArg` path can have and still resolve however\n * the client writes the request. The gateway's `extractFieldArguments` copies an inline\n * object argument one level deep and skips a nested object literal inside it, so\n * `input.nested.id` resolves only when `input` arrives as a variable.\n */\nexport const DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS = 2;\n\n/** The billing scope reads this argument when the directive sets no `scopeArg`. */\nconst DEFAULT_BILLING_SCOPE_ARG = 'billingAccountId';\n\nconst DEFAULT_ID_SCALARS = ['ID', 'String'] as const;\nconst SCHEMA_EXTENSIONS = new Set(['.gql', '.graphql']);\nconst SKIPPED_DIRECTORIES = new Set(['node_modules', 'dist', 'build', 'coverage']);\n\n/**\n * Placeholder root fields (`_empty`, `_emptyVibecontrols`, …) keep an otherwise-empty\n * root type valid SDL. They expose no data and need no gate.\n */\nconst PLACEHOLDER_FIELD = /^_empty[A-Za-z0-9]*$/;\n\n/** The `@rbac` arguments the gateway reads, as written in the SDL. */\nexport interface RbacDirectiveArgs {\n action?: string;\n resource?: string;\n resourceIdArg?: string;\n scopeType?: string;\n scopeArg?: string;\n public?: boolean;\n actorTypes?: string[];\n}\n\n/** One root-operation field found in the schema. */\nexport interface RbacRootField {\n /** Root type name, e.g. `Query`. */\n type: string;\n /** Field name, e.g. `myAgents`. */\n name: string;\n /** `Type.field`. */\n coordinate: string;\n /** Source file the field was parsed from, when the input came from disk. */\n file?: string;\n /** Parsed `@rbac` arguments, or `null` when the field has no `@rbac`. */\n rbac: RbacDirectiveArgs | null;\n}\n\n/** A pinned list of reviewed fields: field names or `Type.field` coordinates, optionally with the reason. */\nexport type RbacFieldPin = readonly string[] | Readonly<Record<string, string>>;\n\nexport interface RbacCoverageOptions {\n /** Root types to check. Defaults to Query/Mutation/Subscription plus any names a `schema { … }` block maps. */\n rootTypes?: readonly string[];\n /** Extra field names or `Type.field` coordinates to skip. `_empty*` placeholders are always skipped. */\n exemptFields?: readonly string[];\n /**\n * The reviewed set of `scopeType: \"self\"` fields. When given, every self-scoped field must\n * be listed and every entry must match a self-scoped field. Omit to skip the pin check.\n */\n selfScopedFields?: RbacFieldPin;\n /** Fail when fewer root fields than this are found (guards a wrong path \"passing\"). Default 1. */\n minRootFields?: number;\n /** Maximum `resourceIdArg`/`scopeArg` path segments. Default {@link DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS}. */\n maxArgPathSegments?: number;\n /** Scalars an id path may end on. Default `ID`, `String`. */\n idScalars?: readonly string[];\n}\n\n/** A schema loaded for analysis: the parsed document plus where it came from. */\nexport interface RbacSchemaDocument {\n document: DocumentNode;\n file?: string;\n}\n\nexport interface RbacCoverageReport {\n /** Every checked root field (placeholders and exemptions removed). */\n rootFields: RbacRootField[];\n /** `Type.field` of root fields without `@rbac`. */\n missing: string[];\n /** `Type.field: reason` for directives the gateway would deny as invalid. */\n malformed: string[];\n /** `Type.field: reason` for `resourceIdArg`/`scopeArg` paths that do not resolve to one id. */\n unresolvedArgPaths: string[];\n /** `Type.field` of self-scoped fields missing from `selfScopedFields`. */\n unreviewedSelfScoped: string[];\n /** Entries of `selfScopedFields` that match no self-scoped field. */\n staleSelfScoped: string[];\n /** Every problem above, one line each, plus a too-few-fields problem when applicable. */\n problems: string[];\n ok: boolean;\n}\n\n/** Thrown by {@link assertRbacCoverage}; carries the full report. */\nexport class RbacCoverageError extends Error {\n readonly report: RbacCoverageReport;\n\n constructor(report: RbacCoverageReport) {\n super(`RBAC coverage check failed (${report.problems.length} problem(s)):\\n - ${report.problems.join('\\n - ')}`);\n this.name = 'RbacCoverageError';\n this.report = report;\n }\n}\n\n/** Accepted inputs: schema file/directory paths, or already-parsed documents. */\nexport type RbacCoverageSource =\n | string\n | readonly string[]\n | DocumentNode\n | readonly DocumentNode[]\n | readonly RbacSchemaDocument[];\n\nfunction collectSchemaFiles(path: string): string[] {\n if (!statSync(path).isDirectory()) return [path];\n const out: string[] = [];\n const entries = readdirSync(path, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name, 'en'));\n for (const entry of entries) {\n const full = join(path, entry.name);\n if (entry.isDirectory()) {\n if (!SKIPPED_DIRECTORIES.has(entry.name) && !entry.name.startsWith('.')) out.push(...collectSchemaFiles(full));\n } else if (SCHEMA_EXTENSIONS.has(extname(entry.name))) {\n out.push(full);\n }\n }\n return out;\n}\n\n/**\n * Parse every `.gql`/`.graphql` file under the given paths. A path may be a single SDL file\n * (e.g. `.hive-schema.graphql`) or a directory, which is walked recursively (skipping\n * dot-directories, `node_modules`, `dist`, `build` and `coverage`).\n */\nexport function loadRbacSchemaDocuments(paths: string | readonly string[]): RbacSchemaDocument[] {\n const files = (typeof paths === 'string' ? [paths] : paths).flatMap(collectSchemaFiles);\n return files.map((file) => {\n try {\n return { file, document: parse(readFileSync(file, 'utf8')) };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to parse GraphQL schema ${file}: ${message}`, { cause: error });\n }\n });\n}\n\nfunction isDocumentNode(value: unknown): value is DocumentNode {\n return typeof value === 'object' && value !== null && (value as { kind?: unknown }).kind === Kind.DOCUMENT;\n}\n\nfunction toSchemaDocuments(source: RbacCoverageSource): RbacSchemaDocument[] {\n if (typeof source === 'string') return loadRbacSchemaDocuments(source);\n if (isDocumentNode(source)) return [{ document: source }];\n const items: readonly unknown[] = source;\n if (items.every((item): item is string => typeof item === 'string')) return loadRbacSchemaDocuments(items);\n return items.map((item) => {\n if (isDocumentNode(item)) return { document: item };\n if (typeof item === 'object' && item !== null && isDocumentNode((item as RbacSchemaDocument).document)) {\n return item as RbacSchemaDocument;\n }\n throw new TypeError('RbacCoverageSource arrays must contain only paths, DocumentNodes or RbacSchemaDocuments');\n });\n}\n\nfunction rbacDirective(field: FieldDefinitionNode): DirectiveNode | undefined {\n return (field.directives ?? []).find((d) => d.name.value === 'rbac');\n}\n\n/** Read the `@rbac` arguments of a field definition the way the gateway does (literal values only). */\nexport function readRbacDirectiveArgs(field: FieldDefinitionNode): RbacDirectiveArgs | null {\n const directive = rbacDirective(field);\n if (!directive) return null;\n const args: RbacDirectiveArgs = {};\n for (const arg of directive.arguments ?? []) {\n const name = arg.name.value;\n const value = arg.value;\n if (name === 'public') {\n if (value.kind === Kind.BOOLEAN) args.public = value.value;\n } else if (name === 'actorTypes') {\n if (value.kind === Kind.LIST) {\n args.actorTypes = value.values.flatMap((v) => (v.kind === Kind.STRING ? [v.value] : []));\n } else if (value.kind === Kind.STRING) {\n args.actorTypes = [value.value];\n }\n } else if (\n value.kind === Kind.STRING &&\n (name === 'action' ||\n name === 'resource' ||\n name === 'resourceIdArg' ||\n name === 'scopeType' ||\n name === 'scopeArg')\n ) {\n args[name] = value.value;\n }\n }\n return args;\n}\n\nfunction rootTypeNames(docs: readonly RbacSchemaDocument[], configured?: readonly string[]): Set<string> {\n if (configured) return new Set(configured);\n const names = new Set<string>(DEFAULT_RBAC_ROOT_TYPES);\n for (const { document } of docs) {\n for (const def of document.definitions) {\n if (def.kind === Kind.SCHEMA_DEFINITION || def.kind === Kind.SCHEMA_EXTENSION) {\n for (const op of def.operationTypes ?? []) names.add(op.type.name.value);\n }\n }\n }\n return names;\n}\n\nfunction inputFieldsByType(docs: readonly RbacSchemaDocument[]): Map<string, InputValueDefinitionNode[]> {\n const out = new Map<string, InputValueDefinitionNode[]>();\n for (const { document } of docs) {\n for (const def of document.definitions) {\n if (def.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION || def.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION) {\n const input: InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode = def;\n const existing = out.get(input.name.value) ?? [];\n existing.push(...(input.fields ?? []));\n out.set(input.name.value, existing);\n }\n }\n }\n return out;\n}\n\n/** The named type under any NonNull wrappers, or null when a List sits anywhere in between. */\nfunction unwrapSingular(type: TypeNode): string | null {\n if (type.kind === Kind.NON_NULL_TYPE) return unwrapSingular(type.type);\n if (type.kind === Kind.LIST_TYPE) return null;\n return type.name.value;\n}\n\ninterface PathContext {\n inputs: Map<string, InputValueDefinitionNode[]>;\n maxSegments: number;\n idScalars: ReadonlySet<string>;\n}\n\n/**\n * Mirrors the gateway's `extractFieldArguments` + `getValueAtPath`: the path is split on '.',\n * walked from the field's arguments through input objects, and used only when it lands on a\n * string. Returns why the path cannot resolve for every request shape, or null when it does.\n */\nexport function rbacArgPathProblem(\n field: FieldDefinitionNode,\n path: string,\n inputs: Map<string, readonly InputValueDefinitionNode[]>,\n options: { maxSegments?: number; idScalars?: readonly string[] } = {}\n): string | null {\n const maxSegments = options.maxSegments ?? DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS;\n const idScalars = new Set(options.idScalars ?? DEFAULT_ID_SCALARS);\n const segments = path.split('.');\n if (segments.some((s) => s.length === 0)) return `\"${path}\" has an empty segment`;\n if (segments.length > maxSegments) {\n return `\"${path}\" has ${segments.length} segments; the gateway reads at most ${maxSegments} (it drops nested object literals)`;\n }\n const [head, ...rest] = segments;\n const arg = (field.arguments ?? []).find((a) => a.name.value === head);\n if (!arg) return `no argument \"${head}\"`;\n let typeName = unwrapSingular(arg.type);\n let walked = head;\n for (const segment of rest) {\n if (typeName === null) return `\"${walked}\" is a list`;\n const fields = inputs.get(typeName);\n if (!fields) return `\"${walked}\" is ${typeName}, not an input object`;\n const next = fields.find((f) => f.name.value === segment);\n if (!next) return `${typeName} has no field \"${segment}\"`;\n typeName = unwrapSingular(next.type);\n walked = `${walked}.${segment}`;\n }\n if (typeName === null) return `\"${walked}\" is a list`;\n if (!idScalars.has(typeName)) return `\"${walked}\" is ${typeName}, not ${[...idScalars].join('/')}`;\n return null;\n}\n\n/** Why the gateway would deny this directive as invalid, or null when it is well-formed. */\nfunction malformedReason(rbac: RbacDirectiveArgs): string | null {\n if (rbac.public === true) return null;\n if (rbac.scopeType === 'self') return null;\n const hasActionResource = Boolean(rbac.action) && Boolean(rbac.resource);\n // An actorTypes-only gate is allowed by the gateway without an RBAC round-trip.\n if (!hasActionResource && rbac.actorTypes && rbac.actorTypes.length > 0) {\n if (rbac.action || rbac.resource) return 'actorTypes gate sets only one of action/resource';\n return null;\n }\n if (!hasActionResource) return 'missing action or resource (and not public, self or actorTypes-only)';\n if (!rbac.scopeType) return 'missing scopeType';\n if (!(RBAC_GATED_SCOPE_TYPES as readonly string[]).includes(rbac.scopeType)) {\n return `unknown scopeType \"${rbac.scopeType}\"`;\n }\n if (rbac.scopeType === 'entity' && !rbac.scopeArg) return 'entity scope requires scopeArg';\n return null;\n}\n\nfunction pinEntries(pin: RbacFieldPin): string[] {\n return Array.isArray(pin) ? [...(pin as readonly string[])] : Object.keys(pin);\n}\n\nfunction matchesEntry(field: RbacRootField, entry: string): boolean {\n return entry === field.name || entry === field.coordinate;\n}\n\n/** Deterministic, locale-independent ordering for report lines. */\nfunction sortLines(lines: string[]): string[] {\n return lines.sort((a, b) => a.localeCompare(b, 'en'));\n}\n\ninterface CollectedRootField {\n root: RbacRootField;\n definition: FieldDefinitionNode;\n}\n\nfunction collectRootFields(\n docs: readonly RbacSchemaDocument[],\n roots: ReadonlySet<string>,\n exempt: ReadonlySet<string>\n): CollectedRootField[] {\n const out: CollectedRootField[] = [];\n for (const { document, file } of docs) {\n for (const def of document.definitions) {\n if (def.kind !== Kind.OBJECT_TYPE_DEFINITION && def.kind !== Kind.OBJECT_TYPE_EXTENSION) continue;\n const type = def.name.value;\n if (!roots.has(type)) continue;\n for (const definition of def.fields ?? []) {\n const name = definition.name.value;\n const coordinate = `${type}.${name}`;\n if (PLACEHOLDER_FIELD.test(name) || exempt.has(name) || exempt.has(coordinate)) continue;\n const root: RbacRootField = { type, name, coordinate, rbac: readRbacDirectiveArgs(definition) };\n if (file) root.file = file;\n out.push({ root, definition });\n }\n }\n }\n return out;\n}\n\n/** The argument path a gated scope reads its scope id from; only `entity` and `billing` read one. */\nfunction scopeArgPath(rbac: RbacDirectiveArgs): string | undefined {\n if (rbac.public === true) return undefined;\n if (rbac.scopeType === 'entity') return rbac.scopeArg;\n if (rbac.scopeType === 'billing') return rbac.scopeArg ?? DEFAULT_BILLING_SCOPE_ARG;\n return undefined;\n}\n\nfunction argPathProblems(\n definition: FieldDefinitionNode,\n rbac: RbacDirectiveArgs,\n context: PathContext\n): { label: string; problem: string }[] {\n const options = { maxSegments: context.maxSegments, idScalars: [...context.idScalars] };\n const checks: { label: string; path: string | undefined }[] = [\n { label: 'resourceIdArg', path: rbac.resourceIdArg },\n { label: 'scopeArg', path: scopeArgPath(rbac) },\n ];\n return checks.flatMap(({ label, path }) => {\n if (path === undefined) return [];\n const problem = rbacArgPathProblem(definition, path, context.inputs, options);\n return problem ? [{ label, problem }] : [];\n });\n}\n\nfunction selfScopedPinProblems(\n rootFields: readonly RbacRootField[],\n pin: RbacFieldPin | undefined\n): { unreviewed: string[]; stale: string[] } {\n if (!pin) return { unreviewed: [], stale: [] };\n const entries = pinEntries(pin);\n const selfScoped = rootFields.filter((f) => f.rbac?.scopeType === 'self' && f.rbac.public !== true);\n return {\n unreviewed: selfScoped\n .filter((field) => !entries.some((entry) => matchesEntry(field, entry)))\n .map((field) => field.coordinate),\n stale: entries.filter((entry) => !selfScoped.some((field) => matchesEntry(field, entry))),\n };\n}\n\n/** Analyse the schema and return every coverage problem without throwing. */\nexport function analyzeRbacCoverage(source: RbacCoverageSource, options: RbacCoverageOptions = {}): RbacCoverageReport {\n const docs = toSchemaDocuments(source);\n const collected = collectRootFields(docs, rootTypeNames(docs, options.rootTypes), new Set(options.exemptFields));\n const pathContext: PathContext = {\n inputs: inputFieldsByType(docs),\n maxSegments: options.maxArgPathSegments ?? DEFAULT_MAX_RBAC_ARG_PATH_SEGMENTS,\n idScalars: new Set(options.idScalars ?? DEFAULT_ID_SCALARS),\n };\n\n const missing: string[] = [];\n const malformed: string[] = [];\n const unresolvedArgPaths: string[] = [];\n for (const { root, definition } of collected) {\n const { rbac, coordinate } = root;\n if (!rbac) {\n missing.push(coordinate);\n continue;\n }\n const reason = malformedReason(rbac);\n if (reason) malformed.push(`${coordinate}: ${reason}`);\n for (const { label, problem } of argPathProblems(definition, rbac, pathContext)) {\n unresolvedArgPaths.push(`${coordinate}: ${label} ${problem}`);\n }\n }\n\n const rootFields = collected.map(({ root }) => root);\n const pins = selfScopedPinProblems(rootFields, options.selfScopedFields);\n const unreviewedSelfScoped = sortLines(pins.unreviewed);\n const staleSelfScoped = sortLines(pins.stale);\n sortLines(missing);\n sortLines(malformed);\n sortLines(unresolvedArgPaths);\n\n const minRootFields = options.minRootFields ?? 1;\n const problems = [\n ...(rootFields.length < minRootFields\n ? [`found ${rootFields.length} root field(s), expected at least ${minRootFields} (wrong schema path?)`]\n : []),\n ...missing.map((c) => `${c}: missing @rbac directive`),\n ...malformed.map((m) => `malformed @rbac on ${m}`),\n ...unresolvedArgPaths.map((p) => `unresolvable @rbac path on ${p}`),\n ...unreviewedSelfScoped.map((c) => `${c}: scopeType \"self\" is not in the reviewed selfScopedFields list`),\n ...staleSelfScoped.map((e) => `selfScopedFields entry \"${e}\" matches no self-scoped root field (stale)`),\n ];\n\n return {\n rootFields,\n missing,\n malformed,\n unresolvedArgPaths,\n unreviewedSelfScoped,\n staleSelfScoped,\n problems,\n ok: problems.length === 0,\n };\n}\n\n/**\n * Assert full `@rbac` coverage. Throws {@link RbacCoverageError} listing every problem;\n * returns the report on success so callers can make further assertions on `rootFields`.\n */\nexport function assertRbacCoverage(source: RbacCoverageSource, options: RbacCoverageOptions = {}): RbacCoverageReport {\n const report = analyzeRbacCoverage(source, options);\n if (!report.ok) throw new RbacCoverageError(report);\n return report;\n}\n"]}
|