@noeldemartin/solid-utils 0.5.0-next.612e9e93903ec33bbcba7105ed2a8580ed2d754c → 0.6.0-next.cccdc9c7e033588e2df9d1887ceae49788344d84

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 (42) hide show
  1. package/dist/noeldemartin-solid-utils.d.ts +6 -65
  2. package/dist/noeldemartin-solid-utils.js +590 -0
  3. package/dist/noeldemartin-solid-utils.js.map +1 -0
  4. package/package.json +54 -63
  5. package/src/helpers/auth.test.ts +221 -0
  6. package/src/helpers/auth.ts +27 -26
  7. package/src/helpers/identifiers.test.ts +76 -0
  8. package/src/helpers/identifiers.ts +1 -1
  9. package/src/helpers/index.ts +0 -1
  10. package/src/helpers/interop.ts +23 -16
  11. package/src/helpers/io.test.ts +228 -0
  12. package/src/helpers/io.ts +53 -73
  13. package/src/helpers/jsonld.ts +3 -3
  14. package/src/helpers/wac.test.ts +64 -0
  15. package/src/helpers/wac.ts +10 -6
  16. package/src/index.ts +3 -0
  17. package/src/models/SolidDocument.test.ts +77 -0
  18. package/src/models/SolidDocument.ts +14 -18
  19. package/src/models/SolidStore.ts +7 -7
  20. package/src/models/SolidThing.ts +5 -7
  21. package/.github/workflows/ci.yml +0 -16
  22. package/.nvmrc +0 -1
  23. package/CHANGELOG.md +0 -70
  24. package/dist/noeldemartin-solid-utils.cjs.js +0 -2
  25. package/dist/noeldemartin-solid-utils.cjs.js.map +0 -1
  26. package/dist/noeldemartin-solid-utils.esm.js +0 -2
  27. package/dist/noeldemartin-solid-utils.esm.js.map +0 -1
  28. package/dist/noeldemartin-solid-utils.umd.js +0 -90
  29. package/dist/noeldemartin-solid-utils.umd.js.map +0 -1
  30. package/noeldemartin.config.js +0 -9
  31. package/src/helpers/testing.ts +0 -190
  32. package/src/main.ts +0 -5
  33. package/src/plugins/chai/assertions.ts +0 -48
  34. package/src/plugins/chai/index.ts +0 -5
  35. package/src/plugins/cypress/types.d.ts +0 -16
  36. package/src/plugins/index.ts +0 -2
  37. package/src/plugins/jest/index.ts +0 -5
  38. package/src/plugins/jest/matchers.ts +0 -65
  39. package/src/plugins/jest/types.d.ts +0 -14
  40. package/src/testing/ResponseStub.ts +0 -46
  41. package/src/testing/index.ts +0 -2
  42. package/src/testing/mocking.ts +0 -33
@@ -1,24 +1,10 @@
1
- declare global {
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
- }
15
- import type { BlankNode } from 'rdf-js';
1
+ import { BlankNode } from '@rdfjs/types';
16
2
  import { JSError } from '@noeldemartin/utils';
17
- import type { JSErrorOptions } from '@noeldemartin/utils';
18
- import type { Literal } from 'rdf-js';
19
- import type { NamedNode } from 'rdf-js';
20
- import type { Quad } from 'rdf-js';
21
- import type { Variable } from 'rdf-js';
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';
22
8
 
23
9
  export declare type AnyFetch = (input: any, options?: any) => Promise<Response>;
24
10
 
