mcard-js
Version:
MCard - Content-addressable storage with cryptographic hashing, handle resolution, and vector search for Node.js and browsers
174 lines • 6.47 kB
TypeScript
/**
* VCard Application Vocabulary - Data-driven patterns for side effects.
*
* Resource types are defined as DATA in vcard_ext/, making the system
* fully extensible without code changes.
*/
import { ExternalRef } from './VCard.js';
import { RESOURCE_REGISTRY, ResourceType, ResourceCategory } from './vcard_ext/index.js';
export { ResourceCategory, ResourceType, RESOURCE_REGISTRY };
export declare class Resource {
static create(resourceType: string, ...argsAndOptions: any[]): Promise<ExternalRef>;
private static _buildUri;
private static _buildHashContent;
private static _determineStatus;
static types(): string[];
static register(type: ResourceType): void;
}
export declare function createLgtmStack(baseUrl: string, serviceName: string, options?: {
environment?: string;
ports?: Partial<Record<'grafana' | 'prometheus' | 'loki' | 'tempo', number>>;
}): Promise<ExternalRef[]>;
export declare enum AccessMode {
READ = "read",
WRITE = "write",
READ_WRITE = "rw",
EXECUTE = "execute"
}
export interface EnvResourceOptions {
required?: boolean;
secret?: boolean;
default?: string;
description?: string;
}
export interface FileResourceOptions {
mode?: AccessMode;
required?: boolean;
description?: string;
}
export interface StorageResourceOptions {
required?: boolean;
description?: string;
}
export interface ApiResourceOptions {
method?: string;
authEnvVar?: string;
description?: string;
}
export interface GrafanaOptions {
orgId?: string;
dashboardUid?: string;
apiKeyEnvVar?: string;
description?: string;
}
export interface PrometheusOptions {
jobName?: string;
scrapeInterval?: number;
description?: string;
}
export interface LokiOptions {
tenantId?: string;
labels?: Record<string, string>;
description?: string;
}
export interface TempoOptions {
serviceName?: string;
samplingRate?: number;
description?: string;
}
export interface FaroOptions {
appVersion?: string;
environment?: string;
description?: string;
}
export interface OtlpOptions {
protocol?: 'grpc' | 'http';
serviceName?: string;
headersEnvVar?: string;
description?: string;
}
export declare class EnvResource {
static create(name: string, options?: EnvResourceOptions): Promise<ExternalRef>;
static resolve(ref: ExternalRef): string | undefined;
}
export declare class FileResource {
static create(path: string, options?: FileResourceOptions): Promise<ExternalRef>;
static createDirectory(path: string, options?: {
recursive?: boolean;
description?: string;
}): Promise<ExternalRef>;
}
export declare class StorageResource {
static createSqlite(path: string, options?: StorageResourceOptions): Promise<ExternalRef>;
static createPostgres(conn: string, options?: StorageResourceOptions): Promise<ExternalRef>;
static createS3(bucket: string, key: string, options?: {
region?: string;
description?: string;
}): Promise<ExternalRef>;
static createLitefs(path: string, options?: {
primary?: string;
leaseKey?: string;
description?: string;
}): Promise<ExternalRef>;
static createTurso(db: string, options?: {
group?: string;
authTokenEnvVar?: string;
syncUrl?: string;
description?: string;
}): Promise<ExternalRef>;
}
export declare class NetworkResource {
static createApi(endpoint: string, options?: ApiResourceOptions): Promise<ExternalRef>;
static createWebhook(endpoint: string, options?: {
secretEnvVar?: string;
description?: string;
}): Promise<ExternalRef>;
}
export declare class ObservabilityResource {
static createGrafana(endpoint: string, options?: GrafanaOptions): Promise<ExternalRef>;
static createPrometheus(endpoint: string, options?: PrometheusOptions): Promise<ExternalRef>;
static createLoki(endpoint: string, options?: LokiOptions): Promise<ExternalRef>;
static createTempo(endpoint: string, options?: TempoOptions): Promise<ExternalRef>;
static createFaro(collectorUrl: string, appName: string, options?: FaroOptions): Promise<ExternalRef>;
static createOtlp(endpoint: string, options?: OtlpOptions): Promise<ExternalRef>;
static createLgtmStack(baseUrl: string, serviceName: string, options?: {
environment?: string;
ports?: Partial<Record<'grafana' | 'prometheus' | 'loki' | 'tempo', number>>;
}): Promise<ExternalRef[]>;
}
export declare class ApplicationResources {
private resources;
add(resourceType: string, ...argsAndOptions: any[]): Promise<this>;
addEnv(name: string, options?: EnvResourceOptions): Promise<this>;
addFile(path: string, options?: FileResourceOptions): Promise<this>;
addDirectory(path: string, options?: {
recursive?: boolean;
description?: string;
}): Promise<this>;
addSqlite(path: string, options?: StorageResourceOptions): Promise<this>;
addLitefs(path: string, options?: {
primary?: string;
leaseKey?: string;
description?: string;
}): Promise<this>;
addTurso(db: string, options?: {
group?: string;
authTokenEnvVar?: string;
syncUrl?: string;
description?: string;
}): Promise<this>;
addApi(endpoint: string, options?: ApiResourceOptions): Promise<this>;
addGrafana(endpoint: string, options?: GrafanaOptions): Promise<this>;
addPrometheus(endpoint: string, options?: PrometheusOptions): Promise<this>;
addLoki(endpoint: string, options?: LokiOptions): Promise<this>;
addTempo(endpoint: string, options?: TempoOptions): Promise<this>;
addFaro(url: string, app: string, options?: FaroOptions): Promise<this>;
addOtlp(endpoint: string, options?: OtlpOptions): Promise<this>;
addLgtmStack(baseUrl: string, serviceName: string, options?: {
environment?: string;
ports?: Partial<Record<'grafana' | 'prometheus' | 'loki' | 'tempo', number>>;
}): Promise<this>;
getAll(): ExternalRef[];
getByCategory(category: ResourceCategory | string): ExternalRef[];
getObservabilityResources(): ExternalRef[];
getInvalid(): ExternalRef[];
validate(): {
valid: boolean;
total: number;
verified: number;
pending: number;
invalid: number;
invalidResources: string[];
};
}
//# sourceMappingURL=vcard_vocabulary.d.ts.map