Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static async importSchema(requestContext: ClientRequestContext | AuthorizedClientRequestContext, iModelDb: IModelDb): Promise {
requestContext.enter();
if (iModelDb.containsClass(_schemaNames.Class.Robot))
return Promise.resolve();
if (iModelDb.isReadonly)
throw new IModelError(IModelStatus.ReadOnly, "importSchema failed because IModelDb is read-only");
// Must import the schema. The schema must be installed alongside the app in its
// assets directory. Note that, for portability, make sure the case of
// the filename is correct!
await iModelDb.importSchema(requestContext, path.join(IModelHost.appAssetsDir!, "RobotWorld.ecschema.xml"));
requestContext.enter();
// This is the right time to create definitions, such as Categories, that will
// be used with the classes in this schema.
RobotWorld.bootStrapDefinitions(iModelDb);
return Promise.resolve();
}
// __PUBLISH_EXTRACT_END__
private getAssetsDir(): string {
if (IModelHost.appAssetsDir)
return IModelHost.appAssetsDir;
return "assets";
}
private getAssetsDir(): string {
if (IModelHost.appAssetsDir)
return IModelHost.appAssetsDir;
return "assets";
}