Skip to content

Commit

Permalink
v3 launch prep, updates to esm fully done, all debugging works, all n…
Browse files Browse the repository at this point in the history
…pm commands work, tests passing, deps updated
  • Loading branch information
patrick-rodgers committed Dec 17, 2021
1 parent 448310a commit 3fb799e
Show file tree
Hide file tree
Showing 26 changed files with 1,733 additions and 2,504 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parser: "@typescript-eslint/parser",
parserOptions: {
project: [
"./tsconfig.json",
Expand All @@ -9,11 +9,11 @@ module.exports = {
sourceType: "module",
},
plugins: [
'@typescript-eslint',
"@typescript-eslint",
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
// updated to address conflicts with code base / typescript such as interface redeclare, etc.
Expand Down
4 changes: 3 additions & 1 deletion debug/launch/v3-patrick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export async function Example(settings: ITestingSettings) {
},
})).using(PnPLogging(LogLevel.Verbose)); //.using(RequestRecorderCache(recordingPath, "record", () => false));

const i = await sp.web();
const i = await sp.web({
headers: {}
});

console.log(i);

Expand Down
4 changes: 4 additions & 0 deletions debug/serve/plumbing/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { spawn } from "child_process";
import { dirname, resolve } from "path";
import findup from "findup-sync";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// give outselves a single reference to the projectRoot
const projectRoot = resolve(dirname(findup("package.json")));
Expand Down
4,029 changes: 1,659 additions & 2,370 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 19 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,49 @@
"version": "3.0.0",
"description": "A JavaScript library for SharePoint & Graph development.",
"devDependencies": {
"@azure/msal-node": "^1.0.1",
"@microsoft/microsoft-graph-types": "^1.32.0",
"@azure/msal-node": "^1.4.0",
"@microsoft/microsoft-graph-types": "^2.11.0",
"@pnp/buildsystem": "^3.0.2",
"@types/chai": "^4.2.22",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.4",
"@types/core-js": "^2.5.4",
"@types/es6-promise": "^3.3.0",
"@types/findup-sync": "^2.0.2",
"@types/gulp": "^4.0.8",
"@types/gulp-replace": "^0.0.31",
"@types/jsonwebtoken": "^8.5.0",
"@types/core-js": "^2.5.5",
"@types/findup-sync": "^4.0.2",
"@types/gulp": "^4.0.9",
"@types/jsonwebtoken": "^8.5.6",
"@types/mocha": "^9.0.0",
"@types/node": "^14.14.34",
"@types/pump": "^1.1.1",
"@types/sharepoint": "^2016.1.9",
"@types/through2": "^2.0.36",
"@types/webpack": "^4.41.26",
"@types/whatwg-fetch": "^0.0.33",
"@types/yargs": "^16.0.0",
"@types/node": "^14.17.3",
"@types/webpack": "^5.28.0",
"@types/yargs": "^17.0.7",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"del-cli": "^3.0.1",
"del-cli": "^4.0.1",
"eslint": "^7.32.0",
"findup-sync": "^4.0.0",
"findup-sync": "^5.0.0",
"jsonwebtoken": "^8.5.1",
"mocha": "^9.1.2",
"msal": "^1.4.6",
"mocha": "^9.1.3",
"msal": "^1.4.15",
"node-abort-controller": "^3.0.1",
"node-fetch": "^2.6.1",
"prettyjson": "^1.2.1",
"stacktrace-js": "^2.0.2",
"string-replace-loader": "^3.0.1",
"string-replace-loader": "^3.1.0",
"tslib": "^2.1.0",
"typescript": "^4.2.3",
"webpack": "^5.26.0",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "v4.0.0-beta.0",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "v4.6.0",
"yargs": "^16.2.0"
},
"scripts": {
"build": "npm run pnp-buildsystem-init && pnpbuild -n build",
"buildDebug": "npm run clean && npm run pnp-buildsystem-init && pnpbuild -n build-debug",
"clean": "del-cli \"./?(dist|site|build|buildsystem-config.js)\"",
"clean-build": "npm run clean && npm run build",
"just-publish": "npm run pnp-buildsystem-init && pnpbuild -n publish",
"lint": "eslint ./packages ./test --ext .ts",
"just-publish": "npm run pnp-buildsystem-init && pnpbuild -n publish",
"package": "npm run build && pnpbuild -n package",
"pnp-buildsystem-init": "tsc -p tsconfig.buildsystem.json",
"pnp-publish": "cd tools/publish && publish-win.bat",
"pnp-publish-beta": "npm run clean && npm run package && pnpbuild -n publish-beta",
"pnp-publish-v3nightly": "npm run clean && npm run package && pnpbuild -n publish-v3nightly",
"serve": "tsc -p ./debug/serve/tsconfig.json && node ./build/server/debug/serve/plumbing/run.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./index.js",
"typings": "./index",
"dependencies": {
"tslib": "2.1.0"
"tslib": "2.3.1"
},
"author": {
"name": "Microsoft and other contributors"
Expand Down
1 change: 1 addition & 0 deletions packages/graph/behaviors/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function Telemetry(): TimelinePipe<Queryable> {

init.headers = { ...init.headers, ["SdkVersion"]: "PnPCoreJS/$$Version$$" };

// eslint-disable-next-line @typescript-eslint/dot-notation
this.log(`Request Tag: ${init.headers["SdkVersion"]}`, 0);

return [url, init, result];
Expand Down
2 changes: 1 addition & 1 deletion packages/graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"typings": "./index",
"dependencies": {
"@microsoft/microsoft-graph-types": "^1.32.0",
"tslib": "2.1.0",
"tslib": "2.3.1",
"@pnp/core": "0.0.0-PLACEHOLDER",
"@pnp/queryable": "0.0.0-PLACEHOLDER"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./index.js",
"typings": "./index",
"dependencies": {
"tslib": "2.1.0"
"tslib": "2.3.1"
},
"author": {
"name": "Microsoft and other contributors"
Expand Down
4 changes: 2 additions & 2 deletions packages/msaljsclient/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"typings": "./index",
"dependencies": {
"@pnp/queryable": "0.0.0-PLACEHOLDER",
"msal": "1.4.6",
"tslib": "2.1.0"
"msal": "1.4.15",
"tslib": "2.3.1"
},
"author": {
"name": "Microsoft and other contributors"
Expand Down
4 changes: 2 additions & 2 deletions packages/nodejs/behaviors/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function NodeFetch(): TimelinePipe<Queryable> {

this.log(`Fetch: ${init.method} ${url.toString()}`, LogLevel.Verbose);

return nodeFetch(url.toString(), init);
return <any>nodeFetch(url.toString(), <any>init);
});

return instance;
Expand Down Expand Up @@ -63,7 +63,7 @@ export function NodeFetchWithRetry(retries = 3, interval = 200): TimelinePipe<Qu

this.log(`Fetch: ${init.method} ${url.toString()}`, LogLevel.Verbose);

response = await nodeFetch(url.toString(), init);
response = await <any>nodeFetch(url.toString(), <any>init);

// if we got a good response, return it, otherwise see if we can retry
return response.ok ? response : retry();
Expand Down
6 changes: 3 additions & 3 deletions packages/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"main": "./index.js",
"typings": "./index",
"dependencies": {
"@azure/msal-node": "^1.0.1",
"@azure/msal-node": "^1.4.0",
"@pnp/core": "0.0.0-PLACEHOLDER",
"@pnp/logging": "0.0.0-PLACEHOLDER",
"@pnp/queryable": "0.0.0-PLACEHOLDER",
"@pnp/sp": "0.0.0-PLACEHOLDER",
"@pnp/graph": "0.0.0-PLACEHOLDER",
"node-fetch": "2.6.1",
"tslib": "2.1.0"
"node-fetch": "3.1.0",
"tslib": "2.3.1"
},
"author": {
"name": "Microsoft and other contributors"
Expand Down
2 changes: 1 addition & 1 deletion packages/queryable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./index.js",
"typings": "./index",
"dependencies": {
"tslib": "2.1.0",
"tslib": "2.3.1",
"@pnp/core": "0.0.0-PLACEHOLDER"
},
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./index.js",
"typings": "./index",
"dependencies": {
"tslib": "2.1.0",
"tslib": "2.3.1",
"@pnp/core": "0.0.0-PLACEHOLDER",
"@pnp/queryable": "0.0.0-PLACEHOLDER"
},
Expand Down
12 changes: 6 additions & 6 deletions samples/nodejs-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions test/core/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,15 @@ describe("hOP", function () {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
expect(hOP({ test: true }, "test")).to.be.true;
});
it("Fail", function () {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
expect(hOP({ test: true }, "nope")).to.be.false;
});
});

describe("getHashCode", function () {
it("Success", function () {
expect(getHashCode("test string value")).to.be.a("number");
expect(getHashCode("test string value !@#$%^&*()_+{}<>,.?/'\"")).to.be.a("number");
});
});
2 changes: 1 addition & 1 deletion test/graph/calendars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Calendar", function () {

_graphfi = getGraph();

const userInfo = await getValidUser();
const userInfo = await getValidUser(this.settings.testUser);
testUserName = userInfo.userPrincipalName;

// Get default calendar
Expand Down
2 changes: 1 addition & 1 deletion test/graph/directoryobjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("Directory Objects", function () {
_graphfi = getGraph();

// Get a sample user
userInfo = await getValidUser();
userInfo = await getValidUser(this.settings.testUser);
testUserName = userInfo.userPrincipalName;

// Create a test group to ensure we have a directory object
Expand Down
2 changes: 1 addition & 1 deletion test/graph/outlook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Outlook", function () {
}

_graphfi = getGraph();
const userInfo = await getValidUser();
const userInfo = await getValidUser(this.settings.testUser);
testUserName = userInfo.userPrincipalName;
});

Expand Down
2 changes: 1 addition & 1 deletion test/graph/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("Teams", function () {
}

_graphfi = getGraph();
const userInfo = await getValidUser();
const userInfo = await getValidUser(this.settings.testUser);
testUserId = userInfo.id;
teamBody = {
"[email protected]": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
Expand Down
4 changes: 2 additions & 2 deletions test/graph/utilities/getValidUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { getGraph } from "../../main.js";
let cachedValidUser = null;
const usersToCheck = 20;

export default async function getValidUser(ignoreCache = false): Promise<IUser> {
export default async function getValidUser(userName: string, ignoreCache = false): Promise<IUser> {

if (!ignoreCache && cachedValidUser !== null) {
return cachedValidUser;
}

const testUserName = this.settings.testUser.substring(this.settings.testUser.lastIndexOf("|") + 1);
const testUserName = userName.substring(userName.lastIndexOf("|") + 1);

try {
const _graphFI: GraphFI = getGraph();
Expand Down
14 changes: 9 additions & 5 deletions test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ function readEnvVar(key: string, parse = false): any {

async function loadSettings(md: typeof mode): Promise<ITestingSettings> {

let settings: ITestingSettings = null;

switch (md) {

case "online":

return {
settings = {
testing: {
testUser: readEnvVar("PNPTESTING_TESTUSER") || null,
enableWebTests: true,
Expand All @@ -112,25 +114,27 @@ async function loadSettings(md: typeof mode): Promise<ITestingSettings> {
},
},
};
break;

case "online-noweb":

return {
settings = {
testing: {
enableWebTests: false,
},
};
break;

default:

const settings = await import(findup("settings.js")).then(s => s.settings);
settings = await import(findup("settings.js")).then(s => s.settings);

if (skipWeb) {
settings.testing.enableWebTests = false;
}

return settings;
}

return settings;
}


Expand Down
2 changes: 1 addition & 1 deletion test/queryable/behaviors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe("Behaviors", function () {
query.using(Timeout(controller.signal));
query.using(ResolveOnData(), RejectOnError());

query.on.send.replace(async (url, init) => nodeFetch(url, init));
query.on.send.replace(async (url, init) => <any>nodeFetch(url.toString(), <any>init));

try {

Expand Down
Loading

0 comments on commit 3fb799e

Please sign in to comment.