/** @packageDocumentation * @module iModelHubClient */ import { GuidString } from "@bentley/bentleyjs-core"; import { AuthorizedClientRequestContext } from "../AuthorizedClientRequestContext"; import { FileHandler } from "../FileHandler"; import { ProgressInfo } from "../Request"; import { WsgInstance } from "./../ECJsonTypeMap"; import { IModelBaseHandler } from "./BaseHandler"; import { StringIdQuery } from "./HubQuery"; /** * Specifies types of changes in a [[ChangeSet]]. * @beta */ 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]($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. * @beta */ 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). */ 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. */ isUploaded?: boolean; /** URL from where the ChangeSet file can be downloaded. See [[ChangeSetQuery.selectDownloadUrl]]. */ downloadUrl?: string; /** URL where the ChangeSet file has to be uploaded. */ 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; } /** * Query object for getting [[ChangeSet]]s. You can use this to modify the query. See [[ChangeSetHandler.get]]. * @beta */ 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(); /** * 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 [IModelDb]($backend) methods instead. * @beta */ 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]] 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; /** * Download the specified [[ChangeSet]]s. 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 [IModelDb.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 changeSets ChangeSets to download. These need to include a download link. See [[ChangeSetQuery.selectDownloadUrl]]. * @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]] if the download fails. */ download(requestContext: AuthorizedClientRequestContext, changeSets: ChangeSet[], path: string, progressCallback?: (progress: ProgressInfo) => void): Promise; /** * Upload a [[ChangeSet]] file. If you want to [push]($docs/learning/Glossary.md#push) your changes to iModelHub, use [IModelDb.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. See [IModelDb.setGuid]($backend). * @throws [Common iModelHub errors]($docs/learning/iModelHub/CommonErrors) */ create(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, changeSet: ChangeSet, path: string, progressCallback?: (progress: ProgressInfo) => void): Promise; } //# sourceMappingURL=ChangeSets.d.ts.map