solid-panes 3.7.3-1bd42721 → 3.7.3-322e9b27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Documentation/VisualLanguage.html +538 -0
- package/Documentation/conventions.md +333 -0
- package/coverage/clover.xml +152 -0
- package/coverage/coverage-final.json +6 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/outline/index.html +161 -0
- package/coverage/lcov-report/outline/outlineIcons.js.html +565 -0
- package/coverage/lcov-report/outline/propertyViews.ts.html +196 -0
- package/coverage/lcov-report/outline/viewAsImage.ts.html +121 -0
- package/coverage/lcov-report/outline/viewAsMbox.ts.html +127 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/trustedApplications/index.html +116 -0
- package/coverage/lcov-report/trustedApplications/trustedApplications.utils.ts.html +238 -0
- package/coverage/lcov.info +204 -0
- package/dev/index.html +28 -0
- package/dev/loader.ts +91 -0
- package/dev/pane/index.ts +10 -0
- package/doc/images/panes-for-classes.epgz +0 -0
- package/doc/images/panes-for-classes.svg +609 -0
- package/eslint.config.mjs +34 -0
- package/jest.config.js +27 -0
- package/jest.setup.ts +4 -0
- package/lib/RDFXMLPane.js +59 -0
- package/lib/RDFXMLPane.js.map +1 -0
- package/{dist → lib}/argument/argumentPane.js +15 -14
- package/lib/argument/argumentPane.js.map +1 -0
- package/{dist → lib}/attach/attachPane.js +93 -83
- package/lib/attach/attachPane.js.map +1 -0
- package/{dist → lib}/audio/audioPane.js +50 -49
- package/lib/audio/audioPane.js.map +1 -0
- package/{dist → lib}/classInstancePane.js +24 -23
- package/lib/classInstancePane.js.map +1 -0
- package/lib/dashboard/basicPreferences.js +229 -0
- package/lib/dashboard/basicPreferences.js.map +1 -0
- package/lib/dashboard/dashboardPane.js +73 -0
- package/lib/dashboard/dashboardPane.js.map +1 -0
- package/lib/dashboard/homepage.js +86 -0
- package/lib/dashboard/homepage.js.map +1 -0
- package/{dist → lib}/dataContentPane.js +63 -63
- package/lib/dataContentPane.js.map +1 -0
- package/{dist → lib}/defaultPane.js +15 -14
- package/lib/defaultPane.js.map +1 -0
- package/{dist → lib}/dokieli/dokieliPane.js +53 -49
- package/lib/dokieli/dokieliPane.js.map +1 -0
- package/lib/dokieli/new.js +9 -0
- package/lib/dokieli/new.js.map +1 -0
- package/{dist → lib}/form/pane.js +45 -44
- package/lib/form/pane.js.map +1 -0
- package/lib/global.d.js +2 -0
- package/lib/global.d.js.map +1 -0
- package/lib/home/homePane.js +91 -0
- package/lib/home/homePane.js.map +1 -0
- package/lib/humanReadablePane.js +138 -0
- package/lib/humanReadablePane.js.map +1 -0
- package/lib/imagePane.js +71 -0
- package/lib/imagePane.js.map +1 -0
- package/lib/index.js +112 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/internalPane.js +184 -0
- package/lib/internal/internalPane.js.map +1 -0
- package/lib/mainPage/footer.js +22 -0
- package/lib/mainPage/footer.js.map +1 -0
- package/lib/mainPage/header.js +152 -0
- package/lib/mainPage/header.js.map +1 -0
- package/{dist → lib}/mainPage/index.d.ts.map +1 -1
- package/lib/mainPage/index.js +42 -0
- package/lib/mainPage/index.js.map +1 -0
- package/{dist → lib}/microblogPane/microblogPane.js +262 -261
- package/lib/microblogPane/microblogPane.js.map +1 -0
- package/lib/n3Pane.js +57 -0
- package/lib/n3Pane.js.map +1 -0
- package/lib/outline/context.js +19 -0
- package/lib/outline/context.js.map +1 -0
- package/lib/outline/manager.js +2264 -0
- package/lib/outline/manager.js.map +1 -0
- package/lib/outline/manager.test.d.ts +2 -0
- package/lib/outline/manager.test.d.ts.map +1 -0
- package/lib/outline/manager.test.js +210 -0
- package/lib/outline/manager.test.js.map +1 -0
- package/{dist → lib}/outline/outlineIcons.js +3 -2
- package/lib/outline/outlineIcons.js.map +1 -0
- package/lib/outline/propertyViews.js +44 -0
- package/lib/outline/propertyViews.js.map +1 -0
- package/lib/outline/propertyViews.test.d.ts +2 -0
- package/lib/outline/propertyViews.test.d.ts.map +1 -0
- package/lib/outline/propertyViews.test.js +27 -0
- package/lib/outline/propertyViews.test.js.map +1 -0
- package/{dist → lib}/outline/queryByExample.js +31 -30
- package/lib/outline/queryByExample.js.map +1 -0
- package/{dist → lib}/outline/userInput.js +260 -262
- package/lib/outline/userInput.js.map +1 -0
- package/lib/outline/viewAsImage.js +17 -0
- package/lib/outline/viewAsImage.js.map +1 -0
- package/{dist → lib}/outline/viewAsMbox.js +14 -4
- package/lib/outline/viewAsMbox.js.map +1 -0
- package/lib/pad/padPane.js +417 -0
- package/lib/pad/padPane.js.map +1 -0
- package/{dist → lib}/playlist/playlistPane.js +37 -36
- package/lib/playlist/playlistPane.js.map +1 -0
- package/{dist → lib}/registerPanes.js +29 -29
- package/lib/registerPanes.js.map +1 -0
- package/lib/schedule/formsForSchedule.js +8 -0
- package/{dist → lib}/schedule/formsForSchedule.js.map +1 -1
- package/{dist → lib}/schedule/schedulePane.js +177 -171
- package/lib/schedule/schedulePane.js.map +1 -0
- package/lib/sharing/sharingPane.js +49 -0
- package/lib/sharing/sharingPane.js.map +1 -0
- package/lib/slideshow/slideshowPane.js +84 -0
- package/lib/slideshow/slideshowPane.js.map +1 -0
- package/{dist → lib}/socialPane.js +142 -141
- package/lib/socialPane.js.map +1 -0
- package/lib/tabbed/tabbedPane.js +72 -0
- package/lib/tabbed/tabbedPane.js.map +1 -0
- package/{dist → lib}/tableViewPane.js +9 -8
- package/lib/tableViewPane.js.map +1 -0
- package/lib/test-import-export/common.js +12 -0
- package/lib/test-import-export/common.js.map +1 -0
- package/lib/test-import-export/edit-importer.js +25 -0
- package/lib/test-import-export/edit-importer.js.map +1 -0
- package/lib/test-import-export/testImportExport.js +2 -0
- package/lib/test-import-export/testImportExport.js.map +1 -0
- package/{dist → lib}/transaction/pane.js +118 -117
- package/lib/transaction/pane.js.map +1 -0
- package/{dist → lib}/transaction/period.js +83 -82
- package/lib/transaction/period.js.map +1 -0
- package/{dist → lib}/trip/tripPane.js +48 -47
- package/lib/trip/tripPane.js.map +1 -0
- package/lib/trustedApplications/trustedApplications.dom.js +177 -0
- package/lib/trustedApplications/trustedApplications.dom.js.map +1 -0
- package/lib/trustedApplications/trustedApplications.test.d.ts +2 -0
- package/lib/trustedApplications/trustedApplications.test.d.ts.map +1 -0
- package/lib/trustedApplications/trustedApplications.test.js +64 -0
- package/lib/trustedApplications/trustedApplications.test.js.map +1 -0
- package/lib/trustedApplications/trustedApplications.utils.js +34 -0
- package/lib/trustedApplications/trustedApplications.utils.js.map +1 -0
- package/lib/trustedApplications/trustedApplications.view.js +87 -0
- package/lib/trustedApplications/trustedApplications.view.js.map +1 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/{dist → lib}/ui/pane.js +31 -30
- package/lib/ui/pane.js.map +1 -0
- package/lib/versionInfo.d.ts +32 -0
- package/lib/versionInfo.d.ts.map +1 -0
- package/lib/versionInfo.js +37 -0
- package/lib/versionInfo.js.map +1 -0
- package/lib/video/videoPane.js +44 -0
- package/lib/video/videoPane.js.map +1 -0
- package/package.json +13 -26
- package/src/RDFXMLPane.js +60 -0
- package/src/argument/argumentPane.js +65 -0
- package/src/argument/argument_icon_v04.jpg +0 -0
- package/src/argument/icon_argument.png +0 -0
- package/src/argument/transparentyingyang.png +0 -0
- package/src/attach/attachPane.js +508 -0
- package/src/attach/tbl-paperclip-128.png +0 -0
- package/src/attach/tbl-paperclip-22.png +0 -0
- package/src/attach/tbl-paperclip-22a.png +0 -0
- package/src/audio/audioPane.js +197 -0
- package/src/chatPreferencesForm.ttl +12 -0
- package/src/classInstancePane.js +110 -0
- package/src/dashboard/basicPreferences.ts +201 -0
- package/src/dashboard/dashboardPane.ts +83 -0
- package/src/dashboard/homepage.ts +72 -0
- package/src/dashboard/languages/codes.html +8611 -0
- package/src/dashboard/languages/codes.xml +3563 -0
- package/src/dashboard/languages/codes2.txt +170 -0
- package/src/dashboard/languages/foo +70 -0
- package/src/dashboard/languages/foo.ttl +0 -0
- package/src/dashboard/languages/get-language-names.sh +12 -0
- package/src/dashboard/ontologyData.ttl +35 -0
- package/src/dashboard/preferencesFormText.ttl +18 -0
- package/src/dataContentPane.js +290 -0
- package/src/defaultPane.js +102 -0
- package/src/dokieli/Makefile +6 -0
- package/src/dokieli/dokieliPane.js +190 -0
- package/src/dokieli/new.html +30 -0
- package/{dist → src}/dokieli/new.js +3 -9
- package/src/form/form-22.png +0 -0
- package/src/form/form-b-22.png +0 -0
- package/src/form/form.graffle +0 -0
- package/src/form/form.png +0 -0
- package/src/form/pane.js +217 -0
- package/src/form/psuedocode-notes.txt +57 -0
- package/src/global.d.ts +4 -0
- package/src/home/homePane.ts +72 -0
- package/src/humanReadablePane.js +150 -0
- package/src/imagePane.js +75 -0
- package/src/index.ts +71 -0
- package/src/internal/internalPane.ts +263 -0
- package/src/mainPage/footer.ts +19 -0
- package/src/mainPage/header.ts +79 -0
- package/src/mainPage/index.ts +20 -0
- package/src/meeting/Makefile +3 -0
- package/src/meeting/test/meeting1/Actions/actions.ttl +14 -0
- package/src/meeting/test/meeting1/Actions/config.ttl +16 -0
- package/src/meeting/test/meeting1/Actions/state.ttl +30 -0
- package/src/meeting/test/meeting1/Schedule/details.ttl +34 -0
- package/src/meeting/test/meeting1/Schedule/details.ttl.acl +20 -0
- package/src/meeting/test/meeting1/Schedule/forms.ttl +75 -0
- package/src/meeting/test/meeting1/Schedule/forms.ttl.acl +20 -0
- package/src/meeting/test/meeting1/Schedule/index.html +72 -0
- package/src/meeting/test/meeting1/Schedule/index.html.acl +20 -0
- package/src/meeting/test/meeting1/Schedule/results.ttl +15 -0
- package/src/meeting/test/meeting1/Schedule/results.ttl.acl +20 -0
- package/src/meeting/test/meeting1/SharedNotes/pad.ttl +23 -0
- package/src/meeting/test/meeting1/chat/chat.ttl +1 -0
- package/src/meeting/test/meeting1/details.ttl +35 -0
- package/src/meeting/test/meeting1/pad/pad.ttl +16 -0
- package/src/microblogPane/mbStyle.css +267 -0
- package/src/microblogPane/microblogPane.js +1412 -0
- package/src/n3Pane.js +56 -0
- package/src/outline/context.ts +21 -0
- package/src/outline/manager.js +2384 -0
- package/src/outline/manager.test.ts +189 -0
- package/src/outline/outlineIcons.js +160 -0
- package/src/outline/propertyViews.test.ts +36 -0
- package/src/outline/propertyViews.ts +37 -0
- package/src/outline/queryByExample.js +296 -0
- package/src/outline/userInput.js +2373 -0
- package/src/outline/viewAsImage.ts +12 -0
- package/src/outline/viewAsMbox.ts +14 -0
- package/src/pad/images/ColourOff.ai +873 -1
- package/src/pad/images/ColourOff.png +0 -0
- package/src/pad/images/ColourOn.ai +934 -2
- package/src/pad/images/ColourOn.png +0 -0
- package/src/pad/padPane.ts +559 -0
- package/src/playlist/playlistPane.js +161 -0
- package/src/registerPanes.js +147 -0
- package/src/schedule/Makefile +6 -0
- package/{dist → src}/schedule/formsForSchedule.js +2 -9
- package/src/schedule/formsForSchedule.ttl +115 -0
- package/src/schedule/schedulePane.js +1201 -0
- package/src/sharing/sharingPane.ts +49 -0
- package/src/slideshow/slideshowPane.js +80 -0
- package/src/socialPane.js +523 -0
- package/src/style/tabbedtab.css +1347 -0
- package/src/tabbed/tabbedPane.ts +60 -0
- package/src/tableViewPane.js +51 -0
- package/src/test-import-export/common.js +6 -0
- package/src/test-import-export/edit-importer.js +20 -0
- package/src/test-import-export/testImportExport.js +0 -0
- package/src/transaction/068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/075988-3d-transparent-glass-icon-business-currency-british-pound-sc35.png +0 -0
- package/src/transaction/22-pixel-068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/pane.js +629 -0
- package/src/transaction/period.js +374 -0
- package/src/transaction/thumbs_075987-3d-transparent-glass-icon-business-creditcard2.png +0 -0
- package/src/transaction/thumbs_075989-3d-transparent-glass-icon-business-currency-cent-sc35.png +0 -0
- package/src/trip/tripPane.js +176 -0
- package/src/trustedApplications/__snapshots__/trustedApplications.test.ts.snap +176 -0
- package/src/trustedApplications/trustedApplications.dom.ts +276 -0
- package/src/trustedApplications/trustedApplications.test.ts +82 -0
- package/src/trustedApplications/trustedApplications.utils.ts +51 -0
- package/src/trustedApplications/trustedApplications.view.ts +80 -0
- package/src/types.ts +34 -0
- package/src/ui/22-builder.png +0 -0
- package/src/ui/builder.graffle +0 -0
- package/src/ui/builder.png +0 -0
- package/src/ui/builder2.png +0 -0
- package/src/ui/pane.js +226 -0
- package/src/versionInfo.ts +30 -0
- package/src/video/videoPane.js +44 -0
- package/timestamp.sh +13 -0
- package/travis/bumpversion.js +29 -0
- package/tsconfig.json +78 -0
- package/typings/raw-loader.d.ts +4 -0
- package/typings/solid-namespace/index.d.ts +9 -0
- package/webpack.config.js +41 -0
- package/dist/RDFXMLPane.js +0 -58
- package/dist/RDFXMLPane.js.map +0 -1
- package/dist/argument/argumentPane.js.map +0 -1
- package/dist/attach/attachPane.js.map +0 -1
- package/dist/audio/audioPane.js.map +0 -1
- package/dist/classInstancePane.js.map +0 -1
- package/dist/dashboard/basicPreferences.js +0 -155
- package/dist/dashboard/basicPreferences.js.map +0 -1
- package/dist/dashboard/dashboardPane.js +0 -63
- package/dist/dashboard/dashboardPane.js.map +0 -1
- package/dist/dashboard/homepage.js +0 -63
- package/dist/dashboard/homepage.js.map +0 -1
- package/dist/dataContentPane.js.map +0 -1
- package/dist/defaultPane.js.map +0 -1
- package/dist/dokieli/dokieliPane.js.map +0 -1
- package/dist/dokieli/new.js.map +0 -1
- package/dist/form/pane.js.map +0 -1
- package/dist/home/homePane.js +0 -68
- package/dist/home/homePane.js.map +0 -1
- package/dist/humanReadablePane.js +0 -135
- package/dist/humanReadablePane.js.map +0 -1
- package/dist/imagePane.js +0 -70
- package/dist/imagePane.js.map +0 -1
- package/dist/index.js +0 -48
- package/dist/index.js.map +0 -1
- package/dist/internal/internalPane.js +0 -195
- package/dist/internal/internalPane.js.map +0 -1
- package/dist/mainPage/footer.js +0 -16
- package/dist/mainPage/footer.js.map +0 -1
- package/dist/mainPage/header.js +0 -84
- package/dist/mainPage/header.js.map +0 -1
- package/dist/mainPage/index.js +0 -30
- package/dist/mainPage/index.js.map +0 -1
- package/dist/microblogPane/microblogPane.js.map +0 -1
- package/dist/n3Pane.js +0 -56
- package/dist/n3Pane.js.map +0 -1
- package/dist/outline/context.js +0 -13
- package/dist/outline/context.js.map +0 -1
- package/dist/outline/manager.js +0 -1997
- package/dist/outline/manager.js.map +0 -1
- package/dist/outline/outlineIcons.js.map +0 -1
- package/dist/outline/propertyViews.js +0 -33
- package/dist/outline/propertyViews.js.map +0 -1
- package/dist/outline/queryByExample.js.map +0 -1
- package/dist/outline/userInput.js.map +0 -1
- package/dist/outline/viewAsImage.js +0 -7
- package/dist/outline/viewAsImage.js.map +0 -1
- package/dist/outline/viewAsMbox.js.map +0 -1
- package/dist/pad/padPane.js +0 -420
- package/dist/pad/padPane.js.map +0 -1
- package/dist/playlist/playlistPane.js.map +0 -1
- package/dist/registerPanes.js.map +0 -1
- package/dist/schedule/schedulePane.js.map +0 -1
- package/dist/sharing/sharingPane.js +0 -45
- package/dist/sharing/sharingPane.js.map +0 -1
- package/dist/slideshow/slideshowPane.js +0 -80
- package/dist/slideshow/slideshowPane.js.map +0 -1
- package/dist/socialPane.js.map +0 -1
- package/dist/tabbed/tabbedPane.js +0 -55
- package/dist/tabbed/tabbedPane.js.map +0 -1
- package/dist/tableViewPane.js.map +0 -1
- package/dist/transaction/pane.js.map +0 -1
- package/dist/transaction/period.js.map +0 -1
- package/dist/trip/tripPane.js.map +0 -1
- package/dist/trustedApplications/trustedApplications.dom.js +0 -158
- package/dist/trustedApplications/trustedApplications.dom.js.map +0 -1
- package/dist/trustedApplications/trustedApplications.utils.js +0 -24
- package/dist/trustedApplications/trustedApplications.utils.js.map +0 -1
- package/dist/trustedApplications/trustedApplications.view.js +0 -62
- package/dist/trustedApplications/trustedApplications.view.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/ui/pane.js.map +0 -1
- package/dist/versionInfo.js +0 -31
- package/dist/versionInfo.js.map +0 -1
- package/dist/video/videoPane.js +0 -43
- package/dist/video/videoPane.js.map +0 -1
- /package/{dist → lib}/dashboard/basicPreferences.d.ts +0 -0
- /package/{dist → lib}/dashboard/basicPreferences.d.ts.map +0 -0
- /package/{dist → lib}/dashboard/dashboardPane.d.ts +0 -0
- /package/{dist → lib}/dashboard/dashboardPane.d.ts.map +0 -0
- /package/{dist → lib}/dashboard/homepage.d.ts +0 -0
- /package/{dist → lib}/dashboard/homepage.d.ts.map +0 -0
- /package/{dist → lib}/home/homePane.d.ts +0 -0
- /package/{dist → lib}/home/homePane.d.ts.map +0 -0
- /package/{dist → lib}/index.d.ts +0 -0
- /package/{dist → lib}/index.d.ts.map +0 -0
- /package/{dist → lib}/internal/internalPane.d.ts +0 -0
- /package/{dist → lib}/internal/internalPane.d.ts.map +0 -0
- /package/{dist → lib}/mainPage/footer.d.ts +0 -0
- /package/{dist → lib}/mainPage/footer.d.ts.map +0 -0
- /package/{dist → lib}/mainPage/header.d.ts +0 -0
- /package/{dist → lib}/mainPage/header.d.ts.map +0 -0
- /package/{dist → lib}/mainPage/index.d.ts +0 -0
- /package/{dist → lib}/outline/context.d.ts +0 -0
- /package/{dist → lib}/outline/context.d.ts.map +0 -0
- /package/{dist → lib}/outline/propertyViews.d.ts +0 -0
- /package/{dist → lib}/outline/propertyViews.d.ts.map +0 -0
- /package/{dist → lib}/outline/viewAsImage.d.ts +0 -0
- /package/{dist → lib}/outline/viewAsImage.d.ts.map +0 -0
- /package/{dist → lib}/outline/viewAsMbox.d.ts +0 -0
- /package/{dist → lib}/outline/viewAsMbox.d.ts.map +0 -0
- /package/{dist → lib}/pad/padPane.d.ts +0 -0
- /package/{dist → lib}/pad/padPane.d.ts.map +0 -0
- /package/{dist → lib}/sharing/sharingPane.d.ts +0 -0
- /package/{dist → lib}/sharing/sharingPane.d.ts.map +0 -0
- /package/{dist → lib}/tabbed/tabbedPane.d.ts +0 -0
- /package/{dist → lib}/tabbed/tabbedPane.d.ts.map +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.dom.d.ts +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.dom.d.ts.map +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.utils.d.ts +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.utils.d.ts.map +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.view.d.ts +0 -0
- /package/{dist → lib}/trustedApplications/trustedApplications.view.d.ts.map +0 -0
- /package/{dist → lib}/types.d.ts +0 -0
- /package/{dist → lib}/types.d.ts.map +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`getStatementsToAdd should return all required statements to add the given permissions for a given origin 1`] = `
|
|
4
|
+
[
|
|
5
|
+
Statement {
|
|
6
|
+
"graph": NamedNode {
|
|
7
|
+
"classOrder": 5,
|
|
8
|
+
"termType": "NamedNode",
|
|
9
|
+
"value": "https://profile.example",
|
|
10
|
+
},
|
|
11
|
+
"object": BlankNode {
|
|
12
|
+
"classOrder": 6,
|
|
13
|
+
"isBlank": 1,
|
|
14
|
+
"isVar": 1,
|
|
15
|
+
"termType": "BlankNode",
|
|
16
|
+
"value": "bn_mock_app_id",
|
|
17
|
+
},
|
|
18
|
+
"predicate": NamedNode {
|
|
19
|
+
"classOrder": 5,
|
|
20
|
+
"termType": "NamedNode",
|
|
21
|
+
"value": "http://www.w3.org/ns/auth/acl#trustedApp",
|
|
22
|
+
},
|
|
23
|
+
"subject": NamedNode {
|
|
24
|
+
"classOrder": 5,
|
|
25
|
+
"termType": "NamedNode",
|
|
26
|
+
"value": "https://profile.example#me",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
Statement {
|
|
30
|
+
"graph": NamedNode {
|
|
31
|
+
"classOrder": 5,
|
|
32
|
+
"termType": "NamedNode",
|
|
33
|
+
"value": "https://profile.example",
|
|
34
|
+
},
|
|
35
|
+
"object": NamedNode {
|
|
36
|
+
"classOrder": 5,
|
|
37
|
+
"termType": "NamedNode",
|
|
38
|
+
"value": "https://origin.example",
|
|
39
|
+
},
|
|
40
|
+
"predicate": NamedNode {
|
|
41
|
+
"classOrder": 5,
|
|
42
|
+
"termType": "NamedNode",
|
|
43
|
+
"value": "http://www.w3.org/ns/auth/acl#origin",
|
|
44
|
+
},
|
|
45
|
+
"subject": BlankNode {
|
|
46
|
+
"classOrder": 6,
|
|
47
|
+
"isBlank": 1,
|
|
48
|
+
"isVar": 1,
|
|
49
|
+
"termType": "BlankNode",
|
|
50
|
+
"value": "bn_mock_app_id",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
Statement {
|
|
54
|
+
"graph": NamedNode {
|
|
55
|
+
"classOrder": 5,
|
|
56
|
+
"termType": "NamedNode",
|
|
57
|
+
"value": "https://profile.example",
|
|
58
|
+
},
|
|
59
|
+
"object": NamedNode {
|
|
60
|
+
"classOrder": 5,
|
|
61
|
+
"termType": "NamedNode",
|
|
62
|
+
"value": "http://www.w3.org/ns/auth/acl#Read",
|
|
63
|
+
},
|
|
64
|
+
"predicate": NamedNode {
|
|
65
|
+
"classOrder": 5,
|
|
66
|
+
"termType": "NamedNode",
|
|
67
|
+
"value": "http://www.w3.org/ns/auth/acl#mode",
|
|
68
|
+
},
|
|
69
|
+
"subject": BlankNode {
|
|
70
|
+
"classOrder": 6,
|
|
71
|
+
"isBlank": 1,
|
|
72
|
+
"isVar": 1,
|
|
73
|
+
"termType": "BlankNode",
|
|
74
|
+
"value": "bn_mock_app_id",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
Statement {
|
|
78
|
+
"graph": NamedNode {
|
|
79
|
+
"classOrder": 5,
|
|
80
|
+
"termType": "NamedNode",
|
|
81
|
+
"value": "https://profile.example",
|
|
82
|
+
},
|
|
83
|
+
"object": NamedNode {
|
|
84
|
+
"classOrder": 5,
|
|
85
|
+
"termType": "NamedNode",
|
|
86
|
+
"value": "http://www.w3.org/ns/auth/acl#Write",
|
|
87
|
+
},
|
|
88
|
+
"predicate": NamedNode {
|
|
89
|
+
"classOrder": 5,
|
|
90
|
+
"termType": "NamedNode",
|
|
91
|
+
"value": "http://www.w3.org/ns/auth/acl#mode",
|
|
92
|
+
},
|
|
93
|
+
"subject": BlankNode {
|
|
94
|
+
"classOrder": 6,
|
|
95
|
+
"isBlank": 1,
|
|
96
|
+
"isVar": 1,
|
|
97
|
+
"termType": "BlankNode",
|
|
98
|
+
"value": "bn_mock_app_id",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
exports[`getStatementsToDelete should return all statements for the given origin 1`] = `
|
|
105
|
+
[
|
|
106
|
+
Statement {
|
|
107
|
+
"graph": DefaultGraph {
|
|
108
|
+
"classOrder": undefined,
|
|
109
|
+
"termType": "DefaultGraph",
|
|
110
|
+
"uri": "chrome:theSession",
|
|
111
|
+
"value": "",
|
|
112
|
+
},
|
|
113
|
+
"object": NamedNode {
|
|
114
|
+
"classOrder": 5,
|
|
115
|
+
"termType": "NamedNode",
|
|
116
|
+
"value": "https://app.example",
|
|
117
|
+
},
|
|
118
|
+
"predicate": NamedNode {
|
|
119
|
+
"classOrder": 5,
|
|
120
|
+
"termType": "NamedNode",
|
|
121
|
+
"value": "http://www.w3.org/ns/auth/acl#trustedApp",
|
|
122
|
+
},
|
|
123
|
+
"subject": NamedNode {
|
|
124
|
+
"classOrder": 5,
|
|
125
|
+
"termType": "NamedNode",
|
|
126
|
+
"value": "https://profile.example#me",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
Statement {
|
|
130
|
+
"graph": DefaultGraph {
|
|
131
|
+
"classOrder": undefined,
|
|
132
|
+
"termType": "DefaultGraph",
|
|
133
|
+
"uri": "chrome:theSession",
|
|
134
|
+
"value": "",
|
|
135
|
+
},
|
|
136
|
+
"object": NamedNode {
|
|
137
|
+
"classOrder": 5,
|
|
138
|
+
"termType": "NamedNode",
|
|
139
|
+
"value": "https://origin.example",
|
|
140
|
+
},
|
|
141
|
+
"predicate": NamedNode {
|
|
142
|
+
"classOrder": 5,
|
|
143
|
+
"termType": "NamedNode",
|
|
144
|
+
"value": "http://www.w3.org/ns/auth/acl#origin",
|
|
145
|
+
},
|
|
146
|
+
"subject": NamedNode {
|
|
147
|
+
"classOrder": 5,
|
|
148
|
+
"termType": "NamedNode",
|
|
149
|
+
"value": "https://app.example",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
Statement {
|
|
153
|
+
"graph": DefaultGraph {
|
|
154
|
+
"classOrder": undefined,
|
|
155
|
+
"termType": "DefaultGraph",
|
|
156
|
+
"uri": "chrome:theSession",
|
|
157
|
+
"value": "",
|
|
158
|
+
},
|
|
159
|
+
"object": NamedNode {
|
|
160
|
+
"classOrder": 5,
|
|
161
|
+
"termType": "NamedNode",
|
|
162
|
+
"value": "http://www.w3.org/ns/auth/acl#Read",
|
|
163
|
+
},
|
|
164
|
+
"predicate": NamedNode {
|
|
165
|
+
"classOrder": 5,
|
|
166
|
+
"termType": "NamedNode",
|
|
167
|
+
"value": "http://www.w3.org/ns/auth/acl#mode",
|
|
168
|
+
},
|
|
169
|
+
"subject": NamedNode {
|
|
170
|
+
"classOrder": 5,
|
|
171
|
+
"termType": "NamedNode",
|
|
172
|
+
"value": "https://app.example",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
]
|
|
176
|
+
`;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { NamedNode, Statement, sym } from 'rdflib'
|
|
2
|
+
import { ns } from 'solid-ui'
|
|
3
|
+
import { store } from 'solid-logic'
|
|
4
|
+
import { generateRandomString, getStatementsToAdd, getStatementsToDelete } from './trustedApplications.utils'
|
|
5
|
+
|
|
6
|
+
interface FormElements {
|
|
7
|
+
modes: HTMLInputElement[]
|
|
8
|
+
// This appears to be used to store either a node from the store,
|
|
9
|
+
// or a reference to the input (checkbox) element for a particular mode.
|
|
10
|
+
// These typings were created post-hoc, so I'm not sure if that was intentional.
|
|
11
|
+
// Thus, this union type should be considered as descriptive rather than prescriptive.
|
|
12
|
+
origin: undefined | NamedNode | HTMLInputElement
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createApplicationTable (subject: NamedNode) {
|
|
16
|
+
const applicationsTable = createElement('table', {
|
|
17
|
+
class: 'results'
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// creating headers
|
|
21
|
+
const header = createContainer('tr', [
|
|
22
|
+
createText('th', 'Application URL'),
|
|
23
|
+
createText('th', 'Access modes'),
|
|
24
|
+
createText('th', 'Actions')
|
|
25
|
+
])
|
|
26
|
+
applicationsTable.appendChild(header);
|
|
27
|
+
|
|
28
|
+
// creating rows
|
|
29
|
+
(store.each(subject, ns.acl('trustedApp'), undefined, undefined) as unknown as Statement[])
|
|
30
|
+
.flatMap(app => store
|
|
31
|
+
.each(app as any, ns.acl('origin'), undefined, undefined)
|
|
32
|
+
.map(origin => ({
|
|
33
|
+
appModes: store.each(app as any, ns.acl('mode'), undefined, undefined) as NamedNode[],
|
|
34
|
+
origin: origin as NamedNode
|
|
35
|
+
})))
|
|
36
|
+
.sort((a: any, b: any) => (a.origin.value < b.origin.value ? -1 : 1))
|
|
37
|
+
.forEach(
|
|
38
|
+
({ appModes, origin }: { appModes: NamedNode[]; origin: NamedNode }) =>
|
|
39
|
+
applicationsTable.appendChild(
|
|
40
|
+
createApplicationEntry(subject, origin, appModes, updateTable)
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// adding a row for new applications
|
|
45
|
+
applicationsTable.appendChild(
|
|
46
|
+
createApplicationEntry(subject, null, [ns.acl('Read')], updateTable)
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return applicationsTable
|
|
50
|
+
|
|
51
|
+
function updateTable () {
|
|
52
|
+
applicationsTable.parentElement!.replaceChild(
|
|
53
|
+
createApplicationTable(subject),
|
|
54
|
+
applicationsTable
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function createApplicationEntry (
|
|
60
|
+
subject: NamedNode,
|
|
61
|
+
origin: NamedNode | null,
|
|
62
|
+
appModes: NamedNode[],
|
|
63
|
+
updateTable: () => void
|
|
64
|
+
): HTMLTableRowElement {
|
|
65
|
+
const trustedApplicationState = {
|
|
66
|
+
origin,
|
|
67
|
+
appModes,
|
|
68
|
+
formElements: {
|
|
69
|
+
modes: [],
|
|
70
|
+
origin: undefined
|
|
71
|
+
} as FormElements
|
|
72
|
+
}
|
|
73
|
+
return createContainer('tr', [
|
|
74
|
+
createContainer('td', [
|
|
75
|
+
createContainer(
|
|
76
|
+
'form',
|
|
77
|
+
[
|
|
78
|
+
createElement(
|
|
79
|
+
'input',
|
|
80
|
+
{
|
|
81
|
+
class: 'textinput',
|
|
82
|
+
placeholder: 'Write new URL here',
|
|
83
|
+
value: origin ? origin.value : ''
|
|
84
|
+
},
|
|
85
|
+
{},
|
|
86
|
+
element => {
|
|
87
|
+
trustedApplicationState.formElements.origin = element
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
],
|
|
91
|
+
{},
|
|
92
|
+
{
|
|
93
|
+
submit: addOrEditApplication
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
]),
|
|
97
|
+
createContainer('td', [
|
|
98
|
+
createContainer(
|
|
99
|
+
'form',
|
|
100
|
+
createModesInput(trustedApplicationState),
|
|
101
|
+
{},
|
|
102
|
+
{
|
|
103
|
+
submit: addOrEditApplication
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
]),
|
|
107
|
+
createContainer('td', [
|
|
108
|
+
createContainer(
|
|
109
|
+
'form',
|
|
110
|
+
origin
|
|
111
|
+
? [
|
|
112
|
+
createText('button', 'Update', {
|
|
113
|
+
class: 'controlButton',
|
|
114
|
+
style: 'background: LightGreen;'
|
|
115
|
+
}),
|
|
116
|
+
createText(
|
|
117
|
+
'button',
|
|
118
|
+
'Delete',
|
|
119
|
+
{
|
|
120
|
+
class: 'controlButton',
|
|
121
|
+
style: 'background: LightCoral;'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
click: removeApplication
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
: [
|
|
129
|
+
createText('button', 'Add', {
|
|
130
|
+
class: 'controlButton',
|
|
131
|
+
style: 'background: LightGreen;'
|
|
132
|
+
})
|
|
133
|
+
],
|
|
134
|
+
{},
|
|
135
|
+
{
|
|
136
|
+
submit: addOrEditApplication
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
])
|
|
140
|
+
])
|
|
141
|
+
|
|
142
|
+
function addOrEditApplication (event: Event) {
|
|
143
|
+
event.preventDefault()
|
|
144
|
+
let origin
|
|
145
|
+
try {
|
|
146
|
+
origin = sym(trustedApplicationState.formElements.origin!.value)
|
|
147
|
+
} catch (err) {
|
|
148
|
+
return alert('Please provide an application URL you want to trust')
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const modes = trustedApplicationState.formElements.modes
|
|
152
|
+
.filter(checkbox => checkbox.checked)
|
|
153
|
+
.map(checkbox => checkbox.value)
|
|
154
|
+
|
|
155
|
+
const deletions = getStatementsToDelete(
|
|
156
|
+
trustedApplicationState.origin || origin,
|
|
157
|
+
subject,
|
|
158
|
+
store,
|
|
159
|
+
ns
|
|
160
|
+
)
|
|
161
|
+
const additions = getStatementsToAdd(
|
|
162
|
+
origin,
|
|
163
|
+
generateRandomString(),
|
|
164
|
+
modes,
|
|
165
|
+
subject,
|
|
166
|
+
ns
|
|
167
|
+
)
|
|
168
|
+
if (!store.updater) {
|
|
169
|
+
throw new Error('Store has no updater')
|
|
170
|
+
}
|
|
171
|
+
store.updater.update(deletions, additions, handleUpdateResponse)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function removeApplication (event: Event) {
|
|
175
|
+
event.preventDefault()
|
|
176
|
+
let origin
|
|
177
|
+
try {
|
|
178
|
+
origin = sym(trustedApplicationState.formElements.origin!.value)
|
|
179
|
+
} catch (err) {
|
|
180
|
+
return alert(
|
|
181
|
+
'Please provide an application URL you want to remove trust from'
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const deletions = getStatementsToDelete(origin, subject, store, ns)
|
|
186
|
+
if (!store.updater) {
|
|
187
|
+
throw new Error('Store has no updater')
|
|
188
|
+
}
|
|
189
|
+
store.updater.update(deletions, [], handleUpdateResponse)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function handleUpdateResponse (uri: any, success: boolean, errorBody: any) {
|
|
193
|
+
if (success) {
|
|
194
|
+
return updateTable()
|
|
195
|
+
}
|
|
196
|
+
console.error(uri, errorBody)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function createElement<K extends keyof globalThis.HTMLElementTagNameMap> (
|
|
201
|
+
elementName: K,
|
|
202
|
+
attributes: { [name: string]: string } = {},
|
|
203
|
+
eventListeners: { [eventName: string]: globalThis.EventListener } = {},
|
|
204
|
+
// eslint-disable-next-line no-unused-vars
|
|
205
|
+
onCreated: null | ((createdElement: globalThis.HTMLElementTagNameMap[K]) => void) = null
|
|
206
|
+
) {
|
|
207
|
+
const element = document.createElement(elementName)
|
|
208
|
+
if (onCreated) {
|
|
209
|
+
onCreated(element)
|
|
210
|
+
}
|
|
211
|
+
Object.keys(attributes).forEach(attName => {
|
|
212
|
+
element.setAttribute(attName, attributes[attName])
|
|
213
|
+
})
|
|
214
|
+
Object.keys(eventListeners).forEach(eventName => {
|
|
215
|
+
element.addEventListener(eventName, eventListeners[eventName])
|
|
216
|
+
})
|
|
217
|
+
return element
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function createContainer<K extends keyof globalThis.HTMLElementTagNameMap> (
|
|
221
|
+
elementName: K,
|
|
222
|
+
children: HTMLElement[],
|
|
223
|
+
attributes = {},
|
|
224
|
+
eventListeners = {},
|
|
225
|
+
onCreated = null
|
|
226
|
+
) {
|
|
227
|
+
const element = createElement(
|
|
228
|
+
elementName,
|
|
229
|
+
attributes,
|
|
230
|
+
eventListeners,
|
|
231
|
+
onCreated
|
|
232
|
+
)
|
|
233
|
+
children.forEach(child => element.appendChild(child))
|
|
234
|
+
return element
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function createText<K extends keyof globalThis.HTMLElementTagNameMap> (
|
|
238
|
+
elementName: K,
|
|
239
|
+
textContent: string | null,
|
|
240
|
+
attributes = {},
|
|
241
|
+
eventListeners = {},
|
|
242
|
+
onCreated = null
|
|
243
|
+
) {
|
|
244
|
+
const element = createElement(
|
|
245
|
+
elementName,
|
|
246
|
+
attributes,
|
|
247
|
+
eventListeners,
|
|
248
|
+
onCreated
|
|
249
|
+
)
|
|
250
|
+
element.textContent = textContent
|
|
251
|
+
return element
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function createModesInput ({ appModes, formElements }: {
|
|
255
|
+
appModes: NamedNode[]
|
|
256
|
+
formElements: FormElements
|
|
257
|
+
}) {
|
|
258
|
+
return ['Read', 'Write', 'Append', 'Control'].map(mode => {
|
|
259
|
+
const isChecked = appModes.some(
|
|
260
|
+
appMode => appMode.value === ns.acl(mode).value
|
|
261
|
+
)
|
|
262
|
+
return createContainer('label', [
|
|
263
|
+
createElement(
|
|
264
|
+
'input',
|
|
265
|
+
{
|
|
266
|
+
type: 'checkbox',
|
|
267
|
+
...(isChecked ? { checked: '' } : {}),
|
|
268
|
+
value: ns.acl(mode).uri
|
|
269
|
+
},
|
|
270
|
+
{},
|
|
271
|
+
element => formElements.modes.push(element)
|
|
272
|
+
),
|
|
273
|
+
createText('span', mode)
|
|
274
|
+
])
|
|
275
|
+
})
|
|
276
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* eslint-env jest */
|
|
2
|
+
import { TextEncoder, TextDecoder } from 'util'
|
|
3
|
+
global.TextEncoder = TextEncoder as any
|
|
4
|
+
global.TextDecoder = TextDecoder as any
|
|
5
|
+
|
|
6
|
+
import * as $rdf from 'rdflib'
|
|
7
|
+
import solidNamespace from 'solid-namespace'
|
|
8
|
+
import { generateRandomString, getStatementsToDelete, getStatementsToAdd } from './trustedApplications.utils'
|
|
9
|
+
|
|
10
|
+
const ns = solidNamespace($rdf)
|
|
11
|
+
|
|
12
|
+
describe('generateRandomString', () => {
|
|
13
|
+
it('generates a random string five characters long', () => {
|
|
14
|
+
expect(generateRandomString().length).toBe(5)
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('getStatementsToDelete', () => {
|
|
19
|
+
it('should return an empty array when there are no statements', () => {
|
|
20
|
+
const mockStore = $rdf.graph()
|
|
21
|
+
const mockOrigin = $rdf.sym('https://origin.example')
|
|
22
|
+
const mockProfile = $rdf.sym('https://profile.example#me')
|
|
23
|
+
expect(
|
|
24
|
+
getStatementsToDelete(mockOrigin, mockProfile, mockStore, ns)
|
|
25
|
+
).toEqual([])
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('should return all statements for the given origin', () => {
|
|
29
|
+
const mockStore = $rdf.graph()
|
|
30
|
+
const mockApplication = $rdf.sym('https://app.example')
|
|
31
|
+
const mockOrigin = $rdf.sym('https://origin.example')
|
|
32
|
+
const mockProfile = $rdf.sym('https://profile.example#me')
|
|
33
|
+
mockStore.add(mockApplication, ns.acl('origin'), mockOrigin)
|
|
34
|
+
mockStore.add(mockApplication, ns.acl('mode'), ns.acl('Read'))
|
|
35
|
+
mockStore.add(mockProfile, ns.acl('trustedApp'), mockApplication)
|
|
36
|
+
const statementsToDelete = getStatementsToDelete(
|
|
37
|
+
mockOrigin,
|
|
38
|
+
mockProfile,
|
|
39
|
+
mockStore,
|
|
40
|
+
ns
|
|
41
|
+
)
|
|
42
|
+
expect(statementsToDelete.length).toBe(3)
|
|
43
|
+
expect(statementsToDelete).toMatchSnapshot()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('should not return statements for a different origin', () => {
|
|
47
|
+
const mockStore = $rdf.graph()
|
|
48
|
+
const mockApplication = $rdf.sym('https://app.example')
|
|
49
|
+
const mockOrigin = $rdf.sym('https://origin.example')
|
|
50
|
+
const mockProfile = $rdf.sym('https://profile.example#me')
|
|
51
|
+
mockStore.add(mockApplication, ns.acl('origin'), mockOrigin)
|
|
52
|
+
mockStore.add(mockApplication, ns.acl('mode'), ns.acl('Read'))
|
|
53
|
+
mockStore.add(mockProfile, ns.acl('trustedApp'), mockApplication)
|
|
54
|
+
|
|
55
|
+
const statementsToDelete = getStatementsToDelete(
|
|
56
|
+
$rdf.lit('A different origin'), // @@ TODO Remove casting
|
|
57
|
+
mockProfile,
|
|
58
|
+
mockStore,
|
|
59
|
+
ns
|
|
60
|
+
)
|
|
61
|
+
expect(statementsToDelete.length).toBe(0)
|
|
62
|
+
expect(statementsToDelete).toEqual([])
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
describe('getStatementsToAdd', () => {
|
|
67
|
+
it('should return all required statements to add the given permissions for a given origin', () => {
|
|
68
|
+
const mockOrigin = $rdf.sym('https://origin.example')
|
|
69
|
+
const mockProfile = $rdf.sym('https://profile.example#me')
|
|
70
|
+
const modes = [ns.acl('Read').value, ns.acl('Write').value]
|
|
71
|
+
|
|
72
|
+
const statementsToAdd = getStatementsToAdd(
|
|
73
|
+
mockOrigin,
|
|
74
|
+
'mock_app_id',
|
|
75
|
+
modes,
|
|
76
|
+
mockProfile,
|
|
77
|
+
ns
|
|
78
|
+
)
|
|
79
|
+
expect(statementsToAdd.length).toBe(4)
|
|
80
|
+
expect(statementsToAdd).toMatchSnapshot()
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BlankNode, IndexedFormula, NamedNode, st, Literal, sym, Statement } from 'rdflib'
|
|
2
|
+
import { Namespaces } from 'solid-namespace'
|
|
3
|
+
|
|
4
|
+
export function getStatementsToDelete (
|
|
5
|
+
origin: NamedNode | Literal,
|
|
6
|
+
person: NamedNode,
|
|
7
|
+
kb: IndexedFormula,
|
|
8
|
+
ns: Namespaces
|
|
9
|
+
): any {
|
|
10
|
+
const applicationStatements = kb.statementsMatching(
|
|
11
|
+
null,
|
|
12
|
+
ns.acl('origin'),
|
|
13
|
+
origin
|
|
14
|
+
)
|
|
15
|
+
const statementsToDelete = applicationStatements.reduce(
|
|
16
|
+
(memo, st) => {
|
|
17
|
+
return memo
|
|
18
|
+
.concat(
|
|
19
|
+
kb.statementsMatching(
|
|
20
|
+
person,
|
|
21
|
+
ns.acl('trustedApp'),
|
|
22
|
+
st.subject as NamedNode
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
.concat(kb.statementsMatching(st.subject))
|
|
26
|
+
},
|
|
27
|
+
[] as Array<Statement>
|
|
28
|
+
)
|
|
29
|
+
return statementsToDelete
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getStatementsToAdd (
|
|
33
|
+
origin: NamedNode,
|
|
34
|
+
nodeName: string,
|
|
35
|
+
modes: string[],
|
|
36
|
+
person: NamedNode,
|
|
37
|
+
ns: Namespaces
|
|
38
|
+
): any {
|
|
39
|
+
const application = new BlankNode(`bn_${nodeName}`) // NamedNode(`${person.doc().uri}#${nodeName}`)
|
|
40
|
+
return [
|
|
41
|
+
st(person, ns.acl('trustedApp'), application, person.doc()),
|
|
42
|
+
st(application, ns.acl('origin'), origin, person.doc()),
|
|
43
|
+
...modes
|
|
44
|
+
.map(mode => sym(mode))
|
|
45
|
+
.map(mode => st(application, ns.acl('mode'), mode, person.doc()))
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function generateRandomString () {
|
|
50
|
+
return Math.random().toString(36).substr(2, 5)
|
|
51
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { PaneDefinition } from 'pane-registry'
|
|
2
|
+
import { NamedNode } from 'rdflib'
|
|
3
|
+
import { icons, login, widgets } from 'solid-ui'
|
|
4
|
+
import { store } from 'solid-logic'
|
|
5
|
+
import { createApplicationTable, createContainer, createText } from './trustedApplications.dom'
|
|
6
|
+
|
|
7
|
+
const thisColor = '#418d99'
|
|
8
|
+
|
|
9
|
+
const trustedApplicationView: PaneDefinition = {
|
|
10
|
+
global: true,
|
|
11
|
+
icon: `${icons.iconBase}noun_15177.svg`,
|
|
12
|
+
name: 'trustedApplications',
|
|
13
|
+
label: () => null,
|
|
14
|
+
render: (subject, context) => {
|
|
15
|
+
const dom = context.dom
|
|
16
|
+
const div = dom.createElement('div')
|
|
17
|
+
div.classList.add('trusted-applications-pane')
|
|
18
|
+
div.setAttribute(
|
|
19
|
+
'style',
|
|
20
|
+
'border: 0.3em solid ' +
|
|
21
|
+
thisColor +
|
|
22
|
+
'; border-radius: 0.5em; padding: 0.7em; margin-top:0.7em;'
|
|
23
|
+
)
|
|
24
|
+
const table = div.appendChild(dom.createElement('table'))
|
|
25
|
+
const main = table.appendChild(dom.createElement('tr'))
|
|
26
|
+
const bottom = table.appendChild(dom.createElement('tr'))
|
|
27
|
+
const statusArea = bottom.appendChild(dom.createElement('div'))
|
|
28
|
+
statusArea.setAttribute('style', 'padding: 0.7em;')
|
|
29
|
+
render(dom, main, statusArea).catch(err => statusArea.appendChild(widgets.errorMessageBlock(dom, err)))
|
|
30
|
+
return div
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function render (dom, main, statusArea): Promise<void> {
|
|
35
|
+
const authContext = await login.ensureLoadedProfile({ dom: dom, div: main, statusArea: statusArea, me: null })
|
|
36
|
+
const subject = authContext.me as NamedNode
|
|
37
|
+
|
|
38
|
+
const profile = subject.doc()
|
|
39
|
+
if (!store.updater) {
|
|
40
|
+
throw new Error('Store has no updater')
|
|
41
|
+
}
|
|
42
|
+
const editable = store.updater.editable(profile.uri, store)
|
|
43
|
+
|
|
44
|
+
main.appendChild(createText('h3', 'Manage your trusted applications'))
|
|
45
|
+
|
|
46
|
+
if (!editable) {
|
|
47
|
+
main.appendChild(
|
|
48
|
+
widgets.errorMessageBlock(dom, `Your profile ${subject.doc().uri} is not editable, so we cannot do much here.`)
|
|
49
|
+
)
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
main.appendChild(createText('p', 'Here you can manage the applications you trust.'))
|
|
54
|
+
|
|
55
|
+
const applicationsTable = createApplicationTable(subject)
|
|
56
|
+
main.appendChild(applicationsTable)
|
|
57
|
+
|
|
58
|
+
main.appendChild(createText('h4', 'Notes'))
|
|
59
|
+
main.appendChild(
|
|
60
|
+
createContainer('ol', [
|
|
61
|
+
main.appendChild(
|
|
62
|
+
createText(
|
|
63
|
+
'li',
|
|
64
|
+
'Trusted applications will get access to all resources that you have access to.'
|
|
65
|
+
)
|
|
66
|
+
),
|
|
67
|
+
main.appendChild(
|
|
68
|
+
createText('li', 'You can limit which modes they have by default.')
|
|
69
|
+
),
|
|
70
|
+
main.appendChild(
|
|
71
|
+
createText('li', 'They will not gain more access than you have.')
|
|
72
|
+
)
|
|
73
|
+
])
|
|
74
|
+
)
|
|
75
|
+
main.appendChild(
|
|
76
|
+
createText('p', 'Application URLs must be valid URL. Examples are http://localhost:3000, https://trusted.app, and https://sub.trusted.app.')
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default trustedApplicationView
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface SolidAuthorization {
|
|
2
|
+
|
|
3
|
+
access_token: string
|
|
4
|
+
|
|
5
|
+
client_id: string
|
|
6
|
+
|
|
7
|
+
id_token: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface SolidClaim {
|
|
11
|
+
|
|
12
|
+
at_hash: string
|
|
13
|
+
aud: string
|
|
14
|
+
azp: string
|
|
15
|
+
cnf: {
|
|
16
|
+
jwk: string
|
|
17
|
+
}
|
|
18
|
+
exp: number
|
|
19
|
+
iat: number
|
|
20
|
+
iss: string
|
|
21
|
+
jti: string
|
|
22
|
+
nonce: string
|
|
23
|
+
sub: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SolidSession {
|
|
27
|
+
authorization: SolidAuthorization
|
|
28
|
+
credentialType: string
|
|
29
|
+
idClaims: SolidClaim
|
|
30
|
+
idp: string
|
|
31
|
+
issuer: string
|
|
32
|
+
sessionKey: string
|
|
33
|
+
webId: string
|
|
34
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|