@itwin/core-backend 4.1.0-dev.66 → 4.1.0-dev.68

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,6 +1,11 @@
1
1
  # Change Log - @itwin/core-backend
2
2
 
3
- This log was last generated on Mon, 17 Jul 2023 19:31:25 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 18 Jul 2023 13:47:06 GMT and should not be manually modified.
4
+
5
+ ## 4.0.5
6
+ Tue, 18 Jul 2023 12:21:56 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 4.0.4
6
11
  Wed, 12 Jul 2023 15:50:01 GMT
@@ -6,14 +6,41 @@ import { IModelJsNative } from "@bentley/imodeljs-native";
6
6
  export type SchemaKey = IModelJsNative.ECSchemaXmlContext.SchemaKey;
7
7
  /** @internal */
8
8
  export type SchemaMatchType = IModelJsNative.ECSchemaXmlContext.SchemaMatchType;
9
- /** @internal */
9
+ /** Context used when deserializing a [Schema]($ecschema-metadata) from an XML file.
10
+ * A schema may contain references to other schemas, which may reside elsewhere on the local disk than the referencing schema.
11
+ * The context maintains a list of directories ("search paths") to search for referenced schemas. Directories can be appended to the list via [[addSchemaPath]].
12
+ * When a referenced schema needs to be located, the list of directories is searched in the order in which each was added.
13
+ * Once located, the schema is cached to avoid performing repeated lookups in the file system.
14
+ * @see [[readSchemaFromXmlFile]] to deserialize a schema.
15
+ * @beta
16
+ */
10
17
  export declare class ECSchemaXmlContext {
11
18
  private _nativeContext;
19
+ /** Construct a context with an empty list of search paths. */
12
20
  constructor();
21
+ /** @internal */
13
22
  get nativeContext(): IModelJsNative.ECSchemaXmlContext;
23
+ /** Append a directory to the list of directories that will be searched to locate referenced schemas.
24
+ * The directories are searched in the order in which they were added to the list.
25
+ * @param searchPath The absolute path to the directory to search.
26
+ */
14
27
  addSchemaPath(searchPath: string): void;
28
+ /** Set the last locater to be used when trying to find a schema
29
+ * @param locater Locater that should be used as the last locater when trying to find a schema
30
+ * @internal
31
+ */
15
32
  setSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void;
33
+ /** Adds a schema locator to the beginning of the list of locators used to search for schemas.
34
+ * This schema locator will be prioritized over other locators when searching for schemas in the current context.
35
+ * @param locater Locater to add to the current context
36
+ * @internal
37
+ */
16
38
  setFirstSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void;
39
+ /** Deserialize a [Schema]($ecschema-metadata) from an ECSchemaXML-formatted file.
40
+ * @param filePath The absolute path of the XML file.
41
+ * @returns The JSON representation of the schema, as a [SchemaProps]($ecschema-metadata).
42
+ * @throws [[IModelError]] if there is a problem reading schema from the XML file
43
+ */
17
44
  readSchemaFromXmlFile(filePath: string): any;
18
45
  }
19
46
  //# sourceMappingURL=ECSchemaXmlContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaXmlContext.d.ts","sourceRoot":"","sources":["../../src/ECSchemaXmlContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,kBAAkB,CAAC,SAAS,CAAC;AAEpE,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC;AAEhF,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,cAAc,CAAgD;;IAMtE,IAAW,aAAa,IAAI,cAAc,CAAC,kBAAkB,CAG5D;IAEM,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIvC,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,qBAAqB,GAAG,IAAI;IAIxF,qBAAqB,CAAC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,qBAAqB,GAAG,IAAI;IAI7F,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;CASpD"}
