Skip to content

Commit 355fbcd

Browse files
author
Colby Sieber
committed
Removed dependency GraphRequest had on package.json
1 parent c91286e commit 355fbcd

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@microsoft/microsoft-graph-client",
3+
"//": "NOTE: The version here should match exactly the exported const PACKAGE_VERSION in common.ts. If you change it here, also change it there.",
34
"version": "1.0.0",
45
"description": "Microsoft Graph Client Library",
56
"main": "lib/src/index.js",

src/GraphRequest.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import * as request from 'superagent';
22
import { Promise } from 'es6-promise'
33

44

5-
import { Options, URLComponents, GraphError, oDataQueryNames, GraphRequestCallback } from "./common"
5+
import { Options, URLComponents, GraphError, oDataQueryNames, GraphRequestCallback, PACKAGE_VERSION } from "./common"
66
import { ResponseHandler } from "./ResponseHandler"
77

8-
const packageInfo = require('../../package.json');
9-
108
export class GraphRequest {
119
config: Options;
1210
urlComponents: URLComponents;
@@ -332,7 +330,7 @@ export class GraphRequest {
332330
let request = requestBuilder
333331
.set('Authorization', 'Bearer ' + accessToken)
334332
.set(this._headers)
335-
.set('SdkVersion', "graph-js-" + packageInfo.version)
333+
.set('SdkVersion', "graph-js-" + PACKAGE_VERSION)
336334

337335
if (this._responseType !== undefined) {
338336
request.responseType(this._responseType);

src/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ export let oDataQueryNames = ["select", "expand", "orderby", "filter", "top", "s
22
export const DEFAULT_VERSION = "v1.0";
33
export const GRAPH_BASE_URL = "https://graph.microsoft.com/";
44

5+
// NOTE: This should be kept up to date with the version used in package.json.
6+
// If you are changing this please ensure you are also changing it in package.json.
7+
export const PACKAGE_VERSION = "1.0.0";
8+
59
// support oData params with and without $ prefix
610
oDataQueryNames = oDataQueryNames.concat(oDataQueryNames.map((s) => "$"+s));
711

0 commit comments

Comments
 (0)