@itwin/core-frontend 5.12.0-dev.8 → 5.13.0-dev.1

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/AccuDraw.d.ts.map +1 -1
  3. package/lib/cjs/AccuDraw.js +10 -9
  4. package/lib/cjs/AccuDraw.js.map +1 -1
  5. package/lib/cjs/AuxCoordSys.d.ts +11 -4
  6. package/lib/cjs/AuxCoordSys.d.ts.map +1 -1
  7. package/lib/cjs/AuxCoordSys.js +12 -6
  8. package/lib/cjs/AuxCoordSys.js.map +1 -1
  9. package/lib/cjs/DrawingViewState.d.ts.map +1 -1
  10. package/lib/cjs/DrawingViewState.js +3 -4
  11. package/lib/cjs/DrawingViewState.js.map +1 -1
  12. package/lib/cjs/EntityState.js +1 -1
  13. package/lib/cjs/EntityState.js.map +1 -1
  14. package/lib/cjs/IModelConnection.d.ts +20 -7
  15. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  16. package/lib/cjs/IModelConnection.js +66 -77
  17. package/lib/cjs/IModelConnection.js.map +1 -1
  18. package/lib/cjs/IpcApp.d.ts +37 -0
  19. package/lib/cjs/IpcApp.d.ts.map +1 -1
  20. package/lib/cjs/IpcApp.js +56 -26
  21. package/lib/cjs/IpcApp.js.map +1 -1
  22. package/lib/cjs/ViewCreator2d.d.ts.map +1 -1
  23. package/lib/cjs/ViewCreator2d.js +7 -9
  24. package/lib/cjs/ViewCreator2d.js.map +1 -1
  25. package/lib/cjs/common/gltf/GltfSchema.d.ts +7 -0
  26. package/lib/cjs/common/gltf/GltfSchema.d.ts.map +1 -1
  27. package/lib/cjs/common/gltf/GltfSchema.js.map +1 -1
  28. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  29. package/lib/cjs/tile/GltfReader.js +3 -0
  30. package/lib/cjs/tile/GltfReader.js.map +1 -1
  31. package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
  32. package/lib/cjs/tools/AccuDrawTool.d.ts +20 -3
  33. package/lib/cjs/tools/AccuDrawTool.d.ts.map +1 -1
  34. package/lib/cjs/tools/AccuDrawTool.js +108 -58
  35. package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
  36. package/lib/cjs/tools/ElementSetTool.d.ts.map +1 -1
  37. package/lib/cjs/tools/ElementSetTool.js +1 -2
  38. package/lib/cjs/tools/ElementSetTool.js.map +1 -1
  39. package/lib/esm/AccuDraw.d.ts.map +1 -1
  40. package/lib/esm/AccuDraw.js +11 -10
  41. package/lib/esm/AccuDraw.js.map +1 -1
  42. package/lib/esm/AuxCoordSys.d.ts +11 -4
  43. package/lib/esm/AuxCoordSys.d.ts.map +1 -1
  44. package/lib/esm/AuxCoordSys.js +13 -7
  45. package/lib/esm/AuxCoordSys.js.map +1 -1
  46. package/lib/esm/DrawingViewState.d.ts.map +1 -1
  47. package/lib/esm/DrawingViewState.js +3 -4
  48. package/lib/esm/DrawingViewState.js.map +1 -1
  49. package/lib/esm/EntityState.js +1 -1
  50. package/lib/esm/EntityState.js.map +1 -1
  51. package/lib/esm/IModelConnection.d.ts +20 -7
  52. package/lib/esm/IModelConnection.d.ts.map +1 -1
  53. package/lib/esm/IModelConnection.js +67 -78
  54. package/lib/esm/IModelConnection.js.map +1 -1
  55. package/lib/esm/IpcApp.d.ts +37 -0
  56. package/lib/esm/IpcApp.d.ts.map +1 -1
  57. package/lib/esm/IpcApp.js +56 -27
  58. package/lib/esm/IpcApp.js.map +1 -1
  59. package/lib/esm/ViewCreator2d.d.ts.map +1 -1
  60. package/lib/esm/ViewCreator2d.js +7 -9
  61. package/lib/esm/ViewCreator2d.js.map +1 -1
  62. package/lib/esm/common/gltf/GltfSchema.d.ts +7 -0
  63. package/lib/esm/common/gltf/GltfSchema.d.ts.map +1 -1
  64. package/lib/esm/common/gltf/GltfSchema.js.map +1 -1
  65. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  66. package/lib/esm/tile/GltfReader.js +3 -0
  67. package/lib/esm/tile/GltfReader.js.map +1 -1
  68. package/lib/esm/tile/TileRequestChannel.js.map +1 -1
  69. package/lib/esm/tools/AccuDrawTool.d.ts +20 -3
  70. package/lib/esm/tools/AccuDrawTool.d.ts.map +1 -1
  71. package/lib/esm/tools/AccuDrawTool.js +109 -59
  72. package/lib/esm/tools/AccuDrawTool.js.map +1 -1
  73. package/lib/esm/tools/ElementSetTool.d.ts.map +1 -1
  74. package/lib/esm/tools/ElementSetTool.js +1 -2
  75. package/lib/esm/tools/ElementSetTool.js.map +1 -1
  76. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  77. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  78. package/package.json +23 -23
@@ -57,6 +57,18 @@ export declare class IpcApp {
57
57
  * primitive types and `ArrayBuffers` are allowed.
58
58
  */
59
59
  static send(channel: string, ...data: any[]): void;
60
+ /**
61
+ * Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls
62
+ * @param channel The name of the channel for this handler.
63
+ * @param handler A function that supplies the implementation for `channel`
64
+ * @returns A function to call to remove the handler.
65
+ * @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see
66
+ * [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the
67
+ * corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking
68
+ * its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.
69
+ * @beta
70
+ */
71
+ static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction;
60
72
  /**
61
73
  * Call a method on the backend through an Ipc channel.
62
74
  * @param channelName the channel registered by the backend handler.
@@ -114,4 +126,29 @@ export declare abstract class NotificationHandler {
114
126
  */
115
127
  static register(): RemoveFunction;
116
128
  }
