solid-logic 1.3.17-9d25ceb7 → 1.3.17-a849582e

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 (114) hide show
  1. package/lib/acl/aclLogic.d.ts +12 -30
  2. package/lib/acl/aclLogic.d.ts.map +1 -1
  3. package/lib/acl/aclLogic.js +151 -116
  4. package/lib/acl/aclLogic.js.map +1 -1
  5. package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
  6. package/lib/authn/SolidAuthnLogic.js +2 -2
  7. package/lib/authn/SolidAuthnLogic.js.map +1 -1
  8. package/lib/chat/chatLogic.d.ts +16 -0
  9. package/lib/chat/chatLogic.d.ts.map +1 -0
  10. package/lib/chat/{ChatLogic.js → chatLogic.js} +82 -87
  11. package/lib/chat/chatLogic.js.map +1 -0
  12. package/lib/discovery/discoveryLogic.d.ts +8 -8
  13. package/lib/discovery/discoveryLogic.d.ts.map +1 -1
  14. package/lib/discovery/discoveryLogic.js +65 -72
  15. package/lib/discovery/discoveryLogic.js.map +1 -1
  16. package/lib/inbox/inboxLogic.d.ts +7 -0
  17. package/lib/inbox/inboxLogic.d.ts.map +1 -0
  18. package/lib/inbox/{InboxLogic.js → inboxLogic.js} +58 -64
  19. package/lib/inbox/inboxLogic.js.map +1 -0
  20. package/lib/index.d.ts +10 -13
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +76 -32
  23. package/lib/index.js.map +1 -1
  24. package/lib/logic/CustomError.d.ts +4 -0
  25. package/lib/logic/CustomError.d.ts.map +1 -1
  26. package/lib/logic/CustomError.js +17 -1
  27. package/lib/logic/CustomError.js.map +1 -1
  28. package/lib/logic/solidLogicSingleton.d.ts +35 -3
  29. package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
  30. package/lib/logic/solidLogicSingleton.js +87 -8
  31. package/lib/logic/solidLogicSingleton.js.map +1 -1
  32. package/lib/profile/profileLogic.d.ts +13 -0
  33. package/lib/profile/profileLogic.d.ts.map +1 -0
  34. package/lib/profile/profileLogic.js +268 -0
  35. package/lib/profile/profileLogic.js.map +1 -0
  36. package/lib/typeIndex/typeIndexLogic.d.ts +31 -21
  37. package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
  38. package/lib/typeIndex/typeIndexLogic.js +650 -295
  39. package/lib/typeIndex/typeIndexLogic.js.map +1 -1
  40. package/lib/types.d.ts +17 -0
  41. package/lib/types.d.ts.map +1 -1
  42. package/lib/util/containerLogic.d.ts +11 -0
  43. package/lib/util/containerLogic.d.ts.map +1 -0
  44. package/lib/{profile/ProfileLogic.js → util/containerLogic.js} +53 -44
  45. package/lib/util/containerLogic.js.map +1 -0
  46. package/lib/util/utilityLogic.d.ts +15 -0
  47. package/lib/util/utilityLogic.d.ts.map +1 -0
  48. package/lib/util/utilityLogic.js +272 -0
  49. package/lib/util/utilityLogic.js.map +1 -0
  50. package/lib/util/utils.d.ts +8 -0
  51. package/lib/util/utils.d.ts.map +1 -0
  52. package/lib/util/utils.js +48 -0
  53. package/lib/util/utils.js.map +1 -0
  54. package/package.json +3 -1
  55. package/src/acl/aclLogic.ts +135 -119
  56. package/src/authn/SolidAuthnLogic.ts +3 -2
  57. package/src/chat/chatLogic.ts +225 -0
  58. package/src/discovery/discoveryLogic.ts +66 -87
  59. package/src/inbox/inboxLogic.ts +57 -0
  60. package/src/index.ts +74 -21
  61. package/src/logic/CustomError.ts +5 -1
  62. package/src/logic/solidLogicSingleton.ts +160 -7
  63. package/src/profile/profileLogic.ts +134 -0
  64. package/src/typeIndex/typeIndexLogic.ts +417 -153
  65. package/src/types.ts +7 -3
  66. package/src/util/containerLogic.ts +54 -0
  67. package/src/util/ns.js +5 -0
  68. package/src/util/utilityLogic.ts +155 -0
  69. package/src/util/utils.ts +52 -0
  70. package/test/aclLogic.test.ts +13 -4
  71. package/test/chatLogic.test.ts +70 -71
  72. package/test/container.test.ts +56 -0
  73. package/test/discoveryLogic.test.ts +14 -14
  74. package/test/helpers/dataSetup.ts +134 -0
  75. package/test/helpers/setup.ts +4 -0
  76. package/test/inboxLogic.test.ts +39 -38
  77. package/test/logic.test.ts +11 -9
  78. package/test/profileLogic.test.ts +246 -0
  79. package/test/typeIndexLogic.test.ts +49 -22
  80. package/test/typeIndexLogicPart2.test.ts +485 -0
  81. package/test/utilityLogic.test.ts +172 -126
  82. package/test/utils.test.ts +32 -0
  83. package/lib/chat/ChatLogic.d.ts +0 -26
  84. package/lib/chat/ChatLogic.d.ts.map +0 -1
  85. package/lib/chat/ChatLogic.js.map +0 -1
  86. package/lib/chat/determineChatContainer.d.ts +0 -3
  87. package/lib/chat/determineChatContainer.d.ts.map +0 -1
  88. package/lib/chat/determineChatContainer.js +0 -12
  89. package/lib/chat/determineChatContainer.js.map +0 -1
  90. package/lib/inbox/InboxLogic.d.ts +0 -18
  91. package/lib/inbox/InboxLogic.d.ts.map +0 -1
  92. package/lib/inbox/InboxLogic.js.map +0 -1
  93. package/lib/logic/SolidLogic.d.ts +0 -48
  94. package/lib/logic/SolidLogic.d.ts.map +0 -1
  95. package/lib/logic/SolidLogic.js +0 -321
  96. package/lib/logic/SolidLogic.js.map +0 -1
  97. package/lib/profile/ProfileLogic.d.ts +0 -13
  98. package/lib/profile/ProfileLogic.d.ts.map +0 -1
  99. package/lib/profile/ProfileLogic.js.map +0 -1
  100. package/lib/util/UtilityLogic.d.ts +0 -33
  101. package/lib/util/UtilityLogic.d.ts.map +0 -1
  102. package/lib/util/UtilityLogic.js +0 -240
  103. package/lib/util/UtilityLogic.js.map +0 -1
  104. package/lib/util/uri.d.ts +0 -3
  105. package/lib/util/uri.d.ts.map +0 -1
  106. package/lib/util/uri.js +0 -9
  107. package/lib/util/uri.js.map +0 -1
  108. package/src/chat/ChatLogic.ts +0 -244
  109. package/src/chat/determineChatContainer.ts +0 -14
  110. package/src/inbox/InboxLogic.ts +0 -66
  111. package/src/logic/SolidLogic.ts +0 -262
  112. package/src/profile/ProfileLogic.ts +0 -44
  113. package/src/util/UtilityLogic.ts +0 -161
  114. package/src/util/uri.ts +0 -5
