Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-code-owners
Browse files Browse the repository at this point in the history
  • Loading branch information
NSeydoux authored Nov 14, 2023
2 parents 20aa5ed + 7365d77 commit 1760b1b
Show file tree
Hide file tree
Showing 114 changed files with 6,693 additions and 12,982 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ on:

jobs:
audit:
uses: inrupt/typescript-sdk-tools/.github/workflows/reusable-audit.yml@v1.7.0
uses: inrupt/typescript-sdk-tools/.github/workflows/reusable-audit.yml@v2
secrets:
WEBHOOK_E2E_FAILURE: ${{ secrets.WEBHOOK_E2E_FAILURE }}
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true
jobs:
lint:
uses: inrupt/typescript-sdk-tools/.github/workflows/reusable-lint.yml@v1.7.0
uses: inrupt/typescript-sdk-tools/.github/workflows/reusable-lint.yml@v2

unit-tests:
continue-on-error: ${{ matrix.experimental }}
Expand All @@ -17,11 +17,11 @@ jobs:
matrix:
# Available OS's: https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ["20.x", "18.x", "16.x", "14.x"]
node-version: ["20.x", "18.x", "16.x"]
experimental: [false]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Sonar analysis needs the full history for features like automatic assignment of bugs. If the following step
# is not included the project will show a warning about incomplete information.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/e2e-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
environment-name: ["ESS PodSpaces"]
experimental: [false]
include:
- environment-name: "ESS Dev-Next"
- environment-name: "ESS Dev-2-2"
experimental: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand All @@ -47,6 +47,7 @@ jobs:
E2E_TEST_OWNER_CLIENT_SECRET: ${{ secrets.E2E_TEST_OWNER_CLIENT_SECRET }}
E2E_TEST_REQUESTOR_CLIENT_ID: ${{ secrets.E2E_TEST_REQUESTOR_CLIENT_ID }}
E2E_TEST_REQUESTOR_CLIENT_SECRET: ${{ secrets.E2E_TEST_REQUESTOR_CLIENT_SECRET }}
E2E_TEST_VC_PROVIDER: ${{ secrets.E2E_TEST_VC_PROVIDER }}
E2E_TEST_ENVIRONMENT: ${{ matrix.environment-name }}
- name: Archive browser-based end-to-end test request logs
uses: actions/upload-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
environment-name: ["ESS PodSpaces"]
experimental: [false]
include:
- environment-name: "ESS Dev-Next"
- environment-name: "ESS Dev-2-2"
experimental: true
node-version: 20.x
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare for publication to npm
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,51 @@

This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Deprecation notice]

The following changes are pending, and will be applied on the next major release:

- The `status` parameter for `getAccessGrantAll` will default to `all` rather than `granted`.

## Unreleased

### Removed features

- Support for `odrl` access grants has been removed.

## [2.6.1](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v2.6.1) - 2023-09-25

### Bugfixes

- `denyAccessRequest` didn't normalize the returned denied Access Grant, resulting in it having a
JSON-LD frame different from the value returned by `approveAccessRequest`. The value is now normalized,
and both functions return a similarly shaped object. This also fixes the return type of `denyAccessRequest`,
which now returns the more strict `AccessGrant` type rather than the `VerifiableCredential` type.
- add `types` entry in the package.json exports so that bundlers such as esbuild can discover type definitions.

## [2.6.0](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v2.6.0) - 2023-09-18

### New feature

- Export `getAccessGrantAll` has a new `status` parameter which allows selection of `granted`, `denied` or `all` access grants.
By default only `granted` access grants are returned as this is the existing behavior. In the next major version of this
library the default will be to return `all` access grants.

## [2.5.0](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v2.5.0) - 2023-08-11

### New feature

- Export `CredentialIsAccessGrantAny` which checks if a `VerifiableCredential` is an `AccessGrantAny`.

## [2.4.0](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v2.4.0) - 2023-07-24

### New feature

- `deleteSolidDataset` and `deleteFile`: Add functions to the `resource` module
to delete resources, following the interface of `@inrupt/solid-client`.
- `getAccessRequest`: a function exported by the `./manage` module to
get the Access Request from the Access Request URL.

