@itwin/ecschema-rpcinterface-impl 3.0.0-dev.83 → 3.0.0-dev.87

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 CHANGED
@@ -1,213 +1,213 @@
1
- # Change Log - @itwin/ecschema-rpcinterface-impl
2
-
3
- This log was last generated on Tue, 21 Sep 2021 21:06:40 GMT and should not be manually modified.
4
-
5
- ## 2.19.13
6
- Tue, 21 Sep 2021 21:06:40 GMT
7
-
8
- _Version update only_
9
-
10
- ## 2.19.12
11
- Wed, 15 Sep 2021 18:06:46 GMT
12
-
13
- _Version update only_
14
-
15
- ## 2.19.11
16
- Thu, 09 Sep 2021 21:04:57 GMT
17
-
18
- _Version update only_
19
-
20
- ## 2.19.10
21
- Wed, 08 Sep 2021 14:36:01 GMT
22
-
23
- _Version update only_
24
-
25
- ## 2.19.9
26
- Wed, 25 Aug 2021 15:36:01 GMT
27
-
28
- _Version update only_
29
-
30
- ## 2.19.8
31
- Mon, 23 Aug 2021 13:23:13 GMT
32
-
33
- _Version update only_
34
-
35
- ## 2.19.7
36
- Fri, 20 Aug 2021 17:47:22 GMT
37
-
38
- _Version update only_
39
-
40
- ## 2.19.6
41
- Tue, 17 Aug 2021 20:34:28 GMT
42
-
43
- _Version update only_
44
-
45
- ## 2.19.5
46
- Fri, 13 Aug 2021 21:48:08 GMT
47
-
48
- _Version update only_
49
-
50
- ## 2.19.4
51
- Thu, 12 Aug 2021 13:09:26 GMT
52
-
53
- _Version update only_
54
-
55
- ## 2.19.3
56
- Wed, 04 Aug 2021 20:29:34 GMT
57
-
58
- _Version update only_
59
-
60
- ## 2.19.2
61
- Tue, 03 Aug 2021 18:26:23 GMT
62
-
63
- _Version update only_
64
-
65
- ## 2.19.1
66
- Thu, 29 Jul 2021 20:01:11 GMT
67
-
68
- _Version update only_
69
-
70
- ## 2.19.0
71
- Mon, 26 Jul 2021 12:21:25 GMT
72
-
73
- _Version update only_
74
-
75
- ## 2.18.4
76
- Tue, 10 Aug 2021 19:35:13 GMT
77
-
78
- _Version update only_
79
-
80
- ## 2.18.3
81
- Wed, 28 Jul 2021 17:16:30 GMT
82
-
83
- _Version update only_
84
-
85
- ## 2.18.2
86
- Mon, 26 Jul 2021 16:18:31 GMT
87
-
88
- _Version update only_
89
-
90
- ## 2.18.1
91
- Fri, 16 Jul 2021 17:45:09 GMT
92
-
93
- _Version update only_
94
-
95
- ## 2.18.0
96
- Fri, 09 Jul 2021 18:11:24 GMT
97
-
98
- _Version update only_
99
-
100
- ## 2.17.3
101
- Mon, 26 Jul 2021 16:08:36 GMT
102
-
103
- _Version update only_
104
-
105
- ## 2.17.2
106
- Thu, 08 Jul 2021 15:23:00 GMT
107
-
108
- _Version update only_
109
-
110
- ## 2.17.1
111
- Fri, 02 Jul 2021 15:38:30 GMT
112
-
113
- _Version update only_
114
-
115
- ## 2.17.0
116
- Mon, 28 Jun 2021 16:20:11 GMT
117
-
118
- _Version update only_
119
-
120
- ## 2.16.10
121
- Thu, 22 Jul 2021 20:23:44 GMT
122
-
123
- _Version update only_
124
-
125
- ## 2.16.9
126
- Tue, 06 Jul 2021 22:08:34 GMT
127
-
128
- _Version update only_
129
-
130
- ## 2.16.8
131
- Fri, 02 Jul 2021 17:40:46 GMT
132
-
133
- _Version update only_
134
-
135
- ## 2.16.7
136
- Mon, 28 Jun 2021 18:13:04 GMT
137
-
138
- _Version update only_
139
-
140
- ## 2.16.6
141
- Mon, 28 Jun 2021 13:12:55 GMT
142
-
143
- _Version update only_
144
-
145
- ## 2.16.5
146
- Fri, 25 Jun 2021 16:03:01 GMT
147
-
148
- _Version update only_
149
-
150
- ## 2.16.4
151
- Wed, 23 Jun 2021 17:09:07 GMT
152
-
153
- _Version update only_
154
-
155
- ## 2.16.3
156
- Wed, 16 Jun 2021 20:29:32 GMT
157
-
158
- _Version update only_
159
-
160
- ## 2.16.2
161
- Thu, 03 Jun 2021 18:08:11 GMT
162
-
163
- _Version update only_
164
-
165
- ## 2.16.1
166
- Thu, 27 May 2021 20:04:22 GMT
167
-
168
- _Version update only_
169
-
170
- ## 2.16.0
171
- Mon, 24 May 2021 15:58:39 GMT
172
-
173
- ### Updates
174
-
175
- - ECSchema Rpc Interface changes
176
-
177
- ## 2.15.6
178
- Wed, 26 May 2021 15:55:18 GMT
179
-
180
- _Version update only_
181
-
182
- ## 2.15.5
183
- Thu, 20 May 2021 15:06:26 GMT
184
-
185
- _Version update only_
186
-
187
- ## 2.15.4
188
- Tue, 18 May 2021 21:59:07 GMT
189
-
190
- _Version update only_
191
-
192
- ## 2.15.3
193
- Mon, 17 May 2021 13:31:37 GMT
194
-
195
- _Version update only_
196
-
197
- ## 2.15.2
198
- Wed, 12 May 2021 18:08:13 GMT
199
-
200
- _Version update only_
201
-
202
- ## 2.15.1
203
- Wed, 05 May 2021 13:18:31 GMT
204
-
205
- _Version update only_
206
-
207
- ## 2.15.0
208
- Fri, 30 Apr 2021 12:36:58 GMT
209
-
210
- ### Updates
211
-
212
- - schema rpc interface initial release
213
-
1
+ # Change Log - @itwin/ecschema-rpcinterface-impl
2
+
3
+ This log was last generated on Tue, 21 Sep 2021 21:06:40 GMT and should not be manually modified.
4
+
5
+ ## 2.19.13
6
+ Tue, 21 Sep 2021 21:06:40 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 2.19.12
11
+ Wed, 15 Sep 2021 18:06:46 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 2.19.11
16
+ Thu, 09 Sep 2021 21:04:57 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 2.19.10
21
+ Wed, 08 Sep 2021 14:36:01 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 2.19.9
26
+ Wed, 25 Aug 2021 15:36:01 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 2.19.8
31
+ Mon, 23 Aug 2021 13:23:13 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 2.19.7
36
+ Fri, 20 Aug 2021 17:47:22 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 2.19.6
41
+ Tue, 17 Aug 2021 20:34:28 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 2.19.5
46
+ Fri, 13 Aug 2021 21:48:08 GMT
47
+
48
+ _Version update only_
49
+
50
+ ## 2.19.4
51
+ Thu, 12 Aug 2021 13:09:26 GMT
52
+
53
+ _Version update only_
54
+
55
+ ## 2.19.3
56
+ Wed, 04 Aug 2021 20:29:34 GMT
57
+
58
+ _Version update only_
59
+
60
+ ## 2.19.2
61
+ Tue, 03 Aug 2021 18:26:23 GMT
62
+
63
+ _Version update only_
64
+
65
+ ## 2.19.1
66
+ Thu, 29 Jul 2021 20:01:11 GMT
67
+
68
+ _Version update only_
69
+
70
+ ## 2.19.0
71
+ Mon, 26 Jul 2021 12:21:25 GMT
72
+
73
+ _Version update only_
74
+
75
+ ## 2.18.4
76
+ Tue, 10 Aug 2021 19:35:13 GMT
77
+
78
+ _Version update only_
79
+
80
+ ## 2.18.3
81
+ Wed, 28 Jul 2021 17:16:30 GMT
82
+
83
+ _Version update only_
84
+
85
+ ## 2.18.2
86
+ Mon, 26 Jul 2021 16:18:31 GMT
87
+
88
+ _Version update only_
89
+
90
+ ## 2.18.1
91
+ Fri, 16 Jul 2021 17:45:09 GMT
92
+
93
+ _Version update only_
94
+
95
+ ## 2.18.0
96
+ Fri, 09 Jul 2021 18:11:24 GMT
97
+
98
+ _Version update only_
99
+
100
+ ## 2.17.3
101
+ Mon, 26 Jul 2021 16:08:36 GMT
102
+
103
+ _Version update only_
104
+
105
+ ## 2.17.2
106
+ Thu, 08 Jul 2021 15:23:00 GMT
107
+
108
+ _Version update only_
109
+
110
+ ## 2.17.1
111
+ Fri, 02 Jul 2021 15:38:30 GMT
112
+
113
+ _Version update only_
114
+
115
+ ## 2.17.0
116
+ Mon, 28 Jun 2021 16:20:11 GMT
117
+
118
+ _Version update only_
119
+
120
+ ## 2.16.10
121
+ Thu, 22 Jul 2021 20:23:44 GMT
122
+
123
+ _Version update only_
124
+
125
+ ## 2.16.9
126
+ Tue, 06 Jul 2021 22:08:34 GMT
127
+
128
+ _Version update only_
129
+
130
+ ## 2.16.8
131
+ Fri, 02 Jul 2021 17:40:46 GMT
132
+
133
+ _Version update only_
134
+
135
+ ## 2.16.7
136
+ Mon, 28 Jun 2021 18:13:04 GMT
137
+
138
+ _Version update only_
139
+
140
+ ## 2.16.6
141
+ Mon, 28 Jun 2021 13:12:55 GMT
142
+
143
+ _Version update only_
144
+
145
+ ## 2.16.5
146
+ Fri, 25 Jun 2021 16:03:01 GMT
147
+
148
+ _Version update only_
149
+
150
+ ## 2.16.4
151
+ Wed, 23 Jun 2021 17:09:07 GMT
152
+
153
+ _Version update only_
154
+
155
+ ## 2.16.3
156
+ Wed, 16 Jun 2021 20:29:32 GMT
157
+
158
+ _Version update only_
159
+
160
+ ## 2.16.2
161
+ Thu, 03 Jun 2021 18:08:11 GMT
162
+
163
+ _Version update only_
164
+
165
+ ## 2.16.1
166
+ Thu, 27 May 2021 20:04:22 GMT
167
+
168
+ _Version update only_
169
+
170
+ ## 2.16.0
171
+ Mon, 24 May 2021 15:58:39 GMT
172
+
173
+ ### Updates
174
+
175
+ - ECSchema Rpc Interface changes
176
+
177
+ ## 2.15.6
178
+ Wed, 26 May 2021 15:55:18 GMT
179
+
180
+ _Version update only_
181
+
182
+ ## 2.15.5
183
+ Thu, 20 May 2021 15:06:26 GMT
184
+
185
+ _Version update only_
186
+
187
+ ## 2.15.4
188
+ Tue, 18 May 2021 21:59:07 GMT
189
+
190
+ _Version update only_
191
+
192
+ ## 2.15.3
193
+ Mon, 17 May 2021 13:31:37 GMT
194
+
195
+ _Version update only_
196
+
197
+ ## 2.15.2
198
+ Wed, 12 May 2021 18:08:13 GMT
199
+
200
+ _Version update only_
201
+
202
+ ## 2.15.1
203
+ Wed, 05 May 2021 13:18:31 GMT
204
+
205
+ _Version update only_
206
+
207
+ ## 2.15.0
208
+ Fri, 30 Apr 2021 12:36:58 GMT
209
+
210
+ ### Updates
211
+
212
+ - schema rpc interface initial release
213
+
package/LICENSE.md CHANGED
@@ -1,9 +1,9 @@
1
- # MIT License
2
-
3
- Copyright © 2017-2021 Bentley Systems, Incorporated. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ # MIT License
2
+
3
+ Copyright © 2017-2021 Bentley Systems, Incorporated. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # iTwin.js Schema RPC Interface Implementation
2
-
3
- Copyright © Bentley Systems, Incorporated. All rights reserved.
4
-
5
- This package contains the Schema RPC Interface Implementation which can be added to a backend.
6
-
7
- ## Testing
8
-
9
- The tests for this RPC Interface are available in the [@itwin/ecschema-rpcinterface-tests](https://www.npmjs.com/package/@itwin/ecschema-rpcinterface-tests) package, please visit the README in that package for more information.
1
+ # iTwin.js Schema RPC Interface Implementation
2
+
3
+ Copyright © Bentley Systems, Incorporated. All rights reserved.
4
+
5
+ This package contains the Schema RPC Interface Implementation which can be added to a backend.
6
+
7
+ ## Testing
8
+
9
+ The tests for this RPC Interface are available in the [@itwin/ecschema-rpcinterface-tests](https://www.npmjs.com/package/@itwin/ecschema-rpcinterface-tests) package, please visit the README in that package for more information.
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oDAAgF;AAEhF;;;+FAG+F;AAC/F,sFAA2E;AAY3E;;;GAGG;AACH,MAAa,eAAgB,SAAQ,mDAAoB;IACvD;;OAEG;IACI,MAAM,CAAC,QAAQ;QACpB,wBAAU,CAAC,YAAY,CAAC,mDAAoB,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,iBAAiB,CAAC,UAA0B;QACxD,OAAO,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,EAAE;YAC/C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IAC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AAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC7C;QAED,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,0CAsEC","sourcesContent":["import * as backend from \"@itwin/core-backend\";\nimport { IModelRpcProps, QueryRowFormat, RpcManager } from \"@itwin/core-common\";\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\n/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\n\n/**\n * Defines the interface how the rows of the iModel query look like.\n */\ninterface SchemaNameRow {\n schemaName: string;\n read: string;\n write: string;\n minor: string;\n}\n\n/**\n * Implementation of the SchemaRpcInterface.\n * @internal\n */\nexport class ECSchemaRpcImpl extends ECSchemaRpcInterface {\n /**\n * Registers the RPC interface with its corresponding implementation class.\n */\n public static register() {\n RpcManager.registerImpl(ECSchemaRpcInterface, ECSchemaRpcImpl);\n }\n\n /**\n * Gets an iModelDb instance. It is important that the database has been opened before\n * otherwise it can't be found.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns Instance of IModelDb.\n */\n private async getIModelDatabase(tokenProps: IModelRpcProps): Promise<backend.IModelDb> {\n return new Promise<backend.IModelDb>((resolve) => {\n resolve(backend.IModelDb.findByKey(tokenProps.key));\n });\n }\n\n /**\n * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call\n * SchemaKey.fromJson() to parse the props to a SchemaKey.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns An array of SchemaKeyProps.\n */\n public override async getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\n\n const schemaKeyProps: SchemaKeyProps[] = [];\n const iModelDb = await this.getIModelDatabase(tokenProps);\n\n // Iterate over the rows returned from AsyncIterableIterator. The custom Query overload returns\n // a typed row instance instead of any.\n const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;\n for await (const row of iModelDb.query(schemaNameQuery, undefined, QueryRowFormat.UseJsPropertyNames)) {\n const schemaDefinitionRow = row as SchemaNameRow;\n const schemaFullName = schemaDefinitionRow.schemaName;\n const read = Number(schemaDefinitionRow.read);\n const write = Number(schemaDefinitionRow.write);\n const minor = Number(schemaDefinitionRow.minor);\n schemaKeyProps.push({ name: schemaFullName, read, write, minor });\n }\n return schemaKeyProps;\n }\n\n /**\n * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which\n * the client can call Schema.fromJson() to return a Schema.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @param schemaName The name of the schema that shall be returned.\n * @returns The SchemaProps.\n */\n public override async getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps> {\n if (schemaName === undefined || schemaName.length < 1) {\n throw new Error(`Schema name must not be undefined or empty.`);\n }\n\n const iModelDb = await this.getIModelDatabase(tokenProps);\n const schemaResult = iModelDb.nativeDb.getSchema(schemaName);\n\n if (schemaResult.error !== undefined) {\n throw new Error(schemaResult.error.message);\n }\n\n if (schemaResult.result === undefined) {\n throw new Error(\"Schema does not exists\");\n }\n\n return JSON.parse(schemaResult.result);\n }\n}\n"]}
1
+ {"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oDAAgF;AAEhF;;;+FAG+F;AAC/F,sFAA2E;AAY3E;;;GAGG;AACH,MAAa,eAAgB,SAAQ,mDAAoB;IACvD;;OAEG;IACI,MAAM,CAAC,QAAQ;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AAC,MAAM,GAAG,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAChE;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC7C;QAED,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,0CAsEC","sourcesContent":["import * as backend from \"@itwin/core-backend\";\r\nimport { IModelRpcProps, QueryRowFormat, RpcManager } from \"@itwin/core-common\";\r\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\r\n/*---------------------------------------------------------------------------------------------\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\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\r\n\r\n/**\r\n * Defines the interface how the rows of the iModel query look like.\r\n */\r\ninterface SchemaNameRow {\r\n schemaName: string;\r\n read: string;\r\n write: string;\r\n minor: string;\r\n}\r\n\r\n/**\r\n * Implementation of the SchemaRpcInterface.\r\n * @internal\r\n */\r\nexport class ECSchemaRpcImpl extends ECSchemaRpcInterface {\r\n /**\r\n * Registers the RPC interface with its corresponding implementation class.\r\n */\r\n public static register() {\r\n RpcManager.registerImpl(ECSchemaRpcInterface, ECSchemaRpcImpl);\r\n }\r\n\r\n /**\r\n * Gets an iModelDb instance. It is important that the database has been opened before\r\n * otherwise it can't be found.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @returns Instance of IModelDb.\r\n */\r\n private async getIModelDatabase(tokenProps: IModelRpcProps): Promise<backend.IModelDb> {\r\n return new Promise<backend.IModelDb>((resolve) => {\r\n resolve(backend.IModelDb.findByKey(tokenProps.key));\r\n });\r\n }\r\n\r\n /**\r\n * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call\r\n * SchemaKey.fromJson() to parse the props to a SchemaKey.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @returns An array of SchemaKeyProps.\r\n */\r\n public override async getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\r\n\r\n const schemaKeyProps: SchemaKeyProps[] = [];\r\n const iModelDb = await this.getIModelDatabase(tokenProps);\r\n\r\n // Iterate over the rows returned from AsyncIterableIterator. The custom Query overload returns\r\n // a typed row instance instead of any.\r\n const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;\r\n for await (const row of iModelDb.query(schemaNameQuery, undefined, QueryRowFormat.UseJsPropertyNames)) {\r\n const schemaDefinitionRow = row as SchemaNameRow;\r\n const schemaFullName = schemaDefinitionRow.schemaName;\r\n const read = Number(schemaDefinitionRow.read);\r\n const write = Number(schemaDefinitionRow.write);\r\n const minor = Number(schemaDefinitionRow.minor);\r\n schemaKeyProps.push({ name: schemaFullName, read, write, minor });\r\n }\r\n return schemaKeyProps;\r\n }\r\n\r\n /**\r\n * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which\r\n * the client can call Schema.fromJson() to return a Schema.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @param schemaName The name of the schema that shall be returned.\r\n * @returns The SchemaProps.\r\n */\r\n public override async getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps> {\r\n if (schemaName === undefined || schemaName.length < 1) {\r\n throw new Error(`Schema name must not be undefined or empty.`);\r\n }\r\n\r\n const iModelDb = await this.getIModelDatabase(tokenProps);\r\n const schemaResult = iModelDb.nativeDb.getSchema(schemaName);\r\n\r\n if (schemaResult.error !== undefined) {\r\n throw new Error(schemaResult.error.message);\r\n }\r\n\r\n if (schemaResult.result === undefined) {\r\n throw new Error(\"Schema does not exists\");\r\n }\r\n\r\n return JSON.parse(schemaResult.result);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAkC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./ECSchemaRpcImpl\";\n"]}
1
+ {"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAkC","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\nexport * from \"./ECSchemaRpcImpl\";\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-rpcinterface-impl",
3
- "version": "3.0.0-dev.83",
3
+ "version": "3.0.0-dev.87",
4
4
  "description": "Schema RPC Interface backend implementation",
5
5
  "main": "lib/cjs/ecschema-rpc-impl.js",
6
6
  "typings": "lib/cjs/ecschema-rpc-impl",
@@ -20,24 +20,24 @@
20
20
  "url": "http://www.bentley.com"
21
21
  },
