@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
136 lines (135 loc) • 3.76 kB
TypeScript
import type { PortalItemLike } from "@vertigis/arcgis-extensions/utilities/portal";
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { Event } from "../Event.js";
import { EventRegistry } from "../EventRegistry.js";
import type { FeaturesLike } from "../common.js";
/**
* Represents a data source for VertiGIS Studio Reporting. A data source created
* at report design time will be replaced by this data source at runtime.
*/
export interface ReportDataSource {
/**
* The name is the name of the data source whose data you want to replace.
* The name must match the name of the data source in the report.
*/
name: string;
/**
* The value is an object that defines the data to use in the report. The
* value is defined using the same schema as the data source in the report.
*/
value: unknown;
}
/**
* The arguments required by the reports.run command.
*/
export interface RunReportArgs {
/**
* The ID of the report item.
*/
id?: string;
/**
* The title of the report.
*/
title?: string;
/**
* The portal item where the report is located.
*/
portalItem?: PortalItemLike;
/**
* A unique ID to identify an instance of this report running.
*/
instanceId?: string;
/**
* The features passed to the report.
*/
features?: FeaturesLike;
/**
* Replace the data from one or more data sources at run time.
*/
dataSources?: ReportDataSource | ReportDataSource[];
}
/**
* Base for the Report Event Args interfaces.
*/
export interface ReportEventArgsBase {
/**
* The ID of the report being run.
*/
reportId: string;
/**
* A unique ID to track the running of this report.
*/
instanceId: string;
}
/**
* Arguments for the reports.report-error event.
*/
export interface ReportErrorEventArgs extends ReportEventArgsBase {
/**
* The error message.
*/
message: string;
/**
* The HTTP status code associated with the error, if it's a HTTP error.
*/
errorCode?: number;
}
/**
* Arguments for the reports.report-finished event.
*/
export interface ReportFinishedEventArgs extends ReportEventArgsBase {
/**
* The URL to download the report at.
*/
downloadUrl: string;
}
/**
* Arguments for the reports.report-progress event.
*/
export interface ReportProgressEventArgs extends ReportEventArgsBase {
}
/**
* Arguments for the reports.report-started event.
*/
export interface ReportStartedEventArgs extends ReportEventArgsBase {
}
export declare class ReportsCommands extends CommandRegistry {
protected readonly _prefix = "reports";
/**
* Run a report on the given features. The report URL and feature IDs are
* provided by the viewer. Web only.
*
* @webOnly
*/
get run(): Command<RunReportArgs>;
}
export declare class ReportEvents extends EventRegistry {
protected readonly _prefix = "reports";
/**
* Raised when a report has started running. Web only.
*
* @webOnly
*/
get reportStarted(): Event<ReportStartedEventArgs>;
/**
* Raised while a report is running to provide updates on its status. Web
* only.
*
* @webOnly
*/
get reportProgress(): Event<ReportProgressEventArgs>;
/**
* Raised when a report has finished running. Event arguments include the
* report download URL. Web only.
*
* @webOnly
*/
get reportFinished(): Event<ReportFinishedEventArgs>;
/**
* Raised when an error occurs with running a report. Web only.
*
* @webOnly
*/
get reportError(): Event<ReportErrorEventArgs>;
}