solid-logic 4.0.8-3 → 5.0.0
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/README.md +4 -3
- package/dist/2729812e0bfc062ee77a.js +1 -0
- package/dist/a9c30b64ceaae48b72f0.js +2045 -0
- package/dist/acl/aclLogic.d.ts +5 -0
- package/dist/acl/aclLogic.d.ts.map +1 -0
- package/dist/authSession/authSession.d.ts +42 -0
- package/dist/authSession/authSession.d.ts.map +1 -0
- package/dist/authSession/events.d.ts +24 -0
- package/dist/authSession/events.d.ts.map +1 -0
- package/dist/authSession/issuer.d.ts +8 -0
- package/dist/authSession/issuer.d.ts.map +1 -0
- package/dist/authSession/session.d.ts +45 -0
- package/dist/authSession/session.d.ts.map +1 -0
- package/dist/authn/SolidAuthnLogic.d.ts +42 -0
- package/dist/authn/SolidAuthnLogic.d.ts.map +1 -0
- package/dist/authn/authUtil.d.ts +17 -0
- package/dist/authn/authUtil.d.ts.map +1 -0
- package/dist/authn/serverLogout.d.ts +6 -0
- package/dist/authn/serverLogout.d.ts.map +1 -0
- package/dist/chat/chatLogic.d.ts +3 -0
- package/dist/chat/chatLogic.d.ts.map +1 -0
- package/dist/inbox/inboxLogic.d.ts +3 -0
- package/dist/inbox/inboxLogic.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/issuer/issuerLogic.d.ts +8 -0
- package/dist/issuer/issuerLogic.d.ts.map +1 -0
- package/dist/logic/CustomError.d.ts +21 -0
- package/dist/logic/CustomError.d.ts.map +1 -0
- package/dist/logic/solidLogic.d.ts +6 -0
- package/dist/logic/solidLogic.d.ts.map +1 -0
- package/dist/logic/solidLogicSingleton.d.ts +4 -0
- package/dist/logic/solidLogicSingleton.d.ts.map +1 -0
- package/dist/profile/profileAclDocuments.d.ts +2 -0
- package/dist/profile/profileAclDocuments.d.ts.map +1 -0
- package/dist/profile/profileDocuments.d.ts +2 -0
- package/dist/profile/profileDocuments.d.ts.map +1 -0
- package/dist/profile/profileLogic.d.ts +3 -0
- package/dist/profile/profileLogic.d.ts.map +1 -0
- package/dist/solid-logic.esm.js +2358 -0
- package/dist/solid-logic.esm.js.map +1 -0
- package/dist/solid-logic.esm.min.js +2 -0
- package/dist/solid-logic.esm.min.js.map +1 -0
- package/dist/solid-logic.js +7548 -0
- package/dist/solid-logic.js.map +1 -0
- package/dist/solid-logic.min.js +2 -0
- package/dist/solid-logic.min.js.map +1 -0
- package/dist/typeIndex/typeIndexAclDocuments.d.ts +2 -0
- package/dist/typeIndex/typeIndexAclDocuments.d.ts.map +1 -0
- package/dist/typeIndex/typeIndexDocuments.d.ts +3 -0
- package/dist/typeIndex/typeIndexDocuments.d.ts.map +1 -0
- package/dist/typeIndex/typeIndexLogic.d.ts +3 -0
- package/dist/typeIndex/typeIndexLogic.d.ts.map +1 -0
- package/dist/types.d.ts +113 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/util/containerLogic.d.ts +11 -0
- package/dist/util/containerLogic.d.ts.map +1 -0
- package/dist/util/debug.d.ts +5 -0
- package/dist/util/debug.d.ts.map +1 -0
- package/dist/util/ns.d.ts +2 -0
- package/dist/util/ns.d.ts.map +1 -0
- package/dist/util/utilityLogic.d.ts +17 -0
- package/dist/util/utilityLogic.d.ts.map +1 -0
- package/dist/util/utils.d.ts +8 -0
- package/dist/util/utils.d.ts.map +1 -0
- package/package.json +33 -27
- package/dist/_virtual/_rolldown/runtime.cjs.js +0 -1
- package/dist/acl/aclLogic.cjs.js +0 -2
- package/dist/acl/aclLogic.cjs.js.map +0 -1
- package/dist/acl/aclLogic.esm.js +0 -56
- package/dist/acl/aclLogic.esm.js.map +0 -1
- package/dist/authSession/authSession.cjs.js +0 -2
- package/dist/authSession/authSession.cjs.js.map +0 -1
- package/dist/authSession/authSession.esm.js +0 -22
- package/dist/authSession/authSession.esm.js.map +0 -1
- package/dist/authSession/events.cjs.js +0 -2
- package/dist/authSession/events.cjs.js.map +0 -1
- package/dist/authSession/events.esm.js +0 -19
- package/dist/authSession/events.esm.js.map +0 -1
- package/dist/authSession/issuer.cjs.js +0 -2
- package/dist/authSession/issuer.cjs.js.map +0 -1
- package/dist/authSession/issuer.esm.js +0 -18
- package/dist/authSession/issuer.esm.js.map +0 -1
- package/dist/authSession/session.cjs.js +0 -2
- package/dist/authSession/session.cjs.js.map +0 -1
- package/dist/authSession/session.esm.js +0 -102
- package/dist/authSession/session.esm.js.map +0 -1
- package/dist/authn/SolidAuthnLogic.cjs.js +0 -2
- package/dist/authn/SolidAuthnLogic.cjs.js.map +0 -1
- package/dist/authn/SolidAuthnLogic.esm.js +0 -116
- package/dist/authn/SolidAuthnLogic.esm.js.map +0 -1
- package/dist/authn/authUtil.cjs.js +0 -2
- package/dist/authn/authUtil.cjs.js.map +0 -1
- package/dist/authn/authUtil.esm.js +0 -33
- package/dist/authn/authUtil.esm.js.map +0 -1
- package/dist/authn/serverLogout.cjs.js +0 -2
- package/dist/authn/serverLogout.cjs.js.map +0 -1
- package/dist/authn/serverLogout.esm.js +0 -25
- package/dist/authn/serverLogout.esm.js.map +0 -1
- package/dist/chat/chatLogic.cjs.js +0 -21
- package/dist/chat/chatLogic.cjs.js.map +0 -1
- package/dist/chat/chatLogic.esm.js +0 -116
- package/dist/chat/chatLogic.esm.js.map +0 -1
- package/dist/inbox/inboxLogic.cjs.js +0 -2
- package/dist/inbox/inboxLogic.cjs.js.map +0 -1
- package/dist/inbox/inboxLogic.esm.js +0 -37
- package/dist/inbox/inboxLogic.esm.js.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -13
- package/dist/index.esm.js.map +0 -1
- package/dist/issuer/issuerLogic.cjs.js +0 -2
- package/dist/issuer/issuerLogic.cjs.js.map +0 -1
- package/dist/issuer/issuerLogic.esm.js +0 -30
- package/dist/issuer/issuerLogic.esm.js.map +0 -1
- package/dist/logic/CustomError.cjs.js +0 -2
- package/dist/logic/CustomError.cjs.js.map +0 -1
- package/dist/logic/CustomError.esm.js +0 -14
- package/dist/logic/CustomError.esm.js.map +0 -1
- package/dist/logic/solidLogic.cjs.js +0 -2
- package/dist/logic/solidLogic.cjs.js.map +0 -1
- package/dist/logic/solidLogic.esm.js +0 -47
- package/dist/logic/solidLogic.esm.js.map +0 -1
- package/dist/logic/solidLogicSingleton.cjs.js +0 -2
- package/dist/logic/solidLogicSingleton.cjs.js.map +0 -1
- package/dist/logic/solidLogicSingleton.esm.js +0 -19
- package/dist/logic/solidLogicSingleton.esm.js.map +0 -1
- package/dist/profile/profileAclDocuments.cjs.js +0 -3
- package/dist/profile/profileAclDocuments.cjs.js.map +0 -1
- package/dist/profile/profileAclDocuments.esm.js +0 -17
- package/dist/profile/profileAclDocuments.esm.js.map +0 -1
- package/dist/profile/profileDocuments.cjs.js +0 -3
- package/dist/profile/profileDocuments.cjs.js.map +0 -1
- package/dist/profile/profileDocuments.esm.js +0 -15
- package/dist/profile/profileDocuments.esm.js.map +0 -1
- package/dist/profile/profileLogic.cjs.js +0 -2
- package/dist/profile/profileLogic.cjs.js.map +0 -1
- package/dist/profile/profileLogic.esm.js +0 -184
- package/dist/profile/profileLogic.esm.js.map +0 -1
- package/dist/typeIndex/typeIndexAclDocuments.cjs.js +0 -3
- package/dist/typeIndex/typeIndexAclDocuments.cjs.js.map +0 -1
- package/dist/typeIndex/typeIndexAclDocuments.esm.js +0 -35
- package/dist/typeIndex/typeIndexAclDocuments.esm.js.map +0 -1
- package/dist/typeIndex/typeIndexDocuments.cjs.js +0 -4
- package/dist/typeIndex/typeIndexDocuments.cjs.js.map +0 -1
- package/dist/typeIndex/typeIndexDocuments.esm.js +0 -21
- package/dist/typeIndex/typeIndexDocuments.esm.js.map +0 -1
- package/dist/typeIndex/typeIndexLogic.cjs.js +0 -2
- package/dist/typeIndex/typeIndexLogic.cjs.js.map +0 -1
- package/dist/typeIndex/typeIndexLogic.esm.js +0 -185
- package/dist/typeIndex/typeIndexLogic.esm.js.map +0 -1
- package/dist/util/containerLogic.cjs.js +0 -2
- package/dist/util/containerLogic.cjs.js.map +0 -1
- package/dist/util/containerLogic.esm.js +0 -37
- package/dist/util/containerLogic.esm.js.map +0 -1
- package/dist/util/debug.cjs.js +0 -2
- package/dist/util/debug.cjs.js.map +0 -1
- package/dist/util/debug.esm.js +0 -11
- package/dist/util/debug.esm.js.map +0 -1
- package/dist/util/ns.cjs.js +0 -2
- package/dist/util/ns.cjs.js.map +0 -1
- package/dist/util/ns.esm.js +0 -8
- package/dist/util/ns.esm.js.map +0 -1
- package/dist/util/utilityLogic.cjs.js +0 -6
- package/dist/util/utilityLogic.cjs.js.map +0 -1
- package/dist/util/utilityLogic.esm.js +0 -149
- package/dist/util/utilityLogic.esm.js.map +0 -1
- package/dist/util/utils.cjs.js +0 -2
- package/dist/util/utils.cjs.js.map +0 -1
- package/dist/util/utils.esm.js +0 -22
- package/dist/util/utils.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndexAclDocuments.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexAclDocuments.ts"],"names":[],"mappings":"AAAA,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CA6B5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndexDocuments.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexDocuments.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,IAAI,MAAM,CAOhD;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAOjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeIndexLogic.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,cAAc,EAAkB,MAAM,UAAU,CAAA;AAMpE,wBAAgB,oBAAoB,CAAC,KAAK,KAAA,EAAE,KAAK,KAAA,EAAE,YAAY,KAAA,EAAE,YAAY,KAAA,GAAG,cAAc,CAgQ7F"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { SessionWithLegacyEvents } from './authSession/authSession';
|
|
2
|
+
import { LiveStore, NamedNode, Statement } from 'rdflib';
|
|
3
|
+
export type AppDetails = {
|
|
4
|
+
noun: string;
|
|
5
|
+
appPathSegment: string;
|
|
6
|
+
};
|
|
7
|
+
export type AuthenticationContext = {
|
|
8
|
+
containers?: Array<NamedNode>;
|
|
9
|
+
div?: HTMLElement;
|
|
10
|
+
dom?: HTMLDocument;
|
|
11
|
+
index?: {
|
|
12
|
+
[key: string]: Array<NamedNode>;
|
|
13
|
+
};
|
|
14
|
+
instances?: Array<NamedNode>;
|
|
15
|
+
me?: NamedNode | null;
|
|
16
|
+
noun?: string;
|
|
17
|
+
preferencesFile?: NamedNode;
|
|
18
|
+
preferencesFileError?: string;
|
|
19
|
+
publicProfile?: NamedNode;
|
|
20
|
+
statusArea?: HTMLElement;
|
|
21
|
+
};
|
|
22
|
+
export interface AuthnLogic {
|
|
23
|
+
authSession: SessionWithLegacyEvents;
|
|
24
|
+
currentUser: () => NamedNode | null;
|
|
25
|
+
checkUser: <T>(setUserCallback?: (me: NamedNode | null) => T) => Promise<NamedNode | T | null>;
|
|
26
|
+
saveUser: (webId: NamedNode | string | null, context?: AuthenticationContext) => NamedNode | null;
|
|
27
|
+
}
|
|
28
|
+
export interface SolidNamespace {
|
|
29
|
+
[key: string]: (term: string) => NamedNode;
|
|
30
|
+
}
|
|
31
|
+
export type TypeIndexScope = {
|
|
32
|
+
label: string;
|
|
33
|
+
index: NamedNode;
|
|
34
|
+
agent: NamedNode;
|
|
35
|
+
};
|
|
36
|
+
export type ScopedApp = {
|
|
37
|
+
instance: NamedNode;
|
|
38
|
+
type: NamedNode;
|
|
39
|
+
scope: TypeIndexScope;
|
|
40
|
+
};
|
|
41
|
+
export interface NewPaneOptions {
|
|
42
|
+
me?: NamedNode;
|
|
43
|
+
newInstance?: NamedNode;
|
|
44
|
+
newBase: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CreatedPaneOptions {
|
|
47
|
+
newInstance: NamedNode;
|
|
48
|
+
}
|
|
49
|
+
export interface ChatLogic {
|
|
50
|
+
setAcl: (chatContainer: NamedNode, me: NamedNode, invitee: NamedNode) => Promise<void>;
|
|
51
|
+
addToPrivateTypeIndex: (chatThing: any, me: any) => void | Promise<void>;
|
|
52
|
+
findChat: (invitee: NamedNode) => Promise<Chat>;
|
|
53
|
+
createChatThing: (chatContainer: NamedNode, me: NamedNode) => Promise<NamedNode>;
|
|
54
|
+
mintNew: (newPaneOptions: NewPaneOptions) => Promise<CreatedPaneOptions>;
|
|
55
|
+
getChat: (invitee: NamedNode, boolean: any) => Promise<NamedNode | null>;
|
|
56
|
+
sendInvite: (invitee: NamedNode, chatThing: NamedNode) => void;
|
|
57
|
+
}
|
|
58
|
+
export interface Chat {
|
|
59
|
+
me: NamedNode;
|
|
60
|
+
chatContainer: NamedNode;
|
|
61
|
+
exists: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ProfileLogic {
|
|
64
|
+
silencedLoadPreferences: (user: NamedNode) => Promise<NamedNode | undefined>;
|
|
65
|
+
loadPreferences: (user: NamedNode) => Promise<NamedNode>;
|
|
66
|
+
loadProfile: (user: NamedNode) => Promise<NamedNode>;
|
|
67
|
+
loadMe: () => Promise<NamedNode>;
|
|
68
|
+
getPodRoot: (user: NamedNode) => NamedNode;
|
|
69
|
+
getMainInbox: (user: NamedNode) => Promise<NamedNode>;
|
|
70
|
+
findStorage: (me: NamedNode) => Node | null;
|
|
71
|
+
}
|
|
72
|
+
export interface AclLogic {
|
|
73
|
+
findAclDocUrl: (url: NamedNode) => Promise<string | undefined>;
|
|
74
|
+
setACLUserPublic: (docURI: string, me: NamedNode, options: {
|
|
75
|
+
defaultForNew?: boolean;
|
|
76
|
+
public?: [];
|
|
77
|
+
}) => Promise<NamedNode>;
|
|
78
|
+
genACLText: (docURI: string, me: NamedNode, aclURI: string, options: {
|
|
79
|
+
defaultForNew?: boolean;
|
|
80
|
+
public?: [];
|
|
81
|
+
}) => string | undefined;
|
|
82
|
+
}
|
|
83
|
+
export interface InboxLogic {
|
|
84
|
+
createInboxFor: (peerWebId: string, nick: string) => Promise<string>;
|
|
85
|
+
getNewMessages: (user?: NamedNode) => Promise<NamedNode[]>;
|
|
86
|
+
markAsRead: (url: string, date: Date) => void;
|
|
87
|
+
}
|
|
88
|
+
export interface TypeIndexLogic {
|
|
89
|
+
getRegistrations: (instance: any, theClass: any) => Node[];
|
|
90
|
+
loadTypeIndexesFor: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
|
|
91
|
+
loadCommunityTypeIndexes: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
|
|
92
|
+
loadAllTypeIndexes: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
|
|
93
|
+
getScopedAppInstances: (klass: NamedNode, user: NamedNode) => Promise<ScopedApp[]>;
|
|
94
|
+
getAppInstances: (klass: NamedNode) => Promise<NamedNode[]>;
|
|
95
|
+
suggestPublicTypeIndex: (me: NamedNode) => NamedNode;
|
|
96
|
+
suggestPrivateTypeIndex: (preferencesFile: NamedNode) => NamedNode;
|
|
97
|
+
registerInTypeIndex: (instance: NamedNode, index: NamedNode, theClass: NamedNode) => Promise<NamedNode | null>;
|
|
98
|
+
deleteTypeIndexRegistration: (item: any) => Promise<void>;
|
|
99
|
+
getScopedAppsFromIndex: (scope: TypeIndexScope, theClass: NamedNode | null) => Promise<ScopedApp[]>;
|
|
100
|
+
}
|
|
101
|
+
export interface SolidLogic {
|
|
102
|
+
store: LiveStore;
|
|
103
|
+
authn: AuthnLogic;
|
|
104
|
+
acl: AclLogic;
|
|
105
|
+
profile: ProfileLogic;
|
|
106
|
+
inbox: InboxLogic;
|
|
107
|
+
typeIndex: TypeIndexLogic;
|
|
108
|
+
chat: ChatLogic;
|
|
109
|
+
load: (doc: NamedNode | NamedNode[] | string) => void;
|
|
110
|
+
updatePromise: (del: Array<Statement>, ins: Array<Statement>) => Promise<void>;
|
|
111
|
+
clearStore: () => void;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAExD,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7B,GAAG,CAAC,EAAE,WAAW,CAAA;IACjB,GAAG,CAAC,EAAE,YAAY,CAAA;IAClB,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;KAAE,CAAA;IAC3C,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAC5B,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE,WAAW,CAAA;CAC3B,CAAA;AAED,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,uBAAuB,CAAA;IACpC,WAAW,EAAE,MAAM,SAAS,GAAG,IAAI,CAAA;IACnC,SAAS,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,CAAC,EAA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uBAAuB,EAAE,CAAC,eAAe,EAAE,SAAS,KAAK,SAAS,CAAC;IACnE,mBAAmB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC/G,2BAA2B,EAAE,CAAC,IAAI,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NamedNode } from 'rdflib';
|
|
2
|
+
/**
|
|
3
|
+
* Container-related class
|
|
4
|
+
*/
|
|
5
|
+
export declare function createContainerLogic(store: any): {
|
|
6
|
+
isContainer: (url: NamedNode) => boolean;
|
|
7
|
+
createContainer: (url: string) => Promise<void>;
|
|
8
|
+
getContainerElements: (containerNode: NamedNode) => NamedNode[];
|
|
9
|
+
getContainerMembers: (containerUrl: NamedNode) => Promise<NamedNode[]>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=containerLogic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerLogic.d.ts","sourceRoot":"","sources":["../../src/util/containerLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,QAAQ,CAAA;AAElD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,KAAA;uBAYZ,SAAS;2BAKC,MAAM;0CAfG,SAAS,KAAG,SAAS,EAAE;wCAuCnB,SAAS,KAAG,OAAO,CAAC,SAAS,EAAE,CAAC;EAUpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/util/debug.ts"],"names":[],"mappings":"AACA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAExC;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAEzC;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAE1C;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns.d.ts","sourceRoot":"","sources":["../../src/util/ns.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,EAAE,KAAuB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NamedNode } from 'rdflib';
|
|
2
|
+
export declare function createUtilityLogic(store: any, aclLogic: any, containerLogic: any): {
|
|
3
|
+
recursiveDelete: (containerNode: NamedNode) => Promise<any>;
|
|
4
|
+
setSinglePeerAccess: (options: {
|
|
5
|
+
ownerWebId: string;
|
|
6
|
+
peerWebId: string;
|
|
7
|
+
accessToModes?: string;
|
|
8
|
+
defaultModes?: string;
|
|
9
|
+
target: string;
|
|
10
|
+
}) => Promise<any>;
|
|
11
|
+
createEmptyRdfDoc: (doc: NamedNode, comment: string) => Promise<void>;
|
|
12
|
+
followOrCreateLink: (subject: NamedNode, predicate: NamedNode, object: NamedNode, doc: NamedNode) => Promise<NamedNode | null>;
|
|
13
|
+
followOrCreateLinkWithContentOnCreate: (subject: NamedNode, predicate: NamedNode, object: NamedNode, doc: NamedNode, data: string) => Promise<NamedNode | null>;
|
|
14
|
+
loadOrCreateIfNotExists: (doc: NamedNode) => Promise<any>;
|
|
15
|
+
loadOrCreateWithContentOnCreate: (doc: NamedNode, data: string) => Promise<boolean>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=utilityLogic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilityLogic.d.ts","sourceRoot":"","sources":["../../src/util/utilityLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,QAAQ,CAAA;AAY3C,wBAAgB,kBAAkB,CAAC,KAAK,KAAA,EAAE,QAAQ,KAAA,EAAE,cAAc,KAAA;qCAClB,SAAS;mCA0JX;QAC1C,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAA;KACf;6BAuCqC,SAAS,WAAW,MAAM;kCAjHrD,SAAS,aACP,SAAS,UACZ,SAAS,OACZ,SAAS,KACb,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;qDA6BjB,SAAS,aACP,SAAS,UACZ,SAAS,OACZ,SAAS,QACR,MAAM,KACX,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;mCAzGgB,SAAS;2CAkCD,SAAS,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;EAkK/F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NamedNode } from 'rdflib';
|
|
2
|
+
export declare function newThing(doc: NamedNode): NamedNode;
|
|
3
|
+
export declare function uniqueNodes(arr: NamedNode[]): NamedNode[];
|
|
4
|
+
export declare function getArchiveUrl(baseUrl: string, date: Date): string;
|
|
5
|
+
export declare function differentOrigin(doc: any): boolean;
|
|
6
|
+
export declare function suggestPreferencesFile(me: NamedNode): NamedNode;
|
|
7
|
+
export declare function determineChatContainer(invitee: NamedNode, podRoot: NamedNode): NamedNode;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAO,MAAM,QAAQ,CAAA;AAEvC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,CAElD;AAED,wBAAgB,WAAW,CAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAM1D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,UAOxD;AAED,wBAAgB,eAAe,CAAC,GAAG,KAAA,GAAG,OAAO,CAO5C;AAED,wBAAgB,sBAAsB,CAAE,EAAE,EAAC,SAAS,aAMnD;AAED,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,SAAS,GACnB,SAAS,CAQX"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-logic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Core business logic of SolidOS",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/solid-logic.js",
|
|
7
|
+
"module": "dist/solid-logic.esm.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
"require": "./dist/
|
|
11
|
+
"import": "./dist/solid-logic.esm.js",
|
|
12
|
+
"require": "./dist/solid-logic.js",
|
|
12
13
|
"types": "./dist/index.d.ts"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
@@ -20,20 +21,22 @@
|
|
|
20
21
|
],
|
|
21
22
|
"scripts": {
|
|
22
23
|
"clean": "rm -rf dist src/versionInfo.ts",
|
|
23
|
-
"build": "npm run clean && npm run typecheck &&
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"build": "npm run clean && npm run typecheck && npm run build-version && npm run build-js && npm run build-dist && npm run postbuild-js",
|
|
25
|
+
"build-version": "./timestamp.sh > src/versionInfo.ts && eslint 'src/versionInfo.ts' --fix",
|
|
26
|
+
"build-js": "tsc --emitDeclarationOnly",
|
|
27
|
+
"build-dist": "webpack --progress",
|
|
26
28
|
"postbuild-js": "rm -f dist/versionInfo.d.ts dist/versionInfo.d.ts.map dist/index.js dist/index.js.map",
|
|
27
29
|
"lint": "eslint",
|
|
28
30
|
"lint-fix": "eslint --fix",
|
|
29
31
|
"typecheck": "tsc --noEmit",
|
|
30
32
|
"typecheck-test": "tsc --noEmit -p tsconfig.test.json",
|
|
31
|
-
"test": "
|
|
32
|
-
"test-coverage": "
|
|
33
|
-
"test-debug": "node --inspect-brk ./node_modules/.bin/
|
|
33
|
+
"test": "jest --no-coverage",
|
|
34
|
+
"test-coverage": "jest --coverage",
|
|
35
|
+
"test-debug": "node --inspect-brk ./node_modules/.bin/jest -i --env jest-environment-node-debug",
|
|
34
36
|
"ignore:prepublishOnly": "npm run build && npm run lint && npm run test",
|
|
35
37
|
"preversion": "npm run lint && npm run typecheck && npm test",
|
|
36
|
-
"postversion": "git push origin main --follow-tags"
|
|
38
|
+
"postversion": "git push origin main --follow-tags",
|
|
39
|
+
"watch": "npm run build-version && tsc --watch"
|
|
37
40
|
},
|
|
38
41
|
"repository": {
|
|
39
42
|
"type": "git",
|
|
@@ -49,29 +52,32 @@
|
|
|
49
52
|
"node": ">=18"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
|
-
"@
|
|
55
|
+
"@babel/core": "^7.29.0",
|
|
56
|
+
"@babel/preset-env": "^7.29.5",
|
|
57
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
58
|
+
"@types/jest": "^30.0.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
60
|
+
"babel-jest": "^30.4.1",
|
|
61
|
+
"babel-loader": "^10.1.1",
|
|
62
|
+
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
53
63
|
"eslint": "^9.39.4",
|
|
54
64
|
"eslint-config-prettier": "^10.1.8",
|
|
55
65
|
"eslint-plugin-import": "^2.32.0",
|
|
56
|
-
"
|
|
57
|
-
"jsdom": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
66
|
+
"jest": "^30.4.2",
|
|
67
|
+
"jest-environment-jsdom": "^30.4.1",
|
|
68
|
+
"jest-fetch-mock": "^3.0.3",
|
|
69
|
+
"terser-webpack-plugin": "^5.6.0",
|
|
70
|
+
"ts-loader": "^9.5.7",
|
|
60
71
|
"tslib": "^2.8.1",
|
|
61
72
|
"typescript": "^5.9.3",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
73
|
+
"webpack": "^5.106.2",
|
|
74
|
+
"webpack-cli": "^7.0.2"
|
|
64
75
|
},
|
|
65
76
|
"dependencies": {
|
|
66
77
|
"@uvdsl/solid-oidc-client-browser": "^0.2.3",
|
|
67
|
-
"solid-namespace": "^0.5.4"
|
|
68
|
-
"vite": "^8.0.16",
|
|
69
|
-
"vitest": "^4.1.9"
|
|
78
|
+
"solid-namespace": "^0.5.4"
|
|
70
79
|
},
|
|
71
|
-
"
|
|
72
|
-
"rdflib"
|
|
73
|
-
],
|
|
74
|
-
"allowScripts": {
|
|
75
|
-
"fsevents@2.3.3": true
|
|
80
|
+
"peerDependencies": {
|
|
81
|
+
"rdflib": "^2.4.0"
|
|
76
82
|
}
|
|
77
83
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/acl/aclLogic.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("../util/ns.cjs.js");let t=require("rdflib");var n=(0,t.sym)(`http://www.iana.org/assignments/link-relations/acl`);function r(r){let i=e.ns;async function a(e){await r.fetcher.load(e);let t=r.any(e,n);if(!t)throw Error(`No ACL link discovered for ${e}`);return t.value}function o(e,t,i){let a=r.any(r.sym(e),n);return Promise.resolve().then(()=>a||s(e).catch(t=>{throw Error(`Error fetching rel=ACL header for ${e}: ${t}`)})).then(n=>{let a=c(e,t,n.uri,i);if(!r.fetcher)throw Error(`Cannot PUT this, store has no fetcher`);return r.fetcher.webOperation(`PUT`,n.uri,{data:a,contentType:`text/turtle`}).then(e=>{if(!e.ok)throw Error(`Error writing ACL text: `+e.error);return n})})}function s(e){let t=r.fetcher;if(!t)throw Error(`Cannot fetch ACL rel, store has no fetcher`);return t.load(e).then(t=>{if(!t.ok)throw Error(`fetchACLRel: While loading:`+t.error);let i=r.any(r.sym(e),n);if(!i)throw Error(`fetchACLRel: No Link rel=ACL header for `+e);return i})}function c(e,n,r,a={}){let o=a.public||[],s=(0,t.graph)(),c=(0,t.Namespace)(`http://www.w3.org/ns/auth/acl#`),l=s.sym(`${r}#a1`),u=s.sym(r),d=s.sym(e);if(s.add(l,i.rdf(`type`),c(`Authorization`),u),s.add(l,c(`accessTo`),d,u),a.defaultForNew&&s.add(l,c(`default`),d,u),s.add(l,c(`agent`),n,u),s.add(l,c(`mode`),c(`Read`),u),s.add(l,c(`mode`),c(`Write`),u),s.add(l,c(`mode`),c(`Control`),u),o.length){l=s.sym(`${r}#a2`),s.add(l,i.rdf(`type`),c(`Authorization`),u),s.add(l,c(`accessTo`),d,u),s.add(l,c(`agentClass`),i.foaf(`Agent`),u);for(let e=0;e<o.length;e++)s.add(l,c(`mode`),c(o[e]),u)}return(0,t.serialize)(u,s,r)}return{findAclDocUrl:a,setACLUserPublic:o,genACLText:c}}exports.ACL_LINK=n,exports.createAclLogic=r;
|
|
2
|
-
//# sourceMappingURL=aclLogic.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aclLogic.cjs.js","names":[],"sources":["../../src/acl/aclLogic.ts"],"sourcesContent":["import { graph, NamedNode, Namespace, serialize, sym } from 'rdflib'\nimport { AclLogic } from '../types'\nimport { ns as namespace } from '../util/ns'\n\n\nexport const ACL_LINK = sym(\n 'http://www.iana.org/assignments/link-relations/acl'\n)\n\nexport function createAclLogic(store): AclLogic {\n\n const ns = namespace\n \n async function findAclDocUrl(url: NamedNode) {\n await store.fetcher.load(url)\n const docNode = store.any(url, ACL_LINK)\n if (!docNode) {\n throw new Error(`No ACL link discovered for ${url}`)\n }\n return docNode.value\n }\n /**\n * Simple Access Control\n *\n * This function sets up a simple default ACL for a resource, with\n * RWC for the owner, and a specified access (default none) for the public.\n * In all cases owner has read write control.\n * Parameter lists modes allowed to public\n *\n * @param options\n * @param options.public eg ['Read', 'Write']\n *\n * @returns Resolves with aclDoc uri on successful write\n */\n function setACLUserPublic ( \n docURI: string,\n me: NamedNode,\n options: {\n defaultForNew?: boolean,\n public?: []\n }\n ): Promise<NamedNode> {\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n return Promise.resolve()\n .then(() => {\n if (aclDoc) {\n return aclDoc as NamedNode\n }\n\n return fetchACLRel(docURI).catch(err => {\n throw new Error(`Error fetching rel=ACL header for ${docURI}: ${err}`)\n })\n })\n .then(aclDoc => {\n const aclText = genACLText(docURI, me, aclDoc.uri, options)\n if (!store.fetcher) {\n throw new Error('Cannot PUT this, store has no fetcher')\n }\n return store.fetcher\n .webOperation('PUT', aclDoc.uri, {\n data: aclText,\n contentType: 'text/turtle'\n })\n .then(result => {\n if (!result.ok) {\n throw new Error('Error writing ACL text: ' + result.error)\n }\n\n return aclDoc\n })\n })\n }\n\n /**\n * @param docURI\n * @returns\n */\n function fetchACLRel (docURI: string): Promise<NamedNode> {\n const fetcher = store.fetcher\n if (!fetcher) {\n throw new Error('Cannot fetch ACL rel, store has no fetcher')\n }\n\n return fetcher.load(docURI).then(result => {\n if (!result.ok) {\n throw new Error('fetchACLRel: While loading:' + (result as any).error)\n }\n\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n if (!aclDoc) {\n throw new Error('fetchACLRel: No Link rel=ACL header for ' + docURI)\n }\n\n return aclDoc as NamedNode\n })\n }\n\n /**\n * @param docURI\n * @param me\n * @param aclURI\n * @param options\n *\n * @returns Serialized ACL\n */\n function genACLText (\n docURI: string,\n me: NamedNode,\n aclURI: string,\n options: {\n defaultForNew?: boolean,\n public?: []\n } = {}\n ): string | undefined {\n const optPublic = options.public || []\n const g = graph()\n const auth = Namespace('http://www.w3.org/ns/auth/acl#')\n let a = g.sym(`${aclURI}#a1`)\n const acl = g.sym(aclURI)\n const doc = g.sym(docURI)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n if (options.defaultForNew) {\n g.add(a, auth('default'), doc, acl)\n }\n g.add(a, auth('agent'), me, acl)\n g.add(a, auth('mode'), auth('Read'), acl)\n g.add(a, auth('mode'), auth('Write'), acl)\n g.add(a, auth('mode'), auth('Control'), acl)\n\n if (optPublic.length) {\n a = g.sym(`${aclURI}#a2`)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n g.add(a, auth('agentClass'), ns.foaf('Agent'), acl)\n for (let p = 0; p < optPublic.length; p++) {\n g.add(a, auth('mode'), auth(optPublic[p]), acl) // Like 'Read' etc\n }\n }\n return serialize(acl, g, aclURI)\n }\n return {\n findAclDocUrl,\n setACLUserPublic,\n genACLText\n }\n}"],"mappings":"6DAKA,IAAa,GAAA,EAAA,EAAA,IAAA,CACT,oDACJ,EAEA,SAAgB,EAAe,EAAiB,CAE5C,IAAM,EAAK,EAAA,GAEX,eAAe,EAAc,EAAgB,CACzC,MAAM,EAAM,QAAQ,KAAK,CAAG,EAC5B,IAAM,EAAU,EAAM,IAAI,EAAK,CAAQ,EACvC,GAAI,CAAC,EACD,MAAU,MAAM,8BAA8B,GAAK,EAEvD,OAAO,EAAQ,KACnB,CAcA,SAAS,EACT,EACA,EACA,EAIsB,CACtB,IAAM,EAAS,EAAM,IACjB,EAAM,IAAI,CAAM,EAChB,CACJ,EAEA,OAAO,QAAQ,QAAQ,CAAC,CACnB,SACG,GAIG,EAAY,CAAM,CAAC,CAAC,MAAM,GAAO,CACpC,MAAU,MAAM,qCAAqC,EAAO,IAAI,GAAK,CACzE,CAAC,CACA,CAAC,CACD,KAAK,GAAU,CAChB,IAAM,EAAU,EAAW,EAAQ,EAAI,EAAO,IAAK,CAAO,EAC1D,GAAI,CAAC,EAAM,QACP,MAAU,MAAM,uCAAuC,EAE3D,OAAO,EAAM,QACR,aAAa,MAAO,EAAO,IAAK,CACjC,KAAM,EACN,YAAa,aACb,CAAC,CAAC,CACD,KAAK,GAAU,CAChB,GAAI,CAAC,EAAO,GACR,MAAU,MAAM,2BAA6B,EAAO,KAAK,EAG7D,OAAO,CACP,CAAC,CACL,CAAC,CACL,CAMA,SAAS,EAAa,EAAoC,CACtD,IAAM,EAAU,EAAM,QACtB,GAAI,CAAC,EACD,MAAU,MAAM,4CAA4C,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EAAG,CAAG,EAClD,IAAK,IAAI,EAAI,EAAG,EAAI,EAAU,OAAQ,IACtC,EAAE,IAAI,EAAG,EAAK,MAAM,EAAG,EAAK,EAAU,EAAE,EAAG,CAAG,CAElD,CACA,OAAA,EAAA,EAAA,UAAA,CAAiB,EAAK,EAAG,CAAM,CACnC,CACA,MAAO,CACH,gBACA,mBACA,YACJ,CACJ"}
|
package/dist/acl/aclLogic.esm.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ns as e } from "../util/ns.esm.js";
|
|
2
|
-
import { Namespace as t, graph as n, serialize as r, sym as i } from "rdflib";
|
|
3
|
-
//#region src/acl/aclLogic.ts
|
|
4
|
-
var a = i("http://www.iana.org/assignments/link-relations/acl");
|
|
5
|
-
function o(i) {
|
|
6
|
-
let o = e;
|
|
7
|
-
async function s(e) {
|
|
8
|
-
await i.fetcher.load(e);
|
|
9
|
-
let t = i.any(e, a);
|
|
10
|
-
if (!t) throw Error(`No ACL link discovered for ${e}`);
|
|
11
|
-
return t.value;
|
|
12
|
-
}
|
|
13
|
-
function c(e, t, n) {
|
|
14
|
-
let r = i.any(i.sym(e), a);
|
|
15
|
-
return Promise.resolve().then(() => r || l(e).catch((t) => {
|
|
16
|
-
throw Error(`Error fetching rel=ACL header for ${e}: ${t}`);
|
|
17
|
-
})).then((r) => {
|
|
18
|
-
let a = u(e, t, r.uri, n);
|
|
19
|
-
if (!i.fetcher) throw Error("Cannot PUT this, store has no fetcher");
|
|
20
|
-
return i.fetcher.webOperation("PUT", r.uri, {
|
|
21
|
-
data: a,
|
|
22
|
-
contentType: "text/turtle"
|
|
23
|
-
}).then((e) => {
|
|
24
|
-
if (!e.ok) throw Error("Error writing ACL text: " + e.error);
|
|
25
|
-
return r;
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function l(e) {
|
|
30
|
-
let t = i.fetcher;
|
|
31
|
-
if (!t) throw Error("Cannot fetch ACL rel, store has no fetcher");
|
|
32
|
-
return t.load(e).then((t) => {
|
|
33
|
-
if (!t.ok) throw Error("fetchACLRel: While loading:" + t.error);
|
|
34
|
-
let n = i.any(i.sym(e), a);
|
|
35
|
-
if (!n) throw Error("fetchACLRel: No Link rel=ACL header for " + e);
|
|
36
|
-
return n;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function u(e, i, a, s = {}) {
|
|
40
|
-
let c = s.public || [], l = n(), u = t("http://www.w3.org/ns/auth/acl#"), d = l.sym(`${a}#a1`), f = l.sym(a), p = l.sym(e);
|
|
41
|
-
if (l.add(d, o.rdf("type"), u("Authorization"), f), l.add(d, u("accessTo"), p, f), s.defaultForNew && l.add(d, u("default"), p, f), l.add(d, u("agent"), i, f), l.add(d, u("mode"), u("Read"), f), l.add(d, u("mode"), u("Write"), f), l.add(d, u("mode"), u("Control"), f), c.length) {
|
|
42
|
-
d = l.sym(`${a}#a2`), l.add(d, o.rdf("type"), u("Authorization"), f), l.add(d, u("accessTo"), p, f), l.add(d, u("agentClass"), o.foaf("Agent"), f);
|
|
43
|
-
for (let e = 0; e < c.length; e++) l.add(d, u("mode"), u(c[e]), f);
|
|
44
|
-
}
|
|
45
|
-
return r(f, l, a);
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
findAclDocUrl: s,
|
|
49
|
-
setACLUserPublic: c,
|
|
50
|
-
genACLText: u
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
54
|
-
export { a as ACL_LINK, o as createAclLogic };
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=aclLogic.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aclLogic.esm.js","names":[],"sources":["../../src/acl/aclLogic.ts"],"sourcesContent":["import { graph, NamedNode, Namespace, serialize, sym } from 'rdflib'\nimport { AclLogic } from '../types'\nimport { ns as namespace } from '../util/ns'\n\n\nexport const ACL_LINK = sym(\n 'http://www.iana.org/assignments/link-relations/acl'\n)\n\nexport function createAclLogic(store): AclLogic {\n\n const ns = namespace\n \n async function findAclDocUrl(url: NamedNode) {\n await store.fetcher.load(url)\n const docNode = store.any(url, ACL_LINK)\n if (!docNode) {\n throw new Error(`No ACL link discovered for ${url}`)\n }\n return docNode.value\n }\n /**\n * Simple Access Control\n *\n * This function sets up a simple default ACL for a resource, with\n * RWC for the owner, and a specified access (default none) for the public.\n * In all cases owner has read write control.\n * Parameter lists modes allowed to public\n *\n * @param options\n * @param options.public eg ['Read', 'Write']\n *\n * @returns Resolves with aclDoc uri on successful write\n */\n function setACLUserPublic ( \n docURI: string,\n me: NamedNode,\n options: {\n defaultForNew?: boolean,\n public?: []\n }\n ): Promise<NamedNode> {\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n return Promise.resolve()\n .then(() => {\n if (aclDoc) {\n return aclDoc as NamedNode\n }\n\n return fetchACLRel(docURI).catch(err => {\n throw new Error(`Error fetching rel=ACL header for ${docURI}: ${err}`)\n })\n })\n .then(aclDoc => {\n const aclText = genACLText(docURI, me, aclDoc.uri, options)\n if (!store.fetcher) {\n throw new Error('Cannot PUT this, store has no fetcher')\n }\n return store.fetcher\n .webOperation('PUT', aclDoc.uri, {\n data: aclText,\n contentType: 'text/turtle'\n })\n .then(result => {\n if (!result.ok) {\n throw new Error('Error writing ACL text: ' + result.error)\n }\n\n return aclDoc\n })\n })\n }\n\n /**\n * @param docURI\n * @returns\n */\n function fetchACLRel (docURI: string): Promise<NamedNode> {\n const fetcher = store.fetcher\n if (!fetcher) {\n throw new Error('Cannot fetch ACL rel, store has no fetcher')\n }\n\n return fetcher.load(docURI).then(result => {\n if (!result.ok) {\n throw new Error('fetchACLRel: While loading:' + (result as any).error)\n }\n\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n if (!aclDoc) {\n throw new Error('fetchACLRel: No Link rel=ACL header for ' + docURI)\n }\n\n return aclDoc as NamedNode\n })\n }\n\n /**\n * @param docURI\n * @param me\n * @param aclURI\n * @param options\n *\n * @returns Serialized ACL\n */\n function genACLText (\n docURI: string,\n me: NamedNode,\n aclURI: string,\n options: {\n defaultForNew?: boolean,\n public?: []\n } = {}\n ): string | undefined {\n const optPublic = options.public || []\n const g = graph()\n const auth = Namespace('http://www.w3.org/ns/auth/acl#')\n let a = g.sym(`${aclURI}#a1`)\n const acl = g.sym(aclURI)\n const doc = g.sym(docURI)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n if (options.defaultForNew) {\n g.add(a, auth('default'), doc, acl)\n }\n g.add(a, auth('agent'), me, acl)\n g.add(a, auth('mode'), auth('Read'), acl)\n g.add(a, auth('mode'), auth('Write'), acl)\n g.add(a, auth('mode'), auth('Control'), acl)\n\n if (optPublic.length) {\n a = g.sym(`${aclURI}#a2`)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n g.add(a, auth('agentClass'), ns.foaf('Agent'), acl)\n for (let p = 0; p < optPublic.length; p++) {\n g.add(a, auth('mode'), auth(optPublic[p]), acl) // Like 'Read' etc\n }\n }\n return serialize(acl, g, aclURI)\n }\n return {\n findAclDocUrl,\n setACLUserPublic,\n genACLText\n }\n}"],"mappings":";;;AAKA,IAAa,IAAW,EACpB,oDACJ;AAEA,SAAgB,EAAe,GAAiB;CAE5C,IAAM,IAAK;CAEX,eAAe,EAAc,GAAgB;EACzC,MAAM,EAAM,QAAQ,KAAK,CAAG;EAC5B,IAAM,IAAU,EAAM,IAAI,GAAK,CAAQ;EACvC,IAAI,CAAC,GACD,MAAU,MAAM,8BAA8B,GAAK;EAEvD,OAAO,EAAQ;CACnB;CAcA,SAAS,EACT,GACA,GACA,GAIsB;EACtB,IAAM,IAAS,EAAM,IACjB,EAAM,IAAI,CAAM,GAChB,CACJ;EAEA,OAAO,QAAQ,QAAQ,CAAC,CACnB,WACG,KAIG,EAAY,CAAM,CAAC,CAAC,OAAM,MAAO;GACpC,MAAU,MA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E,IAAI,GAAG,EAAK,MAAM,GAAG,EAAK,MAAM,GAAG,CAAG,GACxC,EAAE,IAAI,GAAG,EAAK,MAAM,GAAG,EAAK,OAAO,GAAG,CAAG,GACzC,EAAE,IAAI,GAAG,EAAK,MAAM,GAAG,EAAK,SAAS,GAAG,CAAG,GAEvC,EAAU,QAAQ;GAIlB,AAHA,IAAI,EAAE,IAAI,GAAG,EAAO,IAAI,GACxB,EAAE,IAAI,GAAG,EAAG,IAAI,MAAM,GAAG,EAAK,eAAe,GAAG,CAAG,GACnD,EAAE,IAAI,GAAG,EAAK,UAAU,GAAG,GAAK,CAAG,GACnC,EAAE,IAAI,GAAG,EAAK,YAAY,GAAG,EAAG,KAAK,OAAO,GAAG,CAAG;GAClD,KAAK,IAAI,IAAI,GAAG,IAAI,EAAU,QAAQ,KACtC,EAAE,IAAI,GAAG,EAAK,MAAM,GAAG,EAAK,EAAU,EAAE,GAAG,CAAG;EAElD;EACA,OAAO,EAAU,GAAK,GAAG,CAAM;CACnC;CACA,OAAO;EACH;EACA;EACA;CACJ;AACJ"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./session.cjs.js"),t=require("./issuer.cjs.js"),n=require("./events.cjs.js");var r=e._session,i=typeof r.login==`function`?r.login.bind(e._session):void 0;i&&(r.login=async(e,n)=>{if(e&&typeof e==`object`&&!Array.isArray(e)){let n=e.oidcIssuer??e.idp??e.issuer,r=e.redirectUrl??e.redirect_uri??e.redirectUri;if(typeof n==`string`&&typeof r==`string`)return i(await t.resolveIssuerForLogin(n),r)}return i(typeof e==`string`?await t.resolveIssuerForLogin(e):e,n)});var a=new n.SessionEvents,o=e._session.isActive??!!e._session.webId;typeof e._session.addEventListener==`function`&&e._session.addEventListener(`sessionStateChange`,()=>{let t=e._session.isActive??!!e._session.webId;o&&!t&&a.emit(`logout`),o=t});var s=Object.assign(e._session,{events:a});exports.authSession=s;
|
|
2
|
-
//# sourceMappingURL=authSession.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authSession.cjs.js","names":[],"sources":["../../src/authSession/authSession.ts"],"sourcesContent":["/**\n * Auth session wiring.\n *\n * Takes the raw OIDC session from session.ts and layers on:\n * - Login compatibility shim (normalises legacy call-site signatures\n * and resolves the canonical issuer)\n * - SessionEvents shim (legacy EventEmitter-style API)\n * - Logout listener (emits 'logout' on session deactivation)\n *\n * Exports the fully assembled authSession.\n */\n\nimport type { Session as OidcSession } from '@uvdsl/solid-oidc-client-browser/core'\nimport { _session } from './session'\nimport { resolveIssuerForLogin } from './issuer'\nimport { SessionEvents } from './events'\n\ntype SessionCompatibilityShape = {\n webId?: string\n isActive?: boolean\n info?: {\n webId?: string\n isLoggedIn?: boolean\n }\n fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>\n authFetch?: (input: string | URL | Request, init?: RequestInit, dpopPayload?: any) => Promise<Response>\n}\n\ntype LoginOptionsLegacy = {\n oidcIssuer?: string\n idp?: string\n issuer?: string\n redirectUrl?: string\n redirect_uri?: string\n redirectUri?: string\n}\n\ntype LoginCompat = {\n (issuer: string, redirectUrl: string): Promise<unknown>\n (options: LoginOptionsLegacy): Promise<unknown>\n}\n\nexport type SessionWithLegacyEvents = Omit<OidcSession, 'login'> & SessionCompatibilityShape & {\n login: LoginCompat\n events: SessionEvents\n}\n\n// ---------------------------------------------------------------------------\n// Login compatibility shim\n// ---------------------------------------------------------------------------\n// Wraps _session.login() so that call sites with different calling\n// conventions all work. The underlying session expects:\n// login(issuer: string, redirectUrl: string)\n//\n// idpOrOptions can be:\n// - a string (issuer URL) — passed through with less resolution\n// - an options object with any of these field-name variants:\n// issuer: oidcIssuer | idp | issuer\n// redirect: redirectUrl | redirect_uri | redirectUri\n// (all redirect field names map to the same value: the URL the IdP\n// should send the browser back to after authentication)\n// - anything else — passed through to the underlying session as-is\n//\n// In all cases the issuer is resolved through\n// /.well-known/openid-configuration before redirect so the canonical\n// issuer host is used.\n\nconst sessionAny = _session as any\nconst originalLogin = typeof sessionAny.login === 'function'\n ? sessionAny.login.bind(_session)\n : undefined\n\nif (originalLogin) {\n const compatLogin = async (idpOrOptions: any, redirectUri?: string): Promise<unknown> => {\n if (idpOrOptions && typeof idpOrOptions === 'object' && !Array.isArray(idpOrOptions)) {\n const oidcIssuer = idpOrOptions.oidcIssuer ?? idpOrOptions.idp ?? idpOrOptions.issuer\n const redirectUrl = idpOrOptions.redirectUrl ?? idpOrOptions.redirect_uri ?? idpOrOptions.redirectUri\n if (typeof oidcIssuer === 'string' && typeof redirectUrl === 'string') {\n return originalLogin(await resolveIssuerForLogin(oidcIssuer), redirectUrl)\n }\n }\n if (typeof idpOrOptions === 'string') {\n return originalLogin(await resolveIssuerForLogin(idpOrOptions), redirectUri)\n }\n return originalLogin(idpOrOptions, redirectUri)\n }\n sessionAny.login = compatLogin as LoginCompat\n}\n\n// ---------------------------------------------------------------------------\n// Legacy event layer\n// ---------------------------------------------------------------------------\n\nconst events = new SessionEvents()\n\n// Emit the legacy 'logout' event when the session transitions from active to inactive.\n// 'login' and 'sessionRestore' are emitted in SolidAuthnLogic.checkUser()\n// because only that call site knows which path activated the session.\nlet _wasActive = (_session as any).isActive ?? Boolean((_session as any).webId)\nif (typeof (_session as unknown as EventTarget).addEventListener === 'function') {\n ;(_session as unknown as EventTarget).addEventListener('sessionStateChange', () => {\n const isNowActive = (_session as any).isActive ?? Boolean((_session as any).webId)\n if (_wasActive && !isNowActive) {\n events.emit('logout')\n }\n _wasActive = isNowActive\n })\n}\n\nexport const authSession: SessionWithLegacyEvents = Object.assign(\n _session as Omit<OidcSession, 'login'> & { login: LoginCompat },\n { events }\n)\n "],"mappings":"8FAmEA,IAAM,EAAa,EAAA,SACb,EAAgB,OAAO,EAAW,OAAU,WAC9C,EAAW,MAAM,KAAK,EAAA,QAAQ,EAC9B,IAAA,GAEA,IAcF,EAAW,MAAQ,MAbQ,EAAmB,IAA2C,CACvF,GAAI,GAAgB,OAAO,GAAiB,UAAY,CAAC,MAAM,QAAQ,CAAY,EAAG,CACpF,IAAM,EAAa,EAAa,YAAc,EAAa,KAAO,EAAa,OACzE,EAAc,EAAa,aAAe,EAAa,cAAgB,EAAa,YAC1F,GAAI,OAAO,GAAe,UAAY,OAAO,GAAgB,SAC3D,OAAO,EAAc,MAAM,EAAA,sBAAsB,CAAU,EAAG,CAAW,CAE7E,CAIA,OAFS,EADL,OAAO,GAAiB,SACL,MAAM,EAAA,sBAAsB,CAAY,EAE1C,EAF6C,CAAW,CAG/E,GAQF,IAAM,EAAS,IAAI,EAAA,cAKf,EAAc,EAAA,SAAiB,UAAY,EAAS,EAAA,SAAiB,MACrE,OAAQ,EAAA,SAAoC,kBAAqB,YAClE,EAAA,SAAqC,iBAAiB,yBAA4B,CACjF,IAAM,EAAe,EAAA,SAAiB,UAAY,EAAS,EAAA,SAAiB,MACxE,GAAc,CAAC,GACjB,EAAO,KAAK,QAAQ,EAEtB,EAAa,CACf,CAAC,EAGH,IAAa,EAAuC,OAAO,OACzD,EAAA,SACA,CAAE,QAAO,CACX"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { _session as e } from "./session.esm.js";
|
|
2
|
-
import { resolveIssuerForLogin as t } from "./issuer.esm.js";
|
|
3
|
-
import { SessionEvents as n } from "./events.esm.js";
|
|
4
|
-
//#region src/authSession/authSession.ts
|
|
5
|
-
var r = e, i = typeof r.login == "function" ? r.login.bind(e) : void 0;
|
|
6
|
-
i && (r.login = async (e, n) => {
|
|
7
|
-
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
8
|
-
let n = e.oidcIssuer ?? e.idp ?? e.issuer, r = e.redirectUrl ?? e.redirect_uri ?? e.redirectUri;
|
|
9
|
-
if (typeof n == "string" && typeof r == "string") return i(await t(n), r);
|
|
10
|
-
}
|
|
11
|
-
return i(typeof e == "string" ? await t(e) : e, n);
|
|
12
|
-
});
|
|
13
|
-
var a = new n(), o = e.isActive ?? !!e.webId;
|
|
14
|
-
typeof e.addEventListener == "function" && e.addEventListener("sessionStateChange", () => {
|
|
15
|
-
let t = e.isActive ?? !!e.webId;
|
|
16
|
-
o && !t && a.emit("logout"), o = t;
|
|
17
|
-
});
|
|
18
|
-
var s = Object.assign(e, { events: a });
|
|
19
|
-
//#endregion
|
|
20
|
-
export { s as authSession };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=authSession.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authSession.esm.js","names":[],"sources":["../../src/authSession/authSession.ts"],"sourcesContent":["/**\n * Auth session wiring.\n *\n * Takes the raw OIDC session from session.ts and layers on:\n * - Login compatibility shim (normalises legacy call-site signatures\n * and resolves the canonical issuer)\n * - SessionEvents shim (legacy EventEmitter-style API)\n * - Logout listener (emits 'logout' on session deactivation)\n *\n * Exports the fully assembled authSession.\n */\n\nimport type { Session as OidcSession } from '@uvdsl/solid-oidc-client-browser/core'\nimport { _session } from './session'\nimport { resolveIssuerForLogin } from './issuer'\nimport { SessionEvents } from './events'\n\ntype SessionCompatibilityShape = {\n webId?: string\n isActive?: boolean\n info?: {\n webId?: string\n isLoggedIn?: boolean\n }\n fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>\n authFetch?: (input: string | URL | Request, init?: RequestInit, dpopPayload?: any) => Promise<Response>\n}\n\ntype LoginOptionsLegacy = {\n oidcIssuer?: string\n idp?: string\n issuer?: string\n redirectUrl?: string\n redirect_uri?: string\n redirectUri?: string\n}\n\ntype LoginCompat = {\n (issuer: string, redirectUrl: string): Promise<unknown>\n (options: LoginOptionsLegacy): Promise<unknown>\n}\n\nexport type SessionWithLegacyEvents = Omit<OidcSession, 'login'> & SessionCompatibilityShape & {\n login: LoginCompat\n events: SessionEvents\n}\n\n// ---------------------------------------------------------------------------\n// Login compatibility shim\n// ---------------------------------------------------------------------------\n// Wraps _session.login() so that call sites with different calling\n// conventions all work. The underlying session expects:\n// login(issuer: string, redirectUrl: string)\n//\n// idpOrOptions can be:\n// - a string (issuer URL) — passed through with less resolution\n// - an options object with any of these field-name variants:\n// issuer: oidcIssuer | idp | issuer\n// redirect: redirectUrl | redirect_uri | redirectUri\n// (all redirect field names map to the same value: the URL the IdP\n// should send the browser back to after authentication)\n// - anything else — passed through to the underlying session as-is\n//\n// In all cases the issuer is resolved through\n// /.well-known/openid-configuration before redirect so the canonical\n// issuer host is used.\n\nconst sessionAny = _session as any\nconst originalLogin = typeof sessionAny.login === 'function'\n ? sessionAny.login.bind(_session)\n : undefined\n\nif (originalLogin) {\n const compatLogin = async (idpOrOptions: any, redirectUri?: string): Promise<unknown> => {\n if (idpOrOptions && typeof idpOrOptions === 'object' && !Array.isArray(idpOrOptions)) {\n const oidcIssuer = idpOrOptions.oidcIssuer ?? idpOrOptions.idp ?? idpOrOptions.issuer\n const redirectUrl = idpOrOptions.redirectUrl ?? idpOrOptions.redirect_uri ?? idpOrOptions.redirectUri\n if (typeof oidcIssuer === 'string' && typeof redirectUrl === 'string') {\n return originalLogin(await resolveIssuerForLogin(oidcIssuer), redirectUrl)\n }\n }\n if (typeof idpOrOptions === 'string') {\n return originalLogin(await resolveIssuerForLogin(idpOrOptions), redirectUri)\n }\n return originalLogin(idpOrOptions, redirectUri)\n }\n sessionAny.login = compatLogin as LoginCompat\n}\n\n// ---------------------------------------------------------------------------\n// Legacy event layer\n// ---------------------------------------------------------------------------\n\nconst events = new SessionEvents()\n\n// Emit the legacy 'logout' event when the session transitions from active to inactive.\n// 'login' and 'sessionRestore' are emitted in SolidAuthnLogic.checkUser()\n// because only that call site knows which path activated the session.\nlet _wasActive = (_session as any).isActive ?? Boolean((_session as any).webId)\nif (typeof (_session as unknown as EventTarget).addEventListener === 'function') {\n ;(_session as unknown as EventTarget).addEventListener('sessionStateChange', () => {\n const isNowActive = (_session as any).isActive ?? Boolean((_session as any).webId)\n if (_wasActive && !isNowActive) {\n events.emit('logout')\n }\n _wasActive = isNowActive\n })\n}\n\nexport const authSession: SessionWithLegacyEvents = Object.assign(\n _session as Omit<OidcSession, 'login'> & { login: LoginCompat },\n { events }\n)\n "],"mappings":";;;;AAmEA,IAAM,IAAa,GACb,IAAgB,OAAO,EAAW,SAAU,aAC9C,EAAW,MAAM,KAAK,CAAQ,IAC9B,KAAA;AAEA,MAcF,EAAW,QAAQ,OAbQ,GAAmB,MAA2C;CACvF,IAAI,KAAgB,OAAO,KAAiB,YAAY,CAAC,MAAM,QAAQ,CAAY,GAAG;EACpF,IAAM,IAAa,EAAa,cAAc,EAAa,OAAO,EAAa,QACzE,IAAc,EAAa,eAAe,EAAa,gBAAgB,EAAa;EAC1F,IAAI,OAAO,KAAe,YAAY,OAAO,KAAgB,UAC3D,OAAO,EAAc,MAAM,EAAsB,CAAU,GAAG,CAAW;CAE7E;CAIA,OAFS,EADL,OAAO,KAAiB,WACL,MAAM,EAAsB,CAAY,IAE1C,GAF6C,CAAW;AAG/E;AAQF,IAAM,IAAS,IAAI,EAAc,GAK7B,IAAc,EAAiB,YAAY,EAAS,EAAiB;AACrE,OAAQ,EAAoC,oBAAqB,cAClE,EAAqC,iBAAiB,4BAA4B;CACjF,IAAM,IAAe,EAAiB,YAAY,EAAS,EAAiB;CAI5E,AAHI,KAAc,CAAC,KACjB,EAAO,KAAK,QAAQ,GAEtB,IAAa;AACf,CAAC;AAGH,IAAa,IAAuC,OAAO,OACzD,GACA,EAAE,UAAO,CACX"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=class{constructor(){this.listeners=new Map}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,...t){this.listeners.get(e)?.forEach(e=>e(...t))}};exports.SessionEvents=e;
|
|
2
|
-
//# sourceMappingURL=events.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.cjs.js","names":[],"sources":["../../src/authSession/events.ts"],"sourcesContent":["/**\n * Legacy event compatibility layer.\n *\n * Pure EventEmitter-style shim — no side effects, no uvdsl dependencies.\n * Wired into the auth session by authSession.ts.\n */\n\ntype LegacyEventName = 'login' | 'logout' | 'sessionRestore'\ntype LegacyEventHandler = (...args: unknown[]) => void\n\n/**\n * Minimal EventEmitter-style shim so that existing consumers using\n * `authSession.events.on('login' | 'logout' | 'sessionRestore', handler)`\n * continue working without modification.\n *\n * Events are emitted by SolidAuthnLogic.checkUser() (login/sessionRestore)\n * and by the sessionStateChange listener in authSession.ts (logout).\n */\nexport class SessionEvents {\n private readonly listeners: Map<string, Set<LegacyEventHandler>> = new Map()\n\n on (event: LegacyEventName, handler: LegacyEventHandler): void {\n if (!this.listeners.has(event)) this.listeners.set(event, new Set())\n this.listeners.get(event)!.add(handler)\n }\n\n off (event: LegacyEventName, handler: LegacyEventHandler): void {\n this.listeners.get(event)?.delete(handler)\n }\n\n emit (event: LegacyEventName, ...args: unknown[]): void {\n this.listeners.get(event)?.forEach(h => h(...args))\n }\n}\n\n"],"mappings":"AAkBA,IAAa,EAAb,KAA2B,8BAC0C,IAAI,IAEvE,GAAI,EAAwB,EAAmC,CACxD,KAAK,UAAU,IAAI,CAAK,GAAG,KAAK,UAAU,IAAI,EAAO,IAAI,GAAK,EACnE,KAAK,UAAU,IAAI,CAAK,CAAC,CAAE,IAAI,CAAO,CACxC,CAEA,IAAK,EAAwB,EAAmC,CAC9D,KAAK,UAAU,IAAI,CAAK,CAAC,EAAE,OAAO,CAAO,CAC3C,CAEA,KAAM,EAAwB,GAAG,EAAuB,CACtD,KAAK,UAAU,IAAI,CAAK,CAAC,EAAE,QAAQ,GAAK,EAAE,GAAG,CAAI,CAAC,CACpD,CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/authSession/events.ts
|
|
2
|
-
var e = class {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
5
|
-
}
|
|
6
|
-
on(e, t) {
|
|
7
|
-
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t);
|
|
8
|
-
}
|
|
9
|
-
off(e, t) {
|
|
10
|
-
this.listeners.get(e)?.delete(t);
|
|
11
|
-
}
|
|
12
|
-
emit(e, ...t) {
|
|
13
|
-
this.listeners.get(e)?.forEach((e) => e(...t));
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { e as SessionEvents };
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=events.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.esm.js","names":[],"sources":["../../src/authSession/events.ts"],"sourcesContent":["/**\n * Legacy event compatibility layer.\n *\n * Pure EventEmitter-style shim — no side effects, no uvdsl dependencies.\n * Wired into the auth session by authSession.ts.\n */\n\ntype LegacyEventName = 'login' | 'logout' | 'sessionRestore'\ntype LegacyEventHandler = (...args: unknown[]) => void\n\n/**\n * Minimal EventEmitter-style shim so that existing consumers using\n * `authSession.events.on('login' | 'logout' | 'sessionRestore', handler)`\n * continue working without modification.\n *\n * Events are emitted by SolidAuthnLogic.checkUser() (login/sessionRestore)\n * and by the sessionStateChange listener in authSession.ts (logout).\n */\nexport class SessionEvents {\n private readonly listeners: Map<string, Set<LegacyEventHandler>> = new Map()\n\n on (event: LegacyEventName, handler: LegacyEventHandler): void {\n if (!this.listeners.has(event)) this.listeners.set(event, new Set())\n this.listeners.get(event)!.add(handler)\n }\n\n off (event: LegacyEventName, handler: LegacyEventHandler): void {\n this.listeners.get(event)?.delete(handler)\n }\n\n emit (event: LegacyEventName, ...args: unknown[]): void {\n this.listeners.get(event)?.forEach(h => h(...args))\n }\n}\n\n"],"mappings":";AAkBA,IAAa,IAAb,MAA2B;;mCAC0C,IAAI,IAAI;;CAE3E,GAAI,GAAwB,GAAmC;EAE7D,AADK,KAAK,UAAU,IAAI,CAAK,KAAG,KAAK,UAAU,IAAI,mBAAO,IAAI,IAAI,CAAC,GACnE,KAAK,UAAU,IAAI,CAAK,CAAC,CAAE,IAAI,CAAO;CACxC;CAEA,IAAK,GAAwB,GAAmC;EAC9D,KAAK,UAAU,IAAI,CAAK,CAAC,EAAE,OAAO,CAAO;CAC3C;CAEA,KAAM,GAAwB,GAAG,GAAuB;EACtD,KAAK,UAAU,IAAI,CAAK,CAAC,EAAE,SAAQ,MAAK,EAAE,GAAG,CAAI,CAAC;CACpD;AACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
async function e(e){try{let t=new URL(e),n=new URL(`/.well-known/openid-configuration`,t.origin),r=await fetch(n.toString(),{credentials:`include`});if(!r.ok)return null;let i=await r.json();return typeof i?.issuer!=`string`||!i.issuer?null:i.issuer.replace(/\/$/,``)}catch{return null}}async function t(t){return await e(t)||t}exports.resolveIssuerForLogin=t;
|
|
2
|
-
//# sourceMappingURL=issuer.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"issuer.cjs.js","names":[],"sources":["../../src/authSession/issuer.ts"],"sourcesContent":["/**\n * Issuer discovery utilities.\n *\n * Resolves OIDC issuer endpoints from /.well-known/openid-configuration\n * so that login can use the canonical issuer host.\n */\n\nasync function discoverIssuerFromWellKnown (issuer: string): Promise<string | null> {\n try {\n const issuerUrl = new URL(issuer)\n const wellKnownUrl = new URL('/.well-known/openid-configuration', issuerUrl.origin)\n const wellKnownResponse = await fetch(wellKnownUrl.toString(), { credentials: 'include' })\n if (!wellKnownResponse.ok) {\n return null\n }\n\n const wellKnownPayload = await wellKnownResponse.json()\n if (typeof wellKnownPayload?.issuer !== 'string' || !wellKnownPayload.issuer) {\n return null\n }\n\n return wellKnownPayload.issuer.replace(/\\/$/, '')\n } catch (_err) {\n return null\n }\n}\n\nexport async function resolveIssuerForLogin (issuer: string): Promise<string> {\n // Prefer the issuer advertised by discovery; if app and issuer hosts still differ,\n // redirecting to the canonical issuer host is cleaner than rewriting the issuer here.\n const discoveredIssuer = await discoverIssuerFromWellKnown(issuer)\n if (discoveredIssuer) {\n return discoveredIssuer\n }\n return issuer\n}\n"],"mappings":"AAOA,eAAe,EAA6B,EAAwC,CAClF,GAAI,CACF,IAAM,EAAY,IAAI,IAAI,CAAM,EAC1B,EAAe,IAAI,IAAI,oCAAqC,EAAU,MAAM,EAC5E,EAAoB,MAAM,MAAM,EAAa,SAAS,EAAG,CAAE,YAAa,SAAU,CAAC,EACzF,GAAI,CAAC,EAAkB,GACrB,OAAO,KAGT,IAAM,EAAmB,MAAM,EAAkB,KAAK,EAKtD,OAJI,OAAO,GAAkB,QAAW,UAAY,CAAC,EAAiB,OAC7D,KAGF,EAAiB,OAAO,QAAQ,MAAO,EAAE,CAClD,MAAe,CACb,OAAO,IACT,CACF,CAEA,eAAsB,EAAuB,EAAiC,CAO5E,OAHI,MAD2B,EAA4B,CAAM,GAI1D,CACT"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/authSession/issuer.ts
|
|
2
|
-
async function e(e) {
|
|
3
|
-
try {
|
|
4
|
-
let t = new URL(e), n = new URL("/.well-known/openid-configuration", t.origin), r = await fetch(n.toString(), { credentials: "include" });
|
|
5
|
-
if (!r.ok) return null;
|
|
6
|
-
let i = await r.json();
|
|
7
|
-
return typeof i?.issuer != "string" || !i.issuer ? null : i.issuer.replace(/\/$/, "");
|
|
8
|
-
} catch {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
async function t(t) {
|
|
13
|
-
return await e(t) || t;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { t as resolveIssuerForLogin };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=issuer.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"issuer.esm.js","names":[],"sources":["../../src/authSession/issuer.ts"],"sourcesContent":["/**\n * Issuer discovery utilities.\n *\n * Resolves OIDC issuer endpoints from /.well-known/openid-configuration\n * so that login can use the canonical issuer host.\n */\n\nasync function discoverIssuerFromWellKnown (issuer: string): Promise<string | null> {\n try {\n const issuerUrl = new URL(issuer)\n const wellKnownUrl = new URL('/.well-known/openid-configuration', issuerUrl.origin)\n const wellKnownResponse = await fetch(wellKnownUrl.toString(), { credentials: 'include' })\n if (!wellKnownResponse.ok) {\n return null\n }\n\n const wellKnownPayload = await wellKnownResponse.json()\n if (typeof wellKnownPayload?.issuer !== 'string' || !wellKnownPayload.issuer) {\n return null\n }\n\n return wellKnownPayload.issuer.replace(/\\/$/, '')\n } catch (_err) {\n return null\n }\n}\n\nexport async function resolveIssuerForLogin (issuer: string): Promise<string> {\n // Prefer the issuer advertised by discovery; if app and issuer hosts still differ,\n // redirecting to the canonical issuer host is cleaner than rewriting the issuer here.\n const discoveredIssuer = await discoverIssuerFromWellKnown(issuer)\n if (discoveredIssuer) {\n return discoveredIssuer\n }\n return issuer\n}\n"],"mappings":";AAOA,eAAe,EAA6B,GAAwC;CAClF,IAAI;EACF,IAAM,IAAY,IAAI,IAAI,CAAM,GAC1B,IAAe,IAAI,IAAI,qCAAqC,EAAU,MAAM,GAC5E,IAAoB,MAAM,MAAM,EAAa,SAAS,GAAG,EAAE,aAAa,UAAU,CAAC;EACzF,IAAI,CAAC,EAAkB,IACrB,OAAO;EAGT,IAAM,IAAmB,MAAM,EAAkB,KAAK;EAKtD,OAJI,OAAO,GAAkB,UAAW,YAAY,CAAC,EAAiB,SAC7D,OAGF,EAAiB,OAAO,QAAQ,OAAO,EAAE;CAClD,QAAe;EACb,OAAO;CACT;AACF;AAEA,eAAsB,EAAuB,GAAiC;CAO5E,OAHI,MAD2B,EAA4B,CAAM,KAI1D;AACT"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("../_virtual/_rolldown/runtime.cjs.js");let t=require("@uvdsl/solid-oidc-client-browser"),n=require("@uvdsl/solid-oidc-client-browser/core");n=e.__toESM(n);var r=class{constructor(){this.map=new Map}shouldPreserveExistingRefreshToken(e,t){return e===`refresh_token`&&(t==null||t===``)&&this.map.has(e)}async init(){return this}async setItem(e,t){this.shouldPreserveExistingRefreshToken(e,t)||this.map.set(e,t)}async getItem(e){return this.map.has(e)?this.map.get(e):null}async deleteItem(e){this.map.delete(e)}async clear(){this.map.clear()}close(){}},i=class{constructor(){this.db=null,this.dbName=`soidc`,this.storeName=`session`,this.dbVersion=1}async shouldPreserveExistingRefreshToken(e,t){if(e!==`refresh_token`||!(t==null||t===``))return!1;let n=await this.getItem(e);return n!=null&&n!==``}async init(){if(this.db)return this;if(typeof indexedDB>`u`)throw Error(`IndexedDB is not available in this environment`);return await new Promise((e,t)=>{let n=indexedDB.open(this.dbName,this.dbVersion);n.onerror=()=>t(n.error),n.onsuccess=()=>{this.db=n.result,e()},n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(this.storeName)||e.createObjectStore(this.storeName)}}),this}async setItem(e,t){await this.init(),!await this.shouldPreserveExistingRefreshToken(e,t)&&await this.withStore(`readwrite`,n=>n.put(t,e))}async getItem(e){return await this.init(),this.withStore(`readonly`,t=>t.get(e))}async deleteItem(e){await this.init(),await this.withStore(`readwrite`,t=>t.delete(e))}async clear(){await this.init(),await this.withStore(`readwrite`,e=>e.clear())}close(){this.db&&=(this.db.close(),null)}withStore(e,t){return new Promise((n,r)=>{if(!this.db){r(Error(`Session database not initialized`));return}let i=this.db.transaction(this.storeName,e),a=t(i.objectStore(this.storeName)),o=null;i.onerror=()=>r(i.error??a.error),i.onabort=()=>r(i.error??a.error??Error(`IndexedDB transaction aborted`)),i.oncomplete=()=>n(o),a.onerror=()=>r(a.error),a.onsuccess=()=>{o=a.result??null}})}};function a(){let e=n,t=e.SessionCore??e.default?.SessionCore??e.default;return typeof t==`function`?t:null}var o=a();function s(){if(typeof window<`u`&&(()=>{let e=window.location.hostname;return e===`localhost`||e===`127.0.0.1`||e.endsWith(`.localhost`)})())return o?new o(void 0,{database:new i}):new t.Session;try{return new t.Session}catch(e){console.warn(`solid-logic: falling back to non-worker auth session:`,e);try{return o?new o(void 0,{database:new i}):new t.Session}catch(e){return console.warn(`solid-logic: IndexedDB unavailable, using in-memory session database:`,e),o?new o(void 0,{database:new r}):new t.Session}}}var c=s();exports.IndexedDbSessionDatabase=i,exports.MemorySessionDatabase=r,exports._session=c;
|
|
2
|
-
//# sourceMappingURL=session.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.cjs.js","names":[],"sources":["../../src/authSession/session.ts"],"sourcesContent":["/**\n * OIDC session factory.\n *\n * Everything needed to create and configure the underlying auth session:\n * - Session database backends (in-memory and IndexedDB)\n * - Session instantiation (WebSession or SessionCore, with local-dev\n * fallbacks for environments where the service worker can't load)\n * - Login compatibility shim that normalises legacy call-site signatures\n * and resolves the canonical issuer through /.well-known discovery\n *\n * The raw session instance (_session) is consumed by authSession.ts where\n * the legacy event layer and logout listener are attached.\n *\n * DO NOT import _session directly — always go through authSession.ts so\n * the event wiring is guaranteed to run.\n */\n\nimport {\n Session as WebSession,\n} from '@uvdsl/solid-oidc-client-browser'\nimport * as OidcCore from '@uvdsl/solid-oidc-client-browser/core'\nimport type { Session as OidcSession, SessionDatabase } from '@uvdsl/solid-oidc-client-browser/core'\n\n// ---------------------------------------------------------------------------\n// Session databases\n// ---------------------------------------------------------------------------\n\nexport class MemorySessionDatabase implements SessionDatabase {\n private readonly map = new Map<string, any>()\n\n private shouldPreserveExistingRefreshToken(id: string, value: any): boolean {\n return id === 'refresh_token' && (value == null || value === '') && this.map.has(id)\n }\n\n async init (): Promise<SessionDatabase> {\n return this\n }\n\n async setItem (id: string, value: any): Promise<void> {\n // Some Solid IdPs do not include refresh_token on refresh responses.\n // Keep the previous token instead of overwriting it with null/undefined.\n if (this.shouldPreserveExistingRefreshToken(id, value)) {\n return\n }\n this.map.set(id, value)\n }\n\n async getItem (id: string): Promise<any> {\n return this.map.has(id) ? this.map.get(id) : null\n }\n\n async deleteItem (id: string): Promise<void> {\n this.map.delete(id)\n }\n\n async clear (): Promise<void> {\n this.map.clear()\n }\n\n close (): void {\n // No-op for in-memory database\n }\n}\n\nexport class IndexedDbSessionDatabase implements SessionDatabase {\n private db: IDBDatabase | null = null\n private readonly dbName = 'soidc'\n private readonly storeName = 'session'\n private readonly dbVersion = 1\n\n private async shouldPreserveExistingRefreshToken(id: string, value: any): Promise<boolean> {\n if (id !== 'refresh_token' || !(value == null || value === '')) {\n return false\n }\n const existing = await this.getItem(id)\n return existing != null && existing !== ''\n }\n\n async init (): Promise<SessionDatabase> {\n if (this.db) return this\n if (typeof indexedDB === 'undefined') {\n throw new Error('IndexedDB is not available in this environment')\n }\n\n await new Promise<void>((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion)\n\n request.onerror = () => reject(request.error)\n request.onsuccess = () => {\n this.db = request.result\n resolve()\n }\n request.onupgradeneeded = () => {\n const db = request.result\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName)\n }\n }\n })\n\n return this\n }\n\n async setItem (id: string, value: any): Promise<void> {\n await this.init()\n // Some Solid IdPs do not include refresh_token on refresh responses.\n // Keep the previous token instead of overwriting it with null/undefined.\n if (await this.shouldPreserveExistingRefreshToken(id, value)) {\n return\n }\n await this.withStore('readwrite', store => store.put(value, id))\n }\n\n async getItem (id: string): Promise<any> {\n await this.init()\n return this.withStore('readonly', store => store.get(id))\n }\n\n async deleteItem (id: string): Promise<void> {\n await this.init()\n await this.withStore('readwrite', store => store.delete(id))\n }\n\n async clear (): Promise<void> {\n await this.init()\n await this.withStore('readwrite', store => store.clear())\n }\n\n close (): void {\n if (this.db) {\n this.db.close()\n this.db = null\n }\n }\n\n private withStore(mode: IDBTransactionMode, op: (store: IDBObjectStore) => IDBRequest<any>): Promise<any> {\n return new Promise<any>((resolve, reject) => {\n if (!this.db) {\n reject(new Error('Session database not initialized'))\n return\n }\n\n const tx = this.db.transaction(this.storeName, mode)\n const store = tx.objectStore(this.storeName)\n const request = op(store)\n let result: any = null\n\n tx.onerror = () => reject(tx.error ?? request.error)\n tx.onabort = () => reject(tx.error ?? request.error ?? new Error('IndexedDB transaction aborted'))\n tx.oncomplete = () => resolve(result)\n\n request.onerror = () => reject(request.error)\n request.onsuccess = () => {\n result = request.result ?? null\n }\n })\n }\n}\n\n// ---------------------------------------------------------------------------\n// Session instantiation\n// ---------------------------------------------------------------------------\n\nfunction getSessionCoreCtor (): (new (...args: any[]) => OidcSession) | null {\n const coreAny = OidcCore as any\n const candidate = coreAny.SessionCore ?? coreAny.default?.SessionCore ?? coreAny.default\n\n if (typeof candidate !== 'function') {\n return null\n }\n\n return candidate as new (...args: any[]) => OidcSession\n}\n\nconst SessionCoreCtor = getSessionCoreCtor()\n\nfunction createSession (): OidcSession {\n const shouldSkipWorkerInLocalDev = typeof window !== 'undefined' && (() => {\n const host = window.location.hostname\n // In local NSS setups (including subdomain mode like alice.localhost),\n // worker-based session storage can be brittle and lose state on reload.\n // Prefer SessionCore + IndexedDB for deterministic persistence.\n return host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost')\n })()\n\n if (shouldSkipWorkerInLocalDev) {\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new IndexedDbSessionDatabase() })\n }\n return new WebSession()\n }\n\n try {\n return new WebSession()\n } catch (error) {\n // In some deployments, worker URL resolution can become file:// and fail cross-origin.\n // Fall back to SessionCore so auth still works without background refresh worker.\n // Use IndexedDB to keep refresh-token persistence across page reloads.\n console.warn('solid-logic: falling back to non-worker auth session:', error)\n try {\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new IndexedDbSessionDatabase() })\n }\n return new WebSession()\n } catch (dbError) {\n console.warn('solid-logic: IndexedDB unavailable, using in-memory session database:', dbError)\n if (SessionCoreCtor) {\n return new SessionCoreCtor(undefined, { database: new MemorySessionDatabase() })\n }\n return new WebSession()\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Singleton session\n// ---------------------------------------------------------------------------\n\nconst _session = createSession()\n\nexport { _session }\n"],"mappings":"4KA2BA,IAAa,EAAb,KAA8D,wBACrC,IAAI,IAE3B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