contacts-pane 2.6.0-71f11b5c → 2.6.0-e4525047
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/.github/workflows/ci.yml +4 -3
- package/contactLogic.js +2 -1
- package/contactsPane.js +11 -10
- package/groupMembershipControl.js +0 -1
- package/individual.js +3 -2
- package/lib/autocompleteBar.js +5 -5
- package/lib/autocompleteField.js +3 -3
- package/lib/autocompletePicker.js +3 -8
- package/lib/publicData.js +5 -5
- package/mintNewAddressBook.js +4 -4
- package/mugshotGallery.js +5 -3
- package/package.json +4 -3
- package/src/autocompleteBar.ts +6 -8
- package/src/autocompleteField.ts +3 -9
- package/src/autocompletePicker.ts +8 -8
- package/src/publicData.ts +7 -9
- package/toolsPane.js +4 -3
- package/webidControl.js +2 -1
package/.github/workflows/ci.yml
CHANGED
|
@@ -3,10 +3,11 @@ name: CI
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "**"
|
|
7
7
|
pull_request:
|
|
8
8
|
branches:
|
|
9
|
-
-
|
|
9
|
+
- "**"
|
|
10
|
+
workflow_dispatch:
|
|
10
11
|
|
|
11
12
|
jobs:
|
|
12
13
|
test:
|
|
@@ -16,7 +17,7 @@ jobs:
|
|
|
16
17
|
node-version:
|
|
17
18
|
- 12.x
|
|
18
19
|
- 14.x
|
|
19
|
-
-
|
|
20
|
+
- 16.x
|
|
20
21
|
steps:
|
|
21
22
|
- uses: actions/checkout@v2
|
|
22
23
|
- name: Use Node.js ${{ matrix.node-version }}
|
package/contactLogic.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Logic for solid contacts
|
|
2
2
|
|
|
3
3
|
import * as UI from 'solid-ui'
|
|
4
|
+
import { store } from 'solid-logic'
|
|
4
5
|
import { getPersonas } from './webidControl'
|
|
5
6
|
|
|
6
7
|
const ns = UI.ns
|
|
7
8
|
const $rdf = UI.rdf
|
|
8
9
|
const utils = UI.utils
|
|
9
|
-
const kb =
|
|
10
|
+
const kb = store
|
|
10
11
|
const updater = kb.updater
|
|
11
12
|
|
|
12
13
|
/** Perform updates on more than one document @@ Move to rdflib!
|
package/contactsPane.js
CHANGED
|
@@ -14,11 +14,12 @@ to change its state according to an ontology, comment on it, etc.
|
|
|
14
14
|
*/
|
|
15
15
|
/* global alert, confirm */
|
|
16
16
|
|
|
17
|
+
import { authn } from 'solid-logic'
|
|
18
|
+
import { addPersonToGroup, saveNewContact, saveNewGroup } from './contactLogic'
|
|
17
19
|
import * as UI from 'solid-ui'
|
|
18
|
-
import { toolsPane } from './toolsPane'
|
|
19
20
|
import { mintNewAddressBook } from './mintNewAddressBook'
|
|
20
21
|
import { renderIndividual } from './individual'
|
|
21
|
-
import {
|
|
22
|
+
import { toolsPane } from './toolsPane'
|
|
22
23
|
|
|
23
24
|
// const $rdf = UI.rdf
|
|
24
25
|
const ns = UI.ns
|
|
@@ -63,7 +64,7 @@ export default {
|
|
|
63
64
|
|
|
64
65
|
// Reproduction: Spawn a new instance of this app
|
|
65
66
|
function newAddressBookButton (thisAddressBook) {
|
|
66
|
-
return UI.
|
|
67
|
+
return UI.login.newAppInstance(
|
|
67
68
|
dom,
|
|
68
69
|
{ noun: 'address book', appPathSegment: 'contactorator.timbl.com' },
|
|
69
70
|
function (ws, newBase) {
|
|
@@ -79,7 +80,7 @@ export default {
|
|
|
79
80
|
const dom = dataBrowserContext.dom
|
|
80
81
|
const kb = dataBrowserContext.session.store
|
|
81
82
|
const div = dom.createElement('div')
|
|
82
|
-
const me =
|
|
83
|
+
const me = authn.currentUser() // If already logged on
|
|
83
84
|
|
|
84
85
|
UI.aclControl.preventBrowserDropEvents(dom) // protect drag and drop
|
|
85
86
|
|
|
@@ -96,7 +97,7 @@ export default {
|
|
|
96
97
|
|
|
97
98
|
const t = kb.findTypeURIs(subject)
|
|
98
99
|
|
|
99
|
-
let me =
|
|
100
|
+
let me = authn.currentUser()
|
|
100
101
|
|
|
101
102
|
const context = {
|
|
102
103
|
target: subject,
|
|
@@ -777,7 +778,7 @@ export default {
|
|
|
777
778
|
const container = dom.createElement('div')
|
|
778
779
|
newContactButton.setAttribute('type', 'button')
|
|
779
780
|
if (!me) newContactButton.setAttribute('disabled', 'true')
|
|
780
|
-
|
|
781
|
+
authn.checkUser().then(webId => {
|
|
781
782
|
if (webId) {
|
|
782
783
|
me = webId
|
|
783
784
|
newContactButton.removeAttribute('disabled')
|
|
@@ -793,7 +794,7 @@ export default {
|
|
|
793
794
|
const container2 = dom.createElement('div')
|
|
794
795
|
newOrganizationButton.setAttribute('type', 'button')
|
|
795
796
|
if (!me) newOrganizationButton.setAttribute('disabled', 'true')
|
|
796
|
-
|
|
797
|
+
authn.checkUser().then(webId => {
|
|
797
798
|
if (webId) {
|
|
798
799
|
me = webId
|
|
799
800
|
newOrganizationButton.removeAttribute('disabled')
|
|
@@ -860,7 +861,7 @@ export default {
|
|
|
860
861
|
// Render a Group instance
|
|
861
862
|
} else if (t[ns.vcard('Group').uri]) {
|
|
862
863
|
// If we have a main address book, then render this group as a guest group within it
|
|
863
|
-
UI.
|
|
864
|
+
UI.login
|
|
864
865
|
.findAppInstances(context, ns.vcard('AddressBook'))
|
|
865
866
|
.then(function (context) {
|
|
866
867
|
const addressBooks = context.instances
|
|
@@ -888,12 +889,12 @@ export default {
|
|
|
888
889
|
)
|
|
889
890
|
}
|
|
890
891
|
|
|
891
|
-
me =
|
|
892
|
+
me = authn.currentUser()
|
|
892
893
|
if (!me) {
|
|
893
894
|
console.log(
|
|
894
895
|
'(You do not have your Web Id set. Sign in or sign up to make changes.)'
|
|
895
896
|
)
|
|
896
|
-
UI.
|
|
897
|
+
UI.login.ensureLoadedProfile(context).then(
|
|
897
898
|
context => {
|
|
898
899
|
console.log('Logged in as ' + context.me)
|
|
899
900
|
me = context.me
|
package/individual.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as UI from 'solid-ui'
|
|
2
|
+
import { authn, store } from 'solid-logic'
|
|
2
3
|
import { renderMugshotGallery } from './mugshotGallery'
|
|
3
4
|
import { renderWebIdControl, renderPublicIdControl } from './webidControl'
|
|
4
5
|
import { renderGroupMemberships } from './groupMembershipControl.js'
|
|
@@ -7,7 +8,7 @@ import VCARD_ONTOLOGY_TEXT from './lib/vcard.js'
|
|
|
7
8
|
|
|
8
9
|
const $rdf = UI.rdf
|
|
9
10
|
const ns = UI.ns
|
|
10
|
-
const kb =
|
|
11
|
+
const kb = store
|
|
11
12
|
const style = UI.style
|
|
12
13
|
|
|
13
14
|
export function loadTurtleText (kb, thing, text) {
|
|
@@ -68,7 +69,7 @@ export async function renderIndividual (dom, div, subject, dataBrowserContext) {
|
|
|
68
69
|
|
|
69
70
|
div.style = style.paneDivStyle || 'padding: 0.5em 1.5em 1em 1.5em;'
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
authn.checkUser() // kick off async operation @@@ use async version
|
|
72
73
|
|
|
73
74
|
div.appendChild(renderMugshotGallery(dom, subject))
|
|
74
75
|
|
package/lib/autocompleteBar.js
CHANGED
|
@@ -38,16 +38,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
};
|
|
39
39
|
exports.__esModule = true;
|
|
40
40
|
exports.renderAutocompleteControl = void 0;
|
|
41
|
+
var solid_logic_1 = require("solid-logic");
|
|
41
42
|
var solid_ui_1 = require("solid-ui");
|
|
42
|
-
var UI = require("solid-ui");
|
|
43
43
|
var autocompletePicker_1 = require("./autocompletePicker"); // dbpediaParameters
|
|
44
44
|
var publicData_1 = require("./publicData");
|
|
45
45
|
var WEBID_NOUN = 'Solid ID';
|
|
46
|
-
var kb =
|
|
46
|
+
var kb = solid_logic_1.store;
|
|
47
47
|
var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
|
|
48
48
|
var AUTOCOMPLETE_ROWS = 12; // 20?
|
|
49
|
-
var GREEN_PLUS =
|
|
50
|
-
var SEARCH_ICON =
|
|
49
|
+
var GREEN_PLUS = solid_ui_1.icons.iconBase + 'noun_34653_green.svg';
|
|
50
|
+
var SEARCH_ICON = solid_ui_1.icons.iconBase + 'noun_Search_875351.svg';
|
|
51
51
|
function renderAutocompleteControl(dom, person, options, addOneIdAndRefresh) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
53
|
function autoCompleteDone(object, _name) {
|
|
@@ -65,7 +65,7 @@ function renderAutocompleteControl(dom, person, options, addOneIdAndRefresh) {
|
|
|
65
65
|
var webid;
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
67
|
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, solid_ui_1.widgets.askName(dom,
|
|
68
|
+
case 0: return [4 /*yield*/, solid_ui_1.widgets.askName(dom, solid_logic_1.store, creationArea, solid_ui_1.ns.vcard('url'), null, WEBID_NOUN)];
|
|
69
69
|
case 1:
|
|
70
70
|
webid = _a.sent();
|
|
71
71
|
if (!webid) {
|
package/lib/autocompleteField.js
CHANGED
|
@@ -39,10 +39,10 @@ exports.__esModule = true;
|
|
|
39
39
|
exports.autocompleteField = void 0;
|
|
40
40
|
/* Form field for doing autocompleete
|
|
41
41
|
*/
|
|
42
|
+
var rdflib_1 = require("rdflib");
|
|
43
|
+
var solid_logic_1 = require("solid-logic");
|
|
42
44
|
var solid_ui_1 = require("solid-ui");
|
|
43
45
|
var autocompletePicker_1 = require("./autocompletePicker"); // dbpediaParameters
|
|
44
|
-
var rdflib_1 = require("rdflib");
|
|
45
|
-
var kb = solid_ui_1.store;
|
|
46
46
|
var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
|
|
47
47
|
var AUTOCOMPLETE_ROWS = 12; // 20?
|
|
48
48
|
/**
|
|
@@ -97,7 +97,7 @@ dom, container, already, subject, form, doc, callbackFunction) {
|
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
var kb =
|
|
100
|
+
var kb = solid_logic_1.store;
|
|
101
101
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
102
102
|
var box = dom.createElement('tr');
|
|
103
103
|
if (container)
|
|
@@ -37,14 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
exports.__esModule = true;
|
|
39
39
|
exports.renderAutoComplete = void 0;
|
|
40
|
-
|
|
41
|
-
**
|
|
42
|
-
** organization conveys many distinct types of thing.
|
|
43
|
-
**
|
|
44
|
-
*/
|
|
40
|
+
var solid_logic_1 = require("solid-logic");
|
|
45
41
|
var solid_ui_1 = require("solid-ui");
|
|
46
42
|
var publicData_1 = require("./publicData");
|
|
47
|
-
var kb = solid_ui_1.store;
|
|
48
43
|
var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
|
|
49
44
|
var AUTOCOMPLETE_ROWS = 20; // 20?
|
|
50
45
|
var AUTOCOMPLETE_ROWS_STRETCH = 40;
|
|
@@ -147,7 +142,7 @@ callback) {
|
|
|
147
142
|
}
|
|
148
143
|
if (hits == 1) { // Maybe require green confirmation button be clicked?
|
|
149
144
|
console.log(" auto complete elimination: \"".concat(filter, "\" -> \"").concat(pickedName, "\""));
|
|
150
|
-
gotIt(
|
|
145
|
+
gotIt(solid_logic_1.store.sym(pick), pickedName); // uri, name
|
|
151
146
|
}
|
|
152
147
|
}
|
|
153
148
|
function clearList() {
|
|
@@ -236,7 +231,7 @@ callback) {
|
|
|
236
231
|
return __generator(this, function (_a) {
|
|
237
232
|
console.log(' click row textContent: ' + row.textContent);
|
|
238
233
|
console.log(' click name: ' + name);
|
|
239
|
-
gotIt(
|
|
234
|
+
gotIt(solid_logic_1.store.sym(uri), name);
|
|
240
235
|
return [2 /*return*/];
|
|
241
236
|
});
|
|
242
237
|
}); });
|
package/lib/publicData.js
CHANGED
|
@@ -42,9 +42,9 @@ exports.getDbpediaDetails = exports.getWikidataLocation = exports.getWikidataDet
|
|
|
42
42
|
* including filtering resut by natural language etc
|
|
43
43
|
*/
|
|
44
44
|
var rdflib_1 = require("rdflib");
|
|
45
|
+
var solid_logic_1 = require("solid-logic");
|
|
45
46
|
var solid_ui_1 = require("solid-ui");
|
|
46
47
|
var instituteDetailsQuery = require("../lib/instituteDetailsQuery.js");
|
|
47
|
-
var kb = solid_ui_1.store;
|
|
48
48
|
exports.AUTOCOMPLETE_LIMIT = 3000; // How many to get from server
|
|
49
49
|
var subjectRegexp = /\$\(subject\)/g;
|
|
50
50
|
// Schema.org seems to suggest NGOs are non-profit and Corporaions are for-profit
|
|
@@ -220,7 +220,7 @@ function queryESCODataByName(filter, theClass, queryTarget) {
|
|
|
220
220
|
headers: { 'Accept': 'application/json' }
|
|
221
221
|
} // CORS
|
|
222
222
|
;
|
|
223
|
-
return [4 /*yield*/,
|
|
223
|
+
return [4 /*yield*/, solid_logic_1.store.fetcher.webOperation('GET', queryURI, options)
|
|
224
224
|
//complain('Error querying db of organizations: ' + err)
|
|
225
225
|
];
|
|
226
226
|
case 1:
|
|
@@ -276,7 +276,7 @@ function queryPublicDataSelect(sparql, queryTarget) {
|
|
|
276
276
|
headers: { 'Accept': 'application/json' }
|
|
277
277
|
} // CORS
|
|
278
278
|
;
|
|
279
|
-
return [4 /*yield*/,
|
|
279
|
+
return [4 /*yield*/, solid_logic_1.store.fetcher.webOperation('GET', queryURI, options)
|
|
280
280
|
//complain('Error querying db of organizations: ' + err)
|
|
281
281
|
];
|
|
282
282
|
case 1:
|
|
@@ -308,7 +308,7 @@ function queryPublicDataConstruct(sparql, pubicId, queryTarget) {
|
|
|
308
308
|
options = { credentials: 'omit',
|
|
309
309
|
headers: { 'Accept': 'text/turtle' }
|
|
310
310
|
};
|
|
311
|
-
return [4 /*yield*/,
|
|
311
|
+
return [4 /*yield*/, solid_logic_1.store.fetcher.webOperation('GET', queryURI, options)];
|
|
312
312
|
case 1:
|
|
313
313
|
response = _a.sent();
|
|
314
314
|
text = response.responseText;
|
|
@@ -316,7 +316,7 @@ function queryPublicDataConstruct(sparql, pubicId, queryTarget) {
|
|
|
316
316
|
console.log(' queryPublicDataConstruct result text:' + report);
|
|
317
317
|
if (text.length === 0)
|
|
318
318
|
throw new Error('queryPublicDataConstruct: No text back from construct query:' + queryURI);
|
|
319
|
-
(0, rdflib_1.parse)(text,
|
|
319
|
+
(0, rdflib_1.parse)(text, solid_logic_1.store, pubicId.uri, 'text/turtle');
|
|
320
320
|
return [2 /*return*/];
|
|
321
321
|
}
|
|
322
322
|
});
|
package/mintNewAddressBook.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import * as UI from 'solid-ui'
|
|
2
|
+
import { setACLUserPublic } from 'solid-logic'
|
|
2
3
|
|
|
3
4
|
// const mime = require('mime-types')
|
|
4
5
|
// const toolsPane0 = require('./toolsPane')
|
|
@@ -12,7 +13,7 @@ const $rdf = UI.rdf
|
|
|
12
13
|
|
|
13
14
|
export function mintNewAddressBook (dataBrowserContext, context) {
|
|
14
15
|
return new Promise(function (resolve, reject) {
|
|
15
|
-
UI.
|
|
16
|
+
UI.login.ensureLoadedProfile(context).then(
|
|
16
17
|
context => {
|
|
17
18
|
// 20180713
|
|
18
19
|
console.log('Logged in as ' + context.me)
|
|
@@ -120,8 +121,7 @@ export function mintNewAddressBook (dataBrowserContext, context) {
|
|
|
120
121
|
return reject(new Error('Error writing new file ' + task.to))
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
.setACLUserPublic(dest, me, aclOptions)
|
|
124
|
+
setACLUserPublic(dest, me, aclOptions)
|
|
125
125
|
.then(() => doNextTask())
|
|
126
126
|
.catch(err => {
|
|
127
127
|
const message =
|
package/mugshotGallery.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as UI from 'solid-ui'
|
|
2
|
+
import { store } from 'solid-logic'
|
|
2
3
|
import * as mime from 'mime-types'
|
|
3
4
|
|
|
4
5
|
const $rdf = UI.rdf
|
|
5
6
|
const ns = UI.ns
|
|
6
7
|
const utils = UI.utils
|
|
7
|
-
const kb =
|
|
8
|
+
const kb = store
|
|
8
9
|
|
|
9
10
|
/* Mugshot Gallery
|
|
10
11
|
*
|
|
@@ -116,7 +117,7 @@ export function renderMugshotGallery (dom, subject) {
|
|
|
116
117
|
// When a set of URIs are dropped on
|
|
117
118
|
async function handleURIsDroppedOnMugshot (uris) {
|
|
118
119
|
for (const u of uris) {
|
|
119
|
-
|
|
120
|
+
let thing = $rdf.sym(u) // Attachment needs text label to disinguish I think not icon.
|
|
120
121
|
console.log('Dropped on mugshot thing ' + thing) // icon was: UI.icons.iconBase + 'noun_25830.svg'
|
|
121
122
|
if (u.startsWith('http') && u.indexOf('#') < 0) {
|
|
122
123
|
// Plain document
|
|
@@ -125,8 +126,9 @@ export function renderMugshotGallery (dom, subject) {
|
|
|
125
126
|
thing = $rdf.sym('https:' + u.slice(5))
|
|
126
127
|
}
|
|
127
128
|
const options = { withCredentials: false, credentials: 'omit' }
|
|
129
|
+
let result
|
|
128
130
|
try {
|
|
129
|
-
|
|
131
|
+
result = await kb.fetcher.webOperation('GET', thing.uri, options)
|
|
130
132
|
} catch (err) {
|
|
131
133
|
complain(
|
|
132
134
|
`Gallery: fetch error trying to read picture ${thing} data: ${err}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contacts-pane",
|
|
3
|
-
"version": "2.6.0-
|
|
3
|
+
"version": "2.6.0-e4525047",
|
|
4
4
|
"description": "Contacts Pane: Contacts manager for Address Book, Groups, and Individuals.",
|
|
5
5
|
"main": "./contactsPane.js",
|
|
6
6
|
"scripts": {
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/solid/contacts-pane",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"pane-registry": "
|
|
40
|
+
"pane-registry": "2.4.6-0a456338",
|
|
41
41
|
"rdflib": "^2.2.17",
|
|
42
|
-
"solid-
|
|
42
|
+
"solid-logic": "1.3.13-057429fe",
|
|
43
|
+
"solid-ui": "2.4.18-ca7338a8"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"eslint": "^7.32.0",
|
package/src/autocompleteBar.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
// The Control with decorations
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
3
|
+
import { NamedNode } from 'rdflib'
|
|
4
|
+
import { store } from 'solid-logic'
|
|
5
|
+
import { ns, widgets, icons } from 'solid-ui'
|
|
6
6
|
import { renderAutoComplete } from './autocompletePicker' // dbpediaParameters
|
|
7
|
+
import { wikidataParameters } from './publicData'
|
|
7
8
|
|
|
8
|
-
import { NamedNode, Store, st } from 'rdflib'
|
|
9
|
-
import { queryPublicDataByName, filterByLanguage, wikidataParameters,
|
|
10
|
-
AUTOCOMPLETE_LIMIT, QueryParameters, getPreferredLanguages } from './publicData'
|
|
11
9
|
|
|
12
10
|
const WEBID_NOUN = 'Solid ID'
|
|
13
11
|
|
|
@@ -16,8 +14,8 @@ const kb = store
|
|
|
16
14
|
const AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed
|
|
17
15
|
const AUTOCOMPLETE_ROWS = 12 // 20?
|
|
18
16
|
|
|
19
|
-
const GREEN_PLUS =
|
|
20
|
-
const SEARCH_ICON =
|
|
17
|
+
const GREEN_PLUS = icons.iconBase + 'noun_34653_green.svg'
|
|
18
|
+
const SEARCH_ICON = icons.iconBase + 'noun_Search_875351.svg'
|
|
21
19
|
|
|
22
20
|
export async function renderAutocompleteControl (dom:HTMLDocument,
|
|
23
21
|
person:NamedNode, options, addOneIdAndRefresh): Promise<HTMLElement> {
|
package/src/autocompleteField.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/* Form field for doing autocompleete
|
|
2
2
|
*/
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { BlankNode, NamedNode, st, Variable } from 'rdflib'
|
|
4
|
+
import { store } from 'solid-logic'
|
|
5
|
+
import { ns, style, widgets } from 'solid-ui'
|
|
5
6
|
import { renderAutoComplete } from './autocompletePicker' // dbpediaParameters
|
|
6
7
|
|
|
7
|
-
import { NamedNode, BlankNode, Variable, Store, st } from 'rdflib'
|
|
8
|
-
import { queryPublicDataByName, filterByLanguage, wikidataParameters,
|
|
9
|
-
AUTOCOMPLETE_LIMIT, QueryParameters, getPreferredLanguages } from './publicData'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const kb = store
|
|
13
|
-
|
|
14
8
|
const AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed
|
|
15
9
|
const AUTOCOMPLETE_ROWS = 12 // 20?
|
|
16
10
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
** organization conveys many distinct types of thing.
|
|
4
4
|
**
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { NamedNode } from 'rdflib'
|
|
7
|
+
import { store } from 'solid-logic'
|
|
8
|
+
import { style, widgets } from 'solid-ui'
|
|
9
|
+
import {
|
|
10
|
+
AUTOCOMPLETE_LIMIT, filterByLanguage, getPreferredLanguages, QueryParameters, queryPublicDataByName
|
|
11
|
+
} from './publicData'
|
|
12
12
|
|
|
13
13
|
const AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed
|
|
14
14
|
const AUTOCOMPLETE_ROWS = 20 // 20?
|
|
@@ -120,7 +120,7 @@ export async function renderAutoComplete (dom: HTMLDocument, options:Autocomplet
|
|
|
120
120
|
}
|
|
121
121
|
if (hits == 1) { // Maybe require green confirmation button be clicked?
|
|
122
122
|
console.log(` auto complete elimination: "${filter}" -> "${pickedName}"`)
|
|
123
|
-
gotIt(
|
|
123
|
+
gotIt(store.sym(pick), pickedName) // uri, name
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -190,7 +190,7 @@ export async function renderAutoComplete (dom: HTMLDocument, options:Autocomplet
|
|
|
190
190
|
row.addEventListener('click', async _event => {
|
|
191
191
|
console.log(' click row textContent: ' + row.textContent)
|
|
192
192
|
console.log(' click name: ' + name)
|
|
193
|
-
gotIt(
|
|
193
|
+
gotIt(store.sym(uri), name)
|
|
194
194
|
})
|
|
195
195
|
})
|
|
196
196
|
}
|
package/src/publicData.ts
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
*
|
|
3
3
|
* including filtering resut by natural language etc
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
5
|
+
import { Literal, NamedNode, parse } from 'rdflib'
|
|
6
|
+
import { store } from 'solid-logic'
|
|
7
|
+
import { ns } from 'solid-ui'
|
|
8
8
|
import * as instituteDetailsQuery from '../lib/instituteDetailsQuery.js'
|
|
9
9
|
|
|
10
|
-
const kb = store
|
|
11
|
-
|
|
12
10
|
export const AUTOCOMPLETE_LIMIT = 3000 // How many to get from server
|
|
13
11
|
|
|
14
12
|
const subjectRegexp = /\$\(subject\)/g
|
|
@@ -228,7 +226,7 @@ export async function queryESCODataByName (filter: string, theClass:NamedNode, q
|
|
|
228
226
|
headers: { 'Accept': 'application/json'}
|
|
229
227
|
} // CORS
|
|
230
228
|
var response
|
|
231
|
-
response = await
|
|
229
|
+
response = await store.fetcher.webOperation('GET', queryURI, options)
|
|
232
230
|
//complain('Error querying db of organizations: ' + err)
|
|
233
231
|
const text = response.responseText
|
|
234
232
|
console.log(' Query result text' + text.slice(0,500) + '...')
|
|
@@ -268,7 +266,7 @@ export async function queryPublicDataSelect (sparql: string, queryTarget: QueryP
|
|
|
268
266
|
headers: { 'Accept': 'application/json'}
|
|
269
267
|
} // CORS
|
|
270
268
|
var response
|
|
271
|
-
response = await
|
|
269
|
+
response = await store.fetcher.webOperation('GET', queryURI, options)
|
|
272
270
|
//complain('Error querying db of organizations: ' + err)
|
|
273
271
|
const text = response.responseText
|
|
274
272
|
// console.log(' Query result text' + text.slice(0,100) + '...')
|
|
@@ -288,12 +286,12 @@ export async function queryPublicDataConstruct (sparql: string, pubicId: NamedNo
|
|
|
288
286
|
const options = { credentials: 'omit', // CORS
|
|
289
287
|
headers: { 'Accept': 'text/turtle'}
|
|
290
288
|
}
|
|
291
|
-
const response = await
|
|
289
|
+
const response = await store.fetcher.webOperation('GET', queryURI, options)
|
|
292
290
|
const text = response.responseText
|
|
293
291
|
const report = text.lenth > 500 ? text.slice(0,200) + ' ... ' + text.slice(-200) : text
|
|
294
292
|
console.log(' queryPublicDataConstruct result text:' + report)
|
|
295
293
|
if (text.length === 0) throw new Error('queryPublicDataConstruct: No text back from construct query:' + queryURI)
|
|
296
|
-
parse(text,
|
|
294
|
+
parse(text, store, pubicId.uri, 'text/turtle')
|
|
297
295
|
return
|
|
298
296
|
}
|
|
299
297
|
|
package/toolsPane.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/* global confirm, $rdf */
|
|
4
4
|
|
|
5
5
|
import * as UI from 'solid-ui'
|
|
6
|
+
import { store } from 'solid-logic'
|
|
6
7
|
import { saveNewGroup, addPersonToGroup } from './contactLogic'
|
|
7
8
|
export function toolsPane (
|
|
8
9
|
selectAllGroups,
|
|
@@ -13,7 +14,7 @@ export function toolsPane (
|
|
|
13
14
|
me
|
|
14
15
|
) {
|
|
15
16
|
const dom = dataBrowserContext.dom
|
|
16
|
-
const kb =
|
|
17
|
+
const kb = store
|
|
17
18
|
const ns = UI.ns
|
|
18
19
|
const VCARD = ns.vcard
|
|
19
20
|
|
|
@@ -68,7 +69,7 @@ export function toolsPane (
|
|
|
68
69
|
|
|
69
70
|
//
|
|
70
71
|
try {
|
|
71
|
-
await UI.
|
|
72
|
+
await UI.login.registrationControl(context, book, ns.vcard('AddressBook'))
|
|
72
73
|
} catch (e) {
|
|
73
74
|
UI.widgets.complain(context, 'registrationControl: ' + e)
|
|
74
75
|
}
|
|
@@ -160,7 +161,7 @@ export function toolsPane (
|
|
|
160
161
|
stats.nameEmailIndex = kb.any(book, ns.vcard('nameEmailIndex'))
|
|
161
162
|
log('Loading name index...')
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
store.fetcher.nowOrWhenFetched(
|
|
164
165
|
stats.nameEmailIndex,
|
|
165
166
|
undefined,
|
|
166
167
|
function (_ok, _message) {
|
package/webidControl.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Render a control to record the webids we have for this agent
|
|
2
2
|
/* eslint-disable multiline-ternary */
|
|
3
3
|
import * as UI from 'solid-ui'
|
|
4
|
+
import { store } from 'solid-logic'
|
|
4
5
|
import { updateMany } from './contactLogic'
|
|
5
6
|
// import { renderAutoComplete } from './lib/autocompletePicker' // dbpediaParameters
|
|
6
7
|
import { renderAutocompleteControl } from './lib/autocompleteBar'
|
|
@@ -10,7 +11,7 @@ const $rdf = UI.rdf
|
|
|
10
11
|
const ns = UI.ns
|
|
11
12
|
const widgets = UI.widgets
|
|
12
13
|
const utils = UI.utils
|
|
13
|
-
const kb =
|
|
14
|
+
const kb = store
|
|
14
15
|
const style = UI.style
|
|
15
16
|
|
|
16
17
|
const wikidataClasses = widgets.publicData.wikidataClasses // @@ move to solid-logic
|