import { Logger, CoerceURI, URI, AppContext } from "@adviser/cement"; import { Attachable, SuperThis } from "@fireproof/core-types-base"; import { FPCloudClaim } from "./msg-types.zod.js"; export interface ToCloudAttachable extends Attachable { token?: string; readonly opts: ToCloudOpts; } export interface ResEnsureCloudToken { readonly type: "resEnsureCloudToken"; readonly cloudToken: string; readonly appId: string; readonly tenant: string; readonly ledger: string; readonly expiresInSec: number; readonly expiresDate: string; readonly claims: FPCloudClaim; } export interface TokenAndClaims { readonly token: string; readonly claims: FPCloudClaim; readonly res?: ResEnsureCloudToken; } export interface TokenStrategie { hash(): string; open(sthis: SuperThis, logger: Logger, deviceId: string, opts: ToCloudOpts): void; tryToken(sthis: SuperThis, logger: Logger, opts: ToCloudOpts): Promise; waitForToken(sthis: SuperThis, logger: Logger, deviceId: string, opts: ToCloudOpts): Promise; stop(): void; } export declare const ToCloudName = "toCloud"; export interface FPCloudRef { readonly base: CoerceURI; readonly car: CoerceURI; readonly file: CoerceURI; readonly meta: CoerceURI; } export declare function hashableFPCloudRef(ref?: Partial): { base?: string; car?: string; file?: string; meta?: string; }; export interface TokenAndClaimsEvents { hash(): string; changed(token?: TokenAndClaims): Promise; } export interface ToCloudRequiredOpts { readonly urls: Partial; readonly strategy: TokenStrategie; } export interface ToCloudBase { readonly sthis: SuperThis; readonly name: string; readonly intervalSec: number; readonly tokenWaitTimeSec: number; readonly refreshTokenPresetSec: number; readonly context: AppContext; readonly events: TokenAndClaimsEvents; readonly tenant?: string; readonly ledger?: string; } export type ToCloudOpts = ToCloudRequiredOpts & ToCloudBase; export type ToCloudOptionalOpts = Partial & Partial; export interface FPCloudUri { readonly car: URI; readonly file: URI; readonly meta: URI; }