solid-logic 1.3.11 → 1.3.13-057429fe
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/.babelrc +0 -0
- package/.eslintrc.js +0 -0
- package/.github/workflows/ci.yml +39 -5
- package/.github/workflows/release.yml +0 -0
- package/LICENSE +0 -0
- package/README.md +7 -1
- package/jest.config.js +4 -1
- package/lib/acl/aclLogic.d.ts +32 -0
- package/lib/acl/aclLogic.d.ts.map +1 -0
- package/lib/acl/aclLogic.js +132 -0
- package/lib/acl/aclLogic.js.map +1 -0
- package/lib/authSession/authSession.d.ts +3 -0
- package/lib/authSession/authSession.d.ts.map +1 -0
- package/lib/authSession/authSession.js +8 -0
- package/lib/authSession/authSession.js.map +1 -0
- package/lib/authn/SolidAuthnLogic.d.ts +26 -5
- package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/lib/authn/SolidAuthnLogic.js +167 -5
- package/lib/authn/SolidAuthnLogic.js.map +1 -1
- package/lib/authn/authUtil.d.ts +17 -0
- package/lib/authn/authUtil.d.ts.map +1 -0
- package/lib/authn/authUtil.js +88 -0
- package/lib/authn/authUtil.js.map +1 -0
- package/lib/chat/ChatLogic.d.ts +2 -2
- package/lib/chat/ChatLogic.d.ts.map +1 -1
- package/lib/chat/ChatLogic.js +38 -33
- package/lib/chat/ChatLogic.js.map +1 -1
- package/lib/chat/determineChatContainer.d.ts +0 -0
- package/lib/chat/determineChatContainer.d.ts.map +0 -0
- package/lib/chat/determineChatContainer.js +0 -0
- package/lib/chat/determineChatContainer.js.map +0 -0
- package/lib/inbox/InboxLogic.d.ts +2 -2
- package/lib/inbox/InboxLogic.d.ts.map +1 -1
- package/lib/inbox/InboxLogic.js +14 -13
- package/lib/inbox/InboxLogic.js.map +1 -1
- package/lib/index.d.ts +14 -72
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +39 -387
- package/lib/index.js.map +1 -1
- package/lib/issuer/issuerLogic.d.ts +8 -0
- package/lib/issuer/issuerLogic.d.ts.map +1 -0
- package/lib/issuer/issuerLogic.js +53 -0
- package/lib/issuer/issuerLogic.js.map +1 -0
- package/lib/logic/CustomError.d.ts +17 -0
- package/lib/logic/CustomError.d.ts.map +1 -0
- package/lib/logic/CustomError.js +73 -0
- package/lib/logic/CustomError.js.map +1 -0
- package/lib/{index-alain.d.ts → logic/SolidLogic.d.ts} +7 -33
- package/lib/logic/SolidLogic.d.ts.map +1 -0
- package/lib/{index-alain.js → logic/SolidLogic.js} +17 -99
- package/lib/logic/SolidLogic.js.map +1 -0
- package/lib/logic/solidLogicSingleton.d.ts +4 -0
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -0
- package/lib/logic/solidLogicSingleton.js +77 -0
- package/lib/logic/solidLogicSingleton.js.map +1 -0
- package/lib/profile/ProfileLogic.d.ts +2 -3
- package/lib/profile/ProfileLogic.d.ts.map +1 -1
- package/lib/profile/ProfileLogic.js +10 -8
- package/lib/profile/ProfileLogic.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +22 -0
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -0
- package/lib/typeIndex/typeIndexLogic.js +302 -0
- package/lib/typeIndex/typeIndexLogic.js.map +1 -0
- package/lib/types.d.ts +31 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/{authn/index.js → types.js} +1 -1
- package/lib/types.js.map +1 -0
- package/lib/util/UtilityLogic.d.ts +2 -2
- package/lib/util/UtilityLogic.d.ts.map +1 -1
- package/lib/util/UtilityLogic.js +10 -8
- package/lib/util/UtilityLogic.js.map +1 -1
- package/lib/{debug.d.ts → util/debug.d.ts} +0 -0
- package/lib/util/debug.d.ts.map +1 -0
- package/lib/{debug.js → util/debug.js} +0 -0
- package/lib/util/debug.js.map +1 -0
- package/lib/{uri.d.ts → util/uri.d.ts} +0 -0
- package/lib/util/uri.d.ts.map +1 -0
- package/lib/{uri.js → util/uri.js} +0 -0
- package/lib/util/uri.js.map +1 -0
- package/package.json +19 -17
- package/renovate.json +0 -0
- package/src/acl/aclLogic.ts +137 -0
- package/src/authSession/authSession.ts +13 -0
- package/src/authn/SolidAuthnLogic.ts +114 -9
- package/src/authn/authUtil.ts +67 -0
- package/src/chat/ChatLogic.ts +13 -13
- package/src/chat/determineChatContainer.ts +0 -0
- package/src/inbox/InboxLogic.ts +3 -15
- package/src/index.ts +29 -307
- package/src/issuer/issuerLogic.ts +40 -0
- package/src/logic/CustomError.ts +25 -0
- package/src/logic/SolidLogic.ts +264 -0
- package/src/logic/solidLogicSingleton.ts +18 -0
- package/src/profile/ProfileLogic.ts +4 -5
- package/src/typeIndex/typeIndexLogic.ts +170 -0
- package/src/types.ts +43 -0
- package/src/util/UtilityLogic.ts +4 -16
- package/src/{debug.ts → util/debug.ts} +0 -0
- package/src/{uri.ts → util/uri.ts} +0 -0
- package/test/aclLogic.test.ts +15 -0
- package/test/authUtil.test.ts +23 -0
- package/{src/chat/integration.test.ts → test/chatLogic.test.ts} +4 -5
- package/test/helpers/setup.ts +13 -0
- package/{src/inbox/unit.test.ts → test/inboxLogic.test.ts} +5 -6
- package/test/logic.test.ts +28 -0
- package/test/solidAuthLogic.test.ts +49 -0
- package/test/typeIndexLogic.test.ts +26 -0
- package/{src/util/unit.test.ts → test/utilityLogic.test.ts} +3 -4
- package/tsconfig.json +0 -0
- package/jest.setup.ts +0 -2
- package/lib/authn/NoAuthnLogic.d.ts +0 -9
- package/lib/authn/NoAuthnLogic.d.ts.map +0 -1
- package/lib/authn/NoAuthnLogic.js +0 -17
- package/lib/authn/NoAuthnLogic.js.map +0 -1
- package/lib/authn/index.d.ts +0 -5
- package/lib/authn/index.d.ts.map +0 -1
- package/lib/authn/index.js.map +0 -1
- package/lib/chat/integration.test.d.ts +0 -2
- package/lib/chat/integration.test.d.ts.map +0 -1
- package/lib/chat/integration.test.js +0 -318
- package/lib/chat/integration.test.js.map +0 -1
- package/lib/debug.d.ts.map +0 -1
- package/lib/debug.js.map +0 -1
- package/lib/inbox/unit.test.d.ts +0 -2
- package/lib/inbox/unit.test.d.ts.map +0 -1
- package/lib/inbox/unit.test.js +0 -264
- package/lib/inbox/unit.test.js.map +0 -1
- package/lib/index-alain.d.ts.map +0 -1
- package/lib/index-alain.js.map +0 -1
- package/lib/uri.d.ts.map +0 -1
- package/lib/uri.js.map +0 -1
- package/lib/util/UtilityLogic-alain.d.ts +0 -32
- package/lib/util/UtilityLogic-alain.d.ts.map +0 -1
- package/lib/util/UtilityLogic-alain.js +0 -248
- package/lib/util/UtilityLogic-alain.js.map +0 -1
- package/lib/util/unit.test.d.ts +0 -2
- package/lib/util/unit.test.d.ts.map +0 -1
- package/lib/util/unit.test.js +0 -200
- package/lib/util/unit.test.js.map +0 -1
- package/src/authn/NoAuthnLogic.ts +0 -16
- package/src/authn/index.ts +0 -5
- package/src/index-alain.txt +0 -316
- package/src/util/UtilityLogic-alain.txt +0 -181
package/lib/index.js
CHANGED
|
@@ -1,391 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
-
function step(op) {
|
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
52
|
-
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;
|
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
-
switch (op[0]) {
|
|
55
|
-
case 0: case 1: t = op; break;
|
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
-
default:
|
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
-
if (t[2]) _.ops.pop();
|
|
65
|
-
_.trys.pop(); continue;
|
|
66
|
-
}
|
|
67
|
-
op = body.call(thisArg, _);
|
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
73
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
|
-
};
|
|
75
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
3
|
+
exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
|
|
4
|
+
// Make these variables directly accessible as it is what you need most of the time
|
|
5
|
+
// This also makes these variable globaly accesible in mashlib
|
|
6
|
+
var solidLogicSingleton_1 = require("./logic/solidLogicSingleton");
|
|
7
|
+
var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
|
|
8
|
+
exports.authn = authn;
|
|
9
|
+
var authSession = solidLogicSingleton_1.solidLogicSingleton.authn.authSession;
|
|
10
|
+
exports.authSession = authSession;
|
|
11
|
+
var store = solidLogicSingleton_1.solidLogicSingleton.store;
|
|
12
|
+
exports.store = store;
|
|
13
|
+
var chat = solidLogicSingleton_1.solidLogicSingleton.chat;
|
|
14
|
+
exports.chat = chat;
|
|
15
|
+
var profile = solidLogicSingleton_1.solidLogicSingleton.profile;
|
|
16
|
+
exports.profile = profile;
|
|
17
|
+
var aclLogic_1 = require("./acl/aclLogic");
|
|
18
|
+
Object.defineProperty(exports, "setACLUserPublic", { enumerable: true, get: function () { return aclLogic_1.setACLUserPublic; } });
|
|
19
|
+
Object.defineProperty(exports, "genACLText", { enumerable: true, get: function () { return aclLogic_1.genACLText; } });
|
|
20
|
+
var typeIndexLogic_1 = require("./typeIndex/typeIndexLogic");
|
|
21
|
+
Object.defineProperty(exports, "ensureTypeIndexes", { enumerable: true, get: function () { return typeIndexLogic_1.ensureTypeIndexes; } });
|
|
22
|
+
Object.defineProperty(exports, "loadTypeIndexes", { enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } });
|
|
23
|
+
Object.defineProperty(exports, "registerInTypeIndex", { enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } });
|
|
24
|
+
Object.defineProperty(exports, "loadIndex", { enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } });
|
|
25
|
+
var SolidLogic_1 = require("./logic/SolidLogic");
|
|
26
|
+
Object.defineProperty(exports, "SolidLogic", { enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } });
|
|
27
|
+
var authUtil_1 = require("./authn/authUtil");
|
|
28
|
+
Object.defineProperty(exports, "offlineTestID", { enumerable: true, get: function () { return authUtil_1.offlineTestID; } });
|
|
29
|
+
Object.defineProperty(exports, "appContext", { enumerable: true, get: function () { return authUtil_1.appContext; } });
|
|
84
30
|
var UtilityLogic_1 = require("./util/UtilityLogic");
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.fetcher = fetcher;
|
|
98
|
-
if (solidAuthSession) {
|
|
99
|
-
this.authn = new SolidAuthnLogic_1.SolidAuthnLogic(solidAuthSession);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.authn = new NoAuthnLogic_1.NoAuthnLogic();
|
|
103
|
-
}
|
|
104
|
-
this.profile = new ProfileLogic_1.ProfileLogic(this.store, ns, this.authn);
|
|
105
|
-
this.chat = new ChatLogic_1.ChatLogic(this.store, ns, this.profile);
|
|
106
|
-
this.util = new UtilityLogic_1.UtilityLogic(this.store, ns, this.fetcher);
|
|
107
|
-
}
|
|
108
|
-
SolidLogic.prototype.findAclDocUrl = function (url) {
|
|
109
|
-
return this.util.findAclDocUrl(url);
|
|
110
|
-
};
|
|
111
|
-
SolidLogic.prototype.loadDoc = function (doc) {
|
|
112
|
-
return this.util.loadDoc(doc);
|
|
113
|
-
};
|
|
114
|
-
SolidLogic.prototype.loadProfile = function (me) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
-
var profileDocument, err_1, message;
|
|
117
|
-
return __generator(this, function (_a) {
|
|
118
|
-
switch (_a.label) {
|
|
119
|
-
case 0:
|
|
120
|
-
// console.log('loadProfile', me)
|
|
121
|
-
if (this.cache.profileDocument[me.value]) {
|
|
122
|
-
return [2 /*return*/, this.cache.profileDocument[me.value]];
|
|
123
|
-
}
|
|
124
|
-
_a.label = 1;
|
|
125
|
-
case 1:
|
|
126
|
-
_a.trys.push([1, 3, , 4]);
|
|
127
|
-
profileDocument = me.doc();
|
|
128
|
-
return [4 /*yield*/, this.loadDoc(profileDocument)];
|
|
129
|
-
case 2:
|
|
130
|
-
_a.sent();
|
|
131
|
-
return [2 /*return*/, profileDocument];
|
|
132
|
-
case 3:
|
|
133
|
-
err_1 = _a.sent();
|
|
134
|
-
message = "Logged in but cannot load profile ".concat(profileDocument, " : ").concat(err_1);
|
|
135
|
-
throw new Error(message);
|
|
136
|
-
case 4: return [2 /*return*/];
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
SolidLogic.prototype.loadPreferences = function (me) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
// console.log('this.store.any()', this.store.any())
|
|
144
|
-
/**
|
|
145
|
-
* Are we working cross-origin?
|
|
146
|
-
* Returns True if we are in a webapp at an origin, and the file origin is different
|
|
147
|
-
*/
|
|
148
|
-
function differentOrigin() {
|
|
149
|
-
if (!preferencesFile) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
return ("".concat(window.location.origin, "/") !== new URL(preferencesFile.value).origin);
|
|
153
|
-
}
|
|
154
|
-
var preferencesFile, err_2, status_1;
|
|
155
|
-
return __generator(this, function (_a) {
|
|
156
|
-
switch (_a.label) {
|
|
157
|
-
case 0:
|
|
158
|
-
// console.log('loadPreferences', me)
|
|
159
|
-
if (this.cache.preferencesFile[me.value]) {
|
|
160
|
-
return [2 /*return*/, this.cache.preferencesFile[me.value]];
|
|
161
|
-
}
|
|
162
|
-
preferencesFile = this.store.any(me, ns.space("preferencesFile"));
|
|
163
|
-
if (!preferencesFile) {
|
|
164
|
-
throw new Error("Can't find a preference file pointer in profile ".concat(me.doc()));
|
|
165
|
-
}
|
|
166
|
-
if (!this.store.fetcher) {
|
|
167
|
-
throw new Error("Cannot load doc, have no fetcher");
|
|
168
|
-
}
|
|
169
|
-
_a.label = 1;
|
|
170
|
-
case 1:
|
|
171
|
-
_a.trys.push([1, 3, , 4]);
|
|
172
|
-
return [4 /*yield*/, this.store.fetcher.load(preferencesFile, {
|
|
173
|
-
withCredentials: true,
|
|
174
|
-
})];
|
|
175
|
-
case 2:
|
|
176
|
-
_a.sent();
|
|
177
|
-
return [3 /*break*/, 4];
|
|
178
|
-
case 3:
|
|
179
|
-
err_2 = _a.sent();
|
|
180
|
-
status_1 = err_2.status;
|
|
181
|
-
debug.log("HTTP status ".concat(status_1, " for preference file ").concat(preferencesFile));
|
|
182
|
-
if (status_1 === 401) {
|
|
183
|
-
throw new UnauthorizedError();
|
|
184
|
-
}
|
|
185
|
-
if (status_1 === 403) {
|
|
186
|
-
if (differentOrigin()) {
|
|
187
|
-
throw new CrossOriginForbiddenError();
|
|
188
|
-
}
|
|
189
|
-
throw new SameOriginForbiddenError();
|
|
190
|
-
}
|
|
191
|
-
if (status_1 === 404) {
|
|
192
|
-
throw new NotFoundError(preferencesFile.value);
|
|
193
|
-
}
|
|
194
|
-
throw new FetchError(err_2.status, err_2.message);
|
|
195
|
-
case 4: return [2 /*return*/, preferencesFile];
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
SolidLogic.prototype.getTypeIndex = function (me, preferencesFile, isPublic) {
|
|
201
|
-
// console.log('getTypeIndex', this.store.each(me, undefined, undefined, preferencesFile), isPublic, preferencesFile)
|
|
202
|
-
return this.store.each(me, isPublic ? ns.solid("publicTypeIndex") : ns.solid("privateTypeIndex"), undefined, preferencesFile);
|
|
203
|
-
};
|
|
204
|
-
SolidLogic.prototype.getRegistrations = function (instance, theClass) {
|
|
205
|
-
var _this = this;
|
|
206
|
-
return this.store
|
|
207
|
-
.each(undefined, ns.solid("instance"), instance)
|
|
208
|
-
.filter(function (r) {
|
|
209
|
-
return _this.store.holds(r, ns.solid("forClass"), theClass);
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
SolidLogic.prototype.load = function (doc) {
|
|
213
|
-
if (!this.store.fetcher) {
|
|
214
|
-
throw new Error("Cannot load doc(s), have no fetcher");
|
|
215
|
-
}
|
|
216
|
-
return this.store.fetcher.load(doc);
|
|
217
|
-
};
|
|
218
|
-
SolidLogic.prototype.loadIndexes = function (me, publicProfile, preferencesFile, onWarning) {
|
|
219
|
-
var _this = this;
|
|
220
|
-
if (onWarning === void 0) { onWarning = function (_err) { return __awaiter(_this, void 0, void 0, function () {
|
|
221
|
-
return __generator(this, function (_a) {
|
|
222
|
-
return [2 /*return*/, undefined];
|
|
223
|
-
});
|
|
224
|
-
}); }; }
|
|
225
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
-
var privateIndexes, publicIndexes, err_3, err_4;
|
|
227
|
-
return __generator(this, function (_a) {
|
|
228
|
-
switch (_a.label) {
|
|
229
|
-
case 0:
|
|
230
|
-
privateIndexes = [];
|
|
231
|
-
publicIndexes = [];
|
|
232
|
-
if (!publicProfile) return [3 /*break*/, 4];
|
|
233
|
-
publicIndexes = this.getTypeIndex(me, publicProfile, true);
|
|
234
|
-
_a.label = 1;
|
|
235
|
-
case 1:
|
|
236
|
-
_a.trys.push([1, 3, , 4]);
|
|
237
|
-
return [4 /*yield*/, this.load(publicIndexes)];
|
|
238
|
-
case 2:
|
|
239
|
-
_a.sent();
|
|
240
|
-
return [3 /*break*/, 4];
|
|
241
|
-
case 3:
|
|
242
|
-
err_3 = _a.sent();
|
|
243
|
-
onWarning(new Error("loadIndex: loading public type index(es) ".concat(err_3)));
|
|
244
|
-
return [3 /*break*/, 4];
|
|
245
|
-
case 4:
|
|
246
|
-
if (!preferencesFile) return [3 /*break*/, 9];
|
|
247
|
-
privateIndexes = this.getTypeIndex(me, preferencesFile, false);
|
|
248
|
-
if (!(privateIndexes.length === 0)) return [3 /*break*/, 6];
|
|
249
|
-
return [4 /*yield*/, onWarning(new Error("Your preference file ".concat(preferencesFile, " does not point to a private type index.")))];
|
|
250
|
-
case 5:
|
|
251
|
-
_a.sent();
|
|
252
|
-
return [3 /*break*/, 9];
|
|
253
|
-
case 6:
|
|
254
|
-
_a.trys.push([6, 8, , 9]);
|
|
255
|
-
return [4 /*yield*/, this.load(privateIndexes)];
|
|
256
|
-
case 7:
|
|
257
|
-
_a.sent();
|
|
258
|
-
return [3 /*break*/, 9];
|
|
259
|
-
case 8:
|
|
260
|
-
err_4 = _a.sent();
|
|
261
|
-
onWarning(new Error("loadIndex: loading private type index(es) ".concat(err_4)));
|
|
262
|
-
return [3 /*break*/, 9];
|
|
263
|
-
case 9: return [2 /*return*/, {
|
|
264
|
-
private: privateIndexes,
|
|
265
|
-
public: publicIndexes,
|
|
266
|
-
}];
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
SolidLogic.prototype.createEmptyRdfDoc = function (doc, comment) {
|
|
272
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
273
|
-
return __generator(this, function (_a) {
|
|
274
|
-
switch (_a.label) {
|
|
275
|
-
case 0:
|
|
276
|
-
if (!this.store.fetcher) {
|
|
277
|
-
throw new Error("Cannot create empty rdf doc, have no fetcher");
|
|
278
|
-
}
|
|
279
|
-
return [4 /*yield*/, this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
280
|
-
data: "# ".concat(new Date(), " ").concat(comment, "\n"),
|
|
281
|
-
contentType: "text/turtle",
|
|
282
|
-
})];
|
|
283
|
-
case 1:
|
|
284
|
-
_a.sent();
|
|
285
|
-
return [2 /*return*/];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
291
|
-
SolidLogic.prototype.updatePromise = function (del, ins) {
|
|
292
|
-
var _this = this;
|
|
293
|
-
if (ins === void 0) { ins = []; }
|
|
294
|
-
return new Promise(function (resolve, reject) {
|
|
295
|
-
if (!_this.store.updater) {
|
|
296
|
-
throw new Error("Cannot updatePromise, have no updater");
|
|
297
|
-
}
|
|
298
|
-
_this.store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
299
|
-
if (!ok) {
|
|
300
|
-
reject(new Error(errorBody));
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
resolve();
|
|
304
|
-
}
|
|
305
|
-
}); // callback
|
|
306
|
-
}); // promise
|
|
307
|
-
};
|
|
308
|
-
SolidLogic.prototype.isContainer = function (url) {
|
|
309
|
-
return this.util.isContainer(url);
|
|
310
|
-
};
|
|
311
|
-
SolidLogic.prototype.getContainerElements = function (containerNode) {
|
|
312
|
-
return this.util.getContainerElements(containerNode);
|
|
313
|
-
};
|
|
314
|
-
SolidLogic.prototype.getContainerMembers = function (containerUrl) {
|
|
315
|
-
return this.util.getContainerMembers(containerUrl);
|
|
316
|
-
};
|
|
317
|
-
SolidLogic.prototype.recursiveDelete = function (url) {
|
|
318
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
319
|
-
return __generator(this, function (_a) {
|
|
320
|
-
return [2 /*return*/, this.util.recursiveDelete(url)];
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
};
|
|
324
|
-
SolidLogic.prototype.clearStore = function () {
|
|
325
|
-
return this.util.clearStore();
|
|
326
|
-
};
|
|
327
|
-
SolidLogic.prototype.fetch = function (url, options) {
|
|
328
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
329
|
-
return __generator(this, function (_a) {
|
|
330
|
-
return [2 /*return*/, this.fetcher.fetch(url, options)];
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
return SolidLogic;
|
|
335
|
-
}());
|
|
336
|
-
exports.SolidLogic = SolidLogic;
|
|
337
|
-
var CustomError = /** @class */ (function (_super) {
|
|
338
|
-
__extends(CustomError, _super);
|
|
339
|
-
function CustomError(message) {
|
|
340
|
-
var _newTarget = this.constructor;
|
|
341
|
-
var _this = _super.call(this, message) || this;
|
|
342
|
-
// see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
|
|
343
|
-
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
|
|
344
|
-
_this.name = _newTarget.name; // stack traces display correctly now
|
|
345
|
-
return _this;
|
|
346
|
-
}
|
|
347
|
-
return CustomError;
|
|
348
|
-
}(Error));
|
|
349
|
-
var UnauthorizedError = /** @class */ (function (_super) {
|
|
350
|
-
__extends(UnauthorizedError, _super);
|
|
351
|
-
function UnauthorizedError() {
|
|
352
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
353
|
-
}
|
|
354
|
-
return UnauthorizedError;
|
|
355
|
-
}(CustomError));
|
|
356
|
-
exports.UnauthorizedError = UnauthorizedError;
|
|
357
|
-
var CrossOriginForbiddenError = /** @class */ (function (_super) {
|
|
358
|
-
__extends(CrossOriginForbiddenError, _super);
|
|
359
|
-
function CrossOriginForbiddenError() {
|
|
360
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
361
|
-
}
|
|
362
|
-
return CrossOriginForbiddenError;
|
|
363
|
-
}(CustomError));
|
|
364
|
-
exports.CrossOriginForbiddenError = CrossOriginForbiddenError;
|
|
365
|
-
var SameOriginForbiddenError = /** @class */ (function (_super) {
|
|
366
|
-
__extends(SameOriginForbiddenError, _super);
|
|
367
|
-
function SameOriginForbiddenError() {
|
|
368
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
369
|
-
}
|
|
370
|
-
return SameOriginForbiddenError;
|
|
371
|
-
}(CustomError));
|
|
372
|
-
exports.SameOriginForbiddenError = SameOriginForbiddenError;
|
|
373
|
-
var NotFoundError = /** @class */ (function (_super) {
|
|
374
|
-
__extends(NotFoundError, _super);
|
|
375
|
-
function NotFoundError() {
|
|
376
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
377
|
-
}
|
|
378
|
-
return NotFoundError;
|
|
379
|
-
}(CustomError));
|
|
380
|
-
exports.NotFoundError = NotFoundError;
|
|
381
|
-
var FetchError = /** @class */ (function (_super) {
|
|
382
|
-
__extends(FetchError, _super);
|
|
383
|
-
function FetchError(status, message) {
|
|
384
|
-
var _this = _super.call(this, message) || this;
|
|
385
|
-
_this.status = status;
|
|
386
|
-
return _this;
|
|
387
|
-
}
|
|
388
|
-
return FetchError;
|
|
389
|
-
}(CustomError));
|
|
390
|
-
exports.FetchError = FetchError;
|
|
31
|
+
Object.defineProperty(exports, "ACL_LINK", { enumerable: true, get: function () { return UtilityLogic_1.ACL_LINK; } });
|
|
32
|
+
var issuerLogic_1 = require("./issuer/issuerLogic");
|
|
33
|
+
Object.defineProperty(exports, "getSuggestedIssuers", { enumerable: true, get: function () { return issuerLogic_1.getSuggestedIssuers; } });
|
|
34
|
+
// solidLogicSingleton is exported entirely because it is used in solid-panes
|
|
35
|
+
var solidLogicSingleton_2 = require("./logic/solidLogicSingleton");
|
|
36
|
+
Object.defineProperty(exports, "solidLogicSingleton", { enumerable: true, get: function () { return solidLogicSingleton_2.solidLogicSingleton; } });
|
|
37
|
+
var CustomError_1 = require("./logic/CustomError");
|
|
38
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return CustomError_1.UnauthorizedError; } });
|
|
39
|
+
Object.defineProperty(exports, "CrossOriginForbiddenError", { enumerable: true, get: function () { return CustomError_1.CrossOriginForbiddenError; } });
|
|
40
|
+
Object.defineProperty(exports, "SameOriginForbiddenError", { enumerable: true, get: function () { return CustomError_1.SameOriginForbiddenError; } });
|
|
41
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return CustomError_1.NotFoundError; } });
|
|
42
|
+
Object.defineProperty(exports, "FetchError", { enumerable: true, get: function () { return CustomError_1.FetchError; } });
|
|
391
43
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,8DAA8D;AAC9D,mEAAiE;AACjE,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAyB9B,sBAAK;AAxBd,IAAM,WAAW,GAAG,yCAAmB,CAAC,KAAK,CAAC,WAAW,CAAA;AAwBzC,kCAAW;AAvB3B,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAuBV,sBAAK;AArBlC,IAAM,IAAI,GAAG,yCAAmB,CAAC,IAAI,CAAA;AAqBD,oBAAI;AApBxC,IAAM,OAAO,GAAG,yCAAmB,CAAC,OAAO,CAAA;AAoBD,0BAAO;AAlBjD,2CAGuB;AAFrB,4GAAA,gBAAgB,OAAA;AAChB,sGAAA,UAAU,OAAA;AAEZ,6DAKmC;AAJjC,mHAAA,iBAAiB,OAAA;AACjB,iHAAA,eAAe,OAAA;AACf,qHAAA,mBAAmB,OAAA;AACnB,2GAAA,SAAS,OAAA;AAEX,iDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,6CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,sGAAA,UAAU,OAAA;AAClC,oDAA8C;AAArC,wGAAA,QAAQ,OAAA;AACjB,oDAA0D;AAAjD,kHAAA,mBAAmB,OAAA;AAE5B,6EAA6E;AAC7E,mEAAiE;AAAxD,0HAAA,mBAAmB,OAAA;AAC5B,mDAAuI;AAA9H,gHAAA,iBAAiB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuerLogic.d.ts","sourceRoot":"","sources":["../../src/issuer/issuerLogic.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,wBAAgB,mBAAmB,IAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAYpE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getSuggestedIssuers = void 0;
|
|
13
|
+
var DEFAULT_ISSUERS = [
|
|
14
|
+
{
|
|
15
|
+
name: 'Solid Community',
|
|
16
|
+
uri: 'https://solidcommunity.net'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Solid Web',
|
|
20
|
+
uri: 'https://solidweb.org'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Inrupt.net',
|
|
24
|
+
uri: 'https://inrupt.net'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'pod.Inrupt.com',
|
|
28
|
+
uri: 'https://broker.pod.inrupt.com'
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* @returns - A list of suggested OIDC issuers
|
|
33
|
+
*/
|
|
34
|
+
function getSuggestedIssuers() {
|
|
35
|
+
// Suggest a default list of OIDC issuers
|
|
36
|
+
var issuers = __spreadArray([], DEFAULT_ISSUERS, true);
|
|
37
|
+
// Suggest the current host if not already included
|
|
38
|
+
var _a = new URL(location.href), host = _a.host, origin = _a.origin;
|
|
39
|
+
var hosts = issuers.map(function (_a) {
|
|
40
|
+
var uri = _a.uri;
|
|
41
|
+
return new URL(uri).host;
|
|
42
|
+
});
|
|
43
|
+
if (!hosts.includes(host) && !hosts.some(function (existing) { return isSubdomainOf(host, existing); })) {
|
|
44
|
+
issuers.unshift({ name: host, uri: origin });
|
|
45
|
+
}
|
|
46
|
+
return issuers;
|
|
47
|
+
}
|
|
48
|
+
exports.getSuggestedIssuers = getSuggestedIssuers;
|
|
49
|
+
function isSubdomainOf(subdomain, domain) {
|
|
50
|
+
var dot = subdomain.length - domain.length - 1;
|
|
51
|
+
return dot > 0 && subdomain[dot] === '.' && subdomain.endsWith(domain);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=issuerLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuerLogic.js","sourceRoot":"","sources":["../../src/issuer/issuerLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAM,eAAe,GAAG;IACtB;QACE,IAAI,EAAE,iBAAiB;QACvB,GAAG,EAAE,4BAA4B;KAClC;IACD;QACE,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,sBAAsB;KAC5B;IACD;QACE,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,oBAAoB;KAC1B;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,+BAA+B;KACrC;CACF,CAAA;AAED;;GAEG;AACH,SAAgB,mBAAmB;IAC/B,yCAAyC;IACzC,IAAM,OAAO,qBAAO,eAAe,OAAC,CAAA;IAEpC,mDAAmD;IAC7C,IAAA,KAAmB,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAvC,IAAI,UAAA,EAAE,MAAM,YAA2B,CAAA;IAC/C,IAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAC,EAAO;YAAL,GAAG,SAAA;QAAO,OAAA,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI;IAAjB,CAAiB,CAAC,CAAA;IACzD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,EAA7B,CAA6B,CAAC,EAAE;QACnF,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAZH,kDAYG;AAEH,SAAS,aAAa,CAAE,SAAiB,EAAE,MAAc;IACrD,IAAM,GAAG,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAChD,OAAO,GAAG,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAC1E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare class CustomError extends Error {
|
|
2
|
+
constructor(message?: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class UnauthorizedError extends CustomError {
|
|
5
|
+
}
|
|
6
|
+
export declare class CrossOriginForbiddenError extends CustomError {
|
|
7
|
+
}
|
|
8
|
+
export declare class SameOriginForbiddenError extends CustomError {
|
|
9
|
+
}
|
|
10
|
+
export declare class NotFoundError extends CustomError {
|
|
11
|
+
}
|
|
12
|
+
export declare class FetchError extends CustomError {
|
|
13
|
+
status: number;
|
|
14
|
+
constructor(status: number, message?: string);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=CustomError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomError.d.ts","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":"AAAA,cAAM,WAAY,SAAQ,KAAK;gBACf,OAAO,CAAC,EAAE,MAAM;CAM/B;AAED,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,yBAA0B,SAAQ,WAAW;CAAG;AAE7D,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,aAAc,SAAQ,WAAW;CAAG;AAEjD,qBAAa,UAAW,SAAQ,WAAW;IACvC,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAI/C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = void 0;
|
|
19
|
+
var CustomError = /** @class */ (function (_super) {
|
|
20
|
+
__extends(CustomError, _super);
|
|
21
|
+
function CustomError(message) {
|
|
22
|
+
var _newTarget = this.constructor;
|
|
23
|
+
var _this = _super.call(this, message) || this;
|
|
24
|
+
// see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
|
|
25
|
+
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
|
|
26
|
+
_this.name = _newTarget.name; // stack traces display correctly now
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
return CustomError;
|
|
30
|
+
}(Error));
|
|
31
|
+
var UnauthorizedError = /** @class */ (function (_super) {
|
|
32
|
+
__extends(UnauthorizedError, _super);
|
|
33
|
+
function UnauthorizedError() {
|
|
34
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
}
|
|
36
|
+
return UnauthorizedError;
|
|
37
|
+
}(CustomError));
|
|
38
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
39
|
+
var CrossOriginForbiddenError = /** @class */ (function (_super) {
|
|
40
|
+
__extends(CrossOriginForbiddenError, _super);
|
|
41
|
+
function CrossOriginForbiddenError() {
|
|
42
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
43
|
+
}
|
|
44
|
+
return CrossOriginForbiddenError;
|
|
45
|
+
}(CustomError));
|
|
46
|
+
exports.CrossOriginForbiddenError = CrossOriginForbiddenError;
|
|
47
|
+
var SameOriginForbiddenError = /** @class */ (function (_super) {
|
|
48
|
+
__extends(SameOriginForbiddenError, _super);
|
|
49
|
+
function SameOriginForbiddenError() {
|
|
50
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
51
|
+
}
|
|
52
|
+
return SameOriginForbiddenError;
|
|
53
|
+
}(CustomError));
|
|
54
|
+
exports.SameOriginForbiddenError = SameOriginForbiddenError;
|
|
55
|
+
var NotFoundError = /** @class */ (function (_super) {
|
|
56
|
+
__extends(NotFoundError, _super);
|
|
57
|
+
function NotFoundError() {
|
|
58
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
59
|
+
}
|
|
60
|
+
return NotFoundError;
|
|
61
|
+
}(CustomError));
|
|
62
|
+
exports.NotFoundError = NotFoundError;
|
|
63
|
+
var FetchError = /** @class */ (function (_super) {
|
|
64
|
+
__extends(FetchError, _super);
|
|
65
|
+
function FetchError(status, message) {
|
|
66
|
+
var _this = _super.call(this, message) || this;
|
|
67
|
+
_this.status = status;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
return FetchError;
|
|
71
|
+
}(CustomError));
|
|
72
|
+
exports.FetchError = FetchError;
|
|
73
|
+
//# sourceMappingURL=CustomError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomError.js","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAA0B,+BAAK;IAC3B,qBAAY,OAAgB;;QAA5B,YACI,kBAAM,OAAO,CAAC,SAIjB;QAHG,0EAA0E;QAC1E,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,0BAA0B;QAC7E,KAAI,CAAC,IAAI,GAAG,WAAW,IAAI,CAAC,CAAC,qCAAqC;;IACtE,CAAC;IACL,kBAAC;AAAD,CAAC,AAPD,CAA0B,KAAK,GAO9B;AAED;IAAuC,qCAAW;IAAlD;;IAAoD,CAAC;IAAD,wBAAC;AAAD,CAAC,AAArD,CAAuC,WAAW,GAAG;AAAxC,8CAAiB;AAE9B;IAA+C,6CAAW;IAA1D;;IAA4D,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA7D,CAA+C,WAAW,GAAG;AAAhD,8DAAyB;AAEtC;IAA8C,4CAAW;IAAzD;;IAA2D,CAAC;IAAD,+BAAC;AAAD,CAAC,AAA5D,CAA8C,WAAW,GAAG;AAA/C,4DAAwB;AAErC;IAAmC,iCAAW;IAA9C;;IAAgD,CAAC;IAAD,oBAAC;AAAD,CAAC,AAAjD,CAAmC,WAAW,GAAG;AAApC,sCAAa;AAE1B;IAAgC,8BAAW;IAGvC,oBAAY,MAAc,EAAE,OAAgB;QAA5C,YACI,kBAAM,OAAO,CAAC,SAEjB;QADG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IACL,iBAAC;AAAD,CAAC,AAPD,CAAgC,WAAW,GAO1C;AAPY,gCAAU"}
|