/** @packageDocumentation * @module iModelHubClient */ import { GuidString } from "@bentley/bentleyjs-core"; import { AuthorizedClientRequestContext, FileHandler, ProgressCallback, WsgInstance } from "@bentley/itwin-client"; import { IModelBaseHandler } from "./BaseHandler"; import { StringIdQuery } from "./HubQuery"; /** * Specifies types of changes in a [[ChangeSet]]. * @public */ export declare enum ChangesType { /** [[ChangeSet]] contains regular file changes (e.g. changes to elements or models). */ Regular = 0, /** [[ChangeSet]] only contains schema changes. */ Schema = 1, /** [[ChangeSet]] contains definition changes. */ Definition = 2, /** [[ChangeSet]] contains spatial data changes. */ SpatialData = 4, /** [[ChangeSet]] contains sheets and drawings changes. */ SheetsAndDrawings = 8, /** [[ChangeSet]] contains views and model changes. */ ViewsAndModels = 16, /** [[ChangeSet]] contains changes of global properties. */ GlobalProperties = 32 } /** * [ChangeSet]($docs/learning/Glossary.md#changeset) represents a file containing changes to the iModel. A single ChangeSet contains changes made on a single [[Briefcase]] file and pushed as a single file. ChangeSets form a linear change history of the iModel. If a user wants to push their changes to iModelHub, they first have to merge all ChangeSet they do not have yet. Only a single briefcase is allowed to push their changes at a time. * @public */ export declare class ChangeSet extends WsgInstance { /** Id of this ChangeSet. It has to be set during the push. It's a hash value based on the contents of ChangeSet file and its parentId. */ id?: string; /** Filename of the ChangeSet. It has to be set during the push. */ fileName?: string; /** Description of this ChangeSet. */ description?: string; /** Size of this ChangeSet file. It has to be set during the push. */ fileSize?: string; /** Index of this ChangeSet (increasing, but not necessarily sequential). */ index?: string; /** Id of this ChangeSet's parent ChangeSet. It has to be set during the push. */ parentId?: string; /** * Id of the file that this ChangeSet belongs to. It has to be set during the push. See [IModelDb.getGuid]($backend). * @internal @deprecated */ seedFileId?: GuidString; /** Id of the [[Briefcase]] that pushed this ChangeSet. It has to be set during the push. */ briefcaseId?: number; /** Id of the user that pushed this ChangeSet. */ userCreated?: string; /** Date when this ChangeSet was pushed to iModelHub. */ pushDate?: string; /** Shows what kind of changes are contained in this ChangeSet. */ changesType?: ChangesType; /** * Flag that needs to be marked true, when confirming successful ChangeSet upload. * @internal */ isUploaded?: boolean; /** * URL from where the ChangeSet file can be downloaded. See [[ChangeSetQuery.selectDownloadUrl]]. * @internal */ downloadUrl?: string; /** * URL where the ChangeSet file has to be uploaded. * @internal */ uploadUrl?: string; /** Id of the application that created this ChangeSet. */ applicationId?: string; /** Name of the application that created this ChangeSet. */ applicationName?: string; /** Id of the bridge that created this ChangeSet. */ bridgeJobId?: string; /** User identifiers of users who made changes contained in this ChangeSet. */ bridgeUsers?: string[]; /** File names which have been modified with this ChangeSet. */ bridgeChangedFiles?: string[]; /** Path to the download ChangeSet file on disk. */ pathname?: string; private _fileSizeNumber?; /** Parsed number of this ChangeSet file size. */ get fileSizeNumber(): number; } /** * Query object for getting [[ChangeSet]]s. You can use this to modify the query. See [[ChangeSetHandler.get]]. * @public */ export declare class ChangeSetQuery extends StringIdQuery { /** * Default page size which is used when querying ChangeSets * @internal */ static defaultPageSize: number; /** Constructor that sets default page size. */ constructor(); /** * Clone current query. * @returns Cloned query. */ clone(): ChangeSetQuery; /** * Query will additionally select [[ChangeSet]] file download URL. This is needed to use the ChangeSet object with [[ChangeSetHandler.download]]. * @returns This query. */ selectDownloadUrl(): this; /** * Query will additionally select data about application that created this [[ChangeSet]]. * @returns This query. */ selectApplicationData(): this; /** @internal */ protected checkValue(id: string): void; /** * Query [[ChangeSet]]s that are after the specified ChangeSet. This overrides any previously applied ChangeSetQuery filters. Query will return all of the ChangeSets that are newer than the one specified by id. ChangeSet specified by the id will not be included in the results. Returned ChangeSets will be in an ascending order. * @param id Id of a ChangeSet. * @returns This query. */ fromId(id: string): this; /** * Change the order of results to be from newest [[ChangeSet]]s to the oldest ones. * @returns This query. */ latest(): this; /** * Query [[ChangeSet]]s between two specified ChangeSets. This overrides any previously applied ChangeSetQuery filters. This query will work when either of the ChangeSet ids points to an earlier ChangeSet. Latest ChangeSet specified by this range will be included in the results, but the earliest will be excluded. If the second ChangeSet id is not specified, it's assumed that it's the same as an empty id, and query will return all ChangeSets from the start up to the ChangeSet with the first id. Returned ChangeSets will be in an ascending order. * @param firstChangeSetId Id of the first changeSet. * @param secondChangeSetId Id of the second changeSet. * @returns This query. */ betweenChangeSets(firstChangeSetId: string, secondChangeSetId?: string): this; /** * Query [[ChangeSet]]s included in the specified [[Version]]. This overrides any previously applied ChangeSetQuery filters. Query will return all of the ChangeSets from the start up to the one specified by versionId. ChangeSet specified by versionId will be included in the results. Returned ChangeSets will be in an ascending order. * @param versionId Id of the version. * @returns This query. */ getVersionChangeSets(versionId: GuidString): this; /** * Query [[ChangeSet]]s after the specified [[Version]]. This overrides any previously applied ChangeSetQuery filters. Query will return all of the ChangeSets that are newer than the one specified by versionId. ChangeSet specified by versionId will not be included in the results. Returned ChangeSets will be in an ascending order. * @param versionId Id of the version. * @returns This query. */ afterVersion(versionId: GuidString): this; /** * Query [[ChangeSet]]s between two specified [[Version]]s. This overrides any previously applied ChangeSetQuery filters. This query will work when either of the Version ids points to an earlier ChangeSet. Latest ChangeSet specified by this range will be included in the results, but the earliest will be excluded. Returned ChangeSets will be in an ascending order. * @param sourceVersionId Id of the source version. * @param destinationVersionId Id of the destination version. * @returns This query. */ betweenVersions(sourceVersionId: GuidString, destinationVersionId: GuidString): this; /** * Query [[ChangeSet]]s between the specified [[Version]] and another [[ChangeSet]]. This overrides any previously applied ChangeSetQuery filters. This query will work when either versionId or changeSetId points to an earlier ChangeSet. Latest ChangeSet specified by this range will be included in the results, but the earliest will be excluded. Returned ChangeSets will be in an ascending order. * @param versionId Id of the version. * @param changeSetId Id of the changeSet. * @returns This query. */ betweenVersionAndChangeSet(versionId: GuidString, changeSetId: string): this; /** * Query changeSets by the seed file id. Should be obsolete, because seed file replacement is deprecated. * @param seedFileId Id of the seed file. * @returns This query. * @internal */ bySeedFileId(seedFileId: GuidString): this; /** Select all bridge properties. */ selectBridgeProperties(): this; } /** * Handler for managing [[ChangeSet]]s. Use [[IModelClient.ChangeSets]] to get an instance of this class. In most cases, you should use [BriefcaseDb]($backend) methods instead. * @public */ export declare class ChangeSetHandler { private _handler; private _fileHandler?; /** * Constructor for ChangeSetHandler. Should use [[IModelClient]] instead of directly constructing this. * @param handler Handler for WSG requests. * @param fileHandler Handler for file system. * @internal */ constructor(handler: IModelBaseHandler, fileHandler?: FileHandler); /** Get relative url for ChangeSet requests. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param changeSetId Id of the ChangeSet. * @internal */ private getRelativeUrl; /** Get the [[ChangeSet]]s for the iModel. * @param requestContext The client request context * @param iModelId Id of the iModel. See [[HubIModel]]. * @param query Optional query object to filter the queried ChangeSets or select different data from them. * @returns ChangeSets that match the query. * @throws [WsgError]($itwin-client) with [WSStatus.InstanceNotFound]($bentley) if [[InstanceIdQuery.byId]] is used and a [[ChangeSet]] with the specified id could not be found. * @throws [Common iModelHub errors]($docs/learning/iModelHub/CommonErrors) */ get(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, query?: ChangeSetQuery): Promise; /** Get the chunk of [[ChangeSet]]s for the iModel. * @param requestContext The client request context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param url [[ChangeSet]]s query url. * @param chunkedQueryContext [[ChangeSet]]s chunked query context. * @param queryOptions Request query options. * @returns [[ChangeSet]]s chunk that match the query. * @throws [[WsgError]] with [WSStatus.InstanceNotFound]($bentley) if [[InstanceIdQuery.byId]] is used and a [[ChangeSet]] with the specified id could not be found. * @throws [Common iModelHub errors]($docs/learning/iModelHub/CommonErrors) */ private getChunk; /** * Download the [[ChangeSet]]s that match provided query. If you want to [pull]($docs/learning/Glossary.md#pull) and [merge]($docs/learning/Glossary.md#merge) ChangeSets from iModelHub to your [[Briefcase]], you should use [BriefcaseDb.pullAndMergeChanges]($backend) instead. * * This method creates the directory containing the ChangeSets if necessary. If there is an error in downloading some of the ChangeSets, all partially downloaded ChangeSets are deleted from disk. * @param requestContext The client request context * @param iModelId Id of the iModel. See [[HubIModel]]. * @param query Query that defines ChangeSets to download. * @param path Path of directory where the ChangeSets should be downloaded. * @throws [[IModelHubClientError]] with [IModelHubStatus.UndefinedArgumentError]($bentley), if one of the required arguments is undefined or empty. * @param progressCallback Callback for tracking progress. * @throws [ResponseError]($itwin-client) if the download fails. * @internal */ download(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, query: ChangeSetQuery, path: string, progressCallback?: ProgressCallback): Promise; /** Download the chunk of [[ChangeSet]]s for the iModel. * @param requestContext The client request context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param changeSets [[ChangeSet]]s chunk to download. * @param path Path of directory where the ChangeSets should be downloaded. * @param downloadProgress Object that tracks [[ChangeSet]]s download progress. * @param progressCallback Callback for tracking progress. * @throws [ResponseError]($itwin-client) if the download fails. */ private downloadChunk; /** Download single [[ChangeSet]] with retry if SAS url expired or download failed. * @param requestContext The client request context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param changeSet [[ChangeSet]] to download. * @param downloadPath Path where the ChangeSet should be downloaded. * @param changeSetProgress Callback for tracking progress. * @throws [ResponseError]($itwin-client) if the download fails. */ private downloadChangeSetWithRetry; /** Download single [[ChangeSet]]. * @param requestContext The client request context. * @param changeSet [[ChangeSet]] to download. * @param downloadPath Path where the ChangeSet should be downloaded. * @param changeSetProgress Callback for tracking progress. * @throws [ResponseError]($itwin-client) if the download fails. */ private downloadChangeSet; /** Checks if ChangeSet file was already downloaded. * @param path Path of file where the ChangeSet should be downloaded. * @param expectedFileSize Size of the file that's being downloaded. * @param changeSet ChangeSet that's being downloaded. */ private wasChangeSetDownloaded; /** * Upload a [[ChangeSet]] file. If you want to [push]($docs/learning/Glossary.md#push) your changes to iModelHub, use [BriefcaseDb.pushChanges]($backend) instead. This method is only a part of that workflow. * * ChangeSets have to be uploaded in a linear order. If another user is uploading, or changeSet.parentId does not point to the latest ChangeSet on iModelHub, this method will fail. User will have to download all of the newer ChangeSets, merge them into their [[Briefcase]] and calculate a new ChangeSet id. * @param requestContext The client request context * @param iModelId Id of the iModel. See [[HubIModel]]. * @param changeSet Information of the ChangeSet to be uploaded. * @param path Path of the ChangeSet file to be uploaded. * @param progressCallback Callback for tracking upload progress. * @throws [IModelHubStatus.BriefcaseDoesNotBelongToUser]($bentley) if Briefcase specified by changeSet.briefcaseId belongs to another user. * @throws [IModelHubStatus.AnotherUserPushing]($bentley) if another user is currently uploading a ChangeSet. * @throws [IModelHubStatus.PullIsRequired]($bentley) if there are newer ChangeSets on iModelHub, that need to be downloaded and merged, before upload is possible. * @throws [IModelHubStatus.ChangeSetAlreadyExists]($bentley) if a ChangeSet with this id already exists. This usually happens if previous upload attempt has succeeded. * @throws [IModelHubStatus.ChangeSetPointsToBadSeed]($bentley) if changeSet.seedFileId is not set to the correct file id. That file id should match to the value written to the Briefcase file. * @throws [Common iModelHub errors]($docs/learning/iModelHub/CommonErrors) * @internal */ create(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, changeSet: ChangeSet, path: string, progressCallback?: ProgressCallback): Promise; } //# sourceMappingURL=ChangeSets.d.ts.map