@arcote.tech/arc 0.1.12 → 0.3.0
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/adapters/auth-adapter.d.ts +47 -0
- package/dist/adapters/command-wire.d.ts +28 -0
- package/dist/adapters/event-publisher.d.ts +106 -0
- package/dist/adapters/event-wire.d.ts +79 -0
- package/dist/adapters/index.d.ts +18 -0
- package/dist/adapters/wire.d.ts +20 -0
- package/dist/context/context.d.ts +49 -52
- package/dist/context/index.d.ts +1 -10
- package/dist/context-element/command/command-context.d.ts +71 -0
- package/dist/context-element/command/command-data.d.ts +33 -0
- package/dist/context-element/command/command-handler.d.ts +6 -0
- package/dist/context-element/command/command.d.ts +198 -0
- package/dist/context-element/command/index.d.ts +6 -0
- package/dist/context-element/context-element.d.ts +75 -0
- package/dist/context-element/event/event-data.d.ts +35 -0
- package/dist/context-element/event/event.d.ts +158 -0
- package/dist/context-element/event/index.d.ts +5 -0
- package/dist/context-element/event/instance.d.ts +26 -0
- package/dist/context-element/index.d.ts +10 -0
- package/dist/context-element/view/index.d.ts +5 -0
- package/dist/context-element/view/view-context.d.ts +51 -0
- package/dist/context-element/view/view-data.d.ts +40 -0
- package/dist/context-element/view/view.d.ts +194 -0
- package/dist/data-storage/data-storage-forked.d.ts +1 -1
- package/dist/data-storage/data-storage-master.d.ts +7 -10
- package/dist/data-storage/data-storage-observable.d.ts +61 -0
- package/dist/data-storage/data-storage.abstract.d.ts +1 -1
- package/dist/{db/interface.d.ts → data-storage/database-adapter.d.ts} +8 -3
- package/dist/{database → data-storage}/database-store.d.ts +45 -0
- package/dist/data-storage/{types.d.ts → find-options.d.ts} +1 -1
- package/dist/data-storage/index.d.ts +6 -2
- package/dist/{db/postgresAdapter.d.ts → data-storage/postgresql-adapter.d.ts} +7 -33
- package/dist/data-storage/query-result-resolver.d.ts +18 -0
- package/dist/data-storage/query-result-resolver.test.d.ts +2 -0
- package/dist/{db/sqliteAdapter.d.ts → data-storage/sqlite-adapter.d.ts} +5 -31
- package/dist/data-storage/store-state-fork.d.ts +1 -1
- package/dist/data-storage/store-state-master.d.ts +6 -2
- package/dist/data-storage/store-state.abstract.d.ts +1 -1
- package/dist/elements/abstract.d.ts +1 -1
- package/dist/elements/any.d.ts +1 -1
- package/dist/elements/array.d.ts +5 -5
- package/dist/elements/blob.d.ts +1 -1
- package/dist/elements/boolean.d.ts +1 -1
- package/dist/elements/branded.d.ts +5 -5
- package/dist/elements/date.d.ts +1 -1
- package/dist/elements/default.d.ts +5 -5
- package/dist/elements/file.d.ts +1 -1
- package/dist/elements/id.d.ts +3 -3
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/number.d.ts +1 -1
- package/dist/elements/object.d.ts +11 -10
- package/dist/elements/optional.d.ts +5 -5
- package/dist/elements/or.d.ts +5 -5
- package/dist/elements/record.d.ts +3 -3
- package/dist/elements/string-enum.d.ts +1 -1
- package/dist/elements/string.d.ts +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2373 -3439
- package/dist/model/index.d.ts +2 -0
- package/dist/model/live-query/index.d.ts +2 -0
- package/dist/model/live-query/live-query.d.ts +31 -0
- package/dist/model/live-query/query-cache.d.ts +60 -0
- package/dist/model/model-adapters.d.ts +13 -0
- package/dist/model/model.d.ts +19 -78
- package/dist/model/mutation-executor/index.d.ts +2 -0
- package/dist/model/mutation-executor/mutation-executor.d.ts +29 -0
- package/dist/token/index.d.ts +41 -0
- package/dist/token/secured-data-storage.d.ts +125 -0
- package/dist/token/token-cache.d.ts +100 -0
- package/dist/token/token-data.d.ts +38 -0
- package/dist/token/token-instance.d.ts +71 -0
- package/dist/token/token.d.ts +127 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/types/add-question-marks.d.ts +9 -0
- package/dist/utils/types/first-argument.d.ts +5 -0
- package/dist/utils/types/get-type.d.ts +13 -0
- package/dist/utils/types/index.d.ts +6 -0
- package/dist/utils/types/merge.d.ts +7 -0
- package/dist/utils/types/object-util.d.ts +6 -0
- package/dist/utils/types/simplify.d.ts +7 -0
- package/package.json +10 -6
- package/dist/command/command-definition.d.ts +0 -5
- package/dist/command/command.d.ts +0 -45
- package/dist/command/index.d.ts +0 -2
- package/dist/context/commands.d.ts +0 -12
- package/dist/context/element.d.ts +0 -80
- package/dist/context/event.d.ts +0 -45
- package/dist/context/query-builder-context.d.ts +0 -15
- package/dist/context/query-builders.d.ts +0 -17
- package/dist/context/query-cache.d.ts +0 -9
- package/dist/context/query.d.ts +0 -12
- package/dist/context/reactive-query.d.ts +0 -23
- package/dist/context/serializable-query.d.ts +0 -11
- package/dist/context/translator.d.ts +0 -4
- package/dist/database/database-mappers.d.ts +0 -39
- package/dist/database/index.d.ts +0 -3
- package/dist/db/index.d.ts +0 -4
- package/dist/listener/index.d.ts +0 -2
- package/dist/listener/listener.d.ts +0 -23
- package/dist/model/EventPublisher.d.ts +0 -12
- package/dist/model/event-publisher.d.ts +0 -12
- package/dist/query/query-definition.d.ts +0 -8
- package/dist/route/index.d.ts +0 -2
- package/dist/route/route.d.ts +0 -35
- package/dist/rtc/client.d.ts +0 -3
- package/dist/rtc/index.d.ts +0 -4
- package/dist/rtc/messages.d.ts +0 -20
- package/dist/rtc/rtc.d.ts +0 -11
- package/dist/server/query-handler.d.ts +0 -43
- package/dist/state/index.d.ts +0 -2
- package/dist/state/query-builder.d.ts +0 -2
- package/dist/state/query.d.ts +0 -2
- package/dist/state/state.d.ts +0 -2
- package/dist/strategies/cache-strategy.d.ts +0 -20
- package/dist/strategies/datastorage-strategy.d.ts +0 -15
- package/dist/strategies/index.d.ts +0 -7
- package/dist/strategies/leader-strategy.d.ts +0 -16
- package/dist/strategies/model-strategy.d.ts +0 -9
- package/dist/strategies/query-strategy.d.ts +0 -20
- package/dist/telemetry/context.d.ts +0 -65
- package/dist/telemetry/index.d.ts +0 -47
- package/dist/telemetry/interfaces.d.ts +0 -84
- package/dist/telemetry/logger.d.ts +0 -67
- package/dist/telemetry/no-op.d.ts +0 -54
- package/dist/telemetry/tracer.d.ts +0 -85
- package/dist/tests/context/context.test.d.ts +0 -2
- package/dist/tests/pipe.d.ts +0 -2
- package/dist/tests/query/advance-query.test.d.ts +0 -2
- package/dist/tests/query/collection-all.test.d.ts +0 -2
- package/dist/tests/utils/expect-not-false.d.ts +0 -2
- package/dist/tests/utils/sqlite-adapter.d.ts +0 -3
- package/dist/tests/utils/test-model.d.ts +0 -25
- package/dist/tests/validations/array.test.d.ts +0 -2
- package/dist/tests/validations/date.test.d.ts +0 -2
- package/dist/tests/validations/number.test.d.ts +0 -2
- package/dist/tests/validations/object.test.d.ts +0 -2
- package/dist/tests/validations/record.test.d.ts +0 -2
- package/dist/tests/validations/string-enum.test.d.ts +0 -2
- package/dist/tests/validations/string.test.d.ts +0 -2
- package/dist/utils.d.ts +0 -56
- package/dist/view/index.d.ts +0 -6
- package/dist/view/queries/abstract-view-query.d.ts +0 -19
- package/dist/view/queries/find-one.d.ts +0 -13
- package/dist/view/queries/find.d.ts +0 -21
- package/dist/view/queries/index.d.ts +0 -3
- package/dist/view/query-builders/find-one.d.ts +0 -14
- package/dist/view/query-builders/find.d.ts +0 -14
- package/dist/view/query-builders/index.d.ts +0 -2
- package/dist/view/query-builders/new-query-builder.d.ts +0 -2
- package/dist/view/record.d.ts +0 -4
- package/dist/view/static-view.d.ts +0 -43
- package/dist/view/view.d.ts +0 -68
- /package/dist/{database → data-storage}/schema-extraction.d.ts +0 -0
- /package/dist/{data-storage → utils}/deep-merge.d.ts +0 -0
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type QueryDefinition<TResult = any> = {
|
|
2
|
-
readonly contextElementName: string;
|
|
3
|
-
readonly queryAlias: string;
|
|
4
|
-
readonly parameters: any[];
|
|
5
|
-
readonly restrictions?: any;
|
|
6
|
-
};
|
|
7
|
-
export type QueryDefinitionResult<QD extends QueryDefinition> = QD extends QueryDefinition<infer T> ? T : unknown;
|
|
8
|
-
//# sourceMappingURL=query-definition.d.ts.map
|
package/dist/route/index.d.ts
DELETED
package/dist/route/route.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ArcCommandContext } from "../context";
|
|
2
|
-
import { ArcContextElement, type ArcContextElementAny } from "../context/element";
|
|
3
|
-
export type ArcRouteHandler<ContextElements extends ArcContextElementAny[]> = (ctx: ArcCommandContext<ContextElements>, request: Request, params: Record<string, string>, url: URL) => Promise<Response> | Response;
|
|
4
|
-
export type ArcRouteHandlers<ContextElements extends ArcContextElementAny[]> = {
|
|
5
|
-
[Method in "GET" | "POST" | "PUT" | "DELETE" | "PATCH"]?: ArcRouteHandler<ContextElements>;
|
|
6
|
-
};
|
|
7
|
-
export declare class ArcRoute<Name extends string, const Elements extends ArcContextElementAny[]> extends ArcContextElement<null, Name> {
|
|
8
|
-
readonly name: Name;
|
|
9
|
-
private _description?;
|
|
10
|
-
private _path?;
|
|
11
|
-
private _elements?;
|
|
12
|
-
private _handlers?;
|
|
13
|
-
private _isPublic;
|
|
14
|
-
constructor(name: Name);
|
|
15
|
-
use<const E extends ArcContextElementAny[]>(elements: E): ArcRoute<Name, E>;
|
|
16
|
-
description(description: string): ArcRoute<Name, Elements>;
|
|
17
|
-
path(path: string): ArcRoute<Name, Elements>;
|
|
18
|
-
public(): ArcRoute<Name, Elements>;
|
|
19
|
-
get isPublic(): boolean;
|
|
20
|
-
get routePath(): string;
|
|
21
|
-
handle(handlers: ArcRouteHandlers<Elements>): ArcRoute<Name, Elements>;
|
|
22
|
-
getHandler(method: string): ArcRouteHandler<Elements> | undefined;
|
|
23
|
-
matchesPath(pathname: string): {
|
|
24
|
-
matches: boolean;
|
|
25
|
-
params: Record<string, string>;
|
|
26
|
-
};
|
|
27
|
-
matchesRoutePath(pathname: string): {
|
|
28
|
-
matches: boolean;
|
|
29
|
-
isPublic: boolean;
|
|
30
|
-
params?: Record<string, string>;
|
|
31
|
-
};
|
|
32
|
-
private clone;
|
|
33
|
-
}
|
|
34
|
-
export declare function route<Name extends string>(name: Name): ArcRoute<Name, any[]>;
|
|
35
|
-
//# sourceMappingURL=route.d.ts.map
|
package/dist/rtc/client.d.ts
DELETED
package/dist/rtc/index.d.ts
DELETED
package/dist/rtc/messages.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { DataStorageChanges } from "../data-storage/data-storage.abstract";
|
|
2
|
-
export type MessageClientToHost = {
|
|
3
|
-
type: "sync";
|
|
4
|
-
lastDate: string | null;
|
|
5
|
-
} | {
|
|
6
|
-
type: "changes-executed";
|
|
7
|
-
changes: DataStorageChanges[];
|
|
8
|
-
};
|
|
9
|
-
export type MessageHostToClient = {
|
|
10
|
-
type: "sync-result";
|
|
11
|
-
store: string;
|
|
12
|
-
items: any[];
|
|
13
|
-
} | {
|
|
14
|
-
type: "state-changes";
|
|
15
|
-
changes: DataStorageChanges[];
|
|
16
|
-
} | {
|
|
17
|
-
type: "sync-done";
|
|
18
|
-
date: string;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=messages.d.ts.map
|
package/dist/rtc/rtc.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MasterDataStorage } from "../data-storage";
|
|
2
|
-
import type { DataStorageChanges } from "../data-storage/data-storage.abstract";
|
|
3
|
-
export interface RealTimeCommunicationAdapter {
|
|
4
|
-
commitChanges(changes: DataStorageChanges[]): void;
|
|
5
|
-
sync(progressCallback: ({ store, size }: {
|
|
6
|
-
store: string;
|
|
7
|
-
size: number;
|
|
8
|
-
}) => void): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export type RealTimeCommunicationAdapterFactory = (storage: MasterDataStorage) => RealTimeCommunicationAdapter;
|
|
11
|
-
//# sourceMappingURL=rtc.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ArcContextAny } from "../context";
|
|
2
|
-
import type { AuthContext } from "../context/element";
|
|
3
|
-
import type { DataStorage } from "../data-storage";
|
|
4
|
-
import { QueryDefinition } from "../strategies";
|
|
5
|
-
export declare class QueryHandler<C extends ArcContextAny> {
|
|
6
|
-
private model;
|
|
7
|
-
constructor(context: C, dataStorage: DataStorage, catchErrorCallback?: (error: any) => void);
|
|
8
|
-
/**
|
|
9
|
-
* Handle HTTP query requests
|
|
10
|
-
*/
|
|
11
|
-
handleQuery(queryDefinition: QueryDefinition, authContext: AuthContext): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* Handle HTTP query requests with streaming for real-time updates
|
|
14
|
-
*/
|
|
15
|
-
handleQueryWithStream(queryDefinition: QueryDefinition, authContext: AuthContext, streamCallback: (result: any) => void): Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Handle query sync requests for cache strategy
|
|
18
|
-
*/
|
|
19
|
-
handleQuerySync(queryDefinition: QueryDefinition, authContext: AuthContext, syncData: {
|
|
20
|
-
id: string;
|
|
21
|
-
version?: string;
|
|
22
|
-
}[]): Promise<{
|
|
23
|
-
updates: any[];
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to create HTTP handlers for different frameworks
|
|
28
|
-
*/
|
|
29
|
-
export declare function createHttpQueryHandlers<C extends ArcContextAny>(context: C, dataStorage: DataStorage, catchErrorCallback?: (error: any) => void): {
|
|
30
|
-
/**
|
|
31
|
-
* Handle POST /query
|
|
32
|
-
*/
|
|
33
|
-
handleQueryRequest: (req: Request) => Promise<Response>;
|
|
34
|
-
/**
|
|
35
|
-
* Handle POST /query-stream/:streamId
|
|
36
|
-
*/
|
|
37
|
-
handleQueryStreamRequest: (req: Request, streamId: string) => Promise<Response>;
|
|
38
|
-
/**
|
|
39
|
-
* Handle POST /query-sync
|
|
40
|
-
*/
|
|
41
|
-
handleQuerySyncRequest: (req: Request) => Promise<Response>;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=query-handler.d.ts.map
|
package/dist/state/index.d.ts
DELETED
package/dist/state/query.d.ts
DELETED
package/dist/state/state.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ArcContextAny } from "../context";
|
|
2
|
-
import type { AuthContext } from "../context/element";
|
|
3
|
-
import type { DataStorage } from "../data-storage";
|
|
4
|
-
import type { QueryDefinition } from "../query/query-definition";
|
|
5
|
-
import type { CommandDefinition } from "../command/command-definition";
|
|
6
|
-
import type { ModelStrategy } from "./model-strategy";
|
|
7
|
-
export declare class CacheStrategy<C extends ArcContextAny> implements ModelStrategy {
|
|
8
|
-
private readonly dataStorage;
|
|
9
|
-
private dataStorageStrategy;
|
|
10
|
-
private leaderStrategy;
|
|
11
|
-
constructor(context: C, dataStorage: DataStorage, apiBaseUrl: string);
|
|
12
|
-
setAuthToken(token: string | null): void;
|
|
13
|
-
query<TResult = any>(queryDefinition: QueryDefinition<TResult>, authContext: AuthContext, callback?: (result: TResult) => void): Promise<TResult>;
|
|
14
|
-
command(commandDefinition: CommandDefinition, authContext: AuthContext): Promise<any>;
|
|
15
|
-
private extractSyncData;
|
|
16
|
-
private syncWithLeader;
|
|
17
|
-
private updateCache;
|
|
18
|
-
private establishLiveUpdates;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=cache-strategy.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ArcContextAny } from "../context";
|
|
2
|
-
import type { AuthContext } from "../context/element";
|
|
3
|
-
import type { DataStorage } from "../data-storage";
|
|
4
|
-
import type { QueryDefinition } from "../query/query-definition";
|
|
5
|
-
import type { CommandDefinition } from "../command/command-definition";
|
|
6
|
-
import type { ModelStrategy } from "./model-strategy";
|
|
7
|
-
export declare class DataStorageStrategy<C extends ArcContextAny> implements ModelStrategy {
|
|
8
|
-
private readonly context;
|
|
9
|
-
readonly dataStorage: DataStorage;
|
|
10
|
-
private readonly catchErrorCallback?;
|
|
11
|
-
constructor(context: C, dataStorage: DataStorage, catchErrorCallback?: ((error: any) => void) | undefined);
|
|
12
|
-
query<TResult = any>(queryDefinition: QueryDefinition<TResult>, authContext: AuthContext, callback?: (result: TResult) => void): Promise<TResult>;
|
|
13
|
-
command(commandDefinition: CommandDefinition, authContext: AuthContext): Promise<any>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=datastorage-strategy.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./model-strategy";
|
|
2
|
-
export * from "./datastorage-strategy";
|
|
3
|
-
export * from "./leader-strategy";
|
|
4
|
-
export * from "./cache-strategy";
|
|
5
|
-
export type { QueryDefinition } from "../query/query-definition";
|
|
6
|
-
export type { CommandDefinition } from "../command/command-definition";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AuthContext } from "../context/element";
|
|
2
|
-
import type { QueryDefinition } from "../query/query-definition";
|
|
3
|
-
import type { CommandDefinition } from "../command/command-definition";
|
|
4
|
-
import type { ModelStrategy } from "./model-strategy";
|
|
5
|
-
export declare class LeaderStrategy implements ModelStrategy {
|
|
6
|
-
private readonly apiBaseUrl;
|
|
7
|
-
private token;
|
|
8
|
-
constructor(apiBaseUrl: string);
|
|
9
|
-
setAuthToken(token: string | null): void;
|
|
10
|
-
query<TResult = any>(queryDefinition: QueryDefinition<TResult>, authContext: AuthContext, callback?: (result: TResult) => void): Promise<TResult>;
|
|
11
|
-
private queryWithStream;
|
|
12
|
-
private readStream;
|
|
13
|
-
command(commandDefinition: CommandDefinition, authContext: AuthContext): Promise<any>;
|
|
14
|
-
private getAuthHeaders;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=leader-strategy.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AuthContext } from "../context/element";
|
|
2
|
-
import type { QueryDefinition } from "../query/query-definition";
|
|
3
|
-
import type { CommandDefinition } from "../command/command-definition";
|
|
4
|
-
export interface ModelStrategy {
|
|
5
|
-
query<TResult = any>(queryDefinition: QueryDefinition<TResult>, authContext: AuthContext, callback?: (result: TResult) => void): Promise<TResult>;
|
|
6
|
-
command(commandDefinition: CommandDefinition, authContext: AuthContext): Promise<any>;
|
|
7
|
-
setAuthToken?(token: string | null): void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=model-strategy.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AuthContext } from "../context/element";
|
|
2
|
-
export interface QueryDefinition {
|
|
3
|
-
contextElementName: string;
|
|
4
|
-
queryAlias: string;
|
|
5
|
-
parameters: any[];
|
|
6
|
-
restrictions?: any;
|
|
7
|
-
}
|
|
8
|
-
export interface CommandDefinition {
|
|
9
|
-
contextElementName: string;
|
|
10
|
-
parameters: any;
|
|
11
|
-
}
|
|
12
|
-
export interface ModelStrategy {
|
|
13
|
-
query(queryDefinition: QueryDefinition, authContext: AuthContext, callback?: (result: any) => void): Promise<any>;
|
|
14
|
-
command(commandDefinition: CommandDefinition, authContext: AuthContext): Promise<any>;
|
|
15
|
-
setAuthToken?(token: string | null): void;
|
|
16
|
-
}
|
|
17
|
-
export interface QueryStrategy extends ModelStrategy {
|
|
18
|
-
execute(queryDefinition: QueryDefinition, authContext: AuthContext, callback?: (result: any) => void): Promise<any>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=query-strategy.d.ts.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Span } from '@opentelemetry/api';
|
|
2
|
-
import type { AuthContext } from '../context/element';
|
|
3
|
-
import { ArcLogger } from './logger';
|
|
4
|
-
/**
|
|
5
|
-
* Extended context that includes telemetry capabilities
|
|
6
|
-
*/
|
|
7
|
-
export interface ArcTelemetryContext {
|
|
8
|
-
/**
|
|
9
|
-
* Log a message with automatic trace context
|
|
10
|
-
*/
|
|
11
|
-
log: ArcLogger;
|
|
12
|
-
/**
|
|
13
|
-
* Create a child span for a specific operation
|
|
14
|
-
*/
|
|
15
|
-
startSpan(name: string, attributes?: Record<string, string | number | boolean>): Span;
|
|
16
|
-
/**
|
|
17
|
-
* Execute a function within a new span
|
|
18
|
-
*/
|
|
19
|
-
withSpan<T>(name: string, fn: (span: Span) => Promise<T> | T, attributes?: Record<string, string | number | boolean>): Promise<T>;
|
|
20
|
-
/**
|
|
21
|
-
* Add attributes to the current span
|
|
22
|
-
*/
|
|
23
|
-
addSpanAttributes(attributes: Record<string, string | number | boolean>): void;
|
|
24
|
-
/**
|
|
25
|
-
* Add an event to the current span
|
|
26
|
-
*/
|
|
27
|
-
addSpanEvent(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
28
|
-
/**
|
|
29
|
-
* Record an exception in the current span
|
|
30
|
-
*/
|
|
31
|
-
recordException(error: Error | string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Get the current trace ID
|
|
34
|
-
*/
|
|
35
|
-
getTraceId(): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Get the current span ID
|
|
38
|
-
*/
|
|
39
|
-
getSpanId(): string | undefined;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Create telemetry context for command/event handlers
|
|
43
|
-
*/
|
|
44
|
-
export declare function createTelemetryContext(authContext: AuthContext, operationType: 'command' | 'event' | 'listener' | 'view', operationName: string): ArcTelemetryContext;
|
|
45
|
-
/**
|
|
46
|
-
* Extract trace context from headers (for HTTP requests)
|
|
47
|
-
*/
|
|
48
|
-
export declare function extractTraceContext(headers: Record<string, string | string[] | undefined>): import("@opentelemetry/api").Context;
|
|
49
|
-
/**
|
|
50
|
-
* Inject trace context into headers (for outgoing HTTP requests)
|
|
51
|
-
*/
|
|
52
|
-
export declare function injectTraceContext(headers?: Record<string, string>): Record<string, string>;
|
|
53
|
-
/**
|
|
54
|
-
* Run a function with extracted trace context
|
|
55
|
-
*/
|
|
56
|
-
export declare function withExtractedContext<T>(headers: Record<string, string | string[] | undefined>, fn: () => T): T;
|
|
57
|
-
/**
|
|
58
|
-
* Get telemetry information from current context
|
|
59
|
-
*/
|
|
60
|
-
export declare function getCurrentTelemetryInfo(): {
|
|
61
|
-
traceId: string | undefined;
|
|
62
|
-
spanId: string | undefined;
|
|
63
|
-
isRecording: boolean;
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export type { TelemetryProvider, TelemetryContext, Logger, SpanOptions, DatabaseTelemetry } from './interfaces';
|
|
2
|
-
export { NoOpLogger, NoOpTelemetryContext, NoOpTelemetryProvider, NoOpDatabaseTelemetry, noOpTelemetryProvider, noOpDatabaseTelemetry, } from './no-op';
|
|
3
|
-
export declare const initializeTelemetry: (...args: any[]) => never;
|
|
4
|
-
export declare const getTelemetry: () => null;
|
|
5
|
-
export declare const startSpan: (...args: any[]) => never;
|
|
6
|
-
export declare const withSpan: (...args: any[]) => never;
|
|
7
|
-
export declare const ArcTelemetry: {
|
|
8
|
-
new (): {};
|
|
9
|
-
};
|
|
10
|
-
export declare const initializeLogger: (...args: any[]) => never;
|
|
11
|
-
export declare const getLogger: () => never;
|
|
12
|
-
export declare const ArcLogger: {
|
|
13
|
-
new (): {};
|
|
14
|
-
};
|
|
15
|
-
export declare const createTelemetryContext: (...args: any[]) => never;
|
|
16
|
-
export declare const extractTraceContext: (...args: any[]) => never;
|
|
17
|
-
export declare const injectTraceContext: (...args: any[]) => never;
|
|
18
|
-
export declare const withExtractedContext: (...args: any[]) => never;
|
|
19
|
-
export declare const getCurrentTelemetryInfo: () => {
|
|
20
|
-
traceId: undefined;
|
|
21
|
-
spanId: undefined;
|
|
22
|
-
isRecording: boolean;
|
|
23
|
-
};
|
|
24
|
-
export type TelemetryConfig = any;
|
|
25
|
-
export type LogContext = Record<string, any>;
|
|
26
|
-
export type LogEntry = any;
|
|
27
|
-
export type ArcTelemetryContext = any;
|
|
28
|
-
export declare const SpanKind: {
|
|
29
|
-
readonly INTERNAL: "internal";
|
|
30
|
-
readonly SERVER: "server";
|
|
31
|
-
readonly CLIENT: "client";
|
|
32
|
-
readonly PRODUCER: "producer";
|
|
33
|
-
readonly CONSUMER: "consumer";
|
|
34
|
-
};
|
|
35
|
-
export declare const SpanStatusCode: {
|
|
36
|
-
readonly UNSET: 0;
|
|
37
|
-
readonly OK: 1;
|
|
38
|
-
readonly ERROR: 2;
|
|
39
|
-
};
|
|
40
|
-
export declare const LogLevel: {
|
|
41
|
-
readonly ERROR: "error";
|
|
42
|
-
readonly WARN: "warn";
|
|
43
|
-
readonly INFO: "info";
|
|
44
|
-
readonly DEBUG: "debug";
|
|
45
|
-
readonly TRACE: "trace";
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { AuthContext } from '../context/element';
|
|
2
|
-
/**
|
|
3
|
-
* Environment-agnostic telemetry context that handlers receive
|
|
4
|
-
* Automatically correlates logs with trace IDs
|
|
5
|
-
*/
|
|
6
|
-
export interface TelemetryContext {
|
|
7
|
-
/**
|
|
8
|
-
* Logging methods that auto-correlate with trace ID
|
|
9
|
-
*/
|
|
10
|
-
log: {
|
|
11
|
-
info(message: string, context?: Record<string, any>): void;
|
|
12
|
-
error(message: string, context?: Record<string, any>, error?: Error): void;
|
|
13
|
-
debug(message: string, context?: Record<string, any>): void;
|
|
14
|
-
warn(message: string, context?: Record<string, any>): void;
|
|
15
|
-
command(name: string, message: string, context?: Record<string, any>): void;
|
|
16
|
-
event(type: string, message: string, context?: Record<string, any>): void;
|
|
17
|
-
database(operation: string, message: string, context?: Record<string, any>): void;
|
|
18
|
-
http(method: string, path: string, statusCode: number, duration: number, context?: Record<string, any>): void;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Span management (automatically correlates logs with traces)
|
|
22
|
-
*/
|
|
23
|
-
startSpan(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
24
|
-
addAttributes(attributes: Record<string, string | number | boolean>): void;
|
|
25
|
-
addEvent(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
26
|
-
recordException(error: Error | string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Trace correlation info
|
|
29
|
-
*/
|
|
30
|
-
getTraceId(): string | undefined;
|
|
31
|
-
getSpanId(): string | undefined;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Span options for creating new spans
|
|
35
|
-
*/
|
|
36
|
-
export interface SpanOptions {
|
|
37
|
-
kind?: 'client' | 'server' | 'internal' | 'producer' | 'consumer';
|
|
38
|
-
attributes?: Record<string, string | number | boolean>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Main telemetry provider interface that environments must implement
|
|
42
|
-
*/
|
|
43
|
-
export interface TelemetryProvider {
|
|
44
|
-
/**
|
|
45
|
-
* Create a logger instance
|
|
46
|
-
*/
|
|
47
|
-
createLogger(name: string): Logger;
|
|
48
|
-
/**
|
|
49
|
-
* Execute function within a span context
|
|
50
|
-
*/
|
|
51
|
-
withSpan<T>(name: string, fn: (context: TelemetryContext) => Promise<T> | T, options?: SpanOptions): Promise<T>;
|
|
52
|
-
/**
|
|
53
|
-
* Create telemetry context for command/route handlers
|
|
54
|
-
*/
|
|
55
|
-
createTelemetryContext(authContext: AuthContext, operationType: 'command' | 'event' | 'listener' | 'view' | 'route', operationName: string): TelemetryContext;
|
|
56
|
-
/**
|
|
57
|
-
* Check if telemetry is enabled
|
|
58
|
-
*/
|
|
59
|
-
isEnabled(): boolean;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Basic logger interface
|
|
63
|
-
*/
|
|
64
|
-
export interface Logger {
|
|
65
|
-
info(message: string, context?: Record<string, any>): void;
|
|
66
|
-
error(message: string, context?: Record<string, any>, error?: Error): void;
|
|
67
|
-
debug(message: string, context?: Record<string, any>): void;
|
|
68
|
-
warn(message: string, context?: Record<string, any>): void;
|
|
69
|
-
command(name: string, message: string, context?: Record<string, any>): void;
|
|
70
|
-
event(type: string, message: string, context?: Record<string, any>): void;
|
|
71
|
-
database(operation: string, message: string, context?: Record<string, any>): void;
|
|
72
|
-
http(method: string, path: string, statusCode: number, duration: number, context?: Record<string, any>): void;
|
|
73
|
-
child(context: Record<string, any>): Logger;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Database telemetry interface for adapters
|
|
77
|
-
*/
|
|
78
|
-
export interface DatabaseTelemetry {
|
|
79
|
-
/**
|
|
80
|
-
* Execute a database operation with telemetry
|
|
81
|
-
*/
|
|
82
|
-
withDatabaseOperation<T>(operation: string, sql: string, params: any[] | undefined, tableName: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export declare enum LogLevel {
|
|
2
|
-
ERROR = "error",
|
|
3
|
-
WARN = "warn",
|
|
4
|
-
INFO = "info",
|
|
5
|
-
DEBUG = "debug",
|
|
6
|
-
TRACE = "trace"
|
|
7
|
-
}
|
|
8
|
-
interface LogContext {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
interface LogEntry {
|
|
12
|
-
level: LogLevel;
|
|
13
|
-
message: string;
|
|
14
|
-
context?: LogContext;
|
|
15
|
-
timestamp?: string;
|
|
16
|
-
traceId?: string;
|
|
17
|
-
spanId?: string;
|
|
18
|
-
userId?: string;
|
|
19
|
-
requestId?: string;
|
|
20
|
-
command?: string;
|
|
21
|
-
event?: string;
|
|
22
|
-
error?: Error;
|
|
23
|
-
}
|
|
24
|
-
declare class ArcLogger {
|
|
25
|
-
private serviceName;
|
|
26
|
-
constructor(serviceName?: string);
|
|
27
|
-
private createLogEntry;
|
|
28
|
-
private formatForConsole;
|
|
29
|
-
private output;
|
|
30
|
-
private getSeverityNumber;
|
|
31
|
-
error(message: string, context?: LogContext, error?: Error): void;
|
|
32
|
-
warn(message: string, context?: LogContext): void;
|
|
33
|
-
info(message: string, context?: LogContext): void;
|
|
34
|
-
debug(message: string, context?: LogContext): void;
|
|
35
|
-
trace(message: string, context?: LogContext): void;
|
|
36
|
-
/**
|
|
37
|
-
* Log command execution
|
|
38
|
-
*/
|
|
39
|
-
command(commandName: string, message: string, context?: LogContext): void;
|
|
40
|
-
/**
|
|
41
|
-
* Log event processing
|
|
42
|
-
*/
|
|
43
|
-
event(eventType: string, message: string, context?: LogContext): void;
|
|
44
|
-
/**
|
|
45
|
-
* Log database operations
|
|
46
|
-
*/
|
|
47
|
-
database(operation: string, message: string, context?: LogContext): void;
|
|
48
|
-
/**
|
|
49
|
-
* Log HTTP requests
|
|
50
|
-
*/
|
|
51
|
-
http(method: string, path: string, statusCode: number, duration: number, context?: LogContext): void;
|
|
52
|
-
/**
|
|
53
|
-
* Create a child logger with additional context
|
|
54
|
-
*/
|
|
55
|
-
child(context: LogContext): ArcLogger;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Initialize global logger
|
|
59
|
-
*/
|
|
60
|
-
export declare function initializeLogger(serviceName?: string): ArcLogger;
|
|
61
|
-
/**
|
|
62
|
-
* Get the global logger instance
|
|
63
|
-
*/
|
|
64
|
-
export declare function getLogger(): ArcLogger;
|
|
65
|
-
export { ArcLogger };
|
|
66
|
-
export type { LogContext, LogEntry };
|
|
67
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { TelemetryProvider, TelemetryContext, Logger, DatabaseTelemetry } from './interfaces';
|
|
2
|
-
/**
|
|
3
|
-
* No-op logger implementation for when telemetry is disabled
|
|
4
|
-
*/
|
|
5
|
-
export declare class NoOpLogger implements Logger {
|
|
6
|
-
info(): void;
|
|
7
|
-
error(): void;
|
|
8
|
-
debug(): void;
|
|
9
|
-
warn(): void;
|
|
10
|
-
command(): void;
|
|
11
|
-
event(): void;
|
|
12
|
-
database(): void;
|
|
13
|
-
http(): void;
|
|
14
|
-
child(): Logger;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* No-op telemetry context for when telemetry is disabled
|
|
18
|
-
*/
|
|
19
|
-
export declare class NoOpTelemetryContext implements TelemetryContext {
|
|
20
|
-
private logger;
|
|
21
|
-
log: NoOpLogger;
|
|
22
|
-
startSpan(): void;
|
|
23
|
-
addAttributes(): void;
|
|
24
|
-
addEvent(): void;
|
|
25
|
-
recordException(): void;
|
|
26
|
-
getTraceId(): undefined;
|
|
27
|
-
getSpanId(): undefined;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* No-op telemetry provider for when telemetry is disabled
|
|
31
|
-
*/
|
|
32
|
-
export declare class NoOpTelemetryProvider implements TelemetryProvider {
|
|
33
|
-
private logger;
|
|
34
|
-
private context;
|
|
35
|
-
createLogger(): Logger;
|
|
36
|
-
withSpan<T>(name: string, fn: (context: TelemetryContext) => Promise<T> | T): Promise<T>;
|
|
37
|
-
createTelemetryContext(): TelemetryContext;
|
|
38
|
-
isEnabled(): boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* No-op database telemetry for when telemetry is disabled
|
|
42
|
-
*/
|
|
43
|
-
export declare class NoOpDatabaseTelemetry implements DatabaseTelemetry {
|
|
44
|
-
withDatabaseOperation<T>(operation: string, sql: string, params: any[] | undefined, tableName: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Default no-op telemetry provider instance
|
|
48
|
-
*/
|
|
49
|
-
export declare const noOpTelemetryProvider: NoOpTelemetryProvider;
|
|
50
|
-
/**
|
|
51
|
-
* Default no-op database telemetry instance
|
|
52
|
-
*/
|
|
53
|
-
export declare const noOpDatabaseTelemetry: NoOpDatabaseTelemetry;
|
|
54
|
-
//# sourceMappingURL=no-op.d.ts.map
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
2
|
-
import type { Span } from "@opentelemetry/api";
|
|
3
|
-
interface TelemetryConfig {
|
|
4
|
-
serviceName: string;
|
|
5
|
-
serviceVersion: string;
|
|
6
|
-
environment: string;
|
|
7
|
-
otlpEndpoint?: string;
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare class ArcTelemetry {
|
|
11
|
-
private sdk?;
|
|
12
|
-
private tracer;
|
|
13
|
-
private logger;
|
|
14
|
-
private config;
|
|
15
|
-
constructor(config: TelemetryConfig);
|
|
16
|
-
private initialize;
|
|
17
|
-
/**
|
|
18
|
-
* Create a new span for tracing operations
|
|
19
|
-
*/
|
|
20
|
-
startSpan(name: string, options?: {
|
|
21
|
-
kind?: SpanKind;
|
|
22
|
-
attributes?: Record<string, string | number | boolean>;
|
|
23
|
-
parent?: Span;
|
|
24
|
-
}): Span;
|
|
25
|
-
/**
|
|
26
|
-
* Execute a function within a span context
|
|
27
|
-
*/
|
|
28
|
-
withSpan<T>(name: string, fn: (span: Span) => Promise<T> | T, options?: {
|
|
29
|
-
kind?: SpanKind;
|
|
30
|
-
attributes?: Record<string, string | number | boolean>;
|
|
31
|
-
}): Promise<T>;
|
|
32
|
-
/**
|
|
33
|
-
* Add attributes to the current active span
|
|
34
|
-
*/
|
|
35
|
-
addSpanAttributes(attributes: Record<string, string | number | boolean>): void;
|
|
36
|
-
/**
|
|
37
|
-
* Add an event to the current active span
|
|
38
|
-
*/
|
|
39
|
-
addSpanEvent(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
40
|
-
/**
|
|
41
|
-
* Record an exception in the current span
|
|
42
|
-
*/
|
|
43
|
-
recordException(error: Error | string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Shutdown telemetry (call on app shutdown)
|
|
46
|
-
*/
|
|
47
|
-
shutdown(): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Check if telemetry is enabled
|
|
50
|
-
*/
|
|
51
|
-
get isEnabled(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get the current tracer instance
|
|
54
|
-
*/
|
|
55
|
-
getTracer(): any;
|
|
56
|
-
/**
|
|
57
|
-
* Get the current logger instance
|
|
58
|
-
*/
|
|
59
|
-
getLogger(): any;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Initialize global telemetry
|
|
63
|
-
*/
|
|
64
|
-
export declare function initializeTelemetry(config: TelemetryConfig): ArcTelemetry;
|
|
65
|
-
/**
|
|
66
|
-
* Get the global telemetry instance
|
|
67
|
-
*/
|
|
68
|
-
export declare function getTelemetry(): ArcTelemetry | null;
|
|
69
|
-
/**
|
|
70
|
-
* Helper function to create a span
|
|
71
|
-
*/
|
|
72
|
-
export declare function startSpan(name: string, options?: {
|
|
73
|
-
kind?: SpanKind;
|
|
74
|
-
attributes?: Record<string, string | number | boolean>;
|
|
75
|
-
}): Span;
|
|
76
|
-
/**
|
|
77
|
-
* Helper function to execute code within a span
|
|
78
|
-
*/
|
|
79
|
-
export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T> | T, options?: {
|
|
80
|
-
kind?: SpanKind;
|
|
81
|
-
attributes?: Record<string, string | number | boolean>;
|
|
82
|
-
}): Promise<T>;
|
|
83
|
-
export { ArcTelemetry, SpanKind, SpanStatusCode };
|
|
84
|
-
export type { TelemetryConfig };
|
|
85
|
-
//# sourceMappingURL=tracer.d.ts.map
|
package/dist/tests/pipe.d.ts
DELETED