129
+ /**
130
+ * Base class for all implementations of an Ipc interface.
131
+ *
132
+ * Create a subclass to implement your Ipc interface. Your class should be declared like this:
133
+ * ```ts
134
+ * class MyHandler extends IpcHandler implements MyInterface
135
+ * ```
136
+ * to ensure all methods and signatures are correct.
137
+ *
138
+ * Then, call `MyClass.register` at startup to connect your class to your channel.
139
+ * @beta
140
+ */
141
+ export declare abstract class IpcHandler {
142
+ abstract get channelName(): string;
143
+ /**
144
+ * Register this class as the handler for methods on its channel. This static method creates a new instance
145
+ * that becomes the handler and is `this` when its methods are called.
146
+ * @returns A function that can be called to remove the handler.
147
+ * @note Call this only once per channel. Each call registers an *additional* handler rather than
148
+ * replacing a previous one, so registering the same channel more than once causes every registered
149
+ * handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]
150
+ * returned by the previous `register`.
151
+ */
152
+ static register(): RemoveFunction;
153
+ }
117
154
  //# sourceMappingURL=IpcApp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IpcApp.d.ts","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAwD,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,EACsC,eAAe,EAAwC,WAAW,EAAE,iBAAiB,EAChI,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAgC;IACnD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAA6B;IAC5D,qEAAqE;IAErE,OAAO,CAAC,MAAM,KAAK,GAAG,GAA0D;IAEhF,iIAAiI;IACjI,WAAkB,OAAO,IAAI,OAAO,CAAoC;IAExE;;;;;;;OAOG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc;IAIhF;;;;OAIG;WACW,cAAc,CAAC,OAAO,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G,OAAO,CAAC,GAAG,CAAC;IAM5G;;OAEG;WACiB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAIzG;;OAEG;WACW,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAI7F;;;OAGG;WACW,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAIrG,+EAA+E;IAC/E,OAAc,cAAc,oCAAkE;IAE9F;qFACiF;WAC7D,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,aAAa;IAMxE,gBAAgB;WACI,QAAQ;CAK7B;AAED;;;;;;;;;;;;;GAaG;AACH,8BAAsB,mBAAmB;IACvC,wFAAwF;IACxF,aAAoB,WAAW,IAAI,MAAM,CAAC;IAEnC,YAAY,IAAI,cAAc;IAUrC;;;;;OAKG;WACW,QAAQ,IAAI,cAAc;CAGzC;AAQD;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU;IAE9B,aAAoB,WAAW,IAAI,MAAM,CAAC;IAE1C;;;;;;;;OAQG;WACW,QAAQ,IAAI,cAAc;CAIzC"}
package/lib/esm/IpcApp.js CHANGED
@@ -5,8 +5,8 @@
5
5
  /** @packageDocumentation
6
6
  * @module NativeApp
7
7
  */
8
- import { BentleyError, expectDefined, IModelStatus, JsonUtils } from "@itwin/core-bentley";
9
- import { BackendError, IModelError, ipcAppChannels, iTwinChannel, } from "@itwin/core-common";
8
+ import { expectDefined, IModelStatus } from "@itwin/core-bentley";
9
+ import { BackendError, createIpcDispatcher, createIpcProxy, IModelError, ipcAppChannels, iTwinChannel, serializeIpcError, unwrapIpcInvokeReturn, } from "@itwin/core-common";
10
10
  import { _callIpcChannel } from "./common/internal/Symbols";
11
11
  import { IModelApp } from "./IModelApp";
12
12
  /**
@@ -62,6 +62,29 @@ export class IpcApp {
62
62
  static send(channel, ...data) {
63
63
  return this.ipc.send(iTwinChannel(channel), ...data);
64
64
  }
65
+ /**
66
+ * Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls
67
+ * @param channel The name of the channel for this handler.
68
+ * @param handler A function that supplies the implementation for `channel`
69
+ * @returns A function to call to remove the handler.
70
+ * @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see
71
+ * [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the
72
+ * corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking
73
+ * its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.
74
+ * @beta
75
+ */
76
+ static handle(channel, handler) {
77
+ const listener = async (_evt, responseChannel, ...args) => {
78
+ try {
79
+ const response = await handler(...args);
80
+ this.ipc.send(responseChannel, response);
81
+ }
82
+ catch (err) {
83
+ this.ipc.send(responseChannel, serializeIpcError(err, true));
84
+ }
85
+ };
86
+ return this.addListener(channel, listener);
87
+ }
65
88
  /**
66
89
  * Call a method on the backend through an Ipc channel.
67
90
  * @param channelName the channel registered by the backend handler.
@@ -73,21 +96,8 @@ export class IpcApp {
73
96
  */
74
97
  static async [_callIpcChannel](channelName, methodName, ...args) {
75
98
  const retVal = (await this.invoke(channelName, methodName, ...args));
76
- if (retVal.error === undefined)
77
- return retVal.result; // method was successful
78
- // backend threw an exception, rethrow one on frontend
79
- const err = retVal.error;
80
- if (!JsonUtils.isObject(err)) {
81
- // Exception wasn't an object?
82
- throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error
83
- }
84
- // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.
85
- if (!BentleyError.isError(err))
86
- throw Object.assign(new Error(typeof err.message === "string" ? err.message : "unknown error"), err);
87
- const trimErr = { ...err };
88
- delete trimErr.iTwinErrorId; // these are methods on BackendError and will cause Object.assign to fail.
89
- delete trimErr.loggingMetadata;
90
- throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);
99
+ // for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.
100
+ return unwrapIpcInvokeReturn(retVal, BackendError);
91
101
  }
92
102
  /** @internal
93
103
  * @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.
@@ -99,22 +109,14 @@ export class IpcApp {
99
109
  * @param channelName the channel registered by the backend handler.
100
110
  */
