solid-logic 1.3.17-7b06fb45 → 1.3.17-81536f11
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/lib/acl/aclLogic.d.ts +2 -11
- package/lib/acl/aclLogic.d.ts.map +1 -1
- package/lib/acl/aclLogic.js +5 -7
- package/lib/acl/aclLogic.js.map +1 -1
- package/lib/chat/chatLogic.d.ts +2 -15
- package/lib/chat/chatLogic.d.ts.map +1 -1
- package/lib/chat/chatLogic.js +8 -7
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/inbox/inboxLogic.d.ts +2 -6
- package/lib/inbox/inboxLogic.d.ts.map +1 -1
- package/lib/inbox/inboxLogic.js.map +1 -1
- package/lib/index.d.ts +4 -18
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -86
- package/lib/index.js.map +1 -1
- package/lib/issuer/issuerLogic.js +1 -1
- package/lib/issuer/issuerLogic.js.map +1 -1
- package/lib/logic/solidLogic.d.ts +6 -0
- package/lib/logic/solidLogic.d.ts.map +1 -0
- package/lib/logic/{SolidLogic.js → solidLogic.js} +38 -33
- package/lib/logic/solidLogic.js.map +1 -0
- package/lib/logic/solidLogicSingleton.d.ts +1 -2
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
- package/lib/logic/solidLogicSingleton.js +2 -2
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/profile/profileLogic.d.ts +2 -12
- package/lib/profile/profileLogic.d.ts.map +1 -1
- package/lib/profile/profileLogic.js +1 -23
- package/lib/profile/profileLogic.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +2 -31
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/lib/typeIndex/typeIndexLogic.js +12 -359
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/types.d.ts +65 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/util/ns.d.ts +2 -0
- package/lib/util/ns.d.ts.map +1 -0
- package/lib/util/ns.js +34 -0
- package/lib/util/ns.js.map +1 -0
- package/package.json +14 -14
- package/src/acl/aclLogic.ts +8 -5
- package/src/chat/chatLogic.ts +7 -7
- package/src/inbox/inboxLogic.ts +2 -1
- package/src/index.ts +5 -147
- package/src/issuer/issuerLogic.ts +1 -1
- package/src/logic/solidLogic.ts +75 -0
- package/src/logic/solidLogicSingleton.ts +2 -2
- package/src/profile/profileLogic.ts +4 -12
- package/src/typeIndex/typeIndexLogic.ts +6 -277
- package/src/types.ts +76 -1
- package/src/util/{ns.js → ns.ts} +0 -0
- package/test/typeIndexLogic.test.ts +484 -54
- package/lib/logic/SolidLogic.d.ts +0 -22
- package/lib/logic/SolidLogic.d.ts.map +0 -1
- package/lib/logic/SolidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingletonNew.d.ts +0 -80
- package/lib/logic/solidLogicSingletonNew.d.ts.map +0 -1
- package/lib/logic/solidLogicSingletonNew.js +0 -238
- package/lib/logic/solidLogicSingletonNew.js.map +0 -1
- package/src/logic/SolidLogic.ts +0 -81
- package/src/logic/solidLogicSingletonNew.ts +0 -239
- package/test/typeIndexLogicPart2.test.ts +0 -485
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import { NamedNode } from "rdflib";
|
|
2
|
+
import { LiveStore, NamedNode, Statement } from "rdflib";
|
|
3
3
|
export declare type AppDetails = {
|
|
4
4
|
noun: string;
|
|
5
5
|
appPathSegment: string;
|
|
@@ -45,4 +45,68 @@ export interface NewPaneOptions {
|
|
|
45
45
|
export interface CreatedPaneOptions {
|
|
46
46
|
newInstance: NamedNode;
|
|
47
47
|
}
|
|
48
|
+
export interface ChatLogic {
|
|
49
|
+
setAcl: (chatContainer: NamedNode, me: NamedNode, invitee: NamedNode) => Promise<void>;
|
|
50
|
+
addToPrivateTypeIndex: (chatThing: any, me: any) => void | Promise<void>;
|
|
51
|
+
findChat: (invitee: NamedNode) => Promise<Chat>;
|
|
52
|
+
createChatThing: (chatContainer: NamedNode, me: NamedNode) => Promise<NamedNode>;
|
|
53
|
+
mintNew: (newPaneOptions: NewPaneOptions) => Promise<CreatedPaneOptions>;
|
|
54
|
+
getChat: (invitee: NamedNode, boolean: any) => Promise<NamedNode | null>;
|
|
55
|
+
sendInvite: (invitee: NamedNode, chatThing: NamedNode) => void;
|
|
56
|
+
}
|
|
57
|
+
export interface Chat {
|
|
58
|
+
me: NamedNode;
|
|
59
|
+
chatContainer: NamedNode;
|
|
60
|
+
exists: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ProfileLogic {
|
|
63
|
+
silencedLoadPreferences: (user: NamedNode) => Promise<NamedNode | undefined>;
|
|
64
|
+
loadPreferences: (user: NamedNode) => Promise<NamedNode>;
|
|
65
|
+
loadProfile: (user: NamedNode) => Promise<NamedNode>;
|
|
66
|
+
loadMe: () => Promise<NamedNode>;
|
|
67
|
+
getPodRoot: (user: NamedNode) => NamedNode;
|
|
68
|
+
getMainInbox: (user: NamedNode) => Promise<NamedNode>;
|
|
69
|
+
findStorage: (me: NamedNode) => Node | null;
|
|
70
|
+
}
|
|
71
|
+
export interface AclLogic {
|
|
72
|
+
findAclDocUrl: (url: string) => Promise<any>;
|
|
73
|
+
setACLUserPublic: (docURI: string, me: NamedNode, options: {
|
|
74
|
+
defaultForNew?: boolean;
|
|
75
|
+
public?: [];
|
|
76
|
+
}) => Promise<NamedNode>;
|
|
77
|
+
genACLText: (docURI: string, me: NamedNode, aclURI: string, options: {
|
|
78
|
+
defaultForNew?: boolean;
|
|
79
|
+
public?: [];
|
|
80
|
+
}) => string | undefined;
|
|
81
|
+
}
|
|
82
|
+
export interface InboxLogic {
|
|
83
|
+
createInboxFor: (peerWebId: string, nick: string) => Promise<string>;
|
|
84
|
+
getNewMessages: (user?: NamedNode) => Promise<string[]>;
|
|
85
|
+
markAsRead: (url: string, date: Date) => void;
|
|
86
|
+
}
|
|
87
|
+
export interface TypeIndexLogic {
|
|
88
|
+
getRegistrations: (instance: any, theClass: any) => Node[];
|
|
89
|
+
loadTypeIndexesFor: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
|
|
90
|
+
loadCommunityTypeIndexes: (user: NamedNode) => Promise<TypeIndexScope[][]>;
|
|
91
|
+
loadAllTypeIndexes: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
|
|
92
|
+
getScopedAppInstances: (klass: NamedNode, user: NamedNode) => Promise<ScopedApp[]>;
|
|
93
|
+
getAppInstances: (klass: NamedNode) => Promise<NamedNode[]>;
|
|
94
|
+
suggestPublicTypeIndex: (me: NamedNode) => NamedNode;
|
|
95
|
+
suggestPrivateTypeIndex: (preferencesFile: NamedNode) => NamedNode;
|
|
96
|
+
registerInTypeIndex: (instance: NamedNode, index: NamedNode, theClass: NamedNode) => Promise<NamedNode | null>;
|
|
97
|
+
deleteTypeIndexRegistration: (item: any) => Promise<void>;
|
|
98
|
+
getScopedAppsFromIndex: (scope: TypeIndexScope, theClass: NamedNode | null) => Promise<ScopedApp[]>;
|
|
99
|
+
}
|
|
100
|
+
export interface SolidLogic {
|
|
101
|
+
store: LiveStore;
|
|
102
|
+
authn: AuthnLogic;
|
|
103
|
+
acl: AclLogic;
|
|
104
|
+
profile: ProfileLogic;
|
|
105
|
+
inbox: InboxLogic;
|
|
106
|
+
typeIndex: TypeIndexLogic;
|
|
107
|
+
chat: ChatLogic;
|
|
108
|
+
load: (doc: NamedNode | NamedNode[] | string) => void;
|
|
109
|
+
updatePromise: (del: Array<Statement>, ins: Array<Statement>) => Promise<void>;
|
|
110
|
+
clearStore: () => void;
|
|
111
|
+
}
|
|
48
112
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC5D,OA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I,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,sBAAsB,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;CACtG;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM,KAAK,IAAI,CAAC;IACtD,aAAa,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,UAAU,EAAE,MAAM,IAAI,CAAA;CACzB"}
|
package/lib/util/ns.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns.d.ts","sourceRoot":"","sources":["../../src/util/ns.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,EAAE,KAAuB,CAAA"}
|
package/lib/util/ns.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ns = void 0;
|
|
30
|
+
// Namespaces we commonly use and have common prefixes for around Solid
|
|
31
|
+
var solid_namespace_1 = __importDefault(require("solid-namespace")); // Delegate to this which takes RDFlib as param.
|
|
32
|
+
var $rdf = __importStar(require("rdflib"));
|
|
33
|
+
exports.ns = (0, solid_namespace_1.default)($rdf);
|
|
34
|
+
//# sourceMappingURL=ns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns.js","sourceRoot":"","sources":["../../src/util/ns.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAuE;AACvE,oEAA4C,CAAC,gDAAgD;AAC7F,2CAA8B;AAEjB,QAAA,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-logic",
|
|
3
|
-
"version": "1.3.17-
|
|
3
|
+
"version": "1.3.17-81536f11",
|
|
4
4
|
"description": "Core business logic of Solid OS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/solidos/solid-logic#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/plugin-proposal-class-properties": "~7.
|
|
29
|
-
"@babel/plugin-proposal-optional-chaining": "~7.
|
|
30
|
-
"@babel/plugin-transform-async-to-generator": "~7.
|
|
31
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
32
|
-
"@babel/preset-env": "~7.
|
|
33
|
-
"@babel/preset-typescript": "~7.
|
|
34
|
-
"@types/jest": "^27.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
36
|
-
"@typescript-eslint/parser": "^5.
|
|
37
|
-
"eslint": "^8.
|
|
28
|
+
"@babel/plugin-proposal-class-properties": "~7.18.6",
|
|
29
|
+
"@babel/plugin-proposal-optional-chaining": "~7.18.9",
|
|
30
|
+
"@babel/plugin-transform-async-to-generator": "~7.18.6",
|
|
31
|
+
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
32
|
+
"@babel/preset-env": "~7.18.10",
|
|
33
|
+
"@babel/preset-typescript": "~7.18.6",
|
|
34
|
+
"@types/jest": "^27.5.2",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
|
36
|
+
"@typescript-eslint/parser": "^5.35.1",
|
|
37
|
+
"eslint": "^8.23.0",
|
|
38
38
|
"jest": "^27.5.1",
|
|
39
39
|
"jest-environment-node-debug": "^2.0.0",
|
|
40
40
|
"jest-fetch-mock": "^3.0.3",
|
|
41
|
-
"typescript": "^4.
|
|
41
|
+
"typescript": "^4.8.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@inrupt/solid-client-authn-browser": "^1.
|
|
45
|
-
"rdflib": "^2.2.
|
|
44
|
+
"@inrupt/solid-client-authn-browser": "^1.12.2",
|
|
45
|
+
"rdflib": "^2.2.20",
|
|
46
46
|
"solid-namespace": "^0.5.2"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/acl/aclLogic.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { graph, NamedNode, Namespace, serialize, sym } from "rdflib"
|
|
2
|
-
import
|
|
2
|
+
import { AclLogic } from "../types";
|
|
3
|
+
import { ns as namespace } from '../util/ns'
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
export const ACL_LINK = sym(
|
|
6
7
|
"http://www.iana.org/assignments/link-relations/acl"
|
|
7
8
|
);
|
|
8
9
|
|
|
9
|
-
export function createAclLogic(store) {
|
|
10
|
+
export function createAclLogic(store): AclLogic {
|
|
11
|
+
|
|
12
|
+
const ns = namespace
|
|
10
13
|
|
|
11
14
|
async function findAclDocUrl(url: string) {
|
|
12
15
|
const doc = store.sym(url);
|
|
@@ -114,9 +117,9 @@ export function createAclLogic(store) {
|
|
|
114
117
|
me: NamedNode,
|
|
115
118
|
aclURI: string,
|
|
116
119
|
options: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
defaultForNew?: boolean,
|
|
121
|
+
public?: []
|
|
122
|
+
} = {}
|
|
120
123
|
): string | undefined {
|
|
121
124
|
const optPublic = options.public || []
|
|
122
125
|
const g = graph()
|
package/src/chat/chatLogic.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { NamedNode, Node, st, term } from "rdflib"
|
|
2
|
-
import { CreatedPaneOptions, NewPaneOptions } from "../types"
|
|
2
|
+
import { ChatLogic, CreatedPaneOptions, NewPaneOptions, Chat } from "../types"
|
|
3
|
+
import { ns as namespace } from "../util/ns";
|
|
3
4
|
import { determineChatContainer, newThing } from "../util/utils"
|
|
4
|
-
import { ns as namespace } from '../util/ns'
|
|
5
5
|
|
|
6
|
-
const CHAT_LOCATION_IN_CONTAINER = "index.ttl#this"
|
|
6
|
+
const CHAT_LOCATION_IN_CONTAINER = "index.ttl#this"
|
|
7
7
|
|
|
8
|
-
export function createChatLogic(store, profileLogic) {
|
|
8
|
+
export function createChatLogic(store, profileLogic): ChatLogic {
|
|
9
9
|
const ns = namespace
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
async function setAcl(
|
|
12
12
|
chatContainer: NamedNode,
|
|
13
13
|
me: NamedNode,
|
|
@@ -87,7 +87,7 @@ export function createChatLogic(store, profileLogic) {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async function findChat(invitee: NamedNode) {
|
|
90
|
+
async function findChat(invitee: NamedNode): Promise<Chat> {
|
|
91
91
|
const me = await profileLogic.loadMe();
|
|
92
92
|
const podRoot = await profileLogic.getPodRoot(me);
|
|
93
93
|
const chatContainer = determineChatContainer(invitee, podRoot);
|
|
@@ -206,7 +206,7 @@ export function createChatLogic(store, profileLogic) {
|
|
|
206
206
|
${ns.rdf("seeAlso")} <${chatThing.value}> .
|
|
207
207
|
`;
|
|
208
208
|
|
|
209
|
-
const inviteResponse = await store.fetcher
|
|
209
|
+
const inviteResponse = await store.fetcher?.webOperation(
|
|
210
210
|
"POST",
|
|
211
211
|
inviteeInbox.value,
|
|
212
212
|
{
|
package/src/inbox/inboxLogic.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NamedNode } from "rdflib";
|
|
2
|
+
import { InboxLogic } from "../types";
|
|
2
3
|
import { getArchiveUrl } from "../util/utils";
|
|
3
4
|
|
|
4
|
-
export function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic) {
|
|
5
|
+
export function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {
|
|
5
6
|
|
|
6
7
|
async function createInboxFor(peerWebId: string, nick: string) {
|
|
7
8
|
const myWebId: NamedNode = await profileLogic.loadMe();
|
package/src/index.ts
CHANGED
|
@@ -6,158 +6,16 @@ const authn = solidLogicSingleton.authn
|
|
|
6
6
|
const authSession = solidLogicSingleton.authn.authSession
|
|
7
7
|
const store = solidLogicSingleton.store
|
|
8
8
|
|
|
9
|
-
const aclLogic = solidLogicSingleton.aclLogic
|
|
10
|
-
const utilityLogic = solidLogicSingleton.utilityLogic
|
|
11
|
-
const containerLogic = solidLogicSingleton.containerLogic
|
|
12
|
-
const profileLogic = solidLogicSingleton.profileLogic
|
|
13
|
-
const inboxLogic = solidLogicSingleton.inboxLogic
|
|
14
|
-
const typeIndexLogic = solidLogicSingleton.typeIndexLogic
|
|
15
|
-
const chatLogic = solidLogicSingleton.chatLogic
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
findAclDocUrl,
|
|
19
|
-
setACLUserPublic,
|
|
20
|
-
genACLText,
|
|
21
|
-
} = aclLogic
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
ensureTypeIndexes,
|
|
25
|
-
loadTypeIndexes,
|
|
26
|
-
registerInTypeIndex,
|
|
27
|
-
loadIndex,
|
|
28
|
-
ensureOneTypeIndex,
|
|
29
|
-
putIndex,
|
|
30
|
-
makeIndexIfNecessary,
|
|
31
|
-
loadIndexes,
|
|
32
|
-
getTypeIndex,
|
|
33
|
-
getRegistrations,
|
|
34
|
-
//NEW function for discovery
|
|
35
|
-
loadTypeIndexesFor,
|
|
36
|
-
loadCommunityTypeIndexes,
|
|
37
|
-
loadAllTypeIndexes,
|
|
38
|
-
getScopedAppInstances,
|
|
39
|
-
getAppInstances,
|
|
40
|
-
suggestPublicTypeIndex,
|
|
41
|
-
suggestPrivateTypeIndex,
|
|
42
|
-
registerInstanceInTypeIndex,
|
|
43
|
-
deleteTypeIndexRegistration,
|
|
44
|
-
getScopedAppsFromIndex
|
|
45
|
-
} = typeIndexLogic
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
setAcl,
|
|
49
|
-
addToPrivateTypeIndex,
|
|
50
|
-
findChat,
|
|
51
|
-
createChatThing,
|
|
52
|
-
getChat,
|
|
53
|
-
sendInvite,
|
|
54
|
-
mintNew
|
|
55
|
-
} = chatLogic
|
|
56
|
-
|
|
57
|
-
const { createInboxFor, getNewMessages, markAsRead } = inboxLogic
|
|
58
|
-
const {
|
|
59
|
-
recursiveDelete,
|
|
60
|
-
setSinglePeerAccess,
|
|
61
|
-
createEmptyRdfDoc,
|
|
62
|
-
//NEW function for discovery
|
|
63
|
-
followOrCreateLink,
|
|
64
|
-
loadOrCreateIfNotExists,
|
|
65
|
-
} = utilityLogic
|
|
66
|
-
|
|
67
|
-
const {
|
|
68
|
-
ensureLoadedPreferences,
|
|
69
|
-
loadMe,
|
|
70
|
-
getPodRoot,
|
|
71
|
-
getMainInbox,
|
|
72
|
-
findStorage,
|
|
73
|
-
//NEW content from discovery
|
|
74
|
-
loadPreferences,
|
|
75
|
-
loadProfile,
|
|
76
|
-
//NEW function for discovery
|
|
77
|
-
silencedLoadPreferences
|
|
78
|
-
} = profileLogic
|
|
79
|
-
|
|
80
|
-
const {
|
|
81
|
-
isContainer,
|
|
82
|
-
createContainer,
|
|
83
|
-
getContainerElements,
|
|
84
|
-
getContainerMembers
|
|
85
|
-
} = containerLogic
|
|
86
|
-
|
|
87
9
|
export { ACL_LINK } from './acl/aclLogic'
|
|
88
10
|
export { offlineTestID, appContext } from './authn/authUtil'
|
|
89
11
|
export { getSuggestedIssuers } from './issuer/issuerLogic'
|
|
90
|
-
export { SolidLogic } from './
|
|
91
|
-
export { AppDetails, SolidNamespace, AuthenticationContext } from './types'
|
|
92
|
-
// solidLogicSingleton is exported entirely because it is used in solid-panes
|
|
93
|
-
export { solidLogicSingleton } from './logic/solidLogicSingleton'
|
|
12
|
+
export { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic } from './types'
|
|
94
13
|
export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'
|
|
95
14
|
|
|
96
15
|
export {
|
|
16
|
+
solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes
|
|
97
17
|
store,
|
|
98
18
|
authn,
|
|
99
|
-
authSession
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
containerLogic,
|
|
103
|
-
profileLogic,
|
|
104
|
-
inboxLogic,
|
|
105
|
-
typeIndexLogic,
|
|
106
|
-
chatLogic,
|
|
107
|
-
//aclLogic
|
|
108
|
-
findAclDocUrl,
|
|
109
|
-
setACLUserPublic,
|
|
110
|
-
genACLText,
|
|
111
|
-
//typeIndexLogic
|
|
112
|
-
ensureTypeIndexes,
|
|
113
|
-
loadTypeIndexes,
|
|
114
|
-
registerInTypeIndex,
|
|
115
|
-
loadIndex,
|
|
116
|
-
ensureOneTypeIndex,
|
|
117
|
-
putIndex,
|
|
118
|
-
makeIndexIfNecessary,
|
|
119
|
-
loadIndexes,
|
|
120
|
-
getTypeIndex,
|
|
121
|
-
getRegistrations,
|
|
122
|
-
loadTypeIndexesFor,
|
|
123
|
-
loadCommunityTypeIndexes,
|
|
124
|
-
loadAllTypeIndexes,
|
|
125
|
-
getScopedAppInstances,
|
|
126
|
-
getAppInstances,
|
|
127
|
-
suggestPublicTypeIndex,
|
|
128
|
-
suggestPrivateTypeIndex,
|
|
129
|
-
registerInstanceInTypeIndex,
|
|
130
|
-
deleteTypeIndexRegistration,
|
|
131
|
-
getScopedAppsFromIndex,
|
|
132
|
-
setAcl,
|
|
133
|
-
addToPrivateTypeIndex,
|
|
134
|
-
findChat,
|
|
135
|
-
createChatThing,
|
|
136
|
-
getChat,
|
|
137
|
-
sendInvite,
|
|
138
|
-
//inboxLogic
|
|
139
|
-
mintNew,
|
|
140
|
-
createInboxFor,
|
|
141
|
-
getNewMessages,
|
|
142
|
-
markAsRead,
|
|
143
|
-
//utilityLogic
|
|
144
|
-
recursiveDelete,
|
|
145
|
-
setSinglePeerAccess,
|
|
146
|
-
createEmptyRdfDoc,
|
|
147
|
-
followOrCreateLink,
|
|
148
|
-
loadOrCreateIfNotExists,
|
|
149
|
-
//profileLogic
|
|
150
|
-
ensureLoadedPreferences,
|
|
151
|
-
loadMe,
|
|
152
|
-
getPodRoot,
|
|
153
|
-
getMainInbox,
|
|
154
|
-
findStorage,
|
|
155
|
-
loadPreferences,
|
|
156
|
-
loadProfile,
|
|
157
|
-
silencedLoadPreferences,
|
|
158
|
-
//containerLogic
|
|
159
|
-
isContainer,
|
|
160
|
-
createContainer,
|
|
161
|
-
getContainerElements,
|
|
162
|
-
getContainerMembers
|
|
163
|
-
}
|
|
19
|
+
authSession
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
+
import * as rdf from "rdflib";
|
|
3
|
+
import { LiveStore, NamedNode, Statement } from "rdflib";
|
|
4
|
+
import { createAclLogic } from "../acl/aclLogic";
|
|
5
|
+
import { SolidAuthnLogic } from "../authn/SolidAuthnLogic";
|
|
6
|
+
import { createChatLogic } from "../chat/chatLogic";
|
|
7
|
+
import { createInboxLogic } from "../inbox/inboxLogic";
|
|
8
|
+
import { createProfileLogic } from "../profile/profileLogic";
|
|
9
|
+
import { createTypeIndexLogic } from "../typeIndex/typeIndexLogic";
|
|
10
|
+
import { createContainerLogic } from "../util/containerLogic";
|
|
11
|
+
import { createUtilityLogic } from "../util/utilityLogic";
|
|
12
|
+
import { AuthnLogic, SolidLogic } from "../types";
|
|
13
|
+
import * as debug from "../util/debug";
|
|
14
|
+
/*
|
|
15
|
+
** It is important to distinquish `fetch`, a function provided by the browser
|
|
16
|
+
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
17
|
+
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
18
|
+
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
19
|
+
*/
|
|
20
|
+
export function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session): SolidLogic {
|
|
21
|
+
|
|
22
|
+
debug.log("SolidLogic: Unique instance created. There should only be one of these.")
|
|
23
|
+
const store: LiveStore = rdf.graph() as LiveStore
|
|
24
|
+
rdf.fetcher(store, {fetch: specialFetch.fetch}); // Attach a web I/O module, store.fetcher
|
|
25
|
+
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
26
|
+
store.features = [] // disable automatic node merging on store load
|
|
27
|
+
|
|
28
|
+
const authn: AuthnLogic = new SolidAuthnLogic(session)
|
|
29
|
+
|
|
30
|
+
const acl = createAclLogic(store)
|
|
31
|
+
const containerLogic = createContainerLogic(store)
|
|
32
|
+
const utilityLogic = createUtilityLogic(store, acl, containerLogic)
|
|
33
|
+
const profile = createProfileLogic(store, authn, utilityLogic)
|
|
34
|
+
const chat = createChatLogic(store, profile)
|
|
35
|
+
const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)
|
|
36
|
+
const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)
|
|
37
|
+
debug.log('SolidAuthnLogic initialized')
|
|
38
|
+
|
|
39
|
+
function load(doc: NamedNode | NamedNode[] | string) {
|
|
40
|
+
return store.fetcher.load(doc);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
44
|
+
function updatePromise(
|
|
45
|
+
del: Array<Statement>,
|
|
46
|
+
ins: Array<Statement> = []
|
|
47
|
+
): Promise<void> {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
50
|
+
if (!ok) {
|
|
51
|
+
reject(new Error(errorBody));
|
|
52
|
+
} else {
|
|
53
|
+
resolve();
|
|
54
|
+
}
|
|
55
|
+
}); // callback
|
|
56
|
+
}); // promise
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function clearStore() {
|
|
60
|
+
store.statements.slice().forEach(store.remove.bind(store));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
store,
|
|
65
|
+
authn,
|
|
66
|
+
acl,
|
|
67
|
+
inbox,
|
|
68
|
+
chat,
|
|
69
|
+
profile,
|
|
70
|
+
typeIndex,
|
|
71
|
+
load,
|
|
72
|
+
updatePromise,
|
|
73
|
+
clearStore
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as debug from "../util/debug"
|
|
2
2
|
import { authSession } from "../authSession/authSession"
|
|
3
|
-
import {
|
|
3
|
+
import { createSolidLogic } from "./solidLogic"
|
|
4
4
|
|
|
5
5
|
const _fetch = async (url, requestInit) => {
|
|
6
6
|
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
|
|
@@ -13,7 +13,7 @@ const _fetch = async (url, requestInit) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//this const makes solidLogicSingleton global accessible in mashlib
|
|
16
|
-
const solidLogicSingleton =
|
|
16
|
+
const solidLogicSingleton = createSolidLogic({ fetch: _fetch }, authSession)
|
|
17
17
|
|
|
18
18
|
debug.log('Unique quadstore initialized.')
|
|
19
19
|
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { NamedNode } from "rdflib";
|
|
2
2
|
import { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from "../logic/CustomError";
|
|
3
|
-
import { AuthenticationContext } from "../types";
|
|
4
3
|
import * as debug from "../util/debug";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ns as namespace } from '../util/ns';
|
|
5
|
+
import { differentOrigin, suggestPreferencesFile } from "../util/utils"
|
|
6
|
+
import { ProfileLogic } from "../types"
|
|
7
7
|
|
|
8
|
-
export function createProfileLogic(store, authn, utilityLogic) {
|
|
8
|
+
export function createProfileLogic(store, authn, utilityLogic): ProfileLogic {
|
|
9
9
|
const ns = namespace
|
|
10
10
|
|
|
11
|
-
async function ensureLoadedPreferences (context: AuthenticationContext) {
|
|
12
|
-
if (!context.me) throw new Error('@@ ensureLoadedPreferences: no user specified')
|
|
13
|
-
context.publicProfile = await loadProfile(context.me)
|
|
14
|
-
context.preferencesFile = await silencedLoadPreferences(context.me)
|
|
15
|
-
return context
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
/**
|
|
19
12
|
* loads the preference without throwing errors - if it can create it it does so.
|
|
20
13
|
* remark: it still throws error if it cannot load profile.
|
|
@@ -121,7 +114,6 @@ export function createProfileLogic(store, authn, utilityLogic) {
|
|
|
121
114
|
}
|
|
122
115
|
|
|
123
116
|
return {
|
|
124
|
-
ensureLoadedPreferences,
|
|
125
117
|
loadMe,
|
|
126
118
|
getPodRoot,
|
|
127
119
|
getMainInbox,
|