@noeldemartin/solid-utils 0.2.0-next.ebb53edb2f1f27bc44c4c5ebd38761a0b30d3408 → 0.3.0-next.5176c3d9efdc3cf9d06772d0c55c24b2eb49893a
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/CHANGELOG.md +35 -0
- package/dist/noeldemartin-solid-utils.cjs.js +1 -1
- package/dist/noeldemartin-solid-utils.cjs.js.map +1 -1
- package/dist/noeldemartin-solid-utils.d.ts +2 -8
- package/dist/noeldemartin-solid-utils.esm.js +1 -1
- package/dist/noeldemartin-solid-utils.esm.js.map +1 -1
- package/dist/noeldemartin-solid-utils.umd.js +1 -1
- package/dist/noeldemartin-solid-utils.umd.js.map +1 -1
- package/package.json +5 -6
- package/src/helpers/auth.ts +6 -2
- package/src/testing/faking.ts +1 -1
- package/src/testing/mocking.ts +4 -5
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noeldemartin/solid-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.5176c3d9efdc3cf9d06772d0c55c24b2eb49893a",
|
|
4
4
|
"description": "My JavaScript utilities for Solid",
|
|
5
5
|
"main": "dist/noeldemartin-solid-utils.cjs.js",
|
|
6
6
|
"module": "dist/noeldemartin-solid-utils.esm.js",
|
|
7
7
|
"browser": "dist/noeldemartin-solid-utils.umd.js",
|
|
8
8
|
"types": "dist/noeldemartin-solid-utils.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "rm dist -rf && npm run build:js && npm run build:types",
|
|
11
12
|
"build:js": "noeldemartin-build-javascript",
|
|
@@ -30,12 +31,11 @@
|
|
|
30
31
|
"homepage": "https://github.com/noeldemartin/solid-utils",
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@babel/runtime": "^7.14.0",
|
|
33
|
-
"@
|
|
34
|
-
"@noeldemartin/solid-utils-external": "^0.1.
|
|
35
|
-
"@noeldemartin/utils": "^0.
|
|
34
|
+
"@noeldemartin/faker": "^7.6.0",
|
|
35
|
+
"@noeldemartin/solid-utils-external": "^0.1.1",
|
|
36
|
+
"@noeldemartin/utils": "^0.4.0",
|
|
36
37
|
"@types/rdf-js": "^4.0.1",
|
|
37
38
|
"core-js": "^3.12.1",
|
|
38
|
-
"jest-diff": "^26.6.2",
|
|
39
39
|
"md5": "^2.3.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@rollup/plugin-typescript": "^8.2.1",
|
|
55
55
|
"@types/chai": "^4.2.18",
|
|
56
56
|
"@types/jest": "^26.0.23",
|
|
57
|
-
"@types/jest-diff": "^24.3.0",
|
|
58
57
|
"@types/md5": "^2.3.0",
|
|
59
58
|
"babel-plugin-transform-remove-imports": "^1.5.4",
|
|
60
59
|
"eslint": "^7.26.0",
|
package/src/helpers/auth.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { Fetch } from './io';
|
|
|
9
9
|
|
|
10
10
|
export interface SolidUserProfile {
|
|
11
11
|
webId: string;
|
|
12
|
-
storageUrls: string[];
|
|
12
|
+
storageUrls: [string, ...string[]];
|
|
13
13
|
cloaked: boolean;
|
|
14
14
|
writableProfileUrl: string | null;
|
|
15
15
|
name?: string;
|
|
@@ -106,11 +106,15 @@ async function fetchUserProfile(webId: string, fetch?: Fetch): Promise<SolidUser
|
|
|
106
106
|
parentUrl = urlParentDirectory(parentUrl);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
if (storageUrls.length === 0) {
|
|
110
|
+
throw new Error(`Could not find any storage for ${webId}.`);
|
|
111
|
+
}
|
|
112
|
+
|
|
109
113
|
return {
|
|
110
114
|
webId,
|
|
111
115
|
cloaked,
|
|
112
116
|
writableProfileUrl,
|
|
113
|
-
storageUrls: arrayUnique(storageUrls),
|
|
117
|
+
storageUrls: arrayUnique(storageUrls) as [string, ...string[]],
|
|
114
118
|
...objectWithoutEmpty({
|
|
115
119
|
name:
|
|
116
120
|
store.statement(webId, 'vcard:fn')?.object.value ??
|
package/src/testing/faking.ts
CHANGED
package/src/testing/mocking.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fail } from '@noeldemartin/utils';
|
|
2
|
-
import type { GetClosureArgs
|
|
2
|
+
import type { GetClosureArgs } from '@noeldemartin/utils';
|
|
3
3
|
|
|
4
4
|
import type { Fetch } from '@/helpers/io';
|
|
5
5
|
|
|
@@ -10,9 +10,8 @@ export interface FetchMockMethods {
|
|
|
10
10
|
mockNotFoundResponse(): void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export function mockFetch(): FetchMock {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
export function mockFetch<T = any>(): T {
|
|
16
15
|
const responses: ResponseStub[] = [];
|
|
17
16
|
const methods: FetchMockMethods = {
|
|
18
17
|
mockResponse(body, headers, status) {
|
|
@@ -30,5 +29,5 @@ export function mockFetch(): FetchMock {
|
|
|
30
29
|
|
|
31
30
|
Object.assign(fetchMock, methods);
|
|
32
31
|
|
|
33
|
-
return fetchMock as
|
|
32
|
+
return fetchMock as unknown as T;
|
|
34
33
|
}
|