@microsoft/mgt-element
Advanced tools
Comparing version 2.2.0-preview.0245c76 to 2.2.0-preview.05dad46
@@ -17,2 +17,4 @@ /** | ||
* @extends {MgtBaseComponent} | ||
* | ||
* @fires templateRendered - fires when a template is rendered | ||
*/ | ||
@@ -19,0 +21,0 @@ export declare abstract class MgtTemplatedComponent extends MgtBaseComponent { |
@@ -18,2 +18,4 @@ /** | ||
* @extends {MgtBaseComponent} | ||
* | ||
* @fires templateRendered - fires when a template is rendered | ||
*/ | ||
@@ -20,0 +22,0 @@ export class MgtTemplatedComponent extends MgtBaseComponent { |
@@ -124,3 +124,3 @@ /** | ||
new TelemetryHandler(), | ||
new SdkVersionMiddleware(PACKAGE_VERSION), | ||
new SdkVersionMiddleware(PACKAGE_VERSION, provider.name), | ||
new HTTPMessageHandler() | ||
@@ -127,0 +127,0 @@ ]; |
@@ -46,3 +46,10 @@ /** | ||
getAccessToken(): Promise<string>; | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name(): string; | ||
} | ||
//# sourceMappingURL=MockProvider.d.ts.map |
@@ -76,3 +76,12 @@ /** | ||
} | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name() { | ||
return 'MgtMockProvider'; | ||
} | ||
} | ||
//# sourceMappingURL=MockProvider.js.map |
@@ -37,2 +37,9 @@ /** | ||
get state(): ProviderState; | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name(): string; | ||
constructor(); | ||
@@ -75,3 +82,3 @@ /** | ||
/** | ||
* uses scopes to recieve access token | ||
* uses scopes to receive access token | ||
* | ||
@@ -78,0 +85,0 @@ * @param {...string[]} scopes |
@@ -32,2 +32,11 @@ /** | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name() { | ||
return 'MgtIProvider'; | ||
} | ||
/** | ||
* sets state of Provider and fires loginchangedDispatcher | ||
@@ -63,3 +72,3 @@ * | ||
/** | ||
* uses scopes to recieve access token | ||
* uses scopes to receive access token | ||
* | ||
@@ -66,0 +75,0 @@ * @param {...string[]} scopes |
@@ -20,2 +20,9 @@ /** | ||
private _logoutHandler; | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name(): string; | ||
constructor(getAccessTokenHandler: (scopes: string[]) => Promise<string>, loginHandler?: () => Promise<void>, logoutHandler?: () => Promise<void>); | ||
@@ -22,0 +29,0 @@ /** |
@@ -25,2 +25,11 @@ /** | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
get name() { | ||
return 'MgtSimpleProvider'; | ||
} | ||
/** | ||
* Invokes the getAccessToken function | ||
@@ -27,0 +36,0 @@ * |
@@ -130,2 +130,5 @@ /** | ||
} | ||
else if (r.headers['Content-Type'].includes('image/pjpeg')) { | ||
response.content = 'data:image/pjpeg;base64,' + r.body; | ||
} | ||
else { | ||
@@ -132,0 +135,0 @@ response.content = r.body; |
@@ -143,3 +143,8 @@ /** | ||
} | ||
return (yield this.getDb()).get(this.store, key); | ||
try { | ||
return (yield this.getDb()).get(this.store, key); | ||
} | ||
catch (e) { | ||
return null; | ||
} | ||
}); | ||
@@ -160,3 +165,8 @@ } | ||
} | ||
yield (yield this.getDb()).put(this.store, Object.assign(Object.assign({}, item), { timeCached: Date.now() }), key); | ||
try { | ||
yield (yield this.getDb()).put(this.store, Object.assign(Object.assign({}, item), { timeCached: Date.now() }), key); | ||
} | ||
catch (e) { | ||
return; | ||
} | ||
}); | ||
@@ -175,3 +185,8 @@ } | ||
} | ||
(yield this.getDb()).clear(this.store); | ||
try { | ||
(yield this.getDb()).clear(this.store); | ||
} | ||
catch (e) { | ||
return; | ||
} | ||
}); | ||
@@ -178,0 +193,0 @@ } |
@@ -80,6 +80,3 @@ /** | ||
const nextResource = this._nextLink.split(this._version)[1]; | ||
const response = yield this._graph | ||
.api(nextResource) | ||
.version(this._version) | ||
.get(); | ||
const response = yield this._graph.api(nextResource).version(this._version).get(); | ||
if (response && response.value && response.value.length) { | ||
@@ -86,0 +83,0 @@ this._value = this._value.concat(response.value); |
@@ -22,3 +22,4 @@ /** | ||
private _packageVersion; | ||
constructor(packageVersion: string); | ||
private _providerName; | ||
constructor(packageVersion: string, providerName?: string); | ||
execute(context: Context): Promise<void>; | ||
@@ -25,0 +26,0 @@ /** |
@@ -26,4 +26,5 @@ /** | ||
export class SdkVersionMiddleware { | ||
constructor(packageVersion) { | ||
constructor(packageVersion, providerName) { | ||
this._packageVersion = packageVersion; | ||
this._providerName = providerName; | ||
} | ||
@@ -41,2 +42,6 @@ // tslint:disable-next-line: completed-docs | ||
} | ||
if (this._providerName) { | ||
const providerVersion = `${this._providerName}/${this._packageVersion}`; | ||
headerParts.push(providerVersion); | ||
} | ||
// Package version | ||
@@ -43,0 +48,0 @@ const packageVersion = `mgt/${this._packageVersion}`; |
{ | ||
"name": "@microsoft/mgt-element", | ||
"version": "2.2.0-preview.0245c76", | ||
"version": "2.2.0-preview.05dad46", | ||
"description": "Microsoft Graph Toolkit base classes", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/microsoftgraph/microsoft-graph-toolkit", |
@@ -38,2 +38,4 @@ /** | ||
* @extends {MgtBaseComponent} | ||
* | ||
* @fires templateRendered - fires when a template is rendered | ||
*/ | ||
@@ -40,0 +42,0 @@ export abstract class MgtTemplatedComponent extends MgtBaseComponent { |
@@ -154,3 +154,3 @@ /** | ||
new TelemetryHandler(), | ||
new SdkVersionMiddleware(PACKAGE_VERSION), | ||
new SdkVersionMiddleware(PACKAGE_VERSION, provider.name), | ||
new HTTPMessageHandler() | ||
@@ -157,0 +157,0 @@ ]; |
@@ -48,2 +48,3 @@ /** | ||
} | ||
/** | ||
@@ -60,2 +61,3 @@ * sets Provider state to signed out | ||
} | ||
/** | ||
@@ -70,2 +72,12 @@ * Promise returning token from graph.microsoft.com | ||
} | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
public get name() { | ||
return 'MgtMockProvider'; | ||
} | ||
} |
@@ -42,2 +42,12 @@ /** | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
public get name() { | ||
return 'MgtIProvider'; | ||
} | ||
constructor() { | ||
@@ -96,3 +106,3 @@ this._state = ProviderState.Loading; | ||
/** | ||
* uses scopes to recieve access token | ||
* uses scopes to receive access token | ||
* | ||
@@ -99,0 +109,0 @@ * @param {...string[]} scopes |
@@ -106,5 +106,3 @@ /** | ||
private static _eventDispatcher: EventDispatcher<ProvidersChangedState> = new EventDispatcher< | ||
ProvidersChangedState | ||
>(); | ||
private static _eventDispatcher: EventDispatcher<ProvidersChangedState> = new EventDispatcher<ProvidersChangedState>(); | ||
@@ -111,0 +109,0 @@ private static _globalProvider: IProvider; |
@@ -24,2 +24,12 @@ /** | ||
/** | ||
* Name used for analytics | ||
* | ||
* @readonly | ||
* @memberof IProvider | ||
*/ | ||
public get name() { | ||
return 'MgtSimpleProvider'; | ||
} | ||
constructor( | ||
@@ -26,0 +36,0 @@ getAccessTokenHandler: (scopes: string[]) => Promise<string>, |
@@ -190,2 +190,4 @@ /** | ||
response.content = 'data:image/jpeg;base64,' + r.body; | ||
} else if (r.headers['Content-Type'].includes('image/pjpeg')) { | ||
response.content = 'data:image/pjpeg;base64,' + r.body; | ||
} else { | ||
@@ -192,0 +194,0 @@ response.content = r.body; |
@@ -285,4 +285,7 @@ /** | ||
} | ||
return (await this.getDb()).get(this.store, key); | ||
try { | ||
return (await this.getDb()).get(this.store, key); | ||
} catch (e) { | ||
return null; | ||
} | ||
} | ||
@@ -302,4 +305,7 @@ | ||
} | ||
await (await this.getDb()).put(this.store, { ...item, timeCached: Date.now() }, key); | ||
try { | ||
await (await this.getDb()).put(this.store, { ...item, timeCached: Date.now() }, key); | ||
} catch (e) { | ||
return; | ||
} | ||
} | ||
@@ -317,4 +323,7 @@ | ||
} | ||
(await this.getDb()).clear(this.store); | ||
try { | ||
(await this.getDb()).clear(this.store); | ||
} catch (e) { | ||
return; | ||
} | ||
} | ||
@@ -321,0 +330,0 @@ |
@@ -81,6 +81,3 @@ /** | ||
const nextResource = this._nextLink.split(this._version)[1]; | ||
const response = await this._graph | ||
.api(nextResource) | ||
.version(this._version) | ||
.get(); | ||
const response = await this._graph.api(nextResource).version(this._version).get(); | ||
if (response && response.value && response.value.length) { | ||
@@ -87,0 +84,0 @@ this._value = this._value.concat(response.value); |
@@ -26,5 +26,7 @@ /** | ||
private _packageVersion: string; | ||
private _providerName: string; | ||
constructor(packageVersion: string) { | ||
constructor(packageVersion: string, providerName?: string) { | ||
this._packageVersion = packageVersion; | ||
this._providerName = providerName; | ||
} | ||
@@ -47,2 +49,7 @@ | ||
if (this._providerName) { | ||
const providerVersion: string = `${this._providerName}/${this._packageVersion}`; | ||
headerParts.push(providerVersion); | ||
} | ||
// Package version | ||
@@ -49,0 +56,0 @@ const packageVersion: string = `mgt/${this._packageVersion}`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1011616
7017
16815