From 2b5614dc575c66f282323c84585a7a8f99307c8d Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Fri, 28 Jul 2023 10:12:03 -0700 Subject: [PATCH] feat: add canary url to allowed endpoints for graph (#2635) --- packages/mgt-element/src/IGraph.ts | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/packages/mgt-element/src/IGraph.ts b/packages/mgt-element/src/IGraph.ts index e38a37e92..8ca1aaf9e 100644 --- a/packages/mgt-element/src/IGraph.ts +++ b/packages/mgt-element/src/IGraph.ts @@ -75,12 +75,8 @@ export type GraphEndpoint = | 'https://graph.microsoft.us' | 'https://dod-graph.microsoft.us' | 'https://graph.microsoft.de' - | 'https://microsoftgraph.chinacloudapi.cn'; - -/** - * MICROSOFT_GRAPH_ENDPOINTS is a set of all the valid Graph URL endpoints. - */ -export const MICROSOFT_GRAPH_ENDPOINTS: Set = new Set(); + | 'https://microsoftgraph.chinacloudapi.cn' + | 'https://canary.graph.microsoft.com'; /** * MICROSOFT_GRAPH_DEFAULT_ENDPOINT is the default Graph endpoint that is silently set on @@ -88,13 +84,14 @@ export const MICROSOFT_GRAPH_ENDPOINTS: Set = new Set { - const endpoints: GraphEndpoint[] = [ - MICROSOFT_GRAPH_DEFAULT_ENDPOINT, - 'https://graph.microsoft.us', - 'https://dod-graph.microsoft.us', - 'https://graph.microsoft.de', - 'https://microsoftgraph.chinacloudapi.cn' - ]; - endpoints.forEach(endpoint => MICROSOFT_GRAPH_ENDPOINTS.add(endpoint)); -})(); +/** + * MICROSOFT_GRAPH_ENDPOINTS is a set of all the valid Graph URL endpoints. + */ +export const MICROSOFT_GRAPH_ENDPOINTS: Set = new Set([ + MICROSOFT_GRAPH_DEFAULT_ENDPOINT, + 'https://graph.microsoft.us', + 'https://dod-graph.microsoft.us', + 'https://graph.microsoft.de', + 'https://microsoftgraph.chinacloudapi.cn', + 'https://canary.graph.microsoft.com' +]);