Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async _initialize() {
if (this.options.loginDialog) {
try {
const loginOpt = await this._showLoginDialog(this.options.auth);
this.options.auth = loginOpt;
} catch (er) {
// ignore
}
}
this.connector = new NgwConnector(this.options);
this.isLoaded = true;
this.emitter.emit('load');
}
export function prepareWebMapOptions(
mapAdapter: MapAdapter,
options: NgwMapOptions
) {
const kits: StarterKit[] = [new QmsKit()];
if (!options.connector && options.baseUrl) {
options.connector = new NgwConnector({
baseUrl: options.baseUrl,
auth: options.auth
});
} else if (options.connector) {
options.baseUrl = options.connector.options.baseUrl;
}
const opt: NgwMapOptions = deepmerge(OPTIONS, options);
if (opt.connector) {
kits.push(
new NgwKit({
connector: opt.connector,
auth: opt.auth,
identification: opt.identification
})
);
}
typeof value === 'number'
? [value]
: value.split(',').map((x: string) => Number(x));
if (options.filterById[1] !== 'eq' && options.filterById[1] !== 'in') {
throw new Error(
'Unable to filter by object id. Except `eq` or `in` operator'
);
}
const promises: Promise[] = featureIds.map(featureId => {
return getNgwLayerItem({
connector: options.connector,
resourceId: options.resourceId,
featureId
});
});
return CancelablePromise.all(promises);
}
constructor(public options: NgwKitOptions) {
if (this.options.connector) {
this.url = this.options.connector.options.baseUrl;
this.connector = this.options.connector;
} else {
if (this.options.baseUrl) {
this.url = this.options.baseUrl;
} else {
throw new Error('url is not defined');
}
this.connector = new NgwConnector({
baseUrl: this.url,
auth: this.options.auth
});
}
}