@@ -0,0 +1,268 @@
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.createProfileLogic = void 0;
63
+ var CustomError_1 = require("../logic/CustomError");
64
+ var debug = __importStar(require("../util/debug"));
65
+ var utils_1 = require("../util/utils");
66
+ var ns_1 = require("../util/ns");
67
+ function createProfileLogic(store, authn, utilityLogic) {
68
+ var ns = ns_1.ns;
69
+ function ensureLoadedPreferences(context) {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ var _a, _b;
72
+ return __generator(this, function (_c) {
73
+ switch (_c.label) {
74
+ case 0:
75
+ if (!context.me)
76
+ throw new Error('@@ ensureLoadedPreferences: no user specified');
77
+ _a = context;
78
+ return [4 /*yield*/, loadProfile(context.me)];
79
+ case 1:
80
+ _a.publicProfile = _c.sent();
81
+ _b = context;
82
+ return [4 /*yield*/, silencedLoadPreferences(context.me)];
83
+ case 2:
84
+ _b.preferencesFile = _c.sent();
85
+ return [2 /*return*/, context];
86
+ }
87
+ });
88
+ });
89
+ }
90
+ /**
91
+ * loads the preference without throwing errors - if it can create it it does so.
92
+ * remark: it still throws error if it cannot load profile.
93
+ * @param user
94
+ * @returns undefined if preferenceFile cannot be returned or NamedNode if it can find it or create it
95
+ */
96
+ function silencedLoadPreferences(user) {
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var err_1;
99
+ return __generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0:
102
+ _a.trys.push([0, 2, , 3]);
103
+ return [4 /*yield*/, loadPreferences(user)];
104
+ case 1: return [2 /*return*/, _a.sent()];
105
+ case 2:
106
+ err_1 = _a.sent();
107
+ return [2 /*return*/, undefined];
108
+ case 3: return [2 /*return*/];
109
+ }
110
+ });
111
+ });
112
+ }
113
+ /**
114
+ * loads the preference without returning different errors if it cannot create or load it.
115
+ * remark: it also throws error if it cannot load profile.
116
+ * @param user
117
+ * @returns undefined if preferenceFile cannot be an Error or NamedNode if it can find it or create it
118
+ */
119
+ function loadPreferences(user) {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ var possiblePreferencesFile, preferencesFile, err_2, message, response, err_3, msg;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0: return [4 /*yield*/, loadProfile(user)];
125
+ case 1:
126
+ _a.sent();
127
+ possiblePreferencesFile = (0, utils_1.suggestPreferencesFile)(user);
128
+ _a.label = 2;
129
+ case 2:
130
+ _a.trys.push([2, 4, , 5]);
131
+ return [4 /*yield*/, utilityLogic.followOrCreateLink(user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
132
+ case 3:
133
+ preferencesFile = _a.sent();
134
+ return [3 /*break*/, 5];
135
+ case 4:
136
+ err_2 = _a.sent();
137
+ message = "User ".concat(user, " has no pointer in profile to preferences file.");
138
+ debug.warn(message);
139
+ // we are listing the possible errors
140
+ if (err_2 instanceof CustomError_1.NotEditableError) {
141
+ throw err_2;
142
+ }
143
+ if (err_2 instanceof CustomError_1.WebOperationError) {
144
+ throw err_2;
145
+ }
146
+ if (err_2 instanceof CustomError_1.UnauthorizedError) {
147
+ throw err_2;
148
+ }
149
+ if (err_2 instanceof CustomError_1.CrossOriginForbiddenError) {
150
+ throw err_2;
151
+ }
152
+ if (err_2 instanceof CustomError_1.SameOriginForbiddenError) {
153
+ throw err_2;
154
+ }
155
+ if (err_2 instanceof CustomError_1.FetchError) {
156
+ throw err_2;
157
+ }
158
+ throw err_2;
159
+ case 5:
160
+ _a.trys.push([5, 7, , 8]);
161
+ return [4 /*yield*/, store.fetcher.load(preferencesFile)];
162
+ case 6:
163
+ response = _a.sent();
164
+ return [3 /*break*/, 8];
165
+ case 7:
166
+ err_3 = _a.sent();
167
+ msg = "Unable to load preference of user ".concat(user, ": ").concat(err_3);
168
+ debug.warn(msg);
169
+ if (err_3.response.status === 401) {
170
+ throw new CustomError_1.UnauthorizedError();
171
+ }
172
+ if (err_3.response.status === 403) {
173
+ if ((0, utils_1.differentOrigin)(preferencesFile)) {
174
+ throw new CustomError_1.CrossOriginForbiddenError();
175
+ }
176
+ throw new CustomError_1.SameOriginForbiddenError();
177
+ }
178
+ /*if (err.response.status === 404) {
179
+ throw new NotFoundError();
180
+ }*/
181
+ throw new Error(msg);
182
+ case 8: return [2 /*return*/, preferencesFile];
183
+ }
184
+ });
185
+ });
186
+ }
187
+ function loadProfile(user) {
188
+ return __awaiter(this, void 0, void 0, function () {
189
+ var err_4;
190
+ return __generator(this, function (_a) {
191
+ switch (_a.label) {
192
+ case 0:
193
+ if (!user) {
194
+ throw new Error("loadProfile: no user given.");
195
+ }
196
+ _a.label = 1;
197
+ case 1:
198
+ _a.trys.push([1, 3, , 4]);
199
+ return [4 /*yield*/, store.fetcher.load(user.doc())];
200
+ case 2:
201
+ _a.sent();
202
+ return [3 /*break*/, 4];
203
+ case 3:
204
+ err_4 = _a.sent();
205
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
206
+ case 4: return [2 /*return*/, user.doc()];
207
+ }
208
+ });
209
+ });
210
+ }
211
+ function loadMe() {
212
+ return __awaiter(this, void 0, void 0, function () {
213
+ var me;
214
+ return __generator(this, function (_a) {
215
+ switch (_a.label) {
216
+ case 0:
217
+ me = authn.currentUser();
218
+ if (me === null) {
219
+ throw new Error("Current user not found! Not logged in?");
220
+ }
221
+ return [4 /*yield*/, store.fetcher.load(me.doc())];
222
+ case 1:
223
+ _a.sent();
224
+ return [2 /*return*/, me];
225
+ }
226
+ });
227
+ });
228
+ }
229
+ function getPodRoot(user) {
230
+ var podRoot = findStorage(user);
231
+ if (!podRoot) {
232
+ throw new Error("User pod root not found!");
233
+ }
234
+ return podRoot;
235
+ }
236
+ function getMainInbox(user) {
237
+ return __awaiter(this, void 0, void 0, function () {
238
+ var mainInbox;
239
+ return __generator(this, function (_a) {
240
+ switch (_a.label) {
241
+ case 0: return [4 /*yield*/, store.fetcher.load(user)];
242
+ case 1:
243
+ _a.sent();
244
+ mainInbox = store.any(user, ns.ldp("inbox"), undefined, user.doc());
245
+ if (!mainInbox) {
246
+ throw new Error("User main inbox not found!");
247
+ }
248
+ return [2 /*return*/, mainInbox];
249
+ }
250
+ });
251
+ });
252
+ }
253
+ function findStorage(me) {
254
+ return store.any(me, ns.space("storage"), undefined, me.doc());
255
+ }
256
+ return {
257
+ ensureLoadedPreferences: ensureLoadedPreferences,
258
+ loadMe: loadMe,
259
+ getPodRoot: getPodRoot,
260
+ getMainInbox: getMainInbox,
261
+ findStorage: findStorage,
262
+ loadPreferences: loadPreferences,
263
+ loadProfile: loadProfile,
264
+ silencedLoadPreferences: silencedLoadPreferences
265
+ };
266
+ }
267
+ exports.createProfileLogic = createProfileLogic;
268
+ //# sourceMappingURL=profileLogic.js.map
@@ -0,0 +1 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C,4BAA4B,CAAC,CAAC;yBACjD;wBACD,sBAAO,SAAsB,EAAC;;;;KACjC;IAED,SAAS,WAAW,CAAC,EAAa;QAC9B,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO;QACH,uBAAuB,yBAAA;QACvB,MAAM,QAAA;QACN,UAAU,YAAA;QACV,YAAY,cAAA;QACZ,WAAW,aAAA;QACX,eAAe,iBAAA;QACf,WAAW,aAAA;QACX,uBAAuB,yBAAA;KAC1B,CAAA;AACL,CAAC;AA7HD,gDA6HC"}
@@ -1,22 +1,32 @@
1
- import { NamedNode } from "rdflib";
2
- import { AuthenticationContext } from "../types";
3
- export declare const ns: any;
4
- /**
5
- * Resolves with the same context, outputting
6
- * output: index.public, index.private
7
- * @@ This is a very bizare function
8
- * @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
9
- */
10
- export declare function loadIndex(context: AuthenticationContext, isPublic: boolean): Promise<AuthenticationContext>;
11
- export declare function loadTypeIndexes(context: AuthenticationContext): Promise<AuthenticationContext | undefined>;
12
- /**
13
- * Resolves with the same context, outputting
14
- * @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
15
- */
16
- export declare function ensureTypeIndexes(context: AuthenticationContext, agent?: NamedNode): Promise<AuthenticationContext>;
17
- /**
18
- * Register a new app in a type index
19
- * used in chat in bookmark.js (solid-ui)
20
- */
21
- export declare function registerInTypeIndex(context: AuthenticationContext, instance: NamedNode, theClass: NamedNode, isPublic: boolean, agent?: NamedNode): Promise<AuthenticationContext>;
1
+ import * as rdf from "rdflib";
2
+ import { NamedNode } from 'rdflib';
3
+ import { AuthenticationContext, ScopedApp, TypeIndexScope } from '../types';
4
+ export declare function createTypeIndexLogic(store: any, authn: any, profileLogic: any, utilityLogic: any): {
5
+ ensureTypeIndexes: (context: AuthenticationContext, agent?: rdf.NamedNode | undefined) => Promise<AuthenticationContext>;
6
+ loadTypeIndexes: (context: AuthenticationContext) => Promise<AuthenticationContext | undefined>;
7
+ registerInTypeIndex: (context: AuthenticationContext, instance: NamedNode, theClass: NamedNode, isPublic: boolean, agent?: rdf.NamedNode | undefined) => Promise<AuthenticationContext>;
8
+ loadIndex: (context: AuthenticationContext, isPublic: boolean) => Promise<AuthenticationContext>;
9
+ ensureOneTypeIndex: (context: AuthenticationContext, isPublic: boolean, agent?: rdf.NamedNode | undefined) => Promise<AuthenticationContext | void>;
10
+ putIndex: (newIndex: any, context: any) => Promise<any>;
11
+ makeIndexIfNecessary: (context: any, isPublic: any, store: any, ns: any) => Promise<any>;
12
+ loadIndexes: (me: NamedNode | string, publicProfile: NamedNode | string | null, preferencesFile: NamedNode | string | null, onWarning?: (_err: Error) => Promise<undefined>) => Promise<{
13
+ private: any;
14
+ public: any;
15
+ }>;
16
+ getTypeIndex: (me: NamedNode | string, preferencesFile: NamedNode | string, isPublic: boolean) => NamedNode[];
17
+ getRegistrations: (instance: any, theClass: any) => any;
18
+ loadTypeIndexesFor: (user: NamedNode) => Promise<Array<TypeIndexScope>>;
19
+ loadCommunityTypeIndexes: (user: NamedNode) => Promise<TypeIndexScope[][]>;
20
+ loadAllTypeIndexes: (user: NamedNode) => Promise<TypeIndexScope[]>;
21
+ getScopedAppInstances: (klass: NamedNode, user: NamedNode) => Promise<ScopedApp[]>;
22
+ getAppInstances: (klass: NamedNode) => Promise<NamedNode[]>;
23
+ suggestPublicTypeIndex: (me: NamedNode) => rdf.NamedNode;
24
+ suggestPrivateTypeIndex: (preferencesFile: NamedNode) => rdf.NamedNode;
25
+ registerInstanceInTypeIndex: (instance: NamedNode, index: NamedNode, theClass: NamedNode) => Promise<NamedNode | null>;
26
+ deleteTypeIndexRegistration: (item: any) => Promise<void>;
27
+ getScopedAppsFromIndex: (scope: any, theClass: NamedNode | null) => Promise<{
28
+ instance: rdf.NamedNode;
29
+ scope: any;
30
+ }[]>;
31
+ };
22
32
  //# sourceMappingURL=typeIndexLogic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeIndexLogic.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,QAAQ,CAAA;AAK3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAIhD,eAAO,MAAM,EAAE,KAAuB,CAAA;AAWtC;;;;;GAKG;AACH,wBAAsB,SAAS,CAC/B,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,OAAO,GACd,OAAO,CAAC,qBAAqB,CAAC,CAYhC;AAED,wBAAsB,eAAe,CAAE,OAAO,EAAE,qBAAqB,8CAqBpE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAE,OAAO,EAAE,qBAAqB,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAO1H;AAyFD;;;GAGG;AACH,wBAAsB,mBAAmB,CACzC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,CAAC,CAwBhC"}
1
+ {"version":3,"file":"typeIndexLogic.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAsB,MAAM,QAAQ,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAK3E,wBAAgB,oBAAoB,CAAC,KAAK,KAAA,EAAE,KAAK,KAAA,EAAE,YAAY,KAAA,EAAE,YAAY,KAAA;iCAqB/B,qBAAqB,wCAAsB,QAAQ,qBA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