New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/mgt-element

Package Overview
Dependencies
Maintainers
2
Versions
835
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/mgt-element - npm Package Compare versions

Comparing version 3.1.3-next.mgt-chat.a11fc65 to 3.1.3-preview.00b168b

4

dist/es6/Graph.d.ts

@@ -55,3 +55,3 @@ /**

*/
forComponent(component: Element | string, version?: string): Graph;
forComponent(component: Element | string): Graph;
/**

@@ -89,3 +89,3 @@ * Returns a new graph request for a specific component

*/
export declare const createFromProvider: (provider: IProvider, version?: string, component?: Element | string) => Graph;
export declare const createFromProvider: (provider: IProvider, version?: string, component?: Element) => Graph;
//# sourceMappingURL=Graph.d.ts.map

@@ -69,4 +69,4 @@ /**

*/
forComponent(component, version) {
const graph = new Graph(this._client, version || this._version);
forComponent(component) {
const graph = new Graph(this._client, this._version);
graph.setComponent(component);

@@ -73,0 +73,0 @@ return graph;

@@ -45,3 +45,3 @@ /**

*/
forComponent(component: Element | string, version?: string): IGraph;
forComponent(component: Element): IGraph;
/**

@@ -48,0 +48,0 @@ * use this method to make calls directly to the Graph.

@@ -18,4 +18,7 @@ /**

export * from './providers/SimpleProvider';
export * from './utils/CacheItem';
export * from './utils/CacheSchema';
export * from './utils/CacheService';
export * from './utils/CacheStore';
export * from './utils/dbListKey';
export * from './utils/EventDispatcher';

@@ -33,3 +36,2 @@ export * from './utils/equals';

export * from './utils/CustomElement';
export * from './utils/Logging';
export * from './utils/registerComponent';

@@ -36,0 +38,0 @@ export { PACKAGE_VERSION } from './utils/version';

@@ -18,4 +18,7 @@ /**

export * from './providers/SimpleProvider';
export * from './utils/CacheItem';
export * from './utils/CacheSchema';
export * from './utils/CacheService';
export * from './utils/CacheStore';
export * from './utils/dbListKey';
export * from './utils/EventDispatcher';

@@ -33,3 +36,2 @@ export * from './utils/equals';

export * from './utils/CustomElement';
export * from './utils/Logging';
export * from './utils/registerComponent';

@@ -36,0 +38,0 @@ export { PACKAGE_VERSION } from './utils/version';

@@ -34,4 +34,4 @@ /**

*/
forComponent(component: MgtBaseComponent | string): MockGraph;
forComponent(component: MgtBaseComponent): MockGraph;
}
//# sourceMappingURL=MockGraph.d.ts.map

@@ -211,3 +211,2 @@ /**

export interface ActiveAccountChanged {
detail: IProviderAccount;
}

@@ -221,3 +220,2 @@ /**

export interface LoginChangedEvent {
detail: ProviderState;
}

@@ -224,0 +222,0 @@ /**

@@ -139,3 +139,3 @@ /**

this._state = state;
this._loginChangedDispatcher.fire({ detail: this._state });
this._loginChangedDispatcher.fire({});
}

@@ -169,3 +169,3 @@ }

setActiveAccount(user) {
this.fireActiveAccountChanged({ detail: user });
this.fireActiveAccountChanged();
}

@@ -195,4 +195,4 @@ /**

*/
fireActiveAccountChanged(account) {
this._activeAccountChangedDispatcher.fire(account);
fireActiveAccountChanged() {
this._activeAccountChangedDispatcher.fire({});
}

@@ -199,0 +199,0 @@ /**

@@ -8,10 +8,5 @@ /**

import { CacheStore } from './CacheStore';
import { CacheSchema } from './CacheSchema';
import { CacheItem } from './CacheItem';
/**
* Localstorage key for storing names of cache databases
*
* @type {string}
*
*/
export declare const dbListKey = "mgt-db-list";
/**
* Holds the cache options for cache store

@@ -93,9 +88,2 @@ *

fileLists: CacheOptions;
/**
* Cache options for conversation store
*
* @type {CacheOptions}
* @memberof CacheConfig
*/
conversation: CacheOptions;
}

@@ -172,56 +160,2 @@ /**

}
export interface Index {
name: string;
field: string;
}
/**
* Represents organization for a cache
*
* @export
* @interface CacheSchema
*/
export interface CacheSchema {
/**
* version number of cache, useful for upgrading
*
* @type {number}
* @memberof CacheSchema
*/
version: number;
/**
* name of the cache
*
* @type {string}
* @memberof CacheSchema
*/
name: string;
/**
* list of stores in the cache
*
* @type {{ [name: string]: CacheSchemaStore }}
* @memberof CacheSchema
*/
stores: Record<string, string>;
/**
* Optional field to define indexed fields on a per store basis
* K is the name of the store for which the indexes should be applied
* T is the names of the fields on the stored data to be indexed
*/
indexes?: Record<string, Index[]>;
}
/**
* item that is stored in cache
*
* @export
* @interface CacheItem
*/
export interface CacheItem {
/**
* date and time that item was retrieved from api/stored in cache
*
* @type {number}
* @memberof CacheItem
*/
timeCached?: number;
}
//# sourceMappingURL=CacheService.d.ts.map

@@ -19,11 +19,4 @@ /**

import { CacheStore } from './CacheStore';
import { error } from './Logging';
import { dbListKey } from './dbListKey';
/**
* Localstorage key for storing names of cache databases
*
* @type {string}
*
*/
export const dbListKey = 'mgt-db-list';
/**
* class in charge of managing all the caches and their stores

@@ -73,3 +66,3 @@ *

delReq.onerror = () => {
error(`${delReq.error.name} occurred deleting cache: ${x}`, delReq.error.message);
console.error(`🦒: ${delReq.error.name} occurred deleting cache: ${x}`, delReq.error.message);
reject();

@@ -165,8 +158,4 @@ };

isEnabled: true
},
conversation: {
invalidationPeriod: 5 * 24 * 60 * 60 * 1000,
isEnabled: true
}
};
//# sourceMappingURL=CacheService.js.map

@@ -7,3 +7,4 @@ /**

*/
import { CacheItem, CacheSchema } from './CacheService';
import { CacheItem } from './CacheItem';
import { CacheSchema } from './CacheSchema';
/**

@@ -26,12 +27,4 @@ * Represents a store in the cache

*/
getValue(key: string): Promise<T | null>;
getValue(key: string): Promise<T>;
/**
* removes a value from the cache for the given key
*
* @param {string} key
* @returns {Promise<void>}
* @memberof Cache
*/
delete(key: string): Promise<void>;
/**
* inserts value into cache for the given key

@@ -57,4 +50,3 @@ *

private getDb;
queryDb(indexName: string, query: IDBKeyRange | IDBValidKey): Promise<T[]>;
}
//# sourceMappingURL=CacheStore.d.ts.map

@@ -18,3 +18,3 @@ /**

import { Providers } from '../providers/Providers';
import { dbListKey } from './CacheService';
import { dbListKey } from './dbListKey';
/**

@@ -56,23 +56,2 @@ * Represents a store in the cache

/**
* removes a value from the cache for the given key
*
* @param {string} key
* @returns {Promise<void>}
* @memberof Cache
*/
delete(key) {
return __awaiter(this, void 0, void 0, function* () {
if (!window.indexedDB) {
return;
}
try {
const db = yield this.getDb();
return db.delete(this.store, key);
}
catch (e) {
return;
}
});
}
/**
* inserts value into cache for the given key

@@ -134,4 +113,3 @@ *

// eslint-disable-next-line @typescript-eslint/no-unused-vars
upgrade: (db, _oldVersion, _newVersion, transaction) => {
var _a, _b;
upgrade: (db, _oldVersion, _newVersion, _transaction) => {
const dbArray = JSON.parse(localStorage.getItem(dbListKey)) || [];

@@ -143,18 +121,5 @@ if (!dbArray.includes(dbName)) {

for (const storeName in this.schema.stores) {
if (Object.prototype.hasOwnProperty.call(this.schema.stores, storeName)) {
const indexes = (_b = (_a = this.schema.indexes) === null || _a === void 0 ? void 0 : _a[storeName]) !== null && _b !== void 0 ? _b : [];
if (!db.objectStoreNames.contains(storeName)) {
const objectStore = db.createObjectStore(storeName);
indexes.forEach(i => {
objectStore.createIndex(i.name, i.field);
});
}
else {
const store = transaction.objectStore(storeName);
indexes.forEach(i => {
if (store && !store.indexNames.contains(i.name)) {
store.createIndex(i.name, i.field);
}
});
}
if (Object.prototype.hasOwnProperty.call(this.schema.stores, storeName) &&
!db.objectStoreNames.contains(storeName)) {
db.createObjectStore(storeName);
}

@@ -167,9 +132,3 @@ }

}
queryDb(indexName, query) {
return __awaiter(this, void 0, void 0, function* () {
const db = yield this.getDb();
return (yield db.getAllFromIndex(this.store, indexName, query));
});
}
}
//# sourceMappingURL=CacheStore.js.map

@@ -9,3 +9,2 @@ /**

import { customElementHelper } from '../components/customElementHelper';
import { error } from './Logging';
/**

@@ -29,3 +28,3 @@ * This is a wrapper decorator for `customElement` from `lit`

// eslint-disable-next-line no-console
error(`Tag name ${mgtTagName} is already defined using class ${mgtElement.name} version ${version(mgtElement)}\n`, `Currently registering class ${classOrDescriptor.name} with version ${version(classOrDescriptor)}\n`, 'Please use the disambiguation feature to define a unique tag name for this component see: https://github.com/microsoftgraph/microsoft-graph-toolkit/tree/main/packages/mgt-components#disambiguation');
console.error(`🦒: Tag name ${mgtTagName} is already defined using class ${mgtElement.name} version ${version(mgtElement)}\n`, `Currently registering class ${classOrDescriptor.name} with version ${version(classOrDescriptor)}\n`, 'Please use the disambiguation feature to define a unique tag name for this component see: https://github.com/microsoftgraph/microsoft-graph-toolkit/tree/main/packages/mgt-components#disambiguation');
return classOrDescriptor;

@@ -32,0 +31,0 @@ };

@@ -7,3 +7,3 @@ /**

*/
export declare const PACKAGE_VERSION = "3.1.3-next.mgt-chat.a11fc65";
export declare const PACKAGE_VERSION = "3.1.3-preview.00b168b";
//# sourceMappingURL=version.d.ts.map

@@ -9,3 +9,3 @@ /**

// ANY CHANGES WILL BE LOST DURING BUILD
export const PACKAGE_VERSION = '3.1.3-next.mgt-chat.a11fc65';
export const PACKAGE_VERSION = '3.1.3-preview.00b168b';
//# sourceMappingURL=version.js.map
{
"name": "@microsoft/mgt-element",
"version": "3.1.3-next.mgt-chat.a11fc65",
"version": "3.1.3-preview.00b168b",
"description": "Microsoft Graph Toolkit base classes",

@@ -37,3 +37,3 @@ "homepage": "https://github.com/microsoftgraph/microsoft-graph-toolkit",

"idb": "6.0.0",
"lit": "^2.3.1"
"lit": "^3.0.0"
},

@@ -40,0 +40,0 @@ "publishConfig": {

@@ -92,4 +92,4 @@ /**

*/
public forComponent(component: Element | string, version?: string): Graph {
const graph = new Graph(this._client, version || this._version);
public forComponent(component: Element | string): Graph {
const graph = new Graph(this._client, this._version);
graph.setComponent(component);

@@ -151,3 +151,3 @@ return graph;

*/
export const createFromProvider = (provider: IProvider, version?: string, component?: Element | string): Graph => {
export const createFromProvider = (provider: IProvider, version?: string, component?: Element): Graph => {
const middleware: Middleware[] = [

@@ -154,0 +154,0 @@ new AuthenticationHandler(provider),

@@ -50,3 +50,3 @@ /**

*/
forComponent(component: Element | string, version?: string): IGraph;
forComponent(component: Element): IGraph;

@@ -53,0 +53,0 @@ /**

@@ -22,4 +22,7 @@ /**

export * from './utils/CacheItem';
export * from './utils/CacheSchema';
export * from './utils/CacheService';
export * from './utils/CacheStore';
export * from './utils/dbListKey';
export * from './utils/EventDispatcher';

@@ -37,3 +40,2 @@ export * from './utils/equals';

export * from './utils/CustomElement';
export * from './utils/Logging';
export * from './utils/registerComponent';

@@ -40,0 +42,0 @@

@@ -65,3 +65,3 @@ /**

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public forComponent(component: MgtBaseComponent | string): MockGraph {
public forComponent(component: MgtBaseComponent): MockGraph {
// The purpose of the forComponent pattern is to update the headers of any outgoing Graph requests.

@@ -68,0 +68,0 @@ // The MockGraph isn't making real Graph requests, so we can simply no-op and return the same instance.

@@ -164,3 +164,3 @@ /**

this._state = state;
this._loginChangedDispatcher.fire({ detail: this._state });
this._loginChangedDispatcher.fire({});
}

@@ -228,3 +228,3 @@ }

public setActiveAccount?(user: IProviderAccount) {
this.fireActiveAccountChanged({ detail: user });
this.fireActiveAccountChanged();
}

@@ -257,4 +257,4 @@

*/
private fireActiveAccountChanged(account: { detail: IProviderAccount }) {
this._activeAccountChangedDispatcher.fire(account);
private fireActiveAccountChanged() {
this._activeAccountChangedDispatcher.fire({});
}

@@ -291,5 +291,3 @@

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ActiveAccountChanged {
detail: IProviderAccount;
}
export interface ActiveAccountChanged {}
/**

@@ -302,5 +300,3 @@ * loginChangedEvent

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface LoginChangedEvent {
detail: ProviderState;
}
export interface LoginChangedEvent {}

@@ -307,0 +303,0 @@ /**

@@ -11,14 +11,7 @@ /**

import { CacheStore } from './CacheStore';
import { error } from './Logging';
import { CacheSchema } from './CacheSchema';
import { CacheItem } from './CacheItem';
import { dbListKey } from './dbListKey';
/**
* Localstorage key for storing names of cache databases
*
* @type {string}
*
*/
export const dbListKey = 'mgt-db-list';
/**
* Holds the cache options for cache store

@@ -103,9 +96,2 @@ *

fileLists: CacheOptions;
/**
* Cache options for conversation store
*
* @type {CacheOptions}
* @memberof CacheConfig
*/
conversation: CacheOptions;
}

@@ -185,3 +171,3 @@

delReq.onerror = () => {
error(`${delReq.error.name} occurred deleting cache: ${x}`, delReq.error.message);
console.error(`🦒: ${delReq.error.name} occurred deleting cache: ${x}`, delReq.error.message);
reject();

@@ -241,6 +227,2 @@ };

isEnabled: true
},
conversation: {
invalidationPeriod: 5 * 24 * 60 * 60 * 1000,
isEnabled: true
}

@@ -288,58 +270,1 @@ };

}
export interface Index {
name: string;
field: string;
}
/**
* Represents organization for a cache
*
* @export
* @interface CacheSchema
*/
export interface CacheSchema {
/**
* version number of cache, useful for upgrading
*
* @type {number}
* @memberof CacheSchema
*/
version: number;
/**
* name of the cache
*
* @type {string}
* @memberof CacheSchema
*/
name: string;
/**
* list of stores in the cache
*
* @type {{ [name: string]: CacheSchemaStore }}
* @memberof CacheSchema
*/
stores: Record<string, string>;
/**
* Optional field to define indexed fields on a per store basis
* K is the name of the store for which the indexes should be applied
* T is the names of the fields on the stored data to be indexed
*/
indexes?: Record<string, Index[]>;
}
/**
* item that is stored in cache
*
* @export
* @interface CacheItem
*/
export interface CacheItem {
/**
* date and time that item was retrieved from api/stored in cache
*
* @type {number}
* @memberof CacheItem
*/
timeCached?: number;
}

@@ -10,3 +10,5 @@ /**

import { Providers } from '../providers/Providers';
import { CacheItem, CacheSchema, Index, dbListKey } from './CacheService';
import { dbListKey } from './dbListKey';
import { CacheItem } from './CacheItem';
import { CacheSchema } from './CacheSchema';

@@ -40,3 +42,3 @@ /**

*/
public async getValue(key: string): Promise<T | null> {
public async getValue(key: string): Promise<T> {
if (!window.indexedDB) {

@@ -54,21 +56,2 @@ return null;

/**
* removes a value from the cache for the given key
*
* @param {string} key
* @returns {Promise<void>}
* @memberof Cache
*/
public async delete(key: string): Promise<void> {
if (!window.indexedDB) {
return;
}
try {
const db = await this.getDb();
return db.delete(this.store, key);
} catch (e) {
return;
}
}
/**
* inserts value into cache for the given key

@@ -124,3 +107,3 @@ *

// eslint-disable-next-line @typescript-eslint/no-unused-vars
upgrade: (db, _oldVersion, _newVersion, transaction) => {
upgrade: (db, _oldVersion, _newVersion, _transaction) => {
const dbArray: string[] = (JSON.parse(localStorage.getItem(dbListKey)) as string[]) || [];

@@ -132,17 +115,7 @@ if (!dbArray.includes(dbName)) {

for (const storeName in this.schema.stores) {
if (Object.prototype.hasOwnProperty.call(this.schema.stores, storeName)) {
const indexes: Index[] = this.schema.indexes?.[storeName] ?? [];
if (!db.objectStoreNames.contains(storeName)) {
const objectStore = db.createObjectStore(storeName);
indexes.forEach(i => {
objectStore.createIndex(i.name, i.field);
});
} else {
const store = transaction.objectStore(storeName);
indexes.forEach(i => {
if (store && !store.indexNames.contains(i.name)) {
store.createIndex(i.name, i.field);
}
});
}
if (
Object.prototype.hasOwnProperty.call(this.schema.stores, storeName) &&
!db.objectStoreNames.contains(storeName)
) {
db.createObjectStore(storeName);
}

@@ -154,7 +127,2 @@ }

}
public async queryDb(indexName: string, query: IDBKeyRange | IDBValidKey): Promise<T[]> {
const db = await this.getDb();
return (await db.getAllFromIndex(this.store, indexName, query)) as T[];
}
}

@@ -10,3 +10,2 @@ /**

import { customElementHelper } from '../components/customElementHelper';
import { error } from './Logging';

@@ -31,4 +30,4 @@ /**

// eslint-disable-next-line no-console
error(
`Tag name ${mgtTagName} is already defined using class ${mgtElement.name} version ${version(mgtElement)}\n`,
console.error(
`🦒: Tag name ${mgtTagName} is already defined using class ${mgtElement.name} version ${version(mgtElement)}\n`,
`Currently registering class ${classOrDescriptor.name} with version ${version(classOrDescriptor)}\n`,

@@ -35,0 +34,0 @@ 'Please use the disambiguation feature to define a unique tag name for this component see: https://github.com/microsoftgraph/microsoft-graph-toolkit/tree/main/packages/mgt-components#disambiguation'

@@ -11,2 +11,2 @@ /**

export const PACKAGE_VERSION = '3.1.3-next.mgt-chat.a11fc65';
export const PACKAGE_VERSION = '3.1.3-preview.00b168b';

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc