parent
a879b00b44
commit
453ee230f3
@ -0,0 +1,108 @@ |
|||||||
|
import { LdoJsonldContext } from "@ldo/ldo"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* solidContext: JSONLD Context for solid |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
export const solidContext: LdoJsonldContext = { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
Container: { |
||||||
|
"@id": "http://www.w3.org/ns/ldp#Container", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
modified: { |
||||||
|
"@id": "http://purl.org/dc/terms/modified", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
contains: { |
||||||
|
"@id": "http://www.w3.org/ns/ldp#contains", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
mtime: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
size: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#size", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
Resource: { |
||||||
|
"@id": "http://www.w3.org/ns/ldp#Resource", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
modified: { |
||||||
|
"@id": "http://purl.org/dc/terms/modified", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
contains: { |
||||||
|
"@id": "http://www.w3.org/ns/ldp#contains", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
mtime: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
size: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#size", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
modified: { |
||||||
|
"@id": "http://purl.org/dc/terms/modified", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
contains: { |
||||||
|
"@id": "http://www.w3.org/ns/ldp#contains", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
Resource2: { |
||||||
|
"@id": "http://www.w3.org/ns/iana/media-types/text/turtle#Resource", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
modified: { |
||||||
|
"@id": "http://purl.org/dc/terms/modified", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
mtime: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
size: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#size", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
mtime: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
size: { |
||||||
|
"@id": "http://www.w3.org/ns/posix/stat#size", |
||||||
|
"@type": "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
storage: { |
||||||
|
"@id": "http://www.w3.org/ns/pim/space#storage", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
}; |
@ -0,0 +1,233 @@ |
|||||||
|
import { Schema } from "shexj"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* solidSchema: ShexJ Schema for solid |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
export const solidSchema: Schema = { |
||||||
|
type: "Schema", |
||||||
|
shapes: [ |
||||||
|
{ |
||||||
|
id: "http://www.w3.org/ns/lddps#Container", |
||||||
|
type: "ShapeDecl", |
||||||
|
shapeExpr: { |
||||||
|
type: "Shape", |
||||||
|
expression: { |
||||||
|
id: "http://www.w3.org/ns/lddps#ContainerShape", |
||||||
|
type: "EachOf", |
||||||
|
expressions: [ |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
values: [ |
||||||
|
"http://www.w3.org/ns/ldp#Container", |
||||||
|
"http://www.w3.org/ns/ldp#Resource", |
||||||
|
], |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "A container on a Solid server", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://purl.org/dc/terms/modified", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "Date modified", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/ldp#contains", |
||||||
|
valueExpr: "http://www.w3.org/ns/lddps#Resource", |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "Defines a Solid Resource", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "?", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/posix/stat#size", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "size of this container", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "http://www.w3.org/ns/lddps#Resource", |
||||||
|
type: "ShapeDecl", |
||||||
|
shapeExpr: { |
||||||
|
type: "Shape", |
||||||
|
expression: { |
||||||
|
id: "http://www.w3.org/ns/lddps#ResourceShape", |
||||||
|
type: "EachOf", |
||||||
|
expressions: [ |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
values: [ |
||||||
|
"http://www.w3.org/ns/ldp#Resource", |
||||||
|
"http://www.w3.org/ns/iana/media-types/text/turtle#Resource", |
||||||
|
], |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "Any resource on a Solid server", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://purl.org/dc/terms/modified", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#string", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "Date modified", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/posix/stat#mtime", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#decimal", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "?", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/posix/stat#size", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
datatype: "http://www.w3.org/2001/XMLSchema#integer", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "size of this container", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "http://www.w3.org/ns/lddps#ProfileWithStorage", |
||||||
|
type: "ShapeDecl", |
||||||
|
shapeExpr: { |
||||||
|
type: "Shape", |
||||||
|
expression: { |
||||||
|
id: "http://www.w3.org/ns/lddps#ProfileWithStorageShape", |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/pim/space#storage", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
nodeKind: "iri", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
}, |
||||||
|
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}; |
@ -0,0 +1,37 @@ |
|||||||
|
import { ShapeType } from "@ldo/ldo"; |
||||||
|
import { solidSchema } from "./solid.schema"; |
||||||
|
import { solidContext } from "./solid.context"; |
||||||
|
import { Container, Resource, ProfileWithStorage } from "./solid.typings"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* LDO ShapeTypes solid |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Container ShapeType |
||||||
|
*/ |
||||||
|
export const ContainerShapeType: ShapeType<Container> = { |
||||||
|
schema: solidSchema, |
||||||
|
shape: "http://www.w3.org/ns/lddps#Container", |
||||||
|
context: solidContext, |
||||||
|
}; |
||||||
|
|
||||||
|
/** |
||||||
|
* Resource ShapeType |
||||||
|
*/ |
||||||
|
export const ResourceShapeType: ShapeType<Resource> = { |
||||||
|
schema: solidSchema, |
||||||
|
shape: "http://www.w3.org/ns/lddps#Resource", |
||||||
|
context: solidContext, |
||||||
|
}; |
||||||
|
|
||||||
|
/** |
||||||
|
* ProfileWithStorage ShapeType |
||||||
|
*/ |
||||||
|
export const ProfileWithStorageShapeType: ShapeType<ProfileWithStorage> = { |
||||||
|
schema: solidSchema, |
||||||
|
shape: "http://www.w3.org/ns/lddps#ProfileWithStorage", |
||||||
|
context: solidContext, |
||||||
|
}; |
@ -0,0 +1,84 @@ |
|||||||
|
import { LdoJsonldContext, LdSet } from "@ldo/ldo"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* Typescript Typings for solid |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Container Type |
||||||
|
*/ |
||||||
|
export interface Container { |
||||||
|
"@id"?: string; |
||||||
|
"@context"?: LdoJsonldContext; |
||||||
|
/** |
||||||
|
* A container on a Solid server |
||||||
|
*/ |
||||||
|
type?: LdSet< |
||||||
|
| { |
||||||
|
"@id": "Container"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Resource"; |
||||||
|
} |
||||||
|
>; |
||||||
|
/** |
||||||
|
* Date modified |
||||||
|
*/ |
||||||
|
modified?: string; |
||||||
|
/** |
||||||
|
* Defines a Solid Resource |
||||||
|
*/ |
||||||
|
contains?: LdSet<Resource>; |
||||||
|
/** |
||||||
|
* ? |
||||||
|
*/ |
||||||
|
mtime?: number; |
||||||
|
/** |
||||||
|
* size of this container |
||||||
|
*/ |
||||||
|
size?: number; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Resource Type |
||||||
|
*/ |
||||||
|
export interface Resource { |
||||||
|
"@id"?: string; |
||||||
|
"@context"?: LdoJsonldContext; |
||||||
|
/** |
||||||
|
* Any resource on a Solid server |
||||||
|
*/ |
||||||
|
type?: LdSet< |
||||||
|
| { |
||||||
|
"@id": "Resource"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Resource2"; |
||||||
|
} |
||||||
|
>; |
||||||
|
/** |
||||||
|
* Date modified |
||||||
|
*/ |
||||||
|
modified?: string; |
||||||
|
/** |
||||||
|
* ? |
||||||
|
*/ |
||||||
|
mtime?: number; |
||||||
|
/** |
||||||
|
* size of this container |
||||||
|
*/ |
||||||
|
size?: number; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* ProfileWithStorage Type |
||||||
|
*/ |
||||||
|
export interface ProfileWithStorage { |
||||||
|
"@id"?: string; |
||||||
|
"@context"?: LdoJsonldContext; |
||||||
|
storage?: LdSet<{ |
||||||
|
"@id": string; |
||||||
|
}>; |
||||||
|
} |
@ -0,0 +1,78 @@ |
|||||||
|
import { LdoJsonldContext } from "@ldo/ldo"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* wacContext: JSONLD Context for wac |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
export const wacContext: LdoJsonldContext = { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
}, |
||||||
|
Authorization: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#Authorization", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
}, |
||||||
|
accessTo: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#accessTo", |
||||||
|
"@type": "@id", |
||||||
|
}, |
||||||
|
default: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#default", |
||||||
|
"@type": "@id", |
||||||
|
}, |
||||||
|
agent: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agent", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
agentGroup: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agentGroup", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
agentClass: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agentClass", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
mode: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#mode", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
accessTo: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#accessTo", |
||||||
|
"@type": "@id", |
||||||
|
}, |
||||||
|
default: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#default", |
||||||
|
"@type": "@id", |
||||||
|
}, |
||||||
|
agent: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agent", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
agentGroup: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agentGroup", |
||||||
|
"@type": "@id", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
agentClass: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#agentClass", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
AuthenticatedAgent: "http://www.w3.org/ns/auth/acl#AuthenticatedAgent", |
||||||
|
Agent: "http://xmlns.com/foaf/0.1/Agent", |
||||||
|
mode: { |
||||||
|
"@id": "http://www.w3.org/ns/auth/acl#mode", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
Read: "http://www.w3.org/ns/auth/acl#Read", |
||||||
|
Write: "http://www.w3.org/ns/auth/acl#Write", |
||||||
|
Append: "http://www.w3.org/ns/auth/acl#Append", |
||||||
|
Control: "http://www.w3.org/ns/auth/acl#Control", |
||||||
|
}; |
@ -0,0 +1,169 @@ |
|||||||
|
import { Schema } from "shexj"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* wacSchema: ShexJ Schema for wac |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
export const wacSchema: Schema = { |
||||||
|
type: "Schema", |
||||||
|
shapes: [ |
||||||
|
{ |
||||||
|
id: "http://www.w3.org/ns/auth/acls#Authorization", |
||||||
|
type: "ShapeDecl", |
||||||
|
shapeExpr: { |
||||||
|
type: "Shape", |
||||||
|
expression: { |
||||||
|
id: "http://www.w3.org/ns/auth/acls#AuthorizationShape", |
||||||
|
type: "EachOf", |
||||||
|
expressions: [ |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
values: ["http://www.w3.org/ns/auth/acl#Authorization"], |
||||||
|
}, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "Denotes this as an acl:Authorization", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#accessTo", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
nodeKind: "iri", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "The subject of this authorization", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#default", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
nodeKind: "iri", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: 1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: "The container subject of this authorization", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#agent", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
nodeKind: "iri", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: |
||||||
|
"An agent is a person, social entity or software identified by a URI, e.g., a WebID denotes an agent", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#agentGroup", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
nodeKind: "iri", |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: |
||||||
|
"Denotes a group of agents being given the access permission", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#agentClass", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
values: [ |
||||||
|
"http://www.w3.org/ns/auth/acl#AuthenticatedAgent", |
||||||
|
"http://xmlns.com/foaf/0.1/Agent", |
||||||
|
], |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: |
||||||
|
"An agent class is a class of persons or entities identified by a URI.", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
type: "TripleConstraint", |
||||||
|
predicate: "http://www.w3.org/ns/auth/acl#mode", |
||||||
|
valueExpr: { |
||||||
|
type: "NodeConstraint", |
||||||
|
values: [ |
||||||
|
"http://www.w3.org/ns/auth/acl#Read", |
||||||
|
"http://www.w3.org/ns/auth/acl#Write", |
||||||
|
"http://www.w3.org/ns/auth/acl#Append", |
||||||
|
"http://www.w3.org/ns/auth/acl#Control", |
||||||
|
], |
||||||
|
}, |
||||||
|
min: 0, |
||||||
|
max: -1, |
||||||
|
annotations: [ |
||||||
|
{ |
||||||
|
type: "Annotation", |
||||||
|
predicate: "http://www.w3.org/2000/01/rdf-schema#comment", |
||||||
|
object: { |
||||||
|
value: |
||||||
|
"Denotes a class of operations that the agents can perform on a resource.", |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], |
||||||
|
}, |
||||||
|
}, |
||||||
|
], |
||||||
|
}; |
@ -0,0 +1,19 @@ |
|||||||
|
import { ShapeType } from "@ldo/ldo"; |
||||||
|
import { wacSchema } from "./wac.schema"; |
||||||
|
import { wacContext } from "./wac.context"; |
||||||
|
import { Authorization } from "./wac.typings"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* LDO ShapeTypes wac |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Authorization ShapeType |
||||||
|
*/ |
||||||
|
export const AuthorizationShapeType: ShapeType<Authorization> = { |
||||||
|
schema: wacSchema, |
||||||
|
shape: "http://www.w3.org/ns/auth/acls#Authorization", |
||||||
|
context: wacContext, |
||||||
|
}; |
@ -0,0 +1,73 @@ |
|||||||
|
import { LdoJsonldContext, LdSet } from "@ldo/ldo"; |
||||||
|
|
||||||
|
/** |
||||||
|
* ============================================================================= |
||||||
|
* Typescript Typings for wac |
||||||
|
* ============================================================================= |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Authorization Type |
||||||
|
*/ |
||||||
|
export interface Authorization { |
||||||
|
"@id"?: string; |
||||||
|
"@context"?: LdoJsonldContext; |
||||||
|
/** |
||||||
|
* Denotes this as an acl:Authorization |
||||||
|
*/ |
||||||
|
type: { |
||||||
|
"@id": "Authorization"; |
||||||
|
}; |
||||||
|
/** |
||||||
|
* The subject of this authorization |
||||||
|
*/ |
||||||
|
accessTo?: { |
||||||
|
"@id": string; |
||||||
|
}; |
||||||
|
/** |
||||||
|
* The container subject of this authorization |
||||||
|
*/ |
||||||
|
default?: { |
||||||
|
"@id": string; |
||||||
|
}; |
||||||
|
/** |
||||||
|
* An agent is a person, social entity or software identified by a URI, e.g., a WebID denotes an agent |
||||||
|
*/ |
||||||
|
agent?: LdSet<{ |
||||||
|
"@id": string; |
||||||
|
}>; |
||||||
|
/** |
||||||
|
* Denotes a group of agents being given the access permission |
||||||
|
*/ |
||||||
|
agentGroup?: LdSet<{ |
||||||
|
"@id": string; |
||||||
|
}>; |
||||||
|
/** |
||||||
|
* An agent class is a class of persons or entities identified by a URI. |
||||||
|
*/ |
||||||
|
agentClass?: LdSet< |
||||||
|
| { |
||||||
|
"@id": "AuthenticatedAgent"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Agent"; |
||||||
|
} |
||||||
|
>; |
||||||
|
/** |
||||||
|
* Denotes a class of operations that the agents can perform on a resource. |
||||||
|
*/ |
||||||
|
mode?: LdSet< |
||||||
|
| { |
||||||
|
"@id": "Read"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Write"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Append"; |
||||||
|
} |
||||||
|
| { |
||||||
|
"@id": "Control"; |
||||||
|
} |
||||||
|
>; |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> |
||||||
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
||||||
|
PREFIX ldp: <http://www.w3.org/ns/ldp#> |
||||||
|
PREFIX ldps: <http://www.w3.org/ns/lddps#> |
||||||
|
PREFIX dct: <http://purl.org/dc/terms/> |
||||||
|
PREFIX stat: <http://www.w3.org/ns/posix/stat#> |
||||||
|
PREFIX tur: <http://www.w3.org/ns/iana/media-types/text/turtle#> |
||||||
|
PREFIX pim: <http://www.w3.org/ns/pim/space#> |
||||||
|
|
||||||
|
ldps:Container EXTRA a { |
||||||
|
$ldps:ContainerShape ( |
||||||
|
a [ ldp:Container ldp:Resource ]* |
||||||
|
// rdfs:comment "A container on a Solid server"; |
||||||
|
dct:modified xsd:string? |
||||||
|
// rdfs:comment "Date modified"; |
||||||
|
ldp:contains @ldps:Resource* |
||||||
|
// rdfs:comment "Defines a Solid Resource"; |
||||||
|
stat:mtime xsd:decimal? |
||||||
|
// rdfs:comment "?"; |
||||||
|
stat:size xsd:integer? |
||||||
|
// rdfs:comment "size of this container"; |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
ldps:Resource EXTRA a { |
||||||
|
$ldps:ResourceShape ( |
||||||
|
a [ ldp:Resource tur:Resource ]* |
||||||
|
// rdfs:comment "Any resource on a Solid server"; |
||||||
|
dct:modified xsd:string? |
||||||
|
// rdfs:comment "Date modified"; |
||||||
|
stat:mtime xsd:decimal? |
||||||
|
// rdfs:comment "?"; |
||||||
|
stat:size xsd:integer? |
||||||
|
// rdfs:comment "size of this container"; |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
ldps:ProfileWithStorage EXTRA a { |
||||||
|
$ldps:ProfileWithStorageShape ( |
||||||
|
pim:storage IRI *; |
||||||
|
) |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
PREFIX acl: <http://www.w3.org/ns/auth/acl#> |
||||||
|
PREFIX acls: <http://www.w3.org/ns/auth/acls#> |
||||||
|
PREFIX foaf: <http://xmlns.com/foaf/0.1/> |
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
||||||
|
|
||||||
|
acls:Authorization EXTRA a { |
||||||
|
$acls:AuthorizationShape ( |
||||||
|
a [ acl:Authorization ] |
||||||
|
// rdfs:comment "Denotes this as an acl:Authorization"; |
||||||
|
acl:accessTo IRI? |
||||||
|
// rdfs:comment "The subject of this authorization"; |
||||||
|
acl:default IRI? |
||||||
|
// rdfs:comment "The container subject of this authorization"; |
||||||
|
acl:agent IRI* |
||||||
|
// rdfs:comment "An agent is a person, social entity or software identified by a URI, e.g., a WebID denotes an agent"; |
||||||
|
acl:agentGroup IRI* |
||||||
|
// rdfs:comment "Denotes a group of agents being given the access permission"; |
||||||
|
acl:agentClass [ acl:AuthenticatedAgent foaf:Agent ]* |
||||||
|
// rdfs:comment "An agent class is a class of persons or entities identified by a URI."; |
||||||
|
acl:mode [ acl:Read acl:Write acl:Append acl:Control ]* |
||||||
|
// rdfs:comment "Denotes a class of operations that the agents can perform on a resource."; |
||||||
|
) |
||||||
|
} |
@ -1,19 +0,0 @@ |
|||||||
import { ConnectedLdoDataset } from "@ldo/connected"; |
|
||||||
import { solidConnectedPlugin } from "./SolidConnectedPlugin"; |
|
||||||
import { createDatasetFactory } from "@ldo/dataset"; |
|
||||||
import { createTransactionDatasetFactory } from "@ldo/subscribable-dataset"; |
|
||||||
|
|
||||||
const dataset = new ConnectedLdoDataset( |
|
||||||
[solidConnectedPlugin], |
|
||||||
createDatasetFactory(), |
|
||||||
createTransactionDatasetFactory(), |
|
||||||
); |
|
||||||
|
|
||||||
const stringId: string = "blah"; |
|
||||||
const allResources = dataset.getResource(stringId); |
|
||||||
const containerResource = dataset.getResource("https://example.com/container/"); |
|
||||||
const leafResource = dataset.getResource( |
|
||||||
"https://example.com/container/index.ttl", |
|
||||||
); |
|
||||||
|
|
||||||
const nextGraphResource = dataset.getResource("did:ng:cool"); |
|
@ -1,13 +1,22 @@ |
|||||||
import type { ResourceSuccess } from "../../../requester/results/success/SuccessResult"; |
import { ResourceSuccess } from "@ldo/connected"; |
||||||
import type { WacRule } from "../WacRule"; |
import type { WacRule } from "../WacRule"; |
||||||
|
import type { SolidLeaf } from "../../resources/SolidLeaf"; |
||||||
|
import type { SolidContainer } from "../../resources/SolidContainer"; |
||||||
|
|
||||||
/** |
/** |
||||||
* Returned when a WAC rule is successfully retrieved |
* Returned when a WAC rule is successfully retrieved |
||||||
*/ |
*/ |
||||||
export interface GetWacRuleSuccess extends ResourceSuccess { |
export class GetWacRuleSuccess< |
||||||
type: "getWacRuleSuccess"; |
ResourceType extends SolidLeaf | SolidContainer, |
||||||
|
> extends ResourceSuccess<ResourceType> { |
||||||
|
type = "getWacRuleSuccess" as const; |
||||||
/** |
/** |
||||||
* The rule that was retrieved |
* The rule that was retrieved |
||||||
*/ |
*/ |
||||||
wacRule: WacRule; |
wacRule: WacRule; |
||||||
|
|
||||||
|
constructor(resoure: ResourceType, wacRule: WacRule) { |
||||||
|
super(resoure); |
||||||
|
this.wacRule = wacRule; |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,13 +1,22 @@ |
|||||||
import type { ResourceSuccess } from "../../../requester/results/success/SuccessResult"; |
import { ResourceSuccess } from "@ldo/connected"; |
||||||
import type { LeafUri } from "../../../util/uriTypes"; |
import type { SolidLeafUri } from "../../types"; |
||||||
|
import type { SolidContainer } from "../../resources/SolidContainer"; |
||||||
|
import type { SolidLeaf } from "../../resources/SolidLeaf"; |
||||||
|
|
||||||
/** |
/** |
||||||
* Returned when the URI for a resources ACL document was successfully retried |
* Returned when the URI for a resources ACL document was successfully retried |
||||||
*/ |
*/ |
||||||
export interface GetWacUriSuccess extends ResourceSuccess { |
export class GetWacUriSuccess< |
||||||
type: "getWacUriSuccess"; |
ResourceType extends SolidContainer | SolidLeaf, |
||||||
|
> extends ResourceSuccess<ResourceType> { |
||||||
|
type = "getWacUriSuccess" as const; |
||||||
/** |
/** |
||||||
* The URI of the ACL document |
* The URI of the ACL document |
||||||
*/ |
*/ |
||||||
wacUri: LeafUri; |
wacUri: SolidLeafUri; |
||||||
|
|
||||||
|
constructor(resource: ResourceType, wacUri: SolidLeafUri) { |
||||||
|
super(resource); |
||||||
|
this.wacUri = wacUri; |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,13 +1,22 @@ |
|||||||
import type { ResourceSuccess } from "../../../requester/results/success/SuccessResult"; |
import { ResourceSuccess } from "@ldo/connected"; |
||||||
import type { WacRule } from "../WacRule"; |
import type { WacRule } from "../WacRule"; |
||||||
|
import type { SolidContainer } from "../../resources/SolidContainer"; |
||||||
|
import type { SolidLeaf } from "../../resources/SolidLeaf"; |
||||||
|
|
||||||
/** |
/** |
||||||
* Returned when rules were successfully written |
* Returned when rules were successfully written |
||||||
*/ |
*/ |
||||||
export interface SetWacRuleSuccess extends ResourceSuccess { |
export class SetWacRuleSuccess< |
||||||
type: "setWacRuleSuccess"; |
ResourceType extends SolidLeaf | SolidContainer, |
||||||
|
> extends ResourceSuccess<ResourceType> { |
||||||
|
type = "setWacRuleSuccess" as const; |
||||||
/** |
/** |
||||||
* The written rule |
* The written rule |
||||||
*/ |
*/ |
||||||
wacRule: WacRule; |
wacRule: WacRule; |
||||||
|
|
||||||
|
constructor(resource: ResourceType, wacRule: WacRule) { |
||||||
|
super(resource); |
||||||
|
this.wacRule = wacRule; |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,8 +1,12 @@ |
|||||||
import type { ResourceSuccess } from "../../../requester/results/success/SuccessResult"; |
import { ResourceSuccess } from "@ldo/connected"; |
||||||
|
import type { SolidLeaf } from "../../resources/SolidLeaf"; |
||||||
|
import type { SolidContainer } from "../../resources/SolidContainer"; |
||||||
|
|
||||||
/** |
/** |
||||||
* Returned if no WAC rule was returned from the server |
* Returned if no WAC rule was returned from the server |
||||||
*/ |
*/ |
||||||
export interface WacRuleAbsent extends ResourceSuccess { |
export class WacRuleAbsent< |
||||||
type: "wacRuleAbsent"; |
ResourceType extends SolidLeaf | SolidContainer, |
||||||
|
> extends ResourceSuccess<ResourceType> { |
||||||
|
type = "wacRuleAbsent" as const; |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue