Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated 3.x APIs in core-common #7572

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
274667f
Remove isManagedWithIModel
MichaelSwigerAtBentley Jan 16, 2025
2b29b19
Remove override methods
MichaelSwigerAtBentley Jan 16, 2025
80e67e0
Remove getLocalizedStringWithNamespace
MichaelSwigerAtBentley Jan 16, 2025
c0dc76a
Remove TerrainProviderName
MichaelSwigerAtBentley Jan 16, 2025
6e2f826
Remove deprecated props
MichaelSwigerAtBentley Jan 16, 2025
1a9a2c8
Remove BackendTypes
MichaelSwigerAtBentley Jan 16, 2025
7036308
Update NextVersion
MichaelSwigerAtBentley Jan 17, 2025
582f844
Update NextVersion
MichaelSwigerAtBentley Jan 17, 2025
76974ed
BackgroundMapSettings Removal
MichaelSwigerAtBentley Jan 17, 2025
3123e2d
Merge branch 'master' of https://github.com/iTwin/itwinjs-core into m…
MichaelSwigerAtBentley Jan 17, 2025
15c7a2a
Remove RenderMaterial.Params
MichaelSwigerAtBentley Jan 17, 2025
8af7cde
Remove RenderTexture.Params
MichaelSwigerAtBentley Jan 17, 2025
a5de240
Remove getViewThumbnail
MichaelSwigerAtBentley Jan 17, 2025
c812de2
Revert "BackgroundMapSettings Removal"
MichaelSwigerAtBentley Jan 17, 2025
c7846d9
Update Barrel File
MichaelSwigerAtBentley Jan 17, 2025
c18fbba
Update override tests
MichaelSwigerAtBentley Jan 17, 2025
6df6e5c
Merge branch 'master' of https://github.com/iTwin/itwinjs-core into m…
MichaelSwigerAtBentley Jan 21, 2025
8c3ff42
Revert "Remove getViewThumbnail"
MichaelSwigerAtBentley Jan 21, 2025
89d1d50
Remove Deprecated Props from ViewStateHydrator
MichaelSwigerAtBentley Jan 21, 2025
3d1e450
Swap Backend for node:stream
MichaelSwigerAtBentley Jan 21, 2025
b689236
Revert "Remove BackendTypes"
MichaelSwigerAtBentley Jan 22, 2025
9dfb919
Swap out RenderTexture.Params
MichaelSwigerAtBentley Jan 22, 2025
f85395b
Revert "Swap Backend for node:stream"
MichaelSwigerAtBentley Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions core/common/src/BackendTypes.ts

This file was deleted.

60 changes: 3 additions & 57 deletions core/common/src/BackgroundMapSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @module DisplayStyles
*/

import { BackgroundMapProvider, BackgroundMapType } from "./BackgroundMapProvider";
import { BackgroundMapProvider } from "./BackgroundMapProvider";
import { PlanarClipMaskProps, PlanarClipMaskSettings } from "./PlanarClipMask";
import { TerrainProps, TerrainSettings } from "./TerrainSettings";

Expand Down Expand Up @@ -58,32 +58,6 @@ export interface BackgroundMapProps {
providerData?: never;
}

/** Properties of [[PersistentBackgroundMapProps]] that have been deprecated, but are retained for backwards compatibility.
* These properties are omitted from [[BackgroundMapProps]] as they are no longer part of the API, but are included in
* [[PersistentBackgroundMapProps]] because they remain part of the persistence format.
* @public
* @extensions
*/
export interface DeprecatedBackgroundMapProps {
MichaelSwigerAtBentley marked this conversation as resolved.
Show resolved Hide resolved
/** Identifies the source of the map tiles. Currently supported providers are "BingProvider" and "MapBoxProvider".
* Default value: "BingProvider"
* @deprecated in 3.x. use MapImageryProps.backgroundBase.
*/
providerName?: string;
/** Options for customizing the tiles supplied by the provider. If undefined, default values of all members are used.
* @deprecated in 3.x. use MapImageryProps.backgroundBase
*/
providerData?: {
/** The type of map graphics to request. Default value: BackgroundMapType.Hybrid. */
mapType?: BackgroundMapType;
};
}

/** Persistent JSON representation of a [[BackgroundMapSettings]].
* @public
* @extensions
*/
export type PersistentBackgroundMapProps = Omit<BackgroundMapProps, keyof DeprecatedBackgroundMapProps> & DeprecatedBackgroundMapProps;