22
22
  "peerDependencies": {
23
- "@itwin/core-bentley": "3.0.0-dev.83",
24
- "@itwin/ecschema-metadata": "3.0.0-dev.83",
25
- "@itwin/ecschema-rpcinterface-common": "3.0.0-dev.83",
26
- "@itwin/core-geometry": "3.0.0-dev.83",
27
- "@itwin/core-backend": "3.0.0-dev.83",
28
- "@itwin/core-common": "3.0.0-dev.83",
29
- "@bentley/itwin-client": "3.0.0-dev.83"
23
+ "@itwin/core-bentley": "3.0.0-dev.87",
24
+ "@itwin/ecschema-metadata": "3.0.0-dev.87",
25
+ "@itwin/ecschema-rpcinterface-common": "3.0.0-dev.87",
26
+ "@itwin/core-geometry": "3.0.0-dev.87",
27
+ "@itwin/core-backend": "3.0.0-dev.87",
28
+ "@itwin/core-common": "3.0.0-dev.87",
29
+ "@bentley/itwin-client": "3.0.0-dev.87"
30
30
  },
31
31
  "devDependencies": {
32
- "@bentley/itwin-client": "3.0.0-dev.83",
33
- "@itwin/core-bentley": "3.0.0-dev.83",
34
- "@itwin/build-tools": "3.0.0-dev.83",
35
- "@itwin/ecschema-metadata": "3.0.0-dev.83",
36
- "@itwin/ecschema-rpcinterface-common": "3.0.0-dev.83",
37
- "@itwin/eslint-plugin": "3.0.0-dev.83",
38
- "@itwin/core-geometry": "3.0.0-dev.83",
39
- "@itwin/core-backend": "3.0.0-dev.83",
40
- "@itwin/core-common": "3.0.0-dev.83",
32
+ "@bentley/itwin-client": "3.0.0-dev.87",
33
+ "@itwin/core-bentley": "3.0.0-dev.87",
34
+ "@itwin/build-tools": "3.0.0-dev.87",
35
+ "@itwin/ecschema-metadata": "3.0.0-dev.87",
36
+ "@itwin/ecschema-rpcinterface-common": "3.0.0-dev.87",
37
+ "@itwin/eslint-plugin": "3.0.0-dev.87",
38
+ "@itwin/core-geometry": "3.0.0-dev.87",
39
+ "@itwin/core-backend": "3.0.0-dev.87",
40
+ "@itwin/core-common": "3.0.0-dev.87",
41
41
  "eslint": "^7.11.0",
42
42
  "rimraf": "^3.0.2",
43
43
  "typescript": "~4.4.0"