solid-logic 1.3.17-2d62034f → 1.3.17-35eac4c0

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.
Files changed (40) hide show
  1. package/lib/acl/aclLogic.d.ts +2 -11
  2. package/lib/acl/aclLogic.d.ts.map +1 -1
  3. package/lib/acl/aclLogic.js.map +1 -1
  4. package/lib/chat/chatLogic.d.ts +2 -15
  5. package/lib/chat/chatLogic.d.ts.map +1 -1
  6. package/lib/chat/chatLogic.js +8 -7
  7. package/lib/chat/chatLogic.js.map +1 -1
  8. package/lib/inbox/inboxLogic.d.ts +2 -6
  9. package/lib/inbox/inboxLogic.d.ts.map +1 -1
  10. package/lib/inbox/inboxLogic.js.map +1 -1
  11. package/lib/index.d.ts +3 -16
  12. package/lib/index.d.ts.map +1 -1
  13. package/lib/index.js +2 -74
  14. package/lib/index.js.map +1 -1
  15. package/lib/logic/SolidLogic.d.ts +7 -7
  16. package/lib/logic/SolidLogic.d.ts.map +1 -1
  17. package/lib/logic/SolidLogic.js +6 -6
  18. package/lib/logic/SolidLogic.js.map +1 -1
  19. package/lib/profile/profileLogic.d.ts +2 -10
  20. package/lib/profile/profileLogic.d.ts.map +1 -1
  21. package/lib/profile/profileLogic.js.map +1 -1
  22. package/lib/typeIndex/typeIndexLogic.d.ts +2 -18
  23. package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
  24. package/lib/typeIndex/typeIndexLogic.js.map +1 -1
  25. package/lib/types.d.ts +52 -0
  26. package/lib/types.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/acl/aclLogic.ts +5 -4
  29. package/src/chat/chatLogic.ts +7 -7
  30. package/src/inbox/inboxLogic.ts +2 -1
  31. package/src/index.ts +2 -124
  32. package/src/logic/SolidLogic.ts +13 -13
  33. package/src/profile/profileLogic.ts +3 -2
  34. package/src/typeIndex/typeIndexLogic.ts +3 -3
  35. package/src/types.ts +63 -0
  36. package/lib/logic/solidLogicSingletonNew.d.ts +0 -67
  37. package/lib/logic/solidLogicSingletonNew.d.ts.map +0 -1
  38. package/lib/logic/solidLogicSingletonNew.js +0 -219
  39. package/lib/logic/solidLogicSingletonNew.js.map +0 -1
  40. package/src/logic/solidLogicSingletonNew.ts +0 -210
@@ -1,4 +1,5 @@
1
1
  import { graph, NamedNode, Namespace, serialize, sym } from "rdflib"
2
+ import { AclLogic } from "../types";
2
3
  import { ns as namespace } from '../util/ns'
3
4
 
4
5
 