@@ -38,13 +24,6 @@ export declare function createSolidDocument(url: string, body: string, fetch?: F
38
24
 
39
25
  export declare function defineIRIPrefix(name: string, value: string): void;
40
26
 
41
- export declare interface EqualityResult {
42
- success: boolean;
43
- message: string;
44
- expected: string;
45
- actual: string;
46
- }
47
-
48
27
  export declare function expandIRI(iri: string, options?: Partial<ExpandIRIOptions>): string;
49
28
 
50
29
  export declare interface ExpandIRIOptions {
@@ -60,11 +39,6 @@ export declare interface FetchLoginUserProfileOptions extends FetchUserProfileOp
60
39
  required?: boolean;
61
40
  }
62
41
 
63
- export declare interface FetchMockMethods {
64
- mockResponse(body?: string, headers?: Record<string, string>, status?: number): void;
65
- mockNotFoundResponse(): void;
66
- }
67
-
68
42
  export declare function fetchSolidDocument(url: string, options?: FetchSolidDocumentOptions): Promise<SolidDocument>;
69
43
 
70
44
  export declare function fetchSolidDocumentACL(documentUrl: string, fetch: Fetch): Promise<{
@@ -95,10 +69,6 @@ export declare function findContainerRegistrations(typeIndexUrl: string, type: s
95
69
  */
96
70
  export declare function findInstanceRegistrations(typeIndexUrl: string, type: string | string[], fetch?: Fetch): Promise<string[]>;
97
71
 
98
- export declare function installChaiPlugin(): void;
99
-
100
- export declare function installJestPlugin(): void;
101
-
102
72
  export declare function isJsonLDGraph(jsonld: JsonLD): jsonld is JsonLDGraph;
103
73
 
104
74
  export declare type JsonLD = Partial<{
@@ -109,8 +79,6 @@ export declare type JsonLD = Partial<{
109
79
  [k: string]: unknown;
110
80
  };
111
81
 
112
- export declare function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult>;
113
-
114
82
  export declare type JsonLDGraph = {
115
83
  '@context'?: Record<string, unknown>;
116
84
  '@graph': JsonLDResource[];
@@ -131,8 +99,6 @@ export declare class MalformedSolidDocumentError extends JSError {
131
99
 
132
100
  export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
133
101
 
134
- export declare function mockFetch<T = any>(): T;
135
-
136
102
  export declare class NetworkRequestError extends JSError {
137
103
  readonly url: string;
138
104
  constructor(url: string, options?: JSErrorOptions);
@@ -169,27 +135,6 @@ export declare interface RDFGraphData {
169
135
  containsRelativeIRIs: boolean;
170
136
  }
171
137
 
172
- export declare class ResponseStub implements Response {
173
- private rawBody;
174
- readonly body: ReadableStream<Uint8Array> | null;
175
- readonly bodyUsed: boolean;
176
- readonly headers: Headers;
177
- readonly ok: boolean;
178
- readonly redirected: boolean;
179
- readonly status: number;
180
- readonly statusText: string;
181
- readonly trailer: Promise<Headers>;
182
- readonly type: ResponseType;
183
- readonly url: string;
184
- constructor(rawBody?: string, headers?: Record<string, string>, status?: number);
185
- arrayBuffer(): Promise<ArrayBuffer>;
186
- blob(): Promise<Blob>;
187
- formData(): Promise<FormData>;
188
- json(): Promise<unknown>;
189
- text(): Promise<string>;
190
- clone(): Response;
191
- }
192
-
193
138
  export declare class SolidDocument extends SolidStore {
194
139
  readonly url: string;
195
140
  readonly headers: Headers;
@@ -253,8 +198,6 @@ export declare interface SolidUserProfile {
253
198
  privateTypeIndexUrl?: string;
254
199
  }
255
200
 
256
- export declare function sparqlEquals(expected: string, actual: string): EqualityResult;
257
-
258
201
  export declare function sparqlToQuads(sparql: string, options?: Partial<ParsingOptions>): Promise<Record<string, Quad[]>>;
259
202
 
260
203
  export declare function sparqlToQuadsSync(sparql: string, options?: Partial<ParsingOptions>): Record<string, Quad[]>;
@@ -267,8 +210,6 @@ export declare interface SubjectParts {
267
210
 
268
211
  export declare type Term = NamedNode | Literal | BlankNode | Quad | Variable;
269
212
 
270
- export declare function turtleEquals(expected: string, actual: string): EqualityResult;
271
-
272
213
  export declare function turtleToQuads(turtle: string, options?: Partial<ParsingOptions>): Promise<Quad[]>;
273
214
 
274
215
  export declare function turtleToQuadsSync(turtle: string, options?: Partial<ParsingOptions>): Quad[];