added graph node types from edit and publish results (#18891)

* added graph node types from edit and publish results

* make generic property bag

* review comments

* add comment for function

* edit comment

* change name to telemetry info
This commit is contained in:
Aditya Bist
2022-03-31 21:50:26 -07:00
committed by GitHub
parent 0a43ed84e3
commit e7773425ee
5 changed files with 62 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export class TableDesignerMetadata {
// Allowed metadata for every provider
public static mssqlAllowedMetdata: Set<string> = new Set(['isNode', 'isEdge', 'isSystemVersioned']);
// Provider ID to allowed metadata list set mapping
public static providerMetadataMap: Map<string, Set<string>> = new Map<string, Set<string>>([
['MSSQL', TableDesignerMetadata.mssqlAllowedMetdata]
]);
/**
* Validates given metadata and adds metadata from the allowed list
* @param providerId provider ID for the table designer provider
* @param metadata incoming metadata from the table designer provider
* @returns filtered telemetry info with only allowed metadata points
*/
public static getTelemetryInfo(providerId: string, metadata: { [key: string]: string }): { [key: string]: string } {
if (!TableDesignerMetadata.providerMetadataMap.has(providerId)) {
return undefined;
}
const allowedSet = TableDesignerMetadata.providerMetadataMap.get(providerId);
for (const key of Object.keys(metadata)) {
if (!allowedSet.has(key)) {
delete metadata[key];
}
}
return metadata;
}
}