Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade cross fetch #2164

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"installCommand": "install-sandbox",
"buildCommand": "build-sandbox",
"sandboxes": ["/.codesandbox/sandbox"],
"packages": ["packages/browser"]
"packages": ["packages/*"],
"node": "14"
}
13 changes: 13 additions & 0 deletions .codesandbox/sandbox/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"root": true,
"env": {
"shared-node-browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:import/recommended"
],
"plugins": ["prettier", "react", "import"]
}
39,200 changes: 22,873 additions & 16,327 deletions .codesandbox/sandbox/package-lock.json

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions .codesandbox/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@
"test": "react-scripts test --env=jsdom"
},
"dependencies": {
"@inrupt/solid-client": "0.3.0",
"@inrupt/solid-client-authn-browser": "^0.1.1",
"ajv": "6.12.4",
"@inrupt/solid-client": "^1.23.0",
"@inrupt/solid-client-authn-browser": "^1.11.9",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-scripts": "3.4.3",
"react-scripts": "^5.0.1",
"readable-stream": "3.6.0",
"stream-browserify": "3.0.0"
},
"devDependencies": {
"parcel-bundler": "^1.6.1"
"eslint": "8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"prettier": "^2.6.2"
},
"keywords": [
"typescript",
Expand Down
28 changes: 17 additions & 11 deletions .codesandbox/sandbox/src/App.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
import React, { useState, useEffect } from "react";
import { Session as AuthSession } from "@inrupt/solid-client-authn-browser";
import * as defaultSession from "@inrupt/solid-client-authn-browser";

const {
login,
handleIncomingRedirect,
fetch: authenticatedFetch,
getDefaultSession,
} = defaultSession;

const REDIRECT_URL = window.location;

export default function Home() {
// eslint-disable-next-line
const [session, _setSession] = useState(new AuthSession({}));
const [issuer, setIssuer] = useState("https://broker.demo-ess.inrupt.com/");
const [resource, setResource] = useState(session.info.webId);
const [issuer, setIssuer] = useState("https://broker.pod.inrupt.com/");
const [resource, setResource] = useState("");
const [data, setData] = useState(null);

useEffect(() => {
const authCode = new URL(window.location.href).searchParams.get("code");
if (authCode) {
console.log("Being redirected from the IdP");
session.handleIncomingRedirect(window.location.href).then((info) => {
handleIncomingRedirect(window.location.href).then((info) => {
setResource(info.webId);
});
}
}, [session]);
});

const handleLogin = (e) => {
// The default behaviour of the button is to resubmit.
// This prevents the page from reloading.
e.preventDefault();
session.login({
login({
redirectUrl: REDIRECT_URL,
oidcIssuer: issuer,
});
Expand All @@ -34,18 +39,19 @@ export default function Home() {
// The default behaviour of the button is to resubmit.
// This prevents the page from reloading.
e.preventDefault();
session
.fetch(resource)
authenticatedFetch(resource)
.then((response) => response.text())
.then(setData);
};

const session = getDefaultSession();

return (
<div>
<main>
<h1>Sandbox app</h1>
<p>
{session.info.webId
{session?.info?.webId
? `Logged in as ${session.info.webId}`
: "Not logged in yet"}{" "}
</p>
Expand Down
2 changes: 1 addition & 1 deletion .codesandbox/sandbox/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import ReactDOM from "react-dom";
import Home from "./App";

const rootElement = document.getElementById("root");
ReactDOM.render(<Home />, rootElement);
ReactDOM.render(<Home />, rootElement);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:e2e:browser": "cd e2e/browser && npm test",
"lerna-version": "lerna version",
"install-sandbox": "npm ci && npm ci --prefix .codesandbox/sandbox",
"build-sandbox": "npm run build && npm run build --prefix .codesandbox/sandbox",
"build-sandbox": "npm run build --prefix .codesandbox/sandbox",
"build-docs-preview-site": "lerna run build-docs-preview-site; rm -r dist/website || true; lerna exec -- mkdir -p ../../dist/website/\\${PWD##*/}; lerna exec -- \"cp -r docs/api/build/html/. ../../dist/website/\\${PWD##*/}/ || true\"; echo 'API documentation: <a href=\"./browser/\">solid-client-authn-browser</a>, <a href=\"./node/\">solid-client-authn-node</a>, <a href=\"./core/\">solid-client-authn-core</a>, <a href=\"./demo/\">demo app</a>.' >> dist/website/index.html",
"build-demo-app": "npm run build; cd packages/browser/examples/demoClientApp/; npm ci; npm run build; mkdir -p ../../../../dist/website/demo/; cp -r dist/. ../../../../dist/website/demo/"
},
Expand Down
44 changes: 44 additions & 0 deletions packages/browser/examples/demoClientApp/package-lock.json

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

1 change: 1 addition & 0 deletions packages/browser/examples/demoClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"webpack-dev-server": "^4.7.3"
},
"dependencies": {
"@inrupt/solid-client-authn-browser": "file:../../",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"regenerator-runtime": "^0.13.9"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React, { Component } from "react";
import "regenerator-runtime/runtime";

// import {
// Session,
// getClientAuthenticationWithDependencies,
// } from "@inrupt/solid-client-authn-browser";
import {
Session,
getClientAuthenticationWithDependencies,
} from "../../../dist/index";
} from "@inrupt/solid-client-authn-browser";

const clientApplicationName = "S-C-A Browser Demo Client App";
let snackBarTimeout = undefined;
Expand Down
44 changes: 44 additions & 0 deletions packages/browser/examples/single/bundle/package-lock.json

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

Loading