function normalizeGlobeMode(mode?: GlobeMode): GlobeMode {
return GlobeMode.Plane === mode ? mode : GlobeMode.Ellipsoid;
Expand Down Expand Up @@ -138,7 +112,7 @@ export class BackgroundMapSettings {
/** If transparency is overridden, the transparency to apply; otherwise, undefined. */
public get transparencyOverride(): number | undefined { return false !== this.transparency ? this.transparency : undefined; }

private constructor(props: BackgroundMapProps | PersistentBackgroundMapProps) {
private constructor(props: BackgroundMapProps) {
this.groundBias = props.groundBias ?? 0;
this.transparency = normalizeTransparency(props.transparency);
this.useDepthBuffer = props.useDepthBuffer ?? false;
Expand All @@ -150,13 +124,6 @@ export class BackgroundMapSettings {
this._provider = BackgroundMapProvider.fromBackgroundMapProps(props);
}

/** Create settings from their persistent representation. In general, this method should only be used when reading the settings directly from
* the iModel - otherwise, prefer [[fromJSON]].
*/
public static fromPersistentJSON(json?: PersistentBackgroundMapProps): BackgroundMapSettings {
return new this(json ?? {});
}

/** Construct from JSON, performing validation and applying default values for undefined fields.
* @see [[fromPersistentJSON]] if you are reading the settings directly from the iModel.
*/
Expand Down Expand Up @@ -196,31 +163,12 @@ export class BackgroundMapSettings {
return props;
}

/** Convert these settings to their persistent representation. In general, this method should only be used when writing the settings directly to
* the iModel - otherwise, prefer [[toJSON]].
*/
public toPersistentJSON(): PersistentBackgroundMapProps {
const props = this.toJSON() as PersistentBackgroundMapProps;

// Preserve deprecated imagery provider properties.
if ("BingProvider" !== this._provider.name)
props.providerName = this._provider.name; // eslint-disable-line @typescript-eslint/no-deprecated
if (BackgroundMapType.Hybrid !== this._provider.type)
props.providerData = { mapType: this._provider.type }; // eslint-disable-line @typescript-eslint/no-deprecated

return props;
}

/** Returns true if these settings are equivalent to the supplied JSON settings. */
public equalsJSON(json?: BackgroundMapProps): boolean {
return this.equals(BackgroundMapSettings.fromJSON(json));
}

/** Returns true if the persistent representation of these settings is equivalent to `json`. */
public equalsPersistentJSON(json?: PersistentBackgroundMapProps): boolean {
return this.equals(BackgroundMapSettings.fromPersistentJSON(json));
}

/** Returns true if these settings are equivalent to `other`. */
public equals(other: BackgroundMapSettings): boolean {
return this.groundBias === other.groundBias && this.useDepthBuffer === other.useDepthBuffer && this.transparency === other.transparency
Expand All @@ -246,10 +194,8 @@ export class BackgroundMapSettings {
applyTerrain: changedProps.applyTerrain ?? this.applyTerrain,
terrainSettings: changedProps.terrainSettings ? this.terrainSettings.clone(changedProps.terrainSettings).toJSON() : this.terrainSettings.toJSON(),
planarClipMask: changedProps.planarClipMask ? this.planarClipMask.clone(changedProps.planarClipMask).toJSON() : this.planarClipMask.toJSON(),
providerName: this._provider.name,
providerData: { mapType: this._provider.type },
};

return BackgroundMapSettings.fromPersistentJSON(props);
return BackgroundMapSettings.fromJSON(props);
}
}
13 changes: 0 additions & 13 deletions core/common/src/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,4 @@ export class CodeSpec {
else
this.properties.scopeSpec.fGuidRequired = undefined;
}

/** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.
* @deprecated in 3.6 Use scopeReq instead.
*/
public get isManagedWithIModel(): boolean {
return this.properties.spec?.isManagedWithDgnDb ?? true;
}
public set isManagedWithIModel(value: boolean) {
if (!this.properties.spec)
this.properties.spec = {};

this.properties.spec.isManagedWithDgnDb = value;
}
}
36 changes: 0 additions & 36 deletions core/common/src/FeatureSymbology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,42 +817,6 @@ export class FeatureOverrides implements FeatureAppearanceSource {
map.set(idLo, idHi, app);
}

/** Specify overrides for all elements within the specified model.
* @param id The Id of the model.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same model.
* @note These overrides take priority over all other overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to any element within this model, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideModel(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ modelId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry belonging to the specified [SubCategory]($backend).
* @param id The Id of the subcategory.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same subcategory.
* @note These overrides have lower priority than element and model overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to any geometry within this subcategory, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideSubCategory(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ subCategoryId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry originating from the specified element.
* @param id The Id of the element.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same element.
* @note These overrides take precedence over subcategory overrides, but not over model overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to this element, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideElement(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ elementId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry originating from the specified animation node.
* @param id The Id of the animation node.
* @param app The symbology overrides.
Expand Down
9 changes: 0 additions & 9 deletions core/common/src/Localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ export interface Localization {
* @throws Error if no keys resolve to a string.
*/
getLocalizedString(key: string | string[], options?: TranslationOptions): string;
/** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.
* @param namespace - the namespace that identifies the particular localization file that contains the property.
* @param key - the key that matches a property in the JSON localization file.
* @returns The string corresponding to the first key that resolves.
* @throws Error if no keys resolve to a string.
* @deprecated in 3.x. Use `getLocalizedString` instead; providing either a key with a namespace `<namespace>:<key>` or
* including `{ ns: <namespace> }` in the options.
*/
getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TranslationOptions): string;
/** get the English string for a key. */
getEnglishString(namespace: string, key: string | string[], options?: TranslationOptions): string;
/** Replace all instances of `%{key}` within a string with the translations of those keys.
Expand Down
8 changes: 0 additions & 8 deletions core/common/src/TerrainSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@

import { BackgroundMapProps } from "./BackgroundMapSettings";

/** Identifies a [TerrainProvider]($frontend).
* @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].
* @public
* @extensions
* @deprecated in 3.x. Use string instead.
*/
export type TerrainProviderName = string;

/** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.
* These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to "CesiumWorldTerrain".
* You may alternatively use the Id of any ION asset to which you have access.
Expand Down
4 changes: 0 additions & 4 deletions core/common/src/ViewProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export interface SubCategoryResultRow {
export interface HydrateViewStateRequestProps {
acsId?: string;
notLoadedModelSelectorStateModels?: CompressedId64Set;
/** @deprecated in 3.x. If loading categoryIds is necessary, see [IModelConnection.SubCategoriesCache.load]($frontend)*/
notLoadedCategoryIds?: CompressedId64Set;
sheetViewAttachmentIds?: CompressedId64Set;
viewStateLoadProps?: ViewStateLoadProps;
baseModelId?: Id64String;
Expand All @@ -90,8 +88,6 @@ export interface HydrateViewStateResponseProps {
sheetViewViews?: (ViewStateProps | undefined)[];
baseModelProps?: ModelProps;
spatialViewProps?: ViewStateProps;
/** @deprecated in 3.x. If loading categoryIds is necessary, see [IModelConnection.SubCategoriesCache.load]($frontend)*/
categoryIdsResult?: SubCategoryResultRow[];
}

/** Returned from [IModelDb.Views.getViewStateData]($backend).
Expand Down
17 changes: 14 additions & 3 deletions docs/changehistory/NextVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Table of contents:
- [ECMAScript](#ecmascript)
- [Deprecated API removals](#deprecated-api-removals)
- [@itwin/core-backend](#itwincore-backend-1)
- [@itwin/core-common](#itwincore-common-1)
- [@itwin/appui-abstract](#itwinappui-abstract)
- [@itwin/core-electron](#itwincore-electron)
- [API removals](#api-removals)
Expand Down Expand Up @@ -109,6 +110,17 @@ The following previously-deprecated APIs have been removed:

All three `nativeDb` fields and `IModelHost.platform` have always been `@internal`. Use the `@public` APIs instead. If some functionality is missing from those APIs, [let us know](https://github.com/iTwin/itwinjs-core/issues/new?template=feature_request.md).

#### @itwin/core-common

| Removed | Replacement |
| ---------------------------------------------- | --------------------------------- |
| `CodeSpec.isManagedWithIModel` | `CodeSpec.scopeReq` |
| `FeatureOverrides.overrideModel` | `FeatureOverrides.override` |
| `FeatureOverrides.overrideSubCategory` | `FeatureOverrides.override` |
| `FeatureOverrides.overrideElement` | `FeatureOverrides.override` |
| `Localization.getLocalizedStringWithNamespace` | `Localization.getLocalizedString` |
| `TerrainProviderName` | N/A |

#### @itwin/appui-abstract

| Removed | Replacement |
Expand Down Expand Up @@ -149,7 +161,7 @@ As of iTwin.js 5.0, the following packages have been removed and are no longer a
| Removed | Replacement |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `@itwin/core-webpack-tools` | We no longer recommend using [webpack](https://webpack.js.org/) and instead recommend using [Vite](https://vite.dev/). |
| `@itwin/backend-webpack-tools` | We no longer recommend webpack-ing backends, which was previously recommended to shrink the size of backends. |
| `@itwin/backend-webpack-tools` | We no longer recommend webpack-ing backends, which was previously recommended to shrink the size of backends. |

### Change to pullMerge

Expand All @@ -163,7 +175,7 @@ Starting from version 5.x, iTwin.js has transitioned from using the merge method

The merging process in this method follows these steps:

1. Initially, each incoming change is attempted to be applied using the *fastforward* method. If successful, the process is complete.
1. Initially, each incoming change is attempted to be applied using the _fastforward_ method. If successful, the process is complete.
2. If the fast-forward method fails for any incoming change, that changeset is abandoned and the rebase method is used instead.
3. The rebase process is executed as follows:
- All local transactions are reversed.
Expand All @@ -179,4 +191,3 @@ This method offers several advantages:
4. In the future, this method will be essential for lock-less editing as it enables applications to merge changes with domain intelligence.

For more information read [Pull merge & conflict resolution](../learning/backend/PullMerge.md)