## [2.3.2](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v2.3.2) - 2023-06-05

### Deprecation notice
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module](https://www.npmjs.com/package/buffer).
## Node.js Support

Our JavaScript Client Libraries track Node.js [LTS
releases](https://nodejs.org/en/about/releases/), and support 14.x, 16.x and 18.x.
releases](https://nodejs.org/en/about/releases/), and support 16.x, 18.x and 20.x.

# Installation

Expand Down
4 changes: 4 additions & 0 deletions docs/api/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
extensions = [
'sphinx.ext.extlinks',
'myst_parser',
'sphinx_reredirects'
]


Expand Down Expand Up @@ -139,6 +140,9 @@
myst_url_schemes = ('https', 'http')
myst_enable_extensions = ['colon_fence']

redirects = {
"modules/manage.html": "./gConsent_manage.html"
}

# Typedoc by default outputs all files as relative to their directory, but for
# Interfaces this is not what we want. Instead of
Expand Down
7 changes: 4 additions & 3 deletions docs/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# pip install -r requirements.txt

pydata-sphinx-theme==0.13.3
myst-parser==1.0.0
pydata-sphinx-theme==0.14.3
sphinx-reredirects==0.1.3
myst-parser==2.0.0
# Currently myst-parse is incompatible with sphinx v7
Sphinx==6.2.1
Sphinx==7.2.6
# urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled
# with OpenSSL 1.0.2k-fips 26 Jan 2017.
# See: https://github.com/urllib3/urllib3/issues/2168,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Node.js Support
^^^^^^^^^^^^^^^

Our JavaScript Client Libraries track Node.js `LTS releases
<https://nodejs.org/en/about/releases/>`__, and support 14.x, and 16.x.
<https://nodejs.org/en/about/releases/>`__, and support 16.x, 18.x and 20.x.

.. _issues--help:

Expand Down
57 changes: 28 additions & 29 deletions e2e/browser/test-app/components/accessGrants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ export default function AccessGrant({
const [sharedResourceIri, setSharedResourceIri] = useState<string>();
const router = useRouter();

const handleCreate = async (e) => {
// This prevents the default behaviour of the button, i.e. to resubmit, which reloads the page.
e.preventDefault();
const handleCreate = async () => {
if (typeof sharedResourceIri === "string") {
// If a resource already exist, do nothing
return;
Expand All @@ -64,7 +62,7 @@ export default function AccessGrant({
const resourceOwnerPodAll = await getPodUrlAll(session.info.webId);
if (resourceOwnerPodAll.length === 0) {
setErrorMessage(
"The Resource Owner WebID Profile is missing a link to at least one Pod root."
"The Resource Owner WebID Profile is missing a link to at least one Pod root.",
);
}

Expand All @@ -75,14 +73,12 @@ export default function AccessGrant({
// The session ID is a random string, used here as a unique slug.
slug: `${session.info.sessionId}.txt`,
fetch: session.fetch,
}
},
);
setSharedResourceIri(getSourceUrl(savedFile));
};

const handleDelete = async (e) => {
// This prevents the default behaviour of the button, i.e. to resubmit, which reloads the page.
e.preventDefault();
const handleDelete = async () => {
if (typeof sharedResourceIri !== "string") {
// If no resource exist, do nothing
return;
Expand All @@ -93,9 +89,7 @@ export default function AccessGrant({
setSharedResourceIri(undefined);
};

const handleGrant = async (e) => {
// This prevents the default behaviour of the button, i.e. to resubmit, which reloads the page.
e.preventDefault();
const handleGrant = async () => {
if (typeof sharedResourceIri !== "string") {
// If the resource does not exist, do nothing.
return;
Expand All @@ -109,14 +103,12 @@ export default function AccessGrant({
},
{
fetch: session.fetch,
}
},
);
setAccessGrant(JSON.stringify(accessGrantRequest, null, " "));
};

const handleRevoke = async (e) => {
// This prevents the default behaviour of the button, i.e. to resubmit, which reloads the page.
e.preventDefault();
const handleRevoke = async () => {
if (typeof accessGrant !== "string") {
// If the resource does not exist, do nothing.
return;
Expand All @@ -143,30 +135,36 @@ export default function AccessGrant({
},
fallbackAccessManagementUi: `https://podbrowser.inrupt.com/privacy/access/requests/`,
fetch: session.fetch,
}
},
);
};

const handleGrantResponse = async () => {
if (
router.query.accessGrantUrl !== "" &&
typeof router.query.accessGrantUrl === "string"
(router.query.accessGrantUrl !== "" &&
typeof router.query.accessGrantUrl === "string") ||
window.localStorage.getItem("accessGrantUrl") !== null
) {
setAccessGrant(router.query.accessGrantUrl);
setAccessGrant(
window.localStorage.getItem("accessGrantUrl") ??
(router.query.accessGrantUrl as string),
);
}
};

return (
<>
<div>
<button
onClick={async (e) => handleCreate(e)}
type="button"
onClick={handleCreate}
data-testid="create-resource"
>
Create resource
</button>
<button
onClick={async (e) => handleDelete(e)}
type="button"
onClick={handleDelete}
data-testid="delete-resource"
>
Delete resource
Expand All @@ -190,20 +188,19 @@ export default function AccessGrant({
</input>
</p>
<div>
<button
onClick={async (e) => handleGrant(e)}
data-testid="grant-access"
>
<button type="button" onClick={handleGrant} data-testid="grant-access">
Grant access
</button>
<button
onClick={async (e) => handleRevoke(e)}
type="button"
onClick={handleRevoke}
data-testid="revoke-access"
>
Revoke access
</button>
<button
onClick={async () => handleAccessRequest()}
type="button"
onClick={handleAccessRequest}
data-testid="redirect-for-access"
>
Redirect to PodBrowser to Grant Access
Expand All @@ -214,13 +211,15 @@ export default function AccessGrant({
</p>

<button
onClick={async () => handleCallAuthedGrant()}
type="button"
onClick={handleCallAuthedGrant}
data-testid="get-authed-grant"
>
Authenticated Fetch of Grant
</button>
<button
onClick={async () => handleGrantResponse()}
type="button"
onClick={handleGrantResponse}
data-testid="handle-grant-response"
>
Handle Grant Response
Expand Down
15 changes: 14 additions & 1 deletion e2e/browser/test-app/components/appContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
login,
logout,
handleIncomingRedirect,
events,
} from "@inrupt/solid-client-authn-browser";
import type { ISessionInfo } from "@inrupt/solid-client-authn-browser";
import {
Expand All @@ -37,7 +38,7 @@ import AccessGrants from "../accessGrants";

// This is the content of the file uploaded manually at SHARED_FILE_IRI.
const DEFAULT_ISSUER = "https://login.inrupt.com/";
const REDIRECT_URL = window.location.href;
const REDIRECT_URL = "http://localhost:3000/";
const APP_NAME = "Access Grants browser-based tests app";
const AccessGrantContainer = ({
sessionInfo,
Expand All @@ -53,6 +54,11 @@ const AccessGrantContainer = ({
};

export default function Home() {
// Kill the app if an error occurs
events().on("error", (err, errDescription) => {
throw new Error(`An error happened: ${err}, ${errDescription}`);
});

const [sessionInfo, setSessionInfo] = useState<ISessionInfo>();
const [issuer, setIssuer] = useState<string>(DEFAULT_ISSUER);
const [errorMessage, setErrorMessage] = useState<string>();
Expand All @@ -67,6 +73,13 @@ export default function Home() {

const handleLogin = async () => {
try {
const currentURL = new URL(window.location.href);
if (currentURL.searchParams.has("accessGrantUrl")) {
window.localStorage.setItem(
"accessGrantUrl",
decodeURIComponent(currentURL.searchParams.get("accessGrantUrl")!),
);
}
// Login will redirect the user away so that they can log in the OIDC issuer,
// and back to the provided redirect URL (which should be controlled by your app).
await login({
Expand Down
Loading

0 comments on commit 1760b1b

Please sign in to comment.