101
111
  static makeIpcProxy(channelName) {
102
- return new Proxy({}, {
103
- get(_target, methodName) {
104
- return async (...args) => IpcApp[_callIpcChannel](channelName, methodName, ...args);
105
- },
106
- });
112
+ return createIpcProxy(async (methodName, ...args) => IpcApp[_callIpcChannel](channelName, methodName, ...args));
107
113
  }
108
114
  /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a "methodName" argument followed by optional arguments
109
115
  * @param channelName the channel registered by the backend handler.
110
116
  * @param functionName the function to call on the handler.
111
117
  */
112
118
  static makeIpcFunctionProxy(channelName, functionName) {
113
- return new Proxy({}, {
114
- get(_target, methodName) {
115
- return async (...args) => IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);
116
- },
117
- });
119
+ return createIpcProxy(async (methodName, ...args) => IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args));
118
120
  }
119
121
  /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */
120
122
  static appFunctionIpc = IpcApp.makeIpcProxy(ipcAppChannels.functions);
@@ -170,4 +172,31 @@ class IpcAppNotifyHandler extends NotificationHandler {
170
172
  get channelName() { return ipcAppChannels.appNotify; }
171
173
  notifyApp() { }
172
174
  }
175
+ /**
176
+ * Base class for all implementations of an Ipc interface.
177
+ *
178
+ * Create a subclass to implement your Ipc interface. Your class should be declared like this:
179
+ * ```ts
180
+ * class MyHandler extends IpcHandler implements MyInterface
181
+ * ```
182
+ * to ensure all methods and signatures are correct.
183
+ *
184
+ * Then, call `MyClass.register` at startup to connect your class to your channel.
185
+ * @beta
186
+ */
187
+ export class IpcHandler {
188
+ /**
189
+ * Register this class as the handler for methods on its channel. This static method creates a new instance
190
+ * that becomes the handler and is `this` when its methods are called.
191
+ * @returns A function that can be called to remove the handler.
192
+ * @note Call this only once per channel. Each call registers an *additional* handler rather than
193
+ * replacing a previous one, so registering the same channel more than once causes every registered
194
+ * handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]
195
+ * returned by the previous `register`.
196
+ */
197
+ static register() {
198
+ const impl = new this(); // create an instance of subclass. "as any" is necessary because base class is abstract
199
+ return IpcApp.handle(impl.channelName, createIpcDispatcher(impl, impl.channelName, true));
200
+ }
201
+ }
173
202
  //# sourceMappingURL=IpcApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAC7G,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,cAAc,EAAyF,YAAY,GAE/I,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAU1D;;;GAGG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAC,IAAI,CAAgC;IAC3C,MAAM,CAAC,gBAAgB,CAA6B;IAC5D,qEAAqE;IAE7D,MAAM,KAAK,GAAG,KAAwB,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhF,iIAAiI;IAC1H,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IA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,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, expectDefined, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n private static _removeAppNotify: RemoveFunction | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return expectDefined(this._ipc); }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify;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M,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,UAAU;IAI9B;;;;;;;;OAQG;IACI,MAAM,CAAC,QAAQ;QACpB,MAAM,IAAI,GAAG,IAAK,IAAY,EAAgB,CAAC,CAAC,uFAAuF;QACvI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { expectDefined, IModelStatus, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, createIpcDispatcher, createIpcProxy, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction, serializeIpcError, unwrapIpcInvokeReturn,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n private static _removeAppNotify: RemoveFunction | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return expectDefined(this._ipc); }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @returns A function to call to remove the handler.\n * @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see\n * [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the\n * corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking\n * its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.\n * @beta\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n const listener = async (_evt: Event, responseChannel: string, ...args: any[]) => {\n try {\n const response = await handler(...args);\n this.ipc.send(responseChannel, response);\n } catch (err) {\n this.ipc.send(responseChannel, serializeIpcError(err, true));\n }\n };\n\n return this.addListener(channel, listener);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n // for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n return unwrapIpcInvokeReturn(retVal, BackendError);\n }\n\n /** @internal\n * @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return createIpcProxy<K>(async (methodName: string, ...args: any[]) => IpcApp[_callIpcChannel](channelName, methodName, ...args));\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return createIpcProxy<K>(async (methodName: string, ...args: any[]) => IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args));\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @beta\n */\nexport abstract class IpcHandler {\n /* All subclasses must implement this method to specify their channel name. */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note Call this only once per channel. Each call registers an *additional* handler rather than\n * replacing a previous one, so registering the same channel more than once causes every registered\n * handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]\n * returned by the previous `register`.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n return IpcApp.handle(impl.channelName, createIpcDispatcher(impl, impl.channelName, true));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewCreator2d.d.ts","sourceRoot":"","sources":["../../src/ViewCreator2d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAOH,OAAO,EAAa,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACwB,QAAQ,EAEtC,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAe,MAAM,aAAa,CAAC;AAErD;;;EAGE;AACF,MAAM,WAAW,oBAAoB;IACnC,4GAA4G;IAC5G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,uKAAuK;IACvK,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IAUZ,OAAO,CAAC,OAAO;IAP3B,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAA6E;IAChH,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAmC;IAEpE;;;OAGG;gBACiB,OAAO,EAAE,gBAAgB;IAE7C;;;;;OAKG;IACU,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;IAYxG;;;;OAIG;YACW,sBAAsB;IAiBpC;;;;;;OAMG;YACW,kBAAkB;IAehC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB,CA8E3B;IAEF;;;;OAIG;YACW,kBAAkB;IAuBh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ACU,cAAc;IAuB5B;;;OAGG;YACW,6BAA6B;IAQ3C;;OAEG;YACW,iBAAiB;IAQ/B;;;OAGG;YACW,oBAAoB;IAQlC;;;OAGG;IACH,OAAO,CAAC,aAAa,CAMnB;CACH"}
