@openfga/sdk
Version:
JavaScript and Node.js SDK for OpenFGA
70 lines (69 loc) • 2.47 kB
TypeScript
/**
* JavaScript and Node.js SDK for OpenFGA
*
* API version: 1.x
* Website: https://openfga.dev
* Documentation: https://openfga.dev/docs
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)
*
* NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
*/
import { TelemetryAttribute } from "./attributes";
import { TelemetryMetric, MetricRecorder } from "./metrics";
/**
* Configuration for a telemetry metric.
*
* @interface TelemetryMetricConfig
* @property {Set<TelemetryAttribute>} attributes - A set of attributes associated with the telemetry metric.
*/
export interface TelemetryMetricConfig {
attributes?: Set<TelemetryAttribute>;
}
/**
* Represents the overall configuration for telemetry, including various metrics.
*
* @interface TelemetryConfig
* @property {Record<TelemetryMetric, TelemetryMetricConfig>} metrics - A record mapping telemetry metrics to their configurations.
*/
export interface TelemetryConfig {
metrics?: Partial<Record<TelemetryMetric, TelemetryMetricConfig>>;
}
/**
* Manages the overall telemetry configuration, including default and valid attributes.
*
* @class TelemetryConfiguration
* @implements {TelemetryConfig}
*/
export declare class TelemetryConfiguration implements TelemetryConfig {
metrics?: Partial<Record<TelemetryMetric, TelemetryMetricConfig>> | undefined;
readonly recorder: MetricRecorder;
/**
* Default attributes for telemetry metrics.
*
* @static
* @readonly
* @type {Set<TelemetryAttribute>}
*/
static readonly defaultAttributes: Set<TelemetryAttribute>;
/**
* Valid attributes that can be used in telemetry metrics.
*
* @static
* @readonly
* @type {Set<TelemetryAttribute>}
*/
static readonly validAttributes: Set<TelemetryAttribute>;
/**
* Creates an instance of TelemetryConfiguration.
*
* @param {Partial<Record<TelemetryMetric, TelemetryMetricConfig>>} [metrics] - A record mapping telemetry metrics to their configurations.
*/
constructor(metrics?: Partial<Record<TelemetryMetric, TelemetryMetricConfig>> | undefined);
/**
* Validates that the configured metrics use only valid attributes.
*
* @throws {FgaValidationError} Throws an error if any attribute in the metric configurations is invalid.
*/
ensureValid(): void;
}