@burdenoff/be-sdk 2026.624.1 → 2026.703.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +2 -2
- package/dist/{chunk-E5USZ2MR.js → chunk-NRSIT4VI.js} +36 -21
- package/dist/chunk-NRSIT4VI.js.map +1 -0
- package/dist/{chunk-GCBR3TFZ.js → chunk-OWBJD3AS.js} +53 -6
- package/dist/chunk-OWBJD3AS.js.map +1 -0
- package/dist/{chunk-DZK5UGDA.js → chunk-Z2423JIB.js} +3 -3
- package/dist/{chunk-DZK5UGDA.js.map → chunk-Z2423JIB.js.map} +1 -1
- package/dist/{client-CSjIrYKS.d.ts → client-CSEnihJT.d.ts} +4 -0
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +3 -3
- package/dist/{index-BN_-AWdb.d.ts → index-ClXI02GS.d.ts} +1 -1
- package/dist/{index-Dtf6FBaD.d.ts → index-aNMCLxlz.d.ts} +12 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -16
- package/dist/pino-logger-TSRWXWIU.js +5 -0
- package/dist/{pino-logger-NVZXQPWO.js.map → pino-logger-TSRWXWIU.js.map} +1 -1
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +1 -1
- package/dist/{sdk-UWFH5PY7.js → sdk-YS2M6RF5.js} +19 -2
- package/dist/sdk-YS2M6RF5.js.map +1 -0
- package/dist/server/index.d.ts +3 -3
- package/dist/telemetry/index.js +8 -3
- package/dist/telemetry/index.js.map +1 -1
- package/dist/{types-sKXodL2N.d.ts → types-Bj1K2RtU.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-E5USZ2MR.js.map +0 -1
- package/dist/chunk-GCBR3TFZ.js.map +0 -1
- package/dist/pino-logger-NVZXQPWO.js +0 -5
- package/dist/sdk-UWFH5PY7.js.map +0 -1
|
@@ -6,6 +6,10 @@ interface PrismaClientConfig {
|
|
|
6
6
|
maxConnections?: number;
|
|
7
7
|
idleTimeoutMillis?: number;
|
|
8
8
|
connectionTimeoutMillis?: number;
|
|
9
|
+
applicationName?: string;
|
|
10
|
+
statementTimeoutMillis?: number;
|
|
11
|
+
idleInTransactionTimeoutMillis?: number;
|
|
12
|
+
lockTimeoutMillis?: number;
|
|
9
13
|
enableQueryLogging?: boolean;
|
|
10
14
|
slowQueryThreshold?: number;
|
|
11
15
|
logLevels?: Array<'query' | 'info' | 'warn' | 'error'>;
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../graphql-BRj5KPOL.js';
|
|
2
2
|
import '../index-DDCOGyYh.js';
|
|
3
|
-
export { A as AUDIT_FIELDS, C as CreateEdgeOptions, a as CreateNodeOptions, D as DefineEntityConfigOptions, b as DefineGraphConfigOptions, c as DefineRelationshipConfigOptions, E as EdgeDocument, d as EntityDefinition, e as EntityEventContext, f as EntityEventData, g as EntityEventHook, h as EntityFetcher, j as EntityGraphConfig, k as EntityRbacConfig, l as EntityVertex, m as ExtractedEntityData, n as ExtractedRelationshipData, F as FieldMapper, o as GenericEntityConfig, p as GenericEntityRbacConfig, q as GenericGraphConfig, r as GenericRelationshipConfig, s as GraphEdge, t as GraphEntityConfig, u as GraphEntityExport, v as GraphEvent, w as GraphEventOptions, x as GraphEventPublishOptions, y as GraphEventType, z as GraphEventsHelper, B as GraphEventsHelperConfig, H as GraphEventsPublisher, I as GraphExportResponse, J as GraphExportService, K as GraphExportServiceConfig, G as GraphModule, L as GraphNode, M as GraphRegistry, N as GraphRelationshipData, O as GraphRelationshipExport, P as GraphSchema, Q as GraphValidationError, R as GraphValidationResult, S as InitializeGraphOptions, T as ModuleGraph, U as ModuleGraphConfig, V as ModuleGraphDefinition, W as PrismaGraphIntegration, X as PrismaGraphIntegrationOptions, Y as ProductFacet, Z as QueryGraphOptions, _ as RelationshipDefinition, $ as RelationshipEventData, a0 as RelationshipExportData, a1 as RelationshipFetcher, a2 as RelationshipGraphConfig, a3 as SOFT_DELETE_FIELDS, a4 as STANDARD_FIELDS, a5 as SearchFacets, a6 as SearchFilters, a7 as SearchResponse, a8 as SearchResult, a9 as TENANT_FIELDS, aa as TraverseDirection, ab as TraverseOptions, ac as TraverseResult, ad as TypeFacet, ae as ValidationErrorType, af as createEntityEvent, ag as createGraphEventsHelper, ah as createGraphExportService, ai as createPrismaGraphIntegration, aj as createRelationshipEvent, ak as createRelationshipFromEntity, al as defineEntity, am as defineGraphConfig, an as defineModuleGraph, ao as defineRelationship, ap as extractEntityTitle, aq as extractMinimalFields, ar as getCollectionForEntity, as as getGraphEventsPublisher, at as getGraphStats, au as initializeGraph, av as isGraphInitialized, aw as parseRelationship, ax as shouldSyncEntity, ay as shouldSyncRelationship } from '../index-
|
|
3
|
+
export { A as AUDIT_FIELDS, C as CreateEdgeOptions, a as CreateNodeOptions, D as DefineEntityConfigOptions, b as DefineGraphConfigOptions, c as DefineRelationshipConfigOptions, E as EdgeDocument, d as EntityDefinition, e as EntityEventContext, f as EntityEventData, g as EntityEventHook, h as EntityFetcher, j as EntityGraphConfig, k as EntityRbacConfig, l as EntityVertex, m as ExtractedEntityData, n as ExtractedRelationshipData, F as FieldMapper, o as GenericEntityConfig, p as GenericEntityRbacConfig, q as GenericGraphConfig, r as GenericRelationshipConfig, s as GraphEdge, t as GraphEntityConfig, u as GraphEntityExport, v as GraphEvent, w as GraphEventOptions, x as GraphEventPublishOptions, y as GraphEventType, z as GraphEventsHelper, B as GraphEventsHelperConfig, H as GraphEventsPublisher, I as GraphExportResponse, J as GraphExportService, K as GraphExportServiceConfig, G as GraphModule, L as GraphNode, M as GraphRegistry, N as GraphRelationshipData, O as GraphRelationshipExport, P as GraphSchema, Q as GraphValidationError, R as GraphValidationResult, S as InitializeGraphOptions, T as ModuleGraph, U as ModuleGraphConfig, V as ModuleGraphDefinition, W as PrismaGraphIntegration, X as PrismaGraphIntegrationOptions, Y as ProductFacet, Z as QueryGraphOptions, _ as RelationshipDefinition, $ as RelationshipEventData, a0 as RelationshipExportData, a1 as RelationshipFetcher, a2 as RelationshipGraphConfig, a3 as SOFT_DELETE_FIELDS, a4 as STANDARD_FIELDS, a5 as SearchFacets, a6 as SearchFilters, a7 as SearchResponse, a8 as SearchResult, a9 as TENANT_FIELDS, aa as TraverseDirection, ab as TraverseOptions, ac as TraverseResult, ad as TypeFacet, ae as ValidationErrorType, af as createEntityEvent, ag as createGraphEventsHelper, ah as createGraphExportService, ai as createPrismaGraphIntegration, aj as createRelationshipEvent, ak as createRelationshipFromEntity, al as defineEntity, am as defineGraphConfig, an as defineModuleGraph, ao as defineRelationship, ap as extractEntityTitle, aq as extractMinimalFields, ar as getCollectionForEntity, as as getGraphEventsPublisher, at as getGraphStats, au as initializeGraph, av as isGraphInitialized, aw as parseRelationship, ax as shouldSyncEntity, ay as shouldSyncRelationship } from '../index-ClXI02GS.js';
|
|
4
4
|
export { E as EntityEventType, G as GraphEventEmitter, a as GraphMiddlewareConfig, b as addGraphExtension } from '../prisma-extension-krXnYnrN.js';
|
|
5
5
|
import 'graphql-request';
|
|
6
6
|
import '../layer-GNAVXBMf.js';
|
|
7
|
-
import '../client-
|
|
7
|
+
import '../client-CSEnihJT.js';
|
|
8
8
|
import '@prisma/adapter-pg';
|
|
9
9
|
import 'pg';
|
|
10
10
|
import '../graph-emitter-r5TylDBm.js';
|
package/dist/graph/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { AUDIT_FIELDS, GraphEventsPublisher, GraphExportService, GraphModule, SOFT_DELETE_FIELDS, STANDARD_FIELDS, TENANT_FIELDS, createGraphEventsHelper, createGraphExportService, createPrismaGraphIntegration, createRelationshipFromEntity, defineEntity, defineGraphConfig, defineModuleGraph, defineRelationship, getGraphEventsPublisher, getGraphStats, initializeGraph, isGraphInitialized } from '../chunk-
|
|
1
|
+
export { AUDIT_FIELDS, GraphEventsPublisher, GraphExportService, GraphModule, SOFT_DELETE_FIELDS, STANDARD_FIELDS, TENANT_FIELDS, createGraphEventsHelper, createGraphExportService, createPrismaGraphIntegration, createRelationshipFromEntity, defineEntity, defineGraphConfig, defineModuleGraph, defineRelationship, getGraphEventsPublisher, getGraphStats, initializeGraph, isGraphInitialized } from '../chunk-Z2423JIB.js';
|
|
2
2
|
export { GraphRegistry, addGraphExtension, createEntityEvent, createRelationshipEvent, extractEntityTitle, extractMinimalFields, getCollectionForEntity, parseRelationship, shouldSyncEntity, shouldSyncRelationship } from '../chunk-5CESUKWC.js';
|
|
3
|
-
import '../chunk-EZ4PKRUK.js';
|
|
4
|
-
import '../chunk-YFOHAHZE.js';
|
|
5
3
|
import '../chunk-H3AXO5SY.js';
|
|
6
4
|
import '../chunk-OHEPNJ2X.js';
|
|
7
5
|
import '../chunk-MQCVQCFA.js';
|
|
8
6
|
import '../chunk-MHNA7IS7.js';
|
|
7
|
+
import '../chunk-EZ4PKRUK.js';
|
|
8
|
+
import '../chunk-YFOHAHZE.js';
|
|
9
9
|
import '../chunk-CBZNP6RF.js';
|
|
10
10
|
import '../chunk-XE4OXN2W.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as BurdenoffGraphQLClient } from './graphql-BRj5KPOL.js';
|
|
2
2
|
import { S as SDKContext } from './index-DDCOGyYh.js';
|
|
3
|
-
import { P as PrismaClientBase } from './client-
|
|
3
|
+
import { P as PrismaClientBase } from './client-CSEnihJT.js';
|
|
4
4
|
import { G as GraphEventEmitterImpl, E as EntityEventRbacMetadata } from './graph-emitter-r5TylDBm.js';
|
|
5
5
|
import { G as GraphEventEmitter, E as EntityEventType, a as GraphMiddlewareConfig, b as addGraphExtension } from './prisma-extension-krXnYnrN.js';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PrismaClientBase, b as PrismaClientWrapper, c as PrismaClientConfig, a as PrismaClientConstructorOptions, D as DatabaseReturnType, d as DatabaseHealth, C as ConnectionState, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient } from './client-
|
|
1
|
+
import { P as PrismaClientBase, b as PrismaClientWrapper, c as PrismaClientConfig, a as PrismaClientConstructorOptions, D as DatabaseReturnType, d as DatabaseHealth, C as ConnectionState, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient } from './client-CSEnihJT.js';
|
|
2
2
|
import { G as GraphEventEmitter } from './prisma-extension-krXnYnrN.js';
|
|
3
3
|
|
|
4
4
|
interface WorkspaceContext {
|
|
@@ -50,6 +50,13 @@ interface DatabaseClient<T extends PrismaClientBase> {
|
|
|
50
50
|
disconnect: () => Promise<void>;
|
|
51
51
|
}
|
|
52
52
|
declare function createDatabaseClient<T extends PrismaClientBase>(PrismaClientConstructor: new (options: PrismaClientConstructorOptions) => T, config: DatabaseClientConfig): DatabaseClient<T>;
|
|
53
|
+
interface PoolTuningEnv {
|
|
54
|
+
applicationName: string;
|
|
55
|
+
statementTimeoutMillis?: number;
|
|
56
|
+
idleInTransactionTimeoutMillis?: number;
|
|
57
|
+
lockTimeoutMillis?: number;
|
|
58
|
+
}
|
|
59
|
+
declare function resolvePoolTuningFromEnv(productName: string): PoolTuningEnv;
|
|
53
60
|
declare function createDatabaseClientFromEnv<T extends PrismaClientBase>(PrismaClientConstructor: new (options: PrismaClientConstructorOptions) => T, productName: string, overrides?: Partial<DatabaseClientConfig>): DatabaseClient<T>;
|
|
54
61
|
|
|
55
62
|
declare function initializeDatabase<T extends PrismaClientBase>(PrismaClientConstructor: new (options: PrismaClientConstructorOptions) => T, productName: string, config?: Partial<DatabaseClientConfig>): DatabaseClient<T>;
|
|
@@ -144,6 +151,7 @@ type index_InputJsonValue = InputJsonValue;
|
|
|
144
151
|
type index_JsonValue = JsonValue;
|
|
145
152
|
type index_ModelFieldsMap = ModelFieldsMap;
|
|
146
153
|
type index_OperationContext = OperationContext;
|
|
154
|
+
type index_PoolTuningEnv = PoolTuningEnv;
|
|
147
155
|
declare const index_PrismaClientBase: typeof PrismaClientBase;
|
|
148
156
|
declare const index_PrismaClientConfig: typeof PrismaClientConfig;
|
|
149
157
|
declare const index_PrismaClientConstructorOptions: typeof PrismaClientConstructorOptions;
|
|
@@ -187,13 +195,14 @@ declare const index_loadGeneratedFields: typeof loadGeneratedFields;
|
|
|
187
195
|
declare const index_mergeContext: typeof mergeContext;
|
|
188
196
|
declare const index_parseContext: typeof parseContext;
|
|
189
197
|
declare const index_resetDatabaseManager: typeof resetDatabaseManager;
|
|
198
|
+
declare const index_resolvePoolTuningFromEnv: typeof resolvePoolTuningFromEnv;
|
|
190
199
|
declare const index_setWorkspaceContext: typeof setWorkspaceContext;
|
|
191
200
|
declare const index_testConnection: typeof testConnection;
|
|
192
201
|
declare const index_toContextJson: typeof toContextJson;
|
|
193
202
|
declare const index_withWorkspaceContext: typeof withWorkspaceContext;
|
|
194
203
|
declare const index_withWorkspaceContextSync: typeof withWorkspaceContextSync;
|
|
195
204
|
declare namespace index {
|
|
196
|
-
export { index_ConnectionState as ConnectionState, type index_ContextFilterInput as ContextFilterInput, type index_DatabaseClient as DatabaseClient, type index_DatabaseClientConfig as DatabaseClientConfig, index_DatabaseHealth as DatabaseHealth, index_DatabaseReturnType as DatabaseReturnType, type index_FieldExtractionOptions as FieldExtractionOptions, type index_FieldExtractionResult as FieldExtractionResult, type index_InputJsonValue as InputJsonValue, type index_JsonValue as JsonValue, type index_ModelFieldsMap as ModelFieldsMap, type index_OperationContext as OperationContext, index_PrismaClientBase as PrismaClientBase, index_PrismaClientConfig as PrismaClientConfig, index_PrismaClientConstructorOptions as PrismaClientConstructorOptions, index_PrismaClientWrapper as PrismaClientWrapper, index_PrismaEvent as PrismaEvent, type index_PrismaJsonFilter as PrismaJsonFilter, index_PrismaLogDefinition as PrismaLogDefinition, index_PrismaLogEvent as PrismaLogEvent, index_PrismaLogLevel as PrismaLogLevel, index_PrismaQueryEvent as PrismaQueryEvent, index_PrismaTransactionOptions as PrismaTransactionOptions, type index_WorkspaceContext as WorkspaceContext, type index_WorkspaceExtensionConfig as WorkspaceExtensionConfig, index_addWorkspaceExtension as addWorkspaceExtension, index_buildContextWhereClause as buildContextWhereClause, index_buildContextWhereConditions as buildContextWhereConditions, index_checkDatabaseHealth as checkDatabaseHealth, index_configurePrismaLogging as configurePrismaLogging, index_contextMatches as contextMatches, index_createConnectionPool as createConnectionPool, index_createContextFromSDK as createContextFromSDK, index_createDatabaseClient as createDatabaseClient, index_createDatabaseClientFromEnv as createDatabaseClientFromEnv, index_createPrismaAdapter as createPrismaAdapter, index_createPrismaClient as createPrismaClient, index_extractFieldsFromModel as extractFieldsFromModel, index_getAllModelNames as getAllModelNames, index_getDatabaseManager as getDatabaseManager, index_getDatabaseProductName as getDatabaseProductName, index_getDatabaseStats as getDatabaseStats, index_getDatabaseVersion as getDatabaseVersion, index_getDb as getDb, index_getModelFields as getModelFields, index_getWorkspaceContext as getWorkspaceContext, index_hasModel as hasModel, index_initializeDatabase as initializeDatabase, index_initializeDatabaseWithConfig as initializeDatabaseWithConfig, index_injectWhereWorkspaceId as injectWhereWorkspaceId, index_isDatabaseInitialized as isDatabaseInitialized, index_loadGeneratedFields as loadGeneratedFields, index_mergeContext as mergeContext, index_parseContext as parseContext, index_resetDatabaseManager as resetDatabaseManager, index_setWorkspaceContext as setWorkspaceContext, index_testConnection as testConnection, index_toContextJson as toContextJson, index_withWorkspaceContext as withWorkspaceContext, index_withWorkspaceContextSync as withWorkspaceContextSync };
|
|
205
|
+
export { index_ConnectionState as ConnectionState, type index_ContextFilterInput as ContextFilterInput, type index_DatabaseClient as DatabaseClient, type index_DatabaseClientConfig as DatabaseClientConfig, index_DatabaseHealth as DatabaseHealth, index_DatabaseReturnType as DatabaseReturnType, type index_FieldExtractionOptions as FieldExtractionOptions, type index_FieldExtractionResult as FieldExtractionResult, type index_InputJsonValue as InputJsonValue, type index_JsonValue as JsonValue, type index_ModelFieldsMap as ModelFieldsMap, type index_OperationContext as OperationContext, type index_PoolTuningEnv as PoolTuningEnv, index_PrismaClientBase as PrismaClientBase, index_PrismaClientConfig as PrismaClientConfig, index_PrismaClientConstructorOptions as PrismaClientConstructorOptions, index_PrismaClientWrapper as PrismaClientWrapper, index_PrismaEvent as PrismaEvent, type index_PrismaJsonFilter as PrismaJsonFilter, index_PrismaLogDefinition as PrismaLogDefinition, index_PrismaLogEvent as PrismaLogEvent, index_PrismaLogLevel as PrismaLogLevel, index_PrismaQueryEvent as PrismaQueryEvent, index_PrismaTransactionOptions as PrismaTransactionOptions, type index_WorkspaceContext as WorkspaceContext, type index_WorkspaceExtensionConfig as WorkspaceExtensionConfig, index_addWorkspaceExtension as addWorkspaceExtension, index_buildContextWhereClause as buildContextWhereClause, index_buildContextWhereConditions as buildContextWhereConditions, index_checkDatabaseHealth as checkDatabaseHealth, index_configurePrismaLogging as configurePrismaLogging, index_contextMatches as contextMatches, index_createConnectionPool as createConnectionPool, index_createContextFromSDK as createContextFromSDK, index_createDatabaseClient as createDatabaseClient, index_createDatabaseClientFromEnv as createDatabaseClientFromEnv, index_createPrismaAdapter as createPrismaAdapter, index_createPrismaClient as createPrismaClient, index_extractFieldsFromModel as extractFieldsFromModel, index_getAllModelNames as getAllModelNames, index_getDatabaseManager as getDatabaseManager, index_getDatabaseProductName as getDatabaseProductName, index_getDatabaseStats as getDatabaseStats, index_getDatabaseVersion as getDatabaseVersion, index_getDb as getDb, index_getModelFields as getModelFields, index_getWorkspaceContext as getWorkspaceContext, index_hasModel as hasModel, index_initializeDatabase as initializeDatabase, index_initializeDatabaseWithConfig as initializeDatabaseWithConfig, index_injectWhereWorkspaceId as injectWhereWorkspaceId, index_isDatabaseInitialized as isDatabaseInitialized, index_loadGeneratedFields as loadGeneratedFields, index_mergeContext as mergeContext, index_parseContext as parseContext, index_resetDatabaseManager as resetDatabaseManager, index_resolvePoolTuningFromEnv as resolvePoolTuningFromEnv, index_setWorkspaceContext as setWorkspaceContext, index_testConnection as testConnection, index_toContextJson as toContextJson, index_withWorkspaceContext as withWorkspaceContext, index_withWorkspaceContextSync as withWorkspaceContextSync };
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
export {
|
|
208
|
+
export { isDatabaseInitialized as A, loadGeneratedFields as B, type ContextFilterInput as C, type DatabaseClient as D, mergeContext as E, type FieldExtractionOptions as F, parseContext as G, resetDatabaseManager as H, type InputJsonValue as I, type JsonValue as J, resolvePoolTuningFromEnv as K, setWorkspaceContext as L, type ModelFieldsMap as M, testConnection as N, type OperationContext as O, type PoolTuningEnv as P, toContextJson as Q, withWorkspaceContext as R, withWorkspaceContextSync as S, type WorkspaceContext as W, type DatabaseClientConfig as a, type FieldExtractionResult as b, type PrismaJsonFilter as c, type WorkspaceExtensionConfig as d, addWorkspaceExtension as e, buildContextWhereClause as f, buildContextWhereConditions as g, checkDatabaseHealth as h, index as i, contextMatches as j, createContextFromSDK as k, createDatabaseClient as l, createDatabaseClientFromEnv as m, extractFieldsFromModel as n, getAllModelNames as o, getDatabaseManager as p, getDatabaseProductName as q, getDatabaseStats as r, getDatabaseVersion as s, getDb as t, getModelFields as u, getWorkspaceContext as v, hasModel as w, initializeDatabase as x, initializeDatabaseWithConfig as y, injectWhereWorkspaceId as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import { A as ActivityModule, U as UsageModule, T as TrackerModule } from './ind
|
|
|
11
11
|
import { DatabaseConfig, DatabaseModule } from './database/index.js';
|
|
12
12
|
import { E as EventsModule, I as IEventPublisher } from './index-B3ECnOLp.js';
|
|
13
13
|
export { i as EventQueue } from './index-B3ECnOLp.js';
|
|
14
|
-
import { G as GraphModule } from './index-
|
|
15
|
-
export { i as Graph } from './index-
|
|
14
|
+
import { G as GraphModule } from './index-ClXI02GS.js';
|
|
15
|
+
export { i as Graph } from './index-ClXI02GS.js';
|
|
16
16
|
import { B as BurdenoffGraphQLClient } from './graphql-BRj5KPOL.js';
|
|
17
17
|
import { TemporalModule } from './temporal/index.js';
|
|
18
18
|
export { TemporalClient, TemporalClientConfig, TemporalClientFactory, TemporalWorker, TemporalWorkerConfig, TemporalWorkerFactory, TemporalWorkerManager, WorkflowStartOptions } from './temporal/index.js';
|
|
@@ -23,7 +23,7 @@ export { i as Cache } from './index-DkObbJD_.js';
|
|
|
23
23
|
export { i as Middleware } from './index-DSOpj8DI.js';
|
|
24
24
|
export { i as Observability } from './index-4gKQKZ2B.js';
|
|
25
25
|
export { i as GraphQL } from './index-joONjwLt.js';
|
|
26
|
-
export { i as Prisma } from './index-
|
|
26
|
+
export { i as Prisma } from './index-aNMCLxlz.js';
|
|
27
27
|
export { i as Utils } from './index-PaojfSdd.js';
|
|
28
28
|
export { i as I18n, I as I18nCapableContext, T as Translator, c as createTranslator, g as getLanguage, a as getLocale, h as hasI18n, t } from './index-D4l1u8VR.js';
|
|
29
29
|
export { i as Export } from './index-B4ciT3OZ.js';
|
|
@@ -37,10 +37,10 @@ export { i as FeatureFlags } from './index-BdPnlJ8_.js';
|
|
|
37
37
|
export { i as Captcha, R as RecaptchaVerifyOptions, a as RecaptchaVerifyResult, b as isCaptchaEnabled, v as verifyCaptcha, c as verifyCaptchaIfEnabled } from './index-B70b5mYS.js';
|
|
38
38
|
export { i as Platform } from './index-DgWLSDv2.js';
|
|
39
39
|
export { C as CircuitBreakerConfig, h as DEFAULT_CIRCUIT_BREAKER_CONFIG, i as DEFAULT_GATEWAY_RETRY_CONFIG, D as DEFAULT_GATEWAY_ROUTING, b as DEFAULT_LAYER_RESOURCES, c as DEFAULT_LAYER_STREAMS, f as GatewayRequestHeaders, g as GatewayRetryConfig, G as GatewayRoutingConfig, L as LayerConfig, a as LayerFullConfig, d as LayerGatewayConfig, e as LayerResourceUrls, S as ServiceLayer } from './layer-GNAVXBMf.js';
|
|
40
|
-
import './types-
|
|
40
|
+
import './types-Bj1K2RtU.js';
|
|
41
41
|
import 'graphql';
|
|
42
42
|
import 'graphql-yoga';
|
|
43
|
-
import './client-
|
|
43
|
+
import './client-CSEnihJT.js';
|
|
44
44
|
import '@prisma/adapter-pg';
|
|
45
45
|
import 'pg';
|
|
46
46
|
import './types-C8TbSdEj.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { prisma_exports as Prisma } from './chunk-
|
|
1
|
+
export { prisma_exports as Prisma } from './chunk-OWBJD3AS.js';
|
|
2
2
|
export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, getResourceCaps } from './chunk-VDDOGIWY.js';
|
|
3
3
|
import './chunk-GTEMQXCA.js';
|
|
4
4
|
export { sharing_exports as Sharing } from './chunk-XD5ZK727.js';
|
|
@@ -14,15 +14,18 @@ import { TenantNotificationsModule, NotificationsModule } from './chunk-IUL5TEKE
|
|
|
14
14
|
export { tenant_notifications_exports as Notifications, NotificationsModule } from './chunk-IUL5TEKE.js';
|
|
15
15
|
export { observability_exports as Observability } from './chunk-5LXDPGDH.js';
|
|
16
16
|
export { platform_exports as Platform } from './chunk-UCLDHOZC.js';
|
|
17
|
-
import { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
18
|
-
export { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
19
17
|
export { export_exports as Export } from './chunk-UJI2S556.js';
|
|
20
18
|
export { feature_flags_exports as FeatureFlags } from './chunk-YEA4BZOL.js';
|
|
19
|
+
import { GraphModule } from './chunk-Z2423JIB.js';
|
|
20
|
+
export { graph_exports as Graph, GraphModule } from './chunk-Z2423JIB.js';
|
|
21
|
+
import './chunk-5CESUKWC.js';
|
|
22
|
+
import { EventsModule } from './chunk-H3AXO5SY.js';
|
|
23
|
+
export { event_queue_exports as EventQueue, EventsModule } from './chunk-H3AXO5SY.js';
|
|
24
|
+
import './chunk-OHEPNJ2X.js';
|
|
25
|
+
import { QueueType, EventQueueFactory } from './chunk-MQCVQCFA.js';
|
|
21
26
|
export { graphql_exports as GraphQL } from './chunk-X4NELQLV.js';
|
|
22
27
|
import './chunk-QLVKMWFA.js';
|
|
23
|
-
import
|
|
24
|
-
export { graph_exports as Graph, GraphModule } from './chunk-DZK5UGDA.js';
|
|
25
|
-
import './chunk-5CESUKWC.js';
|
|
28
|
+
import './chunk-MHNA7IS7.js';
|
|
26
29
|
export { i18n_exports as I18n, createTranslator, getLanguage, getLocale, hasI18n, t } from './chunk-ULFFX3YE.js';
|
|
27
30
|
export { init_exports as Init } from './chunk-F5BPKP75.js';
|
|
28
31
|
import { GatewayClient, GatewayError, GatewayErrorType } from './chunk-OWUVYM2S.js';
|
|
@@ -32,23 +35,20 @@ export { layer_exports as Layer } from './chunk-UIMPJNWC.js';
|
|
|
32
35
|
import './chunk-VFCMR5GX.js';
|
|
33
36
|
import { ContextManager } from './chunk-DXX6C6X6.js';
|
|
34
37
|
export { ContextManager } from './chunk-DXX6C6X6.js';
|
|
35
|
-
export { cache_exports as Cache } from './chunk-UYE4IEPT.js';
|
|
36
|
-
export { captcha_exports as Captcha, isCaptchaEnabled, verifyCaptcha, verifyCaptchaIfEnabled } from './chunk-YMZEUTD2.js';
|
|
37
|
-
export { createInternalClient, createInternalClientForTenant, createInternalClientForWorkspaces } from './chunk-VI4VSNTI.js';
|
|
38
38
|
import { AuthModule } from './chunk-SS4XWRYR.js';
|
|
39
39
|
export { AuthModule } from './chunk-SS4XWRYR.js';
|
|
40
40
|
export { utils_exports as Utils } from './chunk-B7I4TABG.js';
|
|
41
|
+
export { cache_exports as Cache } from './chunk-UYE4IEPT.js';
|
|
42
|
+
export { captcha_exports as Captcha, isCaptchaEnabled, verifyCaptcha, verifyCaptchaIfEnabled } from './chunk-YMZEUTD2.js';
|
|
43
|
+
export { createInternalClient, createInternalClientForTenant, createInternalClientForWorkspaces } from './chunk-VI4VSNTI.js';
|
|
44
|
+
export { crypto_exports as Crypto } from './chunk-SBS4S2PJ.js';
|
|
45
|
+
import { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
46
|
+
export { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
41
47
|
import { APIError, NetworkError, TimeoutError, ValidationError } from './chunk-EZ4PKRUK.js';
|
|
42
48
|
export { DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_GATEWAY_RETRY_CONFIG, DEFAULT_GATEWAY_ROUTING, DEFAULT_LAYER_RESOURCES, DEFAULT_LAYER_STREAMS } from './chunk-YFOHAHZE.js';
|
|
43
|
-
export { dataloader_exports as DataLoader } from './chunk-NUB5GQTU.js';
|
|
44
|
-
import { EventsModule } from './chunk-H3AXO5SY.js';
|
|
45
|
-
export { event_queue_exports as EventQueue, EventsModule } from './chunk-H3AXO5SY.js';
|
|
46
|
-
import './chunk-OHEPNJ2X.js';
|
|
47
|
-
import { QueueType, EventQueueFactory } from './chunk-MQCVQCFA.js';
|
|
48
|
-
import './chunk-MHNA7IS7.js';
|
|
49
49
|
import { logger } from './chunk-CBZNP6RF.js';
|
|
50
50
|
export { logger_exports as Logger } from './chunk-CBZNP6RF.js';
|
|
51
|
-
export {
|
|
51
|
+
export { dataloader_exports as DataLoader } from './chunk-NUB5GQTU.js';
|
|
52
52
|
import { __name } from './chunk-XE4OXN2W.js';
|
|
53
53
|
import { GraphQLClient } from 'graphql-request';
|
|
54
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"pino-logger-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"pino-logger-TSRWXWIU.js"}
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as ContextFilterInput, D as DatabaseClient, a as DatabaseClientConfig, F as FieldExtractionOptions, b as FieldExtractionResult, I as InputJsonValue, J as JsonValue, M as ModelFieldsMap, O as OperationContext, P as PrismaJsonFilter, W as WorkspaceContext,
|
|
2
|
-
export { C as ConnectionState, d as DatabaseHealth, D as DatabaseReturnType, P as PrismaClientBase, c as PrismaClientConfig, a as PrismaClientConstructorOptions, b as PrismaClientWrapper, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient } from '../client-
|
|
1
|
+
export { C as ContextFilterInput, D as DatabaseClient, a as DatabaseClientConfig, F as FieldExtractionOptions, b as FieldExtractionResult, I as InputJsonValue, J as JsonValue, M as ModelFieldsMap, O as OperationContext, P as PoolTuningEnv, c as PrismaJsonFilter, W as WorkspaceContext, d as WorkspaceExtensionConfig, e as addWorkspaceExtension, f as buildContextWhereClause, g as buildContextWhereConditions, h as checkDatabaseHealth, j as contextMatches, k as createContextFromSDK, l as createDatabaseClient, m as createDatabaseClientFromEnv, n as extractFieldsFromModel, o as getAllModelNames, p as getDatabaseManager, q as getDatabaseProductName, r as getDatabaseStats, s as getDatabaseVersion, t as getDb, u as getModelFields, v as getWorkspaceContext, w as hasModel, x as initializeDatabase, y as initializeDatabaseWithConfig, z as injectWhereWorkspaceId, A as isDatabaseInitialized, B as loadGeneratedFields, E as mergeContext, G as parseContext, H as resetDatabaseManager, K as resolvePoolTuningFromEnv, L as setWorkspaceContext, N as testConnection, Q as toContextJson, R as withWorkspaceContext, S as withWorkspaceContextSync } from '../index-aNMCLxlz.js';
|
|
2
|
+
export { C as ConnectionState, d as DatabaseHealth, D as DatabaseReturnType, P as PrismaClientBase, c as PrismaClientConfig, a as PrismaClientConstructorOptions, b as PrismaClientWrapper, e as PrismaEvent, f as PrismaLogDefinition, g as PrismaLogEvent, h as PrismaLogLevel, i as PrismaQueryEvent, j as PrismaTransactionOptions, k as configurePrismaLogging, l as createConnectionPool, m as createPrismaAdapter, n as createPrismaClient } from '../client-CSEnihJT.js';
|
|
3
3
|
import '../prisma-extension-krXnYnrN.js';
|
|
4
4
|
import '@prisma/adapter-pg';
|
|
5
5
|
import 'pg';
|
package/dist/prisma/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PrismaClientWrapper, buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, configurePrismaLogging, contextMatches, createConnectionPool, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, createPrismaAdapter, createPrismaClient, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, testConnection, toContextJson } from '../chunk-
|
|
1
|
+
export { PrismaClientWrapper, buildContextWhereClause, buildContextWhereConditions, checkDatabaseHealth, configurePrismaLogging, contextMatches, createConnectionPool, createContextFromSDK, createDatabaseClient, createDatabaseClientFromEnv, createPrismaAdapter, createPrismaClient, extractFieldsFromModel, getAllModelNames, getDatabaseManager, getDatabaseProductName, getDatabaseStats, getDatabaseVersion, getDb, getModelFields, hasModel, initializeDatabase, initializeDatabaseWithConfig, isDatabaseInitialized, loadGeneratedFields, mergeContext, parseContext, resetDatabaseManager, resolvePoolTuningFromEnv, testConnection, toContextJson } from '../chunk-OWBJD3AS.js';
|
|
2
2
|
export { addWorkspaceExtension, getWorkspaceContext, injectWhereWorkspaceId, setWorkspaceContext, withWorkspaceContext, withWorkspaceContextSync } from '../chunk-GTEMQXCA.js';
|
|
3
3
|
import '../chunk-5CESUKWC.js';
|
|
4
4
|
import '../chunk-OHEPNJ2X.js';
|
|
@@ -12,20 +12,26 @@ var asyncDisposeMetricReader = /* @__PURE__ */ __name(async (metricReaderCandida
|
|
|
12
12
|
}
|
|
13
13
|
}, "asyncDisposeMetricReader");
|
|
14
14
|
async function createOtelSdk(cfg) {
|
|
15
|
+
console.log("[sdk] importing @opentelemetry/sdk-node...");
|
|
15
16
|
const sdkNodeMod = "@opentelemetry/sdk-node";
|
|
16
17
|
const sdkMod = await import(sdkNodeMod);
|
|
18
|
+
console.log("[sdk] importing @opentelemetry/resources...");
|
|
17
19
|
const resourcesMod = "@opentelemetry/resources";
|
|
18
20
|
const resources = await import(resourcesMod);
|
|
21
|
+
console.log("[sdk] importing @opentelemetry/semantic-conventions...");
|
|
19
22
|
const semMod = "@opentelemetry/semantic-conventions";
|
|
20
23
|
const sem = await import(semMod);
|
|
24
|
+
console.log("[sdk] importing @opentelemetry/exporter-trace-otlp-http...");
|
|
21
25
|
const traceExpMod = "@opentelemetry/exporter-trace-otlp-http";
|
|
22
26
|
const traceExp = await import(traceExpMod);
|
|
27
|
+
console.log("[sdk] importing @opentelemetry/exporter-metrics-otlp-http...");
|
|
23
28
|
let metricsExp;
|
|
24
29
|
try {
|
|
25
30
|
const metricsExpMod = "@opentelemetry/exporter-metrics-otlp-http";
|
|
26
31
|
metricsExp = await import(metricsExpMod);
|
|
27
32
|
} catch {
|
|
28
33
|
metricsExp = void 0;
|
|
34
|
+
console.log("[sdk] metrics exporter not available (non-fatal)");
|
|
29
35
|
}
|
|
30
36
|
let metricReader;
|
|
31
37
|
let metricsEnabled = false;
|
|
@@ -55,6 +61,7 @@ async function createOtelSdk(cfg) {
|
|
|
55
61
|
metricReader = void 0;
|
|
56
62
|
}
|
|
57
63
|
}
|
|
64
|
+
console.log("[sdk] importing @opentelemetry/sdk-trace-base for sampler...");
|
|
58
65
|
let sampler;
|
|
59
66
|
try {
|
|
60
67
|
const traceBaseMod = "@opentelemetry/sdk-trace-base";
|
|
@@ -64,7 +71,9 @@ async function createOtelSdk(cfg) {
|
|
|
64
71
|
});
|
|
65
72
|
} catch {
|
|
66
73
|
sampler = void 0;
|
|
74
|
+
console.log("[sdk] sampler not available (non-fatal)");
|
|
67
75
|
}
|
|
76
|
+
console.log("[sdk] importing @opentelemetry/auto-instrumentations-node...");
|
|
68
77
|
let autoInstrumentations;
|
|
69
78
|
try {
|
|
70
79
|
const autoMod = "@opentelemetry/auto-instrumentations-node";
|
|
@@ -74,8 +83,10 @@ async function createOtelSdk(cfg) {
|
|
|
74
83
|
enabled: false
|
|
75
84
|
}
|
|
76
85
|
});
|
|
86
|
+
console.log("[sdk] auto-instrumentations loaded");
|
|
77
87
|
} catch {
|
|
78
88
|
autoInstrumentations = void 0;
|
|
89
|
+
console.log("[sdk] auto-instrumentations not available (non-fatal)");
|
|
79
90
|
}
|
|
80
91
|
const serviceNamespaceByBoundary = {
|
|
81
92
|
wspace: "workspaces",
|
|
@@ -101,6 +112,7 @@ async function createOtelSdk(cfg) {
|
|
|
101
112
|
const traceExporter = new traceExp.OTLPTraceExporter({
|
|
102
113
|
url: `${cfg.otlpEndpoint.replace(/\/$/, "")}/v1/traces`
|
|
103
114
|
});
|
|
115
|
+
console.log("[sdk] constructing NodeSDK...");
|
|
104
116
|
const nodeSdk = new sdkMod.NodeSDK({
|
|
105
117
|
resource,
|
|
106
118
|
traceExporter,
|
|
@@ -114,15 +126,20 @@ async function createOtelSdk(cfg) {
|
|
|
114
126
|
instrumentations: autoInstrumentations
|
|
115
127
|
} : {}
|
|
116
128
|
});
|
|
129
|
+
console.log("[sdk] NodeSDK constructed, calling start()...");
|
|
117
130
|
const startResult = nodeSdk.start();
|
|
118
131
|
if (isThenable(startResult)) {
|
|
119
132
|
await startResult;
|
|
120
133
|
}
|
|
134
|
+
console.log("[sdk] NodeSDK started");
|
|
121
135
|
try {
|
|
122
136
|
const otelApiMod = "@opentelemetry/api";
|
|
123
137
|
globalThis.__otelApi = await import(otelApiMod);
|
|
138
|
+
console.log("[sdk] @opentelemetry/api stashed for pino mixin");
|
|
124
139
|
} catch {
|
|
140
|
+
console.log("[sdk] @opentelemetry/api stash failed (non-fatal)");
|
|
125
141
|
}
|
|
142
|
+
console.log("[sdk] OTel SDK initialization complete");
|
|
126
143
|
return {
|
|
127
144
|
shutdown: /* @__PURE__ */ __name(async () => nodeSdk.shutdown(), "shutdown"),
|
|
128
145
|
metricsEnabled,
|
|
@@ -132,5 +149,5 @@ async function createOtelSdk(cfg) {
|
|
|
132
149
|
__name(createOtelSdk, "createOtelSdk");
|
|
133
150
|
|
|
134
151
|
export { createOtelSdk };
|
|
135
|
-
//# sourceMappingURL=sdk-
|
|
136
|
-
//# sourceMappingURL=sdk-
|
|
152
|
+
//# sourceMappingURL=sdk-YS2M6RF5.js.map
|
|
153
|
+
//# sourceMappingURL=sdk-YS2M6RF5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/telemetry/sdk.ts"],"names":["isThenable","value","then","asyncDisposeMetricReader","metricReaderCandidate","shutdown","result","call","createOtelSdk","cfg","console","log","sdkNodeMod","sdkMod","resourcesMod","resources","semMod","sem","traceExpMod","traceExp","metricsExp","metricsExpMod","undefined","metricReader","metricsEnabled","metricsDropReason","OTLPMetricExporter","metricsSdkMod","metricsSdk","candidate","PeriodicExportingMetricReader","exporter","url","otlpEndpoint","replace","setProducer","setMetricProducer","sampler","traceBaseMod","traceBase","ParentBasedSampler","root","TraceIdRatioBasedSampler","Math","min","max","sampleRatio","autoInstrumentations","autoMod","auto","getNodeAutoInstrumentations","enabled","serviceNamespaceByBoundary","wspace","global","gateway","resourceAttributes","serviceName","serviceVersion","boundary","env","module","serviceInstanceId","process","clusterName","resource","resourceFromAttributes","traceExporter","OTLPTraceExporter","nodeSdk","NodeSDK","instrumentations","startResult","start","otelApiMod","globalThis","__otelApi"],"mappings":";;;AA8BA,IAAMA,UAAAA,2BAAcC,KAAAA,KAAAA;AAClB,EAAA,OAAO,OAAOA,KAAAA,KAAU,QAAA,IAAYA,UAAU,IAAA,IAAQ,OAAQA,MAA6BC,IAAAA,KAAS,UAAA;AACtG,CAAA,EAFmB,YAAA,CAAA;AAInB,IAAMC,wBAAAA,iCAAkCC,qBAAAA,KAAAA;AACtC,EAAA,MAAMC,WAAYD,qBAAAA,CAAoEC,QAAAA;AACtF,EAAA,IAAI,OAAOA,aAAa,UAAA,EAAY;AAClC,IAAA,MAAMC,MAAAA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B;AAAqB,KAAA,GAAI;GAC1E,CAAA;AACArC,EAAAA,OAAAA,CAAQC,IAAI,+CAAA,CAAA;AAIZ,EAAA,MAAM6D,WAAAA,GAAcH,QAAQI,KAAAA,EAAK;AACjC,EAAA,IAAIzE,UAAAA,CAAWwE,WAAAA,CAAAA,EAAc;AAC3B,IAAA,MAAMA,WAAAA;AACR,EAAA;AACA9D,EAAAA,OAAAA,CAAQC,IAAI,uBAAA,CAAA;AAGZ,EAAA,IAAI;AACF,IAAA,MAAM+D,UAAAA,GAAa,oBAAA;AAClBC,IAAAA,UAAAA,CAAkDC,SAAAA,GAAY,MAAM,OAAOF,UAAAA,CAAAA;AAC5EhE,IAAAA,OAAAA,CAAQC,IAAI,iDAAA,CAAA;EACd,CAAA,CAAA,MAAQ;AACND,IAAAA,OAAAA,CAAQC,IAAI,mDAAA,CAAA;AACd,EAAA;AAEAD,EAAAA,OAAAA,CAAQC,IAAI,wCAAA,CAAA;AACZ,EAAA,OAAO;IACLN,QAAAA,kBAAU,MAAA,CAAA,YAA2BgE,OAAAA,CAAQhE,QAAAA,EAAQ,EAA3C,UAAA,CAAA;AACVmB,IAAAA,cAAAA;AACAC,IAAAA;AACF,GAAA;AACF;AArLsBjB,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"sdk-YS2M6RF5.js","sourcesContent":["/**\n * Thin wrapper that initializes `@opentelemetry/sdk-node` with the\n * OTLPTrace + OTLPMetric exporters and standard auto-instrumentations.\n *\n * All imports are dynamic so services that haven't installed sdk-node\n * still compile and run. The function resolves `undefined` when the SDK\n * isn't available, letting `bootstrapTelemetry` fall back gracefully.\n */\nimport type { Boundary, Env } from './index.js';\n\nexport interface OtelSdkConfig {\n serviceName: string;\n serviceVersion: string;\n boundary: Boundary;\n module?: string;\n env: Env;\n otlpEndpoint: string;\n sampleRatio: number;\n}\n\nexport interface OtelSdkHandle {\n shutdown: () => Promise<void>;\n metricsEnabled: boolean;\n metricsDropReason?: string;\n}\n\ntype Thenable = {\n then: (onfulfilled?: (value: void) => void, onrejected?: (reason: unknown) => void) => unknown;\n};\n\nconst isThenable = (value: unknown): value is Thenable => {\n return typeof value === 'object' && value !== null && typeof (value as { then?: unknown }).then === 'function';\n};\n\nconst asyncDisposeMetricReader = async (metricReaderCandidate: unknown): Promise<void> => {\n const shutdown = (metricReaderCandidate as { shutdown?: () => void | Promise<void> }).shutdown;\n if (typeof shutdown === 'function') {\n const result = shutdown.call(metricReaderCandidate) as unknown;\n if (isThenable(result)) await result;\n }\n};\n\nexport async function createOtelSdk(cfg: OtelSdkConfig): Promise<OtelSdkHandle> {\n // Use local string variables so TypeScript skips static module resolution for\n // optional peer dependencies that may not be installed.\n console.log('[sdk] importing @opentelemetry/sdk-node...');\n const sdkNodeMod = '@opentelemetry/sdk-node';\n const sdkMod = (await import(sdkNodeMod)) as unknown as {\n NodeSDK: new (init: Record<string, unknown>) => {\n start: () => void;\n shutdown: () => Promise<void>;\n };\n };\n\n console.log('[sdk] importing @opentelemetry/resources...');\n const resourcesMod = '@opentelemetry/resources';\n const resources = (await import(resourcesMod)) as unknown as {\n resourceFromAttributes: (attrs: Record<string, string | number>) => unknown;\n };\n\n console.log('[sdk] importing @opentelemetry/semantic-conventions...');\n const semMod = '@opentelemetry/semantic-conventions';\n const sem = (await import(semMod)) as unknown as Record<string, string>;\n\n console.log('[sdk] importing @opentelemetry/exporter-trace-otlp-http...');\n const traceExpMod = '@opentelemetry/exporter-trace-otlp-http';\n const traceExp = (await import(traceExpMod)) as unknown as {\n OTLPTraceExporter: new (init: Record<string, string>) => unknown;\n };\n\n console.log('[sdk] importing @opentelemetry/exporter-metrics-otlp-http...');\n let metricsExp: { OTLPMetricExporter?: new (init: Record<string, string>) => unknown } | undefined;\n try {\n const metricsExpMod = '@opentelemetry/exporter-metrics-otlp-http';\n metricsExp = await import(metricsExpMod);\n } catch {\n metricsExp = undefined;\n console.log('[sdk] metrics exporter not available (non-fatal)');\n }\n\n let metricReader: unknown;\n let metricsEnabled = false;\n let metricsDropReason: string | undefined;\n if (metricsExp?.OTLPMetricExporter) {\n try {\n const metricsSdkMod = '@opentelemetry/sdk-metrics';\n const metricsSdk = (await import(metricsSdkMod)) as unknown as {\n PeriodicExportingMetricReader: new (init: Record<string, unknown>) => unknown;\n };\n const candidate = new metricsSdk.PeriodicExportingMetricReader({\n exporter: new metricsExp.OTLPMetricExporter({\n url: `${cfg.otlpEndpoint.replace(/\\/$/, '')}/v1/metrics`,\n }),\n });\n // Pre-flight API compatibility check. Some OTel package version\n // combinations construct `PeriodicExportingMetricReader` successfully\n // but lack `setMetricProducer` on the prototype chain (mixed\n // sdk-metrics versions, or runtime-specific class-inheritance\n // quirks — Bun has surfaced this in the past). Without the check,\n // `NodeSDK.start()` may register the global tracer provider BEFORE\n // it tries to call `setMetricProducer` and throws — leaving the\n // global tracer pointing at a half-initialized provider whose\n // span pipeline never drains. Skipping the metric reader when the\n // API isn't there avoids that whole failure mode in one pass.\n const setProducer = (candidate as { setMetricProducer?: unknown }).setMetricProducer;\n if (typeof setProducer === 'function') {\n metricReader = candidate;\n metricsEnabled = true;\n } else {\n metricsDropReason =\n 'setMetricProducer is not a function on PeriodicExportingMetricReader; skipping metrics path';\n await asyncDisposeMetricReader(candidate);\n metricReader = undefined;\n }\n } catch {\n if (metricsDropReason === undefined) {\n metricsDropReason = 'metric reader construction or compatibility check failed';\n }\n metricReader = undefined;\n }\n }\n\n console.log('[sdk] importing @opentelemetry/sdk-trace-base for sampler...');\n let sampler: unknown;\n try {\n const traceBaseMod = '@opentelemetry/sdk-trace-base';\n const traceBase = (await import(traceBaseMod)) as unknown as {\n ParentBasedSampler: new (init: Record<string, unknown>) => unknown;\n TraceIdRatioBasedSampler: new (ratio: number) => unknown;\n };\n sampler = new traceBase.ParentBasedSampler({\n root: new traceBase.TraceIdRatioBasedSampler(Math.min(1, Math.max(0, cfg.sampleRatio))),\n });\n } catch {\n sampler = undefined;\n console.log('[sdk] sampler not available (non-fatal)');\n }\n\n // Some services have auto-instrumentations installed; optional.\n console.log('[sdk] importing @opentelemetry/auto-instrumentations-node...');\n let autoInstrumentations: unknown[] | undefined;\n try {\n const autoMod = '@opentelemetry/auto-instrumentations-node';\n const auto = (await import(autoMod)) as unknown as {\n getNodeAutoInstrumentations: (cfg?: Record<string, unknown>) => unknown[];\n };\n autoInstrumentations = auto.getNodeAutoInstrumentations({\n '@opentelemetry/instrumentation-fs': { enabled: false },\n });\n console.log('[sdk] auto-instrumentations loaded');\n } catch {\n autoInstrumentations = undefined;\n console.log('[sdk] auto-instrumentations not available (non-fatal)');\n }\n\n const serviceNamespaceByBoundary: Record<Boundary, string> = {\n wspace: 'workspaces',\n global: 'tenant',\n gateway: 'gateways',\n };\n const resourceAttributes: Record<string, string> = {\n [sem['SEMRESATTRS_SERVICE_NAME'] ?? 'service.name']: cfg.serviceName,\n [sem['SEMRESATTRS_SERVICE_VERSION'] ?? 'service.version']: cfg.serviceVersion,\n [sem['SEMRESATTRS_SERVICE_NAMESPACE'] ?? 'service.namespace']: serviceNamespaceByBoundary[cfg.boundary],\n [sem['SEMRESATTRS_DEPLOYMENT_ENVIRONMENT'] ?? 'deployment.environment']: cfg.env,\n 'burdenoff.boundary': cfg.boundary,\n };\n if (cfg.module) resourceAttributes['burdenoff.module'] = cfg.module;\n const serviceInstanceId = process.env['POD_NAME'] ?? process.env['HOSTNAME'];\n if (serviceInstanceId) resourceAttributes['service.instance.id'] = serviceInstanceId;\n const clusterName = process.env['CLUSTER_NAME'];\n if (clusterName) {\n resourceAttributes['cluster'] = clusterName;\n resourceAttributes['k8s.cluster.name'] = clusterName;\n }\n\n const resource = resources.resourceFromAttributes(resourceAttributes);\n\n const traceExporter = new traceExp.OTLPTraceExporter({\n url: `${cfg.otlpEndpoint.replace(/\\/$/, '')}/v1/traces`,\n });\n\n // Single NodeSDK, single start. The pre-flight `setMetricProducer`\n // check above means we never pass an incompatible metric reader into\n // NodeSDK construction — so we no longer need the prior catch+rebuild\n // fallback dance, which had its own side-effect: the failed first\n // NodeSDK could leave the global tracer provider partially registered,\n // and the second NodeSDK's `setGlobalTracerProvider` becomes a no-op\n // — meaning spans flow into the FIRST (broken) provider and never\n // reach the exporter. Eliminating the fallback eliminates that hazard.\n console.log('[sdk] constructing NodeSDK...');\n const nodeSdk = new sdkMod.NodeSDK({\n resource,\n traceExporter,\n ...(metricReader ? { metricReader } : {}),\n ...(sampler ? { sampler } : {}),\n ...(autoInstrumentations ? { instrumentations: autoInstrumentations } : {}),\n });\n console.log('[sdk] NodeSDK constructed, calling start()...');\n // NodeSDK.start() returns void in modern versions and Promise<void> in older\n // ones. Cast to a permissive thenable shape so awaiting works either way\n // without tripping `@typescript-eslint/await-thenable`.\n const startResult = nodeSdk.start() as unknown;\n if (isThenable(startResult)) {\n await startResult;\n }\n console.log('[sdk] NodeSDK started');\n\n // Stash the @opentelemetry/api reference for pino-logger's mixin.\n try {\n const otelApiMod = '@opentelemetry/api';\n (globalThis as unknown as { __otelApi?: unknown }).__otelApi = await import(otelApiMod);\n console.log('[sdk] @opentelemetry/api stashed for pino mixin');\n } catch {\n console.log('[sdk] @opentelemetry/api stash failed (non-fatal)');\n }\n\n console.log('[sdk] OTel SDK initialization complete');\n return {\n shutdown: async (): Promise<void> => nodeSdk.shutdown(),\n metricsEnabled,\n metricsDropReason,\n };\n}\n"]}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-
|
|
2
|
-
export { C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, m as WspaceGraphQLContext } from '../types-
|
|
1
|
+
import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-Bj1K2RtU.js';
|
|
2
|
+
export { C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, m as WspaceGraphQLContext } from '../types-Bj1K2RtU.js';
|
|
3
3
|
import * as jose from 'jose';
|
|
4
4
|
import { VerifyOptions } from 'jsonwebtoken';
|
|
5
5
|
import { I as I18n } from '../i18n-DrdPTann.js';
|
|
6
6
|
import { GraphQLError } from 'graphql';
|
|
7
7
|
export { I as I18nContext, L as LocaleCode } from '../types-C8TbSdEj.js';
|
|
8
|
-
export { P as PrismaClientBase } from '../client-
|
|
8
|
+
export { P as PrismaClientBase } from '../client-CSEnihJT.js';
|
|
9
9
|
import 'graphql-yoga';
|
|
10
10
|
import '@prisma/adapter-pg';
|
|
11
11
|
import 'pg';
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_REDACT_PATHS, createPinoLogger } from '../chunk-
|
|
1
|
+
export { DEFAULT_REDACT_PATHS, createPinoLogger } from '../chunk-NRSIT4VI.js';
|
|
2
2
|
import { setActiveTelemetryLogger, setupInstrumentation } from '../chunk-ACYGOENW.js';
|
|
3
3
|
export { initializeInstrumentation, setupInstrumentation } from '../chunk-ACYGOENW.js';
|
|
4
4
|
import '../chunk-REF7PANB.js';
|
|
@@ -132,7 +132,7 @@ async function bootstrapTelemetry(cfg) {
|
|
|
132
132
|
const serviceVersion = resolveVersion(cfg.serviceVersion);
|
|
133
133
|
const otlpEndpoint = resolveEndpoint(cfg.otlpEndpoint);
|
|
134
134
|
const sampleRatio = resolveSampling(cfg.sampleRatio, env);
|
|
135
|
-
const { createPinoLogger: createPinoLogger2 } = await import('../pino-logger-
|
|
135
|
+
const { createPinoLogger: createPinoLogger2 } = await import('../pino-logger-TSRWXWIU.js');
|
|
136
136
|
const logger2 = await createPinoLogger2({
|
|
137
137
|
serviceName: cfg.serviceName,
|
|
138
138
|
env,
|
|
@@ -153,8 +153,9 @@ async function bootstrapTelemetry(cfg) {
|
|
|
153
153
|
});
|
|
154
154
|
let otelSdk;
|
|
155
155
|
if (resolveOtelSdkEnabled()) {
|
|
156
|
+
console.log("[telemetry] OTel SDK bootstrap starting...");
|
|
156
157
|
try {
|
|
157
|
-
const { createOtelSdk } = await import('../sdk-
|
|
158
|
+
const { createOtelSdk } = await import('../sdk-YS2M6RF5.js');
|
|
158
159
|
otelSdk = await createOtelSdk({
|
|
159
160
|
serviceName: cfg.serviceName,
|
|
160
161
|
serviceVersion,
|
|
@@ -170,19 +171,23 @@ async function bootstrapTelemetry(cfg) {
|
|
|
170
171
|
sampleRatio,
|
|
171
172
|
metricsEnabled: otelSdk.metricsEnabled
|
|
172
173
|
});
|
|
174
|
+
console.log("[telemetry] OTel SDK exporter pipeline started");
|
|
173
175
|
if (!otelSdk.metricsEnabled && otelSdk.metricsDropReason) {
|
|
174
176
|
logger2.warn("[telemetry] OpenTelemetry metrics reader disabled; continuing with traces only", {
|
|
175
177
|
serviceName: cfg.serviceName,
|
|
176
178
|
reason: otelSdk.metricsDropReason
|
|
177
179
|
});
|
|
180
|
+
console.warn("[telemetry] OTel SDK metrics reader disabled:", otelSdk.metricsDropReason);
|
|
178
181
|
}
|
|
179
182
|
} catch (err) {
|
|
180
183
|
logger2.warn("[telemetry] OpenTelemetry exporter pipeline failed to start; continuing with logs only", {
|
|
181
184
|
error: err instanceof Error ? err.message : String(err)
|
|
182
185
|
});
|
|
186
|
+
console.error("[telemetry] OTel SDK failed:", err);
|
|
183
187
|
}
|
|
184
188
|
} else {
|
|
185
189
|
logger2.info("[telemetry] OTel SDK exporter disabled by env");
|
|
190
|
+
console.log("[telemetry] OTel SDK exporter disabled by env");
|
|
186
191
|
}
|
|
187
192
|
const shutdown = /* @__PURE__ */ __name(async () => {
|
|
188
193
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/telemetry/health.ts","../../src/telemetry/metrics-endpoint.ts","../../src/telemetry/prisma-logging.ts","../../src/telemetry/index.ts"],"names":["createHealthRoutes","_deps","Proxy","get","_target","prop","undefined","loadDefaultRegistry","mod","collectDefaultMetrics","register","createMetricsRoutesImpl","app","opts","path","ctx","registry","ctxWithSet","set","status","headers","contentType","metrics","createMetricsRoutes","createPrismaLoggingExtension","logger","name","query","$allOperations","model","operation","args","start","Date","now","result","debug","duration_ms","redactSensitiveFields","err","error","Error","message","String","resolveEnv","explicit","fromEnv","process","env","resolveVersion","resolveEndpoint","proto","resolveSampling","Number","isFinite","Math","min","max","parsed","resolveOtelSdkEnabled","sdkDisabled","otelEnabled","bootstrapTelemetry","cfg","serviceVersion","otlpEndpoint","sampleRatio","createPinoLogger","serviceName","version","setActiveTelemetryLogger","instrumentation","setupInstrumentation","tracing","samplingRate","otelSdk","createOtelSdk","boundary","module","info","metricsEnabled","metricsDropReason","warn","reason","shutdown","defaultLogger","setLevel","getLevel"],"mappings":";;;;;;;;AAmFO,SAASA,kBAAAA,CAAmBC,KAAAA,GAAoB,EAAC,EAAC;AAEvD,EAAA,OAAO,IAAIC,KAAAA,CACT,EAAC,EACD;AACEC,IAAAA,GAAAA,CAAIC,SAASC,IAAAA,EAAI;AAIf,MAAA,IAAIA,IAAAA,KAAS,KAAA,IAASA,IAAAA,KAAS,MAAA,EAAQ,OAAOC,MAAAA;AAC9C,MAAA,OAAOA,MAAAA;AACT,IAAA;GACF,CAAA;AAEJ;AAdgBN,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA;;;ACnEhB,eAAsBO,mBAAAA,GAAAA;AACpB,EAAA,IAAI;AACF,IAAA,MAAMC,GAAAA,GAAO,MAAM,OAAO,aAAA,CAAA;AAK1B,IAAA,IAAI;AACFA,MA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B,IAAAA,GAAAA;IACAvB,MAAAA,EAAQA,OAAAA;AACR8C,IAAAA,eAAAA;AACAa,IAAAA;AACF,GAAA;AACF;AA7FsBtB,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA","file":"index.js","sourcesContent":["/**\n * `/health`, `/health/live`, `/health/ready` Elysia routes with a 1s\n * result cache so readiness checks can't stampede Postgres.\n *\n * Dependencies (prisma, eventQueue, valkey) are optional — omit any client and\n * the readiness check simply skips it.\n */\n\ninterface PrismaLike {\n $queryRaw: (strings: TemplateStringsArray) => Promise<unknown>;\n}\ninterface EventQueueLike {\n isConnected?: () => boolean | Promise<boolean>;\n healthCheck?: () => Promise<{ ok: boolean }>;\n}\ninterface ValkeyLike {\n ping: () => Promise<unknown>;\n}\n\nexport interface HealthDeps {\n prisma?: PrismaLike;\n eventQueue?: EventQueueLike;\n valkey?: ValkeyLike;\n /** Service version reported on /health. */\n version?: string;\n /** Service name reported on /health. */\n serviceName?: string;\n}\n\ninterface CachedStatus {\n ready: boolean;\n checked: Record<string, { ok: boolean; error?: string }>;\n at: number;\n}\n\nconst CACHE_TTL_MS = 1000;\n\nasync function probeReady(deps: HealthDeps): Promise<CachedStatus> {\n const checked: Record<string, { ok: boolean; error?: string }> = {};\n\n if (deps.prisma) {\n try {\n await deps.prisma.$queryRaw`SELECT 1`;\n checked['postgres'] = { ok: true };\n } catch (err) {\n checked['postgres'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n if (deps.eventQueue) {\n try {\n const connected =\n typeof deps.eventQueue.isConnected === 'function'\n ? await Promise.resolve(deps.eventQueue.isConnected())\n : ((await deps.eventQueue.healthCheck?.())?.ok ?? true);\n checked['eventQueue'] = { ok: Boolean(connected) };\n } catch (err) {\n checked['eventQueue'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n if (deps.valkey) {\n try {\n await deps.valkey.ping();\n checked['valkey'] = { ok: true };\n } catch (err) {\n checked['valkey'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n const ready = Object.values(checked).every((c) => c.ok);\n return { ready, checked, at: Date.now() };\n}\n\nexport function createHealthRoutes(_deps: HealthDeps = {}): unknown {\n // Return an Elysia app lazily so be-sdk doesn't hard-require elysia.\n return new Proxy(\n {},\n {\n get(_target, prop): unknown {\n // Tell TypeScript consumers the returned object is an Elysia plugin;\n // the actual mount happens via `createHealthRoutesImpl`. Services\n // that prefer direct use can call `createHealthRoutesImpl(elysia, deps)`.\n if (prop === 'use' || prop === 'then') return undefined;\n return undefined;\n },\n }\n );\n}\n\n/**\n * Mount health routes on an existing Elysia app. Callers hold a reference\n * to Elysia themselves; be-sdk stays decoupled.\n */\nexport function createHealthRoutesImpl<\n App extends {\n get: (path: string, handler: (ctx: unknown) => unknown) => App;\n },\n>(app: App, deps: HealthDeps = {}): App {\n let cache: CachedStatus | null = null;\n\n const getStatus = async (): Promise<CachedStatus> => {\n if (cache && Date.now() - cache.at < CACHE_TTL_MS) return cache;\n cache = await probeReady(deps);\n return cache;\n };\n\n app.get('/health/live', () => ({\n status: 'ok',\n serviceName: deps.serviceName,\n version: deps.version,\n }));\n\n app.get('/health/ready', async (ctx: unknown): Promise<unknown> => {\n const status = await getStatus();\n const ctxWithSet = ctx as { set?: { status?: number } };\n if (!status.ready && ctxWithSet.set) ctxWithSet.set.status = 503;\n return {\n status: status.ready ? 'ok' : 'degraded',\n serviceName: deps.serviceName,\n version: deps.version,\n checks: status.checked,\n };\n });\n\n app.get('/health', async (ctx: unknown): Promise<unknown> => {\n const status = await getStatus();\n const ctxWithSet = ctx as { set?: { status?: number } };\n if (!status.ready && ctxWithSet.set) ctxWithSet.set.status = 503;\n return {\n status: status.ready ? 'ok' : 'degraded',\n serviceName: deps.serviceName,\n version: deps.version,\n checks: status.checked,\n uptime_s: Math.round(process.uptime()),\n };\n });\n\n return app;\n}\n","/**\n * Prometheus `/metrics` route mounter. Uses the shared `prom-client`\n * default registry so all instrumentation (GraphQL Envelop, Prisma,\n * runtime) shows up on a single endpoint.\n */\n\ninterface PromRegistryLike {\n metrics: () => Promise<string> | string;\n contentType?: string;\n}\n\nexport interface MetricsMountOptions {\n registry?: PromRegistryLike;\n path?: string;\n}\n\nexport async function loadDefaultRegistry(): Promise<PromRegistryLike | null> {\n try {\n const mod = (await import('prom-client')) as unknown as {\n register: PromRegistryLike;\n collectDefaultMetrics: (opts?: Record<string, unknown>) => void;\n };\n // Kick runtime metrics into the default registry if not already.\n try {\n mod.collectDefaultMetrics({ register: mod.register });\n } catch {\n // Already registered — ignore duplicate-metric errors.\n }\n return mod.register;\n } catch {\n return null;\n }\n}\n\nexport function createMetricsRoutesImpl<\n App extends {\n get: (path: string, handler: (ctx: unknown) => unknown) => App;\n },\n>(app: App, opts: MetricsMountOptions = {}): App {\n const path = opts.path ?? '/metrics';\n\n app.get(path, async (ctx: unknown): Promise<unknown> => {\n const registry = opts.registry ?? (await loadDefaultRegistry());\n const ctxWithSet = ctx as { set?: { status?: number; headers?: Record<string, string> } };\n if (!registry) {\n if (ctxWithSet.set) ctxWithSet.set.status = 503;\n return '# prom-client not installed\\n';\n }\n if (ctxWithSet.set) {\n ctxWithSet.set.status = 200;\n ctxWithSet.set.headers = {\n 'content-type': registry.contentType ?? 'text/plain; version=0.0.4; charset=utf-8',\n };\n }\n return registry.metrics();\n });\n\n return app;\n}\n\n/**\n * Legacy export name used by the service template. Composes the Elysia\n * plugin-style function that `new Elysia().use(...)` accepts.\n */\nexport function createMetricsRoutes(opts: MetricsMountOptions = {}): unknown {\n return (app: Parameters<typeof createMetricsRoutesImpl>[0]): unknown => createMetricsRoutesImpl(app, opts);\n}\n","/**\n * Prisma client extension that pipes query events through the SDK logger\n * with trace/span correlation fields auto-injected. The\n * `@prisma/instrumentation` peer provides the spans\n * themselves; this extension only adds structured log events on top.\n */\nimport type { Logger } from '../logger/index.js';\nimport { redactSensitiveFields } from '../logger/index.js';\n\ntype PrismaQueryArgs = {\n model?: string;\n operation: string;\n args: unknown;\n query: (args: unknown) => Promise<unknown>;\n};\n\n/**\n * Returns a Prisma Client extension object compatible with the\n * `$extends()` API (Prisma v5+).\n *\n * ```ts\n * export const prisma = new PrismaClient().$extends(\n * createPrismaLoggingExtension(logger)\n * );\n * ```\n */\nexport function createPrismaLoggingExtension(logger: Logger): {\n name: string;\n query: {\n $allOperations: (args: PrismaQueryArgs) => Promise<unknown>;\n };\n} {\n return {\n name: 'burdenoff-pino-logging',\n query: {\n async $allOperations({ model, operation, args, query }: PrismaQueryArgs): Promise<unknown> {\n const start = Date.now();\n try {\n const result = await query(args);\n logger.debug('prisma.query', {\n model,\n operation,\n duration_ms: Date.now() - start,\n args: redactSensitiveFields(args),\n });\n return result;\n } catch (err) {\n logger.error('prisma.error', {\n model,\n operation,\n duration_ms: Date.now() - start,\n error: err instanceof Error ? err.message : String(err),\n });\n throw err;\n }\n },\n },\n };\n}\n","/**\n * Unified telemetry bootstrap for Burdenoff services.\n *\n * Composes the existing `instrumentation/` + `observability/` + `logger/`\n * modules and adds:\n * - `bootstrapTelemetry({ serviceName, boundary, module, env })` — single\n * call that initializes OTel, wires Pino logger with trace fields,\n * exposes GraphQL Yoga plugins, registers process exit hooks.\n * - `createHealthRoutes({ prisma, nats, valkey, version })` — `/health`,\n * `/health/live`, `/health/ready` Elysia routes.\n * - `createMetricsRoutes(registry?)` — `/metrics` Prometheus exposition.\n * - `createPrismaLoggingExtension(logger)` — Prisma extension that pipes\n * query events through Pino with trace/span correlation ids.\n *\n * The module does not pull in `@opentelemetry/sdk-node` or `pino` as direct\n * deps — services install those as optional peers, and imports are lazy so\n * services that don't install them still load.\n */\n\nimport type { Logger as BaseLogger } from '../logger/index.js';\nimport { logger as defaultLogger } from '../logger/index.js';\nimport {\n initializeInstrumentation,\n setupInstrumentation,\n type SetupInstrumentationOptions,\n type InstrumentationSetupResult,\n} from '../instrumentation/index.js';\nimport { setActiveTelemetryLogger } from './logger-state.js';\nimport type { OtelSdkHandle } from './sdk.js';\n\nexport { createHealthRoutes } from './health.js';\nexport { createMetricsRoutes } from './metrics-endpoint.js';\nexport { createPrismaLoggingExtension } from './prisma-logging.js';\nexport { DEFAULT_REDACT_PATHS } from './pino-redaction.js';\nexport { createPinoLogger } from './pino-logger.js';\n\nexport type Boundary = 'wspace' | 'global' | 'gateway';\nexport type Env = 'alpha' | 'prod' | 'dev';\n\nexport interface TelemetryConfig {\n /** Full service name, e.g. \"wspace-auth-svc\". */\n serviceName: string;\n /** Semver of the service deployment; defaults to `process.env.npm_package_version`. */\n serviceVersion?: string;\n /** Monorepo boundary: `wspace`, `global`, or `gateway`. */\n boundary: Boundary;\n /** Module slug, e.g. `auth` (omit for gateways). */\n module?: string;\n /** Deployment environment; defaults to alpha for non-production NODE_ENV. */\n env?: Env;\n /**\n * OTLP endpoint for spans/metrics/logs. Defaults to\n * `$OTEL_EXPORTER_OTLP_ENDPOINT` or\n * `http://alloy.sre.svc.cluster.local:4318`.\n */\n otlpEndpoint?: string;\n /** Head-based sampling ratio. Default: alpha=1.0, prod=0.1. */\n sampleRatio?: number;\n /** Extra options forwarded to `setupInstrumentation`. */\n instrumentation?: SetupInstrumentationOptions;\n}\n\nexport interface TelemetryHandle {\n /** The configured service name (for use in health routes, etc.). */\n serviceName: string;\n /** The resolved service version. */\n serviceVersion: string;\n /** Environment. */\n env: Env;\n /** The Pino-backed logger. */\n logger: BaseLogger;\n /** Initialized instrumentation (tracer + metrics + plugins). */\n instrumentation: InstrumentationSetupResult;\n /** Cleanup hook; services call on SIGTERM. */\n shutdown: () => Promise<void>;\n}\n\nfunction resolveEnv(explicit?: Env): Env {\n if (explicit) return explicit;\n const fromEnv = process.env['DEPLOY_ENV'] ?? process.env['NODE_ENV'] ?? '';\n if (fromEnv === 'production' || fromEnv === 'prod') return 'prod';\n if (fromEnv === 'development' || fromEnv === 'dev') return 'dev';\n return 'alpha';\n}\n\nfunction resolveVersion(explicit?: string): string {\n if (explicit) return explicit;\n return process.env['npm_package_version'] ?? process.env['SERVICE_VERSION'] ?? '0.0.0';\n}\n\nfunction resolveEndpoint(explicit?: string): string {\n if (explicit) return explicit;\n const proto = 'http';\n // NOTE (ACA / current prod): the `alloy.sre.svc.cluster.local` fallback is a\n // LEGACY Kubernetes in-cluster DNS name and does NOT resolve on Azure\n // Container Apps. In ACA, service metrics reach Grafana/Azure Monitor via the\n // Prometheus `/metrics` *pull* path (the otel-collector scrapes each app) —\n // see `~/products/dev/platform/context/sre/HOW_TO_INTEGRATE_SRE_BACKEND.md`.\n // OTLP *push* (traces/metrics) only works where `OTEL_EXPORTER_OTLP_ENDPOINT`\n // is explicitly set to the env's otel-collector OTLP receiver. Kept as the\n // default for local/K8s remnants; override via env in ACA.\n return process.env['OTEL_EXPORTER_OTLP_ENDPOINT'] ?? `${proto}://alloy.sre.svc.cluster.local:4318`;\n}\n\nfunction resolveSampling(explicit: number | undefined, env: Env): number {\n if (typeof explicit === 'number' && Number.isFinite(explicit)) return Math.min(1, Math.max(0, explicit));\n const fromEnv = process.env['OTEL_TRACES_SAMPLER_ARG'];\n if (fromEnv) {\n const parsed = Number(fromEnv);\n if (Number.isFinite(parsed)) return Math.min(1, Math.max(0, parsed));\n }\n if (env === 'prod') return 0.1;\n return 1.0;\n}\n\nfunction resolveOtelSdkEnabled(): boolean {\n const sdkDisabled = process.env['OTEL_SDK_DISABLED'];\n if (sdkDisabled === 'true' || sdkDisabled === '1') return false;\n const otelEnabled = process.env['OTEL_ENABLED'];\n if (otelEnabled === 'false' || otelEnabled === '0') return false;\n return true;\n}\n\n/**\n * Bootstrap the full telemetry stack for a service.\n *\n * Services call this ONCE at startup **before** importing Prisma / GraphQL\n * Yoga / NATS so OTel can auto-instrument their dependencies.\n *\n * ```ts\n * // src/telemetry.ts\n * import { bootstrapTelemetry } from '@burdenoff/be-sdk/telemetry';\n * export const telemetry = await bootstrapTelemetry({\n * serviceName: 'wspace-auth-svc',\n * boundary: 'wspace',\n * module: 'auth',\n * });\n *\n * // src/index.ts — must be the FIRST import line.\n * import './telemetry.js';\n * ```\n */\nexport async function bootstrapTelemetry(cfg: TelemetryConfig): Promise<TelemetryHandle> {\n const env = resolveEnv(cfg.env);\n const serviceVersion = resolveVersion(cfg.serviceVersion);\n const otlpEndpoint = resolveEndpoint(cfg.otlpEndpoint);\n const sampleRatio = resolveSampling(cfg.sampleRatio, env);\n\n // Pino logger with trace/span correlation + redaction.\n // createPinoLogger is async (loads pino via dynamic import); awaiting it\n // is required — without await, `logger` is a Promise and calls like\n // logger.warn(...) crash with \"logger.warn is not a function\" during the\n // sdk-node fallback path.\n const { createPinoLogger } = await import('./pino-logger.js');\n const logger = await createPinoLogger({\n serviceName: cfg.serviceName,\n env,\n version: serviceVersion,\n });\n setActiveTelemetryLogger(logger);\n\n // Initialize core instrumentation (tracer, metrics registry, envelop plugins).\n // `setupInstrumentation` internally calls `initializeInstrumentation`.\n const instrumentation = setupInstrumentation(cfg.serviceName, {\n ...cfg.instrumentation,\n tracing: {\n serviceName: cfg.serviceName,\n ...(cfg.instrumentation?.tracing ?? {}),\n samplingRate: sampleRatio,\n },\n metrics: {\n serviceName: cfg.serviceName,\n ...(cfg.instrumentation?.metrics ?? {}),\n },\n });\n\n // Start the NodeSDK exporter pipeline if sdk-node is present (optional).\n let otelSdk: OtelSdkHandle | undefined;\n if (resolveOtelSdkEnabled()) {\n try {\n const { createOtelSdk } = await import('./sdk.js');\n otelSdk = await createOtelSdk({\n serviceName: cfg.serviceName,\n serviceVersion,\n boundary: cfg.boundary,\n module: cfg.module,\n env,\n otlpEndpoint,\n sampleRatio,\n });\n // Explicit success log includes metrics path status so an operator can\n // distinguish traces-only startup from full traces+metrics startup.\n logger.info('[telemetry] OpenTelemetry exporter pipeline started', {\n serviceName: cfg.serviceName,\n otlpEndpoint: otlpEndpoint ? '<configured>' : '<not set>',\n sampleRatio,\n metricsEnabled: otelSdk.metricsEnabled,\n });\n\n if (!otelSdk.metricsEnabled && otelSdk.metricsDropReason) {\n logger.warn('[telemetry] OpenTelemetry metrics reader disabled; continuing with traces only', {\n serviceName: cfg.serviceName,\n reason: otelSdk.metricsDropReason,\n });\n }\n } catch (err) {\n logger.warn('[telemetry] OpenTelemetry exporter pipeline failed to start; continuing with logs only', {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n } else {\n logger.info('[telemetry] OTel SDK exporter disabled by env');\n }\n\n const shutdown = async (): Promise<void> => {\n try {\n if (otelSdk?.shutdown) await otelSdk.shutdown();\n } catch (err) {\n logger.warn('[telemetry] shutdown error (ignored)', {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n };\n\n // Mirror defaultLogger so services that still use the singleton get trace-enriched output.\n defaultLogger.setLevel(logger.getLevel?.() ?? 'info');\n\n return {\n serviceName: cfg.serviceName,\n serviceVersion,\n env,\n logger: logger,\n instrumentation,\n shutdown,\n };\n}\n\n// Re-export what services typically import.\nexport { initializeInstrumentation, setupInstrumentation };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/health.ts","../../src/telemetry/metrics-endpoint.ts","../../src/telemetry/prisma-logging.ts","../../src/telemetry/index.ts"],"names":["createHealthRoutes","_deps","Proxy","get","_target","prop","undefined","loadDefaultRegistry","mod","collectDefaultMetrics","register","createMetricsRoutesImpl","app","opts","path","ctx","registry","ctxWithSet","set","status","headers","contentType","metrics","createMetricsRoutes","createPrismaLoggingExtension","logger","name","query","$allOperations","model","operation","args","start","Date","now","result","debug","duration_ms","redactSensitiveFields","err","error","Error","message","String","resolveEnv","explicit","fromEnv","process","env","resolveVersion","resolveEndpoint","proto","resolveSampling","Number","isFinite","Math","min","max","parsed","resolveOtelSdkEnabled","sdkDisabled","otelEnabled","bootstrapTelemetry","cfg","serviceVersion","otlpEndpoint","sampleRatio","createPinoLogger","serviceName","version","setActiveTelemetryLogger","instrumentation","setupInstrumentation","tracing","samplingRate","otelSdk","console","log","createOtelSdk","boundary","module","info","metricsEnabled","metricsDropReason","warn","reason","shutdown","defaultLogger","setLevel","getLevel"],"mappings":";;;;;;;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CAAA;AAGAqC,MAAAA,OAAAA,CAAQpC,KAAAA,CAAM,gCAAgCD,GAAAA,CAAAA;AAChD,IAAA;EACF,CAAA,MAAO;AACLd,IAAAA,OAAAA,CAAOwD,KAAK,+CAAA,CAAA;AACZL,IAAAA,OAAAA,CAAQC,IAAI,+CAAA,CAAA;AACd,EAAA;AAEA,EAAA,MAAMS,2BAAW,MAAA,CAAA,YAAA;AACf,IAAA,IAAI;AACF,MAAA,IAAIX,OAAAA,EAASW,QAAAA,EAAU,MAAMX,OAAAA,CAAQW,QAAAA,EAAQ;AAC/C,IAAA,CAAA,CAAA,OAAS/C,GAAAA,EAAK;AACZd,MAAAA,OAAAA,CAAO2D,KAAK,sCAAA,EAAwC;AAClD5C,QAAAA,KAAAA,EAAOD,GAAAA,YAAeE,KAAAA,GAAQF,GAAAA,CAAIG,OAAAA,GAAUC,OAAOJ,GAAAA;OACrD,CAAA;AACF,IAAA;EACF,CAAA,EARiB,UAAA,CAAA;AAWjBgD,EAAAA,MAAAA,CAAcC,QAAAA,CAAS/D,OAAAA,CAAOgE,QAAAA,IAAQ,IAAQ,MAAA,CAAA;AAE9C,EAAA,OAAO;AACLrB,IAAAA,WAAAA,EAAaL,GAAAA,CAAIK,WAAAA;AACjBJ,IAAAA,cAAAA;AACAhB,IAAAA,GAAAA;IACAvB,MAAAA,EAAQA,OAAAA;AACR8C,IAAAA,eAAAA;AACAe,IAAAA;AACF,GAAA;AACF;AAzGsBxB,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA","file":"index.js","sourcesContent":["/**\n * `/health`, `/health/live`, `/health/ready` Elysia routes with a 1s\n * result cache so readiness checks can't stampede Postgres.\n *\n * Dependencies (prisma, eventQueue, valkey) are optional — omit any client and\n * the readiness check simply skips it.\n */\n\ninterface PrismaLike {\n $queryRaw: (strings: TemplateStringsArray) => Promise<unknown>;\n}\ninterface EventQueueLike {\n isConnected?: () => boolean | Promise<boolean>;\n healthCheck?: () => Promise<{ ok: boolean }>;\n}\ninterface ValkeyLike {\n ping: () => Promise<unknown>;\n}\n\nexport interface HealthDeps {\n prisma?: PrismaLike;\n eventQueue?: EventQueueLike;\n valkey?: ValkeyLike;\n /** Service version reported on /health. */\n version?: string;\n /** Service name reported on /health. */\n serviceName?: string;\n}\n\ninterface CachedStatus {\n ready: boolean;\n checked: Record<string, { ok: boolean; error?: string }>;\n at: number;\n}\n\nconst CACHE_TTL_MS = 1000;\n\nasync function probeReady(deps: HealthDeps): Promise<CachedStatus> {\n const checked: Record<string, { ok: boolean; error?: string }> = {};\n\n if (deps.prisma) {\n try {\n await deps.prisma.$queryRaw`SELECT 1`;\n checked['postgres'] = { ok: true };\n } catch (err) {\n checked['postgres'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n if (deps.eventQueue) {\n try {\n const connected =\n typeof deps.eventQueue.isConnected === 'function'\n ? await Promise.resolve(deps.eventQueue.isConnected())\n : ((await deps.eventQueue.healthCheck?.())?.ok ?? true);\n checked['eventQueue'] = { ok: Boolean(connected) };\n } catch (err) {\n checked['eventQueue'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n if (deps.valkey) {\n try {\n await deps.valkey.ping();\n checked['valkey'] = { ok: true };\n } catch (err) {\n checked['valkey'] = {\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n const ready = Object.values(checked).every((c) => c.ok);\n return { ready, checked, at: Date.now() };\n}\n\nexport function createHealthRoutes(_deps: HealthDeps = {}): unknown {\n // Return an Elysia app lazily so be-sdk doesn't hard-require elysia.\n return new Proxy(\n {},\n {\n get(_target, prop): unknown {\n // Tell TypeScript consumers the returned object is an Elysia plugin;\n // the actual mount happens via `createHealthRoutesImpl`. Services\n // that prefer direct use can call `createHealthRoutesImpl(elysia, deps)`.\n if (prop === 'use' || prop === 'then') return undefined;\n return undefined;\n },\n }\n );\n}\n\n/**\n * Mount health routes on an existing Elysia app. Callers hold a reference\n * to Elysia themselves; be-sdk stays decoupled.\n */\nexport function createHealthRoutesImpl<\n App extends {\n get: (path: string, handler: (ctx: unknown) => unknown) => App;\n },\n>(app: App, deps: HealthDeps = {}): App {\n let cache: CachedStatus | null = null;\n\n const getStatus = async (): Promise<CachedStatus> => {\n if (cache && Date.now() - cache.at < CACHE_TTL_MS) return cache;\n cache = await probeReady(deps);\n return cache;\n };\n\n app.get('/health/live', () => ({\n status: 'ok',\n serviceName: deps.serviceName,\n version: deps.version,\n }));\n\n app.get('/health/ready', async (ctx: unknown): Promise<unknown> => {\n const status = await getStatus();\n const ctxWithSet = ctx as { set?: { status?: number } };\n if (!status.ready && ctxWithSet.set) ctxWithSet.set.status = 503;\n return {\n status: status.ready ? 'ok' : 'degraded',\n serviceName: deps.serviceName,\n version: deps.version,\n checks: status.checked,\n };\n });\n\n app.get('/health', async (ctx: unknown): Promise<unknown> => {\n const status = await getStatus();\n const ctxWithSet = ctx as { set?: { status?: number } };\n if (!status.ready && ctxWithSet.set) ctxWithSet.set.status = 503;\n return {\n status: status.ready ? 'ok' : 'degraded',\n serviceName: deps.serviceName,\n version: deps.version,\n checks: status.checked,\n uptime_s: Math.round(process.uptime()),\n };\n });\n\n return app;\n}\n","/**\n * Prometheus `/metrics` route mounter. Uses the shared `prom-client`\n * default registry so all instrumentation (GraphQL Envelop, Prisma,\n * runtime) shows up on a single endpoint.\n */\n\ninterface PromRegistryLike {\n metrics: () => Promise<string> | string;\n contentType?: string;\n}\n\nexport interface MetricsMountOptions {\n registry?: PromRegistryLike;\n path?: string;\n}\n\nexport async function loadDefaultRegistry(): Promise<PromRegistryLike | null> {\n try {\n const mod = (await import('prom-client')) as unknown as {\n register: PromRegistryLike;\n collectDefaultMetrics: (opts?: Record<string, unknown>) => void;\n };\n // Kick runtime metrics into the default registry if not already.\n try {\n mod.collectDefaultMetrics({ register: mod.register });\n } catch {\n // Already registered — ignore duplicate-metric errors.\n }\n return mod.register;\n } catch {\n return null;\n }\n}\n\nexport function createMetricsRoutesImpl<\n App extends {\n get: (path: string, handler: (ctx: unknown) => unknown) => App;\n },\n>(app: App, opts: MetricsMountOptions = {}): App {\n const path = opts.path ?? '/metrics';\n\n app.get(path, async (ctx: unknown): Promise<unknown> => {\n const registry = opts.registry ?? (await loadDefaultRegistry());\n const ctxWithSet = ctx as { set?: { status?: number; headers?: Record<string, string> } };\n if (!registry) {\n if (ctxWithSet.set) ctxWithSet.set.status = 503;\n return '# prom-client not installed\\n';\n }\n if (ctxWithSet.set) {\n ctxWithSet.set.status = 200;\n ctxWithSet.set.headers = {\n 'content-type': registry.contentType ?? 'text/plain; version=0.0.4; charset=utf-8',\n };\n }\n return registry.metrics();\n });\n\n return app;\n}\n\n/**\n * Legacy export name used by the service template. Composes the Elysia\n * plugin-style function that `new Elysia().use(...)` accepts.\n */\nexport function createMetricsRoutes(opts: MetricsMountOptions = {}): unknown {\n return (app: Parameters<typeof createMetricsRoutesImpl>[0]): unknown => createMetricsRoutesImpl(app, opts);\n}\n","/**\n * Prisma client extension that pipes query events through the SDK logger\n * with trace/span correlation fields auto-injected. The\n * `@prisma/instrumentation` peer provides the spans\n * themselves; this extension only adds structured log events on top.\n */\nimport type { Logger } from '../logger/index.js';\nimport { redactSensitiveFields } from '../logger/index.js';\n\ntype PrismaQueryArgs = {\n model?: string;\n operation: string;\n args: unknown;\n query: (args: unknown) => Promise<unknown>;\n};\n\n/**\n * Returns a Prisma Client extension object compatible with the\n * `$extends()` API (Prisma v5+).\n *\n * ```ts\n * export const prisma = new PrismaClient().$extends(\n * createPrismaLoggingExtension(logger)\n * );\n * ```\n */\nexport function createPrismaLoggingExtension(logger: Logger): {\n name: string;\n query: {\n $allOperations: (args: PrismaQueryArgs) => Promise<unknown>;\n };\n} {\n return {\n name: 'burdenoff-pino-logging',\n query: {\n async $allOperations({ model, operation, args, query }: PrismaQueryArgs): Promise<unknown> {\n const start = Date.now();\n try {\n const result = await query(args);\n logger.debug('prisma.query', {\n model,\n operation,\n duration_ms: Date.now() - start,\n args: redactSensitiveFields(args),\n });\n return result;\n } catch (err) {\n logger.error('prisma.error', {\n model,\n operation,\n duration_ms: Date.now() - start,\n error: err instanceof Error ? err.message : String(err),\n });\n throw err;\n }\n },\n },\n };\n}\n","/**\n * Unified telemetry bootstrap for Burdenoff services.\n *\n * Composes the existing `instrumentation/` + `observability/` + `logger/`\n * modules and adds:\n * - `bootstrapTelemetry({ serviceName, boundary, module, env })` — single\n * call that initializes OTel, wires Pino logger with trace fields,\n * exposes GraphQL Yoga plugins, registers process exit hooks.\n * - `createHealthRoutes({ prisma, nats, valkey, version })` — `/health`,\n * `/health/live`, `/health/ready` Elysia routes.\n * - `createMetricsRoutes(registry?)` — `/metrics` Prometheus exposition.\n * - `createPrismaLoggingExtension(logger)` — Prisma extension that pipes\n * query events through Pino with trace/span correlation ids.\n *\n * The module does not pull in `@opentelemetry/sdk-node` or `pino` as direct\n * deps — services install those as optional peers, and imports are lazy so\n * services that don't install them still load.\n */\n\nimport type { Logger as BaseLogger } from '../logger/index.js';\nimport { logger as defaultLogger } from '../logger/index.js';\nimport {\n initializeInstrumentation,\n setupInstrumentation,\n type SetupInstrumentationOptions,\n type InstrumentationSetupResult,\n} from '../instrumentation/index.js';\nimport { setActiveTelemetryLogger } from './logger-state.js';\nimport type { OtelSdkHandle } from './sdk.js';\n\nexport { createHealthRoutes } from './health.js';\nexport { createMetricsRoutes } from './metrics-endpoint.js';\nexport { createPrismaLoggingExtension } from './prisma-logging.js';\nexport { DEFAULT_REDACT_PATHS } from './pino-redaction.js';\nexport { createPinoLogger } from './pino-logger.js';\n\nexport type Boundary = 'wspace' | 'global' | 'gateway';\nexport type Env = 'alpha' | 'prod' | 'dev';\n\nexport interface TelemetryConfig {\n /** Full service name, e.g. \"wspace-auth-svc\". */\n serviceName: string;\n /** Semver of the service deployment; defaults to `process.env.npm_package_version`. */\n serviceVersion?: string;\n /** Monorepo boundary: `wspace`, `global`, or `gateway`. */\n boundary: Boundary;\n /** Module slug, e.g. `auth` (omit for gateways). */\n module?: string;\n /** Deployment environment; defaults to alpha for non-production NODE_ENV. */\n env?: Env;\n /**\n * OTLP endpoint for spans/metrics/logs. Defaults to\n * `$OTEL_EXPORTER_OTLP_ENDPOINT` or\n * `http://alloy.sre.svc.cluster.local:4318`.\n */\n otlpEndpoint?: string;\n /** Head-based sampling ratio. Default: alpha=1.0, prod=0.1. */\n sampleRatio?: number;\n /** Extra options forwarded to `setupInstrumentation`. */\n instrumentation?: SetupInstrumentationOptions;\n}\n\nexport interface TelemetryHandle {\n /** The configured service name (for use in health routes, etc.). */\n serviceName: string;\n /** The resolved service version. */\n serviceVersion: string;\n /** Environment. */\n env: Env;\n /** The Pino-backed logger. */\n logger: BaseLogger;\n /** Initialized instrumentation (tracer + metrics + plugins). */\n instrumentation: InstrumentationSetupResult;\n /** Cleanup hook; services call on SIGTERM. */\n shutdown: () => Promise<void>;\n}\n\nfunction resolveEnv(explicit?: Env): Env {\n if (explicit) return explicit;\n const fromEnv = process.env['DEPLOY_ENV'] ?? process.env['NODE_ENV'] ?? '';\n if (fromEnv === 'production' || fromEnv === 'prod') return 'prod';\n if (fromEnv === 'development' || fromEnv === 'dev') return 'dev';\n return 'alpha';\n}\n\nfunction resolveVersion(explicit?: string): string {\n if (explicit) return explicit;\n return process.env['npm_package_version'] ?? process.env['SERVICE_VERSION'] ?? '0.0.0';\n}\n\nfunction resolveEndpoint(explicit?: string): string {\n if (explicit) return explicit;\n const proto = 'http';\n // NOTE (ACA / current prod): the `alloy.sre.svc.cluster.local` fallback is a\n // LEGACY Kubernetes in-cluster DNS name and does NOT resolve on Azure\n // Container Apps. In ACA, service metrics reach Grafana/Azure Monitor via the\n // Prometheus `/metrics` *pull* path (the otel-collector scrapes each app) —\n // see `~/products/dev/platform/context/sre/HOW_TO_INTEGRATE_SRE_BACKEND.md`.\n // OTLP *push* (traces/metrics) only works where `OTEL_EXPORTER_OTLP_ENDPOINT`\n // is explicitly set to the env's otel-collector OTLP receiver. Kept as the\n // default for local/K8s remnants; override via env in ACA.\n return process.env['OTEL_EXPORTER_OTLP_ENDPOINT'] ?? `${proto}://alloy.sre.svc.cluster.local:4318`;\n}\n\nfunction resolveSampling(explicit: number | undefined, env: Env): number {\n if (typeof explicit === 'number' && Number.isFinite(explicit)) return Math.min(1, Math.max(0, explicit));\n const fromEnv = process.env['OTEL_TRACES_SAMPLER_ARG'];\n if (fromEnv) {\n const parsed = Number(fromEnv);\n if (Number.isFinite(parsed)) return Math.min(1, Math.max(0, parsed));\n }\n if (env === 'prod') return 0.1;\n return 1.0;\n}\n\nfunction resolveOtelSdkEnabled(): boolean {\n const sdkDisabled = process.env['OTEL_SDK_DISABLED'];\n if (sdkDisabled === 'true' || sdkDisabled === '1') return false;\n const otelEnabled = process.env['OTEL_ENABLED'];\n if (otelEnabled === 'false' || otelEnabled === '0') return false;\n return true;\n}\n\n/**\n * Bootstrap the full telemetry stack for a service.\n *\n * Services call this ONCE at startup **before** importing Prisma / GraphQL\n * Yoga / NATS so OTel can auto-instrument their dependencies.\n *\n * ```ts\n * // src/telemetry.ts\n * import { bootstrapTelemetry } from '@burdenoff/be-sdk/telemetry';\n * export const telemetry = await bootstrapTelemetry({\n * serviceName: 'wspace-auth-svc',\n * boundary: 'wspace',\n * module: 'auth',\n * });\n *\n * // src/index.ts — must be the FIRST import line.\n * import './telemetry.js';\n * ```\n */\nexport async function bootstrapTelemetry(cfg: TelemetryConfig): Promise<TelemetryHandle> {\n const env = resolveEnv(cfg.env);\n const serviceVersion = resolveVersion(cfg.serviceVersion);\n const otlpEndpoint = resolveEndpoint(cfg.otlpEndpoint);\n const sampleRatio = resolveSampling(cfg.sampleRatio, env);\n\n // Pino logger with trace/span correlation + redaction.\n // createPinoLogger is async (loads pino via dynamic import); awaiting it\n // is required — without await, `logger` is a Promise and calls like\n // logger.warn(...) crash with \"logger.warn is not a function\" during the\n // sdk-node fallback path.\n const { createPinoLogger } = await import('./pino-logger.js');\n const logger = await createPinoLogger({\n serviceName: cfg.serviceName,\n env,\n version: serviceVersion,\n });\n setActiveTelemetryLogger(logger);\n\n // Initialize core instrumentation (tracer, metrics registry, envelop plugins).\n // `setupInstrumentation` internally calls `initializeInstrumentation`.\n const instrumentation = setupInstrumentation(cfg.serviceName, {\n ...cfg.instrumentation,\n tracing: {\n serviceName: cfg.serviceName,\n ...(cfg.instrumentation?.tracing ?? {}),\n samplingRate: sampleRatio,\n },\n metrics: {\n serviceName: cfg.serviceName,\n ...(cfg.instrumentation?.metrics ?? {}),\n },\n });\n\n // Start the NodeSDK exporter pipeline if sdk-node is present (optional).\n let otelSdk: OtelSdkHandle | undefined;\n if (resolveOtelSdkEnabled()) {\n // Use console.log as a Pino-independent fallback for the critical OTel\n // bootstrap path. In ACA, Pino's default async sonic-boom destination is\n // not captured by ContainerAppConsoleLogs (see pino-logger.ts), so if the\n // sync-destination fix hasn't been deployed yet the *only* way operators\n // can see OTel startup/failure messages is through console.log.\n console.log('[telemetry] OTel SDK bootstrap starting...');\n try {\n const { createOtelSdk } = await import('./sdk.js');\n otelSdk = await createOtelSdk({\n serviceName: cfg.serviceName,\n serviceVersion,\n boundary: cfg.boundary,\n module: cfg.module,\n env,\n otlpEndpoint,\n sampleRatio,\n });\n // Explicit success log includes metrics path status so an operator can\n // distinguish traces-only startup from full traces+metrics startup.\n logger.info('[telemetry] OpenTelemetry exporter pipeline started', {\n serviceName: cfg.serviceName,\n otlpEndpoint: otlpEndpoint ? '<configured>' : '<not set>',\n sampleRatio,\n metricsEnabled: otelSdk.metricsEnabled,\n });\n console.log('[telemetry] OTel SDK exporter pipeline started');\n\n if (!otelSdk.metricsEnabled && otelSdk.metricsDropReason) {\n logger.warn('[telemetry] OpenTelemetry metrics reader disabled; continuing with traces only', {\n serviceName: cfg.serviceName,\n reason: otelSdk.metricsDropReason,\n });\n console.warn('[telemetry] OTel SDK metrics reader disabled:', otelSdk.metricsDropReason);\n }\n } catch (err) {\n logger.warn('[telemetry] OpenTelemetry exporter pipeline failed to start; continuing with logs only', {\n error: err instanceof Error ? err.message : String(err),\n });\n // console.error is always captured by ACA, ensuring the failure reason\n // is visible to operators even when Pino output is not.\n console.error('[telemetry] OTel SDK failed:', err);\n }\n } else {\n logger.info('[telemetry] OTel SDK exporter disabled by env');\n console.log('[telemetry] OTel SDK exporter disabled by env');\n }\n\n const shutdown = async (): Promise<void> => {\n try {\n if (otelSdk?.shutdown) await otelSdk.shutdown();\n } catch (err) {\n logger.warn('[telemetry] shutdown error (ignored)', {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n };\n\n // Mirror defaultLogger so services that still use the singleton get trace-enriched output.\n defaultLogger.setLevel(logger.getLevel?.() ?? 'info');\n\n return {\n serviceName: cfg.serviceName,\n serviceVersion,\n env,\n logger: logger,\n instrumentation,\n shutdown,\n };\n}\n\n// Re-export what services typically import.\nexport { initializeInstrumentation, setupInstrumentation };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { PubSub } from 'graphql-yoga';
|
|
3
|
-
import { P as PrismaClientBase, a as PrismaClientConstructorOptions } from './client-
|
|
3
|
+
import { P as PrismaClientBase, a as PrismaClientConstructorOptions } from './client-CSEnihJT.js';
|
|
4
4
|
import { I as I18nContext, L as LocaleCode } from './types-C8TbSdEj.js';
|
|
5
5
|
|
|
6
6
|
interface IActor {
|