1
+ {"version":3,"file":"ECSchemaXmlContext.d.ts","sourceRoot":"","sources":["../../src/ECSchemaXmlContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,kBAAkB,CAAC,SAAS,CAAC;AAEpE,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC;AAEhF;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,cAAc,CAAgD;IAEtE,8DAA8D;;IAK9D,gBAAgB;IAChB,IAAW,aAAa,IAAI,cAAc,CAAC,kBAAkB,CAG5D;IAED;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI9C;;;OAGG;IACI,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,qBAAqB,GAAG,IAAI;IAI/F;;;;OAIG;IACI,qBAAqB,CAAC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,qBAAqB,GAAG,IAAI;IAIpG;;;;OAIG;IACI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;CASpD"}
@@ -11,24 +11,51 @@ exports.ECSchemaXmlContext = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const IModelHost_1 = require("./IModelHost");
14
- /** @internal */
14
+ /** Context used when deserializing a [Schema]($ecschema-metadata) from an XML file.
15
+ * A schema may contain references to other schemas, which may reside elsewhere on the local disk than the referencing schema.
16
+ * The context maintains a list of directories ("search paths") to search for referenced schemas. Directories can be appended to the list via [[addSchemaPath]].
17
+ * When a referenced schema needs to be located, the list of directories is searched in the order in which each was added.
18
+ * Once located, the schema is cached to avoid performing repeated lookups in the file system.
19
+ * @see [[readSchemaFromXmlFile]] to deserialize a schema.
20
+ * @beta
21
+ */
15
22
  class ECSchemaXmlContext {
23
+ /** Construct a context with an empty list of search paths. */
16
24
  constructor() {
17
25
  this._nativeContext = new IModelHost_1.IModelHost.platform.ECSchemaXmlContext();
18
26
  }
27
+ /** @internal */
19
28
  get nativeContext() {
20
29
  (0, core_bentley_1.assert)(undefined !== this._nativeContext);
21
30
  return this._nativeContext;
22
31
  }
32
+ /** Append a directory to the list of directories that will be searched to locate referenced schemas.
33
+ * The directories are searched in the order in which they were added to the list.
34
+ * @param searchPath The absolute path to the directory to search.
35
+ */
23
36
  addSchemaPath(searchPath) {
24
37
  this.nativeContext.addSchemaPath(searchPath);
25
38
  }
39
+ /** Set the last locater to be used when trying to find a schema
40
+ * @param locater Locater that should be used as the last locater when trying to find a schema
41
+ * @internal
42
+ */
26
43
  setSchemaLocater(locater) {
27
44
  this.nativeContext.setSchemaLocater(locater);
28
45
  }
46
+ /** Adds a schema locator to the beginning of the list of locators used to search for schemas.
47
+ * This schema locator will be prioritized over other locators when searching for schemas in the current context.
48
+ * @param locater Locater to add to the current context
49
+ * @internal
50
+ */
29
51
  setFirstSchemaLocater(locater) {
30
52
  this.nativeContext.setFirstSchemaLocater(locater);
31
53
  }
54
+ /** Deserialize a [Schema]($ecschema-metadata) from an ECSchemaXML-formatted file.
55
+ * @param filePath The absolute path of the XML file.
56
+ * @returns The JSON representation of the schema, as a [SchemaProps]($ecschema-metadata).
57
+ * @throws [[IModelError]] if there is a problem reading schema from the XML file
58
+ */
32
59
  readSchemaFromXmlFile(filePath) {
33
60
  const response = this.nativeContext.readSchemaFromXmlFile(filePath);
34
61
  if (response.error) {
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaXmlContext.js","sourceRoot":"","sources":["../../src/ECSchemaXmlContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAAiD;AAEjD,6CAA0C;AAQ1C,gBAAgB;AAChB,MAAa,kBAAkB;IAG7B;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACrE,CAAC;IAED,IAAW,aAAa;QACtB,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,aAAa,CAAC,UAAkB;QACrC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAEM,gBAAgB,CAAC,OAAgE;QACtF,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEM,qBAAqB,CAAC,OAAgE;QAC3F,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAEM,qBAAqB,CAAC,QAAgB;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,QAAQ,CAAC,KAAK,EAAE;YAClB,MAAM,IAAI,yBAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACtE;QAED,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAjCD,gDAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/** @internal */\r\nexport type SchemaKey = IModelJsNative.ECSchemaXmlContext.SchemaKey;\r\n\r\n/** @internal */\r\nexport type SchemaMatchType = IModelJsNative.ECSchemaXmlContext.SchemaMatchType;\r\n\r\n/** @internal */\r\nexport class ECSchemaXmlContext {\r\n private _nativeContext: IModelJsNative.ECSchemaXmlContext | undefined;\r\n\r\n constructor() {\r\n this._nativeContext = new IModelHost.platform.ECSchemaXmlContext();\r\n }\r\n\r\n public get nativeContext(): IModelJsNative.ECSchemaXmlContext {\r\n assert(undefined !== this._nativeContext);\r\n return this._nativeContext;\r\n }\r\n\r\n public addSchemaPath(searchPath: string): void {\r\n this.nativeContext.addSchemaPath(searchPath);\r\n }\r\n\r\n public setSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void {\r\n this.nativeContext.setSchemaLocater(locater);\r\n }\r\n\r\n public setFirstSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void {\r\n this.nativeContext.setFirstSchemaLocater(locater);\r\n }\r\n\r\n public readSchemaFromXmlFile(filePath: string): any {\r\n const response = this.nativeContext.readSchemaFromXmlFile(filePath);\r\n if (response.error) {\r\n throw new IModelError(response.error.status, response.error.message);\r\n }\r\n\r\n assert(undefined !== response.result);\r\n return JSON.parse(response.result);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECSchemaXmlContext.js","sourceRoot":"","sources":["../../src/ECSchemaXmlContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAAiD;AAEjD,6CAA0C;AAQ1C;;;;;;;GAOG;AACH,MAAa,kBAAkB;IAG7B,8DAA8D;IAC9D;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACrE,CAAC;IAED,gBAAgB;IAChB,IAAW,aAAa;QACtB,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAAkB;QACrC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACI,gBAAgB,CAAC,OAAgE;QACtF,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAAC,OAAgE;QAC3F,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAAC,QAAgB;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,QAAQ,CAAC,KAAK,EAAE;YAClB,MAAM,IAAI,yBAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACtE;QAED,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AArDD,gDAqDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/** @internal */\r\nexport type SchemaKey = IModelJsNative.ECSchemaXmlContext.SchemaKey;\r\n\r\n/** @internal */\r\nexport type SchemaMatchType = IModelJsNative.ECSchemaXmlContext.SchemaMatchType;\r\n\r\n/** Context used when deserializing a [Schema]($ecschema-metadata) from an XML file.\r\n * A schema may contain references to other schemas, which may reside elsewhere on the local disk than the referencing schema.\r\n * The context maintains a list of directories (\"search paths\") to search for referenced schemas. Directories can be appended to the list via [[addSchemaPath]].\r\n * When a referenced schema needs to be located, the list of directories is searched in the order in which each was added.\r\n * Once located, the schema is cached to avoid performing repeated lookups in the file system.\r\n * @see [[readSchemaFromXmlFile]] to deserialize a schema.\r\n * @beta\r\n */\r\nexport class ECSchemaXmlContext {\r\n private _nativeContext: IModelJsNative.ECSchemaXmlContext | undefined;\r\n\r\n /** Construct a context with an empty list of search paths. */\r\n constructor() {\r\n this._nativeContext = new IModelHost.platform.ECSchemaXmlContext();\r\n }\r\n\r\n /** @internal */\r\n public get nativeContext(): IModelJsNative.ECSchemaXmlContext {\r\n assert(undefined !== this._nativeContext);\r\n return this._nativeContext;\r\n }\r\n\r\n /** Append a directory to the list of directories that will be searched to locate referenced schemas.\r\n * The directories are searched in the order in which they were added to the list.\r\n * @param searchPath The absolute path to the directory to search.\r\n */\r\n public addSchemaPath(searchPath: string): void {\r\n this.nativeContext.addSchemaPath(searchPath);\r\n }\r\n\r\n /** Set the last locater to be used when trying to find a schema\r\n * @param locater Locater that should be used as the last locater when trying to find a schema\r\n * @internal\r\n */\r\n public setSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void {\r\n this.nativeContext.setSchemaLocater(locater);\r\n }\r\n\r\n /** Adds a schema locator to the beginning of the list of locators used to search for schemas.\r\n * This schema locator will be prioritized over other locators when searching for schemas in the current context.\r\n * @param locater Locater to add to the current context\r\n * @internal\r\n */\r\n public setFirstSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void {\r\n this.nativeContext.setFirstSchemaLocater(locater);\r\n }\r\n\r\n /** Deserialize a [Schema]($ecschema-metadata) from an ECSchemaXML-formatted file.\r\n * @param filePath The absolute path of the XML file.\r\n * @returns The JSON representation of the schema, as a [SchemaProps]($ecschema-metadata).\r\n * @throws [[IModelError]] if there is a problem reading schema from the XML file\r\n */\r\n public readSchemaFromXmlFile(filePath: string): any {\r\n const response = this.nativeContext.readSchemaFromXmlFile(filePath);\r\n if (response.error) {\r\n throw new IModelError(response.error.status, response.error.message);\r\n }\r\n\r\n assert(undefined !== response.result);\r\n return JSON.parse(response.result);\r\n }\r\n}\r\n"]}
@@ -37,7 +37,7 @@ export declare class ElementAspect extends Entity {
37
37
  /** @internal */
38
38
  static get className(): string;
39
39
  element: RelatedElement;
40
- /** @internal */
40
+ /** Construct an aspect from its JSON representation and its containing iModel. */
41
41
  constructor(props: ElementAspectProps, iModel: IModelDb);
42
42
  toJSON(): ElementAspectProps;
43
43
  /** Called before a new ElementAspect is inserted.
@@ -129,7 +129,7 @@ export declare class ExternalSourceAspect extends ElementMultiAspect {
129
129
  jsonProperties?: string;
130
130
  /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */
131
131
  source?: RelatedElement;
132
- /** @internal */
132
+ /** Construct an aspect from its JSON representation and its containing iModel. */
133
133
  constructor(props: ExternalSourceAspectProps, iModel: IModelDb);
134
134
  /** @deprecated in 3.x. findAllBySource */
135
135
  static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): {
@@ -1 +1 @@
1
- {"version":3,"file":"ElementAspect.d.ts","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA0B,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/I,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YA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M,CAAC;IACpB,mKAAmK;IAC5J,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACI,cAAc,CAAC,EAAE,MAAM,CAAC;IAC/B,iHAAiH;IAC1G,MAAM,CAAC,EAAE,cAAc,CAAC;IAE/B,kFAAkF;gBACtE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,QAAQ;IAW9D,0CAA0C;WAC5B,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;QAAE,SAAS,CAAC,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;KAAE;IAgBtJ;;;;;;;;;;;MAWE;WACY,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAA;KAAE,CAAC;IAc9I,MAAM,IAAI,yBAAyB;cAYhC,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;CAQ/E;AAED,cAAc;AACd,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,KAAY,IAAI;QACd,oFAAoF;QACpF,OAAO,YAAY;QACnB,yFAAyF;QACzF,YAAY,iBAAiB;QAC7B;;WAEG;QACH,KAAK,UAAU;KAChB;CACF"}
@@ -19,7 +19,7 @@ const core_bentley_1 = require("@itwin/core-bentley");
19
19
  class ElementAspect extends Entity_1.Entity {
20
20
  /** @internal */
21
21
  static get className() { return "ElementAspect"; }
22
- /** @internal */
22
+ /** Construct an aspect from its JSON representation and its containing iModel. */
23
23
  constructor(props, iModel) {
24
24
  super(props, iModel);
25
25
  this.element = core_common_1.RelatedElement.fromJSON(props.element); // eslint-disable-line @typescript-eslint/no-non-null-assertion
@@ -108,7 +108,7 @@ exports.ChannelRootAspect = ChannelRootAspect;
108
108
  class ExternalSourceAspect extends ElementMultiAspect {
109
109
  /** @internal */
110
110
  static get className() { return "ExternalSourceAspect"; }
111
- /** @internal */
111
+ /** Construct an aspect from its JSON representation and its containing iModel. */
112
112
  constructor(props, iModel) {
113
113
  super(props, iModel);
114
114
  this.scope = core_common_1.RelatedElement.fromJSON(props.scope); // eslint-disable-line @typescript-eslint/no-non-null-assertion
@@ -1 +1 @@
1
- {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AA0B3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IACvC,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAG1E,gBAAgB;IAChB,YAAY,KAAyB,EAAE,MAAgB;QACrD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,+DAA+D;IACzH,CAAC;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,GAAqB;QAC7C,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACO,MAAM,CAAC,UAAU,CAAC,IAAsB,IAAU,CAAC;IAE7D;;;;OAIG;IACO,MAAM,CAAC,QAA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AG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;IAEkB,mBAAmB,CAAC,YAAgC;QACrE,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,KAAK;YACZ,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAvGD,oDAuGC;AAED,cAAc;AACd,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAcpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementAspects\r\n */\r\n\r\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/** Argument for the `ElementAspect.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnAspectArg {\r\n /** The iModel for the aspect affected by this event. */\r\n iModel: IModelDb;\r\n /** The model for the aspect affected by this event */\r\n model: Id64String;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnAspectPropsArg extends OnAspectArg {\r\n /** The new properties of the aspect affected by this event. */\r\n props: Readonly<ElementAspectProps>;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\r\n * @beta\r\n */\r\nexport interface OnAspectIdArg extends OnAspectArg {\r\n /** The Id of the aspect affected by this event */\r\n aspectId: Id64String;\r\n}\r\n\r\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\r\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\r\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\r\n * @public\r\n */\r\nexport class ElementAspect extends Entity {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ElementAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n }\r\n\r\n public override toJSON(): ElementAspectProps {\r\n const val = super.toJSON() as ElementAspectProps;\r\n val.element = this.element;\r\n return val;\r\n }\r\n\r\n /** Called before a new ElementAspect is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInsert(arg: OnAspectPropsArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after a new ElementAspect was inserted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdate(arg: OnAspectPropsArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after an ElementAspect was updated.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDelete(arg: OnAspectIdArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after an ElementAspect was deleted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnAspectIdArg): void { }\r\n}\r\n\r\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementUniqueAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementUniqueAspect\"; }\r\n}\r\n\r\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementMultiAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n /** Insert a ChannelRootAspect on the specified element.\r\n * @deprecated in 4.0 use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\r\n */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\r\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\r\n iModel.elements.insertAspect(props);\r\n }\r\n}\r\n\r\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\r\n * @public\r\n */\r\nexport class ExternalSourceAspect extends ElementMultiAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAspect\"; }\r\n\r\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\r\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\r\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\r\n */\r\n public scope: RelatedElement;\r\n /** The identifier of the object in the source repository. */\r\n public identifier: string;\r\n /** The kind of object within the source repository. */\r\n public kind: string;\r\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\r\n public checksum?: string;\r\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\r\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\r\n * If present, this value must be guaranteed to change when any of the source object's content changes.\r\n */\r\n public version?: string;\r\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\r\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\r\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\r\n */\r\n public jsonProperties?: string;\r\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\r\n public source?: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n this.source = RelatedElement.fromJSON(props.source);\r\n this.identifier = props.identifier;\r\n this.kind = props.kind;\r\n this.checksum = props.checksum;\r\n this.version = props.version;\r\n this.jsonProperties = props.jsonProperties;\r\n }\r\n\r\n /** @deprecated in 3.x. findAllBySource */\r\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n let elementId: Id64String | undefined;\r\n let aspectId: Id64String | undefined;\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n elementId = statement.getValue(0).getId();\r\n aspectId = statement.getValue(1).getId();\r\n }\r\n });\r\n return { elementId, aspectId };\r\n }\r\n\r\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\r\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\r\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\r\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\r\n * Therefore, the result array could have more than one entry with the same elementId.\r\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\r\n * @param iModelDb The iModel to query\r\n * @param scope The scope of the ExternalSourceAspects to find\r\n * @param kind The kind of the ExternalSourceAspects to find\r\n * @param identifier The identifier of the ExternalSourceAspects to find\r\n * @returns the query results\r\n */\r\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\r\n }\r\n });\r\n return found;\r\n }\r\n\r\n public override toJSON(): ExternalSourceAspectProps {\r\n const val = super.toJSON() as ExternalSourceAspectProps;\r\n val.scope = this.scope;\r\n val.source = this.source;\r\n val.identifier = this.identifier;\r\n val.kind = this.kind;\r\n val.checksum = this.checksum;\r\n val.version = this.version;\r\n val.jsonProperties = this.jsonProperties;\r\n return val;\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.scope)\r\n referenceIds.addElement(this.scope.id);\r\n referenceIds.addElement(this.element.id);\r\n if (this.source)\r\n referenceIds.addElement(this.source.id);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\r\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\r\n * @public\r\n */\r\n export enum Kind {\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\r\n Element = \"Element\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\r\n Relationship = \"Relationship\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\r\n * @see [[ExternalSourceAspect.scope]]\r\n */\r\n Scope = \"Scope\",\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AA0B3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IACvC,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAG1E,kFAAkF;IAClF,YAAY,KAAyB,EAAE,MAAgB;QACrD,KAAK,CAAC,KAAK,EAAE,MAAM,CA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AAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAcpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementAspects\r\n */\r\n\r\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/** Argument for the `ElementAspect.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnAspectArg {\r\n /** The iModel for the aspect affected by this event. */\r\n iModel: IModelDb;\r\n /** The model for the aspect affected by this event */\r\n model: Id64String;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnAspectPropsArg extends OnAspectArg {\r\n /** The new properties of the aspect affected by this event. */\r\n props: Readonly<ElementAspectProps>;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\r\n * @beta\r\n */\r\nexport interface OnAspectIdArg extends OnAspectArg {\r\n /** The Id of the aspect affected by this event */\r\n aspectId: Id64String;\r\n}\r\n\r\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\r\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\r\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\r\n * @public\r\n */\r\nexport class ElementAspect extends Entity {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** Construct an aspect from its JSON representation and its containing iModel. */\r\n constructor(props: ElementAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n }\r\n\r\n public override toJSON(): ElementAspectProps {\r\n const val = super.toJSON() as ElementAspectProps;\r\n val.element = this.element;\r\n return val;\r\n }\r\n\r\n /** Called before a new ElementAspect is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInsert(arg: OnAspectPropsArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after a new ElementAspect was inserted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdate(arg: OnAspectPropsArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after an ElementAspect was updated.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDelete(arg: OnAspectIdArg): void {\r\n arg.iModel.channels.verifyChannel(arg.model);\r\n }\r\n\r\n /** Called after an ElementAspect was deleted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnAspectIdArg): void { }\r\n}\r\n\r\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementUniqueAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementUniqueAspect\"; }\r\n}\r\n\r\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementMultiAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n /** Insert a ChannelRootAspect on the specified element.\r\n * @deprecated in 4.0 use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\r\n */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\r\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\r\n iModel.elements.insertAspect(props);\r\n }\r\n}\r\n\r\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\r\n * @public\r\n */\r\nexport class ExternalSourceAspect extends ElementMultiAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAspect\"; }\r\n\r\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\r\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\r\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\r\n */\r\n public scope: RelatedElement;\r\n /** The identifier of the object in the source repository. */\r\n public identifier: string;\r\n /** The kind of object within the source repository. */\r\n public kind: string;\r\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\r\n public checksum?: string;\r\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\r\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\r\n * If present, this value must be guaranteed to change when any of the source object's content changes.\r\n */\r\n public version?: string;\r\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\r\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\r\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\r\n */\r\n public jsonProperties?: string;\r\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\r\n public source?: RelatedElement;\r\n\r\n /** Construct an aspect from its JSON representation and its containing iModel. */\r\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n this.source = RelatedElement.fromJSON(props.source);\r\n this.identifier = props.identifier;\r\n this.kind = props.kind;\r\n this.checksum = props.checksum;\r\n this.version = props.version;\r\n this.jsonProperties = props.jsonProperties;\r\n }\r\n\r\n /** @deprecated in 3.x. findAllBySource */\r\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n let elementId: Id64String | undefined;\r\n let aspectId: Id64String | undefined;\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n elementId = statement.getValue(0).getId();\r\n aspectId = statement.getValue(1).getId();\r\n }\r\n });\r\n return { elementId, aspectId };\r\n }\r\n\r\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\r\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\r\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\r\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\r\n * Therefore, the result array could have more than one entry with the same elementId.\r\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\r\n * @param iModelDb The iModel to query\r\n * @param scope The scope of the ExternalSourceAspects to find\r\n * @param kind The kind of the ExternalSourceAspects to find\r\n * @param identifier The identifier of the ExternalSourceAspects to find\r\n * @returns the query results\r\n */\r\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\r\n }\r\n });\r\n return found;\r\n }\r\n\r\n public override toJSON(): ExternalSourceAspectProps {\r\n const val = super.toJSON() as ExternalSourceAspectProps;\r\n val.scope = this.scope;\r\n val.source = this.source;\r\n val.identifier = this.identifier;\r\n val.kind = this.kind;\r\n val.checksum = this.checksum;\r\n val.version = this.version;\r\n val.jsonProperties = this.jsonProperties;\r\n return val;\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.scope)\r\n referenceIds.addElement(this.scope.id);\r\n referenceIds.addElement(this.element.id);\r\n if (this.source)\r\n referenceIds.addElement(this.source.id);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\r\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\r\n * @public\r\n */\r\n export enum Kind {\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\r\n Element = \"Element\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\r\n Relationship = \"Relationship\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\r\n * @see [[ExternalSourceAspect.scope]]\r\n */\r\n Scope = \"Scope\",\r\n }\r\n}\r\n"]}
@@ -1,3 +1,6 @@
1
+ /** @packageDocumentation
2
+ * @module Schema
3
+ */
1
4
  import { ECSchemaXmlContext } from "./ECSchemaXmlContext";
2
5
  /** Converts EC2 Xml ECSchema(s). On success, the `EC2 Xml schemas` are converted into `EC3.2 Xml schemas`.
3
6
  * @param ec2XmlSchemas The EC2 Xml string(s) created from a serialized ECSchema.
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaUtils.d.ts","sourceRoot":"","sources":["../../src/SchemaUtils.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAOnH;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAO/G"}
1
+ {"version":3,"file":"SchemaUtils.d.ts","sourceRoot":"","sources":["../../src/SchemaUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAOnH;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAO/G"}
@@ -3,11 +3,11 @@
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.upgradeCustomAttributesToEC3 = exports.convertEC2SchemasToEC3Schemas = void 0;
8
6
  /** @packageDocumentation
9
7
  * @module Schema
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.upgradeCustomAttributesToEC3 = exports.convertEC2SchemasToEC3Schemas = void 0;
11
11
  const imodeljs_native_1 = require("@bentley/imodeljs-native");
12
12
  const core_bentley_1 = require("@itwin/core-bentley");
13
13
  const core_common_1 = require("@itwin/core-common");
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaUtils.js","sourceRoot":"","sources":["../../src/SchemaUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,8DAA0D;AAC1D,sDAAoD;AACpD,oDAAiD;AAGjD;;;;;GAKG;AACH,SAAgB,6BAA6B,CAAC,aAAuB,EAAE,aAAkC;IACvG,MAAM,kBAAkB,GAAG,aAAa,EAAE,aAAa,CAAC;IACxD,MAAM,aAAa,GAAa,gCAAc,CAAC,aAAa,CAAC,oBAAoB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IACrH,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kCAAkC,CAAC,CAAC;IAEjF,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,sEAOC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,UAAoB,EAAE,aAAkC;IACnG,MAAM,kBAAkB,GAAG,aAAa,EAAE,aAAa,CAAC;IACxD,MAAM,sBAAsB,GAAa,gCAAc,CAAC,aAAa,CAAC,uBAAuB,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IAC9H,IAAI,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACrC,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,mDAAmD,CAAC,CAAC;IAElG,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAPD,oEAOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BentleyStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { ECSchemaXmlContext } from \"./ECSchemaXmlContext\";\r\n\r\n/** Converts EC2 Xml ECSchema(s). On success, the `EC2 Xml schemas` are converted into `EC3.2 Xml schemas`.\r\n * @param ec2XmlSchemas The EC2 Xml string(s) created from a serialized ECSchema.\r\n * @returns EC3.2 Xml ECSchema(s).\r\n * @throws [[IModelError]] if there is a problem converting the EC2 schemas.\r\n * @beta\r\n */\r\nexport function convertEC2SchemasToEC3Schemas(ec2XmlSchemas: string[], schemaContext?: ECSchemaXmlContext): string[] {\r\n const maybeNativeContext = schemaContext?.nativeContext;\r\n const ec3XmlSchemas: string[] = IModelJsNative.SchemaUtility.convertEC2XmlSchemas(ec2XmlSchemas, maybeNativeContext);\r\n if (ec2XmlSchemas.length === 0)\r\n throw new IModelError(BentleyStatus.ERROR, \"Error converting EC2 Xml schemas\");\r\n\r\n return ec3XmlSchemas;\r\n}\r\n\r\n/** Converts schema metadata to EC3 concepts by traversing custom attributes of the supplied schema and calling converters based on schemaName:customAttributeName\r\n * @param xmlSchemas The ECSchema Xml string(s).\r\n * @returns EC3.2 Xml ECSchema(s) with converted custom attributes.\r\n * @throws [[IModelError]] if there is a problem converting the custom attributes of a schema.\r\n * @beta\r\n */\r\nexport function upgradeCustomAttributesToEC3(xmlSchemas: string[], schemaContext?: ECSchemaXmlContext): string[] {\r\n const maybeNativeContext = schemaContext?.nativeContext;\r\n const schemasWithConvertedCA: string[] = IModelJsNative.SchemaUtility.convertCustomAttributes(xmlSchemas, maybeNativeContext);\r\n if (schemasWithConvertedCA.length === 0)\r\n throw new IModelError(BentleyStatus.ERROR, \"Error converting custom attributes of Xml schemas\");\r\n\r\n return schemasWithConvertedCA;\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaUtils.js","sourceRoot":"","sources":["../../src/SchemaUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,8DAA0D;AAC1D,sDAAoD;AACpD,oDAAiD;AAGjD;;;;;GAKG;AACH,SAAgB,6BAA6B,CAAC,aAAuB,EAAE,aAAkC;IACvG,MAAM,kBAAkB,GAAG,aAAa,EAAE,aAAa,CAAC;IACxD,MAAM,aAAa,GAAa,gCAAc,CAAC,aAAa,CAAC,oBAAoB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IACrH,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kCAAkC,CAAC,CAAC;IAEjF,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,sEAOC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,UAAoB,EAAE,aAAkC;IACnG,MAAM,kBAAkB,GAAG,aAAa,EAAE,aAAa,CAAC;IACxD,MAAM,sBAAsB,GAAa,gCAAc,CAAC,aAAa,CAAC,uBAAuB,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IAC9H,IAAI,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACrC,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,mDAAmD,CAAC,CAAC;IAElG,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAPD,oEAOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BentleyStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { ECSchemaXmlContext } from \"./ECSchemaXmlContext\";\r\n\r\n/** Converts EC2 Xml ECSchema(s). On success, the `EC2 Xml schemas` are converted into `EC3.2 Xml schemas`.\r\n * @param ec2XmlSchemas The EC2 Xml string(s) created from a serialized ECSchema.\r\n * @returns EC3.2 Xml ECSchema(s).\r\n * @throws [[IModelError]] if there is a problem converting the EC2 schemas.\r\n * @beta\r\n */\r\nexport function convertEC2SchemasToEC3Schemas(ec2XmlSchemas: string[], schemaContext?: ECSchemaXmlContext): string[] {\r\n const maybeNativeContext = schemaContext?.nativeContext;\r\n const ec3XmlSchemas: string[] = IModelJsNative.SchemaUtility.convertEC2XmlSchemas(ec2XmlSchemas, maybeNativeContext);\r\n if (ec2XmlSchemas.length === 0)\r\n throw new IModelError(BentleyStatus.ERROR, \"Error converting EC2 Xml schemas\");\r\n\r\n return ec3XmlSchemas;\r\n}\r\n\r\n/** Converts schema metadata to EC3 concepts by traversing custom attributes of the supplied schema and calling converters based on schemaName:customAttributeName\r\n * @param xmlSchemas The ECSchema Xml string(s).\r\n * @returns EC3.2 Xml ECSchema(s) with converted custom attributes.\r\n * @throws [[IModelError]] if there is a problem converting the custom attributes of a schema.\r\n * @beta\r\n */\r\nexport function upgradeCustomAttributesToEC3(xmlSchemas: string[], schemaContext?: ECSchemaXmlContext): string[] {\r\n const maybeNativeContext = schemaContext?.nativeContext;\r\n const schemasWithConvertedCA: string[] = IModelJsNative.SchemaUtility.convertCustomAttributes(xmlSchemas, maybeNativeContext);\r\n if (schemasWithConvertedCA.length === 0)\r\n throw new IModelError(BentleyStatus.ERROR, \"Error converting custom attributes of Xml schemas\");\r\n\r\n return schemasWithConvertedCA;\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-backend",
3
- "version": "4.1.0-dev.66",
3
+ "version": "4.1.0-dev.68",
4
4
  "description": "iTwin.js backend components",
5
5
  "main": "lib/cjs/core-backend.js",
6
6
  "typings": "lib/cjs/core-backend",
@@ -25,9 +25,9 @@
25
25
  "url": "http://www.bentley.com"
26
26
  },
27
27
  "peerDependencies": {
28
- "@itwin/core-bentley": "^4.1.0-dev.66",
29
- "@itwin/core-common": "^4.1.0-dev.66",
30
- "@itwin/core-geometry": "^4.1.0-dev.66",
28
+ "@itwin/core-bentley": "^4.1.0-dev.68",
29
+ "@itwin/core-common": "^4.1.0-dev.68",
30
+ "@itwin/core-geometry": "^4.1.0-dev.68",
31
31
  "@opentelemetry/api": "^1.0.4"
32
32
  },
33
33
  "peerDependenciesMeta": {
@@ -66,12 +66,12 @@
66
66
  "source-map-loader": "^4.0.0",
67
67
  "typescript": "~5.0.2",
68
68
  "webpack": "^5.76.0",
69
- "@itwin/build-tools": "4.1.0-dev.66",
70
- "@itwin/core-common": "4.1.0-dev.66",
71
- "@itwin/core-bentley": "4.1.0-dev.66",
72
- "@itwin/core-geometry": "4.1.0-dev.66",
73
- "@itwin/core-webpack-tools": "4.1.0-dev.66",
74
- "internal-tools": "3.0.0-dev.69"
69
+ "@itwin/build-tools": "4.1.0-dev.68",
70
+ "@itwin/core-bentley": "4.1.0-dev.68",
71
+ "@itwin/core-common": "4.1.0-dev.68",
72
+ "@itwin/core-geometry": "4.1.0-dev.68",
73
+ "internal-tools": "3.0.0-dev.69",
74
+ "@itwin/core-webpack-tools": "4.1.0-dev.68"
75
75
  },
76
76
  "dependencies": {
77
77
  "@bentley/imodeljs-native": "4.1.5",
@@ -86,7 +86,7 @@
86
86
  "reflect-metadata": "^0.1.13",
87
87
  "semver": "^7.3.5",
88
88
  "ws": "^7.5.3",
89
- "@itwin/core-telemetry": "4.1.0-dev.66"
89
+ "@itwin/core-telemetry": "4.1.0-dev.68"
90
90
  },
91
91
  "nyc": {
92
92
  "extends": "./node_modules/@itwin/build-tools/.nycrc"