@@ -197,10 +197,9 @@ export class ViewCreator2d {
197
197
  async _addSheetViewProps(modelId, props) {
198
198
  let width = 0;
199
199
  let height = 0;
200
- // eslint-disable-next-line @typescript-eslint/no-deprecated
201
- for await (const row of this._imodel.createQueryReader(`SELECT Width, Height FROM bis.Sheet WHERE ECInstanceId = ?`, QueryBinder.from([modelId]), { rowFormat: QueryRowFormat.UseJsPropertyNames })) {
202
- width = row.width;
203
- height = row.height;
200
+ for await (const row of this._imodel.createQueryReader(`SELECT Width, Height FROM bis.Sheet WHERE ECInstanceId = ?`, QueryBinder.from([modelId]), { rowFormat: QueryRowFormat.UseECSqlPropertyNames })) {
201
+ width = row.Width;
202
+ height = row.Height;
204
203
  break;
205
204
  }
206
205
  const sheetProps = {
@@ -244,7 +243,7 @@ export class ViewCreator2d {
244
243
  * @param modelId of target model.
245
244
  */
246
245
  async _getViewDefinitionsIdForModel(modelId) {
247
- const query = `SELECT ECInstanceId from Bis.ViewDefinition2D WHERE BaseModel.Id = ${modelId} AND isPrivate = false LIMIT 1`;
246
+ const query = `SELECT ECInstanceId as id from Bis.ViewDefinition2D WHERE BaseModel.Id = ${modelId} AND isPrivate = false LIMIT 1`;
248
247
  const viewDefinitionsId = await this._executeQuery(query);
249
248
  return (viewDefinitionsId.length) > 0 ? viewDefinitionsId[0] : undefined;
250
249
  }
@@ -252,7 +251,7 @@ export class ViewCreator2d {
252
251
  * Get all drawing categories
253
252
  */
254
253
  async _getAllCategories() {
255
- const query = "SELECT ECInstanceId from BisCore.DrawingCategory";
254
+ const query = "SELECT ECInstanceId as id from BisCore.DrawingCategory";
256
255
  const categories = await this._executeQuery(query);
257
256
  return categories;
258
257
  }
@@ -261,7 +260,7 @@ export class ViewCreator2d {
261
260
  * @param modelId of target model.
262
261
  */
263
262
  async _getSheetAttachments(modelId) {
264
- const query = `SELECT ECInstanceId FROM Bis.ViewAttachment WHERE Model.Id = ${modelId}`;
263
+ const query = `SELECT ECInstanceId as id FROM Bis.ViewAttachment WHERE Model.Id = ${modelId}`;
265
264
  const attachments = await this._executeQuery(query);
266
265
  return attachments;
267
266
  }
@@ -271,8 +270,7 @@ export class ViewCreator2d {
271
270
  */
272
271
  _executeQuery = async (query) => {
273
272
  const rows = [];
274
- // eslint-disable-next-line @typescript-eslint/no-deprecated
275
- for await (const row of this._imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))
273
+ for await (const row of this._imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseECSqlPropertyNames }))
276
274
  rows.push(row.id);
277
275
  return rows;
278
276
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ViewCreator2d.js","sourceRoot":"","sources":["../../src/ViewCreator2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH;;;EAGE;AAEF,OAAO,EAAyB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACkB,IAAI,EAAE,QAAQ,EAAqB,MAAM,EAAE,WAAW,EAAsB,WAAW,EAAE,cAAc,GAE/H,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IAUJ;IARpB,sCAAsC;IAC9B,MAAM,CAAC,oBAAoB,GAAG,CAAC,iBAAiB,CAAC,aAAa,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACxG,MAA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E;QAC9C,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,4DAA4D;QAC5D,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,kBAAkB,EAAE,CAAC;YACxH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEpB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC","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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Views\n */\n\n/*\nAPI for creating a 2D view from a given modelId and modelType (classFullName).\nAdditional options (such as background color) can be passed during view creation.\n*/\n\nimport { Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport {\n CategorySelectorProps, Code, ColorDef, DisplayStyleProps, IModel, IModelError, ModelSelectorProps, QueryBinder, QueryRowFormat, SheetProps,\n ViewDefinition2dProps, ViewStateProps,\n} from \"@itwin/core-common\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { DrawingViewState } from \"./DrawingViewState\";\nimport { EntityState } from \"./EntityState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { DrawingModelState, SectionDrawingModelState, SheetModelState } from \"./ModelState\";\nimport { SheetViewState } from \"./SheetViewState\";\nimport { ViewState, ViewState2d } from \"./ViewState\";\n\n/** Options for creating a [[ViewState2d]] via [[ViewCreator2d]].\n * @public\n * @extensions\n*/\nexport interface ViewCreator2dOptions {\n /** Aspect ratio of [[Viewport]]. Required to fit contents of the model in the initial state of the view. */\n vpAspect?: number;\n /** Background color of the view (default is white). */\n bgColor?: ColorDef;\n /** Checks to see if there already is a [[ViewDefinition2d]] for the given modelId. If so, use it as the seed view, and merge its props into the final view created. */\n useSeedView?: boolean;\n}\n\n/**\n * API for creating a [[ViewState2d]] for a 2D model ([[GeometricModel2dState]]). @see [[ViewCreator3d]] to create a view for a 3d model.\n * Example usage:\n * ```ts\n * const viewCreator = new ViewCreator2d(imodel);\n * const models = await imodel.models.queryProps({ from: \"BisCore.GeometricModel2d\" });\n * if (models.length > 0)\n * const view = await viewCreator.createViewForModel(models[0].id!);\n * ```\n * @public\n * @extensions\n */\nexport class ViewCreator2d {\n\n // Types of 2D models the API supports\n private static _drawingModelClasses = [DrawingModelState.classFullName, SectionDrawingModelState.classFullName];\n private static _sheetModelClasses = [SheetModelState.classFullName];\n\n /**\n * Constructs a ViewCreator2d using an [[IModelConnection]].\n * @param _imodel [[IModelConnection]] to query for categories and/or models.\n */\n constructor(private _imodel: IModelConnection) { }\n\n /**\n * Creates and returns view for the 2D model id passed in.\n * @param modelId Id of the 2D model for the view.\n * @param [options] Options for creating the view.\n * @throws [IModelError]($common) If modelType is not supported.\n */\n public async createViewForModel(modelId: Id64String, options?: ViewCreator2dOptions): Promise<ViewState> {\n\n const baseClassName = await this._getModelBaseClassName(modelId);\n\n const viewState = await this._createViewState2d(modelId, baseClassName.classFullName, options);\n try {\n await viewState.load();\n } catch { }\n\n return viewState;\n }\n\n /**\n * Gets model base class name from id.\n * @param modelId of target model.\n * @throws [IModelError]($common) if modelId is invalid.\n */\n private async _getModelBaseClassName(modelId: Id64String): Promise<typeof EntityState> {\n\n let baseClassName;\n\n const modelProps = await this._imodel.models.getProps(modelId);\n if (modelProps.length > 0) {\n const modelType = modelProps[0].classFullName;\n baseClassName = await this._imodel.findClassFor(modelType, undefined);\n } else\n throw new IModelError(IModelStatus.BadModel, \"ViewCreator2d._getModelBaseClassName: modelId is invalid\");\n\n if (baseClassName === undefined)\n throw new IModelError(IModelStatus.WrongClass, \"ViewCreator2d.getViewForModel: modelType is invalid\");\n\n return baseClassName;\n }\n\n /**\n * Creates view from any 2D model type (Drawing/SectionDrawing/Sheet)\n * @param modelId of target model.\n * @param modelType classFullName of target 2D model.\n * @param options for view creation.\n * @throws [IModelError]($common) if modelType is not supported.\n */\n private async _createViewState2d(modelId: Id64String, modelType: string, options?: ViewCreator2dOptions): Promise<ViewState2d> {\n let viewState: ViewState2d;\n if (this._isDrawingModelClass(modelType)) {\n const props = await this._createViewStateProps(modelId, options);\n viewState = DrawingViewState.createFromProps(props, this._imodel);\n } else if (this._isSheetModelClass(modelType)) {\n let props = await this._createViewStateProps(modelId, options);\n props = await this._addSheetViewProps(modelId, props);\n viewState = SheetViewState.createFromProps(props, this._imodel);\n } else\n throw new IModelError(IModelStatus.WrongClass, \"ViewCreator2d._createViewState2d: modelType not supported\");\n\n return viewState;\n }\n\n /**\n * Checks to see if given model is of [[DrawingModelState]].\n * @param modelType classFullName of model.\n */\n private _isDrawingModelClass(modelType: string) {\n if (ViewCreator2d._drawingModelClasses.includes(modelType)) {\n return true;\n }\n return false;\n }\n\n /**\n * Checks to see if given model is of [[SheetModelState]].\n * @param modelType classFullName of model.\n */\n private _isSheetModelClass(modelType: string) {\n if (ViewCreator2d._sheetModelClasses.includes(modelType)) {\n return true;\n }\n return false;\n }\n\n /**\n * Creates ViewStateProps for the model. ViewStateProps are composed of the 4 sets of Props below.\n * @param modelId of target model.\n * @param options for view creation.\n */\n private _createViewStateProps = async (modelId: Id64String, options?: ViewCreator2dOptions): Promise<ViewStateProps> => {\n // Use dictionary model in all props\n const dictionaryId = IModel.dictionaryId;\n const categories = await this._getAllCategories();\n\n // Get bg color from options or default to white\n const bgColor: ColorDef = options?.bgColor ? options.bgColor : ColorDef.white;\n\n // model extents\n const modelProps = await this._imodel.models.queryExtents(modelId);\n const modelExtents = Range3d.fromJSON(modelProps[0]?.extents);\n let originX = modelExtents.low.x;\n let originY = modelExtents.low.y;\n let deltaX = modelExtents.xLength();\n let deltaY = modelExtents.yLength();\n\n // if vp aspect given, update model extents to fit view\n if (options?.vpAspect) {\n const modelAspect = deltaY / deltaX;\n\n if (modelAspect > options.vpAspect) {\n const xFix = deltaY / options.vpAspect;\n originX = originX - xFix / 2;\n deltaX = deltaX + xFix;\n } else if (modelAspect < options.vpAspect) {\n const yFix = deltaX * options.vpAspect;\n originY = originY - yFix / 2;\n deltaY = deltaY + yFix;\n }\n }\n\n const modelSelectorProps: ModelSelectorProps = {\n models: [modelId],\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:ModelSelector\",\n };\n\n const categorySelectorProps: CategorySelectorProps = {\n categories,\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:CategorySelector\",\n };\n\n const viewDefinitionProps: ViewDefinition2dProps = {\n baseModelId: modelId,\n categorySelectorId: \"\",\n displayStyleId: \"\",\n origin: { x: originX, y: originY },\n delta: { x: deltaX, y: deltaY },\n angle: { radians: 0 },\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:ViewDefinition2d\",\n };\n\n const displayStyleProps: DisplayStyleProps = {\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:DisplayStyle2d\",\n jsonProperties: {\n styles: {\n backgroundColor: bgColor.tbgr,\n },\n },\n };\n\n const viewStateProps: ViewStateProps = {\n displayStyleProps,\n categorySelectorProps,\n modelSelectorProps,\n viewDefinitionProps,\n modelExtents,\n };\n\n // merge seed view props if needed\n return options?.useSeedView ? this._mergeSeedView(modelId, viewStateProps) : viewStateProps;\n };\n\n /**\n * Adds Sheet view props to given view props.\n * @param modelId of target model.\n * @param props input ViewStateProps.\n */\n private async _addSheetViewProps(modelId: Id64String, props: ViewStateProps) {\n let width = 0;\n let height = 0;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n for await (const row of this._imodel.createQueryReader(`SELECT Width, Height FROM bis.Sheet WHERE ECInstanceId = ?`, QueryBinder.from([modelId]), { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\n width = row.width as number;\n height = row.height as number;\n break;\n }\n const sheetProps: SheetProps = {\n model: modelId,\n code: { spec: \"\", scope: \"\" },\n classFullName: \"DrawingSheetModel\",\n height,\n width,\n };\n\n props.sheetAttachments = await this._getSheetAttachments(modelId);\n props.sheetProps = sheetProps;\n\n return props;\n }\n\n /**\n * Merges a seed view in the iModel with the passed view state props. It will be a no-op if there are no 2D views for target model.\n * @param modelId of target model.\n * @param props Input view props to be merged\n */\n private async _mergeSeedView(modelId: Id64String, props: ViewStateProps): Promise<ViewStateProps> {\n const viewDefinitionId = await this._getViewDefinitionsIdForModel(modelId);\n // Return incase no viewDefinition found.\n if (viewDefinitionId === undefined)\n return props;\n\n const seedViewState = (await this._imodel.views.load(viewDefinitionId));\n const seedViewStateProps: ViewStateProps = {\n categorySelectorProps: seedViewState.categorySelector.toJSON(),\n viewDefinitionProps: seedViewState.toJSON(),\n displayStyleProps: seedViewState.displayStyle.toJSON(),\n };\n const mergedDisplayProps = seedViewStateProps.displayStyleProps;\n if (mergedDisplayProps.jsonProperties !== undefined) {\n mergedDisplayProps.jsonProperties.styles = {\n ...mergedDisplayProps.jsonProperties.styles,\n ...props.displayStyleProps.jsonProperties?.styles,\n };\n }\n\n return { ...seedViewStateProps, ...props, displayStyleProps: mergedDisplayProps };\n }\n\n /**\n * Get all view definitions for a given model.\n * @param modelId of target model.\n */\n private async _getViewDefinitionsIdForModel(modelId: Id64String): Promise<Id64String | undefined> {\n\n const query = `SELECT ECInstanceId from Bis.ViewDefinition2D WHERE BaseModel.Id = ${modelId} AND isPrivate = false LIMIT 1`;\n const viewDefinitionsId = await this._executeQuery(query);\n\n return (viewDefinitionsId.length) > 0 ? viewDefinitionsId[0] : undefined;\n }\n\n /**\n * Get all drawing categories\n */\n private async _getAllCategories(): Promise<Id64Array> {\n\n const query = \"SELECT ECInstanceId from BisCore.DrawingCategory\";\n const categories = await this._executeQuery(query);\n\n return categories;\n }\n\n /**\n * Get all sheet attachments\n * @param modelId of target model.\n */\n private async _getSheetAttachments(modelId: string): Promise<Id64Array> {\n\n const query = `SELECT ECInstanceId FROM Bis.ViewAttachment WHERE Model.Id = ${modelId}`;\n const attachments = await this._executeQuery(query);\n\n return attachments;\n }\n\n /**\n * Helper function to execute ECSql queries.\n * @param query statement to execute.\n */\n private _executeQuery = async (query: string) => {\n const rows = [];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n for await (const row of this._imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\n rows.push(row.id);\n\n return rows;\n };\n}\n"]}
1
+ {"version":3,"file":"ViewCreator2d.js","sourceRoot":"","sources":["../../src/ViewCreator2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH;;;EAGE;AAEF,OAAO,EAAyB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACkB,IAAI,EAAE,QAAQ,EAAqB,MAAM,EAAE,WAAW,EAAsB,WAAW,EAAE,cAAc,GAE/H,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IAUJ;IARpB,sCAAsC;IAC9B,MAAM,CAAC,oBAAoB,GAAG,CAAC,iBAAiB,CAAC,aAAa,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACxG,MAAM,CAAC,kBAAkB,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAEpE;;;OAGG;IACH,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAI,CAAC;IAElD;;;;;OAKG;IACI,KAAK,CAAC,kBAAkB,CAAC,OAAmB,EAAE,OAA8B;QAEjF,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEjE,MAAM,SA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------------------------------------------------------------------------------\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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Views\n */\n\n/*\nAPI for creating a 2D view from a given modelId and modelType (classFullName).\nAdditional options (such as background color) can be passed during view creation.\n*/\n\nimport { Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport {\n CategorySelectorProps, Code, ColorDef, DisplayStyleProps, IModel, IModelError, ModelSelectorProps, QueryBinder, QueryRowFormat, SheetProps,\n ViewDefinition2dProps, ViewStateProps,\n} from \"@itwin/core-common\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { DrawingViewState } from \"./DrawingViewState\";\nimport { EntityState } from \"./EntityState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { DrawingModelState, SectionDrawingModelState, SheetModelState } from \"./ModelState\";\nimport { SheetViewState } from \"./SheetViewState\";\nimport { ViewState, ViewState2d } from \"./ViewState\";\n\n/** Options for creating a [[ViewState2d]] via [[ViewCreator2d]].\n * @public\n * @extensions\n*/\nexport interface ViewCreator2dOptions {\n /** Aspect ratio of [[Viewport]]. Required to fit contents of the model in the initial state of the view. */\n vpAspect?: number;\n /** Background color of the view (default is white). */\n bgColor?: ColorDef;\n /** Checks to see if there already is a [[ViewDefinition2d]] for the given modelId. If so, use it as the seed view, and merge its props into the final view created. */\n useSeedView?: boolean;\n}\n\n/**\n * API for creating a [[ViewState2d]] for a 2D model ([[GeometricModel2dState]]). @see [[ViewCreator3d]] to create a view for a 3d model.\n * Example usage:\n * ```ts\n * const viewCreator = new ViewCreator2d(imodel);\n * const models = await imodel.models.queryProps({ from: \"BisCore.GeometricModel2d\" });\n * if (models.length > 0)\n * const view = await viewCreator.createViewForModel(models[0].id!);\n * ```\n * @public\n * @extensions\n */\nexport class ViewCreator2d {\n\n // Types of 2D models the API supports\n private static _drawingModelClasses = [DrawingModelState.classFullName, SectionDrawingModelState.classFullName];\n private static _sheetModelClasses = [SheetModelState.classFullName];\n\n /**\n * Constructs a ViewCreator2d using an [[IModelConnection]].\n * @param _imodel [[IModelConnection]] to query for categories and/or models.\n */\n constructor(private _imodel: IModelConnection) { }\n\n /**\n * Creates and returns view for the 2D model id passed in.\n * @param modelId Id of the 2D model for the view.\n * @param [options] Options for creating the view.\n * @throws [IModelError]($common) If modelType is not supported.\n */\n public async createViewForModel(modelId: Id64String, options?: ViewCreator2dOptions): Promise<ViewState> {\n\n const baseClassName = await this._getModelBaseClassName(modelId);\n\n const viewState = await this._createViewState2d(modelId, baseClassName.classFullName, options);\n try {\n await viewState.load();\n } catch { }\n\n return viewState;\n }\n\n /**\n * Gets model base class name from id.\n * @param modelId of target model.\n * @throws [IModelError]($common) if modelId is invalid.\n */\n private async _getModelBaseClassName(modelId: Id64String): Promise<typeof EntityState> {\n\n let baseClassName;\n\n const modelProps = await this._imodel.models.getProps(modelId);\n if (modelProps.length > 0) {\n const modelType = modelProps[0].classFullName;\n baseClassName = await this._imodel.findClassFor(modelType, undefined);\n } else\n throw new IModelError(IModelStatus.BadModel, \"ViewCreator2d._getModelBaseClassName: modelId is invalid\");\n\n if (baseClassName === undefined)\n throw new IModelError(IModelStatus.WrongClass, \"ViewCreator2d.getViewForModel: modelType is invalid\");\n\n return baseClassName;\n }\n\n /**\n * Creates view from any 2D model type (Drawing/SectionDrawing/Sheet)\n * @param modelId of target model.\n * @param modelType classFullName of target 2D model.\n * @param options for view creation.\n * @throws [IModelError]($common) if modelType is not supported.\n */\n private async _createViewState2d(modelId: Id64String, modelType: string, options?: ViewCreator2dOptions): Promise<ViewState2d> {\n let viewState: ViewState2d;\n if (this._isDrawingModelClass(modelType)) {\n const props = await this._createViewStateProps(modelId, options);\n viewState = DrawingViewState.createFromProps(props, this._imodel);\n } else if (this._isSheetModelClass(modelType)) {\n let props = await this._createViewStateProps(modelId, options);\n props = await this._addSheetViewProps(modelId, props);\n viewState = SheetViewState.createFromProps(props, this._imodel);\n } else\n throw new IModelError(IModelStatus.WrongClass, \"ViewCreator2d._createViewState2d: modelType not supported\");\n\n return viewState;\n }\n\n /**\n * Checks to see if given model is of [[DrawingModelState]].\n * @param modelType classFullName of model.\n */\n private _isDrawingModelClass(modelType: string) {\n if (ViewCreator2d._drawingModelClasses.includes(modelType)) {\n return true;\n }\n return false;\n }\n\n /**\n * Checks to see if given model is of [[SheetModelState]].\n * @param modelType classFullName of model.\n */\n private _isSheetModelClass(modelType: string) {\n if (ViewCreator2d._sheetModelClasses.includes(modelType)) {\n return true;\n }\n return false;\n }\n\n /**\n * Creates ViewStateProps for the model. ViewStateProps are composed of the 4 sets of Props below.\n * @param modelId of target model.\n * @param options for view creation.\n */\n private _createViewStateProps = async (modelId: Id64String, options?: ViewCreator2dOptions): Promise<ViewStateProps> => {\n // Use dictionary model in all props\n const dictionaryId = IModel.dictionaryId;\n const categories = await this._getAllCategories();\n\n // Get bg color from options or default to white\n const bgColor: ColorDef = options?.bgColor ? options.bgColor : ColorDef.white;\n\n // model extents\n const modelProps = await this._imodel.models.queryExtents(modelId);\n const modelExtents = Range3d.fromJSON(modelProps[0]?.extents);\n let originX = modelExtents.low.x;\n let originY = modelExtents.low.y;\n let deltaX = modelExtents.xLength();\n let deltaY = modelExtents.yLength();\n\n // if vp aspect given, update model extents to fit view\n if (options?.vpAspect) {\n const modelAspect = deltaY / deltaX;\n\n if (modelAspect > options.vpAspect) {\n const xFix = deltaY / options.vpAspect;\n originX = originX - xFix / 2;\n deltaX = deltaX + xFix;\n } else if (modelAspect < options.vpAspect) {\n const yFix = deltaX * options.vpAspect;\n originY = originY - yFix / 2;\n deltaY = deltaY + yFix;\n }\n }\n\n const modelSelectorProps: ModelSelectorProps = {\n models: [modelId],\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:ModelSelector\",\n };\n\n const categorySelectorProps: CategorySelectorProps = {\n categories,\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:CategorySelector\",\n };\n\n const viewDefinitionProps: ViewDefinition2dProps = {\n baseModelId: modelId,\n categorySelectorId: \"\",\n displayStyleId: \"\",\n origin: { x: originX, y: originY },\n delta: { x: deltaX, y: deltaY },\n angle: { radians: 0 },\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:ViewDefinition2d\",\n };\n\n const displayStyleProps: DisplayStyleProps = {\n code: Code.createEmpty(),\n model: dictionaryId,\n classFullName: \"BisCore:DisplayStyle2d\",\n jsonProperties: {\n styles: {\n backgroundColor: bgColor.tbgr,\n },\n },\n };\n\n const viewStateProps: ViewStateProps = {\n displayStyleProps,\n categorySelectorProps,\n modelSelectorProps,\n viewDefinitionProps,\n modelExtents,\n };\n\n // merge seed view props if needed\n return options?.useSeedView ? this._mergeSeedView(modelId, viewStateProps) : viewStateProps;\n };\n\n /**\n * Adds Sheet view props to given view props.\n * @param modelId of target model.\n * @param props input ViewStateProps.\n */\n private async _addSheetViewProps(modelId: Id64String, props: ViewStateProps) {\n let width = 0;\n let height = 0;\n for await (const row of this._imodel.createQueryReader(`SELECT Width, Height FROM bis.Sheet WHERE ECInstanceId = ?`, QueryBinder.from([modelId]), { rowFormat: QueryRowFormat.UseECSqlPropertyNames })) {\n width = row.Width as number;\n height = row.Height as number;\n break;\n }\n const sheetProps: SheetProps = {\n model: modelId,\n code: { spec: \"\", scope: \"\" },\n classFullName: \"DrawingSheetModel\",\n height,\n width,\n };\n\n props.sheetAttachments = await this._getSheetAttachments(modelId);\n props.sheetProps = sheetProps;\n\n return props;\n }\n\n /**\n * Merges a seed view in the iModel with the passed view state props. It will be a no-op if there are no 2D views for target model.\n * @param modelId of target model.\n * @param props Input view props to be merged\n */\n private async _mergeSeedView(modelId: Id64String, props: ViewStateProps): Promise<ViewStateProps> {\n const viewDefinitionId = await this._getViewDefinitionsIdForModel(modelId);\n // Return incase no viewDefinition found.\n if (viewDefinitionId === undefined)\n return props;\n\n const seedViewState = (await this._imodel.views.load(viewDefinitionId));\n const seedViewStateProps: ViewStateProps = {\n categorySelectorProps: seedViewState.categorySelector.toJSON(),\n viewDefinitionProps: seedViewState.toJSON(),\n displayStyleProps: seedViewState.displayStyle.toJSON(),\n };\n const mergedDisplayProps = seedViewStateProps.displayStyleProps;\n if (mergedDisplayProps.jsonProperties !== undefined) {\n mergedDisplayProps.jsonProperties.styles = {\n ...mergedDisplayProps.jsonProperties.styles,\n ...props.displayStyleProps.jsonProperties?.styles,\n };\n }\n\n return { ...seedViewStateProps, ...props, displayStyleProps: mergedDisplayProps };\n }\n\n /**\n * Get all view definitions for a given model.\n * @param modelId of target model.\n */\n private async _getViewDefinitionsIdForModel(modelId: Id64String): Promise<Id64String | undefined> {\n\n const query = `SELECT ECInstanceId as id from Bis.ViewDefinition2D WHERE BaseModel.Id = ${modelId} AND isPrivate = false LIMIT 1`;\n const viewDefinitionsId = await this._executeQuery(query);\n\n return (viewDefinitionsId.length) > 0 ? viewDefinitionsId[0] : undefined;\n }\n\n /**\n * Get all drawing categories\n */\n private async _getAllCategories(): Promise<Id64Array> {\n\n const query = \"SELECT ECInstanceId as id from BisCore.DrawingCategory\";\n const categories = await this._executeQuery(query);\n\n return categories;\n }\n\n /**\n * Get all sheet attachments\n * @param modelId of target model.\n */\n private async _getSheetAttachments(modelId: string): Promise<Id64Array> {\n\n const query = `SELECT ECInstanceId as id FROM Bis.ViewAttachment WHERE Model.Id = ${modelId}`;\n const attachments = await this._executeQuery(query);\n\n return attachments;\n }\n\n /**\n * Helper function to execute ECSql queries.\n * @param query statement to execute.\n */\n private _executeQuery = async (query: string) => {\n const rows = [];\n for await (const row of this._imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseECSqlPropertyNames }))\n rows.push(row.id);\n\n return rows;\n };\n}\n"]}
@@ -173,6 +173,13 @@ export interface GltfMesh extends GltfChildOfRootProperty {
173
173
  /** For morph targets - currently unsupported. */
174
174
  weights?: number[];
175
175
  extensions?: GltfExtensions & {
176
+ /** The [EXT_mesh_primitive_restart](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_primitive_restart) extension
177
+ * describes groups of primitives that can be combined into a single draw call, using a "combined" index accessor containing primitive restart values
178
+ * to separate the individual primitives.
179
+ * It is superseded by [KHR_mesh_primitive_restart](https://github.com/KhronosGroup/glTF/pull/2569), which has no JSON payload at any level. A primitive's
180
+ * own indices accessor may contain restart values inline (the maximum value for the accessor's component type), with the extension declared in the
181
+ * asset's `extensionsUsed` and `extensionsRequired` arrays. See [[GltfReader.readPolylines]] for the handling of inline restart values.
182
+ */
176
183
  EXT_mesh_primitive_restart?: {
177
184
  primitiveGroups: Array<{
178
185
  primitives: number[];
@@ -1 +1 @@
1
- {"version":3,"file":"GltfSchema.d.ts","sourceRoot":"","sources":["../../../../src/common/gltf/GltfSchema.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,oBAAY,YAAY;IACtB,MAAM,IAAI;IACV,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,SAAS,IAAI;IACb,SAAS,IAAI;IACb,+BAA+B;IAC/B,aAAa,IAAI;IACjB,+BAA+B;IAC/B,WAAW,IAAI;CAChB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,UAAU,OAAS;IACnB,YAAY,OAAS;IACrB,WAAW,OAAO;IAClB,aAAa,OAAO;IACpB,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,GAAG,OAAO;IACV,IAAI,OAAO;IACX,OAAO,QAAS;IAChB,OAAO,QAAS;IAChB,SAAS,QAAQ;IACjB,SAAS,QAAQ;IACjB,SAAS,QAAQ;IACjB,SAAS,QAAQ;IACjB,SAAS,QAAQ;IACjB,SAAS,QAAQ;CAClB;AAED,gBAAgB;AAChB,oBAAY,aAAa;IACvB,OAAO,OAAO;IACd,MAAM,OAAO;CACd;AAED,gBAAgB;AAChB,oBAAY,aAAa;IACvB,OAAO,OAAwB;IAC/B,MAAM,OAAuB;IAC7B,oBAAoB,OAAO;IAC3B,mBAAmB,OAAO;IAC1B,m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