1 | /**
|
2 | * Copyright 2020 Inrupt Inc.
|
3 | *
|
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 | * of this software and associated documentation files (the "Software"), to deal in
|
6 | * the Software without restriction, including without limitation the rights to use,
|
7 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
8 | * Software, and to permit persons to whom the Software is furnished to do so,
|
9 | * subject to the following conditions:
|
10 | *
|
11 | * The above copyright notice and this permission notice shall be included in
|
12 | * all copies or substantial portions of the Software.
|
13 | *
|
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
15 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
16 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
17 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
18 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
19 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20 | */
|
21 | import { DatasetCore, NamedNode } from "rdf-js";
|
22 | /**
|
23 | * Alias to indicate where we expect to be given a URL represented as an RDF/JS NamedNode.
|
24 | */
|
25 | export declare type Url = NamedNode;
|
26 | /** @hidden Alias of Url for those who prefer to use IRI terminology. */
|
27 | export declare type Iri = Url;
|
28 | /**
|
29 | * Alias to indicate where we expect to be given a URL.
|
30 | */
|
31 | export declare type UrlString = string;
|
32 | /** @hidden Alias of UrlString for those who prefer to use IRI terminology. */
|
33 | export declare type IriString = UrlString;
|
34 | /**
|
35 | * Alias to indicate where we expect to be given a WebId.
|
36 | */
|
37 | export declare type WebId = UrlString;
|
38 | /**
|
39 | * A LitDataset represents all Quads from a single Resource.
|
40 | */
|
41 | export declare type LitDataset = DatasetCore;
|
42 | /**
|
43 | * A Thing represents all Quads with a given Subject URL and a given Named
|
44 | * Graph, from a single Resource.
|
45 | */
|
46 | export declare type Thing = DatasetCore & ({
|
47 | url: UrlString;
|
48 | } | {
|
49 | name: string;
|
50 | });
|
51 | /**
|
52 | * A [[Thing]] for which we know what the full Subject URL is.
|
53 | */
|
54 | export declare type ThingPersisted = Thing & {
|
55 | url: UrlString;
|
56 | };
|
57 | /**
|
58 | * A [[Thing]] whose full Subject URL will be determined when it is persisted.
|
59 | */
|
60 | export declare type ThingLocal = Thing & {
|
61 | name: string;
|
62 | };
|
63 | /**
|
64 | * A [[LitDataset]] containing Access Control rules for another LitDataset.
|
65 | *
|
66 | * Please note that the Web Access Control specification is not yet finalised, and hence, this
|
67 | * function is still experimental and can change in a non-major release.
|
68 | */
|
69 | export declare type unstable_AclDataset = LitDataset & DatasetInfo & {
|
70 | accessTo: UrlString;
|
71 | };
|
72 | /**
|
73 | * @hidden Developers shouldn't need to directly access ACL rules. Instead, we provide our own functions that verify what access someone has.
|
74 | */
|
75 | export declare type unstable_AclRule = Thing;
|
76 | /**
|
77 | * An object with the boolean properties `read`, `append`, `write` and `control`, representing the
|
78 | * respective Access Modes defined by the Web Access Control specification.
|
79 | *
|
80 | * Since that specification is not finalised yet, this interface is still experimental.
|
81 | */
|
82 | export declare type unstable_AccessModes = {
|
83 | read: boolean;
|
84 | append: true;
|
85 | write: true;
|
86 | control: boolean;
|
87 | } | {
|
88 | read: boolean;
|
89 | append: boolean;
|
90 | write: false;
|
91 | control: boolean;
|
92 | };
|
93 | declare type unstable_WacAllow = {
|
94 | user: unstable_AccessModes;
|
95 | public: unstable_AccessModes;
|
96 | };
|
97 | /**
|
98 | * [[LitDataset]]s fetched by lit-pod include this metadata describing its relation to a Pod Resource.
|
99 | */
|
100 | export declare type DatasetInfo = {
|
101 | datasetInfo: {
|
102 | fetchedFrom: UrlString;
|
103 | /**
|
104 | * The URL reported by the server as possibly containing an ACL file. Note that this file might
|
105 | * not necessarily exist, in which case the ACL of the nearest Container with an ACL applies.
|
106 | *
|
107 | * @ignore We anticipate the Solid spec to change how the ACL gets accessed, which would result
|
108 | * in this API changing as well.
|
109 | */
|
110 | unstable_aclUrl?: UrlString;
|
111 | /**
|
112 | * Access permissions for the current user and the general public for this resource.
|
113 | *
|
114 | * @ignore There is no consensus yet about how this functionality will be incorporated in the
|
115 | * final spec, so the final implementation might influence this API in the future.
|
116 | * @see https://github.com/solid/solid-spec/blob/cb1373a369398d561b909009bd0e5a8c3fec953b/api-rest.md#wac-allow-headers
|
117 | * @see https://github.com/solid/specification/issues/171
|
118 | */
|
119 | unstable_permissions?: unstable_WacAllow;
|
120 | };
|
121 | };
|
122 | /**
|
123 | * @hidden Developers should use [[unstable_getResourceAcl]] and [[unstable_getFallbackAcl]] to access these.
|
124 | */
|
125 | export declare type unstable_Acl = {
|
126 | acl: {
|
127 | resourceAcl?: unstable_AclDataset;
|
128 | fallbackAcl: unstable_AclDataset | null;
|
129 | };
|
130 | };
|
131 | /**
|
132 | * Verify whether a given LitDataset includes metadata about where it was retrieved from.
|
133 | *
|
134 | * @param dataset A [[LitDataset]] that may have metadata attached about the Resource it was retrieved from.
|
135 | * @returns True if `dataset` includes metadata about the Resource it was retrieved from, false if not.
|
136 | */
|
137 | export declare function hasDatasetInfo<T extends LitDataset>(dataset: T): dataset is T & DatasetInfo;
|
138 | /**
|
139 | * A RequestInit restriction where the method is set by the library
|
140 | */
|
141 | export declare type unstable_UploadRequestInit = Omit<RequestInit, "method">;
|
142 | export {};
|