@burdenoff/be-sdk 2026.623.1 → 2026.701.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/{chunk-E5USZ2MR.js → chunk-NRSIT4VI.js} +36 -21
- package/dist/chunk-NRSIT4VI.js.map +1 -0
- package/dist/{chunk-PHKK7725.js → chunk-UCLDHOZC.js} +100 -3
- package/dist/chunk-UCLDHOZC.js.map +1 -0
- package/dist/index-DgWLSDv2.d.ts +302 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/pino-logger-TSRWXWIU.js +5 -0
- package/dist/{pino-logger-NVZXQPWO.js.map → pino-logger-TSRWXWIU.js.map} +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js +1 -1
- package/dist/{sdk-UWFH5PY7.js → sdk-YS2M6RF5.js} +19 -2
- package/dist/sdk-YS2M6RF5.js.map +1 -0
- package/dist/telemetry/index.js +8 -3
- package/dist/telemetry/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-E5USZ2MR.js.map +0 -1
- package/dist/chunk-PHKK7725.js.map +0 -1
- package/dist/index-BQ1yJn1K.d.ts +0 -222
- package/dist/pino-logger-NVZXQPWO.js +0 -5
- package/dist/sdk-UWFH5PY7.js.map +0 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
interface RetryConfig {
|
|
2
|
+
attempts?: number;
|
|
3
|
+
initialDelayMs?: number;
|
|
4
|
+
maxDelayMs?: number;
|
|
5
|
+
retryOn?: (status: number) => boolean;
|
|
6
|
+
}
|
|
7
|
+
interface BreakerConfig {
|
|
8
|
+
threshold?: number;
|
|
9
|
+
cooldownMs?: number;
|
|
10
|
+
}
|
|
11
|
+
interface HttpClientConfig {
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
defaultTimeoutMs?: number;
|
|
14
|
+
retry?: RetryConfig;
|
|
15
|
+
breaker?: BreakerConfig;
|
|
16
|
+
defaultHeaders?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
declare class CircuitBreakerOpenError extends Error {
|
|
19
|
+
constructor(host: string);
|
|
20
|
+
}
|
|
21
|
+
interface HttpClientInit extends RequestInit {
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
retry?: RetryConfig;
|
|
24
|
+
}
|
|
25
|
+
declare function __resetHttpClientBreakers(): void;
|
|
26
|
+
declare function httpClient(url: string, init?: HttpClientInit, config?: HttpClientConfig): Promise<Response>;
|
|
27
|
+
declare function createHttpClient(config?: HttpClientConfig): (url: string, init?: HttpClientInit) => Promise<Response>;
|
|
28
|
+
|
|
29
|
+
interface LeaderLockRedis {
|
|
30
|
+
set(key: string, value: string, ex: 'EX', seconds: number, nx: 'NX'): Promise<'OK' | null>;
|
|
31
|
+
eval(script: string, numKeys: number, ...args: string[]): Promise<unknown>;
|
|
32
|
+
}
|
|
33
|
+
interface LeaderLockOptions {
|
|
34
|
+
ttlMs: number;
|
|
35
|
+
renewMs?: number;
|
|
36
|
+
}
|
|
37
|
+
interface LeaderLockResult<T> {
|
|
38
|
+
acquired: boolean;
|
|
39
|
+
result?: T;
|
|
40
|
+
}
|
|
41
|
+
declare function withLeaderLock<T>(redis: LeaderLockRedis, name: string, fn: () => Promise<T>, options: LeaderLockOptions): Promise<LeaderLockResult<T>>;
|
|
42
|
+
|
|
43
|
+
interface RateLimitRedis {
|
|
44
|
+
incr(key: string): Promise<number>;
|
|
45
|
+
pexpire(key: string, ms: number): Promise<number | 'OK'>;
|
|
46
|
+
pttl(key: string): Promise<number>;
|
|
47
|
+
}
|
|
48
|
+
interface RateLimitInput {
|
|
49
|
+
key: string;
|
|
50
|
+
limit: number;
|
|
51
|
+
windowMs: number;
|
|
52
|
+
}
|
|
53
|
+
interface RateLimitResult {
|
|
54
|
+
allowed: boolean;
|
|
55
|
+
count: number;
|
|
56
|
+
remaining: number;
|
|
57
|
+
resetAt: number;
|
|
58
|
+
}
|
|
59
|
+
declare function rateLimitIncr(redis: RateLimitRedis, input: RateLimitInput): Promise<RateLimitResult>;
|
|
60
|
+
|
|
61
|
+
interface ClampLimitOptions {
|
|
62
|
+
defaultLimit?: number;
|
|
63
|
+
maxLimit?: number;
|
|
64
|
+
minLimit?: number;
|
|
65
|
+
}
|
|
66
|
+
declare const DEFAULT_GRAPHQL_PAGE_LIMIT = 50;
|
|
67
|
+
declare const MAX_GRAPHQL_PAGE_LIMIT = 100;
|
|
68
|
+
declare function clampLimit(input: number | undefined | null, opts?: ClampLimitOptions): number;
|
|
69
|
+
declare function clampOffset(input: number | undefined | null): number;
|
|
70
|
+
declare function clampGraphqlLimit(input: number | undefined | null, opts?: ClampLimitOptions): number;
|
|
71
|
+
interface OffsetPaginationInput {
|
|
72
|
+
limit?: number | null;
|
|
73
|
+
offset?: number | null;
|
|
74
|
+
}
|
|
75
|
+
interface NormalizedOffsetPagination {
|
|
76
|
+
limit: number;
|
|
77
|
+
offset: number;
|
|
78
|
+
}
|
|
79
|
+
declare function normalizeOffsetPagination(input: OffsetPaginationInput | null | undefined, opts?: ClampLimitOptions): NormalizedOffsetPagination;
|
|
80
|
+
interface CursorPaginationInput {
|
|
81
|
+
first?: number | null;
|
|
82
|
+
after?: string | null;
|
|
83
|
+
}
|
|
84
|
+
interface NormalizedCursorPagination {
|
|
85
|
+
first: number;
|
|
86
|
+
after: string | null;
|
|
87
|
+
take: number;
|
|
88
|
+
}
|
|
89
|
+
declare function normalizeCursorPagination(input: CursorPaginationInput | null | undefined, opts?: ClampLimitOptions): NormalizedCursorPagination;
|
|
90
|
+
type CursorPayloadValue = string | number | boolean | null;
|
|
91
|
+
type CursorPayload = Record<string, CursorPayloadValue>;
|
|
92
|
+
declare function encodeCursor(payload: CursorPayload): string;
|
|
93
|
+
declare function decodeCursor(cursor: string | null | undefined): CursorPayload | null;
|
|
94
|
+
interface PageInfo {
|
|
95
|
+
hasNextPage: boolean;
|
|
96
|
+
hasPreviousPage: boolean;
|
|
97
|
+
startCursor: string | null;
|
|
98
|
+
endCursor: string | null;
|
|
99
|
+
}
|
|
100
|
+
interface ConnectionEdge<TItem> {
|
|
101
|
+
node: TItem;
|
|
102
|
+
cursor: string;
|
|
103
|
+
}
|
|
104
|
+
interface ConnectionResult<TItem> {
|
|
105
|
+
edges: ConnectionEdge<TItem>[];
|
|
106
|
+
nodes: TItem[];
|
|
107
|
+
pageInfo: PageInfo;
|
|
108
|
+
totalCount?: number | null;
|
|
109
|
+
}
|
|
110
|
+
interface BuildConnectionOptions<TItem> {
|
|
111
|
+
limit: number;
|
|
112
|
+
cursorForNode: (item: TItem) => string;
|
|
113
|
+
hasPreviousPage?: boolean;
|
|
114
|
+
totalCount?: number | null;
|
|
115
|
+
}
|
|
116
|
+
declare function buildConnection<TItem>(items: TItem[], opts: BuildConnectionOptions<TItem>): ConnectionResult<TItem>;
|
|
117
|
+
interface OffsetPageResult<TItem> {
|
|
118
|
+
items: TItem[];
|
|
119
|
+
total: number;
|
|
120
|
+
limit: number;
|
|
121
|
+
offset: number;
|
|
122
|
+
hasMore: boolean;
|
|
123
|
+
nextOffset: number | null;
|
|
124
|
+
}
|
|
125
|
+
declare function buildOffsetPage<TItem>(items: TItem[], total: number, pagination: NormalizedOffsetPagination): OffsetPageResult<TItem>;
|
|
126
|
+
interface PaginateInput<TWhere, TOrderBy> {
|
|
127
|
+
take?: number | null;
|
|
128
|
+
cursor?: string | null;
|
|
129
|
+
where?: TWhere;
|
|
130
|
+
orderBy?: TOrderBy;
|
|
131
|
+
}
|
|
132
|
+
interface PaginateResult<TItem> {
|
|
133
|
+
items: TItem[];
|
|
134
|
+
hasMore: boolean;
|
|
135
|
+
nextCursor: string | null;
|
|
136
|
+
}
|
|
137
|
+
interface PrismaModelLike<TItem, TWhere, TOrderBy> {
|
|
138
|
+
findMany(args: {
|
|
139
|
+
take?: number;
|
|
140
|
+
skip?: number;
|
|
141
|
+
cursor?: {
|
|
142
|
+
id: string;
|
|
143
|
+
};
|
|
144
|
+
where?: TWhere;
|
|
145
|
+
orderBy?: TOrderBy;
|
|
146
|
+
}): Promise<TItem[]>;
|
|
147
|
+
}
|
|
148
|
+
declare function paginate<TItem extends {
|
|
149
|
+
id: string;
|
|
150
|
+
}, TWhere = unknown, TOrderBy = unknown>(model: PrismaModelLike<TItem, TWhere, TOrderBy>, input: PaginateInput<TWhere, TOrderBy>, opts?: ClampLimitOptions): Promise<PaginateResult<TItem>>;
|
|
151
|
+
|
|
152
|
+
interface DataLoaderLike<K, V> {
|
|
153
|
+
load(key: K): Promise<V>;
|
|
154
|
+
loadMany(keys: readonly K[]): Promise<(V | Error)[]>;
|
|
155
|
+
clear(key: K): this;
|
|
156
|
+
clearAll(): this;
|
|
157
|
+
prime(key: K, value: V): this;
|
|
158
|
+
}
|
|
159
|
+
type LoaderMap = Record<string, DataLoaderLike<unknown, unknown>>;
|
|
160
|
+
type LoaderBuilder<Ctx, M extends LoaderMap> = (ctx: Ctx) => M;
|
|
161
|
+
declare function buildLoaders<Ctx, M extends LoaderMap>(ctx: Ctx, builder: LoaderBuilder<Ctx, M>): M;
|
|
162
|
+
interface ReferenceObject {
|
|
163
|
+
id?: string;
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
}
|
|
166
|
+
declare function resolveReferenceLoader<T, Ctx extends {
|
|
167
|
+
loaders: LoaderMap;
|
|
168
|
+
}>(loaderName: string, keyField?: string): (reference: ReferenceObject, ctx: Ctx) => Promise<T | null>;
|
|
169
|
+
|
|
170
|
+
interface CacheVersionRedis {
|
|
171
|
+
get(key: string): Promise<string | null>;
|
|
172
|
+
incr(key: string): Promise<number>;
|
|
173
|
+
}
|
|
174
|
+
declare function getNamespaceVersion(redis: CacheVersionRedis, namespace: string): Promise<number>;
|
|
175
|
+
declare function buildCacheKey(redis: CacheVersionRedis, namespace: string, ...parts: string[]): Promise<string>;
|
|
176
|
+
declare function invalidateNamespace(redis: CacheVersionRedis, namespace: string): Promise<number>;
|
|
177
|
+
|
|
178
|
+
interface PrismaRawClient {
|
|
179
|
+
$executeRawUnsafe(query: string, ...values: unknown[]): Promise<unknown>;
|
|
180
|
+
$queryRawUnsafe<T = unknown>(query: string, ...values: unknown[]): Promise<T>;
|
|
181
|
+
}
|
|
182
|
+
declare function monthlyPartitionName(table: string, year: number, month: number): string;
|
|
183
|
+
interface EnsureMonthlyOptions {
|
|
184
|
+
table: string;
|
|
185
|
+
from: Date;
|
|
186
|
+
to: Date;
|
|
187
|
+
}
|
|
188
|
+
declare function ensureMonthlyPartitions(prisma: PrismaRawClient, opts: EnsureMonthlyOptions): Promise<string[]>;
|
|
189
|
+
interface DropOldOptions {
|
|
190
|
+
table: string;
|
|
191
|
+
beforeDate: Date;
|
|
192
|
+
}
|
|
193
|
+
declare function dropOldPartitions(prisma: PrismaRawClient, opts: DropOldOptions): Promise<string[]>;
|
|
194
|
+
|
|
195
|
+
interface LLMRequest {
|
|
196
|
+
model?: string;
|
|
197
|
+
messages: Array<{
|
|
198
|
+
role: 'system' | 'user' | 'assistant';
|
|
199
|
+
content: string;
|
|
200
|
+
}>;
|
|
201
|
+
maxTokens?: number;
|
|
202
|
+
temperature?: number;
|
|
203
|
+
stream?: boolean;
|
|
204
|
+
timeoutMs?: number;
|
|
205
|
+
}
|
|
206
|
+
interface LLMResponse {
|
|
207
|
+
provider: string;
|
|
208
|
+
content: string;
|
|
209
|
+
inputTokens?: number;
|
|
210
|
+
outputTokens?: number;
|
|
211
|
+
raw?: unknown;
|
|
212
|
+
}
|
|
213
|
+
interface LLMProviderAdapter {
|
|
214
|
+
name: string;
|
|
215
|
+
complete(req: LLMRequest, signal: AbortSignal): Promise<LLMResponse>;
|
|
216
|
+
}
|
|
217
|
+
interface LLMRouterOptions {
|
|
218
|
+
timeoutMs?: number;
|
|
219
|
+
maxAttempts?: number;
|
|
220
|
+
initialDelayMs?: number;
|
|
221
|
+
maxOutputTokensCap?: number;
|
|
222
|
+
}
|
|
223
|
+
declare class LLMRouter {
|
|
224
|
+
private readonly adapters;
|
|
225
|
+
private readonly opts;
|
|
226
|
+
constructor(opts?: LLMRouterOptions);
|
|
227
|
+
register(adapter: LLMProviderAdapter): void;
|
|
228
|
+
private resolveChain;
|
|
229
|
+
complete(req: LLMRequest): Promise<LLMResponse>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
type index_BreakerConfig = BreakerConfig;
|
|
233
|
+
type index_BuildConnectionOptions<TItem> = BuildConnectionOptions<TItem>;
|
|
234
|
+
type index_CacheVersionRedis = CacheVersionRedis;
|
|
235
|
+
type index_CircuitBreakerOpenError = CircuitBreakerOpenError;
|
|
236
|
+
declare const index_CircuitBreakerOpenError: typeof CircuitBreakerOpenError;
|
|
237
|
+
type index_ClampLimitOptions = ClampLimitOptions;
|
|
238
|
+
type index_ConnectionEdge<TItem> = ConnectionEdge<TItem>;
|
|
239
|
+
type index_ConnectionResult<TItem> = ConnectionResult<TItem>;
|
|
240
|
+
type index_CursorPaginationInput = CursorPaginationInput;
|
|
241
|
+
type index_CursorPayload = CursorPayload;
|
|
242
|
+
type index_CursorPayloadValue = CursorPayloadValue;
|
|
243
|
+
declare const index_DEFAULT_GRAPHQL_PAGE_LIMIT: typeof DEFAULT_GRAPHQL_PAGE_LIMIT;
|
|
244
|
+
type index_DataLoaderLike<K, V> = DataLoaderLike<K, V>;
|
|
245
|
+
type index_DropOldOptions = DropOldOptions;
|
|
246
|
+
type index_EnsureMonthlyOptions = EnsureMonthlyOptions;
|
|
247
|
+
type index_HttpClientConfig = HttpClientConfig;
|
|
248
|
+
type index_HttpClientInit = HttpClientInit;
|
|
249
|
+
type index_LLMProviderAdapter = LLMProviderAdapter;
|
|
250
|
+
type index_LLMRequest = LLMRequest;
|
|
251
|
+
type index_LLMResponse = LLMResponse;
|
|
252
|
+
type index_LLMRouter = LLMRouter;
|
|
253
|
+
declare const index_LLMRouter: typeof LLMRouter;
|
|
254
|
+
type index_LLMRouterOptions = LLMRouterOptions;
|
|
255
|
+
type index_LeaderLockOptions = LeaderLockOptions;
|
|
256
|
+
type index_LeaderLockRedis = LeaderLockRedis;
|
|
257
|
+
type index_LeaderLockResult<T> = LeaderLockResult<T>;
|
|
258
|
+
type index_LoaderBuilder<Ctx, M extends LoaderMap> = LoaderBuilder<Ctx, M>;
|
|
259
|
+
type index_LoaderMap = LoaderMap;
|
|
260
|
+
declare const index_MAX_GRAPHQL_PAGE_LIMIT: typeof MAX_GRAPHQL_PAGE_LIMIT;
|
|
261
|
+
type index_NormalizedCursorPagination = NormalizedCursorPagination;
|
|
262
|
+
type index_NormalizedOffsetPagination = NormalizedOffsetPagination;
|
|
263
|
+
type index_OffsetPageResult<TItem> = OffsetPageResult<TItem>;
|
|
264
|
+
type index_OffsetPaginationInput = OffsetPaginationInput;
|
|
265
|
+
type index_PageInfo = PageInfo;
|
|
266
|
+
type index_PaginateInput<TWhere, TOrderBy> = PaginateInput<TWhere, TOrderBy>;
|
|
267
|
+
type index_PaginateResult<TItem> = PaginateResult<TItem>;
|
|
268
|
+
type index_PrismaModelLike<TItem, TWhere, TOrderBy> = PrismaModelLike<TItem, TWhere, TOrderBy>;
|
|
269
|
+
type index_PrismaRawClient = PrismaRawClient;
|
|
270
|
+
type index_RateLimitInput = RateLimitInput;
|
|
271
|
+
type index_RateLimitRedis = RateLimitRedis;
|
|
272
|
+
type index_RateLimitResult = RateLimitResult;
|
|
273
|
+
type index_ReferenceObject = ReferenceObject;
|
|
274
|
+
type index_RetryConfig = RetryConfig;
|
|
275
|
+
declare const index___resetHttpClientBreakers: typeof __resetHttpClientBreakers;
|
|
276
|
+
declare const index_buildCacheKey: typeof buildCacheKey;
|
|
277
|
+
declare const index_buildConnection: typeof buildConnection;
|
|
278
|
+
declare const index_buildLoaders: typeof buildLoaders;
|
|
279
|
+
declare const index_buildOffsetPage: typeof buildOffsetPage;
|
|
280
|
+
declare const index_clampGraphqlLimit: typeof clampGraphqlLimit;
|
|
281
|
+
declare const index_clampLimit: typeof clampLimit;
|
|
282
|
+
declare const index_clampOffset: typeof clampOffset;
|
|
283
|
+
declare const index_createHttpClient: typeof createHttpClient;
|
|
284
|
+
declare const index_decodeCursor: typeof decodeCursor;
|
|
285
|
+
declare const index_dropOldPartitions: typeof dropOldPartitions;
|
|
286
|
+
declare const index_encodeCursor: typeof encodeCursor;
|
|
287
|
+
declare const index_ensureMonthlyPartitions: typeof ensureMonthlyPartitions;
|
|
288
|
+
declare const index_getNamespaceVersion: typeof getNamespaceVersion;
|
|
289
|
+
declare const index_httpClient: typeof httpClient;
|
|
290
|
+
declare const index_invalidateNamespace: typeof invalidateNamespace;
|
|
291
|
+
declare const index_monthlyPartitionName: typeof monthlyPartitionName;
|
|
292
|
+
declare const index_normalizeCursorPagination: typeof normalizeCursorPagination;
|
|
293
|
+
declare const index_normalizeOffsetPagination: typeof normalizeOffsetPagination;
|
|
294
|
+
declare const index_paginate: typeof paginate;
|
|
295
|
+
declare const index_rateLimitIncr: typeof rateLimitIncr;
|
|
296
|
+
declare const index_resolveReferenceLoader: typeof resolveReferenceLoader;
|
|
297
|
+
declare const index_withLeaderLock: typeof withLeaderLock;
|
|
298
|
+
declare namespace index {
|
|
299
|
+
export { type index_BreakerConfig as BreakerConfig, type index_BuildConnectionOptions as BuildConnectionOptions, type index_CacheVersionRedis as CacheVersionRedis, index_CircuitBreakerOpenError as CircuitBreakerOpenError, type index_ClampLimitOptions as ClampLimitOptions, type index_ConnectionEdge as ConnectionEdge, type index_ConnectionResult as ConnectionResult, type index_CursorPaginationInput as CursorPaginationInput, type index_CursorPayload as CursorPayload, type index_CursorPayloadValue as CursorPayloadValue, index_DEFAULT_GRAPHQL_PAGE_LIMIT as DEFAULT_GRAPHQL_PAGE_LIMIT, type index_DataLoaderLike as DataLoaderLike, type index_DropOldOptions as DropOldOptions, type index_EnsureMonthlyOptions as EnsureMonthlyOptions, type index_HttpClientConfig as HttpClientConfig, type index_HttpClientInit as HttpClientInit, type index_LLMProviderAdapter as LLMProviderAdapter, type index_LLMRequest as LLMRequest, type index_LLMResponse as LLMResponse, index_LLMRouter as LLMRouter, type index_LLMRouterOptions as LLMRouterOptions, type index_LeaderLockOptions as LeaderLockOptions, type index_LeaderLockRedis as LeaderLockRedis, type index_LeaderLockResult as LeaderLockResult, type index_LoaderBuilder as LoaderBuilder, type index_LoaderMap as LoaderMap, index_MAX_GRAPHQL_PAGE_LIMIT as MAX_GRAPHQL_PAGE_LIMIT, type index_NormalizedCursorPagination as NormalizedCursorPagination, type index_NormalizedOffsetPagination as NormalizedOffsetPagination, type index_OffsetPageResult as OffsetPageResult, type index_OffsetPaginationInput as OffsetPaginationInput, type index_PageInfo as PageInfo, type index_PaginateInput as PaginateInput, type index_PaginateResult as PaginateResult, type index_PrismaModelLike as PrismaModelLike, type index_PrismaRawClient as PrismaRawClient, type index_RateLimitInput as RateLimitInput, type index_RateLimitRedis as RateLimitRedis, type index_RateLimitResult as RateLimitResult, type index_ReferenceObject as ReferenceObject, type index_RetryConfig as RetryConfig, index___resetHttpClientBreakers as __resetHttpClientBreakers, index_buildCacheKey as buildCacheKey, index_buildConnection as buildConnection, index_buildLoaders as buildLoaders, index_buildOffsetPage as buildOffsetPage, index_clampGraphqlLimit as clampGraphqlLimit, index_clampLimit as clampLimit, index_clampOffset as clampOffset, index_createHttpClient as createHttpClient, index_decodeCursor as decodeCursor, index_dropOldPartitions as dropOldPartitions, index_encodeCursor as encodeCursor, index_ensureMonthlyPartitions as ensureMonthlyPartitions, index_getNamespaceVersion as getNamespaceVersion, index_httpClient as httpClient, index_invalidateNamespace as invalidateNamespace, index_monthlyPartitionName as monthlyPartitionName, index_normalizeCursorPagination as normalizeCursorPagination, index_normalizeOffsetPagination as normalizeOffsetPagination, index_paginate as paginate, index_rateLimitIncr as rateLimitIncr, index_resolveReferenceLoader as resolveReferenceLoader, index_withLeaderLock as withLeaderLock };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export { encodeCursor as $, type PrismaRawClient as A, type BreakerConfig as B, type CacheVersionRedis as C, DEFAULT_GRAPHQL_PAGE_LIMIT as D, type EnsureMonthlyOptions as E, type RateLimitRedis as F, type RateLimitResult as G, type HttpClientConfig as H, type ReferenceObject as I, type RetryConfig as J, buildCacheKey as K, type LLMProviderAdapter as L, MAX_GRAPHQL_PAGE_LIMIT as M, type NormalizedCursorPagination as N, type OffsetPageResult as O, type PageInfo as P, buildConnection as Q, type RateLimitInput as R, buildLoaders as S, buildOffsetPage as T, clampGraphqlLimit as U, clampLimit as V, clampOffset as W, createHttpClient as X, decodeCursor as Y, dropOldPartitions as Z, __resetHttpClientBreakers as _, type BuildConnectionOptions as a, ensureMonthlyPartitions as a0, getNamespaceVersion as a1, httpClient as a2, invalidateNamespace as a3, monthlyPartitionName as a4, normalizeCursorPagination as a5, normalizeOffsetPagination as a6, paginate as a7, rateLimitIncr as a8, resolveReferenceLoader as a9, withLeaderLock as aa, CircuitBreakerOpenError as b, type ClampLimitOptions as c, type ConnectionEdge as d, type ConnectionResult as e, type CursorPaginationInput as f, type CursorPayload as g, type CursorPayloadValue as h, index as i, type DataLoaderLike as j, type DropOldOptions as k, type HttpClientInit as l, type LLMRequest as m, type LLMResponse as n, LLMRouter as o, type LLMRouterOptions as p, type LeaderLockOptions as q, type LeaderLockRedis as r, type LeaderLockResult as s, type LoaderBuilder as t, type LoaderMap as u, type NormalizedOffsetPagination as v, type OffsetPaginationInput as w, type PaginateInput as x, type PaginateResult as y, type PrismaModelLike as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export { i as Crypto } from './index-e_18DzAg.js';
|
|
|
35
35
|
export { i as Gateway } from './index-Bm6MYdqS.js';
|
|
36
36
|
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
|
-
export { i as Platform } from './index-
|
|
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
40
|
import './types-sKXodL2N.js';
|
|
41
41
|
import 'graphql';
|
package/dist/index.js
CHANGED
|
@@ -10,10 +10,10 @@ export { RBACModule, createRBACDirective, createRBACDirectiveForLayer, createRBA
|
|
|
10
10
|
export { instrumentation_exports as Instrumentation } from './chunk-ACYGOENW.js';
|
|
11
11
|
import './chunk-REF7PANB.js';
|
|
12
12
|
export { middleware_exports as Middleware } from './chunk-2HANKZZM.js';
|
|
13
|
-
export { observability_exports as Observability } from './chunk-5LXDPGDH.js';
|
|
14
13
|
import { TenantNotificationsModule, NotificationsModule } from './chunk-IUL5TEKE.js';
|
|
15
14
|
export { tenant_notifications_exports as Notifications, NotificationsModule } from './chunk-IUL5TEKE.js';
|
|
16
|
-
export {
|
|
15
|
+
export { observability_exports as Observability } from './chunk-5LXDPGDH.js';
|
|
16
|
+
export { platform_exports as Platform } from './chunk-UCLDHOZC.js';
|
|
17
17
|
export { export_exports as Export } from './chunk-UJI2S556.js';
|
|
18
18
|
export { feature_flags_exports as FeatureFlags } from './chunk-YEA4BZOL.js';
|
|
19
19
|
import { GraphModule } from './chunk-Z2423JIB.js';
|
|
@@ -41,13 +41,13 @@ export { utils_exports as Utils } from './chunk-B7I4TABG.js';
|
|
|
41
41
|
export { cache_exports as Cache } from './chunk-UYE4IEPT.js';
|
|
42
42
|
export { captcha_exports as Captcha, isCaptchaEnabled, verifyCaptcha, verifyCaptchaIfEnabled } from './chunk-YMZEUTD2.js';
|
|
43
43
|
export { createInternalClient, createInternalClientForTenant, createInternalClientForWorkspaces } from './chunk-VI4VSNTI.js';
|
|
44
|
+
export { crypto_exports as Crypto } from './chunk-SBS4S2PJ.js';
|
|
44
45
|
import { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
45
46
|
export { DatabaseModule } from './chunk-4OQRBSHM.js';
|
|
46
47
|
import { APIError, NetworkError, TimeoutError, ValidationError } from './chunk-EZ4PKRUK.js';
|
|
47
48
|
export { DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_GATEWAY_RETRY_CONFIG, DEFAULT_GATEWAY_ROUTING, DEFAULT_LAYER_RESOURCES, DEFAULT_LAYER_STREAMS } from './chunk-YFOHAHZE.js';
|
|
48
49
|
import { logger } from './chunk-CBZNP6RF.js';
|
|
49
50
|
export { logger_exports as Logger } from './chunk-CBZNP6RF.js';
|
|
50
|
-
export { crypto_exports as Crypto } from './chunk-SBS4S2PJ.js';
|
|
51
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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"pino-logger-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"pino-logger-TSRWXWIU.js"}
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BreakerConfig, C as CacheVersionRedis,
|
|
1
|
+
export { B as BreakerConfig, a as BuildConnectionOptions, C as CacheVersionRedis, b as CircuitBreakerOpenError, c as ClampLimitOptions, d as ConnectionEdge, e as ConnectionResult, f as CursorPaginationInput, g as CursorPayload, h as CursorPayloadValue, D as DEFAULT_GRAPHQL_PAGE_LIMIT, j as DataLoaderLike, k as DropOldOptions, E as EnsureMonthlyOptions, H as HttpClientConfig, l as HttpClientInit, L as LLMProviderAdapter, m as LLMRequest, n as LLMResponse, o as LLMRouter, p as LLMRouterOptions, q as LeaderLockOptions, r as LeaderLockRedis, s as LeaderLockResult, t as LoaderBuilder, u as LoaderMap, M as MAX_GRAPHQL_PAGE_LIMIT, N as NormalizedCursorPagination, v as NormalizedOffsetPagination, O as OffsetPageResult, w as OffsetPaginationInput, P as PageInfo, x as PaginateInput, y as PaginateResult, z as PrismaModelLike, A as PrismaRawClient, R as RateLimitInput, F as RateLimitRedis, G as RateLimitResult, I as ReferenceObject, J as RetryConfig, _ as __resetHttpClientBreakers, K as buildCacheKey, Q as buildConnection, S as buildLoaders, T as buildOffsetPage, U as clampGraphqlLimit, V as clampLimit, W as clampOffset, X as createHttpClient, Y as decodeCursor, Z as dropOldPartitions, $ as encodeCursor, a0 as ensureMonthlyPartitions, a1 as getNamespaceVersion, a2 as httpClient, a3 as invalidateNamespace, a4 as monthlyPartitionName, a5 as normalizeCursorPagination, a6 as normalizeOffsetPagination, a7 as paginate, a8 as rateLimitIncr, a9 as resolveReferenceLoader, aa as withLeaderLock } from '../index-DgWLSDv2.js';
|
package/dist/platform/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CircuitBreakerOpenError, LLMRouter, __resetHttpClientBreakers, buildCacheKey, buildLoaders, clampLimit, createHttpClient, dropOldPartitions, ensureMonthlyPartitions, getNamespaceVersion, httpClient, invalidateNamespace, monthlyPartitionName, paginate, rateLimitIncr, resolveReferenceLoader, withLeaderLock } from '../chunk-
|
|
1
|
+
export { CircuitBreakerOpenError, DEFAULT_GRAPHQL_PAGE_LIMIT, LLMRouter, MAX_GRAPHQL_PAGE_LIMIT, __resetHttpClientBreakers, buildCacheKey, buildConnection, buildLoaders, buildOffsetPage, clampGraphqlLimit, clampLimit, clampOffset, createHttpClient, decodeCursor, dropOldPartitions, encodeCursor, ensureMonthlyPartitions, getNamespaceVersion, httpClient, invalidateNamespace, monthlyPartitionName, normalizeCursorPagination, normalizeOffsetPagination, paginate, rateLimitIncr, resolveReferenceLoader, withLeaderLock } from '../chunk-UCLDHOZC.js';
|
|
2
2
|
import '../chunk-CBZNP6RF.js';
|
|
3
3
|
import '../chunk-XE4OXN2W.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,2BAAc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A;AACZ,EAAA,MAAM0D,OAAAA,GAAU,IAAIxD,MAAAA,CAAOyD,OAAAA,CAAQ;AACjCL,IAAAA,QAAAA;AACAE,IAAAA,aAAAA;AACA,IAAA,GAAI5C,YAAAA,GAAe;AAAEA,MAAAA;AAAa,KAAA,GAAI,EAAC;AACvC,IAAA,GAAIc,OAAAA,GAAU;AAAEA,MAAAA;AAAQ,KAAA,GAAI,EAAC;AAC7B,IAAA,GAAIU,oBAAAA,GAAuB;MAAEwB,gBAAAA,EAAkBxB;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/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 {
|