@pod-os/core 0.20.1-rc.e23505f.0 → 0.20.1-rc.f98c05a.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/dist/index.js +583 -53
- package/lib/index.js +652 -122
- package/package.json +2 -1
- package/types/files/FileFetcher.d.ts +16 -0
- package/types/index.d.ts +1 -0
- package/types/problems/index.d.ts +18 -0
package/dist/index.js
CHANGED
|
@@ -1878,8 +1878,8 @@ function createErrorClass(createImpl) {
|
|
|
1878
1878
|
var UnsubscriptionError = createErrorClass(function(_super) {
|
|
1879
1879
|
return function UnsubscriptionErrorImpl(errors) {
|
|
1880
1880
|
_super(this);
|
|
1881
|
-
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(
|
|
1882
|
-
return i + 1 + ") " +
|
|
1881
|
+
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err2, i) {
|
|
1882
|
+
return i + 1 + ") " + err2.toString();
|
|
1883
1883
|
}).join("\n ") : "";
|
|
1884
1884
|
this.name = "UnsubscriptionError";
|
|
1885
1885
|
this.errors = errors;
|
|
@@ -1945,12 +1945,12 @@ var Subscription = (function() {
|
|
|
1945
1945
|
var finalizer = _finalizers_1_1.value;
|
|
1946
1946
|
try {
|
|
1947
1947
|
execFinalizer(finalizer);
|
|
1948
|
-
} catch (
|
|
1948
|
+
} catch (err2) {
|
|
1949
1949
|
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
1950
|
-
if (
|
|
1951
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(
|
|
1950
|
+
if (err2 instanceof UnsubscriptionError) {
|
|
1951
|
+
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err2.errors));
|
|
1952
1952
|
} else {
|
|
1953
|
-
errors.push(
|
|
1953
|
+
errors.push(err2);
|
|
1954
1954
|
}
|
|
1955
1955
|
}
|
|
1956
1956
|
}
|
|
@@ -2057,13 +2057,13 @@ var timeoutProvider = {
|
|
|
2057
2057
|
};
|
|
2058
2058
|
|
|
2059
2059
|
// ../node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
|
|
2060
|
-
function reportUnhandledError(
|
|
2060
|
+
function reportUnhandledError(err2) {
|
|
2061
2061
|
timeoutProvider.setTimeout(function() {
|
|
2062
2062
|
var onUnhandledError = config.onUnhandledError;
|
|
2063
2063
|
if (onUnhandledError) {
|
|
2064
|
-
onUnhandledError(
|
|
2064
|
+
onUnhandledError(err2);
|
|
2065
2065
|
} else {
|
|
2066
|
-
throw
|
|
2066
|
+
throw err2;
|
|
2067
2067
|
}
|
|
2068
2068
|
});
|
|
2069
2069
|
}
|
|
@@ -2110,10 +2110,10 @@ function errorContext(cb) {
|
|
|
2110
2110
|
cb();
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
|
-
function captureError(
|
|
2113
|
+
function captureError(err2) {
|
|
2114
2114
|
if (config.useDeprecatedSynchronousErrorHandling && context) {
|
|
2115
2115
|
context.errorThrown = true;
|
|
2116
|
-
context.error =
|
|
2116
|
+
context.error = err2;
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
2119
2119
|
|
|
@@ -2143,12 +2143,12 @@ var Subscriber = (function(_super) {
|
|
|
2143
2143
|
this._next(value7);
|
|
2144
2144
|
}
|
|
2145
2145
|
};
|
|
2146
|
-
Subscriber2.prototype.error = function(
|
|
2146
|
+
Subscriber2.prototype.error = function(err2) {
|
|
2147
2147
|
if (this.isStopped) {
|
|
2148
|
-
handleStoppedNotification(errorNotification(
|
|
2148
|
+
handleStoppedNotification(errorNotification(err2), this);
|
|
2149
2149
|
} else {
|
|
2150
2150
|
this.isStopped = true;
|
|
2151
|
-
this._error(
|
|
2151
|
+
this._error(err2);
|
|
2152
2152
|
}
|
|
2153
2153
|
};
|
|
2154
2154
|
Subscriber2.prototype.complete = function() {
|
|
@@ -2169,9 +2169,9 @@ var Subscriber = (function(_super) {
|
|
|
2169
2169
|
Subscriber2.prototype._next = function(value7) {
|
|
2170
2170
|
this.destination.next(value7);
|
|
2171
2171
|
};
|
|
2172
|
-
Subscriber2.prototype._error = function(
|
|
2172
|
+
Subscriber2.prototype._error = function(err2) {
|
|
2173
2173
|
try {
|
|
2174
|
-
this.destination.error(
|
|
2174
|
+
this.destination.error(err2);
|
|
2175
2175
|
} finally {
|
|
2176
2176
|
this.unsubscribe();
|
|
2177
2177
|
}
|
|
@@ -2203,16 +2203,16 @@ var ConsumerObserver = (function() {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
}
|
|
2205
2205
|
};
|
|
2206
|
-
ConsumerObserver2.prototype.error = function(
|
|
2206
|
+
ConsumerObserver2.prototype.error = function(err2) {
|
|
2207
2207
|
var partialObserver = this.partialObserver;
|
|
2208
2208
|
if (partialObserver.error) {
|
|
2209
2209
|
try {
|
|
2210
|
-
partialObserver.error(
|
|
2210
|
+
partialObserver.error(err2);
|
|
2211
2211
|
} catch (error4) {
|
|
2212
2212
|
handleUnhandledError(error4);
|
|
2213
2213
|
}
|
|
2214
2214
|
} else {
|
|
2215
|
-
handleUnhandledError(
|
|
2215
|
+
handleUnhandledError(err2);
|
|
2216
2216
|
}
|
|
2217
2217
|
};
|
|
2218
2218
|
ConsumerObserver2.prototype.complete = function() {
|
|
@@ -2266,8 +2266,8 @@ function handleUnhandledError(error4) {
|
|
|
2266
2266
|
reportUnhandledError(error4);
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
function defaultErrorHandler(
|
|
2270
|
-
throw
|
|
2269
|
+
function defaultErrorHandler(err2) {
|
|
2270
|
+
throw err2;
|
|
2271
2271
|
}
|
|
2272
2272
|
function handleStoppedNotification(notification2, subscriber3) {
|
|
2273
2273
|
var onStoppedNotification = config.onStoppedNotification;
|
|
@@ -2332,8 +2332,8 @@ var Observable = (function() {
|
|
|
2332
2332
|
Observable2.prototype._trySubscribe = function(sink) {
|
|
2333
2333
|
try {
|
|
2334
2334
|
return this._subscribe(sink);
|
|
2335
|
-
} catch (
|
|
2336
|
-
sink.error(
|
|
2335
|
+
} catch (err2) {
|
|
2336
|
+
sink.error(err2);
|
|
2337
2337
|
}
|
|
2338
2338
|
};
|
|
2339
2339
|
Observable2.prototype.forEach = function(next4, promiseCtor) {
|
|
@@ -2344,8 +2344,8 @@ var Observable = (function() {
|
|
|
2344
2344
|
next: function(value7) {
|
|
2345
2345
|
try {
|
|
2346
2346
|
next4(value7);
|
|
2347
|
-
} catch (
|
|
2348
|
-
reject(
|
|
2347
|
+
} catch (err2) {
|
|
2348
|
+
reject(err2);
|
|
2349
2349
|
subscriber3.unsubscribe();
|
|
2350
2350
|
}
|
|
2351
2351
|
},
|
|
@@ -2376,8 +2376,8 @@ var Observable = (function() {
|
|
|
2376
2376
|
var value7;
|
|
2377
2377
|
_this.subscribe(function(x) {
|
|
2378
2378
|
return value7 = x;
|
|
2379
|
-
}, function(
|
|
2380
|
-
return reject(
|
|
2379
|
+
}, function(err2) {
|
|
2380
|
+
return reject(err2);
|
|
2381
2381
|
}, function() {
|
|
2382
2382
|
return resolve(value7);
|
|
2383
2383
|
});
|
|
@@ -2409,8 +2409,8 @@ function operate(init) {
|
|
|
2409
2409
|
return source8.lift(function(liftedSource) {
|
|
2410
2410
|
try {
|
|
2411
2411
|
return init(liftedSource, this);
|
|
2412
|
-
} catch (
|
|
2413
|
-
this.error(
|
|
2412
|
+
} catch (err2) {
|
|
2413
|
+
this.error(err2);
|
|
2414
2414
|
}
|
|
2415
2415
|
});
|
|
2416
2416
|
}
|
|
@@ -2431,15 +2431,15 @@ var OperatorSubscriber = (function(_super) {
|
|
|
2431
2431
|
_this._next = onNext ? function(value7) {
|
|
2432
2432
|
try {
|
|
2433
2433
|
onNext(value7);
|
|
2434
|
-
} catch (
|
|
2435
|
-
destination2.error(
|
|
2434
|
+
} catch (err2) {
|
|
2435
|
+
destination2.error(err2);
|
|
2436
2436
|
}
|
|
2437
2437
|
} : _super.prototype._next;
|
|
2438
|
-
_this._error = onError ? function(
|
|
2438
|
+
_this._error = onError ? function(err2) {
|
|
2439
2439
|
try {
|
|
2440
|
-
onError(
|
|
2441
|
-
} catch (
|
|
2442
|
-
destination2.error(
|
|
2440
|
+
onError(err2);
|
|
2441
|
+
} catch (err3) {
|
|
2442
|
+
destination2.error(err3);
|
|
2443
2443
|
} finally {
|
|
2444
2444
|
this.unsubscribe();
|
|
2445
2445
|
}
|
|
@@ -2447,8 +2447,8 @@ var OperatorSubscriber = (function(_super) {
|
|
|
2447
2447
|
_this._complete = onComplete ? function() {
|
|
2448
2448
|
try {
|
|
2449
2449
|
onComplete();
|
|
2450
|
-
} catch (
|
|
2451
|
-
destination2.error(
|
|
2450
|
+
} catch (err2) {
|
|
2451
|
+
destination2.error(err2);
|
|
2452
2452
|
} finally {
|
|
2453
2453
|
this.unsubscribe();
|
|
2454
2454
|
}
|
|
@@ -2524,16 +2524,16 @@ var Subject = (function(_super) {
|
|
|
2524
2524
|
}
|
|
2525
2525
|
});
|
|
2526
2526
|
};
|
|
2527
|
-
Subject2.prototype.error = function(
|
|
2527
|
+
Subject2.prototype.error = function(err2) {
|
|
2528
2528
|
var _this = this;
|
|
2529
2529
|
errorContext(function() {
|
|
2530
2530
|
_this._throwIfClosed();
|
|
2531
2531
|
if (!_this.isStopped) {
|
|
2532
2532
|
_this.hasError = _this.isStopped = true;
|
|
2533
|
-
_this.thrownError =
|
|
2533
|
+
_this.thrownError = err2;
|
|
2534
2534
|
var observers = _this.observers;
|
|
2535
2535
|
while (observers.length) {
|
|
2536
|
-
observers.shift().error(
|
|
2536
|
+
observers.shift().error(err2);
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
});
|
|
@@ -2615,9 +2615,9 @@ var AnonymousSubject = (function(_super) {
|
|
|
2615
2615
|
var _a, _b;
|
|
2616
2616
|
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value7);
|
|
2617
2617
|
};
|
|
2618
|
-
AnonymousSubject2.prototype.error = function(
|
|
2618
|
+
AnonymousSubject2.prototype.error = function(err2) {
|
|
2619
2619
|
var _a, _b;
|
|
2620
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a,
|
|
2620
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err2);
|
|
2621
2621
|
};
|
|
2622
2622
|
AnonymousSubject2.prototype.complete = function() {
|
|
2623
2623
|
var _a, _b;
|
|
@@ -2680,11 +2680,11 @@ function tap(observerOrNext, error4, complete2) {
|
|
|
2680
2680
|
isUnsub = false;
|
|
2681
2681
|
(_a2 = tapObserver.complete) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
|
|
2682
2682
|
subscriber3.complete();
|
|
2683
|
-
}, function(
|
|
2683
|
+
}, function(err2) {
|
|
2684
2684
|
var _a2;
|
|
2685
2685
|
isUnsub = false;
|
|
2686
|
-
(_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver,
|
|
2687
|
-
subscriber3.error(
|
|
2686
|
+
(_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, err2);
|
|
2687
|
+
subscriber3.error(err2);
|
|
2688
2688
|
}, function() {
|
|
2689
2689
|
var _a2, _b;
|
|
2690
2690
|
if (isUnsub) {
|
|
@@ -2731,6 +2731,499 @@ var HttpStatus = class {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
};
|
|
2733
2733
|
|
|
2734
|
+
// src/problems/index.ts
|
|
2735
|
+
function httpProblem(title10, response6) {
|
|
2736
|
+
return {
|
|
2737
|
+
type: "http",
|
|
2738
|
+
title: title10,
|
|
2739
|
+
status: response6.status,
|
|
2740
|
+
detail: `The server responded with ${response6.status} ${response6.statusText}`
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
function networkProblem(title10, cause) {
|
|
2744
|
+
return {
|
|
2745
|
+
type: "network",
|
|
2746
|
+
title: title10,
|
|
2747
|
+
detail: `The server could not be reached: ${cause.message}`
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
// ../node_modules/neverthrow/dist/index.es.js
|
|
2752
|
+
var defaultErrorConfig = {
|
|
2753
|
+
withStackTrace: false
|
|
2754
|
+
};
|
|
2755
|
+
var createNeverThrowError = (message4, result6, config2 = defaultErrorConfig) => {
|
|
2756
|
+
const data2 = result6.isOk() ? { type: "Ok", value: result6.value } : { type: "Err", value: result6.error };
|
|
2757
|
+
const maybeStack = config2.withStackTrace ? new Error().stack : void 0;
|
|
2758
|
+
return {
|
|
2759
|
+
data: data2,
|
|
2760
|
+
message: message4,
|
|
2761
|
+
stack: maybeStack
|
|
2762
|
+
};
|
|
2763
|
+
};
|
|
2764
|
+
function __awaiter(thisArg, _arguments, P, generator3) {
|
|
2765
|
+
function adopt(value7) {
|
|
2766
|
+
return value7 instanceof P ? value7 : new P(function(resolve) {
|
|
2767
|
+
resolve(value7);
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2771
|
+
function fulfilled(value7) {
|
|
2772
|
+
try {
|
|
2773
|
+
step4(generator3.next(value7));
|
|
2774
|
+
} catch (e) {
|
|
2775
|
+
reject(e);
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
function rejected(value7) {
|
|
2779
|
+
try {
|
|
2780
|
+
step4(generator3["throw"](value7));
|
|
2781
|
+
} catch (e) {
|
|
2782
|
+
reject(e);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
function step4(result6) {
|
|
2786
|
+
result6.done ? resolve(result6.value) : adopt(result6.value).then(fulfilled, rejected);
|
|
2787
|
+
}
|
|
2788
|
+
step4((generator3 = generator3.apply(thisArg, _arguments || [])).next());
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
function __values2(o) {
|
|
2792
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
2793
|
+
if (m) return m.call(o);
|
|
2794
|
+
if (o && typeof o.length === "number") return {
|
|
2795
|
+
next: function() {
|
|
2796
|
+
if (o && i >= o.length) o = void 0;
|
|
2797
|
+
return { value: o && o[i++], done: !o };
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2801
|
+
}
|
|
2802
|
+
function __await(v2) {
|
|
2803
|
+
return this instanceof __await ? (this.v = v2, this) : new __await(v2);
|
|
2804
|
+
}
|
|
2805
|
+
function __asyncGenerator(thisArg, _arguments, generator3) {
|
|
2806
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2807
|
+
var g = generator3.apply(thisArg, _arguments || []), i, q = [];
|
|
2808
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb2("next"), verb2("throw"), verb2("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
2809
|
+
return this;
|
|
2810
|
+
}, i;
|
|
2811
|
+
function awaitReturn(f) {
|
|
2812
|
+
return function(v2) {
|
|
2813
|
+
return Promise.resolve(v2).then(f, reject);
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
function verb2(n2, f) {
|
|
2817
|
+
if (g[n2]) {
|
|
2818
|
+
i[n2] = function(v2) {
|
|
2819
|
+
return new Promise(function(a, b) {
|
|
2820
|
+
q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
|
|
2821
|
+
});
|
|
2822
|
+
};
|
|
2823
|
+
if (f) i[n2] = f(i[n2]);
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
function resume(n2, v2) {
|
|
2827
|
+
try {
|
|
2828
|
+
step4(g[n2](v2));
|
|
2829
|
+
} catch (e) {
|
|
2830
|
+
settle(q[0][3], e);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
function step4(r) {
|
|
2834
|
+
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
2835
|
+
}
|
|
2836
|
+
function fulfill(value7) {
|
|
2837
|
+
resume("next", value7);
|
|
2838
|
+
}
|
|
2839
|
+
function reject(value7) {
|
|
2840
|
+
resume("throw", value7);
|
|
2841
|
+
}
|
|
2842
|
+
function settle(f, v2) {
|
|
2843
|
+
if (f(v2), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
function __asyncDelegator(o) {
|
|
2847
|
+
var i, p;
|
|
2848
|
+
return i = {}, verb2("next"), verb2("throw", function(e) {
|
|
2849
|
+
throw e;
|
|
2850
|
+
}), verb2("return"), i[Symbol.iterator] = function() {
|
|
2851
|
+
return this;
|
|
2852
|
+
}, i;
|
|
2853
|
+
function verb2(n2, f) {
|
|
2854
|
+
i[n2] = o[n2] ? function(v2) {
|
|
2855
|
+
return (p = !p) ? { value: __await(o[n2](v2)), done: false } : f ? f(v2) : v2;
|
|
2856
|
+
} : f;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
function __asyncValues(o) {
|
|
2860
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2861
|
+
var m = o[Symbol.asyncIterator], i;
|
|
2862
|
+
return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb2("next"), verb2("throw"), verb2("return"), i[Symbol.asyncIterator] = function() {
|
|
2863
|
+
return this;
|
|
2864
|
+
}, i);
|
|
2865
|
+
function verb2(n2) {
|
|
2866
|
+
i[n2] = o[n2] && function(v2) {
|
|
2867
|
+
return new Promise(function(resolve, reject) {
|
|
2868
|
+
v2 = o[n2](v2), settle(resolve, reject, v2.done, v2.value);
|
|
2869
|
+
});
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
function settle(resolve, reject, d, v2) {
|
|
2873
|
+
Promise.resolve(v2).then(function(v3) {
|
|
2874
|
+
resolve({ value: v3, done: d });
|
|
2875
|
+
}, reject);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
var ResultAsync = class _ResultAsync {
|
|
2879
|
+
constructor(res) {
|
|
2880
|
+
this._promise = res;
|
|
2881
|
+
}
|
|
2882
|
+
static fromSafePromise(promise) {
|
|
2883
|
+
const newPromise = promise.then((value7) => new Ok(value7));
|
|
2884
|
+
return new _ResultAsync(newPromise);
|
|
2885
|
+
}
|
|
2886
|
+
static fromPromise(promise, errorFn) {
|
|
2887
|
+
const newPromise = promise.then((value7) => new Ok(value7)).catch((e) => new Err(errorFn(e)));
|
|
2888
|
+
return new _ResultAsync(newPromise);
|
|
2889
|
+
}
|
|
2890
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2891
|
+
static fromThrowable(fn2, errorFn) {
|
|
2892
|
+
return (...args) => {
|
|
2893
|
+
return new _ResultAsync((() => __awaiter(this, void 0, void 0, function* () {
|
|
2894
|
+
try {
|
|
2895
|
+
return new Ok(yield fn2(...args));
|
|
2896
|
+
} catch (error4) {
|
|
2897
|
+
return new Err(errorFn ? errorFn(error4) : error4);
|
|
2898
|
+
}
|
|
2899
|
+
}))());
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
static combine(asyncResultList) {
|
|
2903
|
+
return combineResultAsyncList(asyncResultList);
|
|
2904
|
+
}
|
|
2905
|
+
static combineWithAllErrors(asyncResultList) {
|
|
2906
|
+
return combineResultAsyncListWithAllErrors(asyncResultList);
|
|
2907
|
+
}
|
|
2908
|
+
map(f) {
|
|
2909
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2910
|
+
if (res.isErr()) {
|
|
2911
|
+
return new Err(res.error);
|
|
2912
|
+
}
|
|
2913
|
+
return new Ok(yield f(res.value));
|
|
2914
|
+
})));
|
|
2915
|
+
}
|
|
2916
|
+
andThrough(f) {
|
|
2917
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2918
|
+
if (res.isErr()) {
|
|
2919
|
+
return new Err(res.error);
|
|
2920
|
+
}
|
|
2921
|
+
const newRes = yield f(res.value);
|
|
2922
|
+
if (newRes.isErr()) {
|
|
2923
|
+
return new Err(newRes.error);
|
|
2924
|
+
}
|
|
2925
|
+
return new Ok(res.value);
|
|
2926
|
+
})));
|
|
2927
|
+
}
|
|
2928
|
+
andTee(f) {
|
|
2929
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2930
|
+
if (res.isErr()) {
|
|
2931
|
+
return new Err(res.error);
|
|
2932
|
+
}
|
|
2933
|
+
try {
|
|
2934
|
+
yield f(res.value);
|
|
2935
|
+
} catch (e) {
|
|
2936
|
+
}
|
|
2937
|
+
return new Ok(res.value);
|
|
2938
|
+
})));
|
|
2939
|
+
}
|
|
2940
|
+
orTee(f) {
|
|
2941
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2942
|
+
if (res.isOk()) {
|
|
2943
|
+
return new Ok(res.value);
|
|
2944
|
+
}
|
|
2945
|
+
try {
|
|
2946
|
+
yield f(res.error);
|
|
2947
|
+
} catch (e) {
|
|
2948
|
+
}
|
|
2949
|
+
return new Err(res.error);
|
|
2950
|
+
})));
|
|
2951
|
+
}
|
|
2952
|
+
mapErr(f) {
|
|
2953
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2954
|
+
if (res.isOk()) {
|
|
2955
|
+
return new Ok(res.value);
|
|
2956
|
+
}
|
|
2957
|
+
return new Err(yield f(res.error));
|
|
2958
|
+
})));
|
|
2959
|
+
}
|
|
2960
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
2961
|
+
andThen(f) {
|
|
2962
|
+
return new _ResultAsync(this._promise.then((res) => {
|
|
2963
|
+
if (res.isErr()) {
|
|
2964
|
+
return new Err(res.error);
|
|
2965
|
+
}
|
|
2966
|
+
const newValue = f(res.value);
|
|
2967
|
+
return newValue instanceof _ResultAsync ? newValue._promise : newValue;
|
|
2968
|
+
}));
|
|
2969
|
+
}
|
|
2970
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
2971
|
+
orElse(f) {
|
|
2972
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2973
|
+
if (res.isErr()) {
|
|
2974
|
+
return f(res.error);
|
|
2975
|
+
}
|
|
2976
|
+
return new Ok(res.value);
|
|
2977
|
+
})));
|
|
2978
|
+
}
|
|
2979
|
+
match(ok2, _err) {
|
|
2980
|
+
return this._promise.then((res) => res.match(ok2, _err));
|
|
2981
|
+
}
|
|
2982
|
+
unwrapOr(t) {
|
|
2983
|
+
return this._promise.then((res) => res.unwrapOr(t));
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
* @deprecated will be removed in 9.0.0.
|
|
2987
|
+
*
|
|
2988
|
+
* You can use `safeTry` without this method.
|
|
2989
|
+
* @example
|
|
2990
|
+
* ```typescript
|
|
2991
|
+
* safeTry(async function* () {
|
|
2992
|
+
* const okValue = yield* yourResult
|
|
2993
|
+
* })
|
|
2994
|
+
* ```
|
|
2995
|
+
* Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
|
|
2996
|
+
*/
|
|
2997
|
+
safeUnwrap() {
|
|
2998
|
+
return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
|
|
2999
|
+
return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
// Makes ResultAsync implement PromiseLike<Result>
|
|
3003
|
+
then(successCallback, failureCallback) {
|
|
3004
|
+
return this._promise.then(successCallback, failureCallback);
|
|
3005
|
+
}
|
|
3006
|
+
[Symbol.asyncIterator]() {
|
|
3007
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
3008
|
+
const result6 = yield __await(this._promise);
|
|
3009
|
+
if (result6.isErr()) {
|
|
3010
|
+
yield yield __await(errAsync(result6.error));
|
|
3011
|
+
}
|
|
3012
|
+
return yield __await(result6.value);
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
};
|
|
3016
|
+
function errAsync(err2) {
|
|
3017
|
+
return new ResultAsync(Promise.resolve(new Err(err2)));
|
|
3018
|
+
}
|
|
3019
|
+
var fromPromise = ResultAsync.fromPromise;
|
|
3020
|
+
var fromSafePromise = ResultAsync.fromSafePromise;
|
|
3021
|
+
var fromAsyncThrowable = ResultAsync.fromThrowable;
|
|
3022
|
+
var combineResultList = (resultList) => {
|
|
3023
|
+
let acc = ok([]);
|
|
3024
|
+
for (const result6 of resultList) {
|
|
3025
|
+
if (result6.isErr()) {
|
|
3026
|
+
acc = err(result6.error);
|
|
3027
|
+
break;
|
|
3028
|
+
} else {
|
|
3029
|
+
acc.map((list) => list.push(result6.value));
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
return acc;
|
|
3033
|
+
};
|
|
3034
|
+
var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
|
|
3035
|
+
var combineResultListWithAllErrors = (resultList) => {
|
|
3036
|
+
let acc = ok([]);
|
|
3037
|
+
for (const result6 of resultList) {
|
|
3038
|
+
if (result6.isErr() && acc.isErr()) {
|
|
3039
|
+
acc.error.push(result6.error);
|
|
3040
|
+
} else if (result6.isErr() && acc.isOk()) {
|
|
3041
|
+
acc = err([result6.error]);
|
|
3042
|
+
} else if (result6.isOk() && acc.isOk()) {
|
|
3043
|
+
acc.value.push(result6.value);
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
return acc;
|
|
3047
|
+
};
|
|
3048
|
+
var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
|
|
3049
|
+
var Result;
|
|
3050
|
+
(function(Result2) {
|
|
3051
|
+
function fromThrowable2(fn2, errorFn) {
|
|
3052
|
+
return (...args) => {
|
|
3053
|
+
try {
|
|
3054
|
+
const result6 = fn2(...args);
|
|
3055
|
+
return ok(result6);
|
|
3056
|
+
} catch (e) {
|
|
3057
|
+
return err(errorFn ? errorFn(e) : e);
|
|
3058
|
+
}
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
Result2.fromThrowable = fromThrowable2;
|
|
3062
|
+
function combine(resultList) {
|
|
3063
|
+
return combineResultList(resultList);
|
|
3064
|
+
}
|
|
3065
|
+
Result2.combine = combine;
|
|
3066
|
+
function combineWithAllErrors(resultList) {
|
|
3067
|
+
return combineResultListWithAllErrors(resultList);
|
|
3068
|
+
}
|
|
3069
|
+
Result2.combineWithAllErrors = combineWithAllErrors;
|
|
3070
|
+
})(Result || (Result = {}));
|
|
3071
|
+
function ok(value7) {
|
|
3072
|
+
return new Ok(value7);
|
|
3073
|
+
}
|
|
3074
|
+
function err(err2) {
|
|
3075
|
+
return new Err(err2);
|
|
3076
|
+
}
|
|
3077
|
+
var Ok = class {
|
|
3078
|
+
constructor(value7) {
|
|
3079
|
+
this.value = value7;
|
|
3080
|
+
}
|
|
3081
|
+
isOk() {
|
|
3082
|
+
return true;
|
|
3083
|
+
}
|
|
3084
|
+
isErr() {
|
|
3085
|
+
return !this.isOk();
|
|
3086
|
+
}
|
|
3087
|
+
map(f) {
|
|
3088
|
+
return ok(f(this.value));
|
|
3089
|
+
}
|
|
3090
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3091
|
+
mapErr(_f) {
|
|
3092
|
+
return ok(this.value);
|
|
3093
|
+
}
|
|
3094
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3095
|
+
andThen(f) {
|
|
3096
|
+
return f(this.value);
|
|
3097
|
+
}
|
|
3098
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3099
|
+
andThrough(f) {
|
|
3100
|
+
return f(this.value).map((_value2) => this.value);
|
|
3101
|
+
}
|
|
3102
|
+
andTee(f) {
|
|
3103
|
+
try {
|
|
3104
|
+
f(this.value);
|
|
3105
|
+
} catch (e) {
|
|
3106
|
+
}
|
|
3107
|
+
return ok(this.value);
|
|
3108
|
+
}
|
|
3109
|
+
orTee(_f) {
|
|
3110
|
+
return ok(this.value);
|
|
3111
|
+
}
|
|
3112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3113
|
+
orElse(_f) {
|
|
3114
|
+
return ok(this.value);
|
|
3115
|
+
}
|
|
3116
|
+
asyncAndThen(f) {
|
|
3117
|
+
return f(this.value);
|
|
3118
|
+
}
|
|
3119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3120
|
+
asyncAndThrough(f) {
|
|
3121
|
+
return f(this.value).map(() => this.value);
|
|
3122
|
+
}
|
|
3123
|
+
asyncMap(f) {
|
|
3124
|
+
return ResultAsync.fromSafePromise(f(this.value));
|
|
3125
|
+
}
|
|
3126
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3127
|
+
unwrapOr(_v) {
|
|
3128
|
+
return this.value;
|
|
3129
|
+
}
|
|
3130
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3131
|
+
match(ok2, _err) {
|
|
3132
|
+
return ok2(this.value);
|
|
3133
|
+
}
|
|
3134
|
+
safeUnwrap() {
|
|
3135
|
+
const value7 = this.value;
|
|
3136
|
+
return (function* () {
|
|
3137
|
+
return value7;
|
|
3138
|
+
})();
|
|
3139
|
+
}
|
|
3140
|
+
_unsafeUnwrap(_) {
|
|
3141
|
+
return this.value;
|
|
3142
|
+
}
|
|
3143
|
+
_unsafeUnwrapErr(config2) {
|
|
3144
|
+
throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config2);
|
|
3145
|
+
}
|
|
3146
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias, require-yield
|
|
3147
|
+
*[Symbol.iterator]() {
|
|
3148
|
+
return this.value;
|
|
3149
|
+
}
|
|
3150
|
+
};
|
|
3151
|
+
var Err = class {
|
|
3152
|
+
constructor(error4) {
|
|
3153
|
+
this.error = error4;
|
|
3154
|
+
}
|
|
3155
|
+
isOk() {
|
|
3156
|
+
return false;
|
|
3157
|
+
}
|
|
3158
|
+
isErr() {
|
|
3159
|
+
return !this.isOk();
|
|
3160
|
+
}
|
|
3161
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3162
|
+
map(_f) {
|
|
3163
|
+
return err(this.error);
|
|
3164
|
+
}
|
|
3165
|
+
mapErr(f) {
|
|
3166
|
+
return err(f(this.error));
|
|
3167
|
+
}
|
|
3168
|
+
andThrough(_f) {
|
|
3169
|
+
return err(this.error);
|
|
3170
|
+
}
|
|
3171
|
+
andTee(_f) {
|
|
3172
|
+
return err(this.error);
|
|
3173
|
+
}
|
|
3174
|
+
orTee(f) {
|
|
3175
|
+
try {
|
|
3176
|
+
f(this.error);
|
|
3177
|
+
} catch (e) {
|
|
3178
|
+
}
|
|
3179
|
+
return err(this.error);
|
|
3180
|
+
}
|
|
3181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3182
|
+
andThen(_f) {
|
|
3183
|
+
return err(this.error);
|
|
3184
|
+
}
|
|
3185
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3186
|
+
orElse(f) {
|
|
3187
|
+
return f(this.error);
|
|
3188
|
+
}
|
|
3189
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3190
|
+
asyncAndThen(_f) {
|
|
3191
|
+
return errAsync(this.error);
|
|
3192
|
+
}
|
|
3193
|
+
asyncAndThrough(_f) {
|
|
3194
|
+
return errAsync(this.error);
|
|
3195
|
+
}
|
|
3196
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3197
|
+
asyncMap(_f) {
|
|
3198
|
+
return errAsync(this.error);
|
|
3199
|
+
}
|
|
3200
|
+
unwrapOr(v2) {
|
|
3201
|
+
return v2;
|
|
3202
|
+
}
|
|
3203
|
+
match(_ok, err2) {
|
|
3204
|
+
return err2(this.error);
|
|
3205
|
+
}
|
|
3206
|
+
safeUnwrap() {
|
|
3207
|
+
const error4 = this.error;
|
|
3208
|
+
return (function* () {
|
|
3209
|
+
yield err(error4);
|
|
3210
|
+
throw new Error("Do not use this generator out of `safeTry`");
|
|
3211
|
+
})();
|
|
3212
|
+
}
|
|
3213
|
+
_unsafeUnwrap(config2) {
|
|
3214
|
+
throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config2);
|
|
3215
|
+
}
|
|
3216
|
+
_unsafeUnwrapErr(_) {
|
|
3217
|
+
return this.error;
|
|
3218
|
+
}
|
|
3219
|
+
*[Symbol.iterator]() {
|
|
3220
|
+
const self = this;
|
|
3221
|
+
yield self;
|
|
3222
|
+
return self;
|
|
3223
|
+
}
|
|
3224
|
+
};
|
|
3225
|
+
var fromThrowable = Result.fromThrowable;
|
|
3226
|
+
|
|
2734
3227
|
// src/files/FileFetcher.ts
|
|
2735
3228
|
var FileFetcher = class {
|
|
2736
3229
|
constructor(session4) {
|
|
@@ -2768,6 +3261,42 @@ var FileFetcher = class {
|
|
|
2768
3261
|
body: newContent
|
|
2769
3262
|
});
|
|
2770
3263
|
}
|
|
3264
|
+
createNewFile(container2, name9) {
|
|
3265
|
+
const encodedName = encodeURIComponent(name9);
|
|
3266
|
+
const url7 = container2.uri + encodedName;
|
|
3267
|
+
const contentType4 = "text/turtle";
|
|
3268
|
+
return ResultAsync.fromPromise(
|
|
3269
|
+
this.session.authenticatedFetch(url7, {
|
|
3270
|
+
method: "PUT",
|
|
3271
|
+
headers: {
|
|
3272
|
+
"Content-Type": contentType4,
|
|
3273
|
+
"If-None-Match": "*"
|
|
3274
|
+
}
|
|
3275
|
+
}),
|
|
3276
|
+
(e) => networkProblem("The file could not be created", e)
|
|
3277
|
+
).andThen(
|
|
3278
|
+
(response6) => response6.ok ? ok({
|
|
3279
|
+
url: url7,
|
|
3280
|
+
name: name9,
|
|
3281
|
+
contentType: contentType4
|
|
3282
|
+
}) : err(httpProblem("The file could not be created", response6))
|
|
3283
|
+
);
|
|
3284
|
+
}
|
|
3285
|
+
createNewFolder(container2, name9) {
|
|
3286
|
+
const encodedName = encodeURIComponent(name9);
|
|
3287
|
+
const url7 = container2.uri + encodedName + "/";
|
|
3288
|
+
return ResultAsync.fromPromise(
|
|
3289
|
+
this.session.authenticatedFetch(url7, {
|
|
3290
|
+
method: "PUT"
|
|
3291
|
+
}),
|
|
3292
|
+
(e) => networkProblem("The folder could not be created", e)
|
|
3293
|
+
).andThen(
|
|
3294
|
+
(response6) => response6.ok ? ok({
|
|
3295
|
+
url: url7,
|
|
3296
|
+
name: name9
|
|
3297
|
+
}) : err(httpProblem("The folder could not be created", response6))
|
|
3298
|
+
);
|
|
3299
|
+
}
|
|
2771
3300
|
};
|
|
2772
3301
|
|
|
2773
3302
|
// src/modules/contacts.ts
|
|
@@ -2816,7 +3345,8 @@ function labelFromUri(uri6) {
|
|
|
2816
3345
|
if (isTooGeneric(url7.hash)) {
|
|
2817
3346
|
return (getFilename(url7) || url7.host + url7.pathname) + url7.hash;
|
|
2818
3347
|
}
|
|
2819
|
-
|
|
3348
|
+
const name9 = labelFromFragment(url7.hash) || getFilename(url7) || url7.host;
|
|
3349
|
+
return name9.endsWith("/") ? name9.slice(0, -1) : name9;
|
|
2820
3350
|
}
|
|
2821
3351
|
function labelFromFragment(fragment) {
|
|
2822
3352
|
return fragment ? fragment.split("#")[1] : null;
|
|
@@ -2828,9 +3358,10 @@ function isTooGeneric(fragment) {
|
|
|
2828
3358
|
function getFilename(url7) {
|
|
2829
3359
|
if (url7.pathname.endsWith("/")) {
|
|
2830
3360
|
const containerName = url7.pathname.split("/").at(-2);
|
|
2831
|
-
return containerName ? containerName + "/" : null;
|
|
3361
|
+
return containerName ? decodeURIComponent(containerName) + "/" : null;
|
|
2832
3362
|
} else {
|
|
2833
|
-
|
|
3363
|
+
const name9 = url7.pathname.split("/").pop();
|
|
3364
|
+
return name9 ? decodeURIComponent(name9) : null;
|
|
2834
3365
|
}
|
|
2835
3366
|
}
|
|
2836
3367
|
|
|
@@ -24809,10 +25340,7 @@ var LdpContainer = class extends Thing {
|
|
|
24809
25340
|
);
|
|
24810
25341
|
return contains3.map((content5) => ({
|
|
24811
25342
|
uri: content5.object.value,
|
|
24812
|
-
name: content5.object.value
|
|
24813
|
-
new RegExp(`${this.uri}([^/]*)/?`),
|
|
24814
|
-
"$1"
|
|
24815
|
-
)
|
|
25343
|
+
name: labelFromUri(content5.object.value)
|
|
24816
25344
|
}));
|
|
24817
25345
|
}
|
|
24818
25346
|
};
|
|
@@ -24958,8 +25486,10 @@ export {
|
|
|
24958
25486
|
Thing,
|
|
24959
25487
|
UriService,
|
|
24960
25488
|
WebIdProfile,
|
|
25489
|
+
httpProblem,
|
|
24961
25490
|
labelFromUri,
|
|
24962
|
-
listKnownTerms
|
|
25491
|
+
listKnownTerms,
|
|
25492
|
+
networkProblem
|
|
24963
25493
|
};
|
|
24964
25494
|
/*! Bundled license information:
|
|
24965
25495
|
|