@@ -6,7 +7,7 @@ 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 {
10
11
 
11
12
  const ns = namespace
12
13
 
@@ -116,9 +117,9 @@ export function createAclLogic(store) {
116
117
  me: NamedNode,
117
118
  aclURI: string,
118
119
  options: {
119
- defaultForNew?: boolean,
120
- public?: []
121
- } = {}
120
+ defaultForNew?: boolean,
121
+ public?: []
122
+ } = {}
122
123
  ): string | undefined {
123
124
  const optPublic = options.public || []
124
125
  const g = graph()
@@ -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.webOperation(
209
+ const inviteResponse = await store.fetcher?.webOperation(
210
210
  "POST",
211
211
  inviteeInbox.value,
212
212
  {
@@ -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,138 +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
- registerInTypeIndex,
25
- getRegistrations,
26
- //NEW function for discovery
27
- loadTypeIndexesFor,
28
- loadCommunityTypeIndexes,
29
- loadAllTypeIndexes,
30
- getScopedAppInstances,
31
- getAppInstances,
32
- suggestPublicTypeIndex,
33
- suggestPrivateTypeIndex,
34
- deleteTypeIndexRegistration,
35
- getScopedAppsFromIndex
36
- } = typeIndexLogic
37
-
38
- const {
39
- setAcl,
40
- addToPrivateTypeIndex,
41
- findChat,
42
- createChatThing,
43
- getChat,
44
- sendInvite,
45
- mintNew
46
- } = chatLogic
47
-
48
- const { createInboxFor, getNewMessages, markAsRead } = inboxLogic
49
- const {
50
- recursiveDelete,
51
- setSinglePeerAccess,
52
- createEmptyRdfDoc,
53
- //NEW function for discovery
54
- followOrCreateLink,
55
- loadOrCreateIfNotExists,
56
- } = utilityLogic
57
-
58
- const {
59
- loadMe,
60
- getPodRoot,
61
- getMainInbox,
62
- findStorage,
63
- //NEW content from discovery
64
- loadPreferences,
65
- loadProfile,
66
- //NEW function for discovery
67
- silencedLoadPreferences
68
- } = profileLogic
69
-
70
- const {
71
- isContainer,
72
- createContainer,
73
- getContainerElements,
74
- getContainerMembers
75
- } = containerLogic
76
-
77
9
  export { ACL_LINK } from './acl/aclLogic'
78
10
  export { offlineTestID, appContext } from './authn/authUtil'
79
11
  export { getSuggestedIssuers } from './issuer/issuerLogic'
80
12
  export { SolidLogic } from './logic/SolidLogic'
81
13
  export { AppDetails, SolidNamespace, AuthenticationContext } from './types'
82
- // solidLogicSingleton is exported entirely because it is used in solid-panes
83
- export { solidLogicSingleton } from './logic/solidLogicSingleton'
84
14
  export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'
85
15
 
86
16
  export {
17
+ solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes
87
18
  store,
88
19
  authn,
89
- authSession,
90
- aclLogic,
91
- utilityLogic,
92
- containerLogic,
93
- profileLogic,
94
- inboxLogic,
95
- typeIndexLogic,
96
- chatLogic,
97
- //aclLogic
98
- findAclDocUrl,
99
- setACLUserPublic,
100
- genACLText,
101
- //typeIndexLogic
102
- registerInTypeIndex,
103
- getRegistrations,
104
- loadTypeIndexesFor,
105
- loadCommunityTypeIndexes,
106
- loadAllTypeIndexes,
107
- getScopedAppInstances,
108
- getAppInstances,
109
- suggestPublicTypeIndex,
110
- suggestPrivateTypeIndex,
111
- deleteTypeIndexRegistration,
112
- getScopedAppsFromIndex,
113
- setAcl,
114
- addToPrivateTypeIndex,
115
- findChat,
116
- createChatThing,
117
- getChat,
118
- sendInvite,
119
- //inboxLogic
120
- mintNew,
121
- createInboxFor,
122
- getNewMessages,
123
- markAsRead,
124
- //utilityLogic
125
- recursiveDelete,
126
- setSinglePeerAccess,
127
- createEmptyRdfDoc,
128
- followOrCreateLink,
129
- loadOrCreateIfNotExists,
130
- //profileLogic
131
- loadMe,
132
- getPodRoot,
133
- getMainInbox,
134
- findStorage,
135
- loadPreferences,
136
- loadProfile,
137
- silencedLoadPreferences,
138
- //containerLogic
139
- isContainer,
140
- createContainer,
141
- getContainerElements,
142
- getContainerMembers
20
+ authSession
143
21
  }
@@ -23,13 +23,13 @@ export class SolidLogic {
23
23
  me: string | undefined;
24
24
  authn: AuthnLogic;
25
25
 
26
- aclLogic
27
- utilityLogic
28
- containerLogic
29
- profileLogic
30
- inboxLogic
31
- typeIndexLogic
32
- chatLogic
26
+ readonly acl
27
+ readonly profile
28
+ readonly inbox
29
+ readonly typeIndex
30
+ readonly chat
31
+ private readonly containerLogic
32
+ private readonly utilityLogic
33
33
 
34
34
 
35
35
  constructor(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session) {
@@ -46,13 +46,13 @@ export class SolidLogic {
46
46
 
47
47
  debug.log('SolidAuthnLogic initialized')
48
48
 
49
- this.aclLogic = createAclLogic(this.store)
49
+ this.acl = createAclLogic(this.store)
50
50
  this.containerLogic = createContainerLogic(this.store)
51
- this.utilityLogic = createUtilityLogic(this.store, this.aclLogic, this.containerLogic)
52
- this.profileLogic = createProfileLogic(this.store, this.authn, this.utilityLogic)
53
- this.chatLogic = createChatLogic(this.store, this.profileLogic)
54
- this.inboxLogic = createInboxLogic(this.store, this.profileLogic, this.utilityLogic, this.containerLogic, this.aclLogic)
55
- this.typeIndexLogic = createTypeIndexLogic(this.store, this.authn, this.profileLogic, this.utilityLogic)
51
+ this.utilityLogic = createUtilityLogic(this.store, this.acl, this.containerLogic)
52
+ this.profile = createProfileLogic(this.store, this.authn, this.utilityLogic)
53
+ this.chat = createChatLogic(this.store, this.profile)
54
+ this.inbox = createInboxLogic(this.store, this.profile, this.utilityLogic, this.containerLogic, this.acl)
55
+ this.typeIndex = createTypeIndexLogic(this.store, this.authn, this.profile, this.utilityLogic)
56
56
  }
57
57
 
58
58
  load(doc: NamedNode | NamedNode[] | string) {
@@ -2,9 +2,10 @@ import { NamedNode } from "rdflib";
2
2
  import { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from "../logic/CustomError";
3
3
  import * as debug from "../util/debug";
4
4
  import { ns as namespace } from '../util/ns';
5
- import { differentOrigin, suggestPreferencesFile } from "../util/utils";
5
+ import { differentOrigin, suggestPreferencesFile } from "../util/utils"
6
+ import { ProfileLogic } from "../types"
6
7
 
7
- export function createProfileLogic(store, authn, utilityLogic) {
8
+ export function createProfileLogic(store, authn, utilityLogic): ProfileLogic {
8
9
  const ns = namespace
9
10
 
10
11
  /**
@@ -1,10 +1,10 @@
1
1
  import { NamedNode, st, sym } from 'rdflib'
2
- import { ScopedApp, TypeIndexScope } from '../types'
2
+ import { ScopedApp, TypeIndexLogic, TypeIndexScope } from '../types'
3
3
  import * as debug from "../util/debug"
4
4
  import { ns as namespace } from '../util/ns'
5
5
  import { newThing, uniqueNodes } from "../util/utils"
6
6
 
7
- export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
7
+ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic): TypeIndexLogic {
8
8
  const ns = namespace
9
9
 
10
10
  function getRegistrations(instance, theClass) {
@@ -153,7 +153,7 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
153
153
  await store.updater.update(statements, [])
154
154
  }
155
155
 
156
- async function getScopedAppsFromIndex(scope, theClass: NamedNode | null) {
156
+ async function getScopedAppsFromIndex(scope: TypeIndexScope, theClass: NamedNode | null): Promise<ScopedApp[]> {
157
157
  const index = scope.index
158
158
  const registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
159
159
  .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
package/src/types.ts CHANGED
@@ -45,3 +45,66 @@ export interface CreatedPaneOptions {
45
45
  newInstance: NamedNode;
46
46
  }
47
47
 
48
+ export interface ChatLogic {
49
+ setAcl: (chatContainer: NamedNode, me: NamedNode, invitee: NamedNode) => Promise<void>,
50
+ addToPrivateTypeIndex: (chatThing, me) => 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) => Promise<NamedNode | null>,
55
+ sendInvite: (invitee: NamedNode, chatThing: NamedNode) => void
56
+ }
57
+
58
+ export interface Chat {
59
+ me: NamedNode,
60
+ chatContainer: NamedNode,
61
+ exists: boolean
62
+ }
63
+
64
+ export interface ProfileLogic {
65
+ silencedLoadPreferences: (user: NamedNode) => Promise<NamedNode | undefined>,
66
+ loadPreferences: (user: NamedNode) => Promise<NamedNode>,
67
+ loadProfile: (user: NamedNode) => Promise<NamedNode>,
68
+ loadMe: () => Promise<NamedNode>,
69
+ getPodRoot: (user: NamedNode) => NamedNode,
70
+ getMainInbox: (user: NamedNode) => Promise<NamedNode>,
71
+ findStorage: (me: NamedNode) => Node | null
72
+ }
73
+
74
+ export interface AclLogic {
75
+ findAclDocUrl: (url: string) => Promise<any>,
76
+ setACLUserPublic: (docURI: string, me: NamedNode,
77
+ options: {
78
+ defaultForNew?: boolean,
79
+ public?: []
80
+ }
81
+ ) => Promise<NamedNode>,
82
+ genACLText: (docURI: string, me: NamedNode, aclURI: string,
83
+ options: {
84
+ defaultForNew?: boolean,
85
+ public?: []
86
+ }
87
+ ) => string | undefined
88
+ }
89
+
90
+ export interface InboxLogic {
91
+ createInboxFor: (peerWebId: string, nick: string) => Promise<string>,
92
+ getNewMessages: (user?: NamedNode) => Promise<string[]>,
93
+ markAsRead: (url: string, date: Date) => void
94
+ }
95
+
96
+ export interface TypeIndexLogic {
97
+ getRegistrations: (instance, theClass) => Promise<NamedNode>,
98
+ loadTypeIndexesFor: (user: NamedNode) => Promise<Array<TypeIndexScope>>,
99
+ loadCommunityTypeIndexes: (user: NamedNode) => Promise<TypeIndexScope[][]>,
100
+ loadAllTypeIndexes: (user: NamedNode) => Promise<Array<TypeIndexScope>>,
101
+ getScopedAppInstances: (klass: NamedNode, user: NamedNode) => Promise<ScopedApp[]>,
102
+ getAppInstances: (klass: NamedNode) => Promise<NamedNode[]>,
103
+ suggestPublicTypeIndex: (me: NamedNode) => NamedNode,
104
+ suggestPrivateTypeIndex: (preferencesFile: NamedNode) => NamedNode,
105
+ registerInTypeIndex: (instance: NamedNode, index: NamedNode, theClass: NamedNode) => Promise<NamedNode | null>,
106
+ deleteTypeIndexRegistration: (item: any) => Promise<void>
107
+ getScopedAppsFromIndex: (scope: TypeIndexScope, theClass: NamedNode | null) => Promise<ScopedApp[]>
108
+
109
+ }
110
+
@@ -1,67 +0,0 @@
1
- import * as rdf from "rdflib";
2
- import { SolidAuthnLogic } from "../authn/SolidAuthnLogic";
3
- export declare function solidLogicSingleton(): {
4
- store: rdf.LiveStore;
5
- authn: SolidAuthnLogic;
6
- authSession: import("@inrupt/solid-client-authn-browser").Session;
7
- recursiveDelete: (url: string) => Promise<any>;
8
- setSinglePeerAccess: (options: {
9
- ownerWebId: string;
10
- peerWebId: string;
11
- accessToModes?: string | undefined;
12
- defaultModes?: string | undefined;
13
- target: string;
14
- }) => Promise<any>;
15
- createEmptyRdfDoc: (doc: rdf.NamedNode, comment: string) => Promise<void>;
16
- followOrCreateLink: (subject: rdf.NamedNode, predicate: rdf.NamedNode, object: rdf.NamedNode, doc: rdf.NamedNode) => Promise<rdf.NamedNode | null>;
17
- loadOrCreateIfNotExists: (doc: rdf.NamedNode) => Promise<any>;
18
- isContainer: (url: string) => boolean;
19
- createContainer: (url: string) => Promise<void>;
20
- getContainerElements: (containerNode: rdf.NamedNode) => rdf.NamedNode[];
21
- getContainerMembers: (containerUrl: string) => Promise<string[]>;
22
- registerInTypeIndex: (instance: rdf.NamedNode, index: rdf.NamedNode, theClass: rdf.NamedNode) => Promise<rdf.NamedNode | null>;
23
- getRegistrations: (instance: any, theClass: any) => any;
24
- loadTypeIndexesFor: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[]>;
25
- loadCommunityTypeIndexes: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[][]>;
26
- loadAllTypeIndexes: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[]>;
27
- getScopedAppInstances: (klass: rdf.NamedNode, user: rdf.NamedNode) => Promise<import("../types").ScopedApp[]>;
28
- getAppInstances: (klass: rdf.NamedNode) => Promise<rdf.NamedNode[]>;
29
- suggestPublicTypeIndex: (me: rdf.NamedNode) => rdf.NamedNode;
30
- suggestPrivateTypeIndex: (preferencesFile: rdf.NamedNode) => rdf.NamedNode;
31
- deleteTypeIndexRegistration: (item: any) => Promise<void>;
32
- getScopedAppsFromIndex: (scope: any, theClass: rdf.NamedNode | null) => Promise<{
33
- instance: rdf.NamedNode;
34
- scope: any;
35
- }[]>;
36
- loadMe: () => Promise<rdf.NamedNode>;
37
- getPodRoot: (user: rdf.NamedNode) => rdf.NamedNode;
38
- getMainInbox: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
39
- findStorage: (me: rdf.NamedNode) => any;
40
- loadPreferences: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
41
- loadProfile: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
42
- silencedLoadPreferences: (user: rdf.NamedNode) => Promise<rdf.NamedNode | undefined>;
43
- createInboxFor: (peerWebId: string, nick: string) => Promise<string>;
44
- getNewMessages: (user?: rdf.NamedNode | undefined) => Promise<string[]>;
45
- markAsRead: (url: string, date: Date) => Promise<void>;
46
- setAcl: (chatContainer: rdf.NamedNode, me: rdf.NamedNode, invitee: rdf.NamedNode) => Promise<void>;
47
- addToPrivateTypeIndex: (chatThing: any, me: any) => Promise<void>;
48
- findChat: (invitee: rdf.NamedNode) => Promise<{
49
- me: any;
50
- chatContainer: rdf.NamedNode;
51
- exists: boolean;
52
- }>;
53
- createChatThing: (chatContainer: rdf.NamedNode, me: rdf.NamedNode) => Promise<rdf.NamedNode>;
54
- getChat: (invitee: rdf.NamedNode, createIfMissing?: boolean) => Promise<rdf.NamedNode | null>;
55
- sendInvite: (invitee: rdf.NamedNode, chatThing: rdf.NamedNode) => Promise<void>;
56
- mintNew: (newPaneOptions: import("../types").NewPaneOptions) => Promise<import("../types").CreatedPaneOptions>;
57
- findAclDocUrl: (url: string) => Promise<any>;
58
- setACLUserPublic: (docURI: string, me: rdf.NamedNode, options: {
59
- defaultForNew?: boolean | undefined;
60
- public?: [] | undefined;
61
- }) => Promise<rdf.NamedNode>;
62
- genACLText: (docURI: string, me: rdf.NamedNode, aclURI: string, options?: {
63
- defaultForNew?: boolean | undefined;
64
- public?: [] | undefined;
65
- }) => string | undefined;
66
- };
67
- //# sourceMappingURL=solidLogicSingletonNew.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"solidLogicSingletonNew.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingletonNew.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAW1D,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8IlC"}
@@ -1,219 +0,0 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (_) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.solidLogicSingleton = void 0;
63
- var rdf = __importStar(require("rdflib"));
64
- var SolidAuthnLogic_1 = require("../authn/SolidAuthnLogic");
65
- var authSession_1 = require("../authSession/authSession");
66
- var containerLogic_1 = require("../util/containerLogic");
67
- var typeIndexLogic_1 = require("../typeIndex/typeIndexLogic");
68
- var debug = __importStar(require("../util/debug"));
69
- var utilityLogic_1 = require("../util/utilityLogic");
70
- var profileLogic_1 = require("../profile/profileLogic");
71
- var inboxLogic_1 = require("../inbox/inboxLogic");
72
- var chatLogic_1 = require("../chat/chatLogic");
73
- var aclLogic_1 = require("../acl/aclLogic");
74
- function solidLogicSingleton() {
75
- var _this = this;
76
- var _fetch = function (url, requestInit) { return __awaiter(_this, void 0, void 0, function () {
77
- var omitCreds;
78
- return __generator(this, function (_a) {
79
- omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
80
- if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
81
- // In fact fetch should respect credentials omit itself
82
- return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
83
- }
84
- else {
85
- return [2 /*return*/, window.fetch(url, requestInit)];
86
- }
87
- return [2 /*return*/];
88
- });
89
- }); };
90
- debug.log("SolidLogicSingleton: Unique instance created. There should only be one of these.");
91
- var store = rdf.graph(); // Make a Quad store
92
- rdf.fetcher(store, { fetch: _fetch }); // Attach a web I/O module, store.fetcher
93
- store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
94
- store.features = []; // disable automatic node merging on store load
95
- debug.log('SolidAuthnLogic initialized');
96
- var authn = new SolidAuthnLogic_1.SolidAuthnLogic(authSession_1.authSession);
97
- var aclLogic = (0, aclLogic_1.createAclLogic)(store);
98
- var findAclDocUrl = aclLogic.findAclDocUrl, setACLUserPublic = aclLogic.setACLUserPublic, genACLText = aclLogic.genACLText;
99
- var containerLogic = (0, containerLogic_1.createContainerLogic)(store);
100
- var isContainer = containerLogic.isContainer, createContainer = containerLogic.createContainer, getContainerElements = containerLogic.getContainerElements, getContainerMembers = containerLogic.getContainerMembers;
101
- var utilityLogic = (0, utilityLogic_1.createUtilityLogic)(store, aclLogic, containerLogic);
102
- var recursiveDelete = utilityLogic.recursiveDelete, setSinglePeerAccess = utilityLogic.setSinglePeerAccess, createEmptyRdfDoc = utilityLogic.createEmptyRdfDoc, followOrCreateLink = utilityLogic.followOrCreateLink, loadOrCreateIfNotExists = utilityLogic.loadOrCreateIfNotExists;
103
- var profileLogic = (0, profileLogic_1.createProfileLogic)(store, authn, utilityLogic);
104
- var loadMe = profileLogic.loadMe, getPodRoot = profileLogic.getPodRoot, getMainInbox = profileLogic.getMainInbox, findStorage = profileLogic.findStorage, loadPreferences = profileLogic.loadPreferences, loadProfile = profileLogic.loadProfile, silencedLoadPreferences = profileLogic.silencedLoadPreferences;
105
- var chatLogic = (0, chatLogic_1.createChatLogic)(store, profileLogic);
106
- var setAcl = chatLogic.setAcl, addToPrivateTypeIndex = chatLogic.addToPrivateTypeIndex, findChat = chatLogic.findChat, createChatThing = chatLogic.createChatThing, getChat = chatLogic.getChat, sendInvite = chatLogic.sendInvite, mintNew = chatLogic.mintNew;
107
- var inboxLogic = (0, inboxLogic_1.createInboxLogic)(store, profileLogic, utilityLogic, containerLogic, aclLogic);
108
- var createInboxFor = inboxLogic.createInboxFor, getNewMessages = inboxLogic.getNewMessages, markAsRead = inboxLogic.markAsRead;
109
- var typeIndexLogic = (0, typeIndexLogic_1.createTypeIndexLogic)(store, authn, profileLogic, utilityLogic);
110
- var registerInTypeIndex = typeIndexLogic.registerInTypeIndex, getRegistrations = typeIndexLogic.getRegistrations, loadTypeIndexesFor = typeIndexLogic.loadTypeIndexesFor, loadCommunityTypeIndexes = typeIndexLogic.loadCommunityTypeIndexes, loadAllTypeIndexes = typeIndexLogic.loadAllTypeIndexes, getScopedAppInstances = typeIndexLogic.getScopedAppInstances, getAppInstances = typeIndexLogic.getAppInstances, suggestPublicTypeIndex = typeIndexLogic.suggestPublicTypeIndex, suggestPrivateTypeIndex = typeIndexLogic.suggestPrivateTypeIndex, deleteTypeIndexRegistration = typeIndexLogic.deleteTypeIndexRegistration, getScopedAppsFromIndex = typeIndexLogic.getScopedAppsFromIndex;
111
- return {
112
- store: store,
113
- authn: authn,
114
- authSession: authSession_1.authSession,
115
- //unilityLogic
116
- recursiveDelete: recursiveDelete,
117
- setSinglePeerAccess: setSinglePeerAccess,
118
- createEmptyRdfDoc: createEmptyRdfDoc,
119
- followOrCreateLink: followOrCreateLink,
120
- loadOrCreateIfNotExists: loadOrCreateIfNotExists,
121
- //containerLogic
122
- isContainer: isContainer,
123
- createContainer: createContainer,
124
- getContainerElements: getContainerElements,
125
- getContainerMembers: getContainerMembers,
126
- //typeIndexLogic
127
- registerInTypeIndex: registerInTypeIndex,
128
- getRegistrations: getRegistrations,
129
- loadTypeIndexesFor: loadTypeIndexesFor,
130
- loadCommunityTypeIndexes: loadCommunityTypeIndexes,
131
- loadAllTypeIndexes: loadAllTypeIndexes,
132
- getScopedAppInstances: getScopedAppInstances,
133
- getAppInstances: getAppInstances,
134
- suggestPublicTypeIndex: suggestPublicTypeIndex,
135
- suggestPrivateTypeIndex: suggestPrivateTypeIndex,
136
- deleteTypeIndexRegistration: deleteTypeIndexRegistration,
137
- getScopedAppsFromIndex: getScopedAppsFromIndex,
138
- //profileLogic
139
- loadMe: loadMe,
140
- getPodRoot: getPodRoot,
141
- getMainInbox: getMainInbox,
142
- findStorage: findStorage,
143
- loadPreferences: loadPreferences,
144
- loadProfile: loadProfile,
145
- silencedLoadPreferences: silencedLoadPreferences,
146
- //inboxLogic
147
- createInboxFor: createInboxFor,
148
- getNewMessages: getNewMessages,
149
- markAsRead: markAsRead,
150
- //chatLogic
151
- setAcl: setAcl,
152
- addToPrivateTypeIndex: addToPrivateTypeIndex,
153
- findChat: findChat,
154
- createChatThing: createChatThing,
155
- getChat: getChat,
156
- sendInvite: sendInvite,
157
- mintNew: mintNew,
158
- //aclLogic
159
- findAclDocUrl: findAclDocUrl,
160
- setACLUserPublic: setACLUserPublic,
161
- genACLText: genACLText
162
- };
163
- }
164
- exports.solidLogicSingleton = solidLogicSingleton;
165
- /*export {
166
- store,
167
- authn,
168
- authSession,
169
- //unilityLogic
170
- recursiveDelete,
171
- setSinglePeerAccess,
172
- createEmptyRdfDoc,
173
- followOrCreateLink,
174
- loadOrCreateIfNotExists,
175
- //containerLogic
176
- isContainer,
177
- createContainer,
178
- getContainerElements,
179
- getContainerMembers,
180
- //typeIndexLogic
181
- ensureTypeIndexes,
182
- registerInTypeIndex,
183
- getRegistrations,
184
- loadTypeIndexesFor,
185
- loadCommunityTypeIndexes,
186
- loadAllTypeIndexes,
187
- getScopedAppInstances,
188
- getAppInstances,
189
- suggestPublicTypeIndex,
190
- suggestPrivateTypeIndex,
191
- deleteTypeIndexRegistration,
192
- getScopedAppsFromIndex,
193
- //profileLogic
194
- loadMe,
195
- getPodRoot,
196
- getMainInbox,
197
- findStorage,
198
- loadPreferences,
199
- loadProfile,
200
- silencedLoadPreferences,
201
- //inboxLogic
202
- createInboxFor,
203
- getNewMessages,
204
- markAsRead,
205
- //chatLogic
206
- setAcl,
207
- addToPrivateTypeIndex,
208
- findChat,
209
- createChatThing,
210
- getChat,
211
- sendInvite,
212
- mintNew,
213
- //aclLogic
214
- findAclDocUrl,
215
- setACLUserPublic,
216
- genACLText
217
- }
218
- */
219
- //# sourceMappingURL=solidLogicSingletonNew.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"solidLogicSingletonNew.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingletonNew.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6B;AAC7B,4DAA0D;AAC1D,0DAAwD;AACxD,yDAA6D;AAC7D,8DAAkE;AAClE,mDAAsC;AACtC,qDAAyD;AACzD,wDAA4D;AAC5D,kDAAsD;AACtD,+CAAmD;AACnD,4CAAgD;AAEhD,SAAgB,mBAAmB;IAAnC,iBA8IC;IA5IG,IAAM,MAAM,GAAG,UAAO,GAAG,EAAE,WAAW;;;YAC5B,SAAS,GAAG,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,MAAM,CAAA;YAC7F,IAAI,yBAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,oDAAoD;gBAC5F,uDAAuD;gBACvD,sBAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;aAC7C;iBAAM;gBACH,sBAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;aACxC;;;SACJ,CAAA;IAED,KAAK,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAA;IAE9F,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,E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