@itwin/core-common 4.3.0-dev.1 → 4.3.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/lib/cjs/ConcurrentQuery.d.ts +15 -0
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +8 -9
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ConcurrentQuery.d.ts +15 -0
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ConcurrentQuery.js +7 -8
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Log - @itwin/core-common
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 16 Oct 2023 12:52:10 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.1.9
|
|
6
|
+
Tue, 10 Oct 2023 18:48:12 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.1.8
|
|
11
|
+
Fri, 06 Oct 2023 04:00:18 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
4
14
|
|
|
5
15
|
## 4.1.7
|
|
6
16
|
Thu, 28 Sep 2023 21:41:33 GMT
|
|
@@ -105,6 +115,16 @@ Mon, 22 May 2023 15:34:14 GMT
|
|
|
105
115
|
- Add interfaces representing 3d tileset schema.
|
|
106
116
|
- add Atmosphere class as a property of Environment
|
|
107
117
|
|
|
118
|
+
## 3.7.16
|
|
119
|
+
Mon, 16 Oct 2023 12:49:07 GMT
|
|
120
|
+
|
|
121
|
+
_Version update only_
|
|
122
|
+
|
|
123
|
+
## 3.7.15
|
|
124
|
+
Tue, 10 Oct 2023 19:58:35 GMT
|
|
125
|
+
|
|
126
|
+
_Version update only_
|
|
127
|
+
|
|
108
128
|
## 3.7.14
|
|
109
129
|
Fri, 29 Sep 2023 16:57:16 GMT
|
|
110
130
|
|
|
@@ -236,6 +236,21 @@ export declare class BlobOptionsBuilder {
|
|
|
236
236
|
*/
|
|
237
237
|
setDelay(val: number): this;
|
|
238
238
|
}
|
|
239
|
+
/** @internal */
|
|
240
|
+
export declare enum QueryParamType {
|
|
241
|
+
Boolean = 0,
|
|
242
|
+
Double = 1,
|
|
243
|
+
Id = 2,
|
|
244
|
+
IdSet = 3,
|
|
245
|
+
Integer = 4,
|
|
246
|
+
Long = 5,
|
|
247
|
+
Null = 6,
|
|
248
|
+
Point2d = 7,
|
|
249
|
+
Point3d = 8,
|
|
250
|
+
String = 9,
|
|
251
|
+
Blob = 10,
|
|
252
|
+
Struct = 11
|
|
253
|
+
}
|
|
239
254
|
/**
|
|
240
255
|
* Bind values to an ECSQL query.
|
|
241
256
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentQuery.d.ts","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAqB,QAAQ,EAAQ,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxD;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB;;OAEG;IACH,qBAAqB,IAAA;IACrB;;OAEG;IACH,uBAAuB,IAAA;IACvB;;OAEG;IACH,kBAAkB,IAAA;CACnB;AAED;;;;KAIK;AACL,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,cAAc;AACd,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;I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QxD;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB,CAAC,QAAQ,SAAS,SAAS,EAAE,SAAS,SAAS,UAAU;IACzF,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAChD;AAED,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbQueryError = exports.DbValueFormat = exports.DbResponseStatus = exports.DbResponseKind = exports.DbRequestKind = exports.QueryBinder = exports.BlobOptionsBuilder = exports.QueryOptionsBuilder = exports.QueryRowFormat = void 0;
|
|
3
|
+
exports.DbQueryError = exports.DbValueFormat = exports.DbResponseStatus = exports.DbResponseKind = exports.DbRequestKind = exports.QueryBinder = exports.QueryParamType = exports.BlobOptionsBuilder = exports.QueryOptionsBuilder = exports.QueryRowFormat = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -215,7 +215,7 @@ var QueryParamType;
|
|
|
215
215
|
QueryParamType[QueryParamType["String"] = 9] = "String";
|
|
216
216
|
QueryParamType[QueryParamType["Blob"] = 10] = "Blob";
|
|
217
217
|
QueryParamType[QueryParamType["Struct"] = 11] = "Struct";
|
|
218
|
-
})(QueryParamType || (QueryParamType = {}));
|
|
218
|
+
})(QueryParamType = exports.QueryParamType || (exports.QueryParamType = {}));
|
|
219
219
|
/**
|
|
220
220
|
* Bind values to an ECSQL query.
|
|
221
221
|
*
|
|
@@ -252,11 +252,10 @@ class QueryBinder {
|
|
|
252
252
|
if (typeof indexOrName === "number") {
|
|
253
253
|
if (indexOrName < 1)
|
|
254
254
|
throw new Error("expect index to be >= 1");
|
|
255
|
+
return;
|
|
255
256
|
}
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
throw new Error("expect named parameter to meet identifier specification");
|
|
259
|
-
}
|
|
257
|
+
if (!/^[a-zA-Z_]+\w*$/i.test(indexOrName)) {
|
|
258
|
+
throw new Error("expect named parameter to meet identifier specification");
|
|
260
259
|
}
|
|
261
260
|
}
|
|
262
261
|
/**
|
|
@@ -487,12 +486,12 @@ class QueryBinder {
|
|
|
487
486
|
else if (val instanceof Array && val.length > 0 && typeof val[0] === "string" && core_bentley_1.Id64.isValidId64(val[0])) {
|
|
488
487
|
params.bindIdSet(nameOrId, val);
|
|
489
488
|
}
|
|
490
|
-
else if (typeof val === "object" && !Array.isArray(val)) {
|
|
491
|
-
params.bindStruct(nameOrId, val);
|
|
492
|
-
}
|
|
493
489
|
else if (typeof val === "undefined" || val === null) {
|
|
494
490
|
params.bindNull(nameOrId);
|
|
495
491
|
}
|
|
492
|
+
else if (typeof val === "object" && !Array.isArray(val)) {
|
|
493
|
+
params.bindStruct(nameOrId, val);
|
|
494
|
+
}
|
|
496
495
|
else {
|
|
497
496
|
throw new Error("unsupported type");
|
|
498
497
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuH;AACvH,wDAAwD;AACxD,yCAAmC;AAEnC;;;;;;GAMG;AACH,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB;;OAEG;IACH,qFAAqB,CAAA;IACrB;;OAEG;IACH,yFAAuB,CAAA;IACvB;;OAEG;IACH,+EAAkB,CAAA;AACpB,CAAC,EAbW,cAA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Q,GAAR,QAAQ,CAAK;QAAkB,YAAO,GAAP,OAAO,CAAM;IAE/E,CAAC;IACM,MAAM,CAAC,YAAY,CAAC,QAAa,EAAE,OAAa;QACrD,IAAK,QAAQ,CAAC,MAAiB,IAAK,gBAAgB,CAAC,KAAgB,EAAE;YACrE,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC3C;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,EAAE;YAC/C,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,uBAAQ,CAAC,mBAAmB,CAAC,CAAC;SACzE;IACH,CAAC;CACF;AAZD,oCAYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\nimport { BentleyError, CompressedId64Set, DbResult, Id64, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\r\nimport { Base64 } from \"js-base64\";\r\n\r\n/**\r\n * Specifies the format of the rows returned by the `query` and `restartQuery` methods of\r\n * [IModelConnection]($frontend), [IModelDb]($backend), and [ECDb]($backend).\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport enum QueryRowFormat {\r\n /** Each row is an object in which each non-null column value can be accessed by its name as defined in the ECSql.\r\n * Null values are omitted.\r\n */\r\n UseECSqlPropertyNames,\r\n /** Each row is an array of values accessed by an index corresponding to the property's position in the ECSql SELECT statement.\r\n * Null values are included if they are followed by a non-null column, but trailing null values at the end of the array are omitted.\r\n */\r\n UseECSqlPropertyIndexes,\r\n /** Each row is an object in which each non-null column value can be accessed by a [remapped property name]($docs/learning/ECSqlRowFormat.md).\r\n * This format is backwards-compatible with the format produced by iTwin.js 2.x. Null values are omitted.\r\n */\r\n UseJsPropertyNames,\r\n}\r\n\r\n/**\r\n * Specify limit or range of rows to return\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryLimit {\r\n /** Number of rows to return */\r\n count?: number;\r\n /** Offset from which to return rows */\r\n offset?: number;\r\n}\r\n\r\n/** @public */\r\nexport interface QueryPropertyMetaData {\r\n className: string;\r\n generated: boolean;\r\n index: number;\r\n jsonName: string;\r\n name: string;\r\n extendType: string;\r\n typeName: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface DbRuntimeStats {\r\n cpuTime: number;\r\n totalTime: number;\r\n timeLimit: number;\r\n memLimit: number;\r\n memUsed: number;\r\n}\r\n\r\n/**\r\n * Quota hint for the query.\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryQuota {\r\n /** Max time allowed in seconds. This is hint and may not be honoured but help in prioritize request */\r\n time?: number;\r\n /** Max memory allowed in bytes. This is hint and may not be honoured but help in prioritize request */\r\n memory?: number;\r\n}\r\n\r\n/**\r\n * Config for all request made to concurrent query engine.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BaseReaderOptions {\r\n /** Determine priority of this query default to 0, used as hint and can be overriden by backend. */\r\n priority?: number;\r\n /** If specified cancel last query (if any) with same restart token and queue the new query */\r\n restartToken?: string;\r\n /** For editing apps this can be set to true and all query will run on primary connection\r\n * his may cause slow queries execution but the most recent data changes will be visitable via query\r\n */\r\n usePrimaryConn?: boolean;\r\n /** Restrict time or memory for query but use as hint and may be changed base on backend settings */\r\n quota?: QueryQuota;\r\n /**\r\n * @internal\r\n * Allow query to be be deferred by milliseconds specified. This parameter is ignore by default unless\r\n * concurrent query is configure to honour it.\r\n */\r\n delay?: number;\r\n}\r\n\r\n/**\r\n * ECSql query config\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryOptions extends BaseReaderOptions {\r\n /**\r\n * default to false. It abbreviate blobs to single bytes. This help cases where wildcard is\r\n * used in select clause. Use BlobReader api to read individual blob specially if its of large size.\r\n * */\r\n abbreviateBlobs?: boolean;\r\n /**\r\n * default to false. It will suppress error and will not log it. Useful in cases where we expect query\r\n * can fail.\r\n */\r\n suppressLogErrors?: boolean;\r\n /** This is used internally. If true it query will return meta data about query. */\r\n includeMetaData?: boolean;\r\n /** Limit range of rows returned by query*/\r\n limit?: QueryLimit;\r\n /**\r\n * Convert ECClassId, SourceECClassId, TargetECClassId and RelClassId to respective name.\r\n * When true, XXXXClassId property will be returned as className.\r\n * */\r\n convertClassIdsToClassNames?: boolean;\r\n /**\r\n * Determine row format.\r\n */\r\n rowFormat?: QueryRowFormat;\r\n}\r\n/** @beta */\r\nexport type BlobRange = QueryLimit;\r\n\r\n/** @beta */\r\nexport interface BlobOptions extends BaseReaderOptions {\r\n range?: BlobRange;\r\n}\r\n\r\n/** @public */\r\nexport class QueryOptionsBuilder {\r\n public constructor(private _options: QueryOptions = {}) { }\r\n public getOptions(): QueryOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of query. Query will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other query(s) in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous query with same token is cancelled.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for query. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a query to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * By default all blobs are abbreviated to save memory and network bandwidth. If set to false, all blob data will be returned by query as is.\r\n * Use @type BlobReader to access blob data more efficiently.\r\n * @param val A boolean value, if set to false will return complete blob type property data. This could cost time and network bandwidth.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setAbbreviateBlobs(val: boolean) {\r\n this._options.abbreviateBlobs = val;\r\n return this;\r\n }\r\n /**\r\n * When query fail to prepare it will log error. This setting will suppress log errors in case where query come from user typing it and its expected to fail often.\r\n * @param val A boolean value, if set to true, any error logging will be suppressed.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setSuppressLogErrors(val: boolean) {\r\n this._options.suppressLogErrors = val;\r\n return this;\r\n }\r\n /**\r\n * If set ECClassId, SourceECClassId and TargetECClassId system properties will return qualified name of class instead of a @typedef Id64String.\r\n * @param val A boolean value.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setConvertClassIdsToNames(val: boolean) {\r\n this._options.convertClassIdsToClassNames = val;\r\n return this;\r\n }\r\n /**\r\n * Specify limit for query. Limit determine number of rows and offset in result-set.\r\n * @param val Specify count and offset from within the result-set of a ECSQL query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setLimit(val: QueryLimit) {\r\n this._options.limit = val;\r\n return this;\r\n }\r\n /**\r\n * Specify row format returned by concurrent query manager.\r\n * @param val @enum QueryRowFormat specifying format for result.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRowFormat(val: QueryRowFormat) {\r\n this._options.rowFormat = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of query in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n/** @beta */\r\nexport class BlobOptionsBuilder {\r\n public constructor(private _options: BlobOptions = {}) { }\r\n public getOptions(): BlobOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of blob request. Blob request will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other blob request in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous blob request with same token is cancelled.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for blob request. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a blob request to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute blob request.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * Specify range with in the blob that need to be returned.\r\n * @param val Specify offset and count of bytes that need to be returned.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRange(val: BlobRange) {\r\n this._options.range = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of blob request in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n\r\n/** @internal */\r\nenum QueryParamType {\r\n Boolean = 0,\r\n Double = 1,\r\n Id = 2,\r\n IdSet = 3,\r\n Integer = 4,\r\n Long = 5,\r\n Null = 6,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point2d = 7,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point3d = 8,\r\n String = 9,\r\n Blob = 10,\r\n Struct = 11,\r\n}\r\n\r\n/**\r\n * Bind values to an ECSQL query.\r\n *\r\n * All binding class methods accept an `indexOrName` parameter as a `string | number` type and a value to bind to it.\r\n * A binding must be mapped either by a positional index or a string/name. See the examples below.\r\n *\r\n * @example\r\n * Parameter By Index:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=? AND b=?\r\n * ```\r\n * The first `?` is index 1 and the second `?` is index 2. The parameter index starts with 1 and not 0.\r\n *\r\n * @example\r\n * Parameter By Name:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b\r\n * ```\r\n * Using \"name_a\" as the `indexOrName` will bind the provided value to `name_a` in the query. And the same goes for\r\n * using \"name_b\" and the `name_b` binding respectively.\r\n *\r\n * @see\r\n * - [ECSQL Parameters]($docs/learning/ECSQL.md#ecsql-parameters)\r\n * - [ECSQL Parameter Types]($docs/learning/ECSQLParameterTypes)\r\n * - [ECSQL Code Examples]($docs/learning/backend/ECSQLCodeExamples#parameter-bindings)\r\n *\r\n * @public\r\n */\r\nexport class QueryBinder {\r\n private _args = {};\r\n private verify(indexOrName: string | number) {\r\n if (typeof indexOrName === \"number\") {\r\n if (indexOrName < 1)\r\n throw new Error(\"expect index to be >= 1\");\r\n }\r\n if (typeof indexOrName === \"string\") {\r\n if (!/^[a-zA-Z_]+\\w*$/i.test(indexOrName)) {\r\n throw new Error(\"expect named parameter to meet identifier specification\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Bind boolean value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Boolean value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBoolean(indexOrName: string | number, val: boolean) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true,\r\n value: {\r\n type: QueryParamType.Boolean,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind blob value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Blob value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBlob(indexOrName: string | number, val: Uint8Array) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n const base64 = Base64.fromUint8Array(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Blob,\r\n value: base64,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind double value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Double value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindDouble(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Double,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @typedef Id64String value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @typedef Id64String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindId(indexOrName: string | number, val: Id64String) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Id,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type OrderedId64Iterable to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type OrderedId64Iterable value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindIdSet(indexOrName: string | number, val: OrderedId64Iterable) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n OrderedId64Iterable.uniqueIterator(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.IdSet,\r\n value: CompressedId64Set.sortAndCompress(OrderedId64Iterable.uniqueIterator(val)),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind integer to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Integer value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindInt(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Integer,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind struct to ECSQL statement. Struct specified as object.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val struct value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindStruct(indexOrName: string | number, val: object) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Struct,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind long to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Long value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindLong(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Long,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind string to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindString(indexOrName: string | number, val: string) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.String,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind null to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindNull(indexOrName: string | number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Null,\r\n value: null,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point2d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point2d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint2d(indexOrName: string | number, val: Point2d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point2d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point3d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point3d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint3d(indexOrName: string | number, val: Point3d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point3d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n private static bind(params: QueryBinder, nameOrId: string | number, val: any) {\r\n if (typeof val === \"boolean\") {\r\n params.bindBoolean(nameOrId, val);\r\n } else if (typeof val === \"number\") {\r\n params.bindDouble(nameOrId, val);\r\n } else if (typeof val === \"string\") {\r\n params.bindString(nameOrId, val);\r\n } else if (val instanceof Uint8Array) {\r\n params.bindBlob(nameOrId, val);\r\n } else if (val instanceof Point2d) {\r\n params.bindPoint2d(nameOrId, val);\r\n } else if (val instanceof Point3d) {\r\n params.bindPoint3d(nameOrId, val);\r\n } else if (val instanceof Array && val.length > 0 && typeof val[0] === \"string\" && Id64.isValidId64(val[0])) {\r\n params.bindIdSet(nameOrId, val);\r\n } else if (typeof val === \"object\" && !Array.isArray(val)) {\r\n params.bindStruct(nameOrId, val);\r\n } else if (typeof val === \"undefined\" || val === null) {\r\n params.bindNull(nameOrId);\r\n } else {\r\n throw new Error(\"unsupported type\");\r\n }\r\n }\r\n\r\n /**\r\n * Allow bulk bind either parameters by index as value array or by parameter names as object.\r\n * @param args if array of values is provided then array index is used as index. If object is provided then object property name is used as parameter name of reach value.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public static from(args: any[] | object | undefined): QueryBinder {\r\n const params = new QueryBinder();\r\n if (typeof args === \"undefined\")\r\n return params;\r\n\r\n if (Array.isArray(args)) {\r\n let i = 1;\r\n for (const val of args) {\r\n this.bind(params, i++, val);\r\n }\r\n } else {\r\n for (const prop of Object.getOwnPropertyNames(args)) {\r\n this.bind(params, prop, (args as any)[prop]);\r\n }\r\n }\r\n return params;\r\n }\r\n\r\n public serialize(): object {\r\n return this._args;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum DbRequestKind {\r\n BlobIO = 0,\r\n ECSql = 1\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseKind {\r\n BlobIO = DbRequestKind.BlobIO,\r\n ECSql = DbRequestKind.ECSql,\r\n NoResult = 2\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseStatus {\r\n Done = 1, /* query ran to completion. */\r\n Cancel = 2, /* Requested by user.*/\r\n Partial = 3, /* query was running but ran out of quota.*/\r\n Timeout = 4, /* query time quota expired while it was in queue.*/\r\n QueueFull = 5, /* could not submit the query as queue was full.*/\r\n Error = 100, /* generic error*/\r\n Error_ECSql_PreparedFailed = Error + 1, /* ecsql prepared failed*/\r\n Error_ECSql_StepFailed = Error + 2, /* ecsql step failed*/\r\n Error_ECSql_RowToJsonFailed = Error + 3, /* ecsql failed to serialized row to json.*/\r\n Error_ECSql_BindingFailed = Error + 4, /* ecsql binding failed.*/\r\n Error_BlobIO_OpenFailed = Error + 5, /* class or property or instance specified was not found or property as not of type blob.*/\r\n Error_BlobIO_OutOfRange = Error + 6, /* range specified is invalid based on size of blob.*/\r\n}\r\n\r\n/** @internal */\r\nexport enum DbValueFormat {\r\n ECSqlNames = 0,\r\n JsNames = 1\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequest extends BaseReaderOptions {\r\n kind?: DbRequestKind;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryRequest extends DbRequest, QueryOptions {\r\n valueFormat?: DbValueFormat;\r\n query: string;\r\n args?: object;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobRequest extends DbRequest, BlobOptions {\r\n className: string;\r\n accessString: string;\r\n instanceId: Id64String;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbResponse {\r\n stats: DbRuntimeStats;\r\n status: DbResponseStatus;\r\n kind: DbResponseKind;\r\n error?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryResponse extends DbResponse {\r\n meta: QueryPropertyMetaData[];\r\n data: any[];\r\n rowCount: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobResponse extends DbResponse {\r\n data?: Uint8Array;\r\n rawBlobSize: number;\r\n}\r\n\r\n/** @public */\r\nexport class DbQueryError extends BentleyError {\r\n public constructor(public readonly response: any, public readonly request?: any, rc?: DbResult) {\r\n super(rc ?? DbResult.BE_SQLITE_ERROR, response.error, { response, request });\r\n }\r\n public static throwIfError(response: any, request?: any) {\r\n if ((response.status as number) >= (DbResponseStatus.Error as number)) {\r\n throw new DbQueryError(response, request);\r\n }\r\n if (response.status === DbResponseStatus.Cancel) {\r\n throw new DbQueryError(response, request, DbResult.BE_SQLITE_INTERRUPT);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequestExecutor<TRequest extends DbRequest, TResponse extends DbResponse> {\r\n execute(request: TRequest): Promise<TResponse>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryConfig {\r\n globalQuota?: QueryQuota;\r\n ignoreDelay?: boolean;\r\n ignorePriority?: boolean;\r\n requestQueueSize?: number;\r\n workerThreads?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuH;AACvH,wDAAwD;AACxD,yCAAmC;AAEnC;;;;;;GAMG;AACH,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB;;OAEG;IACH,qFAAqB,CAAA;IACrB;;OAEG;IACH,yFAAuB,CAAA;IACvB;;OAEG;IACH,+EAAkB,CAAA;AACpB,CAAC,EAbW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAazB;AA4GD,cAAc;AACd,MAAa,mBAAmB;IAC9B,YAA2B,WAAyB,EAAE;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAI,CAAC;IACpD,UAAU,KAAmB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D;;;;;OAKG;IACI,WAAW,CAAC,GAAW;QAC5B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;OA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,CAAC,mBAAmB,CAAC,CAAC;SACzE;IACH,CAAC;CACF;AAZD,oCAYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\nimport { BentleyError, CompressedId64Set, DbResult, Id64, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\r\nimport { Base64 } from \"js-base64\";\r\n\r\n/**\r\n * Specifies the format of the rows returned by the `query` and `restartQuery` methods of\r\n * [IModelConnection]($frontend), [IModelDb]($backend), and [ECDb]($backend).\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport enum QueryRowFormat {\r\n /** Each row is an object in which each non-null column value can be accessed by its name as defined in the ECSql.\r\n * Null values are omitted.\r\n */\r\n UseECSqlPropertyNames,\r\n /** Each row is an array of values accessed by an index corresponding to the property's position in the ECSql SELECT statement.\r\n * Null values are included if they are followed by a non-null column, but trailing null values at the end of the array are omitted.\r\n */\r\n UseECSqlPropertyIndexes,\r\n /** Each row is an object in which each non-null column value can be accessed by a [remapped property name]($docs/learning/ECSqlRowFormat.md).\r\n * This format is backwards-compatible with the format produced by iTwin.js 2.x. Null values are omitted.\r\n */\r\n UseJsPropertyNames,\r\n}\r\n\r\n/**\r\n * Specify limit or range of rows to return\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryLimit {\r\n /** Number of rows to return */\r\n count?: number;\r\n /** Offset from which to return rows */\r\n offset?: number;\r\n}\r\n\r\n/** @public */\r\nexport interface QueryPropertyMetaData {\r\n className: string;\r\n generated: boolean;\r\n index: number;\r\n jsonName: string;\r\n name: string;\r\n extendType: string;\r\n typeName: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface DbRuntimeStats {\r\n cpuTime: number;\r\n totalTime: number;\r\n timeLimit: number;\r\n memLimit: number;\r\n memUsed: number;\r\n}\r\n\r\n/**\r\n * Quota hint for the query.\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryQuota {\r\n /** Max time allowed in seconds. This is hint and may not be honoured but help in prioritize request */\r\n time?: number;\r\n /** Max memory allowed in bytes. This is hint and may not be honoured but help in prioritize request */\r\n memory?: number;\r\n}\r\n\r\n/**\r\n * Config for all request made to concurrent query engine.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BaseReaderOptions {\r\n /** Determine priority of this query default to 0, used as hint and can be overriden by backend. */\r\n priority?: number;\r\n /** If specified cancel last query (if any) with same restart token and queue the new query */\r\n restartToken?: string;\r\n /** For editing apps this can be set to true and all query will run on primary connection\r\n * his may cause slow queries execution but the most recent data changes will be visitable via query\r\n */\r\n usePrimaryConn?: boolean;\r\n /** Restrict time or memory for query but use as hint and may be changed base on backend settings */\r\n quota?: QueryQuota;\r\n /**\r\n * @internal\r\n * Allow query to be be deferred by milliseconds specified. This parameter is ignore by default unless\r\n * concurrent query is configure to honour it.\r\n */\r\n delay?: number;\r\n}\r\n\r\n/**\r\n * ECSql query config\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryOptions extends BaseReaderOptions {\r\n /**\r\n * default to false. It abbreviate blobs to single bytes. This help cases where wildcard is\r\n * used in select clause. Use BlobReader api to read individual blob specially if its of large size.\r\n * */\r\n abbreviateBlobs?: boolean;\r\n /**\r\n * default to false. It will suppress error and will not log it. Useful in cases where we expect query\r\n * can fail.\r\n */\r\n suppressLogErrors?: boolean;\r\n /** This is used internally. If true it query will return meta data about query. */\r\n includeMetaData?: boolean;\r\n /** Limit range of rows returned by query*/\r\n limit?: QueryLimit;\r\n /**\r\n * Convert ECClassId, SourceECClassId, TargetECClassId and RelClassId to respective name.\r\n * When true, XXXXClassId property will be returned as className.\r\n * */\r\n convertClassIdsToClassNames?: boolean;\r\n /**\r\n * Determine row format.\r\n */\r\n rowFormat?: QueryRowFormat;\r\n}\r\n/** @beta */\r\nexport type BlobRange = QueryLimit;\r\n\r\n/** @beta */\r\nexport interface BlobOptions extends BaseReaderOptions {\r\n range?: BlobRange;\r\n}\r\n\r\n/** @public */\r\nexport class QueryOptionsBuilder {\r\n public constructor(private _options: QueryOptions = {}) { }\r\n public getOptions(): QueryOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of query. Query will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other query(s) in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous query with same token is cancelled.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for query. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a query to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * By default all blobs are abbreviated to save memory and network bandwidth. If set to false, all blob data will be returned by query as is.\r\n * Use @type BlobReader to access blob data more efficiently.\r\n * @param val A boolean value, if set to false will return complete blob type property data. This could cost time and network bandwidth.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setAbbreviateBlobs(val: boolean) {\r\n this._options.abbreviateBlobs = val;\r\n return this;\r\n }\r\n /**\r\n * When query fail to prepare it will log error. This setting will suppress log errors in case where query come from user typing it and its expected to fail often.\r\n * @param val A boolean value, if set to true, any error logging will be suppressed.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setSuppressLogErrors(val: boolean) {\r\n this._options.suppressLogErrors = val;\r\n return this;\r\n }\r\n /**\r\n * If set ECClassId, SourceECClassId and TargetECClassId system properties will return qualified name of class instead of a @typedef Id64String.\r\n * @param val A boolean value.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setConvertClassIdsToNames(val: boolean) {\r\n this._options.convertClassIdsToClassNames = val;\r\n return this;\r\n }\r\n /**\r\n * Specify limit for query. Limit determine number of rows and offset in result-set.\r\n * @param val Specify count and offset from within the result-set of a ECSQL query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setLimit(val: QueryLimit) {\r\n this._options.limit = val;\r\n return this;\r\n }\r\n /**\r\n * Specify row format returned by concurrent query manager.\r\n * @param val @enum QueryRowFormat specifying format for result.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRowFormat(val: QueryRowFormat) {\r\n this._options.rowFormat = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of query in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n/** @beta */\r\nexport class BlobOptionsBuilder {\r\n public constructor(private _options: BlobOptions = {}) { }\r\n public getOptions(): BlobOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of blob request. Blob request will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other blob request in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous blob request with same token is cancelled.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for blob request. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a blob request to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute blob request.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * Specify range with in the blob that need to be returned.\r\n * @param val Specify offset and count of bytes that need to be returned.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRange(val: BlobRange) {\r\n this._options.range = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of blob request in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum QueryParamType {\r\n Boolean = 0,\r\n Double = 1,\r\n Id = 2,\r\n IdSet = 3,\r\n Integer = 4,\r\n Long = 5,\r\n Null = 6,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point2d = 7,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point3d = 8,\r\n String = 9,\r\n Blob = 10,\r\n Struct = 11,\r\n}\r\n\r\n/**\r\n * Bind values to an ECSQL query.\r\n *\r\n * All binding class methods accept an `indexOrName` parameter as a `string | number` type and a value to bind to it.\r\n * A binding must be mapped either by a positional index or a string/name. See the examples below.\r\n *\r\n * @example\r\n * Parameter By Index:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=? AND b=?\r\n * ```\r\n * The first `?` is index 1 and the second `?` is index 2. The parameter index starts with 1 and not 0.\r\n *\r\n * @example\r\n * Parameter By Name:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b\r\n * ```\r\n * Using \"name_a\" as the `indexOrName` will bind the provided value to `name_a` in the query. And the same goes for\r\n * using \"name_b\" and the `name_b` binding respectively.\r\n *\r\n * @see\r\n * - [ECSQL Parameters]($docs/learning/ECSQL.md#ecsql-parameters)\r\n * - [ECSQL Parameter Types]($docs/learning/ECSQLParameterTypes)\r\n * - [ECSQL Code Examples]($docs/learning/backend/ECSQLCodeExamples#parameter-bindings)\r\n *\r\n * @public\r\n */\r\nexport class QueryBinder {\r\n private _args = {};\r\n private verify(indexOrName: string | number) {\r\n if (typeof indexOrName === \"number\") {\r\n if (indexOrName < 1)\r\n throw new Error(\"expect index to be >= 1\");\r\n return;\r\n }\r\n if (!/^[a-zA-Z_]+\\w*$/i.test(indexOrName)) {\r\n throw new Error(\"expect named parameter to meet identifier specification\");\r\n }\r\n }\r\n\r\n /**\r\n * Bind boolean value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Boolean value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBoolean(indexOrName: string | number, val: boolean) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true,\r\n value: {\r\n type: QueryParamType.Boolean,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind blob value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Blob value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBlob(indexOrName: string | number, val: Uint8Array) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n const base64 = Base64.fromUint8Array(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Blob,\r\n value: base64,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind double value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Double value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindDouble(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Double,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @typedef Id64String value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @typedef Id64String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindId(indexOrName: string | number, val: Id64String) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Id,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type OrderedId64Iterable to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type OrderedId64Iterable value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindIdSet(indexOrName: string | number, val: OrderedId64Iterable) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n OrderedId64Iterable.uniqueIterator(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.IdSet,\r\n value: CompressedId64Set.sortAndCompress(OrderedId64Iterable.uniqueIterator(val)),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind integer to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Integer value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindInt(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Integer,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind struct to ECSQL statement. Struct specified as object.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val struct value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindStruct(indexOrName: string | number, val: object) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Struct,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind long to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Long value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindLong(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Long,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind string to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindString(indexOrName: string | number, val: string) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.String,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind null to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindNull(indexOrName: string | number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Null,\r\n value: null,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point2d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point2d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint2d(indexOrName: string | number, val: Point2d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point2d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point3d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point3d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint3d(indexOrName: string | number, val: Point3d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point3d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n private static bind(params: QueryBinder, nameOrId: string | number, val: any) {\r\n if (typeof val === \"boolean\") {\r\n params.bindBoolean(nameOrId, val);\r\n } else if (typeof val === \"number\") {\r\n params.bindDouble(nameOrId, val);\r\n } else if (typeof val === \"string\") {\r\n params.bindString(nameOrId, val);\r\n } else if (val instanceof Uint8Array) {\r\n params.bindBlob(nameOrId, val);\r\n } else if (val instanceof Point2d) {\r\n params.bindPoint2d(nameOrId, val);\r\n } else if (val instanceof Point3d) {\r\n params.bindPoint3d(nameOrId, val);\r\n } else if (val instanceof Array && val.length > 0 && typeof val[0] === \"string\" && Id64.isValidId64(val[0])) {\r\n params.bindIdSet(nameOrId, val);\r\n } else if (typeof val === \"undefined\" || val === null) {\r\n params.bindNull(nameOrId);\r\n } else if (typeof val === \"object\" && !Array.isArray(val)) {\r\n params.bindStruct(nameOrId, val);\r\n } else {\r\n throw new Error(\"unsupported type\");\r\n }\r\n }\r\n\r\n /**\r\n * Allow bulk bind either parameters by index as value array or by parameter names as object.\r\n * @param args if array of values is provided then array index is used as index. If object is provided then object property name is used as parameter name of reach value.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public static from(args: any[] | object | undefined): QueryBinder {\r\n const params = new QueryBinder();\r\n if (typeof args === \"undefined\")\r\n return params;\r\n\r\n if (Array.isArray(args)) {\r\n let i = 1;\r\n for (const val of args) {\r\n this.bind(params, i++, val);\r\n }\r\n } else {\r\n for (const prop of Object.getOwnPropertyNames(args)) {\r\n this.bind(params, prop, (args as any)[prop]);\r\n }\r\n }\r\n return params;\r\n }\r\n\r\n public serialize(): object {\r\n return this._args;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum DbRequestKind {\r\n BlobIO = 0,\r\n ECSql = 1\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseKind {\r\n BlobIO = DbRequestKind.BlobIO,\r\n ECSql = DbRequestKind.ECSql,\r\n NoResult = 2\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseStatus {\r\n Done = 1, /* query ran to completion. */\r\n Cancel = 2, /* Requested by user.*/\r\n Partial = 3, /* query was running but ran out of quota.*/\r\n Timeout = 4, /* query time quota expired while it was in queue.*/\r\n QueueFull = 5, /* could not submit the query as queue was full.*/\r\n Error = 100, /* generic error*/\r\n Error_ECSql_PreparedFailed = Error + 1, /* ecsql prepared failed*/\r\n Error_ECSql_StepFailed = Error + 2, /* ecsql step failed*/\r\n Error_ECSql_RowToJsonFailed = Error + 3, /* ecsql failed to serialized row to json.*/\r\n Error_ECSql_BindingFailed = Error + 4, /* ecsql binding failed.*/\r\n Error_BlobIO_OpenFailed = Error + 5, /* class or property or instance specified was not found or property as not of type blob.*/\r\n Error_BlobIO_OutOfRange = Error + 6, /* range specified is invalid based on size of blob.*/\r\n}\r\n\r\n/** @internal */\r\nexport enum DbValueFormat {\r\n ECSqlNames = 0,\r\n JsNames = 1\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequest extends BaseReaderOptions {\r\n kind?: DbRequestKind;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryRequest extends DbRequest, QueryOptions {\r\n valueFormat?: DbValueFormat;\r\n query: string;\r\n args?: object;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobRequest extends DbRequest, BlobOptions {\r\n className: string;\r\n accessString: string;\r\n instanceId: Id64String;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbResponse {\r\n stats: DbRuntimeStats;\r\n status: DbResponseStatus;\r\n kind: DbResponseKind;\r\n error?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryResponse extends DbResponse {\r\n meta: QueryPropertyMetaData[];\r\n data: any[];\r\n rowCount: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobResponse extends DbResponse {\r\n data?: Uint8Array;\r\n rawBlobSize: number;\r\n}\r\n\r\n/** @public */\r\nexport class DbQueryError extends BentleyError {\r\n public constructor(public readonly response: any, public readonly request?: any, rc?: DbResult) {\r\n super(rc ?? DbResult.BE_SQLITE_ERROR, response.error, { response, request });\r\n }\r\n public static throwIfError(response: any, request?: any) {\r\n if ((response.status as number) >= (DbResponseStatus.Error as number)) {\r\n throw new DbQueryError(response, request);\r\n }\r\n if (response.status === DbResponseStatus.Cancel) {\r\n throw new DbQueryError(response, request, DbResult.BE_SQLITE_INTERRUPT);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequestExecutor<TRequest extends DbRequest, TResponse extends DbResponse> {\r\n execute(request: TRequest): Promise<TResponse>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryConfig {\r\n globalQuota?: QueryQuota;\r\n ignoreDelay?: boolean;\r\n ignorePriority?: boolean;\r\n requestQueueSize?: number;\r\n workerThreads?: number;\r\n}\r\n"]}
|
|
@@ -236,6 +236,21 @@ export declare class BlobOptionsBuilder {
|
|
|
236
236
|
*/
|
|
237
237
|
setDelay(val: number): this;
|
|
238
238
|
}
|
|
239
|
+
/** @internal */
|
|
240
|
+
export declare enum QueryParamType {
|
|
241
|
+
Boolean = 0,
|
|
242
|
+
Double = 1,
|
|
243
|
+
Id = 2,
|
|
244
|
+
IdSet = 3,
|
|
245
|
+
Integer = 4,
|
|
246
|
+
Long = 5,
|
|
247
|
+
Null = 6,
|
|
248
|
+
Point2d = 7,
|
|
249
|
+
Point3d = 8,
|
|
250
|
+
String = 9,
|
|
251
|
+
Blob = 10,
|
|
252
|
+
Struct = 11
|
|
253
|
+
}
|
|
239
254
|
/**
|
|
240
255
|
* Bind values to an ECSQL query.
|
|
241
256
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentQuery.d.ts","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAqB,QAAQ,EAAQ,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxD;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB;;OAEG;IACH,qBAAqB,IAAA;IACrB;;OAEG;IACH,uBAAuB,IAAA;IACvB;;OAEG;IACH,kBAAkB,IAAA;CACnB;AAED;;;;KAIK;AACL,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,cAAc;AACd,MAAM,WAAW,qBAAqB;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AY,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG;CAQxD;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB,CAAC,QAAQ,SAAS,SAAS,EAAE,SAAS,SAAS,UAAU;IACzF,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAChD;AAED,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -194,7 +194,7 @@ export class BlobOptionsBuilder {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
/** @internal */
|
|
197
|
-
var QueryParamType;
|
|
197
|
+
export var QueryParamType;
|
|
198
198
|
(function (QueryParamType) {
|
|
199
199
|
QueryParamType[QueryParamType["Boolean"] = 0] = "Boolean";
|
|
200
200
|
QueryParamType[QueryParamType["Double"] = 1] = "Double";
|
|
@@ -247,11 +247,10 @@ export class QueryBinder {
|
|
|
247
247
|
if (typeof indexOrName === "number") {
|
|
248
248
|
if (indexOrName < 1)
|
|
249
249
|
throw new Error("expect index to be >= 1");
|
|
250
|
+
return;
|
|
250
251
|
}
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
throw new Error("expect named parameter to meet identifier specification");
|
|
254
|
-
}
|
|
252
|
+
if (!/^[a-zA-Z_]+\w*$/i.test(indexOrName)) {
|
|
253
|
+
throw new Error("expect named parameter to meet identifier specification");
|
|
255
254
|
}
|
|
256
255
|
}
|
|
257
256
|
/**
|
|
@@ -482,12 +481,12 @@ export class QueryBinder {
|
|
|
482
481
|
else if (val instanceof Array && val.length > 0 && typeof val[0] === "string" && Id64.isValidId64(val[0])) {
|
|
483
482
|
params.bindIdSet(nameOrId, val);
|
|
484
483
|
}
|
|
485
|
-
else if (typeof val === "object" && !Array.isArray(val)) {
|
|
486
|
-
params.bindStruct(nameOrId, val);
|
|
487
|
-
}
|
|
488
484
|
else if (typeof val === "undefined" || val === null) {
|
|
489
485
|
params.bindNull(nameOrId);
|
|
490
486
|
}
|
|
487
|
+
else if (typeof val === "object" && !Array.isArray(val)) {
|
|
488
|
+
params.bindStruct(nameOrId, val);
|
|
489
|
+
}
|
|
491
490
|
else {
|
|
492
491
|
throw new Error("unsupported type");
|
|
493
492
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAc,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB;;OAEG;IACH,qFAAqB,CAAA;IACrB;;OAEG;IACH,yFAAuB,CAAA;IACvB;;OAEG;IACH,+EAAkB,CAAA;AACpB,CAAC,EAbW,cAAc,KAAd,cAAc,QAazB;AA4GD,cAAc;AACd,MAAM,OAAO,mBAAmB;IAC9B,YAA2B,WAAyB,EAAE;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAI,CAAC;IACpD,UAAU,KAAmB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D;;;;;OAKG;IACI,WAAW,CAAC,GAAW;QAC5B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;OAIG;I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SACzE;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\nimport { BentleyError, CompressedId64Set, DbResult, Id64, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\r\nimport { Base64 } from \"js-base64\";\r\n\r\n/**\r\n * Specifies the format of the rows returned by the `query` and `restartQuery` methods of\r\n * [IModelConnection]($frontend), [IModelDb]($backend), and [ECDb]($backend).\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport enum QueryRowFormat {\r\n /** Each row is an object in which each non-null column value can be accessed by its name as defined in the ECSql.\r\n * Null values are omitted.\r\n */\r\n UseECSqlPropertyNames,\r\n /** Each row is an array of values accessed by an index corresponding to the property's position in the ECSql SELECT statement.\r\n * Null values are included if they are followed by a non-null column, but trailing null values at the end of the array are omitted.\r\n */\r\n UseECSqlPropertyIndexes,\r\n /** Each row is an object in which each non-null column value can be accessed by a [remapped property name]($docs/learning/ECSqlRowFormat.md).\r\n * This format is backwards-compatible with the format produced by iTwin.js 2.x. Null values are omitted.\r\n */\r\n UseJsPropertyNames,\r\n}\r\n\r\n/**\r\n * Specify limit or range of rows to return\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryLimit {\r\n /** Number of rows to return */\r\n count?: number;\r\n /** Offset from which to return rows */\r\n offset?: number;\r\n}\r\n\r\n/** @public */\r\nexport interface QueryPropertyMetaData {\r\n className: string;\r\n generated: boolean;\r\n index: number;\r\n jsonName: string;\r\n name: string;\r\n extendType: string;\r\n typeName: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface DbRuntimeStats {\r\n cpuTime: number;\r\n totalTime: number;\r\n timeLimit: number;\r\n memLimit: number;\r\n memUsed: number;\r\n}\r\n\r\n/**\r\n * Quota hint for the query.\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryQuota {\r\n /** Max time allowed in seconds. This is hint and may not be honoured but help in prioritize request */\r\n time?: number;\r\n /** Max memory allowed in bytes. This is hint and may not be honoured but help in prioritize request */\r\n memory?: number;\r\n}\r\n\r\n/**\r\n * Config for all request made to concurrent query engine.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BaseReaderOptions {\r\n /** Determine priority of this query default to 0, used as hint and can be overriden by backend. */\r\n priority?: number;\r\n /** If specified cancel last query (if any) with same restart token and queue the new query */\r\n restartToken?: string;\r\n /** For editing apps this can be set to true and all query will run on primary connection\r\n * his may cause slow queries execution but the most recent data changes will be visitable via query\r\n */\r\n usePrimaryConn?: boolean;\r\n /** Restrict time or memory for query but use as hint and may be changed base on backend settings */\r\n quota?: QueryQuota;\r\n /**\r\n * @internal\r\n * Allow query to be be deferred by milliseconds specified. This parameter is ignore by default unless\r\n * concurrent query is configure to honour it.\r\n */\r\n delay?: number;\r\n}\r\n\r\n/**\r\n * ECSql query config\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryOptions extends BaseReaderOptions {\r\n /**\r\n * default to false. It abbreviate blobs to single bytes. This help cases where wildcard is\r\n * used in select clause. Use BlobReader api to read individual blob specially if its of large size.\r\n * */\r\n abbreviateBlobs?: boolean;\r\n /**\r\n * default to false. It will suppress error and will not log it. Useful in cases where we expect query\r\n * can fail.\r\n */\r\n suppressLogErrors?: boolean;\r\n /** This is used internally. If true it query will return meta data about query. */\r\n includeMetaData?: boolean;\r\n /** Limit range of rows returned by query*/\r\n limit?: QueryLimit;\r\n /**\r\n * Convert ECClassId, SourceECClassId, TargetECClassId and RelClassId to respective name.\r\n * When true, XXXXClassId property will be returned as className.\r\n * */\r\n convertClassIdsToClassNames?: boolean;\r\n /**\r\n * Determine row format.\r\n */\r\n rowFormat?: QueryRowFormat;\r\n}\r\n/** @beta */\r\nexport type BlobRange = QueryLimit;\r\n\r\n/** @beta */\r\nexport interface BlobOptions extends BaseReaderOptions {\r\n range?: BlobRange;\r\n}\r\n\r\n/** @public */\r\nexport class QueryOptionsBuilder {\r\n public constructor(private _options: QueryOptions = {}) { }\r\n public getOptions(): QueryOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of query. Query will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other query(s) in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous query with same token is cancelled.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for query. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a query to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * By default all blobs are abbreviated to save memory and network bandwidth. If set to false, all blob data will be returned by query as is.\r\n * Use @type BlobReader to access blob data more efficiently.\r\n * @param val A boolean value, if set to false will return complete blob type property data. This could cost time and network bandwidth.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setAbbreviateBlobs(val: boolean) {\r\n this._options.abbreviateBlobs = val;\r\n return this;\r\n }\r\n /**\r\n * When query fail to prepare it will log error. This setting will suppress log errors in case where query come from user typing it and its expected to fail often.\r\n * @param val A boolean value, if set to true, any error logging will be suppressed.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setSuppressLogErrors(val: boolean) {\r\n this._options.suppressLogErrors = val;\r\n return this;\r\n }\r\n /**\r\n * If set ECClassId, SourceECClassId and TargetECClassId system properties will return qualified name of class instead of a @typedef Id64String.\r\n * @param val A boolean value.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setConvertClassIdsToNames(val: boolean) {\r\n this._options.convertClassIdsToClassNames = val;\r\n return this;\r\n }\r\n /**\r\n * Specify limit for query. Limit determine number of rows and offset in result-set.\r\n * @param val Specify count and offset from within the result-set of a ECSQL query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setLimit(val: QueryLimit) {\r\n this._options.limit = val;\r\n return this;\r\n }\r\n /**\r\n * Specify row format returned by concurrent query manager.\r\n * @param val @enum QueryRowFormat specifying format for result.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRowFormat(val: QueryRowFormat) {\r\n this._options.rowFormat = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of query in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n/** @beta */\r\nexport class BlobOptionsBuilder {\r\n public constructor(private _options: BlobOptions = {}) { }\r\n public getOptions(): BlobOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of blob request. Blob request will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other blob request in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous blob request with same token is cancelled.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for blob request. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a blob request to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute blob request.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * Specify range with in the blob that need to be returned.\r\n * @param val Specify offset and count of bytes that need to be returned.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRange(val: BlobRange) {\r\n this._options.range = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of blob request in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n\r\n/** @internal */\r\nenum QueryParamType {\r\n Boolean = 0,\r\n Double = 1,\r\n Id = 2,\r\n IdSet = 3,\r\n Integer = 4,\r\n Long = 5,\r\n Null = 6,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point2d = 7,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point3d = 8,\r\n String = 9,\r\n Blob = 10,\r\n Struct = 11,\r\n}\r\n\r\n/**\r\n * Bind values to an ECSQL query.\r\n *\r\n * All binding class methods accept an `indexOrName` parameter as a `string | number` type and a value to bind to it.\r\n * A binding must be mapped either by a positional index or a string/name. See the examples below.\r\n *\r\n * @example\r\n * Parameter By Index:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=? AND b=?\r\n * ```\r\n * The first `?` is index 1 and the second `?` is index 2. The parameter index starts with 1 and not 0.\r\n *\r\n * @example\r\n * Parameter By Name:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b\r\n * ```\r\n * Using \"name_a\" as the `indexOrName` will bind the provided value to `name_a` in the query. And the same goes for\r\n * using \"name_b\" and the `name_b` binding respectively.\r\n *\r\n * @see\r\n * - [ECSQL Parameters]($docs/learning/ECSQL.md#ecsql-parameters)\r\n * - [ECSQL Parameter Types]($docs/learning/ECSQLParameterTypes)\r\n * - [ECSQL Code Examples]($docs/learning/backend/ECSQLCodeExamples#parameter-bindings)\r\n *\r\n * @public\r\n */\r\nexport class QueryBinder {\r\n private _args = {};\r\n private verify(indexOrName: string | number) {\r\n if (typeof indexOrName === \"number\") {\r\n if (indexOrName < 1)\r\n throw new Error(\"expect index to be >= 1\");\r\n }\r\n if (typeof indexOrName === \"string\") {\r\n if (!/^[a-zA-Z_]+\\w*$/i.test(indexOrName)) {\r\n throw new Error(\"expect named parameter to meet identifier specification\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Bind boolean value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Boolean value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBoolean(indexOrName: string | number, val: boolean) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true,\r\n value: {\r\n type: QueryParamType.Boolean,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind blob value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Blob value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBlob(indexOrName: string | number, val: Uint8Array) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n const base64 = Base64.fromUint8Array(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Blob,\r\n value: base64,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind double value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Double value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindDouble(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Double,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @typedef Id64String value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @typedef Id64String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindId(indexOrName: string | number, val: Id64String) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Id,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type OrderedId64Iterable to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type OrderedId64Iterable value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindIdSet(indexOrName: string | number, val: OrderedId64Iterable) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n OrderedId64Iterable.uniqueIterator(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.IdSet,\r\n value: CompressedId64Set.sortAndCompress(OrderedId64Iterable.uniqueIterator(val)),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind integer to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Integer value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindInt(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Integer,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind struct to ECSQL statement. Struct specified as object.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val struct value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindStruct(indexOrName: string | number, val: object) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Struct,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind long to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Long value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindLong(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Long,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind string to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindString(indexOrName: string | number, val: string) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.String,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind null to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindNull(indexOrName: string | number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Null,\r\n value: null,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point2d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point2d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint2d(indexOrName: string | number, val: Point2d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point2d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point3d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point3d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint3d(indexOrName: string | number, val: Point3d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point3d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n private static bind(params: QueryBinder, nameOrId: string | number, val: any) {\r\n if (typeof val === \"boolean\") {\r\n params.bindBoolean(nameOrId, val);\r\n } else if (typeof val === \"number\") {\r\n params.bindDouble(nameOrId, val);\r\n } else if (typeof val === \"string\") {\r\n params.bindString(nameOrId, val);\r\n } else if (val instanceof Uint8Array) {\r\n params.bindBlob(nameOrId, val);\r\n } else if (val instanceof Point2d) {\r\n params.bindPoint2d(nameOrId, val);\r\n } else if (val instanceof Point3d) {\r\n params.bindPoint3d(nameOrId, val);\r\n } else if (val instanceof Array && val.length > 0 && typeof val[0] === \"string\" && Id64.isValidId64(val[0])) {\r\n params.bindIdSet(nameOrId, val);\r\n } else if (typeof val === \"object\" && !Array.isArray(val)) {\r\n params.bindStruct(nameOrId, val);\r\n } else if (typeof val === \"undefined\" || val === null) {\r\n params.bindNull(nameOrId);\r\n } else {\r\n throw new Error(\"unsupported type\");\r\n }\r\n }\r\n\r\n /**\r\n * Allow bulk bind either parameters by index as value array or by parameter names as object.\r\n * @param args if array of values is provided then array index is used as index. If object is provided then object property name is used as parameter name of reach value.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public static from(args: any[] | object | undefined): QueryBinder {\r\n const params = new QueryBinder();\r\n if (typeof args === \"undefined\")\r\n return params;\r\n\r\n if (Array.isArray(args)) {\r\n let i = 1;\r\n for (const val of args) {\r\n this.bind(params, i++, val);\r\n }\r\n } else {\r\n for (const prop of Object.getOwnPropertyNames(args)) {\r\n this.bind(params, prop, (args as any)[prop]);\r\n }\r\n }\r\n return params;\r\n }\r\n\r\n public serialize(): object {\r\n return this._args;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum DbRequestKind {\r\n BlobIO = 0,\r\n ECSql = 1\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseKind {\r\n BlobIO = DbRequestKind.BlobIO,\r\n ECSql = DbRequestKind.ECSql,\r\n NoResult = 2\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseStatus {\r\n Done = 1, /* query ran to completion. */\r\n Cancel = 2, /* Requested by user.*/\r\n Partial = 3, /* query was running but ran out of quota.*/\r\n Timeout = 4, /* query time quota expired while it was in queue.*/\r\n QueueFull = 5, /* could not submit the query as queue was full.*/\r\n Error = 100, /* generic error*/\r\n Error_ECSql_PreparedFailed = Error + 1, /* ecsql prepared failed*/\r\n Error_ECSql_StepFailed = Error + 2, /* ecsql step failed*/\r\n Error_ECSql_RowToJsonFailed = Error + 3, /* ecsql failed to serialized row to json.*/\r\n Error_ECSql_BindingFailed = Error + 4, /* ecsql binding failed.*/\r\n Error_BlobIO_OpenFailed = Error + 5, /* class or property or instance specified was not found or property as not of type blob.*/\r\n Error_BlobIO_OutOfRange = Error + 6, /* range specified is invalid based on size of blob.*/\r\n}\r\n\r\n/** @internal */\r\nexport enum DbValueFormat {\r\n ECSqlNames = 0,\r\n JsNames = 1\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequest extends BaseReaderOptions {\r\n kind?: DbRequestKind;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryRequest extends DbRequest, QueryOptions {\r\n valueFormat?: DbValueFormat;\r\n query: string;\r\n args?: object;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobRequest extends DbRequest, BlobOptions {\r\n className: string;\r\n accessString: string;\r\n instanceId: Id64String;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbResponse {\r\n stats: DbRuntimeStats;\r\n status: DbResponseStatus;\r\n kind: DbResponseKind;\r\n error?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryResponse extends DbResponse {\r\n meta: QueryPropertyMetaData[];\r\n data: any[];\r\n rowCount: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobResponse extends DbResponse {\r\n data?: Uint8Array;\r\n rawBlobSize: number;\r\n}\r\n\r\n/** @public */\r\nexport class DbQueryError extends BentleyError {\r\n public constructor(public readonly response: any, public readonly request?: any, rc?: DbResult) {\r\n super(rc ?? DbResult.BE_SQLITE_ERROR, response.error, { response, request });\r\n }\r\n public static throwIfError(response: any, request?: any) {\r\n if ((response.status as number) >= (DbResponseStatus.Error as number)) {\r\n throw new DbQueryError(response, request);\r\n }\r\n if (response.status === DbResponseStatus.Cancel) {\r\n throw new DbQueryError(response, request, DbResult.BE_SQLITE_INTERRUPT);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequestExecutor<TRequest extends DbRequest, TResponse extends DbResponse> {\r\n execute(request: TRequest): Promise<TResponse>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryConfig {\r\n globalQuota?: QueryQuota;\r\n ignoreDelay?: boolean;\r\n ignorePriority?: boolean;\r\n requestQueueSize?: number;\r\n workerThreads?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAc,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB;;OAEG;IACH,qFAAqB,CAAA;IACrB;;OAEG;IACH,yFAAuB,CAAA;IACvB;;OAEG;IACH,+EAAkB,CAAA;AACpB,CAAC,EAbW,cAAc,KAAd,cAAc,QAazB;AA4GD,cAAc;AACd,MAAM,OAAO,mBAAmB;IAC9B,YAA2B,WAAyB,EAAE;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAI,CAAC;IACpD,UAAU,KAAmB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D;;;;;OAKG;IACI,WAAW,CAAC,GAAW;QAC5B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;OAIG;IACI,eAAe,CAAC,GAAW;QAChC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,GAAG,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;OAIG;IACI,QAAQ,CAAC,GAAe;QAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,GAAG,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,C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AA;IACb,2DAAW,CAAA;IACX,qGAAsC,CAAA;IACtC,6FAAkC,CAAA;IAClC,uGAAuC,CAAA;IACvC,mGAAqC,CAAA;IACrC,+FAAmC,CAAA;IACnC,+FAAmC,CAAA;AACrC,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,6DAAc,CAAA;IACd,uDAAW,CAAA;AACb,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AA0CD,cAAc;AACd,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C,YAAmC,QAAa,EAAkB,OAAa,EAAE,EAAa;QAC5F,KAAK,CAAC,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAD5C,aAAQ,GAAR,QAAQ,CAAK;QAAkB,YAAO,GAAP,OAAO,CAAM;IAE/E,CAAC;IACM,MAAM,CAAC,YAAY,CAAC,QAAa,EAAE,OAAa;QACrD,IAAK,QAAQ,CAAC,MAAiB,IAAK,gBAAgB,CAAC,KAAgB,EAAE;YACrE,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC3C;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,EAAE;YAC/C,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;SACzE;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\nimport { BentleyError, CompressedId64Set, DbResult, Id64, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\r\nimport { Base64 } from \"js-base64\";\r\n\r\n/**\r\n * Specifies the format of the rows returned by the `query` and `restartQuery` methods of\r\n * [IModelConnection]($frontend), [IModelDb]($backend), and [ECDb]($backend).\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport enum QueryRowFormat {\r\n /** Each row is an object in which each non-null column value can be accessed by its name as defined in the ECSql.\r\n * Null values are omitted.\r\n */\r\n UseECSqlPropertyNames,\r\n /** Each row is an array of values accessed by an index corresponding to the property's position in the ECSql SELECT statement.\r\n * Null values are included if they are followed by a non-null column, but trailing null values at the end of the array are omitted.\r\n */\r\n UseECSqlPropertyIndexes,\r\n /** Each row is an object in which each non-null column value can be accessed by a [remapped property name]($docs/learning/ECSqlRowFormat.md).\r\n * This format is backwards-compatible with the format produced by iTwin.js 2.x. Null values are omitted.\r\n */\r\n UseJsPropertyNames,\r\n}\r\n\r\n/**\r\n * Specify limit or range of rows to return\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryLimit {\r\n /** Number of rows to return */\r\n count?: number;\r\n /** Offset from which to return rows */\r\n offset?: number;\r\n}\r\n\r\n/** @public */\r\nexport interface QueryPropertyMetaData {\r\n className: string;\r\n generated: boolean;\r\n index: number;\r\n jsonName: string;\r\n name: string;\r\n extendType: string;\r\n typeName: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface DbRuntimeStats {\r\n cpuTime: number;\r\n totalTime: number;\r\n timeLimit: number;\r\n memLimit: number;\r\n memUsed: number;\r\n}\r\n\r\n/**\r\n * Quota hint for the query.\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryQuota {\r\n /** Max time allowed in seconds. This is hint and may not be honoured but help in prioritize request */\r\n time?: number;\r\n /** Max memory allowed in bytes. This is hint and may not be honoured but help in prioritize request */\r\n memory?: number;\r\n}\r\n\r\n/**\r\n * Config for all request made to concurrent query engine.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BaseReaderOptions {\r\n /** Determine priority of this query default to 0, used as hint and can be overriden by backend. */\r\n priority?: number;\r\n /** If specified cancel last query (if any) with same restart token and queue the new query */\r\n restartToken?: string;\r\n /** For editing apps this can be set to true and all query will run on primary connection\r\n * his may cause slow queries execution but the most recent data changes will be visitable via query\r\n */\r\n usePrimaryConn?: boolean;\r\n /** Restrict time or memory for query but use as hint and may be changed base on backend settings */\r\n quota?: QueryQuota;\r\n /**\r\n * @internal\r\n * Allow query to be be deferred by milliseconds specified. This parameter is ignore by default unless\r\n * concurrent query is configure to honour it.\r\n */\r\n delay?: number;\r\n}\r\n\r\n/**\r\n * ECSql query config\r\n * @public\r\n * @extensions\r\n * */\r\nexport interface QueryOptions extends BaseReaderOptions {\r\n /**\r\n * default to false. It abbreviate blobs to single bytes. This help cases where wildcard is\r\n * used in select clause. Use BlobReader api to read individual blob specially if its of large size.\r\n * */\r\n abbreviateBlobs?: boolean;\r\n /**\r\n * default to false. It will suppress error and will not log it. Useful in cases where we expect query\r\n * can fail.\r\n */\r\n suppressLogErrors?: boolean;\r\n /** This is used internally. If true it query will return meta data about query. */\r\n includeMetaData?: boolean;\r\n /** Limit range of rows returned by query*/\r\n limit?: QueryLimit;\r\n /**\r\n * Convert ECClassId, SourceECClassId, TargetECClassId and RelClassId to respective name.\r\n * When true, XXXXClassId property will be returned as className.\r\n * */\r\n convertClassIdsToClassNames?: boolean;\r\n /**\r\n * Determine row format.\r\n */\r\n rowFormat?: QueryRowFormat;\r\n}\r\n/** @beta */\r\nexport type BlobRange = QueryLimit;\r\n\r\n/** @beta */\r\nexport interface BlobOptions extends BaseReaderOptions {\r\n range?: BlobRange;\r\n}\r\n\r\n/** @public */\r\nexport class QueryOptionsBuilder {\r\n public constructor(private _options: QueryOptions = {}) { }\r\n public getOptions(): QueryOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of query. Query will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other query(s) in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous query with same token is cancelled.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for query. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a query to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * By default all blobs are abbreviated to save memory and network bandwidth. If set to false, all blob data will be returned by query as is.\r\n * Use @type BlobReader to access blob data more efficiently.\r\n * @param val A boolean value, if set to false will return complete blob type property data. This could cost time and network bandwidth.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setAbbreviateBlobs(val: boolean) {\r\n this._options.abbreviateBlobs = val;\r\n return this;\r\n }\r\n /**\r\n * When query fail to prepare it will log error. This setting will suppress log errors in case where query come from user typing it and its expected to fail often.\r\n * @param val A boolean value, if set to true, any error logging will be suppressed.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setSuppressLogErrors(val: boolean) {\r\n this._options.suppressLogErrors = val;\r\n return this;\r\n }\r\n /**\r\n * If set ECClassId, SourceECClassId and TargetECClassId system properties will return qualified name of class instead of a @typedef Id64String.\r\n * @param val A boolean value.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setConvertClassIdsToNames(val: boolean) {\r\n this._options.convertClassIdsToClassNames = val;\r\n return this;\r\n }\r\n /**\r\n * Specify limit for query. Limit determine number of rows and offset in result-set.\r\n * @param val Specify count and offset from within the result-set of a ECSQL query.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setLimit(val: QueryLimit) {\r\n this._options.limit = val;\r\n return this;\r\n }\r\n /**\r\n * Specify row format returned by concurrent query manager.\r\n * @param val @enum QueryRowFormat specifying format for result.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setRowFormat(val: QueryRowFormat) {\r\n this._options.rowFormat = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of query in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type QueryOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n/** @beta */\r\nexport class BlobOptionsBuilder {\r\n public constructor(private _options: BlobOptions = {}) { }\r\n public getOptions(): BlobOptions { return this._options; }\r\n /**\r\n * @internal\r\n * Allow to set priority of blob request. Blob request will be inserted int queue base on priority value. This value will be ignored if concurrent query is configured with ignored priority is true.\r\n * @param val integer value which can be negative as well. By default its zero.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setPriority(val: number) {\r\n this._options.priority = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set restart token. If restart token is set then any other blob request in queue with same token is cancelled if its not already executed.\r\n * @param val A string token identifying a use case in which previous blob request with same token is cancelled.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRestartToken(val: string) {\r\n this._options.restartToken = val;\r\n return this;\r\n }\r\n /**\r\n * Allow to set quota restriction for blob request. Its a hint and may be overriden or ignored by concurrent query manager.\r\n * @param val @type QueryQuota Specify time and memory that can be used by a query.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setQuota(val: QueryQuota) {\r\n this._options.quota = val;\r\n return this;\r\n }\r\n /**\r\n * Force a blob request to be executed synchronously against primary connection. This option is ignored if provided by frontend.\r\n * @param val A boolean value to force use primary connection on main thread to execute blob request.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setUsePrimaryConnection(val: boolean) {\r\n this._options.usePrimaryConn = val;\r\n return this;\r\n }\r\n /**\r\n * Specify range with in the blob that need to be returned.\r\n * @param val Specify offset and count of bytes that need to be returned.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setRange(val: BlobRange) {\r\n this._options.range = val;\r\n return this;\r\n }\r\n /**\r\n * @internal\r\n * Defers execution of blob request in queue by specified milliseconds. This parameter is ignored by default unless concurrent query is configure to not ignore it.\r\n * @param val Number of milliseconds.\r\n * @returns @type BlobOptionsBuilder for fluent interface.\r\n */\r\n public setDelay(val: number) {\r\n this._options.delay = val;\r\n return this;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum QueryParamType {\r\n Boolean = 0,\r\n Double = 1,\r\n Id = 2,\r\n IdSet = 3,\r\n Integer = 4,\r\n Long = 5,\r\n Null = 6,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point2d = 7,\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n Point3d = 8,\r\n String = 9,\r\n Blob = 10,\r\n Struct = 11,\r\n}\r\n\r\n/**\r\n * Bind values to an ECSQL query.\r\n *\r\n * All binding class methods accept an `indexOrName` parameter as a `string | number` type and a value to bind to it.\r\n * A binding must be mapped either by a positional index or a string/name. See the examples below.\r\n *\r\n * @example\r\n * Parameter By Index:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=? AND b=?\r\n * ```\r\n * The first `?` is index 1 and the second `?` is index 2. The parameter index starts with 1 and not 0.\r\n *\r\n * @example\r\n * Parameter By Name:\r\n * ```sql\r\n * SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b\r\n * ```\r\n * Using \"name_a\" as the `indexOrName` will bind the provided value to `name_a` in the query. And the same goes for\r\n * using \"name_b\" and the `name_b` binding respectively.\r\n *\r\n * @see\r\n * - [ECSQL Parameters]($docs/learning/ECSQL.md#ecsql-parameters)\r\n * - [ECSQL Parameter Types]($docs/learning/ECSQLParameterTypes)\r\n * - [ECSQL Code Examples]($docs/learning/backend/ECSQLCodeExamples#parameter-bindings)\r\n *\r\n * @public\r\n */\r\nexport class QueryBinder {\r\n private _args = {};\r\n private verify(indexOrName: string | number) {\r\n if (typeof indexOrName === \"number\") {\r\n if (indexOrName < 1)\r\n throw new Error(\"expect index to be >= 1\");\r\n return;\r\n }\r\n if (!/^[a-zA-Z_]+\\w*$/i.test(indexOrName)) {\r\n throw new Error(\"expect named parameter to meet identifier specification\");\r\n }\r\n }\r\n\r\n /**\r\n * Bind boolean value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Boolean value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBoolean(indexOrName: string | number, val: boolean) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true,\r\n value: {\r\n type: QueryParamType.Boolean,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind blob value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Blob value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindBlob(indexOrName: string | number, val: Uint8Array) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n const base64 = Base64.fromUint8Array(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Blob,\r\n value: base64,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind double value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Double value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindDouble(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Double,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @typedef Id64String value to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @typedef Id64String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindId(indexOrName: string | number, val: Id64String) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Id,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type OrderedId64Iterable to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type OrderedId64Iterable value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindIdSet(indexOrName: string | number, val: OrderedId64Iterable) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n OrderedId64Iterable.uniqueIterator(val);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.IdSet,\r\n value: CompressedId64Set.sortAndCompress(OrderedId64Iterable.uniqueIterator(val)),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind integer to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Integer value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindInt(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Integer,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind struct to ECSQL statement. Struct specified as object.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val struct value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindStruct(indexOrName: string | number, val: object) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Struct,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind long to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val Long value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindLong(indexOrName: string | number, val: number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Long,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind string to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val String value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindString(indexOrName: string | number, val: string) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.String,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind null to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindNull(indexOrName: string | number) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Null,\r\n value: null,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point2d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point2d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint2d(indexOrName: string | number, val: Point2d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point2d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Bind @type Point3d to ECSQL statement.\r\n * @param indexOrName Specify parameter index or its name used in ECSQL statement.\r\n * @param val @type Point3d value to bind to ECSQL statement.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public bindPoint3d(indexOrName: string | number, val: Point3d) {\r\n this.verify(indexOrName);\r\n const name = String(indexOrName);\r\n Object.defineProperty(this._args, name, {\r\n enumerable: true, value: {\r\n type: QueryParamType.Point3d,\r\n value: val,\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n private static bind(params: QueryBinder, nameOrId: string | number, val: any) {\r\n if (typeof val === \"boolean\") {\r\n params.bindBoolean(nameOrId, val);\r\n } else if (typeof val === \"number\") {\r\n params.bindDouble(nameOrId, val);\r\n } else if (typeof val === \"string\") {\r\n params.bindString(nameOrId, val);\r\n } else if (val instanceof Uint8Array) {\r\n params.bindBlob(nameOrId, val);\r\n } else if (val instanceof Point2d) {\r\n params.bindPoint2d(nameOrId, val);\r\n } else if (val instanceof Point3d) {\r\n params.bindPoint3d(nameOrId, val);\r\n } else if (val instanceof Array && val.length > 0 && typeof val[0] === \"string\" && Id64.isValidId64(val[0])) {\r\n params.bindIdSet(nameOrId, val);\r\n } else if (typeof val === \"undefined\" || val === null) {\r\n params.bindNull(nameOrId);\r\n } else if (typeof val === \"object\" && !Array.isArray(val)) {\r\n params.bindStruct(nameOrId, val);\r\n } else {\r\n throw new Error(\"unsupported type\");\r\n }\r\n }\r\n\r\n /**\r\n * Allow bulk bind either parameters by index as value array or by parameter names as object.\r\n * @param args if array of values is provided then array index is used as index. If object is provided then object property name is used as parameter name of reach value.\r\n * @returns @type QueryBinder to allow fluent interface.\r\n */\r\n public static from(args: any[] | object | undefined): QueryBinder {\r\n const params = new QueryBinder();\r\n if (typeof args === \"undefined\")\r\n return params;\r\n\r\n if (Array.isArray(args)) {\r\n let i = 1;\r\n for (const val of args) {\r\n this.bind(params, i++, val);\r\n }\r\n } else {\r\n for (const prop of Object.getOwnPropertyNames(args)) {\r\n this.bind(params, prop, (args as any)[prop]);\r\n }\r\n }\r\n return params;\r\n }\r\n\r\n public serialize(): object {\r\n return this._args;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport enum DbRequestKind {\r\n BlobIO = 0,\r\n ECSql = 1\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseKind {\r\n BlobIO = DbRequestKind.BlobIO,\r\n ECSql = DbRequestKind.ECSql,\r\n NoResult = 2\r\n}\r\n\r\n/** @internal */\r\nexport enum DbResponseStatus {\r\n Done = 1, /* query ran to completion. */\r\n Cancel = 2, /* Requested by user.*/\r\n Partial = 3, /* query was running but ran out of quota.*/\r\n Timeout = 4, /* query time quota expired while it was in queue.*/\r\n QueueFull = 5, /* could not submit the query as queue was full.*/\r\n Error = 100, /* generic error*/\r\n Error_ECSql_PreparedFailed = Error + 1, /* ecsql prepared failed*/\r\n Error_ECSql_StepFailed = Error + 2, /* ecsql step failed*/\r\n Error_ECSql_RowToJsonFailed = Error + 3, /* ecsql failed to serialized row to json.*/\r\n Error_ECSql_BindingFailed = Error + 4, /* ecsql binding failed.*/\r\n Error_BlobIO_OpenFailed = Error + 5, /* class or property or instance specified was not found or property as not of type blob.*/\r\n Error_BlobIO_OutOfRange = Error + 6, /* range specified is invalid based on size of blob.*/\r\n}\r\n\r\n/** @internal */\r\nexport enum DbValueFormat {\r\n ECSqlNames = 0,\r\n JsNames = 1\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequest extends BaseReaderOptions {\r\n kind?: DbRequestKind;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryRequest extends DbRequest, QueryOptions {\r\n valueFormat?: DbValueFormat;\r\n query: string;\r\n args?: object;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobRequest extends DbRequest, BlobOptions {\r\n className: string;\r\n accessString: string;\r\n instanceId: Id64String;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbResponse {\r\n stats: DbRuntimeStats;\r\n status: DbResponseStatus;\r\n kind: DbResponseKind;\r\n error?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryResponse extends DbResponse {\r\n meta: QueryPropertyMetaData[];\r\n data: any[];\r\n rowCount: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbBlobResponse extends DbResponse {\r\n data?: Uint8Array;\r\n rawBlobSize: number;\r\n}\r\n\r\n/** @public */\r\nexport class DbQueryError extends BentleyError {\r\n public constructor(public readonly response: any, public readonly request?: any, rc?: DbResult) {\r\n super(rc ?? DbResult.BE_SQLITE_ERROR, response.error, { response, request });\r\n }\r\n public static throwIfError(response: any, request?: any) {\r\n if ((response.status as number) >= (DbResponseStatus.Error as number)) {\r\n throw new DbQueryError(response, request);\r\n }\r\n if (response.status === DbResponseStatus.Cancel) {\r\n throw new DbQueryError(response, request, DbResult.BE_SQLITE_INTERRUPT);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface DbRequestExecutor<TRequest extends DbRequest, TResponse extends DbResponse> {\r\n execute(request: TRequest): Promise<TResponse>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DbQueryConfig {\r\n globalQuota?: QueryQuota;\r\n ignoreDelay?: boolean;\r\n ignorePriority?: boolean;\r\n requestQueueSize?: number;\r\n workerThreads?: number;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-common",
|
|
3
|
-
"version": "4.3.0-dev.
|
|
3
|
+
"version": "4.3.0-dev.10",
|
|
4
4
|
"description": "iTwin.js components common to frontend and backend",
|
|
5
5
|
"main": "lib/cjs/core-common.js",
|
|
6
6
|
"module": "lib/esm/core-common.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"js-base64": "^3.6.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@itwin/core-bentley": "^4.3.0-dev.
|
|
31
|
-
"@itwin/core-geometry": "^4.3.0-dev.
|
|
30
|
+
"@itwin/core-bentley": "^4.3.0-dev.10",
|
|
31
|
+
"@itwin/core-geometry": "^4.3.0-dev.10"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "4.0.0-dev.44",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"nyc": "^15.1.0",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"typescript": "~5.0.2",
|
|
46
|
-
"@itwin/build-tools": "4.3.0-dev.
|
|
47
|
-
"@itwin/core-bentley": "4.3.0-dev.
|
|
48
|
-
"@itwin/core-geometry": "4.3.0-dev.
|
|
46
|
+
"@itwin/build-tools": "4.3.0-dev.10",
|
|
47
|
+
"@itwin/core-bentley": "4.3.0-dev.10",
|
|
48
|
+
"@itwin/core-geometry": "4.3.0-dev.10"
|
|
49
49
|
},
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|