metrickit 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +379 -0
- package/dist/cache-redis.d.ts +10 -0
- package/dist/cache-redis.js +24 -0
- package/dist/cache-utils.d.ts +5 -0
- package/dist/cache.d.ts +18 -0
- package/dist/catalog.d.ts +12 -0
- package/dist/define-metric.d.ts +37 -0
- package/dist/engine.d.ts +200 -0
- package/dist/filters/default-metadata.d.ts +28 -0
- package/dist/filters/index.d.ts +3 -0
- package/dist/filters/parse.d.ts +7 -0
- package/dist/filters/types.d.ts +19 -0
- package/dist/frontend/catalog.d.ts +24 -0
- package/dist/frontend/dashboard.d.ts +12 -0
- package/dist/frontend/format.d.ts +10 -0
- package/dist/frontend/index.d.ts +10 -0
- package/dist/frontend/markers.d.ts +19 -0
- package/dist/frontend/renderers.d.ts +14 -0
- package/dist/frontend/requests.d.ts +17 -0
- package/dist/frontend/stream-state.d.ts +14 -0
- package/dist/frontend/time.d.ts +5 -0
- package/dist/frontend/transport.d.ts +19 -0
- package/dist/frontend/types.d.ts +108 -0
- package/dist/frontend.d.ts +1 -0
- package/dist/frontend.js +752 -0
- package/dist/helpers/clickhouse.d.ts +27 -0
- package/dist/helpers/distribution.d.ts +15 -0
- package/dist/helpers/index.d.ts +6 -0
- package/dist/helpers/metric-type.d.ts +21 -0
- package/dist/helpers/pivot.d.ts +15 -0
- package/dist/helpers/prisma.d.ts +20 -0
- package/dist/helpers/timeseries.d.ts +6 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +668 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1322 -0
- package/dist/orpc.d.ts +36 -0
- package/dist/orpc.js +1157 -0
- package/dist/registry.d.ts +269 -0
- package/dist/run-metrics.d.ts +14 -0
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/inputs.d.ts +19 -0
- package/dist/schemas/metric-type.d.ts +7 -0
- package/dist/schemas/output.d.ts +842 -0
- package/dist/schemas/time.d.ts +24 -0
- package/dist/time.d.ts +6 -0
- package/dist/type-guards.d.ts +7 -0
- package/package.json +91 -0
package/dist/orpc.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CacheAdapter } from './cache.ts';
|
|
2
|
+
import type { MetricResultChunk, MetricsResult } from './run-metrics.ts';
|
|
3
|
+
import type { MetricsRequestFor } from './registry.ts';
|
|
4
|
+
import type { FilterFieldDefinition } from './filters/types.ts';
|
|
5
|
+
import type { AnyRegistry, GetMetricByKey, InferAvailableMetricKey, InferRegistryMetrics, MetricCatalogFor, MetricKindFor } from './registry.ts';
|
|
6
|
+
export interface MetricsRouterOptions<TORPCContext, TResolverContext, R extends AnyRegistry = AnyRegistry> {
|
|
7
|
+
registry: R;
|
|
8
|
+
createContext: (orpcCtx: TORPCContext) => TResolverContext | Promise<TResolverContext>;
|
|
9
|
+
hasAccess?: (metric: InferRegistryMetrics<R>[number], orpcCtx: TORPCContext) => boolean;
|
|
10
|
+
cache?: CacheAdapter;
|
|
11
|
+
}
|
|
12
|
+
export declare function createRunMetricsProcedure<TORPCContext, TResolverContext, R extends AnyRegistry>(options: MetricsRouterOptions<TORPCContext, TResolverContext, R>): <TRequest extends MetricsRequestFor<R>>(input: TRequest, orpcCtx: TORPCContext) => Promise<MetricsResult<R, TRequest["metrics"]> & {
|
|
13
|
+
hasErrors: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function createRunMetricsStreamProcedure<TORPCContext, TResolverContext, R extends AnyRegistry>(options: MetricsRouterOptions<TORPCContext, TResolverContext, R>): <TRequest extends MetricsRequestFor<R>>(input: TRequest, orpcCtx: TORPCContext) => AsyncGenerator<MetricResultChunk<R, TRequest["metrics"]>, void, unknown>;
|
|
16
|
+
export type AvailableMetricFor<R extends AnyRegistry, K extends InferAvailableMetricKey<R> = InferAvailableMetricKey<R>> = {
|
|
17
|
+
key: K;
|
|
18
|
+
kind: MetricKindFor<R, K>;
|
|
19
|
+
displayName: string;
|
|
20
|
+
description: string;
|
|
21
|
+
supportsTimeRange: GetMetricByKey<R, K>['supportsTimeRange'];
|
|
22
|
+
catalog?: MetricCatalogFor<R, K>;
|
|
23
|
+
filters: FilterFieldDefinition[];
|
|
24
|
+
};
|
|
25
|
+
export type AvailableMetricsResult<R extends AnyRegistry> = {
|
|
26
|
+
metrics: AvailableMetricFor<R>[];
|
|
27
|
+
total: number;
|
|
28
|
+
};
|
|
29
|
+
export declare function createGetAvailableMetricsProcedure<TORPCContext, R extends AnyRegistry>(options: Pick<MetricsRouterOptions<TORPCContext, unknown, R>, 'registry' | 'hasAccess'>): (orpcCtx: TORPCContext) => AvailableMetricsResult<R>;
|
|
30
|
+
export declare function createMetricsRouter<TORPCContext, TResolverContext, R extends AnyRegistry>(options: MetricsRouterOptions<TORPCContext, TResolverContext, R>): {
|
|
31
|
+
runMetrics: <TRequest extends MetricsRequestFor<R>>(input: TRequest, orpcCtx: TORPCContext) => Promise<MetricsResult<R, TRequest["metrics"]> & {
|
|
32
|
+
hasErrors: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
runMetricsStream: <TRequest extends MetricsRequestFor<R>>(input: TRequest, orpcCtx: TORPCContext) => AsyncGenerator<import("./registry.ts").MetricResultChunkFor<R, TRequest["metrics"]>, void, unknown>;
|
|
35
|
+
getAvailableMetrics: (orpcCtx: TORPCContext) => AvailableMetricsResult<R>;
|
|
36
|
+
};
|