UNPKG

4.69 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.QueryScanConsistency = exports.QueryProfileMode = exports.QueryMetrics = exports.QueryWarning = exports.QueryMetaData = exports.QueryResult = exports.QueryStatus = void 0;
4/**
5 * Represents the status of a query.
6 *
7 * @category Query
8 */
9var QueryStatus;
10(function (QueryStatus) {
11 /**
12 * Indicates the query is still running.
13 */
14 QueryStatus["Running"] = "running";
15 /**
16 * Indicates that the query completed successfully.
17 */
18 QueryStatus["Success"] = "success";
19 /**
20 * Indicates that the query completed with errors.
21 */
22 QueryStatus["Errors"] = "errors";
23 /**
24 * Indicates that the query completed but the outcome was unknown.
25 */
26 QueryStatus["Completed"] = "completed";
27 /**
28 * Indicates that the query was stopped.
29 */
30 QueryStatus["Stopped"] = "stopped";
31 /**
32 * Indicates that the query timed out during execution.
33 */
34 QueryStatus["Timeout"] = "timeout";
35 /**
36 * Indicates that a connection was closed during execution of the query.
37 */
38 QueryStatus["Closed"] = "closed";
39 /**
40 * Indicates that the query stopped with fatal errors.
41 */
42 QueryStatus["Fatal"] = "fatal";
43 /**
44 * Indicates that the query was aborted while executing.
45 */
46 QueryStatus["Aborted"] = "aborted";
47 /**
48 * Indicates that the status of the query is unknown.
49 */
50 QueryStatus["Unknown"] = "unknown";
51})(QueryStatus || (exports.QueryStatus = QueryStatus = {}));
52/**
53 * Contains the results of a query.
54 *
55 * @category Query
56 */
57class QueryResult {
58 /**
59 * @internal
60 */
61 constructor(data) {
62 this.rows = data.rows;
63 this.meta = data.meta;
64 }
65}
66exports.QueryResult = QueryResult;
67/**
68 * Contains the meta-data that is returend from a query.
69 *
70 * @category Query
71 */
72class QueryMetaData {
73 /**
74 * @internal
75 */
76 constructor(data) {
77 this.requestId = data.requestId;
78 this.clientContextId = data.clientContextId;
79 this.status = data.status;
80 this.signature = data.signature;
81 this.warnings = data.warnings;
82 this.metrics = data.metrics;
83 this.profile = data.profile;
84 }
85}
86exports.QueryMetaData = QueryMetaData;
87/**
88 * Contains information about a warning which occurred during the
89 * execution of a query.
90 *
91 * @category Query
92 */
93class QueryWarning {
94 /**
95 * @internal
96 */
97 constructor(data) {
98 this.code = data.code;
99 this.message = data.message;
100 }
101}
102exports.QueryWarning = QueryWarning;
103/**
104 * Contains various metrics that are returned by the server following
105 * the execution of a query.
106 *
107 * @category Query
108 */
109class QueryMetrics {
110 /**
111 * @internal
112 */
113 constructor(data) {
114 this.elapsedTime = data.elapsedTime;
115 this.executionTime = data.executionTime;
116 this.sortCount = data.sortCount;
117 this.resultCount = data.resultCount;
118 this.resultSize = data.resultSize;
119 this.mutationCount = data.mutationCount;
120 this.errorCount = data.errorCount;
121 this.warningCount = data.warningCount;
122 }
123}
124exports.QueryMetrics = QueryMetrics;
125/**
126 * Specifies the profiling mode for a query.
127 *
128 * @category Query
129 */
130var QueryProfileMode;
131(function (QueryProfileMode) {
132 /**
133 * Disables the generation of profiling data.
134 */
135 QueryProfileMode["Off"] = "off";
136 /**
137 * Enables profiling of the phases of a query.
138 */
139 QueryProfileMode["Phases"] = "phases";
140 /**
141 * Enables profiling of the timings of a query.
142 */
143 QueryProfileMode["Timings"] = "timings";
144})(QueryProfileMode || (exports.QueryProfileMode = QueryProfileMode = {}));
145/**
146 * Represents the various scan consistency options that are available when
147 * querying against the query service.
148 *
149 * @category Query
150 */
151var QueryScanConsistency;
152(function (QueryScanConsistency) {
153 /**
154 * Indicates that no specific consistency is required, this is the fastest
155 * options, but results may not include the most recent operations which have
156 * been performed.
157 */
158 QueryScanConsistency["NotBounded"] = "not_bounded";
159 /**
160 * Indicates that the results to the query should include all operations that
161 * have occurred up until the query was started. This incurs a performance
162 * penalty of waiting for the index to catch up to the most recent operations,
163 * but provides the highest level of consistency.
164 */
165 QueryScanConsistency["RequestPlus"] = "request_plus";
166})(QueryScanConsistency || (exports.QueryScanConsistency = QueryScanConsistency = {}));