@noeldemartin/solid-utils 0.5.0 → 0.6.0-next.8a6a0b585adc7a1c329fb0fed5c420bb72cdccda
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/noeldemartin-solid-utils.d.ts +13 -65
- package/dist/noeldemartin-solid-utils.js +590 -0
- package/dist/noeldemartin-solid-utils.js.map +1 -0
- package/package.json +55 -63
- package/src/helpers/auth.test.ts +221 -0
- package/src/helpers/auth.ts +28 -27
- package/src/helpers/identifiers.test.ts +76 -0
- package/src/helpers/identifiers.ts +1 -1
- package/src/helpers/index.ts +0 -1
- package/src/helpers/interop.ts +23 -16
- package/src/helpers/io.test.ts +228 -0
- package/src/helpers/io.ts +57 -77
- package/src/helpers/jsonld.ts +6 -6
- package/src/helpers/wac.test.ts +64 -0
- package/src/helpers/wac.ts +10 -6
- package/src/index.ts +3 -0
- package/src/models/SolidDocument.test.ts +77 -0
- package/src/models/SolidDocument.ts +14 -18
- package/src/models/SolidStore.ts +22 -12
- package/src/models/SolidThing.ts +5 -7
- package/src/models/index.ts +2 -0
- package/.github/workflows/ci.yml +0 -16
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -70
- package/dist/noeldemartin-solid-utils.cjs.js +0 -2
- package/dist/noeldemartin-solid-utils.cjs.js.map +0 -1
- package/dist/noeldemartin-solid-utils.esm.js +0 -2
- package/dist/noeldemartin-solid-utils.esm.js.map +0 -1
- package/dist/noeldemartin-solid-utils.umd.js +0 -90
- package/dist/noeldemartin-solid-utils.umd.js.map +0 -1
- package/noeldemartin.config.js +0 -9
- package/src/helpers/testing.ts +0 -190
- package/src/main.ts +0 -5
- package/src/plugins/chai/assertions.ts +0 -40
- package/src/plugins/chai/index.ts +0 -5
- package/src/plugins/cypress/types.d.ts +0 -15
- package/src/plugins/index.ts +0 -2
- package/src/plugins/jest/index.ts +0 -5
- package/src/plugins/jest/matchers.ts +0 -65
- package/src/plugins/jest/types.d.ts +0 -14
- package/src/testing/ResponseStub.ts +0 -46
- package/src/testing/index.ts +0 -2
- package/src/testing/mocking.ts +0 -33
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
namespace jest {
|
|
4
|
-
|
|
5
|
-
// TODO generate automatically
|
|
6
|
-
interface Matchers<R> {
|
|
7
|
-
toEqualSparql(sparql: string): R;
|
|
8
|
-
toEqualTurtle(turtle: string): R;
|
|
9
|
-
toEqualJsonLD(jsonld: JsonLD): Promise<R>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { BlankNode } from '@rdfjs/types';
|
|
15
2
|
import { JSError } from '@noeldemartin/utils';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
3
|
+
import { JSErrorOptions } from '@noeldemartin/utils';
|
|
4
|
+
import { Literal } from '@rdfjs/types';
|
|
5
|
+
import { NamedNode } from '@rdfjs/types';
|
|
6
|
+
import { Quad } from '@rdfjs/types';
|
|
7
|
+
import { Variable } from '@rdfjs/types';
|
|
18
8
|
|
|
19
9
|
export declare type AnyFetch = (input: any, options?: any) => Promise<Response>;
|
|
20
10
|
|
|
21
|
-
export declare function compactJsonLDGraph(
|
|
11
|
+
export declare function compactJsonLDGraph(json: JsonLDGraph): Promise<JsonLDGraph>;
|
|
22
12
|
|
|
23
13
|
/**
|
|
24
14
|
* @deprecated Use soukai-solid instead
|
|
@@ -34,13 +24,6 @@ export declare function createSolidDocument(url: string, body: string, fetch?: F
|
|
|
34
24
|
|
|
35
25
|
export declare function defineIRIPrefix(name: string, value: string): void;
|
|
36
26
|
|
|
37
|
-
export declare interface EqualityResult {
|
|
38
|
-
success: boolean;
|
|
39
|
-
message: string;
|
|
40
|
-
expected: string;
|
|
41
|
-
actual: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
27
|
export declare function expandIRI(iri: string, options?: Partial<ExpandIRIOptions>): string;
|
|
45
28
|
|
|
46
29
|
export declare interface ExpandIRIOptions {
|
|
@@ -56,11 +39,6 @@ export declare interface FetchLoginUserProfileOptions extends FetchUserProfileOp
|
|
|
56
39
|
required?: boolean;
|
|
57
40
|
}
|
|
58
41
|
|
|
59
|
-
export declare interface FetchMockMethods {
|
|
60
|
-
mockResponse(body?: string, headers?: Record<string, string>, status?: number): void;
|
|
61
|
-
mockNotFoundResponse(): void;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
42
|
export declare function fetchSolidDocument(url: string, options?: FetchSolidDocumentOptions): Promise<SolidDocument>;
|
|
65
43
|
|
|
66
44
|
export declare function fetchSolidDocumentACL(documentUrl: string, fetch: Fetch): Promise<{
|
|
@@ -91,11 +69,7 @@ export declare function findContainerRegistrations(typeIndexUrl: string, type: s
|
|
|
91
69
|
*/
|
|
92
70
|
export declare function findInstanceRegistrations(typeIndexUrl: string, type: string | string[], fetch?: Fetch): Promise<string[]>;
|
|
93
71
|
|
|
94
|
-
export declare function
|
|
95
|
-
|
|
96
|
-
export declare function installJestPlugin(): void;
|
|
97
|
-
|
|
98
|
-
export declare function isJsonLDGraph(jsonld: JsonLD): jsonld is JsonLDGraph;
|
|
72
|
+
export declare function isJsonLDGraph(json: JsonLD): json is JsonLDGraph;
|
|
99
73
|
|
|
100
74
|
export declare type JsonLD = Partial<{
|
|
101
75
|
'@context': Record<string, unknown>;
|
|
@@ -105,8 +79,6 @@ export declare type JsonLD = Partial<{
|
|
|
105
79
|
[k: string]: unknown;
|
|
106
80
|
};
|
|
107
81
|
|
|
108
|
-
export declare function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult>;
|
|
109
|
-
|
|
110
82
|
export declare type JsonLDGraph = {
|
|
111
83
|
'@context'?: Record<string, unknown>;
|
|
112
84
|
'@graph': JsonLDResource[];
|
|
@@ -116,7 +88,7 @@ export declare type JsonLDResource = Omit<JsonLD, '@id'> & {
|
|
|
116
88
|
'@id': string;
|
|
117
89
|
};
|
|
118
90
|
|
|
119
|
-
export declare function jsonldToQuads(
|
|
91
|
+
export declare function jsonldToQuads(json: JsonLD, baseIRI?: string): Promise<Quad[]>;
|
|
120
92
|
|
|
121
93
|
export declare class MalformedSolidDocumentError extends JSError {
|
|
122
94
|
readonly documentUrl: string | null;
|
|
@@ -127,8 +99,6 @@ export declare class MalformedSolidDocumentError extends JSError {
|
|
|
127
99
|
|
|
128
100
|
export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
|
|
129
101
|
|
|
130
|
-
export declare function mockFetch<T = any>(): T;
|
|
131
|
-
|
|
132
102
|
export declare class NetworkRequestError extends JSError {
|
|
133
103
|
readonly url: string;
|
|
134
104
|
constructor(url: string, options?: JSErrorOptions);
|
|
@@ -165,27 +135,6 @@ export declare interface RDFGraphData {
|
|
|
165
135
|
containsRelativeIRIs: boolean;
|
|
166
136
|
}
|
|
167
137
|
|
|
168
|
-
export declare class ResponseStub implements Response {
|
|
169
|
-
private rawBody;
|
|
170
|
-
readonly body: ReadableStream<Uint8Array> | null;
|
|
171
|
-
readonly bodyUsed: boolean;
|
|
172
|
-
readonly headers: Headers;
|
|
173
|
-
readonly ok: boolean;
|
|
174
|
-
readonly redirected: boolean;
|
|
175
|
-
readonly status: number;
|
|
176
|
-
readonly statusText: string;
|
|
177
|
-
readonly trailer: Promise<Headers>;
|
|
178
|
-
readonly type: ResponseType;
|
|
179
|
-
readonly url: string;
|
|
180
|
-
constructor(rawBody?: string, headers?: Record<string, string>, status?: number);
|
|
181
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
182
|
-
blob(): Promise<Blob>;
|
|
183
|
-
formData(): Promise<FormData>;
|
|
184
|
-
json(): Promise<unknown>;
|
|
185
|
-
text(): Promise<string>;
|
|
186
|
-
clone(): Response;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
138
|
export declare class SolidDocument extends SolidStore {
|
|
190
139
|
readonly url: string;
|
|
191
140
|
readonly headers: Headers;
|
|
@@ -221,11 +170,12 @@ export declare class SolidStore {
|
|
|
221
170
|
isEmpty(): boolean;
|
|
222
171
|
getQuads(): Quad[];
|
|
223
172
|
addQuads(quads: Quad[]): void;
|
|
224
|
-
statements(subject?: string, predicate?: string, object?: string): Quad[];
|
|
225
|
-
statement(subject?: string, predicate?: string, object?: string): Quad | null;
|
|
173
|
+
statements(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad[];
|
|
174
|
+
statement(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad | null;
|
|
226
175
|
contains(subject: string, predicate?: string, object?: string): boolean;
|
|
227
176
|
getThing(subject: string): SolidThing;
|
|
228
177
|
protected expandIRI(iri: string): string;
|
|
178
|
+
protected termMatches(term: Term, value: Term | string): boolean;
|
|
229
179
|
}
|
|
230
180
|
|
|
231
181
|
export declare class SolidThing {
|
|
@@ -248,8 +198,6 @@ export declare interface SolidUserProfile {
|
|
|
248
198
|
privateTypeIndexUrl?: string;
|
|
249
199
|
}
|
|
250
200
|
|
|
251
|
-
export declare function sparqlEquals(expected: string, actual: string): EqualityResult;
|
|
252
|
-
|
|
253
201
|
export declare function sparqlToQuads(sparql: string, options?: Partial<ParsingOptions>): Promise<Record<string, Quad[]>>;
|
|
254
202
|
|
|
255
203
|
export declare function sparqlToQuadsSync(sparql: string, options?: Partial<ParsingOptions>): Record<string, Quad[]>;
|
|
@@ -260,7 +208,7 @@ export declare interface SubjectParts {
|
|
|
260
208
|
resourceHash?: string;
|
|
261
209
|
}
|
|
262
210
|
|
|
263
|
-
export declare
|
|
211
|
+
export declare type Term = NamedNode | Literal | BlankNode | Quad | Variable;
|
|
264
212
|
|
|
265
213
|
export declare function turtleToQuads(turtle: string, options?: Partial<ParsingOptions>): Promise<Quad[]>;
|
|
266
214
|
|