UNPKG

5.98 kBTypeScriptView Raw
1/**
2 * Represents the status of an analytics query.
3 *
4 * @category Analytics
5 */
6export declare enum AnalyticsStatus {
7 /**
8 * Indicates the query is still running.
9 */
10 Running = "running",
11 /**
12 * Indicates that the query completed successfully.
13 */
14 Success = "success",
15 /**
16 * Indicates that the query completed with errors.
17 */
18 Errors = "errors",
19 /**
20 * Indicates that the query completed but the outcome was unknown.
21 */
22 Completed = "completed",
23 /**
24 * Indicates that the query was stopped.
25 */
26 Stopped = "stopped",
27 /**
28 * Indicates that the query timed out during execution.
29 */
30 Timeout = "timeout",
31 /**
32 * Indicates that a connection was closed during execution of the query.
33 */
34 Closed = "closed",
35 /**
36 * Indicates that the query stopped with fatal errors.
37 */
38 Fatal = "fatal",
39 /**
40 * Indicates that the query was aborted while executing.
41 */
42 Aborted = "aborted",
43 /**
44 * Indicates that the status of the query is unknown.
45 */
46 Unknown = "unknown"
47}
48/**
49 * Contains the results of an analytics query.
50 *
51 * @category Analytics
52 */
53export declare class AnalyticsResult<TRow = any> {
54 /**
55 * The rows which have been returned by the query.
56 */
57 rows: TRow[];
58 /**
59 * The meta-data which has been returned by the query.
60 */
61 meta: AnalyticsMetaData;
62 /**
63 * @internal
64 */
65 constructor(data: AnalyticsResult);
66}
67/**
68 * Contains the meta-data that is returend from an analytics query.
69 *
70 * @category Analytics
71 */
72export declare class AnalyticsMetaData {
73 /**
74 * The request ID which is associated with the executed query.
75 */
76 requestId: string;
77 /**
78 * The client context id which is assoicated with the executed query.
79 */
80 clientContextId: string;
81 /**
82 * The status of the query at the time the query meta-data was generated.
83 */
84 status: AnalyticsStatus;
85 /**
86 * Provides the signature of the query.
87 */
88 signature?: any;
89 /**
90 * Any warnings that occurred during the execution of the query.
91 */
92 warnings: AnalyticsWarning[];
93 /**
94 * Various metrics which are made available by the query engine.
95 */
96 metrics: AnalyticsMetrics;
97 /**
98 * @internal
99 */
100 constructor(data: AnalyticsMetaData);
101}
102/**
103 * Contains information about a warning which occurred during the
104 * execution of an analytics query.
105 *
106 * @category Analytics
107 */
108export declare class AnalyticsWarning {
109 /**
110 * The numeric code associated with the warning which occurred.
111 */
112 code: number;
113 /**
114 * A human readable representation of the warning which occurred.
115 */
116 message: string;
117 /**
118 * @internal
119 */
120 constructor(data: AnalyticsWarning);
121}
122/**
123 * Contains various metrics that are returned by the server following
124 * the execution of an analytics query.
125 *
126 * @category Analytics
127 */
128export declare class AnalyticsMetrics {
129 /**
130 * The total amount of time spent running the query, in milliseconds.
131 */
132 elapsedTime: number;
133 /**
134 * The total amount of time spent executing the query, in milliseconds.
135 */
136 executionTime: number;
137 /**
138 * The total number of rows which were part of the result set.
139 */
140 resultCount: number;
141 /**
142 * The total number of bytes which were generated as part of the result set.
143 */
144 resultSize: number;
145 /**
146 * The total number of errors which were encountered during the execution of the query.
147 */
148 errorCount: number;
149 /**
150 * The total number of objects that were processed as part of execution of the query.
151 */
152 processedObjects: number;
153 /**
154 * The total number of warnings which were encountered during the execution of the query.
155 */
156 warningCount: number;
157 /**
158 * @internal
159 */
160 constructor(data: AnalyticsMetrics);
161}
162/**
163 * Represents the various scan consistency options that are available when
164 * querying against the analytics service.
165 *
166 * @category Analytics
167 */
168export declare enum AnalyticsScanConsistency {
169 /**
170 * Indicates that no specific consistency is required, this is the fastest
171 * options, but results may not include the most recent operations which have
172 * been performed.
173 */
174 NotBounded = "not_bounded",
175 /**
176 * Indicates that the results to the query should include all operations that
177 * have occurred up until the query was started. This incurs a performance
178 * penalty of waiting for the index to catch up to the most recent operations,
179 * but provides the highest level of consistency.
180 */
181 RequestPlus = "request_plus"
182}
183/**
184 * @category Analytics
185 */
186export interface AnalyticsQueryOptions {
187 /**
188 * Values to be used for the placeholders within the query.
189 */
190 parameters?: {
191 [key: string]: any;
192 } | any[];
193 /**
194 * Specifies the consistency requirements when executing the query.
195 *
196 * @see AnalyticsScanConsistency
197 */
198 scanConsistency?: AnalyticsScanConsistency;
199 /**
200 * The returned client context id for this query.
201 */
202 clientContextId?: string;
203 /**
204 * Indicates whether this query should be executed with a specific priority level.
205 */
206 priority?: boolean;
207 /**
208 * Indicates whether this query should be executed in read-only mode.
209 */
210 readOnly?: boolean;
211 /**
212 * Specifies the context within which this query should be executed. This can be
213 * scoped to a scope or a collection within the dataset.
214 */
215 queryContext?: string;
216 /**
217 * Specifies any additional parameters which should be passed to the query engine
218 * when executing the query.
219 */
220 raw?: {
221 [key: string]: any;
222 };
223 /**
224 * The timeout for this operation, represented in milliseconds.
225 */
226 timeout?: number;
227}