@itwin/core-frontend
Version:
iTwin.js frontend components
71 lines • 3.53 kB
TypeScript
/** @packageDocumentation
* @module IModelConnection
*/
import { CatalogIModel } from "@itwin/core-common";
import { BriefcaseConnection } from "./BriefcaseConnection";
/**
* A read-only connection to a [CatalogDb]($backend).
* @note CatalogConnection may only be used in [[NativeApp]]s
* @see [[CatalogConnection.openReadonly]] to instantiate this type.
* @beta
*/
export interface CatalogConnection extends BriefcaseConnection {
getCatalogInfo(): Promise<{
manifest?: CatalogIModel.Manifest;
version: string;
}>;
isEditable(): this is EditableCatalogConnection;
}
/** A writable connection to an [EditableCatalogDb]($backend).
* @see [[CatalogConnection.openEditable]] to instantiate this type.
* @beta
*/
export interface EditableCatalogConnection extends CatalogConnection {
updateManifest(manifest: CatalogIModel.Manifest): Promise<void>;
}
/** @beta */
export declare namespace CatalogConnection {
/** Create a new [BlobContainer]($backend) to hold versions of a [CatalogIModel]($common).
* @returns The properties of the newly created container.
* @note creating new containers requires "admin" authorization.
*/
function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps>;
/** Acquire the write lock for a CatalogIModel container. Only one person may obtain the write lock at a time.
* @note this requires "write" authorization to the container
*/
function acquireWriteLock(args: {
/** The id of the container */
containerId: string;
/**
* The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.
* It is also stored in the "lastEditedBy" field of the manifest of any new version edited while the lock is held.
*/
username: string;
}): Promise<void>;
/** Release the write lock on a CatalogIModel container. This uploads all changes made while the lock is held, so they become visible to other users. */
function releaseWriteLock(args: {
containerId: string;
abandon?: true;
}): Promise<void>;
/**
* Create a new version of a CatalogIModel as a copy of an existing version. Immediately after this operation, the new version will be an exact copy
* of the source CatalogIModel. Then, use [[openEditable]] to modify the new version with new content.
* @note the write lock must be held for this operation to succeed
* @see [[acquireWriteLock]]
*/
function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{
oldDb: CatalogIModel.NameAndVersion;
newDb: CatalogIModel.NameAndVersion;
}>;
/** Open a CatalogIModel for read access.
* @returns the [[CatalogConnection]] to access the contents of the Catalog.
* @note CatalogConnection extends BriefcaseConnection. When finished reading, call `close` on the connection.
*/
function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogConnection>;
/** Open a CatalogIModel for write access.
* @note Once a version of a CatalogIModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.
* @note the write lock must be held for this operation to succeed
*/
function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogConnection>;
}
//# sourceMappingURL=CatalogConnection.d.ts.map