Skip to content

Commit 896d8d6

Browse files
committed
Exports types, classes and interfaces
1 parent 0d0eeaa commit 896d8d6

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

index.d.ts

+35-40
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export = agent;
66

77
declare const agent: Agent;
88

9-
declare class Agent implements Taggable, StartSpanFn {
9+
export declare class Agent implements Taggable, StartSpanFn {
1010
// Configuration
1111
start (options?: AgentConfigOptions): Agent;
1212
isStarted (): boolean;
@@ -40,11 +40,6 @@ declare class Agent implements Taggable, StartSpanFn {
4040

4141
// Distributed Tracing
4242
currentTraceparent: string | null;
43-
currentTraceIds: {
44-
'trace.id'?: string;
45-
'transaction.id'?: string;
46-
'span.id'?: string;
47-
}
4843

4944
// Transactions
5045
startTransaction(
@@ -120,7 +115,7 @@ declare class Agent implements Taggable, StartSpanFn {
120115
registerMetric(name: string, labels: Labels, callback: Function): void;
121116
}
122117

123-
declare class GenericSpan implements Taggable {
118+
export declare class GenericSpan implements Taggable {
124119
// The following properties and methods are currently not documented as their API isn't considered official:
125120
// timestamp, ended, id, traceId, parentId, sampled, duration()
126121

@@ -134,7 +129,7 @@ declare class GenericSpan implements Taggable {
134129
addLabels (labels: Labels): boolean;
135130
}
136131

137-
declare class Transaction extends GenericSpan implements StartSpanFn {
132+
export declare class Transaction extends GenericSpan implements StartSpanFn {
138133
// The following properties and methods are currently not documented as their API isn't considered official:
139134
// setUserContext(), setCustomContext(), toJSON(), setDefaultName(), setDefaultNameFromRequest()
140135

@@ -167,7 +162,7 @@ declare class Transaction extends GenericSpan implements StartSpanFn {
167162
end (result?: string | number | null, endTime?: number): void;
168163
}
169164

170-
declare class Span extends GenericSpan {
165+
export declare class Span extends GenericSpan {
171166
// The following properties and methods are currently not documented as their API isn't considered official:
172167
// customStackTrace(), setDbContext()
173168

@@ -177,7 +172,7 @@ declare class Span extends GenericSpan {
177172
end (endTime?: number): void;
178173
}
179174

180-
interface AgentConfigOptions {
175+
export interface AgentConfigOptions {
181176
abortedErrorThreshold?: string; // Also support `number`, but as we're removing this functionality soon, there's no need to advertise it
182177
active?: boolean;
183178
addPatch?: KeyValueConfig;
@@ -230,7 +225,7 @@ interface AgentConfigOptions {
230225
verifyServerCert?: boolean;
231226
}
232227

233-
interface CaptureErrorOptions {
228+
export interface CaptureErrorOptions {
234229
request?: IncomingMessage;
235230
response?: ServerResponse;
236231
timestamp?: number;
@@ -242,22 +237,22 @@ interface CaptureErrorOptions {
242237
message?: string;
243238
}
244239

245-
interface Labels {
240+
export interface Labels {
246241
[key: string]: LabelValue;
247242
}
248243

249-
interface UserObject {
244+
export interface UserObject {
250245
id?: string | number;
251246
username?: string;
252247
email?: string;
253248
}
254249

255-
interface ParameterizedMessageObject {
250+
export interface ParameterizedMessageObject {
256251
message: string;
257252
params: Array<any>;
258253
}
259254

260-
interface Logger {
255+
export interface Logger {
261256
fatal (msg: string, ...args: any[]): void;
262257
fatal (obj: {}, msg?: string, ...args: any[]): void;
263258
error (msg: string, ...args: any[]): void;
@@ -273,39 +268,39 @@ interface Logger {
273268
[propName: string]: any;
274269
}
275270

276-
interface TransactionOptions {
271+
export interface TransactionOptions {
277272
startTime?: number;
278273
childOf?: Transaction | Span | string;
279274
}
280275

281-
interface SpanOptions {
276+
export interface SpanOptions {
282277
childOf?: Transaction | Span | string;
283278
}
284279

285-
type CaptureBody = 'off' | 'errors' | 'transactions' | 'all';
286-
type CaptureErrorLogStackTraces = 'never' | 'messages' | 'always';
287-
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
280+
export type CaptureBody = 'off' | 'errors' | 'transactions' | 'all';
281+
export type CaptureErrorLogStackTraces = 'never' | 'messages' | 'always';
282+
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
288283

289-
type CaptureErrorCallback = (err: Error | null, id: string) => void;
290-
type FilterFn = (payload: Payload) => Payload | boolean | void;
291-
type LabelValue = string | number | boolean | null | undefined;
292-
type KeyValueConfig = string | Labels | Array<Array<LabelValue>>
284+
export type CaptureErrorCallback = (err: Error | null, id: string) => void;
285+
export type FilterFn = (payload: Payload) => Payload | boolean | void;
286+
export type LabelValue = string | number | boolean | null | undefined;
287+
export type KeyValueConfig = string | Labels | Array<Array<LabelValue>>
293288

294-
type Payload = { [propName: string]: any }
289+
export type Payload = { [propName: string]: any }
295290

296-
type PatchHandler = (exports: any, agent: Agent, options: PatchOptions) => any;
291+
export type PatchHandler = (exports: any, agent: Agent, options: PatchOptions) => any;
297292

298-
interface PatchOptions {
293+
export interface PatchOptions {
299294
version: string | undefined,
300295
enabled: boolean
301296
}
302297

303-
interface Taggable {
298+
export interface Taggable {
304299
setLabel (name: string, value: LabelValue): boolean;
305300
addLabels (labels: Labels): boolean;
306301
}
307302

308-
interface StartSpanFn {
303+
export interface StartSpanFn {
309304
startSpan(
310305
name?: string | null,
311306
options?: SpanOptions
@@ -331,37 +326,37 @@ interface StartSpanFn {
331326
}
332327

333328
// Inlined from @types/aws-lambda - start
334-
declare namespace AwsLambda {
335-
interface CognitoIdentity {
329+
export declare namespace AwsLambda {
330+
export interface CognitoIdentity {
336331
cognitoIdentityId: string;
337332
cognitoIdentityPoolId: string;
338333
}
339334

340-
interface ClientContext {
335+
export interface ClientContext {
341336
client: ClientContextClient;
342337
custom?: any;
343338
env: ClientContextEnv;
344339
}
345340

346-
interface ClientContextClient {
341+
export interface ClientContextClient {
347342
installationId: string;
348343
appTitle: string;
349344
appVersionName: string;
350345
appVersionCode: string;
351346
appPackageName: string;
352347
}
353348

354-
interface ClientContextEnv {
349+
export interface ClientContextEnv {
355350
platformVersion: string;
356351
platform: string;
357352
make: string;
358353
model: string;
359354
locale: string;
360355
}
361356

362-
type Callback<TResult = any> = (error?: Error | null | string, result?: TResult) => void;
357+
export type Callback<TResult = any> = (error?: Error | null | string, result?: TResult) => void;
363358

364-
interface Context {
359+
export interface Context {
365360
// Properties
366361
callbackWaitsForEmptyEventLoop: boolean;
367362
functionName: string;
@@ -385,15 +380,15 @@ declare namespace AwsLambda {
385380
succeed(message: string, object: any): void;
386381
}
387382

388-
type Handler<TEvent = any, TResult = any> = (
383+
export type Handler<TEvent = any, TResult = any> = (
389384
event: TEvent,
390385
context: Context,
391386
callback: Callback<TResult>,
392387
) => void | Promise<TResult>;
393388
}
394389

395390
// Inlined from @types/connect - start
396-
declare namespace Connect {
397-
type NextFunction = (err?: any) => void;
398-
type ErrorHandleFunction = (err: any, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
391+
export declare namespace Connect {
392+
export type NextFunction = (err?: any) => void;
393+
export type ErrorHandleFunction = (err: any, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
399394
}

0 commit comments

Comments
 (0)